viem 2.51.2 → 2.52.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/_cjs/errors/version.js +1 -1
  3. package/_cjs/tempo/Abis.js +189 -1
  4. package/_cjs/tempo/Abis.js.map +1 -1
  5. package/_cjs/tempo/Account.js +27 -20
  6. package/_cjs/tempo/Account.js.map +1 -1
  7. package/_cjs/tempo/Addresses.js +3 -1
  8. package/_cjs/tempo/Addresses.js.map +1 -1
  9. package/_cjs/tempo/Decorator.js +23 -0
  10. package/_cjs/tempo/Decorator.js.map +1 -1
  11. package/_cjs/tempo/Hardfork.js +3 -0
  12. package/_cjs/tempo/Hardfork.js.map +1 -1
  13. package/_cjs/tempo/actions/accessKey.js +239 -72
  14. package/_cjs/tempo/actions/accessKey.js.map +1 -1
  15. package/_cjs/tempo/actions/index.js +2 -1
  16. package/_cjs/tempo/actions/index.js.map +1 -1
  17. package/_cjs/tempo/actions/receivePolicy.js +363 -0
  18. package/_cjs/tempo/actions/receivePolicy.js.map +1 -0
  19. package/_cjs/tempo/index.js +2 -1
  20. package/_cjs/tempo/index.js.map +1 -1
  21. package/_esm/errors/version.js +1 -1
  22. package/_esm/tempo/Abis.js +188 -0
  23. package/_esm/tempo/Abis.js.map +1 -1
  24. package/_esm/tempo/Account.js +35 -20
  25. package/_esm/tempo/Account.js.map +1 -1
  26. package/_esm/tempo/Addresses.js +2 -0
  27. package/_esm/tempo/Addresses.js.map +1 -1
  28. package/_esm/tempo/Decorator.js +23 -0
  29. package/_esm/tempo/Decorator.js.map +1 -1
  30. package/_esm/tempo/Hardfork.js +3 -0
  31. package/_esm/tempo/Hardfork.js.map +1 -1
  32. package/_esm/tempo/actions/accessKey.js +562 -127
  33. package/_esm/tempo/actions/accessKey.js.map +1 -1
  34. package/_esm/tempo/actions/index.js +1 -0
  35. package/_esm/tempo/actions/index.js.map +1 -1
  36. package/_esm/tempo/actions/receivePolicy.js +753 -0
  37. package/_esm/tempo/actions/receivePolicy.js.map +1 -0
  38. package/_esm/tempo/index.js +1 -1
  39. package/_esm/tempo/index.js.map +1 -1
  40. package/_types/errors/version.d.ts +1 -1
  41. package/_types/tempo/Abis.d.ts +671 -4
  42. package/_types/tempo/Abis.d.ts.map +1 -1
  43. package/_types/tempo/Account.d.ts +13 -2
  44. package/_types/tempo/Account.d.ts.map +1 -1
  45. package/_types/tempo/Addresses.d.ts +2 -0
  46. package/_types/tempo/Addresses.d.ts.map +1 -1
  47. package/_types/tempo/Decorator.d.ts +501 -0
  48. package/_types/tempo/Decorator.d.ts.map +1 -1
  49. package/_types/tempo/Hardfork.d.ts +1 -1
  50. package/_types/tempo/Hardfork.d.ts.map +1 -1
  51. package/_types/tempo/actions/accessKey.d.ts +1520 -304
  52. package/_types/tempo/actions/accessKey.d.ts.map +1 -1
  53. package/_types/tempo/actions/dex.d.ts +75 -0
  54. package/_types/tempo/actions/dex.d.ts.map +1 -1
  55. package/_types/tempo/actions/index.d.ts +1 -0
  56. package/_types/tempo/actions/index.d.ts.map +1 -1
  57. package/_types/tempo/actions/policy.d.ts +352 -0
  58. package/_types/tempo/actions/policy.d.ts.map +1 -1
  59. package/_types/tempo/actions/receivePolicy.d.ts +1511 -0
  60. package/_types/tempo/actions/receivePolicy.d.ts.map +1 -0
  61. package/_types/tempo/index.d.ts +1 -1
  62. package/_types/tempo/index.d.ts.map +1 -1
  63. package/errors/version.ts +1 -1
  64. package/package.json +2 -2
  65. package/tempo/Abis.ts +189 -0
  66. package/tempo/Account.ts +56 -27
  67. package/tempo/Addresses.ts +2 -0
  68. package/tempo/Decorator.ts +578 -0
  69. package/tempo/Hardfork.ts +3 -0
  70. package/tempo/actions/accessKey.ts +1003 -279
  71. package/tempo/actions/index.ts +1 -0
  72. package/tempo/actions/receivePolicy.ts +1266 -0
  73. package/tempo/index.ts +1 -0
@@ -1,6 +1,8 @@
1
1
  import type { Address } from 'abitype';
2
2
  import type { KeyAuthorization } from 'ox/tempo';
3
3
  import type { Account } from '../../accounts/types.js';
4
+ import type { ReadContractReturnType } from '../../actions/public/readContract.js';
5
+ import type { WatchContractEventParameters } from '../../actions/public/watchContractEvent.js';
4
6
  import { sendTransaction } from '../../actions/wallet/sendTransaction.js';
5
7
  import { sendTransactionSync } from '../../actions/wallet/sendTransactionSync.js';
6
8
  import type { WriteContractReturnType } from '../../actions/wallet/writeContract.js';
@@ -10,9 +12,10 @@ import type { Client } from '../../clients/createClient.js';
10
12
  import type { Transport } from '../../clients/transports/createTransport.js';
11
13
  import type { BaseErrorType } from '../../errors/base.js';
12
14
  import type { Chain } from '../../types/chain.js';
13
- import type { GetEventArgs } from '../../types/contract.js';
14
- import type { Log } from '../../types/log.js';
15
- import type { Compute } from '../../types/utils.js';
15
+ import type { ExtractAbiItem, GetEventArgs } from '../../types/contract.js';
16
+ import type { Log, Log as viem_Log } from '../../types/log.js';
17
+ import type { Hex } from '../../types/misc.js';
18
+ import type { Compute, UnionOmit } from '../../types/utils.js';
16
19
  import * as Abis from '../Abis.js';
17
20
  import type { AccessKeyAccount, resolveAccessKey } from '../Account.js';
18
21
  import { signKeyAuthorization } from '../Account.js';
@@ -55,6 +58,14 @@ export declare namespace authorize {
55
58
  type Args = {
56
59
  /** The access key to authorize. */
57
60
  accessKey: resolveAccessKey.Parameters;
61
+ /**
62
+ * Whether to authorize the key as an admin key. Admin keys are unrestricted
63
+ * and can manage the account's other access keys; `expiry`, `limits`, and
64
+ * `scopes` are ignored. Requires the T6 hardfork.
65
+ *
66
+ * [TIP-1049](https://tips.sh/1049)
67
+ */
68
+ admin?: boolean | undefined;
58
69
  /** The chain ID. */
59
70
  chainId?: number | undefined;
60
71
  /** Unix timestamp when the key expires. */
@@ -67,6 +78,17 @@ export declare namespace authorize {
67
78
  }[] | undefined;
68
79
  /** Call scopes restricting which contracts/selectors this key can call. */
69
80
  scopes?: KeyAuthorization.Scope[] | undefined;
81
+ /**
82
+ * Optional 32-byte witness bound into the authorization's signing hash.
83
+ *
84
+ * Applications use this to bind a single signature to an arbitrary offchain
85
+ * context (e.g. a server-issued challenge), or as a revocation handle that
86
+ * can be burned onchain (see {@link burnWitness}) to invalidate the
87
+ * authorization before it is submitted.
88
+ *
89
+ * [TIP-1053](https://tips.sh/1053)
90
+ */
91
+ witness?: Hex | undefined;
70
92
  };
71
93
  type ReturnValue = WriteContractReturnType;
72
94
  type ErrorType = BaseErrorType;
@@ -213,6 +235,21 @@ export declare namespace authorize {
213
235
  readonly name: "witness";
214
236
  }];
215
237
  readonly outputs: readonly [];
