Skip to content

Commit 53ac4d3

Browse files
committed
add FetchBlockNumber
1 parent 2f9b41e commit 53ac4d3

File tree

14 files changed

+199
-106
lines changed

14 files changed

+199
-106
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,19 @@ let data = await fetchGasPrice()
9898
*/
9999
```
100100

101+
## FetchBlockNumber
102+
```js
103+
import {fetchBlockNumber} from '@kolirt/vue-web3-auth'
104+
105+
let data = await fetchBlockNumber()
106+
107+
/**
108+
* Result in data
109+
*
110+
* 29288229n
111+
*/
112+
```
113+
101114
## Multicall
102115
```ts
103116
import {multicallABI, multicall, chain} from '@kolirt/vue-web3-auth'

dist/vue-web3-auth.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ import type { BlockTag } from 'viem/src/types/block';
22
import type { Chain } from '@wagmi/core';
33
import * as Chains from '@wagmi/core/chains';
44
import type { ComputedRef } from 'vue';
5+
import type { FetchBalanceResult } from '@wagmi/core';
6+
import type { FetchFeeDataResult } from '@wagmi/core';
7+
import type { FetchTokenResult } from '@wagmi/core';
58
import type { Plugin as Plugin_2 } from 'vue';
69
import type { ThemeCtrlState } from '@web3modal/core';
710
import type { TransactionReceipt } from 'viem';
11+
import type { Unit } from '@wagmi/core';
812

913
export declare function $off(event: Events, callback: (...args: any) => void): void;
1014

@@ -80,6 +84,36 @@ export declare enum Events {
8084
ModalStateChanged = "modal_state_changed"
8185
}
8286

87+
declare type FetchBalance = {
88+
chainId?: number;
89+
address: `0x${string}`;
90+
formatUnits?: Unit;
91+
token?: `0x${string}`;
92+
};
93+
94+
export declare function fetchBalance(data: FetchBalance): Promise<FetchBalanceResult>;
95+
96+
declare type FetchBlockNumber = {
97+
chainId?: number;
98+
};
99+
100+
export declare function fetchBlockNumber(data?: FetchBlockNumber): Promise<bigint>;
101+
102+
declare type FetchFeeData = {
103+
chainId?: number;
104+
formatUnits?: Unit;
105+
};
106+
107+
export declare function fetchGasPrice(data?: FetchFeeData): Promise<FetchFeeDataResult>;
108+
109+
declare type FetchToken = {
110+
chainId?: number;
111+
address: `0x${string}`;
112+
formatUnits?: Unit;
113+
};
114+
115+
export declare function fetchToken(data: FetchToken): Promise<FetchTokenResult>;
116+
83117
export declare function getAvailableChains(): Chain[];
84118

85119
export declare function multicall(params: MulticallArgs): Promise<unknown[]>;

0 commit comments

Comments
 (0)