@volare.finance/utils.js
Version:
The Blockchain Utils
44 lines (43 loc) • 2.5 kB
TypeScript
/**
* @file index.ts
* @author astra <astra@volare.finance>
* @date 2022
*/
import { BlockTag, TransactionReceipt, TransactionRequest, TransactionResponse } from '@ethersproject/providers';
import { Contract, providers, Wallet } from 'ethers';
import { Address, BigNumber, Hash } from '../type';
export declare class Provider {
static inited: boolean;
static endpoint: string;
static provider: providers.JsonRpcProvider;
private readonly _endpoint;
provider: providers.JsonRpcProvider;
contract?: Contract;
static Init(endpoint: string): void;
static IsInited(): boolean;
static ChainId(): Promise<number>;
static Call(tx: TransactionRequest, blockTag?: BlockTag): Promise<string>;
static GetTransactionCount(addressOrName: string, blockTag?: BlockTag): Promise<number>;
static GetTransaction(txHash: Hash): Promise<TransactionResponse>;
static GetTransactionReceipt(txHash: Hash): Promise<TransactionReceipt>;
static GetTransactionFailedReason(tx: TransactionResponse): Promise<string>;
static EstimateGas(tx: TransactionRequest): Promise<BigNumber>;
static GetGasPrice(): Promise<BigNumber>;
static SendTransaction(owner: Wallet, tx: TransactionRequest): Promise<TransactionResponse>;
static SpeedUpTransaction(owner: Wallet, tx: TransactionResponse, gasPrice?: BigNumber, gasLimit?: BigNumber): Promise<TransactionResponse>;
static CancelTransaction(owner: Wallet, tx: TransactionResponse, gasPrice?: BigNumber, gasLimit?: BigNumber): Promise<TransactionResponse>;
constructor(endpoint: string);
get endpoint(): string;
get address(): Address;
chainId(): Promise<number>;
call(tx: TransactionRequest, blockTag?: BlockTag): Promise<string>;
getTransactionCount(addressOrName: string, blockTag?: BlockTag): Promise<number>;
getTransaction(txHash: Hash): Promise<TransactionResponse>;
getTransactionReceipt(txHash: Hash): Promise<TransactionReceipt>;
getTransactionFailedReason(tx: TransactionResponse): Promise<string>;
estimateGas(tx: TransactionRequest): Promise<BigNumber>;
getGasPrice(): Promise<BigNumber>;
sendTransaction(owner: Wallet, tx: TransactionRequest): Promise<TransactionResponse>;
speedUpTransaction(owner: Wallet, tx: TransactionResponse, gasPrice?: BigNumber, gasLimit?: BigNumber): Promise<TransactionResponse>;
cancelTransaction(owner: Wallet, tx: TransactionResponse, gasPrice?: BigNumber, gasLimit?: BigNumber): Promise<TransactionResponse>;
}