kokio-sdk 3.4.0 → 3.5.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 (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 +11 -14
  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
@@ -57,6 +57,13 @@ export declare const _executeRaw: (client: WalletClient, target: Address, value:
57
57
  * proposer also holds.
58
58
  */
59
59
  export declare const _cancel: (client: WalletClient, id: Hex) => Promise<`0x${string}`>;
60
+ /**
61
+ * Pause a protocol contract straight away. `GUARDIAN_ROLE`.
62
+ *
63
+ * Only stops the contract, which the admin key could already do, and a guardian
64
+ * can release it at once with `_unpauseInstantly`.
65
+ */
66
+ export declare const _pauseInstantly: (client: WalletClient, target: Address) => Promise<`0x${string}`>;
60
67
  /**
61
68
  * Release a pause on a protocol contract straight away. `GUARDIAN_ROLE`.
62
69
  *
@@ -138,6 +145,13 @@ export declare const _unpauseCall: (client: WalletClient, target?: Address) => P
138
145
  * `target` defaults to the registry.
139
146
  */
140
147
  export declare const _setDefaultPriceCapUSDCentsCall: (client: WalletClient, cap: bigint, target?: Address) => Promise<OwnerCall>;
148
+ /**
149
+ * Set what the admin key may charge each newly created eSIM wallet, in USD
150
+ * cents. Pass the result to `schedule`. Existing wallets keep their own figure.
151
+ *
152
+ * `target` defaults to the registry.
153
+ */
154
+ export declare const _setDefaultAdminAllowanceUSDCentsCall: (client: WalletClient, allowance: bigint, target?: Address) => Promise<OwnerCall>;
141
155
  /**
142
156
  * Point the registry at a new payment adapter. Pass the result to `schedule`.
143
157
  *
@@ -11,6 +11,11 @@ export declare const _eSIMUniqueIdentifier: (client: WalletClient, eSIMWalletAdd
11
11
  * `buyDataBundleWithToken`, since a price over the ceiling reverts.
12
12
  */
13
13
  export declare const _priceCapUSDCents: (client: WalletClient, eSIMWalletAddress: Address) => Promise<bigint>;
14
+ /**
15
+ * What the admin key may still charge this eSIM wallet, in USD cents. Only the
16
+ * owner can raise it, so a purchase above it needs the user first.
17
+ */
18
+ export declare const _adminAllowanceUSDCents: (client: WalletClient, eSIMWalletAddress: Address) => Promise<bigint>;
14
19
  /** The pending owner proposed via `requestTransferOwnership` (zero if none). */
15
20
  export declare const _newRequestedOwner: (client: WalletClient, eSIMWalletAddress: Address) => Promise<Address>;
16
21
  /** The current owner (device wallet) of this eSIM wallet. */
@@ -27,6 +27,8 @@ export declare const _paused: (client: WalletClient) => Promise<boolean>;
27
27
  * cap of its own. Never zero.
28
28
  */
29
29
  export declare const _defaultPriceCapUSDCents: (client: WalletClient) => Promise<bigint>;
30
+ /** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
31
+ export declare const _defaultAdminAllowanceUSDCents: (client: WalletClient) => Promise<bigint>;
30
32
  /** The vault EOA recorded in the registry. */
31
33
  export declare const _vault: (client: WalletClient) => Promise<Address>;
32
34
  /** The pending admin nominated via `requestAdminUpdate` (zero address if none). */
@@ -44,12 +44,12 @@ export declare const _removeESIMWallet: (client: KokioSmartAccountClient, addres
44
44
  * Rotate the P256 key that owns this wallet. The registry is told in the same
45
45
  * call, so its record of the owner cannot drift from the wallet's.
46
46
  *
47
- * A key that cannot produce a verifiable signature bricks the wallet: this is
48
- * reachable only through a signed userOp, so there is no rotating back and no
49
- * reaching the balance afterwards. The contract rejects a key it can tell is
50
- * unusable, but check the new key can sign before calling.
47
+ * `newOwnerSignature` is the new passkey's WebAuthn assertion over
48
+ * `rotationChallenge(newOwner)`, ABI-encoded as a `WebAuthnSignature` with no
49
+ * version or validUntil header. Without it the contract reverts with
50
+ * `NewOwnerKeyCannotSign`, so a wallet can only move to a key that can sign.
51
51
  */
52
- export declare const _transferOwnership: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key) => Promise<`0x${string}`>;
52
+ export declare const _transferOwnership: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key, newOwnerSignature: Hex) => Promise<`0x${string}`>;
53
53
  /**
54
54
  * Top up the gas deposit the EntryPoint holds for this wallet, from the wallet's
55
55
  * own balance. Anyone may pay into any account's deposit, so an EOA can do this
@@ -81,6 +81,12 @@ export declare const _canPullFunds: (client: KokioSmartAccountClient, address: A
81
81
  * the same owner key's wallet at a different salt.
82
82
  */
83
83
  export declare const _isValidSignature: (client: KokioSmartAccountClient, address: Address, messageHash: Hex, signature: Hex) => Promise<Hex>;
84
+ /**
85
+ * The bytes the new passkey must sign before `transferOwnership` accepts it.
86
+ * Bound to this wallet, this chain and `newOwner`, so it cannot be reused for
87
+ * another rotation.
88
+ */
89
+ export declare const _rotationChallenge: (client: KokioSmartAccountClient, address: Address, newOwner: P256Key) => Promise<Hex>;
84
90
  /** The registry this wallet reports its ownership changes to. */
85
91
  export declare const _registry: (client: KokioSmartAccountClient, address: Address) => Promise<Address>;
86
92
  /** The factory that deploys this wallet's eSIM wallets. */
@@ -11,6 +11,14 @@ import { KokioSmartAccountClient } from "../types.js";
11
11
  * owner has to set it again.
12
12
  */
13
13
  export declare const _setPriceCapUSDCents: (client: KokioSmartAccountClient, address: Address, cap: bigint) => Promise<`0x${string}`>;
14
+ /**
15
+ * Set the total the admin key may charge this eSIM wallet, in USD cents. It
16
+ * replaces what is left rather than adding to it, and zero stops admin charges.
17
+ *
18
+ * `onlyDeviceWallet`, so only the user can raise what the admin may spend. A
19
+ * handover resets it to the registry default.
20
+ */
21
+ export declare const _setAdminAllowanceUSDCents: (client: KokioSmartAccountClient, address: Address, allowance: bigint) => Promise<`0x${string}`>;
14
22
  /**
15
23
  * Buy a data bundle in `asset`, an ERC-20 the payment adapter accepts.
16
24
  *
@@ -53,6 +61,12 @@ export declare const _owner: (client: KokioSmartAccountClient, address: Address)
53
61
  * state is reachable.
54
62
  */
55
63
  export declare const _priceCapUSDCents: (client: KokioSmartAccountClient, address: Address) => Promise<bigint>;
64
+ /**
65
+ * What the admin key may still charge this eSIM wallet, in USD cents. Each admin
66
+ * purchase lowers it and nothing refills it, so the owner tops it up with
67
+ * `setAdminAllowanceUSDCents`. The owner's own purchases do not touch it.
68
+ */
69
+ export declare const _adminAllowanceUSDCents: (client: KokioSmartAccountClient, address: Address) => Promise<bigint>;
56
70
  /**
57
71
  * The device wallet this eSIM wallet belongs to. Tracks `owner`, but it is its
58
72
  * own storage slot with its own getter, so read whichever one you mean.
@@ -149,6 +149,16 @@ export declare class PriceOutOfRangeError extends KokioError {
149
149
  readonly priceUSDCents: bigint;
150
150
  constructor(priceUSDCents: bigint);
151
151
  }
152
+ /**
153
+ * An admin purchase priced above what the eSIM wallet's owner still allows the
154
+ * admin key to charge. Thrown before sending, since the contract would revert
155
+ * with `AdminAllowanceExceeded`. The owner raises it with `setAdminAllowanceUSDCents`.
156
+ */
157
+ export declare class AdminAllowanceExceededError extends KokioError {
158
+ readonly priceUSDCents: bigint;
159
+ readonly remainingUSDCents: bigint;
160
+ constructor(priceUSDCents: bigint, remainingUSDCents: bigint);
161
+ }
152
162
  /**
153
163
  * A payment reference that is not 32 bytes, has an empty order part, or
154
164
  * carries a tag this SDK cannot write over or read back.
@@ -70,6 +70,8 @@ export declare const _isESIMIdentifierClaimed: (client: KokioSmartAccountClient,
70
70
  export declare const _eSIMWalletForIdentifier: (client: KokioSmartAccountClient, eSIMUniqueIdentifier: string) => Promise<Address>;
71
71
  /** The fallback price ceiling in USD cents for a wallet holding no cap of its own. */
72
72
  export declare const _defaultPriceCapUSDCents: (client: KokioSmartAccountClient) => Promise<bigint>;
73
+ /** What the admin key may charge a newly created eSIM wallet in total, in USD cents. */
74
+ export declare const _defaultAdminAllowanceUSDCents: (client: KokioSmartAccountClient) => Promise<bigint>;
73
75
  /** The payment adapter this registry currently points at. */
74
76
  export declare const _paymentAdapter: (client: KokioSmartAccountClient) => Promise<Address>;
75
77
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokio-sdk",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/config.js",