@kagamidigital/salt-sdk-mirror
    Preparing search index...

    @kagamidigital/salt-sdk-mirror

    TypeScript NPM Version Documentation

    Salt SDK

    Salt SDK is a TypeScript client for creating and managing Salt organisations, their accounts, policies, and MPC-signed transactions.

    Use it to:

    • Co-ordinate policy-controlled MPC signing
    • Submit MPC-signed transactions

    📃 API Reference

    • ESM only
    • Node.js 24 or later
    • viem is a peer dependency
    npm install salt-sdk viem
    
    // An existing Salt organisation and account are needed for this transaction example
    import { Salt } from 'salt-sdk';
    import {
    createPublicClient,
    createWalletClient,
    http,
    parseEther,
    type Hex,
    } from 'viem';
    import { privateKeyToAccount } from 'viem/accounts';
    import { arbitrumSepolia, sepolia } from 'viem/chains';

    // Create an instance — TESTNET uses Arbitrum Sepolia as its Key Store Network
    const salt = new Salt({ environment: 'TESTNET' });

    // Set up a viem wallet client
    const account = privateKeyToAccount(process.env.PRIVATE_KEY as Hex);
    const walletClient = createWalletClient({
    account,
    chain: arbitrumSepolia,
    transport: http(),
    });

    // Authenticate with SIWE
    await salt.authenticate(walletClient);

    // Fetch your organisations and accounts
    const orgs = await salt.getOrganisations();
    const accounts = await salt.getAccounts(orgs[0].id);

    // Start viem in order to submit a native ETH transfer to Sepolia
    const publicClient = createPublicClient({
    chain: sepolia,
    transport: http(process.env.SEPOLIA_RPC_URL),
    });

    const ceremony = await salt.submitTx({
    accountId: accounts[0].id,
    to: '0x000000000000000000000000000000000000dEaD',
    value: parseEther('0.01'),
    chainId: 11155111,
    userAddress: account.address,
    walletClient,
    publicClient,
    });

    // Track progress: proposing → signing → broadcasting → confirming → success | failure
    ceremony.on('stateChanged', ({ stage }) => console.log('tx is now', stage));

    // Wait for MPC signing + broadcast to complete
    const { transaction } = await ceremony.wait();
    console.dir(transaction);

    Learn More: Salt constructor · authenticate · getOrganisations · getAccounts · submitTx

    Full API reference and more examples at developer.salt.space/sdk/.

    Terms of Service

    By using the Salt SDK, you agree to the Terms of Service.