Skip to content

Commit

Permalink
feat: pending as success
Browse files Browse the repository at this point in the history
  • Loading branch information
janek26 committed Mar 31, 2022
1 parent 767021a commit 9e79288
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/provider/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,12 @@ export class Provider implements ProviderInterface {
// eslint-disable-next-line no-await-in-loop
const res = await this.getTransactionStatus(txHash);

if (res.tx_status === 'ACCEPTED_ON_L1' || res.tx_status === 'ACCEPTED_ON_L2') {
const successStates = ['ACCEPTED_ON_L1', 'ACCEPTED_ON_L2', 'PENDING'];
const errorStates = ['REJECTED', 'NOT_RECEIVED'];

if (successStates.includes(res.tx_status)) {
onchain = true;
} else if (res.tx_status === 'REJECTED' || res.tx_status === 'NOT_RECEIVED') {
} else if (errorStates.includes(res.tx_status)) {
const message = res.tx_failure_reason
? `${res.tx_status}: ${res.tx_failure_reason.code}\n${res.tx_failure_reason.error_message}`
: res.tx_status;
Expand Down

0 comments on commit 9e79288

Please sign in to comment.