@funkit/connect 12.19.0 → 12.21.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 (146) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/clients/{chunk-N46CL4ZT.js → chunk-4NWQR25X.js} +1 -1
  3. package/dist/clients/{chunk-AELXD5XA.js → chunk-6XJV626L.js} +1 -1
  4. package/dist/clients/chunk-B67ESBGC.js +108 -0
  5. package/dist/clients/{chunk-KH2HLTHP.js → chunk-DAMICUCH.js} +5 -5
  6. package/dist/clients/{chunk-FOXMRDKD.js → chunk-FIJU6HZM.js} +1 -1
  7. package/dist/clients/{chunk-L6JL2XJY.js → chunk-MTKOZB6U.js} +1 -1
  8. package/dist/clients/{chunk-R25GIAD5.js → chunk-PZSKO3BJ.js} +1 -0
  9. package/dist/clients/{chunk-5NYKSTGH.js → chunk-S4SMCBQ4.js} +1 -1
  10. package/dist/clients/{chunk-Y7ONHWCW.js → chunk-T4Q43DNC.js} +2 -2
  11. package/dist/clients/{chunk-YSAAJSWT.js → chunk-YSQX5Z3F.js} +49 -25
  12. package/dist/clients/fanatics.d.ts +5 -7
  13. package/dist/clients/fanatics.js +4 -4
  14. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  15. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  16. package/dist/clients/internal/nado/withdrawalForm.js +5 -5
  17. package/dist/clients/internal/nado/withdrawalStatus.js +4 -4
  18. package/dist/clients/lighter.css +8 -1
  19. package/dist/clients/lighter.js +6 -6
  20. package/dist/clients/lighterRh.d.ts +44 -0
  21. package/dist/clients/lighterRh.js +51 -0
  22. package/dist/clients/mallard.js +3 -3
  23. package/dist/clients/nado.js +6 -6
  24. package/dist/clients/polymarket/createPolymarketDepositConfig.js +3 -3
  25. package/dist/clients/polymarket/index.js +3 -3
  26. package/dist/clients/polymarket/polymarket.d.ts +22 -22
  27. package/dist/clients/polymarket/polymarket.js +2 -2
  28. package/dist/components/Avatar/emojiAvatarForAddress.d.ts +35 -35
  29. package/dist/components/Box/Box.d.ts +63 -63
  30. package/dist/components/ConnectButton/ConnectButton.d.ts +16 -15
  31. package/dist/components/Dialog/Dialog.d.ts +12 -4
  32. package/dist/components/Dialog/hooks.d.ts +3 -3
  33. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +2 -2
  34. package/dist/components/FunBottomBar/FunBottomBar.d.ts +3 -1
  35. package/dist/components/FunInfoBanner/InfoBanner.d.ts +1 -1
  36. package/dist/components/FunInput/FunInput.d.ts +1 -1
  37. package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
  38. package/dist/components/FunTooltip/FunTooltip.d.ts +2 -2
  39. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +3 -1
  40. package/dist/components/HighPriceImpactAlert/HighPriceImpactAlert.d.ts +7 -0
  41. package/dist/components/Icons/GreenRoundCheckmark.d.ts +2 -1
  42. package/dist/components/Icons/StatusIcons.css.d.ts +2 -2
  43. package/dist/components/Icons/StatusIcons.d.ts +2 -2
  44. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
  45. package/dist/components/ModalSelection/ModalSelection.d.ts +4 -4
  46. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +1 -1
  47. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +17 -4
  48. package/dist/components/TokenSwapWidget/TokenSwapPercentOptions/TokenSwapPercentOptions.d.ts +9 -0
  49. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +6 -2
  50. package/dist/components/TokenSwapWidget/TokenSwapWidgetSkeleton/TokenSwapWidgetSkeleton.d.ts +3 -0
  51. package/dist/consts/checkout.d.ts +8 -8
  52. package/dist/consts/customers.d.ts +5 -1
  53. package/dist/consts/polymarket.d.ts +2 -2
  54. package/dist/consts/quote.d.ts +25 -15
  55. package/dist/css/cssObjectFromTheme.d.ts +1 -1
  56. package/dist/css/sprinkles.css.d.ts +78 -78
  57. package/dist/domains/bridge.d.ts +1 -1
  58. package/dist/domains/convert/assets.d.ts +38 -0
  59. package/dist/domains/convert/inputAmount.d.ts +24 -21
  60. package/dist/domains/convert/reducer.d.ts +11 -6
  61. package/dist/domains/convert/screen.d.ts +10 -1
  62. package/dist/domains/convert/view.d.ts +4 -0
  63. package/dist/domains/priceImpact.d.ts +14 -0
  64. package/dist/hooks/queries/useMeldLimits.d.ts +45 -45
  65. package/dist/hooks/queries/useWithdrawalQuote.d.ts +62 -62
  66. package/dist/hooks/track/useTrack.d.ts +1 -1
  67. package/dist/hooks/useCheckoutQuoteNotification.d.ts +3 -3
  68. package/dist/hooks/useConvertBalances.d.ts +1 -1
  69. package/dist/hooks/useConvertQuote.d.ts +1 -1
  70. package/dist/hooks/useDynamicRoutes.d.ts +1 -1
  71. package/dist/hooks/useFrogAccount.d.ts +77 -77
  72. package/dist/hooks/useIsomorphicEffect.d.ts +2 -2
  73. package/dist/hooks/usePaymentMethodIcon.d.ts +1 -1
  74. package/dist/hooks/usePaymentSources.d.ts +1 -1
  75. package/dist/hooks/usePolymarketAccountBalances.d.ts +1 -1
  76. package/dist/index.css +8 -1
  77. package/dist/index.d.ts +2 -0
  78. package/dist/index.js +2149 -1697
  79. package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +1 -1
  80. package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +1 -19
  81. package/dist/modals/CheckoutModal/Convert/ConvertChainRail.d.ts +13 -0
  82. package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +7 -5
  83. package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +0 -12
  84. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +13 -2
  85. package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +6 -1
  86. package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +6 -1
  87. package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.css.d.ts +1 -1
  88. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +1 -1
  89. package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +1 -1
  90. package/dist/providers/ConvertProvider.d.ts +2 -0
  91. package/dist/providers/FunkitCheckoutContext/types.d.ts +3 -0
  92. package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
  93. package/dist/providers/GeneralWalletProvider.d.ts +21 -21
  94. package/dist/providers/ModalSizeContext.d.ts +4 -4
  95. package/dist/shadow-css.js +1 -1
  96. package/dist/themes/baseTheme.d.ts +1 -1
  97. package/dist/themes/darkTheme.d.ts +6 -4
  98. package/dist/themes/lightTheme.d.ts +6 -4
  99. package/dist/utils/checkout.d.ts +1 -1
  100. package/dist/utils/customer.d.ts +96 -96
  101. package/dist/utils/datadogBrowserLogsTransport.d.ts +11 -5
  102. package/dist/utils/datadogPageExit.d.ts +5 -0
  103. package/dist/utils/funError.d.ts +26 -0
  104. package/dist/utils/funLogger.d.ts +2 -1
  105. package/dist/utils/shakeElement.d.ts +7 -0
  106. package/dist/wallets/computeWalletConnectMetaData.d.ts +1 -1
  107. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  108. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  109. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  110. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  111. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  112. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  113. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  114. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  115. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  116. package/dist/wallets/walletConnectors/index.js +51 -51
  117. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  118. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  119. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  120. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  121. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  122. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  123. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  124. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  125. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  126. package/package.json +9 -9
  127. package/dist/clients/chunk-GTPMJGCF.js +0 -52
  128. package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +0 -14
  129. package/dist/wallets/walletConnectors/{chunk-OVDCDVFX.js → chunk-34B7OJNT.js} +3 -3
  130. package/dist/wallets/walletConnectors/{chunk-JJBLW4IU.js → chunk-4FHNLTR3.js} +3 -3
  131. package/dist/wallets/walletConnectors/{chunk-TM7UBV3Q.js → chunk-ALGPGI6V.js} +3 -3
  132. package/dist/wallets/walletConnectors/{chunk-MWB6LFSG.js → chunk-BBB2J3US.js} +3 -3
  133. package/dist/wallets/walletConnectors/{chunk-IWPW26AL.js → chunk-BBDNB5TQ.js} +3 -3
  134. package/dist/wallets/walletConnectors/{chunk-53MYTA42.js → chunk-CU5J53XR.js} +3 -3
  135. package/dist/wallets/walletConnectors/{chunk-USLZMUJ3.js → chunk-HOCKAU5H.js} +3 -3
  136. package/dist/wallets/walletConnectors/{chunk-RJF2YEZ5.js → chunk-IA5432IR.js} +3 -3
  137. package/dist/wallets/walletConnectors/{chunk-ASTCNVJC.js → chunk-IWOMSW64.js} +3 -3
  138. package/dist/wallets/walletConnectors/{chunk-KE4CWI3A.js → chunk-NXWG6FG2.js} +3 -3
  139. package/dist/wallets/walletConnectors/{chunk-RQYEGJKL.js → chunk-RFCZYLNR.js} +3 -3
  140. package/dist/wallets/walletConnectors/{chunk-ANODOMIN.js → chunk-RXRYHMRI.js} +3 -3
  141. package/dist/wallets/walletConnectors/{chunk-PPQ6L4K2.js → chunk-SR5CZR3L.js} +3 -3
  142. package/dist/wallets/walletConnectors/{chunk-TIHTQ3OB.js → chunk-TRZDAXCQ.js} +3 -3
  143. package/dist/wallets/walletConnectors/{chunk-F45CUFRR.js → chunk-U52QO5HF.js} +3 -3
  144. package/dist/wallets/walletConnectors/{chunk-A5POD5SV.js → chunk-XODA5ESL.js} +3 -3
  145. package/dist/wallets/walletConnectors/{chunk-FYPQ3HP4.js → chunk-YRMBR6NA.js} +3 -3
  146. package/dist/wallets/walletConnectors/{chunk-65ULY6OC.js → chunk-ZSSSLFQF.js} +3 -3
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { type BaseApiRequest, type BridgeCustomer, BridgeCustomerStatus, type BridgeSubAccount, type BridgeVirtualBankAccount, type CreateBridgeBankAccountRequest, type FunAddress } from '@funkit/api-base';
10
10
  /** Bridge only supports a handful of chains so we need to normalize other chains to the supported chain*/
