Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to new starknet.js V6 #6

Merged
merged 19 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
MNEMONIC="test test test test test test test test test test test junk"
TOKEN_ADDRESS=0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
STARKNET_RPC_URL="https://starknet-goerli.infura.io/v3/<infura_api_key>"
STARKNET_RPC_URL="https://starknet-sepolia.infura.io/v3/<infura_api_key>"
ACCOUNT_CLASS_HASH = "0x0450f568a8cb6ea1bcce446355e8a1c2e5852a6b8dc3536f495cdceb62e8a7e2"
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Tests

env:
DEVNET_SHA: "c6ffb99"

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
workflow_dispatch:

jobs:
run-tests:

# This job runs on Ubuntu-latest, but you can choose other runners if needed
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x] # Define Node.js versions to test against

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it

- uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn' # Caches dependencies to speed up workflows

- name: Install Devnet
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}

- name: Run Devnet in background
run: nohup starknet-devnet --seed 0 & sleep 2


- name: Install dependencies
run: yarn install # Installs dependencies defined in package.json

- name: Run tests
run: yarn test # Runs your test script defined in package.json
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules
.env-*

package-lock.json
yarn.lock

node.json
yarn-error.log
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The tool supports:
- Deterministic address derivation for StarkNet contract given a seed phrase and class hash
- Generate a new seed and deploy a contract to a predefined address
- At default works with the latest trialed-and-tested OZ contract
- Set any contract class in .env file

## Installation

Expand All @@ -30,20 +31,22 @@ yarn install
## Testing

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

```
yarn test
```

More testing is required

Copy the resulting seed, public key and address to an `.env` file

## .env file

See example .env file for how to configure the wallet

## Fee Token Addresses
## Running

Run help for options

The fee token accorss all networks is ETH 0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7
```
ts-node ./src/index.ts --help
```
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starknet-cli-wallet",
"version": "0.0.1",
"version": "0.2.0",
"description": "Example of a starknet wallet implemented with starknetjs",
"main": "index.js",
"types": "./dist/types/index.d.ts",
Expand All @@ -12,16 +12,17 @@
"author": "amanusk",
"license": "MIT",
"dependencies": {
"@scure/starknet": "^1.0.0",
"@types/commander": "^2.12.2",
"abi-wan-kanabi": "^2.0.0",
"commander": "^8.2.0",
"dotenv": "^10.0.0",
"ethers": "^6.3.0",
"micro-starknet": "^0.2.3",
"starknet": "^5.25.0",
"starkscan": "^0.0.9"
"starknet": "^6.6.0"
},
"devDependencies": {
"@types/chai": "^4.3.14",
"@types/mocha": "^10.0.6",
"@types/node": "^16.9.2",
"chai": "^4.3.7",
"eslint": "^7.32.0",
Expand Down
39 changes: 0 additions & 39 deletions scripts/deploy-and-fund.ts

This file was deleted.

46 changes: 0 additions & 46 deletions scripts/deploy-prefunded.ts

This file was deleted.

21 changes: 0 additions & 21 deletions scripts/deploy.ts

This file was deleted.

20 changes: 0 additions & 20 deletions scripts/test-block.ts

This file was deleted.

5 changes: 1 addition & 4 deletions src/ProviderConfig.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { RpcProvider, ProviderInterface, SequencerProvider } from "starknet";
import { RpcProvider, ProviderInterface } from "starknet";

export function getProvider(nodeUrl: string): ProviderInterface {
const provider = new RpcProvider({
nodeUrl,
});
// const provider = new SequencerProvider({
// baseUrl: nodeUrl,
// });
return provider;
}
Loading
Loading