@orderly.network/ui-transfer 3.1.11-alpha.0 → 3.1.12-alpha.0
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 +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +335 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +339 -66
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -14
package/dist/index.d.mts
CHANGED
|
@@ -412,6 +412,12 @@ type QuantityInputProps = {
|
|
|
412
412
|
tokenShowCaret?: boolean;
|
|
413
413
|
balancesRevalidating?: boolean;
|
|
414
414
|
showBalance?: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Token label display mode.
|
|
417
|
+
* - `false` (default): platform-side Orderly account assets — symbol only
|
|
418
|
+
* - `true`: wallet-side chain assets — `display_name || symbol`
|
|
419
|
+
*/
|
|
420
|
+
showDisplayName?: boolean;
|
|
415
421
|
} & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
|
|
416
422
|
declare const QuantityInput: FC<QuantityInputProps>;
|
|
417
423
|
|
|
@@ -423,6 +429,12 @@ type AvailableQuantityProps = {
|
|
|
423
429
|
loading?: boolean;
|
|
424
430
|
tooltipContent?: React.ReactNode;
|
|
425
431
|
notional?: number;
|
|
432
|
+
/**
|
|
433
|
+
* Token label display mode.
|
|
434
|
+
* - `false` (default): platform-side Orderly account assets — symbol only
|
|
435
|
+
* - `true`: wallet-side chain assets — `display_name || symbol`
|
|
436
|
+
*/
|
|
437
|
+
showDisplayName?: boolean;
|
|
426
438
|
};
|
|
427
439
|
declare const AvailableQuantity: FC<AvailableQuantityProps>;
|
|
428
440
|
|
package/dist/index.d.ts
CHANGED
|
@@ -412,6 +412,12 @@ type QuantityInputProps = {
|
|
|
412
412
|
tokenShowCaret?: boolean;
|
|
413
413
|
balancesRevalidating?: boolean;
|
|
414
414
|
showBalance?: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Token label display mode.
|
|
417
|
+
* - `false` (default): platform-side Orderly account assets — symbol only
|
|
418
|
+
* - `true`: wallet-side chain assets — `display_name || symbol`
|
|
419
|
+
*/
|
|
420
|
+
showDisplayName?: boolean;
|
|
415
421
|
} & Omit<InputProps, "onClear" | "suffix" | "onValueChange">;
|
|
416
422
|
declare const QuantityInput: FC<QuantityInputProps>;
|
|
417
423
|
|
|
@@ -423,6 +429,12 @@ type AvailableQuantityProps = {
|
|
|
423
429
|
loading?: boolean;
|
|
424
430
|
tooltipContent?: React.ReactNode;
|
|
425
431
|
notional?: number;
|
|
432
|
+
/**
|
|
433
|
+
* Token label display mode.
|
|
434
|
+
* - `false` (default): platform-side Orderly account assets — symbol only
|
|
435
|
+
* - `true`: wallet-side chain assets — `display_name || symbol`
|
|
436
|
+
*/
|
|
437
|
+
showDisplayName?: boolean;
|
|
426
438
|
};
|
|
427
439
|
declare const AvailableQuantity: FC<AvailableQuantityProps>;
|
|
428
440
|
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,6 @@ var uiChainSelector = require('@orderly.network/ui-chain-selector');
|
|
|
16
16
|
var web3_js = require('@solana/web3.js');
|
|
17
17
|
var ethers = require('ethers');
|
|
18
18
|
var pluginCore = require('@orderly.network/plugin-core');
|
|
19
|
-
var defaultSolanaAdapter = require('@orderly.network/default-solana-adapter');
|
|
20
19
|
|
|
21
20
|
// src/components/depositForm/depositForm.ui.tsx
|
|
22
21
|
var useLtvScript = () => {
|
|
@@ -242,13 +241,19 @@ var AvailableTooltipMessage = ({
|
|
|
242
241
|
return /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 80, children: t("transfer.withdraw.available.tooltip", { amount: amountText }) });
|
|
243
242
|
};
|
|
244
243
|
var AvailableQuantity = (props) => {
|
|
245
|
-
const {
|
|
244
|
+
const {
|
|
245
|
+
quantity,
|
|
246
|
+
maxQuantity,
|
|
247
|
+
token,
|
|
248
|
+
loading,
|
|
249
|
+
showDisplayName = false
|
|
250
|
+
} = props;
|
|
246
251
|
const { t } = i18n.useTranslation();
|
|
247
252
|
const { isMobile } = ui.useScreen();
|
|
248
253
|
const dir = ui.useDocumentDirection();
|
|
249
254
|
const isRTL = dir === "rtl";
|
|
250
255
|
const { getIndexPrice } = hooks.useIndexPricesStream();
|
|
251
|
-
const name = token?.display_name || token?.symbol || "";
|
|
256
|
+
const name = showDisplayName ? token?.display_name || token?.symbol || "" : token?.symbol || "";
|
|
252
257
|
const dp = token?.precision ?? token?.decimals ?? 2;
|
|
253
258
|
const notional = react.useMemo(() => {
|
|
254
259
|
if (props.notional !== void 0 && props.notional !== null) {
|
|
@@ -916,7 +921,8 @@ var useExclusiveDepositOptions = (params) => {
|
|
|
916
921
|
chainId,
|
|
917
922
|
chainName: chain?.network_infos?.name ?? `Chain ${chainId}`,
|
|
918
923
|
explorerUrl: chain?.network_infos?.explorer_base_url ?? "",
|
|
919
|
-
tokenSymbol: token.token
|
|
924
|
+
tokenSymbol: token.token,
|
|
925
|
+
displayName: detail.display_name || token.token
|
|
920
926
|
});
|
|
921
927
|
}
|
|
922
928
|
}
|
|
@@ -951,7 +957,7 @@ var useExclusiveDepositOptions = (params) => {
|
|
|
951
957
|
for (const combo of combos) {
|
|
952
958
|
if (combo.chainId === chainId && !seen.has(combo.tokenSymbol)) {
|
|
953
959
|
seen.add(combo.tokenSymbol);
|
|
954
|
-
result.push({ label: combo.
|
|
960
|
+
result.push({ label: combo.displayName, value: combo.tokenSymbol });
|
|
955
961
|
}
|
|
956
962
|
}
|
|
957
963
|
result.sort((a, b) => {
|
|
@@ -1378,6 +1384,7 @@ var QuantityInput = (props) => {
|
|
|
1378
1384
|
tokenShowCaret,
|
|
1379
1385
|
balancesRevalidating,
|
|
1380
1386
|
showBalance,
|
|
1387
|
+
showDisplayName = false,
|
|
1381
1388
|
...rest
|
|
1382
1389
|
} = props;
|
|
1383
1390
|
const { t } = i18n.useTranslation();
|
|
@@ -1385,6 +1392,7 @@ var QuantityInput = (props) => {
|
|
|
1385
1392
|
const inputRef = react.useRef(null);
|
|
1386
1393
|
const [open, setOpen] = react.useState(false);
|
|
1387
1394
|
const [width, setWidth] = react.useState(0);
|
|
1395
|
+
const getTokenLabel = (tokenInfo) => showDisplayName ? tokenInfo.display_name || tokenInfo.symbol : tokenInfo.symbol;
|
|
1388
1396
|
const tokenOptions = react.useMemo(() => {
|
|
1389
1397
|
return tokens.map((token2) => {
|
|
1390
1398
|
const currentToken = vaultBalanceList?.find(
|
|
@@ -1393,17 +1401,17 @@ var QuantityInput = (props) => {
|
|
|
1393
1401
|
const insufficientBalance = currentToken ? new utils.Decimal(currentToken.balance ?? 0).lt(value ? Number(value) : 0) : false;
|
|
1394
1402
|
return {
|
|
1395
1403
|
...token2,
|
|
1396
|
-
name: token2
|
|
1404
|
+
name: getTokenLabel(token2),
|
|
1397
1405
|
insufficientBalance
|
|
1398
1406
|
};
|
|
1399
1407
|
});
|
|
1400
|
-
}, [tokens, value, vaultBalanceList]);
|
|
1408
|
+
}, [tokens, value, vaultBalanceList, showDisplayName]);
|
|
1401
1409
|
react.useEffect(() => {
|
|
1402
1410
|
const rect = inputRef?.current?.getBoundingClientRect();
|
|
1403
1411
|
setWidth(rect?.width || 0);
|
|
1404
1412
|
}, [inputRef]);
|
|
1405
1413
|
const _onTokenChange = (value2) => {
|
|
1406
|
-
const find = tokens.find((item) => item.symbol === value2);
|
|
1414
|
+
const find = tokens.find((item) => getTokenLabel(item) === value2) ?? tokens.find((item) => item.symbol === value2);
|
|
1407
1415
|
if (find) {
|
|
1408
1416
|
onTokenChange?.(find);
|
|
1409
1417
|
}
|
|
@@ -1432,6 +1440,7 @@ var QuantityInput = (props) => {
|
|
|
1432
1440
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-absolute oui-top-0", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: "2xs", intensity: 36, children: label || t("common.quantity") }) }),
|
|
1433
1441
|
loading && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { className: "oui-absolute oui-bottom-1", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Spinner, { size: "sm" }) })
|
|
1434
1442
|
] });
|
|
1443
|
+
const tokenLabel = token ? getTokenLabel(token) : void 0;
|
|
1435
1444
|
const suffix = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-absolute oui-end-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1436
1445
|
ui.Select.tokens,
|
|
1437
1446
|
{
|
|
@@ -1440,7 +1449,7 @@ var QuantityInput = (props) => {
|
|
|
1440
1449
|
disabled: rest.disabled,
|
|
1441
1450
|
variant: "text",
|
|
1442
1451
|
tokens: tokenOptions,
|
|
1443
|
-
value:
|
|
1452
|
+
value: tokenLabel,
|
|
1444
1453
|
size: rest.size,
|
|
1445
1454
|
onValueChange: _onTokenChange,
|
|
1446
1455
|
showIcon: true,
|
|
@@ -2060,7 +2069,7 @@ var DepositForm = (props) => {
|
|
|
2060
2069
|
ConvertRate,
|
|
2061
2070
|
{
|
|
2062
2071
|
sourceSymbol: sourceToken?.display_name || sourceToken?.symbol,
|
|
2063
|
-
targetSymbol: targetToken?.
|
|
2072
|
+
targetSymbol: targetToken?.symbol,
|
|
2064
2073
|
precision: targetToken?.precision,
|
|
2065
2074
|
swapPrice,
|
|
2066
2075
|
swapPriceInUSD
|
|
@@ -2153,7 +2162,8 @@ var DepositForm = (props) => {
|
|
|
2153
2162
|
tokenValueFormatter: showSourceDepositCap ? tokenValueFormatter : void 0,
|
|
2154
2163
|
disabled: !props.isLoggedIn,
|
|
2155
2164
|
balancesRevalidating: batchBalancesRevalidating,
|
|
2156
|
-
showBalance: true
|
|
2165
|
+
showBalance: true,
|
|
2166
|
+
showDisplayName: true
|
|
2157
2167
|
}
|
|
2158
2168
|
)
|
|
2159
2169
|
] }),
|
|
@@ -2167,7 +2177,8 @@ var DepositForm = (props) => {
|
|
|
2167
2177
|
loading: balanceRevalidating,
|
|
2168
2178
|
onClick: () => {
|
|
2169
2179
|
onQuantityChange(maxDepositAmount);
|
|
2170
|
-
}
|
|
2180
|
+
},
|
|
2181
|
+
showDisplayName: true
|
|
2171
2182
|
}
|
|
2172
2183
|
),
|
|
2173
2184
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6520,7 +6531,8 @@ var WithdrawForm = (props) => {
|
|
|
6520
6531
|
},
|
|
6521
6532
|
token: sourceToken,
|
|
6522
6533
|
value: props.showQty,
|
|
6523
|
-
readOnly: true
|
|
6534
|
+
readOnly: true,
|
|
6535
|
+
showDisplayName: true
|
|
6524
6536
|
}
|
|
6525
6537
|
)
|
|
6526
6538
|
]
|
|
@@ -8189,58 +8201,173 @@ var Dot = (props) => {
|
|
|
8189
8201
|
}
|
|
8190
8202
|
);
|
|
8191
8203
|
};
|
|
8192
|
-
var
|
|
8204
|
+
var blockSpan = 25;
|
|
8205
|
+
var maxAttempts = 2;
|
|
8193
8206
|
async function getEvmBlockTime(chain) {
|
|
8194
8207
|
const provider = new ethers.ethers.JsonRpcProvider(
|
|
8195
8208
|
chain.network_infos.public_rpc_url
|
|
8196
8209
|
);
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8210
|
+
let lastError;
|
|
8211
|
+
try {
|
|
8212
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
8213
|
+
try {
|
|
8214
|
+
const head = await provider.getBlock("latest");
|
|
8215
|
+
if (head?.timestamp == null) {
|
|
8216
|
+
continue;
|
|
8217
|
+
}
|
|
8218
|
+
const tail = await provider.getBlock(head.number - blockSpan);
|
|
8219
|
+
if (tail?.timestamp == null) {
|
|
8220
|
+
continue;
|
|
8221
|
+
}
|
|
8222
|
+
const elapsed = Number(head.timestamp) - Number(tail.timestamp);
|
|
8223
|
+
if (elapsed > 0) {
|
|
8224
|
+
return elapsed / blockSpan;
|
|
8225
|
+
}
|
|
8226
|
+
} catch (error) {
|
|
8227
|
+
lastError = error;
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
console.error(
|
|
8231
|
+
"getEvmBlockTime failed",
|
|
8232
|
+
chain.network_infos.chain_id,
|
|
8233
|
+
lastError ?? "no usable block timestamps"
|
|
8234
|
+
);
|
|
8203
8235
|
return 0;
|
|
8236
|
+
} finally {
|
|
8237
|
+
provider.destroy();
|
|
8204
8238
|
}
|
|
8205
|
-
let sum = 0;
|
|
8206
|
-
for (let i = 0; i < timestamps.length - 1; i++) {
|
|
8207
|
-
const diff = timestamps[i] - timestamps[i + 1];
|
|
8208
|
-
sum += diff;
|
|
8209
|
-
}
|
|
8210
|
-
return sum / (timestamps.length - 1);
|
|
8211
8239
|
}
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
const walletAdapter = new defaultSolanaAdapter.DefaultSolanaWalletAdapter();
|
|
8217
|
-
walletAdapter.active({
|
|
8218
|
-
address: wallet.accounts[0].address,
|
|
8219
|
-
chain: { id: chain.network_infos.chain_id },
|
|
8220
|
-
provider: wallet.provider
|
|
8221
|
-
});
|
|
8222
|
-
const samples = await walletAdapter.connection.getRecentPerformanceSamples(60);
|
|
8240
|
+
var SAMPLE_LIMIT = 60;
|
|
8241
|
+
var SOLANA_RPC_PROXY_PATH = "/v1/solana-rpc-proxy";
|
|
8242
|
+
var RPC_TIMEOUT_MS = 8e3;
|
|
8243
|
+
function averageBlockTimeFromSamples(samples) {
|
|
8223
8244
|
let totalBlockTime = 0;
|
|
8224
8245
|
let validSamples = 0;
|
|
8225
8246
|
for (const sample of samples) {
|
|
8226
8247
|
if (sample.numSlots > 0 && sample.samplePeriodSecs > 0) {
|
|
8227
|
-
|
|
8228
|
-
totalBlockTime += blockTime;
|
|
8248
|
+
totalBlockTime += sample.samplePeriodSecs / sample.numSlots;
|
|
8229
8249
|
validSamples++;
|
|
8230
8250
|
}
|
|
8231
8251
|
}
|
|
8252
|
+
if (validSamples === 0) {
|
|
8253
|
+
return 0;
|
|
8254
|
+
}
|
|
8232
8255
|
return totalBlockTime / validSamples;
|
|
8233
8256
|
}
|
|
8257
|
+
async function fetchBlockTime(connection) {
|
|
8258
|
+
const samples = await connection.getRecentPerformanceSamples(SAMPLE_LIMIT);
|
|
8259
|
+
return averageBlockTimeFromSamples(samples);
|
|
8260
|
+
}
|
|
8261
|
+
function createConnection(url, options2 = {}) {
|
|
8262
|
+
return new web3_js.Connection(url, {
|
|
8263
|
+
commitment: "confirmed",
|
|
8264
|
+
// Avoid ~15s backoff on 429; fail fast and let the caller return 0.
|
|
8265
|
+
disableRetryOnRateLimit: true,
|
|
8266
|
+
fetch: (input, init) => fetch(input, { ...init, signal: AbortSignal.timeout(RPC_TIMEOUT_MS) }),
|
|
8267
|
+
...options2
|
|
8268
|
+
});
|
|
8269
|
+
}
|
|
8270
|
+
function createOrderlyProxyConnection() {
|
|
8271
|
+
const account = core.SimpleDI.get("account");
|
|
8272
|
+
if (!account?.apiBaseUrl || !account.accountId) {
|
|
8273
|
+
return null;
|
|
8274
|
+
}
|
|
8275
|
+
if (!account.keyStore?.getOrderlyKey()) {
|
|
8276
|
+
return null;
|
|
8277
|
+
}
|
|
8278
|
+
return createConnection(`${account.apiBaseUrl}${SOLANA_RPC_PROXY_PATH}`, {
|
|
8279
|
+
// web3.js only wraps fetchMiddleware in a sync try/catch and treats the
|
|
8280
|
+
// 3rd arg as a `next` callback (not fetch). An async throw would hang the
|
|
8281
|
+
// request forever, so always invoke `next` and never return a rejected promise.
|
|
8282
|
+
fetchMiddleware: (info, init, next) => {
|
|
8283
|
+
void (async () => {
|
|
8284
|
+
try {
|
|
8285
|
+
const payload = {
|
|
8286
|
+
url: SOLANA_RPC_PROXY_PATH,
|
|
8287
|
+
method: init?.method ?? "POST",
|
|
8288
|
+
data: JSON.parse(init?.body || "{}")
|
|
8289
|
+
};
|
|
8290
|
+
const signature = await account.signer.sign(payload, utils.getTimestamp());
|
|
8291
|
+
next(info, {
|
|
8292
|
+
...init,
|
|
8293
|
+
headers: {
|
|
8294
|
+
...init?.headers,
|
|
8295
|
+
...signature,
|
|
8296
|
+
"orderly-account-id": account.accountId
|
|
8297
|
+
}
|
|
8298
|
+
});
|
|
8299
|
+
} catch (error) {
|
|
8300
|
+
console.error("solana-rpc-proxy sign failed", error);
|
|
8301
|
+
next(info, init);
|
|
8302
|
+
}
|
|
8303
|
+
})();
|
|
8304
|
+
}
|
|
8305
|
+
});
|
|
8306
|
+
}
|
|
8307
|
+
async function getSolanaBlockTime(chain) {
|
|
8308
|
+
const chainId = Number(chain.network_infos.chain_id);
|
|
8309
|
+
try {
|
|
8310
|
+
if (chainId === types.SOLANA_MAINNET_CHAINID) {
|
|
8311
|
+
const connection = createOrderlyProxyConnection();
|
|
8312
|
+
if (!connection) {
|
|
8313
|
+
return 0;
|
|
8314
|
+
}
|
|
8315
|
+
return await fetchBlockTime(connection);
|
|
8316
|
+
}
|
|
8317
|
+
if (chainId === types.SOLANA_TESTNET_CHAINID) {
|
|
8318
|
+
const rpcUrl = chain.network_infos.public_rpc_url || types.SolanaDevnetChainInfo.public_rpc_url;
|
|
8319
|
+
return await fetchBlockTime(createConnection(rpcUrl));
|
|
8320
|
+
}
|
|
8321
|
+
return 0;
|
|
8322
|
+
} catch (error) {
|
|
8323
|
+
console.error("getSolanaBlockTime failed", chainId, error);
|
|
8324
|
+
return 0;
|
|
8325
|
+
}
|
|
8326
|
+
}
|
|
8234
8327
|
|
|
8235
8328
|
// src/contract/getBlockTime.ts
|
|
8236
8329
|
async function getBlockTime(inputs) {
|
|
8237
|
-
const {
|
|
8330
|
+
const { chain } = inputs;
|
|
8331
|
+
const chainId = Number(inputs.chainId);
|
|
8238
8332
|
if (utils.isSolana(chainId)) {
|
|
8239
|
-
return getSolanaBlockTime(chain
|
|
8333
|
+
return getSolanaBlockTime(chain);
|
|
8240
8334
|
}
|
|
8241
8335
|
return getEvmBlockTime(chain);
|
|
8242
8336
|
}
|
|
8243
8337
|
|
|
8338
|
+
// src/contract/abi/endpointV2Abi.json
|
|
8339
|
+
var endpointV2Abi_default = [
|
|
8340
|
+
{
|
|
8341
|
+
inputs: [
|
|
8342
|
+
{
|
|
8343
|
+
internalType: "address",
|
|
8344
|
+
name: "receiver",
|
|
8345
|
+
type: "address"
|
|
8346
|
+
},
|
|
8347
|
+
{
|
|
8348
|
+
internalType: "uint32",
|
|
8349
|
+
name: "srcEid",
|
|
8350
|
+
type: "uint32"
|
|
8351
|
+
}
|
|
8352
|
+
],
|
|
8353
|
+
name: "getReceiveLibrary",
|
|
8354
|
+
outputs: [
|
|
8355
|
+
{
|
|
8356
|
+
internalType: "address",
|
|
8357
|
+
name: "lib",
|
|
8358
|
+
type: "address"
|
|
8359
|
+
},
|
|
8360
|
+
{
|
|
8361
|
+
internalType: "bool",
|
|
8362
|
+
name: "isDefault",
|
|
8363
|
+
type: "bool"
|
|
8364
|
+
}
|
|
8365
|
+
],
|
|
8366
|
+
stateMutability: "view",
|
|
8367
|
+
type: "function"
|
|
8368
|
+
}
|
|
8369
|
+
];
|
|
8370
|
+
|
|
8244
8371
|
// src/contract/abi/getAppUlnConfigAbi.json
|
|
8245
8372
|
var getAppUlnConfigAbi_default = [
|
|
8246
8373
|
{
|
|
@@ -8326,6 +8453,8 @@ var CHAIN_ID_TO_ENDPOINT_ID = {
|
|
|
8326
8453
|
// Manta Pacific Mainnet
|
|
8327
8454
|
5e3: 30181,
|
|
8328
8455
|
// Mantle Mainnet
|
|
8456
|
+
5003: 40246,
|
|
8457
|
+
// Mantle Sepolia Testnet
|
|
8329
8458
|
81457: 30243,
|
|
8330
8459
|
// Blast Mainnet
|
|
8331
8460
|
252: 30255,
|
|
@@ -8463,6 +8592,8 @@ var CHAIN_ID_TO_ENDPOINT_ID = {
|
|
|
8463
8592
|
// Orderly
|
|
8464
8593
|
291: 30213,
|
|
8465
8594
|
// Orderly Mainnet
|
|
8595
|
+
4460: 40200,
|
|
8596
|
+
// Orderly Testnet
|
|
8466
8597
|
// CoreDAO
|
|
8467
8598
|
1116: 30153,
|
|
8468
8599
|
// CoreDAO Mainnet
|
|
@@ -8650,6 +8781,8 @@ var CHAIN_ID_TO_ENDPOINT_ID = {
|
|
|
8650
8781
|
// X Layer
|
|
8651
8782
|
196: 30274,
|
|
8652
8783
|
// X Layer Mainnet
|
|
8784
|
+
1952: 40416,
|
|
8785
|
+
// X Layer Testnet (xlayer2-testnet)
|
|
8653
8786
|
// XChain
|
|
8654
8787
|
94524: 30291,
|
|
8655
8788
|
// XChain Mainnet
|
|
@@ -8699,31 +8832,168 @@ var CHAIN_ID_TO_ENDPOINT_ID = {
|
|
|
8699
8832
|
// Tron
|
|
8700
8833
|
728126428: 30420,
|
|
8701
8834
|
// Tron Mainnet
|
|
8702
|
-
2494104990: 40420
|
|
8835
|
+
2494104990: 40420,
|
|
8703
8836
|
// Tron Testnet
|
|
8837
|
+
// Newer mainnets (LayerZero metadata)
|
|
8838
|
+
2044: 30148,
|
|
8839
|
+
// Shrapnel Subnet Mainnet
|
|
8840
|
+
2355: 30379,
|
|
8841
|
+
// Silicon Mainnet
|
|
8842
|
+
5031: 30380,
|
|
8843
|
+
// Somnia Mainnet
|
|
8844
|
+
484: 30381,
|
|
8845
|
+
// Camp Mainnet
|
|
8846
|
+
6985385: 30382,
|
|
8847
|
+
// Humanity Mainnet
|
|
8848
|
+
9745: 30383,
|
|
8849
|
+
// Plasma Mainnet
|
|
8850
|
+
9069: 30384,
|
|
8851
|
+
// Apex Fusion Nexus Mainnet
|
|
8852
|
+
202110: 30385,
|
|
8853
|
+
// Dinari Mainnet
|
|
8854
|
+
1408: 30386,
|
|
8855
|
+
// zkVerify Mainnet
|
|
8856
|
+
16661: 30388,
|
|
8857
|
+
// 0G Mainnet
|
|
8858
|
+
10088: 30389,
|
|
8859
|
+
// GateLayer Mainnet
|
|
8860
|
+
143: 30390,
|
|
8861
|
+
// Monad Mainnet
|
|
8862
|
+
5064014: 30391,
|
|
8863
|
+
// Ethereal Mainnet
|
|
8864
|
+
1612: 30392,
|
|
8865
|
+
// Openledger Mainnet
|
|
8866
|
+
97477: 30393,
|
|
8867
|
+
// Doma Mainnet
|
|
8868
|
+
1776: 30394,
|
|
8869
|
+
// Injective EVM Mainnet
|
|
8870
|
+
988: 30396,
|
|
8871
|
+
// Stable Mainnet
|
|
8872
|
+
261131: 30397,
|
|
8873
|
+
// Zama Mainnet
|
|
8874
|
+
4326: 30398,
|
|
8875
|
+
// MegaETH Mainnet
|
|
8876
|
+
26514: 30399,
|
|
8877
|
+
// Horizen Mainnet
|
|
8878
|
+
4153: 30401,
|
|
8879
|
+
// Rise Mainnet
|
|
8880
|
+
151: 30402,
|
|
8881
|
+
// Redbelly Mainnet
|
|
8882
|
+
4114: 30403,
|
|
8883
|
+
// Citrea Mainnet
|
|
8884
|
+
2288: 30404,
|
|
8885
|
+
// Moca Mainnet
|
|
8886
|
+
2366: 30406,
|
|
8887
|
+
// Kite Mainnet
|
|
8888
|
+
1672: 30407,
|
|
8889
|
+
// Pharos Mainnet
|
|
8890
|
+
3282: 30408,
|
|
8891
|
+
// Irys Mainnet
|
|
8892
|
+
88888: 30409,
|
|
8893
|
+
// Chiliz Mainnet
|
|
8894
|
+
4217: 30410,
|
|
8895
|
+
// Tempo Mainnet
|
|
8896
|
+
685689: 30412,
|
|
8897
|
+
// Gensyn Mainnet
|
|
8898
|
+
904: 30413,
|
|
8899
|
+
// Ault Mainnet
|
|
8900
|
+
47763: 30414,
|
|
8901
|
+
// Neox Mainnet
|
|
8902
|
+
72957: 30415,
|
|
8903
|
+
// Rayls Mainnet
|
|
8904
|
+
4663: 30416,
|
|
8905
|
+
// Robinhood Chain Mainnet
|
|
8906
|
+
46630: 40451,
|
|
8907
|
+
// Robinhood Chain Testnet
|
|
8908
|
+
5042: 30417,
|
|
8909
|
+
// Arc Mainnet
|
|
8910
|
+
36900: 30418,
|
|
8911
|
+
// ADI Mainnet (permissionless LayerZero deployment, not in official docs; verified on-chain via RelayV2 endpoint())
|
|
8912
|
+
99999: 40462,
|
|
8913
|
+
// ADI Network AB Testnet
|
|
8914
|
+
222: 30464,
|
|
8915
|
+
// Opn Mainnet
|
|
8916
|
+
6714: 30465,
|
|
8917
|
+
// Anubis Mainnet
|
|
8918
|
+
4352: 30466,
|
|
8919
|
+
// MemeCore Mainnet
|
|
8920
|
+
177: 30467
|
|
8921
|
+
// HashKey Mainnet
|
|
8704
8922
|
};
|
|
8705
8923
|
function getEndpointId(chainId) {
|
|
8706
8924
|
return CHAIN_ID_TO_ENDPOINT_ID[chainId];
|
|
8707
8925
|
}
|
|
8708
8926
|
|
|
8927
|
+
// src/contract/layerzeroConfig.ts
|
|
8928
|
+
var ORDERLY_RPC_URL = {
|
|
8929
|
+
mainnet: "https://rpc.orderly.network",
|
|
8930
|
+
testnet: "https://testnet-rpc.orderly.org"
|
|
8931
|
+
};
|
|
8932
|
+
var ORDERLY_ENDPOINT_V2 = {
|
|
8933
|
+
mainnet: "0x1a44076050125825900e736c501f859c50fE728c",
|
|
8934
|
+
testnet: "0x6EDCE65403992e310A62460808c4b910D972f10f"
|
|
8935
|
+
};
|
|
8936
|
+
var ORDERLY_RELAY_OAPP = {
|
|
8937
|
+
mainnet: "0x461C12FBa639303Da045255dd32eEa7E38AC69b0",
|
|
8938
|
+
testnet: "0xe907d027F6E62794021b9839B4D234618d11Ebab"
|
|
8939
|
+
};
|
|
8940
|
+
var ORDERLY_SOL_PEER_OAPP = {
|
|
8941
|
+
mainnet: "0xCecAe061aa078e13b5e70D5F9eCee90a3F2B6AeA",
|
|
8942
|
+
testnet: "0x5Bf771A65d057e778C5f0Ed52A0003316f94322D"
|
|
8943
|
+
};
|
|
8944
|
+
function getOrderlyNetworkKey(isMainnet) {
|
|
8945
|
+
return isMainnet ? "mainnet" : "testnet";
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8709
8948
|
// src/contract/getChainConfirmations.ts
|
|
8710
8949
|
async function getChainConfirmations(chain) {
|
|
8711
8950
|
const chainId = chain.network_infos.chain_id;
|
|
8712
8951
|
const isMainnet = chain.network_infos.mainnet;
|
|
8713
|
-
const
|
|
8714
|
-
const
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
const
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8952
|
+
const networkKey = getOrderlyNetworkKey(isMainnet);
|
|
8953
|
+
const sourceEid = getEndpointId(chainId);
|
|
8954
|
+
if (!sourceEid) {
|
|
8955
|
+
return 0;
|
|
8956
|
+
}
|
|
8957
|
+
const oapp = resolveDepositOApp(chainId, networkKey);
|
|
8958
|
+
const provider = new ethers.ethers.JsonRpcProvider(ORDERLY_RPC_URL[networkKey]);
|
|
8959
|
+
try {
|
|
8960
|
+
const endpoint = new ethers.ethers.Contract(
|
|
8961
|
+
ORDERLY_ENDPOINT_V2[networkKey],
|
|
8962
|
+
endpointV2Abi_default,
|
|
8963
|
+
provider
|
|
8964
|
+
);
|
|
8965
|
+
const [receiveLibAddress] = await endpoint.getReceiveLibrary(
|
|
8966
|
+
oapp,
|
|
8967
|
+
sourceEid
|
|
8968
|
+
);
|
|
8969
|
+
if (!receiveLibAddress || receiveLibAddress === ethers.ethers.ZeroAddress) {
|
|
8970
|
+
return 0;
|
|
8971
|
+
}
|
|
8972
|
+
const receiveLib = new ethers.ethers.Contract(
|
|
8973
|
+
receiveLibAddress,
|
|
8974
|
+
getAppUlnConfigAbi_default,
|
|
8975
|
+
provider
|
|
8976
|
+
);
|
|
8977
|
+
const config = await receiveLib.getAppUlnConfig(oapp, sourceEid);
|
|
8978
|
+
const confirmations = Number(config.confirmations || 0);
|
|
8979
|
+
if (confirmations > 0) {
|
|
8980
|
+
return confirmations;
|
|
8981
|
+
}
|
|
8982
|
+
const defaultConfig = await receiveLib.getAppUlnConfig(
|
|
8983
|
+
ethers.ethers.ZeroAddress,
|
|
8984
|
+
sourceEid
|
|
8985
|
+
);
|
|
8986
|
+
return Number(defaultConfig.confirmations || 0);
|
|
8987
|
+
} catch (error) {
|
|
8988
|
+
console.error("getChainConfirmations error", error);
|
|
8989
|
+
return 0;
|
|
8990
|
+
}
|
|
8991
|
+
}
|
|
8992
|
+
function resolveDepositOApp(chainId, networkKey) {
|
|
8993
|
+
if (utils.isSolana(chainId)) {
|
|
8994
|
+
return ORDERLY_SOL_PEER_OAPP[networkKey];
|
|
8995
|
+
}
|
|
8996
|
+
return ORDERLY_RELAY_OAPP[networkKey];
|
|
8727
8997
|
}
|
|
8728
8998
|
|
|
8729
8999
|
// src/contract/useTransactionTime.ts
|
|
@@ -8733,7 +9003,6 @@ var useTransactionTime = (chainId) => {
|
|
|
8733
9003
|
const timeMap = react.useRef({});
|
|
8734
9004
|
const confirmationsMap = react.useRef({});
|
|
8735
9005
|
const [, { findByChainId }] = hooks.useChains();
|
|
8736
|
-
const { wallet } = hooks.useWalletConnector();
|
|
8737
9006
|
const chain = react.useMemo(() => {
|
|
8738
9007
|
if (!chainId) {
|
|
8739
9008
|
return;
|
|
@@ -8742,7 +9011,7 @@ var useTransactionTime = (chainId) => {
|
|
|
8742
9011
|
return findByChainId(id);
|
|
8743
9012
|
}, [chainId, findByChainId]);
|
|
8744
9013
|
react.useEffect(() => {
|
|
8745
|
-
if (!chain
|
|
9014
|
+
if (!chain) {
|
|
8746
9015
|
return;
|
|
8747
9016
|
}
|
|
8748
9017
|
const chainId2 = chain.network_infos.chain_id;
|
|
@@ -8751,8 +9020,7 @@ var useTransactionTime = (chainId) => {
|
|
|
8751
9020
|
} else {
|
|
8752
9021
|
getBlockTime({
|
|
8753
9022
|
chainId: chainId2,
|
|
8754
|
-
chain
|
|
8755
|
-
wallet
|
|
9023
|
+
chain
|
|
8756
9024
|
}).then((time) => {
|
|
8757
9025
|
console.log("average block time", chainId2, time);
|
|
8758
9026
|
setBlockTime(time);
|
|
@@ -8772,7 +9040,7 @@ var useTransactionTime = (chainId) => {
|
|
|
8772
9040
|
console.error("getChainConfirmations error", error);
|
|
8773
9041
|
});
|
|
8774
9042
|
}
|
|
8775
|
-
}, [chain
|
|
9043
|
+
}, [chain]);
|
|
8776
9044
|
const transactionTime = react.useMemo(() => {
|
|
8777
9045
|
if (blockTime && confirmations) {
|
|
8778
9046
|
return blockTime * confirmations;
|
|
@@ -8921,8 +9189,13 @@ function useDepositStatusScript() {
|
|
|
8921
9189
|
onClose
|
|
8922
9190
|
};
|
|
8923
9191
|
}
|
|
9192
|
+
var MIN_ESTIMATED_SECONDS = 30;
|
|
9193
|
+
var MAX_ESTIMATED_SECONDS = 30 * 60;
|
|
8924
9194
|
function formatEstimatedTime(totalSeconds) {
|
|
8925
|
-
const sec = Math.
|
|
9195
|
+
const sec = Math.min(
|
|
9196
|
+
MAX_ESTIMATED_SECONDS,
|
|
9197
|
+
Math.max(MIN_ESTIMATED_SECONDS, totalSeconds)
|
|
9198
|
+
);
|
|
8926
9199
|
let minutes = Math.floor(sec / 60);
|
|
8927
9200
|
let seconds = sec % 60;
|
|
8928
9201
|
if (seconds > 0 && seconds <= 30) {
|