kokio-sdk 1.0.0 → 1.1.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.
@@ -1,3 +1,4 @@
1
+ import { ConstantsSubPackage } from "../interface/constantsClass.js";
1
2
  import { AdminDeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
2
3
  import { AdminESIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
3
4
  import { AdminRegistrySubPackage } from "./interface/registryClass.js";
@@ -28,6 +29,7 @@ export class KokioAdmin {
28
29
  walletClient;
29
30
  deviceWalletAddress;
30
31
  eSIMWalletAddress;
32
+ _constants;
31
33
  // Chain-wide surfaces - available as soon as a wallet client exists.
32
34
  deviceWalletFactory;
33
35
  eSIMWalletFactory;
@@ -40,6 +42,7 @@ export class KokioAdmin {
40
42
  this.walletClient = walletClient;
41
43
  this.deviceWalletAddress = deviceWalletAddress;
42
44
  this.eSIMWalletAddress = eSIMWalletAddress;
45
+ this._constants = new ConstantsSubPackage(walletClient);
43
46
  this.deviceWalletFactory = new AdminDeviceWalletFactorySubPackage(walletClient);
44
47
  this.eSIMWalletFactory = new AdminESIMWalletFactorySubPackage(walletClient);
45
48
  this.registry = new AdminRegistrySubPackage(walletClient);
@@ -47,6 +50,19 @@ export class KokioAdmin {
47
50
  this.deviceWallet = deviceWalletAddress ? new AdminDeviceWalletSubPackage(walletClient, deviceWalletAddress) : undefined;
48
51
  this.eSIMWallet = eSIMWalletAddress ? new AdminESIMWalletSubPackage(walletClient, eSIMWalletAddress) : undefined;
49
52
  }
53
+ /**
54
+ * Chain-specific constants (factory addresses, chain, RPC URLs, custom errors)
55
+ * for the wallet client's connected chain. Resolution is asynchronous because
56
+ * the chain id is read from the client, so this getter returns a promise:
57
+ *
58
+ * const { factoryAddresses } = await admin.constants;
59
+ *
60
+ * The underlying value is memoized, so repeated awaits do not re-fetch.
61
+ * There is no Pimlico key on this surface, so `pimlicoRpcURL` is always `""`.
62
+ */
63
+ get constants() {
64
+ return this._constants.load();
65
+ }
50
66
  /**
51
67
  * Bind a `DeviceWallet` instance address after construction and (re)wire the
52
68
  * `deviceWallet` surface to it. Returns `this` for chaining. This is the
@@ -74,6 +90,7 @@ export class KokioAdmin {
74
90
  */
75
91
  setWalletClient(walletClient) {
76
92
  this.walletClient = walletClient;
93
+ this._constants = new ConstantsSubPackage(walletClient);
77
94
  this.deviceWalletFactory = new AdminDeviceWalletFactorySubPackage(walletClient);
78
95
  this.eSIMWalletFactory = new AdminESIMWalletFactorySubPackage(walletClient);
79
96
  this.registry = new AdminRegistrySubPackage(walletClient);
@@ -1,4 +1,5 @@
1
1
  import { Address, WalletClient } from "viem";
2
+ import { KokioConstants } from "../interface/constantsClass.js";
2
3
  import { AdminDeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
3
4
  import { AdminESIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
4
5
  import { AdminRegistrySubPackage } from "./interface/registryClass.js";
@@ -27,6 +28,7 @@ export declare class KokioAdmin {
27
28
  walletClient: WalletClient;
28
29
  deviceWalletAddress?: Address;
29
30
  eSIMWalletAddress?: Address;
31
+ private _constants;
30
32
  deviceWalletFactory: AdminDeviceWalletFactorySubPackage;
31
33
  eSIMWalletFactory: AdminESIMWalletFactorySubPackage;
32
34
  registry: AdminRegistrySubPackage;
@@ -34,6 +36,17 @@ export declare class KokioAdmin {
34
36
  deviceWallet?: AdminDeviceWalletSubPackage;
35
37
  eSIMWallet?: AdminESIMWalletSubPackage;
36
38
  constructor(walletClient: WalletClient, deviceWalletAddress?: Address, eSIMWalletAddress?: Address);
39
+ /**
40
+ * Chain-specific constants (factory addresses, chain, RPC URLs, custom errors)
41
+ * for the wallet client's connected chain. Resolution is asynchronous because
42
+ * the chain id is read from the client, so this getter returns a promise:
43
+ *
44
+ * const { factoryAddresses } = await admin.constants;
45
+ *
46
+ * The underlying value is memoized, so repeated awaits do not re-fetch.
47
+ * There is no Pimlico key on this surface, so `pimlicoRpcURL` is always `""`.
48
+ */
49
+ get constants(): Promise<KokioConstants>;
37
50
  /**
38
51
  * Bind a `DeviceWallet` instance address after construction and (re)wire the
39
52
  * `deviceWallet` surface to it. Returns `this` for chaining. This is the
@@ -16,9 +16,9 @@ export interface KokioConstants {
16
16
  */
17
17
  export declare class ConstantsSubPackage {
18
18
  private client;
19
- private pimlicoAPIKey;
19
+ private pimlicoAPIKey?;
20
20
  private cache?;
21
- constructor(client: WalletClient, pimlicoAPIKey: string);
21
+ constructor(client: WalletClient, pimlicoAPIKey?: string);
22
22
  /**
23
23
  * Resolves and caches the chain-specific constants. Subsequent calls
24
24
  * return the same promise, so the chain id is only fetched once.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokio-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/config.js",