@0xsequence/relayer 0.36.8 → 0.36.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/0xsequence-relayer.cjs.dev.js +4 -2
- package/dist/0xsequence-relayer.cjs.prod.js +4 -2
- package/dist/0xsequence-relayer.esm.js +4 -2
- package/dist/declarations/src/index.d.ts +3 -3
- package/dist/declarations/src/local-relayer.d.ts +2 -2
- package/dist/declarations/src/provider-relayer.d.ts +2 -2
- package/dist/declarations/src/rpc-relayer/index.d.ts +25 -3
- package/package.json +5 -5
- package/src/index.ts +3 -3
- package/src/local-relayer.ts +2 -2
- package/src/provider-relayer.ts +4 -4
- package/src/rpc-relayer/index.ts +7 -6
|
@@ -239,7 +239,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
239
239
|
|
|
240
240
|
async wait(metaTxnId, timeout) {
|
|
241
241
|
if (typeof metaTxnId !== 'string') {
|
|
242
|
-
|
|
242
|
+
utils.logger.info("computing id", metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions);
|
|
243
243
|
return this.wait(transactions.computeMetaTxnHash(config.addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions), timeout);
|
|
244
244
|
} // Transactions can only get executed on nonce change
|
|
245
245
|
// get all nonce changes and look for metaTxnIds in between logs
|
|
@@ -639,7 +639,7 @@ class RpcRelayer extends BaseRelayer {
|
|
|
639
639
|
|
|
640
640
|
async waitReceipt(metaTxnHash, wait = 1000) {
|
|
641
641
|
if (typeof metaTxnHash !== 'string') {
|
|
642
|
-
|
|
642
|
+
utils.logger.info('computing id', metaTxnHash.config, metaTxnHash.context, metaTxnHash.chainId, ...metaTxnHash.transactions);
|
|
643
643
|
return this.waitReceipt(transactions.computeMetaTxnHash(config.addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions));
|
|
644
644
|
}
|
|
645
645
|
|
|
@@ -836,6 +836,8 @@ class RpcRelayer extends BaseRelayer {
|
|
|
836
836
|
from: typeof metaTxnHash === 'string' ? undefined : config.addressOf(metaTxnHash.config, metaTxnHash.context),
|
|
837
837
|
hash: txReceipt.transactionHash,
|
|
838
838
|
raw: receipt.txnReceipt,
|
|
839
|
+
receipt: txReceipt,
|
|
840
|
+
// extended type which is Sequence-specific. Contains the decoded metaTxReceipt
|
|
839
841
|
wait: async function (confirmations) {
|
|
840
842
|
return _this.provider.waitForTransaction(txReceipt.transactionHash, confirmations);
|
|
841
843
|
}
|
|
@@ -239,7 +239,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
239
239
|
|
|
240
240
|
async wait(metaTxnId, timeout) {
|
|
241
241
|
if (typeof metaTxnId !== 'string') {
|
|
242
|
-
|
|
242
|
+
utils.logger.info("computing id", metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions);
|
|
243
243
|
return this.wait(transactions.computeMetaTxnHash(config.addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions), timeout);
|
|
244
244
|
} // Transactions can only get executed on nonce change
|
|
245
245
|
// get all nonce changes and look for metaTxnIds in between logs
|
|
@@ -639,7 +639,7 @@ class RpcRelayer extends BaseRelayer {
|
|
|
639
639
|
|
|
640
640
|
async waitReceipt(metaTxnHash, wait = 1000) {
|
|
641
641
|
if (typeof metaTxnHash !== 'string') {
|
|
642
|
-
|
|
642
|
+
utils.logger.info('computing id', metaTxnHash.config, metaTxnHash.context, metaTxnHash.chainId, ...metaTxnHash.transactions);
|
|
643
643
|
return this.waitReceipt(transactions.computeMetaTxnHash(config.addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions));
|
|
644
644
|
}
|
|
645
645
|
|
|
@@ -836,6 +836,8 @@ class RpcRelayer extends BaseRelayer {
|
|
|
836
836
|
from: typeof metaTxnHash === 'string' ? undefined : config.addressOf(metaTxnHash.config, metaTxnHash.context),
|
|
837
837
|
hash: txReceipt.transactionHash,
|
|
838
838
|
raw: receipt.txnReceipt,
|
|
839
|
+
receipt: txReceipt,
|
|
840
|
+
// extended type which is Sequence-specific. Contains the decoded metaTxReceipt
|
|
839
841
|
wait: async function (confirmations) {
|
|
840
842
|
return _this.provider.waitForTransaction(txReceipt.transactionHash, confirmations);
|
|
841
843
|
}
|
|
@@ -231,7 +231,7 @@ class ProviderRelayer extends BaseRelayer {
|
|
|
231
231
|
|
|
232
232
|
async wait(metaTxnId, timeout) {
|
|
233
233
|
if (typeof metaTxnId !== 'string') {
|
|
234
|
-
|
|
234
|
+
logger.info("computing id", metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions);
|
|
235
235
|
return this.wait(computeMetaTxnHash(addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions), timeout);
|
|
236
236
|
} // Transactions can only get executed on nonce change
|
|
237
237
|
// get all nonce changes and look for metaTxnIds in between logs
|
|
@@ -631,7 +631,7 @@ class RpcRelayer extends BaseRelayer {
|
|
|
631
631
|
|
|
632
632
|
async waitReceipt(metaTxnHash, wait = 1000) {
|
|
633
633
|
if (typeof metaTxnHash !== 'string') {
|
|
634
|
-
|
|
634
|
+
logger.info('computing id', metaTxnHash.config, metaTxnHash.context, metaTxnHash.chainId, ...metaTxnHash.transactions);
|
|
635
635
|
return this.waitReceipt(computeMetaTxnHash(addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions));
|
|
636
636
|
}
|
|
637
637
|
|
|
@@ -828,6 +828,8 @@ class RpcRelayer extends BaseRelayer {
|
|
|
828
828
|
from: typeof metaTxnHash === 'string' ? undefined : addressOf(metaTxnHash.config, metaTxnHash.context),
|
|
829
829
|
hash: txReceipt.transactionHash,
|
|
830
830
|
raw: receipt.txnReceipt,
|
|
831
|
+
receipt: txReceipt,
|
|
832
|
+
// extended type which is Sequence-specific. Contains the decoded metaTxReceipt
|
|
831
833
|
wait: async function (confirmations) {
|
|
832
834
|
return _this.provider.waitForTransaction(txReceipt.transactionHash, confirmations);
|
|
833
835
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, providers } from 'ethers';
|
|
2
|
-
import { SignedTransactions, Transaction } from '@0xsequence/transactions';
|
|
2
|
+
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions';
|
|
3
3
|
import { WalletContext } from '@0xsequence/network';
|
|
4
4
|
import { WalletConfig } from '@0xsequence/config';
|
|
5
5
|
import { proto } from './rpc-relayer';
|
|
@@ -12,8 +12,8 @@ export interface Relayer {
|
|
|
12
12
|
}>;
|
|
13
13
|
gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
14
14
|
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish, blockTag?: providers.BlockTag): Promise<ethers.BigNumberish>;
|
|
15
|
-
relay(signedTxs: SignedTransactions, quote?: FeeQuote): Promise<
|
|
16
|
-
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<
|
|
15
|
+
relay(signedTxs: SignedTransactions, quote?: FeeQuote): Promise<TransactionResponse>;
|
|
16
|
+
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<TransactionResponse>;
|
|
17
17
|
}
|
|
18
18
|
export * from './local-relayer';
|
|
19
19
|
export * from './base-relayer';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TransactionRequest
|
|
1
|
+
import { TransactionRequest } from '@ethersproject/providers';
|
|
2
2
|
import { Signer as AbstractSigner } from 'ethers';
|
|
3
|
-
import { SignedTransactions, Transaction } from '@0xsequence/transactions';
|
|
3
|
+
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions';
|
|
4
4
|
import { WalletContext } from '@0xsequence/network';
|
|
5
5
|
import { WalletConfig } from '@0xsequence/config';
|
|
6
6
|
import { FeeOption, FeeQuote, Relayer } from '.';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockTag, Provider } from '@ethersproject/providers';
|
|
2
2
|
import { ethers, providers } from 'ethers';
|
|
3
|
-
import { SignedTransactions, Transaction } from '@0xsequence/transactions';
|
|
3
|
+
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions';
|
|
4
4
|
import { WalletContext } from '@0xsequence/network';
|
|
5
5
|
import { WalletConfig } from '@0xsequence/config';
|
|
6
6
|
import { BaseRelayer, BaseRelayerOptions } from './base-relayer';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { TransactionResponse } from '@ethersproject/providers';
|
|
2
1
|
import { ethers } from 'ethers';
|
|
3
|
-
import { Transaction, SignedTransactions } from '@0xsequence/transactions';
|
|
2
|
+
import { Transaction, SignedTransactions, TransactionResponse } from '@0xsequence/transactions';
|
|
4
3
|
import { BaseRelayer, BaseRelayerOptions } from '../base-relayer';
|
|
5
4
|
import { FeeOption, FeeQuote, Relayer, SimulateResult } from '..';
|
|
6
5
|
import { WalletContext } from '@0xsequence/network';
|
|
@@ -24,5 +23,28 @@ export declare class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
24
23
|
gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
25
24
|
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish): Promise<ethers.BigNumberish>;
|
|
26
25
|
relay(signedTxs: SignedTransactions, quote?: FeeQuote): Promise<TransactionResponse>;
|
|
27
|
-
wait(metaTxnHash: string | SignedTransactions, wait?: number): Promise<TransactionResponse
|
|
26
|
+
wait(metaTxnHash: string | SignedTransactions, wait?: number): Promise<TransactionResponse<RelayerTxReceipt>>;
|
|
28
27
|
}
|
|
28
|
+
export declare type RelayerTxReceipt = {
|
|
29
|
+
blockHash: string;
|
|
30
|
+
blockNumber: string;
|
|
31
|
+
contractAddress: string;
|
|
32
|
+
cumulativeGasUsed: string;
|
|
33
|
+
gasUsed: string;
|
|
34
|
+
logs: {
|
|
35
|
+
address: string;
|
|
36
|
+
blockHash: string;
|
|
37
|
+
blockNumber: string;
|
|
38
|
+
data: string;
|
|
39
|
+
logIndex: string;
|
|
40
|
+
removed: boolean;
|
|
41
|
+
topics: string[];
|
|
42
|
+
transactionHash: string;
|
|
43
|
+
transactionIndex: string;
|
|
44
|
+
}[];
|
|
45
|
+
logsBloom: string;
|
|
46
|
+
root: string;
|
|
47
|
+
status: string;
|
|
48
|
+
transactionHash: string;
|
|
49
|
+
transactionIndex: string;
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.9",
|
|
4
4
|
"description": "relayer sub-package for Sequence",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/relayer",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"typecheck": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@0xsequence/abi": "^0.36.
|
|
21
|
-
"@0xsequence/config": "^0.36.
|
|
22
|
-
"@0xsequence/transactions": "^0.36.
|
|
23
|
-
"@0xsequence/utils": "^0.36.
|
|
20
|
+
"@0xsequence/abi": "^0.36.9",
|
|
21
|
+
"@0xsequence/config": "^0.36.9",
|
|
22
|
+
"@0xsequence/transactions": "^0.36.9",
|
|
23
|
+
"@0xsequence/utils": "^0.36.9",
|
|
24
24
|
"@ethersproject/providers": "^5.5.1",
|
|
25
25
|
"ethers": "^5.5.2",
|
|
26
26
|
"fetch-ponyfill": "^7.1.0"
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ethers, providers } from 'ethers'
|
|
2
|
-
import { SignedTransactions, Transaction } from '@0xsequence/transactions'
|
|
2
|
+
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions'
|
|
3
3
|
import { WalletContext } from '@0xsequence/network'
|
|
4
4
|
import { WalletConfig } from '@0xsequence/config'
|
|
5
5
|
import { proto } from './rpc-relayer'
|
|
@@ -39,10 +39,10 @@ export interface Relayer {
|
|
|
39
39
|
|
|
40
40
|
// relayer will submit the transaction(s) to the network and return the transaction response.
|
|
41
41
|
// The quote should be the one returned from getFeeOptions, if any.
|
|
42
|
-
relay(signedTxs: SignedTransactions, quote?: FeeQuote): Promise<
|
|
42
|
+
relay(signedTxs: SignedTransactions, quote?: FeeQuote): Promise<TransactionResponse>
|
|
43
43
|
|
|
44
44
|
// wait for transaction confirmation
|
|
45
|
-
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<
|
|
45
|
+
wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<TransactionResponse>
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export * from './local-relayer'
|
package/src/local-relayer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TransactionRequest
|
|
1
|
+
import { TransactionRequest } from '@ethersproject/providers'
|
|
2
2
|
import { Signer as AbstractSigner, ethers } from 'ethers'
|
|
3
3
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
|
-
import { SignedTransactions, Transaction, sequenceTxAbiEncode } from '@0xsequence/transactions'
|
|
4
|
+
import { SignedTransactions, Transaction, sequenceTxAbiEncode, TransactionResponse } from '@0xsequence/transactions'
|
|
5
5
|
import { WalletContext } from '@0xsequence/network'
|
|
6
6
|
import { WalletConfig } from '@0xsequence/config'
|
|
7
7
|
import { logger } from '@0xsequence/utils'
|
package/src/provider-relayer.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockTag, Provider } from '@ethersproject/providers'
|
|
2
2
|
import { ethers, providers } from 'ethers'
|
|
3
3
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
|
-
import { computeMetaTxnHash, encodeNonce, SignedTransactions, Transaction } from '@0xsequence/transactions'
|
|
4
|
+
import { computeMetaTxnHash, encodeNonce, SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions'
|
|
5
5
|
import { WalletContext } from '@0xsequence/network'
|
|
6
6
|
import { WalletConfig, addressOf } from '@0xsequence/config'
|
|
7
7
|
import { BaseRelayer, BaseRelayerOptions } from './base-relayer'
|
|
8
8
|
import { FeeOption, FeeQuote, Relayer, SimulateResult } from '.'
|
|
9
|
-
import { Optionals, Mask } from '@0xsequence/utils'
|
|
9
|
+
import { logger, Optionals, Mask } from '@0xsequence/utils'
|
|
10
10
|
|
|
11
11
|
const DEFAULT_GAS_LIMIT = ethers.BigNumber.from(800000)
|
|
12
12
|
|
|
@@ -130,7 +130,7 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
130
130
|
|
|
131
131
|
async wait(metaTxnId: string | SignedTransactions, timeout: number): Promise<providers.TransactionResponse & { receipt: providers.TransactionReceipt }> {
|
|
132
132
|
if (typeof metaTxnId !== 'string') {
|
|
133
|
-
|
|
133
|
+
logger.info("computing id", metaTxnId.config, metaTxnId.context, metaTxnId.chainId, ...metaTxnId.transactions)
|
|
134
134
|
return this.wait(
|
|
135
135
|
computeMetaTxnHash(addressOf(metaTxnId.config, metaTxnId.context), metaTxnId.chainId, ...metaTxnId.transactions),
|
|
136
136
|
timeout
|
package/src/rpc-relayer/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { TransactionResponse } from '@ethersproject/providers'
|
|
2
1
|
import { ethers } from 'ethers'
|
|
3
2
|
import fetchPonyfill from 'fetch-ponyfill'
|
|
4
3
|
import { walletContracts } from '@0xsequence/abi'
|
|
@@ -10,7 +9,8 @@ import {
|
|
|
10
9
|
sequenceTxAbiEncode,
|
|
11
10
|
SignedTransactions,
|
|
12
11
|
computeMetaTxnHash,
|
|
13
|
-
decodeNonce
|
|
12
|
+
decodeNonce,
|
|
13
|
+
TransactionResponse
|
|
14
14
|
} from '@0xsequence/transactions'
|
|
15
15
|
import { BaseRelayer, BaseRelayerOptions } from '../base-relayer'
|
|
16
16
|
import { FeeOption, FeeQuote, Relayer, SimulateResult } from '..'
|
|
@@ -41,7 +41,7 @@ export class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
41
41
|
|
|
42
42
|
async waitReceipt(metaTxnHash: string | SignedTransactions, wait: number = 1000): Promise<proto.GetMetaTxnReceiptReturn> {
|
|
43
43
|
if (typeof metaTxnHash !== 'string') {
|
|
44
|
-
|
|
44
|
+
logger.info('computing id', metaTxnHash.config, metaTxnHash.context, metaTxnHash.chainId, ...metaTxnHash.transactions)
|
|
45
45
|
return this.waitReceipt(
|
|
46
46
|
computeMetaTxnHash(addressOf(metaTxnHash.config, metaTxnHash.context), metaTxnHash.chainId, ...metaTxnHash.transactions)
|
|
47
47
|
)
|
|
@@ -216,7 +216,7 @@ export class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
216
216
|
return this.wait(metaTxn.txnHash)
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
async wait(metaTxnHash: string | SignedTransactions, wait: number = 1000): Promise<TransactionResponse
|
|
219
|
+
async wait(metaTxnHash: string | SignedTransactions, wait: number = 1000): Promise<TransactionResponse<RelayerTxReceipt>> {
|
|
220
220
|
const { receipt } = await this.waitReceipt(metaTxnHash, wait)
|
|
221
221
|
|
|
222
222
|
if (!receipt.txnReceipt || FAILED_STATUSES.includes(receipt.status as proto.ETHTxnStatus)) {
|
|
@@ -232,7 +232,8 @@ export class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
232
232
|
from: typeof metaTxnHash === 'string' ? undefined : addressOf(metaTxnHash.config, metaTxnHash.context),
|
|
233
233
|
hash: txReceipt.transactionHash,
|
|
234
234
|
raw: receipt.txnReceipt,
|
|
235
|
-
|
|
235
|
+
receipt: txReceipt, // extended type which is Sequence-specific. Contains the decoded metaTxReceipt
|
|
236
|
+
wait: async (confirmations?: number) => this.provider!.waitForTransaction(txReceipt.transactionHash, confirmations),
|
|
236
237
|
} as TransactionResponse
|
|
237
238
|
}
|
|
238
239
|
}
|
|
@@ -241,7 +242,7 @@ class MetaTransactionResponseException {
|
|
|
241
242
|
constructor(public receipt: proto.MetaTxnReceipt) {}
|
|
242
243
|
}
|
|
243
244
|
|
|
244
|
-
type RelayerTxReceipt = {
|
|
245
|
+
export type RelayerTxReceipt = {
|
|
245
246
|
blockHash: string
|
|
246
247
|
blockNumber: string
|
|
247
248
|
contractAddress: string
|