btc-wallet 0.0.1

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.
Files changed (53) hide show
  1. package/README.md +9 -0
  2. package/dist/components/btcWalletSelectorContext.d.ts +12 -0
  3. package/dist/components/button/index.d.ts +10 -0
  4. package/dist/components/confirmBox/Modal.d.ts +7 -0
  5. package/dist/components/confirmBox/index.d.ts +9 -0
  6. package/dist/components/connectModal/index.d.ts +5 -0
  7. package/dist/components/copyText/index.d.ts +8 -0
  8. package/dist/components/hook.d.ts +1 -0
  9. package/dist/components/modal/index.d.ts +11 -0
  10. package/dist/components/signModal/index.d.ts +6 -0
  11. package/dist/components/spinner/index.d.ts +6 -0
  12. package/dist/components/tooltip/index.d.ts +7 -0
  13. package/dist/components/transactionDetails/index.d.ts +5 -0
  14. package/dist/connector/base.d.ts +29 -0
  15. package/dist/connector/bitget.d.ts +6 -0
  16. package/dist/connector/bybit.d.ts +6 -0
  17. package/dist/connector/index.d.ts +9 -0
  18. package/dist/connector/injected.d.ts +25 -0
  19. package/dist/connector/okx.d.ts +6 -0
  20. package/dist/connector/tokenPocket.d.ts +6 -0
  21. package/dist/connector/unisat.d.ts +6 -0
  22. package/dist/connector/wizz.d.ts +6 -0
  23. package/dist/connector/xverse.d.ts +23 -0
  24. package/dist/context/index.d.ts +45 -0
  25. package/dist/evmSigner/index.d.ts +4966 -0
  26. package/dist/evmSigner/provider.d.ts +13 -0
  27. package/dist/evmSigner/walletClientProvider.d.ts +10 -0
  28. package/dist/hooks/index.d.ts +6 -0
  29. package/dist/hooks/useAccountContract.d.ts +4 -0
  30. package/dist/hooks/useAccounts.d.ts +3 -0
  31. package/dist/hooks/useBTCProvider.d.ts +16 -0
  32. package/dist/hooks/useConnectModal.d.ts +4 -0
  33. package/dist/hooks/useConnector.d.ts +4 -0
  34. package/dist/hooks/useETHProvider.d.ts +1 -0
  35. package/dist/hooks/useModalStateValue.d.ts +6 -0
  36. package/dist/index.d.ts +7 -0
  37. package/dist/index.js +2738 -0
  38. package/dist/index.js.map +7 -0
  39. package/dist/package.json +1 -0
  40. package/dist/types/accountInfo.d.ts +6 -0
  41. package/dist/types/deserializeTx.d.ts +97 -0
  42. package/dist/types/eventName.d.ts +8 -0
  43. package/dist/types/evmMethod.d.ts +4 -0
  44. package/dist/utils/ethereumUtils.d.ts +7 -0
  45. package/dist/utils/eventUtils.d.ts +4 -0
  46. package/dist/utils/index.d.ts +11 -0
  47. package/dist/utils/initWalletButton.d.ts +6 -0
  48. package/dist/utils/setupBTCWallet.d.ts +11 -0
  49. package/dist/utils/setupSatoshiWallet.d.ts +11 -0
  50. package/dist/utils/txConfirmUtils.d.ts +6 -0
  51. package/esm/index.js +2720 -0
  52. package/esm/index.js.map +7 -0
  53. package/package.json +89 -0
