UNPKG

@onekeyfe/blockchain-libs

Version:
47 lines (46 loc) 1.86 kB
/// <reference types="node" /> import BigNumber from 'bignumber.js'; import { JsonRPCRequest } from '../../../basic/request/json-rpc'; import { CoinInfo } from '../../../types/chain'; import { AddressInfo, ClientInfo, FeePricePerUnit, TransactionStatus } from '../../../types/provider'; import { SimpleClient } from '../../abc'; declare type NearAccessKey = { type: 'FullAccess' | 'FunctionCall'; pubkey: string; pubkeyHex: string; nonce: number; functionCall?: { allowance: string; receiverId: string; methodNames: string[]; }; }; declare function parseJsonFromRawResponse(response: Uint8Array): any; declare function bytesJsonStringify(input: any): Buffer; export declare type GasCostConfig = { send_sir: number; send_not_sir: number; execution: number; }; declare class NearCli extends SimpleClient { readonly defaultFinality: 'optimistic' | 'final'; readonly rpc: JsonRPCRequest; constructor(url: string, defaultFinality?: 'optimistic' | 'final'); getInfo(): Promise<ClientInfo>; getTxCostConfig(): Promise<Record<string, GasCostConfig>>; getBestBlock(): Promise<{ blockNumber: number; blockHash: string; }>; getAddress(address: string): Promise<AddressInfo>; getAccessKeys(address: string): Promise<NearAccessKey[]>; getBalance(address: string, coin: Partial<CoinInfo>): Promise<BigNumber>; getFeePricePerUnit(): Promise<FeePricePerUnit>; getTransactionStatus(txid: string): Promise<TransactionStatus>; callContract(contract: string, methodName: string, args?: any, { parse, stringify }?: { parse?: typeof parseJsonFromRawResponse | undefined; stringify?: typeof bytesJsonStringify | undefined; }): Promise<any>; broadcastTransaction(rawTx: string): Promise<string>; } export { NearCli, NearAccessKey };