11
- export declare const findBridgeSupportedChain: (chainId: string) => CreateBridgeBankAccountRequest["chainName"];
11
+ export declare const findBridgeSupportedChain: (chainId: string) => CreateBridgeBankAccountRequest['chainName'];
12
12
  export interface AllFiatAccounts {
13
13
  bridgeCustomer?: BridgeCustomer;
14
14
  bankAccounts?: BridgeVirtualBankAccount[];
@@ -1,5 +1,6 @@
1
1
  import type { GetSupportedAssetsResponse, SupportedAssetInfo } from '@funkit/api-base';
2
2
  import type { Config } from '../../wagmi/hooks';
3
+ import { type ConvertBalanceState, type ConvertBalances } from './balances';
3
4
  import type { ConvertAsset, ConvertResolvedAsset } from './types';
4
5
  /** Where the host's asset list and balances stand: still loading, failed, or readable. */
5
6
  export type ConvertAssetListStatus = 'loading' | 'error' | 'ready';
@@ -28,3 +29,40 @@ export declare function resolveConvertAssets({ assets, supportedAssets, wagmiCon
28
29
  }): Promise<ConvertResolvedAsset[]>;
29
30
  /** The listed asset with this {@link convertAssetKey}, if any. */
30
31
  export declare function findConvertAsset(assets: ConvertResolvedAsset[] | undefined, assetKey: string | undefined): ConvertResolvedAsset | undefined;
32
+ /**
33
+ * Whether a token answers a search: its symbol contains the query in any case,
34
+ * or the query is its address as {@link normalizeTokenAddress} spells it, so
35
+ * a Solana mint must match exactly. An empty query matches everything.
36
+ */
37
+ export declare function matchesConvertAssetQuery(asset: ConvertAsset, query: string): boolean;
38
+ /** One row on a Convert token screen. */
39
+ export interface ConvertAssetOption {
40
+ asset: ConvertResolvedAsset;
41
+ key: string;
42
+ /** `undefined` until the first balance read lands. */
43
+ balance: ConvertBalanceState | undefined;
44
+ /** The balance in USD; `undefined` when the balance is unknown. */
45
+ usdAmount: number | undefined;
46
+ isDisabled: boolean;
47
+ /** Worth less than the minimum Convert quotes, so it can't be a source. */
48
+ isBelowMinimum?: boolean;
49
+ }
50
+ /**
51
+ * Pickable rows first, then by USD value. An unknown value sorts last, and the
52
+ * stable sort keeps the host's order among equal values.
53
+ */
54
+ export declare function compareConvertAssetOptions(a: ConvertAssetOption, b: ConvertAssetOption): number;
55
+ /**
56
+ * The source screen's rows: held tokens by USD value, disabled ones last.
57
+ * - Under the $1 minimum is disabled ("Low Balance"): Relay won't quote it.
58
+ * - An unreadable balance stays listed but disabled, so funds never look gone.
59
+ */
60
+ export declare function getConvertSourceOptions({ assets, balances, }: {
61
+ assets: ConvertResolvedAsset[];
62
+ balances: ConvertBalances;
63
+ }): ConvertAssetOption[];
64
+ /**
65
+ * The source Convert opens on: the most valuable token the user can convert
66
+ * from, i.e. the source screen's top row. `undefined` when no row is pickable.
67
+ */
68
+ export declare function getConvertPreselectedSource(options: ConvertAssetOption[]): ConvertAssetOption | undefined;
@@ -12,42 +12,45 @@ export declare function parseConvertInputToBaseUnits({ inputValue, unit, tokenAm
12
12
  decimals: number;
13
13
  }): bigint | undefined;
14
14
  /**
15
- * Max as plain field text in the current unit, rounded down so the field never
16
- * shows more than the user has. Display only: the exact amount is kept apart.
17
- * Empty in USD mode without a price, rather than a token amount under a `$`.
15
+ * A preset amount as plain field text in the current unit, rounded down so the
16
+ * field never shows more than the user has. Display only: the exact amount is
17
+ * kept apart. Empty in USD mode without a price, rather than a token amount under a `$`.
18
18
  */
19
- export declare function formatConvertMaxInput({ baseUnits, decimals, unit, unitPriceUsd, }: {
19
+ export declare function formatConvertPresetInput({ baseUnits, decimals, unit, unitPriceUsd, }: {
20
20
  baseUnits: bigint;
21
21
  decimals: number;
22
22
  unit: AmountUnit;
23
23
  unitPriceUsd: number | undefined;
24
24
  }): string;
25
- /** The field text and converted amounts for an exact Max, at `unitPriceUsd`. */
26
- export declare function getConvertMaxDisplay({ maxBaseUnits, decimals, unit, unitPriceUsd, }: {
27
- maxBaseUnits: bigint;
28
- decimals: number;
29
- unit: AmountUnit;
30
- unitPriceUsd: number | undefined;
31
- }): AmountInUnits & {
32
- inputValue: string;
33
- };
25
+ /**
26
+ * A percentage preset's exact amount, or `undefined` when there's nothing to fill.
27
+ * - Max keeps the gas reserve, so it always fits. Like checkout, it falls back to
28
+ * the full balance while the reserve loads, and is 0 when gas takes it all.
29
+ * - The rest take a share of the full balance, so on a native token they can
30
+ * exceed Max, which raises the usual insufficient-balance issue.
31
+ * - A share that rounds to 0 (dust) fills nothing rather than a silent "0".
32
+ */
33
+ export declare function getConvertPercentBaseUnits({ percent, balanceBaseUnits, maxBaseUnits, }: {
34
+ percent: number;
35
+ balanceBaseUnits: bigint;
36
+ maxBaseUnits: bigint | null;
37
+ }): bigint | undefined;
34
38
  export interface ConvertAmount extends AmountInUnits {
35
- /** The field text; Max's rounded-down display while Max is on. */
39
+ /** The field text; the preset's rounded-down display while a preset is on. */
36
40
  inputValue: string;
37
41
  unit: AmountUnit;
38
- /** What to quote: Max's exact amount, or the typed one. */
42
+ /** What to quote: the preset's exact amount, or the typed one. */
39
43
  baseUnits: bigint | undefined;
40
- isMax: boolean;
41
44
  }
42
45
  /**
43
- * The amount a draft describes at `unitPriceUsd`. While Max is on, the field
44
- * and converted amounts derive from it, so a price change or unit flip never
45
- * leaves them stale.
46
+ * The amount a draft describes at `unitPriceUsd`. While a preset is on, the
47
+ * field and converted amounts derive from it, so a price change or unit flip
48
+ * never leaves them stale.
46
49
  */
47
- export declare function getConvertAmount({ inputValue, unit, maxBaseUnits, decimals, unitPriceUsd, }: {
50
+ export declare function getConvertAmount({ inputValue, unit, presetBaseUnits, decimals, unitPriceUsd, }: {
48
51
  inputValue: string;
49
52
  unit: AmountUnit;
50
- maxBaseUnits: bigint | undefined;
53
+ presetBaseUnits: bigint | undefined;
51
54
  decimals: number;
52
55
  unitPriceUsd: number | undefined;
53
56
  }): ConvertAmount;
@@ -9,11 +9,11 @@ import type { ConvertResolvedAsset } from './types';
9
9
  export interface ConvertDraft {
10
10
  sourceKey: string | undefined;
11
11
  destinationKey: string | undefined;
12
- /** The field text as typed; stale while Max is on, which derives its own. */
12
+ /** The field text as typed; stale while a preset is on, which derives its own. */
13
13
  inputValue: string;
14
14
  unit: AmountUnit;
15
- /** Max's exact amount; typing clears it. */
16
- maxBaseUnits: bigint | undefined;
15
+ /** A percentage preset's exact amount (Max included); typing clears it. */
16
+ presetBaseUnits: bigint | undefined;
17
17
  }
18
18
  /** What the user converted, frozen when they did; a locked screen reads only this. */
19
19
  export interface ConvertSnapshot {
@@ -51,8 +51,8 @@ export type ConvertEvent = {
51
51
  type: 'AMOUNT_EDITED';
52
52
  inputValue: string;
53
53
  } | {
54
- type: 'MAX_SET';
55
- maxBaseUnits: bigint;
54
+ type: 'PRESET_SET';
55
+ presetBaseUnits: bigint;
56
56
  }
57
57
  /** Converts the field at the live price; ignored without one. */
58
58
  | {
@@ -61,6 +61,11 @@ export type ConvertEvent = {
61
61
  } | {
62
62
  type: 'SOURCE_PICKED';
63
63
  sourceKey: string;
64
+ }
65
+ /** Balances loaded with no source picked: opens on the most valuable token. */
66
+ | {
67
+ type: 'SOURCE_PRESELECTED';
68
+ sourceKey: string;
64
69
  } | {
65
70
  type: 'DESTINATION_PICKED';
66
71
  destinationKey: string;
@@ -104,7 +109,7 @@ export declare const INITIAL_CONVERT_STATE: ConvertState;
104
109
  /**
105
110
  * Convert's draft and submission. Pure: the provider runs the wallet steps
106
111
  * and polling, and dispatches what they report.
107
- * - An edit, Max, pick or retry ends a `failed` submission; a locked one ignores them.
112
+ * - An edit, preset, pick or retry ends a `failed` submission; a locked one ignores them.
108
113
  * - `CONVERT_STARTED` freezes the snapshot; nothing live reaches it after.
109
114
  * - `untrackable` is final; `completed` ends with `SUCCESS_SHOWN`, which keeps
110
115
  * the tokens and drops the amount, since it was converted.
@@ -116,6 +116,10 @@ export declare function getConvertNotification({ issue, sourceSymbol, destinatio
116
116
  destinationSymbol: string | undefined;
117
117
  t: TFunction;
118
118
  }): ErrorNotification | undefined;
119
+ /** Another press restarts the timer. */
120
+ export declare const CONVERT_RECEIVE_AMOUNT_HINT_MS = 3000;
121
+ /** Shown briefly when the read-only To amount is pressed. */
122
+ export declare function getConvertReceiveAmountHint(t: TFunction): ErrorNotification;
119
123
  export type ConvertActionButton =
120
124
  /** From the submission until Relay settles. */
121
125
  {
@@ -125,6 +129,10 @@ export type ConvertActionButton =
125
129
  | {
126
130
  action: 'converted';
127
131
  }
132
+ /** The first balance read is out, so there's no source yet. */
133
+ | {
134
+ action: 'loadingBalance';
135
+ }
128
136
  /** A native EVM source's gas price is loading, so Max and the reserve are unknown. */
129
137
  | {
130
138
  action: 'estimatingGas';
@@ -150,10 +158,11 @@ export type ConvertActionButton =
150
158
  * arrives, and waits out a refresh like checkout's confirmation screen. A
151
159
  * submission in flight overrides all of it.
152
160
  */
153
- export declare function getConvertActionButton({ submission, issue, quote, isQuoteFetching, isLookupFetching, isFeeReserveLoading, }: {
161
+ export declare function getConvertActionButton({ submission, issue, quote, isAwaitingBalances, isQuoteFetching, isLookupFetching, isFeeReserveLoading, }: {
154
162
  submission: ConvertSubmission | undefined;
155
163
  issue: ConvertScreenIssue | undefined;
156
164
  quote: ConvertQuote | undefined;
165
+ isAwaitingBalances?: boolean;
157
166
  isQuoteFetching: boolean;
158
167
  /** A source wallet, recipient or balance read is running. */
159
168
  isLookupFetching: boolean;
@@ -56,12 +56,16 @@ export interface ConvertView {
56
56
  balances: ConvertBalances | undefined;
57
57
  sourceAsset: ConvertResolvedAsset | undefined;
58
58
  destinationAsset: ConvertResolvedAsset | undefined;
59
+ /** The first balance read is out, so there's no source to show yet. */
60
+ isAwaitingBalances: boolean;
59
61
  /** Token units; `undefined` while unknown, so it never reads as 0. */
60
62
  sourceTokenBalance: number | undefined;
61
63
  destinationTokenBalance: number | undefined;
62
64
  amount: ConvertAmount;
63
65
  /** The source's Max; `null` while unknown or locked. */
64
66
  maxBaseUnits: bigint | null;
67
+ /** Shows the percentage presets: the source has a balance to take a share of. */
68
+ canSelectPercent: boolean;
65
69
  /** Shows the unit switch; off without a price to convert with. Locked, the widget disables it. */
66
70
  canToggleUnit: boolean;
67
71
  quote: ConvertQuote | undefined;
@@ -0,0 +1,14 @@
1
+ import type { FeeBreakdownV2 } from '@funkit/api-base';
2
+ /**
3
+ * The quote's expected loss in percent, when it exceeds `thresholdPercent`;
4
+ * otherwise undefined.
5
+ *
6
+ * - Sums the rows checkout shows, price impact (swap impact plus app fee) and
7
+ * max slippage, counting a missing field as 0 as they do. `totalImpact` also
8
+ * counts up to 1.25% that the backend moves into the displayed exchange
9
+ * rate, so it can read higher than the rows.
10
+ * - Network cost is its own row and stays out, so a small deposit isn't
11
+ * flagged for gas.
12
+ * - Rounds to the two decimals the warning shows, so it never reads "5.00%".
13
+ */
14
+ export declare function getHighPriceImpactPercent(feeBreakdown: Partial<Pick<FeeBreakdownV2, 'swapImpact' | 'appFeePercent' | 'maxSlippage'>> | undefined, thresholdPercent: number): number | undefined;
@@ -4,16 +4,6 @@ import type { ErrorNotification } from '../../components/FunNotification/FunNoti
4
4
  */
5
5
  export declare const useMeldLimits: (isEnabled?: boolean) => import("@tanstack/react-query").UseQueryResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>;
6
6
  export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
7
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
8
- error: Error;
9
- isError: true;
10
- isPending: false;
11
- isLoading: false;
12
- isLoadingError: false;
13
- isRefetchError: true;
14
- isSuccess: false;
15
- isPlaceholderData: false;
16
- status: "error";
17
7
  dataUpdatedAt: number;
18
8
  errorUpdatedAt: number;
19
9
  failureCount: number;
@@ -29,17 +19,17 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
29
19
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
30
20
  fetchStatus: import("@tanstack/react-query").FetchStatus;
31
21
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
32
- } | {
33
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
34
- error: null;
35
- isError: false;
22
+ error: Error;
23
+ isError: true;
36
24
  isPending: false;
37
25
  isLoading: false;
38
- isLoadingError: false;
26
+ isLoadingError: true;
39
27
  isRefetchError: false;
40
- isSuccess: true;
28
+ isSuccess: false;
41
29
  isPlaceholderData: false;
42
- status: "success";
30
+ status: 'error';
31
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
32
+ } | {
43
33
  dataUpdatedAt: number;
44
34
  errorUpdatedAt: number;
45
35
  failureCount: number;
@@ -55,17 +45,17 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
55
45
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
56
46
  fetchStatus: import("@tanstack/react-query").FetchStatus;
57
47
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
58
- } | {
59
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
60
- error: Error;
61
- isError: true;
62
- isPending: false;
63
- isLoading: false;
64
- isLoadingError: true;
48
+ error: null;
49
+ isError: false;
50
+ isPending: true;
51
+ isLoading: true;
52
+ isLoadingError: false;
65
53
  isRefetchError: false;
66
54
  isSuccess: false;
67
55
  isPlaceholderData: false;
68
- status: "error";
56
+ status: 'pending';
57
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
58
+ } | {
69
59
  dataUpdatedAt: number;
70
60
  errorUpdatedAt: number;
71
61
  failureCount: number;
@@ -74,6 +64,7 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
74
64
  isFetched: boolean;
75
65
  isFetchedAfterMount: boolean;
76
66
  isFetching: boolean;
67
+ isLoading: boolean;
77
68
  isInitialLoading: boolean;
78
69
  isPaused: boolean;
79
70
  isRefetching: boolean;
@@ -81,17 +72,16 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
81
72
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
82
73
  fetchStatus: import("@tanstack/react-query").FetchStatus;
83
74
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
84
- } | {
85
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
86
75
  error: null;
87
76
  isError: false;
88
77
  isPending: true;
89
- isLoading: true;
90
78
  isLoadingError: false;
91
79
  isRefetchError: false;
92
80
  isSuccess: false;
93
81
  isPlaceholderData: false;
94
- status: "pending";
82
+ status: 'pending';
83
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
84
+ } | {
95
85
  dataUpdatedAt: number;
96
86
  errorUpdatedAt: number;
97
87
  failureCount: number;
@@ -107,16 +97,17 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
107
97
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
108
98
  fetchStatus: import("@tanstack/react-query").FetchStatus;
109
99
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
110
- } | {
111
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
112
- error: null;
113
100
  isError: false;
114
- isPending: true;
101
+ error: null;
102
+ isPending: false;
103
+ isLoading: false;
115
104
  isLoadingError: false;
116
105
  isRefetchError: false;
117
- isSuccess: false;
118
- isPlaceholderData: false;
119
- status: "pending";
106
+ isSuccess: true;
107
+ isPlaceholderData: true;
108
+ status: 'success';
109
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
110
+ } | {
120
111
  dataUpdatedAt: number;
121
112
  errorUpdatedAt: number;
122
113
  failureCount: number;
@@ -125,7 +116,6 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
125
116
  isFetched: boolean;
126
117
  isFetchedAfterMount: boolean;
127
118
  isFetching: boolean;
128
- isLoading: boolean;
129
119
  isInitialLoading: boolean;
130
120
  isPaused: boolean;
131
121
  isRefetching: boolean;
@@ -133,17 +123,17 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
133
123
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
134
124
  fetchStatus: import("@tanstack/react-query").FetchStatus;
135
125
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
136
- } | {
137
- data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
138
- isError: false;
139
- error: null;
126
+ error: Error;
127
+ isError: true;
140
128
  isPending: false;
141
129
  isLoading: false;
142
130
  isLoadingError: false;
143
- isRefetchError: false;
144
- isSuccess: true;
145
- isPlaceholderData: true;
146
- status: "success";
131
+ isRefetchError: true;
132
+ isSuccess: false;
133
+ isPlaceholderData: false;
134
+ status: 'error';
135
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
136
+ } | {
147
137
  dataUpdatedAt: number;
148
138
  errorUpdatedAt: number;
149
139
  failureCount: number;
@@ -159,6 +149,16 @@ export declare const useMeldLimit: (fiatCurrency: string | undefined) => {
159
149
  refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined, Error>>;
160
150
  fetchStatus: import("@tanstack/react-query").FetchStatus;
161
151
  promise: Promise<import("@funkit/api-base").MeldFiatCurrencyLimit[] | undefined>;
152
+ error: null;
153
+ isError: false;
154
+ isPending: false;
155
+ isLoading: false;
156
+ isLoadingError: false;
157
+ isRefetchError: false;
158
+ isSuccess: true;
159
+ isPlaceholderData: false;
160
+ status: 'success';
161
+ data: import("@funkit/api-base").MeldFiatCurrencyLimit | undefined;
162
162
  };
163
163
  type MeldLimitError = Pick<ErrorNotification, 'code' | 'messageKey'> & {
164
164
  issue: string;
@@ -16,22 +16,6 @@ export declare const PLACEHOLDER_WITHDRAWAL_WALLET_ADDRESS = "0x0000000000000000
16
16
  * Simplified quoting logic used for withdrawal UI only.
17
17
  */
18
18
  export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, selectedChainId, selectedTokenAddress, selectedTokenSymbol, config, isEnabled, }: CheckoutQuoteParams): {
19
- quoteEnabled: boolean;
20
- withdrawalWalletAddress: `0x${string}`;
21
- data: {
22
- baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
23
- checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
24
- finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
25
- } | null;
26
- error: Error;
27
- isError: true;
28
- isPending: false;
29
- isLoading: false;
30
- isLoadingError: false;
31
- isRefetchError: true;
32
- isSuccess: false;
33
- isPlaceholderData: false;
34
- status: "error";
35
19
  dataUpdatedAt: number;
36
20
  errorUpdatedAt: number;
37
21
  failureCount: number;
@@ -55,23 +39,19 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
55
39
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
56
40
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
57
41
  } | null>;
58
- } | {
59
- quoteEnabled: boolean;
60
- withdrawalWalletAddress: `0x${string}`;
61
- data: {
62
- baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
63
- checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
64
- finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
65
- } | null;
66
- error: null;
67
- isError: false;
42
+ data: undefined;
43
+ error: Error;
44
+ isError: true;
68
45
  isPending: false;
69
46
  isLoading: false;
70
- isLoadingError: false;
47
+ isLoadingError: true;
71
48
  isRefetchError: false;
72
- isSuccess: true;
49
+ isSuccess: false;
73
50
  isPlaceholderData: false;
74
- status: "success";
51
+ status: 'error';
52
+ quoteEnabled: boolean;
53
+ withdrawalWalletAddress: `0x${string}`;
54
+ } | {
75
55
  dataUpdatedAt: number;
76
56
  errorUpdatedAt: number;
77
57
  failureCount: number;
@@ -95,19 +75,19 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
95
75
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
96
76
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
97
77
  } | null>;
98
- } | {
99
- quoteEnabled: boolean;
100
- withdrawalWalletAddress: `0x${string}`;
101
78
  data: undefined;
102
- error: Error;
103
- isError: true;
104
- isPending: false;
105
- isLoading: false;
106
- isLoadingError: true;
79
+ error: null;
80
+ isError: false;
81
+ isPending: true;
82
+ isLoading: true;
83
+ isLoadingError: false;
107
84
  isRefetchError: false;
108
85
  isSuccess: false;
109
86
  isPlaceholderData: false;
110
- status: "error";
87
+ status: 'pending';
88
+ quoteEnabled: boolean;
89
+ withdrawalWalletAddress: `0x${string}`;
90
+ } | {
111
91
  dataUpdatedAt: number;
112
92
  errorUpdatedAt: number;
113
93
  failureCount: number;
@@ -116,6 +96,7 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
116
96
  isFetched: boolean;
117
97
  isFetchedAfterMount: boolean;
118
98
  isFetching: boolean;
99
+ isLoading: boolean;
119
100
  isInitialLoading: boolean;
120
101
  isPaused: boolean;
121
102
  isRefetching: boolean;
@@ -131,19 +112,18 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
131
112
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
132
113
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
133
114
  } | null>;
134
- } | {
135
- quoteEnabled: boolean;
136
- withdrawalWalletAddress: `0x${string}`;
137
115
  data: undefined;
138
116
  error: null;
139
117
  isError: false;
140
118
  isPending: true;
141
- isLoading: true;
142
119
  isLoadingError: false;
143
120
  isRefetchError: false;
144
121
  isSuccess: false;
145
122
  isPlaceholderData: false;
146
- status: "pending";
123
+ status: 'pending';
124
+ quoteEnabled: boolean;
125
+ withdrawalWalletAddress: `0x${string}`;
126
+ } | {
147
127
  dataUpdatedAt: number;
148
128
  errorUpdatedAt: number;
149
129
  failureCount: number;
@@ -167,18 +147,23 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
167
147
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
168
148
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
169
149
  } | null>;
170
- } | {
171
- quoteEnabled: boolean;
172
- withdrawalWalletAddress: `0x${string}`;
173
- data: undefined;
174
- error: null;
150
+ data: {
151
+ baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
152
+ checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
153
+ finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
154
+ } | null;
175
155
  isError: false;
176
- isPending: true;
156
+ error: null;
157
+ isPending: false;
158
+ isLoading: false;
177
159
  isLoadingError: false;
178
160
  isRefetchError: false;
179
- isSuccess: false;
180
- isPlaceholderData: false;
181
- status: "pending";
161
+ isSuccess: true;
162
+ isPlaceholderData: true;
163
+ status: 'success';
164
+ quoteEnabled: boolean;
165
+ withdrawalWalletAddress: `0x${string}`;
166
+ } | {
182
167
  dataUpdatedAt: number;
183
168
  errorUpdatedAt: number;
184
169
  failureCount: number;
@@ -187,7 +172,6 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
187
172
  isFetched: boolean;
188
173
  isFetchedAfterMount: boolean;
189
174
  isFetching: boolean;
190
- isLoading: boolean;
191
175
  isInitialLoading: boolean;
192
176
  isPaused: boolean;
193
177
  isRefetching: boolean;
@@ -203,23 +187,23 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
203
187
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
204
188
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
205
189
  } | null>;
206
- } | {
207
- quoteEnabled: boolean;
208
- withdrawalWalletAddress: `0x${string}`;
209
190
  data: {
210
191
  baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
211
192
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
212
193
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
213
194
  } | null;
214
- isError: false;
215
- error: null;
195
+ error: Error;
196
+ isError: true;
216
197
  isPending: false;
217
198
  isLoading: false;
218
199
  isLoadingError: false;
219
- isRefetchError: false;
220
- isSuccess: true;
221
- isPlaceholderData: true;
222
- status: "success";
200
+ isRefetchError: true;
201
+ isSuccess: false;
202
+ isPlaceholderData: false;
203
+ status: 'error';
204
+ quoteEnabled: boolean;
205
+ withdrawalWalletAddress: `0x${string}`;
206
+ } | {
223
207
  dataUpdatedAt: number;
224
208
  errorUpdatedAt: number;
225
209
  failureCount: number;
@@ -243,5 +227,21 @@ export declare function useWithdrawalQuote({ analyticsStep, recipientAddress, se
243
227
  checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
244
228
  finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
245
229
  } | null>;
230
+ data: {
231
+ baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
232
+ checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
233
+ finalEstimation: import("../../domains/quote").FunkitCheckoutQuoteResult;
234
+ } | null;
235
+ error: null;
236
+ isError: false;
237
+ isPending: false;
238
+ isLoading: false;
239
+ isLoadingError: false;
240
+ isRefetchError: false;
241
+ isSuccess: true;
242
+ isPlaceholderData: false;
243
+ status: 'success';
244
+ quoteEnabled: boolean;
245
+ withdrawalWalletAddress: `0x${string}`;
246
246
  };
247
247
  export {};
@@ -11,7 +11,7 @@ export declare const eventCounts: Partial<Record<CheckoutModalEvent | WithdrawMo
11
11
  export declare const useTrack: () => {
12
12
  logEvent: (eventNameOrTrackEventData: CheckoutModalEvent | TrackEventData) => void;
13
13
  logEventV2: <T extends AnalyticsEvent>(event: T, buildMetadata: () => AnalyticsEventPayload<T>) => void;
14
- logMeasuredEvent: (trackEventData: Omit<TrackEventData, "value">) => void;
14
+ logMeasuredEvent: (trackEventData: Omit<TrackEventData, 'value'>) => void;
15
15
  startMeasuredEvent: (eventName: CheckoutModalEvent | WithdrawModalEvent) => void;
16
16
  updateUserAsync: (userInfo: FunkitUserInfo & {
17
17
  l2Address?: string;
@@ -1,12 +1,12 @@
1
1
  export declare function useCheckoutQuoteNotification(): {
2
2
  quoteNotification: {
3
- readonly messageType: "error";
3
+ readonly messageType: 'error';
4
4
  readonly quoteMessage: import("react").ReactNode;
5
5
  } | {
6
- readonly messageType: "step";
6
+ readonly messageType: 'step';
7
7
  readonly quoteMessage: string;
8
8
  } | {
9
- readonly messageType: "none";
9
+ readonly messageType: 'none';
10
10
  readonly quoteMessage: undefined;
11
11
  };
12
12
  clearCheckoutQuoteMessages: () => void;
@@ -1,6 +1,6 @@
1
1
  import { type ConvertBalances } from '../domains/convert/balances';
2
2
  import type { ConvertRecipientAddresses, ConvertResolvedAsset, GetConvertBalances } from '../domains/convert/types';
3
- export declare const BALANCES_QUERY_KEY: readonly ["convert", "balances"];
3
+ export declare const BALANCES_QUERY_KEY: readonly ['convert', 'balances'];
4
4
  interface UseConvertBalancesParams {
5
5
  /** Scopes reads to one checkout, whose `getBalances` may differ from the last. */
6
6
  checkoutId: string | undefined;