@orderly.network/hooks 1.0.25 → 1.0.26-alpha.1
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 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -4
- 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.26-alpha.1";
|
|
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
|
+
declare const _default: "1.0.26-alpha.1";
|
|
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.
|
|
31
|
+
window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.0.26-alpha.1";
|
|
32
32
|
}
|
|
33
|
-
var version_default = "1.0.
|
|
33
|
+
var version_default = "1.0.26-alpha.1";
|
|
34
34
|
var fetcher = (url, init = {}, queryOptions) => net.get(url, init, queryOptions?.formatter);
|
|
35
35
|
var OrderlyContext = React.createContext({
|
|
36
36
|
// configStore: new MemoryConfigStore(),
|
|
@@ -726,6 +726,7 @@ var useTickerStream = (symbol) => {
|
|
|
726
726
|
}
|
|
727
727
|
if (ticker.close !== void 0 && ticker.open !== void 0) {
|
|
728
728
|
config["change"] = new utils.Decimal(ticker.close).minus(ticker.open).div(ticker.open).toNumber();
|
|
729
|
+
config["24h_change"] = new utils.Decimal(ticker.close).minus(ticker.open);
|
|
729
730
|
}
|
|
730
731
|
return config;
|
|
731
732
|
}, [info, symbol, ticker]);
|
|
@@ -1508,7 +1509,8 @@ var useOrderStream = (params) => {
|
|
|
1508
1509
|
const cancelOrder = React.useCallback((orderId, symbol2) => {
|
|
1509
1510
|
return doCancelOrder(null, {
|
|
1510
1511
|
order_id: orderId,
|
|
1511
|
-
symbol: symbol2
|
|
1512
|
+
symbol: symbol2,
|
|
1513
|
+
source: "mweb"
|
|
1512
1514
|
}).then((res) => {
|
|
1513
1515
|
if (res.success) {
|
|
1514
1516
|
return res;
|
|
@@ -3127,7 +3129,7 @@ var isNativeTokenChecker = (address) => address === nativeTokenAddress;
|
|
|
3127
3129
|
// src/orderly/useChains.ts
|
|
3128
3130
|
var useChains = (networkId, options = {}) => {
|
|
3129
3131
|
const { filter, pick: pick3, crossEnabled, wooSwapEnabled, ...swrOptions } = options;
|
|
3130
|
-
const { configStore } = React.useContext(OrderlyContext);
|
|
3132
|
+
const { configStore, networkId: networkEnv } = React.useContext(OrderlyContext);
|
|
3131
3133
|
const field = options?.pick;
|
|
3132
3134
|
const map = React.useRef(
|
|
3133
3135
|
/* @__PURE__ */ new Map()
|
|
@@ -3169,6 +3171,7 @@ var useChains = (networkId, options = {}) => {
|
|
|
3169
3171
|
dedupingInterval: 36e5
|
|
3170
3172
|
}
|
|
3171
3173
|
);
|
|
3174
|
+
configStore.get("apiBaseUrl");
|
|
3172
3175
|
const chains = React.useMemo(() => {
|
|
3173
3176
|
let orderlyChainsArr = [];
|
|
3174
3177
|
const orderlyChainIds = /* @__PURE__ */ new Set();
|
|
@@ -3236,6 +3239,25 @@ var useChains = (networkId, options = {}) => {
|
|
|
3236
3239
|
]
|
|
3237
3240
|
}
|
|
3238
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
|
+
}
|
|
3239
3261
|
let mainnetArr = [];
|
|
3240
3262
|
map.current.set(421613, testnetArr[0]);
|
|
3241
3263
|
if (wooSwapEnabled) {
|
|
@@ -3303,6 +3325,14 @@ var useChains = (networkId, options = {}) => {
|
|
|
3303
3325
|
testnetArr[index] = _chain;
|
|
3304
3326
|
}
|
|
3305
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
|
+
}
|
|
3306
3336
|
if (typeof options?.filter === "function") {
|
|
3307
3337
|
if (!options.filter(_chain))
|
|
3308
3338
|
return;
|