kokio-sdk 0.0.1 → 0.0.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokio-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/config.js",
@@ -10,6 +10,10 @@
10
10
  "import": "./dist/esm/config.js",
11
11
  "default": "./dist/esm/config.js"
12
12
  },
13
+ "./types": {
14
+ "types": "./dist/types/types-export.d.ts",
15
+ "import": "./dist/esm/types.js"
16
+ },
13
17
  "./package.json": "./package.json"
14
18
  },
15
19
  "scripts": {
package/src/abis/index.ts CHANGED
@@ -1,12 +1,12 @@
1
- import DeviceWallet from './DeviceWallet.json' assert { type: 'json' };
2
- import DeviceWalletFactory from './DeviceWalletFactory.json' assert { type: 'json' };
3
- import ESIMWallet from './ESIMWallet.json' assert { type: 'json' };
4
- import ESIMWalletFactory from './ESIMWalletFactory.json' assert { type: 'json' };
5
- import LazyWalletRegistry from './LazyWalletRegistry.json' assert { type: 'json' };
6
- import P256Verifier from './P256Verifier.json' assert { type: 'json' };
7
- import Registry from './Registry.json' assert { type: 'json' };
8
- import RegistryHelper from './RegistryHelper.json' assert { type: 'json' };
9
- import BeaconProxy from './BeaconProxy.json' assert { type: 'json' }
1
+ import DeviceWallet from './DeviceWallet.json' with { type: 'json' };
2
+ import DeviceWalletFactory from './DeviceWalletFactory.json' with { type: 'json' };
3
+ import ESIMWallet from './ESIMWallet.json' with { type: 'json' };
4
+ import ESIMWalletFactory from './ESIMWalletFactory.json' with { type: 'json' };
5
+ import LazyWalletRegistry from './LazyWalletRegistry.json' with { type: 'json' };
6
+ import P256Verifier from './P256Verifier.json' with { type: 'json' };
7
+ import Registry from './Registry.json' with { type: 'json' };
8
+ import RegistryHelper from './RegistryHelper.json' with { type: 'json' };
9
+ import BeaconProxy from './BeaconProxy.json' with { type: 'json' }
10
10
 
11
11
  export {
12
12
  DeviceWallet,
package/src/config.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { Address, WalletClient } from "viem";
2
2
  import { ConstantsSubPackage } from "./interface/constantsClass.js";
3
- import { smartAccountSubPackage } from "./interface/smartAccountClass.js";
4
- import { deviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
3
+ import { SmartAccountSubPackage } from "./interface/smartAccountClass.js";
4
+ import { DeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
5
5
  import { P256VerifierSubPackage } from "./interface/P256VerifierClass.js";
6
- import { lazyWalletRegistrySubPackage } from "./interface/lazyWalletRegistryClass.js";
7
- import { deviceWalletSubPackage } from "./interface/deviceWalletClass.js";
8
- import { eSIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
9
- import { eSIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
6
+ import { LazyWalletRegistrySubPackage } from "./interface/lazyWalletRegistryClass.js";
7
+ import { DeviceWalletSubPackage } from "./interface/deviceWalletClass.js";
8
+ import { ESIMWalletSubPackage } from "./interface/eSIMWalletClass.js";
9
+ import { ESIMWalletFactorySubPackage } from "./interface/eSIMWalletFactoryClass.js";
10
10
  import { SmartAccountClient } from "@aa-sdk/core";
11
11
  import { TurnkeyClient } from "@turnkey/http";
12
12
 
@@ -14,13 +14,15 @@ export class Kokio {
14
14
  viemWalletClient: WalletClient;
15
15
  turnkeyClient: TurnkeyClient;
16
16
  organizationId: string;
17
+
17
18
  constants: ConstantsSubPackage;
18
- smartAccount: smartAccountSubPackage;
19
- deviceWalletFactory?: deviceWalletFactorySubPackage;
20
- eSIMWalletFactory?: eSIMWalletFactorySubPackage;
21
- lazyWalletRegistry?: lazyWalletRegistrySubPackage;
22
- deviceWallet?: deviceWalletSubPackage;
23
- eSIMWallet?: eSIMWalletSubPackage;
19
+
20
+ smartAccount: SmartAccountSubPackage;
21
+ deviceWalletFactory?: DeviceWalletFactorySubPackage;
22
+ eSIMWalletFactory?: ESIMWalletFactorySubPackage;
23
+ lazyWalletRegistry?: LazyWalletRegistrySubPackage;
24
+ deviceWallet?: DeviceWalletSubPackage;
25
+ eSIMWallet?: ESIMWalletSubPackage;
24
26
  P256Verifier?: P256VerifierSubPackage;
25
27
 
26
28
  constructor(
@@ -34,13 +36,15 @@ export class Kokio {
34
36
  this.viemWalletClient = viemWalletClient;
35
37
  this.turnkeyClient = turnkeyClient;
36
38
  this.organizationId = organizationId;
39
+
37
40
  this.constants = new ConstantsSubPackage(this.viemWalletClient);
38
- this.smartAccount = new smartAccountSubPackage(this.viemWalletClient, this.turnkeyClient, this.organizationId);
39
- this.deviceWalletFactory = smartAccountClient? new deviceWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
40
- this.eSIMWalletFactory = smartAccountClient? new eSIMWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
41
- this.lazyWalletRegistry = smartAccountClient? new lazyWalletRegistrySubPackage(smartAccountClient): undefined;
41
+
42
+ this.smartAccount = new SmartAccountSubPackage(this.viemWalletClient, this.turnkeyClient, this.organizationId);
43
+ this.deviceWalletFactory = smartAccountClient? new DeviceWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
44
+ this.eSIMWalletFactory = smartAccountClient? new ESIMWalletFactorySubPackage(viemWalletClient, smartAccountClient): undefined;
45
+ this.lazyWalletRegistry = smartAccountClient? new LazyWalletRegistrySubPackage(smartAccountClient): undefined;
42
46
  this.P256Verifier = smartAccountClient? new P256VerifierSubPackage(smartAccountClient): undefined;
43
- this.deviceWallet = deviceWalletAddress && smartAccountClient? new deviceWalletSubPackage(viemWalletClient, smartAccountClient, deviceWalletAddress): undefined;
44
- this.eSIMWallet = eSIMWalletAddress && smartAccountClient? new eSIMWalletSubPackage(smartAccountClient, eSIMWalletAddress): undefined;
47
+ this.deviceWallet = deviceWalletAddress && smartAccountClient? new DeviceWalletSubPackage(viemWalletClient, smartAccountClient, deviceWalletAddress): undefined;
48
+ this.eSIMWallet = eSIMWalletAddress && smartAccountClient? new ESIMWalletSubPackage(smartAccountClient, eSIMWalletAddress): undefined;
45
49
  }
46
50
  }
@@ -24,7 +24,8 @@ export class ConstantsSubPackage {
24
24
  constructor(client: WalletClient) {
25
25
  (async () => {
26
26
  const chainID = await _extractChainID(client);
27
- const values = _getChainSpecificConstants(chainID);
27
+ const rpcURL = client.transport.url;
28
+ const values = _getChainSpecificConstants(chainID, rpcURL);
28
29
 
29
30
  this.factoryAddresses = values?.factoryAddresses;
30
31
  this.customErrors = values?.customErrors;
@@ -12,7 +12,7 @@ import {
12
12
  } from "../logic/deviceWallet.js"
13
13
  import { SmartAccountClient } from "@aa-sdk/core";
14
14
 
15
- export class deviceWalletSubPackage {
15
+ export class DeviceWalletSubPackage {
16
16
 
17
17
  smartAccountClient;
18
18
  walletClient;
@@ -6,7 +6,7 @@ import {
6
6
  } from "../logic/deviceWalletFactory.js"
7
7
  import { SmartAccountClient } from "@aa-sdk/core";
8
8
 
9
- export class deviceWalletFactorySubPackage {
9
+ export class DeviceWalletFactorySubPackage {
10
10
 
11
11
  smartAccountClient;
12
12
  walletClient;
@@ -12,7 +12,7 @@ import {
12
12
  import { DataBundleDetails } from "../types";
13
13
  import { SmartAccountClient } from "@aa-sdk/core";
14
14
 
15
- export class eSIMWalletSubPackage {
15
+ export class ESIMWalletSubPackage {
16
16
 
17
17
  client;
18
18
  address;
@@ -7,7 +7,7 @@ import {
7
7
  } from "../logic/eSIMWalletFactory.js"
8
8
  import { SmartAccountClient } from "@aa-sdk/core";
9
9
 
10
- export class eSIMWalletFactorySubPackage {
10
+ export class ESIMWalletFactorySubPackage {
11
11
 
12
12
  smartAccountClient;
13
13
  walletClient;
@@ -8,7 +8,7 @@ import {
8
8
  import { DataBundleDetails } from "../types";
9
9
  import { SmartAccountClient } from "@aa-sdk/core";
10
10
 
11
- export class lazyWalletRegistrySubPackage {
11
+ export class LazyWalletRegistrySubPackage {
12
12
 
13
13
  client;
14
14
 
@@ -4,7 +4,7 @@ import { P256Key, SignedRequest } from "../types";
4
4
  import { SmartAccountClient, SmartContractAccount } from "@aa-sdk/core";
5
5
  import { TurnkeyClient } from "@turnkey/http";
6
6
 
7
- export class smartAccountSubPackage {
7
+ export class SmartAccountSubPackage {
8
8
 
9
9
  client;
10
10
  turnkeyClient;
@@ -13,7 +13,9 @@ export const _verifySignature = async (
13
13
  y: bigint
14
14
  ) => {
15
15
 
16
- const values = _getChainSpecificConstants(await client.getChainId());
16
+ const chainID = await client.getChainId();
17
+ const rpcURL = client.transport.url;
18
+ const values = _getChainSpecificConstants(chainID, rpcURL);
17
19
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
18
20
 
19
21
  // UserOp
@@ -61,25 +61,27 @@ const _encodeBatchExecute = async (txs: AccountOp[]) => {
61
61
 
62
62
  const _getAccountInitCode = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: bigint): Promise<Hex> => {
63
63
 
64
- // To send with user operations
65
- const chainID = await client.getChainId();
66
- const values = _getChainSpecificConstants(chainID);
64
+ // To send with user operations
65
+ const chainID = await client.getChainId();
66
+ const rpcURL = client.transport.url;
67
+ const values = _getChainSpecificConstants(chainID, rpcURL);
67
68
 
68
- const callData = encodeFunctionData({
69
- abi: DeviceWalletFactory,
70
- functionName: "createAccount",
71
- args: [deviceUniqueIdentifier, deviceWalletOwnerKey, salt, ZERO],
72
- })
69
+ const callData = encodeFunctionData({
70
+ abi: DeviceWalletFactory,
71
+ functionName: "createAccount",
72
+ args: [deviceUniqueIdentifier, deviceWalletOwnerKey, salt, ZERO],
73
+ })
73
74
 
74
- return values.factoryAddresses.DEVICE_WALLET_FACTORY.concat(_remove0x(callData)) as Hex;
75
+ return values.factoryAddresses.DEVICE_WALLET_FACTORY.concat(_remove0x(callData)) as Hex;
75
76
  }
76
77
 
77
78
  const getInitCodeHash = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key): Promise<BytesLike> => {
78
79
 
79
80
  const chainID = await client.getChainId();
80
- const values = _getChainSpecificConstants(chainID);
81
+ const rpcURL = client.transport.url;
82
+ const values = _getChainSpecificConstants(chainID, rpcURL);
81
83
 
82
- // off-chain computation of the DeviceWallet address
84
+ // off-chain computation of the DeviceWallet address
83
85
  const registry = values.factoryAddresses.REGISTRY;
84
86
  const deviceWalletFactoryAddress = values.factoryAddresses.DEVICE_WALLET_FACTORY;
85
87
 
@@ -133,7 +135,8 @@ const prepareSaltForCreate2 = (sender: Address, salt: BigInt): BytesLike => {
133
135
  const getCounterFactualAddress = async (client: WalletClient, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: BigInt, sender?: Address):Promise<Hex> => {
134
136
 
135
137
  const chainID = await client.getChainId();
136
- const values = _getChainSpecificConstants(chainID);
138
+ const rpcURL = client.transport.url;
139
+ const values = _getChainSpecificConstants(chainID, rpcURL);
137
140
  const deviceWalletFactoryAddress = values.factoryAddresses.DEVICE_WALLET_FACTORY;
138
141
 
139
142
  sender = sender? sender : values.factoryAddresses.SENDER_CREATOR;
@@ -227,7 +230,8 @@ const _signUserOperationHash = async (hash: Hex, turnkeyClient: TurnkeyClient, o
227
230
  export const _getSmartWallet = async (client: WalletClient, turnkeyClient: TurnkeyClient, organiationId: string, deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: bigint, sender?: Address): Promise<SmartContractAccount> => {
228
231
 
229
232
  const chainID = await client.getChainId();
230
- const values = _getChainSpecificConstants(chainID);
233
+ const rpcURL = client.transport.url;
234
+ const values = _getChainSpecificConstants(chainID, rpcURL);
231
235
 
232
236
  if (!client.account) throw new Error ('Error: No signer account found with WalletClient')
233
237
  const signWith = client.account.address;
@@ -271,7 +275,8 @@ export const _getSmartWallet = async (client: WalletClient, turnkeyClient: Turnk
271
275
  export const _getSmartWalletClient = async (client: WalletClient, account: SmartContractAccount) => {
272
276
 
273
277
  const chainID = await client.getChainId();
274
- const values = _getChainSpecificConstants(chainID);
278
+ const rpcURL = client.transport.url;
279
+ const values = _getChainSpecificConstants(chainID, rpcURL);
275
280
 
276
281
  return createSmartAccountClient({
277
282
  // created above
@@ -1,8 +1,4 @@
1
- import * as dotenv from 'dotenv';
2
- dotenv.config();
3
-
4
- import { WalletClient } from "viem";
5
-
1
+ import { WalletClient, Address } from 'viem';
6
2
  import {
7
3
  mainnet,
8
4
  sepolia,
@@ -14,8 +10,6 @@ import {
14
10
 
15
11
  export const ZERO = BigInt('0');
16
12
 
17
- export const API_KEY = process.env.API_KEY;
18
-
19
13
  export enum CHAIN_ID {
20
14
  MAINNET = 1,
21
15
  SEPOLIA = 11155111,
@@ -25,15 +19,6 @@ export enum CHAIN_ID {
25
19
  ARBITRUM_SEPOLIA = 421614,
26
20
  }
27
21
 
28
- export const rpcURLs: Record<string, string> = {
29
- mainnet: `https://eth-mainnet.g.alchemy.com/v2/${API_KEY}`,
30
- sepolia: `https://eth-sepolia.g.alchemy.com/v2/${API_KEY}`,
31
- optimismMainnet : `https://opt-mainnet.g.alchemy.com/v2/${API_KEY}`,
32
- optimismSepolia: `https://opt-sepolia.g.alchemy.com/v2/${API_KEY}`,
33
- arbitrum: `https://arb-mainnet.g.alchemy.com/v2/${API_KEY}`,
34
- arbitrumSepolia: `https://arb-sepolia.g.alchemy.com/v2/${API_KEY}`,
35
- }
36
-
37
22
  export interface chainSpecifcConstants {
38
23
  factoryAddresses:
39
24
  typeof sepoliaFactoryAddresses |
@@ -53,7 +38,7 @@ export interface chainSpecifcConstants {
53
38
  customErrors: typeof customErrors;
54
39
  }
55
40
 
56
- export const sepoliaFactoryAddresses: Record<string, `0x${string}`> = {
41
+ export const sepoliaFactoryAddresses: Record<string, Address> = {
57
42
  DEVICE_WALLET_FACTORY: '0x63005d8214533fC7209678Aa39F7b9b0b51a7bcB',
58
43
  ESIM_WALLET_FACTORY: '0xB4473979ff8cE4e09161B08f74EEb66BD7718076',
59
44
  LAZY_WALLET_REGISTRY: '0x8a1E53b903efcc6b252CE4bD3b255202318505Ef',
@@ -63,7 +48,7 @@ export const sepoliaFactoryAddresses: Record<string, `0x${string}`> = {
63
48
  P256VERIFIER: '0xF04f3b3935aD461D17d4a8a78E7ea21d4a61AEb1'
64
49
  }
65
50
 
66
- export const mainnetFactoryAddresses: Record<string, `0x${string}`> = {
51
+ export const mainnetFactoryAddresses: Record<string, Address> = {
67
52
  DEVICE_WALLET_FACTORY: '0x',
68
53
  ESIM_WALLET_FACTORY: '0x',
69
54
  LAZY_WALLET_REGISTRY: '0x',
@@ -73,7 +58,7 @@ export const mainnetFactoryAddresses: Record<string, `0x${string}`> = {
73
58
  P256VERIFIER: '0x'
74
59
  }
75
60
 
76
- export const optimismMainnetFactoryAddresses: Record<string, `0x${string}`> = {
61
+ export const optimismMainnetFactoryAddresses: Record<string, Address> = {
77
62
  DEVICE_WALLET_FACTORY: '0x',
78
63
  ESIM_WALLET_FACTORY: '0x',
79
64
  LAZY_WALLET_REGISTRY: '0x',
@@ -83,7 +68,7 @@ export const optimismMainnetFactoryAddresses: Record<string, `0x${string}`> = {
83
68
  P256VERIFIER: '0x'
84
69
  }
85
70
 
86
- export const optimismSepoliaFactoryAddresses: Record<string, `0x${string}`> = {
71
+ export const optimismSepoliaFactoryAddresses: Record<string, Address> = {
87
72
  DEVICE_WALLET_FACTORY: '0x3feA4dB0C0bBB73142d5bB6b776EE238884a3705',
88
73
  ESIM_WALLET_FACTORY: '0xaD2Ba6248D0e6990a844C94ACE78F8775A68b631',
89
74
  LAZY_WALLET_REGISTRY: '0x29b98C32D83604664fd0742b9112b0825a74849F',
@@ -93,7 +78,7 @@ export const optimismSepoliaFactoryAddresses: Record<string, `0x${string}`> = {
93
78
  P256VERIFIER: '0x5349aEA97Faa6D5d6D78A8847068300a4eC9D39E'
94
79
  }
95
80
 
96
- export const arbitrumOneFactoryAddresses: Record<string, `0x${string}`> = {
81
+ export const arbitrumOneFactoryAddresses: Record<string, Address> = {
97
82
  DEVICE_WALLET_FACTORY: '0x',
98
83
  ESIM_WALLET_FACTORY: '0x',
99
84
  LAZY_WALLET_REGISTRY: '0x',
@@ -103,7 +88,7 @@ export const arbitrumOneFactoryAddresses: Record<string, `0x${string}`> = {
103
88
  P256VERIFIER: '0x'
104
89
  }
105
90
 
106
- export const arbitrumSepoliaFactoryAddresses: Record<string, `0x${string}`> = {
91
+ export const arbitrumSepoliaFactoryAddresses: Record<string, Address> = {
107
92
  DEVICE_WALLET_FACTORY: '0x',
108
93
  ESIM_WALLET_FACTORY: '0x',
109
94
  LAZY_WALLET_REGISTRY: '0x',
@@ -134,14 +119,15 @@ export const _getChainSpecificConstants = (
134
119
  CHAIN_ID.OPTIMISM_MAINNET |
135
120
  CHAIN_ID.OPTIMISM_SEPOLIA |
136
121
  CHAIN_ID.ARBITRUM_ONE |
137
- CHAIN_ID.ARBITRUM_SEPOLIA
122
+ CHAIN_ID.ARBITRUM_SEPOLIA,
123
+ rpcURL: string
138
124
  ): chainSpecifcConstants => {
139
125
 
140
126
  if (chainID == CHAIN_ID.SEPOLIA) {
141
127
  return {
142
128
  factoryAddresses: sepoliaFactoryAddresses,
143
129
  chain: sepolia,
144
- rpcURL: rpcURLs.sepolia,
130
+ rpcURL: rpcURL,
145
131
  customErrors: customErrors
146
132
  }
147
133
  }
@@ -149,7 +135,7 @@ export const _getChainSpecificConstants = (
149
135
  return {
150
136
  factoryAddresses: mainnetFactoryAddresses,
151
137
  chain: mainnet,
152
- rpcURL: rpcURLs.mainnet,
138
+ rpcURL: rpcURL,
153
139
  customErrors: customErrors
154
140
  }
155
141
  }
@@ -157,7 +143,7 @@ export const _getChainSpecificConstants = (
157
143
  return {
158
144
  factoryAddresses: optimismMainnetFactoryAddresses,
159
145
  chain: optimism,
160
- rpcURL: rpcURLs.optimismMainnet,
146
+ rpcURL: rpcURL,
161
147
  customErrors: customErrors
162
148
  }
163
149
  }
@@ -165,7 +151,7 @@ export const _getChainSpecificConstants = (
165
151
  return {
166
152
  factoryAddresses: optimismSepoliaFactoryAddresses,
167
153
  chain: optimismSepolia,
168
- rpcURL: rpcURLs.optimismSepolia,
154
+ rpcURL: rpcURL,
169
155
  customErrors: customErrors
170
156
  }
171
157
  }
@@ -173,7 +159,7 @@ export const _getChainSpecificConstants = (
173
159
  return {
174
160
  factoryAddresses: arbitrumOneFactoryAddresses,
175
161
  chain: arbitrum,
176
- rpcURL: rpcURLs.arbitrum,
162
+ rpcURL: rpcURL,
177
163
  customErrors: customErrors
178
164
  }
179
165
  }
@@ -181,7 +167,7 @@ export const _getChainSpecificConstants = (
181
167
  return {
182
168
  factoryAddresses: arbitrumSepoliaFactoryAddresses,
183
169
  chain: arbitrumSepolia,
184
- rpcURL: rpcURLs.arbitrumSepolia,
170
+ rpcURL: rpcURL,
185
171
  customErrors: customErrors
186
172
  }
187
173
  }
@@ -1,7 +1,7 @@
1
1
  import { Address, createPublicClient, encodeFunctionData, getContract, PublicClient, WalletClient } from "viem";
2
2
  import { SmartAccountClient } from "@aa-sdk/core";
3
3
  import { DeviceWallet } from "../abis/index.js";
4
- import { _getChainSpecificConstants, customErrors } from "./constants.js";
4
+ import { customErrors } from "./constants.js";
5
5
  import { P256Key } from "../types.js";
6
6
 
7
7
  export const _deployESIMWallet = async (client: SmartAccountClient, address: Address, hasAccessToETH: boolean, salt: bigint) => {
@@ -158,9 +158,6 @@ export const _removeESIMWallet = async (client: SmartAccountClient, address: Add
158
158
 
159
159
  export const _getOwner = async (client: WalletClient, address: Address) => {
160
160
 
161
- const chainID = await client.getChainId();
162
- const values = _getChainSpecificConstants(chainID);
163
-
164
161
  const contract = getContract({
165
162
  abi: DeviceWallet,
166
163
  address: address,
@@ -12,7 +12,8 @@ export const _createAccountWithEOA = async (
12
12
  ) => {
13
13
 
14
14
  const chainID = await client.getChainId();
15
- const values = _getChainSpecificConstants(chainID);
15
+ const rpcURL = client.transport.url;
16
+ const values = _getChainSpecificConstants(chainID, rpcURL);
16
17
 
17
18
  if (!client.account) throw new Error(customErrors.MISSING_EOA_WALLET);
18
19
 
@@ -33,7 +34,10 @@ export const _getAddress = async (
33
34
  salt: bigint,
34
35
  ) => {
35
36
 
36
- const values = _getChainSpecificConstants(await client.getChainId());
37
+ const chainID = await client.getChainId();
38
+ const rpcURL = client.transport.url;
39
+ const values = _getChainSpecificConstants(chainID, rpcURL);
40
+
37
41
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
38
42
 
39
43
  // UserOp
@@ -52,7 +56,10 @@ export const _getAddress = async (
52
56
 
53
57
  export const _getCurrentDeviceWalletImplementation = async (client: SmartAccountClient) => {
54
58
 
55
- const values = _getChainSpecificConstants(await client.getChainId());
59
+ const chainID = await client.getChainId();
60
+ const rpcURL = client.transport.url;
61
+ const values = _getChainSpecificConstants(chainID, rpcURL);
62
+
56
63
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
57
64
 
58
65
  // UserOp
@@ -5,7 +5,10 @@ import { ESIMWalletFactory } from "../abis/index.js";
5
5
 
6
6
  export const _addRegistryAddress = async (client: SmartAccountClient, registryContractAddress: Address) => {
7
7
 
8
- const values = _getChainSpecificConstants(await client.getChainId());
8
+ const chainID = await client.getChainId();
9
+ const rpcURL = client.transport.url;
10
+ const values = _getChainSpecificConstants(chainID, rpcURL);
11
+
9
12
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
10
13
 
11
14
  // UserOp
@@ -25,7 +28,8 @@ export const _addRegistryAddress = async (client: SmartAccountClient, registryCo
25
28
  export const _deployESIMWalletWithEOA = async (client: WalletClient, deviceWalletAddress: Address, salt: bigint) => {
26
29
 
27
30
  const chainID = await client.getChainId();
28
- const values = _getChainSpecificConstants(chainID);
31
+ const rpcURL = client.transport.url;
32
+ const values = _getChainSpecificConstants(chainID, rpcURL);
29
33
 
30
34
  if (!client.account) throw new Error(customErrors.MISSING_EOA_WALLET);
31
35
 
@@ -41,7 +45,10 @@ export const _deployESIMWalletWithEOA = async (client: WalletClient, deviceWalle
41
45
 
42
46
  export const _deployESIMWalletWithUserOp = async (client: SmartAccountClient, deviceWalletAddress: Address, salt: bigint) => {
43
47
 
44
- const values = _getChainSpecificConstants(await client.getChainId());
48
+ const chainID = await client.getChainId();
49
+ const rpcURL = client.transport.url;
50
+ const values = _getChainSpecificConstants(chainID, rpcURL);
51
+
45
52
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
46
53
 
47
54
  // UserOp
@@ -60,7 +67,10 @@ export const _deployESIMWalletWithUserOp = async (client: SmartAccountClient, de
60
67
 
61
68
  export const _getCurrentESIMWalletImplementation = async (client: SmartAccountClient) => {
62
69
 
63
- const values = _getChainSpecificConstants(await client.getChainId());
70
+ const chainID = await client.getChainId();
71
+ const rpcURL = client.transport.url;
72
+ const values = _getChainSpecificConstants(chainID, rpcURL);
73
+
64
74
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
65
75
 
66
76
  // UserOp
@@ -7,7 +7,10 @@ import { LazyWalletRegistry } from "../abis/index.js";
7
7
 
8
8
  export const _isLazyWalletDeployed = async (client: SmartAccountClient, deviceUniqueIdentifier: string) => {
9
9
 
10
- const values = _getChainSpecificConstants(await client.getChainId());
10
+ const chainID = await client.getChainId();
11
+ const rpcURL = client.transport.url;
12
+ const values = _getChainSpecificConstants(chainID, rpcURL);
13
+
11
14
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
12
15
 
13
16
  // UserOp
@@ -31,7 +34,10 @@ export const _batchPopulateHistory = async (
31
34
  dataBundleDetails: Array<Array<DataBundleDetails>>
32
35
  ) => {
33
36
 
34
- const values = _getChainSpecificConstants(await client.getChainId());
37
+ const chainID = await client.getChainId();
38
+ const rpcURL = client.transport.url;
39
+ const values = _getChainSpecificConstants(chainID, rpcURL);
40
+
35
41
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
36
42
 
37
43
  // UserOp
@@ -56,7 +62,10 @@ export const _deployLazyWalletAndSetESIMIdentifier = async (
56
62
  depositAmount: bigint
57
63
  ) => {
58
64
 
59
- const values = _getChainSpecificConstants(await client.getChainId());
65
+ const chainID = await client.getChainId();
66
+ const rpcURL = client.transport.url;
67
+ const values = _getChainSpecificConstants(chainID, rpcURL);
68
+
60
69
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
61
70
 
62
71
  // UserOp
@@ -80,7 +89,10 @@ export const _switchESIMIdentifierToNewDeviceIdentifier = async (
80
89
  newDeviceIdentifier: string
81
90
  ) => {
82
91
 
83
- const values = _getChainSpecificConstants(await client.getChainId());
92
+ const chainID = await client.getChainId();
93
+ const rpcURL = client.transport.url;
94
+ const values = _getChainSpecificConstants(chainID, rpcURL);
95
+
84
96
  if(!client.account) throw new Error(customErrors.MISSING_SMART_WALLET)
85
97
 
86
98
  // UserOp
@@ -1,5 +1,5 @@
1
1
  import { Hex, isHex } from "viem";
2
- import { _getChainSpecificConstants, customErrors } from "./constants.js"
2
+ import { customErrors } from "./constants.js"
3
3
 
4
4
  export const _add0x = (data: Hex | string): Hex => {
5
5
  if(!data) {
@@ -0,0 +1,7 @@
1
+ export type {
2
+ P256Key,
3
+ WebAuthnSignature,
4
+ P256Credential,
5
+ DataBundleDetails,
6
+ SignedRequest
7
+ } from './types';
package/.env.example DELETED
@@ -1 +0,0 @@
1
- API_KEY=<YOUR_ALCHEMY_API_KEY>