send
Executes a Safe transaction from the connected Safe or sends it to the Safe Transaction Service if it isn't executable.
- If the
threshold
of the connected Safe is greater than1
, it creates the Safe transaction and submits it to the Safe Transaction Service to collect the signatures from the Safe owners. - If the
threshold
of the connected Safe is1
, it executes the Safe transaction. - If the connected Safe is not deployed, it deploys it using the funds from the connected signer to pay for the transaction fees, and executes the transaction or sends it to the Safe Transaction Service, depending on the
threshold
.
Usage
_24import { safeClient } from './setup.ts'_24_24const transactions = [{_24 to: '0x...',_24 data: '0x...',_24 value: '0',_24 operation: 1 // Optional_24},_24{_24 to: '0x...',_24 data: '0x...',_24 value: '0',_24 operation: 1 // Optional_24}]_24_24const txResult = await safeClient.send({_24 transactions,_24 from: '0x...', // Optional_24 gasLimit: '123', // Optional_24 gasPrice: '123', // Optional_24 maxFeePerGas: '123', // Optional_24 maxPriorityFeePerGas: '123', // Optional_24 nonce: 123 // Optional_24})
Returns
Promise<SafeClientResult>
The result of the Safe transaction sent.
Parameters
transactions.to
- Type:
string
The address of the recipient.
_10const txResult = await safeClient.send({_10 transactions: [{_10 to: '0x...',_10 value: '123',_10 data: '0x'_10 }]_10})
transactions.value
- Type:
string
The amount of native tokens that are transferred.
_10const txResult = await safeClient.send({_10 transactions: [{_10 to: '0x...',_10 value: '123',_10 data: '0x'_10 }]_10})
transactions.data
- Type:
string
The encoded transaction data.
_10const txResult = await safeClient.send({_10 transactions: [{_10 to: '0x...',_10 value: '123',_10 data: '0x'_10 }]_10})
transactions.operation
(Optional)
-
Type:
OperationType
-
Default:
1
The operation of the Safe transaction.
_10const txResult = await safeClient.send({_10 transactions: [{_10 to: '0x...',_10 value: '123',_10 data: '0x',_10 operation: 0_10 }]_10})
from
(Optional)
- Type:
string
The address of the transaction sender.
_10const txResult = await safeClient.send({_10 transactions,_10 from: '0x...'_10})
gasLimit
(Optional)
- Type:
stringnumber | string | bigint
The maximum amount of gas the transaction can use.
_10const txResult = await safeClient.send({_10 transactions,_10 gasLimit: '123'_10})
gasPrice
(Optional)
- Type:
number | string
The price in wei that the sender is willing to pay for each unit of gas.
_10const txResult = await safeClient.send({_10 transactions,_10 gasPrice: '123'_10})
maxFeePerGas
(Optional)
- Type:
number | string
The maximum fee per gas the sender is willing to pay.
_10const txResult = await safeClient.send({_10 transactions,_10 maxFeePerGas: '123'_10})
maxPriorityFeePerGas
(Optional)
- Type:
number | string
The maximum priority fee per gas the sender is willing to pay.
_10const txResult = await safeClient.send({_10 maxPriorityFeePerGas: '123'_10})
nonce
(Optional)
- Type:
number | string
The nonce of the transaction.
_10const txResult = await safeClient.send({_10 transactions,_10 nonce: 123_10})