Implementations
Here are example implementations showing how to integrate Arrow API into your JavaScript/TypeScript applications.
Create SOL Transfer Transaction Data
Create raw unsigned SOL transfer transaction data using Arrow API.
import { Transaction } from '@solana/web3.js';
const response = await fetch('https://kouba.io/sol-transfer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
from_address: fromAddress,
to_address: toAddress,
lamports: lamports.toString()
})
});
let transaction = response.data;
const deserializedTx = Transaction.from(transaction);
const blockhash = await // FETCH YOUR BLOCKHASH HERE //
deserializedTx.recentBlockhash = blockhash;
const serializedTransaction = deserializedTx.serialize({
requireAllSignatures: false,
});
Create Token Transfer Transaction Data
Create raw unsigned SPL token transfer transaction data using Arrow API.
import { Transaction } from '@solana/web3.js';
const response = await fetch('https://kouba.io/token-transfer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
from_address: fromAddress,
to_address: toAddress,
token_mint_address: tokenMint,
amount: amount.toString()
})
});
let transaction = response.data;
const deserializedTx = Transaction.from(transaction);
const blockhash = await // FETCH YOUR BLOCKHASH HERE //
deserializedTx.recentBlockhash = blockhash;
const serializedTransaction = deserializedTx.serialize({
requireAllSignatures: false,
});