decane-connect-kit 0.0.1 → 1.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.
- package/dist/index.cjs +471 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -4
- package/dist/index.d.ts +31 -4
- package/dist/index.js +471 -67
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
type ChainType = "evm" | "solana";
|
|
4
|
-
type ChainSupport = [
|
|
3
|
+
type ChainType = "evm" | "solana" | "tron" | "bitcoin";
|
|
4
|
+
type ChainSupport = ChainType[];
|
|
5
5
|
interface ChainDescriptor {
|
|
6
6
|
id: string;
|
|
7
7
|
type: ChainType;
|
|
@@ -25,6 +25,8 @@ interface UnifiedWalletAccount {
|
|
|
25
25
|
chainSupport: ChainSupport;
|
|
26
26
|
evmProvider?: EIP1193Provider;
|
|
27
27
|
solanaProvider?: StandardWallet;
|
|
28
|
+
tronProvider?: TronProvider;
|
|
29
|
+
bitcoinProvider?: BitcoinProvider;
|
|
28
30
|
}
|
|
29
31
|
type CAIP25Method = "wallet_requestPermissions" | "wallet_revokePermissions" | "wallet_getPermissions" | "wallet_sendTransaction" | "wallet_signMessage" | "wallet_signTypedData";
|
|
30
32
|
interface ChainScope {
|
|
@@ -58,6 +60,8 @@ interface DecaneProvider {
|
|
|
58
60
|
readonly evmWallets: UnifiedWalletAccount[];
|
|
59
61
|
readonly solanaWallets: UnifiedWalletAccount[];
|
|
60
62
|
readonly multiChainWallets: UnifiedWalletAccount[];
|
|
63
|
+
readonly tronWallets: UnifiedWalletAccount[];
|
|
64
|
+
readonly bitcoinWallets: UnifiedWalletAccount[];
|
|
61
65
|
connect(wallet: UnifiedWalletAccount, preferredChain?: ChainType): Promise<void>;
|
|
62
66
|
disconnect(): Promise<void>;
|
|
63
67
|
addChain(chain: ChainDescriptor): void;
|
|
@@ -71,7 +75,7 @@ interface DecaneProvider {
|
|
|
71
75
|
interface DecaneConfig {
|
|
72
76
|
chains?: ChainDescriptor[];
|
|
73
77
|
supportedChainIds?: string[];
|
|
74
|
-
networks?: "evm" | "solana" | "all";
|
|
78
|
+
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
75
79
|
defaultChain?: string;
|
|
76
80
|
theme?: "light" | "dark" | "auto";
|
|
77
81
|
}
|
|
@@ -94,6 +98,27 @@ interface StandardWalletAccount {
|
|
|
94
98
|
publicKey: Uint8Array;
|
|
95
99
|
chains: string[];
|
|
96
100
|
}
|
|
101
|
+
interface TronProvider {
|
|
102
|
+
request(args: {
|
|
103
|
+
method: string;
|
|
104
|
+
params?: unknown[] | Record<string, unknown>;
|
|
105
|
+
}): Promise<unknown>;
|
|
106
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
107
|
+
removeListener(event: string, handler: (...args: unknown[]) => void): void;
|
|
108
|
+
}
|
|
109
|
+
interface BitcoinProvider {
|
|
110
|
+
requestAccounts(): Promise<string[] | Array<{
|
|
111
|
+
address: string;
|
|
112
|
+
}>>;
|
|
113
|
+
getAccounts?(): Promise<string[] | Array<{
|
|
114
|
+
address: string;
|
|
115
|
+
}>>;
|
|
116
|
+
signMessage(message: string, ...args: unknown[]): Promise<string>;
|
|
117
|
+
sendBitcoin?(toAddress: string, satoshis: number, options?: unknown): Promise<string>;
|
|
118
|
+
send?(params: unknown): Promise<string>;
|
|
119
|
+
signPsbt?(psbtHex: string, options?: unknown): Promise<string>;
|
|
120
|
+
on?(event: string, handler: (...args: unknown[]) => void): void;
|
|
121
|
+
}
|
|
97
122
|
|
|
98
123
|
declare function createDecane(config?: DecaneConfig): DecaneProvider;
|
|
99
124
|
|
|
@@ -180,6 +205,8 @@ declare const CHAINS: {
|
|
|
180
205
|
readonly LOCALHOST: "eip155:31337";
|
|
181
206
|
readonly SOLANA: "solana:mainnet";
|
|
182
207
|
readonly SOLANA_DEVNET: "solana:devnet";
|
|
208
|
+
readonly TRON: "tron:mainnet";
|
|
209
|
+
readonly BITCOIN: "bip122:mainnet";
|
|
183
210
|
};
|
|
184
211
|
type ChainId = typeof CHAINS[keyof typeof CHAINS];
|
|
185
212
|
|
|
@@ -189,7 +216,7 @@ interface WalletSelectorProps {
|
|
|
189
216
|
onClose: () => void;
|
|
190
217
|
onConnect: (wallet: UnifiedWalletAccount, preference?: ChainType) => void;
|
|
191
218
|
theme?: "light" | "dark" | "auto";
|
|
192
|
-
networks?: "evm" | "solana" | "all";
|
|
219
|
+
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
193
220
|
}
|
|
194
221
|
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, }: WalletSelectorProps): React.ReactPortal | null;
|
|
195
222
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
|
|
3
|
-
type ChainType = "evm" | "solana";
|
|
4
|
-
type ChainSupport = [
|
|
3
|
+
type ChainType = "evm" | "solana" | "tron" | "bitcoin";
|
|
4
|
+
type ChainSupport = ChainType[];
|
|
5
5
|
interface ChainDescriptor {
|
|
6
6
|
id: string;
|
|
7
7
|
type: ChainType;
|
|
@@ -25,6 +25,8 @@ interface UnifiedWalletAccount {
|
|
|
25
25
|
chainSupport: ChainSupport;
|
|
26
26
|
evmProvider?: EIP1193Provider;
|
|
27
27
|
solanaProvider?: StandardWallet;
|
|
28
|
+
tronProvider?: TronProvider;
|
|
29
|
+
bitcoinProvider?: BitcoinProvider;
|
|
28
30
|
}
|
|
29
31
|
type CAIP25Method = "wallet_requestPermissions" | "wallet_revokePermissions" | "wallet_getPermissions" | "wallet_sendTransaction" | "wallet_signMessage" | "wallet_signTypedData";
|
|
30
32
|
interface ChainScope {
|
|
@@ -58,6 +60,8 @@ interface DecaneProvider {
|
|
|
58
60
|
readonly evmWallets: UnifiedWalletAccount[];
|
|
59
61
|
readonly solanaWallets: UnifiedWalletAccount[];
|
|
60
62
|
readonly multiChainWallets: UnifiedWalletAccount[];
|
|
63
|
+
readonly tronWallets: UnifiedWalletAccount[];
|
|
64
|
+
readonly bitcoinWallets: UnifiedWalletAccount[];
|
|
61
65
|
connect(wallet: UnifiedWalletAccount, preferredChain?: ChainType): Promise<void>;
|
|
62
66
|
disconnect(): Promise<void>;
|
|
63
67
|
addChain(chain: ChainDescriptor): void;
|
|
@@ -71,7 +75,7 @@ interface DecaneProvider {
|
|
|
71
75
|
interface DecaneConfig {
|
|
72
76
|
chains?: ChainDescriptor[];
|
|
73
77
|
supportedChainIds?: string[];
|
|
74
|
-
networks?: "evm" | "solana" | "all";
|
|
78
|
+
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
75
79
|
defaultChain?: string;
|
|
76
80
|
theme?: "light" | "dark" | "auto";
|
|
77
81
|
}
|
|
@@ -94,6 +98,27 @@ interface StandardWalletAccount {
|
|
|
94
98
|
publicKey: Uint8Array;
|
|
95
99
|
chains: string[];
|
|
96
100
|
}
|
|
101
|
+
interface TronProvider {
|
|
102
|
+
request(args: {
|
|
103
|
+
method: string;
|
|
104
|
+
params?: unknown[] | Record<string, unknown>;
|
|
105
|
+
}): Promise<unknown>;
|
|
106
|
+
on(event: string, handler: (...args: unknown[]) => void): void;
|
|
107
|
+
removeListener(event: string, handler: (...args: unknown[]) => void): void;
|
|
108
|
+
}
|
|
109
|
+
interface BitcoinProvider {
|
|
110
|
+
requestAccounts(): Promise<string[] | Array<{
|
|
111
|
+
address: string;
|
|
112
|
+
}>>;
|
|
113
|
+
getAccounts?(): Promise<string[] | Array<{
|
|
114
|
+
address: string;
|
|
115
|
+
}>>;
|
|
116
|
+
signMessage(message: string, ...args: unknown[]): Promise<string>;
|
|
117
|
+
sendBitcoin?(toAddress: string, satoshis: number, options?: unknown): Promise<string>;
|
|
118
|
+
send?(params: unknown): Promise<string>;
|
|
119
|
+
signPsbt?(psbtHex: string, options?: unknown): Promise<string>;
|
|
120
|
+
on?(event: string, handler: (...args: unknown[]) => void): void;
|
|
121
|
+
}
|
|
97
122
|
|
|
98
123
|
declare function createDecane(config?: DecaneConfig): DecaneProvider;
|
|
99
124
|
|
|
@@ -180,6 +205,8 @@ declare const CHAINS: {
|
|
|
180
205
|
readonly LOCALHOST: "eip155:31337";
|
|
181
206
|
readonly SOLANA: "solana:mainnet";
|
|
182
207
|
readonly SOLANA_DEVNET: "solana:devnet";
|
|
208
|
+
readonly TRON: "tron:mainnet";
|
|
209
|
+
readonly BITCOIN: "bip122:mainnet";
|
|
183
210
|
};
|
|
184
211
|
type ChainId = typeof CHAINS[keyof typeof CHAINS];
|
|
185
212
|
|
|
@@ -189,7 +216,7 @@ interface WalletSelectorProps {
|
|
|
189
216
|
onClose: () => void;
|
|
190
217
|
onConnect: (wallet: UnifiedWalletAccount, preference?: ChainType) => void;
|
|
191
218
|
theme?: "light" | "dark" | "auto";
|
|
192
|
-
networks?: "evm" | "solana" | "all";
|
|
219
|
+
networks?: "evm" | "solana" | "tron" | "bitcoin" | "all";
|
|
193
220
|
}
|
|
194
221
|
declare function WalletSelector({ provider, open, onClose, onConnect, theme, networks, }: WalletSelectorProps): React.ReactPortal | null;
|
|
195
222
|
|