@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 CHANGED
@@ -23,7 +23,7 @@ declare global {
23
23
  };
24
24
  }
25
25
  }
26
- declare const _default: "1.0.28";
26
+ declare const _default: "1.0.29";
27
27
 
28
28
  declare type useQueryOptions<T> = SWRConfiguration & {
29
29
  formatter?: (data: any) => T;
@@ -360,8 +360,7 @@ 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, fee?: bigint | undefined) => Promise<any>;
364
- getDepositFee: (amount: string, chain: any) => Promise<any>;
363
+ deposit: (amount: string) => Promise<any>;
365
364
  fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
366
365
  fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
367
366
  };
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ declare global {
23
23
  };
24
24
  }
25
25
  }
26
- declare const _default: "1.0.28";
26
+ declare const _default: "1.0.29";
27
27
 
28
28
  declare type useQueryOptions<T> = SWRConfiguration & {
29
29
  formatter?: (data: any) => T;
@@ -360,8 +360,7 @@ 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, fee?: bigint | undefined) => Promise<any>;
364
- getDepositFee: (amount: string, chain: any) => Promise<any>;
363
+ deposit: (amount: string) => Promise<any>;
365
364
  fetchBalances: (tokens: API.TokenInfo[]) => Promise<void>;
366
365
  fetchBalance: (address: string, decimals?: number | undefined) => Promise<string>;
367
366
  };
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.28";
31
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.29";
32
32
  }
33
- var version_default = "1.0.28";
33
+ var version_default = "1.0.29";
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?.average_open_price,
1268
+ openPrice: item.average_open_price,
1269
1269
  markPrice: price
1270
1270
  });
1271
1271
  const imr = perp.account.IMR({
@@ -3238,25 +3238,6 @@ var useChains = (networkId, options = {}) => {
3238
3238
  ]
3239
3239
  }
3240
3240
  ];
3241
- if (networkEnv === "testnet") {
3242
- const opGoerli = {
3243
- network_infos: {
3244
- name: "Optimism Goerli",
3245
- shortName: "Optimism Goerli",
3246
- public_rpc_url: "https://optimism-goerli.gateway.tenderly.co",
3247
- chain_id: 420,
3248
- currency_symbol: "ETH",
3249
- bridge_enable: true,
3250
- mainnet: false,
3251
- explorer_base_url: "https://goerli-optimism.etherscan.io",
3252
- est_txn_mins: null,
3253
- woofi_dex_cross_chain_router: "",
3254
- woofi_dex_depositor: ""
3255
- }
3256
- };
3257
- testnetArr.push(opGoerli);
3258
- map.current.set(420, opGoerli);
3259
- }
3260
3241
  let mainnetArr = [];
3261
3242
  map.current.set(421613, testnetArr[0]);
3262
3243
  if (wooSwapEnabled) {
@@ -3374,9 +3355,7 @@ var useChains = (networkId, options = {}) => {
3374
3355
  if (chain) {
3375
3356
  chain.nativeToken = chain.token_infos?.find(
3376
3357
  (item) => item.address === nativeTokenAddress
3377
- ) || {
3378
- symbol: chain.network_infos?.currency_symbol
3379
- };
3358
+ );
3380
3359
  }
3381
3360
  if (typeof field2 === "string") {
3382
3361
  return ramda.prop(field2, chain);
@@ -3446,15 +3425,7 @@ var useDeposit = (options) => {
3446
3425
  const prevAddress = React.useRef();
3447
3426
  const getBalanceListener = React.useRef();
3448
3427
  const dst = React.useMemo(() => {
3449
- let chain;
3450
- if (networkId === "testnet") {
3451
- chain = findByChainId(types.ARBITRUM_TESTNET_CHAINID);
3452
- } else {
3453
- chain = findByChainId(options?.srcChainId);
3454
- if (!chain?.network_infos?.bridgeless) {
3455
- chain = findByChainId(types.ARBITRUM_MAINNET_CHAINID);
3456
- }
3457
- }
3428
+ const chain = networkId === "testnet" ? findByChainId(types.ARBITRUM_TESTNET_CHAINID) : findByChainId(types.ARBITRUM_MAINNET_CHAINID);
3458
3429
  const USDC = chain?.token_infos.find(
3459
3430
  (token) => token.symbol === "USDC"
3460
3431
  );
@@ -3469,7 +3440,7 @@ var useDeposit = (options) => {
3469
3440
  network: chain.network_infos.shortName
3470
3441
  // chainId: 42161,
3471
3442
  };
3472
- }, [networkId, findByChainId, options?.srcChainId]);
3443
+ }, [networkId, findByChainId]);
3473
3444
  const isNativeToken = React.useMemo(
3474
3445
  () => isNativeTokenChecker(options?.address || ""),
3475
3446
  [options?.address]
@@ -3588,15 +3559,9 @@ var useDeposit = (options) => {
3588
3559
  },
3589
3560
  [account5, getAllowance, options?.address]
3590
3561
  );
3591
- const getDepositFee = React.useCallback(
3592
- async (amount, chain) => {
3593
- return account5.assetsManager.getDepositFee(amount, chain);
3594
- },
3595
- [account5]
3596
- );
3597
3562
  const deposit = React.useCallback(
3598
- (amount, fee) => {
3599
- return account5.assetsManager.deposit(amount, fee).then((res) => {
3563
+ (amount) => {
3564
+ return account5.assetsManager.deposit(amount).then((res) => {
3600
3565
  setAllowance((value) => new utils.Decimal(value).sub(amount).toString());
3601
3566
  setBalance((value) => new utils.Decimal(value).sub(amount).toString());
3602
3567
  return res;
@@ -3633,7 +3598,6 @@ var useDeposit = (options) => {
3633
3598
  allowanceRevalidating,
3634
3599
  approve,
3635
3600
  deposit,
3636
- getDepositFee,
3637
3601
  fetchBalances,
3638
3602
  fetchBalance: fetchBalanceHandler
3639
3603
  };
@@ -3717,8 +3681,8 @@ var useWooSwapQuery = () => {
3717
3681
  return;
3718
3682
  start();
3719
3683
  const params = {
3720
- network: inputs.srcNetwork,
3721
- // network: "arbitrum",
3684
+ // src_network: inputs.srcNetwork,
3685
+ network: "arbitrum",
3722
3686
  from_token: inputs.srcToken,
3723
3687
  to_token: inputs.dstToken,
3724
3688
  //account.assetsManager.usdcAddress,