kokio-sdk 3.4.0 → 3.5.1

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 (49) hide show
  1. package/README.md +8 -4
  2. package/dist/esm/abis/DeviceWallet.js +29 -0
  3. package/dist/esm/abis/ESIMWallet.js +55 -0
  4. package/dist/esm/abis/PaymentAdapter.js +53 -0
  5. package/dist/esm/abis/ProtocolAdmin.js +48 -0
  6. package/dist/esm/abis/Registry.js +55 -0
  7. package/dist/esm/abis/RegistryHelper.js +13 -0
  8. package/dist/esm/admin/config-admin.js +1 -1
  9. package/dist/esm/admin/interface/eSIMWalletClass.js +4 -1
  10. package/dist/esm/admin/interface/paymentAdapterClass.js +4 -1
  11. package/dist/esm/admin/interface/protocolAdminClass.js +7 -1
  12. package/dist/esm/admin/interface/registryClass.js +4 -1
  13. package/dist/esm/interface/deviceWalletClass.js +6 -3
  14. package/dist/esm/interface/eSIMWalletClass.js +7 -1
  15. package/dist/esm/interface/registryClass.js +4 -1
  16. package/dist/esm/logic/admin/eSIMWallet.eoa.js +9 -1
  17. package/dist/esm/logic/admin/paymentAdapter.eoa.js +16 -0
  18. package/dist/esm/logic/admin/protocolAdmin.eoa.js +34 -0
  19. package/dist/esm/logic/admin/reads/eSIMWallet.reads.js +12 -0
  20. package/dist/esm/logic/admin/reads/registry.reads.js +12 -0
  21. package/dist/esm/logic/constants.js +12 -15
  22. package/dist/esm/logic/deviceWallet.js +19 -6
  23. package/dist/esm/logic/eSIMWallet.js +36 -0
  24. package/dist/esm/logic/errors.js +14 -0
  25. package/dist/esm/logic/registry.js +12 -0
  26. package/dist/types/abis/DeviceWallet.d.ts +22 -0
  27. package/dist/types/abis/ESIMWallet.d.ts +42 -0
  28. package/dist/types/abis/PaymentAdapter.d.ts +42 -0
  29. package/dist/types/abis/ProtocolAdmin.d.ts +37 -0
  30. package/dist/types/abis/Registry.d.ts +42 -0
  31. package/dist/types/abis/RegistryHelper.d.ts +10 -0
  32. package/dist/types/admin/config-admin.d.ts +1 -1
  33. package/dist/types/admin/interface/eSIMWalletClass.d.ts +1 -0
  34. package/dist/types/admin/interface/paymentAdapterClass.d.ts +1 -0
  35. package/dist/types/admin/interface/protocolAdminClass.d.ts +2 -0
  36. package/dist/types/admin/interface/registryClass.d.ts +1 -0
  37. package/dist/types/interface/deviceWalletClass.d.ts +2 -1
  38. package/dist/types/interface/eSIMWalletClass.d.ts +2 -0
  39. package/dist/types/interface/registryClass.d.ts +1 -0
  40. package/dist/types/logic/admin/eSIMWallet.eoa.d.ts +3 -0
  41. package/dist/types/logic/admin/paymentAdapter.eoa.d.ts +6 -0
  42. package/dist/types/logic/admin/protocolAdmin.eoa.d.ts +14 -0
  43. package/dist/types/logic/admin/reads/eSIMWallet.reads.d.ts +5 -0
  44. package/dist/types/logic/admin/reads/registry.reads.d.ts +2 -0
  45. package/dist/types/logic/deviceWallet.d.ts +11 -5
  46. package/dist/types/logic/eSIMWallet.d.ts +14 -0
  47. package/dist/types/logic/errors.d.ts +10 -0
  48. package/dist/types/logic/registry.d.ts +2 -0
  49. package/package.json +1 -1
@@ -36,6 +36,18 @@ export const _priceCapUSDCents = async (client, eSIMWalletAddress) => {
36
36
  args: []
37
37
  });
38
38
  };
39
+ /**
40
+ * What the admin key may still charge this eSIM wallet, in USD cents. Only the
41
+ * owner can raise it, so a purchase above it needs the user first.
42
+ */
43
+ export const _adminAllowanceUSDCents = async (client, eSIMWalletAddress) => {
44
+ return client.extend(publicActions).readContract({
45
+ address: eSIMWalletAddress,
46
+ abi: ESIMWallet,
47
+ functionName: "adminAllowanceUSDCents",
48
+ args: []
49
+ });
50
+ };
39
51
  /** The pending owner proposed via `requestTransferOwnership` (zero if none). */
