Taquito TypeDocs
    Preparing search index...

    Class SaplingTransactionBuilder

    Build Sapling transactions with application-defined bound data.

    The caller validates recipients, amounts and memos, selects spendable inputs, and passes the same bound data to this builder and SaplingForger. Configure proving parameters with initSapling before generating proofs.

    Index
    • Build the change (payback) output description for the remainder of sumSelectedInputs. Callers invoking this low-level helper directly must supply a freshly sampled randomCommitmentTrapdoor (rcm), distinct from any recipient output trapdoors.

      Parameters

      • params: ParametersOutputDescription
      • sumSelectedInputs: BigNumber

      Returns Promise<{ payBackAmount: string; payBackOutput: SaplingTransactionOutput }>

    • Spend selected notes for a private transfer or withdrawal. A withdrawal with positive selected inputs creates a payback note, even when its value is zero.

      Parameters

      • saplingTransactionParams: SaplingTransactionParams[]

        Recipient notes. Use an empty list for a withdrawal.

      • txTotalAmount: Value

        Amount to transfer or withdraw in base units.

      • boundData: Uint8Array

        Contract-specific bytes included in the binding signature. Pass the same bytes to the forger when serializing the transaction.

      • chosenInputs: SaplingTransactionInputSelection

        Unspent inputs and their total value. The caller must ensure this total covers the amount; this low-level method does not perform the toolkit balance check.

      Returns Promise<
          {
              balance: BigNumber;
              inputs: SaplingTransactionInput[];
              outputs: SaplingTransactionOutput[];
              signature: Uint8Array<ArrayBufferLike>;
          },
      >

      Transaction descriptions, signature and balance for the forger. The caller supplies a consistent Sapling root when forging the transaction.

    • Create recipient notes for a shielded deposit.

      Parameters

      • saplingTransactionParams: SaplingTransactionParams[]

        Recipient payment addresses, base-unit amounts and memos.

      • txTotalAmount: Value

        Total deposit in base units, without tez-to-mutez conversion.

      • boundData: Uint8Array

        Contract-specific bytes included in the binding signature. Pass the same bytes to the forger when serializing the transaction.

      Returns Promise<
          Pick<SaplingTransaction, "balance" | "signature" | "inputs" | "outputs">,
      >

      Transaction descriptions, signature and balance for the forger.

    • Encrypt a Sapling note plaintext and outgoing ciphertext for a single output. Callers invoking this low-level helper directly must pass the freshly sampled randomCommitmentTrapdoor (rcm) used for this output's commitment and a separately sampled ephemeralPrivateKey.

      Parameters

      • parametersCiphertext: ParametersCiphertext

      Returns Promise<Pick<Ciphertext, "payloadEnc" | "nonceEnc" | "payloadOut" | "nonceOut">>

    • Build a single Sapling output description and encrypted note ciphertext. Callers invoking this low-level helper directly must supply a freshly sampled randomCommitmentTrapdoor (rcm) for each output; never reuse a trapdoor across outputs or as an ephemeral private key.

      Parameters

      • parametersOutputDescription: ParametersOutputDescription

      Returns Promise<SaplingTransactionOutput>