Skip to content

addTxIntention

addTxIntention(config, intention, from?): Promise<TransactionIntention>

Creates a transaction intention with the provided parameters. This is a low-level utility for preparing a transaction intention object, typically used internally by higher-level transaction flows.

Import

ts
import { addTxIntention } from "@midl/executor";

Example

ts
import { addTxIntention } from "@midl/executor";

const intention = await addTxIntention(config, {
  // ...partial intention fields
});

Parameters

NameTypeDescription
configConfigThe configuration object.
intentionPartialIntentionThe intention to add.
fromstring (optional)The BTC Address of the account to sign the transaction with. If omitted, the default account is used.

PartialIntention

NameTypeDescription
evmTransactionTransactionSerializableBTC & { from?: Address }EVM transaction details (with optional from address)
depositDepositOptional deposit details. Satoshis and/or runes to deposit.
withdrawWithdrawalOptional withdraw details. Satoshis and/or runes to withdraw.

Deposit

NameTypeDescription
satoshisnumber (optional)Amount in satoshis to deposit. If not provided, it will deposit all available balance.
runesRunesTransfer[] (optional)Array of runes to transfer. If not provided, it will not deposit any runes.

Withdrawal

NameTypeDescription
satoshisnumber (optional)Amount in satoshis to withdraw. If not provided, it will withdraw all available balance.
runesRunesTransfer[] (optional)Array of runes to transfer. If not provided, it will not withdraw any runes.

RunesTransfer

NameTypeDescription
idstringThe rune ID, in the format blockHeight:txIndex
amountbigintThe amount to transfer
addressAddressERC20 address of the rune

Returns

Promise<TransactionIntention> — The added intention object.