@orderly.network/hooks 1.0.27 → 1.0.28-alpha.0
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 +42 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -8
- 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.0";
|
|
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.0";
|
|
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.0";
|
|
32
32
|
}
|
|
33
|
-
var version_default = "1.0.
|
|
33
|
+
var version_default = "1.0.28-alpha.0";
|
|
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({
|
|
@@ -3124,6 +3124,8 @@ var woofiDexCrossChainRouterAbi = [
|
|
|
3124
3124
|
];
|
|
3125
3125
|
var nativeTokenAddress = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
|
3126
3126
|
var isNativeTokenChecker = (address) => address === nativeTokenAddress;
|
|
3127
|
+
var woofiDexDepositor = "0x7347383c4D258f3c64987acaf0E7c3C2bF5bE0bA";
|
|
3128
|
+
var woofiDexCrossChainRouter = "0x82Fde5086784e348aEd03eB7b19ded97652DB7A8";
|
|
3127
3129
|
|
|
3128
3130
|
// src/orderly/useChains.ts
|
|
3129
3131
|
var useChains = (networkId, options = {}) => {
|
|
@@ -3331,14 +3333,14 @@ var useChains = (networkId, options = {}) => {
|
|
|
3331
3333
|
mainnetArr = mainnetArr.map((item) => item[field]);
|
|
3332
3334
|
}
|
|
3333
3335
|
if (networkId === "mainnet") {
|
|
3334
|
-
return mainnetArr;
|
|
3336
|
+
return wrapTestData(mainnetArr);
|
|
3335
3337
|
}
|
|
3336
3338
|
if (networkId === "testnet") {
|
|
3337
3339
|
return testnetArr;
|
|
3338
3340
|
}
|
|
3339
3341
|
return {
|
|
3340
3342
|
testnet: testnetArr,
|
|
3341
|
-
mainnet: mainnetArr
|
|
3343
|
+
mainnet: wrapTestData(mainnetArr)
|
|
3342
3344
|
};
|
|
3343
3345
|
}, [
|
|
3344
3346
|
data,
|
|
@@ -3355,7 +3357,9 @@ var useChains = (networkId, options = {}) => {
|
|
|
3355
3357
|
if (chain) {
|
|
3356
3358
|
chain.nativeToken = chain.token_infos?.find(
|
|
3357
3359
|
(item) => item.address === nativeTokenAddress
|
|
3358
|
-
)
|
|
3360
|
+
) || {
|
|
3361
|
+
symbol: chain.network_infos?.currency_symbol
|
|
3362
|
+
};
|
|
3359
3363
|
}
|
|
3360
3364
|
if (typeof field2 === "string") {
|
|
3361
3365
|
return ramda.prop(field2, chain);
|
|
@@ -3374,6 +3378,29 @@ var useChains = (networkId, options = {}) => {
|
|
|
3374
3378
|
}
|
|
3375
3379
|
];
|
|
3376
3380
|
};
|
|
3381
|
+
function wrapTestData(chains) {
|
|
3382
|
+
const mapData = (list) => {
|
|
3383
|
+
return list.map((item) => {
|
|
3384
|
+
if (item.name === "Arbitrum") {
|
|
3385
|
+
return {
|
|
3386
|
+
...item,
|
|
3387
|
+
woofi_dex_depositor: woofiDexDepositor
|
|
3388
|
+
};
|
|
3389
|
+
}
|
|
3390
|
+
if (item.name === "Base") {
|
|
3391
|
+
return {
|
|
3392
|
+
...item,
|
|
3393
|
+
woofi_dex_cross_chain_router: woofiDexCrossChainRouter
|
|
3394
|
+
};
|
|
3395
|
+
}
|
|
3396
|
+
return item;
|
|
3397
|
+
});
|
|
3398
|
+
};
|
|
3399
|
+
if (Array.isArray(chains)) {
|
|
3400
|
+
return mapData(chains);
|
|
3401
|
+
}
|
|
3402
|
+
return chains;
|
|
3403
|
+
}
|
|
3377
3404
|
var useChain = (token) => {
|
|
3378
3405
|
const { data, isLoading } = useQuery("/v1/public/token");
|
|
3379
3406
|
const chains = React.useMemo(() => {
|
|
@@ -3559,9 +3586,15 @@ var useDeposit = (options) => {
|
|
|
3559
3586
|
},
|
|
3560
3587
|
[account5, getAllowance, options?.address]
|
|
3561
3588
|
);
|
|
3589
|
+
const getDepositFee = React.useCallback(
|
|
3590
|
+
async (amount, chain) => {
|
|
3591
|
+
return account5.assetsManager.getDepositFee(amount, chain);
|
|
3592
|
+
},
|
|
3593
|
+
[account5]
|
|
3594
|
+
);
|
|
3562
3595
|
const deposit = React.useCallback(
|
|
3563
|
-
(amount) => {
|
|
3564
|
-
return account5.assetsManager.deposit(amount).then((res) => {
|
|
3596
|
+
(amount, fee) => {
|
|
3597
|
+
return account5.assetsManager.deposit(amount, fee).then((res) => {
|
|
3565
3598
|
setAllowance((value) => new utils.Decimal(value).sub(amount).toString());
|
|
3566
3599
|
setBalance((value) => new utils.Decimal(value).sub(amount).toString());
|
|
3567
3600
|
return res;
|
|
@@ -3598,6 +3631,7 @@ var useDeposit = (options) => {
|
|
|
3598
3631
|
allowanceRevalidating,
|
|
3599
3632
|
approve,
|
|
3600
3633
|
deposit,
|
|
3634
|
+
getDepositFee,
|
|
3601
3635
|
fetchBalances,
|
|
3602
3636
|
fetchBalance: fetchBalanceHandler
|
|
3603
3637
|
};
|