Release v3.0.0 (#32) - #33
Merged
Merged
Conversation
A merge commit doesn't carry the "Release" text from a squashed branch commit, so the publish workflow silently skipped v3.0.0. Now it fires on any PR to main merged with a Release label, and runs the test suite before publishing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kokio SDK v3.0.0
TL;DR
The protocol moved off ETH purchases and off wei pricing, and Base Sepolia was
redeployed. Every address in v2.1.0 is stale and
buyDataBundleno longer existson chain, so v2.1.0 cannot encode a single purchase call. This brings the SDK back
in line: prices are USD cents, purchases go through an ERC-20 path, and there is a
new
paymentAdaptersurface on both exports.Breaking on both
.and./admin. 15 commits, 63 files, 398 tests green.What changed
Prices are USD cents, not wei.
123456reads as$1234.56. The field is auint64on chain, still abigintin TypeScript.eSIMWallet.dataBundlePriceCap()eSIMWallet.priceCapUSDCents()eSIMWallet.setDataBundlePriceCap(cap)eSIMWallet.setPriceCapUSDCents(cap)registry.defaultDataBundlePriceCap()registry.defaultPriceCapUSDCents()registry.setDefaultDataBundlePriceCap(cap)registry.setDefaultPriceCapUSDCents(cap)protocolAdmin.setDefaultDataBundlePriceCapCall(cap)protocolAdmin.setDefaultPriceCapUSDCentsCall(cap)The "no ceiling" fallback still answers
maxUint256, not zero.DataBundleDetailschanged shape. viem encodes structs by exact key, so thisis a hard break for every caller:
{ dataBundleID: string, dataBundlePrice: bigint }becomes{ id: Hex, priceUSDCents: bigint, settlement: Settlement }.Settlementis a new exported enum:DeviceWallet(0),ExternalWallet(1),Fiat(2). It says which contract, if any, actually saw the money move.Purchases take a token, not ETH.
eSIMWallet.buyDataBundle(details, value)eSIMWallet.buyDataBundleWithToken(details, asset, maxAmountIn, paymentReference)deviceWallet.toggleAccessToETH(esim, on)deviceWallet.toggleAccessToFunds(esim, on)deviceWallet.canPullETH(esim)deviceWallet.canPullFunds(esim)eSIMWallet.sendTokenToDeviceWallet(token, amount)maxAmountInis in the token's own smallest unit. Take it frompaymentAdapter.quote(asset, priceUSDCents). Do not compute it from a price and anassumed decimals count.
paymentReferenceis an offchain order id, spendable onceper eSIM wallet.
ETH itself did not leave the protocol.
sendETHToDeviceWalletand the factorydeposit path are untouched. Only the purchase path moved to tokens.
New
paymentAdaptersurface, on bothKokioandKokioAdmin.Reads:
quote,resolveAsset,assets,settlementToken,registry,usedReferences,upgradeManager. Owner writes on the admin side:registerAsset,updateAsset,acceptOwnership. The adapter is owned by the timelock, soprotocolAdmingainedsetPaymentAdapterCallplus ownership and upgrade payloadcoverage for it. New exported
Assettype mirrors the on-chain struct.Purchases paid for outside the protocol.
registry.recordSettledPurchaseon theadmin surface records a card or external-wallet payment. No money moves through it,
and it refuses
Settlement.DeviceWallet. Comes withregistry.paymentAdapter,registry.usedPaymentReferencesandregistry.requireLazyHistoryCopied.Lazy history ordering.
lazyWalletRegistry.outstandingHistoryEntries(eSIMIdentifier)tells you whether a purchase would land ahead of history that has not been copied in
yet.
batchPopulateHistorycallers must now setsettlementtoExternalWalletorFiat;DeviceWalletreverts.Base Sepolia addresses. All six moved, plus a new
PAYMENT_ADAPTERkey.DEVICE_WALLET_FACTORY0x0BB3BA8D9233514a4aA6D72c243a2473f9cFf0bbESIM_WALLET_FACTORY0x57da54e07705de17c713ec311ac193e83470D5a5LAZY_WALLET_REGISTRY0x5bE46Cf216186Bc2E3C220729331D6bE7d186e84REGISTRY0x916b6b554119c789EF3026EDeB0E1Ba741b42A49P256VERIFIER0x6FA3E7E145476Dc4682734Fd845019A3872b4821PROTOCOL_ADMIN0xdDeCC2C1345BC966337B5f4Fe57EC2D5bfad751APAYMENT_ADAPTER0xBFaA666a8074924588E96507c307b680ecCeB2c1ENTRY_POINTandSENDER_CREATORdid not move. The counterfactual addressderivation is unaffected: the beacon proxy creation code hash is unchanged, so
createSmartAccountkeeps its existing pin.Chain list trimmed to Base and Base Sepolia. Mainnet, Sepolia, Optimism,
Optimism Sepolia, Arbitrum One and Arbitrum Sepolia were empty placeholder address
books that could only ever be rejected. Base Mainnet stays as a placeholder because
the protocol does ship there next. Callers passing any of the six removed chain ids
now get a type error instead of a runtime rejection.
All 10 ABIs regenerated against the current contracts, plus a new
PaymentAdapterABI. Two event names were corrected on chain and are now correcthere:
UpdatedDeviceWalletAssociatedWithESIMWalletandESIMWalletFactoryDeployed.Anything indexing the old spellings goes silent rather than erroring.
Revert decoding covers the new and renamed errors, including
AssetNotAllowed,AssetNeedsSwap,PaymentReferenceAlreadyUsed,SettlementNotFunded,SettlementNotAssertedandHistoryNotFullyCopied.Docs updated across every page, with two new ones:
docs/mobile/payment-adapter.mdanddocs/admin/payment-adapter.md.Migrating
3.0.0.DataBundleDetailsliteral to{ id, priceUSDCents, settlement },with
idas abytes32hex string.buyDataBundlewithbuyDataBundleWithToken, sourcingmaxAmountInfrom
paymentAdapter.quoteandpaymentReferencefrom your order system.toggleAccessToETHandcanPullETHto theFundsspellings, and thefour price-cap methods per the table above.
Verification
npm run buildclean.npm test: 398 passing across 13 files.cast codeand a name-revealing viewbefore it was written into
constants.ts.