UNPKG

@tangany/waas

Version:

node.js SDK for Tangany Wallet as a Service API

152 lines (151 loc) 4.18 kB
import { IAsyncBitcoinTransactionOutput } from "./bitcoin"; import { IAsyncRequestStatus, ISearchResponse } from "./common"; import { IAsyncEthereumTransactionOutput } from "./ethereum"; import { IAsyncTezosOperationOutput } from "./tezos"; /** * Parameters to configure pagination, sorting or filtering for request status search requests. * There are API-side default values for index (0) and limit (0). * For all other parameters `undefined` or `[]` is used if no value is set explicitly. */ export interface IRequestSearchParams { createdAfter?: Date; createdBefore?: Date; id?: string[]; includePurged?: boolean; index?: number; limit?: number; process?: "completed" | "running" | "pending" | "failed"; purgedAfter?: Date; purgedBefore?: Date; status?: (200 | 202 | 500)[]; updatedAfter?: Date; updatedBefore?: Date; } /** * Represents a request status list operation response */ export interface IRequestStatusesResponse extends ISearchResponse<RequestStatus> { } /** * Represents a request status response */ export interface RequestStatus { requestId: string; isPurged: boolean; content?: IAsyncRequestStatus<IAsyncBitcoinTransactionOutput | IAsyncEthereumTransactionOutput | IAsyncTezosOperationOutput>; trigger: IRequestTrigger; } /** * Represent the trigger of an async process */ export interface IRequestTrigger { computedConfig: IBitcoinComputedConfig | IEthereumComputedConfig | ITezosComputedConfig; url: string; headers: IBitcoinAsyncHeaders | IEthereumAsyncHeaders | ITezosAsyncHeaders; body: IRecipient | IMultipleRecipientsBody | ISmartContractRecipientBody; } /** * Represents the detailed bitcoin configuration of an async process */ interface IBitcoinComputedConfig { network: string; maxFeeRate: number; btcFee: string; fee: number; inputs: IBitcoinInputs[]; outputs: IBitcoinOutputs[]; vbytes: number; } /** * Represents the detailed bitcoin inputs of an async process */ interface IBitcoinInputs { value: number; txId: string; vout: number; confirmations: number; } /** * Represents the detailed bitcoin outputs of an async process */ interface IBitcoinOutputs { address: string; value: number; } /** * Represents the detailed ethereum configuration of an async process */ interface IEthereumComputedConfig { from: string; to: string; nonce: number; transactionType: number; gasLimit: string; value: string; data: string; maxFeePerGas: string; maxPriorityFeePerGas: string; } /** * Represents the detailed tezos configuration of an async process */ interface ITezosComputedConfig { storageFee: number; bakerFee: number; storageLimit: number; gasLimit: number; counter: number; sender: string; target: string; amount: number; } /** * Represents the detailed bitcoin headers used in an async process */ interface IBitcoinAsyncHeaders { "tangany-bitcoin-network": string; "tangany-bitcoin-tx-confirmations"?: string; "tangany-bitcoin-max-fee-rate"?: string; "tangany-bitcoin-tx-speed"?: string; } /** * Represents the detailed ethereum headers used in an async process */ interface IEthereumAsyncHeaders { "tangany-ethereum-network": string; "tangany-ethereum-tx-speed"?: string; "tangany-ethereum-tx-confirmations"?: string; "tangany-ethereum-gas-price"?: string; "tangany-ethereum-gas"?: string; "tangany-ethereum-nonce"?: string; } /** * Represents the detailed tezos headers used in an async process */ interface ITezosAsyncHeaders { "tangany-tezos-network": string; "tangany-tezos-gas-limit"?: string; "tangany-tezos-storage-limit"?: string; "tangany-tezos-operation-confirmations"?: string; } /** * Represents a list of recipients of an transaction */ interface IMultipleRecipientsBody { list?: IRecipient[]; } /** * Represents a smart contract recipients */ interface ISmartContractRecipientBody { function: string; inputs: string[]; } /** * Represents a transaction recipient */ interface IRecipient { amount: string; wallet: string; } export {};