xflows 1.3.2 → 1.3.4
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.js +37 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18684,7 +18684,7 @@ import * as readline from "readline";
|
|
|
18684
18684
|
// package.json
|
|
18685
18685
|
var package_default = {
|
|
18686
18686
|
name: "xflows",
|
|
18687
|
-
version: "1.3.
|
|
18687
|
+
version: "1.3.4",
|
|
18688
18688
|
description: "CLI tool for Wanchain XFlows cross-chain bridge - wallet management, quote queries, and cross-chain transactions",
|
|
18689
18689
|
type: "module",
|
|
18690
18690
|
bin: {
|
|
@@ -19193,13 +19193,19 @@ program2.command("send").description(`Build and send a cross-chain transaction
|
|
|
19193
19193
|
if (quote.nativeFees?.length) {
|
|
19194
19194
|
console.log(`Native fees:`);
|
|
19195
19195
|
for (const f2 of quote.nativeFees) {
|
|
19196
|
-
|
|
19196
|
+
const amount = f2.nativeFeeAmount ?? f2.amount;
|
|
19197
|
+
const symbol = f2.nativeFeeSymbol ?? f2.symbol;
|
|
19198
|
+
const decimals = f2.nativeFeeDecimals ?? f2.decimals ?? 18;
|
|
19199
|
+
console.log(` ${formatUnits(amount, decimals)} ${symbol}`);
|
|
19197
19200
|
}
|
|
19198
19201
|
}
|
|
19199
19202
|
if (quote.tokenFees?.length) {
|
|
19200
19203
|
console.log(`Token fees:`);
|
|
19201
19204
|
for (const f2 of quote.tokenFees) {
|
|
19202
|
-
|
|
19205
|
+
const amount = f2.tokenFeeAmount ?? f2.amount;
|
|
19206
|
+
const symbol = f2.tokenFeeSymbol ?? f2.symbol;
|
|
19207
|
+
const decimals = f2.tokenFeeDecimals ?? f2.decimals ?? 18;
|
|
19208
|
+
console.log(` ${formatUnits(amount, decimals)} ${symbol}`);
|
|
19203
19209
|
}
|
|
19204
19210
|
}
|
|
19205
19211
|
console.log(`
|
|
@@ -19272,8 +19278,34 @@ Checking token approval for ${spender}...`);
|
|
|
19272
19278
|
printJson(txRequest);
|
|
19273
19279
|
return;
|
|
19274
19280
|
}
|
|
19275
|
-
|
|
19276
|
-
|
|
19281
|
+
if (opts.gasLimit) {
|
|
19282
|
+
console.log(`
|
|
19283
|
+
Using manual gas limit: ${opts.gasLimit}`);
|
|
19284
|
+
} else {
|
|
19285
|
+
console.log(`
|
|
19286
|
+
Estimating gas...`);
|
|
19287
|
+
try {
|
|
19288
|
+
const estimatedGas = await provider.estimateGas({
|
|
19289
|
+
...txRequest,
|
|
19290
|
+
from: wallet.address
|
|
19291
|
+
});
|
|
19292
|
+
txRequest.gasLimit = estimatedGas * 120n / 100n;
|
|
19293
|
+
console.log(`Estimated gas: ${estimatedGas.toString()}`);
|
|
19294
|
+
} catch (err) {
|
|
19295
|
+
const reason = err.reason || err.shortMessage || err.message;
|
|
19296
|
+
console.error(`
|
|
19297
|
+
Transaction will fail: ${reason}`);
|
|
19298
|
+
if (!err.reason || err.reason === "require(false)") {
|
|
19299
|
+
console.error("Hint: The contract reverted without a reason. This may indicate:");
|
|
19300
|
+
console.error(" - The bridge storeman group is temporarily unavailable");
|
|
19301
|
+
console.error(" - The token pair or route is not supported at this time");
|
|
19302
|
+
console.error(" - Insufficient token balance for the requested amount");
|
|
19303
|
+
}
|
|
19304
|
+
console.error("The transaction was NOT sent. Use --gas-limit to force send.");
|
|
19305
|
+
process.exit(1);
|
|
19306
|
+
}
|
|
19307
|
+
}
|
|
19308
|
+
console.log("Sending transaction...");
|
|
19277
19309
|
const sentTx = await signer.sendTransaction(txRequest);
|
|
19278
19310
|
console.log(`Transaction hash: ${sentTx.hash}`);
|
|
19279
19311
|
console.log("Waiting for confirmation...");
|