@orderly.network/hooks 1.0.27 → 1.0.28-alpha.1
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/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.d.mts
CHANGED
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
declare const _default: "1.0.
|
|
26
|
+
declare const _default: "1.0.28-alpha.1";
|
|
27
27
|
|
|
28
28
|
declare type useQueryOptions<T> = SWRConfiguration & {
|
|
29
29
|
formatter?: (data: any) => T;
|
|
@@ -360,7 +360,8 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
360
360
|
balanceRevalidating: boolean;
|
|
361
361
|
allowanceRevalidating: boolean;
|
|
362
362
|
approve: (amount: string | undefined) => Promise<any>;
|
|
363
|
-
deposit: (amount: string) => Promise<any>;
|
|
363
|
+
deposit: (amount: string, fee?: bigint | undefined) => Promise<any>;
|
|
364
|
+
getDepositFee: (amount: string, chain: any) => Promise<any>;
|
|
364
365
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
365
366
|
fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
|
|
366
367
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare global {
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
declare const _default: "1.0.
|
|
26
|
+
declare const _default: "1.0.28-alpha.1";
|
|
27
27
|
|
|
28
28
|
declare type useQueryOptions<T> = SWRConfiguration & {
|
|
29
29
|
formatter?: (data: any) => T;
|
|
@@ -360,7 +360,8 @@ declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
|
360
360
|
balanceRevalidating: boolean;
|
|
361
361
|
allowanceRevalidating: boolean;
|
|
362
362
|
approve: (amount: string | undefined) => Promise<any>;
|
|
363
|
-
deposit: (amount: string) => Promise<any>;
|
|
363
|
+
deposit: (amount: string, fee?: bigint | undefined) => Promise<any>;
|
|
364
|
+
getDepositFee: (amount: string, chain: any) => Promise<any>;
|
|
364
365
|
fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
|
|
365
366
|
fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
|
|
366
367
|
};
|
package/dist/index.js
CHANGED
|
@@ -28,9 +28,9 @@ var useSWRSubscription__default = /*#__PURE__*/_interopDefault(useSWRSubscriptio
|
|
|
28
28
|
// src/version.ts
|
|
29
29
|
if (typeof window !== "undefined") {
|
|
30
30
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
31
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.
|
|
31
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.28-alpha.1";
|
|
32
32
|
}
|
|
33
|
-
var version_default = "1.0.
|
|
33
|
+
var version_default = "1.0.28-alpha.1";
|
|
34
34
|
var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
|
|
35
35
|
var OrderlyContext = React.createContext({
|
|
36
36
|
// configStore: new MemoryConfigStore(),
|
|
@@ -1265,7 +1265,7 @@ var usePositionStream = (symbol, options) => {
|
|
|
1265
1265
|
const notional = perp.positions.notional(item.position_qty, price);
|
|
1266
1266
|
const unrealPnl = perp.positions.unrealizedPnL({
|
|
1267
1267
|
qty: item.position_qty,
|
|
1268
|
-
openPrice: item
|
|
1268
|
+
openPrice: item?.average_open_price,
|
|
1269
1269
|
markPrice: price
|
|
1270
1270
|
});
|
|
1271
1271
|
const imr = perp.account.IMR({
|
|
@@ -3355,7 +3355,9 @@ var useChains = (networkId, options = {}) => {
|
|
|
3355
3355
|
if (chain) {
|
|
3356
3356
|
chain.nativeToken = chain.token_infos?.find(
|
|
3357
3357
|
(item) => item.address === nativeTokenAddress
|
|
3358
|
-
)
|
|
3358
|
+
) || {
|
|
3359
|
+
symbol: chain.network_infos?.currency_symbol
|
|
3360
|
+
};
|
|
3359
3361
|
}
|
|
3360
3362
|
if (typeof field2 === "string") {
|
|
3361
3363
|
return ramda.prop(field2, chain);
|
|
@@ -3559,9 +3561,15 @@ var useDeposit = (options) => {
|
|
|
3559
3561
|
},
|
|
3560
3562
|
[account5, getAllowance, options?.address]
|
|
3561
3563
|
);
|
|
3564
|
+
const getDepositFee = React.useCallback(
|
|
3565
|
+
async (amount, chain) => {
|
|
3566
|
+
return account5.assetsManager.getDepositFee(amount, chain);
|
|
3567
|
+
},
|
|
3568
|
+
[account5]
|
|
3569
|
+
);
|
|
3562
3570
|
const deposit = React.useCallback(
|
|
3563
|
-
(amount) => {
|
|
3564
|
-
return account5.assetsManager.deposit(amount).then((res) => {
|
|
3571
|
+
(amount, fee) => {
|
|
3572
|
+
return account5.assetsManager.deposit(amount, fee).then((res) => {
|
|
3565
3573
|
setAllowance((value) => new utils.Decimal(value).sub(amount).toString());
|
|
3566
3574
|
setBalance((value) => new utils.Decimal(value).sub(amount).toString());
|
|
3567
3575
|
return res;
|
|
@@ -3598,6 +3606,7 @@ var useDeposit = (options) => {
|
|
|
3598
3606
|
allowanceRevalidating,
|
|
3599
3607
|
approve,
|
|
3600
3608
|
deposit,
|
|
3609
|
+
getDepositFee,
|
|
3601
3610
|
fetchBalances,
|
|
3602
3611
|
fetchBalance: fetchBalanceHandler
|
|
3603
3612
|
};
|