-
Notifications
You must be signed in to change notification settings - Fork 14
/
Balances.ts
53 lines (50 loc) · 1.49 KB
/
Balances.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import type { Balance } from "../models/Balance";
import type { TokenBalanceReponseDTO } from "../models/TokenBalanceReponseDTO";
import type { CancelablePromise } from "../core/CancelablePromise";
import { OpenAPI } from "../core/OpenAPI";
import { request as __request } from "../core/request";
import { ChainId } from "../models/ChainId";
export class Balances {
/**
* @returns Balance Returns the balance of all tokens for a user address on all supported chains
* @throws ApiError
*/
public static getBalances({ userAddress }: { userAddress: string }): CancelablePromise<Balance> {
return __request(OpenAPI, {
method: "GET",
url: "/v2/balances",
headers: {
"API-KEY": OpenAPI.API_KEY,
},
query: {
userAddress: userAddress,
},
});
}
/**
* @returns TokenBalanceReponseDTO Returns the balance of the token on any given chain
* @throws ApiError
*/
public static getBalance({
tokenAddress,
chainId,
userAddress,
}: {
/** Token contract address on network, e.g USDC on Ethereum Mainnet **/
tokenAddress: string;
/** ID of chain, e.g Ethereum Mainnet = 1 **/
chainId: ChainId;
/** Address of the user **/
userAddress: string;
}): CancelablePromise<TokenBalanceReponseDTO> {
return __request(OpenAPI, {
method: "GET",
url: "/v2/balances/token-balance",
query: {
tokenAddress: tokenAddress,
chainId: chainId,
userAddress: userAddress,
},
});
}
}