@arkade-os/sdk Documentation - v0.4.36
    Preparing search index...

    Class SeedIdentity

    Seed-based identity derived from a raw seed and an account descriptor template.

    This is the recommended identity type for most applications. It uses standard BIP86 (Taproot) derivation by default; callers that need a different path supply the wildcard template directly.

    Prefer this (or

    MnemonicIdentity) over SingleKey for new integrations — SingleKey exists for backward compatibility with raw nsec-style keys.

    The identity holds the wildcard template (e.g. tr([fp/86'/0'/0']xpub/0/*)) on its public descriptor field. HD rotation reads it directly; consumers that need a concrete descriptor at a specific index materialize it themselves (see HDDescriptorProvider in the wallet layer).

    Exposes seed-level primitives (signing, derivation, the template) but is deliberately NOT a DescriptorProvider. Wrap it explicitly to get one:

    • HDDescriptorProvider for rotating receive addresses.
    • StaticDescriptorProvider for legacy, single-key behaviour.

    The split prevents a SeedIdentity from being silently used as a concrete descriptor source, which would defeat HD rotation without any compile-time signal that something was wrong.

    const seed = mnemonicToSeedSync(mnemonic);

    // Testnet (BIP86 wildcard descriptor m/86'/1'/0'/0/*)
    const identity = SeedIdentity.fromSeed(seed, { isMainnet: false });

    // Mainnet (BIP86 wildcard descriptor m/86'/0'/0'/0/*)
    const identity = SeedIdentity.fromSeed(seed, { isMainnet: true });

    // Caller-supplied wildcard descriptor (must end in `/*)`).
    const identity = SeedIdentity.fromSeed(seed, { descriptor });

    Hierarchy (View Summary)

    Implements

    • HDCapableIdentity
    Index

    Constructors

    Properties

    descriptor: string

    Wildcard account-descriptor template (e.g. tr([fp/86'/0'/0']xpub/0/*)). The canonical thing to pass through the system; consumers materialize a concrete descriptor at a specific index themselves (see HDDescriptorProvider in the wallet layer for the rotating-counter use case).

    Methods

    • Returns the compressed public key for this identity.

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Returns true when descriptor is derived from this identity's seed. HD descriptors match by account xpub; bare tr(pubkey) descriptors match by raw pubkey. See descriptorIsOurs.

      Parameters

      • descriptor: string

      Returns boolean

      Prefer DescriptorProvider.isOurs() via HDDescriptorProvider for rotating HD wallets or StaticDescriptorProvider for legacy single-key wallets.

    • Sign the provided transaction inputs.

      Parameters

      • tx: Transaction

        Transaction to sign

      • OptionalinputIndexes: number[]

        Optional input indexes to sign. When omitted, the implementation should sign every signable input.

      Returns Promise<Transaction>

    • Sign an arbitrary message using the requested signature type.

      Parameters

      • message: Uint8Array
      • signatureType: "schnorr" | "ecdsa" = "schnorr"

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Signs a message with the key derived from descriptor.

      Parameters

      • descriptor: string
      • message: Uint8Array
      • signatureType: "schnorr" | "ecdsa" = "schnorr"

      Returns Promise<Uint8Array<ArrayBufferLike>>

      Prefer DescriptorProvider.signMessageWithDescriptor() via HDDescriptorProvider or StaticDescriptorProvider. Identities keep this method only as backing implementation for descriptor providers.

    • Signs each request with the key derived from its descriptor. Each descriptor must share this identity's seed (isOurs).

      Parameters

      • requests: DescriptorSigningRequest[]

      Returns Promise<Transaction[]>

      Prefer DescriptorProvider.signWithDescriptor() via HDDescriptorProvider or StaticDescriptorProvider. Identities keep this method only as backing implementation for descriptor providers.

    • Returns the x-only public key used by Taproot scripts.

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Creates a SeedIdentity from a raw 64-byte seed.

      Pass { isMainnet } for default BIP86 derivation, or { descriptor } for a caller-supplied account-descriptor template (the option's value must end with /*)).

      Parameters

      • seed: Uint8Array

        64-byte seed (typically from mnemonicToSeedSync)

      • opts: SeedIdentityOptions = {}

        Network selection or descriptor template.

      Returns SeedIdentity