kokio-sdk 3.0.0 → 3.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/README.md
CHANGED
|
@@ -39,7 +39,8 @@ is ever held in the app.
|
|
|
39
39
|
|
|
40
40
|
You will need:
|
|
41
41
|
|
|
42
|
-
- a viem `WalletClient` connected to the target chain,
|
|
42
|
+
- a viem `WalletClient` connected to the target chain, carrying an `account`
|
|
43
|
+
and an explicit RPC URL (see the note under the example),
|
|
43
44
|
- the passkey `credentialId` and `rpId` registered for the device,
|
|
44
45
|
- a Pimlico API key and a gas policy id (used by the bundler and paymaster).
|
|
45
46
|
|
|
@@ -48,7 +49,11 @@ import { Kokio } from "kokio-sdk";
|
|
|
48
49
|
import { createWalletClient, http } from "viem";
|
|
49
50
|
import { baseSepolia } from "viem/chains";
|
|
50
51
|
|
|
51
|
-
const walletClient = createWalletClient({
|
|
52
|
+
const walletClient = createWalletClient({
|
|
53
|
+
account: knownAddress,
|
|
54
|
+
chain: baseSepolia,
|
|
55
|
+
transport: http(rpcUrl),
|
|
56
|
+
});
|
|
52
57
|
|
|
53
58
|
const kokio = new Kokio(
|
|
54
59
|
walletClient,
|
|
@@ -81,9 +86,20 @@ const session = new Kokio(
|
|
|
81
86
|
|
|
82
87
|
// 4. Send a user operation. The passkey signs it on the device.
|
|
83
88
|
const hash = await session.deviceWallet!.toggleAccessToFunds(eSIMWalletAddress, true);
|
|
84
|
-
await smartAccountClient.
|
|
89
|
+
const receipt = await smartAccountClient.waitForUserOperationReceipt({ hash });
|
|
90
|
+
if (!receipt.success) throw new Error("operation reverted");
|
|
85
91
|
```
|
|
86
92
|
|
|
93
|
+
Two things about the wallet client. It has to carry an `account`:
|
|
94
|
+
`getSmartWallet` refuses a client without one, though it never asks it for a
|
|
95
|
+
signature, since the passkey signs everything. And give `http()` a real RPC
|
|
96
|
+
URL, because the SDK reads `client.transport.url` to build the public client
|
|
97
|
+
it uses for contract reads.
|
|
98
|
+
|
|
99
|
+
Check `receipt.success`. An operation whose calls revert is still mined and
|
|
100
|
+
still returns a receipt, so the await resolving is not on its own proof the
|
|
101
|
+
write landed. `receipt.receipt.transactionHash` is the onchain transaction.
|
|
102
|
+
|
|
87
103
|
The contract surfaces (`deviceWallet`, `eSIMWallet`, `deviceWalletFactory`,
|
|
88
104
|
`eSIMWalletFactory`, `registry`, `paymentAdapter`, `P256Verifier`) are only
|
|
89
105
|
present once a `smartAccountClient` is supplied, which is why the example
|
package/dist/esm/types-export.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Settlement } from './types';
|
|
1
|
+
export { Settlement } from './types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address, Hex } from "viem";
|
|
2
|
-
import { DataBundleDetails } from "../types";
|
|
2
|
+
import { DataBundleDetails } from "../types.js";
|
|
3
3
|
import { KokioSmartAccountClient } from "../types.js";
|
|
4
4
|
export declare class ESIMWalletSubPackage {
|
|
5
5
|
client: KokioSmartAccountClient;
|
|
@@ -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';
|