Shyft
Start BuildingSupportWebsite
  • Welcome
    • 👋Introducing Shyft
    • 🏗️Start Building
  • Solana Infrastructure
    • 🚁Shyft RPCs
  • Yellowstone gRPC Network
    • Decoding gRPC Latency
    • ⚡gRPC Docs
      • Introduction
      • Authentication
      • Subscribe Requests
      • FAQ
      • Getting Started
        • Initializing the Yellowstone Client
        • Making a gRPC connection
        • Adding a Reconnection Mechanism
        • 🔥Replaying Slots with Solana yellowstone gRPCs
        • Modifying your Subscribe Request
        • Closing a gRPC Connection
      • Subscribing to Transactions
        • All Transactions of an address
        • Subscribing to all transactions of a Liquidity Pool
        • Subscribing to all transactions of multiple addresses
        • Subscribing to all transactions of a Token
      • Subscribing to Accounts
        • Account Updates for a Program
        • Account Updates for an Address
        • Account updates using memcmp
      • Streaming Blocks & BlocksMeta
        • Streaming Block Updates
        • Subscribing to BlocksMeta
      • Modifying & Unsubscribing
  • Solana defi data
    • DeFI APIs
      • Get Pool By Address
      • Get Pools By Token Pair
      • Get All Pools for a Token
      • Get Liquidity Details of a Pool
  • Callbacks
    • ☎️What are Callbacks?
      • Transaction Callbacks
      • Account Callbacks
    • 📔Callback APIs
      • Response Structure
      • List Callbacks
      • Register callback
      • Remove callback
      • 🔥Pause a callback
      • 🔥Resume a callback
      • Update Callbacks
      • Add Addresses
      • Remove addresses
  • Solana Super Indexers
    • 🌩️GraphQL APIs
      • Getting Started
      • Building Queries
      • Paginating Response
      • Applying Filters
      • Ordering and Sorting Data
    • 📀Case Studies
      • Tensor
        • Get Active Listings of a Wallet
        • Get Active Bids of a Wallet
        • Get Active Listings of a Collection
        • Get all Bids of a Collection
        • Get all Pools of a Margin Account
        • Get all Pools by Owner
      • Raydium
        • Get Pool By Address
        • Get Pools By Token Address
        • Get Pools Created Between Time
        • Get Pool Burn Percentage
        • Get Liquidity Details of a Pool
        • Get Pool and OpenBook Market Info
        • Get Token Supply Percentage In Pool
      • Orca Whirlpool
        • Get Pool by Address
        • Get Pool by Token Address
        • Get Positions for a Pool
        • Get Positions for a Wallet
        • Get Liquidity Details of a Pool
      • Kamino
        • Get Borrow Details of a Wallet
        • Get Deposit Details of a Wallet
        • Get Reserve Details
      • Cross Marketplace Queries
        • Get active listings across marketplaces for a wallet
        • Get listings for a collection across marketplaces
        • Get floor price of a collection
      • Cross Defi Queries
        • Fetch Liquidity Pools for Token
      • Native Staking
        • Get Stakes for a Wallet
        • Get Stakes For Validator
      • Governance/Realms
        • Get DAO Token Owners
        • Get Proposals For Governing Mint
        • Get All Proposals For DAO
        • Get DAO Treasury Info
        • Get All Active Proposals For Wallet
      • Meteora
        • Get All LB Position Pairs
        • Get Position of a User Wallet
        • Get Pool by Token Addresses
        • Get All Deposits for a User
        • Get All Withdraws for a User
        • Get All Fees Claimed by a User
        • Get All User Positions and Deposits for a Pool
        • Get All User Positions and Withdrawals for a Pool
      • Fluxbeam
        • Get Pool by Address
        • Get Pool by Token Addresses
      • Drift
        • Get User account for Delegate
        • Get User accounts based on authority
        • Get User details based on Referrer
        • Get Borrow/Deposit Amount for an User
        • Get PrepPositions for an User Account
        • Getting OrderId and userOrderId
        • Get OpenOrders for a User Account
      • 🔥Pumpswap
        • 🔥Get Pool by Address
        • 🔥Get Pool by Creator Address
        • 🔥Get Pools by Token Addresses
      • Raydium Launchpad
        • Get Bonding Curve Details by Pool Address
        • Get All Pools for a Creator
        • Get Pools by Token Addresses
        • Get Migration details of a Pool
  • Solana APIs
    • API Reference
    • Transactions
      • Parsed Transaction Structure
      • Transaction APIs
        • History
        • Parse Signature
        • Parse Multiple Signatures
        • Send
        • Send Multiple
    • NFT
      • 🔥Create Gasless
      • Create
      • Read All
      • Burn
      • 🔥Burn Multiple NFTs V2
      • Update
      • 🔥Create NFT from Metadata
      • 🔥Read Wallet Nfts
      • 🔥Read Selected NFTs
      • 🔥Get NFT Owners
      • 🔥Update NFT Metadata Uri
      • 🔥Update V2
      • Search
      • Transfer
      • Transfer Multiple NFTs
      • Mint
      • Read
    • Wallet
      • Get Balance
      • Get Token Balance
      • Get All Tokens Balance
      • Get Portfolio
      • Resolve Address
      • Get All Domains
      • Get Stake Accounts
    • Fungible Tokens
      • Create
      • Mint
      • Burn
      • 🔥Update
      • Get Token Info
      • Transfer
      • Airdrop
  • 📘Dev Guides
    • 📀gRPC Case Studies
      • Pumpfun
        • Streaming and Parsing Pump.fun Transactions
        • Streaming and Parsing Pump.fun Accounts
        • Detecting new Token launches on Pump.fun
        • Detecting Buy/Sell Transactions on Pump.fun
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • PumpSwap AMM
        • Streaming and Parsing Pump Swap Transactions
        • Streaming and Parsing Pump Swap AMM Accounts
        • Detecting Buy/Sell Transactions on Pump Swap AMM
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • Raydium AMM
        • Streaming and Parsing Raydium AMM Transactions
        • Streaming and Parsing Raydium AMM Accounts
        • Detecting Buy/Sell Transactions on Raydium AMM
        • Detecting new Pools on Raydium AMM
      • Raydium CLMM
        • Streaming and Parsing Raydium CLMM Transactions
        • Streaming and Parsing Raydium CLMM Accounts
      • Raydium CPMM
        • Streaming and Parsing Raydium CPMM Transactions
        • Streaming and Parsing Raydium CPMM Accounts
      • Raydium Launchpad
        • Streaming and Parsing Raydium Launchpad Transactions
        • Streaming and Parsing Raydium Launchpad Accounts
      • Meteora DAMM v2
        • Streaming and Parsing Meteora DAMM v2 Transactions
        • Streaming and Parsing Meteora DAMM v2 Accounts
