kokio-sdk 3.0.2 → 3.2.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 (53) hide show
  1. package/README.md +15 -15
  2. package/dist/esm/admin/config-admin.js +6 -1
  3. package/dist/esm/admin/interface/callsClass.js +30 -0
  4. package/dist/esm/config.js +1 -1
  5. package/dist/esm/interface/deviceWalletClass.js +10 -1
  6. package/dist/esm/interface/eSIMWalletClass.js +17 -1
  7. package/dist/esm/interface/eSIMWalletFactoryClass.js +9 -1
  8. package/dist/esm/interface/registryClass.js +8 -0
  9. package/dist/esm/interface/smartAccountClass.js +9 -2
  10. package/dist/esm/logic/P256Verifier.js +2 -2
  11. package/dist/esm/logic/account-kit/createSmartAccount.js +47 -36
  12. package/dist/esm/logic/admin/deviceWallet.eoa.js +5 -5
  13. package/dist/esm/logic/admin/deviceWalletFactory.eoa.js +13 -13
  14. package/dist/esm/logic/admin/eSIMWallet.eoa.js +3 -3
  15. package/dist/esm/logic/admin/eSIMWalletFactory.eoa.js +9 -9
  16. package/dist/esm/logic/admin/lazyWalletRegistry.eoa.js +13 -13
  17. package/dist/esm/logic/admin/paymentAdapter.eoa.js +11 -11
  18. package/dist/esm/logic/admin/protocolAdmin.eoa.js +14 -14
  19. package/dist/esm/logic/admin/reads/deviceWalletFactory.reads.js +9 -9
  20. package/dist/esm/logic/admin/reads/eSIMWalletFactory.reads.js +7 -7
  21. package/dist/esm/logic/admin/reads/lazyWalletRegistry.reads.js +18 -18
  22. package/dist/esm/logic/admin/reads/paymentAdapter.reads.js +8 -8
  23. package/dist/esm/logic/admin/reads/protocolAdmin.reads.js +2 -2
  24. package/dist/esm/logic/admin/reads/registry.reads.js +31 -31
  25. package/dist/esm/logic/admin/registry.eoa.js +27 -27
  26. package/dist/esm/logic/calls/eSIMWallet.calls.js +72 -0
  27. package/dist/esm/logic/constants.js +14 -1
  28. package/dist/esm/logic/deviceWallet.js +35 -1
  29. package/dist/esm/logic/deviceWalletFactory.js +11 -11
  30. package/dist/esm/logic/eSIMWallet.js +32 -0
  31. package/dist/esm/logic/eSIMWalletFactory.js +15 -3
  32. package/dist/esm/logic/errors.js +15 -9
  33. package/dist/esm/logic/paymentAdapter.js +8 -8
  34. package/dist/esm/logic/registry.js +17 -17
  35. package/dist/esm/logic/utils.js +1 -81
  36. package/dist/types/admin/config-admin.d.ts +4 -1
  37. package/dist/types/admin/interface/callsClass.d.ts +26 -0
  38. package/dist/types/config.d.ts +1 -1
  39. package/dist/types/interface/deviceWalletClass.d.ts +12 -0
  40. package/dist/types/interface/eSIMWalletClass.d.ts +14 -0
  41. package/dist/types/interface/eSIMWalletFactoryClass.d.ts +6 -0
  42. package/dist/types/interface/registryClass.d.ts +8 -0
  43. package/dist/types/interface/smartAccountClass.d.ts +10 -1
  44. package/dist/types/logic/account-kit/createSmartAccount.d.ts +1 -1
  45. package/dist/types/logic/calls/eSIMWallet.calls.d.ts +25 -0
  46. package/dist/types/logic/constants.d.ts +3 -0
  47. package/dist/types/logic/deviceWallet.d.ts +12 -0
  48. package/dist/types/logic/eSIMWallet.d.ts +16 -0
  49. package/dist/types/logic/eSIMWalletFactory.d.ts +2 -0
  50. package/dist/types/logic/errors.d.ts +6 -5
  51. package/dist/types/logic/utils.d.ts +0 -21
  52. package/dist/types/types.d.ts +1 -1
  53. package/package.json +21 -7
@@ -1,5 +1,5 @@
1
1
  import { publicActions } from "viem";
2
- import { _getChainSpecificConstants } from "../../constants.js";
2
+ import { _chainId, _getChainSpecificConstants } from "../../constants.js";
3
3
  import { LazyWalletRegistry } from "../../../abis/index.js";
