Quote a swap, prepare its deposit, and follow it through settlement. The SDK keeps amounts exact, checks transactions, and leaves signing to your wallet.
The package is private and targets the v0.5 API. Node.js 22+ is required for the API client. The runtime is a development foundation; use verified deployment settings and approved wallets.
You can use the HTTP API without installing an SDK. Start with your API URL and customer key:
curl "$API_URL/api/v1/limits" \
-H "Authorization: Bearer $EASYPATH_API_KEY"
The TypeScript SDK is currently distributed privately. The examples below are for customers who have received the package from EasyPath; a repository checkout is not required to use the HTTP API. There is no public npm installation to assume.
Keep the API client on your server. Use assets from your deployment configuration, including
the correct chain ID, mint or contract address, and token decimals. Chain IDs are CAIP-2, such as
solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp and eip155:4663 on mainnet.
import { EasyPath, createQuoteParams, formatAmount } from '@witches-brew/easypath-sdk';
const client = new EasyPath({
baseUrl: process.env.EASYPATH_API_URL!,
apiKey: process.env.EASYPATH_API_KEY!,
});
// assets, sender and recipient come from deployment configuration and wallet selection.
const params = createQuoteParams({
from: assets.SOL,
to: assets.ETH,
amount: '1.25',
sender,
recipient,
slippage: '0.5', // percent; omit for the server recommendation
});
// Record a quote attempt before this call. Call only after the customer requests a quote.
const quote = await client.quote(params);
await journal.saveQuote(quote); // finish durable storage before prompting the wallet
const estimate = formatAmount(quote.estimatedAmountOut, assets.ETH.decimals);
journal is application-owned recovery storage. Its writes must complete durably or throw,
and it must prevent a second attempt after a reload. The SDK does not provide persistence.
A quote creates an intent and reserves capacity. It is not a price preview. Do not request one on every keystroke, prefetch it, cache it, or automatically retry it. If its response is lost, an intent may still exist. See recovery.
Only import the browser-safe helpers into your frontend:
import { getReceiveAssets, parseAmount, formatAmount } from '@witches-brew/easypath-sdk/helpers';
const receiveChoices = getReceiveAssets(configuredAssets, selectedSendAsset);
parseAmount('1.25', 9); // '1250000000'
formatAmount('1250000000', 9); // '1.25'
For the four configured assets, SOL and USDC offer ETH and USDG as receive choices, and vice
versa. Asset objects can also carry symbol, name and logo; the helper preserves them.
It filters chain compatibility. The API decides which routes are enabled and available.
Never identify an asset only by its ticker or guess USDG's address or decimals.
client.relaySolanaDeposit. See wallet integration.prepareRobinhoodDeposit checks the configured vault and calldata. It returns
an optional approval and a deposit. Confirm the approval receipt before sending the deposit.for await (const status of client.poll(quote.intentId, { signal })) {
await journal.saveStatus(status);
// Update your UI from status.status and status.statusSeq.
}
filled means the destination fill was observed. settled also requires origin finality.
The iterator ends at settled, refunded, expired or failed; inspect the state instead of
treating completion as success. Aborting tracking never cancels a swap.
| Task | Method |
|---|---|
| Convert a form without a request | createQuoteParams(input) |
| Show a live, non-binding estimate while typing | client.price(params, signal?) |
| Create one intent | client.quote(params, signal?) |
| Check and relay saved Solana bytes | client.relaySolanaDeposit(quote, sender, signedTx, signal?) |
| Prepare verified EVM steps | prepareRobinhoodDeposit(quote, { vaultAddress }) |
| Format an EVM request for a browser wallet | toEvmWalletTransaction(tx, sender) |
| Read current state | client.status(intentId, signal?) |
| Follow states over HTTP | client.poll(intentId, { since?, signal? }) |
| Follow states over a Node WebSocket | client.watch(intentId, { signal?, maxReconnects? }) |
| Read capacity without reserving it | client.limits(signal?) |
The lower-level submit, wait, robinhoodDepositTransactions, and Solana instruction
helpers remain available. Prefer the verified deposit methods for new integrations.
Run npm run typecheck and npm test to check the SDK. Tests use local fixtures and test keys.
Generate the reference with npm --prefix ../docs run build after installing web/docs dependencies.