Powered by GitBook
On this page
  • Parse Transaction Signature
  • GET /transaction/parsed
  • Transaction History
  • GET /transaction/history
  • Parse Multiple Transaction Signatures
  • POST /transaction/parse_selected
  • Send Transaction
  • POST /transaction/send_txn
  • Send Multiple Transactions
  • POST /transaction/send_many_txns

Was this helpful?

  1. Solana APIs
  2. Transactions

Transaction APIs

Developer friendly transaction APIs.

Transaction history is only limited to past 3-4 days. From both RPCs and APIs.

Parse Transaction Signature

This endpoint returns the parsed transaction details for a given txn signature.

Transaction history is only limited to past 3-4 days. From both RPCs and APIs.

GET /transaction/parsed

Query Params:

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • txn_signature: Transaction signature

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/transaction/parsed?network=mainnet-beta&txn_signature=3teBNmcLtXHWKFNWhkF8n4vJpyverF5njLK7xwyafydubNfUT8R9zZyEA8VkiUUAethwVavTJbPKCvhcfj8vN4AP", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
{
    "success": true,
    "message": "Transaction details fetched successfully",
    "result": {
        "timestamp": "2023-01-19T09:48:43.000Z",
        "fee": 0.000005,
        "fee_payer": "BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx",
        "actions": [
            {
                "info": {
                    "amount": 100,
                    "receiver_address": "EsqozjiKUYMk2ToApSTyxJqvj5iqLWJoyuUg3wpAPdtL",
                    "token_address": "7yPeRofJpfPkjLJ8CLB7czuk4sKG9toXWVq8CcHr4DcU"
                },
                "type": "TOKEN_MINT"
            }
        ],
        "signers": [
            "BvzKvn6nUUAYtKu2pH3h5SbUkUNcRPQawg4bURBiojJx"
        ],
        "signatures": [
            "3teBNmcLtXHWKFNWhkF8n4vJpyverF5njLK7xwyafydubNfUT8R9zZyEA8VkiUUAethwVavTJbPKCvhcfj8vN4AP"
        ]
    }
}

