sdk documentation
ParasolDEX SDK
Everything you need to integrate ParasolDEX into your agent or application. TypeScript and Python SDKs with full x402 auto-pay and MPC wallet support.
The ParasolDEX SDK powers all swap operations. Point it at api.parasol.so and you're set.
npm install moltydexpip install moltydexTypeScript Quick Start
API client (no wallet needed)
for read-only operations like quotes and balance checks.
import { MoltyDEXClient } from 'moltydex';
const client = new MoltyDEXClient('https://api.parasol.so');
// get a swap quote
const quote = await client.getQuote(
'So11111111111111111111111111111111111111112', // SOL
'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC
'100000000', // 0.1 SOL in lamports
);
console.log(`output: ${quote.output_after_fee} USDC`);x402 auto-pay agent (with wallet)
full agent with wallet management and automatic 402 payment handling.
import { X402AutoPayAgent } from 'moltydex';
const agent = new X402AutoPayAgent({
apiUrl: 'https://api.parasol.so',
walletPath: './wallet.json',
autoSwap: true,
});
console.log(`agent wallet: ${agent.getWalletAddress()}`);
// when you get a 402 Payment Required response:
const result = await agent.handle402(paymentResponseBody);
if (result.success) {
console.log(`paid. signature: ${result.payment_signature}`);
}Python Quick Start
get a quote
from moltydex import MoltyDEX
dex = MoltyDEX(
api_url="https://api.parasol.so",
wallet_path="~/.config/solana/id.json",
)
quote = dex.quote(
token_in="So11111111111111111111111111111111111111112",
token_out="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
amount_in=100_000_000,
)
print(f"output: {quote['output_after_fee']} USDC")execute a swap
result = dex.swap(
token_in="So11111111111111111111111111111111111111112",
token_out="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
amount_in=100_000_000,
wait_for_confirmation=True,
)
print(f"swap signature: {result['signature']}")handle x402 payments
# when your agent gets a 402 response:
result = dex.handle_x402_payment(payment_402_response_body)
if result['ready']:
print("payment ready — sufficient balance")
else:
print(f"swap completed: {result['swap_result']['signature']}")
# or use one-call auto-pay:
result = dex.x402_auto_pay(
payment_response_body=response_402_body,
auto_swap=True,
)HTTP Interceptor (Zero-Config)
the fastest way to add x402 support. intercepts all fetch() calls and handles 402 responses transparently.
import { HTTPInterceptor } from 'moltydex';
const interceptor = new HTTPInterceptor({
apiUrl: 'https://api.parasol.so',
walletPath: './wallet.json',
autoSwap: true,
});
// all fetch() calls now auto-handle 402 Payment Required
const response = await fetch('https://some-x402-api.com/data');
// if it returns 402, the agent pays automatically and retries
// restore original fetch when done
interceptor.restore();x402 Auto-Pay Flow
when your agent calls an API that returns HTTP 402 Payment Required, ParasolDEX handles the entire payment flow:
manual x402 handling
import { MoltyDEXClient } from 'moltydex';
const client = new MoltyDEXClient('https://api.parasol.so');
// parse a 402 response body
const requirements = await client.parsePayment(response402Body);
// one-call auto-pay: checks balance, swaps if needed, pays
const result = await client.autoPay(
response402Body,
walletAddress,
'So11111111111111111111111111111111111111112', // pay from SOL
true, // autoSwap
);MPC Wallet Integration
MPC wallets let agents sign transactions without ever holding a raw private key. The key is split into encrypted fragments — no single party ever sees the full key. Powered by Turnkey.
security
raw private keys in config files are one leaked .env from a drained wallet. MPC eliminates this.
guardrails
spending limits, token allowlists, recipient restrictions. control what your agent can do with funds.
enterprise-ready
SOC 2 compliant. no compliance team will approve raw private keys. MPC removes that barrier.
TransactionSigner interface
pluggable signer — same agent code works with a local keypair or an MPC signer.
interface TransactionSigner {
getAddress(): string;
signTransaction(transactionBase64: string): Promise<string>;
}Turnkey MPC integration
import { X402AutoPayAgent } from 'moltydex';
const agent = new X402AutoPayAgent({
apiUrl: 'https://api.parasol.so',
turnkeyApiKey: 'your-turnkey-key',
createWallet: true,
autoSwap: true,
});
// agent now has its own wallet — no private key needed
console.log('agent wallet:', agent.getAddress());wallet management API
/api/wallet/createcreate a new MPC wallet for an agent/api/wallet/:idget wallet info and balances/api/wallet/:id/policyset spending limits and token allowlists/api/wallet/listlist all wallets in your organization| capability | raw keypair | MPC wallet |
|---|---|---|
| wallet creation | manual export | one API call |
| key security | full key in config | key never exists in one place |
| spending limits | custom code | built-in policy engine |
| audit trail | custom logging | full transaction history |
| enterprise-ready | no | SOC 2 compliant |
| fleet management | manual per agent | centralized dashboard |
API Reference
TypeScript — ParasolDEX Client
stateless API client. no wallet needed for read-only operations.
| method | description |
|---|---|
| getQuote(inputMint, outputMint, amount, slippageBps?) | get swap quote |
| buildSwapTransaction(wallet, inputMint, outputMint, amount) | build unsigned swap transaction |
| sendTransaction(signedTransaction) | send signed transaction |
| getTransactionStatus(signature) | check transaction status |
| getBalance(walletAddress, tokenMint) | check token balance |
| parsePayment(body) | parse x402 payment requirements |
| autoPay(body, wallet, inputToken?, autoSwap?) | one-call x402 auto-pay |
X402AutoPayAgent config
| field | type | description |
|---|---|---|
| apiUrl | string | ParasolDEX API URL |
| walletPath | string? | path to wallet JSON file |
| walletSecretKey | Uint8Array | string? | secret key (base58, array, or bytes) |
| preferredInputToken | string? | token to swap from (default: SOL) |
| autoSwap | boolean? | auto-swap if insufficient balance (default: true) |
| webhookUrl | string? | webhook for transaction updates |
| rpcUrl | string? | Solana RPC URL (default: mainnet) |
Python — ParasolDEX
| method | description |
|---|---|
| quote(token_in, token_out, amount_in) | get swap quote |
| swap(token_in, token_out, amount_in) | execute swap (build, sign, send) |
| swap_build(token_in, token_out, amount_in) | build unsigned transaction |
| get_balance(token_mint) | check token balance |
| parse_x402_payment(body) | parse 402 response |
| handle_x402_payment(body) | full x402 payment flow |
| x402_auto_pay(body) | one-call auto-pay |
| search_tokens(query) | search tokens |
| batch_balances(requests) | batch balance checks |
wallet configuration
// from file
new X402AutoPayAgent({
apiUrl: 'https://api.parasol.so',
walletPath: './wallet.json',
...
});
// from secret key
new X402AutoPayAgent({
apiUrl: 'https://api.parasol.so',
walletSecretKey: process.env.WALLET_KEY,
...
});# from file
dex = MoltyDEX(
api_url="https://api.parasol.so",
wallet_path="./wallet.json"
)
# from secret key bytes
dex = MoltyDEX(
api_url="https://api.parasol.so",
wallet_secret_key=[1, 2, 3, ...]
)
# from existing Keypair
from solana.keypair import Keypair
kp = Keypair()
dex = MoltyDEX(
api_url="https://api.parasol.so",
wallet_keypair=kp
)REST API Endpoints
Base URL: https://api.parasol.so
/api/quote?inputMint=...&outputMint=...&amount=...swap quote with price, fees, minimum output
/api/swap/buildbuild unsigned swap transaction for client-side signing
/api/balance?wallet=...&token=...check token balance for a wallet
/api/x402/parse-paymentparse a 402 Payment Required response body
/api/x402/auto-paycomplete x402 payment flow: balance → swap → pay
/api/ultra/orderJupiter Ultra: quote + ready-to-sign transaction in one call
/api/ultra/executeJupiter Ultra: submit signed transaction for execution
/api/ultra/holdings?wallet=...get wallet token balances via Jupiter Ultra
Common Token Addresses
| token | mint address |
|---|---|
| SOL | So11111111111111111111111111111111111111112 |
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
get your agent connected in under 5 minutes. zero platform fees. best prices via Jupiter.