UNPKG

@2waychain/2wayjs

Version:

API wrapper to access the AIBlock 2 Way Chain

134 lines (133 loc) 4.28 kB
import { IAssetItem, IAssetToken, ICreateTransaction, ICreateTransactionEncrypted, IDruidDroplet, IDruidExpectation, IGenericKeyPair, IKeypair, IKeypairEncrypted, IMasterKeyEncrypted, INewWalletResponse, IOutPoint, ITransaction } from './general.interfaces'; export type IClientResponse = { id?: string; status: 'success' | 'error' | 'pending' | 'unknown'; reason?: string; content?: IContentType; }; export type IContentType = { newDRUIDResponse?: string; newSeedPhraseResponse?: string; getSeedPhraseResponse?: string; make2WayPaymentResponse?: IMake2WPaymentResponse; newKeypairResponse?: IKeypairEncrypted; getMasterKeyResponse?: IMasterKeyEncrypted; initNewResponse?: INewWalletResponse; fromSeedResponse?: IMasterKeyEncrypted; regenWalletResponse?: IKeypairEncrypted[]; signMessageResponse?: IGenericKeyPair<string>; decryptKeypairResponse?: IKeypair; saveKeypairResponse?: string[]; getKeypairsResponse?: IKeypairEncrypted[]; } & IApiContentType; export type IApiContentType = { fetchBalanceResponse?: IFetchBalanceResponse; createItemResponse?: ICreateItemResponse; fetchPending2WResponse?: IPending2WResponse; debugDataResponse?: IDebugDataResponse; fetchTransactionsResponse?: IFetchTransactionsResponse; makePaymentResponse?: IMakePaymentResponse; }; export declare enum IAPIRoute { DebugData = "/debug_data", FetchBalance = "/fetch_balance", CreateTransactions = "/create_transactions", CreateItemAsset = "/create_item_asset", FetchPending = "/fetch_pending", BlockchainEntry = "/blockchain_entry", ValenceSet = "/set_data", ValenceGet = "/get_data", ValenceDel = "/del_data" } export type INetworkResponse = { id?: string; status: 'Success' | 'Error' | 'InProgress' | 'Unknown'; reason?: string; route?: string; content?: IApiContentType; }; export type IApiCreateTxResponse = IGenericKeyPair<[string, IApiAsset]>; export type IApiAsset = { asset: IAssetToken | IAssetItem; metadata: number[] | null; }; export type IMakePaymentResponse = { transactionHash: string; paymentAddress: string; asset: IAssetToken | IAssetItem; metadata: number[] | null; usedAddresses: string[]; }; export type IFetchTransactionsResponse = (ITransaction | string)[][]; export type IDebugDataResponse = { node_type: string; node_api: string[]; node_peers: string[]; routes_pow: IGenericKeyPair<number>; }; export type IFetchBalanceResponse = { total: { tokens: number; items: IGenericKeyPair<number>; }; address_list: IGenericKeyPair<{ out_point: IOutPoint; value: IAssetItem | IAssetToken; }[]>; }; export type ICreateItemResponse = { asset: { asset: IAssetItem; metadata: number[] | null; }; to_address: string; tx_hash: string; }; export type IFetchPending2WayResponse = { pending_transactions: { [key: string]: IDruidDroplet[]; }; }; export declare enum IGenesisHashSpecification { Create = "Create", Default = "Default" } export type IItemCreationAPIPayload = { item_amount: number; script_public_key: string; public_key: string; signature: string; version: number | null; genesis_hash_spec: IGenesisHashSpecification; }; export type ICreateTxPayload = { createTx: ICreateTransaction; excessAddressUsed: boolean; usedAddresses: string[]; }; export type IRequestValenceResponse = { status: 'Success' | 'Error' | 'InProgress' | 'Unknown'; reason?: string; route?: string; content?: IApiContentType; }; export type IRequestValenceSetBody<T> = { address: string; data: T; }; export type IPending2WResponse = { address: string; data: IPending2WTxDetails; }; export type IPending2WTxDetails = { druid: string; senderExpectation: IDruidExpectation; receiverExpectation: IDruidExpectation; status: 'pending' | 'rejected' | 'accepted'; mempoolHost: string; }; type IMake2WPaymentResponse = { druid: string; encryptedTx: ICreateTransactionEncrypted; }; export {};