@orderly.network/hooks 1.0.28 → 1.0.29
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 +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +10 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -20,9 +20,9 @@ import { createClient } from '@layerzerolabs/scan-client';
|
|
|
20
20
|
// src/version.ts
|
|
21
21
|
if (typeof window !== "undefined") {
|
|
22
22
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
23
|
-
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.
|
|
23
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.29";
|
|
24
24
|
}
|
|
25
|
-
var version_default = "1.0.
|
|
25
|
+
var version_default = "1.0.29";
|
|
26
26
|
var fetcher = (url, init = {}, queryOptions) => get(url, init, queryOptions?.formatter);
|
|
27
27
|
var OrderlyContext = createContext({
|
|
28
28
|
// configStore: new MemoryConfigStore(),
|
|
@@ -1257,7 +1257,7 @@ var usePositionStream = (symbol, options) => {
|
|
|
1257
1257
|
const notional = positions.notional(item.position_qty, price);
|
|
1258
1258
|
const unrealPnl = positions.unrealizedPnL({
|
|
1259
1259
|
qty: item.position_qty,
|
|
1260
|
-
openPrice: item
|
|
1260
|
+
openPrice: item.average_open_price,
|
|
1261
1261
|
markPrice: price
|
|
1262
1262
|
});
|
|
1263
1263
|
const imr = account.IMR({
|
|
@@ -3230,25 +3230,6 @@ var useChains = (networkId, options = {}) => {
|
|
|
3230
3230
|
]
|
|
3231
3231
|
}
|
|
3232
3232
|
];
|
|
3233
|
-
if (networkEnv === "testnet") {
|
|
3234
|
-
const opGoerli = {
|
|
3235
|
-
network_infos: {
|
|
3236
|
-
name: "Optimism Goerli",
|
|
3237
|
-
shortName: "Optimism Goerli",
|
|
3238
|
-
public_rpc_url: "https://optimism-goerli.gateway.tenderly.co",
|
|
3239
|
-
chain_id: 420,
|
|
3240
|
-
currency_symbol: "ETH",
|
|
3241
|
-
bridge_enable: true,
|
|
3242
|
-
mainnet: false,
|
|
3243
|
-
explorer_base_url: "https://goerli-optimism.etherscan.io",
|
|
3244
|
-
est_txn_mins: null,
|
|
3245
|
-
woofi_dex_cross_chain_router: "",
|
|
3246
|
-
woofi_dex_depositor: ""
|
|
3247
|
-
}
|
|
3248
|
-
};
|
|
3249
|
-
testnetArr.push(opGoerli);
|
|
3250
|
-
map.current.set(420, opGoerli);
|
|
3251
|
-
}
|
|
3252
3233
|
let mainnetArr = [];
|
|
3253
3234
|
map.current.set(421613, testnetArr[0]);
|
|
3254
3235
|
if (wooSwapEnabled) {
|
|
@@ -3366,9 +3347,7 @@ var useChains = (networkId, options = {}) => {
|
|
|
3366
3347
|
if (chain) {
|
|
3367
3348
|
chain.nativeToken = chain.token_infos?.find(
|
|
3368
3349
|
(item) => item.address === nativeTokenAddress
|
|
3369
|
-
)
|
|
3370
|
-
symbol: chain.network_infos?.currency_symbol
|
|
3371
|
-
};
|
|
3350
|
+
);
|
|
3372
3351
|
}
|
|
3373
3352
|
if (typeof field2 === "string") {
|
|
3374
3353
|
return prop(field2, chain);
|
|
@@ -3438,15 +3417,7 @@ var useDeposit = (options) => {
|
|
|
3438
3417
|
const prevAddress = useRef();
|
|
3439
3418
|
const getBalanceListener = useRef();
|
|
3440
3419
|
const dst = useMemo(() => {
|
|
3441
|
-
|
|
3442
|
-
if (networkId === "testnet") {
|
|
3443
|
-
chain = findByChainId(ARBITRUM_TESTNET_CHAINID);
|
|
3444
|
-
} else {
|
|
3445
|
-
chain = findByChainId(options?.srcChainId);
|
|
3446
|
-
if (!chain?.network_infos?.bridgeless) {
|
|
3447
|
-
chain = findByChainId(ARBITRUM_MAINNET_CHAINID);
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3420
|
+
const chain = networkId === "testnet" ? findByChainId(ARBITRUM_TESTNET_CHAINID) : findByChainId(ARBITRUM_MAINNET_CHAINID);
|
|
3450
3421
|
const USDC = chain?.token_infos.find(
|
|
3451
3422
|
(token) => token.symbol === "USDC"
|
|
3452
3423
|
);
|
|
@@ -3461,7 +3432,7 @@ var useDeposit = (options) => {
|
|
|
3461
3432
|
network: chain.network_infos.shortName
|
|
3462
3433
|
// chainId: 42161,
|
|
3463
3434
|
};
|
|
3464
|
-
}, [networkId, findByChainId
|
|
3435
|
+
}, [networkId, findByChainId]);
|
|
3465
3436
|
const isNativeToken = useMemo(
|
|
3466
3437
|
() => isNativeTokenChecker(options?.address || ""),
|
|
3467
3438
|
[options?.address]
|
|
@@ -3580,15 +3551,9 @@ var useDeposit = (options) => {
|
|
|
3580
3551
|
},
|
|
3581
3552
|
[account5, getAllowance, options?.address]
|
|
3582
3553
|
);
|
|
3583
|
-
const getDepositFee = useCallback(
|
|
3584
|
-
async (amount, chain) => {
|
|
3585
|
-
return account5.assetsManager.getDepositFee(amount, chain);
|
|
3586
|
-
},
|
|
3587
|
-
[account5]
|
|
3588
|
-
);
|
|
3589
3554
|
const deposit = useCallback(
|
|
3590
|
-
(amount
|
|
3591
|
-
return account5.assetsManager.deposit(amount
|
|
3555
|
+
(amount) => {
|
|
3556
|
+
return account5.assetsManager.deposit(amount).then((res) => {
|
|
3592
3557
|
setAllowance((value) => new Decimal(value).sub(amount).toString());
|
|
3593
3558
|
setBalance((value) => new Decimal(value).sub(amount).toString());
|
|
3594
3559
|
return res;
|
|
@@ -3625,7 +3590,6 @@ var useDeposit = (options) => {
|
|
|
3625
3590
|
allowanceRevalidating,
|
|
3626
3591
|
approve,
|
|
3627
3592
|
deposit,
|
|
3628
|
-
getDepositFee,
|
|
3629
3593
|
fetchBalances,
|
|
3630
3594
|
fetchBalance: fetchBalanceHandler
|
|
3631
3595
|
};
|
|
@@ -3709,8 +3673,8 @@ var useWooSwapQuery = () => {
|
|
|
3709
3673
|
return;
|
|
3710
3674
|
start();
|
|
3711
3675
|
const params = {
|
|
3712
|
-
|
|
3713
|
-
|
|
3676
|
+
// src_network: inputs.srcNetwork,
|
|
3677
|
+
network: "arbitrum",
|
|
3714
3678
|
from_token: inputs.srcToken,
|
|
3715
3679
|
to_token: inputs.dstToken,
|
|
3716
3680
|
//account.assetsManager.usdcAddress,
|