Transaction History

Fetches a list of parsed transactions for an on-chain account. The response returns the transactions with the latest transactions first. The response can have results of a maximum of 100 transactions in 1 single API call.

Transaction history is only limited to past 3-4 days. From both RPCs and APIs.

GET /transaction/history

Query Params:

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • account: account address

  • tx_num: (optional) How many transactions (maximum 100 transactions at a time) do you want to fetch

  • before_tx_signature: (optional) Tx signature before which X number of transactions will be fetched, in reverse order going back in time

  • until_tx_signature: (optional) Tx signature until which X number of transactions will be fetched, in reverse order going back in time

  • enable_raw: (optional) boolean to send raw data along with parsed information. Send 'true' from raw data

  • enable_events: (optional) boolean to send parsed anchor events along with parsed information.

  • commitment: (optional) confirmed (default) or finalized.

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<API-KEY>");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch(
  "https://api.shyft.to/sol/v1/transaction/history?network=mainnet-beta&tx_num=2&account=Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj&enable_raw=true",
  requestOptions
)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
{
    "success": true,
    "message": "Transaction history fetched successfully",
    "result": [
        {
            "timestamp": "2023-02-17T05:59:59.000Z",
            "fee": 0.000005,
            "fee_payer": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
            "signers": [
                "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
            ],
            "signatures": [
                "WVvRzZbHCSuji7MuQxbzV9X7YtUUNvNpBdLrw3qudHrqw8Mn3nKu3WXtR9CfEqctLav9NyDS7HnxYHmD6PpEoab"
            ],
            "protocol": {
                "address": "11111111111111111111111111111111",
                "name": ""
            },
            "type": "SOL_TRANSFER",
            "actions": [
                {
                    "info": {
                        "sender": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
                        "receiver": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                        "amount": 0.1
                    },
                    "source_protocol": "11111111111111111111111111111111",
                    "type": "SOL_TRANSFER"
                }
            ],
            "raw": {
                "blockTime": 1676613599,
                "meta": {
                    "computeUnitsConsumed": 0,
                    "err": null,
                    "fee": 5000,
                    "innerInstructions": [],
                    "logMessages": [
                        "Program 11111111111111111111111111111111 invoke [1]",
                        "Program 11111111111111111111111111111111 success"
                    ],
                    "postBalances": [
                        39019203960013220,
                        12380456480,
                        1
                    ],
                    "postTokenBalances": [],
                    "preBalances": [
                        39019204060018216,
                        12280456480,
                        1
                    ],
                    "preTokenBalances": [],
                    "rewards": [],
                    "status": {
                        "Ok": null
                    }
                },
                "slot": 196287434,
                "transaction": {
                    "message": {
                        "accountKeys": [
                            {
                                "pubkey": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
                                "signer": true,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                                "signer": false,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "11111111111111111111111111111111",
                                "signer": false,
                                "source": "transaction",
                                "writable": false
                            }
                        ],
                        "addressTableLookups": null,
                        "instructions": [
                            {
                                "parsed": {
                                    "info": {
                                        "destination": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                                        "lamports": 100000000,
                                        "source": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
                                    },
                                    "type": "transfer"
                                },
                                "program": "system",
                                "programId": "11111111111111111111111111111111"
                            }
                        ],
                        "recentBlockhash": "47xjhFKQL8GAfCJdmA29qUKzzb84s3hbY8sT2oeoY3iL"
                    },
                    "signatures": [
                        "WVvRzZbHCSuji7MuQxbzV9X7YtUUNvNpBdLrw3qudHrqw8Mn3nKu3WXtR9CfEqctLav9NyDS7HnxYHmD6PpEoab"
                    ]
                },
                "version": "legacy"
            }
        },
        {
            "timestamp": "2023-02-17T05:55:54.000Z",
            "fee": 0.000005,
            "fee_payer": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
            "signers": [
                "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
            ],
            "signatures": [
                "4RGrpBwAmZAKkC4endaRdZPZd9w2d6XEorjScNfa3HqFoH8v74NQBC1MgFYe8V9nQctaB6FGyzmVJTYKQg4Vg8cn"
            ],
            "protocol": {
                "address": "11111111111111111111111111111111",
                "name": ""
            },
            "type": "SOL_TRANSFER",
            "actions": [
                {
                    "info": {
                        "sender": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
                        "receiver": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                        "amount": 0.1
                    },
                    "source_protocol": "11111111111111111111111111111111",
                    "type": "SOL_TRANSFER"
                }
            ],
            "raw": {
                "blockTime": 1676613354,
                "meta": {
                    "computeUnitsConsumed": 0,
                    "err": null,
                    "fee": 5000,
                    "innerInstructions": [],
                    "logMessages": [
                        "Program 11111111111111111111111111111111 invoke [1]",
                        "Program 11111111111111111111111111111111 success"
                    ],
                    "postBalances": [
                        39019308060298216,
                        12280456480,
                        1
                    ],
                    "postTokenBalances": [],
                    "preBalances": [
                        39019308160303220,
                        12180456480,
                        1
                    ],
                    "preTokenBalances": [],
                    "rewards": [],
                    "status": {
                        "Ok": null
                    }
                },
                "slot": 196286805,
                "transaction": {
                    "message": {
                        "accountKeys": [
                            {
                                "pubkey": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g",
                                "signer": true,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                                "signer": false,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "11111111111111111111111111111111",
                                "signer": false,
                                "source": "transaction",
                                "writable": false
                            }
                        ],
                        "addressTableLookups": null,
                        "instructions": [
                            {
                                "parsed": {
                                    "info": {
                                        "destination": "Apeng15Pm8EjpAcaAXpNUxZjS2jMmGqikfs281Fz9hNj",
                                        "lamports": 100000000,
                                        "source": "9B5XszUGdMaxCZ7uSQhPzdks5ZQSmWxrmzCSvtJ6Ns6g"
                                    },
                                    "type": "transfer"
                                },
                                "program": "system",
                                "programId": "11111111111111111111111111111111"
                            }
                        ],
                        "recentBlockhash": "HzRoRypHdBkbgF4sP5YEq7Ucj3yUTzxPU5fTDcLmdVxR"
                    },
                    "signatures": [
                        "4RGrpBwAmZAKkC4endaRdZPZd9w2d6XEorjScNfa3HqFoH8v74NQBC1MgFYe8V9nQctaB6FGyzmVJTYKQg4Vg8cn"
                    ]
                },
                "version": "legacy"
            }
        }
    ]
}

