UNPKG

@libra-opensource/client-sdk-typescript

Version:
387 lines (386 loc) 9.03 kB
export interface Amount { amount: BigInt; currency: string; } export interface Account { /** * hex-encoded bytes */ address: string; balances: Amount[]; sequence_number?: BigInt; /** * hex-encoded bytes */ authentication_key: string; /** * hex-encoded bytes */ sent_events_key: string; /** * hex-encoded bytes */ received_events_key: string; delegated_key_rotation_capability: boolean; delegated_withdrawal_capability: boolean; is_frozen: boolean; role?: AccountRole; } export interface AccountRole { type: string; parent_vasp_address?: string; human_name: string; base_url: string; expiration_time: BigInt; /** * hex-encoded bytes */ compliance_key: string; /** * hex-encoded bytes */ compliance_key_rotation_events_key?: string; /** * hex-encoded bytes */ base_url_rotation_events_key?: string; num_children: number; /** * hex-encoded bytes */ received_mint_events_key?: string; preburn_balances?: Amount[]; } export interface Event { key: string; sequence_number?: BigInt; transaction_version: BigInt; data?: EventData; } export interface EventData { type: string; /** * burn, cancelburn, mint, preburn, receivedpayment, sentpayment, receivedmint events */ amount?: Amount; /** * burn, cancelburn, preburn events * hex-encoded bytes */ preburn_address?: string; /** * to_xdx_exchange_rate_update event only */ currency_code?: string; new_to_xdx_exchange_rate?: number; /** * receivedpayment and sentpayment events * hex-encoded bytes */ sender?: string; /** * hex-encoded bytes */ receiver: string; /** * hex-encoded bytes */ metadata: string; /** * newepoch event only */ epoch?: number; /** * newblock event only */ round?: number; /** * hex-encoded bytes */ proposer?: string; proposed_time?: BigInt; /** * receivedmint event only * hex-encoded bytes */ destination_address?: string; /** * compliancekeyrotation event only * hex-encoded bytes */ new_compliance_public_key?: string; /** * baseurlrotation event only */ new_base_url?: string; /** * compliancekeyrotation and baseurlrotation events */ time_rotated_seconds?: BigInt; /** * * * createaccount event field. * Hex-encoded account address bytes of the created account. */ created_address?: string; /** * * * createaccount event field. * Role id of the created account, see [DIP-2](https://dip.diem.com/dip-2/#move-implementation) * for more details */ role_id?: number; /** * * * admintransaction event field. * The block time when this transaction is committed. * It is created by validators. */ committed_timestamp_secs?: BigInt; } export interface Metadata { /** * * * The block (ledger) version */ version: BigInt; /** * * * The block (ledger) timestamp, unit is microsecond */ timestamp: BigInt; /** * * * Chain ID of the Diem network */ chain_id?: number; /** * * * List of allowed scripts hex-encoded hash bytes, server may not return this field * if the allow list not found in on chain configuration. */ script_hash_allow_list: string[]; /** * * * True for allowing publishing customized script, server may not return this field * if the flag not found in on chain configuration. */ module_publishing_allowed: boolean; /** * * * Diem chain major version number. */ diem_version: BigInt; /** * * * accumulator root hash of the ledger version requested */ accumulator_root_hash: string; /** * * * The dual attestation limit on-chain. Defined in terms of micro-XDX. */ dual_attestation_limit: number; } export interface Transaction { version: BigInt; transaction?: TransactionData; hash: string; /** * hex-encoded bcs bytes */ bytes: string; events: Event[]; vm_status?: VMStatus; gas_used: BigInt; } export interface MoveAbortExplaination { category: string; category_description: string; reason: string; reason_description: string; } export interface VMStatus { type: string; /** * move_abort, execution_failure */ location?: string; /** * move_abort only */ abort_code?: number; /** * execution_failure only */ function_index?: number; code_offset?: number; /** * move_abort only */ explanation?: MoveAbortExplaination; } export interface TransactionData { type: string; /** * blockmetadata */ timestamp_usecs?: BigInt; /** * user */ sender?: string; signature_scheme?: string; signature?: string; /** * hex-encoded bytes */ public_key?: string; sequence_number?: BigInt; chain_id?: number; max_gas_amount?: BigInt; gas_unit_price?: BigInt; gas_currency?: string; expiration_timestamp_secs?: BigInt; script_hash?: string; /** * hex-encoded bytes */ script_bytes?: string; script?: Script; } export interface Script { /** * * * Name of the script code, see https://github.com/diem/diem/blob/master/language/stdlib/transaction_scripts/doc/transaction_script_documentation.md for all available script names. * Type is set as "unknown" if script code can't be recognized, or transaction payload is not a script. * It is possible server side does not know the code and the code is valid. */ type: string; /** * * * Hex-encoded compiled move script bytes. */ code: string; /** * * * List of string value of the script arguments. Contains type information. * Argument value to string formatting: * - u8 value `12` => "{U8: 12}" * - u64 value `12244` => "{U64: 12244}" * - u128 value `12244` => "{U128: 12244}" * - boolean value `true` => "{BOOL: true}" * - Account address value => "{ADDRESS: <hex-encoded account address bytes>}" * - List<u8> value => "{U8Vector:: 0x<hex-encoded bytes>}" */ arguments: string[]; /** * * * List of type arguments, converted into string. */ type_arguments: string[]; /** * * * hex-encoded receiver account address bytes */ receiver: string; /** * * * peer to peer transfer amount. */ amount: BigInt; /** * * * peer to peer transfer currency code. */ currency: string; /** * * * Metadata of the transaction, LCS serialized hex-encoded string. * See [DIP-4](https://dip.diem.com/dip-4/) for more details. */ metadata: string; /** * * * Hex-encoded metadata signature, use this to validate metadata. * See [DIP-4](https://dip.diem.com/dip-4/) for more details. */ metadata_signature: string; } export interface CurrencyInfo { code: string; scaling_factor: number; fractional_part: number; to_xdx_exchange_rate: number; /** * hex-encoded bytes */ mint_events_key: string; /** * hex-encoded bytes */ burn_events_key: string; /** * HEX-encoded bytes */ preburn_events_key: string; /** * hex-encoded bytes */ cancel_burn_events_key: string; /** * hex-encoded bytes */ exchange_rate_update_events_key: string; } /** * * * This is for experimental API get_state_proof response. It is unstable and likely to be changed. */ export interface StateProof { /** * hex-encoded bcs bytes */ ledger_info_with_signatures: string; /** * hex-encoded bcs bytes */ epoch_change_proof: string; /** * hex-encoded bcs bytes */ ledger_consistency_proof: string; } /** * * * This is for experimental API get_account_state_with_proof response. It is unstable and likely to be changed. */ export interface AccountStateWithProof { version: BigInt; /** * hex-encoded bcs bytes */ blob: string; /** * hex-encoded bcs bytes */ proof?: AccountStateProof; } /** * * * This is for experimental API get_account_state_with_proof response. It is unstable and likely to be changed. */ export interface AccountStateProof { /** * hex-encoded bcs bytes */ ledger_info_to_transaction_info_proof: string; /** * hex-encoded bcs bytes */ transaction_info: string; /** * hex-encoded bcs bytes */ transaction_info_to_account_proof: string; }