@0xsequence/relayer 3.0.0-beta.16 → 3.0.0-beta.18
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,5 +1,21 @@
|
|
|
1
1
|
# @0xsequence/relayer
|
|
2
2
|
|
|
3
|
+
## 3.0.0-beta.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- multicall3 optimization
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @0xsequence/wallet-primitives@3.0.0-beta.18
|
|
10
|
+
|
|
11
|
+
## 3.0.0-beta.17
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- New chains, relayer rpc fix
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @0xsequence/wallet-primitives@3.0.0-beta.17
|
|
18
|
+
|
|
3
19
|
## 3.0.0-beta.16
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -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,MAA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;IAsChD,WAAW,CACf,aAAa,EAAE,OAAO,CAAC,OAAO,EAC9B,EAAE,EAAE,OAAO,CAAC,OAAO,EACnB,IAAI,EAAE,GAAG,CAAC,GAAG,EACb,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,QAAQ,EAChB,aAAa,CAAC,EAAE,uBAAuB,EAAE,GACxC,OAAO,CAAC;QAAE,MAAM,EAAE,GAAG,CAAC,GAAG,CAAA;KAAE,CAAC;IAyBzB,KAAK,CACT,EAAE,EAAE,OAAO,CAAC,OAAO,EACnB,IAAI,EAAE,GAAG,CAAC,GAAG,EACb,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,QAAQ,EAChB,aAAa,CAAC,EAAE,uBAAuB,EAAE,GACxC,OAAO,CAAC;QAAE,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';
|
|
@@ -30,12 +30,11 @@ const networkToChain = (network) => {
|
|
|
30
30
|
},
|
|
31
31
|
}
|
|
32
32
|
: undefined,
|
|
33
|
-
contracts: network.
|
|
34
|
-
? {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
33
|
+
contracts: network.contracts
|
|
34
|
+
? Object.entries(network.contracts).reduce((acc, [name, address]) => {
|
|
35
|
+
acc[name] = { address };
|
|
36
|
+
return acc;
|
|
37
|
+
}, {})
|
|
39
38
|
: undefined,
|
|
40
39
|
};
|
|
41
40
|
};
|
|
@@ -104,13 +103,18 @@ export class RpcRelayer {
|
|
|
104
103
|
}
|
|
105
104
|
}
|
|
106
105
|
async feeOptions(wallet, chainId, to, calls) {
|
|
106
|
+
// IMPORTANT:
|
|
107
|
+
// The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
|
|
108
|
+
// wallet-webapp-v3 requests FeeOptions with `to = wallet` and `data = Payload.encode(calls, self=wallet)`.
|
|
109
|
+
// This works for undeployed wallets and avoids guest-module simulation pitfalls.
|
|
107
110
|
const callsStruct = { type: 'call', space: 0n, nonce: 0n, calls: calls };
|
|
108
|
-
const
|
|
111
|
+
const feeOptionsTo = wallet;
|
|
112
|
+
const data = Payload.encode(callsStruct, wallet);
|
|
109
113
|
try {
|
|
110
114
|
const result = await this.client.feeOptions({
|
|
111
115
|
wallet,
|
|
112
|
-
to,
|
|
113
|
-
data:
|
|
116
|
+
to: feeOptionsTo,
|
|
117
|
+
data: Hex.fromBytes(data),
|
|
114
118
|
}, { ...(this.projectAccessKey ? { 'X-Access-Key': this.projectAccessKey } : undefined) });
|
|
115
119
|
const quote = result.quote ? { _tag: 'FeeQuote', _quote: result.quote } : undefined;
|
|
116
120
|
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.18",
|
|
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.18"
|
|
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'
|
|
@@ -49,12 +49,14 @@ const networkToChain = (network: Network.Network): Chain => {
|
|
|
49
49
|
},
|
|
50
50
|
}
|
|
51
51
|
: undefined,
|
|
52
|
-
contracts: network.
|
|
53
|
-
?
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
contracts: network.contracts
|
|
53
|
+
? Object.entries(network.contracts).reduce(
|
|
54
|
+
(acc, [name, address]) => {
|
|
55
|
+
acc[name] = { address }
|
|
56
|
+
return acc
|
|
56
57
|
},
|
|
57
|
-
|
|
58
|
+
{} as Record<string, { address: Address.Address }>,
|
|
59
|
+
)
|
|
58
60
|
: undefined,
|
|
59
61
|
} as Chain
|
|
60
62
|
}
|
|
@@ -137,15 +139,21 @@ export class RpcRelayer implements Relayer {
|
|
|
137
139
|
to: Address.Address,
|
|
138
140
|
calls: Payload.Call[],
|
|
139
141
|
): Promise<{ options: FeeOption[]; quote?: FeeQuote }> {
|
|
142
|
+
// IMPORTANT:
|
|
143
|
+
// The relayer FeeOptions endpoint simulates `eth_call(to, data)`.
|
|
144
|
+
// wallet-webapp-v3 requests FeeOptions with `to = wallet` and `data = Payload.encode(calls, self=wallet)`.
|
|
145
|
+
// This works for undeployed wallets and avoids guest-module simulation pitfalls.
|
|
140
146
|
const callsStruct: Payload.Calls = { type: 'call', space: 0n, nonce: 0n, calls: calls }
|
|
141
|
-
|
|
147
|
+
|
|
148
|
+
const feeOptionsTo = wallet
|
|
149
|
+
const data = Payload.encode(callsStruct, wallet)
|
|
142
150
|
|
|
143
151
|
try {
|
|
144
152
|
const result = await this.client.feeOptions(
|
|
145
153
|
{
|
|
146
154
|
wallet,
|
|
147
|
-
to,
|
|
148
|
-
data:
|
|
155
|
+
to: feeOptionsTo,
|
|
156
|
+
data: Hex.fromBytes(data),
|
|
149
157
|
},
|
|
150
158
|
{ ...(this.projectAccessKey ? { 'X-Access-Key': this.projectAccessKey } : undefined) },
|
|
151
159
|
)
|