40
52
  export const _newRequestedOwner = async (client, eSIMWalletAddress) => {
41
53
  return client.extend(publicActions).readContract({
@@ -83,6 +83,18 @@ export const _defaultPriceCapUSDCents = async (client) => {
83
83
  args: []
84
84
  });
85
85
  };
86
+ /** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
87
+ export const _defaultAdminAllowanceUSDCents = async (client) => {
88
+ const chainID = await _chainId(client);
89
+ const rpcURL = client.transport.url;
90
+ const values = _getChainSpecificConstants(chainID, rpcURL);
91
+ return client.extend(publicActions).readContract({
92
+ address: values.factoryAddresses.REGISTRY,
93
+ abi: Registry,
94
+ functionName: "defaultAdminAllowanceUSDCents",
95
+ args: []
96
+ });
97
+ };
86
98
  /** The vault EOA recorded in the registry. */
87
99
  export const _vault = async (client) => {
88
100
  const chainID = await _chainId(client);
@@ -25,18 +25,17 @@ export var CHAIN_ID;
25
25
  CHAIN_ID[CHAIN_ID["BASE_MAINNET"] = 8453] = "BASE_MAINNET";
26
26
  CHAIN_ID[CHAIN_ID["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
27
27
  })(CHAIN_ID || (CHAIN_ID = {}));
28
- // Not yet deployed. Kept as a placeholder so mainnet has a documented shape to
29
- // fill in once the protocol ships there, following Base Sepolia's soak.
28
+ // From smart-contract-suite `deployments/base-8453-entrypoint-v8.json`.
30
29
  export const baseMainnetFactoryAddresses = {
31
- DEVICE_WALLET_FACTORY: '0x',
32
- ESIM_WALLET_FACTORY: '0x',
33
- LAZY_WALLET_REGISTRY: '0x',
34
- REGISTRY: '0x',
35
- ENTRY_POINT: '0x',
36
- SENDER_CREATOR: '0x',
37
- P256VERIFIER: '0x',
38
- PROTOCOL_ADMIN: '0x',
39
- PAYMENT_ADAPTER: '0x'
30
+ DEVICE_WALLET_FACTORY: '0xAC6B6A9F905e2593d587D244cEee6a0886952a6D',
31
+ ESIM_WALLET_FACTORY: '0xC88723826B9070ea89d9040387DE4C22A490EdB6',
32
+ LAZY_WALLET_REGISTRY: '0x2046aE906FB940Ad99147f233711Bb6711A2Ab0C',
33
+ REGISTRY: '0x76fB7F8C97457A5a6dF19a7041a66a7f1b3c910c',
34
+ ENTRY_POINT: '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108',
35
+ SENDER_CREATOR: '0x449ED7C3e6Fee6a97311d4b55475DF59C44AdD33',
36
+ P256VERIFIER: '0x4E2C5B9B88184464162d581D6BF36615f0040fE6',
37
+ PROTOCOL_ADMIN: '0x0E664e956aAD2599D17dE2381cc22687a066778B',
38
+ PAYMENT_ADAPTER: '0xbb80B10BECB997b02a4BA4068C145Ef18129943d'
40
39
  };
41
40
  export const baseSepoliaFactoryAddresses = {
42
41
  DEVICE_WALLET_FACTORY: '0x0BB3BA8D9233514a4aA6D72c243a2473f9cFf0bb',
@@ -46,7 +45,7 @@ export const baseSepoliaFactoryAddresses = {
46
45
  ENTRY_POINT: '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108',
47
46
  SENDER_CREATOR: '0x449ED7C3e6Fee6a97311d4b55475DF59C44AdD33',
48
47
  P256VERIFIER: '0x6FA3E7E145476Dc4682734Fd845019A3872b4821',
49
- PROTOCOL_ADMIN: '0xdDeCC2C1345BC966337B5f4Fe57EC2D5bfad751A',
48
+ PROTOCOL_ADMIN: '0xdBC411D2fEc7758B32885DbF0B4AE957c3b918Fe',
50
49
  PAYMENT_ADAPTER: '0xBFaA666a8074924588E96507c307b680ecCeB2c1'
51
50
  };
52
51
  export const customErrors = {
@@ -73,9 +72,7 @@ export const _extractChainID = async (client) => {
73
72
  }
74
73
  return _chainId(client);
75
74
  };
76
- // Maps each supported chain id to its factory-address book + viem chain. Base
77
- // Mainnet is listed with '0x' placeholders so the guard below rejects it with a
78
- // clear message rather than leaking '0x' into viem calls.
75
+ // Maps each supported chain id to its factory-address book + viem chain.
79
76
  const CHAIN_CONFIG = {
80
77
  [CHAIN_ID.BASE_MAINNET]: { factoryAddresses: baseMainnetFactoryAddresses, chain: base },
81
78
  [CHAIN_ID.BASE_SEPOLIA]: { factoryAddresses: baseSepoliaFactoryAddresses, chain: baseSepolia },
@@ -134,12 +134,12 @@ export const _removeESIMWallet = async (client, address, eSIMWalletAddress, call
134
134
  * Rotate the P256 key that owns this wallet. The registry is told in the same
135
135
  * call, so its record of the owner cannot drift from the wallet's.
136
136
  *
137
- * A key that cannot produce a verifiable signature bricks the wallet: this is
138
- * reachable only through a signed userOp, so there is no rotating back and no
139
- * reaching the balance afterwards. The contract rejects a key it can tell is
140
- * unusable, but check the new key can sign before calling.
137
+ * `newOwnerSignature` is the new passkey's WebAuthn assertion over
138
+ * `rotationChallenge(newOwner)`, ABI-encoded as a `WebAuthnSignature` with no
139
+ * version or validUntil header. Without it the contract reverts with
140
+ * `NewOwnerKeyCannotSign`, so a wallet can only move to a key that can sign.
141
141
  */
142
- export const _transferOwnership = async (client, address, newOwner) => {
142
+ export const _transferOwnership = async (client, address, newOwner, newOwnerSignature) => {
143
143
  if (!client.account)
144
144
  throw new MissingSmartWalletError();
145
145
  // UserOp - `onlySelf`.
@@ -150,7 +150,7 @@ export const _transferOwnership = async (client, address, newOwner) => {
150
150
  data: encodeFunctionData({
151
151
  abi: DeviceWallet,
152
152
  functionName: "transferOwnership",
153
- args: [newOwner]
153
+ args: [newOwner, newOwnerSignature]
154
154
  })
155
155
  }]
156
156
  });
@@ -259,6 +259,19 @@ export const _isValidSignature = async (client, address, messageHash, signature)
259
259
  args: [messageHash, signature]
260
260
  });
261
261
  };
262
+ /**
263
+ * The bytes the new passkey must sign before `transferOwnership` accepts it.
264
+ * Bound to this wallet, this chain and `newOwner`, so it cannot be reused for
265
+ * another rotation.
266
+ */
267
+ export const _rotationChallenge = async (client, address, newOwner) => {
268
+ return client.readContract({
269
+ address,
270
+ abi: DeviceWallet,
271
+ functionName: "rotationChallenge",
272
+ args: [newOwner]
273
+ });
274
+ };
262
275
  /** The registry this wallet reports its ownership changes to. */
263
276
  export const _registry = async (client, address) => {
264
277
  return client.readContract({
@@ -37,6 +37,29 @@ export const _setPriceCapUSDCents = async (client, address, cap) => {
37
37
  }]
38
38
  });
39
39
  };
