sendTransaction
Installation
Usage
Initialization
First, initialize the 'Spiderswap'
class with your API key.
Method: sendTransaction
Description
The 'sendTransaction'
method sends a Solana transaction to the blockchain, handling retries and confirmation.
Parameters
'rpcEndpoint'
(string): The RPC endpoint to send the transaction to.'transaction'
(VersionedTransaction): The transaction object to be sent.'privateKey'
(string): The private key of the sender, encoded in base58.'additionalSigners'
(Array<string> | null, default null): The additional signers that need to sign the transaction for it to be sent.'retries'
(number, default 3): The amount of retries this function will try to do to execute the transaction.
Returns
'Promise<string>'
: A promise that resolves to the transaction signature.
Example
This example demonstrates how to use 'getSwap'
, 'createTransaction'
, and 'sendTransaction'
methods.
Implementation Details
This method attempts to send the transaction multiple times, updating the blockhash and signing the transaction each time. If it fails after a set number of retries, it throws an error.
Last updated