@tokemak/toke
v0.1.2
Published
Headless TypeScript SDK for the **legacy TOKE token**: **cross-chain bridging** (LayerZero V2 OFT) and **TOKE → AUTO migration**. TOKE is legacy — the active products (sAUTO staking, AUTO bridging, ETH/AUTO LP) live in `@tokemak/auto`. This package is int
Readme
@tokemak/toke
Headless TypeScript SDK for the legacy TOKE token: cross-chain
bridging (LayerZero V2 OFT) and TOKE → AUTO migration. TOKE is legacy —
the active products (sAUTO staking, AUTO bridging, ETH/AUTO LP) live in
@tokemak/auto. This package is intentionally scoped to bridging + migration.
Runtime dependencies: viem + fetch. No React, no wagmi, no GraphQL client.
Reads return data or throw typed TokemakSdkErrors; builders return unsigned
transactions — nothing executes on its own.
Quickstart
import { createTokemakClient, sendTransaction } from "@tokemak/sdk-core";
import { getBridgeQuote } from "@tokemak/toke/queries";
import { prepareBridge } from "@tokemak/toke/transactions";
const client = createTokemakClient({ chainId: 1, rpcUrl: RPC_URL });
// Quote the LayerZero fee first (optional — prepareBridge quotes internally).
const quote = await getBridgeQuote(client, {
token: "0x2e9d63788249371f1dfc918a52f8d799f4a38c94",
amount: 100n * 10n ** 18n,
destChainId: 8453,
recipient: owner
});
// Bridge 100 TOKE mainnet → Base. tx.value is the LayerZero nativeFee.
const plan = await prepareBridge(client, {
owner,
token: "0x2e9d63788249371f1dfc918a52f8d799f4a38c94",
amount: 100n * 10n ** 18n,
destChainId: 8453
});
if (plan.approval) await sendTransaction(walletClient, plan.approval);
await sendTransaction(walletClient, plan.transaction);Surface
- Queries:
getBridgeQuote,getTokenPrices(re-export). - Transactions:
prepareBridge,prepareMigrate,prepareMigrateAndStake,prepareApprove. - Registry data in
@tokemak/config:TOKE_BRIDGE_REGISTRY(OFT addresses + baked LayerZero eids per chain, verified on-chain 2026-07-07) andTOKE_TO_AUTO_CONVERSION(the TokenConversion contract). - The bridge builders (
getBridgeQuote/prepareBridge) andprepareApproveare thin bindings of shared implementations in@tokemak/sdk-core— this package just suppliesTOKE_BRIDGE_REGISTRY. The same core is reused by@tokemak/auto.
Quirks agents should know
- Mainnet vs satellites. On mainnet, bridging goes through the OFTAdapter
lockbox — it pulls TOKE via
transferFrom, so an ERC-20 approval is required (included in the plan asapproval). Satellite chains use native OFTs that burn from the sender, so no approval. - Sender-bound debit, recipient param.
senddebitsmsg.sender; the destination-chain recipient is a real parameter (defaults toowner). Excess native fee refunds to the sender. - Dust truncation. OFTs move value in 6 shared decimals — amounts below
10^12raw are dust and truncated.minAmountReceivedreflects the exact truncation (vanilla OFT transfers are lossless, so defaultslippageBpsis 0). - Destination eid is baked into the registry, so quoting needs no
destination-chain client. Track deliveries at
https://layerzeroscan.com/tx/{hash}. - Migration is sender-debited, mainnet only.
prepareMigratecalls the TokenConversion contract, which pulls the sender's TOKE (approval included in the plan) and mints AUTO 1:1 toreceiver(defaults to sender).prepareMigrateAndStakeconverts and locks into sAUTO in one transaction via the contract's role-heldlockTokeFor— funds INTO staking, so it is gated on sAUTO's registry lifecycle + freshpaused()(passforceto bypass). The receiver param routes through the conversion contract, so it is the one supported way to stake sAUTO for another account. - No staking reads or LP. TOKE is legacy; this package does not expose accTOKE staking positions/exits or any LP. Recover from git history if legacy staking reads are reintroduced.
Verification
pnpm --filter @tokemak/toke smoke # live mainnet + Base bridge checks with real actorsFully on-chain — no Tokemak subgraph dependency.
