Loading...
Preparing to open Cursor
Preparing to open Cursor
Preparing to open Cursor
Download Cursor to get started. Available for macOS, Windows, and Linux.
Download CursorI want to integrate Flashnet's trading SDK into my product. Flashnet is the first permissionless, non-custodial, Bitcoin-native exchange stack. Here's a working code sample:
import { FlashnetClient, BTC_ASSET_PUBKEY } from '@flashnet/sdk';
import { SparkWallet } from '@buildonspark/spark-sdk';
const { wallet } = await SparkWallet.initialize({
mnemonicOrSeed: process.env.MNEMONIC,
options: { network: "REGTEST" }
});
const client = new FlashnetClient(wallet);
await client.initialize();
const pools = await client.listPools({ sort: "TVL_DESC", limit: 10 });
const topPool = pools.pools[0];
const poolDetails = await client.getPool(topPool.lpIdentityPublicKey);
const swap = await client.executeSwap({
poolId: topPool.lpIdentityPublicKey,
assetInAddress: BTC_ASSET_PUBKEY,
assetOutAddress: poolDetails.assetBAddress,
amountIn: 10000000n,
minAmountOut: 99000000n,
maxSlippageBps: 100
});
Help me understand this SDK and build a trading product with it. What can I build — swaps, AMMs, exchanges? Give me concrete examples and next steps.
Docs: https://docs.flashnet.xyz/products/flashnet-amm/setupDownload Cursor to get started. Available for macOS, Windows, and Linux.
Download CursorI want to integrate Flashnet's trading SDK into my product. Flashnet is the first permissionless, non-custodial, Bitcoin-native exchange stack. Here's a working code sample:
import { FlashnetClient, BTC_ASSET_PUBKEY } from '@flashnet/sdk';
import { SparkWallet } from '@buildonspark/spark-sdk';
const { wallet } = await SparkWallet.initialize({
mnemonicOrSeed: process.env.MNEMONIC,
options: { network: "REGTEST" }
});
const client = new FlashnetClient(wallet);
await client.initialize();
const pools = await client.listPools({ sort: "TVL_DESC", limit: 10 });
const topPool = pools.pools[0];
const poolDetails = await client.getPool(topPool.lpIdentityPublicKey);
const swap = await client.executeSwap({
poolId: topPool.lpIdentityPublicKey,
assetInAddress: BTC_ASSET_PUBKEY,
assetOutAddress: poolDetails.assetBAddress,
amountIn: 10000000n,
minAmountOut: 99000000n,
maxSlippageBps: 100
});
Help me understand this SDK and build a trading product with it. What can I build — swaps, AMMs, exchanges? Give me concrete examples and next steps.
Docs: https://docs.flashnet.xyz/products/flashnet-amm/setup