40
+ /**
41
+ * Set the total the admin key may charge this eSIM wallet, in USD cents. It
42
+ * replaces what is left rather than adding to it, and zero stops admin charges.
43
+ *
44
+ * `onlyDeviceWallet`, so only the user can raise what the admin may spend. A
45
+ * handover resets it to the registry default.
46
+ */
47
+ export const _setAdminAllowanceUSDCents = async (client, address, allowance) => {
48
+ if (!client.account)
49
+ throw new MissingSmartWalletError();
50
+ // UserOp - `onlyDeviceWallet`.
51
+ return client.sendUserOperation({
52
+ account: client.account,
53
+ calls: [{
54
+ to: address,
55
+ data: encodeFunctionData({
56
+ abi: ESIMWallet,
57
+ functionName: "setAdminAllowanceUSDCents",
58
+ args: [allowance]
59
+ })
60
+ }]
61
+ });
62
+ };
40
63
  /**
41
64
  * Buy a data bundle in `asset`, an ERC-20 the payment adapter accepts.
42
65
  *
@@ -135,6 +158,19 @@ export const _priceCapUSDCents = async (client, address) => {
135
158
  const registryCap = await _defaultPriceCapUSDCents(client);
136
159
  return registryCap === 0n ? maxUint256 : registryCap;
137
160
  };
161
+ /**
162
+ * What the admin key may still charge this eSIM wallet, in USD cents. Each admin
163
+ * purchase lowers it and nothing refills it, so the owner tops it up with
164
+ * `setAdminAllowanceUSDCents`. The owner's own purchases do not touch it.
165
+ */
166
+ export const _adminAllowanceUSDCents = async (client, address) => {
167
+ return client.readContract({
168
+ address,
169
+ abi: ESIMWallet,
170
+ functionName: "adminAllowanceUSDCents",
171
+ args: []
172
+ });
173
+ };
138
174
  /**
139
175
  * The device wallet this eSIM wallet belongs to. Tracks `owner`, but it is its
140
176
  * own storage slot with its own getter, so read whichever one you mean.
@@ -228,6 +228,20 @@ export class PriceOutOfRangeError extends KokioError {
228
228
  this.priceUSDCents = priceUSDCents;
229
229
  }
230
230
  }
231
+ /**
232
+ * An admin purchase priced above what the eSIM wallet's owner still allows the
233
+ * admin key to charge. Thrown before sending, since the contract would revert
234
+ * with `AdminAllowanceExceeded`. The owner raises it with `setAdminAllowanceUSDCents`.
235
+ */
236
+ export class AdminAllowanceExceededError extends KokioError {
237
+ priceUSDCents;
238
+ remainingUSDCents;
239
+ constructor(priceUSDCents, remainingUSDCents) {
240
+ super("ADMIN_ALLOWANCE_EXCEEDED", `${priceUSDCents} cents is more than the ${remainingUSDCents} cents the owner still allows the admin to charge.`);
241
+ this.priceUSDCents = priceUSDCents;
242
+ this.remainingUSDCents = remainingUSDCents;
243
+ }
244
+ }
231
245
  /**
232
246
  * A payment reference that is not 32 bytes, has an empty order part, or
233
247
  * carries a tag this SDK cannot write over or read back.
@@ -218,6 +218,18 @@ export const _defaultPriceCapUSDCents = async (client) => {
218
218
  args: []
219
219
  });
220
220
  };
221
+ /** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
222
+ export const _defaultAdminAllowanceUSDCents = async (client) => {
223
+ const chainID = await _chainId(client);
224
+ const rpcURL = client.transport.url;
225
+ const values = _getChainSpecificConstants(chainID, rpcURL);
226
+ return client.readContract({
227
+ address: values.factoryAddresses.REGISTRY,
228
+ abi: Registry,
229
+ functionName: "defaultAdminAllowanceUSDCents",
230
+ args: []
231
+ });
232
+ };
221
233
  /** The payment adapter this registry currently points at. */
