Getting Started
This guide installs the SDK, creates a wallet adapter, and runs your first transfer.
Installation
Prerequisites
You need a viem wallet client with a funded account on a supported chain. The SDK uses viem as its default blockchain adapter.
import { http, createWalletClient } from "viem";
import { sepolia } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
const walletClient = createWalletClient({
chain: sepolia,
transport: http(),
account: privateKeyToAccount("0x..."), // replace with your private key
});Your First Transfer
Create an adapter, create the client, and call transfer.
import { createClient, viem } from "@mure/sdk";
import { sepolia } from "@mure/sdk/accounts/evm";
import { sepolia as sepoliaChain } from "viem/chains";
// 1. Create the adapter
const adapter = viem({
chain: sepoliaChain,
transport: http(),
account: privateKeyToAccount("0x..."),
});
// 2. Create the client
const client = createClient({ adapter });
// 3. Execute a transfer
const hash = await client.transfer({
to: sepolia("0x8f664a25158021EFb4470f9036431664ce9f7895"), // recipient address
asset: "USDC",
amount: 10_000_000n, // 10 USDC (6 decimals)
});
console.log("Transaction hash:", hash);transfer submits immediately after the API returns the transaction. The SDK adds no confirmation step; the adapter's account decides whether the wallet prompts. See Submission and confirmation to inspect the intent before sending.
Swaps, bridges, and batches
The same transfer call handles swaps, bridges, and batches. For a swap, pass an { in, out } asset shape. For a bridge, set to to an address on a different chain than from. For a batch, pass transfers instead of the single-transfer members.
import { base, eth } from "@mure/sdk/accounts/evm";
const USDC = eth("0x3164ed5B9D37Ac9619aC5895CA33F308aB02a053");
const NATIVE_ETH = eth("0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE");
// Swap USDC for ETH on Base
const swapHash = await client.transfer({
to: base("0x8f664a25158021EFb4470f9036431664ce9f7895"),
asset: { in: USDC, out: NATIVE_ETH },
amount: 10_000_000n,
});
// Bridge USDC from the adapter's chain to Base
const bridgeHash = await client.transfer({
to: base("0x8f664a25158021EFb4470f9036431664ce9f7895"),
asset: USDC,
amount: 10_000_000n,
});
// Pay two recipients in one order, so both settle or neither does
const batchHash = await client.transfer({
transfers: [
{ to: base("0x8f664a25158021EFb4470f9036431664ce9f7895"), asset: USDC, amount: 5_000_000n },
{
to: base("0x15d34aaf54267db7d7c367839aaf71a00a2c6a65"),
asset: { in: USDC, out: NATIVE_ETH },
amount: 5_000_000n,
options: { slippageBps: 100 },
},
],
});A batch carries one payer and one source chain, at most 25 transfers. deadline and options.simulate stay at the top level; slippageBps and protocols belong to each item. Every response carries one record per transfer in metadata.transfers, and the intent's own type is batch.
The eth, sepolia, base, baseSepolia, hyperliquid, and hyperliquidTestnet helpers turn a plain address into a CAIP-10 identifier for that chain. If you prefer, you can write the CAIP-10 string directly, e.g. eip155:8453:0x....
Read transfers and tokens
List tokens with an optional chain filter. listTokens answers one page; use
listAllTokens to read every page.
const page = await client.listTokens({ chainId: "eip155:1" });
const everyToken = await listAllTokens((filter) => client.listTokens(filter), {
chainId: "eip155:1",
});List transfers with an optional type filter, plus the paging and totals arguments, or fetch one by id.
const transfers = await client.listTransfers({ type: "swap" });
const next = await client.listTransfers({ cursor: transfers.nextCursor ?? undefined });
const transfer = await client.getTransfer({ id: "int_transfer_01..." });The list methods accept no argument when you want the first page.
Configuration
Pass API options under the api key. Both fields are optional. The default URL is https://api.mure.app/v2.
const client = createClient({
adapter,
api: {
url: "https://api.mure.app/v2", // optional
apiKey: process.env.MURE_API_KEY, // optional
},
});createClient throws ClientConfigError synchronously when api.apiKey is a blank string. An absent key is allowed. See Authentication for credential semantics.
Error Handling
Wrap every call in try/catch to handle validation or blockchain failures.
import { ClientServiceError } from "@mure/sdk";
import { sepolia } from "@mure/sdk/accounts/evm";
try {
const hash = await client.transfer({
to: sepolia("0x..."), // recipient address
asset: "USDC",
amount: 10_000_000n, // 10 USDC (6 decimals)
});
} catch (error) {
if (error instanceof ClientServiceError) {
console.error("Transfer failed:", error.message);
}
}Next Steps
- Read the Client reference for the full API surface.
- Read the Adapters reference to understand how to plug in a different wallet provider.
- Explore the Effect-TS integration if you want to compose the SDK into larger Effect programs.