Skip to main content

Documentation Index

Fetch the complete documentation index at: https://yieldxyz.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Deprecated — The Signers Package is no longer actively maintained. Yield.xyz is signer-agnostic; you can use any signing infrastructure (ethers.js, viem, wagmi, Fireblocks, etc.) to sign the unsigned transaction payloads returned by the API.

Overview

The StakeKit Signers package allows you to create a signing wallet instance from a mnemonic phrase or Ledger app and sign transactions. It supports custom derivation paths and multiple wallet mechanisms including MetaMask, Omni, Phantom, and Keplr.

NPM Package

@stakekit/signers

GitHub

View source code

Installation

npm install @stakekit/signers @stakekit/common
or
yarn add @stakekit/signers @stakekit/common
or
pnpm add @stakekit/signers @stakekit/common

Supported Networks

Production Networks: Arbitrum, Avalanche, Base, BNB Chain, Celo, CoreDAO, Cronos, Ethereum, Harmony, Linea, Optimism, Polygon, Sonic, Unichain, VictionTestnets: Base-Sepolia, Ethereum-Goerli, Ethereum-Holesky, Ethereum-Sepolia, Polygon-Amoy

Supported Wallets

WalletDescription
MetaMaskStandard EVM derivation path
OmniMulti-chain wallet derivation
PhantomSolana-focused derivation
KeplrCosmos ecosystem derivation
SteakWalletAlternative derivation path
TempleTezos wallet derivation

Usage Examples

import { getSigningWallet, ImportableWallets } from '@stakekit/signers';
import { Networks } from '@stakekit/common';

const walletOptions = {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.MetaMask,
  index: 0,
};

const signingWallet = await getSigningWallet(Networks.Ethereum, walletOptions);
const address = await signingWallet.getAddress();

console.log('My wallet address:', address);

// Get unsigned transaction from Yield API
const unsignedTransaction = {}; // Your unsigned transaction

// Sign the transaction
const signedTx = await signingWallet.signTransaction(unsignedTransaction);

// Submit to network
// submitTransaction(signedTx);

Integration with Yield API

1

Get unsigned transaction

Call /v1/actions/enter or /v1/actions/exit to receive unsigned transactions
2

Create signing wallet

Use getSigningWallet() with your mnemonic and network
3

Sign transaction

Call signingWallet.signTransaction(unsignedTx)
4

Submit to network

Broadcast the signed transaction to the blockchain
import { getSigningWallet, ImportableWallets } from '@stakekit/signers';
import { Networks } from '@stakekit/common';

// 1. Get unsigned transaction from Yield API
const response = await fetch('https://api.yield.xyz/v1/actions/enter', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': process.env.YIELD_API_KEY,
  },
  body: JSON.stringify({
    yieldId: 'ethereum-eth-lido-staking',
    address: '0x...',
    arguments: { amount: '1000000000000000000' },
  }),
});

const action = await response.json();

// 2. Create signing wallet
const signingWallet = await getSigningWallet(Networks.Ethereum, {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.MetaMask,
  index: 0,
});

// 3. Sign each transaction
for (const tx of action.transactions) {
  const signedTx = await signingWallet.signTransaction(tx.unsignedTransaction);
  
  // 4. Submit to network
  // await submitTransaction(signedTx);
}

Custom Derivation Paths

You can derive different wallets from the same mnemonic by changing the index or walletType:
// Different account indices
const wallet0 = await getSigningWallet(Networks.Ethereum, {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.MetaMask,
  index: 0,  // First account
});

const wallet1 = await getSigningWallet(Networks.Ethereum, {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.MetaMask,
  index: 1,  // Second account
});

// Different wallet derivation paths
const metamaskWallet = await getSigningWallet(Networks.Ethereum, {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.MetaMask,
  index: 0,
});

const omniWallet = await getSigningWallet(Networks.Ethereum, {
  mnemonic: process.env.MNEMONIC,
  walletType: ImportableWallets.Omni,
  index: 0,
});

Development Setup

  1. Create .env file with variables from .env.example
  2. Install dependencies:
yarn install

Security Considerations

Never expose mnemonics in client-side code or commit them to version control. Use environment variables and secure key management.

Use environment variables

Store mnemonics in secure environment variables

Server-side signing

Perform signing operations on secure backend servers

Next Steps

Shield

Validate transactions before signing

Quickstart

Complete integration guide