diff --git a/src/api/types.ts b/src/api/types.ts index d400564..9ba4513 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -1,111 +1,115 @@ -import { TransactionFee, TransactionRPC } from '../types' +import { TransactionFee, TransactionRPC } from "../types"; export type NodeRpcMethods = { - contract_fun(params: { - contract: string, - function: string, - args?: any[] - }): any, - estimate_transaction_fee(params: EstimateTransactionFeeRequest): TransactionFee, - send_transaction(params: SendTransactionRequest): SendTransactionResponse, - simulate_contract_execution(params: SimulateContractExecutionRequest): SimulateContractExecutionResponse[], - add_origin_key(params: AddOriginKeyRequest): AddOriginKeyResponse -} + contract_fun(params: { + contract: string; + function: string; + args?: any[]; + }): any; + estimate_transaction_fee( + params: EstimateTransactionFeeRequest + ): TransactionFee; + send_transaction(params: SendTransactionRequest): SendTransactionResponse; + simulate_contract_execution( + params: SimulateContractExecutionRequest + ): SimulateContractExecutionResponse[]; + add_origin_key(params: AddOriginKeyRequest): AddOriginKeyResponse; +}; export type AddOriginKeyRequest = { - certificate: string, - origin_public_key: string, -} + certificate: string; + origin_public_key: string; +}; export type AddOriginKeyResponse = { - transaction_address: string, - status: string -} + transaction_address: string; + status: string; +}; export type EstimateTransactionFeeRequest = { - transaction: TransactionRPC -} + transaction: TransactionRPC; +}; export type SendTransactionRequest = { - transaction: TransactionRPC -} + transaction: TransactionRPC; +}; export type SendTransactionResponse = { - transaction_address: string, - status: string -} + transaction_address: string; + status: string; +}; export type SimulateContractExecutionRequest = { - transaction: TransactionRPC -} + transaction: TransactionRPC; +}; export type SimulateContractExecutionResponse = { - recipient_address: string, - valid: boolean, - error?: string -} + recipient_address: string; + valid: boolean; + error?: string; +}; export enum ConnectionState { - Closed = 'WalletRPCConnection_closed', - Closing = 'WalletRPCConnection_closing', - Connecting = 'WalletRPCConnection_connecting', - Open = 'WalletRPCConnection_open', + Closed = "WalletRPCConnection_closed", + Closing = "WalletRPCConnection_closing", + Connecting = "WalletRPCConnection_connecting", + Open = "WalletRPCConnection_open", } export enum RpcErrorCode { - UnsupportedMethod = -32601, - Timeout = 5001, - Connectivity = 4901, - ConsensusNotReached = 5002, - InvalidParams = -32602, - InvalidTransaction = 5003, - InvalidConfirmation = 5006, - InsufficientFunds = 5004, - ServiceNotFound = 5007, - UserRejected = 4001, - UnknownAccount = 5005, - Other = 5000, + UnsupportedMethod = -32601, + Timeout = 5001, + Connectivity = 4901, + ConsensusNotReached = 5002, + InvalidParams = -32602, + InvalidTransaction = 5003, + InvalidConfirmation = 5006, + InsufficientFunds = 5004, + ServiceNotFound = 5007, + UserRejected = 4001, + UnknownAccount = 5005, + Other = 5000, } export type RpcSubscription = { - id: string; - eventListener: EventListenerOrEventListenerObject; -} + id: string; + eventListener: EventListenerOrEventListenerObject; +}; export type RpcNotification = { - subscriptionId: string; - data: Object; -} + subscriptionId: string; + data: Object; +}; export type RpcRequestOrigin = { - name: string; - url?: string; - logo?: string; -} + name: string; + url?: string; + logo?: string; +}; export type RpcRequest = { - origin: RpcRequestOrigin; - version: number; - payload: Object; -} + origin: RpcRequestOrigin; + version: number; + payload: Object; +}; export type Endpoint = { - endpointUrl: string; -} + endpointUrl: string; +}; export type AccountIdentity = { - name: string; - genesisAddress: string; -} + shortName: string; + genesisAddress: string; +}; export type TransactionSuccess = { - transactionAddress: string, - nbConfirmations: number, - maxConfirmations: number, -} + transactionAddress: string; + nbConfirmations: number; + maxConfirmations: number; +}; export type SignedTransaction = { - address: string, - previousPublicKey: string, - previousSignature: string, - originSignature: string -} + address: string; + previousPublicKey: string; + previousSignature: string; + originSignature: string; +};