RAILGUN Reloaded
    Preparing search index...

    Top-level entry point for @railgun-reloaded/wallet-sdk.

    Composes shared wallet, sync, and event behavior with Node-specific database ownership.

    Index
    • Eagerly initialize the cryptography libraries this client depends on.

      Returns Promise<void>

      A promise that resolves once the cryptography libraries are ready.

    • Load a wallet by ID. Delegates to WalletService.

      Parameters

      • walletId: string

        Wallet to load.

      • encryptionKey: Uint8Array

        32-byte key used at creation time.

      Returns Promise<WalletContext>

      Full WalletContext (minus spending key).

    • Delete a wallet by ID. Idempotent. Delegates to WalletService.

      Parameters

      • walletId: string

        Wallet to remove.

      Returns Promise<void>

      Resolves when the delete completes.

    • Read ERC-20 balances for a wallet on a given chain from live unspent notes.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet/listWallets.

      • chainId: number

        Network whose deployment to scope the lookup to.

      • Optionalmode: BalanceMode

        Balance mode: default spendable, all unspent, or one bucket.

      Returns Promise<TokenBalance[]>

      Token balances grouped by token.

    • Read unspent ERC-20 balances grouped by legacy flat balance bucket.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet/listWallets.

      • chainId: number

        Network whose deployment to scope the lookup to.

      Returns Promise<Record<WalletBalanceBucket, TokenBalance[]>>

      Token balances keyed by WalletBalanceBucket.

    • Read unspent private ERC-721 holdings for a wallet on a given chain.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet/listWallets.

      • chainId: number

        Network whose deployment to scope the lookup to.

      Returns Promise<ERC721Holding[]>

      ERC-721 contract addresses and token sub-IDs.

    • Read decrypted notes with protocol and optional POI spend state.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet/listWallets.

      • chainId: number

        Network whose deployment to scope the lookup to.

      • Optionaloptions: { unspent?: boolean }

        Optional note filtering.

        • Optionalunspent?: boolean

          When true, only return unspent notes.

      Returns Promise<DecryptedNote[]>

      Decrypted notes from wallet.db.notes.

    • Record a confirmed shield in wallet-scoped transaction history.

      Parameters

      • walletId: string

        Wallet that received the shield.

      • chainId: number

        Network on which the shield confirmed.

      • result: ShieldReceiptResult

        Confirmed shield receipt returned by shield().

      • timestamp: Date

        Timestamp of the confirmed shield block.

      Returns Promise<void>

      Resolves once the history row is stored.

    • Read stored transaction history for one wallet and chain, newest first.

      Parameters

      • walletId: string

        Wallet whose history should be returned.

      • chainId: number

        Network whose deployment to scope the history query to.

      • Optionallimit: number

        Optional maximum number of rows to return.

      Returns Promise<TransactionHistoryEntry[]>

      Stored wallet transaction history.

    • Read the persisted chain-ingestion cursor without accessing the engine.

      Parameters

      • chainId: number

        Network whose persisted cursor should be returned.

      Returns Promise<SyncCursor>

      Explicit synced or never-synced state.

    • Subscribe to a Railgun event.

      Type Parameters

      Parameters

      • event: E

        Event name from RailgunEventMap.

      • handler: EventHandler<E>

        Synchronous handler. Throws are caught and re-emitted as 'error'; the originating method is unaffected.

      • Optionalfilter: EventFilter

        Optional { walletId?, network? }. Handler fires only when every provided field matches the event payload.

      Returns () => void

      Idempotent unsubscribe function.

    • Remove every subscriber, or every subscriber for one event. Called automatically by close().

      Parameters

      • Optionalevent: keyof RailgunEventMap

        Optional event name to scope the clear.

      Returns void

    • Refresh persisted PPOI for received notes, sent outputs, and wallet unshields.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet / listWallets.

      • chainId: number

        Network to scope the refresh to.

      Returns Promise<RefreshSummary>

      Counters for received notes and outputs checked, updated, skipped, and failed.

    • Prove a confirmed RAILGUN transaction and submit the POI proof to each list provider. Run sync() first: it stores the transaction and decrypts its sent commitments. scan() does not decrypt. Sending the transaction and submitting its POI are separate steps, so a failed submit can be retried alone.

      Parameters

      • params: SubmitPoiParams

        Wallet, transaction, list keys, and POI prover.

      • chainId: number

        Network the transaction ran on.

      Returns Promise<void>

      Resolves when every list provider has accepted its proof.

      If the network has no usable PPOI node URL.

      If a note the transaction spent is not stored.

      If the PPOI node has not validated the TXID tree up to the transaction.

    • Drain the data source into chain.db for network. Returns when the source reaches its current tip (or endBlock, when set). Calls for the same chain in this client run in order, including calls from sync(). Different chains can scan at the same time. A failed scan rejects its caller and does not block the next scan. Direct RailgunEngine.scan() calls do not use this client's queue.

      Parameters

      • params: ScanParams

        Sync target plus optional bounds.

      Returns Promise<bigint | undefined>

      Last block number written to chain.db, or undefined when the source had nothing to yield.

      If the client is closed when the queued scan starts.

    • Decrypt the wallet's notes from chain.db into wallet.db. Pure consumer of chain state — call scan() first to populate chain.db.

      Parameters

      • walletId: string

        Wallet ID returned from createWallet/listWallets.

      • encryptionKey: Uint8Array

        Same 32-byte key used at wallet creation time.

      • params: DecryptParams

        Decryption target plus optional bounds.

      Returns Promise<DecryptSummary>

      Summary of blocks scanned and notes added/spent.

    • Convenience composer: drain chain state into chain.db (scan) then decrypt the wallet's notes from chain.db into wallet.db (decrypt).

      Parameters

      • walletId: string

        Wallet ID to decrypt for.

      • encryptionKey: Uint8Array

        32-byte key used at wallet creation time.

      • params: SyncParams

        Network + data source + optional bounds.

      Returns Promise<SyncSummary>

      Combined summary: last scanned block + decryption counters.

    • Derive a shield key, approve the token, submit, and parse the receipt.

      Parameters

      • params: ShieldParams

        Token, recipient, signer, and execution options.

      • chainId: number

        Network whose RAILGUN contract receives the shield.

      Returns Promise<ShieldReceiptResult>

      Parsed shield result for the confirmed transaction.

      If the confirmed receipt carries no Shield event.

    • Select notes, prove, and build the unsigned unshield call. Does not sign or send. The recipient is a public 0x address. The client needs a prover, and the caller supplies the circuit artifacts through params.loadArtifact.

      Parameters

      • params: BuildUnshieldParams

        Wallet, token, amount, recipient, transport, artifacts, and public client.

      • chainId: number

        Network whose RAILGUN contract runs the unshield.

      Returns Promise<BuildUnshieldResult>

      The proven, unsigned transaction.

      If the client has no prover.

    • Build the unshield, send it with params.signer, and parse the receipt.

      Parameters

      • params: UnshieldParams

        Build inputs plus the signer and execution options.

      • chainId: number

        Network whose RAILGUN contract runs the unshield.

      Returns Promise<UnshieldResult>

      Parsed unshield result for the confirmed transaction.

      If the confirmed receipt carries no Unshield event.

    • Select notes, prove, and build the unsigned transact call that pays each recipient a private note. Does not sign or send. Each recipient is a 0zk address. The client needs a prover, and the caller supplies the circuit artifacts through params.loadArtifact.

      Parameters

      • params: BuildTransferParams

        Wallet, recipients, memo, sender visibility, transport, artifacts, and public client.

      • chainId: number

        Network whose RAILGUN contract runs the transfer.

      Returns Promise<BuildTransferResult>

      The proven, unsigned transaction.

      If a recipient entry is malformed. The error names its index.

      If the client has no prover.

    • Build the transfer, send it with params.signer, and parse the receipt.

      Parameters

      • params: TransferParams

        Build inputs plus the signer and execution options.

      • chainId: number

        Network whose RAILGUN contract runs the transfer.

      Returns Promise<TransferResult>

      Parsed transfer result for the confirmed transaction.

      If the confirmed receipt carries no Transact event.

    • Release resources owned by this client: tears down the engine of every chain (each closes its chain DB only when it owns it) and closes the wallet DB only when it was created internally. Injected DBs and every caller data source remain the caller's responsibility. A pending scan() fails when its engine-owned chain DB closes, so await scan() before close().

      Returns Promise<void>