Skip to content

Commit 4a4ddd4

Browse files
committed
[web3] add support for passing optional block number to call functions
1 parent 2824b63 commit 4a4ddd4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

packages/target-web3-v1-test/types/types.d.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,25 @@ export interface PayableTx extends NonPayableTx {
4747

4848
export interface NonPayableTransactionObject<T> {
4949
arguments: any[];
50-
call(tx?: NonPayableTx): Promise<T>;
50+
call(tx?: NonPayableTx, block?: BlockType): Promise<T>;
5151
send(tx?: NonPayableTx): PromiEvent<TransactionReceipt>;
5252
estimateGas(tx?: NonPayableTx): Promise<number>;
5353
encodeABI(): string;
5454
}
5555

5656
export interface PayableTransactionObject<T> {
5757
arguments: any[];
58-
call(tx?: PayableTx): Promise<T>;
58+
call(tx?: PayableTx, block?: BlockType): Promise<T>;
5959
send(tx?: PayableTx): PromiEvent<TransactionReceipt>;
6060
estimateGas(tx?: PayableTx): Promise<number>;
6161
encodeABI(): string;
6262
}
6363

64-
export type BlockType = "latest" | "pending" | "genesis" | number;
64+
export type BlockType =
65+
| "latest"
66+
| "pending"
67+
| "genesis"
68+
| "earliest"
69+
| number
70+
| BN;
6571
export type BaseContract = Omit<Contract, "clone" | "once">;

packages/target-web3-v1/static/types.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@ export interface PayableTx extends NonPayableTx {
4141

4242
export interface NonPayableTransactionObject<T> {
4343
arguments: any[]
44-
call(tx?: NonPayableTx): Promise<T>
44+
call(tx?: NonPayableTx, block?: BlockType): Promise<T>
4545
send(tx?: NonPayableTx): PromiEvent<TransactionReceipt>
4646
estimateGas(tx?: NonPayableTx): Promise<number>
4747
encodeABI(): string
4848
}
4949

5050
export interface PayableTransactionObject<T> {
5151
arguments: any[]
52-
call(tx?: PayableTx): Promise<T>
52+
call(tx?: PayableTx, block?: BlockType): Promise<T>
5353
send(tx?: PayableTx): PromiEvent<TransactionReceipt>
5454
estimateGas(tx?: PayableTx): Promise<number>
5555
encodeABI(): string
5656
}
5757

58-
export type BlockType = 'latest' | 'pending' | 'genesis' | number
58+
export type BlockType = 'latest' | 'pending' | 'genesis' | 'earliest' | number | BN
5959
export type BaseContract = Omit<Contract, 'clone' | 'once'>

0 commit comments

Comments
 (0)