@0xsequence/relayer
Advanced tools
Comparing version 0.21.0 to 0.21.2
# @0xsequence/relayer | ||
## 0.21.2 | ||
### Patch Changes | ||
- exception handlind in relayer | ||
- Updated dependencies [undefined] | ||
- @0xsequence/abi@0.21.2 | ||
- @0xsequence/chaind@0.21.2 | ||
- @0xsequence/config@0.21.2 | ||
- @0xsequence/transactions@0.21.2 | ||
- @0xsequence/utils@0.21.2 | ||
## 0.21.0 | ||
@@ -4,0 +16,0 @@ |
@@ -416,2 +416,3 @@ 'use strict'; | ||
const FAILED_STATUSES = [ETHTxnStatus.FAILED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.DROPPED, ETHTxnStatus.REVERTED]; | ||
class RpcRelayer extends BaseRelayer { | ||
@@ -424,3 +425,3 @@ constructor(relayerSerivceUrl, bundleDeploy = true, provider) { | ||
async waitReceipt(metaTxnHash, wait = 500) { | ||
async waitReceipt(metaTxnHash, wait = 1000) { | ||
if (typeof metaTxnHash !== 'string') { | ||
@@ -439,7 +440,2 @@ return this.waitReceipt(transactions.computeMetaTxnHash(config.addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions)); | ||
}); | ||
} // "FAILED" is reserved for when the tx is invalid and never dispatched by remote relayer | ||
if (result.receipt.status == 'FAILED') { | ||
throw new Error(result.receipt.revertReason); | ||
} | ||
@@ -550,3 +546,3 @@ | ||
async wait(metaTxnHash, wait = 500) { | ||
async wait(metaTxnHash, wait = 1000) { | ||
var _this = this; | ||
@@ -557,2 +553,7 @@ | ||
} = await this.waitReceipt(metaTxnHash, wait); | ||
if (!receipt.txnReceipt || FAILED_STATUSES.includes(receipt.status)) { | ||
throw new MetaTransactionResponseException(receipt); | ||
} | ||
const txReceipt = JSON.parse(receipt.txnReceipt); | ||
@@ -574,2 +575,9 @@ return { | ||
class MetaTransactionResponseException { | ||
constructor(receipt) { | ||
this.receipt = receipt; | ||
} | ||
} | ||
function isRelayer(cand) { | ||
@@ -576,0 +584,0 @@ return cand && cand.estimateGasLimits !== undefined && cand.gasRefundOptions !== undefined && cand.getNonce !== undefined && cand.relay !== undefined; |
@@ -416,2 +416,3 @@ 'use strict'; | ||
const FAILED_STATUSES = [ETHTxnStatus.FAILED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.DROPPED, ETHTxnStatus.REVERTED]; | ||
class RpcRelayer extends BaseRelayer { | ||
@@ -424,3 +425,3 @@ constructor(relayerSerivceUrl, bundleDeploy = true, provider) { | ||
async waitReceipt(metaTxnHash, wait = 500) { | ||
async waitReceipt(metaTxnHash, wait = 1000) { | ||
if (typeof metaTxnHash !== 'string') { | ||
@@ -439,7 +440,2 @@ return this.waitReceipt(transactions.computeMetaTxnHash(config.addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions)); | ||
}); | ||
} // "FAILED" is reserved for when the tx is invalid and never dispatched by remote relayer | ||
if (result.receipt.status == 'FAILED') { | ||
throw new Error(result.receipt.revertReason); | ||
} | ||
@@ -550,3 +546,3 @@ | ||
async wait(metaTxnHash, wait = 500) { | ||
async wait(metaTxnHash, wait = 1000) { | ||
var _this = this; | ||
@@ -557,2 +553,7 @@ | ||
} = await this.waitReceipt(metaTxnHash, wait); | ||
if (!receipt.txnReceipt || FAILED_STATUSES.includes(receipt.status)) { | ||
throw new MetaTransactionResponseException(receipt); | ||
} | ||
const txReceipt = JSON.parse(receipt.txnReceipt); | ||
@@ -574,2 +575,9 @@ return { | ||
class MetaTransactionResponseException { | ||
constructor(receipt) { | ||
this.receipt = receipt; | ||
} | ||
} | ||
function isRelayer(cand) { | ||
@@ -576,0 +584,0 @@ return cand && cand.estimateGasLimits !== undefined && cand.gasRefundOptions !== undefined && cand.getNonce !== undefined && cand.relay !== undefined; |
@@ -408,2 +408,3 @@ import { ethers } from 'ethers'; | ||
const FAILED_STATUSES = [ETHTxnStatus.FAILED, ETHTxnStatus.PARTIALLY_FAILED, ETHTxnStatus.DROPPED, ETHTxnStatus.REVERTED]; | ||
class RpcRelayer extends BaseRelayer { | ||
@@ -416,3 +417,3 @@ constructor(relayerSerivceUrl, bundleDeploy = true, provider) { | ||
async waitReceipt(metaTxnHash, wait = 500) { | ||
async waitReceipt(metaTxnHash, wait = 1000) { | ||
if (typeof metaTxnHash !== 'string') { | ||
@@ -431,7 +432,2 @@ return this.waitReceipt(computeMetaTxnHash(addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions)); | ||
}); | ||
} // "FAILED" is reserved for when the tx is invalid and never dispatched by remote relayer | ||
if (result.receipt.status == 'FAILED') { | ||
throw new Error(result.receipt.revertReason); | ||
} | ||
@@ -542,3 +538,3 @@ | ||
async wait(metaTxnHash, wait = 500) { | ||
async wait(metaTxnHash, wait = 1000) { | ||
var _this = this; | ||
@@ -549,2 +545,7 @@ | ||
} = await this.waitReceipt(metaTxnHash, wait); | ||
if (!receipt.txnReceipt || FAILED_STATUSES.includes(receipt.status)) { | ||
throw new MetaTransactionResponseException(receipt); | ||
} | ||
const txReceipt = JSON.parse(receipt.txnReceipt); | ||
@@ -566,2 +567,9 @@ return { | ||
class MetaTransactionResponseException { | ||
constructor(receipt) { | ||
this.receipt = receipt; | ||
} | ||
} | ||
function isRelayer(cand) { | ||
@@ -568,0 +576,0 @@ return cand && cand.estimateGasLimits !== undefined && cand.gasRefundOptions !== undefined && cand.getNonce !== undefined && cand.relay !== undefined; |
{ | ||
"name": "@0xsequence/relayer", | ||
"version": "0.21.0", | ||
"version": "0.21.2", | ||
"description": "relayer sub-package for Sequence", | ||
@@ -16,7 +16,7 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer", | ||
"dependencies": { | ||
"@0xsequence/abi": "^0.21.0", | ||
"@0xsequence/chaind": "^0.21.0", | ||
"@0xsequence/config": "^0.21.0", | ||
"@0xsequence/transactions": "^0.21.0", | ||
"@0xsequence/utils": "^0.21.0", | ||
"@0xsequence/abi": "^0.21.2", | ||
"@0xsequence/chaind": "^0.21.2", | ||
"@0xsequence/config": "^0.21.2", | ||
"@0xsequence/transactions": "^0.21.2", | ||
"@0xsequence/utils": "^0.21.2", | ||
"ethers": "^5.0.32", | ||
@@ -23,0 +23,0 @@ "fetch-ponyfill": "^7.1.0" |
@@ -23,2 +23,9 @@ import { TransactionResponse, Provider, BlockTag } from '@ethersproject/providers' | ||
const FAILED_STATUSES = [ | ||
proto.ETHTxnStatus.FAILED, | ||
proto.ETHTxnStatus.PARTIALLY_FAILED, | ||
proto.ETHTxnStatus.DROPPED, | ||
proto.ETHTxnStatus.REVERTED | ||
] | ||
export class RpcRelayer extends BaseRelayer implements Relayer { | ||
@@ -32,3 +39,3 @@ private readonly service: proto.RelayerService | ||
async waitReceipt(metaTxnHash: string | SignedTransactions, wait: number = 500): Promise<proto.GetMetaTxnReceiptReturn> { | ||
async waitReceipt(metaTxnHash: string | SignedTransactions, wait: number = 1000): Promise<proto.GetMetaTxnReceiptReturn> { | ||
if (typeof metaTxnHash !== 'string') { | ||
@@ -47,7 +54,2 @@ return this.waitReceipt( | ||
// "FAILED" is reserved for when the tx is invalid and never dispatched by remote relayer | ||
if (result.receipt.status == 'FAILED') { | ||
throw new Error(result.receipt.revertReason) | ||
} | ||
return result | ||
@@ -176,4 +178,9 @@ } | ||
async wait(metaTxnHash: string | SignedTransactions, wait: number = 500): Promise<TransactionResponse> { | ||
async wait(metaTxnHash: string | SignedTransactions, wait: number = 1000): Promise<TransactionResponse> { | ||
const { receipt } = await this.waitReceipt(metaTxnHash, wait) | ||
if (!receipt.txnReceipt || FAILED_STATUSES.includes(receipt.status as proto.ETHTxnStatus)) { | ||
throw new MetaTransactionResponseException(receipt) | ||
} | ||
const txReceipt = JSON.parse(receipt.txnReceipt) as RelayerTxReceipt | ||
@@ -193,2 +200,6 @@ | ||
class MetaTransactionResponseException { | ||
constructor(public receipt: proto.MetaTxnReceipt) {} | ||
} | ||
type RelayerTxReceipt = { | ||
@@ -195,0 +206,0 @@ blockHash: string |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
105859
2447
Updated@0xsequence/abi@^0.21.2
Updated@0xsequence/chaind@^0.21.2
Updated@0xsequence/config@^0.21.2
Updated@0xsequence/utils@^0.21.2