UNPKG

@2waychain/2wayjs

Version:

API wrapper to access the AIBlock 2 Way Chain

42 lines (41 loc) 2.52 kB
import { IAssetItem, IAssetToken, ICreateTxIn, ICreateTxPayload, IDruidValues, IFetchBalanceResponse, IKeypair, IResult } from '../interfaces'; export type IGetInputsResult = { inputs: ICreateTxIn[]; totalAmountGathered: IAssetToken | IAssetItem; usedAddresses: string[]; depletedAddresses: string[]; }; /** * Gather `TxIn` (input) values for a transaction * * @export * @param {(IAssetToken | IAssetItem)} paymentAsset - Required payment asset to gather inputs for * @param {IFetchBalanceResponse} fetchBalanceResponse - Balance as received from the network * @param {Map<string, IKeypair>} allKeypairs - A map of all existing key-pairs owned by the sender * @return {*} {(IResult<[string[], IAssetToken | IAssetItem, ICreateTxIn[]]>)} */ export declare function getInputsForTx(paymentAsset: IAssetToken | IAssetItem, fetchBalanceResponse: IFetchBalanceResponse, allKeypairs: Map<string, IKeypair>): IResult<IGetInputsResult>; /** * Base function used to create a transaction suitable for processing by a mempool node * * @export * @param {string} paymentAddress - Address to make the payment to * @param {(IAssetToken | IAssetItem)} paymentAsset - The asset to send * @param {string} excessAddress - The address to send excess funds/assets to * @param {(IDruidValues | null)} druidInfo - DRUID information associated with this transaction * @param {([string[], IAssetToken | IAssetItem, ICreateTxIn[]])} txIns - `TxIn` values used in this transaction * @return {*} {IResult<ICreateTxPayload>} */ export declare function createTx(paymentAddress: string, paymentAsset: IAssetToken | IAssetItem, excessAddress: string, druidInfo: IDruidValues | null, txIns: IGetInputsResult, locktime: number): IResult<ICreateTxPayload>; /** * Create a payment transaction * * @export * @param {string} paymentAddress - Address to make the payment to * @param {(IAssetToken | IAssetItem)} paymentAsset - The asset(s) to pay * @param {string} excessAddress - Address to assign excess asset(s) to * @param {IFetchBalanceResponse} fetchBalanceResponse - Balance as fetched from the network * @param {Map<string, IKeypair>} allKeypairs - A list of all existing key-pairs (encrypted) * @return {*} */ export declare function createPaymentTx(paymentAddress: string, paymentAsset: IAssetToken | IAssetItem, excessAddress: string, fetchBalanceResponse: IFetchBalanceResponse, allKeypairs: Map<string, IKeypair>, locktime: number): IResult<ICreateTxPayload>;