package/README.md ADDED
@@ -0,0 +1,9 @@
1
+ # Particle BTC Connect
2
+
3
+ First Account Abstraction Protocol on Bitcoin
4
+
5
+ ## Learn More
6
+
7
+ - [Documentation](https://docs.particle.network/developers/btc-connect)
8
+ - [Website](https://particle.network)
9
+ - [Dashbord](https://dashboard.particle.network)
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export declare function BtcWalletSelectorContextProvider({ children }: {
3
+ children: React.ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
5
+ export declare function useBtcWalletSelector(): {
6
+ login: () => Promise<null>;
7
+ logout: () => void;
8
+ account: string | null;
9
+ getPublicKey: () => Promise<any>;
10
+ signMessage: (msg: string) => any;
11
+ getContext: () => any;
12
+ };
@@ -0,0 +1,10 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ declare const Button: ({ children, isLoading, isDisabled, onClick, className, style, }: {
3
+ children: ReactNode;
4
+ isLoading?: boolean;
5
+ isDisabled?: boolean;
6
+ onClick?: () => void;
7
+ className?: string;
8
+ style?: CSSProperties | undefined;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ export default Button;
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ children?: any;
3
+ onClose?: () => void;
4
+ style?: any;
5
+ }
6
+ export default function Modal({ children, onClose, style }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,9 @@
1
+ interface Props {
2
+ onClose: () => void;
3
+ fromChain?: any;
4
+ toChain?: any;
5
+ status: number;
6
+ hash: string;
7
+ }
8
+ export default function ComfirmBox({ onClose, status, fromChain, toChain, hash }: Props): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,5 @@
1
+ declare const ConnectModal: ({ open, onClose }: {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default ConnectModal;
@@ -0,0 +1,8 @@
1
+ import { type CSSProperties } from 'react';
2
+ export interface CopyTextProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ value?: string;
5
+ className?: string;
6
+ style?: CSSProperties | undefined;
7
+ }
8
+ export default function CopyText({ children, value, className, style }: CopyTextProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function InitContextHook(): null;
@@ -0,0 +1,11 @@
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
+ interface ModalProp {
3
+ open: boolean;
4
+ onClose: () => void;
5
+ children: ReactNode;
6
+ isDismissable?: boolean;
7
+ contentStyle?: CSSProperties | undefined;
8
+ contentClassName?: string;
9
+ }
10
+ declare const Modal: ({ open, onClose, children, isDismissable, contentStyle, contentClassName }: ModalProp) => import("react/jsx-runtime").JSX.Element;
11
+ export default Modal;
@@ -0,0 +1,6 @@
1
+ declare const SignModal: ({ open, onClose, onOpen }: {
2
+ open: boolean;
3
+ onClose: () => void;
4
+ onOpen: () => void;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default SignModal;
@@ -0,0 +1,6 @@
1
+ import { type CSSProperties } from 'react';
2
+ declare const Spinner: ({ className, style }: {
3
+ className?: string;
4
+ style?: CSSProperties | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default Spinner;
@@ -0,0 +1,7 @@
1
+ import { type ReactNode } from 'react';
2
+ declare const Tooltip: ({ children, content, className }: {
3
+ children: ReactNode;
4
+ content: string;
5
+ className?: string;
6
+ }) => import("react/jsx-runtime").JSX.Element;
7
+ export default Tooltip;
@@ -0,0 +1,5 @@
1
+ import { type EVMDeserializeTransactionResult } from '../../types/deserializeTx';
2
+ declare const TransactionDetails: ({ details }: {
3
+ details: EVMDeserializeTransactionResult;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ export default TransactionDetails;
@@ -0,0 +1,29 @@
1
+ export interface WalletMetadata {
2
+ id: string;
3
+ name: string;
4
+ icon: string;
5
+ downloadUrl: string;
6
+ }
7
+ export declare abstract class BaseConnector {
8
+ abstract readonly metadata: WalletMetadata;
9
+ abstract isReady(): boolean;
10
+ abstract requestAccounts(): Promise<string[]>;
11
+ abstract getAccounts(): Promise<string[]>;
12
+ abstract getPublicKey(): Promise<string>;
13
+ abstract signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string>;
14
+ abstract on(event: string, handler: (data?: unknown) => void): void;
15
+ abstract removeListener(event: string, handler: (data?: unknown) => void): void;
16
+ [key: string]: any;
17
+ abstract getProvider(): any;
18
+ abstract getNetwork(): Promise<'livenet' | 'testnet'>;
19
+ abstract switchNetwork(network: 'livenet' | 'testnet'): Promise<void>;
20
+ abstract sendBitcoin(toAddress: string, satoshis: number, options?: {
21
+ feeRate: number;
22
+ }): Promise<string>;
23
+ abstract sendInscription(address: string, inscriptionId: string, options?: {
24
+ feeRate: number;
25
+ }): Promise<{
26
+ txid: string;
27
+ }>;
28
+ abstract disconnect(): void;
29
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class BitgetConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class BybitConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,9 @@
1
+ export { BaseConnector } from './base';
2
+ export { BitgetConnector } from './bitget';
3
+ export { BybitConnector } from './bybit';
4
+ export { InjectedConnector } from './injected';
5
+ export { OKXConnector } from './okx';
6
+ export { TokenPocketConnector } from './tokenPocket';
7
+ export { UnisatConnector } from './unisat';
8
+ export { WizzConnector } from './wizz';
9
+ export { XverseConnector } from './xverse';
@@ -0,0 +1,25 @@
1
+ import { BaseConnector } from './base';
2
+ export declare abstract class InjectedConnector extends BaseConnector {
3
+ private propertity;
4
+ constructor(propertity: string);
5
+ isReady(): boolean;
6
+ requestAccounts(): Promise<string[]>;
7
+ getAccounts(): Promise<string[]>;
8
+ getPublicKey(): Promise<string>;
9
+ signMessage(signStr: string, type?: 'ecdsa' | 'bip322-simple'): Promise<string>;
10
+ on(event: string, handler: (data?: unknown) => void): any;
11
+ removeListener(event: string, handler: (data?: unknown) => void): any;
12
+ getProvider(): any;
13
+ getProviderOrThrow(): any;
14
+ getNetwork(): Promise<'livenet' | 'testnet'>;
15
+ switchNetwork(network: 'livenet' | 'testnet'): Promise<void>;
16
+ sendBitcoin(toAddress: string, satoshis: number, options?: {
17
+ feeRate: number;
18
+ }): Promise<string>;
19
+ sendInscription(address: string, inscriptionId: string, options?: {
20
+ feeRate: number;
21
+ }): Promise<{
22
+ txid: string;
23
+ }>;
24
+ disconnect(): void;
25
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class OKXConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class TokenPocketConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class UnisatConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,6 @@
1
+ import { type WalletMetadata } from './base';
2
+ import { InjectedConnector } from './injected';
3
+ export declare class WizzConnector extends InjectedConnector {
4
+ readonly metadata: WalletMetadata;
5
+ constructor();
6
+ }
@@ -0,0 +1,23 @@
1
+ import EventEmitter from 'events';
2
+ import { BaseConnector, type WalletMetadata } from './base';
3
+ export declare class XverseConnector extends BaseConnector {
4
+ #private;
5
+ constructor();
6
+ readonly metadata: WalletMetadata;
7
+ isReady(): boolean;
8
+ private loadAccounts;
9
+ sendInscription(): Promise<{
10
+ txid: string;
11
+ }>;
12
+ requestAccounts(): Promise<string[]>;
13
+ getAccounts(): Promise<string[]>;
14
+ getPublicKey(): Promise<string>;
15
+ signMessage(signStr: string): Promise<string>;
16
+ on(event: string, handler: (data?: unknown) => void): EventEmitter<[never]>;
17
+ removeListener(event: string, handler: (data?: unknown) => void): EventEmitter<[never]>;
18
+ getProvider(): import("sats-connect").BitcoinProvider | undefined;
19
+ getNetwork(): Promise<'livenet' | 'testnet'>;
20
+ switchNetwork(): Promise<void>;
21
+ sendBitcoin(toAddress: string, satoshis: number): Promise<string>;
22
+ disconnect(): void;
23
+ }
@@ -0,0 +1,45 @@
1
+ import { SmartAccount, type AAOptions, type AccountContract } from '@particle-network/aa';
2
+ import { type WalletOption } from '@particle-network/wallet';
3
+ import { type BaseConnector } from '../connector/base';
4
+ import type { AccountInfo } from '../types/accountInfo';
5
+ interface GlobalState {
6
+ connectorId?: string;
7
+ setConnectorId: (connectorId?: string) => void;
8
+ connector?: BaseConnector;
9
+ connectors: BaseConnector[];
10
+ openConnectModal: () => void;
11
+ closeConnectModal: () => void;
12
+ accounts: string[];
13
+ provider: any;
14
+ disconnect: () => void;
15
+ getPublicKey: () => Promise<string>;
16
+ signMessage: (message: string) => Promise<string>;
17
+ evmAccount?: string;
18
+ smartAccount?: SmartAccount;
19
+ switchNetwork: (network: 'livenet' | 'testnet') => Promise<void>;
20
+ getNetwork: () => Promise<'livenet' | 'testnet'>;
21
+ sendBitcoin: (toAddress: string, satoshis: number, options?: {
22
+ feeRate: number;
23
+ }) => Promise<string>;
24
+ accountContract: AccountContract;
25
+ setAccountContract: (accountContract: AccountContract) => void;
26
+ getSmartAccountInfo: () => Promise<AccountInfo | undefined>;
27
+ }
28
+ interface ConnectOptions {
29
+ projectId: string;
30
+ clientKey: string;
31
+ appId: string;
32
+ aaOptions: AAOptions;
33
+ rpcUrls?: Record<number, string>;
34
+ walletOptions?: Omit<WalletOption, 'erc4337' | 'customStyle'> & {
35
+ customStyle?: Omit<WalletOption['customStyle'], 'supportChains'>;
36
+ };
37
+ }
38
+ export declare const ConnectProvider: ({ children, options, connectors, autoConnect, }: {
39
+ children: React.ReactNode;
40
+ options: ConnectOptions;
41
+ connectors: BaseConnector[];
42
+ autoConnect?: boolean;
43
+ }) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const useConnectProvider: () => GlobalState;
45
+ export {};