btc-wallet 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -0
- package/dist/components/btcWalletSelectorContext.d.ts +12 -0
- package/dist/components/button/index.d.ts +10 -0
- package/dist/components/confirmBox/Modal.d.ts +7 -0
- package/dist/components/confirmBox/index.d.ts +9 -0
- package/dist/components/connectModal/index.d.ts +5 -0
- package/dist/components/copyText/index.d.ts +8 -0
- package/dist/components/hook.d.ts +1 -0
- package/dist/components/modal/index.d.ts +11 -0
- package/dist/components/signModal/index.d.ts +6 -0
- package/dist/components/spinner/index.d.ts +6 -0
- package/dist/components/tooltip/index.d.ts +7 -0
- package/dist/components/transactionDetails/index.d.ts +5 -0
- package/dist/connector/base.d.ts +29 -0
- package/dist/connector/bitget.d.ts +6 -0
- package/dist/connector/bybit.d.ts +6 -0
- package/dist/connector/index.d.ts +9 -0
- package/dist/connector/injected.d.ts +25 -0
- package/dist/connector/okx.d.ts +6 -0
- package/dist/connector/tokenPocket.d.ts +6 -0
- package/dist/connector/unisat.d.ts +6 -0
- package/dist/connector/wizz.d.ts +6 -0
- package/dist/connector/xverse.d.ts +23 -0
- package/dist/context/index.d.ts +45 -0
- package/dist/evmSigner/index.d.ts +4966 -0
- package/dist/evmSigner/provider.d.ts +13 -0
- package/dist/evmSigner/walletClientProvider.d.ts +10 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/useAccountContract.d.ts +4 -0
- package/dist/hooks/useAccounts.d.ts +3 -0
- package/dist/hooks/useBTCProvider.d.ts +16 -0
- package/dist/hooks/useConnectModal.d.ts +4 -0
- package/dist/hooks/useConnector.d.ts +4 -0
- package/dist/hooks/useETHProvider.d.ts +1 -0
- package/dist/hooks/useModalStateValue.d.ts +6 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2738 -0
- package/dist/index.js.map +7 -0
- package/dist/package.json +1 -0
- package/dist/types/accountInfo.d.ts +6 -0
- package/dist/types/deserializeTx.d.ts +97 -0
- package/dist/types/eventName.d.ts +8 -0
- package/dist/types/evmMethod.d.ts +4 -0
- package/dist/utils/ethereumUtils.d.ts +7 -0
- package/dist/utils/eventUtils.d.ts +4 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/initWalletButton.d.ts +6 -0
- package/dist/utils/setupBTCWallet.d.ts +11 -0
- package/dist/utils/setupSatoshiWallet.d.ts +11 -0
- package/dist/utils/txConfirmUtils.d.ts +6 -0
- package/esm/index.js +2720 -0
- package/esm/index.js.map +7 -0
- package/package.json +89 -0
package/README.md
ADDED
@@ -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,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,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,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,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 {};
|