Skip to content

Commit fa07849

Browse files
authored
Merge pull request #6 from amanusk/v6-beta
Migration to new starknet.js V6
2 parents eec748d + 1c0b719 commit fa07849

19 files changed

+1895
-272
lines changed

.env.example

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
MNEMONIC="test test test test test test test test test test test junk"
2-
TOKEN_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
3-
STARKNET_RPC_URL="https://starknet-goerli.infura.io/v3/<infura_api_key>"
2+
STARKNET_RPC_URL="https://starknet-sepolia.infura.io/v3/<infura_api_key>"
3+
ACCOUNT_CLASS_HASH = "0x0450f568a8cb6ea1bcce446355e8a1c2e5852a6b8dc3536f495cdceb62e8a7e2"

.github/workflows/test.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Tests
2+
3+
env:
4+
DEVNET_SHA: "c6ffb99"
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
- develop
11+
pull_request:
12+
branches:
13+
- main
14+
- develop
15+
workflow_dispatch:
16+
17+
jobs:
18+
run-tests:
19+
20+
# This job runs on Ubuntu-latest, but you can choose other runners if needed
21+
runs-on: ubuntu-latest
22+
23+
strategy:
24+
matrix:
25+
node-version: [18.x, 20.x] # Define Node.js versions to test against
26+
27+
# Steps represent a sequence of tasks that will be executed as part of the job
28+
steps:
29+
- uses: actions/checkout@v3 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
30+
31+
- uses: actions-rust-lang/setup-rust-toolchain@v1
32+
33+
- name: Use Node.js ${{ matrix.node-version }}
34+
uses: actions/setup-node@v2
35+
with:
36+
node-version: ${{ matrix.node-version }}
37+
cache: 'yarn' # Caches dependencies to speed up workflows
38+
39+
- name: Install Devnet
40+
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}
41+
42+
- name: Run Devnet in background
43+
run: nohup starknet-devnet --seed 0 & sleep 2
44+
45+
46+
- name: Install dependencies
47+
run: yarn install # Installs dependencies defined in package.json
48+
49+
- name: Run tests
50+
run: yarn test # Runs your test script defined in package.json

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ node_modules
55
.env-*
66

77
package-lock.json
8-
yarn.lock
98

109
node.json
1110
yarn-error.log

README.md

+8-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The tool supports:
77
- Deterministic address derivation for StarkNet contract given a seed phrase and class hash
88
- Generate a new seed and deploy a contract to a predefined address
99
- At default works with the latest trialed-and-tested OZ contract
10+
- Set any contract class in .env file
1011

1112
## Installation
1213

@@ -30,20 +31,22 @@ yarn install
3031
## Testing
3132

3233
To run integrations test with `starknet-devent`, run `starknet-devnet --seed 0` in another terminal.
33-
Use `starknet-devnet>=0.5.3`
34+
Use `starknet-devnet-rs`
3435

3536
```
3637
yarn test
3738
```
3839

39-
More testing is required
40-
4140
Copy the resulting seed, public key and address to an `.env` file
4241

4342
## .env file
4443

4544
See example .env file for how to configure the wallet
4645

47-
## Fee Token Addresses
46+
## Running
47+
48+
Run help for options
4849

49-
The fee token accorss all networks is ETH 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
50+
```
51+
ts-node ./src/index.ts --help
52+
```

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "starknet-cli-wallet",
3-
"version": "0.0.1",
3+
"version": "0.2.0",
44
"description": "Example of a starknet wallet implemented with starknetjs",
55
"main": "index.js",
66
"types": "./dist/types/index.d.ts",
@@ -12,16 +12,17 @@
1212
"author": "amanusk",
1313
"license": "MIT",
1414
"dependencies": {
15+
"@scure/starknet": "^1.0.0",
1516
"@types/commander": "^2.12.2",
1617
"abi-wan-kanabi": "^2.0.0",
1718
"commander": "^8.2.0",
1819
"dotenv": "^10.0.0",
1920
"ethers": "^6.3.0",
20-
"micro-starknet": "^0.2.3",
21-
"starknet": "^5.25.0",
22-
"starkscan": "^0.0.9"
21+
"starknet": "^6.6.0"
2322
},
2423
"devDependencies": {
24+
"@types/chai": "^4.3.14",
25+
"@types/mocha": "^10.0.6",
2526
"@types/node": "^16.9.2",
2627
"chai": "^4.3.7",
2728
"eslint": "^7.32.0",

scripts/deploy-and-fund.ts

-39
This file was deleted.

scripts/deploy-prefunded.ts

-46
This file was deleted.

scripts/deploy.ts

-21
This file was deleted.

scripts/test-block.ts

-20
This file was deleted.

src/ProviderConfig.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import { RpcProvider, ProviderInterface, SequencerProvider } from "starknet";
1+
import { RpcProvider, ProviderInterface } from "starknet";
22

33
export function getProvider(nodeUrl: string): ProviderInterface {
44
const provider = new RpcProvider({
55
nodeUrl,
66
});
7-
// const provider = new SequencerProvider({
8-
// baseUrl: nodeUrl,
9-
// });
107
return provider;
118
}

0 commit comments

Comments
 (0)