thirdweb 5.88.6 → 5.88.8-nightly-1fa36c1d56758788a8f9053f8929497bacb2b115-20250224233959

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 (198) hide show
  1. package/dist/cjs/contract/deployment/utils/create-2-factory.js +4 -0
  2. package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
  3. package/dist/cjs/pay/buyWithFiat/getQuote.js +1 -0
  4. package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
  5. package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js +44 -0
  6. package/dist/cjs/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
  7. package/dist/cjs/pay/convert/type.js +30 -1
  8. package/dist/cjs/pay/convert/type.js.map +1 -1
  9. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
  10. package/dist/cjs/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
  11. package/dist/cjs/react/core/hooks/wallets/useSendToken.js +18 -2
  12. package/dist/cjs/react/core/hooks/wallets/useSendToken.js.map +1 -1
  13. package/dist/cjs/react/core/providers/invalidateWalletBalance.js +6 -1
  14. package/dist/cjs/react/core/providers/invalidateWalletBalance.js.map +1 -1
  15. package/dist/cjs/react/core/utils/account.js +2 -7
  16. package/dist/cjs/react/core/utils/account.js.map +1 -1
  17. package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js +1 -1
  18. package/dist/cjs/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
  19. package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +1 -1
  20. package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -1
  21. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +6 -4
  22. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  23. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +2 -1
  24. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +1 -1
  25. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +1 -1
  26. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +1 -1
  27. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -13
  28. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  29. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +6 -26
  30. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  31. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +1 -1
  32. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  33. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +541 -0
  34. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -0
  35. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +23 -0
  36. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  37. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +8 -0
  38. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  39. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +21 -0
  40. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -0
  41. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +4 -9
  42. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
  43. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
  44. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
  45. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
  46. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  47. package/dist/cjs/rpc/rpc.js +1 -1
  48. package/dist/cjs/storage/upload/mobile.js +1 -1
  49. package/dist/cjs/storage/upload/mobile.js.map +1 -1
  50. package/dist/cjs/storage/upload/web-node.js +1 -0
  51. package/dist/cjs/storage/upload/web-node.js.map +1 -1
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/cjs/version.js.map +1 -1
  54. package/dist/cjs/wallets/in-app/web/ecosystem.js +1 -1
  55. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js +1 -1
  56. package/dist/cjs/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  57. package/dist/esm/contract/deployment/utils/create-2-factory.js +4 -0
  58. package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
  59. package/dist/esm/pay/buyWithFiat/getQuote.js +1 -0
  60. package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
  61. package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js +43 -0
  62. package/dist/esm/pay/buyWithFiat/isSwapRequiredPostOnramp.js.map +1 -1
  63. package/dist/esm/pay/convert/type.js +29 -2
  64. package/dist/esm/pay/convert/type.js.map +1 -1
  65. package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js +1 -0
  66. package/dist/esm/react/core/hooks/pay/useBuyWithFiatStatus.js.map +1 -1
  67. package/dist/esm/react/core/hooks/wallets/useSendToken.js +19 -3
  68. package/dist/esm/react/core/hooks/wallets/useSendToken.js.map +1 -1
  69. package/dist/esm/react/core/providers/invalidateWalletBalance.js +6 -1
  70. package/dist/esm/react/core/providers/invalidateWalletBalance.js.map +1 -1
  71. package/dist/esm/react/core/utils/account.js +1 -6
  72. package/dist/esm/react/core/utils/account.js.map +1 -1
  73. package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js +1 -1
  74. package/dist/esm/react/web/ui/ConnectWallet/NetworkSelector.js.map +1 -1
  75. package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +1 -1
  76. package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -1
  77. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +6 -4
  78. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
  79. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js +2 -1
  80. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.js.map +1 -1
  81. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js +3 -3
  82. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.js.map +1 -1
  83. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js +0 -13
  84. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.js.map +1 -1
  85. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +7 -27
  86. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
  87. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -2
  88. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
  89. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +538 -0
  90. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -0
  91. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +22 -0
  92. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
  93. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +8 -0
  94. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
  95. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js +18 -0
  96. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.js.map +1 -0
  97. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js +5 -10
  98. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.js.map +1 -1
  99. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
  100. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
  101. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js +2 -1
  102. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.js.map +1 -1
  103. package/dist/esm/rpc/rpc.js +1 -1
  104. package/dist/esm/storage/upload/mobile.js +1 -1
  105. package/dist/esm/storage/upload/mobile.js.map +1 -1
  106. package/dist/esm/storage/upload/web-node.js +1 -0
  107. package/dist/esm/storage/upload/web-node.js.map +1 -1
  108. package/dist/esm/version.js +1 -1
  109. package/dist/esm/version.js.map +1 -1
  110. package/dist/esm/wallets/in-app/web/ecosystem.js +1 -1
  111. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js +1 -1
  112. package/dist/esm/wallets/in-app/web/lib/iframe-wallet.js.map +1 -1
  113. package/dist/types/pay/buyWithFiat/getQuote.d.ts +8 -32
  114. package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
  115. package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts +7 -0
  116. package/dist/types/pay/buyWithFiat/isSwapRequiredPostOnramp.d.ts.map +1 -1
  117. package/dist/types/pay/convert/type.d.ts +2 -1
  118. package/dist/types/pay/convert/type.d.ts.map +1 -1
  119. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +2 -1
  120. package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
  121. package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts +2 -1
  122. package/dist/types/react/core/hooks/pay/useBuyWithFiatStatus.d.ts.map +1 -1
  123. package/dist/types/react/core/hooks/wallets/useSendToken.d.ts +6 -1
  124. package/dist/types/react/core/hooks/wallets/useSendToken.d.ts.map +1 -1
  125. package/dist/types/react/core/providers/invalidateWalletBalance.d.ts +1 -1
  126. package/dist/types/react/core/providers/invalidateWalletBalance.d.ts.map +1 -1
  127. package/dist/types/react/core/utils/account.d.ts +1 -1
  128. package/dist/types/react/core/utils/account.d.ts.map +1 -1
  129. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts +1 -1
  130. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.d.ts.map +1 -1
  131. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.d.ts.map +1 -1
  132. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.d.ts.map +1 -1
  133. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts +7 -2
  134. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
  135. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/{FiatFlow.d.ts → OnRampScreen.d.ts} +4 -4
  136. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.d.ts.map +1 -0
  137. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +6 -2
  138. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
  139. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts +0 -1
  140. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/types.d.ts.map +1 -1
  141. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts +4 -0
  142. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.d.ts.map +1 -0
  143. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.d.ts.map +1 -1
  144. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts +1 -0
  145. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.d.ts.map +1 -1
  146. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts +1 -0
  147. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.d.ts.map +1 -1
  148. package/dist/types/react/web/ui/MediaRenderer/MediaRenderer.d.ts +2 -2
  149. package/dist/types/react/web/ui/MediaRenderer/ModelViewer.d.ts +1 -1
  150. package/dist/types/storage/upload/web-node.d.ts.map +1 -1
  151. package/dist/types/version.d.ts +1 -1
  152. package/dist/types/version.d.ts.map +1 -1
  153. package/dist/types/wallets/in-app/web/ecosystem.d.ts +1 -1
  154. package/package.json +1 -1
  155. package/src/contract/deployment/utils/create-2-factory.ts +4 -0
  156. package/src/pay/buyWithFiat/getQuote.ts +9 -33
  157. package/src/pay/buyWithFiat/isSwapRequiredPostOnramp.ts +56 -0
  158. package/src/pay/convert/type.ts +30 -1
  159. package/src/react/core/hooks/connection/ConnectButtonProps.ts +2 -1
  160. package/src/react/core/hooks/pay/useBuyWithFiatStatus.ts +3 -1
  161. package/src/react/core/hooks/wallets/useSendToken.ts +19 -3
  162. package/src/react/core/providers/invalidateWalletBalance.ts +6 -1
  163. package/src/react/core/utils/account.ts +4 -8
  164. package/src/react/web/ui/ConnectWallet/NetworkSelector.tsx +1 -1
  165. package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +1 -1
  166. package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -3
  167. package/src/react/web/ui/ConnectWallet/screens/Buy/PayWIthCreditCard.tsx +2 -2
  168. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/CurrencySelection.tsx +3 -6
  169. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatScreenContent.tsx +0 -19
  170. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +9 -32
  171. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +2 -2
  172. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +790 -0
  173. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +38 -2
  174. package/src/react/web/ui/ConnectWallet/screens/Buy/main/types.ts +0 -1
  175. package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +10 -0
  176. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/StepConnector.tsx +55 -0
  177. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapSummary.tsx +18 -41
  178. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +25 -22
  179. package/src/react/web/ui/ConnectWallet/screens/Buy/swap/WalletRow.tsx +10 -1
  180. package/src/rpc/rpc.ts +1 -1
  181. package/src/storage/upload/mobile.ts +1 -1
  182. package/src/storage/upload/web-node.ts +1 -0
  183. package/src/version.ts +1 -1
  184. package/src/wallets/in-app/web/ecosystem.ts +1 -1
  185. package/src/wallets/in-app/web/lib/iframe-wallet.ts +1 -1
  186. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +0 -63
  187. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +0 -1
  188. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +0 -116
  189. package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +0 -1
  190. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js +0 -60
  191. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.js.map +0 -1
  192. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +0 -113
  193. package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +0 -1
  194. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.d.ts.map +0 -1
  195. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts +0 -24
  196. package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.d.ts.map +0 -1
  197. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx +0 -152
  198. package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +0 -258
