Skip to content

Commit

Permalink
fix: fix tests for starknet 0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dhruvkelawala committed Sep 19, 2022
1 parent fc2fcbb commit c2da26d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/contract/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c2da26d

Please sign in to comment.