thirdweb 5.105.21 → 5.105.23

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.
Files changed (145) hide show
  1. package/dist/cjs/extensions/erc1155/read/getOwnedNFTs.js +1 -0
  2. package/dist/cjs/extensions/erc1155/read/getOwnedNFTs.js.map +1 -1
  3. package/dist/cjs/extensions/erc721/read/getOwnedNFTs.js +1 -0
  4. package/dist/cjs/extensions/erc721/read/getOwnedNFTs.js.map +1 -1
  5. package/dist/cjs/insight/get-nfts.js +3 -3
  6. package/dist/cjs/insight/get-nfts.js.map +1 -1
  7. package/dist/cjs/insight/get-tokens.js +3 -2
  8. package/dist/cjs/insight/get-tokens.js.map +1 -1
  9. package/dist/cjs/react/web/wallets/shared/WalletConnectConnection.js +7 -33
  10. package/dist/cjs/react/web/wallets/shared/WalletConnectConnection.js.map +1 -1
  11. package/dist/cjs/transaction/actions/estimate-gas.js +3 -24
  12. package/dist/cjs/transaction/actions/estimate-gas.js.map +1 -1
  13. package/dist/cjs/utils/web/isMobile.js +0 -2
  14. package/dist/cjs/utils/web/isMobile.js.map +1 -1
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/cjs/wallets/coinbase/coinbase-web.js +56 -0
  17. package/dist/cjs/wallets/coinbase/coinbase-web.js.map +1 -1
  18. package/dist/cjs/wallets/create-wallet.js +21 -4
  19. package/dist/cjs/wallets/create-wallet.js.map +1 -1
  20. package/dist/cjs/wallets/eip5792/get-calls-status.js +40 -63
  21. package/dist/cjs/wallets/eip5792/get-calls-status.js.map +1 -1
  22. package/dist/cjs/wallets/eip5792/get-capabilities.js +14 -49
  23. package/dist/cjs/wallets/eip5792/get-capabilities.js.map +1 -1
  24. package/dist/cjs/wallets/eip5792/send-calls.js +34 -48
  25. package/dist/cjs/wallets/eip5792/send-calls.js.map +1 -1
  26. package/dist/cjs/wallets/in-app/core/{eip5972 → eip5792}/in-app-wallet-calls.js +1 -5
  27. package/dist/cjs/wallets/in-app/core/eip5792/in-app-wallet-calls.js.map +1 -0
  28. package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js +650 -5
  29. package/dist/cjs/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
  30. package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +32 -1
  31. package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
  32. package/dist/cjs/wallets/injected/index.js +55 -0
  33. package/dist/cjs/wallets/injected/index.js.map +1 -1
  34. package/dist/cjs/wallets/smart/index.js +61 -0
  35. package/dist/cjs/wallets/smart/index.js.map +1 -1
  36. package/dist/cjs/wallets/wallet-connect/controller.js +27 -25
  37. package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
  38. package/dist/esm/extensions/erc1155/read/getOwnedNFTs.js +1 -0
  39. package/dist/esm/extensions/erc1155/read/getOwnedNFTs.js.map +1 -1
  40. package/dist/esm/extensions/erc721/read/getOwnedNFTs.js +1 -0
  41. package/dist/esm/extensions/erc721/read/getOwnedNFTs.js.map +1 -1
  42. package/dist/esm/insight/get-nfts.js +3 -3
  43. package/dist/esm/insight/get-nfts.js.map +1 -1
  44. package/dist/esm/insight/get-tokens.js +3 -2
  45. package/dist/esm/insight/get-tokens.js.map +1 -1
  46. package/dist/esm/react/web/wallets/shared/WalletConnectConnection.js +8 -34
  47. package/dist/esm/react/web/wallets/shared/WalletConnectConnection.js.map +1 -1
  48. package/dist/esm/transaction/actions/estimate-gas.js +3 -24
  49. package/dist/esm/transaction/actions/estimate-gas.js.map +1 -1
  50. package/dist/esm/utils/web/isMobile.js +2 -2
  51. package/dist/esm/utils/web/isMobile.js.map +1 -1
  52. package/dist/esm/version.js +1 -1
  53. package/dist/esm/wallets/coinbase/coinbase-web.js +56 -0
  54. package/dist/esm/wallets/coinbase/coinbase-web.js.map +1 -1
  55. package/dist/esm/wallets/create-wallet.js +21 -4
  56. package/dist/esm/wallets/create-wallet.js.map +1 -1
  57. package/dist/esm/wallets/eip5792/get-calls-status.js +39 -63
  58. package/dist/esm/wallets/eip5792/get-calls-status.js.map +1 -1
  59. package/dist/esm/wallets/eip5792/get-capabilities.js +13 -49
  60. package/dist/esm/wallets/eip5792/get-capabilities.js.map +1 -1
  61. package/dist/esm/wallets/eip5792/send-calls.js +33 -48
  62. package/dist/esm/wallets/eip5792/send-calls.js.map +1 -1
  63. package/dist/esm/wallets/in-app/core/{eip5972 → eip5792}/in-app-wallet-calls.js +1 -5
  64. package/dist/esm/wallets/in-app/core/eip5792/in-app-wallet-calls.js.map +1 -0
  65. package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js +650 -5
  66. package/dist/esm/wallets/in-app/core/eip7702/minimal-account.js.map +1 -1
  67. package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +32 -1
  68. package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
  69. package/dist/esm/wallets/injected/index.js +56 -1
  70. package/dist/esm/wallets/injected/index.js.map +1 -1
  71. package/dist/esm/wallets/smart/index.js +61 -0
  72. package/dist/esm/wallets/smart/index.js.map +1 -1
  73. package/dist/esm/wallets/wallet-connect/controller.js +27 -25
  74. package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
  75. package/dist/types/bridge/Webhook.d.ts +2 -2
  76. package/dist/types/insight/get-nfts.d.ts +1 -0
  77. package/dist/types/insight/get-nfts.d.ts.map +1 -1
  78. package/dist/types/insight/get-tokens.d.ts +1 -0
  79. package/dist/types/insight/get-tokens.d.ts.map +1 -1
  80. package/dist/types/react/core/hooks/wallets/useWaitForCallsReceipt.d.ts +1 -1
  81. package/dist/types/react/core/utils/storage.d.ts +1 -1
  82. package/dist/types/react/web/utils/storage.d.ts +1 -1
  83. package/dist/types/react/web/wallets/shared/WalletConnectConnection.d.ts.map +1 -1
  84. package/dist/types/transaction/actions/estimate-gas.d.ts.map +1 -1
  85. package/dist/types/utils/web/isMobile.d.ts +0 -8
  86. package/dist/types/utils/web/isMobile.d.ts.map +1 -1
  87. package/dist/types/version.d.ts +1 -1
  88. package/dist/types/wallets/coinbase/coinbase-web.d.ts.map +1 -1
  89. package/dist/types/wallets/create-wallet.d.ts.map +1 -1
  90. package/dist/types/wallets/eip5792/get-calls-status.d.ts +2 -1
  91. package/dist/types/wallets/eip5792/get-calls-status.d.ts.map +1 -1
  92. package/dist/types/wallets/eip5792/get-capabilities.d.ts +1 -0
  93. package/dist/types/wallets/eip5792/get-capabilities.d.ts.map +1 -1
  94. package/dist/types/wallets/eip5792/send-calls.d.ts +6 -1
  95. package/dist/types/wallets/eip5792/send-calls.d.ts.map +1 -1
  96. package/dist/types/wallets/in-app/core/{eip5972 → eip5792}/in-app-wallet-calls.d.ts +3 -2
  97. package/dist/types/wallets/in-app/core/eip5792/in-app-wallet-calls.d.ts.map +1 -0
  98. package/dist/types/wallets/in-app/core/eip7702/minimal-account.d.ts.map +1 -1
  99. package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts.map +1 -1
  100. package/dist/types/wallets/injected/index.d.ts.map +1 -1
  101. package/dist/types/wallets/interfaces/wallet.d.ts +22 -0
  102. package/dist/types/wallets/interfaces/wallet.d.ts.map +1 -1
  103. package/dist/types/wallets/smart/index.d.ts.map +1 -1
  104. package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
  105. package/package.json +3 -3
  106. package/src/extensions/erc1155/read/getOwnedNFTs.ts +1 -0
  107. package/src/extensions/erc721/read/getOwnedNFTs.ts +1 -0
  108. package/src/insight/get-nfts.ts +4 -3
  109. package/src/insight/get-tokens.ts +4 -2
  110. package/src/react/web/wallets/shared/WalletConnectConnection.tsx +11 -46
  111. package/src/transaction/actions/estimate-gas.ts +14 -42
  112. package/src/utils/web/isMobile.ts +2 -2
  113. package/src/version.ts +1 -1
  114. package/src/wallets/coinbase/coinbase-web.ts +66 -0
  115. package/src/wallets/create-wallet.ts +53 -31
  116. package/src/wallets/eip5792/get-calls-status.test.ts +156 -146
  117. package/src/wallets/eip5792/get-calls-status.ts +44 -73
  118. package/src/wallets/eip5792/get-capabilities.test.ts +216 -205
  119. package/src/wallets/eip5792/get-capabilities.ts +23 -64
  120. package/src/wallets/eip5792/send-calls.test.ts +183 -189
  121. package/src/wallets/eip5792/send-calls.ts +53 -71
  122. package/src/wallets/in-app/core/{eip5972 → eip5792}/in-app-wallet-calls.ts +4 -8
  123. package/src/wallets/in-app/core/eip7702/minimal-account.ts +666 -5
  124. package/src/wallets/in-app/core/wallet/enclave-wallet.ts +36 -1
  125. package/src/wallets/injected/index.ts +63 -0
  126. package/src/wallets/interfaces/wallet.ts +31 -0
  127. package/src/wallets/smart/index.ts +69 -1
  128. package/src/wallets/wallet-connect/controller.ts +28 -25
  129. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-calls.js.map +0 -1
  130. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js +0 -41
  131. package/dist/cjs/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js.map +0 -1
  132. package/dist/cjs/wallets/smart/lib/smart-wallet-capabilities.js +0 -30
  133. package/dist/cjs/wallets/smart/lib/smart-wallet-capabilities.js.map +0 -1
  134. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-calls.js.map +0 -1
  135. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js +0 -38
  136. package/dist/esm/wallets/in-app/core/eip5972/in-app-wallet-capabilities.js.map +0 -1
  137. package/dist/esm/wallets/smart/lib/smart-wallet-capabilities.js +0 -27
  138. package/dist/esm/wallets/smart/lib/smart-wallet-capabilities.js.map +0 -1
  139. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-calls.d.ts.map +0 -1
  140. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-capabilities.d.ts +0 -20
  141. package/dist/types/wallets/in-app/core/eip5972/in-app-wallet-capabilities.d.ts.map +0 -1
  142. package/dist/types/wallets/smart/lib/smart-wallet-capabilities.d.ts +0 -20
  143. package/dist/types/wallets/smart/lib/smart-wallet-capabilities.d.ts.map +0 -1
  144. package/src/wallets/in-app/core/eip5972/in-app-wallet-capabilities.ts +0 -47
  145. package/src/wallets/smart/lib/smart-wallet-capabilities.ts +0 -32
