@human.tech/waap-sdk 2.0.0 → 2.1.0-staging-fb27bb

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +167 -216
  3. package/dist/WaaPError-C5nPcaKk.d.mts +168 -0
  4. package/dist/WaaPError-XLgIXUgh.d.ts +168 -0
  5. package/dist/WalletConnect-BTT6LtUu.d.mts +33 -0
  6. package/dist/WalletConnect-BTT6LtUu.d.ts +33 -0
  7. package/dist/WalletConnect-Deg7_JmH.mjs +4 -0
  8. package/dist/WalletConnect-G-lbqknM.js +4 -0
  9. package/dist/asyncSigning-B0KrmKk7.js +1 -0
  10. package/dist/asyncSigning-CzqBbYDP.mjs +1 -0
  11. package/dist/esm-B4jz8Emb.mjs +1 -0
  12. package/dist/esm-D5fDQenf.js +1 -0
  13. package/dist/evm-Ch-aWWat.js +1 -0
  14. package/dist/evm-DHVrAmEw.mjs +1 -0
  15. package/dist/evm.d.mts +7 -0
  16. package/dist/evm.d.ts +7 -0
  17. package/dist/evm.js +1 -0
  18. package/dist/evm.mjs +1 -0
  19. package/dist/index-CMSufeMa.d.ts +775 -0
  20. package/dist/index-CdKntlzX.d.mts +775 -0
  21. package/dist/index.d.mts +239 -933
  22. package/dist/index.d.ts +239 -933
  23. package/dist/index.js +1 -2191
  24. package/dist/index.mjs +1 -2162
  25. package/dist/initializerContext-0oKHzvQG.d.ts +21 -0
  26. package/dist/initializerContext-C39PUnGi.d.mts +21 -0
  27. package/dist/react.d.mts +2 -0
  28. package/dist/react.d.ts +2 -0
  29. package/dist/react.js +1 -0
  30. package/dist/react.mjs +1 -0
  31. package/dist/register-4Afr2Jx8.js +1 -0
  32. package/dist/register-CBlzg5ln.d.ts +107 -0
  33. package/dist/register-CNgjA0yl.mjs +1 -0
  34. package/dist/register-CxsUwgKJ.d.ts +282 -0
  35. package/dist/register-DIZnKDHF.mjs +1 -0
  36. package/dist/register-LmdJdvzn.d.mts +282 -0
  37. package/dist/register-QjrsOe7r.d.mts +107 -0
  38. package/dist/register-ozKwGWOb.js +1 -0
  39. package/dist/solana.d.mts +5 -0
  40. package/dist/solana.d.ts +5 -0
  41. package/dist/solana.js +1 -0
  42. package/dist/solana.mjs +1 -0
  43. package/dist/sui.d.mts +5 -0
  44. package/dist/sui.d.ts +5 -0
  45. package/dist/sui.js +1 -0
  46. package/dist/sui.mjs +1 -0
  47. package/dist/types-DexmJNke.d.mts +397 -0
  48. package/dist/types-DexmJNke.d.ts +397 -0
  49. package/dist/ui-16QpbEyG.js +1 -0
  50. package/dist/ui-BAYRtDQg.mjs +1 -0
  51. package/dist/useWaapAuth-BrqAhAn2.d.ts +246 -0
  52. package/dist/useWaapAuth-C5I7QqyW.d.mts +246 -0
  53. package/dist/useWaapAuth-DHIeb4yc.mjs +1 -0
  54. package/dist/useWaapAuth-Z_ONicYr.js +1 -0
  55. package/dist/walletconnect.d.mts +2 -0
  56. package/dist/walletconnect.d.ts +2 -0
  57. package/dist/walletconnect.js +1 -0
  58. package/dist/walletconnect.mjs +1 -0
  59. package/package.json +53 -18
