@funkit/connect-rn 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +81 -0
  3. package/dist/{chunk-BNWA4HKO.js → chunk-VDKAH5Y5.js} +327 -111
  4. package/dist/chunk-VDKAH5Y5.js.map +7 -0
  5. package/dist/clients/lighter/index.d.ts +2 -0
  6. package/dist/clients/lighter/index.d.ts.map +1 -1
  7. package/dist/clients/lighter/useLighterSecureWithdrawal.d.ts +42 -0
  8. package/dist/clients/lighter/useLighterSecureWithdrawal.d.ts.map +1 -0
  9. package/dist/clients/lighter.js +126 -1
  10. package/dist/clients/lighter.js.map +4 -4
  11. package/dist/index.d.ts +1 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3388 -1693
  14. package/dist/index.js.map +4 -4
  15. package/dist/src/components/AmountDisplay.d.ts +18 -0
  16. package/dist/src/components/AmountDisplay.d.ts.map +1 -0
  17. package/dist/src/components/AssetGrid.d.ts +39 -0
  18. package/dist/src/components/AssetGrid.d.ts.map +1 -0
  19. package/dist/src/components/NumPad.d.ts +14 -0
  20. package/dist/src/components/NumPad.d.ts.map +1 -0
  21. package/dist/src/components/PillButton.d.ts +25 -0
  22. package/dist/src/components/PillButton.d.ts.map +1 -0
  23. package/dist/src/components/ReceiveAmountSummary.d.ts +27 -0
  24. package/dist/src/components/ReceiveAmountSummary.d.ts.map +1 -0
  25. package/dist/src/components/ReceiveAsRow.d.ts +14 -0
  26. package/dist/src/components/ReceiveAsRow.d.ts.map +1 -0
  27. package/dist/src/components/SearchInput.d.ts +15 -0
  28. package/dist/src/components/SearchInput.d.ts.map +1 -0
  29. package/dist/src/components/SelectableAssetRow.d.ts +14 -0
  30. package/dist/src/components/SelectableAssetRow.d.ts.map +1 -0
  31. package/dist/src/components/SheetContent.d.ts +25 -0
  32. package/dist/src/components/SheetContent.d.ts.map +1 -0
  33. package/dist/src/components/SkeletonBar.d.ts +10 -0
  34. package/dist/src/components/SkeletonBar.d.ts.map +1 -0
  35. package/dist/src/components/TopBar.d.ts +12 -0
  36. package/dist/src/components/TopBar.d.ts.map +1 -0
  37. package/dist/src/components/WalletAddressInput.d.ts +35 -0
  38. package/dist/src/components/WalletAddressInput.d.ts.map +1 -0
  39. package/dist/src/components/WithdrawSourceCard.d.ts +23 -0
  40. package/dist/src/components/WithdrawSourceCard.d.ts.map +1 -0
  41. package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
  42. package/dist/src/flow/FlowSheet.d.ts +3 -1
  43. package/dist/src/flow/FlowSheet.d.ts.map +1 -1
  44. package/dist/src/flow/FunkitFlowProvider.d.ts +11 -3
  45. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
  46. package/dist/src/flow/WithdrawalFlowContent.d.ts +4 -1
  47. package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -1
  48. package/dist/src/haptics/HapticsContext.d.ts +21 -0
  49. package/dist/src/haptics/HapticsContext.d.ts.map +1 -0
  50. package/dist/src/haptics/hapticTap.d.ts +13 -0
  51. package/dist/src/haptics/hapticTap.d.ts.map +1 -0
  52. package/dist/src/hooks/useIsStablecoin.d.ts +3 -0
  53. package/dist/src/hooks/useIsStablecoin.d.ts.map +1 -0
  54. package/dist/src/hooks/useNestedSheet.d.ts +17 -0
  55. package/dist/src/hooks/useNestedSheet.d.ts.map +1 -0
  56. package/dist/src/hooks/useNestedSheetHeight.d.ts +7 -0
  57. package/dist/src/hooks/useNestedSheetHeight.d.ts.map +1 -0
  58. package/dist/src/hooks/usePulse.d.ts +7 -0
  59. package/dist/src/hooks/usePulse.d.ts.map +1 -0
  60. package/dist/src/icons/FigmaSystemIcons.d.ts +2 -0
  61. package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -1
  62. package/dist/src/icons/FunIcon.d.ts +5 -2
  63. package/dist/src/icons/FunIcon.d.ts.map +1 -1
  64. package/dist/src/icons/TokenChainIcon.d.ts +6 -1
  65. package/dist/src/icons/TokenChainIcon.d.ts.map +1 -1
  66. package/dist/src/providers/FunkitProvider.d.ts +17 -2
  67. package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
  68. package/dist/src/screens/SelectChainScreen.d.ts.map +1 -1
  69. package/dist/src/screens/SelectMethodScreen.d.ts.map +1 -1
  70. package/dist/src/screens/SelectReceiveTokenAndChainScreen.d.ts +18 -0
  71. package/dist/src/screens/SelectReceiveTokenAndChainScreen.d.ts.map +1 -0
  72. package/dist/src/screens/SelectReceiveTokenScreen.d.ts +13 -0
  73. package/dist/src/screens/SelectReceiveTokenScreen.d.ts.map +1 -0
  74. package/dist/src/screens/SelectSourceTokenScreen.d.ts.map +1 -1
  75. package/dist/src/screens/TransactionBreakdownScreen.d.ts +12 -0
  76. package/dist/src/screens/TransactionBreakdownScreen.d.ts.map +1 -0
  77. package/dist/src/screens/WithdrawAddressScreen.d.ts +48 -0
  78. package/dist/src/screens/WithdrawAddressScreen.d.ts.map +1 -0
  79. package/dist/src/screens/WithdrawAmountScreen.d.ts +53 -0
  80. package/dist/src/screens/WithdrawAmountScreen.d.ts.map +1 -0
  81. package/dist/src/screens/WithdrawCompleteScreen.d.ts +15 -4
  82. package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -1
  83. package/dist/src/screens/WithdrawCryptoComplete.d.ts +8 -1
  84. package/dist/src/screens/WithdrawCryptoComplete.d.ts.map +1 -1
  85. package/dist/src/screens/WithdrawCryptoSteps.d.ts +39 -0
  86. package/dist/src/screens/WithdrawCryptoSteps.d.ts.map +1 -0
  87. package/dist/src/transfer/clipboard.d.ts +22 -0
  88. package/dist/src/transfer/clipboard.d.ts.map +1 -1
  89. package/dist/src/utils/amountGlyphs.d.ts +15 -0
  90. package/dist/src/utils/amountGlyphs.d.ts.map +1 -0
  91. package/dist/src/utils/assetGrid.d.ts +20 -0
  92. package/dist/src/utils/assetGrid.d.ts.map +1 -0
  93. package/dist/src/utils/executionErrorMessage.d.ts +13 -0
  94. package/dist/src/utils/executionErrorMessage.d.ts.map +1 -0
  95. package/dist/src/utils/formatAmount.d.ts +21 -0
  96. package/dist/src/utils/formatAmount.d.ts.map +1 -0
  97. package/dist/src/utils/motion.d.ts +3 -0
  98. package/dist/src/utils/motion.d.ts.map +1 -0
  99. package/dist/src/utils/numpadInput.d.ts +14 -0
  100. package/dist/src/utils/numpadInput.d.ts.map +1 -0
  101. package/dist/src/utils/safeArea.d.ts +3 -0
  102. package/dist/src/utils/safeArea.d.ts.map +1 -0
  103. package/dist/src/withdrawal/receiveDestination.d.ts +11 -0
  104. package/dist/src/withdrawal/receiveDestination.d.ts.map +1 -0
  105. package/dist/src/withdrawal/sourceToken.d.ts +4 -11
  106. package/dist/src/withdrawal/sourceToken.d.ts.map +1 -1
  107. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +6 -0
  108. package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -1
  109. package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts +89 -0
  110. package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts.map +1 -0
  111. package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts +37 -0
  112. package/dist/src/withdrawal/useCryptoWithdrawalSubmit.d.ts.map +1 -0
  113. package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts.map +1 -1
  114. package/dist/src/withdrawal/useSourceTokenUsdPrice.d.ts +20 -0
  115. package/dist/src/withdrawal/useSourceTokenUsdPrice.d.ts.map +1 -0
  116. package/dist/src/withdrawal/useWithdrawalAmountInput.d.ts +38 -0
  117. package/dist/src/withdrawal/useWithdrawalAmountInput.d.ts.map +1 -0
  118. package/dist/src/withdrawal/useWithdrawalRisk.d.ts +2 -2
  119. package/dist/src/withdrawal/useWithdrawalRisk.d.ts.map +1 -1
  120. package/dist/src/withdrawal/useWithdrawalStatus.d.ts +6 -2
  121. package/dist/src/withdrawal/useWithdrawalStatus.d.ts.map +1 -1
  122. package/dist/src/withdrawal/validation.d.ts +23 -5
  123. package/dist/src/withdrawal/validation.d.ts.map +1 -1
  124. package/package.json +8 -3
  125. package/dist/chunk-BNWA4HKO.js.map +0 -7
  126. package/dist/src/components/AmountInput.d.ts +0 -40
  127. package/dist/src/components/AmountInput.d.ts.map +0 -1
  128. package/dist/src/components/WithdrawFeeSummary.d.ts +0 -23
  129. package/dist/src/components/WithdrawFeeSummary.d.ts.map +0 -1
  130. package/dist/src/screens/SelectDestinationScreen.d.ts +0 -19
  131. package/dist/src/screens/SelectDestinationScreen.d.ts.map +0 -1
  132. package/dist/src/screens/WithdrawCryptoCta.d.ts +0 -20
  133. package/dist/src/screens/WithdrawCryptoCta.d.ts.map +0 -1
  134. package/dist/src/screens/WithdrawCryptoForm.d.ts +0 -28
  135. package/dist/src/screens/WithdrawCryptoForm.d.ts.map +0 -1
  136. package/dist/src/screens/WithdrawCryptoScreen.d.ts +0 -17
  137. package/dist/src/screens/WithdrawCryptoScreen.d.ts.map +0 -1
  138. package/dist/src/withdrawal/flatFee.d.ts +0 -9
  139. package/dist/src/withdrawal/flatFee.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # @funkit/connect-rn
