kokio-sdk 3.0.1 → 3.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.
- package/README.md +15 -15
- package/dist/esm/admin/config-admin.js +1 -1
- package/dist/esm/config.js +1 -1
- package/dist/esm/interface/deviceWalletClass.js +10 -1
- package/dist/esm/interface/eSIMWalletClass.js +9 -1
- package/dist/esm/interface/eSIMWalletFactoryClass.js +9 -1
- package/dist/esm/interface/registryClass.js +8 -0
- package/dist/esm/interface/smartAccountClass.js +9 -2
- package/dist/esm/logic/P256Verifier.js +2 -2
- package/dist/esm/logic/account-kit/createSmartAccount.js +47 -36
- package/dist/esm/logic/admin/deviceWallet.eoa.js +5 -5
- package/dist/esm/logic/admin/deviceWalletFactory.eoa.js +13 -13
- package/dist/esm/logic/admin/eSIMWallet.eoa.js +3 -3
- package/dist/esm/logic/admin/eSIMWalletFactory.eoa.js +9 -9
- package/dist/esm/logic/admin/lazyWalletRegistry.eoa.js +13 -13
- package/dist/esm/logic/admin/paymentAdapter.eoa.js +11 -11
- package/dist/esm/logic/admin/protocolAdmin.eoa.js +14 -14
- package/dist/esm/logic/admin/reads/deviceWalletFactory.reads.js +9 -9
- package/dist/esm/logic/admin/reads/eSIMWalletFactory.reads.js +7 -7
- package/dist/esm/logic/admin/reads/lazyWalletRegistry.reads.js +18 -18
- package/dist/esm/logic/admin/reads/paymentAdapter.reads.js +8 -8
- package/dist/esm/logic/admin/reads/protocolAdmin.reads.js +2 -2
- package/dist/esm/logic/admin/reads/registry.reads.js +31 -31
- package/dist/esm/logic/admin/registry.eoa.js +27 -27
- package/dist/esm/logic/constants.js +14 -1
- package/dist/esm/logic/deviceWallet.js +35 -1
- package/dist/esm/logic/deviceWalletFactory.js +11 -11
- package/dist/esm/logic/eSIMWallet.js +50 -2
- package/dist/esm/logic/eSIMWalletFactory.js +15 -3
- package/dist/esm/logic/errors.js +15 -9
- package/dist/esm/logic/paymentAdapter.js +8 -8
- package/dist/esm/logic/registry.js +17 -17
- package/dist/esm/logic/utils.js +1 -81
- package/dist/esm/types-export.js +1 -1
- package/dist/types/admin/config-admin.d.ts +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/types/interface/deviceWalletClass.d.ts +12 -0
- package/dist/types/interface/eSIMWalletClass.d.ts +7 -1
- package/dist/types/interface/eSIMWalletFactoryClass.d.ts +6 -0
- package/dist/types/interface/registryClass.d.ts +8 -0
- package/dist/types/interface/smartAccountClass.d.ts +10 -1
- package/dist/types/logic/account-kit/createSmartAccount.d.ts +1 -1
- package/dist/types/logic/constants.d.ts +3 -0
- package/dist/types/logic/deviceWallet.d.ts +12 -0
- package/dist/types/logic/eSIMWallet.d.ts +8 -0
- package/dist/types/logic/eSIMWalletFactory.d.ts +2 -0
- package/dist/types/logic/errors.d.ts +6 -5
- package/dist/types/logic/utils.d.ts +0 -21
- package/dist/types/types-export.d.ts +3 -2
- package/dist/types/types.d.ts +1 -1
- package/package.json +21 -7
|
@@ -8,5 +8,14 @@ export declare class SmartAccountSubPackage {
|
|
|
8
8
|
gasPolicyId: string;
|
|
9
9
|
constructor(client: WalletClient, credentialId: string, rpId: string, pimlicoAPIKey: string, gasPolicyId: string);
|
|
10
10
|
getSmartWallet(deviceUniqueIdentifier: string, deviceWalletOwnerKey: P256Key, salt: bigint): Promise<KokioSmartAccount>;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Client that sends the account's user operations through a bundler, with
|
|
13
|
+
* gas sponsored by the paymaster at the same endpoint.
|
|
14
|
+
*
|
|
15
|
+
* @param options.bundlerUrl Bundler and ERC-7677 paymaster endpoint. Defaults to
|
|
16
|
+
* Pimlico for the wallet client's chain, keyed by the API key given to `Kokio`.
|
|
17
|
+
*/
|
|
18
|
+
getSmartWalletClient(account: KokioSmartAccount, options?: {
|
|
19
|
+
bundlerUrl?: string;
|
|
20
|
+
}): Promise<KokioSmartAccountClient>;
|
|
12
21
|
}
|
|
@@ -63,5 +63,5 @@ type RawGasEstimate = Record<string, Hex>;
|
|
|
63
63
|
* override placed on the client is never the one it calls.
|
|
64
64
|
*/
|
|
65
65
|
export declare const _padGasEstimate: (estimate: RawGasEstimate) => RawGasEstimate;
|
|
66
|
-
export declare const _getSmartWalletClient: (client: WalletClient, pimlicoAPIKey: string, gasPolicyId: string, account: KokioSmartAccount) => Promise<KokioSmartAccountClient>;
|
|
66
|
+
export declare const _getSmartWalletClient: (client: WalletClient, pimlicoAPIKey: string, gasPolicyId: string, account: KokioSmartAccount, bundlerUrl?: string) => Promise<KokioSmartAccountClient>;
|
|
67
67
|
export {};
|
|
@@ -18,5 +18,8 @@ export interface chainSpecifcConstants {
|
|
|
18
18
|
export declare const baseMainnetFactoryAddresses: Record<string, Address>;
|
|
19
19
|
export declare const baseSepoliaFactoryAddresses: Record<string, Address>;
|
|
20
20
|
export declare const customErrors: Record<string, string>;
|
|
21
|
+
export declare const _chainId: (client: {
|
|
22
|
+
getChainId: () => Promise<number>;
|
|
23
|
+
}) => Promise<number>;
|
|
21
24
|
export declare const _extractChainID: (client: WalletClient) => Promise<number>;
|
|
22
25
|
export declare const _getChainSpecificConstants: (chainID: CHAIN_ID.BASE_MAINNET | CHAIN_ID.BASE_SEPOLIA, rpcURL: string, pimlicoAPIKey?: string) => chainSpecifcConstants;
|
|
@@ -19,6 +19,18 @@ export declare const _toggleAccessToFunds: (client: KokioSmartAccountClient, add
|
|
|
19
19
|
* a bind from undoing the owner's revocation.
|
|
20
20
|
*/
|
|
21
21
|
export declare const _addESIMWallet: (client: KokioSmartAccountClient, address: Address, eSIMWalletAddress: Address) => Promise<`0x${string}`>;
|
|
22
|
+
/**
|
|
23
|
+
* Deploy an eSIM wallet for this device wallet and bind it, in one user operation.
|
|
24
|
+
*
|
|
25
|
+
* Fund access cannot be granted at bind time, so `grantAccessToFunds` adds a
|
|
26
|
+
* `toggleAccessToFunds` after the bind in the same operation. The device wallet
|
|
27
|
+
* must already be registered (`registry.isDeviceWalletValid`), or the factory
|
|
28
|
+
* refuses it.
|
|
29
|
+
*/
|
|
30
|
+
export declare const _deployAndBindESIMWallet: (client: KokioSmartAccountClient, address: Address, salt: bigint, grantAccessToFunds: boolean) => Promise<{
|
|
31
|
+
userOpHash: Hex;
|
|
32
|
+
eSIMWalletAddress: Address;
|
|
33
|
+
}>;
|
|
22
34
|
/**
|
|
23
35
|
* Release an eSIM wallet and put it on standby for a transfer.
|
|
24
36
|
*
|
|
@@ -21,6 +21,14 @@ export declare const _setPriceCapUSDCents: (client: KokioSmartAccountClient, add
|
|
|
21
21
|
* inventing one.
|
|
22
22
|
*/
|
|
23
23
|
export declare const _buyDataBundleWithToken: (client: KokioSmartAccountClient, address: Address, dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex) => Promise<`0x${string}`>;
|
|
24
|
+
/**
|
|
25
|
+
* Buy a data bundle with tokens the device wallet sends over in the same user
|
|
26
|
+
* operation, so the eSIM wallet needs no access to the device wallet's funds.
|
|
27
|
+
*
|
|
28
|
+
* Only the shortfall is sent: the quote for the bundle minus what this eSIM
|
|
29
|
+
* wallet already holds of `asset`. Arguments are as for `buyDataBundleWithToken`.
|
|
30
|
+
*/
|
|
31
|
+
export declare const _buyDataBundleWithTransfer: (client: KokioSmartAccountClient, address: Address, dataBundleDetails: DataBundleDetails, asset: Hex, maxAmountIn: bigint, paymentReference: Hex) => Promise<`0x${string}`>;
|
|
24
32
|
/**
|
|
25
33
|
* Send an ERC-20 held by this eSIM wallet back to its owning device wallet.
|
|
26
34
|
* `onlyDeviceWallet`.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
2
|
import { KokioSmartAccountClient } from "../types.js";
|
|
3
3
|
export declare const _deployESIMWalletWithUserOp: (client: KokioSmartAccountClient, deviceWalletAddress: Address, salt: bigint) => Promise<`0x${string}`>;
|
|
4
|
+
/** Address `deployESIMWallet` deploys to for this device wallet and salt. */
|
|
5
|
+
export declare const _getESIMWalletCounterFactualAddress: (client: KokioSmartAccountClient, deviceWalletAddress: Address, salt: bigint) => Promise<Address>;
|
|
4
6
|
export declare const _getCurrentESIMWalletImplementation: (client: KokioSmartAccountClient) => Promise<Address>;
|
|
@@ -107,14 +107,15 @@ export declare class ContractRevertError extends KokioError {
|
|
|
107
107
|
constructor(data: Hex);
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* Pulls a ContractRevertError out of an error thrown by viem, or `null`
|
|
111
|
-
*
|
|
110
|
+
* Pulls a ContractRevertError out of an error thrown by viem, or `null` when
|
|
111
|
+
* the error carries no revert data (a network failure, a rejected signature).
|
|
112
112
|
*/
|
|
113
113
|
export declare const toContractRevertError: (err: unknown) => ContractRevertError | null;
|
|
114
114
|
/**
|
|
115
|
-
* `client.writeContract`, but a
|
|
116
|
-
*
|
|
117
|
-
*
|
|
115
|
+
* `client.writeContract`, but a revert comes back as a ContractRevertError
|
|
116
|
+
* instead of viem's raw error chain. Its `decoded` is null when the selector
|
|
117
|
+
* belongs to none of the Kokio contracts. Anything that is not a revert, such
|
|
118
|
+
* as a network failure, is rethrown as-is.
|
|
118
119
|
*
|
|
119
120
|
* Mirrors `WalletClient["writeContract"]`'s own generics rather than reading
|
|
120
121
|
* them off `Parameters<...>`, since that would collapse the per-call overload
|
|
@@ -1,25 +1,4 @@
|
|
|
1
1
|
import { Hex } from "viem";
|
|
2
2
|
export declare const _add0x: (data: Hex | string) => Hex;
|
|
3
|
-
export declare const _remove0x: (data: Hex | string) => string;
|
|
4
3
|
export declare function _shouldRemoveLeadingZero(bytes: Uint8Array): boolean;
|
|
5
4
|
export declare function _concatUint8Arrays(arrays: Uint8Array[]): Uint8Array;
|
|
6
|
-
export declare function base64UrlToBuffer(base64url: string): Buffer;
|
|
7
|
-
export interface ClientDataJSON {
|
|
8
|
-
type: string;
|
|
9
|
-
challenge: string;
|
|
10
|
-
origin: string;
|
|
11
|
-
crossOrigin?: boolean;
|
|
12
|
-
[key: string]: unknown;
|
|
13
|
-
}
|
|
14
|
-
export declare function decodeClientDataJSON(base64url: string): ClientDataJSON;
|
|
15
|
-
export declare function hexToArrayBuffer(hexString: string): ArrayBuffer;
|
|
16
|
-
export declare function parseDEREncodedSignature(signature: Uint8Array): {
|
|
17
|
-
r: string;
|
|
18
|
-
s: string;
|
|
19
|
-
};
|
|
20
|
-
export declare function shouldRemoveLeadingZero(bytes: Uint8Array): boolean;
|
|
21
|
-
export declare function concatUint8Arrays(arrays: Uint8Array[]): Uint8Array;
|
|
22
|
-
export declare function parseSignature(signature: Uint8Array): {
|
|
23
|
-
r: `0x${string}`;
|
|
24
|
-
s: `0x${string}`;
|
|
25
|
-
};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export type { P256Key, Call, WebAuthnSignature, P256Credential, DataBundleDetails, Asset, SignedRequest, KokioSmartAccount, KokioSmartAccountClient, OwnerCall, OperationOptions, ScheduledOperation, ScheduledBatchOperation } from './types';
|
|
2
|
-
export {
|
|
1
|
+
export type { P256Key, Call, WebAuthnSignature, P256Credential, DataBundleDetails, Asset, SignedRequest, KokioSmartAccount, KokioSmartAccountClient, OwnerCall, OperationOptions, ScheduledOperation, ScheduledBatchOperation, LazyDeploymentBatch, LazyDeployment, LazyHistoryBatch, LazyHistoryCopy } from './types.js';
|
|
2
|
+
export type { KokioConstants } from './interface/constantsClass.js';
|
|
3
|
+
export { Settlement } from './types.js';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type OwnerCall = {
|
|
|
20
20
|
abi: Abi;
|
|
21
21
|
functionName: string;
|
|
22
22
|
args?: readonly unknown[];
|
|
23
|
-
/** ETH sent with the call.
|
|
23
|
+
/** ETH sent with the call. `executor.execute` attaches it from the executing account. */
|
|
24
24
|
value?: bigint;
|
|
25
25
|
};
|
|
26
26
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokio-sdk",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/config.js",
|
|
@@ -32,10 +32,13 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc",
|
|
34
34
|
"prepack": "npm run build",
|
|
35
|
+
"pretest": "npm run build",
|
|
35
36
|
"test": "vitest run",
|
|
36
37
|
"test:watch": "vitest",
|
|
37
38
|
"test:integration": "INTEGRATION=1 vitest run",
|
|
38
|
-
"test:integration:fork": "INTEGRATION=1 vitest run tests/integration --no-file-parallelism"
|
|
39
|
+
"test:integration:fork": "INTEGRATION=1 vitest run tests/integration --no-file-parallelism",
|
|
40
|
+
"test:consumer:fork": "npm run build && INTEGRATION=1 vitest run tests/consumer --no-file-parallelism",
|
|
41
|
+
"test:consumer:live": "npm run build && KOKIO_LIVE=1 vitest run tests/consumer --no-file-parallelism"
|
|
39
42
|
},
|
|
40
43
|
"repository": {
|
|
41
44
|
"type": "git",
|
|
@@ -48,20 +51,31 @@
|
|
|
48
51
|
},
|
|
49
52
|
"homepage": "https://github.com/Blockchain-Powered-eSIM/kokio-sdk#readme",
|
|
50
53
|
"devDependencies": {
|
|
54
|
+
"@pimlico/alto": "0.0.21",
|
|
55
|
+
"@pimlico/mock-paymaster": "0.0.8",
|
|
56
|
+
"@simplewebauthn/server": "13.3.2",
|
|
51
57
|
"@types/node": "22.20.1",
|
|
52
58
|
"dotenv": "17.4.2",
|
|
59
|
+
"prool": "0.0.25",
|
|
60
|
+
"react-native-passkey": "3.6.1",
|
|
53
61
|
"typescript": "5.9.3",
|
|
54
62
|
"vitest": "4.1.11"
|
|
55
63
|
},
|
|
56
64
|
"dependencies": {
|
|
57
65
|
"@noble/curves": "2.3.0",
|
|
58
|
-
"@
|
|
59
|
-
"@peculiar/asn1-schema": "2.9.3",
|
|
60
|
-
"@simplewebauthn/server": "13.3.2",
|
|
61
|
-
"react-native-passkey": "3.6.1",
|
|
66
|
+
"@scure/base": "1.2.6",
|
|
62
67
|
"viem": "2.55.19"
|
|
63
68
|
},
|
|
64
69
|
"overrides": {
|
|
65
|
-
"ws": "8.21.0"
|
|
70
|
+
"ws": "8.21.0",
|
|
71
|
+
"tar": "7.5.22"
|
|
72
|
+
},
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react-native-passkey": "^3.6.1"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"react-native-passkey": {
|
|
78
|
+
"optional": true
|
|
79
|
+
}
|
|
66
80
|
}
|
|
67
81
|
}
|