@swype-org/react-sdk 0.2.185 → 0.2.215
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.cjs +7732 -3633
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +298 -13
- package/dist/index.d.ts +298 -13
- package/dist/index.js +6216 -2138
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode, MouseEvent, HTMLAttributeAnchorTarget } from 'react';
|
|
3
3
|
|
|
4
|
-
type ChainFamily = 'evm' | 'svm';
|
|
4
|
+
type ChainFamily = 'evm' | 'svm' | 'tvm';
|
|
5
5
|
/** Wallet provider (e.g. MetaMask or Phantom) */
|
|
6
6
|
interface Provider {
|
|
7
7
|
id: string;
|
|
@@ -64,6 +64,8 @@ interface Account {
|
|
|
64
64
|
name: string;
|
|
65
65
|
/** Optional user-chosen display name for this account. */
|
|
66
66
|
nickname?: string | null;
|
|
67
|
+
/** Optional display logo URL, e.g. the selected Reown wallet icon. */
|
|
68
|
+
logoURI?: string;
|
|
67
69
|
wallets: Wallet[];
|
|
68
70
|
/** Remaining One-Tap allowance in USD, or null when not configured. */
|
|
69
71
|
remainingAllowance?: number | null;
|
|
@@ -92,6 +94,14 @@ interface AuthorizationAction {
|
|
|
92
94
|
orderIndex: number;
|
|
93
95
|
metadata?: Record<string, unknown>;
|
|
94
96
|
}
|
|
97
|
+
interface WalletConnectAccountMetadata {
|
|
98
|
+
reownWalletId: string;
|
|
99
|
+
name: string;
|
|
100
|
+
imageUrl?: string;
|
|
101
|
+
mobileNativeLink?: string;
|
|
102
|
+
mobileUniversalLink?: string;
|
|
103
|
+
desktopNativeLink?: string;
|
|
104
|
+
}
|
|
95
105
|
/** Full authorization session with ordered actions */
|
|
96
106
|
interface AuthorizationSessionDetail {
|
|
97
107
|
id: string;
|
|
@@ -194,7 +204,18 @@ interface ErrorResponse {
|
|
|
194
204
|
interface ActionExecutionResult {
|
|
195
205
|
actionId: string;
|
|
196
206
|
type: string;
|
|
197
|
-
|
|
207
|
+
/**
|
|
208
|
+
* `pending` is a soft-halt sentinel: the action did not succeed, but it
|
|
209
|
+
* also did not produce a user-visible error. Used by `OPEN_PROVIDER` on
|
|
210
|
+
* desktop when no wallet extension is installed (or the user dismissed
|
|
211
|
+
* the connect prompt) and a parallel cross-device QR / auth-app path is
|
|
212
|
+
* still in flight. The session executor unwinds without throwing and
|
|
213
|
+
* the caller should not restore selection — `useDesktopWaitPollingEffect`
|
|
214
|
+
* (or the merchant's own polling) drives eventual completion.
|
|
215
|
+
*/
|
|
216
|
+
status: 'success' | 'error' | 'pending';
|
|
217
|
+
/** When `status === 'pending'`, identifies the soft-halt reason. */
|
|
218
|
+
pendingReason?: 'awaiting-external-authorization';
|
|
198
219
|
message: string;
|
|
199
220
|
data?: unknown;
|
|
200
221
|
}
|
|
@@ -210,6 +231,8 @@ interface SourceOption {
|
|
|
210
231
|
rawBalance: string;
|
|
211
232
|
walletId?: string;
|
|
212
233
|
status?: string;
|
|
234
|
+
walletName?: string;
|
|
235
|
+
walletLogoUrl?: string;
|
|
213
236
|
}
|
|
214
237
|
/** User's chain+token selection for the SELECT_SOURCE action. */
|
|
215
238
|
interface SourceSelection {
|
|
@@ -224,6 +247,49 @@ interface Destination {
|
|
|
224
247
|
address: string;
|
|
225
248
|
};
|
|
226
249
|
}
|
|
250
|
+
type ManualTransferStatus = 'awaiting_deposit' | 'deposit_received' | 'routing' | 'completed' | 'refunded' | 'failed' | 'wrong_token';
|
|
251
|
+
interface ManualTransferSourceOption {
|
|
252
|
+
chainId: number;
|
|
253
|
+
chainName: string;
|
|
254
|
+
chainFamily: 'evm' | 'svm' | 'tvm';
|
|
255
|
+
tokenSymbol: string;
|
|
256
|
+
tokenAddress: string;
|
|
257
|
+
decimals: number;
|
|
258
|
+
minAmountUsd: string;
|
|
259
|
+
}
|
|
260
|
+
interface ManualTransferSlippageSnapshot {
|
|
261
|
+
estimatedOutput: string;
|
|
262
|
+
slippageValue: string;
|
|
263
|
+
slippagePercentage: string;
|
|
264
|
+
slippageValueCurrency: string;
|
|
265
|
+
createdAt: string;
|
|
266
|
+
}
|
|
267
|
+
interface ManualTransferSession {
|
|
268
|
+
sessionId: string;
|
|
269
|
+
idempotencyKey: string;
|
|
270
|
+
merchantId: string;
|
|
271
|
+
destination: Destination;
|
|
272
|
+
source: {
|
|
273
|
+
chainId: number;
|
|
274
|
+
tokenAddress: string;
|
|
275
|
+
tokenSymbol: string;
|
|
276
|
+
};
|
|
277
|
+
refundTo: string | null;
|
|
278
|
+
depositAddress: string;
|
|
279
|
+
requestId: string;
|
|
280
|
+
status: ManualTransferStatus;
|
|
281
|
+
minAmountUsd: string;
|
|
282
|
+
slippage: ManualTransferSlippageSnapshot | null;
|
|
283
|
+
quoteValidUntil: string;
|
|
284
|
+
depositTxHashes: string[];
|
|
285
|
+
destinationTxHash: string | null;
|
|
286
|
+
refundTxHashes: string[];
|
|
287
|
+
deliveredAmountUsd: string | null;
|
|
288
|
+
errorCode: string | null;
|
|
289
|
+
errorMessage: string | null;
|
|
290
|
+
createDate: string;
|
|
291
|
+
updateDate: string;
|
|
292
|
+
}
|
|
227
293
|
/** Merchant-signed authorization envelope required for transfer creation. */
|
|
228
294
|
interface MerchantAuthorization {
|
|
229
295
|
merchantId: string;
|
|
@@ -300,6 +366,7 @@ interface ThemeTokens {
|
|
|
300
366
|
shadowLg: string;
|
|
301
367
|
radius: string;
|
|
302
368
|
radiusLg: string;
|
|
369
|
+
fontFamily: string;
|
|
303
370
|
}
|
|
304
371
|
declare const darkTheme: ThemeTokens;
|
|
305
372
|
declare const lightTheme: ThemeTokens;
|
|
@@ -323,6 +390,16 @@ interface BlinkConfig {
|
|
|
323
390
|
depositAmount: number | null;
|
|
324
391
|
/** Update the deposit amount from a host-app component */
|
|
325
392
|
setDepositAmount: (amount: number | null) => void;
|
|
393
|
+
/**
|
|
394
|
+
* When true, render the new full-widget entry experience (Deposit Options
|
|
395
|
+
* screen with Crypto/Cash toggle and source rows) before the login flow for
|
|
396
|
+
* unauthenticated users. Defaults to `false` for backwards compatibility.
|
|
397
|
+
*
|
|
398
|
+
* Optional on `BlinkConfig` so consumers of this type that pre-date the flag
|
|
399
|
+
* keep type-checking. Internal SDK code should normalize via
|
|
400
|
+
* `useBlinkConfig().enableFullWidget ?? false`.
|
|
401
|
+
*/
|
|
402
|
+
enableFullWidget?: boolean;
|
|
326
403
|
}
|
|
327
404
|
interface BlinkProviderProps {
|
|
328
405
|
/** Base URL for the Blink API (e.g. "http://localhost:3000") */
|
|
@@ -340,6 +417,11 @@ interface BlinkProviderProps {
|
|
|
340
417
|
privyAppId?: string;
|
|
341
418
|
/** Minimum USD amount accepted when no payment-specific deposit amount is set. */
|
|
342
419
|
minTransferAmountUsd?: number;
|
|
420
|
+
/**
|
|
421
|
+
* When true, render the new full-widget entry experience (DepositOptionsScreen)
|
|
422
|
+
* before login for unauthenticated users. Defaults to `false`.
|
|
423
|
+
*/
|
|
424
|
+
enableFullWidget?: boolean;
|
|
343
425
|
children: React.ReactNode;
|
|
344
426
|
}
|
|
345
427
|
/**
|
|
@@ -356,7 +438,7 @@ interface BlinkProviderProps {
|
|
|
356
438
|
* </BlinkProvider>
|
|
357
439
|
* ```
|
|
358
440
|
*/
|
|
359
|
-
declare function BlinkProvider({ apiBaseUrl, theme, privyAppId, minTransferAmountUsd, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
441
|
+
declare function BlinkProvider({ apiBaseUrl, theme, privyAppId, minTransferAmountUsd, enableFullWidget, children, }: BlinkProviderProps): react_jsx_runtime.JSX.Element;
|
|
360
442
|
/** Access the Blink SDK configuration. Throws if used outside BlinkProvider. */
|
|
361
443
|
declare function useBlinkConfig(): BlinkConfig;
|
|
362
444
|
/**
|
|
@@ -395,6 +477,8 @@ interface CreateAccountParams {
|
|
|
395
477
|
* {@link setAuthorizationSessionProvider} once the user taps a wallet.
|
|
396
478
|
*/
|
|
397
479
|
providerId?: string;
|
|
480
|
+
connectionTransport?: 'walletconnect';
|
|
481
|
+
walletConnect?: WalletConnectAccountMetadata;
|
|
398
482
|
/** Optional user-chosen display name. */
|
|
399
483
|
nickname?: string;
|
|
400
484
|
paymentIntent?: {
|
|
@@ -515,7 +599,29 @@ declare function setAuthorizationSessionProvider(apiBaseUrl: string, sessionId:
|
|
|
515
599
|
declare function updateUserConfigBySession(apiBaseUrl: string, sessionId: string, config: {
|
|
516
600
|
defaultAllowance: number;
|
|
517
601
|
}): Promise<void>;
|
|
602
|
+
interface FetchManualTransferSourcesParams {
|
|
603
|
+
merchantAuthorization: MerchantAuthorization;
|
|
604
|
+
destination: Destination;
|
|
605
|
+
}
|
|
606
|
+
declare function fetchManualTransferSources(apiBaseUrl: string, params: FetchManualTransferSourcesParams): Promise<ManualTransferSourceOption[]>;
|
|
607
|
+
interface CreateManualTransferParams {
|
|
608
|
+
merchantAuthorization: MerchantAuthorization;
|
|
609
|
+
destination: Destination;
|
|
610
|
+
source: {
|
|
611
|
+
chainId: number;
|
|
612
|
+
tokenAddress: string;
|
|
613
|
+
};
|
|
614
|
+
idempotencyKey?: string;
|
|
615
|
+
}
|
|
616
|
+
declare function createManualTransfer(apiBaseUrl: string, params: CreateManualTransferParams): Promise<ManualTransferSession>;
|
|
617
|
+
declare function fetchManualTransferSession(apiBaseUrl: string, sessionId: string): Promise<ManualTransferSession>;
|
|
518
618
|
declare function reportActionCompletion(apiBaseUrl: string, actionId: string, result: Record<string, unknown>): Promise<AuthorizationSessionDetail>;
|
|
619
|
+
interface ActionTransactionReceiptWaitResult {
|
|
620
|
+
txHash: string;
|
|
621
|
+
chainName: string;
|
|
622
|
+
status: 'success';
|
|
623
|
+
}
|
|
624
|
+
declare function waitForActionTransactionReceipt(apiBaseUrl: string, actionId: string, txHash: string): Promise<ActionTransactionReceiptWaitResult>;
|
|
519
625
|
type ProbeActionCompletionResult = {
|
|
520
626
|
detected: true;
|
|
521
627
|
session: AuthorizationSessionDetail;
|
|
@@ -555,20 +661,26 @@ type ProbeActionCompletionResult = {
|
|
|
555
661
|
*/
|
|
556
662
|
declare function probeActionCompletion(apiBaseUrl: string, actionId: string): Promise<ProbeActionCompletionResult>;
|
|
557
663
|
|
|
664
|
+
type api_ActionTransactionReceiptWaitResult = ActionTransactionReceiptWaitResult;
|
|
558
665
|
type api_BridgeCall = BridgeCall;
|
|
559
666
|
type api_CreateAccountAuthorizationSessionOptions = CreateAccountAuthorizationSessionOptions;
|
|
560
667
|
type api_CreateAccountParams = CreateAccountParams;
|
|
668
|
+
type api_CreateManualTransferParams = CreateManualTransferParams;
|
|
561
669
|
type api_CreateTransferParams = CreateTransferParams;
|
|
670
|
+
type api_FetchManualTransferSourcesParams = FetchManualTransferSourcesParams;
|
|
562
671
|
type api_ProbeActionCompletionResult = ProbeActionCompletionResult;
|
|
563
672
|
type api_TransferQuote = TransferQuote;
|
|
564
673
|
declare const api_createAccount: typeof createAccount;
|
|
565
674
|
declare const api_createAccountAuthorizationSession: typeof createAccountAuthorizationSession;
|
|
675
|
+
declare const api_createManualTransfer: typeof createManualTransfer;
|
|
566
676
|
declare const api_createTransfer: typeof createTransfer;
|
|
567
677
|
declare const api_fetchAccount: typeof fetchAccount;
|
|
568
678
|
declare const api_fetchAccounts: typeof fetchAccounts;
|
|
569
679
|
declare const api_fetchAuthorizationSession: typeof fetchAuthorizationSession;
|
|
570
680
|
declare const api_fetchAuthorizationSessionByToken: typeof fetchAuthorizationSessionByToken;
|
|
571
681
|
declare const api_fetchChains: typeof fetchChains;
|
|
682
|
+
declare const api_fetchManualTransferSession: typeof fetchManualTransferSession;
|
|
683
|
+
declare const api_fetchManualTransferSources: typeof fetchManualTransferSources;
|
|
572
684
|
declare const api_fetchMerchantPublicKey: typeof fetchMerchantPublicKey;
|
|
573
685
|
declare const api_fetchProviders: typeof fetchProviders;
|
|
574
686
|
declare const api_fetchTransfer: typeof fetchTransfer;
|
|
@@ -583,12 +695,16 @@ declare const api_setTransferSource: typeof setTransferSource;
|
|
|
583
695
|
declare const api_signTransfer: typeof signTransfer;
|
|
584
696
|
declare const api_updateUserConfig: typeof updateUserConfig;
|
|
585
697
|
declare const api_updateUserConfigBySession: typeof updateUserConfigBySession;
|
|
698
|
+
declare const api_waitForActionTransactionReceipt: typeof waitForActionTransactionReceipt;
|
|
586
699
|
declare namespace api {
|
|
587
|
-
export { type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateTransferParams as CreateTransferParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession };
|
|
700
|
+
export { type api_ActionTransactionReceiptWaitResult as ActionTransactionReceiptWaitResult, type api_BridgeCall as BridgeCall, type api_CreateAccountAuthorizationSessionOptions as CreateAccountAuthorizationSessionOptions, type api_CreateAccountParams as CreateAccountParams, type api_CreateManualTransferParams as CreateManualTransferParams, type api_CreateTransferParams as CreateTransferParams, type api_FetchManualTransferSourcesParams as FetchManualTransferSourcesParams, type api_ProbeActionCompletionResult as ProbeActionCompletionResult, type api_TransferQuote as TransferQuote, api_createAccount as createAccount, api_createAccountAuthorizationSession as createAccountAuthorizationSession, api_createManualTransfer as createManualTransfer, api_createTransfer as createTransfer, api_fetchAccount as fetchAccount, api_fetchAccounts as fetchAccounts, api_fetchAuthorizationSession as fetchAuthorizationSession, api_fetchAuthorizationSessionByToken as fetchAuthorizationSessionByToken, api_fetchChains as fetchChains, api_fetchManualTransferSession as fetchManualTransferSession, api_fetchManualTransferSources as fetchManualTransferSources, api_fetchMerchantPublicKey as fetchMerchantPublicKey, api_fetchProviders as fetchProviders, api_fetchTransfer as fetchTransfer, api_fetchUserConfig as fetchUserConfig, api_postTransferQuote as postTransferQuote, api_probeActionCompletion as probeActionCompletion, api_registerPasskey as registerPasskey, api_reportActionCompletion as reportActionCompletion, api_reportPasskeyActivity as reportPasskeyActivity, api_setAuthorizationSessionProvider as setAuthorizationSessionProvider, api_setTransferSource as setTransferSource, api_signTransfer as signTransfer, api_updateUserConfig as updateUserConfig, api_updateUserConfigBySession as updateUserConfigBySession, api_waitForActionTransactionReceipt as waitForActionTransactionReceipt };
|
|
588
701
|
}
|
|
589
702
|
|
|
590
703
|
interface BlinkPaymentProps {
|
|
591
704
|
destination: Destination;
|
|
705
|
+
/** Dev/testing shortcut: skip directly to a specific screen on first render. */
|
|
706
|
+
initialScreen?: 'manual-transfer';
|
|
707
|
+
mock?: boolean;
|
|
592
708
|
onComplete?: (transfer: Transfer) => void;
|
|
593
709
|
onError?: (error: string) => void;
|
|
594
710
|
useWalletConnector?: boolean;
|
|
@@ -608,18 +724,35 @@ interface SelectSourceChainChoice {
|
|
|
608
724
|
tokens: {
|
|
609
725
|
tokenSymbol: string;
|
|
610
726
|
balance: number;
|
|
727
|
+
walletName?: string;
|
|
728
|
+
walletLogoUrl?: string;
|
|
611
729
|
}[];
|
|
612
730
|
}
|
|
613
731
|
|
|
614
|
-
type ScreenName = 'loading' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'deposit';
|
|
732
|
+
type ScreenName = 'loading' | 'manual-transfer' | 'login' | 'success' | 'processing' | 'confirm-sign' | 'select-source' | 'setup' | 'open-wallet' | 'setup-deposit' | 'passkey-ready' | 'wallet-picker' | 'token-picker' | 'guest-source-picker' | 'amount-too-low' | 'deposit' | 'deposit-options';
|
|
615
733
|
interface MobileFlowState {
|
|
616
734
|
deeplinkUri: string;
|
|
617
735
|
providerId: string | null;
|
|
618
736
|
}
|
|
737
|
+
/**
|
|
738
|
+
* Desktop wait state — populated while the inline wagmi authorization executor
|
|
739
|
+
* is running and we want OpenWalletScreen to render a QR fallback so a user
|
|
740
|
+
* who has the wallet on their phone can complete via auth-app instead.
|
|
741
|
+
*/
|
|
742
|
+
interface DesktopWaitState {
|
|
743
|
+
sessionId: string;
|
|
744
|
+
sessionUri: string;
|
|
745
|
+
walletDeeplinks: WalletDeeplink[] | null;
|
|
746
|
+
providerId: string | null;
|
|
747
|
+
}
|
|
619
748
|
type PaymentPhase = {
|
|
620
749
|
step: 'initializing';
|
|
750
|
+
} | {
|
|
751
|
+
step: 'manual-transfer';
|
|
621
752
|
} | {
|
|
622
753
|
step: 'login';
|
|
754
|
+
} | {
|
|
755
|
+
step: 'deposit-options';
|
|
623
756
|
} | {
|
|
624
757
|
step: 'data-loading';
|
|
625
758
|
} | {
|
|
@@ -630,6 +763,7 @@ type PaymentPhase = {
|
|
|
630
763
|
} | {
|
|
631
764
|
step: 'wallet-setup';
|
|
632
765
|
mobile: MobileFlowState | null;
|
|
766
|
+
desktopWait?: DesktopWaitState | null;
|
|
633
767
|
accountId: string | null;
|
|
634
768
|
} | {
|
|
635
769
|
step: 'select-source';
|
|
@@ -664,7 +798,10 @@ type PaymentPhase = {
|
|
|
664
798
|
declare function screenForPhase(phase: PaymentPhase): ScreenName;
|
|
665
799
|
|
|
666
800
|
type WalletClient = {
|
|
667
|
-
request: (
|
|
801
|
+
request: (args: {
|
|
802
|
+
method: string;
|
|
803
|
+
params?: unknown[];
|
|
804
|
+
}) => Promise<unknown>;
|
|
668
805
|
};
|
|
669
806
|
/**
|
|
670
807
|
* Wallets report atomic batching support in two known formats:
|
|
@@ -703,7 +840,7 @@ interface WalletCapabilitiesDebugSnapshot {
|
|
|
703
840
|
* Queries wallet_getCapabilities for the given address.
|
|
704
841
|
* Returns an empty record if the wallet doesn't support EIP-5792.
|
|
705
842
|
*/
|
|
706
|
-
declare function getWalletCapabilities(walletClient: WalletClient, address: string): Promise<WalletCapabilities>;
|
|
843
|
+
declare function getWalletCapabilities(walletClient: WalletClient, address: string, chainId?: number | null): Promise<WalletCapabilities>;
|
|
707
844
|
declare function getAtomicBatchSupportDebugInfo(capabilities: WalletCapabilities, chainId: number): AtomicBatchSupportDebugInfo;
|
|
708
845
|
declare function supportsAtomicBatch(capabilities: WalletCapabilities, chainId: number): boolean;
|
|
709
846
|
declare function supportsPaymasterService(capabilities: WalletCapabilities, chainId: number): boolean;
|
|
@@ -747,16 +884,44 @@ interface BatchedActionExecutionInput {
|
|
|
747
884
|
action: AuthorizationAction;
|
|
748
885
|
sessionId: string | null;
|
|
749
886
|
}
|
|
750
|
-
|
|
887
|
+
/**
|
|
888
|
+
* Result resolved by an external (non-WC) connect that may race the WalletConnect
|
|
889
|
+
* pairing — currently a wagmi `connectAsync` against an EIP-6963 extension that
|
|
890
|
+
* matches the picked Reown wallet. When this Promise resolves before WC pairs,
|
|
891
|
+
* the WC `connect()` is invalidated and we report the extension's wallet to the
|
|
892
|
+
* backend instead. The action result carries `transport: 'wagmi'` so the
|
|
893
|
+
* dispatcher flips `activeEvmTransportRef` to `'wagmi'` and the rest of the
|
|
894
|
+
* session's actions run through the wagmi branch (extension popups) rather than
|
|
895
|
+
* the WC runtime.
|
|
896
|
+
*/
|
|
897
|
+
interface WalletConnectExternalConnectResult {
|
|
898
|
+
accounts: readonly string[];
|
|
899
|
+
/** Numeric chain id (e.g. 8453 for Base). The executor formats it as 0x-hex. */
|
|
900
|
+
chainId: number;
|
|
901
|
+
}
|
|
751
902
|
type ExecutionResult = {
|
|
752
903
|
status: 'completed';
|
|
753
904
|
} | {
|
|
754
905
|
status: 'cancelled';
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Returned when an action returned a soft `pending` sentinel (e.g.
|
|
909
|
+
* desktop wait active and no wallet extension installed). The wagmi
|
|
910
|
+
* inline path has stopped without error; an external path
|
|
911
|
+
* (cross-device QR → auth-app → session polling) is expected to drive
|
|
912
|
+
* completion. Callers should leave `state.desktopWait` pinned and not
|
|
913
|
+
* restore selection.
|
|
914
|
+
*/
|
|
915
|
+
| {
|
|
916
|
+
status: 'awaiting-external';
|
|
917
|
+
reason: string;
|
|
755
918
|
};
|
|
756
919
|
|
|
757
920
|
interface ExecuteActionOptions {
|
|
758
921
|
/** Forwarded to actions that may need server polling (e.g. SIGN_PERMIT2 typedData). */
|
|
759
922
|
sessionId?: string;
|
|
923
|
+
/** WalletConnect account/runtime key that owns this action. */
|
|
924
|
+
walletConnectRuntimeKey?: string;
|
|
760
925
|
/**
|
|
761
926
|
* Forwarded to APPROVE_SPL: invoked once after the Phantom signature is
|
|
762
927
|
* returned and before client-side on-chain confirmation begins. The
|
|
@@ -764,6 +929,18 @@ interface ExecuteActionOptions {
|
|
|
764
929
|
* cue while the SDK polls for `confirmed`.
|
|
765
930
|
*/
|
|
766
931
|
onApproveSplConfirming?: (action: AuthorizationAction) => void;
|
|
932
|
+
/** Emits the WalletConnect pairing URI so UI can render a QR/deeplink while connect is pending. */
|
|
933
|
+
onWalletConnectDisplayUri?: (uri: string) => void;
|
|
934
|
+
/**
|
|
935
|
+
* Optional Promise resolved by an external (non-WC) connection that races the
|
|
936
|
+
* WalletConnect pairing for `OPEN_PROVIDER`. Currently used by
|
|
937
|
+
* `handleSelectWalletConnectWallet` to race a wagmi `connectAsync` against an
|
|
938
|
+
* EIP-6963 extension matching the picked Reown wallet. When this resolves
|
|
939
|
+
* before WC pairs, the executor invalidates the WC runtime and returns the
|
|
940
|
+
* extension's address with `transport: 'wagmi'`, which causes the dispatcher
|
|
941
|
+
* to flip `activeEvmTransportRef` so the rest of the session runs on wagmi.
|
|
942
|
+
*/
|
|
943
|
+
walletConnectExternalConnect?: Promise<WalletConnectExternalConnectResult>;
|
|
767
944
|
}
|
|
768
945
|
interface UseAuthorizationExecutorResult {
|
|
769
946
|
executing: boolean;
|
|
@@ -786,6 +963,8 @@ interface UseAuthorizationExecutorResult {
|
|
|
786
963
|
resolveSelectSource: (selection: SourceSelection) => void;
|
|
787
964
|
/** Reject paused SELECT_SOURCE and reset executor flags (e.g. user backed to deposit). */
|
|
788
965
|
cancelPendingExecution: () => void;
|
|
966
|
+
/** Clear the persisted WalletConnect session so the next connection re-pairs. */
|
|
967
|
+
resetWalletConnect: (runtimeKey?: string) => Promise<void>;
|
|
789
968
|
/** Transaction hash of the batched wallet_sendCalls, available after a successful batch. */
|
|
790
969
|
batchTxHash: string | null;
|
|
791
970
|
/**
|
|
@@ -803,6 +982,8 @@ interface UseAuthorizationExecutorResult {
|
|
|
803
982
|
*/
|
|
804
983
|
executeBatch: (actions: BatchedActionExecutionInput[], options?: {
|
|
805
984
|
paymasterUrl?: string;
|
|
985
|
+
walletConnectRuntimeKey?: string;
|
|
986
|
+
onWalletConnectDisplayUri?: (uri: string) => void;
|
|
806
987
|
}) => Promise<BatchedWalletCallsResult>;
|
|
807
988
|
/**
|
|
808
989
|
* SVM first-transfer combined path: signs the leading APPROVE_SPL +
|
|
@@ -842,6 +1023,14 @@ interface UseAuthorizationExecutorResult {
|
|
|
842
1023
|
addResult: (result: ActionExecutionResult) => void;
|
|
843
1024
|
/** Set the error message. */
|
|
844
1025
|
setError: (error: string | null) => void;
|
|
1026
|
+
/**
|
|
1027
|
+
* Toggle the soft-halt path for `OPEN_PROVIDER` no-connector / user-rejection
|
|
1028
|
+
* outcomes. When `true`, those failure modes return a `pending` sentinel
|
|
1029
|
+
* instead of an error so a parallel cross-device authorization (desktop
|
|
1030
|
+
* QR scan → auth-app) can drive completion. `BlinkPayment` mirrors
|
|
1031
|
+
* `state.desktopWait != null` into this flag.
|
|
1032
|
+
*/
|
|
1033
|
+
setExternalAuthorizationAvailable: (available: boolean) => void;
|
|
845
1034
|
/**
|
|
846
1035
|
* Convenience wrapper: fetches a single session's actions, executes them,
|
|
847
1036
|
* and reports completions. Suitable for simple single-session flows.
|
|
@@ -880,6 +1069,19 @@ type OrchestratorResult = {
|
|
|
880
1069
|
status: 'completed';
|
|
881
1070
|
} | {
|
|
882
1071
|
status: 'cancelled';
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Returned when an action returned a soft `pending` sentinel (currently
|
|
1075
|
+
* only `OPEN_PROVIDER` on desktop when `state.desktopWait` is active and
|
|
1076
|
+
* either no matching wallet extension is installed or the user dismissed
|
|
1077
|
+
* the connect prompt). The wagmi inline loop has stopped without
|
|
1078
|
+
* surfacing an error; an external path (cross-device QR / auth-app /
|
|
1079
|
+
* session polling) is expected to drive completion. Callers should leave
|
|
1080
|
+
* `state.desktopWait` pinned and not restore selection.
|
|
1081
|
+
*/
|
|
1082
|
+
| {
|
|
1083
|
+
status: 'awaiting-external';
|
|
1084
|
+
reason: string;
|
|
883
1085
|
};
|
|
884
1086
|
interface OrchestratorRunOptions {
|
|
885
1087
|
/**
|
|
@@ -941,6 +1143,21 @@ interface OrchestratorRunOptions {
|
|
|
941
1143
|
* surface for SDK consumers that drive their own UI.
|
|
942
1144
|
*/
|
|
943
1145
|
onApproveSplConfirming?: (action: AuthorizationAction) => void;
|
|
1146
|
+
/** Emits the direct WalletConnect pairing URI while OPEN_PROVIDER is connecting. */
|
|
1147
|
+
onWalletConnectDisplayUri?: (uri: string) => void;
|
|
1148
|
+
/**
|
|
1149
|
+
* Optional Promise that races the WalletConnect pairing for OPEN_PROVIDER.
|
|
1150
|
+
* Used by `handleSelectWalletConnectWallet` when the picked Reown wallet is
|
|
1151
|
+
* also installed as an EIP-6963 extension: the SDK kicks off a wagmi
|
|
1152
|
+
* `connectAsync` against the extension in parallel with the WC orchestrator
|
|
1153
|
+
* run. Whichever resolves first wins; if the extension wins, the executor
|
|
1154
|
+
* invalidates the WC runtime and the rest of the session executes via the
|
|
1155
|
+
* wagmi branch.
|
|
1156
|
+
*/
|
|
1157
|
+
walletConnectExternalConnect?: Promise<{
|
|
1158
|
+
accounts: readonly string[];
|
|
1159
|
+
chainId: number;
|
|
1160
|
+
}>;
|
|
944
1161
|
}
|
|
945
1162
|
interface UseAuthorizationOrchestratorResult {
|
|
946
1163
|
/**
|
|
@@ -983,6 +1200,8 @@ interface UseAuthorizationOrchestratorResult {
|
|
|
983
1200
|
resolveOneTapPause: () => void;
|
|
984
1201
|
/** The awaiting-limit action currently waiting on one-tap setup. */
|
|
985
1202
|
pendingOneTapAction: AuthorizationAction | null;
|
|
1203
|
+
/** True after the most recent run drained all authorization actions. */
|
|
1204
|
+
orchestratorCompleted: boolean;
|
|
986
1205
|
/** Cancel any paused setup flow and reject the current orchestrator run. */
|
|
987
1206
|
cancelPendingFlow: () => void;
|
|
988
1207
|
}
|
|
@@ -992,6 +1211,26 @@ interface UseAuthorizationOrchestratorDeps {
|
|
|
992
1211
|
}
|
|
993
1212
|
declare function useAuthorizationOrchestrator(deps: UseAuthorizationOrchestratorDeps): UseAuthorizationOrchestratorResult;
|
|
994
1213
|
|
|
1214
|
+
interface ReownWallet {
|
|
1215
|
+
id: string;
|
|
1216
|
+
name: string;
|
|
1217
|
+
imageUrl?: string;
|
|
1218
|
+
mobile?: ReownWalletLinks;
|
|
1219
|
+
desktop?: ReownWalletLinks;
|
|
1220
|
+
rdns?: string;
|
|
1221
|
+
injected?: ReownInjectedWallet[];
|
|
1222
|
+
chains?: string[];
|
|
1223
|
+
sdks?: string[];
|
|
1224
|
+
}
|
|
1225
|
+
interface ReownWalletLinks {
|
|
1226
|
+
native?: string;
|
|
1227
|
+
universal?: string;
|
|
1228
|
+
}
|
|
1229
|
+
interface ReownInjectedWallet {
|
|
1230
|
+
namespace?: string;
|
|
1231
|
+
injectedId: string;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
995
1234
|
interface PreparedSession {
|
|
996
1235
|
uri: string;
|
|
997
1236
|
transferId?: string;
|
|
@@ -1057,6 +1296,24 @@ interface PaymentState {
|
|
|
1057
1296
|
* (after setup Approve / token reauth). Cleared when the executor idles.
|
|
1058
1297
|
*/
|
|
1059
1298
|
standardDesktopInlineOpenWallet: boolean;
|
|
1299
|
+
/**
|
|
1300
|
+
* Desktop standard flow: per-provider session URI and walletDeeplinks captured when the
|
|
1301
|
+
* inline executor is dispatched. Drives the QR fallback on `OpenWalletScreen` so a
|
|
1302
|
+
* desktop user with the wallet on their phone can complete via auth-app instead.
|
|
1303
|
+
* Cleared when `standardDesktopInlineOpenWallet` is unpinned.
|
|
1304
|
+
*
|
|
1305
|
+
* `sessionId` is captured separately from `sessionUri` so the desktop polling
|
|
1306
|
+
* effect can call `fetchAuthorizationSession(sessionId)` directly without
|
|
1307
|
+
* having to parse the URI.
|
|
1308
|
+
*/
|
|
1309
|
+
desktopWait: {
|
|
1310
|
+
sessionId: string;
|
|
1311
|
+
sessionUri: string;
|
|
1312
|
+
walletDeeplinks: WalletDeeplink[] | null;
|
|
1313
|
+
providerId: string | null;
|
|
1314
|
+
walletName?: string;
|
|
1315
|
+
walletLogoUrl?: string;
|
|
1316
|
+
} | null;
|
|
1060
1317
|
/**
|
|
1061
1318
|
* Mobile flow: pin OpenWalletScreen (in loading mode) while
|
|
1062
1319
|
* `createAccountAuthorizationSession` is in flight, i.e. between the
|
|
@@ -1102,10 +1359,19 @@ interface PaymentState {
|
|
|
1102
1359
|
amountTooLow: {
|
|
1103
1360
|
minAmountUsd: number;
|
|
1104
1361
|
} | null;
|
|
1362
|
+
/**
|
|
1363
|
+
* When true, route unauthenticated users to `DepositOptionsScreen` (the new
|
|
1364
|
+
* full-widget entry point) before login. Mirrored from `BlinkConfig` and
|
|
1365
|
+
* preserved across `LOGOUT` so post-logout users still land on the
|
|
1366
|
+
* options screen.
|
|
1367
|
+
*/
|
|
1368
|
+
enableFullWidget: boolean;
|
|
1105
1369
|
}
|
|
1106
1370
|
interface InitialStateConfig {
|
|
1107
1371
|
depositAmount: number | null;
|
|
1108
1372
|
activeCredentialId: string | null;
|
|
1373
|
+
initialPhase?: PaymentPhase;
|
|
1374
|
+
enableFullWidget?: boolean;
|
|
1109
1375
|
}
|
|
1110
1376
|
declare function createInitialState(config: InitialStateConfig): PaymentState;
|
|
1111
1377
|
|
|
@@ -1114,6 +1380,7 @@ interface StepHandlers {
|
|
|
1114
1380
|
onSignupWithPasskey: () => void;
|
|
1115
1381
|
onPrepareProvider: (providerId: string) => Promise<PreparedSession | null>;
|
|
1116
1382
|
onSelectProvider: (providerId: string, preparedSession?: PreparedSession) => Promise<void>;
|
|
1383
|
+
onSelectWalletConnectWallet?: (wallet: ReownWallet) => Promise<void>;
|
|
1117
1384
|
onContinueConnection: (accountId: string) => void;
|
|
1118
1385
|
onSelectAccount: (accountId: string) => void;
|
|
1119
1386
|
onPay: (amount: number, overrides?: {
|
|
@@ -1162,6 +1429,15 @@ interface StepRendererFlowProps {
|
|
|
1162
1429
|
onDismiss?: () => void;
|
|
1163
1430
|
depositAmount: number | null;
|
|
1164
1431
|
minTransferAmountUsd: number;
|
|
1432
|
+
/** Needed to render ManualTransferFlow when phase is manual-transfer. */
|
|
1433
|
+
destination: Destination;
|
|
1434
|
+
merchantAuthorization?: CreateManualTransferParams['merchantAuthorization'];
|
|
1435
|
+
idempotencyKey?: string;
|
|
1436
|
+
mock?: boolean;
|
|
1437
|
+
/** Host-level completion callback, forwarded to ManualTransferFlow. */
|
|
1438
|
+
onComplete?: (transfer: Transfer) => void;
|
|
1439
|
+
/** Host-level error callback, forwarded to ManualTransferFlow. */
|
|
1440
|
+
onError?: (error: string) => void;
|
|
1165
1441
|
}
|
|
1166
1442
|
/** Polling, signing, and auth-executor surface. */
|
|
1167
1443
|
interface StepRendererRemoteProps {
|
|
@@ -1173,6 +1449,8 @@ interface StepRendererRemoteProps {
|
|
|
1173
1449
|
authExecutorCurrentAction?: AuthorizationAction | null;
|
|
1174
1450
|
/** SIGN_PERMIT2 action paused for one-tap setup; null until the limit screen is actionable. */
|
|
1175
1451
|
pendingOneTapSetup?: AuthorizationAction | null;
|
|
1452
|
+
/** True when all setup authorization actions for the active account/session are complete. */
|
|
1453
|
+
setupAuthorizationComplete?: boolean;
|
|
1176
1454
|
transferSigningSigning: boolean;
|
|
1177
1455
|
transferSigningError: string | null;
|
|
1178
1456
|
transferSigningPasskeyDismissed?: boolean;
|
|
@@ -1562,11 +1840,12 @@ interface WalletPickerScreenProps {
|
|
|
1562
1840
|
directLinkCards?: boolean;
|
|
1563
1841
|
onPrepareProvider: (providerId: string) => Promise<PreparedSession | null>;
|
|
1564
1842
|
onSelectProvider: (providerId: string, preparedSession?: PreparedSession) => Promise<void>;
|
|
1843
|
+
onSelectWalletConnectWallet?: (wallet: ReownWallet) => Promise<void>;
|
|
1565
1844
|
onBack?: () => void;
|
|
1566
1845
|
onLogout?: () => void;
|
|
1567
1846
|
isDesktop?: boolean;
|
|
1568
1847
|
}
|
|
1569
|
-
declare function WalletPickerScreen({ providers, loading, useDeeplink, error, preparedSessionsByProvider, preparingLinks, directLinkCards, onPrepareProvider, onSelectProvider, onBack, onLogout, isDesktop, }: WalletPickerScreenProps): react_jsx_runtime.JSX.Element;
|
|
1848
|
+
declare function WalletPickerScreen({ providers, loading, useDeeplink, error, preparedSessionsByProvider, preparingLinks, directLinkCards, onPrepareProvider, onSelectProvider, onSelectWalletConnectWallet, onBack, onLogout, isDesktop, }: WalletPickerScreenProps): react_jsx_runtime.JSX.Element;
|
|
1570
1849
|
|
|
1571
1850
|
interface SetupScreenProps {
|
|
1572
1851
|
onSetupOneTap: (limit: number) => void;
|
|
@@ -1732,6 +2011,8 @@ interface ChainChoice$1 {
|
|
|
1732
2011
|
tokens: {
|
|
1733
2012
|
tokenSymbol: string;
|
|
1734
2013
|
balance: number;
|
|
2014
|
+
walletName?: string;
|
|
2015
|
+
walletLogoUrl?: string;
|
|
1735
2016
|
}[];
|
|
1736
2017
|
}
|
|
1737
2018
|
interface SelectSourceScreenProps {
|
|
@@ -1756,6 +2037,8 @@ interface DepositSourceAccount {
|
|
|
1756
2037
|
id: string;
|
|
1757
2038
|
/** Provider / account name (e.g. "MetaMask"). Used to look up a logo via KNOWN_LOGOS. */
|
|
1758
2039
|
name: string;
|
|
2040
|
+
/** Optional account display logo, e.g. the selected Reown wallet icon. */
|
|
2041
|
+
logoURI?: string;
|
|
1759
2042
|
/** Full wallet address; a shortened suffix "...abcd" is shown on the right. */
|
|
1760
2043
|
address?: string | null;
|
|
1761
2044
|
}
|
|
@@ -1837,7 +2120,7 @@ type TransferPhase = 'creating' | 'signing' | 'submitting' | 'sent';
|
|
|
1837
2120
|
interface TransferStatusBaseProps {
|
|
1838
2121
|
phase: TransferPhase;
|
|
1839
2122
|
error: string | null;
|
|
1840
|
-
onLogout
|
|
2123
|
+
onLogout?: () => void;
|
|
1841
2124
|
/**
|
|
1842
2125
|
* Optional retry hook. Setup flows wire this to `orchestrator.restart()`;
|
|
1843
2126
|
* deposit flows wire it only after the first passkey signing attempt fails.
|
|
@@ -1851,8 +2134,9 @@ interface TransferStatusBaseProps {
|
|
|
1851
2134
|
interface SetupTransferStatusScreenProps extends TransferStatusBaseProps {
|
|
1852
2135
|
depositAmount: number;
|
|
1853
2136
|
tokenSymbol: string;
|
|
2137
|
+
authorizationComplete?: boolean;
|
|
1854
2138
|
}
|
|
1855
|
-
declare function SetupTransferStatusScreen({ phase, depositAmount, tokenSymbol, error, onLogout, onRetry, }: SetupTransferStatusScreenProps): react_jsx_runtime.JSX.Element;
|
|
2139
|
+
declare function SetupTransferStatusScreen({ phase, depositAmount, tokenSymbol, authorizationComplete, error, onLogout, onRetry, }: SetupTransferStatusScreenProps): react_jsx_runtime.JSX.Element;
|
|
1856
2140
|
|
|
1857
2141
|
interface DepositTransferStatusScreenProps extends TransferStatusBaseProps {
|
|
1858
2142
|
visibleError?: string | null;
|
|
@@ -1867,20 +2151,21 @@ interface OpenWalletScreenProps {
|
|
|
1867
2151
|
* When false (desktop), shows inline authorization progress instead. */
|
|
1868
2152
|
useDeeplink?: boolean;
|
|
1869
2153
|
error?: string | null;
|
|
2154
|
+
walletLogoUrl?: string;
|
|
1870
2155
|
onRetryStatus?: () => void;
|
|
1871
2156
|
/** Soft-retry the orchestrator (calls `orchestrator.restart()`). Desktop only —
|
|
1872
2157
|
* shown alongside the error banner when set so the user can recover from a
|
|
1873
2158
|
* dismissed wallet popup without reloading the iframe. */
|
|
1874
2159
|
onRetryAuthorization?: () => void;
|
|
1875
2160
|
onBack?: () => void;
|
|
1876
|
-
onLogout
|
|
2161
|
+
onLogout?: () => void;
|
|
1877
2162
|
}
|
|
1878
2163
|
/**
|
|
1879
2164
|
* Wallet authorization screen. On mobile, provides a user-tappable button
|
|
1880
2165
|
* that triggers the deeplink via window.open. On desktop, shows inline
|
|
1881
2166
|
* authorization progress while wallet extension popups handle the flow.
|
|
1882
2167
|
*/
|
|
1883
|
-
declare function OpenWalletScreen({ walletName, deeplinkUri, loading, useDeeplink, error, onRetryStatus, onRetryAuthorization, onBack, onLogout, }: OpenWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
2168
|
+
declare function OpenWalletScreen({ walletName, deeplinkUri, loading, walletLogoUrl, useDeeplink, error, onRetryStatus, onRetryAuthorization, onBack, onLogout, }: OpenWalletScreenProps): react_jsx_runtime.JSX.Element;
|
|
1884
2169
|
|
|
1885
2170
|
interface ConfirmSignScreenProps {
|
|
1886
2171
|
walletName: string | null;
|