238
+ }, {
239
+ readonly name: "authorizeAdminKey";
240
+ readonly type: "function";
241
+ readonly stateMutability: "nonpayable";
242
+ readonly inputs: readonly [{
243
+ readonly type: "address";
244
+ readonly name: "keyId";
245
+ }, {
246
+ readonly type: "uint8";
247
+ readonly name: "signatureType";
248
+ }, {
249
+ readonly type: "bytes32";
250
+ readonly name: "witness";
251
+ }];
252
+ readonly outputs: readonly [];
216
253
  }, {
217
254
  readonly name: "burnKeyAuthorizationWitness";
218
255
  readonly type: "function";
@@ -399,6 +436,20 @@ export declare namespace authorize {
399
436
  readonly outputs: readonly [{
400
437
  readonly type: "bool";
401
438
  }];
439
+ }, {
440
+ readonly name: "isAdminKey";
441
+ readonly type: "function";
442
+ readonly stateMutability: "view";
443
+ readonly inputs: readonly [{
444
+ readonly type: "address";
445
+ readonly name: "account";
446
+ }, {
447
+ readonly type: "address";
448
+ readonly name: "keyId";
449
+ }];
450
+ readonly outputs: readonly [{
451
+ readonly type: "bool";
452
+ }];
402
453
  }, {
403
454
  readonly name: "getTransactionKey";
404
455
  readonly type: "function";
@@ -425,6 +476,18 @@ export declare namespace authorize {
425
476
  readonly type: "uint64";
426
477
  readonly name: "expiry";
427
478
  }];
479
+ }, {
480
+ readonly name: "AdminKeyAuthorized";
481
+ readonly type: "event";
482
+ readonly inputs: readonly [{
483
+ readonly type: "address";
484
+ readonly name: "account";
485
+ readonly indexed: true;
486
+ }, {
487
+ readonly type: "address";
488
+ readonly name: "publicKey";
489
+ readonly indexed: true;
490
+ }];
428
491
  }, {
429
492
  readonly name: "KeyRevoked";
430
493
  readonly type: "event";
@@ -560,6 +623,10 @@ export declare namespace authorize {
560
623
  readonly name: "InvalidCallScope";
561
624
  readonly type: "error";
562
625
  readonly inputs: readonly [];
626
+ }, {
627
+ readonly name: "InvalidKeyId";
628
+ readonly type: "error";
629
+ readonly inputs: readonly [];
563
630
  }, {
564
631
  readonly name: "InvalidKeyAuthorizationWitness";
565
632
  readonly type: "error";
@@ -621,7 +688,14 @@ export declare namespace authorizeSync {
621
688
  type ErrorType = BaseErrorType;
622
689
  }
623
690
  /**
624
- * Revokes an authorized access key.
691
+ * Burns a key-authorization witness, invalidating any authorization bound to
692
+ * it before it is submitted onchain.
693
+ *
694
+ * Once burned, an `authorizeKey` call carrying the same `witness` will revert.
695
+ * This lets applications issue a signed authorization offchain (see
696
+ * {@link authorize}) while retaining the ability to revoke it.
697
+ *
698
+ * [TIP-1053](https://tips.sh/1053)
625
699
  *
626
700
  * @example
627
701
  * ```ts
@@ -636,8 +710,8 @@ export declare namespace authorizeSync {
636
710
  * transport: http(),
637
711
  * })
638
712
  *
639
- * const hash = await Actions.accessKey.revoke(client, {
640
- * accessKey: '0x...',
713
+ * const hash = await Actions.accessKey.burnWitness(client, {
714
+ * witness: '0x...',
641
715
  * })
642
716
  * ```
643
717
  *
@@ -645,19 +719,19 @@ export declare namespace authorizeSync {
645
719
  * @param parameters - Parameters.
646
720
  * @returns The transaction hash.
647
721
  */
648
- export declare function revoke<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<revoke.ReturnValue>;
649
- export declare namespace revoke {
722
+ export declare function burnWitness<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burnWitness.Parameters<chain, account>): Promise<burnWitness.ReturnValue>;
723
+ export declare namespace burnWitness {
650
724
  type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
651
725
  type Args = {
652
- /** The access key to revoke. */
653
- accessKey: Address | AccessKeyAccount;
726
+ /** The 32-byte witness to burn. */
727
+ witness: Hex;
654
728
  };
655
729
  type ReturnValue = WriteContractReturnType;
656
730
  type ErrorType = BaseErrorType;
657
731
  /** @internal */
658
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<ReturnType<action>>;
732
+ function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: burnWitness.Parameters<chain, account>): Promise<ReturnType<action>>;
659
733
  /**
660
- * Defines a call to the `revokeKey` function.
734
+ * Defines a call to the `burnKeyAuthorizationWitness` function.
661
735
  *
662
736
  * Can be passed as a parameter to:
663
737
  * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
@@ -677,7 +751,7 @@ export declare namespace revoke {
677
751
  *
678
752
  * const hash = await client.sendTransaction({
679
753
  * calls: [
680
- * Actions.accessKey.revoke.call({ accessKey: '0x...' }),
754
+ * Actions.accessKey.burnWitness.call({ witness: '0x...' }),
681
755
  * ],
682
756
  * })
683
757
  * ```
@@ -687,22 +761,22 @@ export declare namespace revoke {
687
761
  */
688
762
  function call(args: Args): {
689
763
  abi: [{
690
- readonly name: "revokeKey";
764
+ readonly name: "burnKeyAuthorizationWitness";
691
765
  readonly type: "function";
692
766
  readonly stateMutability: "nonpayable";
693
767
  readonly inputs: readonly [{
694
- readonly type: "address";
695
- readonly name: "keyId";
768
+ readonly type: "bytes32";
769
+ readonly name: "witness";
696
770
  }];
697
771
  readonly outputs: readonly [];
698
772
  }];
699
- functionName: "revokeKey";
773
+ functionName: "burnKeyAuthorizationWitness";
700
774
  } & {
701
775
  args: readonly [`0x${string}`];
702
776
  } & {
703
777
  address: Address;
704
778
  } & {
705
- data: import("../../index.js").Hex;
779
+ data: Hex;
706
780
  to: Address;
707
781
  };
708
782
  function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
@@ -846,6 +920,21 @@ export declare namespace revoke {
846
920
  readonly name: "witness";
847
921
  }];
848
922
  readonly outputs: readonly [];
923
+ }, {
924
+ readonly name: "authorizeAdminKey";
925
+ readonly type: "function";
926
+ readonly stateMutability: "nonpayable";
927
+ readonly inputs: readonly [{
928
+ readonly type: "address";
929
+ readonly name: "keyId";
930
+ }, {
931
+ readonly type: "uint8";
932
+ readonly name: "signatureType";
933
+ }, {
934
+ readonly type: "bytes32";
935
+ readonly name: "witness";
936
+ }];
937
+ readonly outputs: readonly [];
849
938
  }, {
850
939
  readonly name: "burnKeyAuthorizationWitness";
851
940
  readonly type: "function";
@@ -1032,6 +1121,20 @@ export declare namespace revoke {
1032
1121
  readonly outputs: readonly [{
1033
1122
  readonly type: "bool";
1034
1123
  }];
1124
+ }, {
1125
+ readonly name: "isAdminKey";
1126
+ readonly type: "function";
1127
+ readonly stateMutability: "view";
1128
+ readonly inputs: readonly [{
1129
+ readonly type: "address";
1130
+ readonly name: "account";
1131
+ }, {
1132
+ readonly type: "address";
1133
+ readonly name: "keyId";
1134
+ }];
1135
+ readonly outputs: readonly [{
1136
+ readonly type: "bool";
1137
+ }];
1035
1138
  }, {
1036
1139
  readonly name: "getTransactionKey";
1037
1140
  readonly type: "function";
@@ -1058,6 +1161,18 @@ export declare namespace revoke {
1058
1161
  readonly type: "uint64";
1059
1162
  readonly name: "expiry";
1060
1163
  }];
1164
+ }, {
1165
+ readonly name: "AdminKeyAuthorized";
1166
+ readonly type: "event";
1167
+ readonly inputs: readonly [{
1168
+ readonly type: "address";
1169
+ readonly name: "account";
1170
+ readonly indexed: true;
1171
+ }, {
1172
+ readonly type: "address";
1173
+ readonly name: "publicKey";
1174
+ readonly indexed: true;
1175
+ }];
1061
1176
  }, {
1062
1177
  readonly name: "KeyRevoked";
1063
1178
  readonly type: "event";
@@ -1193,6 +1308,10 @@ export declare namespace revoke {
1193
1308
  readonly name: "InvalidCallScope";
1194
1309
  readonly type: "error";
1195
1310
  readonly inputs: readonly [];
1311
+ }, {
1312
+ readonly name: "InvalidKeyId";
1313
+ readonly type: "error";
1314
+ readonly inputs: readonly [];
1196
1315
  }, {
1197
1316
  readonly name: "InvalidKeyAuthorizationWitness";
1198
1317
  readonly type: "error";
@@ -1208,10 +1327,10 @@ export declare namespace revoke {
1208
1327
  readonly type: "bytes4";
1209
1328
  readonly name: "newSelector";
1210
1329
  }];
1211
- }], "KeyRevoked">;
1330
+ }], "KeyAuthorizationWitnessBurned">;
1212
1331
  }
1213
1332
  /**
1214
- * Revokes an authorized access key and waits for the transaction receipt.
1333
+ * Burns a key-authorization witness and waits for the transaction receipt.
1215
1334
  *
1216
1335
  * @example
1217
1336
  * ```ts
@@ -1226,8 +1345,8 @@ export declare namespace revoke {
1226
1345
  * transport: http(),
1227
1346
  * })
1228
1347
  *
1229
- * const result = await Actions.accessKey.revokeSync(client, {
1230
- * accessKey: '0x...',
1348
+ * const { receipt, ...result } = await Actions.accessKey.burnWitnessSync(client, {
1349
+ * witness: '0x...',
1231
1350
  * })
1232
1351
  * ```
1233
1352
  *
@@ -1235,11 +1354,11 @@ export declare namespace revoke {
1235
1354
  * @param parameters - Parameters.
1236
1355
  * @returns The transaction receipt and event data.
1237
1356
  */
