kokio-sdk 1.1.0 → 2.0.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 (106) hide show
  1. package/README.md +68 -19
  2. package/dist/esm/abis/BeaconProxy.js +30 -46
  3. package/dist/esm/abis/DeviceWallet.js +546 -535
  4. package/dist/esm/abis/DeviceWalletFactory.js +537 -544
  5. package/dist/esm/abis/ESIMWallet.js +440 -299
  6. package/dist/esm/abis/ESIMWalletFactory.js +372 -289
  7. package/dist/esm/abis/LazyWalletRegistry.js +941 -421
  8. package/dist/esm/abis/P256Verifier.js +29 -29
  9. package/dist/esm/abis/ProtocolAdmin.js +1228 -0
  10. package/dist/esm/abis/Registry.js +1207 -466
  11. package/dist/esm/abis/RegistryHelper.js +414 -20
  12. package/dist/esm/abis/index.js +2 -1
  13. package/dist/esm/admin/config-admin.js +7 -0
  14. package/dist/esm/admin/interface/deviceWalletClass.js +27 -6
  15. package/dist/esm/admin/interface/deviceWalletFactoryClass.js +41 -19
  16. package/dist/esm/admin/interface/eSIMWalletClass.js +10 -1
  17. package/dist/esm/admin/interface/eSIMWalletFactoryClass.js +24 -2
  18. package/dist/esm/admin/interface/lazyWalletRegistryClass.js +83 -4
  19. package/dist/esm/admin/interface/protocolAdminClass.js +195 -0
  20. package/dist/esm/admin/interface/registryClass.js +93 -2
  21. package/dist/esm/config.js +42 -7
  22. package/dist/esm/interface/deviceWalletClass.js +45 -5
  23. package/dist/esm/interface/deviceWalletFactoryClass.js +20 -1
  24. package/dist/esm/interface/eSIMWalletClass.js +12 -3
  25. package/dist/esm/interface/registryClass.js +47 -0
  26. package/dist/esm/interface/smartAccountClass.js +2 -4
  27. package/dist/esm/logic/account-kit/createSmartAccount.js +156 -102
  28. package/dist/esm/logic/admin/deviceWallet.eoa.js +23 -12
  29. package/dist/esm/logic/admin/deviceWalletFactory.eoa.js +63 -42
  30. package/dist/esm/logic/admin/eSIMWallet.eoa.js +3 -5
  31. package/dist/esm/logic/admin/eSIMWalletFactory.eoa.js +76 -8
  32. package/dist/esm/logic/admin/lazyWalletRegistry.eoa.js +330 -19
  33. package/dist/esm/logic/admin/protocolAdmin.eoa.js +524 -0
  34. package/dist/esm/logic/admin/reads/deviceWallet.reads.js +82 -7
  35. package/dist/esm/logic/admin/reads/deviceWalletFactory.reads.js +82 -23
  36. package/dist/esm/logic/admin/reads/eSIMWallet.reads.js +50 -6
  37. package/dist/esm/logic/admin/reads/eSIMWalletFactory.reads.js +63 -5
  38. package/dist/esm/logic/admin/reads/lazyWalletRegistry.reads.js +171 -10
  39. package/dist/esm/logic/admin/reads/protocolAdmin.reads.js +154 -0
  40. package/dist/esm/logic/admin/reads/registry.reads.js +289 -9
  41. package/dist/esm/logic/admin/registry.eoa.js +274 -4
  42. package/dist/esm/logic/constants.js +53 -26
  43. package/dist/esm/logic/deviceWallet.js +224 -31
  44. package/dist/esm/logic/deviceWalletFactory.js +89 -0
  45. package/dist/esm/logic/eSIMWallet.js +113 -43
  46. package/dist/esm/logic/eSIMWalletFactory.js +8 -8
  47. package/dist/esm/logic/errors.js +64 -0
  48. package/dist/esm/logic/registry.js +236 -0
  49. package/dist/esm/logic/utils.js +2 -1
  50. package/dist/types/abis/BeaconProxy.d.ts +21 -33
  51. package/dist/types/abis/DeviceWallet.d.ts +372 -365
  52. package/dist/types/abis/DeviceWalletFactory.d.ts +438 -448
  53. package/dist/types/abis/ESIMWallet.d.ts +352 -245
  54. package/dist/types/abis/ESIMWalletFactory.d.ts +278 -216
  55. package/dist/types/abis/LazyWalletRegistry.d.ts +710 -317
  56. package/dist/types/abis/P256Verifier.d.ts +16 -16
  57. package/dist/types/abis/ProtocolAdmin.d.ts +947 -0
  58. package/dist/types/abis/Registry.d.ts +960 -393
  59. package/dist/types/abis/RegistryHelper.d.ts +317 -16
  60. package/dist/types/abis/index.d.ts +2 -1
  61. package/dist/types/admin/config-admin.d.ts +3 -0
  62. package/dist/types/admin/interface/deviceWalletClass.d.ts +10 -3
  63. package/dist/types/admin/interface/deviceWalletFactoryClass.d.ts +14 -7
  64. package/dist/types/admin/interface/eSIMWalletClass.d.ts +3 -0
  65. package/dist/types/admin/interface/eSIMWalletFactoryClass.d.ts +8 -1
  66. package/dist/types/admin/interface/lazyWalletRegistryClass.d.ts +38 -2
  67. package/dist/types/admin/interface/protocolAdminClass.d.ts +95 -0
  68. package/dist/types/admin/interface/registryClass.d.ts +30 -0
  69. package/dist/types/config.d.ts +26 -5
  70. package/dist/types/interface/P256VerifierClass.d.ts +3 -4
  71. package/dist/types/interface/deviceWalletClass.d.ts +22 -2569
  72. package/dist/types/interface/deviceWalletFactoryClass.d.ts +10 -2564
  73. package/dist/types/interface/eSIMWalletClass.d.ts +11 -8
  74. package/dist/types/interface/eSIMWalletFactoryClass.d.ts +5 -2565
  75. package/dist/types/interface/registryClass.d.ts +19 -0
  76. package/dist/types/interface/smartAccountClass.d.ts +6 -2568
  77. package/dist/types/logic/P256Verifier.d.ts +2 -2
  78. package/dist/types/logic/account-kit/createSmartAccount.d.ts +43 -19
  79. package/dist/types/logic/admin/deviceWallet.eoa.d.ts +15 -9
  80. package/dist/types/logic/admin/deviceWalletFactory.eoa.d.ts +34 -23
  81. package/dist/types/logic/admin/eSIMWallet.eoa.d.ts +0 -5
  82. package/dist/types/logic/admin/eSIMWalletFactory.eoa.d.ts +27 -9
  83. package/dist/types/logic/admin/lazyWalletRegistry.eoa.d.ts +102 -10
  84. package/dist/types/logic/admin/protocolAdmin.eoa.d.ts +163 -0
  85. package/dist/types/logic/admin/reads/deviceWallet.reads.d.ts +28 -8
  86. package/dist/types/logic/admin/reads/deviceWalletFactory.reads.d.ts +45 -14
  87. package/dist/types/logic/admin/reads/eSIMWallet.reads.d.ts +25 -6
  88. package/dist/types/logic/admin/reads/eSIMWalletFactory.reads.d.ts +21 -6
  89. package/dist/types/logic/admin/reads/lazyWalletRegistry.reads.d.ts +44 -11
  90. package/dist/types/logic/admin/reads/protocolAdmin.reads.d.ts +53 -0
  91. package/dist/types/logic/admin/reads/registry.reads.d.ts +105 -9
  92. package/dist/types/logic/admin/registry.eoa.d.ts +102 -5
  93. package/dist/types/logic/constants.d.ts +2 -0
  94. package/dist/types/logic/deviceWallet.d.ts +78 -6
  95. package/dist/types/logic/deviceWalletFactory.d.ts +32 -3
  96. package/dist/types/logic/eSIMWallet.d.ts +48 -7
  97. package/dist/types/logic/eSIMWalletFactory.d.ts +3 -3
  98. package/dist/types/logic/errors.d.ts +45 -0
  99. package/dist/types/logic/registry.d.ts +78 -0
  100. package/dist/types/types-export.d.ts +1 -1
  101. package/dist/types/types.d.ts +111 -1
  102. package/package.json +11 -13
  103. package/dist/esm/interface/lazyWalletRegistryClass.js +0 -10
  104. package/dist/esm/logic/lazyWalletRegistry.js +0 -19
  105. package/dist/types/interface/lazyWalletRegistryClass.d.ts +0 -6
  106. package/dist/types/logic/lazyWalletRegistry.d.ts +0 -2
