@unifold/connect-react-native 0.1.19 → 0.1.21

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.
@@ -0,0 +1,230 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { Onramp } from '@stripe/stripe-react-native';
4
+
5
+ export declare function setStripeOnrampPublishableKey(key: string): void;
6
+ export declare function setStripeOnrampApiUrl(url: string): void;
7
+ export declare function getStripePublishableKey(): Promise<string>;
8
+ export type OnrampSessionTransactionDetails = {
9
+ destination_amount: string;
10
+ destination_currency: string;
11
+ destination_network: string;
12
+ source_amount: string;
13
+ source_currency: string;
14
+ fees: {
15
+ network_fee_amount: string;
16
+ transaction_fee_amount: string;
17
+ };
18
+ quote_expiration: number;
19
+ wallet_address: string;
20
+ last_error: string | null;
21
+ };
22
+ export type OnrampSession = {
23
+ id: string;
24
+ client_secret: string;
25
+ status: string;
26
+ transaction_details: OnrampSessionTransactionDetails;
27
+ };
28
+ export type CreateSessionParams = {
29
+ cryptoCustomerId: string;
30
+ paymentToken: string;
31
+ sourceAmount: number;
32
+ sourceCurrency: string;
33
+ destinationCurrency: string;
34
+ walletAddress: string;
35
+ destinationNetwork: string;
36
+ };
37
+ export type CustomerVerification = {
38
+ name: "kyc_verified" | "phone_verified" | "id_document_verified" | string;
39
+ status: "verified" | "unverified" | string;
40
+ errors: string[];
41
+ };
42
+ export type OnrampCustomer = {
43
+ id: string;
44
+ provided_fields: string[];
45
+ verifications: CustomerVerification[];
46
+ };
47
+ export type KYCData = {
48
+ firstName: string;
49
+ lastName: string;
50
+ idNumber: string;
51
+ dobMonth: string;
52
+ dobDay: string;
53
+ dobYear: string;
54
+ addressLine1: string;
55
+ addressLine2: string;
56
+ city: string;
57
+ state: string;
58
+ postalCode: string;
59
+ country: string;
60
+ };
61
+ export type KYCWizardScreenProps = {
62
+ initialData?: Partial<KYCData>;
63
+ loading?: boolean;
64
+ onComplete: (data: KYCData) => void;
65
+ onCancel: () => void;
66
+ };
67
+ export declare function KYCWizardScreen({ initialData, loading, onComplete, onCancel, }: KYCWizardScreenProps): import("react/jsx-runtime").JSX.Element;
68
+ export type OnrampStep = "email" | "register" | "kyc" | "identity" | "amount" | "wallet" | "payment_method" | "session_params" | "quote" | "processing" | "success";
69
+ export type OnrampErrorCode = "configuration_error" | "authorization_error" | "registration_error" | "kyc_error" | "identity_error" | "wallet_error" | "payment_error" | "session_error" | "validation_error" | "unknown_error";
70
+ export type OnrampError = {
71
+ code: OnrampErrorCode;
72
+ message: string;
73
+ step: OnrampStep;
74
+ stripeErrorCode?: string;
75
+ };
76
+ export type OnrampTransaction = {
77
+ sessionId: string;
78
+ status: string;
79
+ sourceAmount: string;
80
+ sourceCurrency: string;
81
+ destinationAmount: string;
82
+ destinationCurrency: string;
83
+ destinationNetwork: string;
84
+ walletAddress: string;
85
+ fees: {
86
+ networkFee: string;
87
+ transactionFee: string;
88
+ };
89
+ };
90
+ export type OnrampConfig = {
91
+ merchantDisplayName?: string;
92
+ defaultWalletAddress?: string;
93
+ defaultNetwork?: Onramp.CryptoNetwork;
94
+ defaultSourceAmount?: string;
95
+ defaultSourceCurrency?: string;
96
+ defaultDestinationCurrency?: string;
97
+ onComplete?: (transaction: OnrampTransaction) => void;
98
+ onError?: (error: OnrampError) => void;
99
+ onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
100
+ /** Pre-fill email — skips the email screen and goes to register (phone) */
101
+ email?: string;
102
+ /** Pre-fill phone — combined with email, skips both screens and auto-triggers Link check + register */
103
+ phone?: string;
104
+ /** Same fields as DepositConfig / beginDeposit() — used to auto-resolve wallet */
105
+ publishableKey?: string;
106
+ externalUserId?: string;
107
+ recipientAddress?: string;
108
+ destinationChainType?: "ethereum" | "solana" | "bitcoin";
109
+ destinationChainId?: string;
110
+ destinationTokenAddress?: string;
111
+ /** Flow order: "verify_first" (default) starts with email, "amount_first" starts with amount entry */
112
+ flowOrder?: "verify_first" | "amount_first";
113
+ };
114
+ export declare function useStripeOnramp(config?: OnrampConfig): {
115
+ step: OnrampStep;
116
+ loading: boolean;
117
+ status: string;
118
+ error: OnrampError | null;
119
+ email: string;
120
+ phone: string;
121
+ fullName: string;
122
+ country: string;
123
+ customerId: string;
124
+ accessToken: string;
125
+ session: OnrampSession | null;
126
+ kycData: KYCData;
127
+ walletAddress: string;
128
+ resolvedRecipientAddress: string;
129
+ walletNetwork: Onramp.CryptoNetwork;
130
+ sourceAmount: string;
131
+ sourceCurrency: string;
132
+ destinationCurrency: string;
133
+ applePaySupported: boolean;
134
+ walletReady: boolean;
135
+ walletLoading: boolean;
136
+ setStep: import("react").Dispatch<import("react").SetStateAction<OnrampStep>>;
137
+ setStatus: import("react").Dispatch<import("react").SetStateAction<string>>;
138
+ setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
139
+ setPhone: import("react").Dispatch<import("react").SetStateAction<string>>;
140
+ setFullName: import("react").Dispatch<import("react").SetStateAction<string>>;
141
+ setCountry: import("react").Dispatch<import("react").SetStateAction<string>>;
142
+ setWalletAddress: import("react").Dispatch<import("react").SetStateAction<string>>;
143
+ setWalletNetwork: import("react").Dispatch<import("react").SetStateAction<Onramp.CryptoNetwork>>;
144
+ setSourceAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
145
+ setSourceCurrency: import("react").Dispatch<import("react").SetStateAction<string>>;
146
+ setDestinationCurrency: import("react").Dispatch<import("react").SetStateAction<string>>;
147
+ checkEmail: () => Promise<void>;
148
+ register: () => Promise<void>;
149
+ attachKyc: (data: KYCData) => Promise<void>;
150
+ verifyIdentity: () => Promise<void>;
151
+ registerWallet: () => Promise<void>;
152
+ collectPaymentMethod: (useApplePay?: boolean) => Promise<void>;
153
+ refreshQuote: () => Promise<void>;
154
+ confirmCheckout: () => Promise<void>;
155
+ reset: () => void;
156
+ clearError: () => void;
157
+ amountFirst: boolean;
158
+ };
159
+ export type StripeOnrampHook = ReturnType<typeof useStripeOnramp>;
160
+ export declare function OnrampScreen({ config, onComplete }: {
161
+ config?: OnrampConfig;
162
+ onComplete?: () => void;
163
+ }): import("react/jsx-runtime").JSX.Element | null;
164
+ export type AmountScreenProps = {
165
+ initialAmount?: string;
166
+ currency?: string;
167
+ onConfirm: (amount: string) => void;
168
+ onCancel: () => void;
169
+ };
170
+ export declare function AmountScreen({ initialAmount, currency, onConfirm, onCancel, }: AmountScreenProps): import("react/jsx-runtime").JSX.Element;
171
+ export interface StripeOnrampProps {
172
+ /** Unifold publishable key — pass from useUnifold().publishableKey */
173
+ publishableKey?: string;
174
+ /** User's email — pre-fills the email step */
175
+ email?: string;
176
+ /** User's phone — combined with email, skips both screens */
177
+ phone?: string;
178
+ /** Your app's user ID — used to auto-resolve the deposit wallet */
179
+ externalUserId: string;
180
+ /** Flow order: "verify_first" (default) or "amount_first" */
181
+ flowOrder?: "verify_first" | "amount_first";
182
+ /** Override destination chain type (default: "ethereum") */
183
+ destinationChainType?: "ethereum" | "solana" | "bitcoin";
184
+ /** Override destination chain ID (default: "8453" for Base) */
185
+ destinationChainId?: string;
186
+ /** Override destination token address */
187
+ destinationTokenAddress?: string;
188
+ /** Recipient wallet address — where purchased crypto is sent */
189
+ recipientAddress: string;
190
+ /** Called when the transaction completes successfully */
191
+ onComplete?: (transaction: OnrampTransaction) => void;
192
+ /** Called when an error occurs */
193
+ onError?: (error: OnrampError) => void;
194
+ /** Called when the flow step changes */
195
+ onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
196
+ /** Called when the user closes the flow (via ✕ or Done) */
197
+ onClose?: () => void;
198
+ /** Apple Pay merchant identifier (default: "merchant.io.unifold") */
199
+ merchantIdentifier?: string;
200
+ /** URL scheme for Stripe redirects (default: "unifoldOnramp") */
201
+ urlScheme?: string;
202
+ }
203
+ /**
204
+ * High-level Stripe Onramp component.
205
+ *
206
+ * Handles all the plumbing automatically:
207
+ * - Reads the Unifold publishable key from UnifoldProvider context
208
+ * - Fetches the Stripe publishable key from the Unifold API
209
+ * - Wraps in StripeProvider
210
+ * - Eagerly configures the Stripe Onramp SDK
211
+ * - Renders OnrampScreen with the config
212
+ *
213
+ * Usage:
214
+ * ```tsx
215
+ * <StripeOnramp
216
+ * email={user.email}
217
+ * externalUserId={user.id}
218
+ * onClose={() => navigation.goBack()}
219
+ * />
220
+ * ```
221
+ */
222
+ export declare function StripeOnramp({ publishableKey, email, phone, externalUserId, flowOrder, destinationChainType, destinationChainId, destinationTokenAddress, recipientAddress, onComplete, onError, onStepChange, onClose, merchantIdentifier, urlScheme, }: StripeOnrampProps): import("react/jsx-runtime").JSX.Element;
223
+ /**
224
+ * Render inside StripeOnramp after initStripe() has completed.
225
+ * Eagerly calls configure() so the Onramp SDK is ready by the time
226
+ * useStripeOnramp needs it. Renders nothing.
227
+ */
228
+ export declare function StripeOnrampPreconfigure(): null;
229
+
230
+ export {};
@@ -0,0 +1,230 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ import { Onramp } from '@stripe/stripe-react-native';
4
+
5
+ export declare function setStripeOnrampPublishableKey(key: string): void;
6
+ export declare function setStripeOnrampApiUrl(url: string): void;
7
+ export declare function getStripePublishableKey(): Promise<string>;
8
+ export type OnrampSessionTransactionDetails = {
9
+ destination_amount: string;
10
+ destination_currency: string;
11
+ destination_network: string;
12
+ source_amount: string;
13
+ source_currency: string;
14
+ fees: {
15
+ network_fee_amount: string;
16
+ transaction_fee_amount: string;
17
+ };
18
+ quote_expiration: number;
19
+ wallet_address: string;
20
+ last_error: string | null;
21
+ };
22
+ export type OnrampSession = {
23
+ id: string;
24
+ client_secret: string;
25
+ status: string;
26
+ transaction_details: OnrampSessionTransactionDetails;
27
+ };
28
+ export type CreateSessionParams = {
29
+ cryptoCustomerId: string;
30
+ paymentToken: string;
31
+ sourceAmount: number;
32
+ sourceCurrency: string;
33
+ destinationCurrency: string;
34
+ walletAddress: string;
35
+ destinationNetwork: string;
36
+ };
37
+ export type CustomerVerification = {
38
+ name: "kyc_verified" | "phone_verified" | "id_document_verified" | string;
39
+ status: "verified" | "unverified" | string;
40
+ errors: string[];
41
+ };
42
+ export type OnrampCustomer = {
43
+ id: string;
44
+ provided_fields: string[];
45
+ verifications: CustomerVerification[];
46
+ };
47
+ export type KYCData = {
48
+ firstName: string;
49
+ lastName: string;
50
+ idNumber: string;
51
+ dobMonth: string;
52
+ dobDay: string;
53
+ dobYear: string;
54
+ addressLine1: string;
55
+ addressLine2: string;
56
+ city: string;
57
+ state: string;
58
+ postalCode: string;
59
+ country: string;
60
+ };
61
+ export type KYCWizardScreenProps = {
62
+ initialData?: Partial<KYCData>;
63
+ loading?: boolean;
64
+ onComplete: (data: KYCData) => void;
65
+ onCancel: () => void;
66
+ };
67
+ export declare function KYCWizardScreen({ initialData, loading, onComplete, onCancel, }: KYCWizardScreenProps): import("react/jsx-runtime").JSX.Element;
68
+ export type OnrampStep = "email" | "register" | "kyc" | "identity" | "amount" | "wallet" | "payment_method" | "session_params" | "quote" | "processing" | "success";
69
+ export type OnrampErrorCode = "configuration_error" | "authorization_error" | "registration_error" | "kyc_error" | "identity_error" | "wallet_error" | "payment_error" | "session_error" | "validation_error" | "unknown_error";
70
+ export type OnrampError = {
71
+ code: OnrampErrorCode;
72
+ message: string;
73
+ step: OnrampStep;
74
+ stripeErrorCode?: string;
75
+ };
76
+ export type OnrampTransaction = {
77
+ sessionId: string;
78
+ status: string;
79
+ sourceAmount: string;
80
+ sourceCurrency: string;
81
+ destinationAmount: string;
82
+ destinationCurrency: string;
83
+ destinationNetwork: string;
84
+ walletAddress: string;
85
+ fees: {
86
+ networkFee: string;
87
+ transactionFee: string;
88
+ };
89
+ };
90
+ export type OnrampConfig = {
91
+ merchantDisplayName?: string;
92
+ defaultWalletAddress?: string;
93
+ defaultNetwork?: Onramp.CryptoNetwork;
94
+ defaultSourceAmount?: string;
95
+ defaultSourceCurrency?: string;
96
+ defaultDestinationCurrency?: string;
97
+ onComplete?: (transaction: OnrampTransaction) => void;
98
+ onError?: (error: OnrampError) => void;
99
+ onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
100
+ /** Pre-fill email — skips the email screen and goes to register (phone) */
101
+ email?: string;
102
+ /** Pre-fill phone — combined with email, skips both screens and auto-triggers Link check + register */
103
+ phone?: string;
104
+ /** Same fields as DepositConfig / beginDeposit() — used to auto-resolve wallet */
105
+ publishableKey?: string;
106
+ externalUserId?: string;
107
+ recipientAddress?: string;
108
+ destinationChainType?: "ethereum" | "solana" | "bitcoin";
109
+ destinationChainId?: string;
110
+ destinationTokenAddress?: string;
111
+ /** Flow order: "verify_first" (default) starts with email, "amount_first" starts with amount entry */
112
+ flowOrder?: "verify_first" | "amount_first";
113
+ };
114
+ export declare function useStripeOnramp(config?: OnrampConfig): {
115
+ step: OnrampStep;
116
+ loading: boolean;
117
+ status: string;
118
+ error: OnrampError | null;
119
+ email: string;
120
+ phone: string;
121
+ fullName: string;
122
+ country: string;
123
+ customerId: string;
124
+ accessToken: string;
125
+ session: OnrampSession | null;
126
+ kycData: KYCData;
127
+ walletAddress: string;
128
+ resolvedRecipientAddress: string;
129
+ walletNetwork: Onramp.CryptoNetwork;
130
+ sourceAmount: string;
131
+ sourceCurrency: string;
132
+ destinationCurrency: string;
133
+ applePaySupported: boolean;
134
+ walletReady: boolean;
135
+ walletLoading: boolean;
136
+ setStep: import("react").Dispatch<import("react").SetStateAction<OnrampStep>>;
137
+ setStatus: import("react").Dispatch<import("react").SetStateAction<string>>;
138
+ setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
139
+ setPhone: import("react").Dispatch<import("react").SetStateAction<string>>;
140
+ setFullName: import("react").Dispatch<import("react").SetStateAction<string>>;
141
+ setCountry: import("react").Dispatch<import("react").SetStateAction<string>>;
142
+ setWalletAddress: import("react").Dispatch<import("react").SetStateAction<string>>;
143
+ setWalletNetwork: import("react").Dispatch<import("react").SetStateAction<Onramp.CryptoNetwork>>;
144
+ setSourceAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
145
+ setSourceCurrency: import("react").Dispatch<import("react").SetStateAction<string>>;
146
+ setDestinationCurrency: import("react").Dispatch<import("react").SetStateAction<string>>;
147
+ checkEmail: () => Promise<void>;
148
+ register: () => Promise<void>;
149
+ attachKyc: (data: KYCData) => Promise<void>;
150
+ verifyIdentity: () => Promise<void>;
151
+ registerWallet: () => Promise<void>;
152
+ collectPaymentMethod: (useApplePay?: boolean) => Promise<void>;
153
+ refreshQuote: () => Promise<void>;
154
+ confirmCheckout: () => Promise<void>;
155
+ reset: () => void;
156
+ clearError: () => void;
157
+ amountFirst: boolean;
158
+ };
159
+ export type StripeOnrampHook = ReturnType<typeof useStripeOnramp>;
160
+ export declare function OnrampScreen({ config, onComplete }: {
161
+ config?: OnrampConfig;
162
+ onComplete?: () => void;
163
+ }): import("react/jsx-runtime").JSX.Element | null;
164
+ export type AmountScreenProps = {
165
+ initialAmount?: string;
166
+ currency?: string;
167
+ onConfirm: (amount: string) => void;
168
+ onCancel: () => void;
169
+ };
170
+ export declare function AmountScreen({ initialAmount, currency, onConfirm, onCancel, }: AmountScreenProps): import("react/jsx-runtime").JSX.Element;
171
+ export interface StripeOnrampProps {
172
+ /** Unifold publishable key — pass from useUnifold().publishableKey */
173
+ publishableKey?: string;
174
+ /** User's email — pre-fills the email step */
175
+ email?: string;
176
+ /** User's phone — combined with email, skips both screens */
177
+ phone?: string;
178
+ /** Your app's user ID — used to auto-resolve the deposit wallet */
179
+ externalUserId: string;
180
+ /** Flow order: "verify_first" (default) or "amount_first" */
181
+ flowOrder?: "verify_first" | "amount_first";
182
+ /** Override destination chain type (default: "ethereum") */
183
+ destinationChainType?: "ethereum" | "solana" | "bitcoin";
184
+ /** Override destination chain ID (default: "8453" for Base) */
185
+ destinationChainId?: string;
186
+ /** Override destination token address */
187
+ destinationTokenAddress?: string;
188
+ /** Recipient wallet address — where purchased crypto is sent */
189
+ recipientAddress: string;
190
+ /** Called when the transaction completes successfully */
191
+ onComplete?: (transaction: OnrampTransaction) => void;
192
+ /** Called when an error occurs */
193
+ onError?: (error: OnrampError) => void;
194
+ /** Called when the flow step changes */
195
+ onStepChange?: (step: OnrampStep, previousStep: OnrampStep) => void;
196
+ /** Called when the user closes the flow (via ✕ or Done) */
197
+ onClose?: () => void;
198
+ /** Apple Pay merchant identifier (default: "merchant.io.unifold") */
199
+ merchantIdentifier?: string;
200
+ /** URL scheme for Stripe redirects (default: "unifoldOnramp") */
201
+ urlScheme?: string;
202
+ }
203
+ /**
204
+ * High-level Stripe Onramp component.
205
+ *
206
+ * Handles all the plumbing automatically:
207
+ * - Reads the Unifold publishable key from UnifoldProvider context
208
+ * - Fetches the Stripe publishable key from the Unifold API
209
+ * - Wraps in StripeProvider
210
+ * - Eagerly configures the Stripe Onramp SDK
211
+ * - Renders OnrampScreen with the config
212
+ *
213
+ * Usage:
214
+ * ```tsx
215
+ * <StripeOnramp
216
+ * email={user.email}
217
+ * externalUserId={user.id}
218
+ * onClose={() => navigation.goBack()}
219
+ * />
220
+ * ```
221
+ */
222
+ export declare function StripeOnramp({ publishableKey, email, phone, externalUserId, flowOrder, destinationChainType, destinationChainId, destinationTokenAddress, recipientAddress, onComplete, onError, onStepChange, onClose, merchantIdentifier, urlScheme, }: StripeOnrampProps): import("react/jsx-runtime").JSX.Element;
223
+ /**
224
+ * Render inside StripeOnramp after initStripe() has completed.
225
+ * Eagerly calls configure() so the Onramp SDK is ready by the time
226
+ * useStripeOnramp needs it. Renders nothing.
227
+ */
228
+ export declare function StripeOnrampPreconfigure(): null;
229
+
230
+ export {};