Integrations Vanilla Languages JavaScript & TypeScript

JavaScript & TypeScript

Generate raw unsigned transactions with Arrow API, deserialize them with @solana/web3.js, and hand them off to the wallet or signing flow of your choice.

JavaScriptTypeScript

Create SOL Transfer Transaction Data

Request a serialized, unsigned SOL transfer that you can forward to any wallet for signing.

import { Transaction } from '@solana/web3.js';

const response = await fetch('https://arrow-api.yatori.io/v1/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,
});
JavaScriptTypeScript

Create Token Transfer Transaction Data

Generate SPL token transfer payloads, ready to deserialize and sign without pulling in extra tooling.

import { Transaction } from '@solana/web3.js';

const response = await fetch('https://arrow-api.yatori.io/v1/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,
});