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

Holds the sapling spending key

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

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

Allows to read data from the blockchain

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

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

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

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
)

Constructors

Methods

  • 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.

    Prepare a sapling transaction (zet to zet)

  • 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

    Prepare a shielded transaction

  • Parameters

    • unshieldedTxParams: ParametersUnshieldedTransaction

      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.

    Prepare an unshielded transaction