From c2da26d4b92221fdd54fdd8ff37c437529616b21 Mon Sep 17 00:00:00 2001 From: Dhruv Kelawala Date: Mon, 19 Sep 2022 15:12:42 +0100 Subject: [PATCH] fix: fix tests for starknet 0.10 --- .github/workflows/pr.yml | 28 ++++++++++++++++++++++++++-- src/account/default.ts | 5 ++++- src/contract/default.ts | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 83493eb03..4e5007e1e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -19,8 +19,29 @@ jobs: - run: npm ci - run: npm run build --if-present + - uses: actions/upload-artifact@v2 + with: + name: build + path: dist + tests: - name: Run test + strategy: + max-parallel: 1 # needed until we get a seperate account for the rpc provider, until then running them in parallel would result in a nonce issue + matrix: + name: [sequencer-test, sequencer-goerli, rpc-goerli] + include: + - name: sequencer-test + TEST_PROVIDER_BASE_URL: http://127.0.0.1:5050/ + - name: sequencer-goerli + TEST_PROVIDER_BASE_URL: https://alpha4.starknet.io + ENABLE_TEST_ACCOUNT_PRIVATE_KEY: true + ENABLE_TEST_ACCOUNT_ADDRESS: true + - name: rpc-goerli + ENABLE_TEST_RPC_URL: true + ENABLE_TEST_ACCOUNT_PRIVATE_KEY: true + ENABLE_TEST_ACCOUNT_ADDRESS: true + + name: Run test on ${{ matrix.name }} runs-on: ubuntu-latest needs: [build] @@ -30,7 +51,10 @@ jobs: ports: - 5050:5050 env: - TEST_PROVIDER_BASE_URL: http://127.0.0.1:5050/ + TEST_PROVIDER_BASE_URL: ${{ matrix.TEST_PROVIDER_BASE_URL }} + TEST_RPC_URL: ${{ matrix.ENABLE_TEST_RPC_URL && secrets.TEST_RPC_URL }} + TEST_ACCOUNT_PRIVATE_KEY: ${{ matrix.ENABLE_TEST_ACCOUNT_PRIVATE_KEY && secrets.TEST_ACCOUNT_PRIVATE_KEY }} + TEST_ACCOUNT_ADDRESS: ${{ matrix.ENABLE_TEST_ACCOUNT_ADDRESS && secrets.TEST_ACCOUNT_ADDRESS }} steps: - uses: actions/checkout@v2 diff --git a/src/account/default.ts b/src/account/default.ts index d5eaebeea..e82646fd4 100644 --- a/src/account/default.ts +++ b/src/account/default.ts @@ -23,12 +23,15 @@ import { AccountInterface } from './interface'; export class Account extends Provider implements AccountInterface { public signer: SignerInterface; + public address: string; + constructor( providerOrOptions: ProviderOptions | ProviderInterface, - public address: string, + address: string, keyPairOrSigner: KeyPair | SignerInterface ) { super(providerOrOptions); + this.address = address.toLowerCase(); this.signer = 'getPubKey' in keyPairOrSigner ? keyPairOrSigner : new Signer(keyPairOrSigner as KeyPair); } diff --git a/src/contract/default.ts b/src/contract/default.ts index 0f70fdee2..244154f88 100644 --- a/src/contract/default.ts +++ b/src/contract/default.ts @@ -125,7 +125,7 @@ export class Contract implements ContractInterface { address: string, providerOrAccount: ProviderInterface | AccountInterface = defaultProvider ) { - this.address = address; + this.address = address.toLowerCase(); this.providerOrAccount = providerOrAccount; this.abi = abi; this.structs = abi