dash-platform-sdk
    Preparing search index...

    Class ShieldedController

    Shielded controller for requesting information about shielded pool

    Index

    Methods

    • Rebuilds the note commitment tree from the full on-chain note set and witnesses the given recovered notes against it, producing the spendable notes and the shared anchor required by spend transitions (shieldedTransfer, unshield, shieldedWithdrawal, identityCreateFromShieldedPool).

      Pass the complete note set from getShieldedEncryptedNotes as notes (the commitment tree leaves) and the notes you want to spend from recoverNotes as recovered. This keeps the whole spend flow inside the SDK — no need to construct a commitment tree yourself.

      Parameters

      • notes: ShieldedEncryptedNote[]

        {ShieldedEncryptedNote[]} - full on-chain note set (the tree leaves)

      • recovered: RecoveredNoteWASM[]

        {RecoveredNoteWASM[]} - the recovered notes to spend

      Returns { anchor: Uint8Array; spends: SpendableNoteWASM[] }

    • Helper function for building and proving shielded (Orchard) transitions. It may be used to create any of 7 shielded transition actions:

      1. shield - transparent platform addresses -> pool (deposit)
      2. shieldFromAssetLock - asset lock -> pool (deposit)
      3. shieldedWithdrawal - pool -> core L1 (spend)
      4. unshield - pool -> platform identity balance (spend)
      5. shieldedTransfer - pool -> pool (spend)
      6. shieldedTransferMulti - pool -> pool, several recipients, each with its own memo (spend)
      7. identityCreateFromShieldedPool - pool -> new identity (spend)

      Spends require a {SpendableNoteWASM} witnessed against an on-chain anchor.

      Type Parameters

      • K extends keyof ShieldedTransitionParamsMap

      Parameters

      • type: K

        {string} Type of the shielded transition, must be one of ('shield' | 'shieldFromAssetLock' | 'shieldedWithdrawal' | 'unshield' | 'shieldedTransfer' | 'shieldedTransferMulti' | 'identityCreateFromShieldedPool')

      • params: ShieldedTransitionParamsMap[K]

        {ShieldedTransitionParams} params

      Returns Promise<StateTransitionWASM>

    • Retrieves the most recent anchor (note commitment tree root) of the shielded pool.

      Returns Promise<undefined | Uint8Array<ArrayBufferLike>>

    • Retrieves the set of valid anchors (note commitment tree roots) currently accepted by the shielded pool.

      Returns Promise<Uint8Array<ArrayBufferLike>[]>

    • Retrieves a batch of shielded encrypted notes from the shielded pool, starting from the given note index.

      Returns an array of encrypted notes, each containing the nullifier, note commitment (cmx), encrypted note payload and value commitment (cvNet).

      Parameters

      • startIndex: bigint

        {bigint} - index of the first note to fetch

      • count: number

        {number} - amount of notes to fetch

      Returns Promise<ShieldedEncryptedNote[]>

    • Retrieves the total count of notes (leaves) in the shielded notes commitment tree. Useful as a denominator for shielded sync progress.

      Returns Promise<undefined | bigint>

    • Checks the spent status of the given nullifiers in the shielded pool.

      Returns an array of statuses, each containing the nullifier and whether it has already been spent.

      Parameters

      • nullifiers: Uint8Array<ArrayBufferLike>[]

        {Uint8Array[]} - nullifiers to check

      Returns Promise<ShieldedNullifierStatus[]>

    • Retrieves the total balance currently held in the shielded pool.

      Returns Promise<undefined | bigint>

    • Set bindings instance of builder Needed for custom builder load, because ShieldedBuilderWASM inits very slow on old hardware

      Parameters

      • Optionalbuilder: ShieldedBuilderWASM

      Returns Promise<ShieldedBuilderWASM>

    • Recovers the notes owned by a wallet from a set of shielded encrypted notes (as returned by getShieldedEncryptedNotes) by trial-decrypting each with the viewing key derived from the seed (ZIP-32 m/32'/coinType'/account'). Only notes addressed to the wallet are returned, each with its global leaf position (index) in the commitment tree.

      Parameters

      • notes: ShieldedEncryptedNote[]

        {ShieldedEncryptedNote[]} - shielded encrypted notes to scan

      • seed: Uint8Array

        {Uint8Array} - BIP-39 seed bytes

      • account: number

        {number} - ZIP-32 account index

      Returns RecoveredNoteWASM[]