2
2
 
3
+ ## 3.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4c02988: Lighter Native Bridge withdrawals can be submitted from `@funkit/connect-rn`, recorded for attribution.
8
+ - 3d95b7f: Risk assessment now screens on the transaction's chain: `getRiskAssessmentForAddress` accepts an optional `chainId`, and checkout and withdrawal screens send it.
9
+ - e72e8d9: feat(connect-rn): taps through the optional `react-native-haptic-feedback` peer when installed, overridable via `FunkitProvider`'s `hapticFeedback`
10
+ - 61fffd1: feat(connect-rn): token-and-chain grid picker for the withdrawal destination
11
+ - 6cc3034: feat(connect-rn): tabbed token/chain picker with search for the withdrawal destination
12
+ - 14cfa5b: feat(connect-rn): the crypto withdrawal is the amount and recipient steps, with the old single-form screen gone
13
+ - c667b94: Crypto withdrawal amounts can now be entered in dollars, with a tap to switch between dollars and the source token. Sources priced in dollars no longer wait on a price lookup to show their value.
14
+ - e76ae84: feat(connect-rn): amount display whose digits slide in as they are typed and out as they are deleted
15
+ - f2f8eeb: feat(connect-rn): the withdrawal amount screen now fills the screen, status bar included
16
+ - 759b3f4: feat(connect-rn): withdrawal amount screen — numpad entry over the source card, with Use Max giving way to Continue
17
+ - f2f8eeb: feat(connect-rn): the crypto withdrawal now asks for the amount on its own step before the recipient
18
+ - cebbd0f: feat(connect-rn): in-app numpad for entering an amount, tapping on every press
19
+ - cde4297: feat(connect-rn): the withdrawal reports itself going out and landing on the amount it was signed for
20
+ - b6f58fb: feat(connect-rn): the withdrawal shows what the recipient receives, with a breakdown of the estimate
21
+ - 4c718c2: feat(connect-rn): the crypto withdrawal asks for the recipient on its own screen, with paste, clear and the connected wallet
22
+ - f283759: feat(connect-rn): the crypto withdrawal is signed from the recipient step
23
+ - 657e4a3: feat(connect-rn): source card naming what a withdrawal is drawn from, with its balance and a Use Max shortcut
24
+ - ec87169: Crypto withdrawals now price the source token, so the USD minimum and maximum a host configures take effect.
25
+ - 993ac35: React Native token pricing now falls back to Relay when the funkit price API can't price a token, so configured USD withdrawal limits stay enforced.
26
+ - 4523118: Show the provider's own message when a crypto withdrawal fails for a reason the SDK cannot classify, instead of generic copy.
27
+
28
+ ### Patch Changes
29
+
30
+ - 76dafe1: Withdrawal flat-fee deduction now comes from `@funkit/connect-core`, so web and React Native price the same amount.
31
+ - 67d1b06: fix(connect-rn): a failing clipboard read no longer interrupts the withdrawal Paste
32
+ - d2f7455: Document Lighter withdrawal integration in the package README.
33
+ - ca5a3dd: No consumer facing changes.
34
+ - 9722639: No consumer facing changes.
35
+ - fa18a86: fix(connect-rn): render CDN token and chain logos that style their paths with CSS classes
36
+ - c667b94: Withdrawal amounts entered in dollars no longer blank out while a decimal point is typed, and dollars are offered only once the source token's precision is known.
37
+ - f283759: fix(connect-rn): a withdrawal whose quote fails says so, instead of loading forever
38
+ - 53d7f38: fix(connect-rn): a network blip no longer stops a withdrawal from being followed to its outcome
39
+ - 519f359: fix(connect-rn): scroll the chain, token and source pickers on Android
40
+ - db08b0d: fix(connect): reject non-decimal withdrawal source balance values
41
+ - Updated dependencies [fade45e]
42
+ - Updated dependencies [759b3f4]
43
+ - Updated dependencies [c667b94]
44
+ - Updated dependencies [c667b94]
45
+ - Updated dependencies [53d7f38]
46
+ - Updated dependencies [76dafe1]
47
+ - Updated dependencies [bbb0301]
48
+ - Updated dependencies [3d95b7f]
49
+ - Updated dependencies [993ac35]
50
+ - Updated dependencies [db08b0d]
51
+ - Updated dependencies [e1354ad]
52
+ - @funkit/api-base@7.1.0
53
+ - @funkit/connect-core@3.1.0
54
+
3
55
  ## 3.6.0