@@ -1,5 +1,6 @@
1
1
  import type { Definition, TypedData } from "ox/TypedData";
2
2
  import type { Hex, SignableMessage } from "viem";
3
+ import type { Chain } from "../../../../chains/types.js";
3
4
  import { getCachedChain } from "../../../../chains/utils.js";
4
5
  import type { ThirdwebClient } from "../../../../client/client.js";
5
6
  import { getBytecode } from "../../../../contract/actions/get-bytecode.js";
@@ -8,6 +9,7 @@ import {
8
9
  type ThirdwebContract,
9
10
  } from "../../../../contract/contract.js";
10
11
  import { execute } from "../../../../extensions/erc7702/__generated__/MinimalAccount/write/execute.js";
12
+ import { getRpcClient } from "../../../../rpc/rpc.js";
11
13
  import type { SignedAuthorization } from "../../../../transaction/actions/eip7702/authorization.js";
12
14
  import { toSerializableTransaction } from "../../../../transaction/actions/to-serializable-transaction.js";
13
15
  import type { SendTransactionResult } from "../../../../transaction/types.js";
@@ -43,15 +45,23 @@ export const create7702MinimalAccount = (args: {
43
45
  address: adminAccount.address,
44
46
  chain,
45
47
  client,
48
+ abi: MinimalAccountAbi,
46
49
  });
