Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SaplingToolkit

description

Class that surfaces all of the sapling capability allowing to read from a sapling state and prepare transactions

param

Holds the sapling spending key

param

(Optional) Allows to generate the proofs with the proving key rather than the spending key

param

Contains the address of the sapling contract, the memo size, and an optional sapling id that must be defined if the sapling contract contains more than one sapling state

param

Allows to read data from the blockchain

param

(Optional) Allows packing data. Use the MichelCodecPacker by default.

param

(Optional) Allows serializing the sapling transactions. Use the SaplingForger by default.

param

(Optional) Allows to prepare the sapling transactions. Use the SaplingTransactionBuilder by default.

example
const inMemorySpendingKey = await InMemorySpendingKey.fromMnemonic('YOUR_MNEMONIC');
const readProvider = new RpcReadAdapter(new RpcClient('https://YOUR_PREFERRED_RPC_URL'))

const saplingToolkit = new SaplingToolkit(
   { saplingSigner: inMemorySpendingKey },
   { contractAddress: SAPLING_CONTRACT_ADDRESS, memoSize: 8 },
   readProvider
)

Hierarchy

  • SaplingToolkit

Index

Constructors

constructor

  • new SaplingToolkit(keys: { saplingProver?: InMemoryProvingKey; saplingSigner: InMemorySpendingKey }, saplingContractDetails: SaplingContractDetails, readProvider: TzReadProvider, packer?: MichelCodecPacker, saplingForger?: SaplingForger, saplingTxBuilder?: SaplingTransactionBuilder): SaplingToolkit

Methods

getSaplingTransactionViewer

prepareSaplingTransaction

  • prepareSaplingTransaction(saplingTxParams: ParametersSaplingTransaction[]): Promise<string>
  • description

    Prepare a sapling transaction (zet to zet)

    Parameters

    • saplingTxParams: ParametersSaplingTransaction[]

      to is the payment address that will receive the shielded tokens (zet). amount is the amount of unshielded tokens in tez by default. mutez needs to be set to true if the amount of unshielded tokens is in mutez. memo is an empty string by default.

    Returns Promise<string>

    a string representing the sapling transaction.

prepareShieldedTransaction

  • prepareShieldedTransaction(shieldedTxParams: ParametersSaplingTransaction[]): Promise<string>
  • description

    Prepare a shielded transaction

    Parameters

    • shieldedTxParams: ParametersSaplingTransaction[]

      to is the payment address that will receive the shielded tokens (zet). amount is the amount of shielded tokens in tez by default. mutez needs to be set to true if the amount of shielded tokens is in mutez. memo is an empty string by default.

    Returns Promise<string>

    a string representing the sapling transaction

prepareUnshieldedTransaction

  • prepareUnshieldedTransaction(unshieldedTxParams: Pick<ParametersSaplingTransaction, "mutez" | "to" | "amount">): Promise<string>
  • description

    Prepare an unshielded transaction

    Parameters

    • unshieldedTxParams: Pick<ParametersSaplingTransaction, "mutez" | "to" | "amount">

      to is the Tezos address that will receive the unshielded tokens (tz1, tz2 or tz3). amount is the amount of unshielded tokens in tez by default. mutez needs to be set to true if the amount of unshielded tokens is in mutez.

    Returns Promise<string>

    a string representing the sapling transaction.

Generated using TypeDoc