Skip to content
LogoLogo

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.

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....

Read transfers and tokens

List tokens with an optional chain filter.

const { items } = await client.listTokens({ chainId: "eip155:1" });

List transfers with an optional type filter, or fetch one by id.

const transfers = await client.listTransfers({ type: "swap" });
const transfer = await client.getTransfer({ id: "int_transfer_01..." });

The list methods accept no argument when you want every result.

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.