@avail-project/widgets 0.0.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 (143) hide show
  1. package/README.md +34 -0
  2. package/dist/common/components/ErrorBoundary.d.ts +44 -0
  3. package/dist/common/components/ErrorBoundary.d.ts.map +1 -0
  4. package/dist/common/components/ErrorBoundary.js +65 -0
  5. package/dist/common/hooks/useDebouncedCallback.d.ts +13 -0
  6. package/dist/common/hooks/useDebouncedCallback.d.ts.map +1 -0
  7. package/dist/common/hooks/useDebouncedCallback.js +42 -0
  8. package/dist/common/hooks/useDebouncedValue.d.ts +5 -0
  9. package/dist/common/hooks/useDebouncedValue.d.ts.map +1 -0
  10. package/dist/common/hooks/useDebouncedValue.js +15 -0
  11. package/dist/common/hooks/useInterval.d.ts +11 -0
  12. package/dist/common/hooks/useInterval.d.ts.map +1 -0
  13. package/dist/common/hooks/useInterval.js +25 -0
  14. package/dist/common/hooks/useLatest.d.ts +12 -0
  15. package/dist/common/hooks/useLatest.d.ts.map +1 -0
  16. package/dist/common/hooks/useLatest.js +19 -0
  17. package/dist/common/hooks/useNexusError.d.ts +20 -0
  18. package/dist/common/hooks/useNexusError.d.ts.map +1 -0
  19. package/dist/common/hooks/useNexusError.js +120 -0
  20. package/dist/common/hooks/usePolling.d.ts +7 -0
  21. package/dist/common/hooks/usePolling.d.ts.map +1 -0
  22. package/dist/common/hooks/usePolling.js +29 -0
  23. package/dist/common/hooks/useStableCallback.d.ts +6 -0
  24. package/dist/common/hooks/useStableCallback.d.ts.map +1 -0
  25. package/dist/common/hooks/useStableCallback.js +13 -0
  26. package/dist/common/hooks/useStopwatch.d.ts +17 -0
  27. package/dist/common/hooks/useStopwatch.d.ts.map +1 -0
  28. package/dist/common/hooks/useStopwatch.js +44 -0
  29. package/dist/common/hooks/useTransactionExecution.d.ts +62 -0
  30. package/dist/common/hooks/useTransactionExecution.d.ts.map +1 -0
  31. package/dist/common/hooks/useTransactionExecution.js +273 -0
  32. package/dist/common/hooks/useTransactionFlow.d.ts +71 -0
  33. package/dist/common/hooks/useTransactionFlow.d.ts.map +1 -0
  34. package/dist/common/hooks/useTransactionFlow.js +435 -0
  35. package/dist/common/index.d.ts +17 -0
  36. package/dist/common/index.d.ts.map +1 -0
  37. package/dist/common/index.js +16 -0
  38. package/dist/common/tx/steps.d.ts +19 -0
  39. package/dist/common/tx/steps.d.ts.map +1 -0
  40. package/dist/common/tx/steps.js +89 -0
  41. package/dist/common/tx/types.d.ts +11 -0
  42. package/dist/common/tx/types.d.ts.map +1 -0
  43. package/dist/common/tx/types.js +19 -0
  44. package/dist/common/tx/useTransactionSteps.d.ts +21 -0
  45. package/dist/common/tx/useTransactionSteps.d.ts.map +1 -0
  46. package/dist/common/tx/useTransactionSteps.js +40 -0
  47. package/dist/common/types/transaction-flow.d.ts +48 -0
  48. package/dist/common/types/transaction-flow.d.ts.map +1 -0
  49. package/dist/common/types/transaction-flow.js +2 -0
  50. package/dist/common/utils/constant.d.ts +99 -0
  51. package/dist/common/utils/constant.d.ts.map +1 -0
  52. package/dist/common/utils/constant.js +370 -0
  53. package/dist/common/utils/token-pricing.d.ts +33 -0
  54. package/dist/common/utils/token-pricing.d.ts.map +1 -0
  55. package/dist/common/utils/token-pricing.js +255 -0
  56. package/dist/common/utils/transaction-flow.d.ts +35 -0
  57. package/dist/common/utils/transaction-flow.d.ts.map +1 -0
  58. package/dist/common/utils/transaction-flow.js +65 -0
  59. package/dist/index.d.ts +5 -0
  60. package/dist/index.d.ts.map +1 -0
  61. package/dist/index.js +2 -0
  62. package/dist/lib/utils.d.ts +4 -0
  63. package/dist/lib/utils.d.ts.map +1 -0
  64. package/dist/lib/utils.js +8 -0
  65. package/dist/nexus/NexusProvider.d.ts +50 -0
  66. package/dist/nexus/NexusProvider.d.ts.map +1 -0
  67. package/dist/nexus/NexusProvider.js +572 -0
  68. package/dist/nexus-widget/components/address-identicon.d.ts +5 -0
  69. package/dist/nexus-widget/components/address-identicon.d.ts.map +1 -0
  70. package/dist/nexus-widget/components/address-identicon.js +39 -0
  71. package/dist/nexus-widget/components/amount-input-unified.d.ts +18 -0
  72. package/dist/nexus-widget/components/amount-input-unified.d.ts.map +1 -0
  73. package/dist/nexus-widget/components/amount-input-unified.js +88 -0
  74. package/dist/nexus-widget/components/deposit-idle-form.d.ts +29 -0
  75. package/dist/nexus-widget/components/deposit-idle-form.d.ts.map +1 -0
  76. package/dist/nexus-widget/components/deposit-idle-form.js +506 -0
  77. package/dist/nexus-widget/components/nexus-widget-progress-screen.d.ts +36 -0
  78. package/dist/nexus-widget/components/nexus-widget-progress-screen.d.ts.map +1 -0
  79. package/dist/nexus-widget/components/nexus-widget-progress-screen.js +737 -0
  80. package/dist/nexus-widget/components/pay-using-selector.d.ts +9 -0
  81. package/dist/nexus-widget/components/pay-using-selector.d.ts.map +1 -0
  82. package/dist/nexus-widget/components/pay-using-selector.js +37 -0
  83. package/dist/nexus-widget/components/pay-with-sources.d.ts +11 -0
  84. package/dist/nexus-widget/components/pay-with-sources.d.ts.map +1 -0
  85. package/dist/nexus-widget/components/pay-with-sources.js +266 -0
  86. package/dist/nexus-widget/components/receive-asset-selector.d.ts +28 -0
  87. package/dist/nexus-widget/components/receive-asset-selector.d.ts.map +1 -0
  88. package/dist/nexus-widget/components/receive-asset-selector.js +1178 -0
  89. package/dist/nexus-widget/components/recipient-input.d.ts +10 -0
  90. package/dist/nexus-widget/components/recipient-input.d.ts.map +1 -0
  91. package/dist/nexus-widget/components/recipient-input.js +44 -0
  92. package/dist/nexus-widget/components/send-idle-form.d.ts +29 -0
  93. package/dist/nexus-widget/components/send-idle-form.d.ts.map +1 -0
  94. package/dist/nexus-widget/components/send-idle-form.js +548 -0
  95. package/dist/nexus-widget/components/status-alerts.d.ts +7 -0
  96. package/dist/nexus-widget/components/status-alerts.d.ts.map +1 -0
  97. package/dist/nexus-widget/components/status-alerts.js +17 -0
  98. package/dist/nexus-widget/components/swap-asset-selector.d.ts +74 -0
  99. package/dist/nexus-widget/components/swap-asset-selector.d.ts.map +1 -0
  100. package/dist/nexus-widget/components/swap-asset-selector.js +1910 -0
  101. package/dist/nexus-widget/components/swap-idle-form.d.ts +29 -0
  102. package/dist/nexus-widget/components/swap-idle-form.d.ts.map +1 -0
  103. package/dist/nexus-widget/components/swap-idle-form.js +1289 -0
  104. package/dist/nexus-widget/components/swap-intent-preview.d.ts +95 -0
  105. package/dist/nexus-widget/components/swap-intent-preview.d.ts.map +1 -0
  106. package/dist/nexus-widget/components/swap-intent-preview.js +1050 -0
  107. package/dist/nexus-widget/nexus-widget.d.ts +4 -0
  108. package/dist/nexus-widget/nexus-widget.d.ts.map +1 -0
  109. package/dist/nexus-widget/nexus-widget.js +7819 -0
  110. package/dist/nexus-widget/sdk-types.d.ts +13 -0
  111. package/dist/nexus-widget/sdk-types.d.ts.map +1 -0
  112. package/dist/nexus-widget/sdk-types.js +1 -0
  113. package/dist/nexus-widget/theme.d.ts +156 -0
  114. package/dist/nexus-widget/theme.d.ts.map +1 -0
  115. package/dist/nexus-widget/theme.js +159 -0
  116. package/dist/nexus-widget/types.d.ts +141 -0
  117. package/dist/nexus-widget/types.d.ts.map +1 -0
  118. package/dist/nexus-widget/types.js +1 -0
  119. package/dist/nexus-widget/utils/citrea-tokens.d.ts +82 -0
  120. package/dist/nexus-widget/utils/citrea-tokens.d.ts.map +1 -0
  121. package/dist/nexus-widget/utils/citrea-tokens.js +136 -0
  122. package/dist/nexus-widget/utils/deposit-source-selection.d.ts +55 -0
  123. package/dist/nexus-widget/utils/deposit-source-selection.d.ts.map +1 -0
  124. package/dist/nexus-widget/utils/deposit-source-selection.js +219 -0
  125. package/dist/swaps/components/stacked-token-icons.d.ts +15 -0
  126. package/dist/swaps/components/stacked-token-icons.d.ts.map +1 -0
  127. package/dist/swaps/components/stacked-token-icons.js +38 -0
  128. package/dist/swaps/components/step-flow.d.ts +32 -0
  129. package/dist/swaps/components/step-flow.d.ts.map +1 -0
  130. package/dist/swaps/components/step-flow.js +54 -0
  131. package/dist/swaps/components/token-icon.d.ts +11 -0
  132. package/dist/swaps/components/token-icon.d.ts.map +1 -0
  133. package/dist/swaps/components/token-icon.js +16 -0
  134. package/dist/swaps/components/transaction-progress.d.ts +43 -0
  135. package/dist/swaps/components/transaction-progress.d.ts.map +1 -0
  136. package/dist/swaps/components/transaction-progress.js +94 -0
  137. package/dist/ui/button.d.ts +11 -0
  138. package/dist/ui/button.d.ts.map +1 -0
  139. package/dist/ui/button.js +34 -0
  140. package/dist/ui/dialog.d.ts +17 -0
  141. package/dist/ui/dialog.d.ts.map +1 -0
  142. package/dist/ui/dialog.js +47 -0
  143. package/package.json +60 -0
