signTransaction
Signs a transaction with multiple instructions using the user's private key so that it can be separately broadcast to the network
Parameters:
transfers: Array - the list of transfers to sign
type: string - the type of transfer to make (
solana_transfer
for a Solana transfer,spl_token_transfer
for an SPL token transfer)data: object - the transfer details
address: string - the address where the funds should be sent
[
solana_transfer
] lamports: number - the number of lamports to send (one billion lamports are in 1 SOL)[
spl_token_transfer
] token_address: string - the mint address of the tokenEITHER amount: number - the amount of tokens to send with the smallest denomination of tokens being represented by amount 1 (recommended)
OR amount_decimal: number - the decimal amount of tokens to send (not recommended)
Returns:
object ({"from": "...", "transfers": [...], "signature": "...", "serialized_transaction": Uint8Array [...]}
) - the transaction details
from: string (
"..."
) - the address from which Solana is senttransfers: Array (
[...]
) - the transfers of the transactionsignature: string (
"..."
) - the signature of the transactionserialized_transaction: Uint8Array (
Uint8Array [...]
) - the serialized transaction (which can be broadcasted to the network)
Throws:
SOL Pay SDK Fatal Error: Invalid transfers ${transfers}.
- invalid transfers were usedSOL Pay SDK Fatal Error: No connection found. Use SOLPay.connectNetwork() to connect to the Solana network.
- could not find a connection to the Solana networkSOL Pay SDK Fatal Error: No wallet connection found. Use SOLPay.connectWallet() to connect to a Solana wallet.
- no wallet was connectedSOL Pay SDK Fatal Error: Unable to get recent blockhash.
- was not able to get a recent blockhash
Note:
Sending a transaction includes a fee of at least 0.000005 SOL.
Last updated