btc-wallet 0.5.41-beta → 0.5.43-beta

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/esm/index.js CHANGED
@@ -3259,6 +3259,22 @@ function getWhitelist(url) {
3259
3259
  return data;
3260
3260
  });
3261
3261
  }
3262
+ function receiveWithdrawMsg(url, txHash) {
3263
+ return __async(this, null, function* () {
3264
+ const { result_code, result_message, result_data } = yield request(
3265
+ `${url}/v1/receiveWithdrawMsg`,
3266
+ {
3267
+ method: "POST",
3268
+ body: { txHash }
3269
+ }
3270
+ );
3271
+ console.log("receiveWithdrawMsg resp:", { result_code, result_message, result_data });
3272
+ if (result_code !== 0) {
3273
+ throw new Error(result_message);
3274
+ }
3275
+ return result_data;
3276
+ });
3277
+ }
3262
3278
  function getAccountInfo(_0) {
3263
3279
  return __async(this, arguments, function* ({ csna, env }) {
3264
3280
  const config = getWalletConfig(env);
@@ -3874,7 +3890,7 @@ function calculateGasFee(account, amount, feeRate) {
3874
3890
  return fee;
3875
3891
  });
3876
3892
  }
3877
- function getBtcBalance(account, option) {
3893
+ function getBtcBalance(account) {
3878
3894
  return __async(this, null, function* () {
3879
3895
  if (!account) {
3880
3896
  const res = yield retryOperation(getBtcProvider, (res2) => !!res2.account);
@@ -3889,11 +3905,7 @@ function getBtcBalance(account, option) {
3889
3905
  const rawBalance = (utxos == null ? void 0 : utxos.reduce((acc, cur) => acc + cur.value, 0)) || 0;
3890
3906
  const balance = rawBalance / __pow(10, btcDecimals);
3891
3907
  const estimatedFee = yield calculateGasFee(account, rawBalance);
3892
- let availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3893
- if (option == null ? void 0 : option.csna) {
3894
- const { protocolFee, repayAmount } = yield getDepositAmount(rawBalance.toString(), option);
3895
- availableRawBalance = new Big2(availableRawBalance).minus(protocolFee).minus(repayAmount).toFixed(0);
3896
- }
3908
+ const availableRawBalance = (rawBalance - estimatedFee).toFixed(0);
3897
3909
  const availableBalance = new Big2(availableRawBalance).div(__pow(10, btcDecimals)).round(btcDecimals, Big2.roundDown).toNumber();
3898
3910
  return {
3899
3911
  rawBalance,
@@ -4854,7 +4866,7 @@ function getGroup(state) {
4854
4866
 
4855
4867
  // src/index.ts
4856
4868
  var getVersion = () => {
4857
- return "0.5.41-beta";
4869
+ return "0.5.43-beta";
4858
4870
  };
4859
4871
  if (typeof window !== "undefined") {
4860
4872
  window.__BTC_WALLET_VERSION = getVersion();
@@ -4876,20 +4888,35 @@ export {
4876
4888
  btcRpcUrls,
4877
4889
  calculateGasFee,
4878
4890
  calculateGasLimit,
4891
+ calculateGasStrategy,
4879
4892
  calculateWithdraw,
4893
+ checkBridgeTransactionStatus,
4894
+ checkBtcTransactionStatus,
4895
+ checkGasTokenBalance,
4880
4896
  checkGasTokenDebt,
4881
4897
  checkSatoshiWhitelist,
4898
+ convertTransactionToTxHex,
4882
4899
  estimateDepositAmount,
4883
4900
  executeBTCDepositAndAction,
4901
+ getAccountInfo,
4902
+ getBridgeConfig,
4884
4903
  getBtcBalance,
4885
4904
  getBtcGasPrice,
4886
4905
  getBtcUtxos,
4887
4906
  getCsnaAccountId,
4888
4907
  getDepositAmount,
4908
+ getNearNonce,
4909
+ getNonce,
4910
+ getTokenBalance,
4889
4911
  getVersion,
4890
4912
  getWalletConfig,
4913
+ getWhitelist,
4891
4914
  getWithdrawTransaction,
4892
4915
  nearRpcUrls,
4916
+ preReceiveDepositMsg,
4917
+ receiveDepositMsg,
4918
+ receiveTransaction,
4919
+ receiveWithdrawMsg,
4893
4920
  sendBitcoin,
4894
4921
  setupBTCWallet,
4895
4922
  setupWalletSelectorModal,