47
50
  // check if account has been delegated already
48
51
  let authorization: SignedAuthorization | undefined;
49
52
  const isMinimalAccount = await is7702MinimalAccount(eoaContract);
50
53
  if (!isMinimalAccount) {
51
54
  // if not, sign authorization
52
- const nonce = firstTx.nonce
53
- ? BigInt(firstTx.nonce) + (sponsorGas ? 0n : 1n)
54
- : 0n; // TODO (7702): get remote nonce if not provided, should be in the tx though
55
+ let nonce = firstTx.nonce
56
+ ? BigInt(firstTx.nonce)
57
+ : BigInt(
58
+ await getNonce({
59
+ client,
60
+ address: adminAccount.address,
61
+ chain: getCachedChain(firstTx.chainId),
62
+ }),
63
+ );
64
+ nonce += sponsorGas ? 0n : 1n;
55
65
  const auth = await adminAccount.signAuthorization?.({
56
66
  address: MINIMAL_ACCOUNT_IMPLEMENTATION_ADDRESS,
57
67
  chainId: firstTx.chainId,
@@ -166,12 +176,68 @@ export const create7702MinimalAccount = (args: {
166
176
  >(
167
177
  _typedData: Definition<typedData, primaryType>,
168
178
  ): Promise<Hex> => adminAccount.signTypedData(_typedData),
179
+ sendCalls: async (options) => {
180
+ const { inAppWalletSendCalls } = await import(
181
+ "../eip5792/in-app-wallet-calls.js"
182
+ );
183
+ const firstCall = options.calls[0];
184
+ if (!firstCall) {
185
+ throw new Error("No calls to send");
186
+ }
187
+ const client = firstCall.client;
188
+ const chain = firstCall.chain || options.chain;
189
+ const id = await inAppWalletSendCalls({
190
+ account: minimalAccount,
191
+ calls: options.calls,
192
+ });
193
+ return { chain, client, id };
194
+ },
195
+ getCallsStatus: async (options) => {
196
+ const { inAppWalletGetCallsStatus } = await import(
197
+ "../eip5792/in-app-wallet-calls.js"
198
+ );
199
+ return inAppWalletGetCallsStatus(options);
200
+ },
201
+ getCapabilities: async (options) => {
202
+ return {
203
+ [options.chainId ?? 1]: {
204
+ atomic: {
205
+ status: "supported",
206
+ },
207
+ paymasterService: {
208
+ supported: sponsorGas ?? false,
209
+ },
210
+ },
211
+ };
212
+ },
169
213
  };
170
214
  return minimalAccount;
171
215
  };
172
216
 
217
+ async function getNonce(args: {
218
+ client: ThirdwebClient;
219
+ address: string;
220
+ chain: Chain;
221
+ }): Promise<number> {
222
+ const { client, address, chain } = args;
223
+ const rpcRequest = getRpcClient({
224
+ chain,
225
+ client,
226
+ });
227
+ const nonce = await import(
228
+ "../../../../rpc/actions/eth_getTransactionCount.js"
229
+ ).then(({ eth_getTransactionCount }) =>
230
+ eth_getTransactionCount(rpcRequest, {
231
+ address,
232
+ blockTag: "pending",
233
+ }),
234
+ );
235
+ return nonce;
236
+ }
237
+
173
238
  async function is7702MinimalAccount(
174
- eoaContract: ThirdwebContract,
239
+ // biome-ignore lint/suspicious/noExplicitAny: TODO properly type tw contract
240
+ eoaContract: ThirdwebContract<any>,
175
241
  ): Promise<boolean> {
176
242
  const code = await getBytecode(eoaContract);
177
243
  const isDelegated = code.length > 0 && code.startsWith("0xef0100");
@@ -189,7 +255,7 @@ async function waitForTransactionHash(args: {
189
255
  timeoutMs?: number;
190
256
  intervalMs?: number;
191
257
  }): Promise<Hex> {
192
- const timeout = args.timeoutMs || 120000; // 2mins
258
+ const timeout = args.timeoutMs || 300000; // 5mins
193
259
  const interval = args.intervalMs || 1000; // 1s
194
260
  const endtime = Date.now() + timeout;
195
261
  while (Date.now() < endtime) {
@@ -206,3 +272,598 @@ async function waitForTransactionHash(args: {
206
272
  `Timeout waiting for transaction to be mined on chain ${args.options.chain.id} with transactionId: ${args.transactionId}`,
207
273
  );
208
274
  }
275
+
276
+ const MinimalAccountAbi = [
277
+ { type: "receive", stateMutability: "payable" },
278
+ {
279
+ type: "function",
280
+ name: "createSessionWithSig",
281
+ inputs: [
282
+ {
283
+ name: "sessionSpec",
284
+ type: "tuple",
285
+ internalType: "struct SessionLib.SessionSpec",
286
+ components: [
287
+ { name: "signer", type: "address", internalType: "address" },
288
+ { name: "isWildcard", type: "bool", internalType: "bool" },
289
+ { name: "expiresAt", type: "uint256", internalType: "uint256" },
290
+ {
291
+ name: "callPolicies",
292
+ type: "tuple[]",
293
+ internalType: "struct SessionLib.CallSpec[]",
294
+ components: [
295
+ { name: "target", type: "address", internalType: "address" },
296
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
297
+ {
298
+ name: "maxValuePerUse",
299
+ type: "uint256",
300
+ internalType: "uint256",
301
+ },
302
+ {
303
+ name: "valueLimit",
304
+ type: "tuple",
305
+ internalType: "struct SessionLib.UsageLimit",
306
+ components: [
307
+ {
308
+ name: "limitType",
309
+ type: "uint8",
310
+ internalType: "enum SessionLib.LimitType",
311
+ },
312
+ { name: "limit", type: "uint256", internalType: "uint256" },
313
+ { name: "period", type: "uint256", internalType: "uint256" },
314
+ ],
315
+ },
316
+ {
317
+ name: "constraints",
318
+ type: "tuple[]",
319
+ internalType: "struct SessionLib.Constraint[]",
320
+ components: [
321
+ {
322
+ name: "condition",
323
+ type: "uint8",
324
+ internalType: "enum SessionLib.Condition",
325
+ },
326
+ { name: "index", type: "uint64", internalType: "uint64" },
327
+ {
328
+ name: "refValue",
329
+ type: "bytes32",
330
+ internalType: "bytes32",
331
+ },
332
+ {
333
+ name: "limit",
334
+ type: "tuple",
335
+ internalType: "struct SessionLib.UsageLimit",
336
+ components: [
337
+ {
338
+ name: "limitType",
339
+ type: "uint8",
340
+ internalType: "enum SessionLib.LimitType",
341
+ },
342
+ {
343
+ name: "limit",
344
+ type: "uint256",
345
+ internalType: "uint256",
346
+ },
347
+ {
348
+ name: "period",
349
+ type: "uint256",
350
+ internalType: "uint256",
351
+ },
352
+ ],
353
+ },
354
+ ],
355
+ },
356
+ ],
357
+ },
358
+ {
359
+ name: "transferPolicies",
360
+ type: "tuple[]",
361
+ internalType: "struct SessionLib.TransferSpec[]",
362
+ components: [
363
+ { name: "target", type: "address", internalType: "address" },
364
+ {
365
+ name: "maxValuePerUse",
366
+ type: "uint256",
367
+ internalType: "uint256",
368
+ },
369
+ {
370
+ name: "valueLimit",
371
+ type: "tuple",
372
+ internalType: "struct SessionLib.UsageLimit",
373
+ components: [
374
+ {
375
+ name: "limitType",
376
+ type: "uint8",
377
+ internalType: "enum SessionLib.LimitType",
378
+ },
379
+ { name: "limit", type: "uint256", internalType: "uint256" },
380
+ { name: "period", type: "uint256", internalType: "uint256" },
381
+ ],
382
+ },
383
+ ],
384
+ },
385
+ { name: "uid", type: "bytes32", internalType: "bytes32" },
386
+ ],
387
+ },
388
+ { name: "signature", type: "bytes", internalType: "bytes" },
389
+ ],
390
+ outputs: [],
391
+ stateMutability: "nonpayable",
392
+ },
393
+ {
394
+ type: "function",
395
+ name: "eip712Domain",
396
+ inputs: [],
397
+ outputs: [
398
+ { name: "fields", type: "bytes1", internalType: "bytes1" },
399
+ { name: "name", type: "string", internalType: "string" },
400
+ { name: "version", type: "string", internalType: "string" },
401
+ { name: "chainId", type: "uint256", internalType: "uint256" },
402
+ { name: "verifyingContract", type: "address", internalType: "address" },
403
+ { name: "salt", type: "bytes32", internalType: "bytes32" },
404
+ { name: "extensions", type: "uint256[]", internalType: "uint256[]" },
405
+ ],
406
+ stateMutability: "view",
407
+ },
408
+ {
409
+ type: "function",
410
+ name: "execute",
411
+ inputs: [
412
+ {
413
+ name: "calls",
414
+ type: "tuple[]",
415
+ internalType: "struct Call[]",
416
+ components: [
417
+ { name: "target", type: "address", internalType: "address" },
418
+ { name: "value", type: "uint256", internalType: "uint256" },
419
+ { name: "data", type: "bytes", internalType: "bytes" },
420
+ ],
421
+ },
422
+ ],
423
+ outputs: [],
424
+ stateMutability: "payable",
425
+ },
426
+ {
427
+ type: "function",
428
+ name: "executeWithSig",
429
+ inputs: [
430
+ {
431
+ name: "wrappedCalls",
432
+ type: "tuple",
433
+ internalType: "struct WrappedCalls",
434
+ components: [
435
+ {
436
+ name: "calls",
437
+ type: "tuple[]",
438
+ internalType: "struct Call[]",
439
+ components: [
440
+ { name: "target", type: "address", internalType: "address" },
441
+ { name: "value", type: "uint256", internalType: "uint256" },
442
+ { name: "data", type: "bytes", internalType: "bytes" },
443
+ ],
444
+ },
445
+ { name: "uid", type: "bytes32", internalType: "bytes32" },
446
+ ],
447
+ },
448
+ { name: "signature", type: "bytes", internalType: "bytes" },
449
+ ],
450
+ outputs: [],
451
+ stateMutability: "payable",
452
+ },
453
+ {
454
+ type: "function",
455
+ name: "getCallPoliciesForSigner",
456
+ inputs: [{ name: "signer", type: "address", internalType: "address" }],
457
+ outputs: [
458
+ {
459
+ name: "",
460
+ type: "tuple[]",
461
+ internalType: "struct SessionLib.CallSpec[]",
462
+ components: [
463
+ { name: "target", type: "address", internalType: "address" },
464
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
465
+ { name: "maxValuePerUse", type: "uint256", internalType: "uint256" },
466
+ {
467
+ name: "valueLimit",
468
+ type: "tuple",
469
+ internalType: "struct SessionLib.UsageLimit",
470
+ components: [
471
+ {
472
+ name: "limitType",
473
+ type: "uint8",
474
+ internalType: "enum SessionLib.LimitType",
475
+ },
476
+ { name: "limit", type: "uint256", internalType: "uint256" },
477
+ { name: "period", type: "uint256", internalType: "uint256" },
478
+ ],
479
+ },
480
+ {
481
+ name: "constraints",
482
+ type: "tuple[]",
483
+ internalType: "struct SessionLib.Constraint[]",
484
+ components: [
485
+ {
486
+ name: "condition",
487
+ type: "uint8",
488
+ internalType: "enum SessionLib.Condition",
489
+ },
490
+ { name: "index", type: "uint64", internalType: "uint64" },
491
+ { name: "refValue", type: "bytes32", internalType: "bytes32" },
492
+ {
493
+ name: "limit",
494
+ type: "tuple",
495
+ internalType: "struct SessionLib.UsageLimit",
496
+ components: [
497
+ {
498
+ name: "limitType",
499
+ type: "uint8",
500
+ internalType: "enum SessionLib.LimitType",
501
+ },
502
+ { name: "limit", type: "uint256", internalType: "uint256" },
503
+ { name: "period", type: "uint256", internalType: "uint256" },
504
+ ],
505
+ },
506
+ ],
507
+ },
508
+ ],
509
+ },
510
+ ],
511
+ stateMutability: "view",
512
+ },
513
+ {
514
+ type: "function",
515
+ name: "getSessionExpirationForSigner",
516
+ inputs: [{ name: "signer", type: "address", internalType: "address" }],
517
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
518
+ stateMutability: "view",
519
+ },
520
+ {
521
+ type: "function",
522
+ name: "getSessionStateForSigner",
523
+ inputs: [{ name: "signer", type: "address", internalType: "address" }],
524
+ outputs: [
525
+ {
526
+ name: "",
527
+ type: "tuple",
528
+ internalType: "struct SessionLib.SessionState",
529
+ components: [
530
+ {
531
+ name: "transferValue",
532
+ type: "tuple[]",
533
+ internalType: "struct SessionLib.LimitState[]",
534
+ components: [
535
+ { name: "remaining", type: "uint256", internalType: "uint256" },
536
+ { name: "target", type: "address", internalType: "address" },
537
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
538
+ { name: "index", type: "uint256", internalType: "uint256" },
539
+ ],
540
+ },
541
+ {
542
+ name: "callValue",
543
+ type: "tuple[]",
544
+ internalType: "struct SessionLib.LimitState[]",
545
+ components: [
546
+ { name: "remaining", type: "uint256", internalType: "uint256" },
547
+ { name: "target", type: "address", internalType: "address" },
548
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
549
+ { name: "index", type: "uint256", internalType: "uint256" },
550
+ ],
551
+ },
552
+ {
553
+ name: "callParams",
554
+ type: "tuple[]",
555
+ internalType: "struct SessionLib.LimitState[]",
556
+ components: [
557
+ { name: "remaining", type: "uint256", internalType: "uint256" },
558
+ { name: "target", type: "address", internalType: "address" },
559
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
560
+ { name: "index", type: "uint256", internalType: "uint256" },
561
+ ],
562
+ },
563
+ ],
564
+ },
565
+ ],
566
+ stateMutability: "view",
567
+ },
568
+ {
569
+ type: "function",
570
+ name: "getTransferPoliciesForSigner",
571
+ inputs: [{ name: "signer", type: "address", internalType: "address" }],
572
+ outputs: [
573
+ {
574
+ name: "",
575
+ type: "tuple[]",
576
+ internalType: "struct SessionLib.TransferSpec[]",
577
+ components: [
578
+ { name: "target", type: "address", internalType: "address" },
579
+ { name: "maxValuePerUse", type: "uint256", internalType: "uint256" },
580
+ {
581
+ name: "valueLimit",
582
+ type: "tuple",
583
+ internalType: "struct SessionLib.UsageLimit",
584
+ components: [
585
+ {
586
+ name: "limitType",
587
+ type: "uint8",
588
+ internalType: "enum SessionLib.LimitType",
589
+ },
590
+ { name: "limit", type: "uint256", internalType: "uint256" },
591
+ { name: "period", type: "uint256", internalType: "uint256" },
592
+ ],
593
+ },
594
+ ],
595
+ },
596
+ ],
597
+ stateMutability: "view",
598
+ },
599
+ {
600
+ type: "function",
601
+ name: "isWildcardSigner",
602
+ inputs: [{ name: "signer", type: "address", internalType: "address" }],
603
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
604
+ stateMutability: "view",
605
+ },
606
+ {
607
+ type: "function",
608
+ name: "onERC1155BatchReceived",
609
+ inputs: [
610
+ { name: "", type: "address", internalType: "address" },
611
+ { name: "", type: "address", internalType: "address" },
612
+ { name: "", type: "uint256[]", internalType: "uint256[]" },
613
+ { name: "", type: "uint256[]", internalType: "uint256[]" },
614
+ { name: "", type: "bytes", internalType: "bytes" },
615
+ ],
616
+ outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
617
+ stateMutability: "nonpayable",
618
+ },
619
+ {
620
+ type: "function",
621
+ name: "onERC1155Received",
622
+ inputs: [
623
+ { name: "", type: "address", internalType: "address" },
624
+ { name: "", type: "address", internalType: "address" },
625
+ { name: "", type: "uint256", internalType: "uint256" },
626
+ { name: "", type: "uint256", internalType: "uint256" },
627
+ { name: "", type: "bytes", internalType: "bytes" },
628
+ ],
629
+ outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
630
+ stateMutability: "nonpayable",
631
+ },
632
+ {
633
+ type: "function",
634
+ name: "onERC721Received",
635
+ inputs: [
636
+ { name: "", type: "address", internalType: "address" },
637
+ { name: "", type: "address", internalType: "address" },
638
+ { name: "", type: "uint256", internalType: "uint256" },
639
+ { name: "", type: "bytes", internalType: "bytes" },
640
+ ],
641
+ outputs: [{ name: "", type: "bytes4", internalType: "bytes4" }],
642
+ stateMutability: "nonpayable",
643
+ },
644
+ {
645
+ type: "function",
646
+ name: "supportsInterface",
647
+ inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }],
648
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
649
+ stateMutability: "view",
650
+ },
651
+ {
652
+ type: "event",
653
+ name: "Executed",
654
+ inputs: [
655
+ { name: "to", type: "address", indexed: true, internalType: "address" },
656
+ {
657
+ name: "value",
658
+ type: "uint256",
659
+ indexed: false,
660
+ internalType: "uint256",
661
+ },
662
+ { name: "data", type: "bytes", indexed: false, internalType: "bytes" },
663
+ ],
664
+ anonymous: false,
665
+ },
666
+ {
667
+ type: "event",
668
+ name: "SessionCreated",
669
+ inputs: [
670
+ {
671
+ name: "signer",
672
+ type: "address",
673
+ indexed: true,
674
+ internalType: "address",
675
+ },
676
+ {
677
+ name: "sessionSpec",
678
+ type: "tuple",
679
+ indexed: false,
680
+ internalType: "struct SessionLib.SessionSpec",
681
+ components: [
682
+ { name: "signer", type: "address", internalType: "address" },
683
+ { name: "isWildcard", type: "bool", internalType: "bool" },
684
+ { name: "expiresAt", type: "uint256", internalType: "uint256" },
685
+ {
686
+ name: "callPolicies",
687
+ type: "tuple[]",
688
+ internalType: "struct SessionLib.CallSpec[]",
689
+ components: [
690
+ { name: "target", type: "address", internalType: "address" },
691
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
692
+ {
693
+ name: "maxValuePerUse",
694
+ type: "uint256",
695
+ internalType: "uint256",
696
+ },
697
+ {
698
+ name: "valueLimit",
699
+ type: "tuple",
700
+ internalType: "struct SessionLib.UsageLimit",
701
+ components: [
702
+ {
703
+ name: "limitType",
704
+ type: "uint8",
705
+ internalType: "enum SessionLib.LimitType",
706
+ },
707
+ { name: "limit", type: "uint256", internalType: "uint256" },
708
+ { name: "period", type: "uint256", internalType: "uint256" },
709
+ ],
710
+ },
711
+ {
712
+ name: "constraints",
713
+ type: "tuple[]",
714
+ internalType: "struct SessionLib.Constraint[]",
715
+ components: [
716
+ {
717
+ name: "condition",
718
+ type: "uint8",
719
+ internalType: "enum SessionLib.Condition",
720
+ },
721
+ { name: "index", type: "uint64", internalType: "uint64" },
722
+ {
723
+ name: "refValue",
724
+ type: "bytes32",
725
+ internalType: "bytes32",
726
+ },
727
+ {
728
+ name: "limit",
729
+ type: "tuple",
730
+ internalType: "struct SessionLib.UsageLimit",
731
+ components: [
732
+ {
733
+ name: "limitType",
734
+ type: "uint8",
735
+ internalType: "enum SessionLib.LimitType",
736
+ },
737
+ {
738
+ name: "limit",
739
+ type: "uint256",
740
+ internalType: "uint256",
741
+ },
742
+ {
743
+ name: "period",
744
+ type: "uint256",
745
+ internalType: "uint256",
746
+ },
747
+ ],
748
+ },
749
+ ],
750
+ },
751
+ ],
752
+ },
753
+ {
754
+ name: "transferPolicies",
755
+ type: "tuple[]",
756
+ internalType: "struct SessionLib.TransferSpec[]",
757
+ components: [
758
+ { name: "target", type: "address", internalType: "address" },
759
+ {
760
+ name: "maxValuePerUse",
761
+ type: "uint256",
762
+ internalType: "uint256",
763
+ },
764
+ {
765
+ name: "valueLimit",
766
+ type: "tuple",
767
+ internalType: "struct SessionLib.UsageLimit",
768
+ components: [
769
+ {
770
+ name: "limitType",
771
+ type: "uint8",
772
+ internalType: "enum SessionLib.LimitType",
773
+ },
774
+ { name: "limit", type: "uint256", internalType: "uint256" },
775
+ { name: "period", type: "uint256", internalType: "uint256" },
776
+ ],
777
+ },
778
+ ],
779
+ },
780
+ { name: "uid", type: "bytes32", internalType: "bytes32" },
781
+ ],
782
+ },
783
+ ],
784
+ anonymous: false,
785
+ },
786
+ {
787
+ type: "event",
788
+ name: "ValueReceived",
789
+ inputs: [
790
+ { name: "from", type: "address", indexed: true, internalType: "address" },
791
+ {
792
+ name: "value",
793
+ type: "uint256",
794
+ indexed: false,
795
+ internalType: "uint256",
796
+ },
797
+ ],
798
+ anonymous: false,
799
+ },
800
+ {
801
+ type: "error",
802
+ name: "AllowanceExceeded",
803
+ inputs: [
804
+ { name: "allowanceUsage", type: "uint256", internalType: "uint256" },
805
+ { name: "limit", type: "uint256", internalType: "uint256" },
806
+ { name: "period", type: "uint64", internalType: "uint64" },
807
+ ],
808
+ },
809
+ {
810
+ type: "error",
811
+ name: "CallPolicyViolated",
812
+ inputs: [
813
+ { name: "target", type: "address", internalType: "address" },
814
+ { name: "selector", type: "bytes4", internalType: "bytes4" },
815
+ ],
816
+ },
817
+ { type: "error", name: "CallReverted", inputs: [] },
818
+ {
819
+ type: "error",
820
+ name: "ConditionFailed",
821
+ inputs: [
822
+ { name: "param", type: "bytes32", internalType: "bytes32" },
823
+ { name: "refValue", type: "bytes32", internalType: "bytes32" },
824
+ { name: "condition", type: "uint8", internalType: "uint8" },
825
+ ],
826
+ },
827
+ {
828
+ type: "error",
829
+ name: "InvalidDataLength",
830
+ inputs: [
831
+ { name: "actualLength", type: "uint256", internalType: "uint256" },
832
+ { name: "expectedLength", type: "uint256", internalType: "uint256" },
833
+ ],
834
+ },
835
+ {
836
+ type: "error",
837
+ name: "InvalidSignature",
838
+ inputs: [
839
+ { name: "msgSender", type: "address", internalType: "address" },
840
+ { name: "thisAddress", type: "address", internalType: "address" },
841
+ ],
842
+ },
843
+ {
844
+ type: "error",
845
+ name: "LifetimeUsageExceeded",
846
+ inputs: [
847
+ { name: "lifetimeUsage", type: "uint256", internalType: "uint256" },
848
+ { name: "limit", type: "uint256", internalType: "uint256" },
849
+ ],
850
+ },
851
+ {
852
+ type: "error",
853
+ name: "MaxValueExceeded",
854
+ inputs: [
855
+ { name: "value", type: "uint256", internalType: "uint256" },
856
+ { name: "maxValuePerUse", type: "uint256", internalType: "uint256" },
857
+ ],
858
+ },
859
+ { type: "error", name: "NoCallsToExecute", inputs: [] },
860
+ { type: "error", name: "SessionExpired", inputs: [] },
861
+ { type: "error", name: "SessionExpiresTooSoon", inputs: [] },
862
+ { type: "error", name: "SessionZeroSigner", inputs: [] },
863
+ {
864
+ type: "error",
865
+ name: "TransferPolicyViolated",
866
+ inputs: [{ name: "target", type: "address", internalType: "address" }],
867
+ },
868
+ { type: "error", name: "UIDAlreadyProcessed", inputs: [] },
869
+ ] as const;