Skip to content

Commit

Permalink
fix: waitfortransaction usage
Browse files Browse the repository at this point in the history
  • Loading branch information
tabaktoni committed Dec 2, 2022
1 parent bb2a8cd commit 67c2031
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions __tests__/account.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('deploy and test Wallet', () => {
calldata: [erc20.address, '10', '0'],
});

await provider.waitForTransaction(transaction_hash, ['ACCEPTED_ON_L2']);
await provider.waitForTransaction(transaction_hash, undefined, ['ACCEPTED_ON_L2']);
});

test('read balance of wallet after transfer', async () => {
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('deploy and test Wallet', () => {
},
]);

await provider.waitForTransaction(transaction_hash, ['ACCEPTED_ON_L2']);
await provider.waitForTransaction(transaction_hash, undefined, ['ACCEPTED_ON_L2']);

const response = await dapp.get_number(account.address);
expect(toBN(response.number as string).toString()).toStrictEqual('57');
Expand Down
2 changes: 1 addition & 1 deletion __tests__/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const getTestProvider = (): ProviderInterface => {
// accelerate the tests when running locally
const originalWaitForTransaction = provider.waitForTransaction.bind(provider);
provider.waitForTransaction = (txHash, retryInterval) => {
return originalWaitForTransaction(txHash, undefined, retryInterval || 1000);
return originalWaitForTransaction(txHash, retryInterval || 1000);
};
}

Expand Down
6 changes: 4 additions & 2 deletions src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,9 @@ export class Account extends Provider implements AccountInterface {
details: InvocationsDetails = {}
): Promise<DeployContractUDCResponse> {
const deployTx = await this.deploy(payload, details);
const txReceipt = await this.waitForTransaction(deployTx.transaction_hash, ['ACCEPTED_ON_L2']);
const txReceipt = await this.waitForTransaction(deployTx.transaction_hash, undefined, [
'ACCEPTED_ON_L2',
]);
return parseUDCEvent(txReceipt);
}

Expand All @@ -368,7 +370,7 @@ export class Account extends Provider implements AccountInterface {
details?: InvocationsDetails
) {
const { transaction_hash } = await this.declare({ contract, classHash }, details);
const declare = await this.waitForTransaction(transaction_hash, ['ACCEPTED_ON_L2']);
const declare = await this.waitForTransaction(transaction_hash, undefined, ['ACCEPTED_ON_L2']);
const deploy = await this.deployContract({ classHash, constructorCalldata }, details);
return { declare: { ...declare, class_hash: classHash }, deploy };
}
Expand Down

0 comments on commit 67c2031

Please sign in to comment.