@@ -1,4 +1,6 @@
1
1
  import { RadiobuttonIcon } from "@radix-ui/react-icons";
2
+ import type { SupportedFiatCurrency } from "../../../../../../../pay/convert/type.js";
3
+ import { iconSize } from "../../../../../../core/design-system/index.js";
2
4
  import { CADIcon } from "../../../icons/currencies/CADIcon.js";
3
5
  import { EURIcon } from "../../../icons/currencies/EURIcon.js";
4
6
  import { GBPIcon } from "../../../icons/currencies/GBPIcon.js";
@@ -7,14 +9,16 @@ import { USDIcon } from "../../../icons/currencies/USDIcon.js";
7
9
  import type { IconFC } from "../../../icons/types.js";
8
10
 
9
11
  export type CurrencyMeta = {
10
- shorthand: "USD" | "CAD" | "GBP" | "EUR" | "JPY";
12
+ shorthand: SupportedFiatCurrency;
13
+ countryCode: string;
11
14
  name: string;
12
15
  symbol: string;
13
- icon: IconFC;
16
+ icon?: IconFC;
14
17
  };
15
18
 
16
19
  export const usdCurrency: CurrencyMeta = {
17
20
  shorthand: "USD",
21
+ countryCode: "US",
18
22
  name: "US Dollar",
19
23
  symbol: "$",
20
24
  icon: USDIcon,
@@ -24,28 +28,44 @@ export const currencies: CurrencyMeta[] = [
24
28
  usdCurrency,
25
29
  {
26
30
  shorthand: "CAD",
31
+ countryCode: "CA",
27
32
  name: "Canadian Dollar",
28
33
  symbol: "$",
29
34
  icon: CADIcon,
30
35
  },
31
36
  {
32
37
  shorthand: "GBP",
38
+ countryCode: "GB",
33
39
  name: "British Pound",
34
40
  symbol: "£",
35
41
  icon: GBPIcon,
36
42
  },
37
43
  {
38
44
  shorthand: "EUR",
45
+ countryCode: "EU",
39
46
  name: "Euro",
40
47
  symbol: "€",
41
48
  icon: EURIcon,
42
49
  },
43
50
  {
44
51
  shorthand: "JPY",
52
+ countryCode: "JP",
45
53
  name: "Japanese Yen",
46
54
  symbol: "¥",
47
55
  icon: JPYIcon,
48
56
  },
57
+ {
58
+ shorthand: "AUD",
59
+ countryCode: "AU",
60
+ name: "Australian Dollar",
61
+ symbol: "$",
62
+ },
63
+ {
64
+ shorthand: "NZD",
65
+ countryCode: "NZ",
66
+ name: "New Zealand Dollar",
67
+ symbol: "$",
68
+ },
49
69
  ];
50
70
 
51
71
  export function getCurrencyMeta(shorthand: string): CurrencyMeta {
@@ -56,6 +76,7 @@ export function getCurrencyMeta(shorthand: string): CurrencyMeta {
56
76
  ) ?? {
57
77
  // This should never happen
58
78
  icon: UnknownCurrencyIcon,
79
+ countryCode: "US",
59
80
  name: shorthand,
60
81
  symbol: "$",
61
82
  shorthand: shorthand as CurrencyMeta["shorthand"],
@@ -63,6 +84,21 @@ export function getCurrencyMeta(shorthand: string): CurrencyMeta {
63
84
  );
64
85
  }
65
86
 
87
+ export function getFiatIcon(
88
+ currency: CurrencyMeta,
89
+ size: keyof typeof iconSize,
90
+ ): React.ReactNode {
91
+ return currency.icon ? (
92
+ <currency.icon size={iconSize[size]} />
93
+ ) : (
94
+ <img
95
+ src={`https://flagsapi.com/${currency.countryCode.toUpperCase()}/flat/64.png`}
96
+ alt={currency.shorthand}
97
+ width={iconSize[size]}
98
+ height={iconSize[size]}
99
+ />
100
+ );
101
+ }
66
102
  const UnknownCurrencyIcon: IconFC = (props) => {
67
103
  return <RadiobuttonIcon width={props.size} height={props.size} />;
68
104
  };
@@ -39,7 +39,6 @@ export type SelectedScreen =
39
39
  | {
40
40
  id: "fiat-flow";
41
41
  quote: BuyWithFiatQuote;
42
- openedWindow: Window | null;
43
42
  }
44
43
  | {
45
44
  id: "transfer-flow";
@@ -163,6 +163,16 @@ function getDefaultCurrencyBasedOnLocation(): CurrencyMeta["shorthand"] {
163
163
  return "CAD";
164
164
  }
165
165
 
166
+ // australia
167
+ if (timeZone.includes("australia")) {
168
+ return "AUD";
169
+ }
170
+
171
+ // new zealand
172
+ if (timeZone.includes("new zealand")) {
173
+ return "NZD";
174
+ }
175
+
166
176
  return "USD";
167
177
  } catch {
168
178
  return "USD";
@@ -0,0 +1,55 @@
1
+ import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
2
+ import { Container } from "../../../../components/basic.js";
3
+
4
+ export function StepConnectorArrow(props: {
5
+ active: boolean;
6
+ }) {
7
+ const theme = useCustomTheme();
8
+ return (
9
+ <Container
10
+ flex="row"
11
+ center="both"
12
+ style={{
13
+ width: "100%",
14
+ height: "12px",
15
+ position: "relative",
16
+ marginTop: "-1px",
17
+ zIndex: 1000,
18
+ }}
19
+ >
20
+ <svg
21
+ role="presentation"
22
+ width="32"
23
+ height="16"
24
+ viewBox="0 0 32 16"
25
+ fill="none"
26
+ style={{
27
+ display: "block",
28
+ }}
29
+ >
30
+ <path
31
+ d="M1 0L16 15L31 0"
32
+ fill={theme.colors.tertiaryBg}
33
+ stroke={
34
+ props.active ? theme.colors.accentText : theme.colors.borderColor
35
+ }
36
+ strokeWidth="1"
37
+ strokeLinecap="square"
38
+ strokeLinejoin="miter"
39
+ />
40
+ <path
41
+ d="M8 0L16 7.5L24 0"
42
+ fill="none"
43
+ stroke={
44
+ props.active
45
+ ? theme.colors.accentText
46
+ : theme.colors.secondaryIconColor
47
+ }
48
+ strokeWidth="1"
49
+ strokeLinecap="square"
50
+ strokeLinejoin="miter"
51
+ />
52
+ </svg>
53
+ </Container>
54
+ );
55
+ }
@@ -1,14 +1,11 @@
1
- import { ChevronDownIcon } from "@radix-ui/react-icons";
2
1
  import type { Chain } from "../../../../../../../chains/types.js";
3
2
  import type { ThirdwebClient } from "../../../../../../../client/client.js";
4
3
  import { useCustomTheme } from "../../../../../../core/design-system/CustomThemeProvider.js";
5
- import {
6
- iconSize,
7
- radius,
8
- } from "../../../../../../core/design-system/index.js";
4
+ import { radius } from "../../../../../../core/design-system/index.js";
9
5
  import { Container } from "../../../../components/basic.js";
10
6
  import { TokenRow } from "../../../../components/token/TokenRow.js";
11
7
  import type { ERC20OrNativeToken } from "../../nativeToken.js";
8
+ import { StepConnectorArrow } from "./StepConnector.js";
12
9
  import { WalletRow } from "./WalletRow.js";
13
10
 
14
11
  export function SwapSummary(props: {
@@ -36,23 +33,21 @@ export function SwapSummary(props: {
36
33
  border: `1px solid ${theme.colors.borderColor}`,
37
34
  }}
38
35
  >
39
- {isDifferentRecipient && (
40
- <Container
41
- flex="row"
42
- gap="sm"
43
- p="sm"
44
- style={{
45
- borderBottom: `1px solid ${theme.colors.borderColor}`,
46
- }}
47
- >
48
- <WalletRow
49
- address={props.sender}
50
- client={props.client}
51
- iconSize="md"
52
- textSize="sm"
53
- />
54
- </Container>
55
- )}
36
+ <Container
37
+ flex="row"
38
+ gap="sm"
39
+ p="sm"
40
+ style={{
41
+ borderBottom: `1px solid ${theme.colors.borderColor}`,
42
+ }}
43
+ >
44
+ <WalletRow
45
+ address={props.sender}
46
+ client={props.client}
47
+ iconSize="md"
48
+ textSize="sm"
49
+ />
50
+ </Container>
56
51
  <TokenRow
57
52
  token={props.fromToken}
58
53
  chain={props.fromChain}
@@ -69,25 +64,7 @@ export function SwapSummary(props: {
69
64
  />
70
65
  </Container>
71
66
  {/* Connector Icon */}
72
- <Container flex="row" center="both" py="xxs">
73
- <Container flex="column" center="both">
74
- <ChevronDownIcon
75
- width={iconSize.md}
76
- height={iconSize.md}
77
- style={{
78
- color: theme.colors.secondaryIconColor,
79
- }}
80
- />
81
- <ChevronDownIcon
82
- width={iconSize.md}
83
- height={iconSize.md}
84
- style={{
85
- color: theme.colors.secondaryIconColor,
86
- marginTop: "-17px",
87
- }}
88
- />
89
- </Container>
90
- </Container>
67
+ <StepConnectorArrow active={false} />
91
68
  {/* Buy */}
92
69
  <Container
93
70
  flex="column"
@@ -69,6 +69,7 @@ export function TokenSelectorScreen(props: {
69
69
  onSelectToken: (wallet: Wallet, token: TokenInfo, chain: Chain) => void;
70
70
  onConnect: () => void;
71
71
  onPayWithFiat: () => void;
72
+ fiatSupported: boolean;
72
73
  }) {
73
74
  const connectedWallets = useConnectedWallets();
74
75
  const activeAccount = useActiveAccount();
@@ -255,29 +256,31 @@ export function TokenSelectorScreen(props: {
255
256
  </Text>
256
257
  </Container>
257
258
  </Button>
258
- <Button
259
- variant="secondary"
260
- fullWidth
261
- onClick={props.onPayWithFiat}
262
- bg="tertiaryBg"
263
- style={{
264
- border: `1px solid ${theme.colors.borderColor}`,
265
- padding: spacing.sm,
266
- }}
267
- >
268
- <Container
269
- flex="row"
270
- gap="sm"
271
- center="y"
272
- expand
273
- color="secondaryIconColor"
259
+ {props.fiatSupported && (
260
+ <Button
261
+ variant="secondary"
262
+ fullWidth
263
+ onClick={props.onPayWithFiat}
264
+ bg="tertiaryBg"
265
+ style={{
266
+ border: `1px solid ${theme.colors.borderColor}`,
267
+ padding: spacing.sm,
268
+ }}
274
269
  >
275
- <CardStackIcon width={iconSize.md} height={iconSize.md} />
276
- <Text size="sm" color="primaryText">
277
- Pay with credit card
278
- </Text>
279
- </Container>
280
- </Button>
270
+ <Container
271
+ flex="row"
272
+ gap="sm"
273
+ center="y"
274
+ expand
275
+ color="secondaryIconColor"
276
+ >
277
+ <CardStackIcon width={iconSize.md} height={iconSize.md} />
278
+ <Text size="sm" color="primaryText">
279
+ Pay with credit card
280
+ </Text>
281
+ </Container>
282
+ </Button>
283
+ )}
281
284
  </Container>
282
285
  </Container>
283
286
  </Container>
@@ -16,12 +16,14 @@ import { Skeleton } from "../../../../components/Skeleton.js";
16
16
  import { WalletImage } from "../../../../components/WalletImage.js";
17
17
  import { Container } from "../../../../components/basic.js";
18
18
  import { Text } from "../../../../components/text.js";
19
+ import { OutlineWalletIcon } from "../../../icons/OutlineWalletIcon.js";
19
20
 
20
21
  export function WalletRow(props: {
21
22
  client: ThirdwebClient;
22
23
  address: string;
23
24
  iconSize?: keyof typeof iconSize;
24
25
  textSize?: keyof typeof fontSize;
26
+ label?: string;
25
27
  }) {
26
28
  const { client, address } = props;
27
29
  const connectedWallets = useConnectedWallets();
@@ -51,8 +53,15 @@ export function WalletRow(props: {
51
53
  size={iconSize[props.iconSize || "md"]}
52
54
  client={props.client}
53
55
  />
54
- ) : null}
56
+ ) : (
57
+ <OutlineWalletIcon size={iconSize[props.iconSize || "md"]} />
58
+ )}
55
59
  <Container flex="column" gap="4xs">
60
+ {props.label ? (
61
+ <Text size="xs" color="secondaryText">
62
+ {props.label}
63
+ </Text>
64
+ ) : null}
56
65
  <Text size={props.textSize || "xs"} color="primaryText">
57
66
  {addressOrENS || shortenAddress(props.address)}
58
67
  </Text>
package/src/rpc/rpc.ts CHANGED
@@ -218,7 +218,7 @@ export function getRpcClient(
218
218
  reject = reject_;
219
219
  });
220
220
  inflightRequests.set(requestKey, promise);
221
- // @ts-expect-error - they *are* definitely assgined within the promise constructor
221
+ // @ts-expect-error - they *are* definitely assigned within the promise constructor
222
222
  pendingBatch.push({ request, resolve, reject, requestKey });
223
223
  if (batchSize > 1) {
224
224
  // if there is no timeout, set one
@@ -41,7 +41,7 @@ export async function uploadBatchMobile(
41
41
  "Request to upload timed out! No upload progress received in 30s",
42
42
  ),
43
43
  );
44
- }, 30000);
44
+ }, client.config?.storage?.fetch?.requestTimeoutMs ?? 30000);
45
45
 
46
46
  xhr.upload.addEventListener("progress", (event) => {
47
47
  clearTimeout(timer);
@@ -17,6 +17,7 @@ export async function uploadBatch<const TFiles extends UploadableFile[]>(
17
17
  method: "POST",
18
18
  headers,
19
19
  body: form,
20
+ requestTimeoutMs: client.config?.storage?.fetch?.requestTimeoutMs,
20
21
  },
21
22
  );
22
23
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.88.6";
1
+ export const version = "5.88.8-nightly-1fa36c1d56758788a8f9053f8929497bacb2b115-20250224233959";
@@ -39,7 +39,7 @@ import { createInAppWallet } from "../core/wallet/in-app-core.js";
39
39
  *
40
40
  * ### Connect to a restricted ecosystem wallet with your designated partner ID
41
41
  *
42
- * The parnter ID will be provided to you by the ecosystem with which you're integrating.
42
+ * The partner ID will be provided to you by the ecosystem with which you're integrating.
43
43
  *
44
44
  * ```ts
45
45
  * import { ecosystemWallet } from "thirdweb/wallets";
@@ -203,7 +203,7 @@ export class IFrameWallet implements IWebWallet {
203
203
  };
204
204
 
205
205
  if (tx.maxFeePerGas) {
206
- // ethers (in the iframe) rejects any type 0 trasaction with unknown keys
206
+ // ethers (in the iframe) rejects any type 0 transaction with unknown keys
207
207
  // TODO remove this once iframe is upgraded to v5
208
208
  transaction.accessList = tx.accessList;
209
209
  transaction.maxFeePerGas = tx.maxFeePerGas;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FiatFlow = FiatFlow;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const pay_js_1 = require("../../../../../../../analytics/track/pay.js");
7
- const getStatus_js_1 = require("../../../../../../../pay/buyWithFiat/getStatus.js");
8
- const isSwapRequiredPostOnramp_js_1 = require("../../../../../../../pay/buyWithFiat/isSwapRequiredPostOnramp.js");
9
- const openOnRamppopup_js_1 = require("../openOnRamppopup.js");
10
- const pendingSwapTx_js_1 = require("../swap/pendingSwapTx.js");
11
- const FiatStatusScreen_js_1 = require("./FiatStatusScreen.js");
12
- const FiatSteps_js_1 = require("./FiatSteps.js");
13
- const PostOnRampSwapFlow_js_1 = require("./PostOnRampSwapFlow.js");
14
- function FiatFlow(props) {
15
- const hasTwoSteps = (0, isSwapRequiredPostOnramp_js_1.isSwapRequiredPostOnramp)(props.quote);
16
- const [screen, setScreen] = (0, react_1.useState)(hasTwoSteps
17
- ? {
18
- id: "step-1",
19
- }
20
- : {
21
- id: "onramp-status",
22
- });
23
- const [popupWindow, setPopupWindow] = (0, react_1.useState)(props.openedWindow);
24
- const onPostOnrampSuccess = (0, react_1.useCallback)(() => {
25
- // report the status of fiat status instead of post onramp swap status when post onramp swap is successful
26
- (0, getStatus_js_1.getBuyWithFiatStatus)({
27
- intentId: props.quote.intentId,
28
- client: props.client,
29
- }).then((status) => {
30
- props.onSuccess(status);
31
- });
32
- }, [props.onSuccess, props.quote.intentId, props.client]);
33
- if (screen.id === "step-1") {
34
- return ((0, jsx_runtime_1.jsx)(FiatSteps_js_1.FiatSteps, { title: props.title, client: props.client, onBack: props.onBack, partialQuote: (0, FiatSteps_js_1.fiatQuoteToPartialQuote)(props.quote), step: 1, onContinue: () => {
35
- const popup = (0, openOnRamppopup_js_1.openOnrampPopup)(props.quote.onRampLink, props.theme);
36
- (0, pay_js_1.trackPayEvent)({
37
- event: "open_onramp_popup",
38
- client: props.client,
39
- walletAddress: props.payer.account.address,
40
- walletType: props.payer.wallet.id,
41
- });
42
- (0, pendingSwapTx_js_1.addPendingTx)({
43
- type: "fiat",
44
- intentId: props.quote.intentId,
45
- });
46
- setPopupWindow(popup);
47
- setScreen({ id: "onramp-status" });
48
- } }));
49
- }
50
- if (screen.id === "onramp-status") {
51
- return ((0, jsx_runtime_1.jsx)(FiatStatusScreen_js_1.OnrampStatusScreen, { title: props.title, client: props.client, intentId: props.quote.intentId, onBack: props.onBack, hasTwoSteps: hasTwoSteps, openedWindow: popupWindow, quote: props.quote, onDone: props.onDone, onShowSwapFlow: (_status) => {
52
- setScreen({ id: "postonramp-swap", data: _status });
53
- }, transactionMode: props.transactionMode, isEmbed: props.isEmbed, onSuccess: props.onSuccess }));
54
- }
55
- if (screen.id === "postonramp-swap") {
56
- return ((0, jsx_runtime_1.jsx)(PostOnRampSwapFlow_js_1.PostOnRampSwapFlow, { title: props.title, status: screen.data, quote: (0, FiatSteps_js_1.fiatQuoteToPartialQuote)(props.quote), client: props.client, onBack: props.onBack, onDone: props.onDone, onSwapFlowStarted: () => {
57
- // no op
58
- }, transactionMode: props.transactionMode, isEmbed: props.isEmbed, payer: props.payer, onSuccess: onPostOnrampSuccess }));
59
- }
60
- // never
61
- return null;
62
- }
63
- //# sourceMappingURL=FiatFlow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FiatFlow.js","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatFlow.tsx"],"names":[],"mappings":";;AA0CA,4BA6GC;;AAvJD,iCAA8C;AAC9C,wEAA4E;AAG5E,oFAG2D;AAC3D,kHAA4G;AAC5G,8DAAwD;AACxD,+DAAwD;AAExD,+DAA2D;AAC3D,iDAAoE;AACpE,mEAA6D;AA4B7D,SAAgB,QAAQ,CAAC,KAaxB;IACC,MAAM,WAAW,GAAG,IAAA,sDAAwB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAClC,WAAW;QACT,CAAC,CAAC;YACE,EAAE,EAAE,QAAQ;SACb;QACH,CAAC,CAAC;YACE,EAAE,EAAE,eAAe;SACpB,CACN,CAAC;IAEF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAC5C,KAAK,CAAC,YAAY,CACnB,CAAC;IAEF,MAAM,mBAAmB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC3C,0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ACH,CAAC;IACJ,CAAC;IAED,QAAQ;IACR,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OnrampStatusScreen = OnrampStatusScreen;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_icons_1 = require("@radix-ui/react-icons");
6
- const react_query_1 = require("@tanstack/react-query");
7
- const react_1 = require("react");
8
- const isMobile_js_1 = require("../../../../../../../utils/web/isMobile.js");
9
- const index_js_1 = require("../../../../../../core/design-system/index.js");
10
- const useBuyWithFiatStatus_js_1 = require("../../../../../../core/hooks/pay/useBuyWithFiatStatus.js");
11
- const invalidateWalletBalance_js_1 = require("../../../../../../core/providers/invalidateWalletBalance.js");
12
- const Spacer_js_1 = require("../../../../components/Spacer.js");
13
- const Spinner_js_1 = require("../../../../components/Spinner.js");
14
- const StepBar_js_1 = require("../../../../components/StepBar.js");
15
- const basic_js_1 = require("../../../../components/basic.js");
16
- const buttons_js_1 = require("../../../../components/buttons.js");
17
- const text_js_1 = require("../../../../components/text.js");
18
- const AccentFailIcon_js_1 = require("../../../icons/AccentFailIcon.js");
19
- const statusMeta_js_1 = require("../pay-transactions/statusMeta.js");
20
- const FiatTxDetailsTable_js_1 = require("./FiatTxDetailsTable.js");
21
- /**
22
- * Poll for "Buy with Fiat" status - when the on-ramp is in progress
23
- * - Show success screen if swap is not required and on-ramp is completed
24
- * - Show Failed screen if on-ramp failed
25
- * - call `onShowSwapFlow` if on-ramp is completed and swap is required
26
- */
27
- function OnrampStatusScreen(props) {
28
- const queryClient = (0, react_query_1.useQueryClient)();
29
- const { openedWindow, onSuccess } = props;
30
- const statusQuery = (0, useBuyWithFiatStatus_js_1.useBuyWithFiatStatus)({
31
- intentId: props.intentId,
32
- client: props.client,
33
- });
34
- // determine UI status
35
- let uiStatus = "loading";
36
- if (statusQuery.data?.status === "ON_RAMP_TRANSFER_FAILED" ||
37
- statusQuery.data?.status === "PAYMENT_FAILED") {
38
- uiStatus = "failed";
39
- }
40
- else if (statusQuery.data?.status === "CRYPTO_SWAP_FALLBACK") {
41
- uiStatus = "partialSuccess";
42
- }
43
- else if (statusQuery.data?.status === "ON_RAMP_TRANSFER_COMPLETED") {
44
- uiStatus = "completed";
45
- }
46
- const purchaseCbCalled = (0, react_1.useRef)(false);
47
- (0, react_1.useEffect)(() => {
48
- if (purchaseCbCalled.current || !onSuccess) {
49
- return;
50
- }
51
- if (statusQuery.data?.status === "ON_RAMP_TRANSFER_COMPLETED") {
52
- purchaseCbCalled.current = true;
53
- onSuccess(statusQuery.data);
54
- }
55
- }, [onSuccess, statusQuery.data]);
56
- // close the onramp popup if onramp is completed
57
- (0, react_1.useEffect)(() => {
58
- if (!openedWindow || !statusQuery.data) {
59
- return;
60
- }
61
- if (statusQuery.data?.status === "CRYPTO_SWAP_REQUIRED" ||
62
- statusQuery.data?.status === "ON_RAMP_TRANSFER_COMPLETED") {
63
- openedWindow.close();
64
- }
65
- }, [statusQuery.data, openedWindow]);
66
- // invalidate wallet balance when onramp is completed
67
- const invalidatedBalance = (0, react_1.useRef)(false);
68
- (0, react_1.useEffect)(() => {
69
- if (!invalidatedBalance.current &&
70
- statusQuery.data?.status === "ON_RAMP_TRANSFER_COMPLETED") {
71
- invalidatedBalance.current = true;
72
- (0, invalidateWalletBalance_js_1.invalidateWalletBalance)(queryClient);
73
- }
74
- }, [statusQuery.data, queryClient]);
75
- // show swap flow
76
- (0, react_1.useEffect)(() => {
77
- if (statusQuery.data?.status === "CRYPTO_SWAP_REQUIRED") {
78
- props.onShowSwapFlow(statusQuery.data);
79
- }
80
- }, [statusQuery.data, props.onShowSwapFlow]);
81
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { p: "lg", children: [(0, jsx_runtime_1.jsx)(basic_js_1.ModalHeader, { title: props.title, onBack: props.onBack }), props.hasTwoSteps && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(StepBar_js_1.StepBar, { steps: 2, currentStep: 1 }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "sm" }), (0, jsx_runtime_1.jsxs)(text_js_1.Text, { size: "xs", children: ["Step 1 of 2 - Buying ", props.quote.onRampToken.token.symbol, " with", " ", props.quote.fromCurrencyWithFees.currencySymbol] })] })), (0, jsx_runtime_1.jsx)(OnrampStatusScreenUI, { uiStatus: uiStatus, onDone: props.onDone, fiatStatus: statusQuery.data, client: props.client, transactionMode: props.transactionMode, quote: props.quote, isEmbed: props.isEmbed })] }));
82
- }
83
- function OnrampStatusScreenUI(props) {
84
- const { uiStatus } = props;
85
- const statusMeta = props.fiatStatus
86
- ? (0, statusMeta_js_1.getBuyWithFiatStatusMeta)(props.fiatStatus)
87
- : undefined;
88
- const fiatStatus = props.fiatStatus && props.fiatStatus.status !== "NOT_FOUND"
89
- ? props.fiatStatus
90
- : undefined;
91
- const onRampTokenQuote = props.quote.onRampToken;
92
- const txDetails = ((0, jsx_runtime_1.jsx)(FiatTxDetailsTable_js_1.OnRampTxDetailsTable, { client: props.client, token: fiatStatus?.source // source tx is onRamp token
93
- ? {
94
- chainId: fiatStatus.source.token.chainId,
95
- address: fiatStatus.source.token.tokenAddress,
96
- symbol: fiatStatus.source.token.symbol || "",
97
- amount: fiatStatus.source.amount,
98
- }
99
- : {
100
- chainId: onRampTokenQuote.token.chainId,
101
- address: onRampTokenQuote.token.tokenAddress,
102
- symbol: onRampTokenQuote.token.symbol,
103
- amount: onRampTokenQuote.amount,
104
- }, fiat: {
105
- amount: props.quote.fromCurrencyWithFees.amount,
106
- currencySymbol: props.quote.fromCurrencyWithFees.currencySymbol,
107
- }, statusMeta: fiatStatus?.source && statusMeta
108
- ? {
109
- color: statusMeta?.color,
110
- text: statusMeta?.status,
111
- txHash: fiatStatus.source.transactionHash,
112
- }
113
- : undefined }));
114
- return ((0, jsx_runtime_1.jsxs)(basic_js_1.Container, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xl" }), uiStatus === "loading" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(basic_js_1.Container, { flex: "row", center: "x", children: (0, jsx_runtime_1.jsx)(Spinner_js_1.Spinner, { size: "xxl", color: "accentText" }) }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "primaryText", size: "lg", center: true, children: "Buy Pending" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "sm" }), !(0, isMobile_js_1.isMobile)() && (0, jsx_runtime_1.jsx)(text_js_1.Text, { center: true, children: "Complete the purchase in popup" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xxl" }), txDetails] })), uiStatus === "failed" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(basic_js_1.Container, { flex: "row", center: "x", children: (0, jsx_runtime_1.jsx)(AccentFailIcon_js_1.AccentFailIcon, { size: index_js_1.iconSize["3xl"] }) }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "lg" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "primaryText", size: "lg", center: true, children: "Transaction Failed" }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xxl" }), txDetails] })), uiStatus === "completed" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(basic_js_1.Container, { flex: "row", center: "x", color: "success", children: (0, jsx_runtime_1.jsx)(react_icons_1.CheckCircledIcon, { width: index_js_1.iconSize["3xl"], height: index_js_1.iconSize["3xl"] }) }), (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "md" }), (0, jsx_runtime_1.jsx)(text_js_1.Text, { color: "primaryText", size: "lg", center: true, children: "Buy Complete" }), props.fiatStatus && props.fiatStatus.status !== "NOT_FOUND" && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "xxl" }), txDetails, (0, jsx_runtime_1.jsx)(Spacer_js_1.Spacer, { y: "sm" })] })), (0, jsx_runtime_1.jsx)(buttons_js_1.Button, { variant: "accent", fullWidth: true, onClick: props.onDone, children: props.transactionMode ? "Continue Transaction" : "Done" })] }))] }));
115
- }
116
- //# sourceMappingURL=FiatStatusScreen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FiatStatusScreen.js","sourceRoot":"","sources":["../../../../../../../../../src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx"],"names":[],"mappings":";;AA+BA,gDAwGC;;AAvID,uDAAyD;AACzD,uDAAuD;AACvD,iCAA0C;AAO1C,4EAAsE;AACtE,4EAAyE;AACzE,sGAAgG;AAChG,4GAAsG;AACtG,gEAA0D;AAC1D,kEAA4D;AAC5D,kEAA4D;AAC5D,8DAAyE;AACzE,kEAA2D;AAC3D,4DAAsD;AACtD,wEAAkE;AAClE,qEAA6E;AAC7E,mEAA+D;AAI/D;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,KAalC;IACC,MAAM,WAAW,GAAG,IAAA,4BAAc,GAAE,CAAC;IACrC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAA,8CAAoB,EAAC;QACvC,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM;KACrB,CAAC,CAAC;IAEH,sBAAsB;IACtB,IAAI,QAAQ,GAAa,S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