4
4
  // Read-only admin logic for `LazyWalletRegistry` - its public storage getters,
5
5
  // surfaced for the backend's fiat/lazy provisioning flows. Each read extends the
@@ -11,7 +11,7 @@ import { LazyWalletRegistry } from "../../../abis/index.js";
11
11
  // callers iterate indices to read the whole list (there is no full-array getter).
12
12
  /** The upgrade-manager (owner) EOA of the lazy registry. */
13
13
  export const _upgradeManager = async (client) => {
14
- const chainID = await client.getChainId();
14
+ const chainID = await _chainId(client);
15
15
  const rpcURL = client.transport.url;
16
16
  const values = _getChainSpecificConstants(chainID, rpcURL);
17
17
  return client.extend(publicActions).readContract({
@@ -23,7 +23,7 @@ export const _upgradeManager = async (client) => {
23
23
  };
24
24
  /** The device identifier an eSIM identifier is currently associated with. */
25
25
  export const _eSIMIdentifierToDeviceIdentifier = async (client, eSIMIdentifier) => {
26
- const chainID = await client.getChainId();
26
+ const chainID = await _chainId(client);
27
27
  const rpcURL = client.transport.url;
28
28
  const values = _getChainSpecificConstants(chainID, rpcURL);
29
29
  return client.extend(publicActions).readContract({
@@ -35,7 +35,7 @@ export const _eSIMIdentifierToDeviceIdentifier = async (client, eSIMIdentifier)
35
35
  };
36
36
  /** One data-bundle history entry for a (device, eSIM) pair, by array index. */
37
37
  export const _deviceIdentifierToESIMDetails = async (client, deviceIdentifier, eSIMIdentifier, index) => {
38
- const chainID = await client.getChainId();
38
+ const chainID = await _chainId(client);
39
39
  const rpcURL = client.transport.url;
40
40
  const values = _getChainSpecificConstants(chainID, rpcURL);
41
41
  const [id, priceUSDCents, settlement] = await client.extend(publicActions).readContract({
@@ -48,7 +48,7 @@ export const _deviceIdentifierToESIMDetails = async (client, deviceIdentifier, e
48
48
  };
49
49
  /** Most eSIM wallets one `deployLazyWalletAndSetESIMIdentifier` call will deploy. */
50
50
  export const _maxESIMWalletsPerCall = async (client) => {
51
- const chainID = await client.getChainId();
51
+ const chainID = await _chainId(client);
52
52
  const rpcURL = client.transport.url;
53
53
  const values = _getChainSpecificConstants(chainID, rpcURL);
54
54
  return client.extend(publicActions).readContract({
@@ -60,7 +60,7 @@ export const _maxESIMWalletsPerCall = async (client) => {
60
60
  };
61
61
  /** Most history entries one `setHistoryForLazyWallet` call will copy. */
62
62
  export const _maxHistoryEntriesPerCall = async (client) => {
63
- const chainID = await client.getChainId();
63
+ const chainID = await _chainId(client);
64
64
  const rpcURL = client.transport.url;
65
65
  const values = _getChainSpecificConstants(chainID, rpcURL);
66
66
  return client.extend(publicActions).readContract({
@@ -76,7 +76,7 @@ export const _maxHistoryEntriesPerCall = async (client) => {
76
76
  * the route itself.
77
77
  */
78
78
  export const _eSIMWalletsDeployed = async (client, deviceIdentifier) => {
79
- const chainID = await client.getChainId();
79
+ const chainID = await _chainId(client);
80
80
  const rpcURL = client.transport.url;
81
81
  const values = _getChainSpecificConstants(chainID, rpcURL);
82
82
  return client.extend(publicActions).readContract({
@@ -88,7 +88,7 @@ export const _eSIMWalletsDeployed = async (client, deviceIdentifier) => {
88
88
  };
89
89
  /** Salt the device's first deployment batch started from. Every later batch derives from it. */
90
90
  export const _lazyDeploymentSalt = async (client, deviceIdentifier) => {
91
- const chainID = await client.getChainId();
91
+ const chainID = await _chainId(client);
92
92
  const rpcURL = client.transport.url;
93
93
  const values = _getChainSpecificConstants(chainID, rpcURL);
94
94
  return client.extend(publicActions).readContract({
@@ -103,7 +103,7 @@ export const _lazyDeploymentSalt = async (client, deviceIdentifier) => {
103
103
  * did not deploy, which is what authorises the history copy.
104
104
  */
105
105
  export const _lazyDeployedESIMWallet = async (client, eSIMIdentifier) => {
106
- const chainID = await client.getChainId();
106
+ const chainID = await _chainId(client);
107
107
  const rpcURL = client.transport.url;
108
108
  const values = _getChainSpecificConstants(chainID, rpcURL);
109
109
  return client.extend(publicActions).readContract({
@@ -115,7 +115,7 @@ export const _lazyDeployedESIMWallet = async (client, eSIMIdentifier) => {
115
115
  };
116
116
  /** How many of an eSIM's stored purchase entries have already reached its wallet. */
117
117
  export const _historyEntriesCopied = async (client, eSIMIdentifier) => {
118
- const chainID = await client.getChainId();
118
+ const chainID = await _chainId(client);
119
119
  const rpcURL = client.transport.url;
120
120
  const values = _getChainSpecificConstants(chainID, rpcURL);
121
121
  return client.extend(publicActions).readContract({
@@ -132,7 +132,7 @@ export const _historyEntriesCopied = async (client, eSIMIdentifier) => {
132
132
  * has not arrived yet.
133
133
  */
134
134
  export const _outstandingHistoryEntries = async (client, eSIMIdentifier) => {
135
- const chainID = await client.getChainId();
135
+ const chainID = await _chainId(client);
136
136
  const rpcURL = client.transport.url;
137
137
  const values = _getChainSpecificConstants(chainID, rpcURL);
138
138
  return client.extend(publicActions).readContract({
@@ -144,7 +144,7 @@ export const _outstandingHistoryEntries = async (client, eSIMIdentifier) => {
144
144
  };
145
145
  /** Whether a device identifier has purchases recorded against it here. */
146
146
  export const _isDeviceIdentifierReserved = async (client, deviceIdentifier) => {
147
- const chainID = await client.getChainId();
147
+ const chainID = await _chainId(client);
148
148
  const rpcURL = client.transport.url;
149
149
  const values = _getChainSpecificConstants(chainID, rpcURL);
150
150
  return client.extend(publicActions).readContract({
@@ -156,7 +156,7 @@ export const _isDeviceIdentifierReserved = async (client, deviceIdentifier) => {
156
156
  };
157
157
  /** Whether an eSIM identifier is bound to a device here. */
158
158
  export const _isESIMIdentifierReserved = async (client, eSIMIdentifier) => {
159
- const chainID = await client.getChainId();
159
+ const chainID = await _chainId(client);
160
160
  const rpcURL = client.transport.url;
161
161
  const values = _getChainSpecificConstants(chainID, rpcURL);
162
162
  return client.extend(publicActions).readContract({
@@ -168,7 +168,7 @@ export const _isESIMIdentifierReserved = async (client, eSIMIdentifier) => {
168
168
  };
169
169
  /** One eSIM identifier associated with a device identifier, by array index. */
170
170
  export const _eSIMIdentifiersAssociatedWithDeviceIdentifier = async (client, deviceIdentifier, index) => {
171
- const chainID = await client.getChainId();
171
+ const chainID = await _chainId(client);
172
172
  const rpcURL = client.transport.url;
173
173
  const values = _getChainSpecificConstants(chainID, rpcURL);
174
174
  return client.extend(publicActions).readContract({
@@ -184,7 +184,7 @@ export const _eSIMIdentifiersAssociatedWithDeviceIdentifier = async (client, dev
184
184
  * is what stops a non-UUPS address being installed.
185
185
  */
186
186
  export const _proxiableUUID = async (client) => {
187
- const chainID = await client.getChainId();
187
+ const chainID = await _chainId(client);
188
188
  const rpcURL = client.transport.url;
189
189
  const values = _getChainSpecificConstants(chainID, rpcURL);
190
190
  return client.extend(publicActions).readContract({
@@ -196,7 +196,7 @@ export const _proxiableUUID = async (client) => {
196
196
  };
197
197
  /** The OpenZeppelin upgrade interface this proxy speaks, currently `"5.0.0"`. */
198
198
  export const _upgradeInterfaceVersion = async (client) => {
199
- const chainID = await client.getChainId();
199
+ const chainID = await _chainId(client);
200
200
  const rpcURL = client.transport.url;
201
201
  const values = _getChainSpecificConstants(chainID, rpcURL);
202
202
  return client.extend(publicActions).readContract({
@@ -212,7 +212,7 @@ export const _upgradeInterfaceVersion = async (client) => {
212
212
  * be scheduled instead.
213
213
  */
214
214
  export const _owner = async (client) => {
215
- const chainID = await client.getChainId();
215
+ const chainID = await _chainId(client);
216
216
  const rpcURL = client.transport.url;
217
217
  const values = _getChainSpecificConstants(chainID, rpcURL);
218
218
  return client.extend(publicActions).readContract({
@@ -228,7 +228,7 @@ export const _owner = async (client) => {
228
228
  * been offered to the timelock.
229
229
  */
230
230
  export const _pendingOwner = async (client) => {
231
- const chainID = await client.getChainId();
231
+ const chainID = await _chainId(client);
232
232
  const rpcURL = client.transport.url;
233
233
  const values = _getChainSpecificConstants(chainID, rpcURL);
234
234
  return client.extend(publicActions).readContract({
@@ -1,5 +1,5 @@
1
1
  import { publicActions } from "viem";
2
- import { _getChainSpecificConstants } from "../../constants.js";
2
+ import { _chainId, _getChainSpecificConstants } from "../../constants.js";
3
3
  import { PaymentAdapter } from "../../../abis/index.js";
4
4
  // Read-only admin logic for `PaymentAdapter`. Every write on it
5
5
  // (registerAsset/updateAsset) is `onlyOwner`, i.e. only reachable through the
@@ -7,7 +7,7 @@ import { PaymentAdapter } from "../../../abis/index.js";
7
7
  // rather than here.
8
8
  /** The registry this adapter reads `vault()` and `isESIMWalletValid()` from. */
9
9
  export const _registry = async (client) => {
10
- const chainID = await client.getChainId();
10
+ const chainID = await _chainId(client);
11
11
  const rpcURL = client.transport.url;
12
12
  const values = _getChainSpecificConstants(chainID, rpcURL);
13
13
  return client.extend(publicActions).readContract({
@@ -19,7 +19,7 @@ export const _registry = async (client) => {
19
19
  };
20
20
  /** The ERC-20 registered under the `USDC` symbol at configure time. */
21
21
  export const _settlementToken = async (client) => {
22
- const chainID = await client.getChainId();
22
+ const chainID = await _chainId(client);
23
23
  const rpcURL = client.transport.url;
24
24
  const values = _getChainSpecificConstants(chainID, rpcURL);
25
25
  return client.extend(publicActions).readContract({
@@ -35,7 +35,7 @@ export const _settlementToken = async (client) => {
35
35
  * from "registered but withdrawn" (`allowed: false`).
36
36
  */
37
37
  export const _assets = async (client, symbol) => {
38
- const chainID = await client.getChainId();
38
+ const chainID = await _chainId(client);
39
39
  const rpcURL = client.transport.url;
40
40
  const values = _getChainSpecificConstants(chainID, rpcURL);
41
41
  const [allowed, isDollarUnit, decimals, token] = await client.extend(publicActions).readContract({
@@ -48,7 +48,7 @@ export const _assets = async (client, symbol) => {
48
48
  };
49
49
  /** A currency's full entry, reverting if the symbol was never registered. */
50
50
  export const _resolveAsset = async (client, symbol) => {
51
- const chainID = await client.getChainId();
51
+ const chainID = await _chainId(client);
52
52
  const rpcURL = client.transport.url;
53
53
  const values = _getChainSpecificConstants(chainID, rpcURL);
54
54
  return client.extend(publicActions).readContract({
@@ -64,7 +64,7 @@ export const _resolveAsset = async (client, symbol) => {
64
64
  * `_tokenAmount` for the backend's own settlement record.
65
65
  */
66
66
  export const _quote = async (client, symbol, priceUSDCents) => {
67
- const chainID = await client.getChainId();
67
+ const chainID = await _chainId(client);
68
68
  const rpcURL = client.transport.url;
69
69
  const values = _getChainSpecificConstants(chainID, rpcURL);
70
70
  return client.extend(publicActions).readContract({
@@ -82,7 +82,7 @@ export const _quote = async (client, symbol, priceUSDCents) => {
82
82
  * still reads the adapter's own record from before that move.
83
83
  */
84
84
  export const _usedReferences = async (client, paymentReference) => {
85
- const chainID = await client.getChainId();
85
+ const chainID = await _chainId(client);
86
86
  const rpcURL = client.transport.url;
87
87
  const values = _getChainSpecificConstants(chainID, rpcURL);
88
88
  return client.extend(publicActions).readContract({
@@ -94,7 +94,7 @@ export const _usedReferences = async (client, paymentReference) => {
94
94
  };
95
95
  /** The address holding upgrade authority over this adapter (its owner). */
96
96
  export const _upgradeManager = async (client) => {
97
- const chainID = await client.getChainId();
97
+ const chainID = await _chainId(client);
98
98
  const rpcURL = client.transport.url;
99
99
  const values = _getChainSpecificConstants(chainID, rpcURL);
100
100
  return client.extend(publicActions).readContract({
@@ -1,5 +1,5 @@
1
1
  import { publicActions } from "viem";
2
- import { _getChainSpecificConstants } from "../../constants.js";
2
+ import { _chainId, _getChainSpecificConstants } from "../../constants.js";
3
3
  import { ProtocolAdmin } from "../../../abis/index.js";
4
4
  // Read-only logic for `ProtocolAdmin`, the timelock that owns the four
5
5
  // upgradeable contracts. Every read extends the `WalletClient` with
@@ -13,7 +13,7 @@ export var OperationState;
13
13
  OperationState[OperationState["Done"] = 3] = "Done";
14
14
  })(OperationState || (OperationState = {}));
15
15
  const _resolve = async (client) => {
16
- const chainID = await client.getChainId();
16
+ const chainID = await _chainId(client);
17
17
  const rpcURL = client.transport.url;
18
18
  return _getChainSpecificConstants(chainID, rpcURL);
19
19
  };
@@ -1,5 +1,5 @@
1
1
  import { publicActions } from "viem";
2
- import { _getChainSpecificConstants } from "../../constants.js";
2
+ import { _chainId, _getChainSpecificConstants } from "../../constants.js";
3
3
  import { Registry } from "../../../abis/index.js";
4
4
  // Read-only admin logic for `Registry` (which inherits `RegistryHelper`, so its
5
5
  // ABI carries the helper mappings too). Surfaces the public storage getters for
@@ -11,7 +11,7 @@ import { Registry } from "../../../abis/index.js";
11
11
  * dormant rather than unset.
12
12
  */
13
13
  export const _eSIMWalletAdmin = async (client) => {
14
- const chainID = await client.getChainId();
14
+ const chainID = await _chainId(client);
15
15
  const rpcURL = client.transport.url;
16
16
  const values = _getChainSpecificConstants(chainID, rpcURL);
17
17
  return client.extend(publicActions).readContract({
@@ -27,7 +27,7 @@ export const _eSIMWalletAdmin = async (client) => {
27
27
  * who may actually act.
28
28
  */
29
29
  export const _adminOfRecord = async (client) => {
30
- const chainID = await client.getChainId();
30
+ const chainID = await _chainId(client);
31
31
  const rpcURL = client.transport.url;
32
32
  const values = _getChainSpecificConstants(chainID, rpcURL);
33
33
  return client.extend(publicActions).readContract({
@@ -43,7 +43,7 @@ export const _adminOfRecord = async (client) => {
43
43
  * this alongside `_newRequestedAdmin` to tell them apart.
44
44
  */
45
45
  export const _adminDisabled = async (client) => {
46
- const chainID = await client.getChainId();
46
+ const chainID = await _chainId(client);
47
47
  const rpcURL = client.transport.url;
48
48
  const values = _getChainSpecificConstants(chainID, rpcURL);
49
49
  return client.extend(publicActions).readContract({
@@ -58,7 +58,7 @@ export const _adminDisabled = async (client) => {
58
58
  * paths on the device wallets and eSIM wallets revert `ProtocolPaused`.
59
59
  */
60
60
  export const _paused = async (client) => {
61
- const chainID = await client.getChainId();
61
+ const chainID = await _chainId(client);
62
62
  const rpcURL = client.transport.url;
63
63
  const values = _getChainSpecificConstants(chainID, rpcURL);
64
64
  return client.extend(publicActions).readContract({
@@ -73,7 +73,7 @@ export const _paused = async (client) => {
73
73
  * cap of its own. Never zero.
74
74
  */
75
75
  export const _defaultPriceCapUSDCents = async (client) => {
76
- const chainID = await client.getChainId();
76
+ const chainID = await _chainId(client);
77
77
  const rpcURL = client.transport.url;
78
78
  const values = _getChainSpecificConstants(chainID, rpcURL);
79
79
  return client.extend(publicActions).readContract({
@@ -85,7 +85,7 @@ export const _defaultPriceCapUSDCents = async (client) => {
85
85
  };
86
86
  /** The vault EOA recorded in the registry. */
87
87
  export const _vault = async (client) => {
88
- const chainID = await client.getChainId();
88
+ const chainID = await _chainId(client);
89
89
  const rpcURL = client.transport.url;
90
90
  const values = _getChainSpecificConstants(chainID, rpcURL);
91
91
  return client.extend(publicActions).readContract({
@@ -97,7 +97,7 @@ export const _vault = async (client) => {
97
97
  };
98
98
  /** The pending admin nominated via `requestAdminUpdate` (zero address if none). */
99
99
  export const _newRequestedAdmin = async (client) => {
100
- const chainID = await client.getChainId();
100
+ const chainID = await _chainId(client);
101
101
  const rpcURL = client.transport.url;
102
102
  const values = _getChainSpecificConstants(chainID, rpcURL);
103
103
  return client.extend(publicActions).readContract({
@@ -113,7 +113,7 @@ export const _newRequestedAdmin = async (client) => {
113
113
  * be scheduled instead.
114
114
  */
115
115
  export const _owner = async (client) => {
116
- const chainID = await client.getChainId();
116
+ const chainID = await _chainId(client);
117
117
  const rpcURL = client.transport.url;
118
118
  const values = _getChainSpecificConstants(chainID, rpcURL);
119
119
  return client.extend(publicActions).readContract({
@@ -125,7 +125,7 @@ export const _owner = async (client) => {
125
125
  };
126
126
  /** The upgrade-manager (owner) EOA recorded in the registry. */
127
127
  export const _upgradeManager = async (client) => {
128
- const chainID = await client.getChainId();
128
+ const chainID = await _chainId(client);
129
129
  const rpcURL = client.transport.url;
130
130
  const values = _getChainSpecificConstants(chainID, rpcURL);
131
131
  return client.extend(publicActions).readContract({
@@ -141,7 +141,7 @@ export const _upgradeManager = async (client) => {
141
141
  * been offered to the timelock.
142
142
  */
143
143
  export const _pendingOwner = async (client) => {
144
- const chainID = await client.getChainId();
144
+ const chainID = await _chainId(client);
145
145
  const rpcURL = client.transport.url;
146
146
  const values = _getChainSpecificConstants(chainID, rpcURL);
147
147
  return client.extend(publicActions).readContract({
@@ -153,7 +153,7 @@ export const _pendingOwner = async (client) => {
153
153
  };
154
154
  /** The `DeviceWalletFactory` address wired into the registry. */
155
155
  export const _deviceWalletFactory = async (client) => {
156
- const chainID = await client.getChainId();
156
+ const chainID = await _chainId(client);
157
157
  const rpcURL = client.transport.url;
158
158
  const values = _getChainSpecificConstants(chainID, rpcURL);
159
159
  return client.extend(publicActions).readContract({
@@ -165,7 +165,7 @@ export const _deviceWalletFactory = async (client) => {
165
165
  };
166
166
  /** The `ESIMWalletFactory` address wired into the registry. */
167
167
  export const _eSIMWalletFactory = async (client) => {
168
- const chainID = await client.getChainId();
168
+ const chainID = await _chainId(client);
169
169
  const rpcURL = client.transport.url;
170
170
  const values = _getChainSpecificConstants(chainID, rpcURL);
171
171
  return client.extend(publicActions).readContract({
@@ -177,7 +177,7 @@ export const _eSIMWalletFactory = async (client) => {
177
177
  };
178
178
  /** The EntryPoint the registry recognises. One per chain. */
179
179
  export const _entryPoint = async (client) => {
180
- const chainID = await client.getChainId();
180
+ const chainID = await _chainId(client);
181
181
  const rpcURL = client.transport.url;
182
182
  const values = _getChainSpecificConstants(chainID, rpcURL);
183
183
  return client.extend(publicActions).readContract({
@@ -193,7 +193,7 @@ export const _entryPoint = async (client) => {
193
193
  * failure to carry the protocol's own revert reason.
194
194
  */
195
195
  export const _requireNotPaused = async (client) => {
196
- const chainID = await client.getChainId();
196
+ const chainID = await _chainId(client);
197
197
  const rpcURL = client.transport.url;
198
198
  const values = _getChainSpecificConstants(chainID, rpcURL);
199
199
  await client.extend(publicActions).readContract({
@@ -205,7 +205,7 @@ export const _requireNotPaused = async (client) => {
205
205
  };
206
206
  /** The `LazyWalletRegistry` address wired into the registry. */
207
207
  export const _lazyWalletRegistry = async (client) => {
208
- const chainID = await client.getChainId();
208
+ const chainID = await _chainId(client);
209
209
  const rpcURL = client.transport.url;
210
210
  const values = _getChainSpecificConstants(chainID, rpcURL);
211
211
  return client.extend(publicActions).readContract({
@@ -217,7 +217,7 @@ export const _lazyWalletRegistry = async (client) => {
217
217
  };
218
218
  /** The device wallet registered for a device unique identifier (zero if none). */
219
219
  export const _uniqueIdentifierToDeviceWallet = async (client, deviceIdentifier) => {
220
- const chainID = await client.getChainId();
220
+ const chainID = await _chainId(client);
221
221
  const rpcURL = client.transport.url;
222
222
  const values = _getChainSpecificConstants(chainID, rpcURL);
223
223
  return client.extend(publicActions).readContract({
@@ -232,7 +232,7 @@ export const _uniqueIdentifierToDeviceWallet = async (client, deviceIdentifier)
232
232
  * `bytes32[2]` array takes the element index (`0` or `1`) and returns one key.
233
233
  */
234
234
  export const _deviceWalletToOwner = async (client, deviceWallet, index) => {
235
- const chainID = await client.getChainId();
235
+ const chainID = await _chainId(client);
236
236
  const rpcURL = client.transport.url;
237
237
  const values = _getChainSpecificConstants(chainID, rpcURL);
238
238
  return client.extend(publicActions).readContract({
@@ -244,7 +244,7 @@ export const _deviceWalletToOwner = async (client, deviceWallet, index) => {
244
244
  };
245
245
  /** The device wallet registered for a hash of owner P-256 keys (zero if none). */
246
246
  export const _registeredP256Keys = async (client, hashOfOwnerP256Keys) => {
247
- const chainID = await client.getChainId();
247
+ const chainID = await _chainId(client);
248
248
  const rpcURL = client.transport.url;
249
249
  const values = _getChainSpecificConstants(chainID, rpcURL);
250
250
  return client.extend(publicActions).readContract({
@@ -256,7 +256,7 @@ export const _registeredP256Keys = async (client, hashOfOwnerP256Keys) => {
256
256
  };
257
257
  /** Whether a device wallet is registered/valid. */
258
258
  export const _isDeviceWalletValid = async (client, deviceWallet) => {
259
- const chainID = await client.getChainId();
259
+ const chainID = await _chainId(client);
260
260
  const rpcURL = client.transport.url;
261
261
  const values = _getChainSpecificConstants(chainID, rpcURL);
262
262
  return client.extend(publicActions).readContract({
@@ -276,7 +276,7 @@ export const _isDeviceWalletValid = async (client, deviceWallet) => {
276
276
  * `DeviceWallet.isValidESIMWallet` on the device wallet.
277
277
  */
278
278
  export const _isESIMWalletValid = async (client, eSIMWallet) => {
279
- const chainID = await client.getChainId();
279
+ const chainID = await _chainId(client);
280
280
  const rpcURL = client.transport.url;
281
281
  const values = _getChainSpecificConstants(chainID, rpcURL);
282
282
  return client.extend(publicActions).readContract({
@@ -296,7 +296,7 @@ export const _isESIMWalletValid = async (client, eSIMWallet) => {
296
296
  * this to decide whether an eSIM wallet belongs to the protocol.
297
297
  */
298
298
  export const _isESIMWalletOnStandby = async (client, eSIMWallet) => {
299
- const chainID = await client.getChainId();
299
+ const chainID = await _chainId(client);
300
300
  const rpcURL = client.transport.url;
301
301
  const values = _getChainSpecificConstants(chainID, rpcURL);
302
302
  return client.extend(publicActions).readContract({
@@ -312,7 +312,7 @@ export const _isESIMWalletOnStandby = async (client, eSIMWallet) => {
312
312
  * as soon as history is recorded and well before anything is deployed.
313
313
  */
314
314
  export const _isDeviceIdentifierAlreadyUsed = async (client, deviceUniqueIdentifier) => {
315
- const chainID = await client.getChainId();
315
+ const chainID = await _chainId(client);
316
316
  const rpcURL = client.transport.url;
317
317
  const values = _getChainSpecificConstants(chainID, rpcURL);
318
318
  return client.extend(publicActions).readContract({
@@ -324,7 +324,7 @@ export const _isDeviceIdentifierAlreadyUsed = async (client, deviceUniqueIdentif
324
324
  };
325
325
  /** Whether an eSIM identifier is already held by a wallet. */
326
326
  export const _isESIMIdentifierClaimed = async (client, eSIMUniqueIdentifier) => {
327
- const chainID = await client.getChainId();
327
+ const chainID = await _chainId(client);
328
328
  const rpcURL = client.transport.url;
329
329
  const values = _getChainSpecificConstants(chainID, rpcURL);
330
330
  return client.extend(publicActions).readContract({
@@ -340,7 +340,7 @@ export const _isESIMIdentifierClaimed = async (client, eSIMUniqueIdentifier) =>
340
340
  * belongs to the wallet rather than to whichever device is holding it.
341
341
  */
342
342
  export const _eSIMWalletForIdentifier = async (client, eSIMUniqueIdentifier) => {
343
- const chainID = await client.getChainId();
343
+ const chainID = await _chainId(client);
344
344
  const rpcURL = client.transport.url;
345
345
  const values = _getChainSpecificConstants(chainID, rpcURL);
346
346
  return client.extend(publicActions).readContract({
@@ -356,7 +356,7 @@ export const _eSIMWalletForIdentifier = async (client, eSIMUniqueIdentifier) =>
356
356
  * string version and skip the hashing.
357
357
  */
358
358
  export const _claimedESIMIdentifiers = async (client, hashOfESIMIdentifier) => {
359
- const chainID = await client.getChainId();
359
+ const chainID = await _chainId(client);
360
360
  const rpcURL = client.transport.url;
361
361
  const values = _getChainSpecificConstants(chainID, rpcURL);
362
362
  return client.extend(publicActions).readContract({
@@ -376,7 +376,7 @@ export const _claimedESIMIdentifiers = async (client, hashOfESIMIdentifier) => {
376
376
  * all then refuse it.
377
377
  */
378
378
  export const _requireDeviceIdentifierNotReserved = async (client, deviceUniqueIdentifier) => {
379
- const chainID = await client.getChainId();
379
+ const chainID = await _chainId(client);
380
380
  const rpcURL = client.transport.url;
381
381
  const values = _getChainSpecificConstants(chainID, rpcURL);
382
382
  await client.extend(publicActions).readContract({
@@ -392,7 +392,7 @@ export const _requireDeviceIdentifierNotReserved = async (client, deviceUniqueId
392
392
  * is what stops a non-UUPS address being installed.
393
393
  */
394
394
  export const _proxiableUUID = async (client) => {
395
- const chainID = await client.getChainId();
395
+ const chainID = await _chainId(client);
396
396
  const rpcURL = client.transport.url;
397
397
  const values = _getChainSpecificConstants(chainID, rpcURL);
398
398
  return client.extend(publicActions).readContract({
@@ -404,7 +404,7 @@ export const _proxiableUUID = async (client) => {
404
404
  };
405
405
  /** The OpenZeppelin upgrade interface this proxy speaks, currently `"5.0.0"`. */
406
406
  export const _upgradeInterfaceVersion = async (client) => {
407
- const chainID = await client.getChainId();
407
+ const chainID = await _chainId(client);
408
408
  const rpcURL = client.transport.url;
409
409
  const values = _getChainSpecificConstants(chainID, rpcURL);
410
410
  return client.extend(publicActions).readContract({
@@ -416,7 +416,7 @@ export const _upgradeInterfaceVersion = async (client) => {
416
416
  };
417
417
  /** The payment adapter this registry currently points at. */
418
418
  export const _paymentAdapter = async (client) => {
419
- const chainID = await client.getChainId();
419
+ const chainID = await _chainId(client);
420
420
  const rpcURL = client.transport.url;
421
421
  const values = _getChainSpecificConstants(chainID, rpcURL);
422
422
  return client.extend(publicActions).readContract({
@@ -432,7 +432,7 @@ export const _paymentAdapter = async (client) => {
432
432
  * the contract keys `usedPaymentReferences` by, not the bare reference.
433
433
  */
434
434
  export const _usedPaymentReferences = async (client, scopedReference) => {
435
- const chainID = await client.getChainId();
435
+ const chainID = await _chainId(client);
436
436
  const rpcURL = client.transport.url;
437
437
  const values = _getChainSpecificConstants(chainID, rpcURL);
438
438
  return client.extend(publicActions).readContract({