@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
@@ -0,0 +1,89 @@
1
+ import { type WithdrawalAmountValidation } from '@funkit/connect-core';
2
+ import type { WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig';
3
+ import { type WithdrawCtaBlocker } from './validation';
4
+ /** What the crypto withdrawal's screens read and write. */
5
+ export type CryptoWithdrawalForm = ReturnType<typeof useCryptoWithdrawalForm>;
6
+ /**
7
+ * One withdrawal in progress, across the screens that build it: the amount, the
8
+ * recipient and the fees are asked for a step at a time, and all of it is priced
9
+ * against the same quote.
10
+ *
11
+ * Held above the screens rather than inside one of them, so a step can be added
12
+ * (or reordered) without the state moving house — and so the quote isn't thrown
13
+ * away and re-fetched on every navigation.
14
+ */
15
+ export declare function useCryptoWithdrawalForm({ config, quoteInputFeeTokens, }: {
16
+ config: WithdrawalFlowConfig;
17
+ /**
18
+ * A flat fee the venue takes off the withdrawal before it is quoted, in
19
+ * source-token units, or 0.
20
+ */
21
+ quoteInputFeeTokens: number;
22
+ }): {
23
+ recipient: string;
24
+ setRecipient: import("react").Dispatch<import("react").SetStateAction<string>>;
25
+ sourceOptions: import("../..").WithdrawalSourceTokenOption[];
26
+ selectedSourceIndex: number;
27
+ sourceOption: import("../..").WithdrawalSourceTokenOption;
28
+ sourceToken: import("../..").WithdrawalToken;
29
+ sourceLabel: string;
30
+ sourceDecimals: number | undefined;
31
+ balance: string | undefined;
32
+ /**
33
+ * Records the decision and clears the amount: it was in the previous token's
34
+ * units, and the balance and minimum it was checked against are the new
35
+ * token's. Returns whether the source actually moved.
36
+ */
37
+ selectSource: (index: number) => boolean;
38
+ destinationChains: import("./useWithdrawalDestinationTokens").DestinationChain[];
39
+ destinationToken: import("../..").WithdrawalToken | undefined;
40
+ selectDestinationToken: (chainId: number, symbol: string) => void;
41
+ isLoadingDestinations: boolean;
42
+ isRecipientBlacklisted: boolean;
43
+ amountValidation: WithdrawalAmountValidation;
44
+ ctaBlocker: WithdrawCtaBlocker | undefined;
45
+ risk: import("./useWithdrawalRisk").WithdrawalRiskResult;
46
+ /**
47
+ * Whether what has been typed is a wallet address at all — `undefined` while
48
+ * the field is empty. Being one doesn't make it usable: the blacklist and the
49
+ * destination's chain are the separate verdicts in `recipientError`.
50
+ */
51
+ isRecipientAddress: boolean | undefined;
52
+ /** Why a well-formed address still can't be used. */
53
+ recipientError: string | undefined;
54
+ /** Screening's non-blocking verdict; the submit is what it gates. */
55
+ recipientWarning: string | undefined;
56
+ /** Enough to leave the recipient step, which the amount's problems don't hold. */
57
+ canConfirmRecipient: boolean;
58
+ /**
59
+ * Fail closed: only a completed, clean screening lets the withdrawal through,
60
+ * and only while the quote on screen is the one for what the field says —
61
+ * mid-edit the query is disabled and `quote` still holds the last price.
62
+ */
63
+ canSubmit: boolean;
64
+ quote: import("./useCryptoWithdrawalQuote").CryptoWithdrawalQuoteView | undefined;
65
+ quoteAmount: string;
66
+ /** Destination-token units, absent until the quote matches what is typed. */
67
+ receiveAmount: string | undefined;
68
+ receiveUsd: number | undefined;
69
+ receiveFloorUsd: number | undefined;
70
+ isQuoteLoading: boolean;
71
+ isQuoteError: boolean;
72
+ isSettled: boolean;
73
+ isAmountBelowFee: boolean;
74
+ /**
75
+ * The amount step's own gate: `ctaBlocker` also weighs the recipient, which
76
+ * isn't asked for until the step after.
77
+ */
78
+ amountError: string | undefined;
79
+ canContinue: boolean;
80
+ input: string;
81
+ setInput: (next: string) => void;
82
+ inUsd: boolean;
83
+ swapDenomination: () => void;
84
+ canSwapDenomination: boolean;
85
+ amountUsd: string | undefined;
86
+ amount: string;
87
+ setAmount: import("react").Dispatch<import("react").SetStateAction<string>>;
88
+ };
89
+ //# sourceMappingURL=useCryptoWithdrawalForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCryptoWithdrawalForm.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalForm.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAKhC,MAAM,sBAAsB,CAAA;AAI7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAWxE,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,cAAc,CAAA;AAmB7E,2DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAE7E;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,mBAAmB,GACpB,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAA;CAC5B;;;;;;;;;;IA0IG;;;;OAIG;0BACmB,MAAM;;;;;;;;;IA0B5B;;;;OAIG;;IAGH,qDAAqD;;IAErD,qEAAqE;;IAIrE,kFAAkF;;IAElF;;;;OAIG;;;;IAUH,6EAA6E;;;;;;;;IAS7E;;;OAGG;;;;;;;;;;;EAmBN"}
@@ -0,0 +1,37 @@
1
+ import type { WithdrawalFlowCallbacks, WithdrawalFlowConfig } from '../flow/withdrawalFlowConfig';
2
+ import type { CryptoWithdrawalForm } from './useCryptoWithdrawalForm';
3
+ /**
4
+ * Signing the withdrawal {@link CryptoWithdrawalForm} describes: the press, the
5
+ * once-only hand-off to the outcome, and what the step shows while either is in
6
+ * flight.
7
+ *
8
+ * Held apart from the step that renders it so the money path's invariants — one
9
+ * hand-off, the source the signature was actually raised against, nothing
10
+ * executed but the quote on screen — can be exercised without a rendered screen.
11
+ */
12
+ /** What the recipient step is showing the withdrawal will land as. */
13
+ interface ReceiveLabels {
14
+ usdLabel: string | undefined;
15
+ tokenLabel: string | undefined;
16
+ }
17
+ export declare function useCryptoWithdrawalSubmit({ config, callbacks, form, receiveLabels, onSubmitted, }: {
18
+ config: WithdrawalFlowConfig;
19
+ callbacks: WithdrawalFlowCallbacks;
20
+ /** The withdrawal being built, which is what gets signed. */
21
+ form: CryptoWithdrawalForm;
22
+ receiveLabels: ReceiveLabels;
23
+ onSubmitted: (result: {
24
+ txHash: string;
25
+ amountLabel: string;
26
+ } & ReceiveLabels) => void;
27
+ }): {
28
+ isSubmitting: boolean;
29
+ /** The button holds for the price and the screening too, not only the signature. */
30
+ isBusy: boolean;
31
+ /** An unrecoverable failure from the last attempt, in the user's words. */
32
+ executionErrorText: string | undefined;
33
+ /** Executes the quote on screen. `form.canSubmit` is what gates the press. */
34
+ submit: () => void;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=useCryptoWithdrawalSubmit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCryptoWithdrawalSubmit.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalSubmit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,8BAA8B,CAAA;AAKrC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAErE;;;;;;;;GAQG;AACH,sEAAsE;AACtE,UAAU,aAAa;IACrB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B;AAED,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,SAAS,EACT,IAAI,EACJ,aAAa,EACb,WAAW,GACZ,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,SAAS,EAAE,uBAAuB,CAAA;IAClC,6DAA6D;IAC7D,IAAI,EAAE,oBAAoB,CAAA;IAC1B,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,CACX,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,aAAa,KAC5D,IAAI,CAAA;CACV;;IAqCG,oFAAoF;;IAKpF,2EAA2E;;IAK3E,8EAA8E;;EAmBjF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useCryptoWithdrawalValidation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,sBAAsB,EAAE,OAAO,CAAA;IAC/B,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,8EAA8E;IAC9E,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAA;CAC3C;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CAiC7B"}
1
+ {"version":3,"file":"useCryptoWithdrawalValidation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useCryptoWithdrawalValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAIrC,OAAO,EACL,KAAK,kBAAkB,EAIxB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,sBAAsB,EAAE,OAAO,CAAA;IAC/B,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,8EAA8E;IAC9E,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAA;CAC3C;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,MAAM,EACN,SAAS,EACT,OAAO,GACR,EAAE;IACD,MAAM,EAAE,oBAAoB,CAAA;IAC5B,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CA2C7B"}
@@ -0,0 +1,20 @@
1
+ import type { WithdrawalToken } from '../flow/withdrawalFlowConfig';
2
+ /**
3
+ * Spot USD price of the source token, for the USD floor and ceiling the host
4
+ * configures (`getMinWithdrawalUSD` / `getMaxWithdrawalUSD`).
5
+ *
6
+ * A dollar stablecoin is priced from its symbol and never fetched, as web's
7
+ * `useAssetAddressPrice` does — it is the common withdrawal source, and the
8
+ * amount screen was waiting on a round trip to be told a dollar is a dollar.
9
+ *
10
+ * `0` means "unknown", which is what the core validator reads as "no price" —
11
+ * so a failed or in-flight lookup leaves the USD limits inert rather than
12
+ * judging an amount against a made-up rate. Per-token limits and the balance
13
+ * check are unaffected either way.
14
+ *
15
+ * Not every source has a price: Lighter's L2 assets are addressed by index, not
16
+ * by an ERC-20 funkit's price API knows, so that lookup 404s and core's Relay
17
+ * fallback is what prices them.
18
+ */
19
+ export declare function useSourceTokenUsdPrice(sourceToken: WithdrawalToken): number;
20
+ //# sourceMappingURL=useSourceTokenUsdPrice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSourceTokenUsdPrice.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useSourceTokenUsdPrice.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AAanE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAuC3E"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The amount as the user types it, and which denomination they are typing in.
3
+ *
4
+ * - `amount` never changes meaning: the quote, the validation and the signature
5
+ * are all in source-token units, so when typing in dollars the typed figure
6
+ * is held here and `amount` is what it converts to.
7
+ * - Held with the form rather than in the screen, which unmounts on the way to
8
+ * the recipient — local state would drop both on Continue.
9
+ */
10
+ export declare function useWithdrawalAmountInput({ amount, setAmount, sourceUsdPrice, sourceDecimals, }: {
11
+ /** The withdrawal amount, in source-token units. */
12
+ amount: string;
13
+ setAmount: (amount: string) => void;
14
+ /** Spot USD price of the source token; `0` is the price hook's "unknown". */
15
+ sourceUsdPrice: number;
16
+ /** Fraction digits the source token carries, once they're known. */
17
+ sourceDecimals: number | undefined;
18
+ }): {
19
+ /** What to show and edit: dollars when {@link inUsd}, else token units. */
20
+ input: string;
21
+ setInput: (next: string) => void;
22
+ inUsd: boolean;
23
+ /**
24
+ * Switches denomination, converting the amount rather than clearing it.
25
+ *
26
+ * - Deliberately does not re-price against a rate that moved since the
27
+ * figure was typed: rewriting what someone entered, under them, is worse
28
+ * than showing it at the rate they entered it at.
29
+ * - The staleness is bounded by refreshing the price on the way into this
30
+ * screen rather than while it is open.
31
+ */
32
+ swapDenomination: () => void;
33
+ /** Offering the swap without a rate would promise one we don't have. */
34
+ canSwapDenomination: boolean;
35
+ /** What the amount is worth, or `undefined` when nothing prices it. */
36
+ amountUsd: string | undefined;
37
+ };
38
+ //# sourceMappingURL=useWithdrawalAmountInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWithdrawalAmountInput.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalAmountInput.ts"],"names":[],"mappings":"AA0CA;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,EACvC,MAAM,EACN,SAAS,EACT,cAAc,EACd,cAAc,GACf,EAAE;IACD,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACnC,6EAA6E;IAC7E,cAAc,EAAE,MAAM,CAAA;IACtB,oEAAoE;IACpE,cAAc,EAAE,MAAM,GAAG,SAAS,CAAA;CACnC;IAqDG,2EAA2E;;qBAtBpE,MAAM;;IA0Bb;;;;;;;;OAQG;;IAEH,wEAAwE;;IAExE,uEAAuE;;EAS1E"}
@@ -9,8 +9,8 @@ export interface WithdrawalRiskResult {
9
9
  * Chainalysis screening for the recipient.
10
10
  *
11
11
  * **Fails closed**: callers must require `isRisky === false`, so in-flight and
12
- * errored both block. The chain id only gates the query — risk is a property of
13
- * the address, so it stays out of the key (web does the same).
12
+ * errored both block. The chain id scopes the screen to the destination chain,
13
+ * so it is part of the key (web does the same).
14
14
  */
15
15
  export declare function useWithdrawalRisk(address: string, chainId: number | undefined): WithdrawalRiskResult;
16
16
  //# sourceMappingURL=useWithdrawalRisk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useWithdrawalRisk.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalRisk.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,oBAAoB,CAkCtB"}
1
+ {"version":3,"file":"useWithdrawalRisk.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalRisk.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,yBAAyB,mBAAmB,CAAA;AAEzD,MAAM,WAAW,oBAAoB;IACnC,oEAAoE;IACpE,OAAO,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,UAAU,EAAE,OAAO,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,oBAAoB,CAmCtB"}
@@ -4,11 +4,15 @@ export declare const WITHDRAWAL_STATUS_QUERY_KEY = "withdrawalStatus";
4
4
  * Whether there is still anything to learn by asking again. Split out because
5
5
  * the "record never appeared" bound is the part worth testing directly — driving
6
6
  * it through the query would mean waiting out real poll intervals.
7
+ *
8
+ * Only answered-and-absent counts against the bound: a network or 5xx failure
9
+ * says nothing about the record, so giving up on one would abandon a withdrawal
10
+ * we could still have followed.
7
11
  */
8
- export declare function shouldKeepPollingStatus({ status, hasRecord, failedFetches, }: {
12
+ export declare function shouldKeepPollingStatus({ status, hasRecord, notFoundFetches, }: {
9
13
  status: RelayExecutionStatus | undefined;
10
14
  hasRecord: boolean;
11
- failedFetches: number;
15
+ notFoundFetches: number;
12
16
  }): boolean;
13
17
  export interface WithdrawalStatusResult {
14
18
  status: RelayExecutionStatus | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useWithdrawalStatus.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;AAUzB,eAAO,MAAM,2BAA2B,qBAAqB,CAAA;AAU7D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,SAAS,EACT,aAAa,GACd,EAAE;IACD,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB,GAAG,OAAO,CAGV;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,wEAAwE;IACxE,WAAW,EAAE,OAAO,CAAA;IACpB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,sBAAsB,CA0CxB"}
1
+ {"version":3,"file":"useWithdrawalStatus.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/useWithdrawalStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,oBAAoB,EAErB,MAAM,kBAAkB,CAAA;AAYzB,eAAO,MAAM,2BAA2B,qBAAqB,CAAA;AAU7D;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,SAAS,EACT,eAAe,GAChB,EAAE;IACD,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,OAAO,CAGV;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,oBAAoB,GAAG,SAAS,CAAA;IACxC,wEAAwE;IACxE,WAAW,EAAE,OAAO,CAAA;IACpB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAA;IACjB,mEAAmE;IACnE,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,SAAS,GACzB,sBAAsB,CAoDxB"}
@@ -11,14 +11,18 @@ export type WithdrawCtaBlocker = 'enter-recipient' | 'unsupported-recipient' | '
11
11
  /**
12
12
  * Amount limits, resolved from the host's callbacks.
13
13
  *
14
- * `sourceTokenUsdPrice` is 0 until a price source is wired: the core validator
15
- * reads that as "no price", which leaves the USD floor and ceiling inert while
16
- * still applying the per-token minimum and the balance check. It is not a
17
- * stand-in value — 0 genuinely means unknown here.
14
+ * `sourceTokenUsdPrice` of 0 means unknown, not free: the core validator reads
15
+ * it as "no price" and leaves the USD floor and ceiling inert, while the
16
+ * per-token minimum and the balance check still apply. Sources whose price the
17
+ * API cannot resolve (Lighter's index-addressed L2 assets) run that way.
18
18
  */
19
- export declare function validateAmount({ config, sourceToken, amount, balance, }: {
19
+ export declare function validateAmount({ config, sourceToken, sourceTokenUsdPrice, sourceTokenDecimals, amount, balance, }: {
20
20
  config: Pick<WithdrawalFlowConfig, 'getMinWithdrawalAmount' | 'getMinWithdrawalUSD' | 'getMaxWithdrawalUSD' | 'getMaxWithdrawalAmount'>;
21
21
  sourceToken: WithdrawalToken;
22
+ /** Spot USD price of one source token; 0 when unknown. */
23
+ sourceTokenUsdPrice?: number;
24
+ /** Fraction digits the source carries; caps how fine the USD floor gets. */
25
+ sourceTokenDecimals?: number;
22
26
  amount: string;
23
27
  balance: string | undefined;
24
28
  }): WithdrawalAmountValidation;
@@ -45,4 +49,18 @@ export declare function getWithdrawCtaBlocker({ recipientAddress, isRecipientBla
45
49
  amountValidation: WithdrawalAmountValidation;
46
50
  destinationToken: WithdrawalToken | undefined;
47
51
  }): WithdrawCtaBlocker | undefined;
52
+ /**
53
+ * Whether the venue's flat fee leaves nothing for the quote to price.
54
+ *
55
+ * - Two ways to leave nothing: the fee meets or exceeds the amount, or the
56
+ * remainder is under one base unit of the source token — `parseUnits` trims
57
+ * the extra digits, so a positive remainder still reaches the quote as 0.
58
+ * - Undefined `decimals` means the read hasn't landed. The quote can't run
59
+ * without it either, so the fee-only verdict stands until it does.
60
+ */
61
+ export declare function isAmountBelowQuoteFee({ amount, feeTokenAmount, decimals, }: {
62
+ amount: string;
63
+ feeTokenAmount: number;
64
+ decimals: number | undefined;
65
+ }): boolean;
48
66
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAIhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAMrC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,uBAAuB,GACvB,0BAA0B,GAC1B,cAAc,GACd,cAAc,GACd,oBAAoB,GACpB,mBAAmB,CAAA;AAEvB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,WAAW,EACX,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,IAAI,CACV,oBAAoB,EAClB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,CAC3B,CAAA;IACD,WAAW,EAAE,eAAe,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CAkC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,OAAO,CAOV;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,uBAAuB,EAAE,OAAO,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,kBAAkB,GAAG,SAAS,CAiBjC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/withdrawal/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAMhC,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EACV,oBAAoB,EACpB,eAAe,EAChB,MAAM,8BAA8B,CAAA;AAMrC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,uBAAuB,GACvB,0BAA0B,GAC1B,cAAc,GACd,cAAc,GACd,oBAAoB,GACpB,mBAAmB,CAAA;AAEvB;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,IAAI,CACV,oBAAoB,EAClB,wBAAwB,GACxB,qBAAqB,GACrB,qBAAqB,GACrB,wBAAwB,CAC3B,CAAA;IACD,WAAW,EAAE,eAAe,CAAA;IAC5B,0DAA0D;IAC1D,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;CAC5B,GAAG,0BAA0B,CAmC7B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,eAAe,CAAA;IAC5B,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,OAAO,CAOV;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,GACjB,EAAE;IACD,gBAAgB,EAAE,MAAM,CAAA;IACxB,sBAAsB,EAAE,OAAO,CAAA;IAC/B,uBAAuB,EAAE,OAAO,CAAA;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,0BAA0B,CAAA;IAC5C,gBAAgB,EAAE,eAAe,GAAG,SAAS,CAAA;CAC9C,GAAG,kBAAkB,GAAG,SAAS,CAiBjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,cAAc,EACd,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,MAAM,CAAA;IACtB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B,GAAG,OAAO,CAWV"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect-rn",
3
- "version": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "description": "React Native bindings for @funkit/connect. Re-exports the headless @funkit/connect-core logic; the RN platform halves (Restyle theme, WebView Swapped transport, Transfer/Swapped screens, logging) land in later releases.",
5
5
  "files": [
6
6
  "dist",
@@ -36,9 +36,9 @@
36
36
  "license": "MIT",
37
37
  "dependencies": {
38
38
  "@shopify/restyle": "^2.4.5",
39
- "@funkit/api-base": "7.0.0",
39
+ "@funkit/api-base": "7.1.0",
40
40
  "@funkit/chains": "2.2.0",
41
- "@funkit/connect-core": "3.0.0"
41
+ "@funkit/connect-core": "3.1.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@gorhom/bottom-sheet": ">=5",
@@ -50,6 +50,7 @@
50
50
  "react": ">=18",
51
51
  "react-native": ">=0.74",
52
52
  "react-native-gesture-handler": ">=2.0.0",
53
+ "react-native-haptic-feedback": ">=2",
53
54
  "react-native-qrcode-svg": ">=6.3.0",
54
55
  "react-native-reanimated": ">=3.0.0",
55
56
  "react-native-safe-area-context": ">=4.0.0",
@@ -71,6 +72,7 @@
71
72
  "react-dom": "^19.0.0",
72
73
  "react-native": "0.85.3",
73
74
  "react-native-gesture-handler": "2.31.2",
75
+ "react-native-haptic-feedback": "^3.0.0",
74
76
  "react-native-qrcode-svg": "6.3.21",
75
77
  "react-native-reanimated": "4.3.1",
76
78
  "react-native-safe-area-context": "5.4.0",
@@ -93,6 +95,9 @@
93
95
  "peerDependenciesMeta": {
94
96
  "@react-native-clipboard/clipboard": {
95
97
  "optional": true
98
+ },
99
+ "react-native-haptic-feedback": {
100
+ "optional": true
96
101
  }
97
102
  },
98
103
  "scripts": {