btc-wallet 0.3.20 → 0.3.21

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.
@@ -1,3 +1,4 @@
1
+ import type { FinalExecutionOutcome } from '@near-wallet-selector/core';
1
2
  export interface DebtInfo {
2
3
  gas_token_id: string;
3
4
  transfer_amount: string;
@@ -40,19 +41,21 @@ export declare function getDepositAmount(amount: string, option?: {
40
41
  receiveAmount: number;
41
42
  fee: number;
42
43
  }>;
43
- interface ExecuteBTCDepositAndActionParams {
44
+ interface ExecuteBTCDepositAndActionParams<T extends boolean = true> {
44
45
  action?: {
45
46
  receiver_id: string;
46
47
  amount: string;
47
48
  msg: string;
48
49
  };
49
50
  amount?: string;
50
- /** fee rate, if not provided, will use the recommended fee rate from the btc node */
51
51
  feeRate?: number;
52
- /** fixed amount, if true, in arrears mode, amount is fixed, otherwise it is depositAmount-repayAction.amount */
53
52
  fixedAmount?: boolean;
54
- /** is dev environment */
55
53
  isDev?: boolean;
54
+ pollResult?: T;
56
55
  }
57
- export declare function executeBTCDepositAndAction({ action, amount, feeRate, fixedAmount, isDev, }: ExecuteBTCDepositAndActionParams): Promise<any[]>;
56
+ /**
57
+ * @param T - if true, return the poll result, otherwise return the btcTxHash
58
+ */
59
+ type ExecuteBTCDepositAndActionReturn<T extends boolean> = T extends true ? FinalExecutionOutcome[] : string;
60
+ export declare function executeBTCDepositAndAction<T extends boolean = true>({ action, amount, feeRate, fixedAmount, pollResult, isDev, }: ExecuteBTCDepositAndActionParams<T>): Promise<ExecuteBTCDepositAndActionReturn<T>>;
58
61
  export {};
package/dist/index.js CHANGED
@@ -3387,6 +3387,7 @@ function executeBTCDepositAndAction(_0) {
3387
3387
  amount,
3388
3388
  feeRate,
3389
3389
  fixedAmount = true,
3390
+ pollResult = true,
3390
3391
  isDev = false
3391
3392
  }) {
3392
3393
  var _a;
@@ -3470,6 +3471,9 @@ function executeBTCDepositAndAction(_0) {
3470
3471
  postActions: postActionsStr,
3471
3472
  extraMsg: depositMsg.extra_msg
3472
3473
  });
3474
+ if (!pollResult) {
3475
+ return txHash;
3476
+ }
3473
3477
  const checkTransactionStatusRes = yield checkBridgeTransactionStatus(config.base_url, txHash);
3474
3478
  console.log("checkBridgeTransactionStatus resp:", checkTransactionStatusRes);
3475
3479
  const network = yield getNetwork();
@@ -3967,7 +3971,7 @@ function setupBTCWallet({
3967
3971
 
3968
3972
  // src/index.ts
3969
3973
  var getVersion = () => {
3970
- return "0.3.20";
3974
+ return "0.3.21";
3971
3975
  };
3972
3976
  if (typeof window !== "undefined") {
3973
3977
  window.__BTC_WALLET_VERSION = getVersion();