package/dist/index.d.ts CHANGED
@@ -1,64 +1,49 @@
1
- import { CredentialType, RequestPermissionTokenParams, ProjectConfig, CustomConfig, AuthenticationMethod, RequestPermissionTokenResult, SilkNotificationData, SILK_METHOD, SilkResponse, SilkRequest, AsyncTxConfirmedEvent, AsyncTxFailedEvent, AsyncSignCompleteEvent, AsyncTxPendingEvent } from '@human.tech/waap-interface-core';
2
- export { Async2faRequiredEvent, AsyncEvent, AsyncEventType, AsyncSignCompleteEvent, AsyncSignFailedEvent, AsyncSignPendingEvent, AsyncTxConfirmedEvent, AsyncTxFailedEvent, AsyncTxPendingEvent, AsyncTxResponse, AuthenticationMethod, CredentialType, ProjectConfig, RequestPermissionTokenParams, RequestPermissionTokenResult, SILK_METHOD, SilkOptions, SocialProvider, StylesConfig, SILK_METHOD as WAAP_METHOD } from '@human.tech/waap-interface-core';
3
- import { EventEmitter } from 'events';
4
- export { rpcMethodRequiresUI } from '@human.tech/waap-constants';
5
-
6
- interface RequestArguments {
7
- method: string;
8
- params?: unknown[] | object;
9
- async?: boolean;
10
- withPT?: boolean;
11
- }
12
- interface EthereumProviderInterface {
13
- enable(): Promise<unknown>;
14
- isConnected(): boolean;
15
- request(args: RequestArguments): Promise<unknown>;
16
- on(event: string, listener: (...args: any[]) => void): this;
17
- removeListener(event: string, listener: (...args: any[]) => void): this;
18
- }
19
- type LoginResponse = 'waap' | 'human' | 'injected' | 'walletconnect' | null;
20
- interface SilkEthereumProviderInterface extends EthereumProviderInterface {
21
- isSilk: boolean;
22
- connected: boolean;
23
- login(customProvider?: any): Promise<LoginResponse>;
24
- logout(): Promise<unknown>;
25
- getLoginMethod(): LoginResponse;
26
- requestEmail(): Promise<unknown>;
27
- requestSBT(type: CredentialType): Promise<unknown>;
28
- requestPermissionToken(params: RequestPermissionTokenParams): Promise<unknown>;
29
- toggleDarkMode(): Promise<void>;
30
- }
31
- interface InitSilkOptions {
32
- referralCode?: string;
33
- project?: ProjectConfig;
34
- config?: CustomConfig;
35
- useStaging?: boolean;
36
- walletConnectProjectId?: string;
37
- /**
38
- * When true, eth_sendTransaction resolves with the pre-calculated tx hash
39
- * immediately after signing. Broadcasting and confirmation continue in the
40
- * background with events (waap_sign_complete, waap_tx_pending, waap_tx_confirmed, waap_tx_failed).
41
- * Other signing methods (personal_sign, eth_signTypedData_v4, eth_signTransaction)
42
- * are unaffected — they always resolve with the signature directly.
43
- * Applies to ALL eth_sendTransaction calls for this SDK instance.
44
- * Default: false
45
- */
46
- asyncTxs?: boolean;
47
- /** @deprecated Use `asyncTxs` instead. */
48
- asyncSigning?: boolean;
49
- }
50
- type SilkProvider = SilkEthereumProviderInterface;
51
-
52
- /**
53
- * @param referralCode - WaaP points referral code
54
- * @param customConfig - WaaP custom UI configuration
55
- * @param project - WaaP project configuration
56
- * @param useStaging - Whether to use the staging environment
57
- * @param walletConnectProjectId - WalletConnect project ID (only required when passing `wallet` to `authenticationMethods`)
58
- * @param walletConnectOptionalChains - Optional chains to use for WalletConnect
59
- */
60
- declare const initWaaP: (params?: InitSilkOptions) => SilkEthereumProviderInterface;
61
-
1
+ import { A as SILK_METHOD, C as RequestPermissionTokenResult, D as SocialProvider, M as WaaPSessionProtection, O as StylesConfig, S as RequestPermissionTokenParams, _ as validateWalletOrigin, a as PermissionTokenQuery, b as CustomConfig, c as SilkEthereumProviderInterface, d as WaaPAccountStatus, f as WaaPLoginOptions, g as resolveWalletOrigin, h as WaaPWalletTargetOptions, i as PermissionTokenClearResult, k as JSON_RPC_METHOD, l as SilkProvider, m as WaaPEnvironment, n as InitSilkOptions, o as PermissionTokenStatus, p as WaaPSessionExtension, r as LoginResponse, s as RequestArguments, t as EthereumProviderInterface, u as WaaPAccountMode, v as AuthenticationMethod, x as ProjectConfig, y as CredentialType } from "./types-DexmJNke.js";
2
+ import { _ as WAAP_EVENTS, a as useWaapTransaction, c as AsyncEventType, d as AsyncSignPendingEvent, f as AsyncTxConfirmedEvent, g as SilkOptions, h as AsyncTxResponse, i as UseWaapTransactionReturn, l as AsyncSignCompleteEvent, m as AsyncTxPendingEvent, n as TxState, o as Async2faRequiredEvent, p as AsyncTxFailedEvent, r as UseWaapTransactionOptions, s as AsyncEvent, t as useWaapAuth, u as AsyncSignFailedEvent } from "./useWaapAuth-BrqAhAn2.js";
3
+ import { a as CancelWaaPPreload, c as preloadWaaPOnIdle, d as WaaPIframeLifecyclePhase, f as getWaaPIframeDiagnostics, h as WalletMessageManager, i as normalizeWaaPError, l as WaaPIframeDiagnostics, m as PostSilkRequestArgs, n as WaaPErrorCode, o as WaaPIdlePreloadOptions, p as subscribeWaaPIframeLifecycle, r as WaaPOperationMetadata, s as WaaPPreloadTarget, t as WaaPError, u as WaaPIframeLifecycleEvent } from "./WaaPError-XLgIXUgh.js";
4
+ import { A as SolanaSignTransactionInput, B as WaaPSolanaWalletFeatures, C as SolanaChain, D as SolanaSignAndSendTransactionOutput, E as SolanaSignAndSendTransactionInput, F as SolanaStandardSignMessageOutput, G as SuiConnectOutput, H as SuiAccount, I as SolanaStandardSignTransactionInput, J as SuiSignAndExecuteTransactionInput, L as SolanaStandardSignTransactionOutput, M as SolanaStandardSignAndSendTransactionInput, N as SolanaStandardSignAndSendTransactionOutput, O as SolanaSignMessageInput, P as SolanaStandardSignMessageInput, S as SolanaAccount, T as SolanaConnectOutput, U as SuiChain, V as InitWaaPSuiOptions, W as SuiConnectInput, X as SuiSignPersonalMessageInput, Y as SuiSignAndExecuteTransactionOutput, Z as SuiSignPersonalMessageOutput, _ as initWaaPSolana, a as InitWaaPTapOptions, at as WaaPSuiWalletInterface, b as initWaaPTap, c as WaaPSquidChain, d as WaaPSquidStatus, et as SuiSignTransactionInput, f as WaaPSquidStatusState, g as initWaaPMulti, h as initWaaP, i as InitWaaPSquidOptions, it as WaaPSuiWalletFeatures, j as SolanaSignTransactionOutput, k as SolanaSignMessageOutput, l as WaaPSquidLifecycle, m as WaaPTapSession, n as InitWaaPMultiOptions, nt as SuiTransactionInput, o as WaaPChain, p as WaaPTap, r as InitWaaPOptions, s as WaaPSquid, t as InitWaaPChainOptions, tt as SuiSignTransactionOutput, u as WaaPSquidSession, v as initWaaPSquid, w as SolanaConnectInput, x as InitWaaPSolanaOptions, y as initWaaPSui, z as WaaPSolanaProviderInterface } from "./index-CMSufeMa.js";
5
+ import { t as SilkWalletConnect } from "./WalletConnect-BTT6LtUu.js";
6
+ import { n as UIMessageManager, r as UI_EVENT_NAMES } from "./initializerContext-0oKHzvQG.js";
7
+ import { n as WaaPSuiWallet, t as registerWaaPSuiWallet } from "./register-CxsUwgKJ.js";
8
+ import { n as WaaPSolanaProvider, t as registerWaaPSolanaWallet } from "./register-CBlzg5ln.js";
9
+ import { EventEmitter } from "events";
10
+ //#region ../silk-interface-core/dist/esm/types/squidLifecycle.d.ts
11
+ /**
12
+ * Types for the multichain LITE ("Squid" brand) onboarding lifecycle.
13
+ *
14
+ * `initWaaPSquid` onboards both curves (secp256k1 → EVM, ed25519 → Sui +
15
+ * Solana) through one PTB, so all three chain addresses become ready together.
16
+ */
17
+ /** Event types emitted during the Squid onboarding lifecycle. */
18
+ type SquidLifecycleEventType = 'waap_squid_pending' | 'waap_squid_ready' | 'waap_squid_failed';
19
+ /** Emitted while Squid onboarding is in progress. */
20
+ interface SquidPendingEvent {
21
+ /** Opaque SDK-to-iframe correlation value for one onboarding attempt. */
22
+ lifecycleId?: string;
23
+ /** Human-readable progress, e.g. IKA network DKG verification. */
24
+ message?: string;
25
+ /** Sui digest of the create PTB when a DWallet is awaiting verification. */
26
+ transactionDigest?: string;
27
+ }
28
+ /** Emitted when the Squid DWallets are ready for signing. */
29
+ interface SquidReadyEvent {
30
+ /** Opaque correlation value echoed from the pending onboarding attempt. */
31
+ lifecycleId?: string;
32
+ /** secp256k1 Lite DWallet → EVM address. */
33
+ evm: string;
34
+ /** ed25519 Lite DWallet → Sui address. */
35
+ sui: string;
36
+ /** ed25519 Lite DWallet → Solana address. */
37
+ solana: string;
38
+ }
39
+ /** Emitted when Squid onboarding fails. */
40
+ interface SquidFailedEvent {
41
+ /** Opaque correlation value echoed from the pending onboarding attempt. */
42
+ lifecycleId?: string;
43
+ error: string;
44
+ }
45
+ //#endregion
46
+ //#region src/ui/WaapComponent.d.ts
62
47
  /**
63
48
  * WaaP Component
64
49
  *
@@ -83,885 +68,206 @@ declare const initWaaP: (params?: InitSilkOptions) => SilkEthereumProviderInterf
83
68
  * Only defined in browser environments to avoid SSR issues
84
69
  */
85
70
  declare let WaapWalletElement: any;
