import { NetworkApi } from '../api/network'; import { Asset, Balance, Block, BlockWithTxList, Contract, GasPrice, MerkleProof, Network, Transaction } from '../api/types'; import { Rpc } from '../rpc/rpc'; export class NetworkApiImp implements NetworkApi { private rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; } getNodeCount() { return this.rpc.call('network.getNodeCount'); } getBlockHeight() { return this.rpc.call('network.getBlockHeight'); } getMerkleProof(args: { txHash: string }) { return this.rpc.call('network.getMerkleProof', args); } getStorage(args: { contract: string; key: string }) { return this.rpc.call('network.getStorage', args); } getAllowance(args: { asset: Asset; fromAddress: string; toAddress: string; }) { return this.rpc.call('network.getAllowance', args); } getAllowanceV2(args: { asset: Asset; fromAddress: string; toAddress: string; }) { return this.rpc.call('network.getAllowanceV2', args); } getBlock(args: { block: number | string }) { return this.rpc.call('network.getBlock', args); } getTransaction(args: { txHash: string }) { return this.rpc.call('network.getTransaction', args); } getNetwork() { return this.rpc.call('network.getNetwork'); } getBalance(args: { address: string }) { return this.rpc.call('network.getBalance', args); } getBalanceV2(args: { address: string }) { return this.rpc.call('network.getBalanceV2', args); } isConnected() { return this.rpc.call('network.isConnected'); } getUnboundOng(args: { address: string }) { return this.rpc.call('network.getUnboundOng', args); } getContract(args: { hash: string }) { return this.rpc.call('network.getContract', args); } getSmartCodeEvent(args: { value: string | number }) { return this.rpc.call('network.getSmartCodeEvent', args); } getBlockHeightByTxHash(args: { hash: string }) { return this.rpc.call('network.getBlockHeightByTxHash', args); } getBlockHash(args: { height: number }) { return this.rpc.call('network.getBlockHash', args); } getBlockTxsByHeight(args: { height: number }) { return this.rpc.call('network.getBlockTxsByHeight', args); } getGasPrice() { return this.rpc.call('network.getGasPrice'); } getGrantOng(args: { address: string }) { return this.rpc.call('network.getGrantOng', args); } getMempoolTxCount() { return this.rpc.call('network.getMempoolTxCount'); } getMempoolTxState(args: { hash: string }) { return this.rpc.call('network.getMempoolTxState', args); } getVersion() { return this.rpc.call('network.getVersion'); } }