btc-wallet 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +60 -6
- package/dist/components/signModal/index.d.ts +1 -1
- package/dist/context/index.d.ts +0 -2
- package/dist/core/bridgeSupplyUtils.d.ts +10 -0
- package/dist/{utils → core}/setupBTCWallet.d.ts +1 -1
- package/dist/index.d.ts +3 -4
- package/dist/index.js +147 -196
- package/dist/index.js.map +4 -4
- package/dist/utils/ethereumUtils.d.ts +1 -4
- package/dist/utils/index.d.ts +0 -5
- package/esm/index.js +143 -186
- package/esm/index.js.map +4 -4
- package/package.json +1 -1
- package/dist/components/hook.d.ts +0 -1
- package/dist/utils/bridgeSupplyUtils.d.ts +0 -1
- /package/dist/{components → core}/btcWalletSelectorContext.d.ts +0 -0
package/README.md
CHANGED
@@ -1,9 +1,63 @@
|
|
1
|
-
#
|
1
|
+
# BTC Wallet
|
2
2
|
|
3
|
-
|
3
|
+
BTC Wallet is a toolkit that enables the use of Bitcoin on the NEAR blockchain through the Satoshi protocol. It provides seamless integration for managing Bitcoin transactions and interactions within the NEAR ecosystem.
|
4
4
|
|
5
|
-
##
|
5
|
+
## Features
|
6
6
|
|
7
|
-
-
|
8
|
-
|
9
|
-
|
7
|
+
- **NEAR Integration**: Leverage the Satoshi protocol to use Bitcoin on the NEAR blockchain.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Install `btc-wallet` using npm or yarn:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
pnpm install btc-wallet
|
15
|
+
or
|
16
|
+
yarn add btc-wallet
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Initialize BTC Wallet
|
22
|
+
|
23
|
+
To use BTC Wallet in your project, wrap your application with the `BtcWalletSelectorContextProvider`:
|
24
|
+
|
25
|
+
```javascript
|
26
|
+
import BtcWalletSelectorContextProvider from 'btc-wallet';
|
27
|
+
function App() {
|
28
|
+
return (
|
29
|
+
<BtcWalletSelectorContextProvider>
|
30
|
+
{/* Your application components */}
|
31
|
+
</BtcWalletSelectorContextProvider>
|
32
|
+
);
|
33
|
+
}
|
34
|
+
```
|
35
|
+
|
36
|
+
### Setup Wallet Selector
|
37
|
+
|
38
|
+
Integrate BTC Wallet with NEAR's wallet selector:
|
39
|
+
|
40
|
+
```javascript
|
41
|
+
import { setupWalletSelector } from '@near-wallet-selector/core';
|
42
|
+
import { setupBTCWallet } from 'btc-wallet';
|
43
|
+
setupWalletSelector({
|
44
|
+
network: 'mainnet', // or 'testnet'
|
45
|
+
modules: [setupBTCWallet()],
|
46
|
+
});
|
47
|
+
```
|
48
|
+
|
49
|
+
### Execute Burrow Supply
|
50
|
+
|
51
|
+
To execute a Burrow supply operation, use the `executeBurrowSupply` function:
|
52
|
+
|
53
|
+
```javascript
|
54
|
+
import { executeBurrowSupply } from 'btc-wallet';
|
55
|
+
executeBurrowSupply({
|
56
|
+
amount: '0.01', // BTC amount
|
57
|
+
environment: 'mainnet', // or 'testnet'
|
58
|
+
}).then(() => {
|
59
|
+
console.log('Burrow supply executed successfully');
|
60
|
+
}).catch((error) => {
|
61
|
+
console.error('Error executing Burrow supply:', error);
|
62
|
+
});
|
63
|
+
```
|
package/dist/context/index.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
import { SmartAccount, type AAOptions, type AccountContract } from '@particle-network/aa';
|
2
2
|
import { type WalletOption } from '@particle-network/wallet';
|
3
3
|
import { type BaseConnector } from '../connector/base';
|
4
|
-
import type { AccountInfo } from '../types/accountInfo';
|
5
4
|
interface GlobalState {
|
6
5
|
connectorId?: string;
|
7
6
|
setConnectorId: (connectorId?: string) => void;
|
@@ -24,7 +23,6 @@ interface GlobalState {
|
|
24
23
|
}) => Promise<string>;
|
25
24
|
accountContract: AccountContract;
|
26
25
|
setAccountContract: (accountContract: AccountContract) => void;
|
27
|
-
getSmartAccountInfo: () => Promise<AccountInfo | undefined>;
|
28
26
|
}
|
29
27
|
interface ConnectOptions {
|
30
28
|
projectId: string;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
interface ExecuteBurrowSupplyParams {
|
2
|
+
/** btc amount, e.g. 0.01 */
|
3
|
+
amount: string;
|
4
|
+
/** fee rate, if not provided, will use the recommended fee rate from the btc node */
|
5
|
+
feeRate?: number;
|
6
|
+
/** environment, default is mainnet */
|
7
|
+
environment?: 'dev' | 'testnet' | 'mainnet';
|
8
|
+
}
|
9
|
+
export declare function executeBurrowSupply({ amount, feeRate, environment, }: ExecuteBurrowSupplyParams): Promise<void>;
|
10
|
+
export {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { InjectedWallet, WalletModuleFactory } from '@near-wallet-selector/core';
|
2
|
-
import type { useBtcWalletSelector } from '
|
2
|
+
import type { useBtcWalletSelector } from './btcWalletSelectorContext';
|
3
3
|
declare global {
|
4
4
|
interface Window {
|
5
5
|
btcContext: ReturnType<typeof useBtcWalletSelector>;
|
package/dist/index.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
export * from './connector';
|
2
2
|
export { ConnectProvider } from './context';
|
3
3
|
export * from './hooks';
|
4
|
-
export * from './
|
5
|
-
export * from './
|
6
|
-
export * from './
|
7
|
-
export * from './utils/bridgeSupplyUtils';
|
4
|
+
export * from './core/btcWalletSelectorContext';
|
5
|
+
export * from './core/setupBTCWallet';
|
6
|
+
export * from './core/bridgeSupplyUtils';
|
8
7
|
export declare const getVersion: () => string;
|