📈Transaction
Transactions for zkFi protocol can be created via TransactionRequest, TransactionOptions
types of the Labyrinth SDK. A TransactionRequest
object has the following fields:
type
A TransactionType
enum to define the type of transaction - DEPOSIT
, WITHDRAW
, TRANSFER
, and CONVERT
. The types specify what you want to do with your account's assets.
DEPOSIT
: To specify that you want to fund a shielded account from your public wallet i.e. it tops up the shielded account specified into
the field.WITHDRAW
: You may want to withdraw assets from your shielded account to your regular wallet address. This is what this type is for. Theto
field in this case must be a plain wallet address.TRANSFER
: This is to perform a fully private transfer of assets from your shielded account to another shielded account.CONVERT
: This is the special one to perform a transaction with any protocol that integrates with Labyrinth. e.g. to swap with Uniswap, lend on Aave, stake on Lido, etc. Theto
must be the address of the target protocols' "adaptor" contract. See more [here].
assetIds
Specify a list of Labyrinth's assetId
s of the asset/token you intend to transact. You can get a list of all supported assets from contractService::getAssets()
.
values
The corresponding values of assetIds
you are transacting, in the same order.
to
The shielded address or public address to deposit, transfer or withdraw funds to. Or it could be the address of the integrated protocols' proxy contract.
payload
The optional arbitrary data that may be needed by adaptor contract to function, in case of a CONVERT
type transaction. It is empty (0x
) by default. Feel free to refer the Uniswap integration example to understand this better.
Transaction Options
You can modify the default options to change some parameters of the transactions by passing TransactionOptions
object. Current available options are as follows:
revokerId
: The ID of the revoker chosen. You can query the registered revoker details fromcontractSource::getRevoker(...)
.viaBundler
: This is a boolean to specify if the prepared transactions will be sent via a bundler. This parameter affects the values used to generate proof and pay gas fee.paymaster
: The paymaster address that should pay the fee, if the transaction is sent via bundler.
Last updated