Skip to content

Documentation / react-auth / useSendSolanaTransaction

Function: useSendSolanaTransaction()

useSendSolanaTransaction(callbacks?): Object

Use this hook to send a transaction using the embedded wallet and to attach callbacks for success and errors. Transactions sent from the embedded wallet using transaction functions from non-Privy libraries will not trigger the callbacks.

Parameters

callbacks?: Object

callbacks.onError?: (error) => void

Callback that will execute in the case of a non-successful sendTransaction.

Param [PrivyErrorCode]([object Object]) - the corresponding error code

callbacks.onSuccess?: (response) => void

Callback that will execute once a successful sendSolanaTransaction completes. This will not run in the case of a wallet-based authentication or link flow.

Param the response SolanaTransactionReceipt from the successful transaction

Returns

Object

sendSolanaTransaction - prompts the user send a transaction using their embedded wallet

sendSolanaTransaction

sendSolanaTransaction: (transaction, connection, uiOptions?, transactionOptions?) => Promise<SolanaTransactionReceipt>

Parameters

transaction: SupportedSolanaTransaction

connection: Connection

uiOptions?: SendTransactionModalUIOptions

transactionOptions?: SendTransactionOptions

Returns

Promise<SolanaTransactionReceipt>