1238
- export declare function revokeSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revokeSync.Parameters<chain, account>): Promise<revokeSync.ReturnValue>;
1239
- export declare namespace revokeSync {
1240
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = revoke.Parameters<chain, account>;
1241
- type Args = revoke.Args;
1242
- type ReturnValue = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyRevoked', {
1357
+ export declare function burnWitnessSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: burnWitnessSync.Parameters<chain, account>): Promise<burnWitnessSync.ReturnValue>;
1358
+ export declare namespace burnWitnessSync {
1359
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = burnWitness.Parameters<chain, account>;
1360
+ type Args = burnWitness.Args;
1361
+ type ReturnValue = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyAuthorizationWitnessBurned', {
1243
1362
  IndexedOnly: false;
1244
1363
  Required: true;
1245
1364
  }> & {
@@ -1248,150 +1367,1234 @@ export declare namespace revokeSync {
1248
1367
  type ErrorType = BaseErrorType;
1249
1368
  }
1250
1369
  /**
1251
- * Updates the spending limit for a specific token on an authorized access key.
1370
+ * Gets access key information.
1252
1371
  *
1253
1372
  * @example
1254
1373
  * ```ts
1255
1374
  * import { createClient, http } from 'viem'
1256
1375
  * import { tempo } from 'viem/chains'
1257
1376
  * import { Actions } from 'viem/tempo'
1258
- * import { privateKeyToAccount } from 'viem/accounts'
1259
1377
  *
1260
1378
  * const client = createClient({
1261
- * account: privateKeyToAccount('0x...'),
1262
1379
  * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1263
1380
  * transport: http(),
1264
1381
  * })
1265
1382
  *
1266
- * const hash = await Actions.accessKey.updateLimit(client, {
1383
+ * const key = await Actions.accessKey.getMetadata(client, {
1384
+ * account: '0x...',
1267
1385
  * accessKey: '0x...',
1268
- * token: '0x...',
1269
- * limit: 1000000000000000000n,
1270
1386
  * })
1271
1387
  * ```
1272
1388
  *
1273
1389
  * @param client - Client.
1274
1390
  * @param parameters - Parameters.
1275
- * @returns The transaction hash.
1391
+ * @returns The key information.
1276
1392
  */
1277
- export declare function updateLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<updateLimit.ReturnValue>;
1278
- export declare namespace updateLimit {
1279
- type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
1393
+ export declare function getMetadata<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getMetadata.Parameters<account>): Promise<getMetadata.ReturnValue>;
1394
+ export declare namespace getMetadata {
1395
+ type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey'>;
1280
1396
  type Args = {
1281
- /** The access key to update. */
1397
+ /** Account address. */
1398
+ account: Address;
1399
+ /** The access key. */
1282
1400
  accessKey: Address | AccessKeyAccount;
1283
- /** The token address. */
1284
- token: Address;
1285
- /** The new spending limit. */
1286
- limit: bigint;
1287
1401
  };
1288
- type ReturnValue = WriteContractReturnType;
1289
- type ErrorType = BaseErrorType;
1290
- /** @internal */
1291
- function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<ReturnType<action>>;
1402
+ type ReturnValue = {
1403
+ /** The access key address. */
1404
+ address: Address;
1405
+ /** The key type. */
1406
+ keyType: 'secp256k1' | 'p256' | 'webAuthn';
1407
+ /** The expiry timestamp. */
1408
+ expiry: bigint;
1409
+ /** The spending policy. */
1410
+ spendPolicy: 'limited' | 'unlimited';
1411
+ /** Whether the key is revoked. */
1412
+ isRevoked: boolean;
1413
+ };
1292
1414
  /**
1293
- * Defines a call to the `updateSpendingLimit` function.
1294
- *
1295
- * Can be passed as a parameter to:
1296
- * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
1297
- * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
1298
- * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
1299
- *
1300
- * @example
1301
- * ```ts
1302
- * import { createClient, http, walletActions } from 'viem'
1303
- * import { tempo } from 'viem/chains'
1304
- * import { Actions } from 'viem/tempo'
1305
- *
1306
- * const client = createClient({
1307
- * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1308
- * transport: http(),
1309
- * }).extend(walletActions)
1310
- *
1311
- * const hash = await client.sendTransaction({
1312
- * calls: [
1313
- * Actions.accessKey.updateLimit.call({
1314
- * accessKey: '0x...',
1315
- * token: '0x...',
1316
- * limit: 1000000000000000000n,
1317
- * }),
1318
- * ],
1319
- * })
1320
- * ```
1415
+ * Defines a call to the `getKey` function.
1321
1416
  *
1322
1417
  * @param args - Arguments.
1323
1418
  * @returns The call.
1324
1419
  */
1325
1420
  function call(args: Args): {
1326
1421
  abi: [{
1327
- readonly name: "updateSpendingLimit";
1422
+ readonly name: "getKey";
1328
1423
  readonly type: "function";
1329
- readonly stateMutability: "nonpayable";
1424
+ readonly stateMutability: "view";
1330
1425
  readonly inputs: readonly [{
1331
1426
  readonly type: "address";
1332
- readonly name: "keyId";
1427
+ readonly name: "account";
1333
1428
  }, {
1334
1429
  readonly type: "address";
1335
- readonly name: "token";
1336
- }, {
1337
- readonly type: "uint256";
1338
- readonly name: "newLimit";
1430
+ readonly name: "keyId";
1431
+ }];
1432
+ readonly outputs: readonly [{
1433
+ readonly type: "tuple";
1434
+ readonly components: readonly [{
1435
+ readonly type: "uint8";
1436
+ readonly name: "signatureType";
1437
+ }, {
1438
+ readonly type: "address";
1439
+ readonly name: "keyId";
1440
+ }, {
1441
+ readonly type: "uint64";
1442
+ readonly name: "expiry";
1443
+ }, {
1444
+ readonly type: "bool";
1445
+ readonly name: "enforceLimits";
1446
+ }, {
1447
+ readonly type: "bool";
1448
+ readonly name: "isRevoked";
1449
+ }];
1339
1450
  }];
1340
- readonly outputs: readonly [];
1341
1451
  }];
1342
- functionName: "updateSpendingLimit";
1452
+ functionName: "getKey";
1343
1453
  } & {
1344
- args: readonly [`0x${string}`, token: `0x${string}`, newLimit: bigint];
1454
+ args: readonly [account: `0x${string}`, `0x${string}`];
1345
1455
  } & {
1346
1456
  address: Address;
1347
1457
  } & {
1348
- data: import("../../index.js").Hex;
1458
+ data: Hex;
1349
1459
  to: Address;
1350
1460
  };
1351
- function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
1352
- readonly name: "authorizeKey";
1353
- readonly type: "function";
1354
- readonly stateMutability: "nonpayable";
1355
- readonly inputs: readonly [{
1356
- readonly type: "address";
1357
- readonly name: "keyId";
1358
- }, {
1359
- readonly type: "uint8";
1360
- readonly name: "signatureType";
1361
- }, {
1362
- readonly type: "uint64";
1363
- readonly name: "expiry";
1364
- }, {
1365
- readonly type: "bool";
1366
- readonly name: "enforceLimits";
1367
- }, {
1368
- readonly type: "tuple[]";
1369
- readonly name: "limits";
1370
- readonly components: readonly [{
1371
- readonly type: "address";
1372
- readonly name: "token";
1373
- }, {
1374
- readonly type: "uint256";
1375
- readonly name: "amount";
1376
- }];
1377
- }];
1378
- readonly outputs: readonly [];
1379
- }, {
1380
- readonly name: "authorizeKey";
1381
- readonly type: "function";
1382
- readonly stateMutability: "nonpayable";
1383
- readonly inputs: readonly [{
1384
- readonly type: "address";
1385
- readonly name: "keyId";
1386
- }, {
1387
- readonly type: "uint8";
1388
- readonly name: "signatureType";
1389
- }, {
1390
- readonly type: "tuple";
1391
- readonly name: "config";
1392
- readonly components: readonly [{
1393
- readonly type: "uint64";
1394
- readonly name: "expiry";
1461
+ }
1462
+ /**
1463
+ * Gets the remaining spending limit for a key-token pair.
1464
+ *
1465
+ * @example
1466
+ * ```ts
1467
+ * import { createClient, http } from 'viem'
1468
+ * import { tempo } from 'viem/chains'
1469
+ * import { Actions } from 'viem/tempo'
1470
+ *
1471
+ * const client = createClient({
1472
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1473
+ * transport: http(),
1474
+ * })
1475
+ *
1476
+ * const { remaining, periodEnd } = await Actions.accessKey.getRemainingLimit(client, {
1477
+ * account: '0x...',
1478
+ * accessKey: '0x...',
1479
+ * token: '0x...',
1480
+ * })
1481
+ *
1482
+ * console.log(remaining, periodEnd)
1483
+ * ```
1484
+ *
1485
+ * @param client - Client.
1486
+ * @param parameters - Parameters.
1487
+ * @returns The remaining spending amount and period end timestamp.
1488
+ */
1489
+ export declare function getRemainingLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getRemainingLimit.Parameters<account>): Promise<getRemainingLimit.ReturnValue>;
1490
+ export declare namespace getRemainingLimit {
1491
+ type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey' | 'token'>;
1492
+ type Args = {
1493
+ /** Account address. */
1494
+ account: Address;
1495
+ /** The access key. */
1496
+ accessKey: Address | AccessKeyAccount;
1497
+ /** The token address. */
1498
+ token: Address;
1499
+ };
1500
+ type ReturnValue = {
1501
+ remaining: bigint;
1502
+ periodEnd: bigint | undefined;
1503
+ };
1504
+ /**
1505
+ * Defines a call to the `getRemainingLimit` function (pre-T3).
1506
+ *
1507
+ * @param args - Arguments.
1508
+ * @returns The call.
1509
+ */
1510
+ function call(args: Args): {
1511
+ abi: [{
1512
+ readonly name: "getRemainingLimit";
1513
+ readonly type: "function";
1514
+ readonly stateMutability: "view";
1515
+ readonly inputs: readonly [{
1516
+ readonly type: "address";
1517
+ readonly name: "account";
1518
+ }, {
1519
+ readonly type: "address";
1520
+ readonly name: "keyId";
1521
+ }, {
1522
+ readonly type: "address";
1523
+ readonly name: "token";
1524
+ }];
1525
+ readonly outputs: readonly [{
1526
+ readonly type: "uint256";
1527
+ readonly name: "remaining";
1528
+ }];
1529
+ }];
1530
+ functionName: "getRemainingLimit";
1531
+ } & {
1532
+ args: readonly [account: `0x${string}`, `0x${string}`, token: `0x${string}`];
1533
+ } & {
1534
+ address: Address;
1535
+ } & {
1536
+ data: Hex;
1537
+ to: Address;
1538
+ };
1539
+ /**
1540
+ * Defines a call to the `getRemainingLimitWithPeriod` function (T3+).
1541
+ *
1542
+ * @param args - Arguments.
1543
+ * @returns The call.
1544
+ */
1545
+ function callWithPeriod(args: Args): {
1546
+ abi: [{
1547
+ readonly name: "getRemainingLimitWithPeriod";
1548
+ readonly type: "function";
1549
+ readonly stateMutability: "view";
1550
+ readonly inputs: readonly [{
1551
+ readonly type: "address";
1552
+ readonly name: "account";
1553
+ }, {
1554
+ readonly type: "address";
1555
+ readonly name: "keyId";
1556
+ }, {
1557
+ readonly type: "address";
1558
+ readonly name: "token";
1559
+ }];
1560
+ readonly outputs: readonly [{
1561
+ readonly type: "uint256";
1562
+ readonly name: "remaining";
1563
+ }, {
1564
+ readonly type: "uint64";
1565
+ readonly name: "periodEnd";
1566
+ }];
1567
+ }];
1568
+ functionName: "getRemainingLimitWithPeriod";
1569
+ } & {
1570
+ args: readonly [account: `0x${string}`, `0x${string}`, token: `0x${string}`];
1571
+ } & {
1572
+ address: Address;
1573
+ } & {
1574
+ data: Hex;
1575
+ to: Address;
1576
+ };
1577
+ }
1578
+ /**
1579
+ * Checks whether an access key is an admin key for an account.
1580
+ *
1581
+ * Returns `true` for the account's root key or for an active admin access key
1582
+ * (see {@link authorize} with `admin: true`).
1583
+ *
1584
+ * [TIP-1049](https://tips.sh/1049)
1585
+ *
1586
+ * @example
1587
+ * ```ts
1588
+ * import { createClient, http } from 'viem'
1589
+ * import { tempo } from 'viem/chains'
1590
+ * import { Actions } from 'viem/tempo'
1591
+ *
1592
+ * const client = createClient({
1593
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1594
+ * transport: http(),
1595
+ * })
1596
+ *
1597
+ * const isAdmin = await Actions.accessKey.isAdmin(client, {
1598
+ * account: '0x...',
1599
+ * accessKey: '0x...',
1600
+ * })
1601
+ * ```
1602
+ *
1603
+ * @param client - Client.
1604
+ * @param parameters - Parameters.
1605
+ * @returns Whether the access key is an admin key.
1606
+ */
1607
+ export declare function isAdmin<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: isAdmin.Parameters<account>): Promise<isAdmin.ReturnValue>;
1608
+ export declare namespace isAdmin {
1609
+ type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey'>;
1610
+ type Args = {
1611
+ /** Account address. */
1612
+ account: Address;
1613
+ /** The access key. */
1614
+ accessKey: Address | AccessKeyAccount;
1615
+ };
1616
+ type ReturnValue = ReadContractReturnType<typeof Abis.accountKeychain, 'isAdminKey', never>;
1617
+ /**
1618
+ * Defines a call to the `isAdminKey` function.
1619
+ *
1620
+ * @param args - Arguments.
1621
+ * @returns The call.
1622
+ */
1623
+ function call(args: Args): {
1624
+ abi: [{
1625
+ readonly name: "isAdminKey";
1626
+ readonly type: "function";
1627
+ readonly stateMutability: "view";
1628
+ readonly inputs: readonly [{
1629
+ readonly type: "address";
1630
+ readonly name: "account";
1631
+ }, {
1632
+ readonly type: "address";
1633
+ readonly name: "keyId";
1634
+ }];
1635
+ readonly outputs: readonly [{
1636
+ readonly type: "bool";
1637
+ }];
1638
+ }];
1639
+ functionName: "isAdminKey";
1640
+ } & {
1641
+ args: readonly [account: `0x${string}`, `0x${string}`];
1642
+ } & {
1643
+ address: Address;
1644
+ } & {
1645
+ data: Hex;
1646
+ to: Address;
1647
+ };
1648
+ }
1649
+ /**
1650
+ * Checks whether a key-authorization witness has been burned for an account.
1651
+ *
1652
+ * @example
1653
+ * ```ts
1654
+ * import { createClient, http } from 'viem'
1655
+ * import { tempo } from 'viem/chains'
1656
+ * import { Actions } from 'viem/tempo'
1657
+ *
1658
+ * const client = createClient({
1659
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1660
+ * transport: http(),
1661
+ * })
1662
+ *
1663
+ * const isBurned = await Actions.accessKey.isWitnessBurned(client, {
1664
+ * account: '0x...',
1665
+ * witness: '0x...',
1666
+ * })
1667
+ * ```
1668
+ *
1669
+ * @param client - Client.
1670
+ * @param parameters - Parameters.
1671
+ * @returns Whether the witness has been burned.
1672
+ */
1673
+ export declare function isWitnessBurned<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: isWitnessBurned.Parameters<account>): Promise<isWitnessBurned.ReturnValue>;
1674
+ export declare namespace isWitnessBurned {
1675
+ type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'witness'>;
1676
+ type Args = {
1677
+ /** Account address. */
1678
+ account: Address;
1679
+ /** The 32-byte witness to check. */
1680
+ witness: Hex;
1681
+ };
1682
+ type ReturnValue = ReadContractReturnType<typeof Abis.accountKeychain, 'isKeyAuthorizationWitnessBurned', never>;
1683
+ /**
1684
+ * Defines a call to the `isKeyAuthorizationWitnessBurned` function.
1685
+ *
1686
+ * @param args - Arguments.
1687
+ * @returns The call.
1688
+ */
1689
+ function call(args: Args): {
1690
+ abi: [{
1691
+ readonly name: "isKeyAuthorizationWitnessBurned";
1692
+ readonly type: "function";
1693
+ readonly stateMutability: "view";
1694
+ readonly inputs: readonly [{
1695
+ readonly type: "address";
1696
+ readonly name: "account";
1697
+ }, {
1698
+ readonly type: "bytes32";
1699
+ readonly name: "witness";
1700
+ }];
1701
+ readonly outputs: readonly [{
1702
+ readonly type: "bool";
1703
+ }];
1704
+ }];
1705
+ functionName: "isKeyAuthorizationWitnessBurned";
1706
+ } & {
1707
+ args: readonly [account: `0x${string}`, `0x${string}`];
1708
+ } & {
1709
+ address: Address;
1710
+ } & {
1711
+ data: Hex;
1712
+ to: Address;
1713
+ };
1714
+ }
1715
+ /**
1716
+ * Revokes an authorized access key.
1717
+ *
1718
+ * @example
1719
+ * ```ts
1720
+ * import { createClient, http } from 'viem'
1721
+ * import { tempo } from 'viem/chains'
1722
+ * import { Actions } from 'viem/tempo'
1723
+ * import { privateKeyToAccount } from 'viem/accounts'
1724
+ *
1725
+ * const client = createClient({
1726
+ * account: privateKeyToAccount('0x...'),
1727
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1728
+ * transport: http(),
1729
+ * })
1730
+ *
1731
+ * const hash = await Actions.accessKey.revoke(client, {
1732
+ * accessKey: '0x...',
1733
+ * })
1734
+ * ```
1735
+ *
1736
+ * @param client - Client.
1737
+ * @param parameters - Parameters.
1738
+ * @returns The transaction hash.
1739
+ */
1740
+ export declare function revoke<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<revoke.ReturnValue>;
1741
+ export declare namespace revoke {
1742
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
1743
+ type Args = {
1744
+ /** The access key to revoke. */
1745
+ accessKey: Address | AccessKeyAccount;
1746
+ };
1747
+ type ReturnValue = WriteContractReturnType;
1748
+ type ErrorType = BaseErrorType;
1749
+ /** @internal */
1750
+ function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: revoke.Parameters<chain, account>): Promise<ReturnType<action>>;
1751
+ /**
1752
+ * Defines a call to the `revokeKey` function.
1753
+ *
1754
+ * Can be passed as a parameter to:
1755
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
1756
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
1757
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
1758
+ *
1759
+ * @example
1760
+ * ```ts
1761
+ * import { createClient, http, walletActions } from 'viem'
1762
+ * import { tempo } from 'viem/chains'
1763
+ * import { Actions } from 'viem/tempo'
1764
+ *
1765
+ * const client = createClient({
1766
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
1767
+ * transport: http(),
1768
+ * }).extend(walletActions)
1769
+ *
1770
+ * const hash = await client.sendTransaction({
1771
+ * calls: [
1772
+ * Actions.accessKey.revoke.call({ accessKey: '0x...' }),
1773
+ * ],
1774
+ * })
1775
+ * ```
1776
+ *
1777
+ * @param args - Arguments.
1778
+ * @returns The call.
1779
+ */
1780
+ function call(args: Args): {
1781
+ abi: [{
1782
+ readonly name: "revokeKey";
1783
+ readonly type: "function";
1784
+ readonly stateMutability: "nonpayable";
1785
+ readonly inputs: readonly [{
1786
+ readonly type: "address";
1787
+ readonly name: "keyId";
1788
+ }];
1789
+ readonly outputs: readonly [];
1790
+ }];
1791
+ functionName: "revokeKey";
1792
+ } & {
1793
+ args: readonly [`0x${string}`];
1794
+ } & {
1795
+ address: Address;
1796
+ } & {
1797
+ data: Hex;
1798
+ to: Address;
1799
+ };
1800
+ function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
1801
+ readonly name: "authorizeKey";
1802
+ readonly type: "function";
1803
+ readonly stateMutability: "nonpayable";
1804
+ readonly inputs: readonly [{
1805
+ readonly type: "address";
1806
+ readonly name: "keyId";
1807
+ }, {
1808
+ readonly type: "uint8";
1809
+ readonly name: "signatureType";
1810
+ }, {
1811
+ readonly type: "uint64";
1812
+ readonly name: "expiry";
1813
+ }, {
1814
+ readonly type: "bool";
1815
+ readonly name: "enforceLimits";
1816
+ }, {
1817
+ readonly type: "tuple[]";
1818
+ readonly name: "limits";
1819
+ readonly components: readonly [{
1820
+ readonly type: "address";
1821
+ readonly name: "token";
1822
+ }, {
1823
+ readonly type: "uint256";
1824
+ readonly name: "amount";
1825
+ }];
1826
+ }];
1827
+ readonly outputs: readonly [];
1828
+ }, {
1829
+ readonly name: "authorizeKey";
1830
+ readonly type: "function";
1831
+ readonly stateMutability: "nonpayable";
1832
+ readonly inputs: readonly [{
1833
+ readonly type: "address";
1834
+ readonly name: "keyId";
1835
+ }, {
1836
+ readonly type: "uint8";
1837
+ readonly name: "signatureType";
1838
+ }, {
1839
+ readonly type: "tuple";
1840
+ readonly name: "config";
1841
+ readonly components: readonly [{
1842
+ readonly type: "uint64";
1843
+ readonly name: "expiry";
1844
+ }, {
1845
+ readonly type: "bool";
1846
+ readonly name: "enforceLimits";
1847
+ }, {
1848
+ readonly type: "tuple[]";
1849
+ readonly name: "limits";
1850
+ readonly components: readonly [{
1851
+ readonly type: "address";
1852
+ readonly name: "token";
1853
+ }, {
1854
+ readonly type: "uint256";
1855
+ readonly name: "amount";
1856
+ }, {
1857
+ readonly type: "uint64";
1858
+ readonly name: "period";
1859
+ }];
1860
+ }, {
1861
+ readonly type: "bool";
1862
+ readonly name: "allowAnyCalls";
1863
+ }, {
1864
+ readonly type: "tuple[]";
1865
+ readonly name: "allowedCalls";
1866
+ readonly components: readonly [{
1867
+ readonly type: "address";
1868
+ readonly name: "target";
1869
+ }, {
1870
+ readonly type: "tuple[]";
1871
+ readonly name: "selectorRules";
1872
+ readonly components: readonly [{
1873
+ readonly type: "bytes4";
1874
+ readonly name: "selector";
1875
+ }, {
1876
+ readonly type: "address[]";
1877
+ readonly name: "recipients";
1878
+ }];
1879
+ }];
1880
+ }];
1881
+ }];
1882
+ readonly outputs: readonly [];
1883
+ }, {
1884
+ readonly name: "authorizeKey";
1885
+ readonly type: "function";
1886
+ readonly stateMutability: "nonpayable";
1887
+ readonly inputs: readonly [{
1888
+ readonly type: "address";
1889
+ readonly name: "keyId";
1890
+ }, {
1891
+ readonly type: "uint8";
1892
+ readonly name: "signatureType";
1893
+ }, {
1894
+ readonly type: "tuple";
1895
+ readonly name: "config";
1896
+ readonly components: readonly [{
1897
+ readonly type: "uint64";
1898
+ readonly name: "expiry";
1899
+ }, {
1900
+ readonly type: "bool";
1901
+ readonly name: "enforceLimits";
1902
+ }, {
1903
+ readonly type: "tuple[]";
1904
+ readonly name: "limits";
1905
+ readonly components: readonly [{
1906
+ readonly type: "address";
1907
+ readonly name: "token";
1908
+ }, {
1909
+ readonly type: "uint256";
1910
+ readonly name: "amount";
1911
+ }, {
1912
+ readonly type: "uint64";
1913
+ readonly name: "period";
1914
+ }];
1915
+ }, {
1916
+ readonly type: "bool";
1917
+ readonly name: "allowAnyCalls";
1918
+ }, {
1919
+ readonly type: "tuple[]";
1920
+ readonly name: "allowedCalls";
1921
+ readonly components: readonly [{
1922
+ readonly type: "address";
1923
+ readonly name: "target";
1924
+ }, {
1925
+ readonly type: "tuple[]";
1926
+ readonly name: "selectorRules";
1927
+ readonly components: readonly [{
1928
+ readonly type: "bytes4";
1929
+ readonly name: "selector";
1930
+ }, {
1931
+ readonly type: "address[]";
1932
+ readonly name: "recipients";
1933
+ }];
1934
+ }];
1935
+ }];
1936
+ }, {
1937
+ readonly type: "bytes32";
1938
+ readonly name: "witness";
1939
+ }];
1940
+ readonly outputs: readonly [];
1941
+ }, {
1942
+ readonly name: "authorizeAdminKey";
1943
+ readonly type: "function";
1944
+ readonly stateMutability: "nonpayable";
1945
+ readonly inputs: readonly [{
1946
+ readonly type: "address";
1947
+ readonly name: "keyId";
1948
+ }, {
1949
+ readonly type: "uint8";
1950
+ readonly name: "signatureType";
1951
+ }, {
1952
+ readonly type: "bytes32";
1953
+ readonly name: "witness";
1954
+ }];
1955
+ readonly outputs: readonly [];
1956
+ }, {
1957
+ readonly name: "burnKeyAuthorizationWitness";
1958
+ readonly type: "function";
1959
+ readonly stateMutability: "nonpayable";
1960
+ readonly inputs: readonly [{
1961
+ readonly type: "bytes32";
1962
+ readonly name: "witness";
1963
+ }];
1964
+ readonly outputs: readonly [];
1965
+ }, {
1966
+ readonly name: "revokeKey";
1967
+ readonly type: "function";
1968
+ readonly stateMutability: "nonpayable";
1969
+ readonly inputs: readonly [{
1970
+ readonly type: "address";
1971
+ readonly name: "keyId";
1972
+ }];
1973
+ readonly outputs: readonly [];
1974
+ }, {
1975
+ readonly name: "updateSpendingLimit";
1976
+ readonly type: "function";
1977
+ readonly stateMutability: "nonpayable";
1978
+ readonly inputs: readonly [{
1979
+ readonly type: "address";
1980
+ readonly name: "keyId";
1981
+ }, {
1982
+ readonly type: "address";
1983
+ readonly name: "token";
1984
+ }, {
1985
+ readonly type: "uint256";
1986
+ readonly name: "newLimit";
1987
+ }];
1988
+ readonly outputs: readonly [];
1989
+ }, {
1990
+ readonly name: "setAllowedCalls";
1991
+ readonly type: "function";
1992
+ readonly stateMutability: "nonpayable";
1993
+ readonly inputs: readonly [{
1994
+ readonly type: "address";
1995
+ readonly name: "keyId";
1996
+ }, {
1997
+ readonly type: "tuple[]";
1998
+ readonly name: "scopes";
1999
+ readonly components: readonly [{
2000
+ readonly type: "address";
2001
+ readonly name: "target";
2002
+ }, {
2003
+ readonly type: "tuple[]";
2004
+ readonly name: "selectorRules";
2005
+ readonly components: readonly [{
2006
+ readonly type: "bytes4";
2007
+ readonly name: "selector";
2008
+ }, {
2009
+ readonly type: "address[]";
2010
+ readonly name: "recipients";
2011
+ }];
2012
+ }];
2013
+ }];
2014
+ readonly outputs: readonly [];
2015
+ }, {
2016
+ readonly name: "removeAllowedCalls";
2017
+ readonly type: "function";
2018
+ readonly stateMutability: "nonpayable";
2019
+ readonly inputs: readonly [{
2020
+ readonly type: "address";
2021
+ readonly name: "keyId";
2022
+ }, {
2023
+ readonly type: "address";
2024
+ readonly name: "target";
2025
+ }];
2026
+ readonly outputs: readonly [];
2027
+ }, {
2028
+ readonly name: "getKey";
2029
+ readonly type: "function";
2030
+ readonly stateMutability: "view";
2031
+ readonly inputs: readonly [{
2032
+ readonly type: "address";
2033
+ readonly name: "account";
2034
+ }, {
2035
+ readonly type: "address";
2036
+ readonly name: "keyId";
2037
+ }];
2038
+ readonly outputs: readonly [{
2039
+ readonly type: "tuple";
2040
+ readonly components: readonly [{
2041
+ readonly type: "uint8";
2042
+ readonly name: "signatureType";
2043
+ }, {
2044
+ readonly type: "address";
2045
+ readonly name: "keyId";
2046
+ }, {
2047
+ readonly type: "uint64";
2048
+ readonly name: "expiry";
2049
+ }, {
2050
+ readonly type: "bool";
2051
+ readonly name: "enforceLimits";
2052
+ }, {
2053
+ readonly type: "bool";
2054
+ readonly name: "isRevoked";
2055
+ }];
2056
+ }];
2057
+ }, {
2058
+ readonly name: "getRemainingLimit";
2059
+ readonly type: "function";
2060
+ readonly stateMutability: "view";
2061
+ readonly inputs: readonly [{
2062
+ readonly type: "address";
2063
+ readonly name: "account";
2064
+ }, {
2065
+ readonly type: "address";
2066
+ readonly name: "keyId";
2067
+ }, {
2068
+ readonly type: "address";
2069
+ readonly name: "token";
2070
+ }];
2071
+ readonly outputs: readonly [{
2072
+ readonly type: "uint256";
2073
+ readonly name: "remaining";
2074
+ }];
2075
+ }, {
2076
+ readonly name: "getRemainingLimitWithPeriod";
2077
+ readonly type: "function";
2078
+ readonly stateMutability: "view";
2079
+ readonly inputs: readonly [{
2080
+ readonly type: "address";
2081
+ readonly name: "account";
2082
+ }, {
2083
+ readonly type: "address";
2084
+ readonly name: "keyId";
2085
+ }, {
2086
+ readonly type: "address";
2087
+ readonly name: "token";
2088
+ }];
2089
+ readonly outputs: readonly [{
2090
+ readonly type: "uint256";
2091
+ readonly name: "remaining";
2092
+ }, {
2093
+ readonly type: "uint64";
2094
+ readonly name: "periodEnd";
2095
+ }];
2096
+ }, {
2097
+ readonly name: "getAllowedCalls";
2098
+ readonly type: "function";
2099
+ readonly stateMutability: "view";
2100
+ readonly inputs: readonly [{
2101
+ readonly type: "address";
2102
+ readonly name: "account";
2103
+ }, {
2104
+ readonly type: "address";
2105
+ readonly name: "keyId";
2106
+ }];
2107
+ readonly outputs: readonly [{
2108
+ readonly type: "bool";
2109
+ readonly name: "isScoped";
2110
+ }, {
2111
+ readonly type: "tuple[]";
2112
+ readonly name: "scopes";
2113
+ readonly components: readonly [{
2114
+ readonly type: "address";
2115
+ readonly name: "target";
2116
+ }, {
2117
+ readonly type: "tuple[]";
2118
+ readonly name: "selectorRules";
2119
+ readonly components: readonly [{
2120
+ readonly type: "bytes4";
2121
+ readonly name: "selector";
2122
+ }, {
2123
+ readonly type: "address[]";
2124
+ readonly name: "recipients";
2125
+ }];
2126
+ }];
2127
+ }];
2128
+ }, {
2129
+ readonly name: "isKeyAuthorizationWitnessBurned";
2130
+ readonly type: "function";
2131
+ readonly stateMutability: "view";
2132
+ readonly inputs: readonly [{
2133
+ readonly type: "address";
2134
+ readonly name: "account";
2135
+ }, {
2136
+ readonly type: "bytes32";
2137
+ readonly name: "witness";
2138
+ }];
2139
+ readonly outputs: readonly [{
2140
+ readonly type: "bool";
2141
+ }];
2142
+ }, {
2143
+ readonly name: "isAdminKey";
2144
+ readonly type: "function";
2145
+ readonly stateMutability: "view";
2146
+ readonly inputs: readonly [{
2147
+ readonly type: "address";
2148
+ readonly name: "account";
2149
+ }, {
2150
+ readonly type: "address";
2151
+ readonly name: "keyId";
2152
+ }];
2153
+ readonly outputs: readonly [{
2154
+ readonly type: "bool";
2155
+ }];
2156
+ }, {
2157
+ readonly name: "getTransactionKey";
2158
+ readonly type: "function";
2159
+ readonly stateMutability: "view";
2160
+ readonly inputs: readonly [];
2161
+ readonly outputs: readonly [{
2162
+ readonly type: "address";
2163
+ }];
2164
+ }, {
2165
+ readonly name: "KeyAuthorized";
2166
+ readonly type: "event";
2167
+ readonly inputs: readonly [{
2168
+ readonly type: "address";
2169
+ readonly name: "account";
2170
+ readonly indexed: true;
2171
+ }, {
2172
+ readonly type: "address";
2173
+ readonly name: "publicKey";
2174
+ readonly indexed: true;
2175
+ }, {
2176
+ readonly type: "uint8";
2177
+ readonly name: "signatureType";
2178
+ }, {
2179
+ readonly type: "uint64";
2180
+ readonly name: "expiry";
2181
+ }];
2182
+ }, {
2183
+ readonly name: "AdminKeyAuthorized";
2184
+ readonly type: "event";
2185
+ readonly inputs: readonly [{
2186
+ readonly type: "address";
2187
+ readonly name: "account";
2188
+ readonly indexed: true;
2189
+ }, {
2190
+ readonly type: "address";
2191
+ readonly name: "publicKey";
2192
+ readonly indexed: true;
2193
+ }];
2194
+ }, {
2195
+ readonly name: "KeyRevoked";
2196
+ readonly type: "event";
2197
+ readonly inputs: readonly [{
2198
+ readonly type: "address";
2199
+ readonly name: "account";
2200
+ readonly indexed: true;
2201
+ }, {
2202
+ readonly type: "address";
2203
+ readonly name: "publicKey";
2204
+ readonly indexed: true;
2205
+ }];
2206
+ }, {
2207
+ readonly name: "SpendingLimitUpdated";
2208
+ readonly type: "event";
2209
+ readonly inputs: readonly [{
2210
+ readonly type: "address";
2211
+ readonly name: "account";
2212
+ readonly indexed: true;
2213
+ }, {
2214
+ readonly type: "address";
2215
+ readonly name: "publicKey";
2216
+ readonly indexed: true;
2217
+ }, {
2218
+ readonly type: "address";
2219
+ readonly name: "token";
2220
+ readonly indexed: true;
2221
+ }, {
2222
+ readonly type: "uint256";
2223
+ readonly name: "newLimit";
2224
+ }];
2225
+ }, {
2226
+ readonly name: "AccessKeySpend";
2227
+ readonly type: "event";
2228
+ readonly inputs: readonly [{
2229
+ readonly type: "address";
2230
+ readonly name: "account";
2231
+ readonly indexed: true;
2232
+ }, {
2233
+ readonly type: "address";
2234
+ readonly name: "publicKey";
2235
+ readonly indexed: true;
2236
+ }, {
2237
+ readonly type: "address";
2238
+ readonly name: "token";
2239
+ readonly indexed: true;
2240
+ }, {
2241
+ readonly type: "uint256";
2242
+ readonly name: "amount";
2243
+ }, {
2244
+ readonly type: "uint256";
2245
+ readonly name: "remainingLimit";
2246
+ }];
2247
+ }, {
2248
+ readonly name: "KeyAuthorizationWitness";
2249
+ readonly type: "event";
2250
+ readonly inputs: readonly [{
2251
+ readonly type: "address";
2252
+ readonly name: "account";
2253
+ readonly indexed: true;
2254
+ }, {
2255
+ readonly type: "bytes32";
2256
+ readonly name: "witness";
2257
+ readonly indexed: true;
2258
+ }];
2259
+ }, {
2260
+ readonly name: "KeyAuthorizationWitnessBurned";
2261
+ readonly type: "event";
2262
+ readonly inputs: readonly [{
2263
+ readonly type: "address";
2264
+ readonly name: "account";
2265
+ readonly indexed: true;
2266
+ }, {
2267
+ readonly type: "bytes32";
2268
+ readonly name: "witness";
2269
+ readonly indexed: true;
2270
+ }];
2271
+ }, {
2272
+ readonly name: "UnauthorizedCaller";
2273
+ readonly type: "error";
2274
+ readonly inputs: readonly [];
2275
+ }, {
2276
+ readonly name: "KeyAlreadyExists";
2277
+ readonly type: "error";
2278
+ readonly inputs: readonly [];
2279
+ }, {
2280
+ readonly name: "KeyNotFound";
2281
+ readonly type: "error";
2282
+ readonly inputs: readonly [];
2283
+ }, {
2284
+ readonly name: "KeyExpired";
2285
+ readonly type: "error";
2286
+ readonly inputs: readonly [];
2287
+ }, {
2288
+ readonly name: "SpendingLimitExceeded";
2289
+ readonly type: "error";
2290
+ readonly inputs: readonly [];
2291
+ }, {
2292
+ readonly name: "InvalidSpendingLimit";
2293
+ readonly type: "error";
2294
+ readonly inputs: readonly [];
2295
+ }, {
2296
+ readonly name: "InvalidSignatureType";
2297
+ readonly type: "error";
2298
+ readonly inputs: readonly [];
2299
+ }, {
2300
+ readonly name: "ZeroPublicKey";
2301
+ readonly type: "error";
2302
+ readonly inputs: readonly [];
2303
+ }, {
2304
+ readonly name: "ExpiryInPast";
2305
+ readonly type: "error";
2306
+ readonly inputs: readonly [];
2307
+ }, {
2308
+ readonly name: "KeyAlreadyRevoked";
2309
+ readonly type: "error";
2310
+ readonly inputs: readonly [];
2311
+ }, {
2312
+ readonly name: "SignatureTypeMismatch";
2313
+ readonly type: "error";
2314
+ readonly inputs: readonly [{
2315
+ readonly type: "uint8";
2316
+ readonly name: "expected";
2317
+ }, {
2318
+ readonly type: "uint8";
2319
+ readonly name: "actual";
2320
+ }];
2321
+ }, {
2322
+ readonly name: "CallNotAllowed";
2323
+ readonly type: "error";
2324
+ readonly inputs: readonly [];
2325
+ }, {
2326
+ readonly name: "InvalidCallScope";
2327
+ readonly type: "error";
2328
+ readonly inputs: readonly [];
2329
+ }, {
2330
+ readonly name: "InvalidKeyId";
2331
+ readonly type: "error";
2332
+ readonly inputs: readonly [];
2333
+ }, {
2334
+ readonly name: "InvalidKeyAuthorizationWitness";
2335
+ readonly type: "error";
2336
+ readonly inputs: readonly [];
2337
+ }, {
2338
+ readonly name: "KeyAuthorizationWitnessAlreadyBurned";
2339
+ readonly type: "error";
2340
+ readonly inputs: readonly [];
2341
+ }, {
2342
+ readonly name: "LegacyAuthorizeKeySelectorChanged";
2343
+ readonly type: "error";
2344
+ readonly inputs: readonly [{
2345
+ readonly type: "bytes4";
2346
+ readonly name: "newSelector";
2347
+ }];
2348
+ }], "KeyRevoked">;
2349
+ }
2350
+ /**
2351
+ * Revokes an authorized access key and waits for the transaction receipt.
2352
+ *
2353
+ * @example
2354
+ * ```ts
2355
+ * import { createClient, http } from 'viem'
2356
+ * import { tempo } from 'viem/chains'
2357
+ * import { Actions } from 'viem/tempo'
2358
+ * import { privateKeyToAccount } from 'viem/accounts'
2359
+ *
2360
+ * const client = createClient({
2361
+ * account: privateKeyToAccount('0x...'),
2362
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
2363
+ * transport: http(),
2364
+ * })
2365
+ *
2366
+ * const result = await Actions.accessKey.revokeSync(client, {
2367
+ * accessKey: '0x...',
2368
+ * })
2369
+ * ```
2370
+ *
2371
+ * @param client - Client.
2372
+ * @param parameters - Parameters.
2373
+ * @returns The transaction receipt and event data.
2374
+ */
2375
+ export declare function revokeSync<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: revokeSync.Parameters<chain, account>): Promise<revokeSync.ReturnValue>;
2376
+ export declare namespace revokeSync {
2377
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = revoke.Parameters<chain, account>;
2378
+ type Args = revoke.Args;
2379
+ type ReturnValue = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyRevoked', {
2380
+ IndexedOnly: false;
2381
+ Required: true;
2382
+ }> & {
2383
+ receipt: TransactionReceipt;
2384
+ }>;
2385
+ type ErrorType = BaseErrorType;
2386
+ }
2387
+ /**
2388
+ * Signs a key authorization for an access key.
2389
+ *
2390
+ * @example
2391
+ * ```ts
2392
+ * import { generatePrivateKey } from 'viem/accounts'
2393
+ * import { Account, Actions } from 'viem/tempo'
2394
+ *
2395
+ * const account = Account.from({ privateKey: '0x...' })
2396
+ * const accessKey = Account.fromP256(generatePrivateKey(), {
2397
+ * access: account,
2398
+ * })
2399
+ *
2400
+ * const keyAuthorization = await Actions.accessKey.signAuthorization(
2401
+ * client,
2402
+ * {
2403
+ * account,
2404
+ * accessKey,
2405
+ * expiry: Math.floor((Date.now() + 30_000) / 1000),
2406
+ * },
2407
+ * )
2408
+ * ```
2409
+ *
2410
+ * @param client - Client.
2411
+ * @param parameters - Parameters.
2412
+ * @returns The signed key authorization.
2413
+ */
2414
+ export declare function signAuthorization<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: signAuthorization.Parameters<account>): Promise<signAuthorization.ReturnValue>;
2415
+ export declare namespace signAuthorization {
2416
+ type Parameters<account extends Account | undefined = Account | undefined> = GetAccountParameter<account> & {
2417
+ /** The access key to authorize. */
2418
+ accessKey: resolveAccessKey.Parameters;
2419
+ /**
2420
+ * Whether to authorize the key as an admin key. Admin keys are unrestricted
2421
+ * and can manage the account's other access keys; `expiry`, `limits`, and
2422
+ * `scopes` are ignored. Requires the T6 hardfork.
2423
+ *
2424
+ * [TIP-1049](https://tips.sh/1049)
2425
+ */
2426
+ admin?: boolean | undefined;
2427
+ /** The chain ID. */
2428
+ chainId?: number | undefined;
2429
+ /** Unix timestamp when the key expires. */
2430
+ expiry?: number | undefined;
2431
+ /** Spending limits per token. */
2432
+ limits?: {
2433
+ token: Address;
2434
+ limit: bigint;
2435
+ period?: number | undefined;
2436
+ }[] | undefined;
2437
+ /** Call scopes restricting which contracts/selectors this key can call. */
2438
+ scopes?: KeyAuthorization.Scope[] | undefined;
2439
+ /**
2440
+ * Optional 32-byte witness bound into the authorization's signing hash.
2441
+ *
2442
+ * Applications use this to bind a single signature to an arbitrary offchain
2443
+ * context (e.g. a server-issued challenge), or as a revocation handle that
2444
+ * can be burned onchain (see {@link burnWitness}) to invalidate the
2445
+ * authorization before it is submitted.
2446
+ *
2447
+ * [TIP-1053](https://tips.sh/1053)
2448
+ */
2449
+ witness?: Hex | undefined;
2450
+ };
2451
+ type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>;
2452
+ }
2453
+ /**
2454
+ * Updates the spending limit for a specific token on an authorized access key.
2455
+ *
2456
+ * @example
2457
+ * ```ts
2458
+ * import { createClient, http } from 'viem'
2459
+ * import { tempo } from 'viem/chains'
2460
+ * import { Actions } from 'viem/tempo'
2461
+ * import { privateKeyToAccount } from 'viem/accounts'
2462
+ *
2463
+ * const client = createClient({
2464
+ * account: privateKeyToAccount('0x...'),
2465
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
2466
+ * transport: http(),
2467
+ * })
2468
+ *
2469
+ * const hash = await Actions.accessKey.updateLimit(client, {
2470
+ * accessKey: '0x...',
2471
+ * token: '0x...',
2472
+ * limit: 1000000000000000000n,
2473
+ * })
2474
+ * ```
2475
+ *
2476
+ * @param client - Client.
2477
+ * @param parameters - Parameters.
2478
+ * @returns The transaction hash.
2479
+ */
2480
+ export declare function updateLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<updateLimit.ReturnValue>;
2481
+ export declare namespace updateLimit {
2482
+ type Parameters<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = WriteParameters<chain, account> & Args;
2483
+ type Args = {
2484
+ /** The access key to update. */
2485
+ accessKey: Address | AccessKeyAccount;
2486
+ /** The token address. */
2487
+ token: Address;
2488
+ /** The new spending limit. */
2489
+ limit: bigint;
2490
+ };
2491
+ type ReturnValue = WriteContractReturnType;
2492
+ type ErrorType = BaseErrorType;
2493
+ /** @internal */
2494
+ function inner<action extends typeof writeContract | typeof writeContractSync, chain extends Chain | undefined, account extends Account | undefined>(action: action, client: Client<Transport, chain, account>, parameters: updateLimit.Parameters<chain, account>): Promise<ReturnType<action>>;
2495
+ /**
2496
+ * Defines a call to the `updateSpendingLimit` function.
2497
+ *
2498
+ * Can be passed as a parameter to:
2499
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
2500
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
2501
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
2502
+ *
2503
+ * @example
2504
+ * ```ts
2505
+ * import { createClient, http, walletActions } from 'viem'
2506
+ * import { tempo } from 'viem/chains'
2507
+ * import { Actions } from 'viem/tempo'
2508
+ *
2509
+ * const client = createClient({
2510
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
2511
+ * transport: http(),
2512
+ * }).extend(walletActions)
2513
+ *
2514
+ * const hash = await client.sendTransaction({
2515
+ * calls: [
2516
+ * Actions.accessKey.updateLimit.call({
2517
+ * accessKey: '0x...',
2518
+ * token: '0x...',
2519
+ * limit: 1000000000000000000n,
2520
+ * }),
2521
+ * ],
2522
+ * })
2523
+ * ```
2524
+ *
2525
+ * @param args - Arguments.
2526
+ * @returns The call.
2527
+ */
2528
+ function call(args: Args): {
2529
+ abi: [{
2530
+ readonly name: "updateSpendingLimit";
2531
+ readonly type: "function";
2532
+ readonly stateMutability: "nonpayable";
2533
+ readonly inputs: readonly [{
2534
+ readonly type: "address";
2535
+ readonly name: "keyId";
2536
+ }, {
2537
+ readonly type: "address";
2538
+ readonly name: "token";
2539
+ }, {
2540
+ readonly type: "uint256";
2541
+ readonly name: "newLimit";
2542
+ }];
2543
+ readonly outputs: readonly [];
2544
+ }];
2545
+ functionName: "updateSpendingLimit";
2546
+ } & {
2547
+ args: readonly [`0x${string}`, token: `0x${string}`, newLimit: bigint];
2548
+ } & {
2549
+ address: Address;
2550
+ } & {
2551
+ data: Hex;
2552
+ to: Address;
2553
+ };
2554
+ function extractEvent(logs: Log[]): Log<bigint, number, false, undefined, true, readonly [{
2555
+ readonly name: "authorizeKey";
2556
+ readonly type: "function";
2557
+ readonly stateMutability: "nonpayable";
2558
+ readonly inputs: readonly [{
2559
+ readonly type: "address";
2560
+ readonly name: "keyId";
2561
+ }, {
2562
+ readonly type: "uint8";
2563
+ readonly name: "signatureType";
2564
+ }, {
2565
+ readonly type: "uint64";
2566
+ readonly name: "expiry";
2567
+ }, {
2568
+ readonly type: "bool";
2569
+ readonly name: "enforceLimits";
2570
+ }, {
2571
+ readonly type: "tuple[]";
2572
+ readonly name: "limits";
2573
+ readonly components: readonly [{
2574
+ readonly type: "address";
2575
+ readonly name: "token";
2576
+ }, {
2577
+ readonly type: "uint256";
2578
+ readonly name: "amount";
2579
+ }];
2580
+ }];
2581
+ readonly outputs: readonly [];
2582
+ }, {
2583
+ readonly name: "authorizeKey";
2584
+ readonly type: "function";
2585
+ readonly stateMutability: "nonpayable";
2586
+ readonly inputs: readonly [{
2587
+ readonly type: "address";
2588
+ readonly name: "keyId";
2589
+ }, {
2590
+ readonly type: "uint8";
2591
+ readonly name: "signatureType";
2592
+ }, {
2593
+ readonly type: "tuple";
2594
+ readonly name: "config";
2595
+ readonly components: readonly [{
2596
+ readonly type: "uint64";
2597
+ readonly name: "expiry";
1395
2598
  }, {
1396
2599
  readonly type: "bool";
1397
2600
  readonly name: "enforceLimits";
@@ -1489,6 +2692,21 @@ export declare namespace updateLimit {
1489
2692
  readonly name: "witness";
1490
2693
  }];
1491
2694
  readonly outputs: readonly [];
2695
+ }, {
2696
+ readonly name: "authorizeAdminKey";
2697
+ readonly type: "function";
2698
+ readonly stateMutability: "nonpayable";
2699
+ readonly inputs: readonly [{
2700
+ readonly type: "address";
2701
+ readonly name: "keyId";
2702
+ }, {
2703
+ readonly type: "uint8";
2704
+ readonly name: "signatureType";
2705
+ }, {
2706
+ readonly type: "bytes32";
2707
+ readonly name: "witness";
2708
+ }];
2709
+ readonly outputs: readonly [];
1492
2710
  }, {
1493
2711
  readonly name: "burnKeyAuthorizationWitness";
1494
2712
  readonly type: "function";
@@ -1675,6 +2893,20 @@ export declare namespace updateLimit {
1675
2893
  readonly outputs: readonly [{
1676
2894
  readonly type: "bool";
1677
2895
  }];
2896
+ }, {
2897
+ readonly name: "isAdminKey";
2898
+ readonly type: "function";
2899
+ readonly stateMutability: "view";
2900
+ readonly inputs: readonly [{
2901
+ readonly type: "address";
2902
+ readonly name: "account";
2903
+ }, {
2904
+ readonly type: "address";
2905
+ readonly name: "keyId";
2906
+ }];
2907
+ readonly outputs: readonly [{
2908
+ readonly type: "bool";
2909
+ }];
1678
2910
  }, {
1679
2911
  readonly name: "getTransactionKey";
1680
2912
  readonly type: "function";
@@ -1701,6 +2933,18 @@ export declare namespace updateLimit {
1701
2933
  readonly type: "uint64";
1702
2934
  readonly name: "expiry";
1703
2935
  }];
2936
+ }, {
2937
+ readonly name: "AdminKeyAuthorized";
2938
+ readonly type: "event";
2939
+ readonly inputs: readonly [{
2940
+ readonly type: "address";
2941
+ readonly name: "account";
2942
+ readonly indexed: true;
2943
+ }, {
2944
+ readonly type: "address";
2945
+ readonly name: "publicKey";
2946
+ readonly indexed: true;
2947
+ }];
1704
2948
  }, {
1705
2949
  readonly name: "KeyRevoked";
1706
2950
  readonly type: "event";
@@ -1836,6 +3080,10 @@ export declare namespace updateLimit {
1836
3080
  readonly name: "InvalidCallScope";
1837
3081
  readonly type: "error";
1838
3082
  readonly inputs: readonly [];
3083
+ }, {
3084
+ readonly name: "InvalidKeyId";
3085
+ readonly type: "error";
3086
+ readonly inputs: readonly [];
1839
3087
  }, {
1840
3088
  readonly name: "InvalidKeyAuthorizationWitness";
1841
3089
  readonly type: "error";
@@ -1899,7 +3147,12 @@ export declare namespace updateLimitSync {
1899
3147
  type ErrorType = BaseErrorType;
1900
3148
  }
1901
3149
  /**
1902
- * Gets access key information.
3150
+ * Watches for admin key authorization events.
3151
+ *
3152
+ * Emitted when an admin key is authorized (see {@link authorize} with
3153
+ * `admin: true`).
3154
+ *
3155
+ * [TIP-1049](https://tips.sh/1049)
1903
3156
  *
1904
3157
  * @example
1905
3158
  * ```ts
@@ -1912,87 +3165,117 @@ export declare namespace updateLimitSync {
1912
3165
  * transport: http(),
1913
3166
  * })
1914
3167
  *
1915
- * const key = await Actions.accessKey.getMetadata(client, {
1916
- * account: '0x...',
1917
- * accessKey: '0x...',
3168
+ * const unwatch = Actions.accessKey.watchAdminAuthorized(client, {
3169
+ * onAuthorized: (args, log) => {
3170
+ * console.log('Admin key authorized:', args)
3171
+ * },
1918
3172
  * })
1919
3173
  * ```
1920
3174
  *
1921
3175
  * @param client - Client.
1922
3176
  * @param parameters - Parameters.
1923
- * @returns The key information.
3177
+ * @returns A function to unsubscribe from the event.
1924
3178
  */
1925
- export declare function getMetadata<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getMetadata.Parameters<account>): Promise<getMetadata.ReturnValue>;
1926
- export declare namespace getMetadata {
1927
- type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey'>;
1928
- type Args = {
1929
- /** Account address. */
1930
- account: Address;
1931
- /** The access key. */
1932
- accessKey: Address | AccessKeyAccount;
3179
+ export declare function watchAdminAuthorized<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchAdminAuthorized.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
3180
+ export declare namespace watchAdminAuthorized {
3181
+ type Args = Compute<GetEventArgs<typeof Abis.accountKeychain, 'AdminKeyAuthorized', {
3182
+ IndexedOnly: false;
3183
+ Required: true;
3184
+ }>>;
3185
+ type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.accountKeychain, 'AdminKeyAuthorized'>, true>;
3186
+ type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.accountKeychain, 'AdminKeyAuthorized', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
3187
+ /** Callback to invoke when an admin key is authorized. */
3188
+ onAuthorized: (args: Args, log: Log) => void;
1933
3189
  };
1934
- type ReturnValue = {
1935
- /** The access key address. */
1936
- address: Address;
1937
- /** The key type. */
1938
- keyType: 'secp256k1' | 'p256' | 'webAuthn';
1939
- /** The expiry timestamp. */
1940
- expiry: bigint;
1941
- /** The spending policy. */
1942
- spendPolicy: 'limited' | 'unlimited';
1943
- /** Whether the key is revoked. */
1944
- isRevoked: boolean;
3190
+ }
3191
+ /**
3192
+ * Watches for key-authorization witness events.
3193
+ *
3194
+ * Emitted when a key is authorized with a `witness` (see {@link authorize}).
3195
+ *
3196
+ * @example
3197
+ * ```ts
3198
+ * import { createClient, http } from 'viem'
3199
+ * import { tempo } from 'viem/chains'
3200
+ * import { Actions } from 'viem/tempo'
3201
+ *
3202
+ * const client = createClient({
3203
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
3204
+ * transport: http(),
3205
+ * })
3206
+ *
3207
+ * const unwatch = Actions.accessKey.watchWitness(client, {
3208
+ * onWitness: (args, log) => {
3209
+ * console.log('Witness used:', args)
3210
+ * },
3211
+ * })
3212
+ * ```
3213
+ *
3214
+ * @param client - Client.
3215
+ * @param parameters - Parameters.
3216
+ * @returns A function to unsubscribe from the event.
3217
+ */
3218
+ export declare function watchWitness<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchWitness.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
3219
+ export declare namespace watchWitness {
3220
+ type Args = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyAuthorizationWitness', {
3221
+ IndexedOnly: false;
3222
+ Required: true;
3223
+ }>>;
3224
+ type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.accountKeychain, 'KeyAuthorizationWitness'>, true>;
3225
+ type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.accountKeychain, 'KeyAuthorizationWitness', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
3226
+ /** Callback to invoke when a witness is used. */
3227
+ onWitness: (args: Args, log: Log) => void;
1945
3228
  };
1946
- /**
1947
- * Defines a call to the `getKey` function.
1948
- *
1949
- * @param args - Arguments.
1950
- * @returns The call.
1951
- */
1952
- function call(args: Args): {
1953
- abi: [{
1954
- readonly name: "getKey";
1955
- readonly type: "function";
1956
- readonly stateMutability: "view";
1957
- readonly inputs: readonly [{
1958
- readonly type: "address";
1959
- readonly name: "account";
1960
- }, {
1961
- readonly type: "address";
1962
- readonly name: "keyId";
1963
- }];
1964
- readonly outputs: readonly [{
1965
- readonly type: "tuple";
1966
- readonly components: readonly [{
1967
- readonly type: "uint8";
1968
- readonly name: "signatureType";
1969
- }, {
1970
- readonly type: "address";
1971
- readonly name: "keyId";
1972
- }, {
1973
- readonly type: "uint64";
1974
- readonly name: "expiry";
1975
- }, {
1976
- readonly type: "bool";
1977
- readonly name: "enforceLimits";
1978
- }, {
1979
- readonly type: "bool";
1980
- readonly name: "isRevoked";
1981
- }];
1982
- }];
1983
- }];
1984
- functionName: "getKey";
1985
- } & {
1986
- args: readonly [account: `0x${string}`, `0x${string}`];
1987
- } & {
1988
- address: Address;
1989
- } & {
1990
- data: import("../../index.js").Hex;
1991
- to: Address;
3229
+ }
3230
+ /**
3231
+ * Watches for key-authorization witness burned events.
3232
+ *
3233
+ * Emitted when a witness is burned (see {@link burnWitness}).
3234
+ *
3235
+ * @example
3236
+ * ```ts
3237
+ * import { createClient, http } from 'viem'
3238
+ * import { tempo } from 'viem/chains'
3239
+ * import { Actions } from 'viem/tempo'
3240
+ *
3241
+ * const client = createClient({
3242
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
3243
+ * transport: http(),
3244
+ * })
3245
+ *
3246
+ * const unwatch = Actions.accessKey.watchWitnessBurned(client, {
3247
+ * onBurned: (args, log) => {
3248
+ * console.log('Witness burned:', args)
3249
+ * },
3250
+ * })
3251
+ * ```
3252
+ *
3253
+ * @param client - Client.
3254
+ * @param parameters - Parameters.
3255
+ * @returns A function to unsubscribe from the event.
3256
+ */
3257
+ export declare function watchWitnessBurned<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: watchWitnessBurned.Parameters): import("../../actions/public/watchContractEvent.js").WatchContractEventReturnType;
3258
+ export declare namespace watchWitnessBurned {
3259
+ type Args = Compute<GetEventArgs<typeof Abis.accountKeychain, 'KeyAuthorizationWitnessBurned', {
3260
+ IndexedOnly: false;
3261
+ Required: true;
3262
+ }>>;
3263
+ type Log = viem_Log<bigint, number, false, ExtractAbiItem<typeof Abis.accountKeychain, 'KeyAuthorizationWitnessBurned'>, true>;
3264
+ type Parameters = UnionOmit<WatchContractEventParameters<typeof Abis.accountKeychain, 'KeyAuthorizationWitnessBurned', true>, 'abi' | 'address' | 'batch' | 'eventName' | 'onLogs' | 'strict'> & {
3265
+ /** Callback to invoke when a witness is burned. */
3266
+ onBurned: (args: Args, log: Log) => void;
1992
3267
  };
1993
3268
  }
1994
3269
  /**
1995
- * Gets the remaining spending limit for a key-token pair.
3270
+ * Verifies that a keychain signature was produced by an active access key
3271
+ * for the expected account.
3272
+ *
3273
+ * By default (`admin: true`), returns `true` only if the signature was
3274
+ * produced by the account's root key or an active admin access key. Set
3275
+ * `admin: false` to accept any active access key.
3276
+ *
3277
+ * Returns `false` for account mismatches, unknown, revoked, or expired
3278
+ * access keys. [TIP-1049](https://tips.sh/1049)
1996
3279
  *
1997
3280
  * @example
1998
3281
  * ```ts
@@ -2005,153 +3288,86 @@ export declare namespace getMetadata {
2005
3288
  * transport: http(),
2006
3289
  * })
2007
3290
  *
2008
- * const { remaining, periodEnd } = await Actions.accessKey.getRemainingLimit(client, {
3291
+ * const valid = await Actions.accessKey.verifyHash(client, {
2009
3292
  * account: '0x...',
2010
- * accessKey: '0x...',
2011
- * token: '0x...',
3293
+ * hash: '0x...',
3294
+ * signature: '0x...',
2012
3295
  * })
2013
- *
2014
- * console.log(remaining, periodEnd)
2015
3296
  * ```
2016
3297
  *
2017
3298
  * @param client - Client.
2018
3299
  * @param parameters - Parameters.
2019
- * @returns The remaining spending amount and period end timestamp.
3300
+ * @returns Whether the keychain signature is valid for the account.
2020
3301
  */
2021
- export declare function getRemainingLimit<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: getRemainingLimit.Parameters<account>): Promise<getRemainingLimit.ReturnValue>;
2022
- export declare namespace getRemainingLimit {
2023
- type Parameters<account extends Account | undefined = Account | undefined> = ReadParameters & GetAccountParameter<account> & Pick<Args, 'accessKey' | 'token'>;
3302
+ export declare function verifyHash<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: verifyHash.Parameters): Promise<verifyHash.ReturnValue>;
3303
+ export declare namespace verifyHash {
3304
+ type Parameters = ReadParameters & Args;
2024
3305
  type Args = {
2025
- /** Account address. */
3306
+ /** Account address the signature is expected to belong to. */
2026
3307
  account: Address;
2027
- /** The access key. */
2028
- accessKey: Address | AccessKeyAccount;
2029
- /** The token address. */
2030
- token: Address;
2031
- };
2032
- type ReturnValue = {
2033
- remaining: bigint;
2034
- periodEnd: bigint | undefined;
3308
+ /**
3309
+ * Whether to require the signer to be the account's root key or an
3310
+ * active admin access key. Defaults to `true`. Set to `false` to accept
3311
+ * any active access key.
3312
+ */
3313
+ admin?: boolean | undefined;
3314
+ /** Original message hash that was signed. */
3315
+ hash: Hex;
3316
+ /** Keychain signature envelope (V2). */
3317
+ signature: Hex;
2035
3318
  };
3319
+ type ReturnValue = ReadContractReturnType<typeof Abis.signatureVerifier, 'verifyKeychain' | 'verifyKeychainAdmin', never>;
2036
3320
  /**
2037
- * Defines a call to the `getRemainingLimit` function (pre-T3).
3321
+ * Defines a call to `verifyKeychain` or `verifyKeychainAdmin` on the
3322
+ * Signature Verifier precompile (controlled by `admin`).
2038
3323
  *
2039
3324
  * @param args - Arguments.
2040
3325
  * @returns The call.
2041
3326
  */
2042
3327
  function call(args: Args): {
2043
3328
  abi: [{
2044
- readonly name: "getRemainingLimit";
3329
+ readonly name: "verifyKeychain";
2045
3330
  readonly type: "function";
2046
3331
  readonly stateMutability: "view";
2047
3332
  readonly inputs: readonly [{
2048
3333
  readonly type: "address";
2049
3334
  readonly name: "account";
2050
3335
  }, {
2051
- readonly type: "address";
2052
- readonly name: "keyId";
3336
+ readonly type: "bytes32";
3337
+ readonly name: "hash";
2053
3338
  }, {
2054
- readonly type: "address";
2055
- readonly name: "token";
3339
+ readonly type: "bytes";
3340
+ readonly name: "signature";
2056
3341
  }];
2057
3342
  readonly outputs: readonly [{
2058
- readonly type: "uint256";
2059
- readonly name: "remaining";
3343
+ readonly type: "bool";
2060
3344
  }];
2061
- }];
2062
- functionName: "getRemainingLimit";
2063
- } & {
2064
- args: readonly [account: `0x${string}`, `0x${string}`, token: `0x${string}`];
2065
- } & {
2066
- address: Address;
2067
- } & {
2068
- data: import("../../index.js").Hex;
2069
- to: Address;
2070
- };
2071
- /**
2072
- * Defines a call to the `getRemainingLimitWithPeriod` function (T3+).
2073
- *
2074
- * @param args - Arguments.
2075
- * @returns The call.
2076
- */
2077
- function callWithPeriod(args: Args): {
2078
- abi: [{
2079
- readonly name: "getRemainingLimitWithPeriod";
3345
+ } | {
3346
+ readonly name: "verifyKeychainAdmin";
2080
3347
  readonly type: "function";
2081
3348
  readonly stateMutability: "view";
2082
3349
  readonly inputs: readonly [{
2083
3350
  readonly type: "address";
2084
3351
  readonly name: "account";
2085
3352
  }, {
2086
- readonly type: "address";
2087
- readonly name: "keyId";
3353
+ readonly type: "bytes32";
3354
+ readonly name: "hash";
2088
3355
  }, {
2089
- readonly type: "address";
2090
- readonly name: "token";
3356
+ readonly type: "bytes";
3357
+ readonly name: "signature";
2091
3358
  }];
2092
3359
  readonly outputs: readonly [{
2093
- readonly type: "uint256";
2094
- readonly name: "remaining";
2095
- }, {
2096
- readonly type: "uint64";
2097
- readonly name: "periodEnd";
3360
+ readonly type: "bool";
2098
3361
  }];
2099
3362
  }];
2100
- functionName: "getRemainingLimitWithPeriod";
3363
+ functionName: "verifyKeychain" | "verifyKeychainAdmin";
2101
3364
  } & {
2102
- args: readonly [account: `0x${string}`, `0x${string}`, token: `0x${string}`];
3365
+ args: readonly [account: `0x${string}`, hash: `0x${string}`, signature: `0x${string}`];
2103
3366
  } & {
2104
3367
  address: Address;
2105
3368
  } & {
2106
- data: import("../../index.js").Hex;
3369
+ data: Hex;
2107
3370
  to: Address;
2108
3371
  };
2109
3372
  }
2110
- /**
2111
- * Signs a key authorization for an access key.
2112
- *
2113
- * @example
2114
- * ```ts
2115
- * import { generatePrivateKey } from 'viem/accounts'
2116
- * import { Account, Actions } from 'viem/tempo'
2117
- *
2118
- * const account = Account.from({ privateKey: '0x...' })
2119
- * const accessKey = Account.fromP256(generatePrivateKey(), {
2120
- * access: account,
2121
- * })
2122
- *
2123
- * const keyAuthorization = await Actions.accessKey.signAuthorization(
2124
- * client,
2125
- * {
2126
- * account,
2127
- * accessKey,
2128
- * expiry: Math.floor((Date.now() + 30_000) / 1000),
2129
- * },
2130
- * )
2131
- * ```
2132
- *
2133
- * @param client - Client.
2134
- * @param parameters - Parameters.
2135
- * @returns The signed key authorization.
2136
- */
2137
- export declare function signAuthorization<chain extends Chain | undefined, account extends Account | undefined>(client: Client<Transport, chain, account>, parameters: signAuthorization.Parameters<account>): Promise<signAuthorization.ReturnValue>;
2138
- export declare namespace signAuthorization {
2139
- type Parameters<account extends Account | undefined = Account | undefined> = GetAccountParameter<account> & {
2140
- /** The access key to authorize. */
2141
- accessKey: resolveAccessKey.Parameters;
2142
- /** The chain ID. */
2143
- chainId?: number | undefined;
2144
- /** Unix timestamp when the key expires. */
2145
- expiry?: number | undefined;
2146
- /** Spending limits per token. */
2147
- limits?: {
2148
- token: Address;
2149
- limit: bigint;
2150
- period?: number | undefined;
2151
- }[] | undefined;
2152
- /** Call scopes restricting which contracts/selectors this key can call. */
2153
- scopes?: KeyAuthorization.Scope[] | undefined;
2154
- };
2155
- type ReturnValue = Awaited<ReturnType<typeof signKeyAuthorization>>;
2156
- }
2157
3373
  //# sourceMappingURL=accessKey.d.ts.map