btc-wallet 0.5.53-beta → 0.5.56-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/README.md CHANGED
@@ -30,15 +30,24 @@ const selector = await setupWalletSelector({
30
30
  deprecated?: boolean, // optional: mark as deprecated
31
31
  autoConnect?: boolean, // optional: enable auto-connect, defaults to true
32
32
  syncLogOut?: boolean, // optional: sync logout across tabs, defaults to true
33
- env?: 'mainnet' | 'testnet' | 'private_mainnet' | 'dev' // optional: defaults to NEAR network environment
33
+ env?: 'mainnet' | 'testnet' | 'private_mainnet' | 'dev', // optional: defaults to NEAR network environment
34
+ gasStrategy?: 'auto' | 'near' | 'btc' // optional: specify gas payment strategy, defaults to 'auto'
35
+ // 'auto': use NEAR if balance > 0.5, otherwise use BTC token
36
+ // 'near': force use NEAR for gas payment
37
+ // 'btc': force use BTC token for gas payment
34
38
  }),
35
39
  // setup other wallets...
36
40
  ],
37
41
  });
38
42
 
39
- // 2. Setup wallet selector modal,params see setupModal @near-wallet-selector/modal-ui
43
+ // 2. Setup wallet selector modal
44
+ // Note: For enhanced functionality, use setupWalletSelectorModal exported from btc-wallet
45
+ // If using setupModal from @near-wallet-selector/modal-ui, the showChainGroups and showWalletUIForNearAccount parameters below are not supported
40
46
  setupWalletSelectorModal(selector, {
41
- contractId:'xxx.near',
47
+ contractId: 'xxx.near',
48
+ showChainGroups?: boolean, // optional: show chain group selection, defaults to true
49
+ showWalletUIForNearAccount?: boolean, // optional: show wallet UI for regular NEAR accounts, defaults to true
50
+ env?: 'mainnet' | 'testnet' | 'private_mainnet' | 'dev', // optional: defaults to NEAR network environment
42
51
  });
43
52
 
44
53
  // 3. Wrap your app with BtcWalletSelectorContextProvider
@@ -62,18 +71,18 @@ Execute a native BTC deposit to receive corresponding BTC tokens on NEAR through
62
71
  interface ExecuteBTCDepositAndActionParams<T extends boolean = true> {
63
72
  // Option 1: For dApp one-click BTC deposit and action
64
73
  action?: {
65
- receiver_id: string; // receiver account on NEAR
66
- amount: string; // amount to deposit
67
- msg: string; // message for the transaction
74
+ receiver_id: string; // receiver account on NEAR
75
+ amount: string; // amount to deposit
76
+ msg: string; // message for the transaction
68
77
  };
69
-
78
+
70
79
  // Option 2: For direct Satoshi bridge deposit
71
- amount?: string; // amount to deposit to Satoshi bridge
72
-
80
+ amount?: string; // amount to deposit to Satoshi bridge
81
+
73
82
  // Common optional parameters
74
- feeRate?: number; // optional: custom fee rate for the BTC transaction
83
+ feeRate?: number; // optional: custom fee rate for the BTC transaction
75
84
  env?: 'mainnet' | 'testnet' | 'private_mainnet' | 'dev'; // optional: defaults to NEAR network environment
76
- pollResult?: T; // optional: whether to poll for transaction result
85
+ pollResult?: T; // optional: whether to poll for transaction result
77
86
  registerDeposit?: string; // optional: whether to register deposit,default 0.000125 NEAR
78
87
  newAccountMinDepositAmount?: boolean; // default is true, if true, new account minimum deposit BTC amount 1000sat, otherwise 0
79
88
  registerContractId?: string; // if registerContractId is provided, it will be used to register the contract, otherwise it will be the default contract id
@@ -84,15 +93,15 @@ await executeBTCDepositAndAction({
84
93
  action: {
85
94
  receiver_id: 'token.near',
86
95
  amount: '1000000',
87
- msg: 'ft_transfer_call message' // ft_transfer_call message
96
+ msg: 'ft_transfer_call message', // ft_transfer_call message
88
97
  },
89
- registerDeposit: '100000000000000000000000', // default 0.000125 NEAR, you can set it according to your needs
98
+ registerDeposit: '100000000000000000000000', // default 0.000125 NEAR, you can set it according to your needs
90
99
  });
91
100
 
92
101
  // Example 2: Direct Satoshi bridge deposit
93
102
  await executeBTCDepositAndAction({
94
- amount: '1000000', // amount to deposit to Satoshi bridge
95
- feeRate: 5
103
+ amount: '1000000', // amount to deposit to Satoshi bridge
104
+ feeRate: 5,
96
105
  });
97
106
  ```
98
107
 
@@ -158,4 +167,4 @@ const transaction = await getWithdrawTransaction({
158
167
 
159
168
  ## License
160
169
 
161
- This project is licensed under the MIT License - see the LICENSE file for details.
170
+ This project is licensed under the MIT License - see the LICENSE file for details.
@@ -13,8 +13,9 @@ interface BTCWalletParams {
13
13
  syncLogOut?: boolean;
14
14
  env?: ENV;
15
15
  walletUrl?: string;
16
+ gasStrategy?: 'auto' | 'near' | 'btc';
16
17
  }
17
- export declare function setupBTCWallet({ iconUrl, deprecated, autoConnect, syncLogOut, env, walletUrl, }?: BTCWalletParams | undefined): WalletModuleFactory<InjectedWallet>;
18
+ export declare function setupBTCWallet({ iconUrl, deprecated, autoConnect, syncLogOut, env, walletUrl, gasStrategy, }?: BTCWalletParams | undefined): WalletModuleFactory<InjectedWallet>;
18
19
  declare const _default: {
19
20
  setupBTCWallet: typeof setupBTCWallet;
20
21
  };
@@ -1,5 +1,11 @@
1
1
  import { type WalletSelectorModal as _WalletSelectorModal, type ModalOptions as _ModalOptions } from 'ref-modal-ui';
2
2
  import type { WalletSelector } from '@near-wallet-selector/core';
3
- export type WalletSelectorModalOptions = _ModalOptions;
3
+ import { ENV } from '../config';
4
+ export interface WalletSelectorModalOptions extends _ModalOptions {
5
+ showChainGroups?: boolean;
6
+ showWalletUIForNearAccount?: boolean;
7
+ walletUrl?: string;
8
+ env?: ENV;
9
+ }
4
10
  export type WalletSelectorModal = _WalletSelectorModal;
5
11
  export declare function setupWalletSelectorModal(selector: WalletSelector, options: WalletSelectorModalOptions): _WalletSelectorModal;