@@ -0,0 +1,136 @@
1
+ // biome-ignore-all lint: NexusWidget registry component from shadcn registry.
2
+ import { CHAIN_METADATA } from "../../common";
3
+ import { getShortChainName } from "../../common/utils/constant";
4
+ export const CITREA_CHAIN_ID = 4114;
5
+ const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
6
+ const E_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
7
+ const CITREA_CHAIN_FALLBACK = {
8
+ logo: "https://raw.githubusercontent.com/availproject/nexus-assets/main/chains/citrea/logo.png",
9
+ name: "Citrea Mainnet",
10
+ };
11
+ export const CITREA_STABLE_SYMBOLS = [
12
+ "ctUSD",
13
+ "USDC.e",
14
+ "JUSD",
15
+ "svJUSD",
16
+ "GUSD",
17
+ "USDT.e",
18
+ ];
19
+ export const CITREA_LOCAL_TOKENS = [
20
+ {
21
+ address: ZERO_ADDRESS,
22
+ decimals: 18,
23
+ logo: "https://assets.coingecko.com/coins/images/102172844/standard/cBTC.png",
24
+ name: "Citrea Bitcoin",
25
+ symbol: "cBTC",
26
+ type: "NATIVE",
27
+ },
28
+ {
29
+ address: "0x3100000000000000000000000000000000000006",
30
+ decimals: 18,
31
+ logo: "https://assets.coingecko.com/coins/images/102172843/standard/cBTC.png",
32
+ name: "Wrapped Citrea Bitcoin",
33
+ symbol: "wcBTC",
34
+ },
35
+ {
36
+ address: "0x8D82c4E3c936C7B5724A382a9c5a4E6Eb7aB6d5D",
37
+ decimals: 6,
38
+ logo: "https://assets.coingecko.com/coins/images/71615/standard/ctUSD.png",
39
+ name: "Citrea USD",
40
+ symbol: "ctUSD",
41
+ type: "STABLE",
42
+ },
43
+ {
44
+ address: "0xE045e6c36cF77FAA2CfB54466D71A3aEF7bbE839",
45
+ decimals: 6,
46
+ logo: "https://assets.coingecko.com/coins/images/6319/standard/USDC.png",
47
+ name: "Bridged USDC",
48
+ symbol: "USDC.e",
49
+ type: "STABLE",
50
+ },
51
+ {
52
+ address: "0x0987D3720D38847ac6dBB9D025B9dE892a3CA35C",
53
+ decimals: 18,
54
+ logo: "https://assets.coingecko.com/coins/images/102172725/standard/JUSD_192x192_App_Icon.png",
55
+ name: "Juice Dollar",
56
+ symbol: "JUSD",
57
+ type: "STABLE",
58
+ },
59
+ {
60
+ address: "0x384157027B1CDEAc4e26e3709667BB28735379Bb",
61
+ decimals: 8,
62
+ logo: "https://assets.coingecko.com/coins/images/102172893/standard/syBTC.png",
63
+ name: "Symbiosis BTC",
64
+ symbol: "syBTC",
65
+ },
66
+ {
67
+ address: "0x1b70ae756b1089cc5948e4f8a2AD498DF30E897d",
68
+ decimals: 18,
69
+ logo: "https://assets.coingecko.com/coins/images/102172892/standard/JuiceDollar_Coinlogo.png",
70
+ name: "Savings Vault JUSD",
71
+ symbol: "svJUSD",
72
+ type: "STABLE",
73
+ },
74
+ {
75
+ address: "0xAC8c1AEB584765DB16ac3e08D4736CFcE198589B",
76
+ decimals: 18,
77
+ logo: "https://assets.coingecko.com/coins/images/71672/large/GUSD.png",
78
+ name: "Generic Dollar",
79
+ symbol: "GUSD",
80
+ type: "STABLE",
81
+ },
82
+ {
83
+ address: "0xDF240DC08B0FdaD1d93b74d5048871232f6BEA3d",
84
+ decimals: 8,
85
+ logo: "https://coin-images.coingecko.com/coins/images/7598/large/WBTCLOGO.png",
86
+ name: "Bridged Wrapped Bitcoin",
87
+ symbol: "WBTC.e",
88
+ },
89
+ {
90
+ address: "0x9f3096Bac87e7F03DC09b0B416eB0DF837304dc4",
91
+ decimals: 6,
92
+ logo: "https://coin-images.coingecko.com/coins/images/325/large/Tether.png",
93
+ name: "Bridged USDT",
94
+ symbol: "USDT.e",
95
+ type: "STABLE",
96
+ },
97
+ ];
98
+ const normalizeAddress = (address) => {
99
+ const lower = address?.toLowerCase();
100
+ if (!lower)
101
+ return "";
102
+ if (lower === E_ADDRESS)
103
+ return ZERO_ADDRESS;
104
+ return lower;
105
+ };
106
+ export const getCitreaChainMeta = () => ({
107
+ logo: CHAIN_METADATA[CITREA_CHAIN_ID]?.logo ?? CITREA_CHAIN_FALLBACK.logo,
108
+ name: getShortChainName(CITREA_CHAIN_ID, CHAIN_METADATA[CITREA_CHAIN_ID]?.name ?? CITREA_CHAIN_FALLBACK.name),
109
+ });
110
+ export const getCitreaReceiveTokenOptions = () => {
111
+ const chain = getCitreaChainMeta();
112
+ return CITREA_LOCAL_TOKENS.map((token) => ({
113
+ balance: `0 ${token.symbol}`,
114
+ balanceInFiat: "$0.00",
115
+ chainId: CITREA_CHAIN_ID,
116
+ chainLogo: chain.logo,
117
+ chainName: chain.name,
118
+ contractAddress: token.address,
119
+ decimals: token.decimals,
120
+ logo: token.logo,
121
+ name: token.name,
122
+ symbol: token.symbol,
123
+ }));
124
+ };
125
+ export const findCitreaReceiveToken = ({ address, chainId, symbol, }) => {
126
+ if (chainId !== CITREA_CHAIN_ID)
127
+ return undefined;
128
+ const normalizedAddress = normalizeAddress(address);
129
+ const normalizedSymbol = symbol?.toLowerCase();
130
+ return getCitreaReceiveTokenOptions().find((token) => {
131
+ const addressMatches = normalizedAddress &&
132
+ normalizeAddress(token.contractAddress) === normalizedAddress;
133
+ const symbolMatches = normalizedSymbol && token.symbol.toLowerCase() === normalizedSymbol;
134
+ return Boolean(addressMatches || symbolMatches);
135
+ });
136
+ };
@@ -0,0 +1,55 @@
1
+ import { type Hex } from "viem";
2
+ import type { UserAsset } from "../../nexus/NexusProvider";
3
+ export type DepositSourceFilter = "all" | "stablecoins" | "native" | "custom";
4
+ type DepositSourceDestination = {
5
+ chainId: number;
6
+ tokenAddress: `0x${string}`;
7
+ tokenSymbol: string;
8
+ };
9
+ export declare const getDepositSourceId: (tokenAddress: string, chainId: number) => string;
10
+ export declare const parseDepositSourceId: (sourceId: string) => {
11
+ tokenAddress: Hex;
12
+ chainId: number;
13
+ } | null;
14
+ export declare const buildDepositSourcePoolIds: (params: {
15
+ swapBalance: UserAsset[] | null;
16
+ filter: DepositSourceFilter;
17
+ selectedSourceIds: Iterable<string>;
18
+ isManualSelection: boolean;
19
+ }) => string[];
20
+ export declare const buildPrioritySelectedSourceIds: (params: {
21
+ swapBalance: UserAsset[] | null;
22
+ destination: DepositSourceDestination;
23
+ minimumBalanceUsd: number;
24
+ targetAmountUsd?: number;
25
+ sourceIds?: Iterable<string>;
26
+ }) => string[];
27
+ export declare const buildSortedFromSources: (params: {
28
+ sourceIds: Iterable<string>;
29
+ swapBalance: UserAsset[] | null;
30
+ destination: DepositSourceDestination;
31
+ minimumBalanceUsd?: number;
32
+ }) => Array<{
33
+ tokenAddress: Hex;
34
+ chainId: number;
35
+ }>;
36
+ export interface ResolvedDepositSourceSelection {
37
+ fromSources: Array<{
38
+ tokenAddress: Hex;
39
+ chainId: number;
40
+ }>;
41
+ selectedSourceIds: string[];
42
+ sourcePoolIds: string[];
43
+ }
44
+ export declare const resolveDepositSourceSelection: (params: {
45
+ swapBalance: UserAsset[] | null;
46
+ destination: DepositSourceDestination;
47
+ filter: DepositSourceFilter;
48
+ selectedSourceIds: Iterable<string>;
49
+ isManualSelection: boolean;
50
+ minimumBalanceUsd: number;
51
+ targetAmountUsd?: number;
52
+ excludedSourceIds?: Iterable<string>;
53
+ }) => ResolvedDepositSourceSelection;
54
+ export {};
55
+ //# sourceMappingURL=deposit-source-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deposit-source-selection.d.ts","sourceRoot":"","sources":["../../../.build-src/nexus-widget/utils/deposit-source-selection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,GAAG,EAAU,MAAM,MAAM,CAAC;AAExC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE9E,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA2CF,eAAO,MAAM,kBAAkB,GAC7B,cAAc,MAAM,EACpB,SAAS,MAAM,KACd,MAAsC,CAAC;AAE1C,eAAO,MAAM,oBAAoB,GAC/B,UAAU,MAAM,KACf;IAAE,YAAY,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAS3C,CAAC;AAiHF,eAAO,MAAM,yBAAyB,GAAI,QAAQ;IAChD,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;CAC5B,KAAG,MAAM,EA8BT,CAAC;AAEF,eAAO,MAAM,8BAA8B,GAAI,QAAQ;IACrD,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,wBAAwB,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC9B,KAAG,MAAM,EAoDT,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,QAAQ;IAC7C,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,wBAAwB,CAAC;IACtC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,KAAG,KAAK,CAAC;IAAE,YAAY,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAGsB,CAAC;AAEvE,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,GAAG,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC3D,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,6BAA6B,GAAI,QAAQ;IACpD,WAAW,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAChC,WAAW,EAAE,wBAAwB,CAAC;IACtC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACpC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CACtC,KAAG,8BA6CH,CAAC"}
@@ -0,0 +1,219 @@
1
+ // biome-ignore-all lint: NexusWidget registry component from shadcn registry.
2
+ import { padHex } from "viem";
3
+ import { CHAIN_METADATA } from "../../common";
4
+ const STABLECOIN_SYMBOLS = ["USDC", "USDT", "DAI", "TUSD", "USDP"];
5
+ const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
6
+ const EVM_NATIVE_PLACEHOLDER = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
7
+ const MAX_PRIORITY_RANK = Number.MAX_SAFE_INTEGER;
8
+ const sortSourcesByPriority = (swapBalance, _destination) => swapBalance
9
+ .flatMap((asset) => asset.breakdown ?? [])
10
+ .sort((a, b) => parseNonNegativeNumber(b.balanceInFiat) -
11
+ parseNonNegativeNumber(a.balanceInFiat))
12
+ .map((breakdown) => ({
13
+ chainID: breakdown.chain.id,
14
+ tokenAddress: breakdown.contractAddress,
15
+ }));
16
+ const parseNonNegativeNumber = (value) => {
17
+ const parsed = Number.parseFloat(String(value));
18
+ if (!Number.isFinite(parsed) || parsed < 0)
19
+ return 0;
20
+ return parsed;
21
+ };
22
+ const normalizeAddress = (address) => address.toLowerCase();
23
+ const toComparableSdkAddress = (address) => {
24
+ const normalized = normalizeAddress(address);
25
+ const effectiveAddress = normalized === ZERO_ADDRESS ? EVM_NATIVE_PLACEHOLDER : normalized;
26
+ try {
27
+ return padHex(effectiveAddress, { size: 32 }).toLowerCase();
28
+ }
29
+ catch {
30
+ return effectiveAddress;
31
+ }
32
+ };
33
+ export const getDepositSourceId = (tokenAddress, chainId) => `${tokenAddress}-${chainId}`;
34
+ export const parseDepositSourceId = (sourceId) => {
35
+ const separatorIndex = sourceId.lastIndexOf("-");
36
+ if (separatorIndex <= 0)
37
+ return null;
38
+ const tokenAddress = sourceId.slice(0, separatorIndex);
39
+ const chainId = Number.parseInt(sourceId.slice(separatorIndex + 1), 10);
40
+ if (!Number.isInteger(chainId) || chainId <= 0)
41
+ return null;
42
+ return { tokenAddress, chainId };
43
+ };
44
+ const isStablecoin = (symbol) => STABLECOIN_SYMBOLS.includes((symbol ?? "").toUpperCase());
45
+ const isNative = (symbol) => {
46
+ const normalized = (symbol ?? "").toUpperCase();
47
+ if (!normalized)
48
+ return false;
49
+ return Object.values(CHAIN_METADATA).some((chain) => chain.nativeCurrency.symbol.toUpperCase() === normalized);
50
+ };
51
+ const getFiatLookupKey = (tokenAddress, chainId) => `${normalizeAddress(tokenAddress)}-${chainId}`;
52
+ const getPriorityLookupKey = (tokenAddress, chainId) => `${toComparableSdkAddress(tokenAddress)}-${chainId}`;
53
+ const buildSourceFiatByKeyMap = (swapBalance) => {
54
+ const map = new Map();
55
+ if (!swapBalance)
56
+ return map;
57
+ for (const asset of swapBalance) {
58
+ for (const breakdown of asset.breakdown ?? []) {
59
+ const chainId = breakdown.chain?.id;
60
+ const tokenAddress = breakdown.contractAddress;
61
+ if (!chainId || !tokenAddress)
62
+ continue;
63
+ map.set(getFiatLookupKey(tokenAddress, chainId), parseNonNegativeNumber(breakdown.balanceInFiat));
64
+ }
65
+ }
66
+ return map;
67
+ };
68
+ const buildPriorityRankMap = (swapBalance, destination) => {
69
+ const map = new Map();
70
+ if (!swapBalance?.length)
71
+ return map;
72
+ const sortedSources = sortSourcesByPriority(swapBalance, destination);
73
+ sortedSources.forEach((source, index) => {
74
+ map.set(getPriorityLookupKey(source.tokenAddress, source.chainID), index);
75
+ });
76
+ return map;
77
+ };
78
+ const buildSortedSourceCandidates = (params) => {
79
+ const { sourceIds, swapBalance, destination, minimumBalanceUsd } = params;
80
+ const uniqueIds = [...new Set(sourceIds)];
81
+ if (uniqueIds.length === 0)
82
+ return [];
83
+ const sourceFiatByKeyMap = buildSourceFiatByKeyMap(swapBalance);
84
+ const priorityRankMap = buildPriorityRankMap(swapBalance, destination);
85
+ return uniqueIds
86
+ .map((sourceId) => {
87
+ const parsed = parseDepositSourceId(sourceId);
88
+ if (!parsed)
89
+ return null;
90
+ const fiatKey = getFiatLookupKey(parsed.tokenAddress, parsed.chainId);
91
+ const priorityKey = getPriorityLookupKey(parsed.tokenAddress, parsed.chainId);
92
+ return {
93
+ sourceId,
94
+ balanceInFiat: sourceFiatByKeyMap.get(fiatKey) ?? 0,
95
+ priorityRank: priorityRankMap.get(priorityKey) ?? MAX_PRIORITY_RANK,
96
+ };
97
+ })
98
+ .filter((item) => {
99
+ if (!item)
100
+ return false;
101
+ if (minimumBalanceUsd == null)
102
+ return true;
103
+ return item.balanceInFiat >= minimumBalanceUsd;
104
+ })
105
+ .sort((a, b) => {
106
+ if (a.priorityRank !== b.priorityRank) {
107
+ return a.priorityRank - b.priorityRank;
108
+ }
109
+ if (a.balanceInFiat !== b.balanceInFiat) {
110
+ return b.balanceInFiat - a.balanceInFiat;
111
+ }
112
+ return a.sourceId.localeCompare(b.sourceId);
113
+ });
114
+ };
115
+ const sortSourceIdsByPriority = (params) => buildSortedSourceCandidates(params).map((item) => item.sourceId);
116
+ export const buildDepositSourcePoolIds = (params) => {
117
+ const { swapBalance, filter, selectedSourceIds, isManualSelection } = params;
118
+ const selectedSourceIdSet = new Set(selectedSourceIds);
119
+ if (isManualSelection) {
120
+ return [...selectedSourceIdSet];
121
+ }
122
+ const sourceIds = new Set();
123
+ swapBalance?.forEach((asset) => {
124
+ asset.breakdown?.forEach((breakdown) => {
125
+ const chainId = breakdown.chain?.id;
126
+ const tokenAddress = breakdown.contractAddress;
127
+ if (!chainId || !tokenAddress)
128
+ return;
129
+ const stable = isStablecoin(breakdown.symbol ?? asset.symbol);
130
+ const native = isNative(breakdown.symbol ?? asset.symbol);
131
+ const sourceId = getDepositSourceId(tokenAddress, chainId);
132
+ const include = filter === "all" ||
133
+ (filter === "stablecoins" && stable) ||
134
+ (filter === "native" && native) ||
135
+ (filter === "custom" && selectedSourceIdSet.has(sourceId));
136
+ if (include)
137
+ sourceIds.add(sourceId);
138
+ });
139
+ });
140
+ return [...sourceIds];
141
+ };
142
+ export const buildPrioritySelectedSourceIds = (params) => {
143
+ const { swapBalance, destination, minimumBalanceUsd, targetAmountUsd, sourceIds, } = params;
144
+ const requestedSourceIds = sourceIds ? [...new Set(sourceIds)] : undefined;
145
+ const orderedCandidateSourceIds = requestedSourceIds
146
+ ? sortSourceIdsByPriority({
147
+ sourceIds: requestedSourceIds,
148
+ swapBalance,
149
+ destination,
150
+ minimumBalanceUsd,
151
+ })
152
+ : sortSourceIdsByPriority({
153
+ sourceIds: buildDepositSourcePoolIds({
154
+ swapBalance,
155
+ filter: "all",
156
+ selectedSourceIds: [],
157
+ isManualSelection: false,
158
+ }),
159
+ swapBalance,
160
+ destination,
161
+ minimumBalanceUsd,
162
+ });
163
+ if (orderedCandidateSourceIds.length === 0)
164
+ return [];
165
+ const normalizedTargetAmountUsd = parseNonNegativeNumber(targetAmountUsd);
166
+ if (normalizedTargetAmountUsd <= 0)
167
+ return [orderedCandidateSourceIds[0]];
168
+ const sourceFiatByKeyMap = buildSourceFiatByKeyMap(swapBalance);
169
+ const selectedSourceIds = [];
170
+ let runningTotalUsd = 0;
171
+ for (const sourceId of orderedCandidateSourceIds) {
172
+ const parsed = parseDepositSourceId(sourceId);
173
+ if (!parsed)
174
+ continue;
175
+ selectedSourceIds.push(sourceId);
176
+ runningTotalUsd +=
177
+ sourceFiatByKeyMap.get(getFiatLookupKey(parsed.tokenAddress, parsed.chainId)) ?? 0;
178
+ if (runningTotalUsd >= normalizedTargetAmountUsd)
179
+ break;
180
+ }
181
+ return selectedSourceIds;
182
+ };
183
+ export const buildSortedFromSources = (params) => sortSourceIdsByPriority(params)
184
+ .map((sourceId) => parseDepositSourceId(sourceId))
185
+ .filter((item) => Boolean(item));
186
+ export const resolveDepositSourceSelection = (params) => {
187
+ const { swapBalance, destination, excludedSourceIds, filter, selectedSourceIds, isManualSelection, minimumBalanceUsd, targetAmountUsd, } = params;
188
+ const excludedSourceIdSet = new Set(excludedSourceIds ?? []);
189
+ const sourcePoolIds = buildDepositSourcePoolIds({
190
+ swapBalance,
191
+ filter,
192
+ selectedSourceIds,
193
+ isManualSelection,
194
+ }).filter((sourceId) => !excludedSourceIdSet.has(sourceId));
195
+ const resolvedSelectedSourceIds = isManualSelection
196
+ ? sortSourceIdsByPriority({
197
+ sourceIds: sourcePoolIds,
198
+ swapBalance,
199
+ destination,
200
+ minimumBalanceUsd,
201
+ })
202
+ : buildPrioritySelectedSourceIds({
203
+ swapBalance,
204
+ destination,
205
+ minimumBalanceUsd,
206
+ targetAmountUsd,
207
+ sourceIds: sourcePoolIds,
208
+ });
209
+ return {
210
+ sourcePoolIds,
211
+ selectedSourceIds: resolvedSelectedSourceIds,
212
+ fromSources: buildSortedFromSources({
213
+ sourceIds: resolvedSelectedSourceIds,
214
+ swapBalance,
215
+ destination,
216
+ minimumBalanceUsd,
217
+ }),
218
+ };
219
+ };
@@ -0,0 +1,15 @@
1
+ type StackedIconSize = "sm" | "md" | "lg";
2
+ interface TokenSource {
3
+ tokenLogo?: string;
4
+ chainLogo?: string;
5
+ symbol?: string;
6
+ }
7
+ interface StackedTokenIconsProps {
8
+ sources: TokenSource[];
9
+ size?: StackedIconSize;
10
+ maxDisplay?: number;
11
+ className?: string;
12
+ }
13
+ export declare const StackedTokenIcons: ({ sources, size, maxDisplay, className, }: StackedTokenIconsProps) => import("react/jsx-runtime").JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=stacked-token-icons.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stacked-token-icons.d.ts","sourceRoot":"","sources":["../../../.build-src/swaps/components/stacked-token-icons.tsx"],"names":[],"mappings":"AAIA,KAAK,eAAe,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAc1C,UAAU,WAAW;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,sBAAsB;IAC9B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,GAAI,2CAK/B,sBAAsB,4CAwFxB,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/utils";
4
+ const SIZE_MAP = {
5
+ sm: 24,
6
+ md: 32,
7
+ lg: 40,
8
+ };
9
+ const OVERLAP_MAP = {
10
+ sm: 12,
11
+ md: 16,
12
+ lg: 20,
13
+ };
14
+ export const StackedTokenIcons = ({ sources, size = "md", maxDisplay = 4, className, }) => {
15
+ const dimension = SIZE_MAP[size];
16
+ const overlap = OVERLAP_MAP[size];
17
+ const displaySources = sources.slice(0, maxDisplay);
18
+ const remainingCount = sources.length - maxDisplay;
19
+ // Calculate total width based on number of icons
20
+ const totalWidth = displaySources.length > 0
21
+ ? dimension + (displaySources.length - 1) * (dimension - overlap)
22
+ : 0;
23
+ return (_jsxs("span", { className: cn("relative inline-flex items-center", className), style: { width: totalWidth, height: dimension }, children: [displaySources.map((source, index) => (_jsx("span", { className: "absolute inline-flex", style: {
24
+ left: index * (dimension - overlap),
25
+ zIndex: displaySources.length - index,
26
+ }, children: _jsxs("span", { className: "relative inline-flex", children: [source.tokenLogo ? (_jsx("img", { src: source.tokenLogo, alt: source.symbol ?? "token", width: dimension, height: dimension, className: "rounded-full object-cover border-2 border-background" })) : (_jsx("span", { className: cn("rounded-full bg-ring/80 text-muted-foreground flex items-center justify-center font-semibold uppercase border-2 border-background", {
27
+ "h-6 w-6 text-xs": size === "sm",
28
+ "h-8 w-8 text-sm": size === "md",
29
+ "h-10 w-10 text-base": size === "lg",
30
+ }), children: source.symbol?.charAt(0) ?? "?" })), source.chainLogo && (_jsx("span", { className: "absolute -bottom-0.5 -right-0.5 rounded-full border border-background bg-background", children: _jsx("img", { src: source.chainLogo, alt: "chain logo", width: Math.max(12, dimension * 0.35), height: Math.max(12, dimension * 0.35), className: "rounded-full object-cover" }) }))] }) }, `${source.symbol}-${index}`))), remainingCount > 0 && (_jsx("span", { className: "absolute inline-flex", style: {
31
+ left: displaySources.length * (dimension - overlap),
32
+ zIndex: 0,
33
+ }, children: _jsxs("span", { className: cn("rounded-full bg-muted text-muted-foreground flex items-center justify-center font-medium border-2 border-background", {
34
+ "h-6 w-6 text-[10px]": size === "sm",
35
+ "h-8 w-8 text-xs": size === "md",
36
+ "h-10 w-10 text-sm": size === "lg",
37
+ }), children: ["+", remainingCount] }) }))] }));
38
+ };
@@ -0,0 +1,32 @@
1
+ import { type FC } from "react";
2
+ import { type DisplayStep } from "./transaction-progress";
3
+ interface TokenSource {
4
+ tokenLogo: string;
5
+ chainLogo: string;
6
+ symbol: string;
7
+ }
8
+ interface StepFlowProps {
9
+ steps: DisplayStep[];
10
+ currentIndex: number;
11
+ totalSteps: number;
12
+ explorerUrls: {
13
+ sourceExplorerUrl: string | null;
14
+ destinationExplorerUrl: string | null;
15
+ };
16
+ sourceSymbol: string;
17
+ destinationSymbol: string;
18
+ sourceLogos: {
19
+ token: string;
20
+ chain: string;
21
+ };
22
+ destinationLogos: {
23
+ token: string;
24
+ chain: string;
25
+ };
26
+ allCompleted: boolean;
27
+ hasMultipleSources?: boolean;
28
+ sources?: TokenSource[];
29
+ }
30
+ export declare const StepFlow: FC<StepFlowProps>;
31
+ export {};
32
+ //# sourceMappingURL=step-flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-flow.d.ts","sourceRoot":"","sources":["../../../.build-src/swaps/components/step-flow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAKhD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE;QACZ,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;KACvC,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,gBAAgB,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,YAAY,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;CACzB;AAqID,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAiEtC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment, memo } from "react";
3
+ import { TokenIcon } from "./token-icon";
4
+ import { StackedTokenIcons } from "./stacked-token-icons";
5
+ import { cn } from "../../lib/utils";
6
+ import { Atom, CircleCheck, CircleX, SquareArrowOutUpRight } from "lucide-react";
7
+ import {} from "./transaction-progress";
8
+ const StepItem = memo(({ step, isCompleted, isCurrent, isFailed, logos, symbol, totalSteps, index, explorerUrl, allCompleted, hasMultipleSources, sources, }) => {
9
+ const isSecondLast = index === totalSteps - 2;
10
+ // Determine opacity based on step state
11
+ const getOpacity = () => {
12
+ if (allCompleted)
13
+ return "opacity-100";
14
+ if (isCompleted)
15
+ return "opacity-100";
16
+ if (isCurrent)
17
+ return "opacity-100";
18
+ return "opacity-50";
19
+ };
20
+ // Render the appropriate icon based on state
21
+ const renderIcon = () => {
22
+ if (isSecondLast) {
23
+ return _jsx(Atom, { className: "size-4 animate-spin" });
24
+ }
25
+ if (hasMultipleSources && sources && sources.length > 0) {
26
+ return _jsx(StackedTokenIcons, { sources: sources, size: "sm", maxDisplay: 3 });
27
+ }
28
+ return (_jsx(TokenIcon, { size: "sm", symbol: symbol, chainLogo: logos.chain, tokenLogo: logos.token, className: "w-full h-full object-cover" }));
29
+ };
30
+ return (_jsxs("div", { className: cn("flex gap-x-4 items-center rounded-lg w-full py-1 transition-opacity duration-300", getOpacity()), children: [isFailed ? (_jsx("div", { className: "w-6 h-6 min-w-6 min-h-6 shrink-0 flex items-center justify-center rounded-full bg-red-500/10 text-red-500", children: _jsx("span", { className: "w-2 h-2 min-w-[8px] min-h-[8px] rounded-full bg-red-500" }) })) : isCurrent ? (_jsx("div", { className: "w-6 h-6 min-w-6 min-h-6 shrink-0 flex items-center justify-center rounded-full bg-chart-1/20 animate-pulse", children: _jsx("span", { className: "w-2.5 h-2.5 min-w-[10px] min-h-[10px] rounded-full bg-chart-1" }) })) : isCompleted ? (_jsx("div", { className: "w-6 h-6 min-w-6 min-h-6 shrink-0 flex items-center justify-center rounded-full bg-chart-1/10", children: _jsx("span", { className: "w-2 h-2 min-w-[8px] min-h-[8px] rounded-full bg-chart-1" }) })) : (_jsx("div", { className: "w-6 h-6 min-w-6 min-h-6 shrink-0 flex items-center justify-center rounded-full", children: _jsx("span", { className: "w-2 h-2 min-w-[8px] min-h-[8px] rounded-full bg-muted-foreground/50" }) })), _jsxs("div", { className: "flex w-full items-center justify-between", children: [_jsxs("div", { className: "flex flex-col items-start gap-y-0.5", children: [_jsx("h3", { className: cn("font-medium text-sm transition-colors duration-300", isFailed ? "text-red-500" : isCompleted || isCurrent
31
+ ? "text-foreground"
32
+ : "text-muted-foreground"), children: step.label }), explorerUrl &&
33
+ (isCompleted || isFailed) &&
34
+ (isSecondLast || index === totalSteps - 1 || isFailed) && (_jsxs("a", { href: explorerUrl, target: "_blank", rel: "noreferrer", className: "text-xs text-muted-foreground hover:text-foreground inline-flex items-center gap-x-1 transition-colors", children: [_jsx(SquareArrowOutUpRight, { className: "size-3" }), " View Transaction"] }))] }), isCurrent && !isCompleted && !isFailed && (_jsxs("p", { className: "text-xs text-muted-foreground", children: ["Step ", index + 1, " of ", totalSteps] })), isCompleted && !isFailed && _jsx(CircleCheck, { className: "size-5 shrink-0 text-chart-1" }), isFailed && _jsx(CircleX, { className: "size-5 shrink-0 text-red-500" })] })] }));
35
+ });
36
+ StepItem.displayName = "StepItem";
37
+ export const StepFlow = memo(({ steps, currentIndex, totalSteps, sourceSymbol, destinationSymbol, sourceLogos, destinationLogos, explorerUrls, allCompleted, hasMultipleSources, sources, }) => {
38
+ return (_jsx("div", { className: "flex flex-col gap-y-0 w-full", children: steps.map((step, index) => {
39
+ const isCompleted = !!step.completed;
40
+ const isFailed = !!step.failed;
41
+ const isCurrent = currentIndex === -1 ? false : index === currentIndex;
42
+ const isLast = index === steps.length - 1;
43
+ const url = step.explorerUrl ?? (isLast
44
+ ? explorerUrls.destinationExplorerUrl
45
+ : index === steps.length - 2
46
+ ? explorerUrls.sourceExplorerUrl
47
+ : null);
48
+ // For source steps (not the last step), pass multiple sources info
49
+ const isSourceStep = !isLast;
50
+ const showMultipleSources = isSourceStep && hasMultipleSources;
51
+ return (_jsxs(Fragment, { children: [_jsx(StepItem, { step: step, isCompleted: isCompleted, isCurrent: isCurrent, isFailed: isFailed, index: index, symbol: isLast ? destinationSymbol : sourceSymbol, logos: isLast ? destinationLogos : sourceLogos, totalSteps: totalSteps, explorerUrl: url, allCompleted: allCompleted, hasMultipleSources: showMultipleSources, sources: showMultipleSources ? sources : undefined }), !isLast && (_jsx("div", { className: "flex w-max ml-[11px]", children: _jsx("div", { className: cn("w-0.5 h-5 border border-dashed transition-colors duration-300", isCompleted ? "border-chart-1/50" : "border-border") }) }))] }, step.id));
52
+ }) }));
53
+ });
54
+ StepFlow.displayName = "StepFlow";
@@ -0,0 +1,11 @@
1
+ type TokenIconSize = "sm" | "md" | "lg";
2
+ interface TokenIconProps {
3
+ symbol?: string;
4
+ tokenLogo?: string;
5
+ chainLogo?: string;
6
+ size?: TokenIconSize;
7
+ className?: string;
8
+ }
9
+ export declare const TokenIcon: ({ symbol, tokenLogo, chainLogo, size, className, }: TokenIconProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=token-icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-icon.d.ts","sourceRoot":"","sources":["../../../.build-src/swaps/components/token-icon.tsx"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAQxC,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,GAAI,oDAMvB,cAAc,4CAgDhB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cn } from "../../lib/utils";
4
+ const SIZE_MAP = {
5
+ sm: 24,
6
+ md: 32,
7
+ lg: 40,
8
+ };
9
+ export const TokenIcon = ({ symbol, tokenLogo, chainLogo, size = "md", className, }) => {
10
+ const dimension = SIZE_MAP[size];
11
+ return (_jsxs("span", { className: cn("relative inline-flex", className), children: [tokenLogo ? (_jsx("img", { src: tokenLogo, alt: symbol ?? "token", width: dimension, height: dimension, className: cn("rounded-full object-cover") })) : (_jsx("span", { className: cn("rounded-full bg-ring/80 text-muted-foreground flex items-center justify-center font-semibold uppercase", {
12
+ "h-6 w-6 text-xs": size === "sm",
13
+ "h-8 w-8 text-sm": size === "md",
14
+ "h-10 w-10 text-base": size === "lg",
15
+ }), children: " " })), chainLogo ? (_jsx("span", { className: "absolute -bottom-0.5 -right-0.5 rounded-full border border-background bg-background", children: _jsx("img", { src: chainLogo, alt: "chain logo", width: Math.max(14, dimension * 0.4), height: Math.max(14, dimension * 0.4), className: "rounded-full object-cover" }) })) : (_jsx("span", { className: cn("absolute -bottom-0.5 -right-0.5 rounded-full bg-ring text-muted-foreground flex items-center justify-center font-semibold uppercase size-6"), children: " " }))] }));
16
+ };
@@ -0,0 +1,43 @@
1
+ import { type FC } from "react";
2
+ import { type BridgeStepType, type SwapStepType } from "../../common";
3
+ export type DisplayStep = {
4
+ id: string;
5
+ label: string;
6
+ completed: boolean;
7
+ failed?: boolean;
8
+ explorerUrl?: string | null;
9
+ };
10
+ type ProgressStep = BridgeStepType | SwapStepType;
11
+ interface TokenSource {
12
+ tokenLogo: string;
13
+ chainLogo: string;
14
+ symbol: string;
15
+ }
16
+ interface TransactionProgressProps {
17
+ steps: Array<{
18
+ id: number;
19
+ completed: boolean;
20
+ step: ProgressStep;
21
+ }>;
22
+ explorerUrls: {
23
+ sourceExplorerUrl: string | null;
24
+ destinationExplorerUrl: string | null;
25
+ };
26
+ sourceSymbol: string;
27
+ destinationSymbol: string;
28
+ sourceLogos: {
29
+ token: string;
30
+ chain: string;
31
+ };
32
+ destinationLogos: {
33
+ token: string;
34
+ chain: string;
35
+ };
36
+ hasMultipleSources?: boolean;
37
+ sources?: TokenSource[];
38
+ isTransferMode?: boolean;
39
+ depositOpportunityName?: string;
40
+ }
41
+ declare const TransactionProgress: FC<TransactionProgressProps>;
42
+ export default TransactionProgress;
43
+ //# sourceMappingURL=transaction-progress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction-progress.d.ts","sourceRoot":"","sources":["../../../.build-src/swaps/components/transaction-progress.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAW,MAAM,OAAO,CAAC;AACzC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,WAAW,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAC3H,KAAK,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;AAElD,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,wBAAwB;IAChC,KAAK,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,YAAY,CAAA;KAAE,CAAC,CAAC;IACrE,YAAY,EAAE;QACZ,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;QACjC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;KACvC,CAAC;IACF,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,gBAAgB,EAAE;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAoBD,QAAA,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CAmHrD,CAAC;AAEF,eAAe,mBAAmB,CAAC"}