send_transaction
Installation
pip install karrotcapital.spiderswapUsage
Initialization
First, initialize the 'Spiderswap' class with your API key.
from karrotcapital.spiderswap import Spiderswap
spiderswap = Spiderswap(ApiKey);Method: send_transaction
Description
The 'send_transaction' method sends a Solana transaction to the blockchain, handling retries and confirmation.
Parameters
'rpc_endpoint'(str): The RPC endpoint to send the transaction to.'transaction'(VersionedTransaction): The transaction object to be sent.'private_key'(str): The private key of the sender, encoded in base58.'additional_signers'(List[str] | None): The additional signers that need to sign the transaction for it to be sent (Default isNone).'retries'(float): The amount of retries this function will try to do to execute the transaction (Default is 3).
Returns
'str': A str that resolves to the transaction signature.
Example
This example demonstrates how to use 'get_swap', 'create_transaction', and 'send_transaction' 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