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);Same-chain swaps and cross-chain bridges
The same transfer call handles swaps and bridges. For a swap, pass an { in, out } asset shape. For a bridge, set to to an address on a different chain than from.
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,
});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....
Configuration
You can optionally pass a custom API URL to createClient. The default is https://api.mure.app/v2.
const client = createClient({
adapter,
url: "https://api.mure.app/v2",
});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.