-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
35 lines (31 loc) · 1.59 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import Web3 from 'web3';
import { TransactionReceipt, TransactionConfig } from 'web3-core';
import { ContractSendMethod } from 'web3-eth-contract';
import BN from 'bn.js';
export type BalanceForCallResponse = {
estimatedGas: BN;
requiredBalance: BN;
callerBalance: BN,
isEnough: boolean,
gasPrice: BN
};
export type GasOptions = {
gasPrice?: number;
gasLimit?: number;
};
export interface RskTransactionHelper {
rskConfig: {hostUrl: string, chainId: number};
web3Client: Web3;
mine(amountOfBlocks?: number): Promise<void>;
getClient(): Web3;
getTxReceipt(): Promise<TransactionReceipt>;
getGasPrice(): Promise<BN>;
getBalance(address: string): Promise<BN>;
transferFundsCheckingBalance(senderAddress: string, senderPrivateKey: string, destinationAddress: string, value: number, gasOptions?: GasOptions): Promise<string>;
transferFunds(senderAddress: string, senderPrivateKey: string, destinationAddress: string, value: number, gasOptions?: GasOptions): Promise<string>;
signAndSendTransaction(senderAddress: string, senderPrivateKey: string, destinationAddress: string, abi: string, value: number, gasOptions?: GasOptions): Promise<string>;
signAndSendTransactionCheckingBalance(call: ContractSendMethod, senderAddress: string, senderPrivateKey: string, destinationAddress: string, estimatedGasPercentIncrement: number): Promise<string>;
checkBalanceForCall(call: ContractSendMethod, callerAddress: string): Promise<BalanceForCallResponse>;
getBlockNumber(): Promise<number>;
sendTransaction(txConfig: TransactionConfig): Promise<string>;
}