@enclave-hq/wallet-sdk 1.0.0 → 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.d.mts +62 -37
- package/dist/index.d.ts +62 -37
- package/dist/index.js +347 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +347 -60
- package/dist/index.mjs.map +1 -1
- package/dist/react/index.d.mts +33 -8
- package/dist/react/index.d.ts +33 -8
- package/dist/react/index.js +358 -33
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +358 -34
- package/dist/react/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/react/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ChainType as ChainType$1 } from '@enclave-hq/chain-utils';
|
|
2
3
|
|
|
3
4
|
declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
4
5
|
private emitter;
|
|
@@ -9,12 +10,8 @@ declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[])
|
|
|
9
10
|
removeAllListeners<K extends keyof TEvents>(event?: K): this;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
declare
|
|
13
|
-
|
|
14
|
-
TRON = "tron",
|
|
15
|
-
SOLANA = "solana",
|
|
16
|
-
COSMOS = "cosmos"
|
|
17
|
-
}
|
|
13
|
+
declare const ChainType: typeof ChainType$1;
|
|
14
|
+
type ChainType = ChainType$1;
|
|
18
15
|
declare enum WalletType {
|
|
19
16
|
METAMASK = "metamask",
|
|
20
17
|
WALLETCONNECT = "walletconnect",
|
|
@@ -50,7 +47,7 @@ interface IWalletAdapter {
|
|
|
50
47
|
disconnect(): Promise<void>;
|
|
51
48
|
isAvailable(): Promise<boolean>;
|
|
52
49
|
signMessage(message: string): Promise<string>;
|
|
53
|
-
signTransaction?(transaction:
|
|
50
|
+
signTransaction?(transaction: Transaction): Promise<string>;
|
|
54
51
|
signTypedData?(typedData: any): Promise<string>;
|
|
55
52
|
switchChain?(chainId: number): Promise<void>;
|
|
56
53
|
addChain?(chainConfig: AddChainParams): Promise<void>;
|
|
@@ -75,6 +72,24 @@ interface ContractWriteParams extends ContractReadParams {
|
|
|
75
72
|
gas?: number;
|
|
76
73
|
gasPrice?: string;
|
|
77
74
|
}
|
|
75
|
+
interface EVMTransaction {
|
|
76
|
+
to: string;
|
|
77
|
+
value?: string | bigint;
|
|
78
|
+
data?: string;
|
|
79
|
+
gas?: string | bigint;
|
|
80
|
+
gasPrice?: string | bigint;
|
|
81
|
+
maxFeePerGas?: string | bigint;
|
|
82
|
+
maxPriorityFeePerGas?: string | bigint;
|
|
83
|
+
nonce?: number;
|
|
84
|
+
chainId?: number;
|
|
85
|
+
}
|
|
86
|
+
interface TronTransaction {
|
|
87
|
+
txID?: string;
|
|
88
|
+
raw_data?: any;
|
|
89
|
+
raw_data_hex?: string;
|
|
90
|
+
visible?: boolean;
|
|
91
|
+
}
|
|
92
|
+
type Transaction = EVMTransaction | TronTransaction;
|
|
78
93
|
interface TransactionReceipt {
|
|
79
94
|
transactionHash: string;
|
|
80
95
|
blockNumber: number;
|
|
@@ -142,6 +157,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
142
157
|
signMessage(message: string): Promise<string>;
|
|
143
158
|
signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
|
|
144
159
|
signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
|
|
160
|
+
signTransaction(transaction: any): Promise<string>;
|
|
161
|
+
signTransactionWithChainType(transaction: any, chainType?: ChainType): Promise<string>;
|
|
145
162
|
requestSwitchChain(chainId: number, options?: {
|
|
146
163
|
addChainIfNotExists?: boolean;
|
|
147
164
|
chainConfig?: AddChainParams;
|
|
@@ -176,6 +193,7 @@ interface WalletContextValue {
|
|
|
176
193
|
disconnect: () => Promise<void>;
|
|
177
194
|
switchPrimaryWallet: (chainType: ChainType) => Promise<Account>;
|
|
178
195
|
signMessage: (message: string) => Promise<string>;
|
|
196
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
179
197
|
}
|
|
180
198
|
interface WalletProviderProps {
|
|
181
199
|
children: ReactNode;
|
|
@@ -215,4 +233,11 @@ interface UseSignMessageResult {
|
|
|
215
233
|
}
|
|
216
234
|
declare function useSignMessage(): UseSignMessageResult;
|
|
217
235
|
|
|
218
|
-
|
|
236
|
+
interface UseSignTransactionResult {
|
|
237
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
238
|
+
isSigning: boolean;
|
|
239
|
+
error: Error | null;
|
|
240
|
+
}
|
|
241
|
+
declare function useSignTransaction(): UseSignTransactionResult;
|
|
242
|
+
|
|
243
|
+
export { type UseAccountResult, type UseConnectResult, type UseDisconnectResult, type UseSignMessageResult, type UseSignTransactionResult, type WalletContextValue, WalletProvider, type WalletProviderProps, useAccount, useConnect, useDisconnect, useSignMessage, useSignTransaction, useWallet };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ChainType as ChainType$1 } from '@enclave-hq/chain-utils';
|
|
2
3
|
|
|
3
4
|
declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[]) => void>> {
|
|
4
5
|
private emitter;
|
|
@@ -9,12 +10,8 @@ declare class TypedEventEmitter<TEvents extends Record<string, (...args: any[])
|
|
|
9
10
|
removeAllListeners<K extends keyof TEvents>(event?: K): this;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
declare
|
|
13
|
-
|
|
14
|
-
TRON = "tron",
|
|
15
|
-
SOLANA = "solana",
|
|
16
|
-
COSMOS = "cosmos"
|
|
17
|
-
}
|
|
13
|
+
declare const ChainType: typeof ChainType$1;
|
|
14
|
+
type ChainType = ChainType$1;
|
|
18
15
|
declare enum WalletType {
|
|
19
16
|
METAMASK = "metamask",
|
|
20
17
|
WALLETCONNECT = "walletconnect",
|
|
@@ -50,7 +47,7 @@ interface IWalletAdapter {
|
|
|
50
47
|
disconnect(): Promise<void>;
|
|
51
48
|
isAvailable(): Promise<boolean>;
|
|
52
49
|
signMessage(message: string): Promise<string>;
|
|
53
|
-
signTransaction?(transaction:
|
|
50
|
+
signTransaction?(transaction: Transaction): Promise<string>;
|
|
54
51
|
signTypedData?(typedData: any): Promise<string>;
|
|
55
52
|
switchChain?(chainId: number): Promise<void>;
|
|
56
53
|
addChain?(chainConfig: AddChainParams): Promise<void>;
|
|
@@ -75,6 +72,24 @@ interface ContractWriteParams extends ContractReadParams {
|
|
|
75
72
|
gas?: number;
|
|
76
73
|
gasPrice?: string;
|
|
77
74
|
}
|
|
75
|
+
interface EVMTransaction {
|
|
76
|
+
to: string;
|
|
77
|
+
value?: string | bigint;
|
|
78
|
+
data?: string;
|
|
79
|
+
gas?: string | bigint;
|
|
80
|
+
gasPrice?: string | bigint;
|
|
81
|
+
maxFeePerGas?: string | bigint;
|
|
82
|
+
maxPriorityFeePerGas?: string | bigint;
|
|
83
|
+
nonce?: number;
|
|
84
|
+
chainId?: number;
|
|
85
|
+
}
|
|
86
|
+
interface TronTransaction {
|
|
87
|
+
txID?: string;
|
|
88
|
+
raw_data?: any;
|
|
89
|
+
raw_data_hex?: string;
|
|
90
|
+
visible?: boolean;
|
|
91
|
+
}
|
|
92
|
+
type Transaction = EVMTransaction | TronTransaction;
|
|
78
93
|
interface TransactionReceipt {
|
|
79
94
|
transactionHash: string;
|
|
80
95
|
blockNumber: number;
|
|
@@ -142,6 +157,8 @@ declare class WalletManager extends TypedEventEmitter<WalletManagerEvents> {
|
|
|
142
157
|
signMessage(message: string): Promise<string>;
|
|
143
158
|
signMessageWithChainType(message: string, chainType?: ChainType): Promise<string>;
|
|
144
159
|
signTypedData(typedData: any, chainType?: ChainType): Promise<string>;
|
|
160
|
+
signTransaction(transaction: any): Promise<string>;
|
|
161
|
+
signTransactionWithChainType(transaction: any, chainType?: ChainType): Promise<string>;
|
|
145
162
|
requestSwitchChain(chainId: number, options?: {
|
|
146
163
|
addChainIfNotExists?: boolean;
|
|
147
164
|
chainConfig?: AddChainParams;
|
|
@@ -176,6 +193,7 @@ interface WalletContextValue {
|
|
|
176
193
|
disconnect: () => Promise<void>;
|
|
177
194
|
switchPrimaryWallet: (chainType: ChainType) => Promise<Account>;
|
|
178
195
|
signMessage: (message: string) => Promise<string>;
|
|
196
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
179
197
|
}
|
|
180
198
|
interface WalletProviderProps {
|
|
181
199
|
children: ReactNode;
|
|
@@ -215,4 +233,11 @@ interface UseSignMessageResult {
|
|
|
215
233
|
}
|
|
216
234
|
declare function useSignMessage(): UseSignMessageResult;
|
|
217
235
|
|
|
218
|
-
|
|
236
|
+
interface UseSignTransactionResult {
|
|
237
|
+
signTransaction: (transaction: any) => Promise<string>;
|
|
238
|
+
isSigning: boolean;
|
|
239
|
+
error: Error | null;
|
|
240
|
+
}
|
|
241
|
+
declare function useSignTransaction(): UseSignTransactionResult;
|
|
242
|
+
|
|
243
|
+
export { type UseAccountResult, type UseConnectResult, type UseDisconnectResult, type UseSignMessageResult, type UseSignTransactionResult, type WalletContextValue, WalletProvider, type WalletProviderProps, useAccount, useConnect, useDisconnect, useSignMessage, useSignTransaction, useWallet };
|