@meshconnect/uwc-types 0.2.0
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/UWC-state.d.ts +62 -0
- package/dist/UWC-state.d.ts.map +1 -0
- package/dist/UWC-state.js +2 -0
- package/dist/UWC-state.js.map +1 -0
- package/dist/connection-mode.d.ts +2 -0
- package/dist/connection-mode.d.ts.map +1 -0
- package/dist/connection-mode.js +2 -0
- package/dist/connection-mode.js.map +1 -0
- package/dist/connector.d.ts +76 -0
- package/dist/connector.d.ts.map +1 -0
- package/dist/connector.js +2 -0
- package/dist/connector.js.map +1 -0
- package/dist/errors.d.ts +14 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/network-rpc.d.ts +6 -0
- package/dist/network-rpc.d.ts.map +1 -0
- package/dist/network-rpc.js +2 -0
- package/dist/network-rpc.js.map +1 -0
- package/dist/networks.d.ts +33 -0
- package/dist/networks.d.ts.map +1 -0
- package/dist/networks.js +2 -0
- package/dist/networks.js.map +1 -0
- package/dist/providers.d.ts +7 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +2 -0
- package/dist/providers.js.map +1 -0
- package/dist/react-hooks.d.ts +231 -0
- package/dist/react-hooks.d.ts.map +1 -0
- package/dist/react-hooks.js +2 -0
- package/dist/react-hooks.js.map +1 -0
- package/dist/session.d.ts +16 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +2 -0
- package/dist/session.js.map +1 -0
- package/dist/signature.d.ts +28 -0
- package/dist/signature.d.ts.map +1 -0
- package/dist/signature.js +2 -0
- package/dist/signature.js.map +1 -0
- package/dist/transactions.d.ts +109 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +5 -0
- package/dist/transactions.js.map +1 -0
- package/dist/wallet-connect-connector.d.ts +13 -0
- package/dist/wallet-connect-connector.d.ts.map +1 -0
- package/dist/wallet-connect-connector.js +2 -0
- package/dist/wallet-connect-connector.js.map +1 -0
- package/package.json +32 -0
- package/src/UWC-state.ts +77 -0
- package/src/connection-mode.ts +1 -0
- package/src/connector.ts +118 -0
- package/src/errors.ts +20 -0
- package/src/index.ts +12 -0
- package/src/network-rpc.ts +6 -0
- package/src/networks.ts +62 -0
- package/src/providers.ts +14 -0
- package/src/react-hooks.ts +256 -0
- package/src/session.ts +17 -0
- package/src/signature.ts +36 -0
- package/src/transactions.ts +127 -0
- package/src/wallet-connect-connector.ts +12 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { NetworkId, Namespace } from './networks';
|
|
2
|
+
import type { Session } from './session';
|
|
3
|
+
export interface UniversalWalletConnectorState {
|
|
4
|
+
session: Session;
|
|
5
|
+
}
|
|
6
|
+
export interface DetectedEIP6963WalletInfo {
|
|
7
|
+
uuid: string;
|
|
8
|
+
name: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
rdns: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DetectedSolanaWalletInfo {
|
|
13
|
+
uuid: string;
|
|
14
|
+
name: string;
|
|
15
|
+
features: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface Eip155Metadata {
|
|
18
|
+
eip155Name: string;
|
|
19
|
+
injectedId: string;
|
|
20
|
+
supportsAddingNetworks: boolean;
|
|
21
|
+
requiresUserApprovalOnNetworkSwitch: boolean;
|
|
22
|
+
installed?: boolean;
|
|
23
|
+
detectedWallet?: DetectedEIP6963WalletInfo;
|
|
24
|
+
}
|
|
25
|
+
export interface SolanaMetadata {
|
|
26
|
+
walletStandardName?: string;
|
|
27
|
+
injectedId?: string;
|
|
28
|
+
ignoredInjectedIds?: string[];
|
|
29
|
+
installed?: boolean;
|
|
30
|
+
detectedWallet?: DetectedSolanaWalletInfo;
|
|
31
|
+
}
|
|
32
|
+
type NamespaceMetaDataMap = {
|
|
33
|
+
[K in Namespace]?: K extends 'eip155' ? Eip155Metadata : K extends 'solana' ? SolanaMetadata : undefined;
|
|
34
|
+
};
|
|
35
|
+
export interface ExtensionInjectedProvider {
|
|
36
|
+
supportedNetworkIds: NetworkId[];
|
|
37
|
+
namespaceMetaData: Partial<NamespaceMetaDataMap>;
|
|
38
|
+
requiresUserApprovalOnNamespaceSwitch: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface IntegratedBrowserInjectedProvider extends ExtensionInjectedProvider {
|
|
41
|
+
integratedBrowserDeeplink: string;
|
|
42
|
+
}
|
|
43
|
+
export type DeeplinkType = 'universal' | 'native';
|
|
44
|
+
export interface WalletConnectProvider {
|
|
45
|
+
supportedNetworkIds: NetworkId[];
|
|
46
|
+
deeplinks: {
|
|
47
|
+
universal: string;
|
|
48
|
+
native: string;
|
|
49
|
+
androidPreferredDeeplink?: DeeplinkType;
|
|
50
|
+
iOSPreferredDeeplink?: DeeplinkType;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface WalletMetadata {
|
|
54
|
+
id: string;
|
|
55
|
+
name: string;
|
|
56
|
+
metadata: Record<string, any>;
|
|
57
|
+
extensionInjectedProvider?: ExtensionInjectedProvider;
|
|
58
|
+
integratedBrowserInjectedProvider?: IntegratedBrowserInjectedProvider;
|
|
59
|
+
walletConnectProvider?: WalletConnectProvider;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=UWC-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UWC-state.d.ts","sourceRoot":"","sources":["../src/UWC-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAExC,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,y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;IAChC,SAAS,EAAE;QACT,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,wBAAwB,CAAC,EAAE,YAAY,CAAA;QACvC,oBAAoB,CAAC,EAAE,YAAY,CAAA;KACpC,CAAA;CACF;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IAEZ,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC7B,yBAAyB,CAAC,EAAE,yBAAyB,CAAA;IACrD,iCAAiC,CAAC,EAAE,iCAAiC,CAAA;IACrE,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;CAC9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UWC-state.js","sourceRoot":"","sources":["../src/UWC-state.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-mode.d.ts","sourceRoot":"","sources":["../src/connection-mode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-mode.js","sourceRoot":"","sources":["../src/connection-mode.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Network, NetworkId, Namespace } from './networks';
|
|
2
|
+
import type { AvailableAddress } from './session';
|
|
3
|
+
import type { DetectedEIP6963WalletInfo, DetectedSolanaWalletInfo, ExtensionInjectedProvider, IntegratedBrowserInjectedProvider, WalletConnectProvider } from './UWC-state';
|
|
4
|
+
import type { TransactionRequest, TransactionResult } from './transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Result interface for connect operations
|
|
7
|
+
*/
|
|
8
|
+
export interface ConnectorResult {
|
|
9
|
+
networkId: NetworkId;
|
|
10
|
+
address: string;
|
|
11
|
+
availableAddresses: AvailableAddress[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Result interface for network switch operations
|
|
15
|
+
*/
|
|
16
|
+
export interface SwitchNetworkResult {
|
|
17
|
+
networkId: NetworkId;
|
|
18
|
+
address: string;
|
|
19
|
+
availableAddresses?: AvailableAddress[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Common interface for all wallet connectors
|
|
23
|
+
*/
|
|
24
|
+
export interface Connector {
|
|
25
|
+
/**
|
|
26
|
+
* Connect to a wallet on the specified network
|
|
27
|
+
* @param network The network to connect to
|
|
28
|
+
* @param args Additional arguments specific to the connector type
|
|
29
|
+
* @returns A promise that resolves to a ConnectorResult containing the network ID, wallet address, and available addresses
|
|
30
|
+
*/
|
|
31
|
+
connect(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<ConnectorResult>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the connection URI for the wallet, if applicable
|
|
34
|
+
* This is typically used for WalletConnect or similar protocols
|
|
35
|
+
* to allow the user to scan a QR code or open a link
|
|
36
|
+
* to initiate the connection.
|
|
37
|
+
* @return A string representing the connection URI, or undefined if not applicable
|
|
38
|
+
* @remarks This method is optional and may not be implemented by all connectors.
|
|
39
|
+
*/
|
|
40
|
+
getConnectionURI?(): string;
|
|
41
|
+
/**
|
|
42
|
+
* Disconnect from the wallet
|
|
43
|
+
* This method is optional and may not be implemented by all connectors.
|
|
44
|
+
* @returns A promise that resolves when the disconnection is complete
|
|
45
|
+
*/
|
|
46
|
+
disconnect?(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Switch to a different network
|
|
49
|
+
* @param network The network to switch to
|
|
50
|
+
* @param args Additional arguments specific to the connector type
|
|
51
|
+
* @returns A promise that resolves to a SwitchNetworkResult containing the network ID and new wallet address
|
|
52
|
+
*/
|
|
53
|
+
switchNetwork(network: Network, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<SwitchNetworkResult>;
|
|
54
|
+
/**
|
|
55
|
+
* Get available wallets for a specific namespace
|
|
56
|
+
* This method is optional and may not be implemented by all connectors.
|
|
57
|
+
* @param namespace The namespace to check for available wallets (e.g., 'eip155', 'solana')
|
|
58
|
+
* @returns A promise that resolves to an array of detected wallets, or undefined if not supported
|
|
59
|
+
*/
|
|
60
|
+
getAvailableWallets?(namespace: Namespace): Promise<DetectedEIP6963WalletInfo[] | DetectedSolanaWalletInfo[]>;
|
|
61
|
+
/**
|
|
62
|
+
* Sign a message with the connected wallet
|
|
63
|
+
* @param message The message to sign
|
|
64
|
+
* @param provider The wallet provider (required for injected connector)
|
|
65
|
+
* @returns A promise that resolves to the signature
|
|
66
|
+
*/
|
|
67
|
+
signMessage?(message: string, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Send a transaction with the connected wallet
|
|
70
|
+
* @param request The transaction request parameters
|
|
71
|
+
* @param provider The wallet provider (required for injected connector)
|
|
72
|
+
* @returns A promise that resolves to the transaction result
|
|
73
|
+
*/
|
|
74
|
+
sendTransaction?(request: TransactionRequest, provider?: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider): Promise<TransactionResult>;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=connector.d.ts.map
|
|
@@ -0,0 +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,EAAE,kBAAkB,EAAE,i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CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":""}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ErrorType = 'unknown' | 'rejected';
|
|
2
|
+
export interface WalletError {
|
|
3
|
+
type: ErrorType;
|
|
4
|
+
message: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Custom error class that includes wallet error metadata
|
|
8
|
+
* This is thrown by the connectors when operations fail
|
|
9
|
+
*/
|
|
10
|
+
export declare class WalletConnectorError extends Error {
|
|
11
|
+
type: ErrorType;
|
|
12
|
+
constructor(walletError: WalletError);
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,EAAE,SAAS,CAAA;gBAEH,WAAW,EAAE,WAAW;CAKrC"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error class that includes wallet error metadata
|
|
3
|
+
* This is thrown by the connectors when operations fail
|
|
4
|
+
*/
|
|
5
|
+
export class WalletConnectorError extends Error {
|
|
6
|
+
type;
|
|
7
|
+
constructor(walletError) {
|
|
8
|
+
super(walletError.message);
|
|
9
|
+
this.name = 'WalletConnectorError';
|
|
10
|
+
this.type = walletError.type;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,IAAI,CAAW;IAEf,YAAY,WAAwB;QAClC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAC1B,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAA;IAC9B,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './networks';
|
|
2
|
+
export * from './network-rpc';
|
|
3
|
+
export * from './connection-mode';
|
|
4
|
+
export * from './session';
|
|
5
|
+
export * from './UWC-state';
|
|
6
|
+
export * from './connector';
|
|
7
|
+
export * from './providers';
|
|
8
|
+
export * from './wallet-connect-connector';
|
|
9
|
+
export * from './react-hooks';
|
|
10
|
+
export * from './signature';
|
|
11
|
+
export * from './transactions';
|
|
12
|
+
export * from './errors';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './networks';
|
|
2
|
+
export * from './network-rpc';
|
|
3
|
+
export * from './connection-mode';
|
|
4
|
+
export * from './session';
|
|
5
|
+
export * from './UWC-state';
|
|
6
|
+
export * from './connector';
|
|
7
|
+
export * from './providers';
|
|
8
|
+
export * from './wallet-connect-connector';
|
|
9
|
+
export * from './react-hooks';
|
|
10
|
+
export * from './signature';
|
|
11
|
+
export * from './transactions';
|
|
12
|
+
export * from './errors';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-rpc.d.ts","sourceRoot":"","sources":["../src/network-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-rpc.js","sourceRoot":"","sources":["../src/network-rpc.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type NetworkId = 'eip155:1' | 'eip155:11155111' | 'solana:devnet' | 'eip155:56' | 'eip155:137' | 'eip155:43114' | 'eip155:42161' | 'eip155:10' | 'eip155:8453' | 'bip122:000000000019d6689c085ae165831e93' | 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' | 'tron:0x2b6653dc' | 'eip155:81457' | 'bip122:1a91e3dace36e2be3bf030a65679fe82' | 'xrpl:0' | 'bip122:12a765e31ffd4059bada1e25190f6e98';
|
|
2
|
+
export type NetworkType = 'evm' | 'solana' | 'bitcoin' | 'tron' | 'dogecoin' | 'litecoin' | 'ripple';
|
|
3
|
+
export type Namespace = 'eip155' | 'solana' | 'bip122' | 'tron' | 'xrpl';
|
|
4
|
+
export interface NativeCurrency {
|
|
5
|
+
name: string;
|
|
6
|
+
symbol: string;
|
|
7
|
+
decimals: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RpcUrls {
|
|
10
|
+
default: {
|
|
11
|
+
http: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface BlockExplorer {
|
|
15
|
+
name: string;
|
|
16
|
+
url: string;
|
|
17
|
+
apiUrl?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface BlockExplorers {
|
|
20
|
+
default: BlockExplorer;
|
|
21
|
+
}
|
|
22
|
+
export interface Network {
|
|
23
|
+
internalId: number;
|
|
24
|
+
id: NetworkId;
|
|
25
|
+
namespace: Namespace;
|
|
26
|
+
name: string;
|
|
27
|
+
logoUrl: string;
|
|
28
|
+
nativeCurrency: NativeCurrency;
|
|
29
|
+
rpcUrls?: RpcUrls;
|
|
30
|
+
blockExplorers?: BlockExplorers;
|
|
31
|
+
networkType: NetworkType;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=networks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.d.ts","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,UAAU,GACV,iBAAiB,GACjB,eAAe,GACf,WAAW,GACX,YAAY,GACZ,cAAc,GACd,cAAc,GACd,WAAW,GACX,aAAa,GACb,yCAAyC,GACzC,yCAAyC,GACzC,iBAAiB,GACjB,cAAc,GACd,yCAAyC,GACzC,QAAQ,GACR,yCAAyC,CAAA;AAE7C,MAAM,MAAM,WAAW,GACnB,KAAK,GACL,QAAQ,GACR,SAAS,GACT,MAAM,GACN,UAAU,GACV,UAAU,GACV,QAAQ,CAAA;AAEZ,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAA;AAExE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,EAAE,CAAA;KACf,CAAA;CACF;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,SAAS,CAAA;IACb,SAAS,EAAE,SAAS,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,cAAc,CAAA;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,WAAW,EAAE,WAAW,CAAA;CACzB"}
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"networks.js","sourceRoot":"","sources":["../src/networks.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ExtensionInjectedProvider, IntegratedBrowserInjectedProvider, WalletConnectProvider } from './UWC-state';
|
|
2
|
+
/**
|
|
3
|
+
* Union type of all supported provider types
|
|
4
|
+
* Used throughout the application to handle different wallet provider types
|
|
5
|
+
*/
|
|
6
|
+
export type SupportedProvider = ExtensionInjectedProvider | IntegratedBrowserInjectedProvider | WalletConnectProvider;
|
|
7
|
+
//# sourceMappingURL=providers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,iCAAiC,EACjC,qBAAqB,EACtB,MAAM,aAAa,CAAA;AAEpB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB,yBAAyB,GACzB,iCAAiC,GACjC,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import type { NetworkId, Network, ConnectionMode, Session, AvailableAddress, TransactionRequest, TransactionResult, WalletError } from './index';
|
|
2
|
+
/**
|
|
3
|
+
* WalletConnect connection interface for the useConnection hook
|
|
4
|
+
*/
|
|
5
|
+
export interface WalletConnectConnection {
|
|
6
|
+
/**
|
|
7
|
+
* Connects to the specified wallet using WalletConnect protocol
|
|
8
|
+
* @param networkId - Optional network ID to connect to. If not provided, uses the default network
|
|
9
|
+
* @returns Promise that resolves when connection is established
|
|
10
|
+
*/
|
|
11
|
+
connect: (networkId?: NetworkId) => Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* The WalletConnect connection URI for QR code display
|
|
14
|
+
* Will be undefined if not using WalletConnect or if connection is already established
|
|
15
|
+
*/
|
|
16
|
+
connectionURI: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates if the WalletConnect connection is currently being established
|
|
19
|
+
*/
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Error from the last connection attempt, undefined if no error occurred
|
|
23
|
+
*/
|
|
24
|
+
error: WalletError | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Indicates if WalletConnect is currently available for use
|
|
27
|
+
* This depends on whether the wallet supports WalletConnect
|
|
28
|
+
*/
|
|
29
|
+
available: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Injected wallet connection interface for the useConnection hook
|
|
33
|
+
*/
|
|
34
|
+
export interface InjectedConnection {
|
|
35
|
+
/**
|
|
36
|
+
* Connects to the specified wallet using browser injection (MetaMask, Trust Wallet, etc.)
|
|
37
|
+
* @param networkId - Optional network ID to connect to. If not provided, uses the default network
|
|
38
|
+
* @returns Promise that resolves when connection is established
|
|
39
|
+
*/
|
|
40
|
+
connect: (networkId?: NetworkId) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Indicates if the injected wallet connection is currently being established
|
|
43
|
+
*/
|
|
44
|
+
isLoading: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Error from the last connection attempt, undefined if no error occurred
|
|
47
|
+
*/
|
|
48
|
+
error: WalletError | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Indicates if injected connection is currently available for use
|
|
51
|
+
*/
|
|
52
|
+
available: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Return type for the useConnection hook
|
|
56
|
+
* @example
|
|
57
|
+
* ```tsx
|
|
58
|
+
* const { walletConnect, injected } = useConnection('metamask')
|
|
59
|
+
*
|
|
60
|
+
* // Connect with WalletConnect
|
|
61
|
+
* await walletConnect.connect('eip155:1')
|
|
62
|
+
* console.log(walletConnect.connectionURI) // Display QR code
|
|
63
|
+
*
|
|
64
|
+
* // Connect with injected wallet
|
|
65
|
+
* await injected.connect('eip155:1')
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export interface UseConnectionReturn {
|
|
69
|
+
/**
|
|
70
|
+
* WalletConnect connection methods and state
|
|
71
|
+
*/
|
|
72
|
+
walletConnect: WalletConnectConnection;
|
|
73
|
+
/**
|
|
74
|
+
* Injected wallet connection methods and state
|
|
75
|
+
*/
|
|
76
|
+
injected: InjectedConnection;
|
|
77
|
+
/**
|
|
78
|
+
* Indicates if wallet detection has completed and the connector is ready to use
|
|
79
|
+
*/
|
|
80
|
+
isReady: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Return type for the useSession hook
|
|
84
|
+
* Provides access to the current wallet session state
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* const { activeAddress, activeNetwork, session } = useSession()
|
|
88
|
+
*
|
|
89
|
+
* if (activeAddress) {
|
|
90
|
+
* console.log(`Connected to ${activeNetwork?.name} with ${activeAddress}`)
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface UseSessionReturn {
|
|
95
|
+
/**
|
|
96
|
+
* The complete session object containing all wallet connection state
|
|
97
|
+
*/
|
|
98
|
+
session: Session;
|
|
99
|
+
/**
|
|
100
|
+
* The currently connected wallet address, or null if not connected
|
|
101
|
+
*/
|
|
102
|
+
activeAddress: string | null;
|
|
103
|
+
/**
|
|
104
|
+
* The currently selected network, or null if not connected
|
|
105
|
+
*/
|
|
106
|
+
activeNetwork: Network | null;
|
|
107
|
+
/**
|
|
108
|
+
* List of networks available for the connected wallet
|
|
109
|
+
*/
|
|
110
|
+
availableNetworks: Network[];
|
|
111
|
+
/**
|
|
112
|
+
* The active connection mode ('injected' or 'walletConnect'), or null if not connected
|
|
113
|
+
*/
|
|
114
|
+
activeConnector: ConnectionMode | null;
|
|
115
|
+
/**
|
|
116
|
+
* List of available addresses for the connected wallet
|
|
117
|
+
*/
|
|
118
|
+
availableAddresses: AvailableAddress[];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Return type for the useSwitchNetwork hook
|
|
122
|
+
* Provides network switching functionality with loading states
|
|
123
|
+
* @example
|
|
124
|
+
* ```tsx
|
|
125
|
+
* const { switchNetwork, isLoading, isWaitingForUserApproval } = useSwitchNetwork()
|
|
126
|
+
*
|
|
127
|
+
* const handleNetworkSwitch = async () => {
|
|
128
|
+
* await switchNetwork('eip155:8453') // Switch to Base
|
|
129
|
+
*
|
|
130
|
+
* if (isWaitingForUserApproval) {
|
|
131
|
+
* console.log('Waiting for user to approve in wallet...')
|
|
132
|
+
* }
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
export interface UseSwitchNetworkReturn {
|
|
137
|
+
/**
|
|
138
|
+
* Switches the connected wallet to the specified network
|
|
139
|
+
* @param networkId - The ID of the network to switch to (e.g., 'eip155:1' for Ethereum mainnet)
|
|
140
|
+
* @returns Promise that resolves when the network switch is complete
|
|
141
|
+
* @throws Error if network switch fails or is rejected by the user
|
|
142
|
+
*/
|
|
143
|
+
switchNetwork: (networkId: NetworkId) => Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Indicates if a network switch operation is currently in progress
|
|
146
|
+
*/
|
|
147
|
+
isLoading: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Indicates if the wallet is waiting for user approval to switch networks
|
|
150
|
+
* This depends on the wallet's metadata configuration (requiresUserApprovalOnNetworkSwitch)
|
|
151
|
+
*/
|
|
152
|
+
isWaitingForUserApproval: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Error from the last network switch attempt, undefined if no error occurred
|
|
155
|
+
*/
|
|
156
|
+
error: WalletError | undefined;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Return type for the useSignMessage hook
|
|
160
|
+
* Provides message signing functionality with loading state and signature result
|
|
161
|
+
* @example
|
|
162
|
+
* ```tsx
|
|
163
|
+
* const { signMessage, isLoading, signature } = useSignMessage()
|
|
164
|
+
*
|
|
165
|
+
* const handleSign = async () => {
|
|
166
|
+
* const sig = await signMessage('Hello World')
|
|
167
|
+
* console.log('Signature:', sig)
|
|
168
|
+
* // The signature state will also contain the result
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export interface UseSignMessageReturn {
|
|
173
|
+
/**
|
|
174
|
+
* Signs a message with the connected wallet
|
|
175
|
+
* @param message - The message to sign
|
|
176
|
+
* @returns Promise that resolves to the signature string
|
|
177
|
+
* @throws Error if no wallet is connected or signing fails
|
|
178
|
+
*/
|
|
179
|
+
signMessage: (message: string) => Promise<string>;
|
|
180
|
+
/**
|
|
181
|
+
* Indicates if a message signing operation is currently in progress
|
|
182
|
+
*/
|
|
183
|
+
isLoading: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* The last signature result, undefined if no message has been signed yet
|
|
186
|
+
*/
|
|
187
|
+
signature: string | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Error from the last signing attempt, undefined if no error occurred
|
|
190
|
+
*/
|
|
191
|
+
error: WalletError | undefined;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Return type for the useTransaction hook
|
|
195
|
+
* Provides transaction sending functionality with loading state and result
|
|
196
|
+
* @example
|
|
197
|
+
* ```tsx
|
|
198
|
+
* const { sendTransaction, isLoading, transactionResult } = useTransaction()
|
|
199
|
+
*
|
|
200
|
+
* const handleSend = async () => {
|
|
201
|
+
* const result = await sendTransaction({
|
|
202
|
+
* to: '0x...',
|
|
203
|
+
* amount: BigInt('1000000000000000000'),
|
|
204
|
+
* from: session.activeAddress
|
|
205
|
+
* })
|
|
206
|
+
* console.log('Transaction hash:', result.hash)
|
|
207
|
+
* }
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
export interface UseTransactionReturn {
|
|
211
|
+
/**
|
|
212
|
+
* Sends a transaction with the connected wallet
|
|
213
|
+
* @param request - The transaction request object
|
|
214
|
+
* @returns Promise that resolves to the transaction result
|
|
215
|
+
* @throws Error if no wallet is connected or transaction fails
|
|
216
|
+
*/
|
|
217
|
+
sendTransaction: (request: TransactionRequest) => Promise<TransactionResult>;
|
|
218
|
+
/**
|
|
219
|
+
* Indicates if a transaction is currently being processed
|
|
220
|
+
*/
|
|
221
|
+
isLoading: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* The last transaction result, undefined if no transaction has been sent yet
|
|
224
|
+
*/
|
|
225
|
+
transactionResult: TransactionResult | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* Error from the last transaction attempt, undefined if no error occurred
|
|
228
|
+
*/
|
|
229
|
+
error: WalletError | undefined;
|
|
230
|
+
}
|
|
231
|
+
//# sourceMappingURL=react-hooks.d.ts.map
|
|
@@ -0,0 +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,EACZ,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,kBAAkB,CAAA;IAC5B;;OA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E,iBAAiB,GAAG,SAAS,CAAA;IAChD;;OAEG;IACH,KAAK,EAAE,WAAW,GAAG,SAAS,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-hooks.js","sourceRoot":"","sources":["../src/react-hooks.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ConnectionMode } from './connection-mode';
|
|
2
|
+
import type { Network, NetworkId } from './networks';
|
|
3
|
+
import type { WalletMetadata } from './UWC-state';
|
|
4
|
+
export interface AvailableAddress {
|
|
5
|
+
address: string;
|
|
6
|
+
networkId: NetworkId;
|
|
7
|
+
}
|
|
8
|
+
export interface Session {
|
|
9
|
+
connectionMode: ConnectionMode | null;
|
|
10
|
+
activeNetwork: Network | null;
|
|
11
|
+
activeAddress: string | null;
|
|
12
|
+
availableNetworks: Network[];
|
|
13
|
+
activeWallet: WalletMetadata | null;
|
|
14
|
+
availableAddresses: AvailableAddress[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +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"}
|
package/dist/session.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ExtensionInjectedProvider, IntegratedBrowserInjectedProvider } from './UWC-state';
|
|
2
|
+
/**
|
|
3
|
+
* Result interface for signature operations
|
|
4
|
+
*/
|
|
5
|
+
export interface SignatureResult {
|
|
6
|
+
signature: string;
|
|
7
|
+
address: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Error types for signature operations
|
|
11
|
+
*/
|
|
12
|
+
export interface SignatureError {
|
|
13
|
+
code: number;
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Signature service interface
|
|
18
|
+
*/
|
|
19
|
+
export interface SignatureService {
|
|
20
|
+
/**
|
|
21
|
+
* Sign a message with the connected wallet
|
|
22
|
+
* @param message The message to sign
|
|
23
|
+
* @param provider The wallet provider to use for signing
|
|
24
|
+
* @returns A promise that resolves to the signature result
|
|
25
|
+
*/
|
|
26
|
+
signMessage(message: string, provider: ExtensionInjectedProvider | IntegratedBrowserInjectedProvider): Promise<SignatureResult>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -0,0 +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,MAAM,CAAA;IACjB,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"}
|