kokio-sdk 0.0.6 → 0.0.8

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Kokio SDK
2
+
3
+ This is an internal SDK that allows Koki'o mobile app to interact with the Smart contracts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokio-sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/config.js",
@@ -4,7 +4,8 @@ import {
4
4
  getEntryPoint,
5
5
  SmartContractAccount,
6
6
  toSmartContractAccount,
7
- split
7
+ split,
8
+ SmartAccountClient
8
9
  } from "@aa-sdk/core";
9
10
  import {
10
11
  http,
@@ -266,7 +267,7 @@ export const _getSmartWallet = async (
266
267
  });
267
268
  }
268
269
 
269
- export const _getSmartWalletClient = async (client: WalletClient, pimlicoAPIKey: string, gasPolicyId: string, account: SmartContractAccount) => {
270
+ export const _getSmartWalletClient = async (client: WalletClient, pimlicoAPIKey: string, gasPolicyId: string, account: SmartContractAccount): Promise<SmartAccountClient> => {
270
271
 
271
272
  const chainID = await client.getChainId();
272
273
  const rpcURL = client.transport.url;
@@ -5,7 +5,9 @@ import {
5
5
  optimism,
6
6
  optimismSepolia,
7
7
  arbitrum,
8
- arbitrumSepolia
8
+ arbitrumSepolia,
9
+ base,
10
+ baseSepolia
9
11
  } from "viem/chains";
10
12
 
11
13
  export const ZERO = BigInt('0');
@@ -17,6 +19,8 @@ export enum CHAIN_ID {
17
19
  SEPOLIA = 11155111,
18
20
  OPTIMISM_MAINNET = 10,
19
21
  OPTIMISM_SEPOLIA = 11155420,
22
+ BASE_MAINNET = 8453,
23
+ BASE_SEPOLIA = 84532,
20
24
  ARBITRUM_ONE = 42161,
21
25
  ARBITRUM_SEPOLIA = 421614,
22
26
  }
@@ -27,6 +31,8 @@ export interface chainSpecifcConstants {
27
31
  typeof mainnetFactoryAddresses |
28
32
  typeof optimismMainnetFactoryAddresses |
29
33
  typeof optimismSepoliaFactoryAddresses |
34
+ typeof baseMainnetFactoryAddresses |
35
+ typeof baseSepoliaFactoryAddresses |
30
36
  typeof arbitrumOneFactoryAddresses |
31
37
  typeof arbitrumSepoliaFactoryAddresses;
32
38
  chain:
@@ -34,6 +40,8 @@ export interface chainSpecifcConstants {
34
40
  typeof sepolia |
35
41
  typeof optimism |
36
42
  typeof optimismSepolia |
43
+ typeof base |
44
+ typeof baseSepolia |
37
45
  typeof arbitrum |
38
46
  typeof arbitrumSepolia
39
47
  rpcURL: string;
@@ -81,6 +89,26 @@ export const optimismSepoliaFactoryAddresses: Record<string, Address> = {
81
89
  P256VERIFIER: '0x3c15a78046838481788613A9F111F972B562623C'
82
90
  }
83
91
 
92
+ export const baseMainnetFactoryAddresses: Record<string, Address> = {
93
+ DEVICE_WALLET_FACTORY: '0x',
94
+ ESIM_WALLET_FACTORY: '0x',
95
+ LAZY_WALLET_REGISTRY: '0x',
96
+ REGISTRY: '0x',
97
+ ENTRY_POINT: '0x',
98
+ SENDER_CREATOR: '0x',
99
+ P256VERIFIER: '0x'
100
+ }
101
+
102
+ export const baseSepoliaFactoryAddresses: Record<string, Address> = {
103
+ DEVICE_WALLET_FACTORY: '0xB4473979ff8cE4e09161B08f74EEb66BD7718076',
104
+ ESIM_WALLET_FACTORY: '0x63005d8214533fC7209678Aa39F7b9b0b51a7bcB',
105
+ LAZY_WALLET_REGISTRY: '0x8a1E53b903efcc6b252CE4bD3b255202318505Ef',
106
+ REGISTRY: '0xCa447f5C75C57f6C59027304A5Fb5A09F0E005c9',
107
+ ENTRY_POINT: '0x0000000071727De22E5E9d8BAf0edAc6f37da032',
108
+ SENDER_CREATOR: '0xefc2c1444ebcc4db75e7613d20c6a62ff67a167c',
109
+ P256VERIFIER: '0xF04f3b3935aD461D17d4a8a78E7ea21d4a61AEb1'
110
+ }
111
+
84
112
  export const arbitrumOneFactoryAddresses: Record<string, Address> = {
85
113
  DEVICE_WALLET_FACTORY: '0x',
86
114
  ESIM_WALLET_FACTORY: '0x',
@@ -121,6 +149,8 @@ export const _getChainSpecificConstants = (
121
149
  CHAIN_ID.MAINNET |
122
150
  CHAIN_ID.OPTIMISM_MAINNET |
123
151
  CHAIN_ID.OPTIMISM_SEPOLIA |
152
+ CHAIN_ID.BASE_MAINNET |
153
+ CHAIN_ID.BASE_SEPOLIA |
124
154
  CHAIN_ID.ARBITRUM_ONE |
125
155
  CHAIN_ID.ARBITRUM_SEPOLIA,
126
156
  rpcURL: string,
@@ -163,6 +193,24 @@ export const _getChainSpecificConstants = (
163
193
  customErrors: customErrors
164
194
  }
165
195
  }
196
+ else if (chainID == CHAIN_ID.BASE_MAINNET) {
197
+ return {
198
+ factoryAddresses: optimismMainnetFactoryAddresses,
199
+ chain: optimism,
200
+ rpcURL: rpcURL,
201
+ pimlicoRpcURL: pimlicoAPIKey ? `https://api.pimlico.io/v2/${chainID}/rpc?apikey=${pimlicoAPIKey}` : "",
202
+ customErrors: customErrors
203
+ }
204
+ }
205
+ else if (chainID == CHAIN_ID.BASE_SEPOLIA) {
206
+ return {
207
+ factoryAddresses: optimismSepoliaFactoryAddresses,
208
+ chain: optimismSepolia,
209
+ rpcURL: rpcURL,
210
+ pimlicoRpcURL: pimlicoAPIKey ? `https://api.pimlico.io/v2/${chainID}/rpc?apikey=${pimlicoAPIKey}` : "",
211
+ customErrors: customErrors
212
+ }
213
+ }
166
214
  else if (chainID == CHAIN_ID.ARBITRUM_ONE) {
167
215
  return {
168
216
  factoryAddresses: arbitrumOneFactoryAddresses,