Build Babbage Apps with TypeScript


License
OpenSSL
Install
npm install @babbage/sdk-ts@0.2.66

Documentation

@babbage/sdk-ts

Build Babbage apps in TypeScript

NPM Package

GitHub Repository

Installation

npm i @babbage/sdk

By Example

There are a few example projects you can check out which implement the Babbage SDK:

  • 🎵Tempo: A platform for creating and sharing music, and empowering artists with micropayments
  • ✅Simple ToDo List: An app that demonstrates the basics of Bitcoin tokenization and identity

Documentation

📒 The JavaScript API is documented below the examples, in the API section

The 📚Babbage Learn website hosts the concepts, guides and reference materials that show you how the SDK works.

Example Usage

Encryption

import { encrypt, decrypt } from '@babbage/sdk-ts'

// Encrypt and decrypt data using the Babbage SDK
const encryptedData = await encrypt({
  plaintext: Buffer.from('some data'),
  protocolID: [0, 'Hello World'],
  keyID: '1'
})

// The same protocol and key ID is needed for decryption
const decryptedData = await decrypt({
  ciphertext: encryptedData,
  protocolID: [0, 'Hello World'],
  keyID: '1',
  returnType: 'string'
})

Creating and Redeeming Bitcoin tokens

This example also uses PushDrop

import { createAction } from '@babbage/sdk-ts'
import { create, redeem } from 'pushdrop'

const bitcoinOutputScript = await create({
  fields: [ // The "fields" are the data payload to attach to the token.
    Buffer.from('My First Token'),
    Buffer.from('My name is Ty') // Tokens can represent anything!
  ],
  // The "first token" protocol and key ID can be used to sign and 
  // lock this new Bitcoin PushDrop token.
  protocolID: 'first token',
  keyID: '1'
})

const newToken = await createAction({
  // The Bitcoin transaction ("Action" with a capital A) has an output, 
  // because it has led to the creation of a new Bitcoin token.
  outputs: [{
    // The output amount is how much Bitcoin (measured in "satoshis") 
    // this token is worth. Let's use 1000 satoshis.
    satoshis: 1000,
    // The output script for this token was created by the PushDrop library, 
    // which you can see above.
    script: bitcoinOutputScript
  }],
  // Finally, we'll describe the Action for the user
  description: 'Create my first token'
})

// Here, we're using the PushDrop library to unlcok / redeem the PushDrop 
// token that was previously created. By providing this information, 
// PushDrop can "unlock" and spend the token. When the token gets spent, 
// the user gets their 1000 satoshis back.
const unlockingScript = await pushdrop.redeem({
  // To unlock the token, we need to use the same "first token" protocol 
  // and key ID as when we created the token before. Otherwise, the 
  // key won't fit the lock and the Bitcoins won't come out.
  protocolID: 'first token',
  keyID: '1',
  // We're telling PushDrop which previous transaction and output we want to
  // unlock, so that the correct unlocking puzzle can be prepared.
  prevTxId: newToken.txid,
  outputIndex: 0, // The first output from the transaction
  // We also give PushDrop a copy of the locking puzzle ("script") that 
  // we want to open, which is helpful in preparing to unlock it.
  lockingScript: bitcoinOutputScript,
  // Finally, the number of satoshis we are expecting to unlock when the 
  // puzzle gets solved.
  outputAmount: 1000
})

// Now, we're going to use the unlocking puzle that PushDrop has prepared for us,
// so that the user can get their Bitcoins back. This is another "Action", which
// is just a Bitcoin transaction.
// The amount the user gets back will be slightly less, because of transaction fees.
await createAction({
  inputs: { // These are inputs, which unlock Bitcoin tokens.
    // The input comes from the token which we're completing
    [newToken.txid]: {
      ...newToken,
      // The output we want to redeem is specified here, and we also give 
      // the unlocking puzzle ("script") from PushDrop.
      outputsToRedeem: [{
        index: 0, // The first output of the transaction
        unlockingScript
      }]
    }
  },
  // Let the user know why they're getting some Bitcoins back
  description: 'Redeem my first token'
})

🏆 After reading the above two examples, could you implement a token with encrypted data? 🏆

API

Links: API, Interfaces, Classes, Functions, Types, Variables

Interfaces

AbortActionArgs GetNetworkResult SignableTransaction
AbortActionResult GetPublicKeyArgs SpecificKeyLinkageResult
AbortActionResult GetPublicKeyResult SubmitDirectTransaction
AcquireCertificateArgs GetTransactionOutputResult SubmitDirectTransactionOutput
AcquireCertificateResult GetVersionResult SubmitDirectTransactionResult
AuthenticatedResult IdentityCertificate TscMerkleProofApi
BasketInsertion IdentityCertifier ValidAbortActionArgs
CertificateApi InternalizeActionArgs ValidAcquireCertificateArgs
CounterpartyKeyLinkageResult InternalizeActionResult ValidBasketInsertion
CreateActionArgs InternalizeOutput ValidCreateActionArgs
CreateActionInput KeyDeriverApi ValidCreateActionInput
CreateActionInput KeyLinkageResult ValidCreateActionOptions
CreateActionOptions ListActionsArgs ValidCreateActionOutput
CreateActionOptions ListActionsResult ValidInternalizeActionArgs
CreateActionOutput ListActionsResult ValidInternalizeOutput
CreateActionOutput ListActionsTransaction ValidListActionsArgs
CreateActionOutputToRedeem ListActionsTransactionInput ValidListCertificatesArgs
CreateActionParams ListActionsTransactionOutput ValidListOutputsArgs
CreateActionResult ListCertificatesArgs ValidProcessActionArgs
CreateActionResult ListCertificatesResult ValidProcessActionOptions
CreateCertificateResult ListOutputsArgs ValidRelinquishOutputArgs
CreateHmacArgs ListOutputsResult ValidSignActionArgs
CreateHmacResult MapiResponseApi ValidSignActionOptions
CreateSignatureArgs OptionalEnvelopeEvidenceApi ValidWalletPayment
CreateSignatureResult OutPoint VerifyHmacArgs
DiscoverByAttributesArgs ProveCertificateArgs VerifyHmacResult
DiscoverByIdentityKeyArgs ProveCertificateResult VerifySignatureArgs
DiscoverCertificatesResult ProveCertificateResult VerifySignatureResult
DojoCreateTransactionResultApi RelinquishCertificateArgs Wallet
DojoCreateTxOutputApi RelinquishCertificateResult WalletAction
DojoCreateTxResultInstructionsApi RelinquishOutputArgs WalletActionInput
DojoCreateTxResultOutputApi RelinquishOutputResult WalletActionOutput
DojoCreatingTxInputsApi RevealCounterpartyKeyLinkageArgs WalletCertificate
DojoOutputToRedeemApi RevealCounterpartyKeyLinkageResult WalletCryptoObject
DojoSendWithResultsApi RevealSpecificKeyLinkageArgs WalletDecryptArgs
EnvelopeApi RevealSpecificKeyLinkageResult WalletDecryptResult
EnvelopeEvidenceApi SendWithResult WalletEncryptArgs
GetHeaderArgs SignActionArgs WalletEncryptResult
GetHeaderResult SignActionOptions WalletEncryptionArgs
GetHeightResult SignActionResult WalletErrorObject
GetInfoParams SignActionResult WalletOutput
GetInfoResult SignActionSpend WalletPayment

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AbortActionArgs

export interface AbortActionArgs {
    reference: Base64String;
}

See also: Base64String

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AbortActionResult