@@ -4,7 +4,23 @@ export declare class AdminRegistrySubPackage {
4
4
  walletClient: WalletClient;
5
5
  constructor(walletClient: WalletClient);
6
6
  addOrUpdateLazyWalletRegistryAddress(lazyWalletRegistry: Address): Promise<`0x${string}`>;
7
+ updateVaultAddress(newVaultAddress: Address): Promise<`0x${string}`>;
8
+ requestAdminUpdate(newAdmin: Address): Promise<`0x${string}`>;
9
+ disableAdmin(): Promise<`0x${string}`>;
10
+ enableAdmin(): Promise<`0x${string}`>;
11
+ acceptAdminUpdate(): Promise<`0x${string}`>;
12
+ assignESIMIdentifier(eSIMWalletAddress: Address, eSIMUniqueIdentifier: string): Promise<`0x${string}`>;
13
+ pause(): Promise<`0x${string}`>;
14
+ unpause(): Promise<`0x${string}`>;
15
+ setDefaultDataBundlePriceCap(cap: bigint): Promise<`0x${string}`>;
16
+ acceptOwnership(): Promise<`0x${string}`>;
17
+ transferOwnershipCall(newOwner: Address): Promise<import("../../types.js").OwnerCall>;
18
+ upgradeCall(newImplementation: Address, data?: Hex): Promise<import("../../types.js").OwnerCall>;
19
+ owner(): Promise<`0x${string}`>;
7
20
  eSIMWalletAdmin(): Promise<`0x${string}`>;
21
+ adminOfRecord(): Promise<`0x${string}`>;
22
+ adminDisabled(): Promise<boolean>;
23
+ newRequestedAdmin(): Promise<`0x${string}`>;
8
24
  vault(): Promise<`0x${string}`>;
9
25
  upgradeManager(): Promise<`0x${string}`>;
10
26
  lazyWalletRegistry(): Promise<`0x${string}`>;
@@ -14,4 +30,18 @@ export declare class AdminRegistrySubPackage {
14
30
  isDeviceWalletValid(deviceWallet: Address): Promise<boolean>;
15
31
  isESIMWalletValid(eSIMWallet: Address): Promise<`0x${string}`>;
16
32
  isESIMWalletOnStandby(eSIMWallet: Address): Promise<boolean>;
33
+ paused(): Promise<boolean>;
34
+ defaultDataBundlePriceCap(): Promise<bigint>;
35
+ isDeviceIdentifierAlreadyUsed(deviceUniqueIdentifier: string): Promise<boolean>;
36
+ isESIMIdentifierClaimed(eSIMUniqueIdentifier: string): Promise<boolean>;
37
+ eSIMWalletForIdentifier(eSIMUniqueIdentifier: string): Promise<`0x${string}`>;
38
+ claimedESIMIdentifiers(hashOfESIMIdentifier: Hex): Promise<`0x${string}`>;
39
+ requireDeviceIdentifierNotReserved(deviceUniqueIdentifier: string): Promise<void>;
40
+ requireNotPaused(): Promise<void>;
41
+ pendingOwner(): Promise<`0x${string}`>;
42
+ deviceWalletFactory(): Promise<`0x${string}`>;
43
+ eSIMWalletFactory(): Promise<`0x${string}`>;
44
+ entryPoint(): Promise<`0x${string}`>;
45
+ proxiableUUID(): Promise<`0x${string}`>;
46
+ upgradeInterfaceVersion(): Promise<string>;
17
47
  }
@@ -3,29 +3,31 @@ import { KokioConstants } from "./interface/constantsClass.js";
3
3
  import { SmartAccountSubPackage } from "./interface/smartAccountClass.js";
4
4
  import { DeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
5
5
  import { P256VerifierSubPackage } from "./interface/P256VerifierClass.js";
6
- import { LazyWalletRegistrySubPackage } from "./interface/lazyWalletRegistryClass.js";
6
+ import { RegistrySubPackage } from "./interface/registryClass.js";
7
7
  import { DeviceWalletSubPackage } from "./interface/deviceWalletClass.js";
8
8
  import { ESIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
9
9
  import { ESIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
10
- import { SmartAccountClient } from "@aa-sdk/core";
10
+ import { KokioSmartAccountClient } from "./types.js";
11
11
  export { KokioError, NullOrUndefinedValueError, MissingSmartWalletError, MissingEOAWalletError, InvalidClientError, UnsupportedChainError, UnconfiguredChainError, CounterfactualMismatchError, ContractRevertError, decodeContractRevert, } from "./logic/errors.js";
12
12
  export type { DecodedRevert } from "./logic/errors.js";
13
13
  export declare class Kokio {
14
14
  viemWalletClient: WalletClient;
15
15
  credentialId: string;
16
16
  rpId: string;
17
- organizationId: string;
18
17
  pimlicoAPIKey: string;
19
18
  gasPolicyId: string;
19
+ smartAccountClient?: KokioSmartAccountClient;
20
+ deviceWalletAddress?: Address;
21
+ eSIMWalletAddress?: Address;
20
22
  private _constants;
21
23
  smartAccount: SmartAccountSubPackage;
22
24
  deviceWalletFactory?: DeviceWalletFactorySubPackage;
23
25
  eSIMWalletFactory?: ESIMWalletFactorySubPackage;
24
- lazyWalletRegistry?: LazyWalletRegistrySubPackage;
26
+ registry?: RegistrySubPackage;
25
27
  deviceWallet?: DeviceWalletSubPackage;
26
28
  eSIMWallet?: ESIMWalletSubPackage;
27
29
  P256Verifier?: P256VerifierSubPackage;
28
- constructor(viemWalletClient: WalletClient, credentialId: string, rpId: string, organizationId: string, pimlicoAPIKey: string, gasPolicyId: string, smartAccountClient?: SmartAccountClient, deviceWalletAddress?: Address, eSIMWalletAddress?: Address);
30
+ constructor(viemWalletClient: WalletClient, credentialId: string, rpId: string, pimlicoAPIKey: string, gasPolicyId: string, smartAccountClient?: KokioSmartAccountClient, deviceWalletAddress?: Address, eSIMWalletAddress?: Address);
29
31
  /**
30
32
  * Chain-specific constants (factory addresses, chain, RPC URLs, custom errors)
31
33
  * for the wallet client's connected chain. Resolution is asynchronous because
@@ -36,4 +38,23 @@ export declare class Kokio {
36
38
  * The underlying value is memoized, so repeated awaits do not re-fetch.
37
39
  */
38
40
  get constants(): Promise<KokioConstants>;
41
+ /**
42
+ * Bind a `DeviceWallet` instance address after construction and (re)wire
43
+ * the `deviceWallet` surface to it. Returns `this` for chaining.
44
+ *
45
+ * Needs a `smartAccountClient` already on this instance - every write on
46
+ * `deviceWallet` sends a user operation through it. Without one,
47
+ * `deviceWallet` stays `undefined`, same as when no address is passed to
48
+ * the constructor.
49
+ */
50
+ setDeviceWalletAddress(deviceWalletAddress: Address): this;
51
+ /**
52
+ * Bind an `ESIMWallet` instance address after construction and (re)wire
53
+ * the `eSIMWallet` surface to it. Returns `this` for chaining.
54
+ *
55
+ * A user holding several eSIM wallets can call this to switch which one
56
+ * `kokio.eSIMWallet` acts on, without re-creating `Kokio`. Same
57
+ * `smartAccountClient` requirement as {@link setDeviceWalletAddress}.
58
+ */
59
+ setESIMWalletAddress(eSIMWalletAddress: Address): this;
39
60
  }
@@ -1,8 +1,7 @@
1
1
  import { Hex } from "viem";
2
- import { WebAuthnSignature } from "../types";
3
- import { SmartAccountClient } from "@aa-sdk/core";
2
+ import { WebAuthnSignature, KokioSmartAccountClient } from "../types.js";
4
3
  export declare class P256VerifierSubPackage {
5
- client: SmartAccountClient;
6
- constructor(client: SmartAccountClient);
4
+ client: KokioSmartAccountClient;
5
+ constructor(client: KokioSmartAccountClient);
7
6
  verifySignature(message: Hex, requireMessageVerification: boolean, webAuthnSignature: WebAuthnSignature, x: bigint, y: bigint): Promise<boolean>;
8
7
  }