@aurum-sdk/core 0.2.6 → 0.2.8

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 CHANGED
@@ -1,274 +1,61 @@
1
- import { Chain } from 'viem';
2
- import { WalletId, WalletName, AurumRpcProvider, AurumConfig, NonNullableBrandConfig, UserInfo, WalletsConfig, EmailAuthStartResult, EmailAuthVerifyResult, WalletConnectSessionResult } from '@aurum-sdk/types';
3
- import { SignInWithEmailResult, VerifyEmailOTPResult } from '@coinbase/cdp-core';
1
+ export { A as Aurum } from './Aurum-B0Okb4Qv.mjs';
2
+ import 'viem';
3
+ import '@aurum-sdk/types';
4
+ import '@coinbase/cdp-core';
4
5
 
5
- interface WalletConnectionResult {
6
- address: string;
7
- provider: AurumRpcProvider;
8
- walletId: WalletId;
9
- email?: string;
6
+ /**
7
+ * Typed error hierarchy for @aurum-sdk/core.
8
+ *
9
+ * Consumers can discriminate failures via `instanceof UserRejectedError` or
10
+ * `err.code === 'USER_REJECTED'` instead of sniffing error message strings.
11
+ *
12
+ * All errors thrown from the public AurumCore API extend AurumError.
13
+ */
14
+ declare abstract class AurumError extends Error {
15
+ abstract readonly code: string;
16
+ readonly cause?: unknown;
17
+ constructor(message: string, cause?: unknown);
10
18
  }
11
- interface WalletAdapter {
12
- readonly id: WalletId;
13
- readonly name: WalletName;
14
- readonly icon: string;
15
- readonly hide: boolean;
16
- readonly downloadUrl: string | null;
17
- readonly wcDeepLinkUrl: string | null;
18
- isInstalled(): boolean;
19
- getProvider(): AurumRpcProvider | null;
20
- connect(): Promise<WalletConnectionResult>;
21
- tryRestoreConnection(): Promise<WalletConnectionResult | null>;
22
- disconnect(): Promise<void>;
23
- emailAuthStart?(email: string): Promise<SignInWithEmailResult>;
24
- emailAuthVerify?(email: string, otp: string): Promise<VerifyEmailOTPResult>;
25
- openModal?(): Promise<WalletConnectionResult>;
26
- onAccountsChanged(callback: (accounts: string[]) => void): void;
27
- removeListeners(): void;
19
+ declare class UserRejectedError extends AurumError {
20
+ readonly code = "USER_REJECTED";
21
+ }
22
+ declare class ChainSwitchRejectedError extends AurumError {
23
+ readonly code = "CHAIN_SWITCH_REJECTED";
24
+ }
25
+ declare class WalletNotInstalledError extends AurumError {
26
+ readonly walletId: string;
27
+ readonly code = "WALLET_NOT_INSTALLED";
28
+ constructor(walletId: string, cause?: unknown);
29
+ }
30
+ declare class WalletNotConfiguredError extends AurumError {
31
+ readonly walletId: string;
32
+ readonly code = "WALLET_NOT_CONFIGURED";
33
+ constructor(walletId: string, cause?: unknown);
34
+ }
35
+ declare class WalletExcludedError extends AurumError {
36
+ readonly walletId: string;
37
+ readonly code = "WALLET_EXCLUDED";
38
+ constructor(walletId: string, cause?: unknown);
39
+ }
40
+ declare class ChainNotSupportedError extends AurumError {
41
+ readonly code = "CHAIN_NOT_SUPPORTED";
42
+ }
43
+ declare class InvalidConfigError extends AurumError {
44
+ readonly code = "INVALID_CONFIG";
45
+ }
46
+ declare class ConnectionError extends AurumError {
47
+ readonly code = "CONNECTION_FAILED";
48
+ }
49
+ interface NormalizeContext {
50
+ operation?: 'connect' | 'switchChain' | string;
28
51
  }
29
-
30
52
  /**
31
- * Aurum SDK - Web3 Wallet Integration Library
53
+ * Normalize an unknown thrown value into an AurumError.
54
+ *
55
+ * Used at public-method boundaries so errors from wallet adapters (which vary in shape)
56
+ * exit the core with a stable, typed surface. Centralized message-regex fallback means
57
+ * downstream consumers don't need to re-implement the heuristic.
32
58
  */
33
- declare class Aurum {
34
- private core;
35
- /**
36
- * Creates a new Aurum instance.
37
- *
38
- * @param config - Configuration for branding and wallets
39
- *
40
- * @example
41
- * ```typescript
42
- * const aurum = new Aurum({
43
- * brand: { appName: 'Your App Name' },
44
- * wallets: {
45
- * embedded: { projectId: 'cdp-project-id' },
46
- * walletConnect: { projectId: 'reown-project-id' },
47
- * },
48
- * });
49
- * ```
50
- */
51
- constructor(config: AurumConfig);
52
- /**
53
- * EIP1193 compatible RPC provider that can be used to interact with the connected wallet.
54
- * Compatible with viem, ethers.js, and other web3 libraries.
55
- *
56
- * @example
57
- * ```typescript
58
- * const balance = await aurum.rpcProvider.request({
59
- * method: 'eth_getBalance',
60
- * params: [address, 'latest']
61
- * });
62
- * ```
63
- */
64
- get rpcProvider(): AurumRpcProvider;
65
- /**
66
- * Indicates whether the SDK is finished initializing.
67
- */
68
- get ready(): boolean;
69
- /**
70
- * Returns the resolved brand configuration.
71
- * @internal Used by widget components (i.e. ConnectWidget)
72
- */
73
- get brandConfig(): NonNullableBrandConfig;
74
- /**
75
- * Returns the wallet adapters configured for this instance.
76
- * @internal Used by widget components (i.e. ConnectWidget)
77
- */
78
- get walletAdapters(): WalletAdapter[];
79
- /**
80
- * Returns the set of excluded wallet IDs.
81
- * @internal Used by widget components (i.e. ConnectWidget)
82
- */
83
- get excludedWalletIds(): Set<WalletId>;
84
- /**
85
- * Waits for the SDK to finish initializing.
86
- * This should be called before calling methods with the provider to ensure provider is set (such as after a page refresh).
87
- *
88
- * @example
89
- * ```typescript
90
- * await aurum.whenReady();
91
- * const balance = await aurum.rpcProvider.request({
92
- * method: 'eth_getBalance',
93
- * params: [address, 'latest']
94
- * });
95
- * ```
96
- */
97
- whenReady(): Promise<void>;
98
- /**
99
- * Opens the wallet connection modal or connects directly to a specific wallet.
100
- *
101
- * @param walletId - Optional wallet ID for direct connection (bypasses modal).
102
- * Cannot be 'email' or 'walletconnect' (use their dedicated methods).
103
- * @returns The connected wallet address
104
- * @throws Error if user closes the modal without connecting a wallet
105
- *
106
- * @example
107
- * ```typescript
108
- * // Open modal for user to choose
109
- * const address = await aurum.connect();
110
- *
111
- * // Or connect directly to a specific wallet
112
- * import { WalletId } from '@aurum-sdk/types';
113
- * const address = await aurum.connect(WalletId.MetaMask);
114
- * ```
115
- */
116
- connect(walletId?: WalletId): Promise<`0x${string}`>;
117
- /**
118
- * Disconnects the currently connected wallet and clears the connection state.
119
- *
120
- * @example
121
- * ```typescript
122
- * await aurum.disconnect();
123
- * ```
124
- */
125
- disconnect(): Promise<void>;
126
- /**
127
- * Gets information about the currently connected user.
128
- *
129
- * @returns User information including wallet address and wallet name, or undefined if no wallet is connected
130
- *
131
- * @example
132
- * ```typescript
133
- * const userInfo = await aurum.getUserInfo();
134
- * if (userInfo) {
135
- * console.log(`Connected to ${userInfo.walletName}: ${userInfo.publicAddress}`);
136
- * } else {
137
- * console.log('No wallet connected');
138
- * }
139
- * ```
140
- */
141
- getUserInfo(): Promise<UserInfo | undefined>;
142
- /**
143
- * Checks if a wallet is currently connected.
144
- *
145
- * @returns `true` if a wallet is connected, `false` otherwise
146
- *
147
- * @example
148
- * ```typescript
149
- * const isConnected = await aurum.isConnected();
150
- * console.log('Is user connected:', isConnected);
151
- * ```
152
- */
153
- isConnected(): Promise<boolean>;
154
- /**
155
- * Gets the current chain ID of the connected wallet.
156
- *
157
- * @returns The current chain ID as a number
158
- *
159
- * @example
160
- * ```typescript
161
- * const chainId = await aurum.getChainId();
162
- * console.log('Connected to chain:', chainId);
163
- * ```
164
- */
165
- getChainId(): Promise<number>;
166
- /**
167
- * Switches the connected wallet to a different blockchain network.
168
- * If the chain is not added to the wallet, it will attempt to add it using the provided chain config.
169
- *
170
- * @param chainId - The chain ID to switch to (can be hex string, decimal string, or number)
171
- * @param chain - Optional viem Chain object with chain configuration (required if chain needs to be added)
172
- * @throws Error if the switch fails or the user rejects the request
173
- *
174
- * @example
175
- * ```typescript
176
- * import { sepolia } from 'viem/chains';
177
- *
178
- * await aurum.switchChain(sepolia.id, sepolia);
179
- * ```
180
- */
181
- switchChain(chainId: `0x${string}` | string | number, chain?: Chain): Promise<void>;
182
- /**
183
- * Updates the brand configuration at runtime.
184
- * Changes will be reflected the next time the connect modal is opened.
185
- *
186
- * @param newConfig - Partial brand config to merge with existing config
187
- *
188
- * @example
189
- * ```typescript
190
- * aurum.updateBrandConfig({
191
- * theme: 'light',
192
- * });
193
- * ```
194
- */
195
- updateBrandConfig(newConfig: Partial<NonNullableBrandConfig>): void;
196
- /**
197
- * Updates the wallets configuration at runtime.
198
- * Changes will be reflected the next time the connect modal is opened.
199
- *
200
- * @param newConfig - Partial wallets config to update (currently supports `exclude`)
201
- *
202
- * @example
203
- * ```typescript
204
- * import { WalletId } from '@aurum-sdk/types';
205
- *
206
- * aurum.updateWalletsConfig({
207
- * exclude: [WalletId.Email, WalletId.WalletConnect],
208
- * });
209
- * ```
210
- */
211
- updateWalletsConfig(newConfig: Partial<Pick<WalletsConfig, 'exclude'>>): void;
212
- /**
213
- * Notifies the SDK of a widget-initiated connection.
214
- * Updates internal state so getUserInfo(), isConnected(), etc. work correctly.
215
- * @internal Used by ConnectWidget - not intended for direct use
216
- */
217
- handleWidgetConnection(result: WalletConnectionResult): Promise<UserInfo>;
218
- /**
219
- * Starts the email authentication flow by sending an OTP to the provided email.
220
- * Use with `emailAuthVerify()` to complete the connection.
221
- *
222
- * @param email - The email address to send the OTP to
223
- * @returns Object containing flowId to use with emailAuthVerify
224
- * @throws Error if email wallet is not configured
225
- *
226
- * @example
227
- * ```typescript
228
- * const { flowId } = await aurum.emailAuthStart('user@example.com');
229
- * // User receives OTP email, then verify:
230
- * const { address, email, isNewUser } = await aurum.emailAuthVerify(flowId, '123456');
231
- * ```
232
- */
233
- emailAuthStart(email: string): Promise<EmailAuthStartResult>;
234
- /**
235
- * Verifies the email OTP and completes the wallet connection.
236
- *
237
- * @param flowId - The flowId returned from emailAuthStart
238
- * @param otp - The OTP code the user received via email
239
- * @returns Object containing the connected address and email
240
- * @throws Error if verification fails
241
- *
242
- * @example
243
- * ```typescript
244
- * const { flowId } = await aurum.emailAuthStart('user@example.com');
245
- * // User receives OTP...
246
- * const { address, email, isNewUser } = await aurum.emailAuthVerify(flowId, '123456');
247
- * console.log(`Connected: ${address} (${email})`);
248
- * ```
249
- */
250
- emailAuthVerify(flowId: string, otp: string): Promise<EmailAuthVerifyResult>;
251
- /**
252
- * Initiates a WalletConnect session and returns the URI for displaying a custom QR code.
253
- * Use this for building custom QR code UIs instead of using the built-in modal.
254
- *
255
- * @returns Object containing the URI and a function to wait for the connection
256
- * @throws Error if WalletConnect is not configured
257
- *
258
- * @example
259
- * ```typescript
260
- * // Get the WalletConnect URI
261
- * const { uri, waitForConnection } = await aurum.getWalletConnectSession();
262
- *
263
- * // Display your custom QR code with the URI
264
- * myQRCodeComponent.render(uri);
265
- *
266
- * // Wait for user to scan and approve
267
- * const address = await waitForConnection();
268
- * console.log('Connected:', address);
269
- * ```
270
- */
271
- getWalletConnectSession(): Promise<WalletConnectSessionResult>;
272
- }
59
+ declare function normalizeError(err: unknown, context?: NormalizeContext): AurumError;
273
60
 
274
- export { Aurum };
61
+ export { AurumError, ChainNotSupportedError, ChainSwitchRejectedError, ConnectionError, InvalidConfigError, UserRejectedError, WalletExcludedError, WalletNotConfiguredError, WalletNotInstalledError, normalizeError };
package/dist/index.d.ts CHANGED
@@ -1,274 +1,61 @@
1
- import { Chain } from 'viem';
2
- import { WalletId, WalletName, AurumRpcProvider, AurumConfig, NonNullableBrandConfig, UserInfo, WalletsConfig, EmailAuthStartResult, EmailAuthVerifyResult, WalletConnectSessionResult } from '@aurum-sdk/types';
3
- import { SignInWithEmailResult, VerifyEmailOTPResult } from '@coinbase/cdp-core';
1
+ export { A as Aurum } from './Aurum-B0Okb4Qv.js';
2
+ import 'viem';
3
+ import '@aurum-sdk/types';
4
+ import '@coinbase/cdp-core';
4
5
 
5
- interface WalletConnectionResult {
6
- address: string;
7
- provider: AurumRpcProvider;
8
- walletId: WalletId;
9
- email?: string;
6
+ /**
7
+ * Typed error hierarchy for @aurum-sdk/core.
8
+ *
9
+ * Consumers can discriminate failures via `instanceof UserRejectedError` or
10
+ * `err.code === 'USER_REJECTED'` instead of sniffing error message strings.
11
+ *
12
+ * All errors thrown from the public AurumCore API extend AurumError.
13
+ */
14
+ declare abstract class AurumError extends Error {
15
+ abstract readonly code: string;
16
+ readonly cause?: unknown;
17
+ constructor(message: string, cause?: unknown);
10
18
  }
11
- interface WalletAdapter {
12
- readonly id: WalletId;
13
- readonly name: WalletName;
14
- readonly icon: string;
15
- readonly hide: boolean;
16
- readonly downloadUrl: string | null;
17
- readonly wcDeepLinkUrl: string | null;
18
- isInstalled(): boolean;
19
- getProvider(): AurumRpcProvider | null;
20
- connect(): Promise<WalletConnectionResult>;
21
- tryRestoreConnection(): Promise<WalletConnectionResult | null>;
22
- disconnect(): Promise<void>;
23
- emailAuthStart?(email: string): Promise<SignInWithEmailResult>;
24
- emailAuthVerify?(email: string, otp: string): Promise<VerifyEmailOTPResult>;
25
- openModal?(): Promise<WalletConnectionResult>;
26
- onAccountsChanged(callback: (accounts: string[]) => void): void;
27
- removeListeners(): void;
19
+ declare class UserRejectedError extends AurumError {
20
+ readonly code = "USER_REJECTED";
21
+ }
22
+ declare class ChainSwitchRejectedError extends AurumError {
23
+ readonly code = "CHAIN_SWITCH_REJECTED";
24
+ }
25
+ declare class WalletNotInstalledError extends AurumError {
26
+ readonly walletId: string;
27
+ readonly code = "WALLET_NOT_INSTALLED";
28
+ constructor(walletId: string, cause?: unknown);
29
+ }
30
+ declare class WalletNotConfiguredError extends AurumError {
31
+ readonly walletId: string;
32
+ readonly code = "WALLET_NOT_CONFIGURED";
33
+ constructor(walletId: string, cause?: unknown);
34
+ }
35
+ declare class WalletExcludedError extends AurumError {
36
+ readonly walletId: string;
37
+ readonly code = "WALLET_EXCLUDED";
38
+ constructor(walletId: string, cause?: unknown);
39
+ }
40
+ declare class ChainNotSupportedError extends AurumError {
41
+ readonly code = "CHAIN_NOT_SUPPORTED";
42
+ }
43
+ declare class InvalidConfigError extends AurumError {
44
+ readonly code = "INVALID_CONFIG";
45
+ }
46
+ declare class ConnectionError extends AurumError {
47
+ readonly code = "CONNECTION_FAILED";
48
+ }
49
+ interface NormalizeContext {
50
+ operation?: 'connect' | 'switchChain' | string;
28
51
  }
29
-
30
52
  /**
31
- * Aurum SDK - Web3 Wallet Integration Library
53
+ * Normalize an unknown thrown value into an AurumError.
54
+ *
55
+ * Used at public-method boundaries so errors from wallet adapters (which vary in shape)
56
+ * exit the core with a stable, typed surface. Centralized message-regex fallback means
57
+ * downstream consumers don't need to re-implement the heuristic.
32
58
  */
33
- declare class Aurum {
34
- private core;
35
- /**
36
- * Creates a new Aurum instance.
37
- *
38
- * @param config - Configuration for branding and wallets
39
- *
40
- * @example
41
- * ```typescript
42
- * const aurum = new Aurum({
43
- * brand: { appName: 'Your App Name' },
44
- * wallets: {
45
- * embedded: { projectId: 'cdp-project-id' },
46
- * walletConnect: { projectId: 'reown-project-id' },
47
- * },
48
- * });
49
- * ```
50
- */
51
- constructor(config: AurumConfig);
52
- /**
53
- * EIP1193 compatible RPC provider that can be used to interact with the connected wallet.
54
- * Compatible with viem, ethers.js, and other web3 libraries.
55
- *
56
- * @example
57
- * ```typescript
58
- * const balance = await aurum.rpcProvider.request({
59
- * method: 'eth_getBalance',
60
- * params: [address, 'latest']
61
- * });
62
- * ```
63
- */
64
- get rpcProvider(): AurumRpcProvider;
65
- /**
66
- * Indicates whether the SDK is finished initializing.
67
- */
68
- get ready(): boolean;
69
- /**
70
- * Returns the resolved brand configuration.
71
- * @internal Used by widget components (i.e. ConnectWidget)
72
- */
73
- get brandConfig(): NonNullableBrandConfig;
74
- /**
75
- * Returns the wallet adapters configured for this instance.
76
- * @internal Used by widget components (i.e. ConnectWidget)
77
- */
78
- get walletAdapters(): WalletAdapter[];
79
- /**
80
- * Returns the set of excluded wallet IDs.
81
- * @internal Used by widget components (i.e. ConnectWidget)
82
- */
83
- get excludedWalletIds(): Set<WalletId>;
84
- /**
85
- * Waits for the SDK to finish initializing.
86
- * This should be called before calling methods with the provider to ensure provider is set (such as after a page refresh).
87
- *
88
- * @example
89
- * ```typescript
90
- * await aurum.whenReady();
91
- * const balance = await aurum.rpcProvider.request({
92
- * method: 'eth_getBalance',
93
- * params: [address, 'latest']
94
- * });
95
- * ```
96
- */
97
- whenReady(): Promise<void>;
98
- /**
99
- * Opens the wallet connection modal or connects directly to a specific wallet.
100
- *
101
- * @param walletId - Optional wallet ID for direct connection (bypasses modal).
102
- * Cannot be 'email' or 'walletconnect' (use their dedicated methods).
103
- * @returns The connected wallet address
104
- * @throws Error if user closes the modal without connecting a wallet
105
- *
106
- * @example
107
- * ```typescript
108
- * // Open modal for user to choose
109
- * const address = await aurum.connect();
110
- *
111
- * // Or connect directly to a specific wallet
112
- * import { WalletId } from '@aurum-sdk/types';
113
- * const address = await aurum.connect(WalletId.MetaMask);
114
- * ```
115
- */
116
- connect(walletId?: WalletId): Promise<`0x${string}`>;
117
- /**
118
- * Disconnects the currently connected wallet and clears the connection state.
119
- *
120
- * @example
121
- * ```typescript
122
- * await aurum.disconnect();
123
- * ```
124
- */
125
- disconnect(): Promise<void>;
126
- /**
127
- * Gets information about the currently connected user.
128
- *
129
- * @returns User information including wallet address and wallet name, or undefined if no wallet is connected
130
- *
131
- * @example
132
- * ```typescript
133
- * const userInfo = await aurum.getUserInfo();
134
- * if (userInfo) {
135
- * console.log(`Connected to ${userInfo.walletName}: ${userInfo.publicAddress}`);
136
- * } else {
137
- * console.log('No wallet connected');
138
- * }
139
- * ```
140
- */
141
- getUserInfo(): Promise<UserInfo | undefined>;
142
- /**
143
- * Checks if a wallet is currently connected.
144
- *
145
- * @returns `true` if a wallet is connected, `false` otherwise
146
- *
147
- * @example
148
- * ```typescript
149
- * const isConnected = await aurum.isConnected();
150
- * console.log('Is user connected:', isConnected);
151
- * ```
152
- */
153
- isConnected(): Promise<boolean>;
154
- /**
155
- * Gets the current chain ID of the connected wallet.
156
- *
157
- * @returns The current chain ID as a number
158
- *
159
- * @example
160
- * ```typescript
161
- * const chainId = await aurum.getChainId();
162
- * console.log('Connected to chain:', chainId);
163
- * ```
164
- */
165
- getChainId(): Promise<number>;
166
- /**
167
- * Switches the connected wallet to a different blockchain network.
168
- * If the chain is not added to the wallet, it will attempt to add it using the provided chain config.
169
- *
170
- * @param chainId - The chain ID to switch to (can be hex string, decimal string, or number)
171
- * @param chain - Optional viem Chain object with chain configuration (required if chain needs to be added)
172
- * @throws Error if the switch fails or the user rejects the request
173
- *
174
- * @example
175
- * ```typescript
176
- * import { sepolia } from 'viem/chains';
177
- *
178
- * await aurum.switchChain(sepolia.id, sepolia);
179
- * ```
180
- */
181
- switchChain(chainId: `0x${string}` | string | number, chain?: Chain): Promise<void>;
182
- /**
183
- * Updates the brand configuration at runtime.
184
- * Changes will be reflected the next time the connect modal is opened.
185
- *
186
- * @param newConfig - Partial brand config to merge with existing config
187
- *
188
- * @example
189
- * ```typescript
190
- * aurum.updateBrandConfig({
191
- * theme: 'light',
192
- * });
193
- * ```
194
- */
195
- updateBrandConfig(newConfig: Partial<NonNullableBrandConfig>): void;
196
- /**
197
- * Updates the wallets configuration at runtime.
198
- * Changes will be reflected the next time the connect modal is opened.
199
- *
200
- * @param newConfig - Partial wallets config to update (currently supports `exclude`)
201
- *
202
- * @example
203
- * ```typescript
204
- * import { WalletId } from '@aurum-sdk/types';
205
- *
206
- * aurum.updateWalletsConfig({
207
- * exclude: [WalletId.Email, WalletId.WalletConnect],
208
- * });
209
- * ```
210
- */
211
- updateWalletsConfig(newConfig: Partial<Pick<WalletsConfig, 'exclude'>>): void;
212
- /**
213
- * Notifies the SDK of a widget-initiated connection.
214
- * Updates internal state so getUserInfo(), isConnected(), etc. work correctly.
215
- * @internal Used by ConnectWidget - not intended for direct use
216
- */
217
- handleWidgetConnection(result: WalletConnectionResult): Promise<UserInfo>;
218
- /**
219
- * Starts the email authentication flow by sending an OTP to the provided email.
220
- * Use with `emailAuthVerify()` to complete the connection.
221
- *
222
- * @param email - The email address to send the OTP to
223
- * @returns Object containing flowId to use with emailAuthVerify
224
- * @throws Error if email wallet is not configured
225
- *
226
- * @example
227
- * ```typescript
228
- * const { flowId } = await aurum.emailAuthStart('user@example.com');
229
- * // User receives OTP email, then verify:
230
- * const { address, email, isNewUser } = await aurum.emailAuthVerify(flowId, '123456');
231
- * ```
232
- */
233
- emailAuthStart(email: string): Promise<EmailAuthStartResult>;
234
- /**
235
- * Verifies the email OTP and completes the wallet connection.
236
- *
237
- * @param flowId - The flowId returned from emailAuthStart
238
- * @param otp - The OTP code the user received via email
239
- * @returns Object containing the connected address and email
240
- * @throws Error if verification fails
241
- *
242
- * @example
243
- * ```typescript
244
- * const { flowId } = await aurum.emailAuthStart('user@example.com');
245
- * // User receives OTP...
246
- * const { address, email, isNewUser } = await aurum.emailAuthVerify(flowId, '123456');
247
- * console.log(`Connected: ${address} (${email})`);
248
- * ```
249
- */
250
- emailAuthVerify(flowId: string, otp: string): Promise<EmailAuthVerifyResult>;
251
- /**
252
- * Initiates a WalletConnect session and returns the URI for displaying a custom QR code.
253
- * Use this for building custom QR code UIs instead of using the built-in modal.
254
- *
255
- * @returns Object containing the URI and a function to wait for the connection
256
- * @throws Error if WalletConnect is not configured
257
- *
258
- * @example
259
- * ```typescript
260
- * // Get the WalletConnect URI
261
- * const { uri, waitForConnection } = await aurum.getWalletConnectSession();
262
- *
263
- * // Display your custom QR code with the URI
264
- * myQRCodeComponent.render(uri);
265
- *
266
- * // Wait for user to scan and approve
267
- * const address = await waitForConnection();
268
- * console.log('Connected:', address);
269
- * ```
270
- */
271
- getWalletConnectSession(): Promise<WalletConnectSessionResult>;
272
- }
59
+ declare function normalizeError(err: unknown, context?: NormalizeContext): AurumError;
273
60
 
274
- export { Aurum };
61
+ export { AurumError, ChainNotSupportedError, ChainSwitchRejectedError, ConnectionError, InvalidConfigError, UserRejectedError, WalletExcludedError, WalletNotConfiguredError, WalletNotInstalledError, normalizeError };