@meshconnect/uwc-types 0.2.0 → 0.2.2
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/connector.d.ts +4 -2
- package/dist/connector.d.ts.map +1 -1
- package/dist/react-hooks.d.ts +11 -3
- package/dist/react-hooks.d.ts.map +1 -1
- package/dist/session.d.ts +3 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/signature.d.ts +20 -1
- package/dist/signature.d.ts.map +1 -1
- package/dist/transactions.d.ts +45 -26
- package/dist/transactions.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connector.ts +9 -2
- package/src/network-rpc.ts +1 -1
- package/src/react-hooks.ts +13 -3
- package/src/session.ts +3 -0
- package/src/signature.ts +24 -2
- package/src/transactions.ts +60 -27
package/dist/connector.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Network, NetworkId, Namespace } from './networks';
|
|
2
2
|
import type { AvailableAddress } from './session';
|
|
3
3
|
import type { DetectedEIP6963WalletInfo, DetectedSolanaWalletInfo, ExtensionInjectedProvider, IntegratedBrowserInjectedProvider, WalletConnectProvider } from './UWC-state';
|
|
4
|
-
import type { TransactionRequest, TransactionResult } from './transactions';
|
|
4
|
+
import type { EVMCapabilities, TransactionRequest, TransactionResult } from './transactions';
|
|
5
|
+
import type { SignatureType } from './signature';
|
|
5
6
|
/**
|
|
6
7
|
* Result interface for connect operations
|
|
7
8
|
*/
|
|
@@ -64,7 +65,7 @@ export interface Connector {
|
|
|
64
65
|
* @param provider The wallet provider (required for injected connector)
|
|
65
66
|
* @returns A promise that resolves to the signature
|
|
66
67
|
*/
|
|
67
|
-
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<
|
|
68
|
+
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<SignatureType>;
|
|
68
69
|
/**
|
|
69
70
|
* Send a transaction with the connected wallet
|
|
70
71
|
* @param request The transaction request parameters
|
|
@@ -72,5 +73,6 @@ export interface Connector {
|
|
|
72
73
|
* @returns A promise that resolves to the transaction result
|
|
73
74
|
*/
|
|
74
75
|
sendTransaction?(request: TransactionRequest, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<TransactionResult>;
|
|
76
|
+
getWalletCapabilities?(from: string): Promise<Record<string, EVMCapabilities>>;
|
|
75
77
|
}
|
|
76
78
|
//# sourceMappingURL=connector.d.ts.map
|
package/dist/connector.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhD;;GAEG;AACH,MAAM,WAAW,eAAe;IA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AC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;CAC/E"}
|
package/dist/react-hooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError } from './index';
|
|
1
|
+
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError, EVMCapabilities, SignatureType } from './index';
|
|
2
2
|
/**
|
|
3
3
|
* WalletConnect connection interface for the useConnection hook
|
|
4
4
|
*/
|
|
@@ -104,6 +104,14 @@ export interface UseSessionReturn {
|
|
|
104
104
|
* The currently selected network, or null if not connected
|
|
105
105
|
*/
|
|
106
106
|
activeNetwork: Network | null;
|
|
107
|
+
/**
|
|
108
|
+
* The capabilities of the currently connected wallet, or null if not connected
|
|
109
|
+
*/
|
|
110
|
+
activeWalletCapabilities: Record<string, EVMCapabilities> | null;
|
|
111
|
+
/**
|
|
112
|
+
* The capabilities of the currently connected wallet on the active network, or null if not connected
|
|
113
|
+
*/
|
|
114
|
+
activeNetworkWalletCapabilities: EVMCapabilities | null;
|
|
107
115
|
/**
|
|
108
116
|
* List of networks available for the connected wallet
|
|
109
117
|
*/
|
|
@@ -176,7 +184,7 @@ export interface UseSignMessageReturn {
|
|
|
176
184
|
* @returns Promise that resolves to the signature string
|
|
177
185
|
* @throws Error if no wallet is connected or signing fails
|
|
178
186
|
*/
|
|
179
|
-
signMessage: (message: string) => Promise<
|
|
187
|
+
signMessage: (message: string) => Promise<SignatureType>;
|
|
180
188
|
/**
|
|
181
189
|
* Indicates if a message signing operation is currently in progress
|
|
182
190
|
*/
|
|
@@ -184,7 +192,7 @@ export interface UseSignMessageReturn {
|
|
|
184
192
|
/**
|
|
185
193
|
* The last signature result, undefined if no message has been signed yet
|
|
186
194
|
*/
|
|
187
|
-
signature:
|
|
195
|
+
signature: SignatureType | undefined;
|
|
188
196
|
/**
|
|
189
197
|
* Error from the last signing attempt, undefined if no error occurred
|
|
190
198
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-hooks.d.ts","sourceRoot":"","sources":["../src/react-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,
|
|
1
|
+
{"version":3,"file":"react-hooks.d.ts","sourceRoot":"","sources":["../src/react-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,OAAO,EACP,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,aAAa,EACd,MAAM,SAAS,CAAA;AAIhB;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;;OAGG;IACH,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;IAC9B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,aAAa,EAAE,uBAAuB,CAAA;IACtC;;OAEG;IACH,QAAQ,EAAE,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;;;;;OAKG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE,kBAAkB,KAAK,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAC5E;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAChD;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;CAC/B"}
|
package/dist/session.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConnectionMode } from './connection-mode';
|
|
2
2
|
import type { Network, NetworkId } from './networks';
|
|
3
|
+
import type { EVMCapabilities } from './transactions';
|
|
3
4
|
import type { WalletMetadata } from './UWC-state';
|
|
4
5
|
export interface AvailableAddress {
|
|
5
6
|
address: string;
|
|
@@ -8,6 +9,8 @@ export interface AvailableAddress {
|
|
|
8
9
|
export interface Session {
|
|
9
10
|
connectionMode: ConnectionMode | null;
|
|
10
11
|
activeNetwork: Network | null;
|
|
12
|
+
activeWalletCapabilities: Record<string, EVMCapabilities> | null;
|
|
13
|
+
activeNetworkWalletCapabilities: EVMCapabilities | null;
|
|
11
14
|
activeAddress: string | null;
|
|
12
15
|
availableNetworks: Network[];
|
|
13
16
|
activeWallet: WalletMetadata | null;
|
package/dist/session.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,iBAAiB,EAAE,OAAO,EAAE,CAAA;IAC5B,YAAY,EAAE,cAAc,GAAG,IAAI,CAAA;IACnC,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;CACvC"}
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,aAAa,EAAE,OAAO,GAAG,IAAI,CAAA;IAC7B,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,IAAI,CAAA;IAChE,+BAA+B,EAAE,eAAe,GAAG,IAAI,CAAA;IACvD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,iBAAiB,EAAE,OAAO,EAAE,CAAA;IAC5B,YAAY,EAAE,cAAc,GAAG,IAAI,CAAA;IACnC,kBAAkB,EAAE,gBAAgB,EAAE,CAAA;CACvC"}
|
package/dist/signature.d.ts
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import type { ExtensionInjectedProvider, IntegratedBrowserInjectedProvider } from './UWC-state';
|
|
2
|
+
/**
|
|
3
|
+
* Standard signature format for most blockchains (EVM, Solana, etc.)
|
|
4
|
+
*/
|
|
5
|
+
export interface StandardSignature {
|
|
6
|
+
type: 'standard';
|
|
7
|
+
signature: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Tron-specific signature format
|
|
11
|
+
*/
|
|
12
|
+
export interface TronSignature {
|
|
13
|
+
type: 'tron';
|
|
14
|
+
signature: string[];
|
|
15
|
+
txID: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Discriminated union type for all signature formats
|
|
19
|
+
*/
|
|
20
|
+
export type SignatureType = StandardSignature | TronSignature;
|
|
2
21
|
/**
|
|
3
22
|
* Result interface for signature operations
|
|
4
23
|
*/
|
|
5
24
|
export interface SignatureResult {
|
|
6
|
-
signature:
|
|
25
|
+
signature: SignatureType;
|
|
7
26
|
address: string;
|
|
8
27
|
}
|
|
9
28
|
/**
|
package/dist/signature.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../src/signature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,iCAAiC,EAClC,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../src/signature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,iCAAiC,EAClC,MAAM,aAAa,CAAA;AAEpB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,aAAa,CAAA;AAE7D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,aAAa,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,yBAAyB,GAAG,iCAAiC,GACtE,OAAO,CAAC,eAAe,CAAC,CAAA;CAC5B"}
|
package/dist/transactions.d.ts
CHANGED
|
@@ -30,14 +30,6 @@ export interface EVMContractCallRequest {
|
|
|
30
30
|
value?: string;
|
|
31
31
|
gasConfig?: EVMGasConfig;
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
34
|
-
* Single call in a batch transaction
|
|
35
|
-
*/
|
|
36
|
-
export interface EVMBatchCall {
|
|
37
|
-
to: string;
|
|
38
|
-
value: string;
|
|
39
|
-
data?: string;
|
|
40
|
-
}
|
|
41
33
|
/**
|
|
42
34
|
* Request for batch EVM transactions (EIP-5792)
|
|
43
35
|
*/
|
|
@@ -46,19 +38,20 @@ export interface EVMBatchTransactionRequest {
|
|
|
46
38
|
from: string;
|
|
47
39
|
chainId: string;
|
|
48
40
|
atomicRequired: boolean;
|
|
49
|
-
calls:
|
|
41
|
+
calls: (EVMNativeTransferRequest | EVMContractCallRequest)[];
|
|
50
42
|
}
|
|
51
43
|
/**
|
|
52
44
|
* EVM wallet capabilities
|
|
53
45
|
*/
|
|
54
46
|
export interface EVMCapabilities {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
paymasterService?: {
|
|
59
|
-
supported: boolean;
|
|
60
|
-
};
|
|
47
|
+
alternateGasFees?: EVMCapability;
|
|
48
|
+
atomic?: EVMCapability;
|
|
49
|
+
paymasterService?: EVMCapability;
|
|
61
50
|
}
|
|
51
|
+
export type EVMCapability = {
|
|
52
|
+
status: EVMCapabilityStatus;
|
|
53
|
+
};
|
|
54
|
+
export type EVMCapabilityStatus = 'supported' | 'ready' | 'unsupported';
|
|
62
55
|
/**
|
|
63
56
|
* Solana Transaction Types
|
|
64
57
|
*/
|
|
@@ -72,17 +65,41 @@ export interface SolanaNativeTransferRequest {
|
|
|
72
65
|
blockhash: string;
|
|
73
66
|
}
|
|
74
67
|
/**
|
|
75
|
-
*
|
|
68
|
+
* Request for SPL token transfer
|
|
76
69
|
*/
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
amount: string | number;
|
|
81
|
-
blockhash: string;
|
|
82
|
-
tokenMint?: string;
|
|
83
|
-
tokenDecimals?: number;
|
|
70
|
+
export interface SolanaTokenTransferRequest extends SolanaNativeTransferRequest {
|
|
71
|
+
tokenMint: string;
|
|
72
|
+
tokenDecimals: number;
|
|
84
73
|
tokenProgram?: string;
|
|
85
|
-
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Request for Solana transfers with instructions
|
|
77
|
+
*/
|
|
78
|
+
export interface SolanaGenericTransferRequest {
|
|
79
|
+
feePayer: string;
|
|
80
|
+
blockhash: string;
|
|
81
|
+
instructions: SolanaTransactionInstruction[];
|
|
82
|
+
states?: SolanaAddressLookupTable[];
|
|
83
|
+
additionalRequests?: (SolanaNativeTransferRequest | SolanaTokenTransferRequest)[];
|
|
84
|
+
}
|
|
85
|
+
export interface SolanaAddressLookupTable {
|
|
86
|
+
deactivationSlot: bigint;
|
|
87
|
+
lastExtendedSlot: number;
|
|
88
|
+
lastExtendedStartIndex: number;
|
|
89
|
+
key: string;
|
|
90
|
+
authority?: string;
|
|
91
|
+
addresses: string[];
|
|
92
|
+
}
|
|
93
|
+
export interface SolanaTransactionInstruction {
|
|
94
|
+
programId: string;
|
|
95
|
+
accounts: SolanaAccountMeta[];
|
|
96
|
+
data: string;
|
|
97
|
+
}
|
|
98
|
+
export interface SolanaAccountMeta {
|
|
99
|
+
shouldFillPubkey: boolean;
|
|
100
|
+
pubKey: string | null;
|
|
101
|
+
isWritable: boolean;
|
|
102
|
+
isSigner: boolean;
|
|
86
103
|
}
|
|
87
104
|
/**
|
|
88
105
|
* Common Transaction Types
|
|
@@ -99,11 +116,13 @@ export interface BatchTransactionResult {
|
|
|
99
116
|
status: number;
|
|
100
117
|
atomic: boolean;
|
|
101
118
|
receipts: Array<{
|
|
102
|
-
transactionHash:
|
|
119
|
+
transactionHash: TransactionResult;
|
|
103
120
|
}>;
|
|
104
121
|
}
|
|
105
122
|
/**
|
|
106
123
|
* Generic transaction request that can be either EVM or Solana
|
|
107
124
|
*/
|
|
108
|
-
export type TransactionRequest =
|
|
125
|
+
export type TransactionRequest = EthereumTransactionRequest | SolanaTransactionRequest;
|
|
126
|
+
export type EthereumTransactionRequest = EVMNativeTransferRequest | EVMContractCallRequest | EVMBatchTransactionRequest;
|
|
127
|
+
export type SolanaTransactionRequest = SolanaNativeTransferRequest | SolanaTokenTransferRequest | SolanaGenericTransferRequest;
|
|
109
128
|
//# sourceMappingURL=transactions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,YAAY,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAA;IAEvB,GAAG,EAAE,GAAG,EAAE,CAAA;IACV,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;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEtC;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,KAAK,CAAC;QACd,eAAe,EAAE,iBAAiB,CAAA;KACnC,CAAC,CAAA;CACH;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,0BAA0B,GAC1B,wBAAwB,CAAA;AAE5B,MAAM,MAAM,0BAA0B,GAClC,wBAAwB,GACxB,sBAAsB,GACtB,0BAA0B,CAAA;AAE9B,MAAM,MAAM,wBAAwB,GAChC,2BAA2B,GAC3B,0BAA0B,GAC1B,4BAA4B,CAAA"}
|
package/package.json
CHANGED
package/src/connector.ts
CHANGED
|
@@ -7,7 +7,12 @@ import type {
|
|
|
7
7
|
IntegratedBrowserInjectedProvider,
|
|
8
8
|
WalletConnectProvider
|
|
9
9
|
} from './UWC-state'
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
EVMCapabilities,
|
|
12
|
+
TransactionRequest,
|
|
13
|
+
TransactionResult
|
|
14
|
+
} from './transactions'
|
|
15
|
+
import type { SignatureType } from './signature'
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Result interface for connect operations
|
|
@@ -100,7 +105,7 @@ export interface Connector {
|
|
|
100
105
|
| ExtensionInjectedProvider
|
|
101
106
|
| IntegratedBrowserInjectedProvider
|
|
102
107
|
| WalletConnectProvider
|
|
103
|
-
): Promise<
|
|
108
|
+
): Promise<SignatureType>
|
|
104
109
|
|
|
105
110
|
/**
|
|
106
111
|
* Send a transaction with the connected wallet
|
|
@@ -115,4 +120,6 @@ export interface Connector {
|
|
|
115
120
|
| IntegratedBrowserInjectedProvider
|
|
116
121
|
| WalletConnectProvider
|
|
117
122
|
): Promise<TransactionResult>
|
|
123
|
+
|
|
124
|
+
getWalletCapabilities?(from: string): Promise<Record<string, EVMCapabilities>>
|
|
118
125
|
}
|
package/src/network-rpc.ts
CHANGED
package/src/react-hooks.ts
CHANGED
|
@@ -6,7 +6,9 @@ import type {
|
|
|
6
6
|
AvailableAddress,
|
|
7
7
|
TransactionRequest,
|
|
8
8
|
TransactionResult,
|
|
9
|
-
WalletError
|
|
9
|
+
WalletError,
|
|
10
|
+
EVMCapabilities,
|
|
11
|
+
SignatureType
|
|
10
12
|
} from './index'
|
|
11
13
|
|
|
12
14
|
// useConnection hook types
|
|
@@ -121,6 +123,14 @@ export interface UseSessionReturn {
|
|
|
121
123
|
* The currently selected network, or null if not connected
|
|
122
124
|
*/
|
|
123
125
|
activeNetwork: Network | null
|
|
126
|
+
/**
|
|
127
|
+
* The capabilities of the currently connected wallet, or null if not connected
|
|
128
|
+
*/
|
|
129
|
+
activeWalletCapabilities: Record<string, EVMCapabilities> | null
|
|
130
|
+
/**
|
|
131
|
+
* The capabilities of the currently connected wallet on the active network, or null if not connected
|
|
132
|
+
*/
|
|
133
|
+
activeNetworkWalletCapabilities: EVMCapabilities | null
|
|
124
134
|
/**
|
|
125
135
|
* List of networks available for the connected wallet
|
|
126
136
|
*/
|
|
@@ -199,7 +209,7 @@ export interface UseSignMessageReturn {
|
|
|
199
209
|
* @returns Promise that resolves to the signature string
|
|
200
210
|
* @throws Error if no wallet is connected or signing fails
|
|
201
211
|
*/
|
|
202
|
-
signMessage: (message: string) => Promise<
|
|
212
|
+
signMessage: (message: string) => Promise<SignatureType>
|
|
203
213
|
/**
|
|
204
214
|
* Indicates if a message signing operation is currently in progress
|
|
205
215
|
*/
|
|
@@ -207,7 +217,7 @@ export interface UseSignMessageReturn {
|
|
|
207
217
|
/**
|
|
208
218
|
* The last signature result, undefined if no message has been signed yet
|
|
209
219
|
*/
|
|
210
|
-
signature:
|
|
220
|
+
signature: SignatureType | undefined
|
|
211
221
|
/**
|
|
212
222
|
* Error from the last signing attempt, undefined if no error occurred
|
|
213
223
|
*/
|
package/src/session.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ConnectionMode } from './connection-mode'
|
|
2
2
|
import type { Network, NetworkId } from './networks'
|
|
3
|
+
import type { EVMCapabilities } from './transactions'
|
|
3
4
|
import type { WalletMetadata } from './UWC-state'
|
|
4
5
|
|
|
5
6
|
export interface AvailableAddress {
|
|
@@ -10,6 +11,8 @@ export interface AvailableAddress {
|
|
|
10
11
|
export interface Session {
|
|
11
12
|
connectionMode: ConnectionMode | null
|
|
12
13
|
activeNetwork: Network | null
|
|
14
|
+
activeWalletCapabilities: Record<string, EVMCapabilities> | null
|
|
15
|
+
activeNetworkWalletCapabilities: EVMCapabilities | null
|
|
13
16
|
activeAddress: string | null
|
|
14
17
|
availableNetworks: Network[]
|
|
15
18
|
activeWallet: WalletMetadata | null
|
package/src/signature.ts
CHANGED
|
@@ -3,11 +3,33 @@ import type {
|
|
|
3
3
|
IntegratedBrowserInjectedProvider
|
|
4
4
|
} from './UWC-state'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Standard signature format for most blockchains (EVM, Solana, etc.)
|
|
8
|
+
*/
|
|
9
|
+
export interface StandardSignature {
|
|
10
|
+
type: 'standard'
|
|
11
|
+
signature: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Tron-specific signature format
|
|
16
|
+
*/
|
|
17
|
+
export interface TronSignature {
|
|
18
|
+
type: 'tron'
|
|
19
|
+
signature: string[]
|
|
20
|
+
txID: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Discriminated union type for all signature formats
|
|
25
|
+
*/
|
|
26
|
+
export type SignatureType = StandardSignature | TronSignature
|
|
27
|
+
|
|
6
28
|
/**
|
|
7
29
|
* Result interface for signature operations
|
|
8
30
|
*/
|
|
9
31
|
export interface SignatureResult {
|
|
10
|
-
signature:
|
|
32
|
+
signature: SignatureType
|
|
11
33
|
address: string
|
|
12
34
|
}
|
|
13
35
|
|
|
@@ -33,4 +55,4 @@ export interface SignatureService {
|
|
|
33
55
|
message: string,
|
|
34
56
|
provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider
|
|
35
57
|
): Promise<SignatureResult>
|
|
36
|
-
}
|
|
58
|
+
}
|
package/src/transactions.ts
CHANGED
|
@@ -35,15 +35,6 @@ export interface EVMContractCallRequest {
|
|
|
35
35
|
gasConfig?: EVMGasConfig
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* Single call in a batch transaction
|
|
40
|
-
*/
|
|
41
|
-
export interface EVMBatchCall {
|
|
42
|
-
to: string
|
|
43
|
-
value: string
|
|
44
|
-
data?: string
|
|
45
|
-
}
|
|
46
|
-
|
|
47
38
|
/**
|
|
48
39
|
* Request for batch EVM transactions (EIP-5792)
|
|
49
40
|
*/
|
|
@@ -52,21 +43,24 @@ export interface EVMBatchTransactionRequest {
|
|
|
52
43
|
from: string
|
|
53
44
|
chainId: string
|
|
54
45
|
atomicRequired: boolean
|
|
55
|
-
calls:
|
|
46
|
+
calls: (EVMNativeTransferRequest | EVMContractCallRequest)[]
|
|
56
47
|
}
|
|
57
48
|
|
|
58
49
|
/**
|
|
59
50
|
* EVM wallet capabilities
|
|
60
51
|
*/
|
|
61
52
|
export interface EVMCapabilities {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
paymasterService?: {
|
|
66
|
-
supported: boolean
|
|
67
|
-
}
|
|
53
|
+
alternateGasFees?: EVMCapability
|
|
54
|
+
atomic?: EVMCapability
|
|
55
|
+
paymasterService?: EVMCapability
|
|
68
56
|
}
|
|
69
57
|
|
|
58
|
+
export type EVMCapability = {
|
|
59
|
+
status: EVMCapabilityStatus
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type EVMCapabilityStatus = 'supported' | 'ready' | 'unsupported'
|
|
63
|
+
|
|
70
64
|
/**
|
|
71
65
|
* Solana Transaction Types
|
|
72
66
|
*/
|
|
@@ -82,18 +76,49 @@ export interface SolanaNativeTransferRequest {
|
|
|
82
76
|
}
|
|
83
77
|
|
|
84
78
|
/**
|
|
85
|
-
*
|
|
79
|
+
* Request for SPL token transfer
|
|
86
80
|
*/
|
|
87
|
-
export interface
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
blockhash: string
|
|
92
|
-
// Token-specific
|
|
93
|
-
tokenMint?: string
|
|
94
|
-
tokenDecimals?: number
|
|
81
|
+
export interface SolanaTokenTransferRequest
|
|
82
|
+
extends SolanaNativeTransferRequest {
|
|
83
|
+
tokenMint: string
|
|
84
|
+
tokenDecimals: number
|
|
95
85
|
tokenProgram?: string
|
|
96
|
-
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Request for Solana transfers with instructions
|
|
90
|
+
*/
|
|
91
|
+
export interface SolanaGenericTransferRequest {
|
|
92
|
+
feePayer: string
|
|
93
|
+
blockhash: string
|
|
94
|
+
instructions: SolanaTransactionInstruction[]
|
|
95
|
+
states?: SolanaAddressLookupTable[]
|
|
96
|
+
additionalRequests?: (
|
|
97
|
+
| SolanaNativeTransferRequest
|
|
98
|
+
| SolanaTokenTransferRequest
|
|
99
|
+
)[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface SolanaAddressLookupTable {
|
|
103
|
+
deactivationSlot: bigint
|
|
104
|
+
lastExtendedSlot: number
|
|
105
|
+
lastExtendedStartIndex: number
|
|
106
|
+
key: string
|
|
107
|
+
authority?: string
|
|
108
|
+
addresses: string[]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface SolanaTransactionInstruction {
|
|
112
|
+
programId: string
|
|
113
|
+
accounts: SolanaAccountMeta[]
|
|
114
|
+
data: string
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface SolanaAccountMeta {
|
|
118
|
+
shouldFillPubkey: boolean
|
|
119
|
+
pubKey: string | null
|
|
120
|
+
isWritable: boolean
|
|
121
|
+
isSigner: boolean
|
|
97
122
|
}
|
|
98
123
|
|
|
99
124
|
/**
|
|
@@ -113,7 +138,7 @@ export interface BatchTransactionResult {
|
|
|
113
138
|
status: number
|
|
114
139
|
atomic: boolean
|
|
115
140
|
receipts: Array<{
|
|
116
|
-
transactionHash:
|
|
141
|
+
transactionHash: TransactionResult
|
|
117
142
|
}>
|
|
118
143
|
}
|
|
119
144
|
|
|
@@ -121,7 +146,15 @@ export interface BatchTransactionResult {
|
|
|
121
146
|
* Generic transaction request that can be either EVM or Solana
|
|
122
147
|
*/
|
|
123
148
|
export type TransactionRequest =
|
|
149
|
+
| EthereumTransactionRequest
|
|
150
|
+
| SolanaTransactionRequest
|
|
151
|
+
|
|
152
|
+
export type EthereumTransactionRequest =
|
|
124
153
|
| EVMNativeTransferRequest
|
|
125
154
|
| EVMContractCallRequest
|
|
126
155
|
| EVMBatchTransactionRequest
|
|
156
|
+
|
|
157
|
+
export type SolanaTransactionRequest =
|
|
127
158
|
| SolanaNativeTransferRequest
|
|
159
|
+
| SolanaTokenTransferRequest
|
|
160
|
+
| SolanaGenericTransferRequest
|