@funkit/connect 9.4.3 → 9.5.1

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 (70) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/__generated__/default_configs.d.ts +145 -6
  3. package/dist/__generated__/default_feature_gates.d.ts +1 -0
  4. package/dist/clients/{chunk-SBQ2UUPK.js → chunk-H6F75ULR.js} +7 -1
  5. package/dist/clients/fanatics.js +1 -1
  6. package/dist/clients/polymarket.js +1 -1
  7. package/dist/components/Dropdown/ChainDropdown.d.ts +1 -3
  8. package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +1 -3
  9. package/dist/domains/quoteMode/exactIn.d.ts +2 -0
  10. package/dist/domains/quoteMode/exactOut.d.ts +2 -0
  11. package/dist/domains/quoteMode/gasEstimate.d.ts +15 -0
  12. package/dist/domains/quoteMode/index.d.ts +9 -0
  13. package/dist/domains/quoteMode/oneToOne.d.ts +21 -0
  14. package/dist/domains/quoteMode/resolveQuoteMode.d.ts +19 -0
  15. package/dist/domains/quoteMode/types.d.ts +125 -0
  16. package/dist/hooks/queries/useFops.d.ts +1 -0
  17. package/dist/hooks/queries/useWithdrawFops.d.ts +9 -0
  18. package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
  19. package/dist/hooks/track/WithdrawModalEvent.d.ts +3 -0
  20. package/dist/hooks/useCheckoutTransferInit.d.ts +1 -0
  21. package/dist/hooks/useTokenAndChainDropdown.d.ts +0 -1
  22. package/dist/hooks/useTokenTransfer.d.ts +7 -11
  23. package/dist/hooks/useTokenTransferConfig.d.ts +1 -1
  24. package/dist/index.css +205 -205
  25. package/dist/index.js +3707 -3252
  26. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeContainer.d.ts +1 -1
  27. package/dist/modals/WithdrawalModal/WithdrawalMethodSelect.d.ts +8 -0
  28. package/dist/modals/WithdrawalModal/types.d.ts +1 -0
  29. package/dist/providers/SwappedProvider.d.ts +2 -1
  30. package/dist/utils/bluvo.d.ts +2 -4
  31. package/dist/utils/funLogger.d.ts +3 -1
  32. package/dist/utils/tokenMath.d.ts +38 -0
  33. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  38. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  39. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  40. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  41. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  42. package/dist/wallets/walletConnectors/index.js +43 -43
  43. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  44. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  49. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  50. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  51. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  52. package/package.json +4 -3
  53. package/dist/wallets/walletConnectors/{chunk-6YO27XOM.js → chunk-3Y2GG3PM.js} +3 -3
  54. package/dist/wallets/walletConnectors/{chunk-HETS3KKI.js → chunk-3YCR2ZB4.js} +3 -3
  55. package/dist/wallets/walletConnectors/{chunk-HOPH3TQ3.js → chunk-C4RP2DNH.js} +3 -3
  56. package/dist/wallets/walletConnectors/{chunk-IICWJWGZ.js → chunk-CBI3SGOC.js} +3 -3
  57. package/dist/wallets/walletConnectors/{chunk-GVOQTORD.js → chunk-CMLFDRCP.js} +3 -3
  58. package/dist/wallets/walletConnectors/{chunk-LI6QY2B5.js → chunk-COX3VEDR.js} +3 -3
  59. package/dist/wallets/walletConnectors/{chunk-EKJHJFRN.js → chunk-CT3QPTAU.js} +3 -3
  60. package/dist/wallets/walletConnectors/{chunk-7OARWILZ.js → chunk-DWMUM4F6.js} +3 -3
  61. package/dist/wallets/walletConnectors/{chunk-CJJT7LMT.js → chunk-FDVJHNLL.js} +3 -3
  62. package/dist/wallets/walletConnectors/{chunk-6UCI7GM6.js → chunk-I7K6LUZR.js} +3 -3
  63. package/dist/wallets/walletConnectors/{chunk-XBLHZICW.js → chunk-N3UJMC3V.js} +3 -3
  64. package/dist/wallets/walletConnectors/{chunk-4C7ER452.js → chunk-NEK7T3IC.js} +3 -3
  65. package/dist/wallets/walletConnectors/{chunk-PKMAPNN6.js → chunk-RLLTYOWT.js} +3 -3
  66. package/dist/wallets/walletConnectors/{chunk-GH4M6FTK.js → chunk-TIT5F32X.js} +3 -3
  67. package/dist/wallets/walletConnectors/{chunk-TTHM3WUR.js → chunk-UPUDLUBT.js} +3 -3
  68. package/dist/wallets/walletConnectors/{chunk-53VYSPXK.js → chunk-UVMMPRDM.js} +3 -3
  69. package/dist/wallets/walletConnectors/{chunk-GSHSWVEG.js → chunk-UVYZSGIX.js} +3 -3
  70. package/dist/wallets/walletConnectors/{chunk-KO56HCTI.js → chunk-ZMRIQOR5.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 9.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9827fbd: Add typeLabel to Datadog logging
8
+ - e02fa70: feat(connect): migrate MinTokenTransferValue flag to statsig
9
+ - cd9d0c2: feat(connect): migrate WithdrawalChainsAndAssets flag to statsig
10
+ - 5e1069c: refactor(connect): use dynamic config to determine chain ids for token transfer payment method item
11
+ - b12f9d8: implement swapped focus and success transaction events
12
+ - Updated dependencies [e02fa70]
13
+ - Updated dependencies [cd9d0c2]
14
+ - Updated dependencies [6024e2f]
15
+ - @funkit/utils@1.2.8
16
+ - @funkit/api-base@3.0.6
17
+
18
+ ## 9.5.0
19
+
20
+ ### Minor Changes
21
+
22
+ - fec5e96: Add QuoteMode types (EXACT_IN, EXACT_OUT, ONE_TO_ONE), QuoteBuilder strategy pattern, dnum-based token math utilities, and quote mode resolution logic
23
+ - 3b3eeba: Add swapped withdrawal method selection screen behind enableswappedwithdrawal flag
24
+
25
+ ### Patch Changes
26
+
27
+ - 9993a99: fix(connect): use modal=false to prevent multiple dropdowns staying open on client sites that override body scroll locking
28
+ - 0de9370: fix(connect): swapped loading state
29
+ - Updated dependencies [fec5e96]
30
+ - @funkit/utils@1.2.7
31
+ - @funkit/api-base@3.0.5
32
+
3
33
  ## 9.4.3
4
34
 
5
35
  ### Patch Changes
@@ -61,6 +61,9 @@ declare const _default: {
61
61
  readonly disabletokentransferchainsandassets: {
62
62
  readonly value: {};
63
63
  };
64
+ readonly disablewithdrawalchainsandassets: {
65
+ readonly value: {};
66
+ };
64
67
  readonly dynamicrouting: {
65
68
  readonly value: readonly [{
66
69
  readonly routeId: "LIGHTER_ETH_SPOT";
@@ -424,8 +427,12 @@ declare const _default: {
424
427
  readonly countryCodes: readonly ["CA"];
425
428
  };
426
429
  readonly value: {
427
- readonly mainnet: 15;
428
- readonly nonMainnet: 3;
430
+ readonly default: 3;
431
+ readonly chains: {
432
+ readonly '1': 15;
433
+ readonly '8253038': 15;
434
+ readonly '728126428': 15;
435
+ };
429
436
  };
430
437
  }, {
431
438
  readonly condition: {
@@ -433,15 +440,26 @@ declare const _default: {
433
440
  readonly countryCodes: readonly ["AU"];
434
441
  };
435
442
  readonly value: {
436
- readonly mainnet: 15;
437
- readonly nonMainnet: 3;
443
+ readonly default: 3.5;
444
+ readonly chains: {
445
+ readonly '1': 15;
446
+ readonly '8253038': 15;
447
+ readonly '728126428': 15;
448
+ };
438
449
  };
439
450
  }];
440
451
  readonly value: {
441
- readonly mainnet: 10;
442
- readonly nonMainnet: 2.5;
452
+ readonly default: 2.5;
453
+ readonly chains: {
454
+ readonly '1': 10;
455
+ readonly '8253038': 10;
456
+ readonly '728126428': 10;
457
+ };
443
458
  };
444
459
  };
460
+ readonly newtokenassetselectionbanner: {
461
+ readonly value: {};
462
+ };
445
463
  readonly relaybypasssourcechainsandassets: {
446
464
  readonly value: {
447
465
  readonly '1': readonly ["*"];
@@ -708,6 +726,127 @@ declare const _default: {
708
726
  };
709
727
  }];
710
728
  };
729
+ readonly withdrawalconfig: {
730
+ readonly value: {
731
+ readonly priorityTokens: readonly [];
732
+ readonly chains: readonly [{
733
+ readonly chainId: 1;
734
+ readonly assets: readonly [{
735
+ readonly address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
736
+ }, {
737
+ readonly address: "0x6B175474E89094C44Da98b954EedeAC495271d0F";
738
+ }, {
739
+ readonly address: "0xdAC17F958D2ee523a2206206994597C13D831ec7";
740
+ }, {
741
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
742
+ }, {
743
+ readonly address: "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
744
+ }, {
745
+ readonly address: "0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6";
746
+ }, {
747
+ readonly address: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0";
748
+ }, {
749
+ readonly address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
750
+ }, {
751
+ readonly address: "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3";
752
+ }];
753
+ }, {
754
+ readonly chainId: 1151111081099710;
755
+ readonly assets: readonly [{
756
+ readonly address: "11111111111111111111111111111111";
757
+ }, {
758
+ readonly address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
759
+ }, {
760
+ readonly address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB";
761
+ }];
762
+ }, {
763
+ readonly chainId: 56;
764
+ readonly assets: readonly [{
765
+ readonly address: "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d";
766
+ }, {
767
+ readonly address: "0x55d398326f99059fF775485246999027B3197955";
768
+ }, {
769
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
770
+ }, {
771
+ readonly address: "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c";
772
+ }, {
773
+ readonly address: "0x2170Ed0880ac9A755fd29B2688956BD959F933F8";
774
+ }, {
775
+ readonly address: "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3";
776
+ }, {
777
+ readonly address: "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56";
778
+ }, {
779
+ readonly address: "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c";
780
+ }, {
781
+ readonly address: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
782
+ }];
783
+ }, {
784
+ readonly chainId: 8453;
785
+ readonly assets: readonly [{
786
+ readonly address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
787
+ }, {
788
+ readonly address: "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2";
789
+ }, {
790
+ readonly address: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb";
791
+ }, {
792
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
793
+ }, {
794
+ readonly address: "0x4200000000000000000000000000000000000006";
795
+ }, {
796
+ readonly address: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf";
797
+ }, {
798
+ readonly address: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
799
+ }];
800
+ }, {
801
+ readonly chainId: 137;
802
+ readonly assets: readonly [{
803
+ readonly address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359";
804
+ }, {
805
+ readonly address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174";
806
+ }, {
807
+ readonly address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F";
808
+ }, {
809
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
810
+ }, {
811
+ readonly address: "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063";
812
+ }, {
813
+ readonly address: "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619";
814
+ }];
815
+ }, {
816
+ readonly chainId: 42161;
817
+ readonly assets: readonly [{
818
+ readonly address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831";
819
+ }, {
820
+ readonly address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9";
821
+ }, {
822
+ readonly address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
823
+ }, {
824
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
825
+ }, {
826
+ readonly address: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1";
827
+ }, {
828
+ readonly address: "0x912CE59144191C1204E64559FE8253a0e49E6548";
829
+ }, {
830
+ readonly address: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
831
+ }];
832
+ }, {
833
+ readonly chainId: 10;
834
+ readonly assets: readonly [{
835
+ readonly address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85";
836
+ }, {
837
+ readonly address: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58";
838
+ }, {
839
+ readonly address: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1";
840
+ }, {
841
+ readonly address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
842
+ }, {
843
+ readonly address: "0x4200000000000000000000000000000000000006";
844
+ }, {
845
+ readonly address: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34";
846
+ }];
847
+ }];
848
+ };
849
+ };
711
850
  readonly withdrawalinfobanner: {
712
851
  readonly value: {
713
852
  readonly message: "";
@@ -1,6 +1,7 @@
1
1
  declare const _default: {
2
2
  readonly 'exact-in': false;
3
3
  readonly 'new-token-transfer-config': false;
4
+ readonly 'new-withdrawal-config': false;
4
5
  readonly 'test-testing-gate': false;
5
6
  };
6
7
  export default _default;
@@ -25,6 +25,7 @@ var FunLogger = class {
25
25
  this.userAddress = null;
26
26
  this.userName = null;
27
27
  this.userLoginType = null;
28
+ this.typeLabel = null;
28
29
  this.sdkVersion = null;
29
30
  this.l2Address = null;
30
31
  this.isConfigured = false;
@@ -48,6 +49,7 @@ var FunLogger = class {
48
49
  userName: this.userName,
49
50
  userAddress: this.userAddress,
50
51
  userLoginType: this.userLoginType,
52
+ typeLabel: this.typeLabel,
51
53
  sdkVersion: this.sdkVersion
52
54
  };
53
55
  switch (level) {
@@ -189,14 +191,18 @@ var FunLogger = class {
189
191
  getUserLoginType() {
190
192
  return this.userLoginType;
191
193
  }
194
+ getTypeLabel() {
195
+ return this.typeLabel;
196
+ }
192
197
  getL2Address() {
193
198
  return this.l2Address;
194
199
  }
195
- setUserInfo(userId, userAddress, userName, userLoginType, l2Address) {
200
+ setUserInfo(userId, userAddress, userName, userLoginType, typeLabel, l2Address) {
196
201
  this.userId = userId;
197
202
  this.userAddress = userAddress;
198
203
  this.userName = userName;
199
204
  this.userLoginType = userLoginType;
205
+ this.typeLabel = typeLabel;
200
206
  this.l2Address = l2Address ?? null;
201
207
  }
202
208
  };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  logger
4
- } from "./chunk-SBQ2UUPK.js";
4
+ } from "./chunk-H6F75ULR.js";
5
5
 
6
6
  // src/clients/fanatics.tsx
7
7
  import React7, { useEffect as useEffect2, useMemo as useMemo2 } from "react";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  logger
4
- } from "./chunk-SBQ2UUPK.js";
4
+ } from "./chunk-H6F75ULR.js";
5
5
 
6
6
  // src/clients/polymarket.tsx
7
7
  import {
@@ -24,8 +24,6 @@ interface ChainDropdownProps {
24
24
  maxDropdownHeight?: BaseDropdownProps['maxDropdownHeight'];
25
25
  tagComponent?: (value: string) => React.ReactNode;
26
26
  testId?: string;
27
- /** Default chain ID — promoted to first position in the dropdown */
28
- defaultChainId?: number;
29
27
  }
30
- export declare const ChainDropdown: ({ assets, chainIdSortOrder, selectedChainId: propSelectedChainId, selectedToken, allowUnselect, onChainSelected, activeItemProps, size, openDropdownBackgroundColor, openDropdownFullWidth, isLoading, alwaysOpenToTop, maxDropdownHeight, tagComponent, testId, defaultChainId, }: ChainDropdownProps) => React.JSX.Element;
28
+ export declare const ChainDropdown: ({ assets, chainIdSortOrder, selectedChainId: propSelectedChainId, selectedToken, allowUnselect, onChainSelected, activeItemProps, size, openDropdownBackgroundColor, openDropdownFullWidth, isLoading, alwaysOpenToTop, maxDropdownHeight, tagComponent, testId, }: ChainDropdownProps) => React.JSX.Element;
31
29
  export {};
@@ -30,9 +30,7 @@ interface TokenAndChainDropdownProps {
30
30
  priorityTokenSymbols?: string[];
31
31
  /** Determines the chain display order */
32
32
  chainIdSortOrder?: number[];
33
- /** Default chain ID — promoted to first position in chain dropdown */
34
- defaultChainId?: number;
35
33
  }
36
34
  /** Combines together chain and token dropdowns */
37
- export declare const TokenAndChainDropdown: ({ isLoading, selectedToken, selectedChainId, assets, onTokenSelected, onChainSelected, tokenLabel, chainLabel, chainLabelAddon, alwaysOpenToTop, maxTokenDropdownHeight, maxChainDropdownHeight, openChainDropdownFullWidth, chainTagComponent, hideNewTokenBadge, priorityTokenSymbols, chainIdSortOrder, defaultChainId, }: TokenAndChainDropdownProps) => React.JSX.Element;
35
+ export declare const TokenAndChainDropdown: ({ isLoading, selectedToken, selectedChainId, assets, onTokenSelected, onChainSelected, tokenLabel, chainLabel, chainLabelAddon, alwaysOpenToTop, maxTokenDropdownHeight, maxChainDropdownHeight, openChainDropdownFullWidth, chainTagComponent, hideNewTokenBadge, priorityTokenSymbols, chainIdSortOrder, }: TokenAndChainDropdownProps) => React.JSX.Element;
38
36
  export {};
@@ -0,0 +1,2 @@
1
+ import { type QuoteBuilder } from './types';
2
+ export declare function createExactInBuilder(): QuoteBuilder;
@@ -0,0 +1,2 @@
1
+ import { type QuoteBuilder } from './types';
2
+ export declare function createExactOutBuilder(): QuoteBuilder;
@@ -0,0 +1,15 @@
1
+ import type { Dnum } from 'dnum';
2
+ /**
3
+ * Hardcoded gas-unit estimate for a checkout transaction involving a
4
+ * native token. Checkout relay/swap transactions typically consume
5
+ * 300k–500k gas; we use 1M as a conservative baseline. The builder
6
+ * applies an additional 1.5x multiplier on top, giving ~1.5M effective.
7
+ */
8
+ export declare const CHECKOUT_GAS_UNITS = 1000000n;
9
+ /**
10
+ * Compute a gas cost estimate in wei as an 18-decimal Dnum.
11
+ *
12
+ * @param gasPriceWei - Current gas price in wei (e.g. from `getGasPrice`)
13
+ * @returns Gas estimate as a Dnum: [gasUnits * gasPriceWei, 18]
14
+ */
15
+ export declare function getGasEstimateWei(gasPriceWei: bigint): Dnum;
@@ -0,0 +1,9 @@
1
+ export { QuickOptionType, QuoteBuildType, QuoteMode, RetryActionType, RetryErrorReason, } from './types';
2
+ export type { QuoteBuilder, QuoteBuildResult, QuoteRetryError, RetryAction, QuoteDisplayAmounts, MaxSendableParams, } from './types';
3
+ export type { Dnum } from 'dnum';
4
+ export { createExactOutBuilder } from './exactOut';
5
+ export { createExactInBuilder } from './exactIn';
6
+ export { createOneToOneBuilder } from './oneToOne';
7
+ export { createQuoteBuilder, _resolveQuoteMode } from './resolveQuoteMode';
8
+ export type { CreateQuoteBuilderParams } from './resolveQuoteMode';
9
+ export { getGasEstimateWei, CHECKOUT_GAS_UNITS } from './gasEstimate';
@@ -0,0 +1,21 @@
1
+ import { type QuoteBuilder } from './types';
2
+ /**
3
+ * @TODO: Wire it up to UI components, currently it is not used.
4
+ * More about the purpose of this quote mode: https://www.notion.so/the-fun-group/Refactoring-Quote-Mode-Selection-Max-Button-Behavior-327fc3b2a00281eea8f0eb0a28a08045#8d7655b63b9c416a91021718702ffe8f
5
+ *
6
+ * ONE_TO_ONE is EXACT_IN with subsidized fees — the user sends X tokens and
7
+ * receives exactly X tokens on the destination chain. All bridge/relay fees
8
+ * are absorbed by the protocol, so send === receive and feesUsd === '0'.
9
+ *
10
+ * Mechanically it inherits all EXACT_IN behavior (max sendable calculation,
11
+ * quote request building, retry logic, quick options) and only overrides
12
+ * `getDisplayAmounts` to reflect the 1:1 guarantee.
13
+ *
14
+ * @TODO: Revisit whether ONE_TO_ONE should remain a separate builder or be
15
+ * collapsed into EXACT_IN with overrides. Jeremy suspects it may just be
16
+ * EXACT_IN with some config flags. Discuss with Connor before removing since
17
+ * it's in the approved design doc.
18
+ * See: https://fun-xyz.slack.com/archives/C0AN3BXPBNK/p1775167066455859
19
+ * Tracked: https://linear.app/funxyz/issue/ENG-3282/revisit-one-to-one-quote-mode-consider-collapsing-into-exact-in
20
+ */
21
+ export declare function createOneToOneBuilder(): QuoteBuilder;
@@ -0,0 +1,19 @@
1
+ import { type QuoteBuilder } from './types';
2
+ export interface CreateQuoteBuilderParams {
3
+ hasPostAction: boolean;
4
+ isExactInEnabled: boolean;
5
+ providerSupportsExactInWithActions?: boolean;
6
+ }
7
+ /**
8
+ * Determines the quote mode and returns the corresponding builder.
9
+ *
10
+ * Resolution order:
11
+ * 1. Feature gate off → EXACT_OUT (Stage 1 default)
12
+ * 2. No action params → EXACT_IN
13
+ * 3. Action params + provider supports → EXACT_IN
14
+ * 4. Action params + no support → EXACT_OUT
15
+ *
16
+ * Note: ONE_TO_ONE (subsidized routes) is not yet auto-detected.
17
+ * It will be enabled in a future phase when subsidy detection is implemented.
18
+ */
19
+ export declare function createQuoteBuilder({ hasPostAction, isExactInEnabled, providerSupportsExactInWithActions, }: CreateQuoteBuilderParams): QuoteBuilder;
@@ -0,0 +1,125 @@
1
+ import type { Dnum } from 'dnum';
2
+ import type { PaymentMethod } from '../../domains/paymentMethods';
3
+ import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
+ export declare enum QuoteMode {
5
+ EXACT_IN = "EXACT_IN",
6
+ EXACT_OUT = "EXACT_OUT",
7
+ ONE_TO_ONE = "ONE_TO_ONE"
8
+ }
9
+ export declare enum QuoteBuildType {
10
+ EXACT_IN = "exactIn",
11
+ EXACT_OUT = "exactOut"
12
+ }
13
+ export declare enum RetryActionType {
14
+ CALIBRATE_AMOUNT = "calibrateAmount",
15
+ REFETCH_BALANCE = "refetchBalance",
16
+ GIVE_UP = "giveUp"
17
+ }
18
+ export declare enum RetryErrorReason {
19
+ INSUFFICIENT_BALANCE = "insufficientBalance",
20
+ INSUFFICIENT_AMOUNT = "insufficientAmount",
21
+ INTERNAL = "internal"
22
+ }
23
+ export declare enum QuickOptionType {
24
+ SET_TOKEN_AMOUNT = "setTokenAmount",
25
+ SET_FIAT_AMOUNT = "setFiatAmount"
26
+ }
27
+ export interface QuoteRetryError {
28
+ reason: RetryErrorReason;
29
+ maxTargetAssetAmount?: Dnum;
30
+ minTargetAssetAmount?: Dnum;
31
+ }
32
+ export type QuoteBuildResult = {
33
+ type: QuoteBuildType.EXACT_IN;
34
+ fromAmountBaseUnit: string;
35
+ } | {
36
+ type: QuoteBuildType.EXACT_OUT;
37
+ toAmountBaseUnit: string;
38
+ };
39
+ export type RetryAction = {
40
+ type: RetryActionType.CALIBRATE_AMOUNT;
41
+ newAmountBaseUnit: Dnum;
42
+ } | {
43
+ type: RetryActionType.REFETCH_BALANCE;
44
+ } | {
45
+ type: RetryActionType.GIVE_UP;
46
+ };
47
+ export interface QuoteDisplayAmounts {
48
+ /** The primary dollar/token amount shown at the top of the confirmation screen */
49
+ confirmationScreenDisplayAmount: string;
50
+ /** "You send" line */
51
+ sendAmount: string;
52
+ /** "You receive" line */
53
+ receiveAmount: string;
54
+ /** Whether the send amount is exact (vs estimated) */
55
+ isSendExact: boolean;
56
+ /** Whether the receive amount is exact (vs estimated) */
57
+ isReceiveExact: boolean;
58
+ /** Total fees in USD. '0' for ONE_TO_ONE */
59
+ feesUsd: string;
60
+ }
61
+ export interface MaxSendableParams {
62
+ /** Token balance as a Dnum */
63
+ tokenBalanceBaseUnit: Dnum;
64
+ /** Whether the token is the chain's native token (ETH, MATIC, etc.) */
65
+ isNativeToken: boolean;
66
+ /** Estimated gas price in wei (required for native tokens) */
67
+ gasEstimateWei?: Dnum;
68
+ /** Token price in USD (used for fee estimation in token terms) */
69
+ unitPrice: number;
70
+ /** Checkout target chain ID */
71
+ targetChainId: string;
72
+ /** Source asset chain ID */
73
+ assetChainId: string;
74
+ /** Payment method */
75
+ paymentMethod: PaymentMethod | undefined;
76
+ }
77
+ export interface UsdAvailableAmountParams {
78
+ /** Source asset USD value */
79
+ assetUsdAmount: number | null | undefined;
80
+ /** Checkout target chain ID */
81
+ targetChainId: string;
82
+ /** Source asset chain ID */
83
+ assetChainId: string | undefined;
84
+ /** Payment method */
85
+ paymentMethod: PaymentMethod | undefined;
86
+ }
87
+ export interface QuoteBuilder {
88
+ readonly mode: QuoteMode;
89
+ /** Compute the USD available amount for the source asset, accounting for fees where applicable */
90
+ getUsdAvailableAmount(params: UsdAvailableAmountParams): number | null;
91
+ /** Compute max sendable token amount for the max button */
92
+ getMaxSendableAmount(params: MaxSendableParams): Dnum;
93
+ /** Build the quote request params from the user's input */
94
+ buildQuoteRequest(params: {
95
+ tokenAmountBaseUnit: Dnum;
96
+ }): QuoteBuildResult;
97
+ /** Handle quote failure. Returns action to take. */
98
+ handleRetry(params: {
99
+ error: QuoteRetryError;
100
+ }): RetryAction;
101
+ /** Derive display amounts for confirmation screen.
102
+ * @param inputAmount — the user's input in human-readable form (e.g., 15.9) */
103
+ getDisplayAmounts(quote: FunkitCheckoutQuoteResult, inputAmount: number): QuoteDisplayAmounts;
104
+ /** Whether the confirmation screen can show a dollar amount before the quote resolves */
105
+ hasKnownAmountBeforeQuote(config: {
106
+ targetAssetAmount?: number;
107
+ targetAssetTicker: string;
108
+ finalizedToken?: unknown;
109
+ }): boolean;
110
+ /** Compute the token/fiat amount for a quick-option percentage button.
111
+ * Returns the action to dispatch to the state reducer. */
112
+ computeQuickOptionAmount(params: {
113
+ percentage: number;
114
+ tokenBalanceBaseUnit: Dnum | null;
115
+ frozenUnitPrice: number | null;
116
+ usdAvailableAmount: number | null;
117
+ }): {
118
+ type: QuickOptionType.SET_TOKEN_AMOUNT;
119
+ tokenAmountBaseUnit: Dnum;
120
+ frozenUnitPrice: number;
121
+ } | {
122
+ type: QuickOptionType.SET_FIAT_AMOUNT;
123
+ fiatAmount: number;
124
+ };
125
+ }
@@ -9,4 +9,5 @@ export declare const useFops: () => {
9
9
  savedFormsOfPayments: SavedFormOfPayment[];
10
10
  } | undefined;
11
11
  isLoading: boolean;
12
+ isFetching: boolean;
12
13
  };
@@ -0,0 +1,9 @@
1
+ import { type GetFopsResponse } from '@funkit/api-base';
2
+ /**
3
+ * Hook to fetch available withdrawal forms of payment.
4
+ * MVP: Returns static mock data. Will be replaced with a real API call later.
5
+ */
6
+ export declare const useWithdrawFops: () => {
7
+ data: GetFopsResponse;
8
+ isLoading: boolean;
9
+ };
@@ -57,5 +57,6 @@ export declare enum CheckoutModalEvent {
57
57
  SWAPPED_IFRAME_NEW_DEPOSIT_BACK = "fc::swapped_iframe::new_deposit_back",
58
58
  SWAPPED_IFRAME_EXIT = "fc::swapped_iframe::exit",
59
59
  SWAPPED_IFRAME_ORDER_DATA = "fc::swapped_iframe::order_data",
60
+ SWAPPED_IFRAME_TRANSACTION_SUCCESSFUL = "fc::swapped_iframe::transaction_successful",
60
61
  SWAPPED_IFRAME_LOGOUT = "fc::swapped_iframe::logout"
61
62
  }
@@ -2,6 +2,9 @@ export declare enum WithdrawModalEvent {
2
2
  MODAL_OPENED = "fw::modal_opened",
3
3
  MODAL_READY = "fw::modal_ready",
4
4
  MODAL_CLOSED = "fw::modal_closed",
5
+ ENTER_AMOUNT_VIEWED = "fw::enter_amount_viewed",
6
+ CRYPTO_ADDRESS_SELECTED = "fw::crypto_address_selected",
7
+ CASH_FOP_SELECTED = "fw::cash_fop_selected",
5
8
  FINAL_QUOTE = "fw::quote::final_quote",
6
9
  VIEW_TRANSACTION_BREAKDOWN = "fw::quote::view_transaction_breakdown",
7
10
  PENDING_CALLBACK = "fw::pending_callback",
@@ -5,6 +5,7 @@ interface UseCheckoutTransferInitResponse {
5
5
  transferInit: CheckoutInitTokenTransferResponse | undefined;
6
6
  recipientAddr: FunAddress;
7
7
  isLoading: boolean;
8
+ isFetching: boolean;
8
9
  }
9
10
  type CheckoutTokenTransferParams = Omit<CheckoutInitTokenTransferAddressParams, 'logger' | 'clientMetadata'>;
10
11
  export declare function checkoutTransferFetch(params: CheckoutTokenTransferParams): Promise<CheckoutInitTokenTransferResponse>;
@@ -14,7 +14,6 @@ interface UseTokenChainResult {
14
14
  isLoadingAssets: boolean;
15
15
  chainIdSortOrder: number[];
16
16
  priorityTokenSymbols: string[];
17
- defaultChainId: number;
18
17
  }
19
18
  /**
20
19
  * Semi reusable hook (tied into token transfer configuration)
@@ -4,6 +4,12 @@ export type FeeValue = {
4
4
  label: string;
5
5
  value: number;
6
6
  };
7
+ export interface MinTransferConfig {
8
+ default: number;
9
+ chains: {
10
+ [chainId: string]: number;
11
+ };
12
+ }
7
13
  interface UseTokenTransferResult {
8
14
  /** where money goes to first */
9
15
  depositAddress: FunAddress | undefined;
@@ -21,16 +27,6 @@ interface UseTokenTransferResult {
21
27
  blockchain: 'ethereum' | 'solana' | 'bitcoin' | 'tron';
22
28
  }
23
29
  export declare const useTokenTransfer: (selectedChainId: number, selectedToken: string, chainIds?: number[]) => UseTokenTransferResult;
24
- /**
25
- * Differentiates limit for Canada/Australia users to avoid confusion with non american dollars
26
- */
27
- export declare const useMinTransferLimits: () => {
28
- mainnet: number;
29
- nonMainnet: number;
30
- };
31
- export declare function getMinTransferValueForChain(chainId: number, limits: {
32
- mainnet: number;
33
- nonMainnet: number;
34
- }): number;
30
+ export declare function getMinTransferValueForChain(chainId: number, limits: MinTransferConfig): number;
35
31
  export declare const useMinTransferValue: (selectedChainId: number) => number;
36
32
  export {};
@@ -1,2 +1,2 @@
1
1
  import type { TokenTransferConfig } from '../utils/tokenTransfer/types';
2
- export declare function useTokenTransferConfig(): TokenTransferConfig;
2
+ export declare function useTokenTransferConfig(isWithdrawal?: boolean): TokenTransferConfig;