EthersV5 <> Peanut Transaction Types

The SDK returns an unsigned transaction object with the following fields:

interface IPeanutUnsignedTransaction {
	from?: string
	to?: string
	data?: string
	value?: BigInt
}

Do you want to convert this to a transaction type that can be passed into an EthersV5 signer to send the transaction? You can use the following utils function:

const peanutTransaction // get this from any prepare function

const convertedTransaction = peanutToEthersV5(peanutTransaction)

Or the other way around:

const ethersV5transaction

const convertedTransaction = ethersV5ToPeanutTx(ethersV5transaction)

Last updated