@bsv/wallet-toolbox-client
Version:
Client only Wallet Storage
92 lines • 3.56 kB
TypeScript
import { Beef, HexString, HttpClient } from '@bsv/sdk';
import { PostBeefResult, PostTxResultForTxid } from '../../sdk/WalletServices.interfaces';
/** Configuration options for the ARC broadcaster. */
export interface ArcConfig {
/** Authentication token for the ARC API */
apiKey?: string;
/** The HTTP client used to make requests to the ARC API. */
httpClient?: HttpClient;
/** Deployment id used annotating api calls in XDeployment-ID header - this value will be randomly generated if not set */
deploymentId?: string;
/** notification callback endpoint for proofs and double spend notification */
callbackUrl?: string;
/** default access token for notification callback endpoint. It will be used as a Authorization header for the http callback */
callbackToken?: string;
/** additional headers to be attached to all tx submissions. */
headers?: Record<string, string>;
}
/**
* Represents an ARC transaction broadcaster.
*/
export declare class ARC {
readonly name: string;
readonly URL: string;
readonly apiKey: string | undefined;
readonly deploymentId: string;
readonly callbackUrl: string | undefined;
readonly callbackToken: string | undefined;
readonly headers: Record<string, string> | undefined;
private readonly httpClient;
/**
* Constructs an instance of the ARC broadcaster.
*
* @param {string} URL - The URL endpoint for the ARC API.
* @param {ArcConfig} config - Configuration options for the ARC broadcaster.
*/
constructor(URL: string, config?: ArcConfig, name?: string);
/**
* Constructs an instance of the ARC broadcaster.
*
* @param {string} URL - The URL endpoint for the ARC API.
* @param {string} apiKey - The API key used for authorization with the ARC API.
*/
constructor(URL: string, apiKey?: string, name?: string);
/**
* Constructs a dictionary of the default & supplied request headers.
*/
private requestHeaders;
/**
* The ARC '/v1/tx' endpoint, as of 2025-02-17 supports all of the following hex string formats:
* 1. Single serialized raw transaction.
* 2. Single EF serialized raw transaction (untested).
* 3. V1 serialized Beef (results returned reflect only the last transaction in the beef)
*
* The ARC '/v1/tx' endpoint, as of 2025-02-17 DOES NOT support the following hex string formats:
* 1. V2 serialized Beef
*
* @param rawTx
* @param txids
* @returns
*/
postRawTx(rawTx: HexString, txids?: string[]): Promise<PostTxResultForTxid>;
/**
* ARC does not natively support a postBeef end-point aware of multiple txids of interest in the Beef.
*
* It does process multiple new transactions, however, which allows results for all txids of interest
* to be collected by the `/v1/tx/${txid}` endpoint.
*
* @param beef
* @param txids
* @returns
*/
postBeef(beef: Beef, txids: string[]): Promise<PostBeefResult>;
/**
* This seems to only work for recently submitted txids...but that's all we need to complete postBeef!
* @param txid
* @returns
*/
getTxData(txid: string): Promise<ArcMinerGetTxData>;
}
export interface ArcMinerGetTxData {
status: number;
title: string;
blockHash: string;
blockHeight: number;
competingTxs: null | string[];
extraInfo: string;
merklePath: string;
timestamp: string;
txid: string;
txStatus: string;
}
//# sourceMappingURL=ARC.d.ts.map