UNPKG

wallet-storage

Version:

BRC100 conforming wallet, wallet storage and wallet signer components

1,894 lines (1,350 loc) 243 kB
# API Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) ## Interfaces | | | | | --- | --- | --- | | [ArcMinerGetTxData](#interface-arcminergettxdata) | [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) | [TrxToken](#interface-trxtoken) | | [ArcMinerPostBeefDataApi](#interface-arcminerpostbeefdataapi) | [GetReqsAndBeefResult](#interface-getreqsandbeefresult) | [TscMerkleProofApi](#interface-tscmerkleproofapi) | | [ArcMinerPostTxsData](#interface-arcminerposttxsdata) | [GetUtxoStatusDetails](#interface-getutxostatusdetails) | [TxScriptOffsets](#interface-txscriptoffsets) | | [ArcServiceConfig](#interface-arcserviceconfig) | [GetUtxoStatusResult](#interface-getutxostatusresult) | [UpdateProvenTxReqWithNewProvenTxArgs](#interface-updateproventxreqwithnewproventxargs) | | [AuthId](#interface-authid) | [KeyPair](#interface-keypair) | [UpdateProvenTxReqWithNewProvenTxResult](#interface-updateproventxreqwithnewproventxresult) | | [BaseBlockHeader](#interface-baseblockheader) | [MonitorOptions](#interface-monitoroptions) | [ValidAbortActionArgs](#interface-validabortactionargs) | | [BlockHeader](#interface-blockheader) | [OutPoint](#interface-outpoint) | [ValidAcquireCertificateArgs](#interface-validacquirecertificateargs) | | [BsvExchangeRate](#interface-bsvexchangerate) | [Paged](#interface-paged) | [ValidAcquireDirectCertificateArgs](#interface-validacquiredirectcertificateargs) | | [CertOpsWallet](#interface-certopswallet) | [PendingSignAction](#interface-pendingsignaction) | [ValidBasketInsertion](#interface-validbasketinsertion) | | [CommitNewTxResults](#interface-commitnewtxresults) | [PendingStorageInput](#interface-pendingstorageinput) | [ValidCreateActionArgs](#interface-validcreateactionargs) | | [EntityTimeStamp](#interface-entitytimestamp) | [PostBeefResult](#interface-postbeefresult) | [ValidCreateActionInput](#interface-validcreateactioninput) | | [ExchangeRatesIoApi](#interface-exchangeratesioapi) | [PostBeefResultForTxidApi](#interface-postbeefresultfortxidapi) | [ValidCreateActionOptions](#interface-validcreateactionoptions) | | [FiatExchangeRates](#interface-fiatexchangerates) | [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) | [ValidCreateActionOutput](#interface-validcreateactionoutput) | | [FindCertificateFieldsArgs](#interface-findcertificatefieldsargs) | [PostReqsToNetworkResult](#interface-postreqstonetworkresult) | [ValidDiscoverByAttributesArgs](#interface-validdiscoverbyattributesargs) | | [FindCertificatesArgs](#interface-findcertificatesargs) | [PostTxResultForTxid](#interface-posttxresultfortxid) | [ValidDiscoverByIdentityKeyArgs](#interface-validdiscoverbyidentitykeyargs) | | [FindCommissionsArgs](#interface-findcommissionsargs) | [PostTxsResult](#interface-posttxsresult) | [ValidInternalizeActionArgs](#interface-validinternalizeactionargs) | | [FindForUserSincePagedArgs](#interface-findforusersincepagedargs) | [ProcessSyncChunkResult](#interface-processsyncchunkresult) | [ValidInternalizeOutput](#interface-validinternalizeoutput) | | [FindMonitorEventsArgs](#interface-findmonitoreventsargs) | [ProvenOrRawTx](#interface-provenorrawtx) | [ValidListActionsArgs](#interface-validlistactionsargs) | | [FindOutputBasketsArgs](#interface-findoutputbasketsargs) | [PurgeParams](#interface-purgeparams) | [ValidListCertificatesArgs](#interface-validlistcertificatesargs) | | [FindOutputTagMapsArgs](#interface-findoutputtagmapsargs) | [PurgeResults](#interface-purgeresults) | [ValidListOutputsArgs](#interface-validlistoutputsargs) | | [FindOutputTagsArgs](#interface-findoutputtagsargs) | [RequestSyncChunkArgs](#interface-requestsyncchunkargs) | [ValidProcessActionArgs](#interface-validprocessactionargs) | | [FindOutputsArgs](#interface-findoutputsargs) | [ScriptTemplateParamsSABPPP](#interface-scripttemplateparamssabppp) | [ValidProcessActionOptions](#interface-validprocessactionoptions) | | [FindPartialSincePagedArgs](#interface-findpartialsincepagedargs) | [StorageCreateActionResult](#interface-storagecreateactionresult) | [ValidProveCertificateArgs](#interface-validprovecertificateargs) | | [FindProvenTxReqsArgs](#interface-findproventxreqsargs) | [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput) | [ValidRelinquishCertificateArgs](#interface-validrelinquishcertificateargs) | | [FindProvenTxsArgs](#interface-findproventxsargs) | [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) | [ValidRelinquishOutputArgs](#interface-validrelinquishoutputargs) | | [FindSincePagedArgs](#interface-findsincepagedargs) | [StorageFeeModel](#interface-storagefeemodel) | [ValidSignActionArgs](#interface-validsignactionargs) | | [FindSyncStatesArgs](#interface-findsyncstatesargs) | [StorageGetBeefOptions](#interface-storagegetbeefoptions) | [ValidSignActionOptions](#interface-validsignactionoptions) | | [FindTransactionsArgs](#interface-findtransactionsargs) | [StorageIdentity](#interface-storageidentity) | [ValidWalletPayment](#interface-validwalletpayment) | | [FindTxLabelMapsArgs](#interface-findtxlabelmapsargs) | [StorageInternalizeActionResult](#interface-storageinternalizeactionresult) | [ValidWalletSignerArgs](#interface-validwalletsignerargs) | | [FindTxLabelsArgs](#interface-findtxlabelsargs) | [StorageProcessActionArgs](#interface-storageprocessactionargs) | [WalletArgs](#interface-walletargs) | | [FindUsersArgs](#interface-findusersargs) | [StorageProcessActionResults](#interface-storageprocessactionresults) | [WalletServices](#interface-walletservices) | | [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) | [StorageProvenOrReq](#interface-storageprovenorreq) | [WalletServicesOptions](#interface-walletservicesoptions) | | [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) | [StorageProviderOptions](#interface-storageprovideroptions) | [WalletSigner](#interface-walletsigner) | | [GenerateChangeSdkInput](#interface-generatechangesdkinput) | [StorageReaderOptions](#interface-storagereaderoptions) | [WalletStorage](#interface-walletstorage) | | [GenerateChangeSdkOutput](#interface-generatechangesdkoutput) | [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) | [WalletStorageProvider](#interface-walletstorageprovider) | | [GenerateChangeSdkParams](#interface-generatechangesdkparams) | [StorageSyncReader](#interface-storagesyncreader) | [WalletStorageReader](#interface-walletstoragereader) | | [GenerateChangeSdkResult](#interface-generatechangesdkresult) | [StorageSyncReaderOptions](#interface-storagesyncreaderoptions) | [WalletStorageSync](#interface-walletstoragesync) | | [GenerateChangeSdkStorageChange](#interface-generatechangesdkstoragechange) | [StorageSyncReaderWriter](#interface-storagesyncreaderwriter) | [WalletStorageWriter](#interface-walletstoragewriter) | | [GetMerklePathResult](#interface-getmerklepathresult) | [SyncChunk](#interface-syncchunk) | [XValidCreateActionOutput](#interface-xvalidcreateactionoutput) | | [GetRawTxResult](#interface-getrawtxresult) | [TaskPurgeParams](#interface-taskpurgeparams) | | Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ArcMinerGetTxData ```ts export interface ArcMinerGetTxData { status: number; title: string; blockHash: string; blockHeight: number; competingTxs: null | string[]; extraInfo: string; merklePath: string; timestamp: string; txid: string; txStatus: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ArcMinerPostBeefDataApi ```ts export interface ArcMinerPostBeefDataApi { status: number; title: string; blockHash?: string; blockHeight?: number; competingTxs?: null; extraInfo: string; merklePath?: string; timestamp?: string; txid?: string; txStatus?: string; type?: string; detail?: string; instance?: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ArcMinerPostTxsData ```ts export interface ArcMinerPostTxsData { status: number; title: string; blockHash: string; blockHeight: number; competingTxs: null | string[]; extraInfo: string; merklePath: string; timestamp: string; txid: string; txStatus: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ArcServiceConfig ```ts export interface ArcServiceConfig { name: string; url: string; arcConfig: ArcConfig; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: AuthId ```ts export interface AuthId { identityKey: string; userId?: number; isActive?: boolean; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: BaseBlockHeader These are fields of 80 byte serialized header in order whose double sha256 hash is a block's hash value and the next block's previousHash value. All block hash values and merkleRoot values are 32 byte hex string values with the byte order reversed from the serialized byte order. ```ts export interface BaseBlockHeader { version: number; previousHash: string; merkleRoot: string; time: number; bits: number; nonce: number; } ``` <details> <summary>Interface BaseBlockHeader Details</summary> #### Property bits Block header bits value. Serialized length is 4 bytes. ```ts bits: number ``` #### Property merkleRoot Root hash of the merkle tree of all transactions in this block. Serialized length is 32 bytes. ```ts merkleRoot: string ``` #### Property nonce Block header nonce value. Serialized length is 4 bytes. ```ts nonce: number ``` #### Property previousHash Hash of previous block's block header. Serialized length is 32 bytes. ```ts previousHash: string ``` #### Property time Block header time value. Serialized length is 4 bytes. ```ts time: number ``` #### Property version Block header version value. Serialized length is 4 bytes. ```ts version: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: BlockHeader A `BaseBlockHeader` extended with its computed hash and height in its chain. ```ts export interface BlockHeader extends BaseBlockHeader { height: number; hash: string; } ``` See also: [BaseBlockHeader](#interface-baseblockheader) <details> <summary>Interface BlockHeader Details</summary> #### Property hash The double sha256 hash of the serialized `BaseBlockHeader` fields. ```ts hash: string ``` #### Property height Height of the header, starting from zero. ```ts height: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: BsvExchangeRate ```ts export interface BsvExchangeRate { timestamp: Date; base: "USD"; rate: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: CertOpsWallet ```ts export interface CertOpsWallet { getPublicKey(args: GetPublicKeyArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<GetPublicKeyResult>; encrypt(args: WalletEncryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletEncryptResult>; decrypt(args: WalletDecryptArgs, originator?: OriginatorDomainNameStringUnder250Bytes): Promise<WalletDecryptResult>; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: CommitNewTxResults ```ts export interface CommitNewTxResults { req: entity.ProvenTxReq; log?: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: EntityTimeStamp ```ts export interface EntityTimeStamp { created_at: Date; updated_at: Date; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ExchangeRatesIoApi ```ts export interface ExchangeRatesIoApi { success: boolean; timestamp: number; base: "EUR" | "USD"; date: string; rates: Record<string, number>; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FiatExchangeRates ```ts export interface FiatExchangeRates { timestamp: Date; base: "USD"; rates: Record<string, number>; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindCertificateFieldsArgs ```ts export interface FindCertificateFieldsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.CertificateField>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindCertificatesArgs ```ts export interface FindCertificatesArgs extends FindSincePagedArgs { partial: Partial<table.Certificate>; certifiers?: string[]; types?: string[]; includeFields?: boolean; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindCommissionsArgs ```ts export interface FindCommissionsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.Commission>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindForUserSincePagedArgs ```ts export interface FindForUserSincePagedArgs extends FindSincePagedArgs { userId: number; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindMonitorEventsArgs ```ts export interface FindMonitorEventsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.MonitorEvent>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindOutputBasketsArgs ```ts export interface FindOutputBasketsArgs extends FindSincePagedArgs { partial: Partial<table.OutputBasket>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindOutputTagMapsArgs ```ts export interface FindOutputTagMapsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.OutputTagMap>; tagIds?: number[]; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindOutputTagsArgs ```ts export interface FindOutputTagsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.OutputTag>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindOutputsArgs ```ts export interface FindOutputsArgs extends FindSincePagedArgs { partial: Partial<table.Output>; noScript?: boolean; txStatus?: sdk.TransactionStatus[]; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs), [TransactionStatus](#type-transactionstatus) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindPartialSincePagedArgs ```ts export interface FindPartialSincePagedArgs<T extends object> extends FindSincePagedArgs { partial: Partial<T>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindProvenTxReqsArgs ```ts export interface FindProvenTxReqsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.ProvenTxReq>; status?: sdk.ProvenTxReqStatus[]; txids?: string[]; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs), [ProvenTxReqStatus](#type-proventxreqstatus) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindProvenTxsArgs ```ts export interface FindProvenTxsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.ProvenTx>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindSincePagedArgs ```ts export interface FindSincePagedArgs { since?: Date; paged?: sdk.Paged; trx?: sdk.TrxToken; } ``` See also: [Paged](#interface-paged), [TrxToken](#interface-trxtoken) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindSyncStatesArgs ```ts export interface FindSyncStatesArgs extends sdk.FindSincePagedArgs { partial: Partial<table.SyncState>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindTransactionsArgs ```ts export interface FindTransactionsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.Transaction>; status?: sdk.TransactionStatus[]; noRawTx?: boolean; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs), [TransactionStatus](#type-transactionstatus) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindTxLabelMapsArgs ```ts export interface FindTxLabelMapsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.TxLabelMap>; labelIds?: number[]; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindTxLabelsArgs ```ts export interface FindTxLabelsArgs extends sdk.FindSincePagedArgs { partial: Partial<table.TxLabel>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: FindUsersArgs ```ts export interface FindUsersArgs extends sdk.FindSincePagedArgs { partial: Partial<table.User>; } ``` See also: [FindSincePagedArgs](#interface-findsincepagedargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkChangeInput ```ts export interface GenerateChangeSdkChangeInput { outputId: number; satoshis: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkChangeOutput ```ts export interface GenerateChangeSdkChangeOutput { satoshis: number; lockingScriptLength: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkInput ```ts export interface GenerateChangeSdkInput { satoshis: number; unlockingScriptLength: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkOutput ```ts export interface GenerateChangeSdkOutput { satoshis: number; lockingScriptLength: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkParams ```ts export interface GenerateChangeSdkParams { fixedInputs: GenerateChangeSdkInput[]; fixedOutputs: GenerateChangeSdkOutput[]; feeModel: sdk.StorageFeeModel; targetNetCount?: number; changeInitialSatoshis: number; changeFirstSatoshis: number; changeLockingScriptLength: number; changeUnlockingScriptLength: number; randomVals?: number[]; noLogging?: boolean; log?: string; } ``` See also: [GenerateChangeSdkInput](#interface-generatechangesdkinput), [GenerateChangeSdkOutput](#interface-generatechangesdkoutput), [StorageFeeModel](#interface-storagefeemodel) <details> <summary>Interface GenerateChangeSdkParams Details</summary> #### Property changeFirstSatoshis Lowest amount value to assign to a change output. Drop the output if unable to satisfy. default 285 ```ts changeFirstSatoshis: number ``` #### Property changeInitialSatoshis Satoshi amount to initialize optional new change outputs. ```ts changeInitialSatoshis: number ``` #### Property changeLockingScriptLength Fixed change locking script length. For P2PKH template, 25 bytes ```ts changeLockingScriptLength: number ``` #### Property changeUnlockingScriptLength Fixed change unlocking script length. For P2PKH template, 107 bytes ```ts changeUnlockingScriptLength: number ``` #### Property targetNetCount Target for number of new change outputs added minus number of funding change outputs consumed. If undefined, only a single change output will be added if excess fees must be recaptured. ```ts targetNetCount?: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkResult ```ts export interface GenerateChangeSdkResult { allocatedChangeInputs: GenerateChangeSdkChangeInput[]; changeOutputs: GenerateChangeSdkChangeOutput[]; size: number; fee: number; satsPerKb: number; } ``` See also: [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput), [GenerateChangeSdkChangeOutput](#interface-generatechangesdkchangeoutput) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GenerateChangeSdkStorageChange ```ts export interface GenerateChangeSdkStorageChange extends GenerateChangeSdkChangeInput { spendable: boolean; } ``` See also: [GenerateChangeSdkChangeInput](#interface-generatechangesdkchangeinput) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetMerklePathResult Properties on result returned from `WalletServices` function `getMerkleProof`. ```ts export interface GetMerklePathResult { name?: string; merklePath?: MerklePath; header?: BlockHeader; error?: sdk.WalletError; } ``` See also: [BlockHeader](#interface-blockheader), [WalletError](#class-walleterror) <details> <summary>Interface GetMerklePathResult Details</summary> #### Property error The first exception error that occurred during processing, if any. ```ts error?: sdk.WalletError ``` See also: [WalletError](#class-walleterror) #### Property merklePath Multiple proofs may be returned when a transaction also appears in one or more orphaned blocks ```ts merklePath?: MerklePath ``` #### Property name The name of the service returning the proof, or undefined if no proof ```ts name?: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetRawTxResult Properties on result returned from `WalletServices` function `getRawTx`. ```ts export interface GetRawTxResult { txid: string; name?: string; rawTx?: number[]; error?: sdk.WalletError; } ``` See also: [WalletError](#class-walleterror) <details> <summary>Interface GetRawTxResult Details</summary> #### Property error The first exception error that occurred during processing, if any. ```ts error?: sdk.WalletError ``` See also: [WalletError](#class-walleterror) #### Property name The name of the service returning the rawTx, or undefined if no rawTx ```ts name?: string ``` #### Property rawTx Multiple proofs may be returned when a transaction also appears in one or more orphaned blocks ```ts rawTx?: number[] ``` #### Property txid Transaction hash or rawTx (and of initial request) ```ts txid: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetReqsAndBeefDetail ```ts export interface GetReqsAndBeefDetail { txid: string; req?: table.ProvenTxReq; proven?: table.ProvenTx; status: "readyToSend" | "alreadySent" | "error" | "unknown"; error?: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetReqsAndBeefResult ```ts export interface GetReqsAndBeefResult { beef: Beef; details: GetReqsAndBeefDetail[]; } ``` See also: [GetReqsAndBeefDetail](#interface-getreqsandbeefdetail) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetUtxoStatusDetails ```ts export interface GetUtxoStatusDetails { height?: number; txid?: string; index?: number; satoshis?: number; } ``` <details> <summary>Interface GetUtxoStatusDetails Details</summary> #### Property height if isUtxo, the block height containing the matching unspent transaction output typically there will be only one, but future orphans can result in multiple values ```ts height?: number ``` #### Property index if isUtxo, the output index in the transaction containing of the matching unspent transaction output typically there will be only one, but future orphans can result in multiple values ```ts index?: number ``` #### Property satoshis if isUtxo, the amount of the matching unspent transaction output typically there will be only one, but future orphans can result in multiple values ```ts satoshis?: number ``` #### Property txid if isUtxo, the transaction hash (txid) of the transaction containing the matching unspent transaction output typically there will be only one, but future orphans can result in multiple values ```ts txid?: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: GetUtxoStatusResult ```ts export interface GetUtxoStatusResult { name: string; status: "success" | "error"; error?: sdk.WalletError; isUtxo?: boolean; details: GetUtxoStatusDetails[]; } ``` See also: [GetUtxoStatusDetails](#interface-getutxostatusdetails), [WalletError](#class-walleterror) <details> <summary>Interface GetUtxoStatusResult Details</summary> #### Property details Additional details about occurances of this output script as a utxo. Normally there will be one item in the array but due to the possibility of orphan races there could be more than one block in which it is a valid utxo. ```ts details: GetUtxoStatusDetails[] ``` See also: [GetUtxoStatusDetails](#interface-getutxostatusdetails) #### Property error When status is 'error', provides code and description ```ts error?: sdk.WalletError ``` See also: [WalletError](#class-walleterror) #### Property isUtxo true if the output is associated with at least one unspent transaction output ```ts isUtxo?: boolean ``` #### Property name The name of the service to which the transaction was submitted for processing ```ts name: string ``` #### Property status 'success' - the operation was successful, non-error results are valid. 'error' - the operation failed, error may have relevant information. ```ts status: "success" | "error" ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: KeyPair ```ts export interface KeyPair { privateKey: string; publicKey: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: MonitorOptions ```ts export interface MonitorOptions { chain: sdk.Chain; services: Services; storage: MonitorStorage; chaintracks: ChaintracksServiceClient; msecsWaitPerMerkleProofServiceReq: number; taskRunWaitMsecs: number; abandonedMsecs: number; unprovenAttemptsLimitTest: number; unprovenAttemptsLimitMain: number; } ``` See also: [Chain](#type-chain), [MonitorStorage](#type-monitorstorage), [Services](#class-services) <details> <summary>Interface MonitorOptions Details</summary> #### Property msecsWaitPerMerkleProofServiceReq How many msecs to wait after each getMerkleProof service request. ```ts msecsWaitPerMerkleProofServiceReq: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: OutPoint Identifies a unique transaction output by its `txid` and index `vout` ```ts export interface OutPoint { txid: string; vout: number; } ``` <details> <summary>Interface OutPoint Details</summary> #### Property txid Transaction double sha256 hash as big endian hex string ```ts txid: string ``` #### Property vout zero based output index within the transaction ```ts vout: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: Paged ```ts export interface Paged { limit: number; offset?: number; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PendingSignAction ```ts export interface PendingSignAction { reference: string; dcr: sdk.StorageCreateActionResult; args: sdk.ValidCreateActionArgs; tx: BsvTransaction; amount: number; pdi: PendingStorageInput[]; } ``` See also: [PendingStorageInput](#interface-pendingstorageinput), [StorageCreateActionResult](#interface-storagecreateactionresult), [ValidCreateActionArgs](#interface-validcreateactionargs) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PendingStorageInput ```ts export interface PendingStorageInput { vin: number; derivationPrefix: string; derivationSuffix: string; unlockerPubKey?: string; sourceSatoshis: number; lockingScript: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostBeefResult ```ts export interface PostBeefResult extends PostTxsResult { } ``` See also: [PostTxsResult](#interface-posttxsresult) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostBeefResultForTxidApi ```ts export interface PostBeefResultForTxidApi { txid: string; status: "success" | "error"; alreadyKnown?: boolean; blockHash?: string; blockHeight?: number; merklePath?: string; } ``` <details> <summary>Interface PostBeefResultForTxidApi Details</summary> #### Property alreadyKnown if true, the transaction was already known to this service. Usually treat as a success. Potentially stop posting to additional transaction processors. ```ts alreadyKnown?: boolean ``` #### Property status 'success' - The transaction was accepted for processing ```ts status: "success" | "error" ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostReqsToNetworkDetails ```ts export interface PostReqsToNetworkDetails { txid: string; req: entity.ProvenTxReq; status: PostReqsToNetworkDetailsStatus; pbrft: sdk.PostTxResultForTxid; data?: string; error?: string; } ``` See also: [PostReqsToNetworkDetailsStatus](#type-postreqstonetworkdetailsstatus), [PostTxResultForTxid](#interface-posttxresultfortxid) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostReqsToNetworkResult ```ts export interface PostReqsToNetworkResult { status: "success" | "error"; beef: Beef; details: PostReqsToNetworkDetails[]; pbr?: sdk.PostBeefResult; log: string; } ``` See also: [PostBeefResult](#interface-postbeefresult), [PostReqsToNetworkDetails](#interface-postreqstonetworkdetails) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostTxResultForTxid ```ts export interface PostTxResultForTxid { txid: string; status: "success" | "error"; alreadyKnown?: boolean; blockHash?: string; blockHeight?: number; merklePath?: MerklePath; data?: object; } ``` <details> <summary>Interface PostTxResultForTxid Details</summary> #### Property alreadyKnown if true, the transaction was already known to this service. Usually treat as a success. Potentially stop posting to additional transaction processors. ```ts alreadyKnown?: boolean ``` #### Property status 'success' - The transaction was accepted for processing ```ts status: "success" | "error" ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PostTxsResult Properties on array items of result returned from `WalletServices` function `postBeef`. ```ts export interface PostTxsResult { name: string; status: "success" | "error"; error?: sdk.WalletError; txidResults: PostTxResultForTxid[]; data?: object; } ``` See also: [PostTxResultForTxid](#interface-posttxresultfortxid), [WalletError](#class-walleterror) <details> <summary>Interface PostTxsResult Details</summary> #### Property data Service response object. Use service name and status to infer type of object. ```ts data?: object ``` #### Property name The name of the service to which the transaction was submitted for processing ```ts name: string ``` #### Property status 'success' all txids returned status of 'success' 'error' one or more txids returned status of 'error'. See txidResults for details. ```ts status: "success" | "error" ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ProcessSyncChunkResult ```ts export interface ProcessSyncChunkResult { done: boolean; maxUpdated_at: Date | undefined; updates: number; inserts: number; error?: sdk.WalletError; } ``` See also: [WalletError](#class-walleterror) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ProvenOrRawTx ```ts export interface ProvenOrRawTx { proven?: table.ProvenTx; rawTx?: number[]; inputBEEF?: number[]; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PurgeParams ```ts export interface PurgeParams { purgeCompleted: boolean; purgeFailed: boolean; purgeSpent: boolean; purgeCompletedAge?: number; purgeFailedAge?: number; purgeSpentAge?: number; } ``` <details> <summary>Interface PurgeParams Details</summary> #### Property purgeCompletedAge Minimum age in msecs for transient completed transaction data purge. Default is 14 days. ```ts purgeCompletedAge?: number ``` #### Property purgeFailedAge Minimum age in msecs for failed transaction data purge. Default is 14 days. ```ts purgeFailedAge?: number ``` #### Property purgeSpentAge Minimum age in msecs for failed transaction data purge. Default is 14 days. ```ts purgeSpentAge?: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: PurgeResults ```ts export interface PurgeResults { count: number; log: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: RequestSyncChunkArgs ```ts export interface RequestSyncChunkArgs { fromStorageIdentityKey: string; toStorageIdentityKey: string; identityKey: string; since?: Date; maxRoughSize: number; maxItems: number; offsets: { name: string; offset: number; }[]; } ``` <details> <summary>Interface RequestSyncChunkArgs Details</summary> #### Property fromStorageIdentityKey The storageIdentityKey of the storage supplying the update SyncChunk data. ```ts fromStorageIdentityKey: string ``` #### Property identityKey The identity of whose data is being requested ```ts identityKey: string ``` #### Property maxItems The maximum number of items (records) to be returned. ```ts maxItems: number ``` #### Property maxRoughSize A rough limit on how large the response should be. The item that exceeds the limit is included and ends adding more items. ```ts maxRoughSize: number ``` #### Property offsets For each entity in dependency order, the offset at which to start returning items from `since`. The entity order is: 0 ProvenTxs 1 ProvenTxReqs 2 OutputBaskets 3 TxLabels 4 OutputTags 5 Transactions 6 TxLabelMaps 7 Commissions 8 Outputs 9 OutputTagMaps 10 Certificates 11 CertificateFields ```ts offsets: { name: string; offset: number; }[] ``` #### Property since The max updated_at time received from the storage service receiving the request. Will be undefiend if this is the first request or if no data was previously sync'ed. `since` must include items if 'updated_at' is greater or equal. Thus, when not undefined, a sync request should always return at least one item already seen. ```ts since?: Date ``` #### Property toStorageIdentityKey The storageIdentityKey of the storage consuming the update SyncChunk data. ```ts toStorageIdentityKey: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: ScriptTemplateParamsSABPPP ```ts export interface ScriptTemplateParamsSABPPP { derivationPrefix?: string; derivationSuffix?: string; keyDeriver: KeyDeriverApi; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageCreateActionResult ```ts export interface StorageCreateActionResult { inputBeef?: number[]; inputs: StorageCreateTransactionSdkInput[]; outputs: StorageCreateTransactionSdkOutput[]; noSendChangeOutputVouts?: number[]; derivationPrefix: string; version: number; lockTime: number; reference: string; } ``` See also: [StorageCreateTransactionSdkInput](#interface-storagecreatetransactionsdkinput), [StorageCreateTransactionSdkOutput](#interface-storagecreatetransactionsdkoutput) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageCreateTransactionSdkInput ```ts export interface StorageCreateTransactionSdkInput { vin: number; sourceTxid: string; sourceVout: number; sourceSatoshis: number; sourceLockingScript: string; unlockingScriptLength: number; providedBy: StorageProvidedBy; type: string; spendingDescription?: string; derivationPrefix?: string; derivationSuffix?: string; senderIdentityKey?: string; } ``` See also: [StorageProvidedBy](#type-storageprovidedby) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageCreateTransactionSdkOutput ```ts export interface StorageCreateTransactionSdkOutput extends sdk.ValidCreateActionOutput { vout: number; providedBy: StorageProvidedBy; purpose?: string; derivationSuffix?: string; } ``` See also: [StorageProvidedBy](#type-storageprovidedby), [ValidCreateActionOutput](#interface-validcreateactionoutput) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageFeeModel Specifies the available options for computing transaction fees. ```ts export interface StorageFeeModel { model: "sat/kb"; value?: number; } ``` <details> <summary>Interface StorageFeeModel Details</summary> #### Property model Available models. Currently only "sat/kb" is supported. ```ts model: "sat/kb" ``` #### Property value When "fee.model" is "sat/kb", this is an integer representing the number of satoshis per kb of block space the transaction will pay in fees. If undefined, the default value is used. ```ts value?: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageGetBeefOptions ```ts export interface StorageGetBeefOptions { trustSelf?: "known"; knownTxids?: string[]; mergeToBeef?: Beef | number[]; ignoreStorage?: boolean; ignoreServices?: boolean; ignoreNewProven?: boolean; minProofLevel?: number; } ``` <details> <summary>Interface StorageGetBeefOptions Details</summary> #### Property ignoreNewProven optional. Default is false. If true, raw transactions with proofs missing from `storage` and obtained from `getServices` are not inserted to `storage`. ```ts ignoreNewProven?: boolean ``` #### Property ignoreServices optional. Default is false. `getServices` is used for raw transaction and merkle proof lookup ```ts ignoreServices?: boolean ``` #### Property ignoreStorage optional. Default is false. `storage` is used for raw transaction and merkle proof lookup ```ts ignoreStorage?: boolean ``` #### Property knownTxids list of txids to be included as txidOnly if referenced. Validity is known to caller. ```ts knownTxids?: string[] ``` #### Property mergeToBeef optional. If defined, raw transactions and merkle paths required by txid are merged to this instance and returned. Otherwise a new Beef is constructed and returned. ```ts mergeToBeef?: Beef | number[] ``` #### Property minProofLevel optional. Default is zero. Ignores available merkle paths until recursion detpth equals or exceeds value ```ts minProofLevel?: number ``` #### Property trustSelf if 'known', txids known to local storage as valid are included as txidOnly ```ts trustSelf?: "known" ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageIdentity ```ts export interface StorageIdentity { storageIdentityKey: string; storageName: string; } ``` <details> <summary>Interface StorageIdentity Details</summary> #### Property storageIdentityKey The identity key (public key) assigned to this storage ```ts storageIdentityKey: string ``` #### Property storageName The human readable name assigned to this storage. ```ts storageName: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageInternalizeActionResult ```ts export interface StorageInternalizeActionResult extends InternalizeActionResult { isMerge: boolean; txid: string; satoshis: number; } ``` <details> <summary>Interface StorageInternalizeActionResult Details</summary> #### Property isMerge true if internalizing outputs on an existing storage transaction ```ts isMerge: boolean ``` #### Property satoshis net change in change balance for user due to this internalization ```ts satoshis: number ``` #### Property txid txid of transaction being internalized ```ts txid: string ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageProcessActionArgs ```ts export interface StorageProcessActionArgs { isNewTx: boolean; isSendWith: boolean; isNoSend: boolean; isDelayed: boolean; reference?: string; txid?: string; rawTx?: number[]; sendWith: string[]; log?: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageProcessActionResults ```ts export interface StorageProcessActionResults { sendWithResults?: SendWithResult[]; log?: string; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageProvenOrReq ```ts export interface StorageProvenOrReq { proven?: table.ProvenTx; req?: table.ProvenTxReq; } ``` Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageProviderOptions ```ts export interface StorageProviderOptions extends StorageReaderWriterOptions { chain: sdk.Chain; feeModel: sdk.StorageFeeModel; commissionSatoshis: number; commissionPubKeyHex?: PubKeyHex; } ``` See also: [Chain](#type-chain), [StorageFeeModel](#interface-storagefeemodel), [StorageReaderWriterOptions](#interface-storagereaderwriteroptions) <details> <summary>Interface StorageProviderOptions Details</summary> #### Property commissionPubKeyHex If commissionSatoshis is greater than zero, must be a valid public key hex string. The actual locking script for each commission will use a public key derived from this key by information stored in the commissions table. ```ts commissionPubKeyHex?: PubKeyHex ``` #### Property commissionSatoshis Transactions created by this Storage can charge a fee per transaction. A value of zero disables commission fees. ```ts commissionSatoshis: number ``` </details> Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageReaderOptions ```ts export interface StorageReaderOptions { chain: sdk.Chain; } ``` See also: [Chain](#type-chain) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageReaderWriterOptions ```ts export interface StorageReaderWriterOptions extends StorageReaderOptions { } ``` See also: [StorageReaderOptions](#interface-storagereaderoptions) Links: [API](#api), [Interfaces](#interfaces), [Classes](#classes), [Functions](#functions), [Types](#types), [Variables](#variables) --- ### Interface: StorageSyncReader This is the minimal interface required for a WalletStorageProvider to export data to another provider. ```ts export interface StorageSyncReader { isAvailable(): boolean; makeAvailable(): Promise<table.Settings>; destroy(): Promise<void>; getSettings(): table.Settings; findUserByIdentityKey(key: string): Promise<table.User | undefined>; findSyncStates(args: sdk.FindSyncStatesArgs): Promise<table.SyncState[]>; findCertificateFields(args: sdk.FindCertificateFieldsArgs): Promise<table.CertificateField[]>; findCertificates(args: sdk.FindCertificatesArgs): Promise<table.Certificate[]>; findCommissions(args: sdk.Find