222
234
  export const _paymentAdapter = async (client) => {
223
235
  const chainID = await _chainId(client);
@@ -345,6 +345,20 @@ declare const DeviceWallet: readonly [{
345
345
  }];
346
346
  readonly outputs: readonly [];
347
347
  readonly stateMutability: "nonpayable";
348
+ }, {
349
+ readonly type: "function";
350
+ readonly name: "rotationChallenge";
351
+ readonly inputs: readonly [{
352
+ readonly name: "newOwner";
353
+ readonly type: "bytes32[2]";
354
+ readonly internalType: "bytes32[2]";
355
+ }];
356
+ readonly outputs: readonly [{
357
+ readonly name: "";
358
+ readonly type: "bytes";
359
+ readonly internalType: "bytes";
360
+ }];
361
+ readonly stateMutability: "view";
348
362
  }, {
349
363
  readonly type: "function";
350
364
  readonly name: "supportsInterface";
@@ -380,6 +394,10 @@ declare const DeviceWallet: readonly [{
380
394
  readonly name: "newOwner";
381
395
  readonly type: "bytes32[2]";
382
396
  readonly internalType: "bytes32[2]";
397
+ }, {
398
+ readonly name: "newOwnerSignature";
399
+ readonly type: "bytes";
400
+ readonly internalType: "bytes";
383
401
  }];
384
402
  readonly outputs: readonly [{
385
403
  readonly name: "";
@@ -643,6 +661,10 @@ declare const DeviceWallet: readonly [{
643
661
  readonly type: "error";
644
662
  readonly name: "InvalidInitialization";
645
663
  readonly inputs: readonly [];
664
+ }, {
665
+ readonly type: "error";
666
+ readonly name: "NewOwnerKeyCannotSign";
667
+ readonly inputs: readonly [];
646
668
  }, {
647
669
  readonly type: "error";
648
670
  readonly name: "NotInitializing";
@@ -7,6 +7,16 @@ declare const ESIMWallet: readonly [{
7
7
  readonly inputs: readonly [];
8
8
  readonly outputs: readonly [];
9
9
  readonly stateMutability: "nonpayable";
10
+ }, {
11
+ readonly type: "function";
12
+ readonly name: "adminAllowanceUSDCents";
13
+ readonly inputs: readonly [];
14
+ readonly outputs: readonly [{
15
+ readonly name: "";
16
+ readonly type: "uint64";
17
+ readonly internalType: "uint64";
18
+ }];
19
+ readonly stateMutability: "view";
10
20
  }, {
11
21
  readonly type: "function";
12
22
  readonly name: "buyDataBundleWithToken";
@@ -218,6 +228,16 @@ declare const ESIMWallet: readonly [{
218
228
  readonly internalType: "uint256";
219
229
  }];
220
230
  readonly stateMutability: "nonpayable";
231
+ }, {
232
+ readonly type: "function";
233
+ readonly name: "setAdminAllowanceUSDCents";
234
+ readonly inputs: readonly [{
235
+ readonly name: "_allowance";
236
+ readonly type: "uint64";
237
+ readonly internalType: "uint64";
238
+ }];
239
+ readonly outputs: readonly [];
240
+ readonly stateMutability: "nonpayable";
221
241
  }, {
222
242
  readonly type: "function";
223
243
  readonly name: "setESIMUniqueIdentifier";
@@ -270,6 +290,16 @@ declare const ESIMWallet: readonly [{
270
290
  }];
271
291
  readonly outputs: readonly [];
272
292
  readonly stateMutability: "pure";
293
+ }, {
294
+ readonly type: "event";
295
+ readonly name: "AdminAllowanceUSDCentsUpdated";
296
+ readonly inputs: readonly [{
297
+ readonly name: "_allowance";
298
+ readonly type: "uint64";
299
+ readonly indexed: false;
300
+ readonly internalType: "uint64";
301
+ }];
302
+ readonly anonymous: false;
273
303
  }, {
274
304
  readonly type: "event";
275
305
  readonly name: "DataBundleBoughtWithToken";
@@ -483,6 +513,18 @@ declare const ESIMWallet: readonly [{
483
513
  readonly internalType: "uint256";
484
514
  }];
485
515
  readonly anonymous: false;
516
+ }, {
517
+ readonly type: "error";
518
+ readonly name: "AdminAllowanceExceeded";
519
+ readonly inputs: readonly [{
520
+ readonly name: "priceUSDCents";
521
+ readonly type: "uint64";
522
+ readonly internalType: "uint64";
523
+ }, {
524
+ readonly name: "remaining";
525
+ readonly type: "uint64";
526
+ readonly internalType: "uint64";
527
+ }];
486
528
  }, {
487
529
  readonly type: "error";
488
530
  readonly name: "AssetNotTransferable";
@@ -116,6 +116,24 @@ declare const PaymentAdapter: readonly [{
116
116
  readonly internalType: "uint256";
117
117
  }];
118
118
  readonly stateMutability: "view";
119
+ }, {
120
+ readonly type: "function";
121
+ readonly name: "recoverTokens";
122
+ readonly inputs: readonly [{
123
+ readonly name: "_token";
124
+ readonly type: "address";
125
+ readonly internalType: "address";
126
+ }, {
127
+ readonly name: "_to";
128
+ readonly type: "address";
129
+ readonly internalType: "address";
130
+ }, {
131
+ readonly name: "_amount";
132
+ readonly type: "uint256";
133
+ readonly internalType: "uint256";
134
+ }];
135
+ readonly outputs: readonly [];
136
+ readonly stateMutability: "nonpayable";
119
137
  }, {
120
138
  readonly type: "function";
121
139
  readonly name: "registerAsset";
@@ -443,6 +461,26 @@ declare const PaymentAdapter: readonly [{
443
461
  readonly internalType: "uint256";
444
462
  }];
445
463
  readonly anonymous: false;
464
+ }, {
465
+ readonly type: "event";
466
+ readonly name: "TokensRecovered";
467
+ readonly inputs: readonly [{
468
+ readonly name: "_token";
469
+ readonly type: "address";
470
+ readonly indexed: true;
471
+ readonly internalType: "address";
472
+ }, {
473
+ readonly name: "_to";
474
+ readonly type: "address";
475
+ readonly indexed: true;
476
+ readonly internalType: "address";
477
+ }, {
478
+ readonly name: "_amount";
479
+ readonly type: "uint256";
480
+ readonly indexed: false;
481
+ readonly internalType: "uint256";
482
+ }];
483
+ readonly anonymous: false;
446
484
  }, {
447
485
  readonly type: "event";
448
486
  readonly name: "Upgraded";
@@ -653,6 +691,10 @@ declare const PaymentAdapter: readonly [{
653
691
  readonly type: "string";
654
692
  readonly internalType: "string";
655
693
  }];
694
+ }, {
695
+ readonly type: "error";
696
+ readonly name: "ZeroAmount";
697
+ readonly inputs: readonly [];
656
698
  }, {
657
699
  readonly type: "error";
658
700
  readonly name: "ZeroDataBundlePrice";
@@ -443,6 +443,16 @@ declare const ProtocolAdmin: readonly [{
443
443
  readonly internalType: "bytes4";
444
444
  }];
445
445
  readonly stateMutability: "nonpayable";
446
+ }, {
447
+ readonly type: "function";
448
+ readonly name: "pauseInstantly";
449
+ readonly inputs: readonly [{
450
+ readonly name: "target";
451
+ readonly type: "address";
452
+ readonly internalType: "address";
453
+ }];
454
+ readonly outputs: readonly [];
455
+ readonly stateMutability: "nonpayable";
446
456
  }, {
447
457
  readonly type: "function";
448
458
  readonly name: "renounceRole";
@@ -740,6 +750,21 @@ declare const ProtocolAdmin: readonly [{
740
750
  readonly internalType: "address";
741
751
  }];
742
752
  readonly anonymous: false;
753
+ }, {
754
+ readonly type: "event";
755
+ readonly name: "PauseRaised";
756
+ readonly inputs: readonly [{
757
+ readonly name: "target";
758
+ readonly type: "address";
759
+ readonly indexed: true;
760
+ readonly internalType: "address";
761
+ }, {
762
+ readonly name: "guardian";
763
+ readonly type: "address";
764
+ readonly indexed: true;
765
+ readonly internalType: "address";
766
+ }];
767
+ readonly anonymous: false;
743
768
  }, {
744
769
  readonly type: "event";
745
770
  readonly name: "PauseReleased";
@@ -855,6 +880,18 @@ declare const ProtocolAdmin: readonly [{
855
880
  readonly type: "error";
856
881
  readonly name: "NoProposers";
857
882
  readonly inputs: readonly [];
883
+ }, {
884
+ readonly type: "error";
885
+ readonly name: "NomineeIsTheIncumbent";
886
+ readonly inputs: readonly [{
887
+ readonly name: "target";
888
+ readonly type: "address";
889
+ readonly internalType: "address";
890
+ }, {
891
+ readonly name: "admin";
892
+ readonly type: "address";
893
+ readonly internalType: "address";
894
+ }];
858
895
  }, {
859
896
  readonly type: "error";
860
897
  readonly name: "NotACanceller";
@@ -114,6 +114,16 @@ declare const Registry: readonly [{
114
114
  }];
115
115
  readonly outputs: readonly [];
116
116
  readonly stateMutability: "nonpayable";
117
+ }, {
118
+ readonly type: "function";
119
+ readonly name: "defaultAdminAllowanceUSDCents";
120
+ readonly inputs: readonly [];
121
+ readonly outputs: readonly [{
122
+ readonly name: "";
123
+ readonly type: "uint64";
124
+ readonly internalType: "uint64";
125
+ }];
126
+ readonly stateMutability: "view";
117
127
  }, {
118
128
  readonly type: "function";
119
129
  readonly name: "defaultPriceCapUSDCents";
@@ -303,6 +313,10 @@ declare const Registry: readonly [{
303
313
  readonly name: "_defaultPriceCapUSDCents";
304
314
  readonly type: "uint64";
305
315
  readonly internalType: "uint64";
316
+ }, {
317
+ readonly name: "_defaultAdminAllowanceUSDCents";
318
+ readonly type: "uint64";
319
+ readonly internalType: "uint64";
306
320
  }];
307
321
  readonly outputs: readonly [];
308
322
  readonly stateMutability: "nonpayable";
@@ -574,6 +588,16 @@ declare const Registry: readonly [{
574
588
  readonly inputs: readonly [];
575
589
  readonly outputs: readonly [];
576
590
  readonly stateMutability: "view";
591
+ }, {
592
+ readonly type: "function";
593
+ readonly name: "setDefaultAdminAllowanceUSDCents";
594
+ readonly inputs: readonly [{
595
+ readonly name: "_allowance";
596
+ readonly type: "uint64";
597
+ readonly internalType: "uint64";
598
+ }];
599
+ readonly outputs: readonly [];
600
+ readonly stateMutability: "nonpayable";
577
601
  }, {
578
602
  readonly type: "function";
579
603
  readonly name: "setDefaultPriceCapUSDCents";
@@ -843,6 +867,16 @@ declare const Registry: readonly [{
843
867
  readonly internalType: "bytes32";
844
868
  }];
845
869
  readonly anonymous: false;
870
+ }, {
871
+ readonly type: "event";
872
+ readonly name: "DefaultAdminAllowanceUSDCentsUpdated";
873
+ readonly inputs: readonly [{
874
+ readonly name: "_allowance";
875
+ readonly type: "uint64";
876
+ readonly indexed: false;
877
+ readonly internalType: "uint64";
878
+ }];
879
+ readonly anonymous: false;
846
880
  }, {
847
881
  readonly type: "event";
848
882
  readonly name: "DefaultPriceCapUSDCentsUpdated";
@@ -1326,6 +1360,14 @@ declare const Registry: readonly [{
1326
1360
  readonly type: "bytes32";
1327
1361
  readonly internalType: "bytes32";
1328
1362
  }];
1363
+ }, {
1364
+ readonly type: "error";
1365
+ readonly name: "OwnerKeyNotHeldByWallet";
1366
+ readonly inputs: readonly [{
1367
+ readonly name: "deviceWallet";
1368
+ readonly type: "address";
1369
+ readonly internalType: "address";
1370
+ }];
1329
1371
  }, {
1330
1372
  readonly type: "error";
1331
1373
  readonly name: "OwnershipCannotBeRenounced";
@@ -378,6 +378,16 @@ declare const RegistryHelper: readonly [{
378
378
  readonly internalType: "bytes32";
379
379
  }];
380
380
  readonly anonymous: false;
381
+ }, {
382
+ readonly type: "event";
383
+ readonly name: "DefaultAdminAllowanceUSDCentsUpdated";
384
+ readonly inputs: readonly [{
385
+ readonly name: "_allowance";
386
+ readonly type: "uint64";
387
+ readonly indexed: false;
388
+ readonly internalType: "uint64";
389
+ }];
390
+ readonly anonymous: false;
381
391
  }, {
382
392
  readonly type: "event";
383
393
  readonly name: "DefaultPriceCapUSDCentsUpdated";
@@ -10,7 +10,7 @@ import { AdminESIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
10
10
  import { AdminPaymentAdapterSubPackage } from "./interface/paymentAdapterClass.js";
11
11
  import { AdminCallsSubPackage } from "./interface/callsClass.js";
12
12
  import { AdminUtilsSubPackage } from "./interface/utilsClass.js";
13
- export { KokioError, NullOrUndefinedValueError, MissingSmartWalletError, MissingEOAWalletError, InvalidClientError, UnsupportedChainError, UnconfiguredChainError, CounterfactualMismatchError, BatchSizeOutOfRangeError, DepositOnResumeError, ESIMWalletNotLazyDeployedError, MissingBatchEventError, StalledBatchError, InvalidAddressError, InvalidSymbolError, TokenNotAcceptedError, NotAProtocolESIMWalletError, UnknownTransactionError, TransactionRevertedError, ReceiptNotCanonicalError, NotAnERC20TokenError, UnmatchedPaymentEventsError, PriceOutOfRangeError, InvalidPaymentReferenceError, CouponSplitOutOfRangeError, ContractRevertError, decodeContractRevert, } from "../logic/errors.js";
13
+ export { KokioError, NullOrUndefinedValueError, MissingSmartWalletError, MissingEOAWalletError, InvalidClientError, UnsupportedChainError, UnconfiguredChainError, CounterfactualMismatchError, BatchSizeOutOfRangeError, DepositOnResumeError, ESIMWalletNotLazyDeployedError, MissingBatchEventError, StalledBatchError, InvalidAddressError, InvalidSymbolError, TokenNotAcceptedError, NotAProtocolESIMWalletError, UnknownTransactionError, TransactionRevertedError, ReceiptNotCanonicalError, NotAnERC20TokenError, UnmatchedPaymentEventsError, PriceOutOfRangeError, AdminAllowanceExceededError, InvalidPaymentReferenceError, CouponSplitOutOfRangeError, ContractRevertError, decodeContractRevert, } from "../logic/errors.js";
14
14
  export type { DecodedRevert } from "../logic/errors.js";
15
15
  export { OperationState } from "../logic/admin/reads/protocolAdmin.reads.js";
16
16
  export { PaymentReferenceKind } from "../logic/admin/utils/paymentReference.js";
@@ -15,6 +15,7 @@ export declare class AdminESIMWalletSubPackage {
15
15
  newRequestedOwner(): Promise<`0x${string}`>;
16
16
  owner(): Promise<`0x${string}`>;
17
17
  priceCapUSDCents(): Promise<bigint>;
18
+ adminAllowanceUSDCents(): Promise<bigint>;
18
19
  deviceWallet(): Promise<`0x${string}`>;
19
20
  transactionHistory(index: bigint): Promise<DataBundleDetails>;
20
21
  }
@@ -14,6 +14,7 @@ export declare class AdminPaymentAdapterSubPackage {
14
14
  updateAsset(symbol: Hex, asset: Asset): Promise<`0x${string}`>;
15
15
  acceptOwnership(): Promise<`0x${string}`>;
16
16
  registerAssetCall(symbol: Hex, asset: Asset): Promise<import("../../types.js").OwnerCall>;
17
+ recoverTokensCall(token: Address, to: Address, amount: bigint): Promise<import("../../types.js").OwnerCall>;
17
18
  updateAssetCall(symbol: Hex, asset: Asset): Promise<import("../../types.js").OwnerCall>;
18
19
  transferOwnershipCall(newOwner: Address): Promise<import("../../types.js").OwnerCall>;
19
20
  upgradeCall(newImplementation: Address, data?: Hex): Promise<import("../../types.js").OwnerCall>;
@@ -33,6 +33,7 @@ export declare class ProtocolAdminCancellerSubPackage {
33
33
  export declare class ProtocolAdminGuardianSubPackage {
34
34
  walletClient: WalletClient;
35
35
  constructor(walletClient: WalletClient);
36
+ pauseInstantly(target: Address): Promise<`0x${string}`>;
36
37
  unpauseInstantly(target: Address): Promise<`0x${string}`>;
37
38
  revokeCancellersInstantly(accounts: readonly Address[]): Promise<`0x${string}`>;
38
39
  disableAdminInstantly(target?: Address): Promise<`0x${string}`>;
@@ -73,6 +74,7 @@ export declare class AdminProtocolAdminSubPackage {
73
74
  enableAdminCall(target?: Address): Promise<OwnerCall>;
74
75
  unpauseCall(target?: Address): Promise<OwnerCall>;
75
76
  setDefaultPriceCapUSDCentsCall(cap: bigint, target?: Address): Promise<OwnerCall>;
77
+ setDefaultAdminAllowanceUSDCentsCall(allowance: bigint, target?: Address): Promise<OwnerCall>;
76
78
  setPaymentAdapterCall(paymentAdapter: Address, target?: Address): Promise<OwnerCall>;
77
79
  operationId(call: OwnerCall, opts?: OperationOptions): Promise<`0x${string}`>;
78
80
  operationIdBatch(calls: readonly OwnerCall[], opts?: OperationOptions): Promise<`0x${string}`>;
@@ -46,6 +46,7 @@ export declare class AdminRegistrySubPackage {
46
46
  isESIMWalletOnStandby(eSIMWallet: Address): Promise<boolean>;
47
47
  paused(): Promise<boolean>;
48
48
  defaultPriceCapUSDCents(): Promise<bigint>;
49
+ defaultAdminAllowanceUSDCents(): Promise<bigint>;
49
50
  paymentAdapter(): Promise<`0x${string}`>;
50
51
  usedPaymentReferences(scopedReference: Hex): Promise<boolean>;
51
52
  isDeviceIdentifierAlreadyUsed(deviceUniqueIdentifier: string): Promise<boolean>;
@@ -23,7 +23,7 @@ export declare class DeviceWalletSubPackage {
23
23
  getVaultAddress(): Promise<`0x${string}`>;
24
24
  removeESIMWallet(eSIMWalletAddress: Address, callBackETH: boolean): Promise<`0x${string}`>;
25
25
  toggleAccessToFunds(eSIMWalletAddress: Address, hasAccessToFunds: boolean): Promise<`0x${string}`>;
26
- transferOwnership(newOwner: P256Key): Promise<`0x${string}`>;
26
+ transferOwnership(newOwner: P256Key, newOwnerSignature: Hex): Promise<`0x${string}`>;
27
27
  withdrawDepositTo(withdrawAddress: Address, amount: bigint): Promise<`0x${string}`>;
28
28
  canPullFunds(eSIMWalletAddress: Address): Promise<boolean>;
29
29
  deviceUniqueIdentifier(): Promise<string>;
@@ -34,5 +34,6 @@ export declare class DeviceWalletSubPackage {
34
34
  isValidESIMWallet(eSIMWalletAddress: Address): Promise<boolean>;
35
35
  isValidSignature(messageHash: Hex, signature: Hex): Promise<`0x${string}`>;
36
36
  registry(): Promise<`0x${string}`>;
37
+ rotationChallenge(newOwner: P256Key): Promise<`0x${string}`>;
37
38
  verifier(): Promise<`0x${string}`>;
38
39
  }
@@ -22,6 +22,8 @@ export declare class ESIMWalletSubPackage {
22
22
  */
23
23
  buyDataBundleWithTransfer(dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex): Promise<`0x${string}`>;
24
24
  priceCapUSDCents(): Promise<bigint>;
25
+ adminAllowanceUSDCents(): Promise<bigint>;
26
+ setAdminAllowanceUSDCents(allowance: bigint): Promise<`0x${string}`>;
25
27
  deviceWallet(): Promise<`0x${string}`>;
26
28
  owner(): Promise<`0x${string}`>;
27
29
  requestTransferOwnership(newOwner: Address): Promise<`0x${string}`>;
@@ -23,6 +23,7 @@ export declare class RegistrySubPackage {
23
23
  isESIMIdentifierClaimed(eSIMUniqueIdentifier: string): Promise<boolean>;
24
24
  eSIMWalletForIdentifier(eSIMUniqueIdentifier: string): Promise<`0x${string}`>;
25
25
  defaultPriceCapUSDCents(): Promise<bigint>;
26
+ defaultAdminAllowanceUSDCents(): Promise<bigint>;
26
27
  paymentAdapter(): Promise<`0x${string}`>;
27
28
  usedPaymentReferences(scopedReference: Hex): Promise<boolean>;
28
29
  requireLazyHistoryCopied(eSIMWallet: Address): Promise<void>;
@@ -8,5 +8,8 @@ import { DataBundleDetails } from "../../types.js";
8
8
  * unit - read it from `paymentAdapter.quote(asset, dataBundleDetails.priceUSDCents)`
9
9
  * first. `paymentReference` ties this purchase to its offchain order and is
10
10
  * spendable once per eSIM wallet.
11
+ *
12
+ * Throws `AdminAllowanceExceededError` without sending when the price is above
13
+ * what the wallet's owner still allows the admin to charge.
11
14
  */
12
15
  export declare const _buyDataBundleWithToken: (client: WalletClient, eSIMWalletAddress: Address, dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex) => Promise<`0x${string}`>;