From a1cc9faa5d23258ecd953775b2c85504ca6758ac Mon Sep 17 00:00:00 2001 From: ManulParihar Date: Wed, 2 Sep 2026 19:07:27 +0530 Subject: [PATCH 1/2] Updated readme with viem methods --- README.md | 22 +++++++++++++++++++--- docs/mobile/device-wallet.md | 6 +++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a705d09..a71d884 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ is ever held in the app. You will need: -- a viem `WalletClient` connected to the target chain, +- a viem `WalletClient` connected to the target chain, carrying an `account` + and an explicit RPC URL (see the note under the example), - the passkey `credentialId` and `rpId` registered for the device, - a Pimlico API key and a gas policy id (used by the bundler and paymaster). @@ -48,7 +49,11 @@ import { Kokio } from "kokio-sdk"; import { createWalletClient, http } from "viem"; import { baseSepolia } from "viem/chains"; -const walletClient = createWalletClient({ chain: baseSepolia, transport: http() }); +const walletClient = createWalletClient({ + account: knownAddress, + chain: baseSepolia, + transport: http(rpcUrl), +}); const kokio = new Kokio( walletClient, @@ -81,9 +86,20 @@ const session = new Kokio( // 4. Send a user operation. The passkey signs it on the device. const hash = await session.deviceWallet!.toggleAccessToFunds(eSIMWalletAddress, true); -await smartAccountClient.waitForUserOperationTransaction({ hash }); +const receipt = await smartAccountClient.waitForUserOperationReceipt({ hash }); +if (!receipt.success) throw new Error("operation reverted"); ``` +Two things about the wallet client. It has to carry an `account`: +`getSmartWallet` refuses a client without one, though it never asks it for a +signature, since the passkey signs everything. And give `http()` a real RPC +URL, because the SDK reads `client.transport.url` to build the public client +it uses for contract reads. + +Check `receipt.success`. An operation whose calls revert is still mined and +still returns a receipt, so the await resolving is not on its own proof the +write landed. `receipt.receipt.transactionHash` is the onchain transaction. + The contract surfaces (`deviceWallet`, `eSIMWallet`, `deviceWalletFactory`, `eSIMWalletFactory`, `registry`, `paymentAdapter`, `P256Verifier`) are only present once a `smartAccountClient` is supplied, which is why the example diff --git a/docs/mobile/device-wallet.md b/docs/mobile/device-wallet.md index e54747e..b5fad90 100644 --- a/docs/mobile/device-wallet.md +++ b/docs/mobile/device-wallet.md @@ -10,9 +10,13 @@ operation signed by the passkey. ```ts const hash = await kokio.deviceWallet!.toggleAccessToFunds(eSIMWalletAddress, true); -await smartAccountClient.waitForUserOperationTransaction({ hash }); +const receipt = await smartAccountClient.waitForUserOperationReceipt({ hash }); +if (!receipt.success) throw new Error("operation reverted"); ``` +An operation whose calls revert is still mined and still returns a receipt, +so check `success` rather than treating a resolved await as confirmation. + ## sendUserOperation Sends one or more raw calls from this device wallet as a single user From 44e33b42faf68539ae1a858981cae18d4cf403c1 Mon Sep 17 00:00:00 2001 From: ManulParihar Date: Wed, 2 Sep 2026 19:12:28 +0530 Subject: [PATCH 2/2] Bump package version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 75c67fc..ba62f67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "kokio-sdk", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "kokio-sdk", - "version": "3.0.0", + "version": "3.0.1", "license": "MIT", "dependencies": { "@noble/curves": "2.3.0", diff --git a/package.json b/package.json index bd430db..f47f5fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kokio-sdk", - "version": "3.0.0", + "version": "3.0.1", "description": "", "type": "module", "main": "./dist/esm/config.js",