Labyrinth
WhitepaperResearchGet Private Access
  • 🔭Labyrinth Overview
    • Introduction
    • Why Labyrinth?
    • Who can use Labyrinth?
    • Reward and Fee in Labyrinth
    • Compliance
  • ⭐Use Labyrinth web App
    • How to use the Labyrinth app?
  • 📦Labyrinth SDK
    • ❓What is Labyrinth SDK?
    • ⚒️Quickstart
      • Setup Environment
      • Initialization
      • Private Transactions
      • Balance And Transaction History
      • Protocol Integration
    • 1️⃣Getting Started
    • 🔐Shielded Account
    • 📈Transaction
    • ▶️Initializing SDK
    • 💰Balances And History
    • 📤Sending Transaction
    • 🔌Integrating with DeFi Protocols
    • Labyrinth fee structure
  • Compliance Solution
    • Overview of Compliance
    • How Compliance Works
  • 💻CLI
    • ▶️Running SeDe CLI
  • Technical Implementation
    • Cryptographic Primitives
    • Shielded Account
    • Shielded Address
    • Account Abstraction
    • 🔵Core Architecture
      • 💵Note
      • 🌲Merkle Tree
      • 🔀JoinSplits
      • 🛡️Shielded Transaction
    • 🔄Protocol Interoperability
  • Resource and support
    • Roadmap
    • FAQs
    • Whitepaper
    • Selective De-Anonymization Compliance Paper
  • Contact and socials
    • Labyrinth Website
    • Twitter
    • Discord
    • Contact Us
Powered by GitBook
On this page
  1. Labyrinth SDK

Transaction

PreviousShielded AccountNextInitializing SDK

Last updated 10 months ago

Transactions for zkFi protocol can be created via TransactionRequest, TransactionOptions types of the Labyrinth SDK. A TransactionRequest object has the following fields:

export type TransactionRequest = {
  type: TransactionType;
  assetIds: number[];
  values: bigint[];
  feeAssetId: number;
  to: string;
  payload?: string;
};

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 in to 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. The to 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. The to must be the address of the target protocols' "adaptor" contract.

assetIds

Specify a list of Labyrinth's assetIds 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

Transaction Options

export type TransactionOptions = {
  revokerId: number;
  paymaster?: Hex;
  viaBundler?: boolean;
};

You can modify the default options to change some parameters of the transactions by passing TransactionOptionsobject. Current available options are as follows:

  • revokerId: The ID of the revoker chosen. You can query the registered revoker details from contractSource::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.

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 to understand this better.

📦
📈
See more [here].
refer the Uniswap integration example