btc-wallet 0.4.3-beta → 0.4.4-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/dist/index.js CHANGED
@@ -479,39 +479,11 @@ var XverseConnector = class extends BaseConnector {
479
479
  if (!provider) {
480
480
  throw new Error(`${this.metadata.name} is not install!`);
481
481
  }
482
- const { sendBtcTransaction } = yield import("sats-connect");
483
- const addresses = yield this.getAccounts();
484
- if (addresses.length === 0) {
485
- throw new Error(`${this.metadata.name} not connected!`);
486
- }
487
- const result = yield new Promise((resolve, reject) => {
488
- const sendBtcOptions = {
489
- payload: {
490
- network: {
491
- type: __privateGet(this, _network)
492
- },
493
- recipients: [
494
- {
495
- address: toAddress,
496
- amountSats: BigInt(satoshis)
497
- }
498
- ],
499
- senderAddress: addresses[0]
500
- },
501
- onFinish: (response) => {
502
- resolve(response);
503
- },
504
- onCancel: () => {
505
- reject({
506
- code: 4001,
507
- message: "User rejected the request."
508
- });
509
- }
510
- };
511
- console.log("\u{1F680} ~ XverseConnector ~ sendBitcoin ~ sendBtcOptions:", sendBtcOptions);
512
- sendBtcTransaction(sendBtcOptions).catch((e) => reject(e));
482
+ const { result } = yield provider.request("sendTransfer", {
483
+ recipients: [{ address: toAddress, amount: satoshis }]
513
484
  });
514
- return result;
485
+ console.log("\u{1F680} ~ XverseConnector ~ sendBitcoin ~ res:", result);
486
+ return result.txid;
515
487
  });
516
488
  }
517
489
  disconnect() {
@@ -3497,18 +3469,11 @@ function executeBTCDepositAndAction(_0) {
3497
3469
  gas: GAS_LIMIT
3498
3470
  }));
3499
3471
  }
3500
- if (action || !action && new import_big.default((accountInfo == null ? void 0 : accountInfo.gas_token[config.token]) || 0).lt(MINIMUM_DEPOSIT_AMOUNT_BASE)) {
3501
- newActions.push(
3502
- action ? __spreadProps(__spreadValues({}, action), {
3503
- amount: (arrearsAction == null ? void 0 : arrearsAction.amount) && !fixedAmount ? new import_big.default(receiveAmount).minus(arrearsAction.amount).toString() : receiveAmount.toString(),
3504
- gas: GAS_LIMIT
3505
- }) : {
3506
- receiver_id: config.accountContractId,
3507
- amount: MINIMUM_DEPOSIT_AMOUNT_BASE.toString(),
3508
- msg: JSON.stringify("Deposit"),
3509
- gas: GAS_LIMIT
3510
- }
3511
- );
3472
+ if (action) {
3473
+ newActions.push(__spreadProps(__spreadValues({}, action), {
3474
+ amount: (arrearsAction == null ? void 0 : arrearsAction.amount) && !fixedAmount ? new import_big.default(receiveAmount).minus(arrearsAction.amount).toString() : receiveAmount.toString(),
3475
+ gas: GAS_LIMIT
3476
+ }));
3512
3477
  }
3513
3478
  const storageDepositMsg = {};
3514
3479
  const registerRes = yield nearCall((action == null ? void 0 : action.receiver_id) || config.token, "storage_balance_of", {
@@ -3892,7 +3857,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
3892
3857
  args: {
3893
3858
  receiver_id: currentConfig.accountContractId,
3894
3859
  amount,
3895
- msg: JSON.stringify("Deposit")
3860
+ msg: JSON.stringify("Repay")
3896
3861
  },
3897
3862
  gas: new import_big2.default(50).mul(__pow(10, 12)).toFixed(0),
3898
3863
  deposit: "1"
@@ -4061,7 +4026,7 @@ function setupBTCWallet({
4061
4026
 
4062
4027
  // src/index.ts
4063
4028
  var getVersion = () => {
4064
- return "0.4.3-beta";
4029
+ return "0.4.4-beta";
4065
4030
  };
4066
4031
  if (typeof window !== "undefined") {
4067
4032
  window.__BTC_WALLET_VERSION = getVersion();