@bze/bze-ui-kit 1.0.4 → 1.0.6
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 +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -594,6 +594,10 @@ var getChainExplorerURL = (chainName) => {
|
|
|
594
594
|
var getLockerAddress = () => {
|
|
595
595
|
return process.env.NEXT_PUBLIC_LOCKER_ADDRESS || "bze1pc5zjcvhx3e8l305zjl72grytfa30r5mdypmw4";
|
|
596
596
|
};
|
|
597
|
+
var getGasMultiplier = () => {
|
|
598
|
+
const val = parseFloat(process.env.NEXT_PUBLIC_GAS_MULTIPLIER || "");
|
|
599
|
+
return isNaN(val) || val <= 0 ? 1.5 : val;
|
|
600
|
+
};
|
|
597
601
|
|
|
598
602
|
// src/storage/storage.ts
|
|
599
603
|
var TTL_NO_EXPIRY = 0;
|
|
@@ -4220,10 +4224,14 @@ var useTx = (chainName) => {
|
|
|
4220
4224
|
return { typeUrl, value: encodedValue };
|
|
4221
4225
|
});
|
|
4222
4226
|
const txBody = import_tx13.TxBody.fromPartial({ messages: encodedMessages, memo: memo != null ? memo : "" });
|
|
4223
|
-
const
|
|
4227
|
+
const sequence = await signer.getSequence(address);
|
|
4228
|
+
const signerInfo = import_tx13.SignerInfo.fromPartial({ modeInfo: { single: { mode: 1 } }, sequence });
|
|
4224
4229
|
const { gasInfo } = await signer.simulateByTxBody(txBody, [signerInfo]);
|
|
4225
4230
|
const gasEstimated = Number((_a2 = gasInfo == null ? void 0 : gasInfo.gasUsed) != null ? _a2 : BigInt(0));
|
|
4226
|
-
|
|
4231
|
+
if (gasEstimated === 0) {
|
|
4232
|
+
throw new Error("Gas simulation returned 0");
|
|
4233
|
+
}
|
|
4234
|
+
const gasAmount = (0, import_bignumber13.default)(gasEstimated).multipliedBy(getGasMultiplier());
|
|
4227
4235
|
const gasPayment = gasAmount.multipliedBy(gasPrice);
|
|
4228
4236
|
const nativeFee = {
|
|
4229
4237
|
amount: coins(gasPayment.toFixed(0).toString(), nativeDenom),
|
|
@@ -4258,12 +4266,8 @@ var useTx = (chainName) => {
|
|
|
4258
4266
|
return await simulateFee(messages, options == null ? void 0 : options.memo);
|
|
4259
4267
|
}
|
|
4260
4268
|
} catch (e) {
|
|
4261
|
-
console.error("could not get fee: ", e);
|
|
4262
|
-
|
|
4263
|
-
return defaultFee;
|
|
4264
|
-
} else {
|
|
4265
|
-
throw e;
|
|
4266
|
-
}
|
|
4269
|
+
console.error("could not get fee, using default fee: ", e);
|
|
4270
|
+
return defaultFee;
|
|
4267
4271
|
}
|
|
4268
4272
|
}, [simulateFee]);
|
|
4269
4273
|
const tx = (0, import_react16.useCallback)(async (msgs, options) => {
|