@orderly.network/hooks 1.0.26-alpha.0 → 1.0.26-alpha.2

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.26-alpha.0";
26
+ declare const _default: "1.0.26-alpha.2";
27
27
 
28
28
  declare type useQueryOptions<T> = SWRConfiguration & {
29
29
  formatter?: (data: any) => T;
@@ -325,6 +325,7 @@ declare const useWithdraw: () => {
325
325
  chainId: number;
326
326
  token: string;
327
327
  amount: number;
328
+ allowCrossChainWithdraw: boolean;
328
329
  }) => Promise<any>;
329
330
  isLoading: boolean;
330
331
  maxAmount: number;
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-alpha.0";
26
+ declare const _default: "1.0.26-alpha.2";
27
27
 
28
28
  declare type useQueryOptions<T> = SWRConfiguration & {
29
29
  formatter?: (data: any) => T;
@@ -325,6 +325,7 @@ declare const useWithdraw: () => {
325
325
  chainId: number;
326
326
  token: string;
327
327
  amount: number;
328
+ allowCrossChainWithdraw: boolean;
328
329
  }) => Promise<any>;
329
330
  isLoading: boolean;
330
331
  maxAmount: number;
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.26-alpha.0";
31
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.26-alpha.2";
32
32
  }
33
- var version_default = "1.0.26-alpha.0";
33
+ var version_default = "1.0.26-alpha.2";
34
34
  var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
35
35
  var OrderlyContext = React.createContext({
36
36
  // configStore: new MemoryConfigStore(),
@@ -1509,7 +1509,8 @@ var useOrderStream = (params) => {
1509
1509
  const cancelOrder = React.useCallback((orderId, symbol2) => {
1510
1510
  return doCancelOrder(null, {
1511
1511
  order_id: orderId,
1512
- symbol: symbol2
1512
+ symbol: symbol2,
1513
+ source: "mweb"
1513
1514
  }).then((res) => {
1514
1515
  if (res.success) {
1515
1516
  return res;
@@ -3128,7 +3129,7 @@ var isNativeTokenChecker = (address) => address === nativeTokenAddress;
3128
3129
  // src/orderly/useChains.ts
3129
3130
  var useChains = (networkId, options = {}) => {
3130
3131
  const { filter, pick: pick3, crossEnabled, wooSwapEnabled, ...swrOptions } = options;
3131
- const { configStore } = React.useContext(OrderlyContext);
3132
+ const { configStore, networkId: networkEnv } = React.useContext(OrderlyContext);
3132
3133
  const field = options?.pick;
3133
3134
  const map = React.useRef(
3134
3135
  /* @__PURE__ */ new Map()
@@ -3170,6 +3171,7 @@ var useChains = (networkId, options = {}) => {
3170
3171
  dedupingInterval: 36e5
3171
3172
  }
3172
3173
  );
3174
+ configStore.get("apiBaseUrl");
3173
3175
  const chains = React.useMemo(() => {
3174
3176
  let orderlyChainsArr = [];
3175
3177
  const orderlyChainIds = /* @__PURE__ */ new Set();
@@ -3237,6 +3239,25 @@ var useChains = (networkId, options = {}) => {
3237
3239
  ]
3238
3240
  }
3239
3241
  ];
3242
+ if (networkEnv === "testnet") {
3243
+ const opGoerli = {
3244
+ network_infos: {
3245
+ name: "Optimism Goerli",
3246
+ shortName: "Optimism Goerli",
3247
+ public_rpc_url: "https://optimism-goerli.gateway.tenderly.co",
3248
+ chain_id: 420,
3249
+ currency_symbol: "ETH",
3250
+ bridge_enable: true,
3251
+ mainnet: false,
3252
+ explorer_base_url: "https://goerli-optimism.etherscan.io",
3253
+ est_txn_mins: null,
3254
+ woofi_dex_cross_chain_router: "",
3255
+ woofi_dex_depositor: ""
3256
+ }
3257
+ };
3258
+ testnetArr.push(opGoerli);
3259
+ map.current.set(420, opGoerli);
3260
+ }
3240
3261
  let mainnetArr = [];
3241
3262
  map.current.set(421613, testnetArr[0]);
3242
3263
  if (wooSwapEnabled) {
@@ -3304,6 +3325,14 @@ var useChains = (networkId, options = {}) => {
3304
3325
  testnetArr[index] = _chain;
3305
3326
  }
3306
3327
  }
3328
+ if (_chain.network_infos.chain_id === 420) {
3329
+ const index = testnetArr.findIndex(
3330
+ (item) => item.network_infos.chain_id === 420
3331
+ );
3332
+ if (index > -1) {
3333
+ testnetArr[index] = _chain;
3334
+ }
3335
+ }
3307
3336
  if (typeof options?.filter === "function") {
3308
3337
  if (!options.filter(_chain))
3309
3338
  return;