thirdweb 5.105.41 → 5.105.42-nightly-2d76cf904079cc74809f571b67ac746fad7aa04f-20250909000351
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/cjs/extensions/erc7702/__generated__/MinimalAccount/events/Executed.js +4 -2
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/events/Executed.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.js +3 -2
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.js +32 -0
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.js.map +1 -0
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/eip712Domain.js +7 -7
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/eip712Domain.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getCallPoliciesForSigner.js +20 -20
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getCallPoliciesForSigner.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getSessionExpirationForSigner.js +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getSessionExpirationForSigner.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getSessionStateForSigner.js +20 -20
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getSessionStateForSigner.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getTransferPoliciesForSigner.js +9 -9
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/getTransferPoliciesForSigner.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/isWildcardSigner.js +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/read/isWildcardSigner.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/createSessionWithSig.js +45 -45
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/createSessionWithSig.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/execute.js +14 -14
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/execute.js.map +1 -1
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/executeWithSig.js +18 -18
- package/dist/cjs/extensions/erc7702/__generated__/MinimalAccount/write/executeWithSig.js.map +1 -1
- package/dist/cjs/gas/fee-data.js +1 -1
- package/dist/cjs/gas/fee-data.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js +2 -6
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js +117 -10
- package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/Executed.js +4 -2
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/Executed.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.js +3 -2
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.js +29 -0
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.js.map +1 -0
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/eip712Domain.js +7 -7
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/eip712Domain.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getCallPoliciesForSigner.js +20 -20
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getCallPoliciesForSigner.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getSessionExpirationForSigner.js +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getSessionExpirationForSigner.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getSessionStateForSigner.js +20 -20
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getSessionStateForSigner.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getTransferPoliciesForSigner.js +9 -9
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/getTransferPoliciesForSigner.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/isWildcardSigner.js +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/read/isWildcardSigner.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/createSessionWithSig.js +45 -45
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/createSessionWithSig.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/execute.js +14 -14
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/execute.js.map +1 -1
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/executeWithSig.js +18 -18
- package/dist/esm/extensions/erc7702/__generated__/MinimalAccount/write/executeWithSig.js.map +1 -1
- package/dist/esm/gas/fee-data.js +1 -1
- package/dist/esm/gas/fee-data.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js +2 -6
- package/dist/esm/react/web/ui/ConnectWallet/Modal/AllWalletsUI.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Modal/ConnectModalContent.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js +117 -10
- package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/Executed.d.ts +25 -8
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/Executed.d.ts.map +1 -1
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.d.ts +14 -4
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.d.ts.map +1 -1
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.d.ts +54 -0
- package/dist/types/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/Modal/AllWalletsUI.d.ts +0 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/AllWalletsUI.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Modal/ConnectModalContent.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/eip7702/minimal-account.d.ts +64 -0
- package/dist/types/wallets/in-app/core/eip7702/minimal-account.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/extensions/erc7702/__generated__/MinimalAccount/events/Executed.ts +17 -4
- package/src/extensions/erc7702/__generated__/MinimalAccount/events/SessionCreated.ts +11 -5
- package/src/extensions/erc7702/__generated__/MinimalAccount/events/ValueReceived.ts +47 -0
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/eip712Domain.ts +7 -7
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/getCallPoliciesForSigner.ts +20 -20
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/getSessionExpirationForSigner.ts +1 -1
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/getSessionStateForSigner.ts +20 -20
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/getTransferPoliciesForSigner.ts +9 -9
- package/src/extensions/erc7702/__generated__/MinimalAccount/read/isWildcardSigner.ts +1 -1
- package/src/extensions/erc7702/__generated__/MinimalAccount/write/createSessionWithSig.ts +47 -47
- package/src/extensions/erc7702/__generated__/MinimalAccount/write/execute.ts +16 -16
- package/src/extensions/erc7702/__generated__/MinimalAccount/write/executeWithSig.ts +20 -20
- package/src/extensions/erc7702/account/sessionkey.test.ts +2 -4
- package/src/gas/fee-data.ts +1 -1
- package/src/react/web/ui/ConnectWallet/Modal/AllWalletsUI.tsx +5 -12
- package/src/react/web/ui/ConnectWallet/Modal/ConnectModalContent.tsx +0 -1
- package/src/react/web/wallets/in-app/WalletAuth.tsx +0 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/eip7702/minimal-account.ts +149 -10
- package/src/wallets/in-app/web/lib/in-app-gateway.test.ts +87 -103
- package/src/wallets/in-app/web/lib/in-app-integration.test.ts +1 -2
@@ -81,134 +81,134 @@ export type CreateSessionWithSigParams = WithOverrides<{
|
|
81
81
|
export const FN_SELECTOR = "0xb5051648" as const;
|
82
82
|
const FN_INPUTS = [
|
83
83
|
{
|
84
|
+
type: "tuple",
|
85
|
+
name: "sessionSpec",
|
84
86
|
components: [
|
85
87
|
{
|
86
|
-
name: "signer",
|
87
88
|
type: "address",
|
89
|
+
name: "signer",
|
88
90
|
},
|
89
91
|
{
|
90
|
-
name: "isWildcard",
|
91
92
|
type: "bool",
|
93
|
+
name: "isWildcard",
|
92
94
|
},
|
93
95
|
{
|
94
|
-
name: "expiresAt",
|
95
96
|
type: "uint256",
|
97
|
+
name: "expiresAt",
|
96
98
|
},
|
97
99
|
{
|
100
|
+
type: "tuple[]",
|
101
|
+
name: "callPolicies",
|
98
102
|
components: [
|
99
103
|
{
|
100
|
-
name: "target",
|
101
104
|
type: "address",
|
105
|
+
name: "target",
|
102
106
|
},
|
103
107
|
{
|
104
|
-
name: "selector",
|
105
108
|
type: "bytes4",
|
109
|
+
name: "selector",
|
106
110
|
},
|
107
111
|
{
|
108
|
-
name: "maxValuePerUse",
|
109
112
|
type: "uint256",
|
113
|
+
name: "maxValuePerUse",
|
110
114
|
},
|
111
115
|
{
|
116
|
+
type: "tuple",
|
117
|
+
name: "valueLimit",
|
112
118
|
components: [
|
113
119
|
{
|
114
|
-
name: "limitType",
|
115
120
|
type: "uint8",
|
121
|
+
name: "limitType",
|
116
122
|
},
|
117
123
|
{
|
118
|
-
name: "limit",
|
119
124
|
type: "uint256",
|
125
|
+
name: "limit",
|
120
126
|
},
|
121
127
|
{
|
122
|
-
name: "period",
|
123
128
|
type: "uint256",
|
129
|
+
name: "period",
|
124
130
|
},
|
125
131
|
],
|
126
|
-
name: "valueLimit",
|
127
|
-
type: "tuple",
|
128
132
|
},
|
129
133
|
{
|
134
|
+
type: "tuple[]",
|
135
|
+
name: "constraints",
|
130
136
|
components: [
|
131
137
|
{
|
132
|
-
name: "condition",
|
133
138
|
type: "uint8",
|
139
|
+
name: "condition",
|
134
140
|
},
|
135
141
|
{
|
136
|
-
name: "index",
|
137
142
|
type: "uint64",
|
143
|
+
name: "index",
|
138
144
|
},
|
139
145
|
{
|
140
|
-
name: "refValue",
|
141
146
|
type: "bytes32",
|
147
|
+
name: "refValue",
|
142
148
|
},
|
143
149
|
{
|
150
|
+
type: "tuple",
|
151
|
+
name: "limit",
|
144
152
|
components: [
|
145
153
|
{
|
146
|
-
name: "limitType",
|
147
154
|
type: "uint8",
|
155
|
+
name: "limitType",
|
148
156
|
},
|
149
157
|
{
|
150
|
-
name: "limit",
|
151
158
|
type: "uint256",
|
159
|
+
name: "limit",
|
152
160
|
},
|
153
161
|
{
|
154
|
-
name: "period",
|
155
162
|
type: "uint256",
|
163
|
+
name: "period",
|
156
164
|
},
|
157
165
|
],
|
158
|
-
name: "limit",
|
159
|
-
type: "tuple",
|
160
166
|
},
|
161
167
|
],
|
162
|
-
name: "constraints",
|
163
|
-
type: "tuple[]",
|
164
168
|
},
|
165
169
|
],
|
166
|
-
name: "callPolicies",
|
167
|
-
type: "tuple[]",
|
168
170
|
},
|
169
171
|
{
|
172
|
+
type: "tuple[]",
|
173
|
+
name: "transferPolicies",
|
170
174
|
components: [
|
171
175
|
{
|
172
|
-
name: "target",
|
173
176
|
type: "address",
|
177
|
+
name: "target",
|
174
178
|
},
|
175
179
|
{
|
176
|
-
name: "maxValuePerUse",
|
177
180
|
type: "uint256",
|
181
|
+
name: "maxValuePerUse",
|
178
182
|
},
|
179
183
|
{
|
184
|
+
type: "tuple",
|
185
|
+
name: "valueLimit",
|
180
186
|
components: [
|
181
187
|
{
|
182
|
-
name: "limitType",
|
183
188
|
type: "uint8",
|
189
|
+
name: "limitType",
|
184
190
|
},
|
185
191
|
{
|
186
|
-
name: "limit",
|
187
192
|
type: "uint256",
|
193
|
+
name: "limit",
|
188
194
|
},
|
189
195
|
{
|
190
|
-
name: "period",
|
191
196
|
type: "uint256",
|
197
|
+
name: "period",
|
192
198
|
},
|
193
199
|
],
|
194
|
-
name: "valueLimit",
|
195
|
-
type: "tuple",
|
196
200
|
},
|
197
201
|
],
|
198
|
-
name: "transferPolicies",
|
199
|
-
type: "tuple[]",
|
200
202
|
},
|
201
203
|
{
|
202
|
-
name: "uid",
|
203
204
|
type: "bytes32",
|
205
|
+
name: "uid",
|
204
206
|
},
|
205
207
|
],
|
206
|
-
name: "sessionSpec",
|
207
|
-
type: "tuple",
|
208
208
|
},
|
209
209
|
{
|
210
|
-
name: "signature",
|
211
210
|
type: "bytes",
|
211
|
+
name: "signature",
|
212
212
|
},
|
213
213
|
] as const;
|
214
214
|
const FN_OUTPUTS = [] as const;
|
@@ -316,23 +316,23 @@ export function createSessionWithSig(
|
|
316
316
|
});
|
317
317
|
|
318
318
|
return prepareContractCall({
|
319
|
-
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
320
|
-
authorizationList: async () =>
|
321
|
-
(await asyncOptions()).overrides?.authorizationList,
|
322
319
|
contract: options.contract,
|
323
|
-
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
324
|
-
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
325
|
-
gas: async () => (await asyncOptions()).overrides?.gas,
|
326
|
-
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
327
|
-
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
328
|
-
maxPriorityFeePerGas: async () =>
|
329
|
-
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
330
320
|
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
331
|
-
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
332
321
|
params: async () => {
|
333
322
|
const resolvedOptions = await asyncOptions();
|
334
323
|
return [resolvedOptions.sessionSpec, resolvedOptions.signature] as const;
|
335
324
|
},
|
336
325
|
value: async () => (await asyncOptions()).overrides?.value,
|
326
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
327
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
328
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
329
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
330
|
+
maxPriorityFeePerGas: async () =>
|
331
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
332
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
333
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
334
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
335
|
+
authorizationList: async () =>
|
336
|
+
(await asyncOptions()).overrides?.authorizationList,
|
337
337
|
});
|
338
338
|
}
|
@@ -26,22 +26,22 @@ export type ExecuteParams = WithOverrides<{
|
|
26
26
|
export const FN_SELECTOR = "0x3f707e6b" as const;
|
27
27
|
const FN_INPUTS = [
|
28
28
|
{
|
29
|
+
type: "tuple[]",
|
30
|
+
name: "calls",
|
29
31
|
components: [
|
30
32
|
{
|
31
|
-
name: "target",
|
32
33
|
type: "address",
|
34
|
+
name: "target",
|
33
35
|
},
|
34
36
|
{
|
35
|
-
name: "value",
|
36
37
|
type: "uint256",
|
38
|
+
name: "value",
|
37
39
|
},
|
38
40
|
{
|
39
|
-
name: "data",
|
40
41
|
type: "bytes",
|
42
|
+
name: "data",
|
41
43
|
},
|
42
44
|
],
|
43
|
-
name: "calls",
|
44
|
-
type: "tuple[]",
|
45
45
|
},
|
46
46
|
] as const;
|
47
47
|
const FN_OUTPUTS = [] as const;
|
@@ -137,23 +137,23 @@ export function execute(
|
|
137
137
|
});
|
138
138
|
|
139
139
|
return prepareContractCall({
|
140
|
-
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
141
|
-
authorizationList: async () =>
|
142
|
-
(await asyncOptions()).overrides?.authorizationList,
|
143
140
|
contract: options.contract,
|
144
|
-
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
145
|
-
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
146
|
-
gas: async () => (await asyncOptions()).overrides?.gas,
|
147
|
-
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
148
|
-
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
149
|
-
maxPriorityFeePerGas: async () =>
|
150
|
-
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
151
141
|
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
152
|
-
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
153
142
|
params: async () => {
|
154
143
|
const resolvedOptions = await asyncOptions();
|
155
144
|
return [resolvedOptions.calls] as const;
|
156
145
|
},
|
157
146
|
value: async () => (await asyncOptions()).overrides?.value,
|
147
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
148
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
149
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
150
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
151
|
+
maxPriorityFeePerGas: async () =>
|
152
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
153
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
154
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
155
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
156
|
+
authorizationList: async () =>
|
157
|
+
(await asyncOptions()).overrides?.authorizationList,
|
158
158
|
});
|
159
159
|
}
|
@@ -34,36 +34,36 @@ export type ExecuteWithSigParams = WithOverrides<{
|
|
34
34
|
export const FN_SELECTOR = "0xba61557d" as const;
|
35
35
|
const FN_INPUTS = [
|
36
36
|
{
|
37
|
+
type: "tuple",
|
38
|
+
name: "wrappedCalls",
|
37
39
|
components: [
|
38
40
|
{
|
41
|
+
type: "tuple[]",
|
42
|
+
name: "calls",
|
39
43
|
components: [
|
40
44
|
{
|
41
|
-
name: "target",
|
42
45
|
type: "address",
|
46
|
+
name: "target",
|
43
47
|
},
|
44
48
|
{
|
45
|
-
name: "value",
|
46
49
|
type: "uint256",
|
50
|
+
name: "value",
|
47
51
|
},
|
48
52
|
{
|
49
|
-
name: "data",
|
50
53
|
type: "bytes",
|
54
|
+
name: "data",
|
51
55
|
},
|
52
56
|
],
|
53
|
-
name: "calls",
|
54
|
-
type: "tuple[]",
|
55
57
|
},
|
56
58
|
{
|
57
|
-
name: "uid",
|
58
59
|
type: "bytes32",
|
60
|
+
name: "uid",
|
59
61
|
},
|
60
62
|
],
|
61
|
-
name: "wrappedCalls",
|
62
|
-
type: "tuple",
|
63
63
|
},
|
64
64
|
{
|
65
|
-
name: "signature",
|
66
65
|
type: "bytes",
|
66
|
+
name: "signature",
|
67
67
|
},
|
68
68
|
] as const;
|
69
69
|
const FN_OUTPUTS = [] as const;
|
@@ -167,23 +167,23 @@ export function executeWithSig(
|
|
167
167
|
});
|
168
168
|
|
169
169
|
return prepareContractCall({
|
170
|
-
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
171
|
-
authorizationList: async () =>
|
172
|
-
(await asyncOptions()).overrides?.authorizationList,
|
173
170
|
contract: options.contract,
|
174
|
-
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
175
|
-
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
176
|
-
gas: async () => (await asyncOptions()).overrides?.gas,
|
177
|
-
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
178
|
-
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
179
|
-
maxPriorityFeePerGas: async () =>
|
180
|
-
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
181
171
|
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
|
182
|
-
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
183
172
|
params: async () => {
|
184
173
|
const resolvedOptions = await asyncOptions();
|
185
174
|
return [resolvedOptions.wrappedCalls, resolvedOptions.signature] as const;
|
186
175
|
},
|
187
176
|
value: async () => (await asyncOptions()).overrides?.value,
|
177
|
+
accessList: async () => (await asyncOptions()).overrides?.accessList,
|
178
|
+
gas: async () => (await asyncOptions()).overrides?.gas,
|
179
|
+
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
|
180
|
+
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
|
181
|
+
maxPriorityFeePerGas: async () =>
|
182
|
+
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
|
183
|
+
nonce: async () => (await asyncOptions()).overrides?.nonce,
|
184
|
+
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
|
185
|
+
erc20Value: async () => (await asyncOptions()).overrides?.erc20Value,
|
186
|
+
authorizationList: async () =>
|
187
|
+
(await asyncOptions()).overrides?.authorizationList,
|
188
188
|
});
|
189
189
|
}
|
@@ -75,7 +75,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
75
75
|
events: [sessionCreatedEvent()],
|
76
76
|
logs: receipt.logs,
|
77
77
|
});
|
78
|
-
expect(logs[0]?.args.
|
78
|
+
expect(logs[0]?.args.newSigner).toBe(TEST_ACCOUNT_A.address);
|
79
79
|
});
|
80
80
|
|
81
81
|
it("should allow adding granular session keys", async () => {
|
@@ -124,9 +124,7 @@ describe.runIf(process.env.TW_SECRET_KEY)(
|
|
124
124
|
events: [sessionCreatedEvent()],
|
125
125
|
logs: receipt.logs,
|
126
126
|
});
|
127
|
-
expect(logs[0]?.args.
|
128
|
-
expect(logs[0]?.args.sessionSpec.callPolicies).toHaveLength(1);
|
129
|
-
expect(logs[0]?.args.sessionSpec.transferPolicies).toHaveLength(1);
|
127
|
+
expect(logs[0]?.args.newSigner).toBe(TEST_ACCOUNT_A.address);
|
130
128
|
});
|
131
129
|
},
|
132
130
|
);
|
package/src/gas/fee-data.ts
CHANGED
@@ -242,7 +242,7 @@ function getGasStationUrl(chainId: 137 | 80002): string {
|
|
242
242
|
case 137:
|
243
243
|
return "https://gasstation.polygon.technology/v2";
|
244
244
|
case 80002:
|
245
|
-
return "https://gasstation
|
245
|
+
return "https://gasstation.polygon.technology/amoy";
|
246
246
|
}
|
247
247
|
}
|
248
248
|
|
@@ -28,7 +28,6 @@ import { WalletEntryButton } from "../WalletEntryButton.js";
|
|
28
28
|
function AllWalletsUI(props: {
|
29
29
|
onBack: () => void;
|
30
30
|
onSelect: (wallet: Wallet) => void;
|
31
|
-
specifiedWallets: Wallet[];
|
32
31
|
size: "compact" | "wide";
|
33
32
|
client: ThirdwebClient;
|
34
33
|
recommendedWallets: Wallet[] | undefined;
|
@@ -39,17 +38,11 @@ function AllWalletsUI(props: {
|
|
39
38
|
const setSelectionData = useSetSelectionData();
|
40
39
|
|
41
40
|
const walletList = useMemo(() => {
|
42
|
-
return walletInfos
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
})
|
48
|
-
.filter(
|
49
|
-
(info) =>
|
50
|
-
info.id !== "inApp" && info.id !== "embedded" && info.id !== "smart",
|
51
|
-
);
|
52
|
-
}, [props.specifiedWallets]);
|
41
|
+
return walletInfos.filter(
|
42
|
+
(info) =>
|
43
|
+
info.id !== "inApp" && info.id !== "embedded" && info.id !== "smart",
|
44
|
+
);
|
45
|
+
}, []);
|
53
46
|
|
54
47
|
const fuseInstance = useMemo(() => {
|
55
48
|
return new Fuse(walletList, {
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.105.
|
1
|
+
export const version = "5.105.42-nightly-2d76cf904079cc74809f571b67ac746fad7aa04f-20250909000351";
|
@@ -14,6 +14,9 @@ import type { SignedAuthorization } from "../../../../transaction/actions/eip770
|
|
14
14
|
import { toSerializableTransaction } from "../../../../transaction/actions/to-serializable-transaction.js";
|
15
15
|
import type { SendTransactionResult } from "../../../../transaction/types.js";
|
16
16
|
import { getAddress } from "../../../../utils/address.js";
|
17
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
18
|
+
import { stringify } from "../../../../utils/json.js";
|
19
|
+
import { withCache } from "../../../../utils/promise/withCache.js";
|
17
20
|
import { randomBytesHex } from "../../../../utils/random.js";
|
18
21
|
import type {
|
19
22
|
Account,
|
@@ -23,11 +26,140 @@ import {
|
|
23
26
|
executeWithSignature,
|
24
27
|
getQueuedTransactionHash,
|
25
28
|
} from "../../../smart/lib/bundler.js";
|
29
|
+
import { getDefaultBundlerUrl } from "../../../smart/lib/constants.js";
|
26
30
|
import type { BundlerOptions } from "../../../smart/types.js";
|
27
31
|
|
28
|
-
|
29
|
-
|
32
|
+
interface DelegationContractResponse {
|
33
|
+
id: string;
|
34
|
+
jsonrpc: string;
|
35
|
+
result: {
|
36
|
+
delegationContract: string;
|
37
|
+
};
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Fetches the delegation contract address from the bundler using the tw_getDelegationContract RPC method
|
42
|
+
* @internal
|
43
|
+
*/
|
44
|
+
async function getDelegationContractAddress(args: {
|
45
|
+
client: ThirdwebClient;
|
46
|
+
chain: Chain;
|
47
|
+
bundlerUrl?: string;
|
48
|
+
}): Promise<string> {
|
49
|
+
const { client, chain, bundlerUrl } = args;
|
50
|
+
const url = bundlerUrl ?? getDefaultBundlerUrl(chain);
|
51
|
+
|
52
|
+
// Create a cache key based on the bundler URL to ensure we cache per chain/bundler
|
53
|
+
const cacheKey = `delegation-contract:${url}`;
|
54
|
+
|
55
|
+
return withCache(
|
56
|
+
async () => {
|
57
|
+
const fetchWithHeaders = getClientFetch(client);
|
58
|
+
|
59
|
+
const response = await fetchWithHeaders(url, {
|
60
|
+
useAuthToken: true,
|
61
|
+
body: stringify({
|
62
|
+
id: 1,
|
63
|
+
jsonrpc: "2.0",
|
64
|
+
method: "tw_getDelegationContract",
|
65
|
+
params: [],
|
66
|
+
}),
|
67
|
+
headers: {
|
68
|
+
"Content-Type": "application/json",
|
69
|
+
},
|
70
|
+
method: "POST",
|
71
|
+
});
|
72
|
+
|
73
|
+
if (!response.ok) {
|
74
|
+
throw new Error(
|
75
|
+
`Failed to fetch delegation contract: ${response.status} ${response.statusText}`,
|
76
|
+
);
|
77
|
+
}
|
30
78
|
|
79
|
+
const result: DelegationContractResponse = await response.json();
|
80
|
+
|
81
|
+
if ((result as any).error) {
|
82
|
+
throw new Error(
|
83
|
+
`Delegation contract RPC error: ${JSON.stringify((result as any).error)}`,
|
84
|
+
);
|
85
|
+
}
|
86
|
+
|
87
|
+
if (!result.result?.delegationContract) {
|
88
|
+
throw new Error(
|
89
|
+
"Invalid response: missing delegationContract in result",
|
90
|
+
);
|
91
|
+
}
|
92
|
+
|
93
|
+
return result.result.delegationContract;
|
94
|
+
},
|
95
|
+
{ cacheKey, cacheTime: 24 * 60 * 60 * 1000 }, // cache for 24 hours
|
96
|
+
);
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Creates an EIP-7702 account that enables EOA (Externally Owned Account) delegation
|
101
|
+
* to smart contract functionality. This allows an EOA to delegate its code execution
|
102
|
+
* to a minimal account contract, enabling features like batch transactions and sponsored gas.
|
103
|
+
*
|
104
|
+
* The minimal account leverages EIP-7702 authorization to delegate the EOA's code to a
|
105
|
+
* MinimalAccount contract, allowing the EOA to execute smart contract functions while
|
106
|
+
* maintaining its original address and private key control.
|
107
|
+
*
|
108
|
+
* @param args - Configuration object for creating the minimal account
|
109
|
+
* @param args.client - The thirdweb client instance for blockchain interactions
|
110
|
+
* @param args.adminAccount - The EOA account that will be delegated to the minimal account contract
|
111
|
+
* @param args.sponsorGas - Optional flag to enable sponsored gas transactions via bundler
|
112
|
+
*
|
113
|
+
* @returns An Account object with enhanced capabilities including batch transactions and EIP-5792 support
|
114
|
+
*
|
115
|
+
* @example
|
116
|
+
* ```typescript
|
117
|
+
* import { createThirdwebClient, sendBatchTransaction } from "thirdweb";
|
118
|
+
* import { privateKeyToAccount } from "thirdweb/wallets";
|
119
|
+
* import { create7702MinimalAccount } from "thirdweb/wallets/in-app";
|
120
|
+
* import { sepolia } from "thirdweb/chains";
|
121
|
+
*
|
122
|
+
* // Create a client
|
123
|
+
* const client = createThirdwebClient({
|
124
|
+
* clientId: "your-client-id"
|
125
|
+
* });
|
126
|
+
*
|
127
|
+
* // Create an EOA account
|
128
|
+
* const adminAccount = privateKeyToAccount({
|
129
|
+
* client,
|
130
|
+
* privateKey: "0x..."
|
131
|
+
* });
|
132
|
+
*
|
133
|
+
* // Wrap it with a EIP-7702 account
|
134
|
+
* const minimal7702Account = create7702MinimalAccount({
|
135
|
+
* client,
|
136
|
+
* adminAccount,
|
137
|
+
* sponsorGas: true // Enable sponsored transactions
|
138
|
+
* });
|
139
|
+
*
|
140
|
+
* // Send a batch of transactions
|
141
|
+
* const result = await sendBatchTransaction({
|
142
|
+
* account: minimal7702Account,
|
143
|
+
* transactions: [
|
144
|
+
* {
|
145
|
+
* to: "0x...",
|
146
|
+
* data: "0x...",
|
147
|
+
* value: 0n,
|
148
|
+
* chainId: sepolia.id
|
149
|
+
* },
|
150
|
+
* {
|
151
|
+
* to: "0x...",
|
152
|
+
* data: "0x...",
|
153
|
+
* value: 0n,
|
154
|
+
* chainId: sepolia.id
|
155
|
+
* }
|
156
|
+
* ]});
|
157
|
+
*
|
158
|
+
* console.log("Batch transaction hash:", result.transactionHash);
|
159
|
+
* ```
|
160
|
+
*
|
161
|
+
* @wallet
|
162
|
+
*/
|
31
163
|
export const create7702MinimalAccount = (args: {
|
32
164
|
client: ThirdwebClient;
|
33
165
|
adminAccount: Account;
|
@@ -49,7 +181,14 @@ export const create7702MinimalAccount = (args: {
|
|
49
181
|
});
|
50
182
|
// check if account has been delegated already
|
51
183
|
let authorization: SignedAuthorization | undefined;
|
52
|
-
const
|
184
|
+
const delegationContractAddress = await getDelegationContractAddress({
|
185
|
+
client,
|
186
|
+
chain,
|
187
|
+
});
|
188
|
+
const isMinimalAccount = await is7702MinimalAccount(
|
189
|
+
eoaContract,
|
190
|
+
delegationContractAddress,
|
191
|
+
);
|
53
192
|
if (!isMinimalAccount) {
|
54
193
|
// if not, sign authorization
|
55
194
|
let nonce = firstTx.nonce
|
@@ -58,12 +197,12 @@ export const create7702MinimalAccount = (args: {
|
|
58
197
|
await getNonce({
|
59
198
|
client,
|
60
199
|
address: adminAccount.address,
|
61
|
-
chain
|
200
|
+
chain,
|
62
201
|
}),
|
63
202
|
);
|
64
203
|
nonce += sponsorGas ? 0n : 1n;
|
65
204
|
const auth = await adminAccount.signAuthorization?.({
|
66
|
-
address:
|
205
|
+
address: getAddress(delegationContractAddress),
|
67
206
|
chainId: firstTx.chainId,
|
68
207
|
nonce,
|
69
208
|
});
|
@@ -76,7 +215,7 @@ export const create7702MinimalAccount = (args: {
|
|
76
215
|
// send transaction from executor, needs signature
|
77
216
|
const wrappedCalls = {
|
78
217
|
calls: txs.map((tx) => ({
|
79
|
-
data: tx.data ?? "0x",
|
218
|
+
data: tx.data ?? "0x",
|
80
219
|
target: getAddress(tx.to ?? ""),
|
81
220
|
value: tx.value ?? 0n,
|
82
221
|
})),
|
@@ -131,7 +270,7 @@ export const create7702MinimalAccount = (args: {
|
|
131
270
|
const executeTx = execute({
|
132
271
|
calls: txs.map((tx) => ({
|
133
272
|
data: tx.data ?? "0x",
|
134
|
-
target: tx.to ?? "",
|
273
|
+
target: getAddress(tx.to ?? ""),
|
135
274
|
value: tx.value ?? 0n,
|
136
275
|
})),
|
137
276
|
contract: eoaContract,
|
@@ -228,7 +367,7 @@ async function getNonce(args: {
|
|
228
367
|
"../../../../rpc/actions/eth_getTransactionCount.js"
|
229
368
|
).then(({ eth_getTransactionCount }) =>
|
230
369
|
eth_getTransactionCount(rpcRequest, {
|
231
|
-
address,
|
370
|
+
address: getAddress(address),
|
232
371
|
blockTag: "pending",
|
233
372
|
}),
|
234
373
|
);
|
@@ -238,14 +377,14 @@ async function getNonce(args: {
|
|
238
377
|
async function is7702MinimalAccount(
|
239
378
|
// biome-ignore lint/suspicious/noExplicitAny: TODO properly type tw contract
|
240
379
|
eoaContract: ThirdwebContract<any>,
|
380
|
+
delegationContractAddress: string,
|
241
381
|
): Promise<boolean> {
|
242
382
|
const code = await getBytecode(eoaContract);
|
243
383
|
const isDelegated = code.length > 0 && code.startsWith("0xef0100");
|
244
384
|
const target = `0x${code.slice(8, 48)}`;
|
245
385
|
return (
|
246
386
|
isDelegated &&
|
247
|
-
target.toLowerCase() ===
|
248
|
-
MINIMAL_ACCOUNT_IMPLEMENTATION_ADDRESS.toLowerCase()
|
387
|
+
target.toLowerCase() === delegationContractAddress.toLowerCase()
|
249
388
|
);
|
250
389
|
}
|
251
390
|
|