@mezo-org/passport 0.5.2-dev.2 → 0.5.2-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js +0 -2
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -1
- package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -1
- package/dist/src/hooks/useAssetsConversionRates.js +9 -36
- package/dist/src/hooks/useAssetsConversionRates.js.map +1 -1
- package/dist/src/hooks/useBorrowData.d.ts +0 -15
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -1
- package/dist/src/hooks/useBorrowData.js +3 -25
- package/dist/src/hooks/useBorrowData.js.map +1 -1
- package/dist/src/hooks/useCollateralPrice.d.ts +17 -0
- package/dist/src/hooks/useCollateralPrice.d.ts.map +1 -0
- package/dist/src/hooks/useCollateralPrice.js +56 -0
- package/dist/src/hooks/useCollateralPrice.js.map +1 -0
- package/dist/src/hooks/useTokensBalances.d.ts.map +1 -1
- package/dist/src/hooks/useTokensBalances.js +6 -10
- package/dist/src/hooks/useTokensBalances.js.map +1 -1
- package/dist/src/lib/contracts/index.d.ts +1 -1
- package/dist/src/lib/contracts/index.d.ts.map +1 -1
- package/dist/src/lib/contracts/index.js +0 -1
- package/dist/src/lib/contracts/index.js.map +1 -1
- package/dist/src/utils/numbers.test.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Dropdown/Root/AccountMusdListing.tsx +0 -2
- package/src/hooks/useAssetsConversionRates.ts +10 -43
- package/src/hooks/useBorrowData.ts +5 -27
- package/src/hooks/useCollateralPrice.ts +64 -0
- package/src/hooks/useTokensBalances.ts +6 -11
- package/src/lib/contracts/index.ts +0 -2
- package/src/utils/numbers.test.ts +0 -1
- package/dist/src/hooks/useTokensBalances copy.d.ts +0 -74
- package/dist/src/hooks/useTokensBalances copy.d.ts.map +0 -1
- package/dist/src/hooks/useTokensBalances copy.js +0 -206
- package/dist/src/hooks/useTokensBalances copy.js.map +0 -1
- package/dist/src/lib/contracts/priceOracle.d.ts +0 -43
- package/dist/src/lib/contracts/priceOracle.d.ts.map +0 -1
- package/dist/src/lib/contracts/priceOracle.js +0 -52
- package/dist/src/lib/contracts/priceOracle.js.map +0 -1
- package/dist/src/utils/chain.d.ts +0 -2
- package/dist/src/utils/chain.d.ts.map +0 -1
- package/dist/src/utils/chain.js +0 -5
- package/dist/src/utils/chain.js.map +0 -1
- package/dist/src/utils/number2.d.ts +0 -106
- package/dist/src/utils/number2.d.ts.map +0 -1
- package/dist/src/utils/number2.js +0 -289
- package/dist/src/utils/number2.js.map +0 -1
- package/dist/src/utils/number2.test.d.ts +0 -2
- package/dist/src/utils/number2.test.d.ts.map +0 -1
- package/dist/src/utils/number2.test.js +0 -223
- package/dist/src/utils/number2.test.js.map +0 -1
- package/src/hooks/useTokensBalances copy.ts +0 -289
- package/src/lib/contracts/priceOracle.ts +0 -53
- package/src/utils/chain.ts +0 -5
- package/src/utils/number2.test.ts +0 -309
- package/src/utils/number2.ts +0 -419
|
@@ -13,6 +13,7 @@ import { bigIntMax, normalizePrecision } from "../utils/numbers"
|
|
|
13
13
|
import useWalletAccount from "./useWalletAccount"
|
|
14
14
|
import { getAsset } from "../utils/assets"
|
|
15
15
|
import { convertToUsd } from "../utils/currency"
|
|
16
|
+
import { useCollateralPrice } from "./useCollateralPrice"
|
|
16
17
|
|
|
17
18
|
const DEBT_AND_COLL_PRECISION = 18
|
|
18
19
|
|
|
@@ -85,22 +86,6 @@ const BORROWER_OPERATIONS_ABI = [
|
|
|
85
86
|
},
|
|
86
87
|
] as const
|
|
87
88
|
|
|
88
|
-
const PRICE_FEED_ABI = [
|
|
89
|
-
{
|
|
90
|
-
inputs: [],
|
|
91
|
-
name: "fetchPrice",
|
|
92
|
-
outputs: [
|
|
93
|
-
{
|
|
94
|
-
internalType: "uint256",
|
|
95
|
-
name: "",
|
|
96
|
-
type: "uint256",
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
stateMutability: "view",
|
|
100
|
-
type: "function",
|
|
101
|
-
},
|
|
102
|
-
] as const
|
|
103
|
-
|
|
104
89
|
/**
|
|
105
90
|
* Query hook for getting borrow data. Returns collateral and trove debt for the
|
|
106
91
|
* connected account, based on it's evm address.
|
|
@@ -110,18 +95,18 @@ export function useBorrowData(queryOptions = {}) {
|
|
|
110
95
|
const { environment = "mainnet" } = usePassportContext()
|
|
111
96
|
const walletAccount = useWalletAccount()
|
|
112
97
|
|
|
98
|
+
const { data: collateralPrice } = useCollateralPrice()
|
|
99
|
+
|
|
113
100
|
const contractAddress = useMemo(() => {
|
|
114
101
|
if (environment === "mainnet") {
|
|
115
102
|
return {
|
|
116
103
|
troveManager: mainnetBorrowContracts.TroveManager.address,
|
|
117
104
|
borrowerOperations: mainnetBorrowContracts.BorrowerOperations.address,
|
|
118
|
-
priceFeed: mainnetBorrowContracts.PriceFeed.address,
|
|
119
105
|
}
|
|
120
106
|
}
|
|
121
107
|
return {
|
|
122
108
|
troveManager: testnetBorrowContracts.TroveManager.address,
|
|
123
109
|
borrowerOperations: testnetBorrowContracts.BorrowerOperations.address,
|
|
124
|
-
priceFeed: testnetBorrowContracts.PriceFeed.address,
|
|
125
110
|
}
|
|
126
111
|
}, [environment])
|
|
127
112
|
|
|
@@ -144,15 +129,9 @@ export function useBorrowData(queryOptions = {}) {
|
|
|
144
129
|
functionName: "MUSD_GAS_COMPENSATION",
|
|
145
130
|
chainId,
|
|
146
131
|
},
|
|
147
|
-
{
|
|
148
|
-
abi: PRICE_FEED_ABI,
|
|
149
|
-
address: contractAddress.priceFeed,
|
|
150
|
-
functionName: "fetchPrice",
|
|
151
|
-
chainId,
|
|
152
|
-
},
|
|
153
132
|
],
|
|
154
133
|
query: {
|
|
155
|
-
enabled: !!walletAccount.accountAddress,
|
|
134
|
+
enabled: !!walletAccount.accountAddress && !!collateralPrice?.toString,
|
|
156
135
|
staleTime: 5 * ONE_MINUTE_MS,
|
|
157
136
|
retry: 1,
|
|
158
137
|
select: (data) => {
|
|
@@ -161,7 +140,6 @@ export function useBorrowData(queryOptions = {}) {
|
|
|
161
140
|
|
|
162
141
|
const [rawCollateral, principal, interest] = data[0].result!
|
|
163
142
|
const gasCompensation = data[1].result!
|
|
164
|
-
const collateralPrice = data[2].result!
|
|
165
143
|
|
|
166
144
|
const btcDetails = getAsset("BTC")
|
|
167
145
|
|
|
@@ -173,7 +151,7 @@ export function useBorrowData(queryOptions = {}) {
|
|
|
173
151
|
usd: convertToUsd(
|
|
174
152
|
rawCollateral,
|
|
175
153
|
DEBT_AND_COLL_PRECISION,
|
|
176
|
-
collateralPrice
|
|
154
|
+
collateralPrice!,
|
|
177
155
|
DEBT_AND_COLL_PRECISION,
|
|
178
156
|
),
|
|
179
157
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useReadContract } from "wagmi"
|
|
2
|
+
import { useMemo } from "react"
|
|
3
|
+
import { ONE_MINUTE_MS } from "../utils/time"
|
|
4
|
+
import {
|
|
5
|
+
mainnetBorrowContracts,
|
|
6
|
+
testnetBorrowContracts,
|
|
7
|
+
} from "../lib/contracts"
|
|
8
|
+
import { usePassportContext } from "./usePassportContext"
|
|
9
|
+
import { CHAIN_ID } from "../constants"
|
|
10
|
+
import useWalletAccount from "./useWalletAccount"
|
|
11
|
+
|
|
12
|
+
// Wagmi handles typesafety with ABI const assertions. TypeScript doesn't
|
|
13
|
+
// support importing JSON as const yet so types cannot be inferred from the
|
|
14
|
+
// imported contract. As a workaround there is minimal ABI definition that can
|
|
15
|
+
// be asserted types from.
|
|
16
|
+
// Ref: https://wagmi.sh/core/typescript#const-assert-abis-typed-data
|
|
17
|
+
|
|
18
|
+
const PRICE_FEED_ABI = [
|
|
19
|
+
{
|
|
20
|
+
inputs: [],
|
|
21
|
+
name: "fetchPrice",
|
|
22
|
+
outputs: [
|
|
23
|
+
{
|
|
24
|
+
internalType: "uint256",
|
|
25
|
+
name: "",
|
|
26
|
+
type: "uint256",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
stateMutability: "view",
|
|
30
|
+
type: "function",
|
|
31
|
+
},
|
|
32
|
+
] as const
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Query hook for getting borrow data. Returns collateral and trove debt for the
|
|
36
|
+
* connected account, based on it's evm address.
|
|
37
|
+
* @param queryOptions Query options passed to the underlying `useQuery` hook.
|
|
38
|
+
*/
|
|
39
|
+
export function useCollateralPrice(queryOptions = {}) {
|
|
40
|
+
const { environment = "mainnet" } = usePassportContext()
|
|
41
|
+
const walletAccount = useWalletAccount()
|
|
42
|
+
|
|
43
|
+
const priceFeedContractAddress = useMemo(() => {
|
|
44
|
+
if (environment === "mainnet") {
|
|
45
|
+
return mainnetBorrowContracts.PriceFeed.address
|
|
46
|
+
}
|
|
47
|
+
return testnetBorrowContracts.PriceFeed.address
|
|
48
|
+
}, [environment])
|
|
49
|
+
|
|
50
|
+
const chainId = CHAIN_ID[environment]
|
|
51
|
+
|
|
52
|
+
return useReadContract({
|
|
53
|
+
abi: PRICE_FEED_ABI,
|
|
54
|
+
address: priceFeedContractAddress,
|
|
55
|
+
functionName: "fetchPrice",
|
|
56
|
+
chainId,
|
|
57
|
+
query: {
|
|
58
|
+
enabled: !!walletAccount.accountAddress,
|
|
59
|
+
staleTime: 5 * ONE_MINUTE_MS,
|
|
60
|
+
retry: 1,
|
|
61
|
+
...queryOptions,
|
|
62
|
+
},
|
|
63
|
+
})
|
|
64
|
+
}
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
isTTokenCryptoAsset,
|
|
19
19
|
} from "../utils/assets"
|
|
20
20
|
import { convertToUsd } from "../utils/currency"
|
|
21
|
-
import { CHAIN_ID } from "../constants"
|
|
21
|
+
import { CHAIN_ID, mezoMainnet, mezoTestnet } from "../constants"
|
|
22
22
|
import { useAssetsConversionRates } from "./useAssetsConversionRates"
|
|
23
23
|
import { normalizePrecision } from "../utils/numbers"
|
|
24
|
-
import {
|
|
24
|
+
import { usePassportContext } from "./usePassportContext"
|
|
25
25
|
|
|
26
26
|
// Wagmi handles typesafety with ABI const assertions. TypeScript doesn't
|
|
27
27
|
// support importing JSON as const yet so types cannot be inferred from the
|
|
@@ -114,24 +114,19 @@ export function useTokensBalances<T extends MezoChainToken[]>(
|
|
|
114
114
|
|
|
115
115
|
const { data: conversionRatesData } = useAssetsConversionRates()
|
|
116
116
|
|
|
117
|
-
const
|
|
117
|
+
const { environment = "mainnet" } = usePassportContext()
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
console.log("conversionRatesData: ", conversionRatesData)
|
|
121
|
-
console.log("isMezoChainId: ", isMezoChainId)
|
|
122
|
-
console.log("chainId: ", config.state.chainId)
|
|
119
|
+
const chainId = environment === "testnet" ? mezoTestnet.id : mezoMainnet.id
|
|
123
120
|
|
|
124
121
|
return useQuery({
|
|
125
122
|
queryKey: [
|
|
126
123
|
TOKEN_BALANCES_QUERY_KEY,
|
|
127
124
|
walletAccount?.accountAddress,
|
|
128
125
|
options.tokens,
|
|
129
|
-
|
|
126
|
+
chainId,
|
|
130
127
|
],
|
|
131
|
-
enabled:
|
|
132
|
-
!!walletAccount?.accountAddress && !!conversionRatesData && isMezoChainId,
|
|
128
|
+
enabled: !!walletAccount?.accountAddress && !!conversionRatesData,
|
|
133
129
|
queryFn: async () => {
|
|
134
|
-
const { chainId } = config.state
|
|
135
130
|
const isMainnet = chainId === CHAIN_ID.mainnet
|
|
136
131
|
const contractsMap = isMainnet
|
|
137
132
|
? mainnetTokenContracts
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
-
import { MezoChainToken } from "../lib/contracts";
|
|
3
|
-
export declare const BALANCE_OF_ABI: readonly [{
|
|
4
|
-
readonly inputs: readonly [{
|
|
5
|
-
readonly internalType: "address";
|
|
6
|
-
readonly name: "account";
|
|
7
|
-
readonly type: "address";
|
|
8
|
-
}];
|
|
9
|
-
readonly name: "balanceOf";
|
|
10
|
-
readonly outputs: readonly [{
|
|
11
|
-
readonly internalType: "uint256";
|
|
12
|
-
readonly name: "";
|
|
13
|
-
readonly type: "uint256";
|
|
14
|
-
}];
|
|
15
|
-
readonly stateMutability: "view";
|
|
16
|
-
readonly type: "function";
|
|
17
|
-
}];
|
|
18
|
-
type UseMezoChainTokensBalancesOptions<T extends MezoChainToken[]> = {
|
|
19
|
-
tokens?: T;
|
|
20
|
-
queryOptions?: Omit<UseQueryOptions<Record<T[number], TokenBalance>>, "queryKey" | "queryFn" | "select" | "enabled">;
|
|
21
|
-
};
|
|
22
|
-
export type TokenBalance = {
|
|
23
|
-
decimals: number;
|
|
24
|
-
symbol: string;
|
|
25
|
-
value: bigint;
|
|
26
|
-
usd: {
|
|
27
|
-
value: number;
|
|
28
|
-
formatted: string;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Hook to get the balance of a list of Mezo tokens for the current account
|
|
33
|
-
* @param options.tokens The list of tokens to get the balance for. It will
|
|
34
|
-
* fallback to all tokens if not provided.
|
|
35
|
-
* @param options.queryOptions The query options to pass to the
|
|
36
|
-
* `useReadContracts`
|
|
37
|
-
* @returns Tanstack's `useQuery` returnings with balance of tokens for the
|
|
38
|
-
* current account in form of typesafe object with token names as keys
|
|
39
|
-
* and balances as values.
|
|
40
|
-
* @example
|
|
41
|
-
* const mezoTokensBalance = useTokensBalances({
|
|
42
|
-
* tokens: ["mT", "mxSolvBTC"],
|
|
43
|
-
* })
|
|
44
|
-
* // Assuming the status is "success"
|
|
45
|
-
* console.log(mezoTokensBalance.data.mT) // Eg. { value: 0n ... }
|
|
46
|
-
* console.log(Object.keys(mezoTokensBalance.data)) // ["mT", "mxSolvBTC"]
|
|
47
|
-
*/
|
|
48
|
-
export declare function useTokensBalances<T extends MezoChainToken[]>(options?: UseMezoChainTokensBalancesOptions<T>): import("@tanstack/react-query").UseQueryResult<Record<"BTC" | T[number], TokenBalance>, Error>;
|
|
49
|
-
/**
|
|
50
|
-
* Hook for invalidating current user's token balances. Can be used to
|
|
51
|
-
* invalidate the balances manually, which forces the data to be re-fetched.
|
|
52
|
-
* @returns Function `invalidateTokenBalances` that invalidates token balances
|
|
53
|
-
* @example
|
|
54
|
-
* const { invalidateTokenBalances } = useInvalidateTokensBalances()
|
|
55
|
-
* (...)
|
|
56
|
-
* await invalidateTokenBalances()
|
|
57
|
-
*/
|
|
58
|
-
export declare function useInvalidateTokensBalances(): {
|
|
59
|
-
invalidateTokensBalances: () => Promise<void>;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Hook for resetting current user's token balances. Can be used to reset the
|
|
63
|
-
* balances manually, which forces the data to be re-fetched.
|
|
64
|
-
* @returns Function `resetTokenBalances` that invalidates token balances
|
|
65
|
-
* @example
|
|
66
|
-
* const { resetTokenBalances } = useResetTokensBalances()
|
|
67
|
-
* (...)
|
|
68
|
-
* await resetTokenBalances()
|
|
69
|
-
*/
|
|
70
|
-
export declare function useResetTokensBalances(): {
|
|
71
|
-
resetTokenBalances: () => Promise<void>;
|
|
72
|
-
};
|
|
73
|
-
export {};
|
|
74
|
-
//# sourceMappingURL=useTokensBalances%20copy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTokensBalances copy.d.ts","sourceRoot":"","sources":["../../../src/hooks/useTokensBalances copy.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAEL,cAAc,EAEf,MAAM,kBAAkB,CAAA;AAwBzB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;EAoBH,CAAA;AAgBxB,KAAK,iCAAiC,CAAC,CAAC,SAAS,cAAc,EAAE,IAAI;IACnE,MAAM,CAAC,EAAE,CAAC,CAAA;IACV,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,CAAC,EAChD,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAC9C,CAAA;CACF,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE;QACH,KAAK,EAAE,MAAM,CAAA;QACb,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;CACF,CAAA;AAID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,EAC1D,OAAO,GAAE,iCAAiC,CAAC,CAAC,CAAM,kGA0InD;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B;;EAS1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB;;EASrC"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { useConfig } from "wagmi";
|
|
2
|
-
import { useQuery, useQueryClient, } from "@tanstack/react-query";
|
|
3
|
-
import { getBalance, readContracts } from "wagmi/actions";
|
|
4
|
-
import { mainnetTokenContracts, testnetTokenContracts, } from "../lib/contracts";
|
|
5
|
-
import useWalletAccount from "./useWalletAccount";
|
|
6
|
-
import { getAsset, isBitcoinLikeCryptoAsset, isTTokenCryptoAsset, } from "../utils/assets";
|
|
7
|
-
import { convertToUsd } from "../utils/currency";
|
|
8
|
-
import { CHAIN_ID } from "../constants";
|
|
9
|
-
import { useAssetsConversionRates } from "./useAssetsConversionRates";
|
|
10
|
-
import { isMezoChain } from "../utils/chain";
|
|
11
|
-
import { amountAsUSD, bigIntToFloat, floatToHumanReadableFormat, } from "../utils/number2";
|
|
12
|
-
import { useBorrowData } from "./useBorrowData";
|
|
13
|
-
// Wagmi handles typesafety with ABI const assertions. TypeScript doesn't
|
|
14
|
-
// support importing JSON as const yet so types cannot be inferred from the
|
|
15
|
-
// imported contract. As a workaround there is minimal ABI definition that can
|
|
16
|
-
// be asserted types from.
|
|
17
|
-
// Ref: https://wagmi.sh/core/typescript#const-assert-abis-typed-data
|
|
18
|
-
export const BALANCE_OF_ABI = [
|
|
19
|
-
{
|
|
20
|
-
inputs: [
|
|
21
|
-
{
|
|
22
|
-
internalType: "address",
|
|
23
|
-
name: "account",
|
|
24
|
-
type: "address",
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
name: "balanceOf",
|
|
28
|
-
outputs: [
|
|
29
|
-
{
|
|
30
|
-
internalType: "uint256",
|
|
31
|
-
name: "",
|
|
32
|
-
type: "uint256",
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
stateMutability: "view",
|
|
36
|
-
type: "function",
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
const BALANCE_TOKENS = [
|
|
40
|
-
"mcbBTC",
|
|
41
|
-
"mDAI",
|
|
42
|
-
"mFBTC",
|
|
43
|
-
"mSolvBTC",
|
|
44
|
-
"mswBTC",
|
|
45
|
-
"mT",
|
|
46
|
-
"mUSDC",
|
|
47
|
-
"mUSDe",
|
|
48
|
-
"mUSDT",
|
|
49
|
-
"mxSolvBTC",
|
|
50
|
-
"MUSD",
|
|
51
|
-
];
|
|
52
|
-
const TOKEN_BALANCES_QUERY_KEY = "passport.tokenBalances";
|
|
53
|
-
/**
|
|
54
|
-
* Hook to get the balance of a list of Mezo tokens for the current account
|
|
55
|
-
* @param options.tokens The list of tokens to get the balance for. It will
|
|
56
|
-
* fallback to all tokens if not provided.
|
|
57
|
-
* @param options.queryOptions The query options to pass to the
|
|
58
|
-
* `useReadContracts`
|
|
59
|
-
* @returns Tanstack's `useQuery` returnings with balance of tokens for the
|
|
60
|
-
* current account in form of typesafe object with token names as keys
|
|
61
|
-
* and balances as values.
|
|
62
|
-
* @example
|
|
63
|
-
* const mezoTokensBalance = useTokensBalances({
|
|
64
|
-
* tokens: ["mT", "mxSolvBTC"],
|
|
65
|
-
* })
|
|
66
|
-
* // Assuming the status is "success"
|
|
67
|
-
* console.log(mezoTokensBalance.data.mT) // Eg. { value: 0n ... }
|
|
68
|
-
* console.log(Object.keys(mezoTokensBalance.data)) // ["mT", "mxSolvBTC"]
|
|
69
|
-
*/
|
|
70
|
-
export function useTokensBalances(options = {}) {
|
|
71
|
-
const { tokens = BALANCE_TOKENS, ...restQueryOptions } = options;
|
|
72
|
-
const walletAccount = useWalletAccount();
|
|
73
|
-
const config = useConfig();
|
|
74
|
-
const { data: conversionRatesData } = useAssetsConversionRates();
|
|
75
|
-
const isMezoChainId = isMezoChain(config.state.chainId);
|
|
76
|
-
const { data: borrowData } = useBorrowData();
|
|
77
|
-
return useQuery({
|
|
78
|
-
queryKey: [
|
|
79
|
-
TOKEN_BALANCES_QUERY_KEY,
|
|
80
|
-
walletAccount?.accountAddress,
|
|
81
|
-
options.tokens,
|
|
82
|
-
config.state.chainId,
|
|
83
|
-
borrowData?.collateral.value.toString(),
|
|
84
|
-
],
|
|
85
|
-
enabled: !!walletAccount?.accountAddress &&
|
|
86
|
-
!!conversionRatesData &&
|
|
87
|
-
isMezoChainId &&
|
|
88
|
-
!!borrowData?.collateral.value,
|
|
89
|
-
queryFn: async () => {
|
|
90
|
-
const { chainId } = config.state;
|
|
91
|
-
const isMainnet = chainId === CHAIN_ID.mainnet;
|
|
92
|
-
const contractsMap = isMainnet
|
|
93
|
-
? mainnetTokenContracts
|
|
94
|
-
: testnetTokenContracts;
|
|
95
|
-
const accountAddress = walletAccount?.accountAddress;
|
|
96
|
-
if (!accountAddress) {
|
|
97
|
-
throw new Error("Account address is not available.");
|
|
98
|
-
}
|
|
99
|
-
const tokenContracts = tokens.map((token) => {
|
|
100
|
-
const { address } = contractsMap[token];
|
|
101
|
-
return {
|
|
102
|
-
address,
|
|
103
|
-
abi: BALANCE_OF_ABI,
|
|
104
|
-
functionName: "balanceOf",
|
|
105
|
-
args: [accountAddress],
|
|
106
|
-
chainId,
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
return Promise.all([
|
|
110
|
-
getBalance(config, { address: accountAddress }),
|
|
111
|
-
readContracts(config, {
|
|
112
|
-
contracts: tokenContracts,
|
|
113
|
-
}),
|
|
114
|
-
]);
|
|
115
|
-
},
|
|
116
|
-
select: (data) => {
|
|
117
|
-
const [btcBalance, tokensBalancesData] = data;
|
|
118
|
-
if (!conversionRatesData) {
|
|
119
|
-
throw new Error("Conversion rates data is not available.");
|
|
120
|
-
}
|
|
121
|
-
const parsedBtcBalance = {
|
|
122
|
-
...btcBalance,
|
|
123
|
-
symbol: getAsset("BTC").symbol,
|
|
124
|
-
usd: convertToUsd(btcBalance.value, btcBalance.decimals, BigInt(conversionRatesData.rates.BTC), conversionRatesData.decimals),
|
|
125
|
-
};
|
|
126
|
-
const parsedTokensBalances = tokensBalancesData.map((item, index) => {
|
|
127
|
-
const token = tokens[index];
|
|
128
|
-
const { decimals, symbol } = getAsset(token);
|
|
129
|
-
if (item.status === "failure") {
|
|
130
|
-
throw new Error(`Failed to fetch balance of ${token} for ${walletAccount?.accountAddress}.`);
|
|
131
|
-
}
|
|
132
|
-
const floatAmount = bigIntToFloat({
|
|
133
|
-
amount: item.result,
|
|
134
|
-
decimals,
|
|
135
|
-
});
|
|
136
|
-
// const formatted =
|
|
137
|
-
// Number(floatAmount) * getTokenUsdPrice(token as SupportedTokenName)
|
|
138
|
-
const tokenBalance = {
|
|
139
|
-
value: item.result,
|
|
140
|
-
decimals,
|
|
141
|
-
symbol,
|
|
142
|
-
};
|
|
143
|
-
let value = Number(item.result);
|
|
144
|
-
let usd = {
|
|
145
|
-
value,
|
|
146
|
-
formatted: floatToHumanReadableFormat(amountAsUSD({ amount: value })),
|
|
147
|
-
};
|
|
148
|
-
if (isBitcoinLikeCryptoAsset(tokenBalance.symbol)) {
|
|
149
|
-
// TODO: had to add number for rates to avoid red underline
|
|
150
|
-
value = Number(floatAmount) * Number(conversionRatesData.rates.BTC);
|
|
151
|
-
usd = {
|
|
152
|
-
value,
|
|
153
|
-
formatted: floatToHumanReadableFormat(amountAsUSD({ amount: value })),
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
if (isTTokenCryptoAsset(tokenBalance.symbol)) {
|
|
157
|
-
// TODO: had to add number for rates to avoid red underline
|
|
158
|
-
value = Number(floatAmount) * Number(conversionRatesData.rates.mT);
|
|
159
|
-
usd = {
|
|
160
|
-
value,
|
|
161
|
-
formatted: floatToHumanReadableFormat(amountAsUSD({ amount: value })),
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
return { ...tokenBalance, usd };
|
|
165
|
-
});
|
|
166
|
-
return [parsedBtcBalance, ...parsedTokensBalances].reduce((acc, token) => ({
|
|
167
|
-
...acc,
|
|
168
|
-
[token.symbol]: token,
|
|
169
|
-
}), {});
|
|
170
|
-
},
|
|
171
|
-
...restQueryOptions,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Hook for invalidating current user's token balances. Can be used to
|
|
176
|
-
* invalidate the balances manually, which forces the data to be re-fetched.
|
|
177
|
-
* @returns Function `invalidateTokenBalances` that invalidates token balances
|
|
178
|
-
* @example
|
|
179
|
-
* const { invalidateTokenBalances } = useInvalidateTokensBalances()
|
|
180
|
-
* (...)
|
|
181
|
-
* await invalidateTokenBalances()
|
|
182
|
-
*/
|
|
183
|
-
export function useInvalidateTokensBalances() {
|
|
184
|
-
const queryClient = useQueryClient();
|
|
185
|
-
const invalidateTokensBalancesHandler = () => queryClient.invalidateQueries({ queryKey: [TOKEN_BALANCES_QUERY_KEY] });
|
|
186
|
-
return {
|
|
187
|
-
invalidateTokensBalances: invalidateTokensBalancesHandler,
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Hook for resetting current user's token balances. Can be used to reset the
|
|
192
|
-
* balances manually, which forces the data to be re-fetched.
|
|
193
|
-
* @returns Function `resetTokenBalances` that invalidates token balances
|
|
194
|
-
* @example
|
|
195
|
-
* const { resetTokenBalances } = useResetTokensBalances()
|
|
196
|
-
* (...)
|
|
197
|
-
* await resetTokenBalances()
|
|
198
|
-
*/
|
|
199
|
-
export function useResetTokensBalances() {
|
|
200
|
-
const queryClient = useQueryClient();
|
|
201
|
-
const resetTokenBalancesHandler = () => queryClient.resetQueries({ queryKey: [TOKEN_BALANCES_QUERY_KEY] });
|
|
202
|
-
return {
|
|
203
|
-
resetTokenBalances: resetTokenBalancesHandler,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
//# sourceMappingURL=useTokensBalances%20copy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTokensBalances copy.js","sourceRoot":"","sources":["../../../src/hooks/useTokensBalances copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,EACL,QAAQ,EACR,cAAc,GAEf,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACzD,OAAO,EACL,qBAAqB,EAErB,qBAAqB,GACtB,MAAM,kBAAkB,CAAA;AACzB,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EACL,WAAW,EACX,aAAa,EACb,0BAA0B,GAC3B,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,yEAAyE;AACzE,2EAA2E;AAC3E,8EAA8E;AAC9E,0BAA0B;AAC1B,qEAAqE;AAErE,MA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AAG,cAAc,EAAE,CAAA;IAEpC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CACrC,WAAW,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAA;IAEpE,OAAO;QACL,kBAAkB,EAAE,yBAAyB;KAC9C,CAAA;AACH,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Address } from "viem";
|
|
2
|
-
declare const _default: {
|
|
3
|
-
address: Address;
|
|
4
|
-
abi: readonly [{
|
|
5
|
-
readonly inputs: readonly [];
|
|
6
|
-
readonly name: "decimals";
|
|
7
|
-
readonly outputs: readonly [{
|
|
8
|
-
readonly internalType: "uint8";
|
|
9
|
-
readonly name: "";
|
|
10
|
-
readonly type: "uint8";
|
|
11
|
-
}];
|
|
12
|
-
readonly stateMutability: "view";
|
|
13
|
-
readonly type: "function";
|
|
14
|
-
}, {
|
|
15
|
-
readonly inputs: readonly [];
|
|
16
|
-
readonly name: "latestRoundData";
|
|
17
|
-
readonly outputs: readonly [{
|
|
18
|
-
readonly internalType: "uint80";
|
|
19
|
-
readonly name: "roundId";
|
|
20
|
-
readonly type: "uint80";
|
|
21
|
-
}, {
|
|
22
|
-
readonly internalType: "int256";
|
|
23
|
-
readonly name: "answer";
|
|
24
|
-
readonly type: "int256";
|
|
25
|
-
}, {
|
|
26
|
-
readonly internalType: "uint256";
|
|
27
|
-
readonly name: "startedAt";
|
|
28
|
-
readonly type: "uint256";
|
|
29
|
-
}, {
|
|
30
|
-
readonly internalType: "uint256";
|
|
31
|
-
readonly name: "updatedAt";
|
|
32
|
-
readonly type: "uint256";
|
|
33
|
-
}, {
|
|
34
|
-
readonly internalType: "uint80";
|
|
35
|
-
readonly name: "answeredInRound";
|
|
36
|
-
readonly type: "uint80";
|
|
37
|
-
}];
|
|
38
|
-
readonly stateMutability: "view";
|
|
39
|
-
readonly type: "function";
|
|
40
|
-
}];
|
|
41
|
-
};
|
|
42
|
-
export default _default;
|
|
43
|
-
//# sourceMappingURL=priceOracle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"priceOracle.d.ts","sourceRoot":"","sources":["../../../../src/lib/contracts/priceOracle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;;aAG6B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADlE,wBAkDC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
address: "0x7b7c000000000000000000000000000000000015",
|
|
3
|
-
abi: [
|
|
4
|
-
{
|
|
5
|
-
inputs: [],
|
|
6
|
-
name: "decimals",
|
|
7
|
-
outputs: [
|
|
8
|
-
{
|
|
9
|
-
internalType: "uint8",
|
|
10
|
-
name: "",
|
|
11
|
-
type: "uint8",
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
stateMutability: "view",
|
|
15
|
-
type: "function",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
inputs: [],
|
|
19
|
-
name: "latestRoundData",
|
|
20
|
-
outputs: [
|
|
21
|
-
{
|
|
22
|
-
internalType: "uint80",
|
|
23
|
-
name: "roundId",
|
|
24
|
-
type: "uint80",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
internalType: "int256",
|
|
28
|
-
name: "answer",
|
|
29
|
-
type: "int256",
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
internalType: "uint256",
|
|
33
|
-
name: "startedAt",
|
|
34
|
-
type: "uint256",
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
internalType: "uint256",
|
|
38
|
-
name: "updatedAt",
|
|
39
|
-
type: "uint256",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
internalType: "uint80",
|
|
43
|
-
name: "answeredInRound",
|
|
44
|
-
type: "uint80",
|
|
45
|
-
},
|
|
46
|
-
],
|
|
47
|
-
stateMutability: "view",
|
|
48
|
-
type: "function",
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
//# sourceMappingURL=priceOracle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"priceOracle.js","sourceRoot":"","sources":["../../../../src/lib/contracts/priceOracle.ts"],"names":[],"mappings":"AAEA,eAAe;IACb,OAAO,EAAE,4CAAuD;IAChE,GAAG,EAAE;QACH;YACE,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,OAAO;oBACrB,IAAI,EAAE,EAAE;oBACR,IAAI,EAAE,OAAO;iBACd;aACF;YACD,eAAe,EAAE,MAAM;YACvB,IAAI,EAAE,UAAU;SACjB;QACD;YACE,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE;gBACP;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,SAAS;oBACvB,IAAI,EAAE,WAAW;oBACjB,IAAI,EAAE,SAAS;iBAChB;gBACD;oBACE,YAAY,EAAE,QAAQ;oBACtB,IAAI,EAAE,iBAAiB;oBACvB,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,eAAe,EAAE,MAAM;YACvB,IAAI,EAAE,UAAU;SACjB;KACO;CACX,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/utils/chain.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,WAE1C"}
|
package/dist/src/utils/chain.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../src/utils/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAE9D,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,OAAO,KAAK,WAAW,CAAC,EAAE,IAAI,OAAO,KAAK,WAAW,CAAC,EAAE,CAAA;AACjE,CAAC"}
|