import { Models } from '@open-rights-exchange/chain-js'; import { EosPublicKey } from './cryptoModels'; import { EosActionAuthorizationStruct } from './eosStructures'; import { EosEntityName } from './generalModels'; /** Transaction options used when contructing a trnasaction header */ export type EosTransactionOptions = { /** Uses the time from the block which is `blocksBehind` behind head block * to calclate the expiratation time (blockBehind_time + expireSeconds) */ blocksBehind?: number; /** Number of seconds after which transaction expires - must be submitted to the chain before then */ expireSeconds?: number; }; /** Payload returned after sending transaction to chain */ export type EosTxResult = { transactionId: string; chainResponse: EosTxChainResponse; }; /** Response from chain after sending transaction */ export type EosTxChainResponse = any; /** EOS Raw Data Structure for contract action - i.e. including name, authorizations, and serialized representation */ export type EosActionStruct = { account: EosEntityName; name: string; authorization: EosActionAuthorizationStruct[]; data?: any; hex_data?: string; }; /** EOS Raw Data Structure for chain transaction - i.e. including header, actions, and keys */ export interface EosTransactionStruct { expiration: string; ref_block_num: number; ref_block_prefix: number; max_net_usage_words: number | string; max_cpu_usage_ms: number | string; delay_sec: number; context_free_actions: EosActionStruct[]; actions: EosActionStruct[]; available_keys: EosPublicKey[]; } /** Resouces required for transaction */ export type EosTransactionResources = { estimationType: Models.ResourceEstimationType; cpuMicroseconds: number; netBytes: number; ramBytes: number; }; /** EOS chain transaction history */ export interface EosTransactionHistory { receipt: { status: EosTransactionHistoryStatus; cpu_usage_us: number | string; net_usage_words: number | string; trx: [any]; }; trx: EosTransactionStruct; } /** Transction Status on-chain */ export declare enum EosTransactionHistoryStatus { Executed = "executed", SoftFail = "soft_fail", HardFail = "hard_fail", Delayed = "delayed", Expired = "expired" } export type EosSerializedTransaction = EosRawTransaction | string; export type EosRawTransaction = Uint8Array;