86
-
87
- /**
88
- * A Ethereum provder API (from EIP 1193) for Silk.
89
- * https://eips.ethereum.org/EIPS/eip-1193
90
- */
91
- /**
92
- * Resources:
93
- * - EIP-2255: Wallet Permissions System: https://eips.ethereum.org/EIPS/eip-2255
94
- */
95
-
71
+ //#endregion
72
+ //#region src/lib/provider/EthereumProviderExtension.d.ts
96
73
  declare class EthereumProviderExtension extends EventEmitter implements EthereumProviderInterface {
97
- readonly isSilk = true;
98
- connected: boolean;
99
- config: CustomConfig;
100
- constructor(customConfig?: CustomConfig);
101
- sendToExtension(args: RequestArguments): Promise<unknown>;
102
- request(args: RequestArguments): Promise<unknown>;
103
- enable(): Promise<unknown>;
104
- isConnected(): boolean;
105
- login(): Promise<unknown>;
106
- requestSBT(type: CredentialType): Promise<unknown>;
107
- toggleDarkMode(): Promise<void>;
108
- safe(): Promise<unknown>;
109
- }
110
-
111
- declare class SilkWalletConnect {
112
- private static instance;
113
- private static projectId;
114
- private static chains;
115
- /**
116
- * Set the WalletConnect project ID programmatically
117
- * Use this if environment variables aren't working in your setup
118
- *
119
- * @param id - The WalletConnect project ID to use
120
- */
121
- static setProjectId(id: string): void;
122
- static getProjectIdFromEnv(): string | undefined;
123
- static getInstance(): Promise<any>;
124
- static listenToAccountChangeEvent(): Promise<void>;
125
- /**
126
- * Wait for WalletConnect to be properly initialized and connected
127
- * @returns Promise<boolean> - true if connected, false if timeout reached
128
- */
129
- static waitForReadyAndCheckConnection(): Promise<boolean>;
130
- /**
131
- * Check if WalletConnect is currently connected (immediate check, no waiting)
132
- * @returns boolean - true if connected, false otherwise
133
- */
134
- static isConnected(): boolean;
135
- /**
136
- * Get the wallet provider from the WalletConnect instance
137
- * @returns The wallet provider or null if not available
138
- */
139
- static getWalletProvider(): any;
140
- }
141
-
142
- /**
143
- * Type definitions for Sui Wallet Standard integration.
144
- *
145
- * @see https://docs.sui.io/standards/wallet-standard
146
- */
147
- /**
148
- * Sui chain identifiers.
149
- */
150
- type SuiChain = 'sui:mainnet' | 'sui:testnet' | 'sui:devnet' | 'sui:localnet';
151
- /**
152
- * Sui account representation following Wallet Standard.
153
- */
154
- interface SuiAccount {
155
- /** Sui address (32 bytes, 0x-prefixed hex string) */
156
- readonly address: string;
157
- /** Compressed public key bytes (33 bytes for Secp256k1) */
158
- readonly publicKey: Uint8Array;
159
- /** Supported chains for this account */
160
- readonly chains: readonly SuiChain[];
161
- /** Supported features for this account */
162
- readonly features: readonly string[];
163
- /** Optional display label */
164
- readonly label?: string;
165
- }
166
- /**
167
- * Input for sui:signPersonalMessage feature.
168
- */
169
- interface SuiSignPersonalMessageInput {
170
- /** Message bytes to sign */
171
- message: Uint8Array;
172
- /** Account to sign with */
173
- account: SuiAccount;
174
- /** Optional chain identifier */
175
- chain?: SuiChain;
176
- }
177
- /**
178
- * Output from sui:signPersonalMessage feature.
179
- */
180
- interface SuiSignPersonalMessageOutput {
181
- /** Base64-encoded message bytes */
182
- bytes: string;
183
- /** Base64-encoded signature (98 bytes for Secp256k1) */
184
- signature: string;
185
- }
186
- /**
187
- * Input for sui:signTransaction feature.
188
- */
189
- interface SuiSignTransactionInput {
190
- /** BCS-serialized transaction bytes */
191
- transaction: Uint8Array;
192
- /** Account to sign with */
193
- account: SuiAccount;
194
- /** Optional chain identifier */
195
- chain?: SuiChain;
196
- }
197
- /**
198
- * Output from sui:signTransaction feature.
199
- */
200
- interface SuiSignTransactionOutput {
201
- /** Base64-encoded transaction bytes */
202
- bytes: string;
203
- /** Base64-encoded signature */
204
- signature: string;
205
- }
206
- /**
207
- * Input for sui:signAndExecuteTransaction feature.
208
- */
209
- interface SuiSignAndExecuteTransactionInput {
210
- /** BCS-serialized transaction bytes */
211
- transaction: Uint8Array;
212
- /** Account to sign with */
213
- account: SuiAccount;
214
- /** Optional chain identifier */
215
- chain?: SuiChain;
216
- /** Options for execution */
217
- options?: unknown;
218
- /** Request type */
219
- requestType?: 'WaitForEffectsCert' | 'WaitForLocalExecution';
220
- }
221
- /**
222
- * Output from sui:signAndExecuteTransaction feature.
223
- */
224
- interface SuiSignAndExecuteTransactionOutput {
225
- digest: string;
226
- effects?: unknown;
227
- errors?: unknown[];
228
- [key: string]: unknown;
229
- }
230
- /**
231
- * Connect input options.
232
- */
233
- interface SuiConnectInput {
234
- /** If true, attempt silent connection without UI prompt */
235
- silent?: boolean;
236
- }
237
- /**
238
- * Connect output with accounts.
239
- */
240
- interface SuiConnectOutput {
241
- /** Connected accounts */
242
- accounts: readonly SuiAccount[];
243
- }
244
- /**
245
- * Input for legacy sui:signTransactionBlock feature.
246
- */
247
- interface SuiSignTransactionBlockInput {
248
- /** BCS-serialized transaction block bytes */
249
- transactionBlock: Uint8Array;
250
- /** Account to sign with */
251
- account: SuiAccount;
252
- /** Optional chain identifier */
253
- chain?: SuiChain;
254
- }
255
- /**
256
- * Output for legacy sui:signTransactionBlock feature.
257
- */
258
- interface SuiSignTransactionBlockOutput extends SuiSignTransactionOutput {
259
- }
260
- /**
261
- * Input for legacy sui:signAndExecuteTransactionBlock feature.
262
- */
263
- interface SuiSignAndExecuteTransactionBlockInput {
264
- /** BCS-serialized transaction block bytes */
265
- transactionBlock: Uint8Array;
266
- /** Account to sign with */
267
- account: SuiAccount;
268
- /** Optional chain identifier */
269
- chain?: SuiChain;
270
- /** Options for execution */
271
- options?: unknown;
272
- /** Request type */
273
- requestType?: 'WaitForEffectsCert' | 'WaitForLocalExecution';
274
- }
275
- /**
276
- * Output for legacy sui:signAndExecuteTransactionBlock feature.
277
- */
278
- interface SuiSignAndExecuteTransactionBlockOutput extends SuiSignAndExecuteTransactionOutput {
279
- }
280
- /**
281
- * Wallet change event properties.
282
- */
283
- interface SuiWalletChangeProperties {
284
- chains?: readonly SuiChain[];
285
- accounts?: readonly SuiAccount[];
286
- features?: Record<string, unknown>;
287
- }
288
- /**
289
- * Event listener types.
290
- */
291
- type SuiWalletEventListener = (properties: SuiWalletChangeProperties) => void;
292
- /**
293
- * Wallet icon type (data URL).
294
- */
295
- type WalletIcon = `data:image/${'svg+xml' | 'webp' | 'png' | 'gif'};base64,${string}`;
296
- /**
297
- * Wallet Standard features object.
298
- */
299
- interface WaaPSuiWalletFeatures {
300
- 'standard:connect': {
301
- version: '1.0.0';
302
- connect: (input?: SuiConnectInput) => Promise<SuiConnectOutput>;
303
- };
304
- 'standard:disconnect': {
305
- version: '1.0.0';
306
- disconnect: () => Promise<void>;
307
- };
308
- 'standard:events': {
309
- version: '1.0.0';
310
- on: (event: 'change', listener: SuiWalletEventListener) => () => void;
311
- };
312
- 'sui:signPersonalMessage': {
313
- version: '1.1.0';
314
- signPersonalMessage: (input: SuiSignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
315
- };
316
- 'sui:signTransaction': {
317
- version: '2.0.0';
318
- signTransaction: (input: SuiSignTransactionInput) => Promise<SuiSignTransactionOutput>;
319
- };
320
- 'sui:switchChain': {
321
- version: '1.0.0';
322
- switchChain: (input: {
323
- chain: SuiChain;
324
- }) => Promise<void>;
325
- };
326
- 'sui:signAndExecuteTransaction': {
327
- version: '1.0.0';
328
- signAndExecuteTransaction: (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
329
- };
330
- 'sui:signTransactionBlock': {
331
- version: '2.0.0';
332
- signTransactionBlock: (input: SuiSignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
333
- };
334
- 'sui:signAndExecuteTransactionBlock': {
335
- version: '1.0.0';
336
- signAndExecuteTransactionBlock: (input: SuiSignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
337
- };
338
- }
339
- /**
340
- * WaaP Sui Wallet interface.
341
- */
342
- interface WaaPSuiWalletInterface {
343
- /** Wallet name */
344
- readonly name: string;
345
- /** Wallet version */
346
- readonly version: string;
347
- /** Wallet icon */
348
- readonly icon: WalletIcon;
349
- /** Supported chains */
350
- readonly chains: readonly SuiChain[];
351
- /** Connected accounts */
352
- readonly accounts: readonly SuiAccount[];
353
- /** Wallet Standard features */
354
- readonly features: WaaPSuiWalletFeatures;
355
- /**
356
- * Connect to the wallet.
357
- */
358
- connect(input?: SuiConnectInput): Promise<SuiConnectOutput>;
359
- /**
360
- * Disconnect from the wallet.
361
- */
362
- disconnect(): Promise<void>;
363
- /**
364
- * Switch the active chain.
365
- */
366
- switchChain(input: {
367
- chain: SuiChain;
368
- }): Promise<void>;
369
- /**
370
- * Sign a personal message.
371
- */
372
- signPersonalMessage(input: SuiSignPersonalMessageInput): Promise<SuiSignPersonalMessageOutput>;
373
- /**
374
- * Sign and execute a transaction.
375
- */
376
- signAndExecuteTransaction(input: SuiSignAndExecuteTransactionInput): Promise<SuiSignAndExecuteTransactionOutput>;
377
- /**
378
- * Sign a transaction block (Legacy).
379
- */
380
- signTransactionBlock(input: SuiSignTransactionBlockInput): Promise<SuiSignTransactionBlockOutput>;
381
- /**
382
- * Sign and execute a transaction block (Legacy).
383
- */
384
- signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiSignAndExecuteTransactionBlockOutput>;
385
- /**
386
- * Subscribe to wallet events.
387
- * @returns Unsubscribe function
388
- */
389
- on(event: 'change', listener: SuiWalletEventListener): () => void;
390
- /** custom WaaP features */
391
- /**
392
- * Request the user's email address.
393
- * @returns Promise resolving to the user's email address
394
- */
395
- requestEmail(): Promise<string>;
396
- /**
397
- * Request a Permission Token from the user.
398
- * Allows pre-authorised batches of Sui transactions without individual confirmations.
399
- *
400
- * @param params - Allowed addresses, chainId (e.g. "sui:mainnet"), spend limit, expiry
401
- * @returns Promise resolving to a RequestPermissionTokenResult
402
- */
403
- requestPermissionToken(params: RequestPermissionTokenParams): Promise<RequestPermissionTokenResult>;
404
- }
405
-
406
- /**
407
- * Sui-supported authentication methods (no 'wallet/walletconnect' support yet)
408
- * Also it is not necessary as @mysten/dapp-kit handles wallet choices
409
- * todo: maybe add a modal to list out Sui wallets discovered as per Wallet Standard
410
- */
411
- type SuiAuthenticationMethod = Exclude<AuthenticationMethod, 'wallet'>;
412
- /**
413
- * Sui-specific custom configuration
414
- */
415
- interface SuiCustomConfig extends Omit<CustomConfig, 'authenticationMethods'> {
416
- authenticationMethods?: SuiAuthenticationMethod[];
417
- }
418
- /**
419
- * Initialization options for WaaP Sui Wallet.
420
- */
421
- interface InitWaaPSuiOptions {
422
- /** Use staging environment */
423
- useStaging?: boolean;
424
- /** WaaP points referral code */
425
- referralCode?: string;
426
- /** WaaP project configuration */
427
- project?: ProjectConfig;
428
- /** WaaP custom UI configuration */
429
- config?: SuiCustomConfig;
430
- }
431
-
432
- /**
433
- * UIMessageManager emits events whose intended recipient is the UI
434
- * of the silk-wallet-sdk. It is used by EthereumProvider to
435
- * communicate with the UI.
436
- *
437
- * Note that the UI part of silk-wallet-sdk is not the Silk
438
- * website but rather the actual iframe tag that gets embedded
439
- * in the host site.
440
- */
441
-
442
- declare enum UI_EVENT_NAMES {
443
- show_modal = "show_modal",
444
- hide_modal = "hide_modal"
445
- }
446
- declare class UIMessageManager extends EventEmitter {
447
- constructor();
448
- }
449
-
450
- /**
451
- * WaaP Sui Wallet implementation.
452
- *
453
- * Implements the Sui Wallet Standard to allow dApps to:
454
- * - Connect/disconnect
455
- * - Sign personal messages
456
- * - (Future) Sign and execute transactions
457
- */
458
- declare class WaaPSuiWallet implements WaaPSuiWalletInterface {
459
- readonly name = "WaaP";
460
- readonly version = "1.0.0";
461
- readonly icon: WalletIcon;
462
- private _accounts;
463
- private _chains;
464
- private walletMessageManager;
465
- private uiMessageManager;
466
- private internalEventEmitter;
467
- private changeListeners;
468
- /**
469
- * Creates a new WaaPSuiWallet instance.
470
- *
471
- * @param iframeWindow - The contentWindow of the WaaP iframe
472
- * @param options - Initialization options
473
- */
474
- constructor(iframeWindow: Window, options?: InitWaaPSuiOptions);
475
- /**
476
- * Refresh accounts by making a silent connect request.
477
- * Used internally when account changes are detected.
478
- */
479
- private refreshAccounts;
480
- /**
481
- * Supported chains.
482
- */
483
- get chains(): readonly SuiChain[];
484
- /**
485
- * Connected accounts.
486
- */
487
- get accounts(): readonly SuiAccount[];
488
- /**
489
- * UI message manager for showing/hiding modal.
490
- */
491
- get ui(): UIMessageManager;
492
- /**
493
- * Connect to the wallet.
494
- */
495
- connect(input?: SuiConnectInput): Promise<SuiConnectOutput>;
496
- /**
497
- * Disconnect from the wallet.
498
- */
499
- disconnect(): Promise<void>;
500
- /**
501
- * Sign a personal message.
502
- *
503
- * @param input - Sign personal message input
504
- * @returns Signed message result with bytes and signature
505
- */
506
- signPersonalMessage(input: SuiSignPersonalMessageInput): Promise<SuiSignPersonalMessageOutput>;
507
- /**
508
- * Extract the destination addresses from BCS-serialized Sui transaction bytes.
509
- *
510
- * Unlike EVM transactions where `to` is a top-level field, Sui transaction
511
- * destinations are embedded in BCS-encoded programmable transaction blocks.
512
- * We deserialize with Transaction.from() and inspect TransferObjects commands.
513
- *
514
- * Only TransferObjects destinations are extracted — MoveCall package addresses
515
- * are not user-facing recipients and should not be validated against a PT's
516
- * allowedAddresses list.
517
- *
518
- * Returns an empty array if no TransferObjects are found or deserialization fails.
519
- */
520
- private extractTransferAddresses;
521
- /**
522
- * Helper to resolve transaction bytes from various input formats.
523
- * If the input is a Transaction/TransactionBlock object, it builds it.
524
- */
525
- private resolveTransactionBytes;
526
- /**
527
- * Sign a transaction.
528
- *
529
- * @param input - Sign transaction input with transaction
530
- * @returns Signed transaction result with bytes and signature
531
- */
532
- signTransaction(input: {
533
- transaction: unknown;
534
- account: SuiAccount;
535
- chain?: SuiChain;
536
- }): Promise<{
537
- bytes: string;
538
- signature: string;
539
- }>;
540
- /**
541
- * Sign and execute a transaction.
542
- *
543
- * @param input - Sign and execute transaction input
544
- */
545
- signAndExecuteTransaction(input: SuiSignAndExecuteTransactionInput): Promise<SuiSignAndExecuteTransactionOutput>;
546
- /**
547
- * Switch the active chain.
548
- */
549
- switchChain(input: {
550
- chain: SuiChain;
551
- }): Promise<void>;
552
- /**
553
- * Subscribe to wallet change events.
554
- *
555
- * @param event - Event name (currently only 'change')
556
- * @param listener - Event listener callback
557
- * @returns Unsubscribe function
558
- */
559
- on(event: 'change', listener: SuiWalletEventListener): () => void;
560
- /**
561
- * Wallet Standard features property.
562
- * Required by @mysten/wallet-standard registerWallet.
563
- */
564
- get features(): {
565
- readonly 'standard:connect': {
566
- readonly version: "1.0.0";
567
- readonly connect: (input?: SuiConnectInput) => Promise<SuiConnectOutput>;
568
- };
569
- readonly 'standard:disconnect': {
570
- readonly version: "1.0.0";
571
- readonly disconnect: () => Promise<void>;
572
- };
573
- readonly 'standard:events': {
574
- readonly version: "1.0.0";
575
- readonly on: (event: "change", listener: SuiWalletEventListener) => () => void;
576
- };
577
- readonly 'sui:signPersonalMessage': {
578
- readonly version: "1.1.0";
579
- readonly signPersonalMessage: (input: SuiSignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
580
- };
581
- readonly 'sui:signTransaction': {
582
- readonly version: "2.0.0";
583
- readonly signTransaction: (input: {
584
- transaction: unknown;
585
- account: SuiAccount;
586
- chain?: SuiChain;
587
- }) => Promise<{
588
- bytes: string;
589
- signature: string;
590
- }>;
591
- };
592
- readonly 'sui:signAndExecuteTransaction': {
593
- readonly version: "1.0.0";
594
- readonly signAndExecuteTransaction: (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
595
- };
596
- readonly 'sui:signTransactionBlock': {
597
- readonly version: "2.0.0";
598
- readonly signTransactionBlock: (input: SuiSignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
599
- };
600
- readonly 'sui:signAndExecuteTransactionBlock': {
601
- readonly version: "1.0.0";
602
- readonly signAndExecuteTransactionBlock: (input: SuiSignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
603
- };
604
- readonly 'sui:switchChain': {
605
- readonly version: "1.0.0";
606
- readonly switchChain: (input: {
607
- chain: SuiChain;
608
- }) => Promise<void>;
609
- };
610
- };
611
- /**
612
- * Legacy method for signing a transaction block.
613
- * Maps to signTransaction.
614
- */
615
- signTransactionBlock(input: SuiSignTransactionBlockInput): Promise<SuiSignTransactionBlockOutput>;
616
- /**
617
- * Legacy method for signing and executing a transaction block.
618
- * Maps to signAndExecuteTransaction.
619
- */
620
- signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiSignAndExecuteTransactionBlockOutput>;
621
- /**
622
- * Request a Permission Token from the user.
623
- * Allows pre-authorised batches of Sui transactions without individual confirmations.
624
- *
625
- * @param params - Allowed addresses, chainId (e.g. "sui:mainnet"), spend limit, expiry
626
- */
627
- requestPermissionToken(params: RequestPermissionTokenParams): Promise<RequestPermissionTokenResult>;
628
- /**
629
- * Request the user's email address.
630
- *
631
- * @returns Promise resolving to the user's email address
632
- */
633
- requestEmail(): Promise<string>;
634
- /**
635
- * Post a request to the iframe and wait for response.
636
- */
637
- private postRequestAndWait;
638
- /**
639
- * Notify all change listeners.
640
- */
641
- private notifyChange;
642
- }
643
-
644
- /**
645
- * Initialization function for WaaP Sui Wallet.
646
- */
647
-
648
- /**
649
- * Initialize WaaP Sui Wallet.
650
- *
651
- * This creates the WaaP iframe (if needed) and returns a SuiWallet instance
652
- * that implements the Sui Wallet Standard.
653
- *
654
- * @param options - Initialization options
655
- * @returns WaaPSuiWallet instance
656
- *
657
- * @example
658
- * ```typescript
659
- * import { initWaaPSui } from '@silk-wallet/silk-wallet-sdk'
660
- *
661
- * const suiWallet = initWaaPSui()
662
- *
663
- * // Connect to get accounts
664
- * const { accounts } = await suiWallet.connect()
665
- *
666
- * // Sign a message
667
- * const result = await suiWallet.signPersonalMessage({
668
- * message: new TextEncoder().encode('Hello, Sui!'),
669
- * account: accounts[0]
670
- * })
671
- * ```
672
- */
673
- declare function initWaaPSui(options?: InitWaaPSuiOptions): WaaPSuiWalletInterface;
674
-
675
- /**
676
- * WaaP Sui Wallet Registration
677
- *
678
- * Registers the WaaP Sui wallet with the Wallet Standard registry,
679
- * making it discoverable by dApps using @mysten/dapp-kit.
680
- *
681
- * @see https://docs.sui.io/standards/wallet-standard
682
- */
683
-
684
- /**
685
- * Register WaaP Sui Wallet with the Wallet Standard.
686
- *
687
- * This makes the wallet discoverable by dApps using @mysten/dapp-kit.
688
- * The wallet will appear in the wallet selection UI of any dApp
689
- * that uses the Sui Wallet Standard.
690
- *
691
- * @param iframeWindow - The contentWindow of the WaaP iframe
692
- * @param options - Initialization options
693
- * @returns The registered WaaPSuiWallet instance
694
- *
695
- * @example
696
- * ```typescript
697
- * import { registerWaaPSuiWallet } from '@silk-wallet/silk-wallet-sdk'
698
- *
699
- * // Get the iframe element
700
- * const iframe = document.getElementById('waap-wallet-iframe') as HTMLIFrameElement
701
- *
702
- * // Register the wallet (makes it discoverable by dApps)
703
- * const wallet = registerWaaPSuiWallet(iframe.contentWindow!, { useStaging: false })
704
- *
705
- * // The wallet is now available in dapp-kit's wallet list
706
- * ```
707
- */
708
- declare function registerWaaPSuiWallet(iframeWindow: Window, options?: InitWaaPSuiOptions): WaaPSuiWalletInterface;
709
-
710
- /**
711
- * WalletMessageManager handles messages between the wallet (in the Silk iframe)
712
- * and the wallet SDK (in the top frame). It is used by EthereumProvider
713
- * to communicate with the wallet.
714
- */
715
-
716
- type PostSilkRequestArgs = {
717
- method: keyof typeof SILK_METHOD;
718
- params: any[];
719
- interactionRequired: boolean;
720
- silkOptions?: {
721
- async?: boolean;
722
- };
723
- };
724
- /**
725
- * Async transaction notification from iframe
726
- */
727
- interface AsyncTxNotification {
728
- type: string;
729
- payload: any;
730
- }
731
- /**
732
- * Listener interface for WalletMessageManager
733
- */
734
- interface MessageListenerConfig {
735
- handleResponse: (response: SilkResponse) => void;
736
- handleRequest: (request: SilkRequest) => void;
737
- onReceiveConnectNotif?: () => void;
738
- onAccountChanged?: (newAccount: string) => void;
739
- onAsyncTxNotification?: (notification: AsyncTxNotification) => void;
740
- }
741
- declare class WalletMessageManager {
742
- private iframeWindow;
743
- private walletOrigin;
744
- constructor(iframeWindow: Window, useStaging: boolean);
745
- /**
746
- * Post a Silk notification to the given iframeWindow
747
- */
748
- postSilkNotification(data: SilkNotificationData): void;
749
- postReadyNotification(): void;
750
- postConnectNotification(): void;
751
- /**
752
- * Post a 'ready' notification to the iframe, and wait
753
- * for the iframe to respond with a 'ready' notification.
754
- */
755
- pingIframe(): Promise<void>;
756
- /**
757
- * Post a SilkRequest to the iframeWindow. Don't wait for a response.
758
- */
759
- postSilkRequest(req: PostSilkRequestArgs): Promise<string>;
760
- /**
761
- * Add a message listener to the window in which this is called (which should be the top frame).
762
- * It handles all messages from the Silk iframe posted to the top frame.
763
- * @param config - Configuration that includes callbacks for handling specific messages.
764
- */
765
- addListener(config: MessageListenerConfig): void;
766
- }
767
-
768
- /**
769
- * A Ethereum provder API (from EIP 1193) for Silk.
770
- * https://eips.ethereum.org/EIPS/eip-1193
771
- */
772
- /**
773
- * Resources:
774
- * - EIP-2255: Wallet Permissions System: https://eips.ethereum.org/EIPS/eip-2255
775
- */
776
-
74
+ readonly isSilk = true;
75
+ connected: boolean;
76
+ config: CustomConfig;
77
+ constructor(customConfig?: CustomConfig);
78
+ sendToExtension(args: RequestArguments): Promise<unknown>;
79
+ request(args: RequestArguments): Promise<unknown>;
80
+ enable(): Promise<unknown>;
81
+ isConnected(): boolean;
82
+ login(): Promise<unknown>;
83
+ requestSBT(type: CredentialType): Promise<unknown>;
84
+ toggleDarkMode(): Promise<void>;
85
+ safe(): Promise<unknown>;
86
+ }
87
+ //#endregion
88
+ //#region src/lib/provider/EthereumProvider.d.ts
777
89
  declare class EthereumProvider extends EventEmitter implements SilkEthereumProviderInterface {
778
- readonly isSilk = true;
779
- readonly isWaaP = true;
780
- connected: boolean;
781
- walletMessageManager: WalletMessageManager;
782
- uiMessageManager: UIMessageManager;
783
- config: CustomConfig;
784
- private currentAccount;
785
- private walletConnectProvider;
786
- /**
787
- * When true, eth_sendTransaction resolves with the pre-calculated tx hash
788
- * after signing. Broadcasting continues in the background with events.
789
- */
790
- private asyncTxs;
791
- /**
792
- * When true, sends `asyncSigning: true` in silkOptions instead of `async: true`.
793
- * This mimics the v1 SDK protocol for backward compatibility testing.
794
- * @internal
795
- */
796
- private legacyAsyncSigning;
797
- private persistedMethods;
798
- /**
799
- * We use the internalEventEmitter to emit as events
800
- * Silk messages posted to the window.
801
- */
802
- internalEventEmitter: EventEmitter;
803
- /**
804
- * @param iframeWindow - The contentWindow of the iframe of the Silk website.
805
- * @param referralCode - Silk points referral code
806
- * @param customConfig - Silk custom UI configuration
807
- * @param project - Silk project configuration
808
- * @param useStaging - Whether to use the staging environment
809
- * @param asyncTxs - When true, eth_sendTransaction resolves with tx hash after signing
810
- * @param legacyAsyncSigning - When true, sends asyncSigning in silkOptions (v1 compat)
811
- */
812
- constructor(iframeWindow: Window, referralCode?: string, customConfig?: CustomConfig, project?: ProjectConfig, useStaging?: boolean, asyncTxs?: boolean, legacyAsyncSigning?: boolean);
813
- private initializeWalletConnect;
814
- enable(): Promise<unknown>;
815
- isConnected(): boolean;
816
- request(args: RequestArguments): Promise<unknown>;
817
- login(customProvider?: EthereumProviderInterface): Promise<LoginResponse>;
818
- logout(): Promise<unknown>;
819
- private cleanupInvalidLoginState;
820
- /**
821
- * Helper method to set up window.waap for WaaP
822
- */
823
- private setupWaaP;
824
- /**
825
- * Helper method to set up window.silk for injected wallets (e.g., MetaMask)
826
- */
827
- private setupInjectedWallet;
828
- /**
829
- * Helper method to set up window.silk for WalletConnect
830
- */
831
- private setupWalletConnect;
832
- /**
833
- * Helper method to set up window.silk for auto-connect with injected wallets
834
- */
835
- private setupAutoConnectInjected;
836
- /**
837
- * Helper method to set up window.silk for auto-connect with WalletConnect
838
- */
839
- private setupAutoConnectWalletConnect;
840
- /**
841
- * Attempts to auto-connect using previously stored login method
842
- * @param method - The RPC method being called
843
- * @returns Promise<unknown> if auto-connect succeeds, null if it should fall through to normal flow
844
- */
845
- private attemptAutoConnect;
846
- getLoginMethod(): LoginResponse;
847
- toggleDarkMode(): Promise<void>;
848
- safe(): Promise<void>;
849
- orcid(): Promise<void>;
850
- /**
851
- * INTERNAL METHOD: Gas tank administration operations
852
- * This method is ONLY accessible from the Dev Portal domain
853
- * It's not included in the public typing to hide it from regular dApps
854
- */
855
- portal(feature: 'gastank' | 'customization' | 'project', operation: 'get' | 'update' | 'topup' | 'init', payload?: any): Promise<unknown>;
856
- requestEmail(): Promise<unknown>;
857
- /**
858
- * Request a Permission Token from the user.
859
- * Allows pre-authorized transactions without individual confirmations.
860
- * @param params - Permission token parameters (allowed addresses, chain, limits, expiry)
861
- * @returns Promise<RequestPermissionTokenResult>
862
- */
863
- requestPermissionToken(params: RequestPermissionTokenParams): Promise<unknown>;
864
- /**
865
- * Prompt the user to mint a Zeronym SBT.
866
- * @returns string or null - The address of the owner of the SBT, or null
867
- * if the user already minted the SBT.
868
- */
869
- requestSBT(type: CredentialType): Promise<unknown>;
870
- }
871
-
90
+ /**
91
+ * Last conversion state the wallet actually reported. The synchronous status
92
+ * accessor cannot await the iframe, and previously answered `complete` for any
93
+ * logged-in user — a definite claim it had no basis for. `pending` means "not
94
+ * yet resolved", which is the truth until `getCanonicalAccountStatus` runs.
95
+ */
96
+ private lastKnownConversion;
97
+ readonly isSilk = true;
98
+ readonly isWaaP = true;
99
+ connected: boolean;
100
+ walletMessageManager: WalletMessageManager;
101
+ uiMessageManager: UIMessageManager;
102
+ config: CustomConfig;
103
+ private currentAccount;
104
+ private accountMode;
105
+ private walletConnectProvider;
106
+ /**
107
+ * When true, eth_sendTransaction resolves with the signed transaction hash.
108
+ * Broadcasting continues in the background with lifecycle events.
109
+ */
110
+ private asyncTxs;
111
+ /**
112
+ * When true, sends `asyncSigning: true` in silkOptions instead of `async: true`.
113
+ * This mimics the v1 SDK protocol for backward compatibility testing.
114
+ * @internal
115
+ */
116
+ private legacyAsyncSigning;
117
+ private persistedMethods;
118
+ /**
119
+ * We use the internalEventEmitter to emit as events
120
+ * Silk messages posted to the window.
121
+ */
122
+ internalEventEmitter: EventEmitter;
123
+ /**
124
+ * @param iframeWindow - The contentWindow of the iframe of the Silk website.
125
+ * @param referralCode - Silk points referral code
126
+ * @param customConfig - Silk custom UI configuration
127
+ * @param project - Silk project configuration
128
+ * @param walletOrigin - Resolved wallet iframe origin
129
+ * @param asyncTxs - When true, eth_sendTransaction resolves with the signed transaction hash while broadcasting continues in the background
130
+ * @param legacyAsyncSigning - When true, sends asyncSigning in silkOptions (v1 compat)
131
+ */
132
+ /**
133
+ * `deferIframe` mode: called on first use to create the iframe and return its
134
+ * contentWindow. Undefined in eager mode. Once invoked, `iframeMounted` flips
135
+ * true and the referral/project/config setup is replayed against the iframe.
136
+ */
137
+ private ensureIframe?;
138
+ private iframeMounted;
139
+ private referralCode?;
140
+ private project?;
141
+ private customConfig?;
142
+ private initializerChains;
143
+ private sessionProtection?;
144
+ private initializerPromise;
145
+ /** Shared silent session probe for concurrent signing/connect requests. */
146
+ private sessionProbe;
147
+ private initializedIframeWindow;
148
+ constructor(iframeWindow: Window | null, referralCode?: string, customConfig?: CustomConfig, project?: ProjectConfig, walletOrigin?: string, asyncTxs?: boolean, legacyAsyncSigning?: boolean, ensureIframe?: () => Window | null, initializerChains?: readonly ('evm' | 'sui' | 'solana')[], sessionProtection?: WaaPSessionProtection);
149
+ private initializeWalletConnect;
150
+ /**
151
+ * Select the initialized signer family and atomically apply its public
152
+ * config. The wallet still accepts the old mode-only envelope, so released
153
+ * SDKs and old integrations remain wire-compatible.
154
+ */
155
+ initializeIframeContext(): Promise<void>;
156
+ /**
157
+ * Reapply this facade's signer family after a restored wallet session has
158
+ * hydrated. The one-time initializer intentionally cannot do this itself:
159
+ * a persisted wallet-store selection may hydrate after the first envelope.
160
+ *
161
+ * @internal Shared initializers use this after login; applications should
162
+ * select their family by calling the appropriate public initializer.
163
+ */
164
+ reassertIframeAccountMode(): Promise<void>;
165
+ /**
166
+ * In `deferIframe` mode, create the iframe on first use and point the message
167
+ * manager at it. Initialization is then performed by the operation that
168
+ * required the iframe. No-op in eager mode / once
169
+ * already mounted.
170
+ */
171
+ private ensureIframeMounted;
172
+ /** Ensure every public wallet operation supports deferred mounting. */
173
+ private ensureInitialized;
174
+ /** Warm the iframe after the host app's LCP without opening wallet UI. */
175
+ preload(): Promise<void>;
176
+ enable(): Promise<unknown>;
177
+ isConnected(): boolean;
178
+ /** Public-safe status for this initializer family. */
179
+ getAccountStatus(): WaaPAccountStatus;
180
+ get session(): WaaPSessionExtension;
181
+ /** Fetch the canonical, redacted account snapshot from the wallet iframe. */
182
+ getCanonicalAccountStatus(): Promise<WaaPAccountStatus>;
183
+ /** @internal Initializers set this once; applications select a mode by initializer. */
184
+ setAccountMode(mode: WaaPAccountMode): void;
185
+ request(args: RequestArguments): Promise<unknown>;
186
+ login(customProvider?: EthereumProviderInterface): Promise<LoginResponse>;
187
+ login(options: WaaPLoginOptions): Promise<LoginResponse>;
188
+ logout(): Promise<unknown>;
189
+ /** Release listeners owned by this EVM facade. */
190
+ destroy(): void;
191
+ private cleanupInvalidLoginState;
192
+ /**
193
+ * Helper method to set up window.waap for WaaP
194
+ */
195
+ private setupWaaP;
196
+ /**
197
+ * Helper method to set up window.silk for injected wallets (e.g., MetaMask)
198
+ */
199
+ private setupInjectedWallet;
200
+ /**
201
+ * Helper method to set up window.silk for WalletConnect
202
+ */
203
+ private setupWalletConnect;
204
+ /**
205
+ * Helper method to set up window.silk for auto-connect with injected wallets
206
+ */
207
+ private setupAutoConnectInjected;
208
+ /**
209
+ * Helper method to set up window.silk for auto-connect with WalletConnect
210
+ */
211
+ private setupAutoConnectWalletConnect;
212
+ /**
213
+ * Attempts to auto-connect using previously stored login method
214
+ * @param method - The RPC method being called
215
+ * @returns Promise<unknown> if auto-connect succeeds, null if it should fall through to normal flow
216
+ */
217
+ private attemptAutoConnect;
218
+ /**
219
+ * Coalesce concurrent silent session restores. This avoids repeating the
220
+ * status plus auto-connect round trips for a burst of signing requests.
221
+ */
222
+ private restorePersistedWaaPSession;
223
+ /** Probe the iframe's actual WaaP session without ever presenting wallet UI. */
224
+ private probeWaaPSession;
225
+ getLoginMethod(): LoginResponse;
226
+ toggleDarkMode(): Promise<void>;
227
+ safe(): Promise<void>;
228
+ orcid(): Promise<void>;
229
+ /**
230
+ * INTERNAL METHOD: Gas tank administration operations
231
+ * This method is ONLY accessible from the Dev Portal domain
232
+ * It's not included in the public typing to hide it from regular dApps
233
+ */
234
+ portal(feature: 'gastank' | 'customization' | 'project', operation: 'get' | 'update' | 'topup' | 'init', payload?: any): Promise<unknown>;
235
+ requestEmail(): Promise<unknown>;
236
+ /**
237
+ * Request a Permission Token from the user.
238
+ * Allows pre-authorized transactions without individual confirmations.
239
+ * @param params - Permission token parameters (allowed addresses, chain, limits, expiry)
240
+ * @returns Promise<RequestPermissionTokenResult>
241
+ */
242
+ requestPermissionToken(params: RequestPermissionTokenParams): Promise<unknown>;
243
+ getPermissionTokenStatus(query: PermissionTokenQuery): Promise<PermissionTokenStatus>;
244
+ clearPermissionToken(query: PermissionTokenQuery): Promise<PermissionTokenClearResult>;
245
+ /**
246
+ * Prompt the user to mint a Zeronym SBT.
247
+ * @returns string or null - The address of the owner of the SBT, or null
248
+ * if the user already minted the SBT.
249
+ */
250
+ requestSBT(type: CredentialType): Promise<unknown>;
251
+ }
252
+ //#endregion
253
+ //#region src/lib/provider/requests.d.ts
872
254
  /**
873
255
  * Options passed to iframe for transaction behavior
874
256
  */
875
- interface SilkOptions {
876
- async?: boolean;
877
- withPT?: boolean;
257
+ interface WaaPRequestOptions {
258
+ async?: boolean;
259
+ withPT?: boolean;
260
+ /** Timeout for non-interactive requests, in milliseconds. SDK-side only, not forwarded to the iframe. */
261
+ timeoutMs?: number;
262
+ /** Cancel this SDK wait and remove its queued iframe request. */
263
+ signal?: AbortSignal;
878
264
  }
265
+ /** Whether a standard EIP-1193 request must show wallet UI. */
266
+ declare const rpcMethodRequiresUI: (method: JSON_RPC_METHOD) => boolean;
879
267
  /**
880
268
  * Send request to wallet in iframe, and upon receiving the wallet's response
881
269
  * or error, hide modal and return wallet's response or throw wallet's error.
882
270
  */
883
- declare function handleWalletRequestAndResponse(args: RequestArguments, interactionRequired: boolean, walletMessageManager: WalletMessageManager, internalProviderEventEmitter: EventEmitter, silkOptions?: SilkOptions): Promise<unknown>;
884
-
885
- /**
886
- * Transaction state tracked by the hook.
887
- * Keyed by txHash (pre-calculated from keccak256(serializedSignedTx)).
888
- */
889
- interface TxState {
890
- status: 'signed' | 'tx_pending' | 'confirmed' | 'failed';
891
- txHash: string;
892
- /** @deprecated Use `txHash` instead. */
893
- pendingTxId?: string;
894
- signature?: string;
895
- serializedTx?: string;
896
- receipt?: AsyncTxConfirmedEvent['receipt'];
897
- error?: string;
898
- stage?: AsyncTxFailedEvent['stage'];
899
- }
900
- /**
901
- * Options for useWaapTransaction hook
902
- */
903
- interface UseWaapTransactionOptions {
904
- onSigned?: (event: AsyncSignCompleteEvent) => void;
905
- onTxPending?: (event: AsyncTxPendingEvent) => void;
906
- onConfirmed?: (event: AsyncTxConfirmedEvent) => void;
907
- onFailed?: (event: AsyncTxFailedEvent) => void;
908
- /** @deprecated No longer emitted in v2. */
909
- onPending?: (event: any) => void;
910
- /** @deprecated No longer emitted in v2. */
911
- on2faRequired?: (event: any) => void;
912
- /** @deprecated Use `onFailed` instead. */
913
- onSignFailed?: (event: any) => void;
914
- }
915
- /**
916
- * Return type for useWaapTransaction hook
917
- */
918
- interface UseWaapTransactionReturn {
919
- /**
920
- * Send a transaction using eth_sendTransaction.
921
- * When asyncTxs is enabled, resolves with the pre-calculated txHash
922
- * after signing. Broadcasting continues in the background with events.
923
- */
924
- sendTransaction: (txRequest: RequestArguments['params']) => Promise<string>;
925
- /**
926
- * Sign a transaction without broadcasting using eth_signTransaction.
927
- * Always resolves with the signature directly.
928
- */
929
- signTransaction: (txRequest: RequestArguments['params']) => Promise<string>;
930
- /**
931
- * Map of transaction hashes to their current state
932
- */
933
- pendingTransactions: Map<string, TxState>;
934
- /**
935
- * Whether there are any pending transactions
936
- */
937
- isAnyPending: boolean;
938
- }
939
- /**
940
- * React hook for handling async transactions with WaaP SDK.
941
- *
942
- * When `asyncTxs` is enabled (via `initWaaP({ asyncTxs: true })` or per-request `{ async: true }`):
943
- * - `eth_sendTransaction` resolves with the pre-calculated tx hash after signing
944
- * - Broadcasting and confirmation happen in the background with events
945
- * - Use the callbacks to track transaction lifecycle
946
- *
947
- * Other signing methods (`personal_sign`, `eth_signTypedData_v4`, `eth_signTransaction`)
948
- * always resolve with the signature directly — no events needed.
949
- *
950
- * @example
951
- * ```tsx
952
- * const { sendTransaction, pendingTransactions, isAnyPending } = useWaapTransaction({
953
- * onSigned: ({ txHash }) => console.log('Signed:', txHash),
954
- * onTxPending: ({ txHash }) => console.log('Broadcasting:', txHash),
955
- * onConfirmed: ({ txHash, receipt }) => console.log('Confirmed:', txHash),
956
- * onFailed: ({ txHash, error }) => console.error('Failed:', txHash, error)
957
- * });
958
- *
959
- * const handleSend = async () => {
960
- * const txHash = await sendTransaction([{ to: '0x...', value: '0x...' }]);
961
- * console.log('Got tx hash:', txHash);
962
- * };
963
- * ```
964
- */
965
- declare function useWaapTransaction(options?: UseWaapTransactionOptions): UseWaapTransactionReturn;
966
-
967
- export { EthereumProvider, EthereumProviderExtension, type InitSilkOptions, type InitSilkOptions as InitWaaPOptions, type InitWaaPSuiOptions, type PostSilkRequestArgs, type PostSilkRequestArgs as PostWaaPRequestArgs, type SilkEthereumProviderInterface, type SilkProvider, SilkWalletConnect, type SuiAccount, type SuiChain, type SuiConnectInput, type SuiConnectOutput, type SuiSignPersonalMessageInput, type SuiSignPersonalMessageOutput, type TxState, UIMessageManager, UI_EVENT_NAMES, type UseWaapTransactionOptions, type UseWaapTransactionReturn, WaapWalletElement as WaaP, type SilkEthereumProviderInterface as WaaPEthereumProviderInterface, type SilkProvider as WaaPProvider, WaaPSuiWallet, type WaaPSuiWalletFeatures, type WaaPSuiWalletInterface, SilkWalletConnect as WaaPWalletConnect, WalletMessageManager, handleWalletRequestAndResponse, initWaaP, initWaaPSui, registerWaaPSuiWallet, useWaapTransaction };
271
+ declare function handleWalletRequestAndResponse(args: RequestArguments, interactionRequired: boolean, walletMessageManager: WalletMessageManager, internalProviderEventEmitter: EventEmitter, silkOptions?: WaaPRequestOptions): Promise<any>;
272
+ //#endregion
273
+ export { type Async2faRequiredEvent, type AsyncEvent, type AsyncEventType, type AsyncSignCompleteEvent, type AsyncSignFailedEvent, type AsyncSignPendingEvent, type AsyncTxConfirmedEvent, type AsyncTxFailedEvent, type AsyncTxPendingEvent, type AsyncTxResponse, type AuthenticationMethod, type CancelWaaPPreload, type CredentialType, EthereumProvider, EthereumProviderExtension, type InitSilkOptions, type InitWaaPChainOptions, type InitWaaPMultiOptions, type InitWaaPOptions, type InitWaaPSolanaOptions, type InitWaaPSquidOptions, type InitWaaPSuiOptions, type InitWaaPTapOptions, type PermissionTokenClearResult, type PermissionTokenQuery, type PermissionTokenStatus, type PostSilkRequestArgs, type PostSilkRequestArgs as PostWaaPRequestArgs, type ProjectConfig, type RequestPermissionTokenParams, type RequestPermissionTokenResult, SILK_METHOD, SILK_METHOD as WAAP_METHOD, type SilkEthereumProviderInterface, type SilkEthereumProviderInterface as WaaPEthereumProviderInterface, type SilkOptions, type SilkProvider, type SilkProvider as WaaPProvider, SilkWalletConnect, SilkWalletConnect as WaaPWalletConnect, type SocialProvider, type SolanaAccount, type SolanaChain, type SolanaConnectInput, type SolanaConnectOutput, type SolanaSignAndSendTransactionInput, type SolanaSignAndSendTransactionOutput, type SolanaSignMessageInput, type SolanaSignMessageOutput, type SolanaSignTransactionInput, type SolanaSignTransactionOutput, type SolanaStandardSignAndSendTransactionInput, type SolanaStandardSignAndSendTransactionOutput, type SolanaStandardSignMessageInput, type SolanaStandardSignMessageOutput, type SolanaStandardSignTransactionInput, type SolanaStandardSignTransactionOutput, type SquidFailedEvent, type SquidLifecycleEventType, type SquidPendingEvent, type SquidReadyEvent, type StylesConfig, type SuiAccount, type SuiChain, type SuiConnectInput, type SuiConnectOutput, type SuiSignAndExecuteTransactionInput, type SuiSignAndExecuteTransactionOutput, type SuiSignPersonalMessageInput, type SuiSignPersonalMessageOutput, type SuiSignTransactionInput, type SuiSignTransactionOutput, type SuiTransactionInput, type TxState, UIMessageManager, UI_EVENT_NAMES, type UseWaapTransactionOptions, type UseWaapTransactionReturn, WAAP_EVENTS, WaapWalletElement as WaaP, type WaaPAccountMode, type WaaPAccountStatus, type WaaPChain, type WaaPEnvironment, WaaPError, type WaaPErrorCode, type WaaPIdlePreloadOptions, type WaaPIframeDiagnostics, type WaaPIframeLifecycleEvent, type WaaPIframeLifecyclePhase, type WaaPLoginOptions, type WaaPOperationMetadata, type WaaPPreloadTarget, type WaaPSessionProtection, WaaPSolanaProvider, type WaaPSolanaProviderInterface, type WaaPSolanaWalletFeatures, type WaaPSquid, type WaaPSquidChain, type WaaPSquidLifecycle, type WaaPSquidSession, type WaaPSquidStatus, type WaaPSquidStatusState, WaaPSuiWallet, type WaaPSuiWalletFeatures, type WaaPSuiWalletInterface, type WaaPTap, type WaaPTapSession, type WaaPWalletTargetOptions, WalletMessageManager, getWaaPIframeDiagnostics, handleWalletRequestAndResponse, initWaaP, initWaaPMulti, initWaaPSolana, initWaaPSquid, initWaaPSui, initWaaPTap, normalizeWaaPError, preloadWaaPOnIdle, registerWaaPSolanaWallet, registerWaaPSuiWallet, resolveWalletOrigin, rpcMethodRequiresUI, subscribeWaaPIframeLifecycle, useWaapAuth, useWaapTransaction, validateWalletOrigin };