Parse Multiple Transaction Signatures

Fetch parsed bulk transactions in a single call.

Transaction history is only limited to past 3-4 days. From both RPCs and APIs.

POST /transaction/parse_selected

Body params:

  • network: Solana blockchain environment (testnet/devnet/mainnet-beta)

  • transaction_signatures: array of strings) Selected transaction signatures (minimum 1 and maximum 100 transactions could be fetched)

  • enable_raw: (optional) boolean to send raw data along with parsed information. Send 'true' from raw data

  • enable_events: (optional) boolean to send parsed anchor events along with parsed information.

  • commitment: (optional) confirmed (default) or finalized.

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");

var raw = JSON.stringify({
  "network": "mainnet-beta",
  "transaction_signatures": [
    "67BJFsmeLhpPWLonvXyi46dh4UszCHZCWecUznfAdGX2KGEJxxGCoTiKAixMgZsBJBGTUQsDNHf697BQLceRdfd9",
    "4NcmYNHKAdTFnm8y78wQoKMmGCedhTVFrWeHdEGYaThY4AYQ96fbeADY48B7XSgDz6RCZUDqnNPVWay34M18yXmg"
  ],
  "enable_raw": false,
  "enable_events": true
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/transaction/parse_selected", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
{
    "success": true,
    "message": "Selected transactions fetched successfully",
    "result": [
        {
            "timestamp": "2023-10-27T10:41:34.000Z",
            "fee": 0.0000066,
            "fee_payer": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC",
            "signers": [
                "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC"
            ],
            "signatures": [
                "67BJFsmeLhpPWLonvXyi46dh4UszCHZCWecUznfAdGX2KGEJxxGCoTiKAixMgZsBJBGTUQsDNHf697BQLceRdfd9"
            ],
            "protocol": {
                "address": "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY",
                "name": "BUBBLEGUM"
            },
            "type": "COMPRESSED_NFT_TRANSFER",
            "status": "Success",
            "actions": [
                {
                    "info": {
                        "tree_authority": "zGyFUsKhko78FD7mpSZWsF4qjhWLsZZfmiA6pw7FvKd",
                        "merkle_tree": "7FjaYxpXjDteyhw12CQr7K3GQUQvEw98qZbBGQfBpACk",
                        "sender": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC",
                        "receiver": "DPznZBrcA3jHB2TMtXQcJhp1eKmoQV1o2kgEJxMT2kwa",
                        "nft_address": "3X5TMvbL3FWwAxBpQZeKFXtbNo3FYU3gjdg9CzQcyiuJ",
                        "update_authority": "Cvy11EnXf18VPS6MHJ3nQ6PopuJuctBpZrrJ6fUp83RC"
                    },
                    "source_protocol": {
                        "address": "BGUMAp9Gq7iTEuizy4pqaxsTyUCBK68MDfK752saRPUY",
                        "name": "BUBBLEGUM"
                    },
                    "type": "COMPRESSED_NFT_TRANSFER"
                }
            ],
            "events": []
        },
        {
            "timestamp": "2023-10-27T11:38:42.000Z",
            "fee": 0.000005,
            "fee_payer": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
            "signers": [
                "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt"
            ],
            "signatures": [
                "4NcmYNHKAdTFnm8y78wQoKMmGCedhTVFrWeHdEGYaThY4AYQ96fbeADY48B7XSgDz6RCZUDqnNPVWay34M18yXmg"
            ],
            "protocol": {
                "address": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp",
                "name": "FOXY_CITRUS"
            },
            "type": "REPAY_LOAN",
            "status": "Success",
            "actions": [
                {
                    "info": {
                        "lender": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
                        "borrower": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
                        "loan": "BJbH1z8vbjQ5WmknjGgqiTxUUUjs8YeaeNtKsRvRhHro",
                        "currency": "So11111111111111111111111111111111111111112",
                        "amount": 13.431017779,
                        "fee_paid": null,
                        "nft_address": "2C5M6bNjnEgfZbSZdaX1eTyRYg13fPPeKHy7PriVrRzT",
                        "escrow": "",
                        "escrow_token_account": "",
                        "order_book": "",
                        "admin_payment": null,
                        "payback_to_liq_owner": null
                    },
                    "source_protocol": {
                        "address": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp",
                        "name": "FOXY_CITRUS"
                    },
                    "type": "REPAY_LOAN"
                },
                {
                    "info": {
                        "sender": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
                        "receiver": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
                        "amount": 13.431017779
                    },
                    "source_protocol": {
                        "address": "11111111111111111111111111111111",
                        "name": "SYSTEM_PROGRAM"
                    },
                    "type": "SOL_TRANSFER",
                    "parent_protocol": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp"
                },
                {
                    "info": {
                        "sender": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
                        "receiver": "7e7qhwnJuLVDGBiLAGjB9FxfpizsPhQjoBxkNA5wVCCc",
                        "amount": 0.020162666
                    },
                    "source_protocol": {
                        "address": "11111111111111111111111111111111",
                        "name": "SYSTEM_PROGRAM"
                    },
                    "type": "SOL_TRANSFER",
                    "parent_protocol": "JCFRaPv7852ESRwJJGRy2mysUMydXZgVVhrMLmExvmVp"
                }
            ],
            "events": [
                {
                    "data": {
                        "loanAccount": "BJbH1z8vbjQ5WmknjGgqiTxUUUjs8YeaeNtKsRvRhHro",
                        "lender": "HX66hhr7Ga5dS9M5wsQySGsaugdYx4kvPSfG4pVE72WJ",
                        "borrower": "AD6h853HkrjmK1nGRmrVrDHEQj9To3zoQs3DvpbiPTKt",
                        "mint": "2C5M6bNjnEgfZbSZdaX1eTyRYg13fPPeKHy7PriVrRzT",
                        "collectionConfig": "8nU7L3os6vhYQrx2dYvDMzEeZt5XEq52ToZbAqZZp8Wa",
                        "status": {
                            "repaid": {}
                        },
                        "loanTerms": {
                            "apyBps": 24000,
                            "duration": 259200,
                            "principal": 13296600000
                        },
                        "creationTime": 1698233153,
                        "startTime": 1698255801,
                        "endTime": 1698406722,
                        "fox": false,
                        "tokenAccount": "DaJFRQtMSFpT2eK98sFQUjtLM8QTm8QfFf7kDGiSCcNv",
                        "rulesAcc": null,
                        "mortgage": false,
                        "private": false,
                        "offerType": {
                            "global": {}
                        },
                        "listingPrice": 0,
                        "ltvTerms": {
                            "ltvBps": 8300,
                            "maxOffer": 15000000000
                        },
                        "pool": false,
                        "listedLoan": null
                    },
                    "name": "LoanUpdate"
                }
            ]
        }
    ]
}

Send Transaction

This API endpoint lets you submit your signed transaction into the Solana blockchain, via Shyft's dedicated RPC node, which reduces the risk of transaction drop to near 0.

API Working:

This endpoint can be used to submit transactions to blockchain using Shyft dedicated RPC nodes.

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

async createSignedSerializedTxn(encodedTransaction: string, fromPrivateKey: string) : string {
  try {    
    const connection = new Connection(clusterApiUrl("devnet"), 'confirmed');
    const feePayer = Keypair.fromSecretKey(decode(fromPrivateKey));
    const recoveredTransaction = Transaction.from(Buffer.from(encodedTransaction, 'base64'));
   recoveredTransaction.partialSign(feePayer);

    // This is the way that signed transactions can be serialized in base64 format. Needed to make a successful API call.
    const txnToSendBackToShyft = recoveredTransaction.serialize().toString('base64');
    return txnToSendBackToShyft;
  } catch (error) {
    console.log(error);    
  }
}

POST /transaction/send_txn

Body params:

  • network: string [mainnet-beta, devnet]

  • encoded_transaction: string - Base64 encoded and signed transaction string.

var myHeaders = new Headers();
myHeaders.append("x-api-key", "<YOUR_API_KEY>");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "network": "devnet",
  "encoded_transaction": "AVmMGj3kZrTdbQ+nFT55d59kaNkGvakYRJJ1ZFlyoSkIZSGNmjM2nAd+5YPj1kJh7uVCS+4kpZoy1X8f/k5dSAIBAAIFoml4osSZRwXqi2onReASLw930fViKFqc8clj9mwcrHlnmECCqlsIMcbFpqlapSWdgN1oYDA1x0VtmheYQvu7gc4uKRKiVfHE4b4WyDLcyJDaRxpH/74SupaQfQnHam2RBUpTWpkpIQZNJOhxYNo4fHw1td28kruB5B+oQEEFRI0G3fbh12Whk9nL4UbO63msHLSF7V9bN5E6jPWFfv8AqXwrKau0iGDsINwwNq2yz3B2rQ48PACETYKxI6KT9uTnAgQDAQIACg4A5AtUAgAAAAkDAQAXU2h5ZnQgbWFrZXMgbGlmZSBlYXNpZXI="
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/transaction/send_txn", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
{
    "success": true,
    "message": "Transaction successfully submitted to blockchain",
    "result": {
        "signature": "2nqhCpcSHmKj4dcNPaatqQZp7hwP2msXXbQVVpyv6sFn5MwsXgxiUUpb84PUGD7RJidDXmoDZEABtzgwfitPsJZF"
    }
}

Send Multiple Transactions

This API endpoint lets you send bulk transactions to Solana blockchain, via Shyft's dedicated RPC node, which reduces the risk of transaction drop to near 0.

POST /transaction/send_many_txns

Body params:

  • network: string - [mainnet-beta, devnet]

  • encoded_transactions: string - Array of base64 encoded and signed transaction strings (maximum 100).

  • commitment (optional): processed, confirmed, finalized. API returns after the desired commitment level is reached for all txs or they error out.

The response times may increase with commitment levels. System waits for the transactions to reach the required commitment level.

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "YOUR_API_KEY");

var raw = JSON.stringify({
  "network": "devnet",
  "encoded_transactions": [
    "ARfcRDj2D2q6Zib4/r9bBcDvONvJ9/lM+4834g2065NGTvQ5kEmIWepO1hTDV5oq6JYye75FJdIHBgk8TQrGcQwBAAEDGMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxVALAeVfwkorAqlrAeN8dOn8Jeu6H4u3ofHzGz4FntQPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/RWzWr+bM4lKfgjl47HKiqsxT/Jwcg1qYDkOI9MxN5wBAgIAAQwCAAAAQEIPAAAAAAA=",
    "AT3owiHF0oxDqa0Mhqisawdq2sf0mb58TVe/REYwnFZOU1nB5uK9Fu9m/8z1ojVhHrZqdwvp22PXgzpvD0gKpwEBAAEDGMqfUcVHHu2+lyU5gx9wU2rGxk2NoSXtodMSdev+DxUsLagmF5c4a6vJhMr74YTUznxniMs9+z4QYlMJ1x2b+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoEdavLhXjxh1GQUyHcxHwCsR71IQrPe3nJ88rb7cqJUBAgIAAQ"
  ],
  "commitment": "finalized"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.shyft.to/sol/v1/transaction/send_many_txns", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
{
    "success": true,
    "message": "Transactions are successfully submitted to blockchain",
    "result": [
        {
            "id": 1,
            "signature": "UfnRjNLyu9AnoBG27tre9D4XEQN32WVbnoPnkPd3j1wpxfQWt5qd6xiKPuTfbmkTA9kDXGJeXjQ4gusvUFgHGm9",
            "status": "finalized"
        },
        {
            "id": 2,
            "error": {
                "code": -32602,
                "message": "invalid base64 encoding: InvalidPadding"
            },
            "status": null
        }
    ]
}
PreviousParsed Transaction StructureNextNFT

Last updated 4 months ago

Was this helpful?

NOTE: Above code snippet uses private keys for signing a txn, but a txn can be signed using wallet adapters as well. Please refer to this function for signing using wallet adapter ()

https://github.com/Shyft-to/community-projects/blob/f2552c5e809a517ac9820dda0008d06f1d9e0013/demo-hh/src/shyft.js#L23