RAILGUN Reloaded
    Preparing search index...

    Browser entry point for @railgun-reloaded/wallet-sdk.

    Mirrors the Node RailgunClient API where practical, but never touches a filesystem or opens databases: chain and wallet storage contracts are injected at construction and remain caller-owned. close() tears down the data source only.

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

    • 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?, chainId? }. The 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

    • Drain the supplied data source into chain storage for network. 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, 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 storage into wallet storage.

      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 storage (scan) then decrypt the wallet's notes into wallet storage (decrypt), optionally refreshing PPOI status on PPOI networks.

      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.

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

    • 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: drops every event subscriber. The injected storage contracts and every caller data source are caller-owned. Close or delete the storage through the adapter that created it.

      Returns Promise<void>