@arkade-os/sdk Documentation - v0.5.0-rc.11
    Preparing search index...

    Class ServiceWorkerWallet

    Core wallet interface for Bitcoin transactions with Arkade protocol support.

    This interface defines the contract that all wallet implementations must follow. It provides methods for address management, balance checking, virtual output operations, and transaction management including sending, settling, and unrolling.

    IReadonlyWallet

    Hierarchy (View Summary)

    Implements

    Index

    Properties

    activity: ActivityRegistry = ...

    Resolvers that group/label getActivityHistory rows.

    contractRepository: ContractRepository
    identity: Identity

    Signing identity associated with the wallet.

    A real signer, not a ReadonlyIdentity that structurally fits: contract corridors need all four members — sign, signMessage, signerSession and xOnlyPublicKey — and signerSession is the one a watch-only identity lacks. isSigningIdentity is the check; a wallet that fails it is refused as WalletCannotSignError before anything is funded, rather than at the push that discovers there is no signer.

    serviceWorker: ServiceWorker
    walletRepository: WalletRepository

    Accessors

    Methods

    • Return service-worker wallet status, including connectivity and sync state.

      Returns Promise<
          {
              providerConnectionState?: ProviderConnectionState;
              walletInitialized: boolean;
              xOnlyPublicKey: Uint8Array<ArrayBufferLike>
              | undefined;
          },
      >

      Current service-worker wallet status payload including walletInitalized and xOnlyPublicKey

    • Explicitly recover this wallet's contracts and balance on a fresh repo. Mirrors Wallet.restore but drives the scan inside the service worker — the materialize() callback used by scanContracts cannot cross the postMessage boundary, so the entire flow runs worker-side and only the gapLimit / outcome cross the wire.

      Uses the streaming send path so the bus deadline does not race a long indexer-bound scan. AggregateError thrown by the worker is reconstructed here so callers can inspect .errors.

      Parameters

      • Optionalopts: { gapLimit?: number }

      Returns Promise<void>

    • Send bitcoin and/or assets to one or more Arkade recipients, passed either as variadic Recipients or as a single SendParams object — the latter also carries the inputs to spend.

      Parameters

      Returns Promise<string>

      Arkade transaction id

      SendParams

      await wallet.send({ address: 'ark1q...', amount: 1000 })

      // choosing the inputs as well as the outputs
      await wallet.send({
      recipients: [{ address: 'ark1q...', amount: 1000 }],
      selectedVtxos: mine,
      })
    • Parameters

      • descriptor: string

      Returns Promise<Identity>

      HDWalletCapable.signerForDescriptor

      Runs page-side: an Identity cannot cross the message bus, and it does not need to — the page owns the signing identity, and resolving a descriptor reads no allocation state. Shares resolveDescriptorSigner with Wallet.signerForDescriptor so the two sides of the bus cannot answer differently for one descriptor.

      No provider is passed, and none is needed: HDDescriptorProvider's isOurs and signing members all delegate to the identity, which the page holds. Building one here would only add a page-side read of the wallet state the worker allocates from — shared mutable state on a path that has no business touching it.