Skip to content

Documentation / @frak-labs/core-sdk / actions / sendTransaction

Function: sendTransaction()

sendTransaction(client, args): Promise<{ hash: `0x${string}`; }>

Defined in: actions/wrapper/sendTransaction.ts:47

Function used to send a user transaction, simple wrapper around the displayModal function to ease the send transaction process

Parameters

client

FrakClient

The current Frak Client

args

The parameters

metadata?

ModalRpcMetadata

Custom metadata to be passed to the modal

tx

SendTransactionTxType | SendTransactionTxType[]

The transaction to be sent (either a single tx or multiple ones)

Returns

Promise<{ hash: `0x${string}`; }>

The hash of the transaction that was sent in a promise

Example

const { hash } = await sendTransaction(frakConfig, {
    tx: {
        to: "0xdeadbeef",
        value: toHex(100n),
    },
    metadata: {
        header: {
            title: "Sending eth",
        },
        context: "Send 100wei to 0xdeadbeef",
    },
});
console.log("Transaction hash:", hash);