export interface AbortActionResult {
    referenceNumber: string;
    log?: string;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AbortActionResult

export interface AbortActionResult {
    aborted: boolean;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AcquireCertificateArgs

export interface AcquireCertificateArgs {
    type: Base64String;
    certifier: PubKeyHex;
    acquisitionProtocol: AcquisitionProtocol;
    fields: Record<CertificateFieldNameUnder50Bytes, string>;
    serialNumber?: Base64String;
    revocationOutpoint?: OutpointString;
    signature?: HexString;
    certifierUrl?: string;
    keyringRevealer?: KeyringRevealer;
    keyringForSubject?: Record<CertificateFieldNameUnder50Bytes, Base64String>;
    privileged?: BooleanDefaultFalse;
    privilegedReason?: DescriptionString5to50Bytes;
}

See also: AcquisitionProtocol, Base64String, BooleanDefaultFalse, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, HexString, KeyringRevealer, OutpointString, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AcquireCertificateResult

export interface AcquireCertificateResult extends WalletCertificate {
}

See also: WalletCertificate

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: AuthenticatedResult

export interface AuthenticatedResult {
    authenticated: boolean;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: BasketInsertion

export interface BasketInsertion {
    basket: BasketStringUnder300Bytes;
    customInstructions?: string;
    tags?: OutputTagStringUnder300Bytes[];
}

See also: BasketStringUnder300Bytes, OutputTagStringUnder300Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CertificateApi

export interface CertificateApi {
    type: string;
    subject: string;
    validationKey: string;
    serialNumber: string;
    certifier: string;
    revocationOutpoint: string;
    signature: string;
    fields?: Record<string, string>;
}
Interface CertificateApi Details
Property certifier

max length of 255

certifier: string
Property fields

Certificate fields object where keys are field names and values are field value.

fields?: Record<string, string>
Property revocationOutpoint

max length of 255

revocationOutpoint: string
Property serialNumber

max length of 255

serialNumber: string
Property signature

max length of 255

signature: string
Property subject

max length of 255

subject: string
Property type

max length of 255

type: string
Property validationKey

max length of 255

validationKey: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CounterpartyKeyLinkageResult

export interface CounterpartyKeyLinkageResult {
    type: "counterparty-revelation";
    prover: string;
    verifier: string;
    counterparty: string;
    revelationTime: string;
    encryptedLinkage: string;
}
Interface CounterpartyKeyLinkageResult Details
Property revelationTime

ISO date string

revelationTime: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionArgs

export interface CreateActionArgs {
    description: DescriptionString5to50Bytes;
    inputBEEF?: BEEF;
    inputs?: CreateActionInput[];
    outputs?: CreateActionOutput[];
    lockTime?: PositiveIntegerOrZero;
    version?: PositiveIntegerOrZero;
    labels?: LabelStringUnder300Bytes[];
    options?: CreateActionOptions;
}

See also: BEEF, CreateActionInput, CreateActionOptions, CreateActionOutput, DescriptionString5to50Bytes, LabelStringUnder300Bytes, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionInput

export interface CreateActionInput extends OptionalEnvelopeEvidenceApi {
    outputsToRedeem: CreateActionOutputToRedeem[];
}

See also: CreateActionOutputToRedeem, OptionalEnvelopeEvidenceApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionInput

export interface CreateActionInput {
    outpoint: OutpointString;
    inputDescription: DescriptionString5to50Bytes;
    unlockingScript?: HexString;
    unlockingScriptLength?: PositiveInteger;
    sequenceNumber?: PositiveIntegerOrZero;
}

See also: DescriptionString5to50Bytes, HexString, OutpointString, PositiveInteger, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionOptions

export interface CreateActionOptions {
    acceptDelayedBroadcast?: boolean;
    trustSelf?: TrustSelf;
    knownTxids?: string[];
    resultFormat?: "beef" | "none";
    noSend?: boolean;
    noSendChange?: OutPoint[];
    sendWith?: string[];
    randomizeOutputs?: boolean;
}

See also: OutPoint, TrustSelf

Interface CreateActionOptions Details
Property acceptDelayedBroadcast

true if local validation and self-signed mapi response is sufficient. Upon return, transaction will have sending status. Watchman will proceed to send the transaction asynchronously.

false if a valid mapi response from the bitcoin transaction processing network is required. Upon return, transaction will have unproven status. Watchman will proceed to prove transaction.

default true

acceptDelayedBroadcast?: boolean
Property knownTxids

If the caller already has envelopes or BUMPS for certain txids, pass them in this array and they will be assumed to be valid and not returned again in the results.

knownTxids?: string[]
Property noSend

If true, successfully created transactions remain in the nosend state. A proof will be sought but it will not be considered an error if the txid remains unknown.

Supports testing, user control over broadcasting of transactions, and batching.

noSend?: boolean
Property noSendChange

Available transaction fee payment output(s) belonging to the user.

Only change outputs previously created by a noSend transaction.

Supports chained noSend transactions by minimizing the consumption and non-replenishment of change outputs.

noSendChange?: OutPoint[]

See also: OutPoint

Property randomizeOutputs

optional. When set to false, the wallet will avoid randomizing the order of outputs within the transaction.

randomizeOutputs?: boolean
Property resultFormat

If 'beef', the results will format new transaction and supporting input proofs in BEEF format. If 'none', the results will include only the txid of the new transaction. Otherwise, the results will use EnvelopeEvidenceApi format.

resultFormat?: "beef" | "none"
Property sendWith

Setting sendWith to an array of txid values for previously created noSend transactions causes all of them to be sent to the bitcoin network as a single batch of transactions.

When using sendWith, createAction can be called without inputs or outputs, in which case previously created noSend transactions will be sent without creating a new transaction.

sendWith?: string[]
Property trustSelf

If undefined, normal case, all inputs must be provably valid by chain of rawTx and merkle proof values, and results will include new rawTx and proof chains for new outputs.

If 'known', any input txid corresponding to a previously processed transaction may ommit its rawTx and proofs, and results will exclude new rawTx and proof chains for new outputs.

trustSelf?: TrustSelf

See also: TrustSelf

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionOptions

export interface CreateActionOptions {
    signAndProcess?: BooleanDefaultTrue;
    acceptDelayedBroadcast?: BooleanDefaultTrue;
    trustSelf?: TrustSelf;
    knownTxids?: TXIDHexString[];
    returnTXIDOnly?: BooleanDefaultFalse;
    noSend?: BooleanDefaultFalse;
    noSendChange?: OutpointString[];
    sendWith?: TXIDHexString[];
    randomizeOutputs?: BooleanDefaultTrue;
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, OutpointString, TXIDHexString, TrustSelf

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionOutput

A specific output to be created as part of a new transactions. These outputs can contain custom scripts as specified by recipients.

export interface CreateActionOutput {
    script: string;
    satoshis: number;
    description?: string;
    basket?: string;
    customInstructions?: string;
    tags?: string[];
}
Interface CreateActionOutput Details
Property basket

Destination output basket name for the new UTXO

basket?: string
Property customInstructions

Custom spending instructions (metadata, string, optional)

customInstructions?: string
Property description

Human-readable output line-item description

description?: string
Property satoshis

The amount of the output in satoshis

satoshis: number
Property script

The output script that will be included, hex encoded

script: string
Property tags

Optional array of output tags to assign to this output.

tags?: string[]

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionOutput

export interface CreateActionOutput {
    lockingScript: HexString;
    satoshis: SatoshiValue;
    outputDescription: DescriptionString5to50Bytes;
    basket?: BasketStringUnder300Bytes;
    customInstructions?: string;
    tags?: OutputTagStringUnder300Bytes[];
}

See also: BasketStringUnder300Bytes, DescriptionString5to50Bytes, HexString, OutputTagStringUnder300Bytes, SatoshiValue

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionOutputToRedeem

export interface CreateActionOutputToRedeem {
    index: number;
    unlockingScript: string | number;
    spendingDescription?: string;
    sequenceNumber?: number;
}
Interface CreateActionOutputToRedeem Details
Property index

Zero based output index within its transaction to spend, vout.

index: number
Property sequenceNumber

Sequence number to use when spending

sequenceNumber?: number
Property unlockingScript

Hex scriptcode that unlocks the satoshis or the maximum script length (in bytes) if using signAction.

Note that you should create any signatures with SIGHASH_NONE | ANYONECANPAY or similar so that the additional Dojo outputs can be added afterward without invalidating your signature.

unlockingScript: string | number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionParams

export interface CreateActionParams {
    description: string;
    inputs?: Record<string, CreateActionInput>;
    beef?: Beef | number[];
    outputs?: CreateActionOutput[];
    lockTime?: number;
    version?: number;
    labels?: string[];
    originator?: string;
    options?: CreateActionOptions;
    acceptDelayedBroadcast?: boolean;
    log?: string;
}

See also: CreateActionInput, CreateActionOptions, CreateActionOutput

Interface CreateActionParams Details
Property acceptDelayedBroadcast

true if local validation and self-signed mapi response is sufficient. Upon return, transaction will have sending status. Watchman will proceed to send the transaction asynchronously.

false if a valid mapi response from the bitcoin transaction processing network is required. Upon return, transaction will have unproven status. Watchman will proceed to prove transaction.

default true

DEPRECATED: Use options.acceptDelayedBroadcast instead.

acceptDelayedBroadcast?: boolean
Property beef

Optional. Alternate source of validity proof data for inputs. If number[] it must be serialized Beef.

beef?: Beef | number[]
Property description

Human readable string giving the purpose of this transaction. Value will be encrypted prior to leaving this device. Encrypted length limit is 500 characters.

description: string
Property inputs

If an input is self-provided (known to user's Dojo), or if beef is used, envelope evidence can be ommitted, reducing data size and processing time.

each input's outputsToRedeem:

  • satoshis must be greater than zero, must match output's value.
  • spendingDescription length limit is 50, values are encrypted before leaving this device
  • unlockingScript is max byte length for signActionRequired mode, otherwise hex string.
inputs?: Record<string, CreateActionInput>

See also: CreateActionInput

Property labels

transaction labels to apply to this transaction default []

labels?: string[]
Property lockTime

Optional. Default is zero. When the transaction can be processed into a block:

= 500,000,000 values are interpreted as minimum required unix time stamps in seconds < 500,000,000 values are interpreted as minimum required block height

lockTime?: number
Property options

Processing options.

options?: CreateActionOptions

See also: CreateActionOptions

Property originator

Reserved Admin originators 'projectbabbage.com' 'staging-satoshiframe.babbage.systems' 'satoshiframe.babbage.systems'

originator?: string
Property outputs

each output:

  • description length limit is 50, values are encrypted before leaving this device
outputs?: CreateActionOutput[]

See also: CreateActionOutput

Property version

Optional. Transaction version number, default is current standard transaction version value.

version?: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionResult

export interface CreateActionResult {
    signActionRequired?: boolean;
    createResult?: DojoCreateTransactionResultApi;
    txid?: string;
    rawTx?: string;
    inputs?: Record<string, OptionalEnvelopeEvidenceApi>;
    beef?: number[];
    noSendChange?: OutPoint[];
    mapiResponses?: MapiResponseApi[];
    sendWithResults?: DojoSendWithResultsApi[];
    options?: CreateActionOptions;
    log?: string;
}

See also: CreateActionOptions, DojoCreateTransactionResultApi, DojoSendWithResultsApi, MapiResponseApi, OptionalEnvelopeEvidenceApi, OutPoint

Interface CreateActionResult Details
Property beef

Valid for options.resultFormat 'beef', in which case rawTx and inputs will be undefined.

Change output(s) that may be forwarded to chained noSend transactions.

beef?: number[]
Property createResult

if signActionRequired, the dojo createTransaction results to be forwarded to signAction

createResult?: DojoCreateTransactionResultApi

See also: DojoCreateTransactionResultApi

Property inputs

This is the fully-formed inputs field of this transaction, as per the SPV Envelope specification.

inputs?: Record<string, OptionalEnvelopeEvidenceApi>

See also: OptionalEnvelopeEvidenceApi

Property log

operational and performance logging if enabled.

log?: string
Property mapiResponses

If not signActionRequired, at least one valid mapi response. may be a self-signed response if acceptDelayedBroadcast is true.

If signActionRequired, empty array.

mapiResponses?: MapiResponseApi[]

See also: MapiResponseApi

Property noSendChange

Valid for options.noSend true.

Change output(s) that may be forwarded to chained noSend transactions.

noSendChange?: OutPoint[]

See also: OutPoint

Property options

Processing options.

options?: CreateActionOptions

See also: CreateActionOptions

Property rawTx

if not signActionRequired, fully signed transaction as LE hex string

if signActionRequired:

  • All length specified unlocking scripts are zero bytes
  • All SABPPP template unlocking scripts have zero byte signatures
  • All custom provided unlocking scripts fully copied.
rawTx?: string
Property signActionRequired

true if at least one input's outputsToRedeem uses numeric max script byte length for unlockingScript

If true, in-process transaction will have status unsigned. An unsigned transaction must be completed by signing all remaining unsigned inputs and calling signAction. Failure to complete the process in a timely manner will cause the transaction to transition to failed.

If false or undefined, completed transaction will have status of sending, nosend or unproven, depending on acceptDelayedBroadcast and noSend.

signActionRequired?: boolean
Property txid

if not signActionRequired, signed transaction hash (double SHA256 BE hex string)

txid?: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateActionResult

export interface CreateActionResult {
    txid?: TXIDHexString;
    tx?: AtomicBEEF;
    noSendChange?: OutpointString[];
    sendWithResults?: SendWithResult[];
    signableTransaction?: SignableTransaction;
}

See also: AtomicBEEF, OutpointString, SendWithResult, SignableTransaction, TXIDHexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateCertificateResult

export interface CreateCertificateResult extends CertificateApi {
    type: string;
    subject: string;
    validationKey: string;
    serialNumber: string;
    certifier: string;
    revocationOutpoint: string;
    signature: string;
    fields?: Record<string, string>;
    masterKeyring?: Record<string, string>;
}

See also: CertificateApi

Interface CreateCertificateResult Details
Property certifier

max length of 255

certifier: string
Property fields

Certificate fields object where keys are field names and values are field value.

fields?: Record<string, string>
Property masterKeyring

Certificate masterKeyring object where keys are field names and values are field masterKey value.

masterKeyring?: Record<string, string>
Property revocationOutpoint

max length of 255

revocationOutpoint: string
Property serialNumber

max length of 255

serialNumber: string
Property signature

max length of 255

signature: string
Property subject

max length of 255

subject: string
Property type

max length of 255

type: string
Property validationKey

max length of 255

validationKey: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateHmacArgs

export interface CreateHmacArgs extends WalletEncryptionArgs {
    data: Byte[];
}

See also: Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateHmacResult

export interface CreateHmacResult {
    hmac: Byte[];
}

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateSignatureArgs

export interface CreateSignatureArgs extends WalletEncryptionArgs {
    data?: Byte[];
    hashToDirectlySign?: Byte[];
}

See also: Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: CreateSignatureResult

export interface CreateSignatureResult {
    signature: Byte[];
}

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DiscoverByAttributesArgs

export interface DiscoverByAttributesArgs {
    attributes: Record<CertificateFieldNameUnder50Bytes, string>;
    limit?: PositiveIntegerDefault10Max10000;
    offset?: PositiveIntegerOrZero;
    seekPermission?: BooleanDefaultTrue;
}

See also: BooleanDefaultTrue, CertificateFieldNameUnder50Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DiscoverByIdentityKeyArgs

export interface DiscoverByIdentityKeyArgs {
    identityKey: PubKeyHex;
    limit?: PositiveIntegerDefault10Max10000;
    offset?: PositiveIntegerOrZero;
    seekPermission?: BooleanDefaultTrue;
}

See also: BooleanDefaultTrue, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DiscoverCertificatesResult

export interface DiscoverCertificatesResult {
    totalCertificates: PositiveIntegerOrZero;
    certificates: IdentityCertificate[];
}

See also: IdentityCertificate, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoCreateTransactionResultApi

export interface DojoCreateTransactionResultApi {
    inputs: Record<string, DojoCreatingTxInputsApi>;
    outputs: DojoCreateTxResultOutputApi[];
    derivationPrefix: string;
    version: number;
    lockTime: number;
    referenceNumber: string;
    paymailHandle: string;
    note?: string;
    log?: string;
}

See also: DojoCreateTxResultOutputApi, DojoCreatingTxInputsApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoCreateTxOutputApi

A specific output to be created as part of a new transactions. These outputs can contain custom scripts as specified by recipients.

export interface DojoCreateTxOutputApi {
    script: string;
    satoshis: number;
    description?: string;
    basket?: string;
    customInstructions?: string;
    tags?: string[];
}
Interface DojoCreateTxOutputApi Details
Property basket

Destination output basket name for the new UTXO

basket?: string
Property customInstructions

Custom spending instructions (metadata, string, optional)

customInstructions?: string
Property description

Human-readable output line-item description

description?: string
Property satoshis

The amount of the output in satoshis

satoshis: number
Property script

The output script that will be included, hex encoded

script: string
Property tags

Optional array of output tags to assign to this output.

tags?: string[]

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoCreateTxResultInstructionsApi

export interface DojoCreateTxResultInstructionsApi {
    type: string;
    derivationPrefix?: string;
    derivationSuffix?: string;
    senderIdentityKey?: string;
    paymailHandle?: string;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoCreateTxResultOutputApi

export interface DojoCreateTxResultOutputApi extends DojoCreateTxOutputApi {
    providedBy: DojoProvidedByApi;
    purpose?: string;
    destinationBasket?: string;
    derivationSuffix?: string;
    keyOffset?: string;
}

See also: DojoCreateTxOutputApi, DojoProvidedByApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoCreatingTxInputsApi

export interface DojoCreatingTxInputsApi extends EnvelopeEvidenceApi {
    outputsToRedeem: DojoOutputToRedeemApi[];
    providedBy: DojoProvidedByApi;
    instructions: Record<number, DojoCreateTxResultInstructionsApi>;
}

See also: DojoCreateTxResultInstructionsApi, DojoOutputToRedeemApi, DojoProvidedByApi, EnvelopeEvidenceApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoOutputToRedeemApi

export interface DojoOutputToRedeemApi {
    index: number;
    unlockingScriptLength: number;
    spendingDescription?: string;
}
Interface DojoOutputToRedeemApi Details
Property index

Zero based output index within its transaction to spend.

index: number
Property unlockingScriptLength

byte length of unlocking script

Note: To protect client keys and utxo control, unlocking scripts are never shared with Dojo.

unlockingScriptLength: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: DojoSendWithResultsApi

export interface DojoSendWithResultsApi {
    txid: string;
    transactionId: number;
    reference: string;
    status: "unproven" | "failed" | "sending";
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: EnvelopeApi

Simplest case of an envelope is a rawTx and merkle proof that ties the transaction to a known block header. This will be the case for any sufficiently old transaction.

If the transaction has been mined but for some reason the block headers may not be known, an array of headers linking known headers to the one needed by the proof may be provided. They must be in height order and need to overlap a known header.

If the transaction has not been minded yet but it has been submitted to one or more miners then the mapi responses received, proving that specific miners have received the transaction for processing, are included in the mapiResponses array. Note that the miner reputations must be checked to give weight to these responses.

Additionally, when the transaction hasn't been mined or a proof is unavailable and mapi responses proving miner acceptance are unavailable, then all the transactions providing inputs can be submitted in an inputs object.

The keys of the inputs object are the transaction hashes (txids) of each of the input transactions. The value of each inputs object property is another envelope object.

References: Section 2 of https://projectbabbage.com/assets/simplified-payments.pdf https://gist.github.com/ty-everett/44b6a0e7f3d6c48439f9ff26068f8d8b

export interface EnvelopeApi extends EnvelopeEvidenceApi {
    headers?: string[];
    reference?: string;
}

See also: EnvelopeEvidenceApi

Interface EnvelopeApi Details
Property headers

For root nodes only. Array of 80 byte block headers encoded as 160 character hex strings Include headers the envelope creator is aware of but which the resipient may not have.

headers?: string[]
Property reference

Arbitrary reference string associated with the envelope, typically root node only.

reference?: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: EnvelopeEvidenceApi

Either inputs or proof are required.

export interface EnvelopeEvidenceApi {
    rawTx: string;
    proof?: TscMerkleProofApi | Buffer;
    inputs?: Record<string, EnvelopeEvidenceApi>;
    txid?: string;
    mapiResponses?: MapiResponseApi[];
    depth?: number;
}

See also: MapiResponseApi, TscMerkleProofApi

Interface EnvelopeEvidenceApi Details
Property depth

count of maximum number of chained unproven transactions before a proven leaf node proof nodes have depth zero.

depth?: number
Property inputs

Only one of proof or inputs must be valid. Branching nodes have inputs with a sub envelope (values) for every input transaction txid (keys)

inputs?: Record<string, EnvelopeEvidenceApi>

See also: EnvelopeEvidenceApi

Property mapiResponses

Array of mapi transaction status update responses Only the payload, signature, and publicKey properties are relevant.

Branching inputs nodes only. Array of mapi transaction status update responses confirming unproven transctions have at least been submitted for processing.

mapiResponses?: MapiResponseApi[]

See also: MapiResponseApi

Property proof

Either proof, or inputs, must have a value. Leaf nodes have proofs.

If value is a Buffer, content is binary encoded serialized proof see: chaintracks-spv.utils.serializeTscMerkleProof

proof?: TscMerkleProofApi | Buffer

See also: TscMerkleProofApi

Property rawTx

A valid bitcoin transaction encoded as a hex string.

rawTx: string
Property txid

double SHA256 hash of serialized rawTx. Optional.

txid?: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetHeaderArgs

export interface GetHeaderArgs {
    height: PositiveInteger;
}

See also: PositiveInteger

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetHeaderResult

export interface GetHeaderResult {
    header: HexString;
}

See also: HexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetHeightResult

export interface GetHeightResult {
    height: PositiveInteger;
}

See also: PositiveInteger

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetInfoParams

export interface GetInfoParams {
    description?: string;
}
Interface GetInfoParams Details
Property description

Describe the high-level operation being performed, so that the user can make an informed decision if permission is needed.

description?: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetInfoResult

export interface GetInfoResult {
    metanetClientVersion: string;
    chain: Chain;
    height: number;
    userId: number;
    userIdentityKey: string;
    dojoIdentityKey: string;
    dojoIdentityName?: string;
    perferredCurrency: string;
}

See also: Chain

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetNetworkResult

export interface GetNetworkResult {
    network: WalletNetwork;
}

See also: WalletNetwork

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetPublicKeyArgs

When identityKey is true, WalletEncryptionArgs are not used.

When identityKey is undefined, WalletEncryptionArgs are required.

export interface GetPublicKeyArgs extends Partial<WalletEncryptionArgs> {
    identityKey?: true;
    forSelf?: BooleanDefaultFalse;
}

See also: BooleanDefaultFalse, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetPublicKeyResult

export interface GetPublicKeyResult {
    publicKey: PubKeyHex;
}

See also: PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetTransactionOutputResult

export interface GetTransactionOutputResult {
    txid: string;
    vout: number;
    amount: number;
    outputScript: string;
    type: string;
    spendable: boolean;
    envelope?: EnvelopeApi;
    customInstructions?: string;
    basket?: string;
    tags?: string[];
}

See also: EnvelopeApi

Interface GetTransactionOutputResult Details
Property amount

Number of satoshis in the output

amount: number
Property basket

If includeBasket option is true, name of basket to which this output belongs.

basket?: string
Property customInstructions

When envelope requested, any custom instructions associated with this output.

customInstructions?: string
Property envelope

When requested and available, output validity support envelope.

envelope?: EnvelopeApi

See also: EnvelopeApi

Property outputScript

Hex representation of output locking script

outputScript: string
Property spendable

Whether this output is free to be spent

spendable: boolean
Property tags

If includeTags option is true, tags assigned to this output.

tags?: string[]
Property txid

Transaction ID of transaction that created the output

txid: string
Property type

The type of output, for example "P2PKH" or "P2RPH"

type: string
Property vout

Index in the transaction of the output

vout: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: GetVersionResult

export interface GetVersionResult {
    version: VersionString7To30Bytes;
}

See also: VersionString7To30Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: IdentityCertificate

export interface IdentityCertificate extends WalletCertificate {
    certifierInfo: IdentityCertifier;
    publiclyRevealedKeyring: Record<CertificateFieldNameUnder50Bytes, Base64String>;
    decryptedFields: Record<CertificateFieldNameUnder50Bytes, string>;
}

See also: Base64String, CertificateFieldNameUnder50Bytes, IdentityCertifier, WalletCertificate

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: IdentityCertifier

export interface IdentityCertifier {
    name: EntityNameStringMax100Bytes;
    iconUrl: EntityIconURLStringMax500Bytes;
    description: DescriptionString5to50Bytes;
    trust: PositiveIntegerMax10;
}

See also: DescriptionString5to50Bytes, EntityIconURLStringMax500Bytes, EntityNameStringMax100Bytes, PositiveIntegerMax10

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: InternalizeActionArgs

export interface InternalizeActionArgs {
    tx: AtomicBEEF;
    outputs: InternalizeOutput[];
    description: DescriptionString5to50Bytes;
    labels?: LabelStringUnder300Bytes[];
    seekPermission?: BooleanDefaultTrue;
}

See also: AtomicBEEF, BooleanDefaultTrue, DescriptionString5to50Bytes, InternalizeOutput, LabelStringUnder300Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: InternalizeActionResult

export interface InternalizeActionResult {
    accepted: true;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: InternalizeOutput

export interface InternalizeOutput {
    outputIndex: PositiveIntegerOrZero;
    protocol: "wallet payment" | "basket insertion";
    paymentRemittance?: WalletPayment;
    insertionRemittance?: BasketInsertion;
}

See also: BasketInsertion, PositiveIntegerOrZero, WalletPayment

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: KeyDeriverApi

export interface KeyDeriverApi {
    rootKey: PrivateKey;
    identityKey: string;
    derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean): PublicKey;
    derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey;
    deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey;
    revealCounterpartySecret(counterparty: Counterparty): number[];
    revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[];
}

See also: Counterparty, WalletProtocol

Interface KeyDeriverApi Details
Property identityKey

The identity of this key deriver which is normally the public key associated with the rootKey

identityKey: string
Property rootKey

The root key from which all other keys are derived.

rootKey: PrivateKey
Method derivePrivateKey

Derives a private key based on protocol ID, key ID, and counterparty.

derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey

See also: Counterparty, WalletProtocol

Returns

  • The derived private key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
Method derivePublicKey

Derives a public key based on protocol ID, key ID, and counterparty.

derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf?: boolean): PublicKey

See also: Counterparty, WalletProtocol

Returns

  • The derived public key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • forSelf
    • Optional. false if undefined. Whether deriving for self.
Method deriveSymmetricKey

Derives a symmetric key based on protocol ID, key ID, and counterparty. Note: Symmetric keys should not be derivable by everyone due to security risks.

deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey

See also: Counterparty, WalletProtocol

Returns

  • The derived symmetric key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to derive a symmetric key for 'anyone'.
Method revealCounterpartySecret

Reveals the shared secret between the root key and the counterparty. Note: This should not be used for 'self'.

revealCounterpartySecret(counterparty: Counterparty): number[]

See also: Counterparty

Returns

  • The shared secret as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to reveal a shared secret for 'self'.
Method revealSpecificSecret

Reveals the specific key association for a given protocol ID, key ID, and counterparty.

revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[]

See also: Counterparty, WalletProtocol

Returns

  • The specific key association as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: KeyLinkageResult

export interface KeyLinkageResult {
    encryptedLinkage: Byte[];
    encryptedLinkageProof: Byte[];
    prover: PubKeyHex;
    verifier: PubKeyHex;
    counterparty: PubKeyHex;
}

See also: Byte, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsArgs

export interface ListActionsArgs {
    labels: LabelStringUnder300Bytes[];
    labelQueryMode?: "any" | "all";
    includeLabels?: BooleanDefaultFalse;
    includeInputs?: BooleanDefaultFalse;
    includeInputSourceLockingScripts?: BooleanDefaultFalse;
    includeInputUnlockingScripts?: BooleanDefaultFalse;
    includeOutputs?: BooleanDefaultFalse;
    includeOutputLockingScripts?: BooleanDefaultFalse;
    limit?: PositiveIntegerDefault10Max10000;
    offset?: PositiveIntegerOrZero;
    seekPermission?: BooleanDefaultTrue;
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, LabelStringUnder300Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsResult

export interface ListActionsResult {
    totalTransactions: number;
    transactions: ListActionsTransaction[];
}

See also: ListActionsTransaction

Interface ListActionsResult Details
Property totalTransactions

The number of transactions in the complete set

totalTransactions: number
Property transactions

The specific transactions from the set that were requested, based on limit and offset

transactions: ListActionsTransaction[]

See also: ListActionsTransaction

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsResult

export interface ListActionsResult {
    totalActions: PositiveIntegerOrZero;
    actions: WalletAction[];
}

See also: PositiveIntegerOrZero, WalletAction

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsTransaction

export interface ListActionsTransaction {
    txid: string;
    amount: number;
    status: TransactionStatusApi;
    senderPaymail: string;
    recipientPaymail: string;
    isOutgoing: boolean;
    note: string;
    created_at: string;
    referenceNumber: string;
    labels: string[];
    inputs?: ListActionsTransactionInput[];
    outputs?: ListActionsTransactionOutput[];
}

See also: ListActionsTransactionInput, ListActionsTransactionOutput, TransactionStatusApi

Interface ListActionsTransaction Details
Property amount

The number of satoshis added or removed from Dojo by this transaction

amount: number
Property created_at

The time the transaction was registered with the Dojo

created_at: string
Property isOutgoing

Whether or not the transaction was created with createTransaction

isOutgoing: boolean
Property labels

A set of all the labels affixed to the transaction

labels: string[]
Property note

The human-readable tag for the transaction, provided by the person who initiated it

note: string
Property recipientPaymail

The Paymail handle of the person who received the transaction

recipientPaymail: string
Property referenceNumber

The Dojo reference number for the transaction

referenceNumber: string
Property senderPaymail

The Paymail handle of the person who sent the transaction

senderPaymail: string
Property status

The current state of the transaction. Common statuses are completed and unproven.

status: TransactionStatusApi

See also: TransactionStatusApi

Property txid

The transaction ID

txid: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsTransactionInput

export interface ListActionsTransactionInput {
    txid: string;
    vout: number;
    amount: number;
    outputScript: string;
    type: string;
    spendable: boolean;
    spendingDescription?: string;
    basket?: string;
    tags?: string[];
}
Interface ListActionsTransactionInput Details
Property amount

Number of satoshis in the output

amount: number
Property basket

Optionally included basket assignment.

basket?: string
Property outputScript

Hex representation of output locking script

outputScript: string
Property spendable

Whether this output is free to be spent

spendable: boolean
Property spendingDescription

Spending description for this transaction input

spendingDescription?: string
Property tags

Optionally included tag assignments.

tags?: string[]
Property txid

Transaction ID of transaction that created the output

txid: string
Property type

The type of output, for example "P2PKH" or "P2RPH"

type: string
Property vout

Index in the transaction of the output

vout: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListActionsTransactionOutput

export interface ListActionsTransactionOutput {
    txid: string;
    vout: number;
    amount: number;
    outputScript: string;
    type: string;
    spendable: boolean;
    description?: string;
    basket?: string;
    tags?: string[];
}
Interface ListActionsTransactionOutput Details
Property amount

Number of satoshis in the output

amount: number
Property basket

Optionally included basket assignment.

basket?: string
Property description

Output description

description?: string
Property outputScript

Hex representation of output locking script

outputScript: string
Property spendable

Whether this output is free to be spent

spendable: boolean
Property tags

Optionally included tag assignments.

tags?: string[]
Property txid

Transaction ID of transaction that created the output

txid: string
Property type

The type of output, for example "P2PKH" or "P2RPH"

type: string
Property vout

Index in the transaction of the output

vout: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListCertificatesArgs

export interface ListCertificatesArgs {
    certifiers: PubKeyHex[];
    types: Base64String[];
    limit?: PositiveIntegerDefault10Max10000;
    offset?: PositiveIntegerOrZero;
    privileged?: BooleanDefaultFalse;
    privilegedReason?: DescriptionString5to50Bytes;
}

See also: Base64String, BooleanDefaultFalse, DescriptionString5to50Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListCertificatesResult

export interface ListCertificatesResult {
    totalCertificates: PositiveIntegerOrZero;
    certificates: WalletCertificate[];
}

See also: PositiveIntegerOrZero, WalletCertificate

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListOutputsArgs

export interface ListOutputsArgs {
    basket: BasketStringUnder300Bytes;
    tags?: OutputTagStringUnder300Bytes[];
    tagQueryMode?: "all" | "any";
    include?: "locking scripts" | "entire transactions";
    includeCustomInstructions?: BooleanDefaultFalse;
    includeTags?: BooleanDefaultFalse;
    includeLabels?: BooleanDefaultFalse;
    limit?: PositiveIntegerDefault10Max10000;
    offset?: PositiveIntegerOrZero;
    seekPermission?: BooleanDefaultTrue;
}

See also: BasketStringUnder300Bytes, BooleanDefaultFalse, BooleanDefaultTrue, OutputTagStringUnder300Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ListOutputsResult

export interface ListOutputsResult {
    totalOutputs: PositiveIntegerOrZero;
    BEEF?: BEEF;
    outputs: WalletOutput[];
}

See also: BEEF, PositiveIntegerOrZero, WalletOutput

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: MapiResponseApi

export interface MapiResponseApi {
    payload: string;
    signature: string;
    publicKey: string;
    encoding?: string;
    mimetype?: string;
}
Interface MapiResponseApi Details
Property encoding

encoding of the payload data

encoding?: string
Property mimetype

mime type of the payload data

mimetype?: string
Property payload

Contents of the envelope. Validate using signature and publicKey. encoding and mimetype may assist with decoding validated payload.

payload: string
Property publicKey

public key to use to verify signature of payload data

publicKey: string
Property signature

signature producted by correpsonding private key on payload data

signature: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: OptionalEnvelopeEvidenceApi

Either rawTx or txid are required. If txid, then it must be a known transaction.

If not a known trxid, either inputs or proof are required.

export interface OptionalEnvelopeEvidenceApi {
    rawTx?: string;
    proof?: TscMerkleProofApi | Buffer;
    inputs?: Record<string, OptionalEnvelopeEvidenceApi>;
    txid?: string;
    mapiResponses?: MapiResponseApi[];
    depth?: number;
}

See also: MapiResponseApi, TscMerkleProofApi

Interface OptionalEnvelopeEvidenceApi Details
Property depth

count of maximum number of chained unproven transactions before a proven leaf node proof nodes have depth zero.

depth?: number
Property inputs

Only one of proof or inputs must be valid. Branching nodes have inputs with a sub envelope (values) for every input transaction txid (keys)

inputs?: Record<string, OptionalEnvelopeEvidenceApi>

See also: OptionalEnvelopeEvidenceApi

Property mapiResponses

Array of mapi transaction status update responses Only the payload, signature, and publicKey properties are relevant.

Branching inputs nodes only. Array of mapi transaction status update responses confirming unproven transctions have at least been submitted for processing.

mapiResponses?: MapiResponseApi[]

See also: MapiResponseApi

Property proof

Either proof, or inputs, must have a value. Leaf nodes have proofs.

If value is a Buffer, content is binary encoded serialized proof see: chaintracks-spv.utils.serializeTscMerkleProof

proof?: TscMerkleProofApi | Buffer

See also: TscMerkleProofApi

Property rawTx

A valid bitcoin transaction encoded as a hex string.

rawTx?: string
Property txid

double SHA256 hash of serialized rawTx. Optional.

txid?: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: OutPoint

Identifies a unique transaction output by its txid and index vout

export interface OutPoint {
    txid: string;
    vout: number;
}
Interface OutPoint Details
Property txid

Transaction double sha256 hash as big endian hex string

txid: string
Property vout

zero based output index within the transaction

vout: number

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ProveCertificateArgs

export interface ProveCertificateArgs {
    certificate: WalletCertificate;
    fieldsToReveal: CertificateFieldNameUnder50Bytes[];
    verifier: PubKeyHex;
    privileged?: BooleanDefaultFalse;
    privilegedReason?: DescriptionString5to50Bytes;
}

See also: BooleanDefaultFalse, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, PubKeyHex, WalletCertificate

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ProveCertificateResult

export interface ProveCertificateResult extends CertificateApi {
    type: string;
    subject: string;
    validationKey: string;
    serialNumber: string;
    certifier: string;
    revocationOutpoint: string;
    signature: string;
    fields?: Record<string, string>;
    keyring: Record<string, string>;
}

See also: CertificateApi

Interface ProveCertificateResult Details
Property certifier

max length of 255

certifier: string
Property fields

Plaintext field names and values of only those fields requested in fieldsToReveal

fields?: Record<string, string>
Property keyring

field revelation keyring for the given verifier

keyring: Record<string, string>
Property revocationOutpoint

max length of 255

revocationOutpoint: string
Property serialNumber

max length of 255

serialNumber: string
Property signature

max length of 255

signature: string
Property subject

max length of 255

subject: string
Property type

max length of 255

type: string
Property validationKey

max length of 255

validationKey: string

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ProveCertificateResult

export interface ProveCertificateResult {
    keyringForVerifier: Record<CertificateFieldNameUnder50Bytes, Base64String>;
}

See also: Base64String, CertificateFieldNameUnder50Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RelinquishCertificateArgs

export interface RelinquishCertificateArgs {
    type: Base64String;
    serialNumber: Base64String;
    certifier: PubKeyHex;
}

See also: Base64String, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RelinquishCertificateResult

export interface RelinquishCertificateResult {
    relinquished: boolean;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RelinquishOutputArgs

export interface RelinquishOutputArgs {
    basket: BasketStringUnder300Bytes;
    output: OutpointString;
}

See also: BasketStringUnder300Bytes, OutpointString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RelinquishOutputResult

export interface RelinquishOutputResult {
    relinquished: true;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RevealCounterpartyKeyLinkageArgs

export interface RevealCounterpartyKeyLinkageArgs {
    counterparty: PubKeyHex;
    verifier: PubKeyHex;
    privileged?: BooleanDefaultFalse;
    privilegedReason?: DescriptionString5to50Bytes;
}

See also: BooleanDefaultFalse, DescriptionString5to50Bytes, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RevealCounterpartyKeyLinkageResult

export interface RevealCounterpartyKeyLinkageResult extends KeyLinkageResult {
    revelationTime: ISOTimestampString;
}

See also: ISOTimestampString, KeyLinkageResult

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RevealSpecificKeyLinkageArgs

export interface RevealSpecificKeyLinkageArgs {
    counterparty: WalletCounterparty;
    verifier: PubKeyHex;
    protocolID: WalletProtocol;
    keyID: KeyIDStringUnder800Bytes;
    privilegedReason?: DescriptionString5to50Bytes;
    privileged?: BooleanDefaultFalse;
}

See also: BooleanDefaultFalse, DescriptionString5to50Bytes, KeyIDStringUnder800Bytes, PubKeyHex, WalletCounterparty, WalletProtocol

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: RevealSpecificKeyLinkageResult

export interface RevealSpecificKeyLinkageResult extends KeyLinkageResult {
    protocolID: WalletProtocol;
    keyID: KeyIDStringUnder800Bytes;
    proofType: Byte;
}

See also: Byte, KeyIDStringUnder800Bytes, KeyLinkageResult, WalletProtocol

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SendWithResult

export interface SendWithResult {
    txid: TXIDHexString;
    status: SendWithResultStatus;
}

See also: SendWithResultStatus, TXIDHexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignActionArgs

export interface SignActionArgs {
    spends: Record<PositiveIntegerOrZero, SignActionSpend>;
    reference: Base64String;
    options?: SignActionOptions;
}

See also: Base64String, PositiveIntegerOrZero, SignActionOptions, SignActionSpend

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignActionOptions

export interface SignActionOptions {
    acceptDelayedBroadcast?: BooleanDefaultTrue;
    returnTXIDOnly?: BooleanDefaultFalse;
    noSend?: BooleanDefaultFalse;
    sendWith?: TXIDHexString[];
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, TXIDHexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignActionResult

export interface SignActionResult {
    rawTx: string;
    inputs: Record<string, EnvelopeEvidenceApi>;
    mapiResponses: MapiResponseApi[];
    txid: string;
    log?: string;
}

See also: EnvelopeEvidenceApi, MapiResponseApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignActionResult

export interface SignActionResult {
    txid?: TXIDHexString;
    tx?: AtomicBEEF;
    sendWithResults?: SendWithResult[];
}

See also: AtomicBEEF, SendWithResult, TXIDHexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignActionSpend

export interface SignActionSpend {
    unlockingScript: HexString;
    sequenceNumber?: PositiveIntegerOrZero;
}

See also: HexString, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SignableTransaction

export interface SignableTransaction {
    tx: AtomicBEEF;
    reference: Base64String;
}

See also: AtomicBEEF, Base64String

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SpecificKeyLinkageResult

export interface SpecificKeyLinkageResult {
    type: "specific-revelation";
    prover: string;
    verifier: string;
    counterparty: string;
    protocolID: ProtocolID;
    encryptedLinkage: string;
}

See also: ProtocolID

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SubmitDirectTransaction

export interface SubmitDirectTransaction {
    rawTx: string;
    txid?: string;
    inputs?: Record<string, OptionalEnvelopeEvidenceApi>;
    mapiResponses?: MapiResponseApi[];
    proof?: TscMerkleProofApi;
    outputs: SubmitDirectTransactionOutput[];
    referenceNumber?: string;
}

See also: MapiResponseApi, OptionalEnvelopeEvidenceApi, SubmitDirectTransactionOutput, TscMerkleProofApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SubmitDirectTransactionOutput

export interface SubmitDirectTransactionOutput {
    vout: number;
    satoshis: number;
    basket?: string;
    derivationPrefix?: string;
    derivationSuffix?: string;
    customInstructions?: string;
    senderIdentityKey?: string;
    tags?: string[];
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: SubmitDirectTransactionResult

export interface SubmitDirectTransactionResult {
    transactionId: number;
    referenceNumber: string;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: TscMerkleProofApi

As defined in https://github.com/bitcoin-sv-specs/brfc-merchantapi/blob/master/README.md

export interface TscMerkleProofApi {
    height?: number;
    index: number;
    txOrId: string | Buffer;
    target: string | Buffer;
    nodes: string[] | Buffer;
    targetType?: "hash" | "header" | "merkleRoot" | "height";
    proofType?: "branch" | "tree";
    composite?: boolean;
}
Interface TscMerkleProofApi Details
Property height

The most efficient way of confirming a proof should also be the most common, when the containing block's height is known.

height?: number
Property index

Index of transaction in its block. First transaction is index zero.

index: number
Property nodes

Merkle tree sibling hash values required to compute root from txid. Duplicates (sibling hash === computed hash) are indicated by "*" or type byte === 1. type byte === 2... Strings are encoded as hex.

nodes: string[] | Buffer
Property target

Merkle root (length === 32) or serialized block header containing it (length === 80). If string, encoding is hex.

target: string | Buffer
Property txOrId

Full transaction (length > 32 bytes) or just its double SHA256 hash (length === 32 bytes). If string, encoding is hex.

txOrId: string | Buffer

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidAbortActionArgs

export interface ValidAbortActionArgs {
    reference: sdk.Base64String;
    log?: string;
}

See also: Base64String

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidAcquireCertificateArgs

export interface ValidAcquireCertificateArgs {
    type: sdk.Base64String;
    certifier: sdk.PubKeyHex;
    acquisitionProtocol: sdk.AcquisitionProtocol;
    fields: Record<sdk.CertificateFieldNameUnder50Bytes, string>;
    serialNumber?: sdk.Base64String;
    revocationOutpoint?: sdk.OutpointString;
    signature?: sdk.HexString;
    certifierUrl?: string;
    keyringRevealer?: sdk.KeyringRevealer;
    keyringForSubject?: Record<sdk.CertificateFieldNameUnder50Bytes, sdk.Base64String>;
    privileged?: sdk.BooleanDefaultFalse;
    privilegedReason?: sdk.DescriptionString5to50Bytes;
    log?: string;
}

See also: AcquisitionProtocol, Base64String, BooleanDefaultFalse, CertificateFieldNameUnder50Bytes, DescriptionString5to50Bytes, HexString, KeyringRevealer, OutpointString, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidBasketInsertion

export interface ValidBasketInsertion {
    basket: sdk.BasketStringUnder300Bytes;
    customInstructions?: string;
    tags: sdk.OutputTagStringUnder300Bytes[];
}

See also: BasketStringUnder300Bytes, OutputTagStringUnder300Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidCreateActionArgs

export interface ValidCreateActionArgs extends ValidProcessActionArgs {
    description: sdk.DescriptionString5to50Bytes;
    inputBEEF?: sdk.BEEF;
    inputs: sdk.ValidCreateActionInput[];
    outputs: sdk.ValidCreateActionOutput[];
    lockTime: number;
    version: number;
    labels: string[];
    options: ValidCreateActionOptions;
    isSignAction: boolean;
}

See also: BEEF, DescriptionString5to50Bytes, ValidCreateActionInput, ValidCreateActionOptions, ValidCreateActionOutput, ValidProcessActionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidCreateActionInput

export interface ValidCreateActionInput {
    outpoint: OutPoint;
    inputDescription: sdk.DescriptionString5to50Bytes;
    sequenceNumber: sdk.PositiveIntegerOrZero;
    unlockingScript?: sdk.HexString;
    unlockingScriptLength: sdk.PositiveInteger;
}

See also: DescriptionString5to50Bytes, HexString, OutPoint, PositiveInteger, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidCreateActionOptions

export interface ValidCreateActionOptions extends ValidProcessActionOptions {
    signAndProcess: boolean;
    trustSelf?: TrustSelf;
    knownTxids: sdk.TXIDHexString[];
    noSendChange: OutPoint[];
    randomizeOutputs: boolean;
}

See also: OutPoint, TXIDHexString, TrustSelf, ValidProcessActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidCreateActionOutput

export interface ValidCreateActionOutput {
    lockingScript: sdk.HexString;
    satoshis: sdk.SatoshiValue;
    outputDescription: sdk.DescriptionString5to50Bytes;
    basket?: sdk.BasketStringUnder300Bytes;
    customInstructions?: string;
    tags: sdk.OutputTagStringUnder300Bytes[];
}

See also: BasketStringUnder300Bytes, DescriptionString5to50Bytes, HexString, OutputTagStringUnder300Bytes, SatoshiValue

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidInternalizeActionArgs

export interface ValidInternalizeActionArgs {
    tx: sdk.AtomicBEEF;
    outputs: sdk.InternalizeOutput[];
    description: sdk.DescriptionString5to50Bytes;
    labels: sdk.LabelStringUnder300Bytes[];
    seekPermission: sdk.BooleanDefaultTrue;
    log?: string;
}

See also: AtomicBEEF, BooleanDefaultTrue, DescriptionString5to50Bytes, InternalizeOutput, LabelStringUnder300Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidInternalizeOutput

export interface ValidInternalizeOutput {
    outputIndex: sdk.PositiveIntegerOrZero;
    protocol: "wallet payment" | "basket insertion";
    paymentRemittance?: ValidWalletPayment;
    insertionRemittance?: ValidBasketInsertion;
}

See also: PositiveIntegerOrZero, ValidBasketInsertion, ValidWalletPayment

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidListActionsArgs

export interface ValidListActionsArgs {
    labels: sdk.LabelStringUnder300Bytes[];
    labelQueryMode: "any" | "all";
    includeLabels: sdk.BooleanDefaultFalse;
    includeInputs: sdk.BooleanDefaultFalse;
    includeInputSourceLockingScripts: sdk.BooleanDefaultFalse;
    includeInputUnlockingScripts: sdk.BooleanDefaultFalse;
    includeOutputs: sdk.BooleanDefaultFalse;
    includeOutputLockingScripts: sdk.BooleanDefaultFalse;
    limit: sdk.PositiveIntegerDefault10Max10000;
    offset: sdk.PositiveIntegerOrZero;
    seekPermission: sdk.BooleanDefaultTrue;
    log?: string;
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, LabelStringUnder300Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidListCertificatesArgs

export interface ValidListCertificatesArgs {
    certifiers: sdk.PubKeyHex[];
    types: sdk.Base64String[];
    limit: sdk.PositiveIntegerDefault10Max10000;
    offset: sdk.PositiveIntegerOrZero;
    privileged: sdk.BooleanDefaultFalse;
    privilegedReason?: sdk.DescriptionString5to50Bytes;
    log?: string;
}

See also: Base64String, BooleanDefaultFalse, DescriptionString5to50Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidListOutputsArgs

export interface ValidListOutputsArgs {
    basket: sdk.BasketStringUnder300Bytes;
    tags: sdk.OutputTagStringUnder300Bytes[];
    tagQueryMode: "all" | "any";
    includeLockingScripts: boolean;
    includeTransactions: boolean;
    includeCustomInstructions: sdk.BooleanDefaultFalse;
    includeTags: sdk.BooleanDefaultFalse;
    includeLabels: sdk.BooleanDefaultFalse;
    limit: sdk.PositiveIntegerDefault10Max10000;
    offset: sdk.PositiveIntegerOrZero;
    seekPermission: sdk.BooleanDefaultTrue;
    knownTxids: string[];
    log?: string;
}

See also: BasketStringUnder300Bytes, BooleanDefaultFalse, BooleanDefaultTrue, OutputTagStringUnder300Bytes, PositiveIntegerDefault10Max10000, PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidProcessActionArgs

export interface ValidProcessActionArgs {
    options: sdk.ValidProcessActionOptions;
    isSendWith: boolean;
    isNewTx: boolean;
    isNoSend: boolean;
    isDelayed: boolean;
    log?: string;
}

See also: ValidProcessActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidProcessActionOptions

export interface ValidProcessActionOptions {
    acceptDelayedBroadcast: sdk.BooleanDefaultTrue;
    returnTXIDOnly: sdk.BooleanDefaultFalse;
    noSend: sdk.BooleanDefaultFalse;
    sendWith: sdk.TXIDHexString[];
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, TXIDHexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidRelinquishOutputArgs

export interface ValidRelinquishOutputArgs {
    basket: sdk.BasketStringUnder300Bytes;
    output: sdk.OutpointString;
    log?: string;
}

See also: BasketStringUnder300Bytes, OutpointString

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidSignActionArgs

export interface ValidSignActionArgs extends ValidProcessActionArgs {
    spends: Record<sdk.PositiveIntegerOrZero, sdk.SignActionSpend>;
    reference: sdk.Base64String;
    options: sdk.ValidSignActionOptions;
}

See also: Base64String, PositiveIntegerOrZero, SignActionSpend, ValidProcessActionArgs, ValidSignActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidSignActionOptions

export interface ValidSignActionOptions extends ValidProcessActionOptions {
    acceptDelayedBroadcast: boolean;
    returnTXIDOnly: boolean;
    noSend: boolean;
    sendWith: sdk.TXIDHexString[];
}

See also: TXIDHexString, ValidProcessActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: ValidWalletPayment

export interface ValidWalletPayment {
    derivationPrefix: sdk.Base64String;
    derivationSuffix: sdk.Base64String;
    senderIdentityKey: sdk.PubKeyHex;
}

See also: Base64String, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: VerifyHmacArgs

export interface VerifyHmacArgs extends WalletEncryptionArgs {
    data: Byte[];
    hmac: Byte[];
}

See also: Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: VerifyHmacResult

export interface VerifyHmacResult {
    valid: boolean;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: VerifySignatureArgs

export interface VerifySignatureArgs extends WalletEncryptionArgs {
    data?: Byte[];
    hashToDirectlyVerify?: Byte[];
    signature: Byte[];
    forSelf?: BooleanDefaultFalse;
}

See also: BooleanDefaultFalse, Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: VerifySignatureResult

export interface VerifySignatureResult {
    valid: true;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: Wallet

The Wallet interface defines a wallet capable of various tasks including transaction creation and signing, encryption, decryption, identity certificate management, identity verification, and communication with applications as per the BRC standards. This interface allows applications to interact with the wallet for a range of functionalities aligned with the Babbage architectural principles.

Error Handling

Every method of the Wallet interface has a return value of the form Promise<object>. When an error occurs, an exception object may be thrown which must conform to the WalletErrorObject interface. Serialization layers can rely on the isError property being unique to error objects to deserialize and rethrow WalletErrorObject conforming objects.

export interface Wallet extends WalletCryptoObject {
    createAction: (args: CreateActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateActionResult>;
    signAction: (args: SignActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<SignActionResult>;
    abortAction: (args: AbortActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AbortActionResult>;
    listActions: (args: ListActionsArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListActionsResult>;
    internalizeAction: (args: InternalizeActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<InternalizeActionResult>;
    listOutputs: (args: ListOutputsArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListOutputsResult>;
    relinquishOutput: (args: RelinquishOutputArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RelinquishOutputResult>;
    acquireCertificate: (args: AcquireCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AcquireCertificateResult>;
    listCertificates: (args: ListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListCertificatesResult>;
    proveCertificate: (args: ProveCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ProveCertificateResult>;
    relinquishCertificate: (args: RelinquishCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RelinquishCertificateResult>;
    discoverByIdentityKey: (args: DiscoverByIdentityKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<DiscoverCertificatesResult>;
    discoverByAttributes: (args: DiscoverByAttributesArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<DiscoverCertificatesResult>;
    isAuthenticated: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AuthenticatedResult>;
    waitForAuthentication: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AuthenticatedResult>;
    getHeight: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetHeightResult>;
    getHeaderForHeight: (args: GetHeaderArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetHeaderResult>;
    getNetwork: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetNetworkResult>;
    getVersion: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetVersionResult>;
}

See also: AbortActionArgs, AbortActionResult, AcquireCertificateArgs, AcquireCertificateResult, AuthenticatedResult, CreateActionArgs, CreateActionResult, DiscoverByAttributesArgs, DiscoverByIdentityKeyArgs, DiscoverCertificatesResult, GetHeaderArgs, GetHeaderResult, GetHeightResult, GetNetworkResult, GetVersionResult, InternalizeActionArgs, InternalizeActionResult, ListActionsArgs, ListActionsResult, ListCertificatesArgs, ListCertificatesResult, ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes, ProveCertificateArgs, ProveCertificateResult, RelinquishCertificateArgs, RelinquishCertificateResult, RelinquishOutputArgs, RelinquishOutputResult, SignActionArgs, SignActionResult, WalletCryptoObject, abortAction, createAction, discoverByAttributes, discoverByIdentityKey, getHeight, getNetwork, getVersion, isAuthenticated, listActions, proveCertificate, signAction, waitForAuthentication

Interface Wallet Details
Property abortAction

Aborts a transaction that is in progress and has not yet been finalized or sent to the network.

abortAction: (args: AbortActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AbortActionResult>

See also: AbortActionArgs, AbortActionResult, OriginatorDomainNameStringUnder250Bytes

Property acquireCertificate

Acquires an identity certificate, whether by acquiring one from the certifier or by directly receiving it.

acquireCertificate: (args: AcquireCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AcquireCertificateResult>

See also: AcquireCertificateArgs, AcquireCertificateResult, OriginatorDomainNameStringUnder250Bytes

Property createAction

Creates a new Bitcoin transaction based on the provided inputs, outputs, labels, locks, and other options.

createAction: (args: CreateActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateActionResult>

See also: CreateActionArgs, CreateActionResult, OriginatorDomainNameStringUnder250Bytes

Property discoverByAttributes

Discovers identity certificates belonging to other users, where the documents contain specific attributes, issued by a trusted entity.

discoverByAttributes: (args: DiscoverByAttributesArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<DiscoverCertificatesResult>

See also: DiscoverByAttributesArgs, DiscoverCertificatesResult, OriginatorDomainNameStringUnder250Bytes

Property discoverByIdentityKey

Discovers identity certificates, issued to a given identity key by a trusted entity.

discoverByIdentityKey: (args: DiscoverByIdentityKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<DiscoverCertificatesResult>

See also: DiscoverByIdentityKeyArgs, DiscoverCertificatesResult, OriginatorDomainNameStringUnder250Bytes

Property getHeaderForHeight

Retrieves the block header of a block at a specified height.

getHeaderForHeight: (args: GetHeaderArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetHeaderResult>

See also: GetHeaderArgs, GetHeaderResult, OriginatorDomainNameStringUnder250Bytes

Property getHeight

Retrieves the current height of the blockchain.

getHeight: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetHeightResult>

See also: GetHeightResult, OriginatorDomainNameStringUnder250Bytes

Property getNetwork

Retrieves the Bitcoin network the client is using (mainnet or testnet).

getNetwork: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetNetworkResult>

See also: GetNetworkResult, OriginatorDomainNameStringUnder250Bytes

Property getVersion

Retrieves the current version string of the wallet.

getVersion: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetVersionResult>

See also: GetVersionResult, OriginatorDomainNameStringUnder250Bytes

Property internalizeAction

Submits a transaction to be internalized and optionally labeled, outputs paid to the wallet balance, inserted into baskets, and/or tagged.

internalizeAction: (args: InternalizeActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<InternalizeActionResult>

See also: InternalizeActionArgs, InternalizeActionResult, OriginatorDomainNameStringUnder250Bytes

Property isAuthenticated

Checks the authentication status of the user.

isAuthenticated: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AuthenticatedResult>

See also: AuthenticatedResult, OriginatorDomainNameStringUnder250Bytes

Property listActions

Lists all transactions matching the specified labels.

listActions: (args: ListActionsArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListActionsResult>

See also: ListActionsArgs, ListActionsResult, OriginatorDomainNameStringUnder250Bytes

Property listCertificates

Lists identity certificates belonging to the user, filtered by certifier(s) and type(s).

listCertificates: (args: ListCertificatesArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListCertificatesResult>

See also: ListCertificatesArgs, ListCertificatesResult, OriginatorDomainNameStringUnder250Bytes

Property listOutputs

Lists the spendable outputs kept within a specific basket, optionally tagged with specific labels.

listOutputs: (args: ListOutputsArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ListOutputsResult>

See also: ListOutputsArgs, ListOutputsResult, OriginatorDomainNameStringUnder250Bytes

Property proveCertificate

Proves select fields of an identity certificate, as specified, when requested by a verifier.

proveCertificate: (args: ProveCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<ProveCertificateResult>

See also: OriginatorDomainNameStringUnder250Bytes, ProveCertificateArgs, ProveCertificateResult

Property relinquishCertificate

Relinquishes an identity certificate, removing it from the wallet regardless of whether the revocation outpoint has become spent.

relinquishCertificate: (args: RelinquishCertificateArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RelinquishCertificateResult>

See also: OriginatorDomainNameStringUnder250Bytes, RelinquishCertificateArgs, RelinquishCertificateResult

Property relinquishOutput

Relinquish an output out of a basket, removing it from tracking without spending it.

relinquishOutput: (args: RelinquishOutputArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RelinquishOutputResult>

See also: OriginatorDomainNameStringUnder250Bytes, RelinquishOutputArgs, RelinquishOutputResult

Property signAction

Signs a transaction previously created using createAction.

signAction: (args: SignActionArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<SignActionResult>

See also: OriginatorDomainNameStringUnder250Bytes, SignActionArgs, SignActionResult

Property waitForAuthentication

Continuously waits until the user is authenticated, returning the result once confirmed.

waitForAuthentication: (args: {}, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<AuthenticatedResult>

See also: AuthenticatedResult, OriginatorDomainNameStringUnder250Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletAction

export interface WalletAction {
    txid: TXIDHexString;
    satoshis: SatoshiValue;
    status: ActionStatus;
    isOutgoing: boolean;
    description: DescriptionString5to50Bytes;
    labels?: LabelStringUnder300Bytes[];
    version: PositiveIntegerOrZero;
    lockTime: PositiveIntegerOrZero;
    inputs?: WalletActionInput[];
    outputs?: WalletActionOutput[];
}

See also: ActionStatus, DescriptionString5to50Bytes, LabelStringUnder300Bytes, PositiveIntegerOrZero, SatoshiValue, TXIDHexString, WalletActionInput, WalletActionOutput

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletActionInput

export interface WalletActionInput {
    sourceOutpoint: OutpointString;
    sourceSatoshis: SatoshiValue;
    sourceLockingScript?: HexString;
    unlockingScript?: HexString;
    inputDescription: DescriptionString5to50Bytes;
    sequenceNumber: PositiveIntegerOrZero;
}

See also: DescriptionString5to50Bytes, HexString, OutpointString, PositiveIntegerOrZero, SatoshiValue

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletActionOutput

export interface WalletActionOutput {
    satoshis: SatoshiValue;
    lockingScript?: HexString;
    spendable: boolean;
    customInstructions?: string;
    tags: OutputTagStringUnder300Bytes[];
    outputIndex: PositiveIntegerOrZero;
    outputDescription: DescriptionString5to50Bytes;
    basket: BasketStringUnder300Bytes;
}

See also: BasketStringUnder300Bytes, DescriptionString5to50Bytes, HexString, OutputTagStringUnder300Bytes, PositiveIntegerOrZero, SatoshiValue

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletCertificate

export interface WalletCertificate {
    type: Base64String;
    subject: PubKeyHex;
    serialNumber: Base64String;
    certifier: PubKeyHex;
    revocationOutpoint: OutpointString;
    signature: HexString;
    fields: Record<CertificateFieldNameUnder50Bytes, string>;
}

See also: Base64String, CertificateFieldNameUnder50Bytes, HexString, OutpointString, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletCryptoObject

The WalletCryptoObject interface defines a wallet cryptographic capabilities including: key derivation, encryption, decryption, hmac creation and verification, signature generation and verification

Error Handling

Every method of the Wallet interface has a return value of the form Promise<object>. When an error occurs, an exception object may be thrown which must conform to the WalletErrorObject interface. Serialization layers can rely on the isError property being unique to error objects to deserialize and rethrow WalletErrorObject conforming objects.

export interface WalletCryptoObject {
    getPublicKey: (args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetPublicKeyResult>;
    revealCounterpartyKeyLinkage: (args: RevealCounterpartyKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RevealCounterpartyKeyLinkageResult>;
    revealSpecificKeyLinkage: (args: RevealSpecificKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RevealSpecificKeyLinkageResult>;
    encrypt: (args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<WalletEncryptResult>;
    decrypt: (args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<WalletDecryptResult>;
    createHmac: (args: CreateHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateHmacResult>;
    verifyHmac: (args: VerifyHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<VerifyHmacResult>;
    createSignature: (args: CreateSignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateSignatureResult>;
    verifySignature: (args: VerifySignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<VerifySignatureResult>;
}

See also: CreateHmacArgs, CreateHmacResult, CreateSignatureArgs, CreateSignatureResult, GetPublicKeyArgs, GetPublicKeyResult, OriginatorDomainNameStringUnder250Bytes, RevealCounterpartyKeyLinkageArgs, RevealCounterpartyKeyLinkageResult, RevealSpecificKeyLinkageArgs, RevealSpecificKeyLinkageResult, VerifyHmacArgs, VerifyHmacResult, VerifySignatureArgs, VerifySignatureResult, WalletDecryptArgs, WalletDecryptResult, WalletEncryptArgs, WalletEncryptResult, createHmac, createSignature, decrypt, encrypt, getPublicKey, verifyHmac, verifySignature

Interface WalletCryptoObject Details
Property createHmac

Creates an HMAC (Hash-based Message Authentication Code) based on the provided data, protocol, key ID, counterparty, and other factors.

createHmac: (args: CreateHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateHmacResult>

See also: CreateHmacArgs, CreateHmacResult, OriginatorDomainNameStringUnder250Bytes

Property createSignature

Creates a digital signature for the provided data or hash using a specific protocol, key, and optionally considering privilege and counterparty.

createSignature: (args: CreateSignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<CreateSignatureResult>

See also: CreateSignatureArgs, CreateSignatureResult, OriginatorDomainNameStringUnder250Bytes

Property decrypt

Decrypts the provided ciphertext using derived keys, based on the protocol ID, key ID, counterparty, and other factors.

decrypt: (args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<WalletDecryptResult>

See also: OriginatorDomainNameStringUnder250Bytes, WalletDecryptArgs, WalletDecryptResult

Property encrypt

Encrypts the provided plaintext data using derived keys, based on the protocol ID, key ID, counterparty, and other factors.

encrypt: (args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<WalletEncryptResult>

See also: OriginatorDomainNameStringUnder250Bytes, WalletEncryptArgs, WalletEncryptResult

Property getPublicKey

Retrieves a derived or identity public key based on the requested protocol, key ID, counterparty, and other factors.

getPublicKey: (args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<GetPublicKeyResult>

See also: GetPublicKeyArgs, GetPublicKeyResult, OriginatorDomainNameStringUnder250Bytes

Property revealCounterpartyKeyLinkage

Reveals the key linkage between ourselves and a counterparty, to a particular verifier, across all interactions with the counterparty.

revealCounterpartyKeyLinkage: (args: RevealCounterpartyKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RevealCounterpartyKeyLinkageResult>

See also: OriginatorDomainNameStringUnder250Bytes, RevealCounterpartyKeyLinkageArgs, RevealCounterpartyKeyLinkageResult

Property revealSpecificKeyLinkage

Reveals the key linkage between ourselves and a counterparty, to a particular verifier, with respect to a specific interaction.

revealSpecificKeyLinkage: (args: RevealSpecificKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<RevealSpecificKeyLinkageResult>

See also: OriginatorDomainNameStringUnder250Bytes, RevealSpecificKeyLinkageArgs, RevealSpecificKeyLinkageResult

Property verifyHmac

Verifies an HMAC (Hash-based Message Authentication Code) based on the provided data, protocol, key ID, counterparty, and other factors.

verifyHmac: (args: VerifyHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<VerifyHmacResult>

See also: OriginatorDomainNameStringUnder250Bytes, VerifyHmacArgs, VerifyHmacResult

Property verifySignature

Verifies a digital signature for the provided data or hash using a specific protocol, key, and optionally considering privilege and counterparty.

verifySignature: (args: VerifySignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes) => Promise<VerifySignatureResult>

See also: OriginatorDomainNameStringUnder250Bytes, VerifySignatureArgs, VerifySignatureResult

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletDecryptArgs

export interface WalletDecryptArgs extends WalletEncryptionArgs {
    ciphertext: Byte[];
}

See also: Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletDecryptResult

export interface WalletDecryptResult {
    plaintext: Byte[];
}

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletEncryptArgs

export interface WalletEncryptArgs extends WalletEncryptionArgs {
    plaintext: Byte[];
}

See also: Byte, WalletEncryptionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletEncryptResult

export interface WalletEncryptResult {
    ciphertext: Byte[];
}

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletEncryptionArgs

export interface WalletEncryptionArgs {
    protocolID: WalletProtocol;
    keyID: KeyIDStringUnder800Bytes;
    counterparty?: WalletCounterparty;
    privileged?: BooleanDefaultFalse;
    privilegedReason?: DescriptionString5to50Bytes;
    seekPermission?: BooleanDefaultTrue;
}

See also: BooleanDefaultFalse, BooleanDefaultTrue, DescriptionString5to50Bytes, KeyIDStringUnder800Bytes, WalletCounterparty, WalletProtocol

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletErrorObject

Every method of the Wallet interface has a return value of the form Promise<object>. When errors occur, an exception object may be thrown which must conform to the WalletErrorObject interface. Serialization layers can rely on the isError property being unique to error objects. Deserialization should rethrow WalletErrorObject conforming objects.

export interface WalletErrorObject extends Error {
    isError: true;
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletOutput

export interface WalletOutput {
    satoshis: SatoshiValue;
    lockingScript?: HexString;
    spendable: boolean;
    customInstructions?: string;
    tags?: OutputTagStringUnder300Bytes[];
    outpoint: OutpointString;
    labels?: LabelStringUnder300Bytes[];
}

See also: HexString, LabelStringUnder300Bytes, OutpointString, OutputTagStringUnder300Bytes, SatoshiValue

Links: API, Interfaces, Classes, Functions, Types, Variables


Interface: WalletPayment

export interface WalletPayment {
    derivationPrefix: Base64String;
    derivationSuffix: Base64String;
    senderIdentityKey: PubKeyHex;
}

See also: Base64String, PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Classes

CachedKeyDeriver WERR_INVALID_PUBLIC_KEY
Communicator WERR_MISSING_PARAMETER
KeyDeriver WERR_NETWORK_CHAIN
WERR_BAD_REQUEST WERR_NOT_IMPLEMENTED
WERR_INSUFFICIENT_FUNDS WERR_UNAUTHORIZED
WERR_INTERNAL WalletCrypto
WERR_INVALID_PARAMETER WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: CachedKeyDeriver

A cached version of KeyDeriver that caches the results of key derivation methods. This is useful for optimizing performance when the same keys are derived multiple times. It supports configurable cache size with sane defaults and maintains cache entries using LRU (Least Recently Used) eviction policy.

export default class CachedKeyDeriver {
    constructor(rootKey: PrivateKey | "anyone", options?: {
        maxCacheSize?: number;
    }) 
    derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf: boolean = false): PublicKey 
    derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey 
    deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey 
    revealCounterpartySecret(counterparty: Counterparty): number[] 
    revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[] 
}

See also: Counterparty, WalletProtocol

Class CachedKeyDeriver Details
Constructor

Initializes the CachedKeyDeriver instance with a root private key and optional cache settings.

constructor(rootKey: PrivateKey | "anyone", options?: {
    maxCacheSize?: number;
}) 

Argument Details

  • rootKey
    • The root private key or the string 'anyone'.
  • options
    • Optional settings for the cache.
Method derivePrivateKey

Derives a private key based on protocol ID, key ID, and counterparty. Caches the result for future calls with the same parameters.

derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived private key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
Method derivePublicKey

Derives a public key based on protocol ID, key ID, and counterparty. Caches the result for future calls with the same parameters.

derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf: boolean = false): PublicKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived public key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • forSelf
    • Whether deriving for self.
Method deriveSymmetricKey

Derives a symmetric key based on protocol ID, key ID, and counterparty. Caches the result for future calls with the same parameters.

deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived symmetric key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to derive a symmetric key for 'anyone'.
Method revealCounterpartySecret

Reveals the shared secret between the root key and the counterparty. Caches the result for future calls with the same parameters.

revealCounterpartySecret(counterparty: Counterparty): number[] 

See also: Counterparty

Returns

  • The shared secret as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to reveal a shared secret for 'self'.
Method revealSpecificSecret

Reveals the specific key association for a given protocol ID, key ID, and counterparty. Caches the result for future calls with the same parameters.

revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[] 

See also: Counterparty, WalletProtocol

Returns

  • The specific key association as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: Communicator

export class Communicator {
    static setCached(substrate: string, version: string): Communicator 
    static getCached(): Communicator | undefined 
    async dispatch<P extends object>(args: {
        name: string;
        params: P;
        isGet?: boolean;
        bodyParamKey?: string;
        bodyJsonParams?: boolean;
        contentType?: string;
        nameHttp?: string;
        isNinja?: boolean;
    }): Promise<unknown> 
}

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: KeyDeriver

Class responsible for deriving various types of keys using a root private key. It supports deriving public and private keys, symmetric keys, and revealing key linkages.

export class KeyDeriver implements KeyDeriverApi {
    rootKey: PrivateKey;
    identityKey: string;
    constructor(rootKey: PrivateKey | "anyone") 
    derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf: boolean = false): PublicKey 
    derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey 
    deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey 
    revealCounterpartySecret(counterparty: Counterparty): number[] 
    revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[] 
}

See also: Counterparty, KeyDeriverApi, WalletProtocol

Class KeyDeriver Details
Constructor

Initializes the KeyDeriver instance with a root private key.

constructor(rootKey: PrivateKey | "anyone") 

Argument Details

  • rootKey
    • The root private key or the string 'anyone'.
Method derivePrivateKey

Derives a private key based on protocol ID, key ID, and counterparty.

derivePrivateKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): PrivateKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived private key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
Method derivePublicKey

Derives a public key based on protocol ID, key ID, and counterparty.

derivePublicKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty, forSelf: boolean = false): PublicKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived public key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • forSelf
    • Whether deriving for self.
Method deriveSymmetricKey

Derives a symmetric key based on protocol ID, key ID, and counterparty. Note: Symmetric keys should not be derivable by everyone due to security risks.

deriveSymmetricKey(protocolID: WalletProtocol, keyID: string, counterparty: Counterparty): SymmetricKey 

See also: Counterparty, WalletProtocol

Returns

  • The derived symmetric key.

Argument Details

  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.
  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to derive a symmetric key for 'anyone'.
Method revealCounterpartySecret

Reveals the shared secret between the root key and the counterparty. Note: This should not be used for 'self'.

revealCounterpartySecret(counterparty: Counterparty): number[] 

See also: Counterparty

Returns

  • The shared secret as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').

Throws

  • Throws an error if attempting to reveal a shared secret for 'self'.
Method revealSpecificSecret

Reveals the specific key association for a given protocol ID, key ID, and counterparty.

revealSpecificSecret(counterparty: Counterparty, protocolID: WalletProtocol, keyID: string): number[] 

See also: Counterparty, WalletProtocol

Returns

  • The specific key association as a number array.

Argument Details

  • counterparty
    • The counterparty's public key or a predefined value ('self' or 'anyone').
  • protocolID
    • The protocol ID including a security level and protocol name.
  • keyID
    • The key identifier.

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_BAD_REQUEST

The request is invalid.

export class WERR_BAD_REQUEST extends WalletError {
    constructor(message?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_INSUFFICIENT_FUNDS

Insufficient funds in the available inputs to cover the cost of the required outputs and the transaction fee (${moreSatoshisNeeded} more satoshis are needed, for a total of ${totalSatoshisNeeded}), plus whatever would be required in order to pay the fee to unlock and spend the outputs used to provide the additional satoshis.

export class WERR_INSUFFICIENT_FUNDS extends WalletError {
    constructor(public totalSatoshisNeeded: number, public moreSatoshisNeeded: number) 
}

See also: WalletError

Class WERR_INSUFFICIENT_FUNDS Details
Constructor
constructor(public totalSatoshisNeeded: number, public moreSatoshisNeeded: number) 

Argument Details

  • totalSatoshisNeeded
    • Total satoshis required to fund transactions after net of required inputs and outputs.
  • moreSatoshisNeeded
    • Shortfall on total satoshis required to fund transactions after net of required inputs and outputs.

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_INTERNAL

An internal error has occurred.

This is an example of an error with an optional custom message.

export class WERR_INTERNAL extends WalletError {
    constructor(message?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_INVALID_PARAMETER

The ${parameter} parameter is invalid.

This is an example of an error object with a custom property parameter and templated message.

export class WERR_INVALID_PARAMETER extends WalletError {
    constructor(public parameter: string, mustBe?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_INVALID_PUBLIC_KEY

export class WERR_INVALID_PUBLIC_KEY extends WalletError {
    constructor(public key: string, network: WalletNetwork = "mainnet") 
}

See also: WalletError, WalletNetwork

Class WERR_INVALID_PUBLIC_KEY Details
Constructor
constructor(public key: string, network: WalletNetwork = "mainnet") 

See also: WalletNetwork

Argument Details

  • key
    • The invalid public key that caused the error.
  • environment
    • Optional environment flag to control whether the key is included in the message.

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_MISSING_PARAMETER

The required ${parameter} parameter is missing.

This is an example of an error object with a custom property parameter

export class WERR_MISSING_PARAMETER extends WalletError {
    constructor(public parameter: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_NETWORK_CHAIN

Configured network chain is invalid or does not match across services.

export class WERR_NETWORK_CHAIN extends WalletError {
    constructor(message?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_NOT_IMPLEMENTED

Not implemented.

export class WERR_NOT_IMPLEMENTED extends WalletError {
    constructor(message?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WERR_UNAUTHORIZED

Access is denied due to an authorization error.

export class WERR_UNAUTHORIZED extends WalletError {
    constructor(message?: string) 
}

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WalletCrypto

WalletCrypto implements single-keyring wallet cryptography functions, operating without context about whether its configured keyring is privileged.

export class WalletCrypto implements WalletCryptoObject {
    keyDeriver: KeyDeriverApi;
    constructor(keyDeriver: KeyDeriverApi) 
    async getIdentityKey(originator?: OriginatorDomainNameStringUnder250Bytes): Promise<{
        publicKey: PubKeyHex;
    }> 
    async getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<{
        publicKey: PubKeyHex;
    }> 
    async revealCounterpartyKeyLinkage(args: RevealCounterpartyKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealCounterpartyKeyLinkageResult> 
    async revealSpecificKeyLinkage(args: RevealSpecificKeyLinkageArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<RevealSpecificKeyLinkageResult> 
    async encrypt(args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletEncryptResult> 
    async decrypt(args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletDecryptResult> 
    async createHmac(args: CreateHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateHmacResult> 
    async verifyHmac(args: VerifyHmacArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifyHmacResult> 
    async createSignature(args: CreateSignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<CreateSignatureResult> 
    async verifySignature(args: VerifySignatureArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<VerifySignatureResult> 
}

See also: CreateHmacArgs, CreateHmacResult, CreateSignatureArgs, CreateSignatureResult, GetPublicKeyArgs, KeyDeriverApi, OriginatorDomainNameStringUnder250Bytes, PubKeyHex, RevealCounterpartyKeyLinkageArgs, RevealCounterpartyKeyLinkageResult, RevealSpecificKeyLinkageArgs, RevealSpecificKeyLinkageResult, VerifyHmacArgs, VerifyHmacResult, VerifySignatureArgs, VerifySignatureResult, WalletCryptoObject, WalletDecryptArgs, WalletDecryptResult, WalletEncryptArgs, WalletEncryptResult, createHmac, createSignature, decrypt, encrypt, getPublicKey, verifyHmac, verifySignature

Class WalletCrypto Details
Method getIdentityKey

Convenience method to obtain the identityKey.

async getIdentityKey(originator?: OriginatorDomainNameStringUnder250Bytes): Promise<{
    publicKey: PubKeyHex;
}> 

See also: OriginatorDomainNameStringUnder250Bytes, PubKeyHex

Returns

await this.getPublicKey({ identityKey: true }, originator)

Links: API, Interfaces, Classes, Functions, Types, Variables


Class: WalletError

Derived class constructors should use the derived class name as the value for name, and an internationalizable constant string for message.

If a derived class intends to wrap another WalletError, the public property should be named walletError and will be recovered by fromUnknown.

Optionaly, the derived class message can include template parameters passed in to the constructor. See WERR_MISSING_PARAMETER for an example.

To avoid derived class name colisions, packages should include a package specific identifier after the 'WERR_' prefix. e.g. 'WERR_FOO_' as the prefix for Foo package error classes.

export class WalletError extends Error implements WalletErrorObject {
    isError: true = true;
    constructor(name: string, message: string, stack?: string, public details?: Record<string, string>) 
    get code(): sdk.ErrorCodeString10To40Bytes 
    set code(v: sdk.ErrorCodeString10To40Bytes) 
    get description(): sdk.ErrorDescriptionString20To200Bytes 
    set description(v: sdk.ErrorDescriptionString20To200Bytes) 
    static fromUnknown(err: unknown): WalletError 
    asStatus(): {
        status: string;
        code: string;
        description: string;
    } 
}

See also: ErrorCodeString10To40Bytes, ErrorDescriptionString20To200Bytes, WalletErrorObject

Class WalletError Details
Method asStatus
asStatus(): {
    status: string;
    code: string;
    description: string;
} 

Returns

standard HTTP error status object with status property set to 'error'.

Method fromUnknown

Recovers all public fields from WalletError derived error classes and relevant Error derived errors.

Critical client data fields are preserved across HTTP DojoExpress / DojoExpressClient encoding.

static fromUnknown(err: unknown): WalletError 

See also: WalletError

Links: API, Interfaces, Classes, Functions, Types, Variables


Functions

abortAction getMerkleRootForHeight validateCreateActionArgs
asArray getNetwork validateCreateActionInput
asBsvSdkScript getPreferredCurrency validateCreateActionOptions
asBsvSdkTx getPublicKey validateCreateActionOptions
asBuffer getRandomID validateCreateActionOutput
asString getTransactionOutputs validateInteger
buildTransactionForSignActionUnlocking getVersion validateInternalizeActionArgs
connectToSubstrate isAuthenticated validateInternalizeOutput
convertMerklePathToProof listActions validateListActionsArgs
convertProofToMerklePath makeHttpRequest validateListCertificatesArgs
convertProofToMerklePathWithLookup parseWalletOutpoint validateListOutputsArgs
createAction promiseWithTimeout validateOptionalEnvelopeEvidence
createCertificate proveCertificate validateOptionalInteger
createHmac requestGroupPermission validateOptionalOutpointString
createSignature resolveOptionalEnvelopeEvidence validateOriginator
decrypt revealKeyLinkage validateOutpointString
decryptAsArray revealKeyLinkageCounterparty validatePositiveIntegerOrZero
decryptAsString revealKeyLinkageSpecific validateRelinquishOutputArgs
discoverByAttributes sha256Hash validateSatoshis
discoverByIdentityKey signAction validateSignActionArgs
doubleSha256BE stampLog validateSignActionOptions
doubleSha256HashLE stampLogFormat validateStringLength
encrypt submitDirectTransaction validateWalletPayment
encryptAsArray toBEEFfromEnvelope verifyHmac
encryptAsString toEnvelopeFromBEEF verifySignature
getCertificates unbasketOutput verifyTruthy
getEnvelopeForTransaction validateAbortActionArgs waitForAuthentication
getHeight validateAcquireCertificateArgs
getInfo validateBasketInsertion

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: abortAction

Aborts a previously created action which required custom input unlocking script signing.

export async function abortAction(args: {
    referenceNumber: string;
    log?: string;
}): Promise<AbortActionResult> 

See also: AbortActionResult

Function abortAction Details

Returns

An Action object containing "txid", "rawTx" "mapiResponses" and "inputs".

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: asArray

export function asArray(val: Buffer | string | number[], encoding?: BufferEncoding): number[] 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: asBsvSdkScript

export function asBsvSdkScript(script: string | Buffer | Script): Script 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: asBsvSdkTx

export function asBsvSdkTx(tx: string | Buffer | Transaction): Transaction 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: asBuffer

export function asBuffer(val: Buffer | string | number[], encoding?: BufferEncoding): Buffer 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: asString

export function asString(val: Buffer | string, encoding?: BufferEncoding): string 
Function asString Details

Argument Details

  • val
    • Value to convert to encoded string if not already a string.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: buildTransactionForSignActionUnlocking

Constructs a

export async function buildTransactionForSignActionUnlocking(ninjaInputs: Record<string, CreateActionInput>, createResult: DojoCreateTransactionResultApi): Promise<Transaction> 

See also: CreateActionInput, DojoCreateTransactionResultApi

Function buildTransactionForSignActionUnlocking Details

Argument Details

  • ninjaInputs
    • Ninja inputs as passed to createAction
  • createResult
    • Create transaction results returned by createAction when signActionRequires is true.
  • changeKeys
    • Dummy keys can be used to create a transaction with which to generate Ninja input lockingScripts.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: connectToSubstrate

export default async function connectToSubstrate(): Promise<Communicator> 

See also: Communicator

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: convertMerklePathToProof

Convert a MerklePath to a single BRC-10 proof

export function convertMerklePathToProof(txid: string, mp: MerklePath): TscMerkleProofApi 

See also: TscMerkleProofApi

Function convertMerklePathToProof Details

Returns

transaction proof in BRC-10 string format.

Argument Details

  • txid
    • the txid in mp for which a BRC-10 proof is needed
  • mp
    • MerklePath

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: convertProofToMerklePath

Convert a single BRC-10 proof to a MerklePath

export function convertProofToMerklePath(txid: string, proof: TscMerkleProofApi): MerklePath 

See also: TscMerkleProofApi

Function convertProofToMerklePath Details

Returns

corresponding MerklePath

Argument Details

  • txid
    • transaction hash as big endian hex string
  • proof
    • transaction proof in BRC-10 string format.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: convertProofToMerklePathWithLookup

export async function convertProofToMerklePathWithLookup(txid: string, proof: TscMerkleProofApi, lookupHeight: (targetType: "hash" | "header" | "merkleRoot" | "height", target: string | Buffer) => Promise<number>): Promise<MerklePath> 

See also: TscMerkleProofApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: createAction

Creates and broadcasts a BitCoin transaction with the provided inputs and outputs.

export async function createAction(args: CreateActionParams): Promise<CreateActionResult> 

See also: CreateActionParams, CreateActionResult

Function createAction Details

Returns

An Action object containing "txid", "rawTx" "mapiResponses" and "inputs".

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: createCertificate

Creates a signed certificate

export async function createCertificate(args: {
    certificateType: string;
    fieldObject: Record<string, string>;
    certifierUrl: string;
    certifierPublicKey: string;
}): Promise<CreateCertificateResult> 

See also: CreateCertificateResult

Function createCertificate Details

Returns

A signed certificate

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: createHmac

Creates a SHA-256 HMAC with a key belonging to the user.

export async function createHmac(args: {
    data: Uint8Array | string;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<Uint8Array> 

See also: ProtocolID

Function createHmac Details

Returns

The SHA-256 HMAC of the data.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: createSignature

Creates a digital signature with a key belonging to the user. The SHA-256 hash of the data is used with ECDSA.

To allow other users to externally verify the signature, use getPublicKey with the same protocolID, keyID and privileged parameters. The signature should be valid under that public key.

export async function createSignature(args: {
    data: Uint8Array | string;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<Uint8Array> 

See also: ProtocolID

Function createSignature Details

Returns

The ECDSA message signature.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: decrypt

Decrypts data with a key belonging to the user. The same protocolID, keyID, counterparty and privileged parameters that were used during encryption must be used to successfully decrypt.

export async function decrypt(args: {
    ciphertext: string | Uint8Array;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
    returnType?: "Uint8Array" | "string";
}): Promise<string | Uint8Array> 

See also: ProtocolID

Function decrypt Details

Returns

The decrypted plaintext.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: decryptAsArray

Decrypts data with a key belonging to the user. The same protocolID, keyID, counterparty and privileged parameters that were used during encryption must be used to successfully decrypt.

export async function decryptAsArray(args: {
    ciphertext: string | Uint8Array;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<Uint8Array> 

See also: ProtocolID

Function decryptAsArray Details

Returns

The decrypted plaintext.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: decryptAsString

Decrypts data with a key belonging to the user. The same protocolID, keyID, counterparty and privileged parameters that were used during encryption must be used to successfully decrypt.

export async function decryptAsString(args: {
    ciphertext: string | Uint8Array;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<string> 

See also: ProtocolID

Function decryptAsString Details

Returns

The decrypted plaintext TextDecoder decoded to string.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: discoverByAttributes

Resolves identity information by attributes from the user's trusted certifiers.

export async function discoverByAttributes(args: {
    attributes: Record<string, string>;
    description: string;
}): Promise<object[]> 
Function discoverByAttributes Details

Argument Details

  • obj
    • All parameters are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: discoverByIdentityKey

Resolves identity information by identity key from the user's trusted certifiers.

export async function discoverByIdentityKey(args: {
    identityKey: string;
    description: string;
}): Promise<object[]> 
Function discoverByIdentityKey Details

Argument Details

  • obj
    • All parameters are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: doubleSha256BE

Calculate the SHA256 hash of the SHA256 hash of a Buffer.

export function doubleSha256BE(data: string | Buffer, encoding?: BufferEncoding): Buffer {
    return doubleSha256HashLE(data, encoding).reverse();
}

See also: doubleSha256HashLE

Function doubleSha256BE Details

Returns

reversed (big-endian) double sha256 hash of data, byte 31 of hash first.

Argument Details

  • data
    • is Buffer or hex encoded string

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: doubleSha256HashLE

Calculate the SHA256 hash of the SHA256 hash of a Buffer.

export function doubleSha256HashLE(data: string | Buffer, encoding?: BufferEncoding): Buffer {
    const msg = asArray(data, encoding);
    const first = new Hash.SHA256().update(msg).digest();
    const second = new Hash.SHA256().update(first).digest();
    return asBuffer(second);
}

See also: asArray, asBuffer

Function doubleSha256HashLE Details

Returns

double sha256 hash of buffer contents, byte 0 of hash first.

Argument Details

  • data
    • is Buffer or hex encoded string

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: encrypt

Encrypts data with a key belonging to the user. If a counterparty is provided, also allows the counterparty to decrypt the data. The same protocolID, keyID, counterparty and privileged parameters must be used when decrypting.

export async function encrypt(args: {
    plaintext: string | Uint8Array;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
    returnType?: "Uint8Array" | "string";
}): Promise<string | Uint8Array> 

See also: ProtocolID

Function encrypt Details

Returns

The encrypted ciphertext.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: encryptAsArray

Encrypts data with a key belonging to the user. If a counterparty is provided, also allows the counterparty to decrypt the data. The same protocolID, keyID, counterparty and privileged parameters must be used when decrypting.

export async function encryptAsArray(args: {
    plaintext: string | Uint8Array;
    protocolID: string;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<Uint8Array> 
Function encryptAsArray Details

Returns

The encrypted ciphertext data.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: encryptAsString

Encrypts data with a key belonging to the user. If a counterparty is provided, also allows the counterparty to decrypt the data. The same protocolID, keyID, counterparty and privileged parameters must be used when decrypting.

export async function encryptAsString(args: {
    plaintext: string | Uint8Array;
    protocolID: string;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<string> 
Function encryptAsString Details

Returns

The encrypted ciphertext data as base64 encoded string.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getCertificates

Returns found certificates

export async function getCertificates(args: {
    certifiers: string[];
    types: Record<string, string[]>;
}): Promise<CreateCertificateResult[]> 

See also: CreateCertificateResult

Function getCertificates Details

Returns

An object containing the found certificates

Argument Details

  • obj
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getEnvelopeForTransaction

Returns an Everett Style envelope for the given txid.

A transaction envelope is a tree of inputs where all the leaves are proven transactions. The trivial case is a single leaf: the envelope for a proven transaction is the rawTx and its proof.

Each branching level of the tree corresponds to an unmined transaction without a proof, in which case the envelope is:

  • rawTx
  • mapiResponses from transaction processors (optional)
  • inputs object where keys are this transaction's input txids and values are recursive envelope for those txids.
export async function getEnvelopeForTransaction(args: {
    txid: string;
}): Promise<EnvelopeApi | undefined> 

See also: EnvelopeApi

Function getEnvelopeForTransaction Details

Returns

Undefined if the txid does not exist or an envelope can't be generated.

Argument Details

  • args
    • All parameters are given in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getHeight

Returns the current chain height of the network

export async function getHeight(): Promise<number> 
Function getHeight Details

Returns

The current chain height

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getInfo

export async function getInfo(args?: GetInfoParams): Promise<GetInfoResult> 

See also: GetInfoParams, GetInfoResult

Function getInfo Details

Returns

information about the metanet-client context (version, chain, height, user...).

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getMerkleRootForHeight

A method to verify the validity of a Merkle root for a given block height.

export async function getMerkleRootForHeight(height: number): Promise<string | undefined> 
Function getMerkleRootForHeight Details

Returns

Returns the merkle root for height or undefined, if height doesn't have a known merkle root or is invalid.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getNetwork

Returns which BSV network we are using (mainnet or testnet)

export async function getNetwork(format?: "default" | "nonet"): Promise<string> 
Function getNetwork Details

Returns

The current BSV network formatted as requested.

Argument Details

  • format
    • for the returned string. Either with (default) or without (nonet) a 'net' suffix.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getPreferredCurrency

Returns the user's preferred currency for displaying within apps

export async function getPreferredCurrency(args: {
    description?: string;
}): Promise<string> 
Function getPreferredCurrency Details

Returns

The user's preferred currency

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getPublicKey

Returns the public key. If identityKey is specified, returns the current user's identity key. If a counterparty is specified, derives a public key for the counterparty.

export async function getPublicKey(args: {
    protocolID?: ProtocolID;
    keyID?: string;
    privileged?: boolean;
    identityKey?: boolean;
    reason?: string;
    counterparty?: string;
    forSelf?: boolean;
}): Promise<string> 

See also: ProtocolID

Function getPublicKey Details

Returns

The user's public key

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getRandomID

export default function getRandomID(): string 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getTransactionOutputs

Returns a set of transaction outputs that Dojo has tracked

export async function getTransactionOutputs(args: {
    basket?: string;
    tracked?: boolean;
    spendable?: boolean;
    tags?: string[];
    type?: string;
    includeEnvelope?: boolean;
    includeBasket?: boolean;
    includeCustomInstructions?: boolean;
    includeTags?: boolean;
    tagQueryMode?: "all" | "any";
    limit?: number;
    offset?: number;
}): Promise<GetTransactionOutputResult[]> 

See also: GetTransactionOutputResult

Function getTransactionOutputs Details

Returns

A set of outputs that match the criteria

Argument Details

  • args
    • All parameters are given in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: getVersion

Returns the current version of the kernel

export async function getVersion(): Promise<string> 
Function getVersion Details

Returns

The current kernel version (e.g. "0.3.49")

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: isAuthenticated

Checks if a user is currently authenticated.

export async function isAuthenticated(): Promise<boolean> 
Function isAuthenticated Details

Returns

Returns whether a user is currently authenticated.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: listActions

Returns a list of Actions with a given label

export async function listActions(args: {
    label: string;
    addInputsAndOutputs?: boolean;
    includeBasket?: boolean;
    includeTags?: boolean;
    noRawTx?: boolean;
    limit?: number;
    offset?: number;
}): Promise<ListActionsResult> 

See also: ListActionsResult

Function listActions Details

Returns

A set of outputs that match the criteria

Argument Details

  • args
    • All parameters are given in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: makeHttpRequest

export default async function makeHttpRequest<R>(routeURL: string, requestInput: RequestInit = {}): Promise<R> 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: parseWalletOutpoint

export function parseWalletOutpoint(outpoint: string): {
    txid: string;
    vout: number;
} 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: promiseWithTimeout

Provides a timedout promise.

export default async function promiseWithTimeout<T>(obj: {
    timeout: number;
    promise: Promise<T>;
    error?: Error;
}): Promise<T> 
Function promiseWithTimeout Details

Argument Details

  • obj
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: proveCertificate

Creates certificate proof specifically for verifier

export async function proveCertificate(args: {
    certificate: CertificateApi;
    fieldsToReveal: string[];
    verifierPublicIdentityKey: string;
}): Promise<ProveCertificateResult> 

See also: CertificateApi, ProveCertificateResult

Function proveCertificate Details

Returns

A certificate for presentation to the verifier for field examination

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: requestGroupPermission

Requests group permissions for an application.

export async function requestGroupPermission(): Promise<void> 
Function requestGroupPermission Details

Returns

Resolves after group permissions are completed by the user.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: resolveOptionalEnvelopeEvidence

Convert OptionalEnvelopeEvidenceApi to EnvelopeEvidenceApi.

Missing data (rawTx / proofs) can be looked up if lookupMissing is provided.

Any mising data will result in an Error throw.

export async function resolveOptionalEnvelopeEvidence(e: OptionalEnvelopeEvidenceApi, lookupMissing?: (txid: string) => Promise<{
    rawTx?: string;
    proof?: TscMerkleProofApi;
}>): Promise<EnvelopeEvidenceApi> 

See also: EnvelopeEvidenceApi, OptionalEnvelopeEvidenceApi, TscMerkleProofApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: revealKeyLinkage

Reveals the linkage between a key held by this user and a key held by another user. In one mode, reveals all keys associated with a counterparty, in the other mode reveals only the linkage of a specific interaction.

Encrypts the linkage value so that only the specified verifier can access it. Refer to BRC-72 for full details.

export async function revealKeyLinkage(args: {
    mode: "counterparty" | "specific";
    counterparty: string;
    verifier: string;
    protocolID: ProtocolID;
    keyID: string;
    description: string;
    privileged?: boolean;
}): Promise<CounterpartyKeyLinkageResult | SpecificKeyLinkageResult> 

See also: CounterpartyKeyLinkageResult, ProtocolID, SpecificKeyLinkageResult

Function revealKeyLinkage Details

Returns

The revealed linkage payload, as described in BRC-72.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: revealKeyLinkageCounterparty

Reveals the linkage between a key held by this user and a key held by another user. Reveals all keys associated with a counterparty,

Encrypts the linkage value so that only the specified verifier can access it. Refer to BRC-72 for full details.

export async function revealKeyLinkageCounterparty(args: {
    counterparty: string;
    verifier: string;
    protocolID: ProtocolID;
    description: string;
    privileged?: boolean;
}): Promise<CounterpartyKeyLinkageResult> 

See also: CounterpartyKeyLinkageResult, ProtocolID

Function revealKeyLinkageCounterparty Details

Returns

The revealed linkage payload, as described in BRC-72.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: revealKeyLinkageSpecific

Reveals the linkage between a key held by this user and a key held by another user. Reveals only the linkage of a specific interaction.

Encrypts the linkage value so that only the specified verifier can access it. Refer to BRC-72 for full details.

export async function revealKeyLinkageSpecific(args: {
    counterparty: string;
    verifier: string;
    protocolID: ProtocolID;
    keyID: string;
    description: string;
    privileged?: boolean;
}): Promise<SpecificKeyLinkageResult> 

See also: ProtocolID, SpecificKeyLinkageResult

Function revealKeyLinkageSpecific Details

Returns

The revealed linkage payload, as described in BRC-72.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: sha256Hash

Calculate the SHA256 hash of a Buffer.

export function sha256Hash(buffer: Buffer): Buffer {
    const msg = asArray(buffer);
    const first = new Hash.SHA256().update(msg).digest();
    return asBuffer(first);
}

See also: asArray, asBuffer

Function sha256Hash Details

Returns

sha256 hash of buffer contents.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: signAction

Completes a previously created action which required custom input unlocking script signing.

export async function signAction(args: {
    inputs?: Record<string, CreateActionInput>;
    createResult: DojoCreateTransactionResultApi;
    acceptDelayedBroadcast?: boolean;
    log?: string;
}): Promise<SignActionResult> 

See also: CreateActionInput, DojoCreateTransactionResultApi, SignActionResult

Function signAction Details

Returns

An Action object containing "txid", "rawTx" "mapiResponses" and "inputs".

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: stampLog

If a log is being kept, add a time stamped line.

export function stampLog(log: string | undefined | {
    log?: string;
}, lineToAdd: string): string | undefined 
Function stampLog Details

Returns

undefined or log extended by time stamped lineToAdd and new line.

Argument Details

  • log
    • Optional time stamped log to extend, or an object with a log property to update
  • lineToAdd
    • Content to add to line.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: stampLogFormat

Replaces individual timestamps with delta msecs. Looks for two network crossings and adjusts clock for clock skew if found. Assumes log built by repeated calls to stampLog

export function stampLogFormat(log?: string): string 
Function stampLogFormat Details

Returns

reformated multi-line event log

Argument Details

  • log
    • Each logged event starts with ISO time stamp, space, rest of line, terminated by \n.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: submitDirectTransaction

Submits a transaction directly to a ninja

export async function submitDirectTransaction(args: {
    protocol?: string;
    transaction: SubmitDirectTransaction;
    senderIdentityKey: string;
    note: string;
    amount: number;
    labels?: string[];
    derivationPrefix?: string;
}): Promise<SubmitDirectTransactionResult> 

See also: SubmitDirectTransaction, SubmitDirectTransactionResult

Function submitDirectTransaction Details

Returns

Object containing reference number, status=success, and human-readable note acknowledging the transaction

Argument Details

  • args
    • All parameters for this function are provided in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: toBEEFfromEnvelope

Converts a BRC-8 Everett-style Transaction Envelope to a

export function toBEEFfromEnvelope(e: EnvelopeEvidenceApi): {
    tx: Transaction;
    beef: number[];
} 

See also: EnvelopeEvidenceApi

Function toBEEFfromEnvelope Details

Returns

tx: Transaction containing required merklePath and sourceTransaction values

beef: tx.toBEEF()

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: toEnvelopeFromBEEF

BEEF standard: BRC-62: Background Evaluation Extended Format (BEEF) Transactions https://github.com/bitcoin-sv/BRCs/blob/master/transactions/0062.md

BUMP standard: BRC-74: BSV Unified Merkle Path (BUMP) Format https://github.com/bitcoin-sv/BRCs/blob/master/transactions/0074.md

export function toEnvelopeFromBEEF(input: Transaction | number[]): EnvelopeEvidenceApi 

See also: EnvelopeEvidenceApi

Function toEnvelopeFromBEEF Details

Returns

Everett-style Envelope for the transaction.

Argument Details

  • input
    • Either a Transaction with sourceTransaction and merklePath, recursively, on inputs, or a serialized BEEF of the transaction.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: unbasketOutput

Removes the uniquely identified output's basket assignment.

The output will no longer belong to any basket.

This is typically only useful for outputs that are no longer usefull.

export async function unbasketOutput(args: {
    txid: string;
    vout: number;
    basket: string;
}): Promise<void> 
Function unbasketOutput Details

Argument Details

  • args
    • All parameters are given in an object

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateAbortActionArgs

export function validateAbortActionArgs(args: sdk.AbortActionArgs): ValidAbortActionArgs 

See also: AbortActionArgs, ValidAbortActionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateAcquireCertificateArgs

export function validateAcquireCertificateArgs(args: sdk.AcquireCertificateArgs): ValidAcquireCertificateArgs 

See also: AcquireCertificateArgs, ValidAcquireCertificateArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateBasketInsertion

export function validateBasketInsertion(args?: sdk.BasketInsertion): ValidBasketInsertion | undefined 

See also: BasketInsertion, ValidBasketInsertion

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateCreateActionArgs

export function validateCreateActionArgs(args: sdk.CreateActionArgs): ValidCreateActionArgs 

See also: CreateActionArgs, ValidCreateActionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateCreateActionInput

export function validateCreateActionInput(i: sdk.CreateActionInput): ValidCreateActionInput 

See also: CreateActionInput, ValidCreateActionInput

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateCreateActionOptions

export function validateCreateActionOptions(options?: CreateActionOptions): CreateActionOptions 

See also: CreateActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateCreateActionOptions

Set all default true/false booleans to true or false if undefined. Set all possibly undefined numbers to their default values. Set all possibly undefined arrays to empty arrays. Convert string outpoints to { txid: string, vout: number }

export function validateCreateActionOptions(options?: sdk.CreateActionOptions): ValidCreateActionOptions 

See also: CreateActionOptions, ValidCreateActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateCreateActionOutput

export function validateCreateActionOutput(o: sdk.CreateActionOutput): ValidCreateActionOutput 

See also: CreateActionOutput, ValidCreateActionOutput

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateInteger

export function validateInteger(v: number | undefined, name: string, defaultValue?: number, min?: number, max?: number): number 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateInternalizeActionArgs

export function validateInternalizeActionArgs(args: sdk.InternalizeActionArgs): ValidInternalizeActionArgs 

See also: InternalizeActionArgs, ValidInternalizeActionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateInternalizeOutput

export function validateInternalizeOutput(args: sdk.InternalizeOutput): ValidInternalizeOutput 

See also: InternalizeOutput, ValidInternalizeOutput

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateListActionsArgs

export function validateListActionsArgs(args: sdk.ListActionsArgs): ValidListActionsArgs 

See also: ListActionsArgs, ValidListActionsArgs

Function validateListActionsArgs Details

Argument Details

  • args.labels
    • An array of labels used to filter actions.
  • args.labelQueryMode
    • Optional. Specifies how to match labels (default is any which matches any of the labels).
  • args.includeLabels
    • Optional. Whether to include transaction labels in the result set.
  • args.includeInputs
    • Optional. Whether to include input details in the result set.
  • args.includeInputSourceLockingScripts
    • Optional. Whether to include input source locking scripts in the result set.
  • args.includeInputUnlockingScripts
    • Optional. Whether to include input unlocking scripts in the result set.
  • args.includeOutputs
    • Optional. Whether to include output details in the result set.
  • args.includeOutputLockingScripts
    • Optional. Whether to include output locking scripts in the result set.
  • args.limit
    • Optional. The maximum number of transactions to retrieve.
  • args.offset
    • Optional. Number of transactions to skip before starting to return the results.
  • args.seekPermission
    • — Optional. Whether to seek permission from the user for this operation if required. Default true, will return an error rather than proceed if set to false.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateListCertificatesArgs

export function validateListCertificatesArgs(args: sdk.ListCertificatesArgs): ValidListCertificatesArgs 

See also: ListCertificatesArgs, ValidListCertificatesArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateListOutputsArgs

export function validateListOutputsArgs(args: sdk.ListOutputsArgs): ValidListOutputsArgs 

See also: ListOutputsArgs, ValidListOutputsArgs

Function validateListOutputsArgs Details

Argument Details

  • args.basket
    • Required. The associated basket name whose outputs should be listed.
  • args.tags
    • Optional. Filter outputs based on these tags.
  • args.tagQueryMode
    • Optional. Filter mode, defining whether all or any of the tags must match. By default, any tag can match.
  • args.include
    • Optional. Whether to include locking scripts (with each output) or entire transactions (as aggregated BEEF, at the top level) in the result. By default, unless specified, neither are returned.
  • args.includeEntireTransactions
    • Optional. Whether to include the entire transaction(s) in the result.
  • args.includeCustomInstructions
    • Optional. Whether custom instructions should be returned in the result.
  • args.includeTags
    • Optional. Whether the tags associated with the output should be returned.
  • args.includeLabels
    • Optional. Whether the labels associated with the transaction containing the output should be returned.
  • args.limit
    • Optional limit on the number of outputs to return.
  • args.offset
    • Optional. Number of outputs to skip before starting to return results.
  • args.seekPermission
    • — Optional. Whether to seek permission from the user for this operation if required. Default true, will return an error rather than proceed if set to false.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateOptionalEnvelopeEvidence

export function validateOptionalEnvelopeEvidence(e: OptionalEnvelopeEvidenceApi): EnvelopeEvidenceApi 

See also: EnvelopeEvidenceApi, OptionalEnvelopeEvidenceApi

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateOptionalInteger

export function validateOptionalInteger(v: number | undefined, name: string, min?: number, max?: number): number | undefined 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateOptionalOutpointString

export function validateOptionalOutpointString(outpoint: string | undefined, name: string): string | undefined 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateOriginator

export function validateOriginator(s?: string): string | undefined 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateOutpointString

export function validateOutpointString(outpoint: string, name: string): string 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validatePositiveIntegerOrZero

export function validatePositiveIntegerOrZero(v: number, name: string): number 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateRelinquishOutputArgs

export function validateRelinquishOutputArgs(args: sdk.RelinquishOutputArgs): ValidRelinquishOutputArgs 

See also: RelinquishOutputArgs, ValidRelinquishOutputArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateSatoshis

export function validateSatoshis(v: number | undefined, name: string, min?: number): number 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateSignActionArgs

export function validateSignActionArgs(args: sdk.SignActionArgs): ValidSignActionArgs 

See also: SignActionArgs, ValidSignActionArgs

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateSignActionOptions

Set all default true/false booleans to true or false if undefined. Set all possibly undefined numbers to their default values. Set all possibly undefined arrays to empty arrays. Convert string outpoints to { txid: string, vout: number }

export function validateSignActionOptions(options?: sdk.SignActionOptions): ValidSignActionOptions 

See also: SignActionOptions, ValidSignActionOptions

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateStringLength

export function validateStringLength(s: string, name: string, min?: number, max?: number): string 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: validateWalletPayment

export function validateWalletPayment(args?: sdk.WalletPayment): ValidWalletPayment | undefined 

See also: ValidWalletPayment, WalletPayment

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: verifyHmac

Verifies that a SHA-256 HMAC was created with a key that belongs to the user.

export async function verifyHmac(args: {
    data: Uint8Array | string;
    hmac: Uint8Array | string;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
}): Promise<boolean> 

See also: ProtocolID

Function verifyHmac Details

Returns

Whether the HMAC has been erified.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: verifySignature

Verifies that a digital signature was created with a key belonging to the user.

export async function verifySignature(args: {
    data: Uint8Array | string;
    signature: Uint8Array | string;
    protocolID: ProtocolID;
    keyID: string;
    description?: string;
    counterparty?: string;
    privileged?: boolean;
    reason?: string;
}): Promise<boolean> 

See also: ProtocolID

Function verifySignature Details

Returns

An whether the signature was successfully verified.

Argument Details

  • args
    • All parameters are passed in an object.

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: verifyTruthy

export function verifyTruthy<T>(v: T | null | undefined, description?: string): T 

Links: API, Interfaces, Classes, Functions, Types, Variables


Function: waitForAuthentication

Waits for a user to be authenticated.

export async function waitForAuthentication(): Promise<boolean> 
Function waitForAuthentication Details

Returns

Always returns true

Links: API, Interfaces, Classes, Functions, Types, Variables


Types

AcquisitionProtocol EntityNameStringMax100Bytes ProtocolID
ActionStatus ErrorCodeString10To40Bytes ProtocolString5To400Bytes
AtomicBEEF ErrorDescriptionString20To200Bytes PubKeyHex
BEEF HexString SatoshiValue
Base64String ISOTimestampString SendWithResultStatus
BasketStringUnder300Bytes KeyIDStringUnder800Bytes TXIDHexString
BooleanDefaultFalse KeyringRevealer TransactionStatusApi
BooleanDefaultTrue LabelStringUnder300Bytes TrustSelf
Byte OriginatorDomainNameStringUnder250Bytes TrustSelf
CertificateFieldNameUnder50Bytes OutpointString VersionString7To30Bytes
Chain OutputTagStringUnder300Bytes WalletCounterparty
Counterparty PositiveInteger WalletNetwork
DescriptionString5to50Bytes PositiveIntegerDefault10Max10000 WalletProtocol
DojoProvidedByApi PositiveIntegerMax10
EntityIconURLStringMax500Bytes PositiveIntegerOrZero

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: AcquisitionProtocol

export type AcquisitionProtocol = "direct" | "issuance"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ActionStatus

export type ActionStatus = "completed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend" | "nonfinal"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: AtomicBEEF

export type AtomicBEEF = Byte[]

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: BEEF

export type BEEF = Byte[]

See also: Byte

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: Base64String

export type Base64String = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: BasketStringUnder300Bytes

export type BasketStringUnder300Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: BooleanDefaultFalse

export type BooleanDefaultFalse = boolean

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: BooleanDefaultTrue

export type BooleanDefaultTrue = boolean

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: Byte

export type Byte = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: CertificateFieldNameUnder50Bytes

export type CertificateFieldNameUnder50Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: Chain

export type Chain = "main" | "test"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: Counterparty

export type Counterparty = PublicKey | PubKeyHex | "self" | "anyone"

See also: PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: DescriptionString5to50Bytes

export type DescriptionString5to50Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: DojoProvidedByApi

export type DojoProvidedByApi = "you" | "dojo" | "you-and-dojo"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: EntityIconURLStringMax500Bytes

export type EntityIconURLStringMax500Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: EntityNameStringMax100Bytes

export type EntityNameStringMax100Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ErrorCodeString10To40Bytes

export type ErrorCodeString10To40Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ErrorDescriptionString20To200Bytes

export type ErrorDescriptionString20To200Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: HexString

export type HexString = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ISOTimestampString

export type ISOTimestampString = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: KeyIDStringUnder800Bytes

export type KeyIDStringUnder800Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: KeyringRevealer

export type KeyringRevealer = PubKeyHex | "certifier"

See also: PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: LabelStringUnder300Bytes

export type LabelStringUnder300Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: OriginatorDomainNameStringUnder250Bytes

export type OriginatorDomainNameStringUnder250Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: OutpointString

export type OutpointString = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: OutputTagStringUnder300Bytes

export type OutputTagStringUnder300Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: PositiveInteger

export type PositiveInteger = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: PositiveIntegerDefault10Max10000

export type PositiveIntegerDefault10Max10000 = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: PositiveIntegerMax10

export type PositiveIntegerMax10 = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: PositiveIntegerOrZero

export type PositiveIntegerOrZero = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ProtocolID

export type ProtocolID = string | [
    0 | 1 | 2,
    string
]

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: ProtocolString5To400Bytes

export type ProtocolString5To400Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: PubKeyHex

export type PubKeyHex = HexString

See also: HexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: SatoshiValue

export type SatoshiValue = number

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: SendWithResultStatus

export type SendWithResultStatus = "unproven" | "sending" | "failed"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TXIDHexString

export type TXIDHexString = HexString

See also: HexString

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TransactionStatusApi

export type TransactionStatusApi = "completed" | "failed" | "unprocessed" | "sending" | "unproven" | "unsigned" | "nosend"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TrustSelf

Controls level of trust for inputs from user's own transactions.

export type TrustSelf = "known"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: TrustSelf

Controls behavior of input BEEF validation.

If known, input transactions may omit supporting validity proof data for all TXIDs known to this wallet.

If undefined, input BEEFs must be complete and valid.

export type TrustSelf = "known"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: VersionString7To30Bytes

export type VersionString7To30Bytes = string

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: WalletCounterparty

export type WalletCounterparty = PubKeyHex | "self" | "anyone"

See also: PubKeyHex

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: WalletNetwork

export type WalletNetwork = "mainnet" | "testnet"

Links: API, Interfaces, Classes, Functions, Types, Variables


Type: WalletProtocol

export type WalletProtocol = [
    0 | 1 | 2,
    ProtocolString5To400Bytes
]

See also: ProtocolString5To400Bytes

Links: API, Interfaces, Classes, Functions, Types, Variables


Variables

Variable: BabbageSDK

BabbageSDK = {
    abortAction,
    createAction,
    createHmac,
    createCertificate,
    createSignature,
    decrypt,
    decryptAsArray,
    decryptAsString,
    discoverByAttributes,
    discoverByIdentityKey,
    getPreferredCurrency,
    encrypt,
    encryptAsArray,
    encryptAsString,
    getCertificates,
    getHeight,
    getInfo,
    getMerkleRootForHeight,
    getNetwork,
    getPublicKey,
    getEnvelopeForTransaction,
    getTransactionOutputs,
    getVersion,
    isAuthenticated,
    listActions,
    proveCertificate,
    requestGroupPermission,
    revealKeyLinkage,
    revealKeyLinkageCounterparty,
    revealKeyLinkageSpecific,
    signAction,
    submitDirectTransaction,
    unbasketOutput,
    verifyHmac,
    verifySignature,
    waitForAuthentication,
}

See also: abortAction, createAction, createCertificate, createHmac, createSignature, decrypt, decryptAsArray, decryptAsString, discoverByAttributes, discoverByIdentityKey, encrypt, encryptAsArray, encryptAsString, getCertificates, getEnvelopeForTransaction, getHeight, getInfo, getMerkleRootForHeight, getNetwork, getPreferredCurrency, getPublicKey, getTransactionOutputs, getVersion, isAuthenticated, listActions, proveCertificate, requestGroupPermission, revealKeyLinkage, revealKeyLinkageCounterparty, revealKeyLinkageSpecific, signAction, submitDirectTransaction, unbasketOutput, verifyHmac, verifySignature, waitForAuthentication

Links: API, Interfaces, Classes, Functions, Types, Variables


SDK Connection Substrates

The Babbage SDK connects to a running Computing with Integrity (CWI) kernel instance, allowing applications to plug into user-owned identities. There are currently three substrates (connection modes) that the SDK can use to link an application to a MetaNet identity provider:

  1. Window API: In a web browser, the SDK will first try to use a window.CWI interface for communicating with the kernel.
  2. Babbage XDM: In a browser or iframe window, the SDK will next try to use XDM (cross-document messaging) to communicate with a running kernel instance.
  3. Cicada API: Lastly, the SDK will attempt to communicate over localhost:3301 to a running HTTP MetaNet service. This Port 3301 Substrate is named Cicada, in honor of Cicada 3301.

License

The license for this library, which is a wrapper for the proprietary Babbage API, is the Open BSV License. It can only be used on the BSV blockchain. The Babbage API itself, including the rights to create and host Babbage software or any other related infrastructure, is not covered by the Open BSV License and remains proprietary and restricted. The Open BSV License only extends to the code in this repository, and you are not permitted to host Babbage software, servers or create copies or alternative implementations of the proprietary Babbage API without other permission.