4
56
 
5
57
  ### Minor Changes
package/README.md CHANGED
@@ -106,6 +106,87 @@ Two deliberate choices keep it that way:
106
106
  module that Expo Go doesn't bundle. If you genuinely need one, make it optional +
107
107
  lazily imported + guarded with a host-injectable override, the way clipboard is.
108
108
 
109
+ ## Lighter withdrawals
110
+
111
+ Lighter lives on its own entry, `@funkit/connect-rn/clients/lighter`, so a host
112
+ that never configures it carries none of it. **You** call the hook and pass the
113
+ methods it returns to `beginWithdrawal` — the SDK's withdrawal config names no
114
+ venue. The methods replace the generic crypto row on the method screen:
115
+
116
+ | | Fast |
117
+ | --- | --- |
118
+ | Source | USDC Perps |
119
+ | Destination | any supported chain/token |
120
+ | Path | Fun + Relay |
121
+ | Speed | seconds |
122
+ | Limits | $4 min, $3M max |
123
+
124
+ ```tsx
125
+ import { useFunkitCheckout } from '@funkit/connect-rn'
126
+ import {
127
+ type LighterWithdrawalFlowConfig,
128
+ useLighterWithdrawal,
129
+ } from '@funkit/connect-rn/clients/lighter'
130
+
131
+ const lighter: LighterWithdrawalFlowConfig = {
132
+ // The end user's L1 address. The SDK resolves their L2 main-account index
133
+ // from it — Lighter addresses accounts by index, not by address.
134
+ l1Address,
135
+ // Your Lighter L2 signer. The SDK never holds L2 key material.
136
+ signerClient,
137
+ // Reserved for the Native Bridge rail, which has not shipped — see below.
138
+ sendLighterSecureWithdrawal: ({ amountTokenUnits, assetIndex, routeType }) =>
139
+ client.withdraw({ amount: amountTokenUnits, assetIndex, routeType }),
140
+ // Your own accounting: margin requirements and locked collateral are not
141
+ // visible to the SDK.
142
+ withdrawalSourceTokenBalance: ({ sourceToken }) =>
143
+ balances[sourceToken.symbol] ?? 0,
144
+ // Awaited before the rail signs. Lighter strategies and withdrawals share
145
+ // one L2 signing account, so cancel in-flight strategies here or the
146
+ // withdrawal signs against a nonce that has already moved. Throwing aborts
147
+ // the withdrawal and consumes no nonce.
148
+ onBeforeSign: () => cancelOpenStrategies(),
149
+ }
150
+
151
+ // Empty until the L2 account resolves — both rails address it by index, so the
152
+ // flow falls back to its generic crypto row until then.
153
+ const methods = useLighterWithdrawal({
154
+ lighter,
155
+ config: { ...withdrawalConfig, withdrawalWallet },
156
+ })
157
+
158
+ const { beginWithdrawal } = useFunkitCheckout()
159
+ beginWithdrawal({ ...withdrawalConfig, withdrawalWallet, methods })
160
+ ```
161
+
162
+ ### The unstaked fee
163
+
164
+ Lighter charges a flat $3 on Fast withdrawals for users not sufficiently staked
165
+ in its LIT pool. The SDK reads the stake off the account and takes the fee off
166
+ the amount **before** quoting — so the quote prices what Lighter will actually
167
+ move, and the user is not promised ~3 tokens the transfer never delivers.
168
+
169
+ That timing is the whole contract: `quoteInputFeeTokens` is deducted pre-quote,
170
+ and a fee taken from a quote's *result* is a different number at a different
171
+ time. If a venue ever charges that way it needs its own field rather than
172
+ reusing this one.
173
+
174
+ It gets no row in the fee summary. The quote already prices the smaller amount,
175
+ so its own cost rows carry what the withdrawal costs; a venue that bills its fee
176
+ as source-chain gas instead sets `extraSourceGasUsd`, which lands in the network
177
+ cost row.
178
+
179
+ While the account is still loading the fee holds at 0 — "no shares" and "not a
180
+ staker" are indistinguishable then, and charging would bill an exempt user. A
181
+ *failed* lookup fails closed and charges, because Lighter takes the fee whether
182
+ or not the SDK could see the stake.
183
+
184
+ **The Native Bridge rail is not available yet.** Only Fast is reachable — its
185
+ row is the sole Lighter method on the screen. `sendLighterSecureWithdrawal` is
186
+ required by the config type and reserved for that rail, so it must be supplied
187
+ even though nothing calls it today; a stub is fine. Same for the optional
188
+ `getSecureMinWithdrawalAmount`.
189
+
109
190
  ## Local development
110
191
 
111
192
  > No root shortcut exists for this package — use the `pnpm --filter` form (or