@crossmint/client-sdk-react-native-ui 1.0.0-beta.5 → 1.0.0-beta.7
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/README.md +104 -163
- package/app.plugin.js +1 -1
- package/dist/chunk-2RDEJU3T.js +2 -0
- package/dist/chunk-2U67EBAU.js +1 -0
- package/dist/{chunk-VACQTZRT.js → chunk-2UY6GCV3.js} +1 -1
- package/dist/{chunk-LLHUAEZP.mjs → chunk-335OOXYN.mjs} +1 -1
- package/dist/chunk-3G67LZY4.js +2 -0
- package/dist/{chunk-X64DPUQJ.js → chunk-4MOBXEX6.js} +1 -1
- package/dist/chunk-4P5ABAFD.mjs +1 -0
- package/dist/{chunk-YVITECJT.js → chunk-6YOO7OTV.js} +1 -1
- package/dist/chunk-7JGGPJBX.mjs +1 -0
- package/dist/chunk-7JOOUJJ2.js +38 -0
- package/dist/{chunk-ZCKUSOGC.mjs → chunk-AHAHB7QD.mjs} +1 -1
- package/dist/chunk-AX72ILV2.js +1 -0
- package/dist/chunk-BOG3QIA2.js +1 -0
- package/dist/chunk-C7S2X5RD.mjs +1 -0
- package/dist/{chunk-QVLCNPNG.mjs → chunk-DYBYU4QW.mjs} +1 -1
- package/dist/chunk-IJN37RF2.js +1 -0
- package/dist/chunk-J62V5BQX.mjs +1 -0
- package/dist/{chunk-F5O5W34O.mjs → chunk-K6ZOIECD.mjs} +1 -1
- package/dist/chunk-LHEOII54.js +1 -0
- package/dist/{chunk-D5QADN6Z.mjs → chunk-NG4FYS2Z.mjs} +1 -1
- package/dist/{chunk-3MXWZO3W.mjs → chunk-NNGGH73Y.mjs} +1 -1
- package/dist/{chunk-F7VXWATP.js → chunk-NVBPI6JQ.js} +1 -1
- package/dist/chunk-QE2FX5MA.mjs +1 -0
- package/dist/{chunk-4HT7GY6N.js → chunk-QHJA7VYD.js} +1 -1
- package/dist/chunk-QHTHMZZV.mjs +1 -0
- package/dist/{chunk-HQFWYQ4L.js → chunk-QODMJ5UY.js} +1 -1
- package/dist/chunk-R4AKS6SV.js +1 -0
- package/dist/chunk-R4DCEEUP.mjs +38 -0
- package/dist/chunk-RIKAIN6N.js +1 -0
- package/dist/chunk-RWTMQGU7.js +1 -0
- package/dist/chunk-SAPISWWH.mjs +1 -0
- package/dist/{chunk-RFFLL7AO.js → chunk-SQMKAGYM.js} +1 -1
- package/dist/chunk-ST55IDAQ.mjs +1 -0
- package/dist/{chunk-6BGT7YJW.js → chunk-STDFVESG.js} +1 -1
- package/dist/chunk-TQIJ7OZD.js +1 -0
- package/dist/chunk-TSRZEXRU.mjs +1 -0
- package/dist/chunk-TVASK7FQ.js +1 -0
- package/dist/{chunk-SHTETN4C.js → chunk-U3CLRKGH.js} +1 -1
- package/dist/{chunk-RO3XNRC3.mjs → chunk-VNL4MD2H.mjs} +1 -1
- package/dist/chunk-W4PUVHWF.mjs +2 -0
- package/dist/{chunk-YLJDAK2S.mjs → chunk-WDMEQNBX.mjs} +1 -1
- package/dist/{chunk-4PMKF2DM.mjs → chunk-WGBLUFWU.mjs} +1 -1
- package/dist/{chunk-DC5HCBPK.js → chunk-WH3PVAVN.js} +1 -1
- package/dist/chunk-X7EQP7ZO.mjs +1 -0
- package/dist/chunk-XZ5LQIRB.mjs +1 -0
- package/dist/chunk-YJIX6E2P.mjs +0 -0
- package/dist/chunk-YMCYXFCG.mjs +2 -0
- package/dist/{chunk-OGYBEE5A.js → chunk-Z36IMAC2.js} +1 -1
- package/dist/{chunk-FX23A4BR.mjs → chunk-ZP2QWJOD.mjs} +1 -1
- package/dist/chunk-ZQ2BJNI7.js +1 -0
- package/dist/components/embed/index.js +1 -1
- package/dist/components/embed/index.mjs +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.js +1 -1
- package/dist/components/embed/v3/CrossmintEmbeddedCheckoutV3.mjs +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.js +1 -1
- package/dist/components/embed/v3/EmbeddedCheckoutV3WebView.mjs +1 -1
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.js +1 -1
- package/dist/components/embed/v3/crypto/PayerConnectionHandler.mjs +1 -1
- package/dist/components/embed/v3/index.js +1 -1
- package/dist/components/embed/v3/index.mjs +1 -1
- package/dist/components/icons/MailCheckIcon.d.mts +6 -0
- package/dist/components/icons/MailCheckIcon.d.ts +6 -0
- package/dist/components/icons/MailCheckIcon.js +1 -0
- package/dist/components/icons/MailCheckIcon.mjs +1 -0
- package/dist/components/icons/MailIcon.d.mts +6 -0
- package/dist/components/icons/MailIcon.d.ts +6 -0
- package/dist/components/icons/MailIcon.js +1 -0
- package/dist/components/icons/MailIcon.mjs +1 -0
- package/dist/components/icons/PhoneIcon.d.mts +6 -0
- package/dist/components/icons/PhoneIcon.d.ts +6 -0
- package/dist/components/icons/PhoneIcon.js +1 -0
- package/dist/components/icons/PhoneIcon.mjs +1 -0
- package/dist/components/icons/PngIcon.d.mts +10 -0
- package/dist/components/icons/PngIcon.d.ts +10 -0
- package/dist/components/icons/PngIcon.js +1 -0
- package/dist/components/icons/PngIcon.mjs +1 -0
- package/dist/components/icons/SmartphoneIcon.d.mts +6 -0
- package/dist/components/icons/SmartphoneIcon.d.ts +6 -0
- package/dist/components/icons/SmartphoneIcon.js +1 -0
- package/dist/components/icons/SmartphoneIcon.mjs +1 -0
- package/dist/components/icons/XIcon.d.mts +6 -0
- package/dist/components/icons/XIcon.d.ts +6 -0
- package/dist/components/icons/XIcon.js +1 -0
- package/dist/components/icons/XIcon.mjs +1 -0
- package/dist/components/icons/index.d.mts +7 -0
- package/dist/components/icons/index.d.ts +7 -0
- package/dist/components/icons/index.js +1 -0
- package/dist/components/icons/index.mjs +1 -0
- package/dist/components/icons/types.d.mts +7 -0
- package/dist/components/icons/types.d.ts +7 -0
- package/dist/components/icons/types.js +1 -0
- package/dist/components/icons/types.mjs +0 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/components/signers/BaseCodeInput.js +1 -1
- package/dist/components/signers/BaseCodeInput.mjs +1 -1
- package/dist/components/signers/BaseConfirmation.js +1 -1
- package/dist/components/signers/BaseConfirmation.mjs +1 -1
- package/dist/components/signers/EmailSignersDialog.js +1 -1
- package/dist/components/signers/EmailSignersDialog.mjs +1 -1
- package/dist/components/signers/PhoneSignersDialog.js +1 -1
- package/dist/components/signers/PhoneSignersDialog.mjs +1 -1
- package/dist/components/signers/index.js +1 -1
- package/dist/components/signers/index.mjs +1 -1
- package/dist/components/wallets/ExportPrivateKeyButton.js +1 -1
- package/dist/components/wallets/ExportPrivateKeyButton.mjs +1 -1
- package/dist/components/wallets/index.js +1 -1
- package/dist/components/wallets/index.mjs +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/hooks/useAuth.js +1 -1
- package/dist/hooks/useAuth.mjs +1 -1
- package/dist/hooks/useCrossmintCheckout.js +1 -1
- package/dist/hooks/useCrossmintCheckout.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/logger/init.js +1 -1
- package/dist/logger/init.mjs +1 -1
- package/dist/plugin/mods/addQueryToAndroidManifest.js +1 -1
- package/dist/plugin/mods/addQueryToAndroidManifest.mjs +1 -1
- package/dist/plugin/withCrossmintUI.d.mts +6 -0
- package/dist/plugin/withCrossmintUI.d.ts +6 -0
- package/dist/plugin/withCrossmintUI.js +1 -0
- package/dist/plugin/withCrossmintUI.mjs +1 -0
- package/dist/plugin/withDeviceSigner.d.mts +5 -0
- package/dist/plugin/withDeviceSigner.d.ts +5 -0
- package/dist/plugin/withDeviceSigner.js +1 -0
- package/dist/plugin/withDeviceSigner.mjs +1 -0
- package/dist/plugin/withGooglePay.d.mts +2 -2
- package/dist/plugin/withGooglePay.d.ts +2 -2
- package/dist/plugin/withGooglePay.js +1 -1
- package/dist/plugin/withGooglePay.mjs +1 -1
- package/dist/providers/CrossmintAuthProvider.js +1 -1
- package/dist/providers/CrossmintAuthProvider.mjs +1 -1
- package/dist/providers/CrossmintProvider.js +1 -1
- package/dist/providers/CrossmintProvider.mjs +1 -1
- package/dist/providers/CrossmintWalletProvider.d.mts +2 -2
- package/dist/providers/CrossmintWalletProvider.d.ts +2 -2
- package/dist/providers/CrossmintWalletProvider.js +1 -1
- package/dist/providers/CrossmintWalletProvider.mjs +1 -1
- package/dist/providers/index.js +1 -1
- package/dist/providers/index.mjs +1 -1
- package/dist/styles/index.js +1 -1
- package/dist/styles/index.mjs +1 -1
- package/dist/styles/theme.js +1 -1
- package/dist/styles/theme.mjs +1 -1
- package/dist/utils/SecureStorage.js +1 -1
- package/dist/utils/SecureStorage.mjs +1 -1
- package/dist/utils/createCrossmintApiClient.js +1 -1
- package/dist/utils/createCrossmintApiClient.mjs +1 -1
- package/dist/utils/embed/userAgent.js +1 -1
- package/dist/utils/embed/userAgent.mjs +1 -1
- package/dist/utils/eventEmitter.js +1 -1
- package/dist/utils/eventEmitter.mjs +1 -1
- package/package.json +5 -7
- package/dist/chunk-3QSVHCEH.mjs +0 -2
- package/dist/chunk-4XMG3KIU.mjs +0 -1
- package/dist/chunk-F4GXM2ZD.js +0 -1
- package/dist/chunk-J42HASCI.js +0 -1
- package/dist/chunk-MVVSGLQL.js +0 -2
- package/dist/chunk-PSSAAY7D.mjs +0 -1
- package/dist/chunk-VGA23PJK.mjs +0 -1
- package/dist/chunk-XNDIT72O.mjs +0 -2
- package/dist/chunk-XSBVXPEK.mjs +0 -1
- package/dist/chunk-YJORUMPB.js +0 -2
- package/dist/chunk-ZM4HMYQX.js +0 -1
package/README.md
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @crossmint/client-sdk-react-native-ui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> Supports Solana, 20+ EVM chains (Polygon, Base, etc.), with secure mobile authentication.
|
|
3
|
+
React Native SDK for integrating [Crossmint Wallets](https://docs.crossmint.com) into your mobile application. Provides providers, hooks, and built-in UI for wallet creation, signing, and OTP verification.
|
|
5
4
|
|
|
6
|
-
##
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Get a **client** API key from the [Crossmint developer console](https://docs.crossmint.com/introduction/platform/api-keys). Ensure your key has the **Wallet API** scopes enabled.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
7
10
|
|
|
8
11
|
```bash
|
|
12
|
+
npm install @crossmint/client-sdk-react-native-ui expo-secure-store expo-web-browser expo-device
|
|
13
|
+
# or
|
|
9
14
|
pnpm add @crossmint/client-sdk-react-native-ui expo-secure-store expo-web-browser expo-device
|
|
10
15
|
```
|
|
11
16
|
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
12
19
|
### 1. Setup Providers
|
|
13
20
|
|
|
14
|
-
**
|
|
21
|
+
**With Crossmint Authentication (Recommended for quickstarts only)**
|
|
15
22
|
|
|
16
23
|
```tsx
|
|
17
24
|
import {
|
|
18
25
|
CrossmintProvider,
|
|
19
26
|
CrossmintAuthProvider,
|
|
20
|
-
CrossmintWalletProvider
|
|
27
|
+
CrossmintWalletProvider,
|
|
21
28
|
} from "@crossmint/client-sdk-react-native-ui";
|
|
22
29
|
|
|
23
30
|
export default function App() {
|
|
@@ -26,10 +33,9 @@ export default function App() {
|
|
|
26
33
|
<CrossmintAuthProvider>
|
|
27
34
|
<CrossmintWalletProvider
|
|
28
35
|
createOnLogin={{
|
|
29
|
-
chain: "
|
|
30
|
-
|
|
36
|
+
chain: "base-sepolia",
|
|
37
|
+
recovery: { type: "email" },
|
|
31
38
|
}}
|
|
32
|
-
headlessSigningFlow={false}
|
|
33
39
|
>
|
|
34
40
|
<MainApp />
|
|
35
41
|
</CrossmintWalletProvider>
|
|
@@ -39,23 +45,28 @@ export default function App() {
|
|
|
39
45
|
}
|
|
40
46
|
```
|
|
41
47
|
|
|
42
|
-
**
|
|
48
|
+
**Bring Your Own Authentication**
|
|
43
49
|
|
|
44
|
-
Already have authentication? Skip
|
|
45
|
-
|
|
46
|
-
📖 **[Complete Custom Auth Guide](https://docs.crossmint.com/wallets/advanced/bring-your-own-auth#react-native)** - Full setup with server-side examples and implementation details.
|
|
50
|
+
Already have authentication? Skip `CrossmintAuthProvider` and use wallets with your existing auth system. See the [Custom Auth Guide](https://docs.crossmint.com/wallets/advanced/bring-your-own-auth#react-native) for full details.
|
|
47
51
|
|
|
48
52
|
```tsx
|
|
49
53
|
import {
|
|
50
54
|
CrossmintProvider,
|
|
51
|
-
CrossmintWalletProvider
|
|
55
|
+
CrossmintWalletProvider,
|
|
52
56
|
} from "@crossmint/client-sdk-react-native-ui";
|
|
53
57
|
|
|
54
58
|
export default function App() {
|
|
55
59
|
return (
|
|
56
60
|
<CrossmintProvider apiKey={process.env.EXPO_PUBLIC_CROSSMINT_API_KEY}>
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
<CrossmintWalletProvider
|
|
62
|
+
createOnLogin={{
|
|
63
|
+
chain: "base-sepolia",
|
|
64
|
+
recovery: {
|
|
65
|
+
type: "email",
|
|
66
|
+
email: "user@example.com",
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
>
|
|
59
70
|
<MainApp />
|
|
60
71
|
</CrossmintWalletProvider>
|
|
61
72
|
</CrossmintProvider>
|
|
@@ -63,169 +74,115 @@ export default function App() {
|
|
|
63
74
|
}
|
|
64
75
|
```
|
|
65
76
|
|
|
66
|
-
### 2. Use
|
|
67
|
-
|
|
68
|
-
The React Native SDK uses [Expo's SecureStore](https://docs.expo.dev/versions/latest/sdk/securestore/) for secure, encrypted storage of authentication tokens. This provides a platform-native secure storage solution that encrypts sensitive data on the device.
|
|
77
|
+
### 2. Use Wallets
|
|
69
78
|
|
|
70
79
|
```tsx
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
80
|
+
import { useWallet } from "@crossmint/client-sdk-react-native-ui";
|
|
81
|
+
import { View, Text, TouchableOpacity } from "react-native";
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
const { loginWithOAuth, logout, user } = useCrossmintAuth();
|
|
83
|
+
function WalletActions() {
|
|
76
84
|
const { wallet, status } = useWallet();
|
|
77
85
|
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
<View style={{ padding: 20 }}>
|
|
81
|
-
<Button
|
|
82
|
-
title="Login with Google"
|
|
83
|
-
onPress={() => loginWithOAuth("google")}
|
|
84
|
-
/>
|
|
85
|
-
</View>
|
|
86
|
-
);
|
|
87
|
-
}
|
|
86
|
+
if (status === "in-progress") return <Text>Loading wallet...</Text>;
|
|
87
|
+
if (!wallet) return <Text>No wallet</Text>;
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<Text>Wallet: {wallet?.address}</Text>
|
|
94
|
-
<Button
|
|
95
|
-
title="Send 1 USDC"
|
|
96
|
-
onPress={() => wallet?.send(recipient, "usdc", "1.0")}
|
|
97
|
-
/>
|
|
98
|
-
<Button title="Logout" onPress={logout} />
|
|
99
|
-
</View>
|
|
100
|
-
);
|
|
101
|
-
}
|
|
89
|
+
const handleSend = async () => {
|
|
90
|
+
const tx = await wallet.send("0xRecipient", "usdc", "10");
|
|
91
|
+
console.log("Transaction:", tx.explorerLink);
|
|
92
|
+
};
|
|
102
93
|
|
|
103
|
-
return
|
|
94
|
+
return (
|
|
95
|
+
<View>
|
|
96
|
+
<Text>Wallet: {wallet.address}</Text>
|
|
97
|
+
<TouchableOpacity onPress={handleSend}>
|
|
98
|
+
<Text>Send 10 USDC</Text>
|
|
99
|
+
</TouchableOpacity>
|
|
100
|
+
</View>
|
|
101
|
+
);
|
|
104
102
|
}
|
|
105
103
|
```
|
|
106
104
|
|
|
107
|
-
##
|
|
108
|
-
|
|
109
|
-
### OAuth Login Methods
|
|
110
|
-
```tsx
|
|
111
|
-
const { loginWithOAuth } = useCrossmintAuth();
|
|
105
|
+
## Providers
|
|
112
106
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
| Provider | Purpose |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `CrossmintProvider` | Root provider. Required for all Crossmint features. |
|
|
110
|
+
| `CrossmintAuthProvider` | Authentication (OAuth). Optional if using your own auth. |
|
|
111
|
+
| `CrossmintWalletProvider` | Wallet creation, device signer management, and OTP UI. |
|
|
117
112
|
|
|
118
|
-
|
|
113
|
+
### `CrossmintWalletProvider` Props
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
-
|
|
115
|
+
| Prop | Type | Default | Description |
|
|
116
|
+
|---|---|---|---|
|
|
117
|
+
| `createOnLogin` | `CreateOnLogin` | — | Auto-create wallet on auth. Uses `recovery` + optional `signers`. |
|
|
118
|
+
| `headlessSigningFlow` | `boolean` | `true` | When `true`, built-in OTP dialogs are suppressed. Handle OTP manually via `useWalletOtpSigner()`. Set to `false` to show built-in dialogs. |
|
|
119
|
+
| `deviceSignerKeyStorage` | `DeviceSignerKeyStorage` | — | Override the default native key storage. |
|
|
120
|
+
| `appearance` | `UIConfig` | — | Styling for built-in UI components. |
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
```tsx
|
|
127
|
-
const { wallet, getOrCreateWallet } = useWallet();
|
|
122
|
+
## Hooks
|
|
128
123
|
|
|
129
|
-
|
|
130
|
-
const address = wallet?.address;
|
|
131
|
-
const balance = await wallet?.balances();
|
|
124
|
+
### `useWallet()`
|
|
132
125
|
|
|
133
|
-
|
|
134
|
-
const tx = await wallet?.send(recipient, "usdc", "10.5");
|
|
135
|
-
console.log("Transaction:", tx.explorerLink);
|
|
126
|
+
Returns the wallet instance and management functions:
|
|
136
127
|
|
|
137
|
-
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
})
|
|
128
|
+
```tsx
|
|
129
|
+
const {
|
|
130
|
+
wallet, // Wallet | undefined
|
|
131
|
+
status, // "not-loaded" | "in-progress" | "loaded" | "error"
|
|
132
|
+
getWallet, // (props: { chain, alias? }) => Promise<Wallet | undefined>
|
|
133
|
+
createWallet, // (props: ClientSideWalletCreateArgs) => Promise<Wallet | undefined>
|
|
134
|
+
createDeviceSigner, // () => Promise<DeviceSignerDescriptor> | undefined
|
|
135
|
+
createPasskeySigner, // (name: string) => Promise<RegisterSignerPasskeyParams>
|
|
136
|
+
} = useWallet();
|
|
142
137
|
```
|
|
143
138
|
|
|
144
|
-
|
|
139
|
+
### `useWalletOtpSigner()`
|
|
145
140
|
|
|
146
|
-
|
|
141
|
+
For custom OTP UI when using email/phone recovery signers. Since `headlessSigningFlow` defaults to `true` in React Native, you'll typically need this hook to handle OTP flows manually:
|
|
147
142
|
|
|
148
143
|
```tsx
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// Implement your custom storage provider
|
|
152
|
-
class CustomStorage implements StorageProvider {
|
|
153
|
-
async get(key: string): Promise<string | undefined> {
|
|
154
|
-
// Your implementation
|
|
155
|
-
}
|
|
144
|
+
const { needsAuth, sendOtp, verifyOtp, reject } = useWalletOtpSigner();
|
|
145
|
+
```
|
|
156
146
|
|
|
157
|
-
|
|
158
|
-
// Your implementation
|
|
159
|
-
}
|
|
147
|
+
### `useCrossmintAuth()`
|
|
160
148
|
|
|
161
|
-
|
|
162
|
-
// Your implementation
|
|
163
|
-
}
|
|
164
|
-
}
|
|
149
|
+
Authentication state and OAuth login:
|
|
165
150
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const customStorage = new CustomStorage();
|
|
151
|
+
```tsx
|
|
152
|
+
const { loginWithOAuth, logout, user } = useCrossmintAuth();
|
|
169
153
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
{/* Your app content */}
|
|
174
|
-
</CrossmintAuthProvider>
|
|
175
|
-
</CrossmintProvider>
|
|
176
|
-
);
|
|
177
|
-
}
|
|
154
|
+
// OAuth providers
|
|
155
|
+
loginWithOAuth("google");
|
|
156
|
+
loginWithOAuth("twitter");
|
|
178
157
|
```
|
|
179
158
|
|
|
180
|
-
##
|
|
159
|
+
## Components
|
|
181
160
|
|
|
182
|
-
|
|
161
|
+
### `ExportPrivateKeyButton`
|
|
183
162
|
|
|
184
|
-
|
|
163
|
+
Renders a button to export the wallet's private key via TEE. Only renders for email/phone signers.
|
|
185
164
|
|
|
186
165
|
```tsx
|
|
187
|
-
import {
|
|
188
|
-
CrossmintProvider,
|
|
189
|
-
CrossmintEmbeddedCheckout
|
|
190
|
-
} from "@crossmint/client-sdk-react-native-ui";
|
|
166
|
+
import { ExportPrivateKeyButton } from "@crossmint/client-sdk-react-native-ui";
|
|
191
167
|
|
|
192
|
-
|
|
193
|
-
return (
|
|
194
|
-
<CrossmintProvider apiKey={process.env.EXPO_PUBLIC_CROSSMINT_API_KEY}>
|
|
195
|
-
<CrossmintEmbeddedCheckout
|
|
196
|
-
recipient={{
|
|
197
|
-
walletAddress: "your_recipient_wallet_address"
|
|
198
|
-
}}
|
|
199
|
-
payment={{
|
|
200
|
-
crypto: { enabled: false },
|
|
201
|
-
fiat: { enabled: true },
|
|
202
|
-
receiptEmail: "customer@example.com" // Required for payment receipts
|
|
203
|
-
}}
|
|
204
|
-
lineItems={{
|
|
205
|
-
tokenLocator: "solana:7EivYFyNfgGj8xbUymR7J4LuxUHLvi7Dgu",
|
|
206
|
-
executionParameters: {
|
|
207
|
-
mode: "exact-in", // USD amount to spend
|
|
208
|
-
amount: "1", // Amount in USD
|
|
209
|
-
maxSlippageBps: "500" // 5% slippage tolerance
|
|
210
|
-
}
|
|
211
|
-
}}
|
|
212
|
-
/>
|
|
213
|
-
</CrossmintProvider>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
168
|
+
<ExportPrivateKeyButton appearance={{ borderRadius: "12px" }} />
|
|
216
169
|
```
|
|
217
170
|
|
|
218
|
-
|
|
171
|
+
## Differences from React SDK
|
|
219
172
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
173
|
+
| Feature | React | React Native |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| Device signer storage | Browser iframe (`IframeDeviceSignerKeyStorage`) | Native secure storage (iOS Secure Enclave / Android Keystore) |
|
|
176
|
+
| Device storage override | Not exposed | `deviceSignerKeyStorage` prop on provider |
|
|
177
|
+
| Built-in OTP UI | Always rendered | `headlessSigningFlow=true` (suppressed by default) |
|
|
178
|
+
| Passkey helper UI | `showPasskeyHelpers` prop | Not available |
|
|
179
|
+
| TEE communication | Hidden iframe | Hidden WebView (lazily initialized) |
|
|
224
180
|
|
|
225
|
-
|
|
181
|
+
## Wallets SDK
|
|
226
182
|
|
|
183
|
+
The `wallet` object returned by `useWallet()` is a [`Wallet`](https://www.npmjs.com/package/@crossmint/wallets-sdk) instance. For wallet method documentation (send, balances, sign, etc.), see the [`@crossmint/wallets-sdk` README](https://www.npmjs.com/package/@crossmint/wallets-sdk).
|
|
227
184
|
|
|
228
|
-
##
|
|
185
|
+
## Environment Setup
|
|
229
186
|
|
|
230
187
|
1. Get your API key from [Crossmint Console](https://staging.crossmint.com/console/projects/apiKeys)
|
|
231
188
|
|
|
@@ -243,29 +200,13 @@ EXPO_PUBLIC_CROSSMINT_API_KEY=your_api_key_here
|
|
|
243
200
|
}
|
|
244
201
|
```
|
|
245
202
|
|
|
246
|
-
##
|
|
247
|
-
|
|
248
|
-
```
|
|
249
|
-
Source JSDoc → TypeDoc → api.json ─┐
|
|
250
|
-
├→ generate-reference.mjs → MDX pages (docs/<product>/)
|
|
251
|
-
examples.json ─┘
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Run with `pnpm generate:docs` or `node scripts/generate-reference.mjs --product wallets`.
|
|
255
|
-
|
|
256
|
-
**Key details for maintainers:**
|
|
257
|
-
|
|
258
|
-
- **`api.json` and `docs/` are gitignored** — they're build artifacts, not checked in.
|
|
259
|
-
- **Adding a new product** only requires a new entry in the `PRODUCTS` config at the top of `generate-reference.mjs`. No other script changes needed.
|
|
260
|
-
- **Exports are auto-classified** by naming convention: `*Provider` → providers page, `use*` → hooks page, everything else → components page.
|
|
261
|
-
- **`examples.json`** holds all code snippets, keyed by export name (e.g. `"CrossmintProvider"`, `"useWallet"`). The script validates that every export has a matching example.
|
|
262
|
-
- **`MANUAL_RETURNS` / `EXPANDABLE_CHILDREN`** are escape hatches for cross-package types that TypeDoc can't resolve (e.g. wallet args, hook return types). If a new hook's return type shows as `unknown`, you likely need to add an entry here.
|
|
263
|
-
- **`skipErrorChecking: true`** in the TypeDoc config is intentional — React packages have peer deps that break type resolution without it.
|
|
264
|
-
|
|
265
|
-
## 📚 Examples & Documentation
|
|
203
|
+
## Documentation
|
|
266
204
|
|
|
267
|
-
-
|
|
205
|
+
- [Crossmint Wallets Docs](https://docs.crossmint.com)
|
|
206
|
+
- [SDK Reference](https://docs.crossmint.com/sdk-reference/wallets/react-native)
|
|
207
|
+
- [Wallets Expo Quickstart](https://github.com/Crossmint/wallets-expo-quickstart)
|
|
208
|
+
- [Custom Auth Guide (React Native)](https://docs.crossmint.com/wallets/advanced/bring-your-own-auth#react-native)
|
|
268
209
|
|
|
269
|
-
|
|
210
|
+
## License
|
|
270
211
|
|
|
271
|
-
|
|
212
|
+
Apache-2.0
|
package/app.plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require("./dist/plugin/
|
|
1
|
+
module.exports = require("./dist/plugin/withCrossmintUI");
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLHEOII54js = require('./chunk-LHEOII54.js');var _chunkR4AKS6SVjs = require('./chunk-R4AKS6SV.js');var _chunkNVBPI6JQjs = require('./chunk-NVBPI6JQ.js');var _chunkWH3PVAVNjs = require('./chunk-WH3PVAVN.js');var _chunk2U67EBAUjs = require('./chunk-2U67EBAU.js');var _chunkEI5LOD4Yjs = require('./chunk-EI5LOD4Y.js');var _reactnative = require('react-native');var _jsxruntime = require('react/jsx-runtime');var{width:V}=_reactnative.Dimensions.get("window");function H({phone:i,open:n,setOpen:v,step:O,onSubmitOTP:x,onResendOTPCode:I,onSubmitPhone:M,rejectRef:r,appearance:o}){var m,u,c,g,y,b;function s(){var h;n&&((h=r.current)==null||h.call(r,new Error("User cancelled")),v(!1))}let l=_reactnative.StyleSheet.create({modalOverlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center",padding:16},modalContainer:{backgroundColor:((m=o==null?void 0:o.colors)==null?void 0:m.background)||_chunkEI5LOD4Yjs.a["cm-background-primary"],borderRadius:(o==null?void 0:o.borderRadius)||12,padding:32,width:Math.min(V-32,400),maxHeight:"80%",position:"relative",alignItems:"center",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5},closeButton:{position:"absolute",top:16,right:16,width:32,height:32,borderRadius:6,backgroundColor:((u=o==null?void 0:o.colors)==null?void 0:u.inputBackground)||_chunkEI5LOD4Yjs.a["cm-muted-primary"],alignItems:"center",justifyContent:"center",zIndex:1}});return n?_jsxruntime.jsx.call(void 0, _reactnative.Modal,{visible:n,transparent:!0,animationType:"fade",onRequestClose:s,statusBarTranslucent:!0,children:_jsxruntime.jsx.call(void 0, _reactnative.View,{style:l.modalOverlay,children:_jsxruntime.jsxs.call(void 0, _reactnative.View,{style:l.modalContainer,children:[_jsxruntime.jsx.call(void 0, _reactnative.TouchableOpacity,{style:l.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:_jsxruntime.jsx.call(void 0, _chunkR4AKS6SVjs.a,{size:16,color:((c=o==null?void 0:o.colors)==null?void 0:c.textSecondary)||_chunkEI5LOD4Yjs.a["cm-text-secondary"]})}),O==="initial"?_jsxruntime.jsx.call(void 0, _chunkWH3PVAVNjs.a,{contactInfo:i!=null?i:"",contactType:"phone",icon:_jsxruntime.jsx.call(void 0, _chunk2U67EBAUjs.a,{size:22,color:((g=o==null?void 0:o.colors)==null?void 0:g.textPrimary)||_chunkEI5LOD4Yjs.a["cm-text-primary"]}),onConfirm:M,onCancel:s,appearance:o}):_jsxruntime.jsx.call(void 0, _chunkNVBPI6JQjs.a,{contactInfo:i!=null?i:"",contactType:"phone",icon:_jsxruntime.jsx.call(void 0, _reactnative.View,{style:{backgroundColor:((y=o==null?void 0:o.colors)==null?void 0:y.accent)||_chunkEI5LOD4Yjs.a["cm-accent"],borderRadius:999,padding:12},children:_jsxruntime.jsx.call(void 0, _chunkLHEOII54js.a,{size:22,color:((b=o==null?void 0:o.colors)==null?void 0:b.background)||_chunkEI5LOD4Yjs.a["cm-background-primary"]})}),title:"Check your phone",description:_jsxruntime.jsxs.call(void 0, _reactnative.Text,{children:["A temporary login code has been sent via SMS to"," ",_jsxruntime.jsx.call(void 0, _reactnative.Text,{style:{fontWeight:"bold"},children:i})]}),helpText:`Can't receive the SMS? Check your phone number.
|
|
2
|
+
Some messages may take several minutes to arrive.`,onSubmitOTP:x,onResendCode:I,appearance:o,otpLength:10,keyboardType:"number-pad",autoComplete:"sms-otp",textContentType:"oneTimeCode"})]})})}):null}exports.a = H;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTVASK7FQjs = require('./chunk-TVASK7FQ.js');var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var r=_chunkIJN37RF2js.e.call(void 0, (P,I)=>{I.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABZ0lEQVR4AbTUC1LDMAwE0MDFgJMBJwNOBn4ZLyNcUuzSdroj67crxWnvtxt/qsBj03pr+CzgvzT/4m8EkCAjUsn4zy3ANrP+jcBDb31t9q6A39yNCLuMCGRCm1SS+MnX3NQ5Au+9+mKi3n9iInCSuFYgAh+dcNxg9HvZvIlAHlEuOwzeLOdctvMSIpCmOnEuGHnOqZu2EbABaIxI/HErNdOIgAaTsnnnCQDBf2+AGBkgBLEqmpj4NOoGmvI2uVyEBCMitrzJKIAghHlUY4xvGHAmfPgHOQqkyeQ2QJBYFUYKhlCnJuB/x38TUFjJqshTS0YcUXM3scM/yCMBJFXEtMjEEcqBs5hckIH2AY4EFCsMgWLPWSw555Fc7gfOCShEQMS0fM+2ComdxV8CaTZtRMSqkJwNQY7PGm6bFdCg0WUSAjFC4I7Adny5/Te1IqAJCEEVMy3Isx6rmqUNNI9AAgiBKEtkr/0CAAD//0s8Y9YAAAAGSURBVAMAIbpVMfA3cdgAAAAASUVORK5CYII="});var _jsxruntime = require('react/jsx-runtime');function s({size:p=22,color:c,strokeWidth:n=2}){return _jsxruntime.jsx.call(void 0, _chunkTVASK7FQjs.a,{source:r(),size:p,color:c})}exports.a = s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var _react = require('react');function m({payer:r,webViewClient:e}){return _react.useEffect.call(void 0, ()=>{if(e==null)return;let t=e.on("crypto:send-transaction",f=>_chunkIJN37RF2js.f.call(void 0, this,[f],function*({chain:s,serializedTransaction:c}){try{yield r.handleChainSwitch(s);let n=yield r.handleSignAndSendTransaction(c);n.success?e.send("crypto:send-transaction:success",{txId:n.txId}):e.send("crypto:send-transaction:failed",{error:n.errorMessage})}catch(n){console.error("[PayerConnectionHandler] Failed to send transaction",n),e.send("crypto:send-transaction:failed",{error:n.message||"An unknown error occurred"})}}));return()=>{e.off(t)}},[e]),null}exports.a = m;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as r}from"./chunk-
|
|
1
|
+
import{a as r}from"./chunk-ST55IDAQ.mjs";import{SdkLogger as C,ReactNativeDatadogSink as R,validateAPIKey as S}from"@crossmint/common-sdk-base";import{AppState as b}from"react-native";import D from"expo-constants";import*as e from"expo-device";function _(n,i){var s,c,f,g,v,m,u,l,p,k,L;let t=S(n);if(!t.isValid)throw new Error(`Invalid API key: ${t.message}`);let{environment:d,projectId:I}=t,a=new C({packageName:r.name,packageVersion:r.version,environment:d,projectId:I,platform:"react-native",consoleLogLevel:i}),N=(m=(v=(c=(s=D.expoConfig)==null?void 0:s.ios)==null?void 0:c.bundleIdentifier)!=null?v:(g=(f=D.expoConfig)==null?void 0:f.android)==null?void 0:g.package)!=null?m:void 0,o={};e!=null&&(o.device=(p=(l=(u=e.modelName)!=null?u:e.deviceName)!=null?l:e.brand)!=null?p:void 0,o.os_version=(k=e.osVersion)!=null?k:void 0,o.os_name=(L=e.osName)!=null?L:void 0);let h=new R(d,N,o);return a.addSink(h),w(a),a}function w(n){b.addEventListener("change",i=>{(i==="background"||i==="inactive")&&typeof n.flush=="function"&&n.flush()})}export{_ as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkR4AKS6SVjs = require('./chunk-R4AKS6SV.js');var _chunkNVBPI6JQjs = require('./chunk-NVBPI6JQ.js');var _chunkWH3PVAVNjs = require('./chunk-WH3PVAVN.js');var _chunkTQIJ7OZDjs = require('./chunk-TQIJ7OZD.js');var _chunkRIKAIN6Njs = require('./chunk-RIKAIN6N.js');var _chunkEI5LOD4Yjs = require('./chunk-EI5LOD4Y.js');var _reactnative = require('react-native');var _jsxruntime = require('react/jsx-runtime');var{width:z}=_reactnative.Dimensions.get("window");function L({email:i,open:n,setOpen:S,step:O,onSubmitOTP:v,onResendOTPCode:P,onSubmitEmail:V,rejectRef:r,appearance:o}){var m,u,c,g,b,h;function s(){var y;n&&((y=r.current)==null||y.call(r,new Error),S(!1))}let d=_reactnative.StyleSheet.create({centeredView:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center",padding:16},modalView:{backgroundColor:((m=o==null?void 0:o.colors)==null?void 0:m.background)||_chunkEI5LOD4Yjs.a["cm-background-primary"],borderRadius:(o==null?void 0:o.borderRadius)||12,padding:32,alignItems:"center",width:Math.min(z-32,400),maxHeight:"80%",position:"relative",shadowColor:"#000",shadowOffset:{width:0,height:2},shadowOpacity:.25,shadowRadius:4,elevation:5},closeButton:{position:"absolute",top:16,right:16,width:32,height:32,borderRadius:6,backgroundColor:((u=o==null?void 0:o.colors)==null?void 0:u.inputBackground)||_chunkEI5LOD4Yjs.a["cm-muted-primary"],alignItems:"center",justifyContent:"center",zIndex:1}});return n?_jsxruntime.jsx.call(void 0, _reactnative.Modal,{visible:n,transparent:!0,animationType:"fade",onRequestClose:s,statusBarTranslucent:!0,children:_jsxruntime.jsx.call(void 0, _reactnative.View,{style:d.centeredView,children:_jsxruntime.jsxs.call(void 0, _reactnative.View,{style:d.modalView,children:[_jsxruntime.jsx.call(void 0, _reactnative.TouchableOpacity,{style:d.closeButton,onPress:s,hitSlop:{top:10,bottom:10,left:10,right:10},children:_jsxruntime.jsx.call(void 0, _chunkR4AKS6SVjs.a,{size:16,color:((c=o==null?void 0:o.colors)==null?void 0:c.textSecondary)||_chunkEI5LOD4Yjs.a["cm-text-secondary"]})}),O==="initial"?_jsxruntime.jsx.call(void 0, _chunkWH3PVAVNjs.a,{contactInfo:i!=null?i:"",contactType:"email",icon:_jsxruntime.jsx.call(void 0, _chunkRIKAIN6Njs.a,{size:22,color:((g=o==null?void 0:o.colors)==null?void 0:g.textPrimary)||_chunkEI5LOD4Yjs.a["cm-text-primary"]}),onConfirm:V,onCancel:s,appearance:o}):_jsxruntime.jsx.call(void 0, _chunkNVBPI6JQjs.a,{contactInfo:i!=null?i:"",contactType:"email",icon:_jsxruntime.jsx.call(void 0, _reactnative.View,{style:{backgroundColor:((b=o==null?void 0:o.colors)==null?void 0:b.accent)||_chunkEI5LOD4Yjs.a["cm-accent"],borderRadius:999,padding:12},children:_jsxruntime.jsx.call(void 0, _chunkTQIJ7OZDjs.a,{size:22,color:((h=o==null?void 0:o.colors)==null?void 0:h.background)||_chunkEI5LOD4Yjs.a["cm-background-primary"]})}),title:"Check your email",description:_jsxruntime.jsxs.call(void 0, _reactnative.Text,{children:["A temporary login code has been sent to"," ",_jsxruntime.jsx.call(void 0, _reactnative.Text,{style:{fontWeight:"bold"},children:i})]}),helpText:`Can't find the email? Check spam folder.
|
|
2
|
+
Some emails may take several minutes to arrive.`,onSubmitOTP:v,onResendCode:P,appearance:o,otpLength:9,keyboardType:"default",autoComplete:"one-time-code",textContentType:"oneTimeCode"})]})})}):null}exports.a = L;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2UY6GCV3js = require('./chunk-2UY6GCV3.js');var _chunkYQEWHOQ7js = require('./chunk-YQEWHOQ7.js');var _chunkSQMKAGYMjs = require('./chunk-SQMKAGYM.js');var _chunk2D2RJCVXjs = require('./chunk-2D2RJCVX.js');var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var _clientsdkreactbase = require('@crossmint/client-sdk-react-base');var _react = require('react');var _reactnative = require('react-native');var _clientsdkbase = require('@crossmint/client-sdk-base');var _clientsdkrnwindow = require('@crossmint/client-sdk-rn-window');var _jsxruntime = require('react/jsx-runtime');function Q(t){var u;let[e,w]=_react.useState.call(void 0, null),[C,v]=_react.useState.call(void 0, 0),E=_react.useRef.call(void 0, (u=t.payment.crypto.payer)==null?void 0:u.initialChain),n=_react.useRef.call(void 0, t);if(U(t,n.current)){let r=_chunkIJN37RF2js.a.call(void 0, {},t),o=F(t,E.current);o.shouldPreserve&&(r.payment.crypto.payer=o.updatedPayer),n.current=r}let{crossmint:i}=_clientsdkreactbase.useCrossmint.call(void 0, ),V=_chunkSQMKAGYMjs.a.call(void 0, i,{usageOrigin:"client"}),P=_clientsdkbase.crossmintEmbeddedCheckoutV3Service.call(void 0, {apiClient:V}),s=_react.useRef.call(void 0, null);_react.useEffect.call(void 0, ()=>{let r=s.current;if(!r||e)return;let o=new (0, _clientsdkrnwindow.WebViewParent)({current:r},{incomingEvents:_clientsdkbase.embeddedCheckoutV3IncomingEvents,outgoingEvents:_clientsdkbase.embeddedCheckoutV3OutgoingEvents});w(o)},[s.current,e]),_react.useEffect.call(void 0, ()=>{if(e==null)return;let r=a=>v(a.height);e.on("ui:height.changed",r);let o=a=>{_chunk2D2RJCVXjs.a.emit("order:updated",a)};return e.on("order:updated",o),()=>{e.off("ui:height.changed"),e.off("order:updated")}},[e]);let k=r=>{e&&e.handleMessage(r)};return _jsxruntime.jsxs.call(void 0, _reactnative.View,{style:{flex:1},children:[_jsxruntime.jsx.call(void 0, _clientsdkrnwindow.RNWebView,{ref:s,globals:i.appId?{crossmintAppId:i.appId}:void 0,source:{uri:P.iframe.getUrl(n.current)},onMessage:k,style:{width:"100%",minWidth:"100%",height:C,backgroundColor:"transparent",overflow:"hidden",opacity:1,padding:0,boxShadow:"none",borderWidth:0,transform:[{translateX:0}]},allowsInlineMediaPlayback:!0,mediaPlaybackRequiresUserAction:!1,allowsBackForwardNavigationGestures:!1,allowsLinkPreview:!1,scrollEnabled:!1,bounces:!1,showsHorizontalScrollIndicator:!1,showsVerticalScrollIndicator:!1,domStorageEnabled:!0,mixedContentMode:"always",allowFileAccess:!0,allowUniversalAccessFromFileURLs:!0,geolocationEnabled:!0,userAgent:_chunkYQEWHOQ7js.c,paymentRequestEnabled:!0}),n.current.payment.crypto.enabled?n.current.payment.crypto.payer!=null?_jsxruntime.jsx.call(void 0, _chunk2UY6GCV3js.a,{payer:n.current.payment.crypto.payer,webViewClient:e}):_jsxruntime.jsx.call(void 0, H,{message:"If 'payment.crypto.enabled' is true, 'payment.crypto.payer' must be provided. Support for not providing a payer is not yet implemented."}):null]})}function U(t,e){return JSON.stringify(t)!==JSON.stringify(e)}function F(t,e){return t.payment.crypto.payer&&e!=null?{shouldPreserve:!0,updatedPayer:_chunkIJN37RF2js.b.call(void 0, _chunkIJN37RF2js.a.call(void 0, {},t.payment.crypto.payer),{initialChain:e})}:{shouldPreserve:!1}}function H({message:t}){throw new Error(t)}exports.a = Q;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty,p=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var j=(a,b,c)=>b in a?o(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c,r=(a,b)=>{for(var c in b||(b={}))k.call(b,c)&&j(a,c,b[c]);if(f)for(var c of f(b))l.call(b,c)&&j(a,c,b[c]);return a},s=(a,b)=>p(a,q(b));var t=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var u=(a,b)=>{var c={};for(var d in a)k.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&f)for(var d of f(a))b.indexOf(d)<0&&l.call(a,d)&&(c[d]=a[d]);return c};var v=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var w=(a,b,c)=>new Promise((d,i)=>{var m=e=>{try{g(c.next(e))}catch(h){i(h)}},n=e=>{try{g(c.throw(e))}catch(h){i(h)}},g=e=>e.done?d(e.value):Promise.resolve(e.value).then(m,n);g((c=c.apply(a,b)).next())});export{r as a,s as b,t as c,u as d,v as e,w as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var o={name:"@crossmint/client-sdk-react-native-ui",version:"1.0.0-beta.7",repository:"https://github.com/Crossmint/crossmint-sdk",license:"Apache-2.0",author:"Paella Labs Inc",sideEffects:!1,main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",files:["dist","app.plugin.js","LICENSE"],scripts:{build:"cross-env NODE_OPTIONS='--max-old-space-size=8192' tsup",dev:"cross-env NODE_OPTIONS='--max-old-space-size=8192' tsup --watch","generate:docs":"typedoc && node scripts/generate-reference.mjs"},dependencies:{"@crossmint/client-sdk-auth":"workspace:*","@crossmint/client-sdk-base":"workspace:*","@crossmint/client-sdk-react-base":"workspace:*","@crossmint/client-sdk-rn-window":"workspace:*","@crossmint/client-signers":"workspace:*","@crossmint/common-sdk-auth":"workspace:*","@crossmint/common-sdk-base":"workspace:*","@crossmint/wallets-sdk":"workspace:*","@solana/web3.js":"1.98.1",bs58:"^5.0.0","lodash.clonedeep":"4.5.0","lodash.isequal":"4.5.0",mitt:"3.0.1",zod:"3.22.4","@crossmint/expo-device-signer":"workspace:*"},devDependencies:{"@expo/config-plugins":"^9.0.17",typedoc:"0.28.16","@types/react":"19.1.10","expo-constants":"~18.0.9","expo-device":"~8.0.9","expo-secure-store":"~15.0.7","expo-web-browser":"~15.0.8"},peerDependencies:{"@crossmint/expo-device-signer":"0.1.0-beta.5","@expo/config-plugins":">=9.0.0","@solana/web3.js":"^1.98.1","expo-constants":">=17 <19","expo-device":">=7 <9","expo-secure-store":">=14 <16","expo-web-browser":">=14 <16",react:">=17.0.2","react-native":">=0.74.3","react-native-webview":">=13.15.0 <14"},peerDependenciesMeta:{"@crossmint/expo-device-signer":{optional:!0}}};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Image as n}from"react-native";import{jsx as t}from"react/jsx-runtime";function g({source:o,size:e=22,color:r}){return t(n,{source:typeof o=="string"?{uri:o}:o,resizeMode:"contain",style:{width:e,height:e,tintColor:r}})}export{g as a};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var _configplugins = require('@expo/config-plugins');var _path = require('path'); var _path2 = _interopRequireDefault(_path);var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);var E=l=>_configplugins.withDangerousMod.call(void 0, l,["ios",i=>_chunkIJN37RF2js.f.call(void 0, void 0,null,function*(){let t=_path2.default.join(i.modRequest.platformProjectRoot,"Podfile"),e=_fs2.default.readFileSync(t,"utf8");e.includes("CROSSMINT_RN_PREBUILT_FIX")||(e=e.replace(/(ENV\['RCT_USE_RN_DEP'\][^\n]+\n)(ENV\['RCT_USE_PREBUILT_RNCORE'\][^\n]+\n)/,`$1$2ENV.delete('RCT_USE_RN_DEP') # CROSSMINT_RN_PREBUILT_FIX
|
|
2
|
+
ENV.delete('RCT_USE_PREBUILT_RNCORE') # CROSSMINT_RN_PREBUILT_FIX
|
|
3
|
+
`));let n="# @crossmint/expo-device-signer: CrossmintDeviceSigner autolinking exclusion";if(!e.includes(n)){let a=` ${n}
|
|
4
|
+
# RN 0.82 removed CallInvoker.h from TurboModuleUtils.h, breaking
|
|
5
|
+
# expo-modules-core@3.x. Inject it via a prefix header for that pod.
|
|
6
|
+
require 'fileutils'
|
|
7
|
+
pch_path = "#{installer.sandbox.root}/CrossmintExpoFixes.pch"
|
|
8
|
+
unless File.exist?(pch_path)
|
|
9
|
+
File.write(pch_path, [
|
|
10
|
+
"// Auto-generated by @crossmint/client-sdk-react-native-ui plugin",
|
|
11
|
+
"#ifdef __OBJC__",
|
|
12
|
+
"#endif",
|
|
13
|
+
"#ifdef __cplusplus",
|
|
14
|
+
"// RN 0.82 moved these headers; include from their new locations.",
|
|
15
|
+
"#include <ReactCommon/CallInvoker.h>",
|
|
16
|
+
"#include <ReactCommon/react/bridging/CallbackWrapper.h>",
|
|
17
|
+
"#endif",
|
|
18
|
+
].join("\\n") + "\\n")
|
|
19
|
+
end
|
|
20
|
+
installer.pods_project.targets.each do |target|
|
|
21
|
+
if target.name == 'ExpoModulesCore'
|
|
22
|
+
target.build_configurations.each do |config|
|
|
23
|
+
config.build_settings['GCC_PREFIX_HEADER'] = pch_path
|
|
24
|
+
config.build_settings['GCC_PRECOMPILE_PREFIX_HEADER'] = 'YES'
|
|
25
|
+
paths = config.build_settings['HEADER_SEARCH_PATHS'] || '$(inherited)'
|
|
26
|
+
# Needed so <ReactCommon/CallInvoker.h> resolves correctly
|
|
27
|
+
extra = '$(PODS_ROOT)/Headers/Public/React-callinvoker'
|
|
28
|
+
config.build_settings['HEADER_SEARCH_PATHS'] = "#{paths} #{extra}" unless paths.include?(extra)
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
if target.name == 'CrossmintDeviceSigner'
|
|
32
|
+
target.build_configurations.each do |config|
|
|
33
|
+
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = ''
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
`,o=e.replace(/(post_install do \|installer\|)/,`$1
|
|
38
|
+
${a}`);if(o===e)throw new Error("[crossmint/client-sdk-react-native-ui] Could not inject post_install hook: expected 'post_install do |installer|' in Podfile");e=o}return _fs2.default.writeFileSync(t,e),i})]);exports.a = E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as n}from"./chunk-4P5ABAFD.mjs";import*as e from"expo-secure-store";var i=class{get(t){return n(this,null,function*(){try{let r=yield e.getItemAsync(t);if(!r)return;try{let o=JSON.parse(r);if(o.expiresAt&&new Date(o.expiresAt)<new Date){yield this.remove(t);return}return o.value}catch(o){return r}}catch(r){console.error("Error reading from SecureStore:",r);return}})}set(t,r,o){return n(this,null,function*(){try{if(o){let s=JSON.stringify({value:r,expiresAt:o});yield e.setItemAsync(t,s)}else yield e.setItemAsync(t,r)}catch(s){console.error("Error writing to SecureStore:",s)}})}remove(t){return n(this,null,function*(){try{yield e.deleteItemAsync(t)}catch(r){console.error("Error removing from SecureStore:",r)}})}isAvailable(){return n(this,null,function*(){try{return yield e.isAvailableAsync()}catch(t){return!1}})}};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSTDFVESGjs = require('./chunk-STDFVESG.js');var _chunk3G67LZY4js = require('./chunk-3G67LZY4.js');var _chunk2RDEJU3Tjs = require('./chunk-2RDEJU3T.js');var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var _react = require('react');var _reactnative = require('react-native');var _clientsdkrnwindow = require('@crossmint/client-sdk-rn-window');var _clientsigners = require('@crossmint/client-signers');var _commonsdkbase = require('@crossmint/common-sdk-base');var _clientsdkreactbase = require('@crossmint/client-sdk-react-base');var _expodevicesigner = require('@crossmint/expo-device-signer');var _jsxruntime = require('react/jsx-runtime');var L="Passkey signers are not supported in React Native. Use a different signer type such as 'email', 'phone', or 'device'.";function ve(c){var i,v;return c==null?!1:!!(((i=c.recovery)==null?void 0:i.type)==="passkey"||(v=c.signers)!=null&&v.some(m=>m.type==="passkey"))}function me({children:c}){let i=_react.useContext.call(void 0, _clientsdkreactbase.CrossmintWalletBaseContext),v=_react.useCallback.call(void 0, d=>_chunkIJN37RF2js.f.call(void 0, this,null,function*(){var R,I;if(((R=d.recovery)==null?void 0:R.type)==="passkey"||(I=d.signers)!=null&&I.some(r=>r.type==="passkey"))throw new Error(L);return i.createWallet(d)}),[i.createWallet]),m=_react.useCallback.call(void 0, d=>_chunkIJN37RF2js.f.call(void 0, this,null,function*(){throw new Error(L)}),[]),V=_react.useMemo.call(void 0, ()=>_chunkIJN37RF2js.b.call(void 0, _chunkIJN37RF2js.a.call(void 0, {},i),{createWallet:v,createPasskeySigner:m}),[i,v,m]);return _jsxruntime.jsx.call(void 0, _clientsdkreactbase.CrossmintWalletBaseContext.Provider,{value:V,children:c})}function pe({children:c,createOnLogin:i,appearance:v,showOtpSignerPrompt:m=!0,callbacks:V,deviceSignerKeyStorage:d}){let R=_react.useMemo.call(void 0, ()=>d!=null?d:new _expodevicesigner.NativeDeviceSignerKeyStorage,[]),{crossmint:I}=_clientsdkreactbase.useCrossmint.call(void 0, "CrossmintWalletProvider must be used within CrossmintProvider"),r=_clientsdkreactbase.useLogger.call(void 0, _chunkSTDFVESGjs.a),{apiKey:N,appId:O}=I,D=_react.useMemo.call(void 0, ()=>{let e=_commonsdkbase.validateAPIKey.call(void 0, N);if(!e.isValid)throw new Error("Invalid API key");return e},[N]),F=_react.useMemo.call(void 0, ()=>_clientsigners.environmentUrlConfig[D.environment],[D.environment]),y=_react.useRef.call(void 0, null),t=_react.useRef.call(void 0, null),[T,J]=_react.useState.call(void 0, !1),C=_react.useRef.call(void 0, !1),l=_react.useRef.call(void 0, !1),s=_react.useRef.call(void 0, 0),M=_react.useRef.call(void 0, 0),Y=_react.useMemo.call(void 0, ()=>O!=null?{crossmintAppId:O}:{},[O]),w=_react.useCallback.call(void 0, e=>_chunkIJN37RF2js.f.call(void 0, this,null,function*(){if(t.current!=null){let n=t.current;if(l.current){r.info("react-native.wallet.webview.handshake.skip.in-progress",{trigger:e,generation:s.current});return}if(C.current&&n.isConnected){r.info("react-native.wallet.webview.handshake.skip.already-connected",{trigger:e,generation:s.current});return}l.current=!0;let a=Date.now();M.current=a;let o=s.current;try{r.info("react-native.wallet.webview.handshake.start",{trigger:e,generation:o,platform:_reactnative.Platform.OS}),C.current=!0,n.isConnected=!1,yield n.handshakeWithChild();let u=Date.now()-a;r.info("react-native.wallet.webview.handshake.success",{trigger:e,generation:o,durationMs:u})}catch(u){let f=Date.now()-a;o===s.current&&(C.current=!1),r.error("react-native.wallet.webview.handshake.error",{trigger:e,generation:o,durationMs:f,error:u instanceof Error?u.message:String(u)}),console.error("[CrossmintWalletProvider] Handshake error:",u)}finally{o===s.current&&(l.current=!1)}}else r.warn("react-native.wallet.webview.handshake.skip",{trigger:e,reason:"parent not initialized"})}),[r]);_react.useEffect.call(void 0, ()=>{y.current!=null&&t.current==null&&(r.info("react-native.wallet.webview.initializing"),t.current=new (0, _clientsdkrnwindow.WebViewParent)(y,{incomingEvents:_clientsigners.signerOutboundEvents,outgoingEvents:_clientsigners.signerInboundEvents,handshakeOptions:{timeoutMs:3e4,intervalMs:100},recovery:{recoverableErrorCodes:[_clientsigners.SignerErrorCode.IndexedDbFatal]}}),r.info("react-native.wallet.webview.initialized"),w("eager"))},[T,r,w]);let $=_react.useCallback.call(void 0, ()=>_chunkIJN37RF2js.f.call(void 0, this,null,function*(){var e,n;r.info("react-native.wallet.webview.onLoadEnd",{handshakeInProgress:l.current,isConnected:(n=(e=t.current)==null?void 0:e.isConnected)!=null?n:!1,generation:s.current}),yield w("onLoadEnd")}),[r,w]),q=_react.useCallback.call(void 0, e=>{var o,u;let n=t.current;if(n==null)return;let a=e.nativeEvent.data;if(a==="frame-ready"){r.info("react-native.wallet.webview.frame-ready.received",{handshakeInProgress:l.current,isConnected:(u=(o=t.current)==null?void 0:o.isConnected)!=null?u:!1,generation:s.current,msSinceHandshakeStart:M.current>0?Date.now()-M.current:null}),w("frame-ready");return}try{let f=JSON.parse(a);if(f&&typeof f.type=="string"&&f.type.startsWith("console.")){let x=f.type.split(".")[1],U=(f.data||[]).map(h=>{try{return h==="[Function]"||h==="[Circular Reference]"||h==="[Unserializable Object]"?h:JSON.parse(h)}catch(be){return h}}),k=`react-native.wallet.webview.console.${x}`,P={webview_args:U};switch(x){case"log":r.info(k,P);break;case"error":r.error(k,P);break;case"warn":r.warn(k,P);break;case"info":r.info(k,P);break;case"debug":r.debug(k,P);break;default:r.info("react-native.wallet.webview.console.unknown",{webview_method:x,webview_args:U})}return}}catch(f){}n.handleMessage(e)},[r,w]),Q=()=>{if(t.current==null)throw new Error("WebView not ready or handshake incomplete");return t.current},X=({emailSignerProps:e,phoneSignerProps:n})=>m?_jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _chunk3G67LZY4js.a,_chunkIJN37RF2js.a.call(void 0, {},e)),_jsxruntime.jsx.call(void 0, _chunk2RDEJU3Tjs.a,_chunkIJN37RF2js.a.call(void 0, {},n))]}):null,Z=()=>_chunkIJN37RF2js.f.call(void 0, this,null,function*(){r.info("react-native.wallet.webview.init.start"),J(!0);let e=0,n=100;for(;t.current==null&&e<n;)yield new Promise(a=>setTimeout(a,50)),e++;if(t.current==null)throw r.error("react-native.wallet.webview.init.timeout",{attempts:e}),new Error("WebView not ready or handshake incomplete");r.info("react-native.wallet.webview.init.success",{attempts:e})});return _react.useEffect.call(void 0, ()=>{if(ve(i))throw new Error(L)},[i]),_jsxruntime.jsxs.call(void 0, _clientsdkreactbase.CrossmintWalletBaseProvider,{createOnLogin:i,appearance:v,showOtpSignerPrompt:m,initializeWebView:Z,callbacks:V,renderUI:X,clientTEEConnection:Q,deviceSignerKeyStorage:R,children:[_jsxruntime.jsx.call(void 0, me,{children:c}),T&&_jsxruntime.jsx.call(void 0, _reactnative.View,{style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:_jsxruntime.jsx.call(void 0, _clientsdkrnwindow.RNWebView,{ref:y,source:{uri:F},globals:Y,onLoadEnd:$,onMessage:q,onError:e=>{console.error("[CrossmintWalletProvider] WebView error:",e.nativeEvent)},onHttpError:e=>{console.error("[CrossmintWalletProvider] WebView HTTP error:",e.nativeEvent)},onContentProcessDidTerminate:()=>{var n,a,o;let e=s.current;s.current++,r.warn("react-native.wallet.webview.process.terminated",{prevGeneration:e,newGeneration:s.current,wasConnected:(a=(n=t.current)==null?void 0:n.isConnected)!=null?a:!1,hadHandshakeInProgress:l.current}),C.current=!1,l.current=!1,t.current!=null&&(t.current.isConnected=!1),(o=y.current)==null||o.reload(),w("eager")},onRenderProcessGone:()=>{var n,a,o;let e=s.current;s.current++,r.warn("react-native.wallet.webview.process.renderGone",{prevGeneration:e,newGeneration:s.current,wasConnected:(a=(n=t.current)==null?void 0:n.isConnected)!=null?a:!1,hadHandshakeInProgress:l.current}),C.current=!1,l.current=!1,t.current!=null&&(t.current.isConnected=!1),(o=y.current)==null||o.reload(),w("eager")},style:{width:1,height:1},javaScriptCanOpenWindowsAutomatically:!1,thirdPartyCookiesEnabled:!1,sharedCookiesEnabled:!1,incognito:!1,setSupportMultipleWindows:!1,originWhitelist:[_clientsigners.environmentUrlConfig[D.environment]],cacheEnabled:!0,cacheMode:"LOAD_DEFAULT"})})]})}function De(c){return _jsxruntime.jsx.call(void 0, pe,_chunkIJN37RF2js.a.call(void 0, {},c))}exports.a = De;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkLOFHVHXQjs = require('./chunk-LOFHVHXQ.js');var _configplugins = require('@expo/config-plugins');var{addMetaDataItemToMainApplication:l,getMainApplicationOrThrow:d}=_configplugins.AndroidConfig.Manifest,s= exports.a =(n,a={enableGooglePay:!1})=>a.enableGooglePay?_configplugins.withAndroidManifest.call(void 0, n,o=>{let i=d(o.modResults);return l(i,"com.google.android.gms.wallet.api.enabled","true"),o.modResults=_chunkLOFHVHXQjs.a.call(void 0, o.modResults,{intent:[{action:[{$:{"android:name":"org.chromium.intent.action.PAY"}}]},{action:[{$:{"android:name":"org.chromium.intent.action.IS_READY_TO_PAY"}}]},{action:[{$:{"android:name":"org.chromium.intent.action.UPDATE_PAYMENT_DETAILS"}}]}]}),o}):n;exports.a = s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-7JGGPJBX.mjs";import{e as I}from"./chunk-4P5ABAFD.mjs";var r=I((f,c)=>{c.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABV0lEQVR4AdzUXVKDQBAEYPRi6snUk+nNdL4pmiIEE5DkJSl6l52Z7t4/8jzc+fdYBq+1W1+Fn4Og8VEa/WSLBCSYdOJAQ+O9+PohBi8V8HxW83QQNEpiYDIZtJvoDfA9arRmVjDG2tV2Zby3x7XVE29pIGFpDlqx8RaYLQ7uSf3S4K2y8z28ZkLYjKGog+2hMeS3NFBAdG5iZmLhpBcjzEQMhzgN48bSoIPVILtNSDWczoYYEM52EFSLo/YEfxmkCGluQhiYEDZjSP1Zf80AgYkZxoiwd8Le1SwhD9N3sCxYG8eIsPe1msTkYZdByLv6LVu0S3Asdk53WwFxl6C9soIcVrt2ZlujHlIdcXodj0GfeFW52z6sS2hi1Xr8C+MQBjMn7iLIT4csyETfiY0NIRzC4F1somcFAmYm6c5fgjr1AU4m5z3x7ucGHfhnw/RMnNatDGit4hcAAP//I+bVpgAAAAZJREFUAwC4slUxPmyOTgAAAABJRU5ErkJggg=="});import{jsx as e}from"react/jsx-runtime";function v({size:i=22,color:n,strokeWidth:t=2}){return e(o,{source:r(),size:i,color:n})}export{v as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-ST55IDAQ.mjs";import{CrossmintApiClient as e}from"@crossmint/common-sdk-base";function C(i,t){return new e(i,{internalConfig:{sdkMetadata:{name:"@crossmint/client-sdk-react-native-ui",version:n.version},apiKeyExpectations:t}})}export{C as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var o=Object.defineProperty,p=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable;var j=(a,b,c)=>b in a?o(a,b,{enumerable:!0,configurable:!0,writable:!0,value:c}):a[b]=c,r= exports.a =(a,b)=>{for(var c in b||(b={}))k.call(b,c)&&j(a,c,b[c]);if(f)for(var c of f(b))l.call(b,c)&&j(a,c,b[c]);return a},s= exports.b =(a,b)=>p(a,q(b));var t=(a=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(a,{get:(b,c)=>(typeof require!="undefined"?require:b)[c]}):a)(function(a){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var u=(a,b)=>{var c={};for(var d in a)k.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(a!=null&&f)for(var d of f(a))b.indexOf(d)<0&&l.call(a,d)&&(c[d]=a[d]);return c};var v=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var w=(a,b,c)=>new Promise((d,i)=>{var m=e=>{try{g(c.next(e))}catch(h){i(h)}},n=e=>{try{g(c.throw(e))}catch(h){i(h)}},g=e=>e.done?d(e.value):Promise.resolve(e.value).then(m,n);g((c=c.apply(a,b)).next())});exports.a = r; exports.b = s; exports.c = t; exports.d = u; exports.e = v; exports.f = w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-7JGGPJBX.mjs";import{e}from"./chunk-4P5ABAFD.mjs";var r=e((s,i)=>{i.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAABPElEQVR4AdzVW1ICMRCF4ajL8FnXoetwLZZaLkzX4VpU6C+kh2Go4RZ4gcrJpZP+TxJCcVsu/Lkug/e4rb/QolO/kY8VTSl5RQJvEclxdE8ud5GJhTkYvEZQeYzqplMYgSiVmTvO9sVMp+5bfmXWqgU0w9EMTpBr+RrnTQ3MMfFFW2x8iJ5ikRy50V2XqcFzTH2EFIv3mQDbMcn5jgojmlWZGlgAOjaxM7FVxroWA2YiKgccw7hqalCDUUn2miTFsORpwAhYzBwgsBzjDc0Z5CJJYxNgYmINMDEx3tI+AwlMxqcBYyqmb82sDjHI5DSyY/2M72yPMdgJmpu8HoP/dsSH1vY0yajMvKLPRvyJ1g+rRxiBKZWZBl6Fp1ddzXYIAwtz+D/AE/Bn4X33CAMLc8OgBs5d5RWdmzvwlgAAAP//5FxmQQAAAAZJREFUAwDOiFAxJLPlDQAAAABJRU5ErkJggg=="});import{jsx as n}from"react/jsx-runtime";function l({size:I=22,color:c,strokeWidth:p=2}){return n(o,{source:r(),size:I,color:c})}export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-AHAHB7QD.mjs";import{d as S,f as c}from"./chunk-4P5ABAFD.mjs";import{createContext as I,useEffect as N,useMemo as L,useState as M,useCallback as W}from"react";import*as n from"expo-web-browser";import p from"expo-constants";import{Platform as T}from"react-native";import{CrossmintAuthBaseProvider as z,useCrossmintAuthBase as F}from"@crossmint/client-sdk-react-base";import{useCrossmint as b,useWallet as Y,useWalletOtpSigner as Z}from"@crossmint/client-sdk-react-base";import{useContext as k}from"react";function R(){let r=k(w);if(r==null)throw new Error("useCrossmintAuth must be used within a CrossmintAuthProvider");return r}import{jsx as d}from"react/jsx-runtime";var B={google:null,twitter:null},G={crossmintAuth:void 0,login:()=>{},logout:()=>c(void 0,null,function*(){}),jwt:void 0,user:void 0,status:"initializing",getUser:()=>{},loginWithOAuth:()=>Promise.resolve(),createAuthSession:()=>Promise.resolve(null)},w=I(G);function V({children:r}){let{setJwt:e}=b(),{jwt:t}=R();return N(()=>{e(t)},[e,t]),r}function _({children:r,appSchema:e}){let t=F(),[h,g]=M(B),[f,i]=M(!1),A=Array.isArray(e)?e[0]:e,P=p.executionEnvironment==="storeClient"||p.appOwnership==="expo"||!!p.expoVersion?"exp://127.0.0.1:8081":A,y=W(()=>c(this,null,function*(){try{let u=Object.keys(B).map(s=>c(this,null,function*(){var m;let l=yield(m=t.crossmintAuth)==null?void 0:m.getOAuthUrl(s,{appSchema:P});return{[s]:l}})),a=Object.assign({},...yield Promise.all(u));g(a)}catch(o){console.error(o)}}),[t.crossmintAuth,P]);N(()=>{t.user==null&&y()},[y,t.user]);let E=()=>t.status==="initializing"?"initializing":f?"in-progress":t.jwt!=null?"logged-in":"logged-out",j=o=>c(this,null,function*(){var u,a;try{i(!0);let s=(a=h[o])!=null?a:yield(u=t.crossmintAuth)==null?void 0:u.getOAuthUrl(o,{appSchema:P});yield n.warmUpAsync();let l=new URL(s);if(o==="google"&&l.searchParams.append("provider_prompt","select_account"),T.OS==="android")yield n.openBrowserAsync(l.toString());else{let m=yield n.openAuthSessionAsync(l.toString());m.type==="success"&&(yield x(m.url))}yield n.coolDownAsync()}catch(s){throw console.error("[CrossmintAuthProvider] Error during OAuth login:",s),new Error(`Error during OAuth login: ${s}`)}finally{i(!1)}}),x=W(o=>c(this,null,function*(){var a;let u=o.includes("://")?D(o):o;if(u!=null)try{return i(!0),yield(a=t.crossmintAuth)==null?void 0:a.handleRefreshAuthMaterial(u)}catch(s){throw s}finally{i(!1)}return null}),[t.crossmintAuth]);return d(w.Provider,{value:{crossmintAuth:t.crossmintAuth,logout:t.logout,jwt:t.jwt,user:t.user,status:E(),getUser:t.getUser,login:()=>{},loginWithOAuth:j,createAuthSession:x},children:d(V,{children:r})})}function at(t){var h=t,{children:r}=h,e=S(h,["children"]);var i,A;let g=(A=e.appSchema)!=null?A:(i=p.expoConfig)==null?void 0:i.scheme,f=L(()=>{var C;return(C=e.storageProvider)!=null?C:new v},[e.storageProvider]);return d(z,{onLoginSuccess:e.onLoginSuccess,refreshRoute:e.refreshRoute,logoutRoute:e.logoutRoute,storageProvider:f,children:d(_,{appSchema:g,children:r})})}var D=r=>{let e=/[?&]oneTimeSecret=([^&#]+)/,t=r.match(e);return t?decodeURIComponent(t[1]):void 0};export{w as a,at as b,R as c,b as d,Y as e,Z as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTVASK7FQjs = require('./chunk-TVASK7FQ.js');var _chunkIJN37RF2js = require('./chunk-IJN37RF2.js');var r=_chunkIJN37RF2js.e.call(void 0, (t,e)=>{e.exports="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAxUlEQVR4AeyVbQrCQAxEqx5F9Gyi51E8m+JR/Ji3mIXQlM0PhUK3ZJZt8oa0oXTXw5+vqQZn9X1K76Rg8Qj3ETUAPAqLakqHAYsHrwMouIRuDhKx17JKClboYF72RVEDy90LkVuMNW91jRK18qNNb9AcZB9RH1FzAk1geV/RTTN5SOmY3Yj472/Tjy8weoOX8sSOJSljzVttUYPrt8q8s2cyLDbzsi+KGpxUuUijp1FuKmDx4HVM1AAAcKNN9kyGxSOLjw8AAAD//6BjmDAAAAAGSURBVAMAy+IoMbHLqDcAAAAASUVORK5CYII="});var _jsxruntime = require('react/jsx-runtime');function s({size:n=22,color:p,strokeWidth:c=2}){return _jsxruntime.jsx.call(void 0, _chunkTVASK7FQjs.a,{source:r(),size:n,color:p})}exports.a = s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-7USVT6EZ.mjs";import{
|
|
1
|
+
import{a as o}from"./chunk-7USVT6EZ.mjs";import{f as b}from"./chunk-4P5ABAFD.mjs";import{useState as g}from"react";import{View as V,Text as n,TextInput as K,TouchableOpacity as D,StyleSheet as M,ActivityIndicator as Q}from"react-native";import{jsx as e,jsxs as X}from"react/jsx-runtime";function p({icon:H,title:L,description:F,helpText:N,onSubmitOTP:W,onResendCode:y,appearance:t,otpLength:E=9,keyboardType:U="default",autoComplete:$="one-time-code",textContentType:q="oneTimeCode"}){var f,h,B,C,S,I,P,k,R,z,w,O,v;let[r,x]=g(""),[s,u]=g(!1),[c,d]=g(null),[m,T]=g(0),G=()=>b(this,null,function*(){if(r.length!==0){u(!0),d(null);try{yield W(r),x("")}catch(l){console.error("Failed to verify OTP",l),d("Invalid code. Please try again.")}finally{u(!1)}}}),J=()=>b(this,null,function*(){if(!(m>0||!y)){u(!0),d(null);try{yield y(),T(60);let l=setInterval(()=>{T(A=>A<=1?(clearInterval(l),0):A-1)},1e3)}catch(l){console.error("Failed to resend OTP",l),d("Failed to resend code. Please try again.")}finally{u(!1)}}}),i=M.create({container:{width:"100%"},iconContainer:{alignItems:"center",marginBottom:8},title:{fontSize:18,fontWeight:"600",color:((f=t==null?void 0:t.colors)==null?void 0:f.textPrimary)||o["cm-text-primary"],textAlign:"center",marginBottom:8,marginTop:16},description:{fontSize:14,color:((h=t==null?void 0:t.colors)==null?void 0:h.textSecondary)||o["cm-text-secondary"],textAlign:"center",marginBottom:24,lineHeight:20},otpInput:{borderWidth:1,borderColor:c?((B=t==null?void 0:t.colors)==null?void 0:B.danger)||o["cm-danger"]:((C=t==null?void 0:t.colors)==null?void 0:C.border)||o["cm-border"],borderRadius:(t==null?void 0:t.borderRadius)||12,backgroundColor:((S=t==null?void 0:t.colors)==null?void 0:S.inputBackground)||o["cm-muted-primary"],padding:16,fontSize:16,color:((I=t==null?void 0:t.colors)==null?void 0:I.textPrimary)||o["cm-text-primary"],marginBottom:16,textAlign:"center"},errorText:{fontSize:14,color:((P=t==null?void 0:t.colors)==null?void 0:P.danger)||o["cm-danger"],textAlign:"center",marginBottom:16},helpText:{fontSize:12,color:((k=t==null?void 0:t.colors)==null?void 0:k.textSecondary)||o["cm-text-secondary"],textAlign:"center",marginBottom:16,lineHeight:16},submitButton:{backgroundColor:((R=t==null?void 0:t.colors)==null?void 0:R.accent)||o["cm-accent"],paddingVertical:16,paddingHorizontal:32,borderRadius:(t==null?void 0:t.borderRadius)||12,alignItems:"center",marginBottom:16},submitButtonDisabled:{opacity:.6},submitButtonText:{fontSize:16,fontWeight:"500",color:((z=t==null?void 0:t.colors)==null?void 0:z.background)||o["cm-background-primary"]},resendButton:{alignSelf:"center",paddingVertical:12,paddingHorizontal:16},resendButtonText:{fontSize:14,color:((w=t==null?void 0:t.colors)==null?void 0:w.accent)||o["cm-accent"],textAlign:"center"},resendButtonDisabled:{opacity:.6}});return X(V,{style:i.container,children:[e(V,{style:i.iconContainer,children:H}),e(n,{style:i.title,children:L}),e(n,{style:i.description,children:F}),e(K,{style:i.otpInput,placeholder:"Enter code",placeholderTextColor:((O=t==null?void 0:t.colors)==null?void 0:O.textSecondary)||o["cm-text-secondary"],value:r,onChangeText:l=>{x(l),d(null)},keyboardType:U,autoComplete:$,textContentType:q,editable:!s,maxLength:E}),c&&e(n,{style:i.errorText,children:c}),e(n,{style:i.helpText,children:N}),e(D,{style:[i.submitButton,(r.length===0||s)&&i.submitButtonDisabled],onPress:G,disabled:r.length===0||s,children:s?e(Q,{color:((v=t==null?void 0:t.colors)==null?void 0:v.background)||o["cm-background-primary"]}):e(n,{style:i.submitButtonText,children:"Submit"})}),y&&e(D,{style:[i.resendButton,m>0&&i.resendButtonDisabled],onPress:J,disabled:m>0||s,children:e(n,{style:i.resendButtonText,children:m>0?`Re-send code in ${m}s`:"Re-send code"})})]})}export{p as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{f as p}from"./chunk-4P5ABAFD.mjs";import{useState as v,useCallback as s,useRef as u,useEffect as y}from"react";import{View as g,Text as x,StyleSheet as V,Alert as f}from"react-native";import{useWallet as h,useCrossmint as C}from"@crossmint/client-sdk-react-base";import{environmentUrlConfig as W,exportSignerInboundEvents as P,exportSignerOutboundEvents as S}from"@crossmint/client-signers";import{isExportableSignerAdapter as b}from"@crossmint/wallets-sdk";import{validateAPIKey as F}from"@crossmint/common-sdk-base";import{WebViewParent as I,RNWebView as k}from"@crossmint/client-sdk-rn-window";import{jsx as o}from"react/jsx-runtime";function z({appearance:K}){let{wallet:r}=h(),{crossmint:i}=C(),a=u(null),l=u(null),[c,w]=v("");y(()=>{if(i!=null)try{let e=F(i.apiKey);if(e.isValid){let t=W[e.environment];w(`${t}/export`)}}catch(e){console.error("Failed to get TEE URL:",e)}},[i]);let E=s(e=>p(this,null,function*(){if(!(r==null||a.current==null||e.nativeEvent.loading))try{if(r.signer!=null&&b(r.signer)){let t=new I(a,{incomingEvents:S,outgoingEvents:P});l.current=t,yield t.handshakeWithChild(),yield r.signer._exportPrivateKey(t)}}catch(t){console.error("Failed to export private key:",t),f.alert("Export Failed","Failed to export private key. Please try again.")}}),[r]),d=s(e=>{let{nativeEvent:t}=e;console.error("WebView error:",t),f.alert("Export Failed","Failed to load export interface. Please try again.")},[]),m=s(e=>{l.current&&l.current.handleMessage(e)},[]);return c===""||r==null||r.signer==null||!b(r.signer)?null:o(g,{style:n.webViewContainer,children:o(k,{ref:a,source:{uri:c},style:n.webView,javaScriptEnabled:!0,domStorageEnabled:!0,onLoadEnd:E,onError:d,onHttpError:d,onMessage:m,startInLoadingState:!0,renderLoading:()=>o(g,{style:n.loadingContainer,children:o(x,{style:n.loadingText,children:"Loading..."})})})})}var n=V.create({webViewContainer:{height:56,borderWidth:1,borderColor:"#E5E5E5",borderRadius:12,overflow:"hidden"},webView:{flex:1},loadingContainer:{flex:1,justifyContent:"center",alignItems:"center",backgroundColor:"#F5F5F5"},loadingText:{fontSize:16,color:"#666666"}});export{z as a};
|