xflows 1.3.2 → 1.3.3
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 +27 -4
- 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.3",
|
|
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(`
|
|
@@ -19273,7 +19279,24 @@ Checking token approval for ${spender}...`);
|
|
|
19273
19279
|
return;
|
|
19274
19280
|
}
|
|
19275
19281
|
console.log(`
|
|
19276
|
-
|
|
19282
|
+
Estimating gas...`);
|
|
19283
|
+
try {
|
|
19284
|
+
const estimatedGas = await provider.estimateGas({
|
|
19285
|
+
...txRequest,
|
|
19286
|
+
from: wallet.address
|
|
19287
|
+
});
|
|
19288
|
+
if (!txRequest.gasLimit) {
|
|
19289
|
+
txRequest.gasLimit = estimatedGas * 120n / 100n;
|
|
19290
|
+
}
|
|
19291
|
+
console.log(`Estimated gas: ${estimatedGas.toString()}`);
|
|
19292
|
+
} catch (err) {
|
|
19293
|
+
const reason = err.reason || err.shortMessage || err.message;
|
|
19294
|
+
console.error(`
|
|
19295
|
+
Transaction will fail: ${reason}`);
|
|
19296
|
+
console.error("The transaction was NOT sent.");
|
|
19297
|
+
process.exit(1);
|
|
19298
|
+
}
|
|
19299
|
+
console.log("Sending transaction...");
|
|
19277
19300
|
const sentTx = await signer.sendTransaction(txRequest);
|
|
19278
19301
|
console.log(`Transaction hash: ${sentTx.hash}`);
|
|
19279
19302
|
console.log("Waiting for confirmation...");
|