@0xsequence/relayer 3.0.0-beta.16 → 3.0.0-beta.17
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/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/relayer/rpc-relayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,IAAI,WAAW,EACvB,uBAAuB,EAExB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/relayer/rpc-relayer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,QAAQ,IAAI,WAAW,EACvB,uBAAuB,EAExB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAe,MAAM,IAAI,CAAA;AAC9C,OAAO,EAAa,OAAO,EAAW,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAU3E,OAAO,EAA0C,KAAK,EAAE,MAAM,MAAM,CAAA;AAGpE,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;AAqCjF,eAAO,MAAM,QAAQ,GAAI,SAAS,MAAM,KAAG,KAc1C,CAAA;AAED,qBAAa,UAAW,YAAW,OAAO;IACxC,SAAgB,IAAI,EAAE,SAAS,CAAY;IAC3C,SAAgB,IAAI,SAAQ;IAC5B,SAAgB,EAAE,EAAE,MAAM,CAAA;IAC1B,SAAgB,OAAO,EAAE,MAAM,CAAA;IAC/B,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,KAAK,CAA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E,MAAM,EAAE,GAAG,CAAC,GAAG,CAAA;KAAE,CAAC;IAyBzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA2ClE,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC;IAuKhF,OAAO,CAAC,uBAAuB;CAMhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Relayer as GenRelayer, FeeTokenType, ETHTxnStatus, } from './relayer.gen.js';
|
|
2
|
-
import { Address, Hex,
|
|
2
|
+
import { Address, Hex, AbiFunction } from 'ox';
|
|
3
3
|
import { Constants, Payload, Network } from '@0xsequence/wallet-primitives';
|
|
4
4
|
import { decodePrecondition } from '../../preconditions/index.js';
|
|
5
5
|
import { erc20BalanceOf, erc20Allowance, erc721OwnerOf, erc721GetApproved, erc1155BalanceOf, erc1155IsApprovedForAll, } from '../standard/abi.js';
|
|
@@ -104,13 +104,18 @@ export class RpcRelayer {
|
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
async feeOptions(wallet, chainId, to, calls) {
|
|
107
|
+
// IMPORTANT:
|
|
108
|
+
// The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
|
|
109
|
+
// wallet-webapp-v3 requests FeeOptions with `to = wallet` and `data = Payload.encode(calls, self=wallet)`.
|
|
110
|
+
// This works for undeployed wallets and avoids guest-module simulation pitfalls.
|
|
107
111
|
const callsStruct = { type: 'call', space: 0n, nonce: 0n, calls: calls };
|
|
108
|
-
const
|
|
112
|
+
const feeOptionsTo = wallet;
|
|
113
|
+
const data = Payload.encode(callsStruct, wallet);
|
|
109
114
|
try {
|
|
110
115
|
const result = await this.client.feeOptions({
|
|
111
116
|
wallet,
|
|
112
|
-
to,
|
|
113
|
-
data:
|
|
117
|
+
to: feeOptionsTo,
|
|
118
|
+
data: Hex.fromBytes(data),
|
|
114
119
|
}, { ...(this.projectAccessKey ? { 'X-Access-Key': this.projectAccessKey } : undefined) });
|
|
115
120
|
const quote = result.quote ? { _tag: 'FeeQuote', _quote: result.quote } : undefined;
|
|
116
121
|
const options = result.options.map((option) => ({
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/relayer",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"description": "relayer sub-package for Sequence",
|
|
9
9
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/services/relayer",
|
|
10
|
-
"author": "Sequence Platforms
|
|
10
|
+
"author": "Sequence Platforms ULC",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"mipd": "^0.0.7",
|
|
26
26
|
"ox": "^0.9.17",
|
|
27
27
|
"viem": "^2.40.3",
|
|
28
|
-
"@0xsequence/wallet-primitives": "^3.0.0-beta.
|
|
28
|
+
"@0xsequence/wallet-primitives": "^3.0.0-beta.17"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc",
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
TransactionPrecondition,
|
|
8
8
|
ETHTxnStatus,
|
|
9
9
|
} from './relayer.gen.js'
|
|
10
|
-
import { Address, Hex,
|
|
10
|
+
import { Address, Hex, AbiFunction } from 'ox'
|
|
11
11
|
import { Constants, Payload, Network } from '@0xsequence/wallet-primitives'
|
|
12
12
|
import { FeeOption, FeeQuote, OperationStatus, Relayer } from '../index.js'
|
|
13
13
|
import { decodePrecondition } from '../../preconditions/index.js'
|
|
@@ -137,15 +137,21 @@ export class RpcRelayer implements Relayer {
|
|
|
137
137
|
to: Address.Address,
|
|
138
138
|
calls: Payload.Call[],
|
|
139
139
|
): Promise<{ options: FeeOption[]; quote?: FeeQuote }> {
|
|
140
|
+
// IMPORTANT:
|
|
141
|
+
// The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
|
|
142
|
+
// wallet-webapp-v3 requests FeeOptions with `to = wallet` and `data = Payload.encode(calls, self=wallet)`.
|
|
143
|
+
// This works for undeployed wallets and avoids guest-module simulation pitfalls.
|
|
140
144
|
const callsStruct: Payload.Calls = { type: 'call', space: 0n, nonce: 0n, calls: calls }
|
|
141
|
-
|
|
145
|
+
|
|
146
|
+
const feeOptionsTo = wallet
|
|
147
|
+
const data = Payload.encode(callsStruct, wallet)
|
|
142
148
|
|
|
143
149
|
try {
|
|
144
150
|
const result = await this.client.feeOptions(
|
|
145
151
|
{
|
|
146
152
|
wallet,
|
|
147
|
-
to,
|
|
148
|
-
data:
|
|
153
|
+
to: feeOptionsTo,
|
|
154
|
+
data: Hex.fromBytes(data),
|
|
149
155
|
},
|
|
150
156
|
{ ...(this.projectAccessKey ? { 'X-Access-Key': this.projectAccessKey } : undefined) },
|
|
151
157
|
)
|