@0xsequence/relayer 0.42.10 → 0.43.0
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 +59 -151
- package/dist/0xsequence-relayer.cjs.prod.js +59 -151
- package/dist/0xsequence-relayer.esm.js +60 -148
- package/dist/declarations/src/base-relayer.d.ts +1 -1
- package/dist/declarations/src/local-relayer.d.ts +3 -4
- package/dist/declarations/src/provider-relayer.d.ts +3 -4
- package/dist/declarations/src/rpc-relayer/relayer.gen.d.ts +20 -1
- package/package.json +11 -10
- package/src/base-relayer.ts +4 -5
- package/src/local-relayer.ts +4 -5
- package/src/provider-relayer.ts +4 -5
- package/src/rpc-relayer/index.ts +1 -2
- package/src/rpc-relayer/relayer.gen.ts +190 -95
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ethers, providers } from
|
|
1
|
+
import { ethers, providers } from 'ethers';
|
|
2
2
|
import { WalletContext } from '@0xsequence/network';
|
|
3
3
|
import { WalletConfig, DecodedSignature } from '@0xsequence/config';
|
|
4
4
|
import { SignedTransactions, Transaction } from '@0xsequence/transactions';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Signer as AbstractSigner } from 'ethers';
|
|
1
|
+
import { Signer as AbstractSigner, providers } from 'ethers';
|
|
3
2
|
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions';
|
|
4
3
|
import { WalletContext } from '@0xsequence/network';
|
|
5
4
|
import { WalletConfig } from '@0xsequence/config';
|
|
@@ -18,6 +17,6 @@ export declare class LocalRelayer extends ProviderRelayer implements Relayer {
|
|
|
18
17
|
options: FeeOption[];
|
|
19
18
|
}>;
|
|
20
19
|
gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
21
|
-
setTransactionOptions(transactionRequest: TransactionRequest): void;
|
|
22
|
-
relay(signedTxs: SignedTransactions, quote?: FeeQuote, waitForReceipt?: boolean): Promise<TransactionResponse<TransactionReceipt>>;
|
|
20
|
+
setTransactionOptions(transactionRequest: providers.TransactionRequest): void;
|
|
21
|
+
relay(signedTxs: SignedTransactions, quote?: FeeQuote, waitForReceipt?: boolean): Promise<TransactionResponse<providers.TransactionReceipt>>;
|
|
23
22
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BlockTag, Provider } from '@ethersproject/providers';
|
|
2
1
|
import { ethers, providers } from 'ethers';
|
|
3
2
|
import { SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions';
|
|
4
3
|
import { WalletContext } from '@0xsequence/network';
|
|
@@ -7,7 +6,7 @@ import { BaseRelayer, BaseRelayerOptions } from './base-relayer';
|
|
|
7
6
|
import { FeeOption, FeeQuote, Relayer, SimulateResult } from '.';
|
|
8
7
|
import { Optionals, Mask } from '@0xsequence/utils';
|
|
9
8
|
export interface ProviderRelayerOptions extends BaseRelayerOptions {
|
|
10
|
-
provider: Provider;
|
|
9
|
+
provider: providers.Provider;
|
|
11
10
|
waitPollRate?: number;
|
|
12
11
|
deltaBlocksLog?: number;
|
|
13
12
|
fromBlockLog?: number;
|
|
@@ -15,7 +14,7 @@ export interface ProviderRelayerOptions extends BaseRelayerOptions {
|
|
|
15
14
|
export declare const ProviderRelayerDefaults: Required<Optionals<Mask<ProviderRelayerOptions, BaseRelayerOptions>>>;
|
|
16
15
|
export declare function isProviderRelayerOptions(obj: any): obj is ProviderRelayerOptions;
|
|
17
16
|
export declare abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
18
|
-
provider: Provider;
|
|
17
|
+
provider: providers.Provider;
|
|
19
18
|
waitPollRate: number;
|
|
20
19
|
deltaBlocksLog: number;
|
|
21
20
|
fromBlockLog: number;
|
|
@@ -27,7 +26,7 @@ export declare abstract class ProviderRelayer extends BaseRelayer implements Rel
|
|
|
27
26
|
abstract gasRefundOptions(config: WalletConfig, context: WalletContext, ...transactions: Transaction[]): Promise<FeeOption[]>;
|
|
28
27
|
abstract relay(signedTxs: SignedTransactions, quote?: FeeQuote, waitForReceipt?: boolean): Promise<TransactionResponse>;
|
|
29
28
|
simulate(wallet: string, ...transactions: Transaction[]): Promise<SimulateResult[]>;
|
|
30
|
-
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish, blockTag?: BlockTag): Promise<ethers.BigNumberish>;
|
|
29
|
+
getNonce(config: WalletConfig, context: WalletContext, space?: ethers.BigNumberish, blockTag?: providers.BlockTag): Promise<ethers.BigNumberish>;
|
|
31
30
|
wait(metaTxnId: string | SignedTransactions, timeout?: number, delay?: number, maxFails?: number): Promise<providers.TransactionResponse & {
|
|
32
31
|
receipt: providers.TransactionReceipt;
|
|
33
32
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const WebRPCVersion = "v1";
|
|
2
2
|
export declare const WebRPCSchemaVersion = "v0.4.0";
|
|
3
|
-
export declare const WebRPCSchemaHash = "
|
|
3
|
+
export declare const WebRPCSchemaHash = "dd44f90f38fc726a1f1430cfece544c3316f6b4f";
|
|
4
4
|
export declare enum ETHTxnStatus {
|
|
5
5
|
UNKNOWN = "UNKNOWN",
|
|
6
6
|
DROPPED = "DROPPED",
|
|
@@ -217,8 +217,10 @@ export interface Relayer {
|
|
|
217
217
|
getMetaTxnNonce(args: GetMetaTxnNonceArgs, headers?: object): Promise<GetMetaTxnNonceReturn>;
|
|
218
218
|
getMetaTxnReceipt(args: GetMetaTxnReceiptArgs, headers?: object): Promise<GetMetaTxnReceiptReturn>;
|
|
219
219
|
simulate(args: SimulateArgs, headers?: object): Promise<SimulateReturn>;
|
|
220
|
+
updateMetaTxnGasLimits(args: UpdateMetaTxnGasLimitsArgs, headers?: object): Promise<UpdateMetaTxnGasLimitsReturn>;
|
|
220
221
|
feeTokens(headers?: object): Promise<FeeTokensReturn>;
|
|
221
222
|
feeOptions(args: FeeOptionsArgs, headers?: object): Promise<FeeOptionsReturn>;
|
|
223
|
+
getMetaTxnNetworkFeeOptions(args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object): Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
|
222
224
|
sentTransactions(args: SentTransactionsArgs, headers?: object): Promise<SentTransactionsReturn>;
|
|
223
225
|
pendingTransactions(args: PendingTransactionsArgs, headers?: object): Promise<PendingTransactionsReturn>;
|
|
224
226
|
listGasSponsors(args: ListGasSponsorsArgs, headers?: object): Promise<ListGasSponsorsReturn>;
|
|
@@ -279,6 +281,14 @@ export interface SimulateArgs {
|
|
|
279
281
|
export interface SimulateReturn {
|
|
280
282
|
results: Array<SimulateResult>;
|
|
281
283
|
}
|
|
284
|
+
export interface UpdateMetaTxnGasLimitsArgs {
|
|
285
|
+
walletAddress: string;
|
|
286
|
+
walletConfig: WalletConfig;
|
|
287
|
+
payload: string;
|
|
288
|
+
}
|
|
289
|
+
export interface UpdateMetaTxnGasLimitsReturn {
|
|
290
|
+
payload: string;
|
|
291
|
+
}
|
|
282
292
|
export interface FeeTokensArgs {
|
|
283
293
|
}
|
|
284
294
|
export interface FeeTokensReturn {
|
|
@@ -294,6 +304,13 @@ export interface FeeOptionsReturn {
|
|
|
294
304
|
options: Array<FeeOption>;
|
|
295
305
|
quote?: string;
|
|
296
306
|
}
|
|
307
|
+
export interface GetMetaTxnNetworkFeeOptionsArgs {
|
|
308
|
+
walletConfig: WalletConfig;
|
|
309
|
+
payload: string;
|
|
310
|
+
}
|
|
311
|
+
export interface GetMetaTxnNetworkFeeOptionsReturn {
|
|
312
|
+
options: Array<FeeOption>;
|
|
313
|
+
}
|
|
297
314
|
export interface SentTransactionsArgs {
|
|
298
315
|
filter?: SentTransactionsFilter;
|
|
299
316
|
page?: Page;
|
|
@@ -356,8 +373,10 @@ export declare class Relayer implements Relayer {
|
|
|
356
373
|
getMetaTxnNonce: (args: GetMetaTxnNonceArgs, headers?: object | undefined) => Promise<GetMetaTxnNonceReturn>;
|
|
357
374
|
getMetaTxnReceipt: (args: GetMetaTxnReceiptArgs, headers?: object | undefined) => Promise<GetMetaTxnReceiptReturn>;
|
|
358
375
|
simulate: (args: SimulateArgs, headers?: object | undefined) => Promise<SimulateReturn>;
|
|
376
|
+
updateMetaTxnGasLimits: (args: UpdateMetaTxnGasLimitsArgs, headers?: object | undefined) => Promise<UpdateMetaTxnGasLimitsReturn>;
|
|
359
377
|
feeTokens: (headers?: object | undefined) => Promise<FeeTokensReturn>;
|
|
360
378
|
feeOptions: (args: FeeOptionsArgs, headers?: object | undefined) => Promise<FeeOptionsReturn>;
|
|
379
|
+
getMetaTxnNetworkFeeOptions: (args: GetMetaTxnNetworkFeeOptionsArgs, headers?: object | undefined) => Promise<GetMetaTxnNetworkFeeOptionsReturn>;
|
|
361
380
|
sentTransactions: (args: SentTransactionsArgs, headers?: object | undefined) => Promise<SentTransactionsReturn>;
|
|
362
381
|
pendingTransactions: (args: PendingTransactionsArgs, headers?: object | undefined) => Promise<PendingTransactionsReturn>;
|
|
363
382
|
listGasSponsors: (args: ListGasSponsorsArgs, headers?: object | undefined) => Promise<ListGasSponsorsReturn>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.0",
|
|
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,16 +17,17 @@
|
|
|
17
17
|
"typecheck": "tsc --noEmit"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@0xsequence/abi": "^0.
|
|
21
|
-
"@0xsequence/config": "^0.
|
|
22
|
-
"@0xsequence/transactions": "^0.
|
|
23
|
-
"@0xsequence/utils": "^0.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
20
|
+
"@0xsequence/abi": "^0.43.0",
|
|
21
|
+
"@0xsequence/config": "^0.43.0",
|
|
22
|
+
"@0xsequence/transactions": "^0.43.0",
|
|
23
|
+
"@0xsequence/utils": "^0.43.0"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"ethers": ">=5.5"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"ethers": "^5.7.2"
|
|
27
30
|
},
|
|
28
|
-
"peerDependencies": {},
|
|
29
|
-
"devDependencies": {},
|
|
30
31
|
"files": [
|
|
31
32
|
"src",
|
|
32
33
|
"dist"
|
package/src/base-relayer.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { ethers, providers } from
|
|
2
|
-
import { Interface } from "ethers/lib/utils"
|
|
1
|
+
import { ethers, providers, utils } from 'ethers'
|
|
3
2
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
3
|
import { WalletContext } from '@0xsequence/network'
|
|
5
4
|
import { WalletConfig, addressOf, imageHash, DecodedSignature, encodeSignature } from '@0xsequence/config'
|
|
@@ -48,7 +47,7 @@ export class BaseRelayer {
|
|
|
48
47
|
config: WalletConfig,
|
|
49
48
|
context: WalletContext
|
|
50
49
|
): { to: string, data: string} {
|
|
51
|
-
const factoryInterface = new Interface(walletContracts.factory.abi)
|
|
50
|
+
const factoryInterface = new utils.Interface(walletContracts.factory.abi)
|
|
52
51
|
|
|
53
52
|
return {
|
|
54
53
|
to: context.factory,
|
|
@@ -63,7 +62,7 @@ export class BaseRelayer {
|
|
|
63
62
|
): Promise<{ to: string, execute: { transactions: Transaction[], nonce: ethers.BigNumber, signature: string } }> {
|
|
64
63
|
const { config, context, transactions, nonce, signature } = signedTransactions
|
|
65
64
|
const walletAddress = addressOf(config, context)
|
|
66
|
-
const walletInterface = new Interface(walletContracts.mainModule.abi)
|
|
65
|
+
const walletInterface = new utils.Interface(walletContracts.mainModule.abi)
|
|
67
66
|
|
|
68
67
|
const encodedSignature = (async () => {
|
|
69
68
|
const sig = await signature
|
|
@@ -126,7 +125,7 @@ export class BaseRelayer {
|
|
|
126
125
|
throw new Error('Unable to prepare transactions without a defined nonce')
|
|
127
126
|
}
|
|
128
127
|
const { to, execute } = await this.prependWalletDeploy({ config, context, transactions, nonce, signature })
|
|
129
|
-
const walletInterface = new Interface(walletContracts.mainModule.abi)
|
|
128
|
+
const walletInterface = new utils.Interface(walletContracts.mainModule.abi)
|
|
130
129
|
return {
|
|
131
130
|
to, data: walletInterface.encodeFunctionData(walletInterface.getFunction('execute'), [
|
|
132
131
|
sequenceTxAbiEncode(execute.transactions),
|
package/src/local-relayer.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Signer as AbstractSigner, ethers } from 'ethers'
|
|
1
|
+
import { Signer as AbstractSigner, ethers, providers } from 'ethers'
|
|
3
2
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
3
|
import { SignedTransactions, Transaction, sequenceTxAbiEncode, TransactionResponse } from '@0xsequence/transactions'
|
|
5
4
|
import { WalletContext } from '@0xsequence/network'
|
|
@@ -18,7 +17,7 @@ export function isLocalRelayerOptions(obj: any): obj is LocalRelayerOptions {
|
|
|
18
17
|
|
|
19
18
|
export class LocalRelayer extends ProviderRelayer implements Relayer {
|
|
20
19
|
private signer: AbstractSigner
|
|
21
|
-
private txnOptions: TransactionRequest
|
|
20
|
+
private txnOptions: providers.TransactionRequest
|
|
22
21
|
|
|
23
22
|
constructor(options: LocalRelayerOptions | AbstractSigner) {
|
|
24
23
|
super(AbstractSigner.isSigner(options) ? { provider: options.provider! } : { ...options, provider: options.signer.provider! })
|
|
@@ -53,11 +52,11 @@ export class LocalRelayer extends ProviderRelayer implements Relayer {
|
|
|
53
52
|
return options
|
|
54
53
|
}
|
|
55
54
|
|
|
56
|
-
setTransactionOptions(transactionRequest: TransactionRequest) {
|
|
55
|
+
setTransactionOptions(transactionRequest: providers.TransactionRequest) {
|
|
57
56
|
this.txnOptions = transactionRequest
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
async relay(signedTxs: SignedTransactions, quote?: FeeQuote, waitForReceipt: boolean = true): Promise<TransactionResponse<TransactionReceipt>> {
|
|
59
|
+
async relay(signedTxs: SignedTransactions, quote?: FeeQuote, waitForReceipt: boolean = true): Promise<TransactionResponse<providers.TransactionReceipt>> {
|
|
61
60
|
if (quote !== undefined) {
|
|
62
61
|
logger.warn(`LocalRelayer doesn't accept fee quotes`)
|
|
63
62
|
}
|
package/src/provider-relayer.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BlockTag, Provider } from '@ethersproject/providers'
|
|
2
1
|
import { ethers, providers } from 'ethers'
|
|
3
2
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
3
|
import { computeMetaTxnHash, encodeNonce, SignedTransactions, Transaction, TransactionResponse } from '@0xsequence/transactions'
|
|
@@ -11,7 +10,7 @@ import { logger, Optionals, Mask } from '@0xsequence/utils'
|
|
|
11
10
|
const DEFAULT_GAS_LIMIT = ethers.BigNumber.from(800000)
|
|
12
11
|
|
|
13
12
|
export interface ProviderRelayerOptions extends BaseRelayerOptions {
|
|
14
|
-
provider: Provider,
|
|
13
|
+
provider: providers.Provider,
|
|
15
14
|
waitPollRate?: number,
|
|
16
15
|
deltaBlocksLog?: number,
|
|
17
16
|
fromBlockLog?: number
|
|
@@ -24,11 +23,11 @@ export const ProviderRelayerDefaults: Required<Optionals<Mask<ProviderRelayerOpt
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
export function isProviderRelayerOptions(obj: any): obj is ProviderRelayerOptions {
|
|
27
|
-
return obj.provider !== undefined && Provider.isProvider(obj.provider)
|
|
26
|
+
return obj.provider !== undefined && providers.Provider.isProvider(obj.provider)
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
31
|
-
public provider: Provider
|
|
30
|
+
public provider: providers.Provider
|
|
32
31
|
public waitPollRate: number
|
|
33
32
|
public deltaBlocksLog: number
|
|
34
33
|
public fromBlockLog: number
|
|
@@ -97,7 +96,7 @@ export abstract class ProviderRelayer extends BaseRelayer implements Relayer {
|
|
|
97
96
|
config: WalletConfig,
|
|
98
97
|
context: WalletContext,
|
|
99
98
|
space?: ethers.BigNumberish,
|
|
100
|
-
blockTag?: BlockTag
|
|
99
|
+
blockTag?: providers.BlockTag
|
|
101
100
|
): Promise<ethers.BigNumberish> {
|
|
102
101
|
if (!this.provider) {
|
|
103
102
|
throw new Error('provider is not set')
|
package/src/rpc-relayer/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ethers } from 'ethers'
|
|
2
|
-
import fetchPonyfill from 'fetch-ponyfill'
|
|
3
2
|
import { walletContracts } from '@0xsequence/abi'
|
|
4
3
|
import {
|
|
5
4
|
Transaction,
|
|
@@ -43,7 +42,7 @@ export class RpcRelayer extends BaseRelayer implements Relayer {
|
|
|
43
42
|
|
|
44
43
|
constructor(options: RpcRelayerOptions) {
|
|
45
44
|
super(options)
|
|
46
|
-
this.service = new proto.Relayer(options.url,
|
|
45
|
+
this.service = new proto.Relayer(options.url, global.fetch)
|
|
47
46
|
}
|
|
48
47
|
|
|
49
48
|
async waitReceipt(
|