@orderly.network/hooks 1.0.10 → 1.0.11
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -318,6 +318,10 @@ declare type useDepositOptions = {
|
|
|
318
318
|
networkId?: NetworkId;
|
|
319
319
|
srcChainId?: number;
|
|
320
320
|
srcToken?: string;
|
|
321
|
+
/**
|
|
322
|
+
* @hidden
|
|
323
|
+
*/
|
|
324
|
+
wooSwapEnabled?: boolean;
|
|
321
325
|
};
|
|
322
326
|
declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
323
327
|
dst: {
|
package/dist/index.d.ts
CHANGED
|
@@ -318,6 +318,10 @@ declare type useDepositOptions = {
|
|
|
318
318
|
networkId?: NetworkId;
|
|
319
319
|
srcChainId?: number;
|
|
320
320
|
srcToken?: string;
|
|
321
|
+
/**
|
|
322
|
+
* @hidden
|
|
323
|
+
*/
|
|
324
|
+
wooSwapEnabled?: boolean;
|
|
321
325
|
};
|
|
322
326
|
declare const useDeposit: (options?: useDepositOptions | undefined) => {
|
|
323
327
|
dst: {
|
package/dist/index.js
CHANGED
|
@@ -442,7 +442,7 @@ var OrderlyConfigProvider = (props) => {
|
|
|
442
442
|
console.error("[OrderlyConfigProvider]: brokerId is required");
|
|
443
443
|
}
|
|
444
444
|
const innerConfigStore = useConstant4__default.default(() => {
|
|
445
|
-
return configStore || new core.
|
|
445
|
+
return configStore || new core.DefaultConfigStore({ brokerId, networkId });
|
|
446
446
|
});
|
|
447
447
|
const innerKeyStore = useConstant4__default.default(() => {
|
|
448
448
|
return keyStore || new core.LocalStorageStore(networkId);
|
|
@@ -3156,7 +3156,8 @@ var useChains = (networkId, options = {}) => {
|
|
|
3156
3156
|
}
|
|
3157
3157
|
);
|
|
3158
3158
|
const { data: orderlyChains, error: tokenError } = useQuery(
|
|
3159
|
-
"/v1/public/token"
|
|
3159
|
+
// wooSwapEnabled ? "/v1/public/token" :
|
|
3160
|
+
"https://api-evm.orderly.org/v1/public/token",
|
|
3160
3161
|
{
|
|
3161
3162
|
revalidateIfStale: false,
|
|
3162
3163
|
revalidateOnFocus: false,
|
|
@@ -3390,6 +3391,7 @@ var useWithdraw = () => {
|
|
|
3390
3391
|
};
|
|
3391
3392
|
var useDeposit = (options) => {
|
|
3392
3393
|
const { onlyTestnet, enableSwapDeposit } = React.useContext(OrderlyContext);
|
|
3394
|
+
const networkId = useConfig("networkId");
|
|
3393
3395
|
const [balanceRevalidating, setBalanceRevalidating] = React.useState(false);
|
|
3394
3396
|
const [allowanceRevalidating, setAllowanceRevalidating] = React.useState(false);
|
|
3395
3397
|
const [_, { findByChainId }] = useChains(void 0, {
|
|
@@ -3401,8 +3403,10 @@ var useDeposit = (options) => {
|
|
|
3401
3403
|
const prevAddress = React.useRef();
|
|
3402
3404
|
const getBalanceListener = React.useRef();
|
|
3403
3405
|
const dst = React.useMemo(() => {
|
|
3404
|
-
const chain =
|
|
3405
|
-
const USDC = chain?.token_infos.find(
|
|
3406
|
+
const chain = networkId === "testnet" ? findByChainId(types.ARBITRUM_TESTNET_CHAINID) : findByChainId(types.ARBITRUM_MAINNET_CHAINID);
|
|
3407
|
+
const USDC = chain?.token_infos.find(
|
|
3408
|
+
(token) => token.symbol === "USDC"
|
|
3409
|
+
);
|
|
3406
3410
|
if (!chain) {
|
|
3407
3411
|
throw new Error("dst chain not found");
|
|
3408
3412
|
}
|
|
@@ -3414,7 +3418,7 @@ var useDeposit = (options) => {
|
|
|
3414
3418
|
network: chain.network_infos.shortName
|
|
3415
3419
|
// chainId: 42161,
|
|
3416
3420
|
};
|
|
3417
|
-
}, []);
|
|
3421
|
+
}, [networkId]);
|
|
3418
3422
|
const isNativeToken = React.useMemo(
|
|
3419
3423
|
() => isNativeTokenChecker(options?.address || ""),
|
|
3420
3424
|
[options?.address]
|