kokio-sdk 0.1.2 → 0.1.4
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/{src/abis/BeaconProxy.json → dist/esm/abis/BeaconProxy.js} +3 -2
- package/dist/esm/abis/DeviceWallet.js +913 -0
- package/{src/abis/DeviceWalletFactory.json → dist/esm/abis/DeviceWalletFactory.js} +3 -2
- package/{src/abis/ESIMWallet.json → dist/esm/abis/ESIMWallet.js} +3 -2
- package/{src/abis/ESIMWalletFactory.json → dist/esm/abis/ESIMWalletFactory.js} +3 -2
- package/{src/abis/LazyWalletRegistry.json → dist/esm/abis/LazyWalletRegistry.js} +3 -2
- package/{src/abis/P256Verifier.json → dist/esm/abis/P256Verifier.js} +3 -2
- package/{src/abis/Registry.json → dist/esm/abis/Registry.js} +3 -2
- package/{src/abis/RegistryHelper.json → dist/esm/abis/RegistryHelper.js} +3 -2
- package/dist/esm/abis/index.js +10 -0
- package/dist/esm/config.js +52 -0
- package/dist/esm/interface/P256VerifierClass.js +10 -0
- package/dist/esm/interface/constantsClass.js +38 -0
- package/{src/interface/deviceWalletClass.ts → dist/esm/interface/deviceWalletClass.js} +12 -36
- package/dist/esm/interface/deviceWalletFactoryClass.js +18 -0
- package/dist/esm/interface/eSIMWalletClass.js +33 -0
- package/dist/esm/interface/eSIMWalletFactoryClass.js +21 -0
- package/dist/esm/interface/lazyWalletRegistryClass.js +19 -0
- package/{src/interface/smartAccountClass.ts → dist/esm/interface/smartAccountClass.js} +3 -11
- package/dist/esm/interface/utilsClass.js +13 -0
- package/{src/logic/P256Verifier.ts → dist/esm/logic/P256Verifier.js} +6 -17
- package/dist/esm/logic/account-kit/createSmartAccount.js +298 -0
- package/{src/logic/constants.ts → dist/esm/logic/constants.js} +42 -103
- package/{src/logic/deviceWallet.ts → dist/esm/logic/deviceWallet.js} +46 -74
- package/{src/logic/deviceWalletFactory.ts → dist/esm/logic/deviceWalletFactory.js} +22 -43
- package/{src/logic/eSIMWallet.ts → dist/esm/logic/eSIMWallet.js} +41 -59
- package/{src/logic/eSIMWalletFactory.ts → dist/esm/logic/eSIMWalletFactory.js} +28 -41
- package/{src/logic/lazyWalletRegistry.ts → dist/esm/logic/lazyWalletRegistry.js} +29 -60
- package/dist/esm/logic/utils.js +100 -0
- package/dist/esm/types-export.js +1 -0
- package/dist/esm/types.js +1 -0
- package/dist/types/abis/BeaconProxy.d.ts +3 -0
- package/dist/types/abis/DeviceWallet.d.ts +3 -0
- package/dist/types/abis/DeviceWalletFactory.d.ts +3 -0
- package/dist/types/abis/ESIMWallet.d.ts +3 -0
- package/dist/types/abis/ESIMWalletFactory.d.ts +3 -0
- package/dist/types/abis/LazyWalletRegistry.d.ts +3 -0
- package/dist/types/abis/P256Verifier.d.ts +3 -0
- package/dist/types/abis/Registry.d.ts +3 -0
- package/dist/types/abis/RegistryHelper.d.ts +3 -0
- package/dist/types/abis/index.d.ts +10 -0
- package/dist/types/config.d.ts +37 -0
- package/dist/types/interface/P256VerifierClass.d.ts +7 -0
- package/dist/types/interface/constantsClass.d.ts +27 -0
- package/dist/types/interface/deviceWalletClass.d.ts +2577 -0
- package/dist/types/interface/deviceWalletFactoryClass.d.ts +2570 -0
- package/dist/types/interface/eSIMWalletClass.d.ts +16 -0
- package/dist/types/interface/eSIMWalletFactoryClass.d.ts +2571 -0
- package/dist/types/interface/lazyWalletRegistryClass.d.ts +11 -0
- package/dist/types/interface/smartAccountClass.d.ts +2574 -0
- package/dist/types/interface/utilsClass.d.ts +2567 -0
- package/dist/types/logic/P256Verifier.d.ts +3 -0
- package/dist/types/logic/account-kit/createSmartAccount.d.ts +6 -0
- package/dist/types/logic/constants.d.ts +32 -0
- package/dist/types/logic/deviceWallet.d.ts +12 -0
- package/dist/types/logic/deviceWalletFactory.d.ts +5 -0
- package/dist/types/logic/eSIMWallet.d.ts +11 -0
- package/dist/types/logic/eSIMWalletFactory.d.ts +6 -0
- package/dist/types/logic/lazyWalletRegistry.d.ts +7 -0
- package/dist/types/logic/utils.d.ts +18 -0
- package/dist/types/types-export.d.ts +1 -0
- package/{src/types.ts → dist/types/types.d.ts} +19 -21
- package/package.json +24 -14
- package/.github/workflows/npm_publish.yaml +0 -45
- package/src/abis/DeviceWallet.json +0 -912
- package/src/abis/index.ts +0 -21
- package/src/config.ts +0 -58
- package/src/interface/P256VerifierClass.ts +0 -19
- package/src/interface/constantsClass.ts +0 -36
- package/src/interface/deviceWalletFactoryClass.ts +0 -35
- package/src/interface/eSIMWalletClass.ts +0 -55
- package/src/interface/eSIMWalletFactoryClass.ts +0 -36
- package/src/interface/lazyWalletRegistryClass.ts +0 -34
- package/src/interface/utilsClass.ts +0 -21
- package/src/logic/account-kit/createSmartAccount.ts +0 -401
- package/src/logic/utils.ts +0 -123
- package/src/types-export.ts +0 -7
- package/tsconfig.json +0 -114
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import { encodeFunctionData
|
|
2
|
-
import { DataBundleDetails } from "../types.js";
|
|
1
|
+
import { encodeFunctionData } from "viem";
|
|
3
2
|
import { _getChainSpecificConstants, customErrors } from "./constants.js";
|
|
4
|
-
import { SmartAccountClient } from "@aa-sdk/core";
|
|
5
3
|
import { LazyWalletRegistry } from "../abis/index.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export const _isLazyWalletDeployed = async (client: SmartAccountClient, deviceUniqueIdentifier: string) => {
|
|
9
|
-
|
|
4
|
+
export const _isLazyWalletDeployed = async (client, deviceUniqueIdentifier) => {
|
|
10
5
|
const chainID = await client.getChainId();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
const rpcURL = client.transport.url;
|
|
7
|
+
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
8
|
+
if (!client.account)
|
|
9
|
+
throw new Error(customErrors.MISSING_SMART_WALLET);
|
|
16
10
|
// UserOp
|
|
17
11
|
return client.sendUserOperation({
|
|
18
12
|
account: client.account,
|
|
19
|
-
uo:{
|
|
13
|
+
uo: {
|
|
20
14
|
target: values.factoryAddresses.LAZY_WALLET_REGISTRY,
|
|
21
15
|
data: encodeFunctionData({
|
|
22
16
|
abi: LazyWalletRegistry,
|
|
@@ -25,25 +19,17 @@ export const _isLazyWalletDeployed = async (client: SmartAccountClient, deviceUn
|
|
|
25
19
|
})
|
|
26
20
|
}
|
|
27
21
|
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const _batchPopulateHistory = async (
|
|
31
|
-
client: SmartAccountClient,
|
|
32
|
-
deviceUniqueIdentifiers: Array<string>,
|
|
33
|
-
eSIMUniqueIdentifiers: Array<Array<string>>,
|
|
34
|
-
dataBundleDetails: Array<Array<DataBundleDetails>>
|
|
35
|
-
) => {
|
|
36
|
-
|
|
22
|
+
};
|
|
23
|
+
export const _batchPopulateHistory = async (client, deviceUniqueIdentifiers, eSIMUniqueIdentifiers, dataBundleDetails) => {
|
|
37
24
|
const chainID = await client.getChainId();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
const rpcURL = client.transport.url;
|
|
26
|
+
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
27
|
+
if (!client.account)
|
|
28
|
+
throw new Error(customErrors.MISSING_SMART_WALLET);
|
|
43
29
|
// UserOp
|
|
44
30
|
return client.sendUserOperation({
|
|
45
31
|
account: client.account,
|
|
46
|
-
uo:{
|
|
32
|
+
uo: {
|
|
47
33
|
target: values.factoryAddresses.LAZY_WALLET_REGISTRY,
|
|
48
34
|
data: encodeFunctionData({
|
|
49
35
|
abi: LazyWalletRegistry,
|
|
@@ -52,26 +38,17 @@ export const _batchPopulateHistory = async (
|
|
|
52
38
|
})
|
|
53
39
|
}
|
|
54
40
|
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const _deployLazyWalletAndSetESIMIdentifier = async (
|
|
58
|
-
client: SmartAccountClient,
|
|
59
|
-
deviceOwnerPublicKey: Hex[2],
|
|
60
|
-
deviceUniqueIdentifier: string,
|
|
61
|
-
salt: bigint,
|
|
62
|
-
depositAmount: bigint
|
|
63
|
-
) => {
|
|
64
|
-
|
|
41
|
+
};
|
|
42
|
+
export const _deployLazyWalletAndSetESIMIdentifier = async (client, deviceOwnerPublicKey, deviceUniqueIdentifier, salt, depositAmount) => {
|
|
65
43
|
const chainID = await client.getChainId();
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
const rpcURL = client.transport.url;
|
|
45
|
+
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
46
|
+
if (!client.account)
|
|
47
|
+
throw new Error(customErrors.MISSING_SMART_WALLET);
|
|
71
48
|
// UserOp
|
|
72
49
|
return client.sendUserOperation({
|
|
73
50
|
account: client.account,
|
|
74
|
-
uo:{
|
|
51
|
+
uo: {
|
|
75
52
|
target: values.factoryAddresses.LAZY_WALLET_REGISTRY,
|
|
76
53
|
data: encodeFunctionData({
|
|
77
54
|
abi: LazyWalletRegistry,
|
|
@@ -80,25 +57,17 @@ export const _deployLazyWalletAndSetESIMIdentifier = async (
|
|
|
80
57
|
})
|
|
81
58
|
}
|
|
82
59
|
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export const _switchESIMIdentifierToNewDeviceIdentifier = async (
|
|
86
|
-
client: SmartAccountClient,
|
|
87
|
-
eSIMIdentifier: string,
|
|
88
|
-
oldDeviceIdentifier: string,
|
|
89
|
-
newDeviceIdentifier: string
|
|
90
|
-
) => {
|
|
91
|
-
|
|
60
|
+
};
|
|
61
|
+
export const _switchESIMIdentifierToNewDeviceIdentifier = async (client, eSIMIdentifier, oldDeviceIdentifier, newDeviceIdentifier) => {
|
|
92
62
|
const chainID = await client.getChainId();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
63
|
+
const rpcURL = client.transport.url;
|
|
64
|
+
const values = _getChainSpecificConstants(chainID, rpcURL);
|
|
65
|
+
if (!client.account)
|
|
66
|
+
throw new Error(customErrors.MISSING_SMART_WALLET);
|
|
98
67
|
// UserOp
|
|
99
68
|
return client.sendUserOperation({
|
|
100
69
|
account: client.account,
|
|
101
|
-
uo:{
|
|
70
|
+
uo: {
|
|
102
71
|
target: values.factoryAddresses.LAZY_WALLET_REGISTRY,
|
|
103
72
|
data: encodeFunctionData({
|
|
104
73
|
abi: LazyWalletRegistry,
|
|
@@ -107,4 +76,4 @@ export const _switchESIMIdentifierToNewDeviceIdentifier = async (
|
|
|
107
76
|
})
|
|
108
77
|
}
|
|
109
78
|
});
|
|
110
|
-
}
|
|
79
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { isHex, toHex } from "viem";
|
|
2
|
+
import { AsnParser } from "@peculiar/asn1-schema";
|
|
3
|
+
import { ECDSASigValue } from "@peculiar/asn1-ecc";
|
|
4
|
+
import { customErrors } from "./constants.js";
|
|
5
|
+
export const _add0x = (data) => {
|
|
6
|
+
if (!data) {
|
|
7
|
+
throw customErrors.NULL_OR_UNDEFINED_VALUE;
|
|
8
|
+
}
|
|
9
|
+
return (data.indexOf('0x') !== -1) ? isHex(data) ? data : `0x${data}` : `0x${data}`;
|
|
10
|
+
};
|
|
11
|
+
export const _remove0x = (data) => {
|
|
12
|
+
if (!data) {
|
|
13
|
+
throw customErrors.NULL_OR_UNDEFINED_VALUE;
|
|
14
|
+
}
|
|
15
|
+
return (data.indexOf('0x') !== -1) ? data.slice(2) : data;
|
|
16
|
+
};
|
|
17
|
+
export function _shouldRemoveLeadingZero(bytes) {
|
|
18
|
+
return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
|
|
19
|
+
}
|
|
20
|
+
export function _concatUint8Arrays(arrays) {
|
|
21
|
+
let pointer = 0;
|
|
22
|
+
const totalLength = arrays.reduce((prev, curr) => prev + curr.length, 0);
|
|
23
|
+
const toReturn = new Uint8Array(totalLength);
|
|
24
|
+
arrays.forEach((arr) => {
|
|
25
|
+
toReturn.set(arr, pointer);
|
|
26
|
+
pointer += arr.length;
|
|
27
|
+
});
|
|
28
|
+
return toReturn;
|
|
29
|
+
}
|
|
30
|
+
export function base64UrlToBuffer(base64url) {
|
|
31
|
+
const base64 = base64url
|
|
32
|
+
.replace(/-/g, "+")
|
|
33
|
+
.replace(/_/g, "/")
|
|
34
|
+
.padEnd((base64url.length + 3) & ~3, "=");
|
|
35
|
+
return Buffer.from(base64, "base64");
|
|
36
|
+
}
|
|
37
|
+
export function decodeClientDataJSON(base64url) {
|
|
38
|
+
const base64 = base64url
|
|
39
|
+
.replace(/-/g, "+")
|
|
40
|
+
.replace(/_/g, "/")
|
|
41
|
+
.padEnd((base64url.length + 3) & ~3, "=");
|
|
42
|
+
const jsonString = Buffer.from(base64, "base64").toString("utf-8");
|
|
43
|
+
return JSON.parse(jsonString);
|
|
44
|
+
}
|
|
45
|
+
export function hexToArrayBuffer(hexString) {
|
|
46
|
+
const cleanHex = hexString.startsWith("0x") ? hexString.slice(2) : hexString;
|
|
47
|
+
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
48
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
49
|
+
bytes[i] = parseInt(cleanHex.substr(i * 2, 2), 16);
|
|
50
|
+
}
|
|
51
|
+
return bytes.buffer;
|
|
52
|
+
}
|
|
53
|
+
export function parseDEREncodedSignature(signature) {
|
|
54
|
+
let offset = 0;
|
|
55
|
+
if (signature[offset++] !== 0x30)
|
|
56
|
+
throw new Error("Invalid DER sequence");
|
|
57
|
+
const length = signature[offset++];
|
|
58
|
+
if (signature[offset++] !== 0x02)
|
|
59
|
+
throw new Error("Expected integer for r");
|
|
60
|
+
const rLen = signature[offset++];
|
|
61
|
+
const r = signature.slice(offset, offset + rLen);
|
|
62
|
+
offset += rLen;
|
|
63
|
+
if (signature[offset++] !== 0x02)
|
|
64
|
+
throw new Error("Expected integer for s");
|
|
65
|
+
const sLen = signature[offset++];
|
|
66
|
+
const s = signature.slice(offset, offset + sLen);
|
|
67
|
+
return {
|
|
68
|
+
r: Buffer.from(r).toString("hex"),
|
|
69
|
+
s: Buffer.from(s).toString("hex"),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function shouldRemoveLeadingZero(bytes) {
|
|
73
|
+
return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
|
|
74
|
+
}
|
|
75
|
+
export function concatUint8Arrays(arrays) {
|
|
76
|
+
let pointer = 0;
|
|
77
|
+
const totalLength = arrays.reduce((prev, curr) => prev + curr.length, 0);
|
|
78
|
+
const toReturn = new Uint8Array(totalLength);
|
|
79
|
+
arrays.forEach((arr) => {
|
|
80
|
+
toReturn.set(arr, pointer);
|
|
81
|
+
pointer += arr.length;
|
|
82
|
+
});
|
|
83
|
+
return toReturn;
|
|
84
|
+
}
|
|
85
|
+
export function parseSignature(signature) {
|
|
86
|
+
const parsedSignature = AsnParser.parse(signature, ECDSASigValue);
|
|
87
|
+
let rBytes = new Uint8Array(parsedSignature.r);
|
|
88
|
+
let sBytes = new Uint8Array(parsedSignature.s);
|
|
89
|
+
if (shouldRemoveLeadingZero(rBytes)) {
|
|
90
|
+
rBytes = rBytes.slice(1);
|
|
91
|
+
}
|
|
92
|
+
if (shouldRemoveLeadingZero(sBytes)) {
|
|
93
|
+
sBytes = sBytes.slice(1);
|
|
94
|
+
}
|
|
95
|
+
const finalSignature = concatUint8Arrays([rBytes, sBytes]);
|
|
96
|
+
return {
|
|
97
|
+
r: toHex(finalSignature.slice(0, 32)),
|
|
98
|
+
s: toHex(finalSignature.slice(32)),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import DeviceWallet from './DeviceWallet.js';
|
|
2
|
+
import DeviceWalletFactory from './DeviceWalletFactory.js';
|
|
3
|
+
import ESIMWallet from './ESIMWallet.js';
|
|
4
|
+
import ESIMWalletFactory from './ESIMWalletFactory.js';
|
|
5
|
+
import LazyWalletRegistry from './LazyWalletRegistry.js';
|
|
6
|
+
import P256Verifier from './P256Verifier.js';
|
|
7
|
+
import Registry from './Registry.js';
|
|
8
|
+
import RegistryHelper from './RegistryHelper.js';
|
|
9
|
+
import BeaconProxy from './BeaconProxy.js';
|
|
10
|
+
export { DeviceWallet, DeviceWalletFactory, ESIMWallet, ESIMWalletFactory, LazyWalletRegistry, P256Verifier, Registry, RegistryHelper, BeaconProxy };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Address, WalletClient } from "viem";
|
|
2
|
+
import { KokioConstants } from "./interface/constantsClass.js";
|
|
3
|
+
import { SmartAccountSubPackage } from "./interface/smartAccountClass.js";
|
|
4
|
+
import { DeviceWalletFactorySubPackage } from "./interface/deviceWalletFactoryClass.js";
|
|
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";
|
|
10
|
+
import { SmartAccountClient } from "@aa-sdk/core";
|
|
11
|
+
export declare class Kokio {
|
|
12
|
+
viemWalletClient: WalletClient;
|
|
13
|
+
credentialId: string;
|
|
14
|
+
rpId: string;
|
|
15
|
+
organizationId: string;
|
|
16
|
+
pimlicoAPIKey: string;
|
|
17
|
+
gasPolicyId: string;
|
|
18
|
+
private _constants;
|
|
19
|
+
smartAccount: SmartAccountSubPackage;
|
|
20
|
+
deviceWalletFactory?: DeviceWalletFactorySubPackage;
|
|
21
|
+
eSIMWalletFactory?: ESIMWalletFactorySubPackage;
|
|
22
|
+
lazyWalletRegistry?: LazyWalletRegistrySubPackage;
|
|
23
|
+
deviceWallet?: DeviceWalletSubPackage;
|
|
24
|
+
eSIMWallet?: ESIMWalletSubPackage;
|
|
25
|
+
P256Verifier?: P256VerifierSubPackage;
|
|
26
|
+
constructor(viemWalletClient: WalletClient, credentialId: string, rpId: string, organizationId: string, pimlicoAPIKey: string, gasPolicyId: string, smartAccountClient?: SmartAccountClient, deviceWalletAddress?: Address, eSIMWalletAddress?: Address);
|
|
27
|
+
/**
|
|
28
|
+
* Chain-specific constants (factory addresses, chain, RPC URLs, custom errors)
|
|
29
|
+
* for the wallet client's connected chain. Resolution is asynchronous because
|
|
30
|
+
* the chain id is read from the client, so this getter returns a promise:
|
|
31
|
+
*
|
|
32
|
+
* const { factoryAddresses } = await kokio.constants;
|
|
33
|
+
*
|
|
34
|
+
* The underlying value is memoized, so repeated awaits do not re-fetch.
|
|
35
|
+
*/
|
|
36
|
+
get constants(): Promise<KokioConstants>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { WebAuthnSignature } from "../types";
|
|
2
|
+
import { SmartAccountClient } from "@aa-sdk/core";
|
|
3
|
+
export declare class P256VerifierSubPackage {
|
|
4
|
+
client: SmartAccountClient;
|
|
5
|
+
constructor(client: SmartAccountClient);
|
|
6
|
+
verifySignature(message: string, requireMessageVerification: boolean, webAuthnSignature: WebAuthnSignature, x: bigint, y: bigint): Promise<import("@aa-sdk/core").SendUserOperationResult<keyof import("@aa-sdk/core").EntryPointRegistryBase<unknown>>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WalletClient } from "viem";
|
|
2
|
+
import { mainnetFactoryAddresses, sepoliaFactoryAddresses, optimismMainnetFactoryAddresses, optimismSepoliaFactoryAddresses, baseMainnetFactoryAddresses, baseSepoliaFactoryAddresses, arbitrumOneFactoryAddresses, arbitrumSepoliaFactoryAddresses, customErrors, chainSpecifcConstants } from "../logic/constants.js";
|
|
3
|
+
export interface KokioConstants {
|
|
4
|
+
factoryAddresses: typeof sepoliaFactoryAddresses | typeof mainnetFactoryAddresses | typeof optimismMainnetFactoryAddresses | typeof optimismSepoliaFactoryAddresses | typeof baseMainnetFactoryAddresses | typeof baseSepoliaFactoryAddresses | typeof arbitrumOneFactoryAddresses | typeof arbitrumSepoliaFactoryAddresses;
|
|
5
|
+
chain: chainSpecifcConstants["chain"];
|
|
6
|
+
rpcURL: string;
|
|
7
|
+
pimlicoRpcURL: string;
|
|
8
|
+
customErrors: typeof customErrors;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Resolves chain-specific constants for the wallet client's connected chain.
|
|
12
|
+
*
|
|
13
|
+
* The chain id can only be read asynchronously from the client, so resolution
|
|
14
|
+
* is deferred to `load()` (memoized after the first call). Access the resolved
|
|
15
|
+
* values via `await kokio.constants` on the top-level SDK instance.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ConstantsSubPackage {
|
|
18
|
+
private client;
|
|
19
|
+
private pimlicoAPIKey;
|
|
20
|
+
private cache?;
|
|
21
|
+
constructor(client: WalletClient, pimlicoAPIKey: string);
|
|
22
|
+
/**
|
|
23
|
+
* Resolves and caches the chain-specific constants. Subsequent calls
|
|
24
|
+
* return the same promise, so the chain id is only fetched once.
|
|
25
|
+
*/
|
|
26
|
+
load(): Promise<KokioConstants>;
|
|
27
|
+
}
|