@orderly.network/hooks 0.0.45 → 0.0.47

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
@@ -287,7 +287,7 @@ declare const useWithdraw: () => {
287
287
  declare const useDeposit: () => {
288
288
  balance: string;
289
289
  allowance: string;
290
- approve: (amount: string) => Promise<any>;
290
+ approve: (amount: string | undefined) => Promise<any>;
291
291
  deposit: (amount: string) => Promise<any>;
292
292
  };
293
293
 
package/dist/index.d.ts CHANGED
@@ -287,7 +287,7 @@ declare const useWithdraw: () => {
287
287
  declare const useDeposit: () => {
288
288
  balance: string;
289
289
  allowance: string;
290
- approve: (amount: string) => Promise<any>;
290
+ approve: (amount: string | undefined) => Promise<any>;
291
291
  deposit: (amount: string) => Promise<any>;
292
292
  };
293
293
 
package/dist/index.js CHANGED
@@ -1120,10 +1120,11 @@ var usePositionStream = (symbol, options) => {
1120
1120
  const total = totalCollateral.toNumber();
1121
1121
  return formatedPositions[0].filter((item) => item.position_qty !== 0).map((item) => {
1122
1122
  const info = symbolInfo == null ? void 0 : symbolInfo[item.symbol];
1123
+ console.log("******", accountInfo, info("base"));
1123
1124
  const MMR = futures.positions.MMR({
1124
1125
  baseMMR: info("base_mmr"),
1125
1126
  baseIMR: info("base_imr"),
1126
- IMRFactor: accountInfo.imr_factor[info("base")],
1127
+ IMRFactor: accountInfo.imr_factor[item.symbol],
1127
1128
  positionNotional: item.notional,
1128
1129
  IMR_factor_power: 4 / 5
1129
1130
  });
@@ -2044,7 +2045,9 @@ var useDeposit = () => {
2044
2045
  const approve = React2.useCallback(
2045
2046
  (amount) => {
2046
2047
  return account5.assetsManager.approve(amount).then((result) => {
2047
- setAllowance((value) => new utils.Decimal(value).add(amount).toString());
2048
+ if (typeof amount !== "undefined") {
2049
+ setAllowance((value) => new utils.Decimal(value).add(amount).toString());
2050
+ }
2048
2051
  return result;
2049
2052
  });
2050
2053
  },