btc-wallet 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,9 +1,63 @@
1
- # Particle BTC Connect
1
+ # BTC Wallet
2
2
 
3
- First Account Abstraction Protocol on Bitcoin
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
- ## Learn More
5
+ ## Features
6
6
 
7
- - [Documentation](https://docs.particle.network/developers/btc-connect)
8
- - [Website](https://particle.network)
9
- - [Dashbord](https://dashboard.particle.network)
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
+ ```
@@ -1,4 +1,4 @@
1
- declare const SignModal: ({ open, onClose, onOpen }: {
1
+ declare const SignModal: ({ open, onClose, onOpen, }: {
2
2
  open: boolean;
3
3
  onClose: () => void;
4
4
  onOpen: () => void;
@@ -0,0 +1,14 @@
1
+ export declare const walletConfig: Record<string, {
2
+ base_url: string;
3
+ token: string;
4
+ contractId: string;
5
+ walletUrl: string;
6
+ }>;
7
+ export declare const nearRpcUrls: {
8
+ mainnet: string[];
9
+ testnet: string[];
10
+ };
11
+ export declare const btcRpcUrls: {
12
+ mainnet: string;
13
+ testnet: string;
14
+ };
@@ -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 React from 'react';
2
- export declare function BtcWalletSelectorContextProvider({ children, autoConnect }: {
2
+ export declare function BtcWalletSelectorContextProvider({ children, autoConnect, }: {
3
3
  children: React.ReactNode;
4
4
  autoConnect?: boolean;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -12,4 +12,7 @@ export declare function useBtcWalletSelector(): {
12
12
  signMessage: (msg: string) => any;
13
13
  getContext: () => any;
14
14
  getBalance: () => Promise<any>;
15
+ sendBitcoin: (toAddress: string, satoshis: number, options?: {
16
+ feeRate: number;
17
+ }) => Promise<string>;
15
18
  };
@@ -1,5 +1,5 @@
1
1
  import type { InjectedWallet, WalletModuleFactory } from '@near-wallet-selector/core';
2
- import type { useBtcWalletSelector } from './../components/btcWalletSelectorContext';
2
+ import type { useBtcWalletSelector } from './btcWalletSelectorContext';
3
3
  declare global {
4
4
  interface Window {
5
5
  btcContext: ReturnType<typeof useBtcWalletSelector>;