@0xsequence/marketplace-sdk 1.2.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1151) hide show
  1. package/.storybook/preview.tsx +4 -7
  2. package/CHANGELOG.md +192 -1
  3. package/compile-tailwind.js +1 -1
  4. package/dist/BellIcon.js +48 -0
  5. package/dist/BellIcon.js.map +1 -0
  6. package/dist/Card.js +831 -0
  7. package/dist/Card.js.map +1 -0
  8. package/dist/ShopCard.d.ts +83 -0
  9. package/dist/_internal.js +78 -0
  10. package/dist/_internal.js.map +1 -0
  11. package/dist/abi.js +157 -0
  12. package/dist/abi.js.map +1 -0
  13. package/dist/alertMessage.js +29 -0
  14. package/dist/alertMessage.js.map +1 -0
  15. package/dist/alien_swap.js +6 -0
  16. package/dist/alien_swap.js.map +1 -0
  17. package/dist/api.js +187 -0
  18. package/dist/api.js.map +1 -0
  19. package/dist/aqua-xyz.js +6 -0
  20. package/dist/aqua-xyz.js.map +1 -0
  21. package/dist/aura.js +6 -0
  22. package/dist/aura.js.map +1 -0
  23. package/dist/blur.js +6 -0
  24. package/dist/blur.js.map +1 -0
  25. package/dist/builder-api.js +41 -0
  26. package/dist/builder-api.js.map +1 -0
  27. package/dist/calendar.js +51 -0
  28. package/dist/calendar.js.map +1 -0
  29. package/dist/checkout.js +52 -0
  30. package/dist/checkout.js.map +1 -0
  31. package/dist/coinbase.js +6 -0
  32. package/dist/coinbase.js.map +1 -0
  33. package/dist/collectible.js +620 -0
  34. package/dist/collectible.js.map +1 -0
  35. package/dist/collection.js +396 -0
  36. package/dist/collection.js.map +1 -0
  37. package/dist/config.js +75 -0
  38. package/dist/config.js.map +1 -0
  39. package/dist/consts.d.ts +7 -0
  40. package/dist/consts.js +8 -0
  41. package/dist/consts.js.map +1 -0
  42. package/dist/contracts.js +116 -0
  43. package/dist/contracts.js.map +1 -0
  44. package/dist/create-config.d.ts +12255 -0
  45. package/dist/create-config.js +170 -0
  46. package/dist/create-config.js.map +1 -0
  47. package/dist/currency.js +186 -0
  48. package/dist/currency.js.map +1 -0
  49. package/dist/currencyImage.js +28 -0
  50. package/dist/currencyImage.js.map +1 -0
  51. package/dist/dist.js +2771 -0
  52. package/dist/dist.js.map +1 -0
  53. package/dist/element.js +6 -0
  54. package/dist/element.js.map +1 -0
  55. package/dist/expirationDateSelect.js +245 -0
  56. package/dist/expirationDateSelect.js.map +1 -0
  57. package/dist/filter-state.d.ts +153 -0
  58. package/dist/filters.d.ts +29 -0
  59. package/dist/foundation.js +6 -0
  60. package/dist/foundation.js.map +1 -0
  61. package/dist/hooks.js +26 -0
  62. package/dist/hooks.js.map +1 -0
  63. package/dist/hooks2.js +24 -0
  64. package/dist/hooks2.js.map +1 -0
  65. package/dist/index.d.ts +12 -8
  66. package/dist/index.js +13 -16
  67. package/dist/index10.d.ts +61 -0
  68. package/dist/index11.d.ts +639 -0
  69. package/dist/index12.d.ts +563 -0
  70. package/dist/index13.d.ts +19 -0
  71. package/dist/index14.d.ts +19 -0
  72. package/dist/index15.d.ts +25 -0
  73. package/dist/index16.d.ts +8 -0
  74. package/dist/index17.d.ts +853 -0
  75. package/dist/index18.d.ts +552 -0
  76. package/dist/index19.d.ts +338 -0
  77. package/dist/index2.d.ts +2174 -0
  78. package/dist/index21.d.ts +319 -0
  79. package/dist/index22.d.ts +230 -0
  80. package/dist/index23.d.ts +516 -0
  81. package/dist/index24.d.ts +24 -0
  82. package/dist/index26.d.ts +27 -0
  83. package/dist/index27.d.ts +25 -0
  84. package/dist/index28.d.ts +115 -0
  85. package/dist/index3.d.ts +2216 -0
  86. package/dist/index31.d.ts +48 -0
  87. package/dist/index32.d.ts +1 -0
  88. package/dist/index33.d.ts +56 -0
  89. package/dist/index34.d.ts +99 -0
  90. package/dist/index35.d.ts +171 -0
  91. package/dist/index36.d.ts +131 -0
  92. package/dist/index37.d.ts +135 -0
  93. package/dist/index38.d.ts +85 -0
  94. package/dist/index39.d.ts +91 -0
  95. package/dist/index4.d.ts +3426 -0
  96. package/dist/index40.d.ts +46 -0
  97. package/dist/index5.d.ts +809 -0
  98. package/dist/index6.d.ts +2541 -0
  99. package/dist/index7.d.ts +1803 -0
  100. package/dist/index8.d.ts +121 -0
  101. package/dist/index9.d.ts +47 -0
  102. package/dist/inventory.d.ts +46 -0
  103. package/dist/inventory.js +91 -0
  104. package/dist/inventory.js.map +1 -0
  105. package/dist/looks-rare.js +6 -0
  106. package/dist/looks-rare.js.map +1 -0
  107. package/dist/magic-eden.js +6 -0
  108. package/dist/magic-eden.js.map +1 -0
  109. package/dist/manifold.js +6 -0
  110. package/dist/manifold.js.map +1 -0
  111. package/dist/marketplace-logos.js +50 -0
  112. package/dist/marketplace-logos.js.map +1 -0
  113. package/dist/marketplace.js +1913 -0
  114. package/dist/marketplace.js.map +1 -0
  115. package/dist/marketplace2.js +70 -0
  116. package/dist/marketplace2.js.map +1 -0
  117. package/dist/metadata.d.ts +733 -0
  118. package/dist/mintify.js +6 -0
  119. package/dist/mintify.js.map +1 -0
  120. package/dist/network.js +15 -0
  121. package/dist/network.js.map +1 -0
  122. package/dist/networkconfigToWagmiChain.js +16 -0
  123. package/dist/networkconfigToWagmiChain.js.map +1 -0
  124. package/dist/nftx.js +6 -0
  125. package/dist/nftx.js.map +1 -0
  126. package/dist/okx.js +6 -0
  127. package/dist/okx.js.map +1 -0
  128. package/dist/open-sea.js +6 -0
  129. package/dist/open-sea.js.map +1 -0
  130. package/dist/primary-sale-checkout-options.d.ts +29 -0
  131. package/dist/primary-sale.js +3048 -0
  132. package/dist/primary-sale.js.map +1 -0
  133. package/dist/quantityInput.js +93 -0
  134. package/dist/quantityInput.js.map +1 -0
  135. package/dist/ranges.d.ts +125 -0
  136. package/dist/rarible.js +6 -0
  137. package/dist/rarible.js.map +1 -0
  138. package/dist/react/_internal/api/index.d.ts +5 -2
  139. package/dist/react/_internal/api/index.js +4 -7
  140. package/dist/react/_internal/databeat/index.d.ts +4 -1
  141. package/dist/react/_internal/databeat/index.js +4 -37
  142. package/dist/react/_internal/index.d.ts +5 -2
  143. package/dist/react/_internal/index.js +6 -11
  144. package/dist/react/_internal/wagmi/index.d.ts +4 -1
  145. package/dist/react/_internal/wagmi/index.js +2 -5
  146. package/dist/react/hooks/_deprecated/index.d.ts +47 -0
  147. package/dist/react/hooks/_deprecated/index.js +4 -0
  148. package/dist/react/hooks/checkout/index.d.ts +7 -0
  149. package/dist/react/hooks/checkout/index.js +7 -0
  150. package/dist/react/hooks/collectible/index.d.ts +7 -0
  151. package/dist/react/hooks/collectible/index.js +7 -0
  152. package/dist/react/hooks/collection/index.d.ts +11 -0
  153. package/dist/react/hooks/collection/index.js +7 -0
  154. package/dist/react/hooks/config/index.d.ts +9 -8
  155. package/dist/react/hooks/config/index.js +4 -37
  156. package/dist/react/hooks/contracts/index.d.ts +4 -7
  157. package/dist/react/hooks/contracts/index.js +3 -16
  158. package/dist/react/hooks/currency/index.d.ts +47 -0
  159. package/dist/react/hooks/currency/index.js +7 -0
  160. package/dist/react/hooks/index.d.ts +47 -37
  161. package/dist/react/hooks/index.js +14 -38
  162. package/dist/react/hooks/inventory/index.d.ts +7 -0
  163. package/dist/react/hooks/inventory/index.js +4 -0
  164. package/dist/react/hooks/token/index.d.ts +7 -0
  165. package/dist/react/hooks/token/index.js +7 -0
  166. package/dist/react/hooks/transactions/index.d.ts +6 -3
  167. package/dist/react/hooks/transactions/index.js +5 -38
  168. package/dist/react/hooks/ui/card-data/index.d.ts +8 -0
  169. package/dist/react/hooks/ui/card-data/index.js +4 -0
  170. package/dist/react/hooks/ui/index.d.ts +11 -5
  171. package/dist/react/hooks/ui/index.js +8 -38
  172. package/dist/react/hooks/ui/url-state/index.d.ts +7 -0
  173. package/dist/react/hooks/ui/url-state/index.js +4 -0
  174. package/dist/react/hooks/utils/index.d.ts +6 -37
  175. package/dist/react/hooks/utils/index.js +5 -38
  176. package/dist/react/index.d.ts +47 -37
  177. package/dist/react/index.js +20 -38
  178. package/dist/react/providers/index.d.ts +6 -0
  179. package/dist/react/providers/index.js +6 -0
  180. package/dist/react/queries/checkout/index.d.ts +7 -0
  181. package/dist/react/queries/checkout/index.js +4 -0
  182. package/dist/react/queries/collectible/index.d.ts +7 -0
  183. package/dist/react/queries/collectible/index.js +5 -0
  184. package/dist/react/queries/collection/index.d.ts +11 -0
  185. package/dist/react/queries/collection/index.js +4 -0
  186. package/dist/react/queries/currency/index.d.ts +6 -0
  187. package/dist/react/queries/currency/index.js +4 -0
  188. package/dist/react/queries/index.d.ts +23 -24
  189. package/dist/react/queries/index.js +11 -30
  190. package/dist/react/queries/inventory/index.d.ts +7 -3
  191. package/dist/react/queries/inventory/index.js +3 -21
  192. package/dist/react/queries/marketplace/index.d.ts +7 -0
  193. package/dist/react/queries/marketplace/index.js +5 -0
  194. package/dist/react/queries/token/index.d.ts +7 -0
  195. package/dist/react/queries/token/index.js +4 -0
  196. package/dist/react/ssr/index.d.ts +13 -25
  197. package/dist/react/ssr/index.js +13 -36
  198. package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.d.ts +6 -0
  199. package/dist/react/ui/components/marketplace-collectible-card/ActionButton/index.js +6 -0
  200. package/dist/react/ui/components/marketplace-collectible-card/Card/index.d.ts +10 -0
  201. package/dist/react/ui/components/marketplace-collectible-card/Card/index.js +6 -0
  202. package/dist/react/ui/components/marketplace-collectible-card/index.d.ts +45 -5
  203. package/dist/react/ui/components/marketplace-collectible-card/index.js +6 -38
  204. package/dist/react/ui/components/marketplace-collectible-card/utils/index.d.ts +6 -3
  205. package/dist/react/ui/components/marketplace-collectible-card/utils/index.js +3 -12
  206. package/dist/react/ui/components/marketplace-logos/index.d.ts +23 -22
  207. package/dist/react/ui/components/marketplace-logos/index.js +1 -1
  208. package/dist/react/ui/hooks/index.d.ts +47 -0
  209. package/dist/react/ui/hooks/index.js +15 -0
  210. package/dist/react/ui/icons/index.d.ts +3 -1
  211. package/dist/react/ui/icons/index.js +3 -14
  212. package/dist/react/ui/index.d.ts +47 -5
  213. package/dist/react/ui/index.js +6 -38
  214. package/dist/react/ui/modals/BuyModal/index.d.ts +47 -0
  215. package/dist/react/ui/modals/BuyModal/index.js +4 -0
  216. package/dist/react/ui/modals/CreateListingModal/index.d.ts +4 -0
  217. package/dist/react/ui/modals/CreateListingModal/index.js +6 -0
  218. package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.d.ts +190 -0
  219. package/dist/react/ui/modals/CreateListingModal/internal/hooks/index.js +4 -0
  220. package/dist/react/ui/modals/MakeOfferModal/index.d.ts +4 -0
  221. package/dist/react/ui/modals/MakeOfferModal/index.js +4 -0
  222. package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.d.ts +188 -0
  223. package/dist/react/ui/modals/MakeOfferModal/internal/hooks/index.js +3 -0
  224. package/dist/react/ui/modals/SellModal/index.d.ts +6 -0
  225. package/dist/react/ui/modals/SellModal/index.js +6 -0
  226. package/dist/react/ui/modals/TransferModal/index.d.ts +47 -0
  227. package/dist/react/ui/modals/TransferModal/index.js +6 -0
  228. package/dist/react/ui/modals/_internal/components/alertMessage/index.d.ts +14 -0
  229. package/dist/react/ui/modals/_internal/components/alertMessage/index.js +3 -0
  230. package/dist/react/ui/modals/_internal/components/baseModal/index.d.ts +144 -0
  231. package/dist/react/ui/modals/_internal/components/baseModal/index.js +6 -0
  232. package/dist/react/ui/modals/_internal/components/calendar/index.d.ts +73 -0
  233. package/dist/react/ui/modals/_internal/components/calendar/index.js +5 -0
  234. package/dist/react/ui/modals/_internal/components/calendarDropdown/index.d.ts +21 -0
  235. package/dist/react/ui/modals/_internal/components/calendarDropdown/index.js +6 -0
  236. package/dist/react/ui/modals/_internal/components/currencyImage/index.d.ts +15 -0
  237. package/dist/react/ui/modals/_internal/components/currencyImage/index.js +5 -0
  238. package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.d.ts +30 -0
  239. package/dist/react/ui/modals/_internal/components/currencyOptionsSelect/index.js +6 -0
  240. package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.d.ts +2 -0
  241. package/dist/react/ui/modals/_internal/components/expirationDateSelect/index.js +6 -0
  242. package/dist/react/ui/modals/_internal/components/floorPriceText/index.d.ts +24 -0
  243. package/dist/react/ui/modals/_internal/components/floorPriceText/index.js +6 -0
  244. package/dist/react/ui/modals/_internal/components/priceInput/index.d.ts +45 -0
  245. package/dist/react/ui/modals/_internal/components/priceInput/index.js +6 -0
  246. package/dist/react/ui/modals/_internal/components/quantityInput/index.d.ts +24 -0
  247. package/dist/react/ui/modals/_internal/components/quantityInput/index.js +6 -0
  248. package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.d.ts +18 -0
  249. package/dist/react/ui/modals/_internal/components/selectWaasFeeOptions/index.js +6 -0
  250. package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.d.ts +14 -0
  251. package/dist/react/ui/modals/_internal/components/switchChainErrorModal/index.js +6 -0
  252. package/dist/react/ui/modals/_internal/components/timeAgo/index.d.ts +12 -0
  253. package/dist/react/ui/modals/_internal/components/timeAgo/index.js +5 -0
  254. package/dist/react/ui/modals/_internal/components/tokenPreview/index.d.ts +19 -0
  255. package/dist/react/ui/modals/_internal/components/tokenPreview/index.js +6 -0
  256. package/dist/react/ui/modals/_internal/components/transaction-footer/index.d.ts +26 -0
  257. package/dist/react/ui/modals/_internal/components/transaction-footer/index.js +4 -0
  258. package/dist/react/ui/modals/_internal/components/transactionDetails/index.d.ts +28 -0
  259. package/dist/react/ui/modals/_internal/components/transactionDetails/index.js +6 -0
  260. package/dist/react/ui/modals/_internal/components/transactionHeader/index.d.ts +16 -0
  261. package/dist/react/ui/modals/_internal/components/transactionHeader/index.js +3 -0
  262. package/dist/react/ui/modals/_internal/components/transactionPreview/index.d.ts +36 -0
  263. package/dist/react/ui/modals/_internal/components/transactionPreview/index.js +6 -0
  264. package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.d.ts +27 -0
  265. package/dist/react/ui/modals/_internal/components/transactionStatusModal/index.js +6 -0
  266. package/dist/react/utils/index.d.ts +6 -19
  267. package/dist/react/utils/index.js +3 -8
  268. package/dist/react.js +16224 -0
  269. package/dist/react.js.map +1 -0
  270. package/dist/sequence.js +6 -0
  271. package/dist/sequence.js.map +1 -0
  272. package/dist/ssr.js +26 -0
  273. package/dist/ssr.js.map +1 -0
  274. package/dist/steps.d.ts +85 -0
  275. package/dist/styles/index.css +2040 -375
  276. package/dist/sudo-swap.js +6 -0
  277. package/dist/sudo-swap.js.map +1 -0
  278. package/dist/super-rare.js +6 -0
  279. package/dist/super-rare.js.map +1 -0
  280. package/dist/switchChainErrorModal.js +97 -0
  281. package/dist/switchChainErrorModal.js.map +1 -0
  282. package/dist/timeAgo.js +29 -0
  283. package/dist/timeAgo.js.map +1 -0
  284. package/dist/token-balances.d.ts +359 -0
  285. package/dist/token-balances.js +62 -0
  286. package/dist/token-balances.js.map +1 -0
  287. package/dist/token.js +2091 -0
  288. package/dist/token.js.map +1 -0
  289. package/dist/token2.js +247 -0
  290. package/dist/token2.js.map +1 -0
  291. package/dist/transaction-footer.js +45 -0
  292. package/dist/transaction-footer.js.map +1 -0
  293. package/dist/transaction.js +70 -0
  294. package/dist/transaction.js.map +1 -0
  295. package/dist/transactionHeader.js +32 -0
  296. package/dist/transactionHeader.js.map +1 -0
  297. package/dist/types/index.d.ts +5 -2
  298. package/dist/types/index.js +3 -4
  299. package/dist/types.d.ts +88 -0
  300. package/dist/types.js +41 -0
  301. package/dist/types.js.map +1 -0
  302. package/dist/url-state.js +170 -0
  303. package/dist/url-state.js.map +1 -0
  304. package/dist/utils/abi/index.d.ts +6 -5
  305. package/dist/utils/abi/index.js +5 -5
  306. package/dist/utils/abi/marketplace/index.d.ts +1 -1
  307. package/dist/utils/abi/marketplace/index.js +1 -1
  308. package/dist/utils/abi/primary-sale/index.d.ts +1 -1
  309. package/dist/utils/abi/primary-sale/index.js +1 -1
  310. package/dist/utils/abi/token/index.d.ts +1 -1
  311. package/dist/utils/abi/token/index.js +1 -1
  312. package/dist/utils/index.d.ts +9 -7
  313. package/dist/utils/index.js +9 -13
  314. package/dist/utils.js +230 -0
  315. package/dist/utils.js.map +1 -0
  316. package/dist/utils2.js +76 -0
  317. package/dist/utils2.js.map +1 -0
  318. package/dist/waas-types.d.ts +19 -0
  319. package/dist/wagmi.js +0 -0
  320. package/dist/x2y2.js +6 -0
  321. package/dist/x2y2.js.map +1 -0
  322. package/dist/xstate-store.cjs.d.ts +18 -0
  323. package/dist/zora.js +6 -0
  324. package/dist/zora.js.map +1 -0
  325. package/eslint/sequence-types.js +1069 -0
  326. package/eslint.config.mjs +337 -9
  327. package/image.d.ts +5 -0
  328. package/package.json +52 -50
  329. package/postcss.config.mjs +1 -1
  330. package/preserve-directives.ts +235 -0
  331. package/public/mockServiceWorker.js +0 -1
  332. package/src/react/_internal/api/builder-api.ts +26 -4
  333. package/src/react/_internal/api/index.ts +1 -2
  334. package/src/react/_internal/api/marketplace-api.ts +57 -25
  335. package/src/react/_internal/api/services.ts +56 -4
  336. package/src/react/_internal/api-mocks.ts +8 -0
  337. package/src/react/_internal/databeat/index.ts +4 -0
  338. package/src/react/_internal/databeat/types.ts +24 -28
  339. package/src/react/_internal/index.ts +70 -0
  340. package/src/react/_internal/query-builder.ts +203 -0
  341. package/src/react/_internal/types.ts +88 -18
  342. package/src/react/_internal/utils.ts +34 -52
  343. package/src/react/_internal/wagmi/__tests__/create-config.test.ts +11 -5
  344. package/src/react/_internal/wagmi/create-config.ts +2 -2
  345. package/src/react/_internal/wagmi/get-connectors.ts +22 -7
  346. package/src/react/hooks/_deprecated/index.ts +61 -0
  347. package/src/react/hooks/checkout/index.ts +1 -0
  348. package/src/react/hooks/checkout/primary-sale-checkout-options.test.tsx +206 -0
  349. package/src/react/hooks/checkout/primary-sale-checkout-options.tsx +111 -0
  350. package/src/react/hooks/collectible/balance.test.tsx +149 -0
  351. package/src/react/hooks/collectible/balance.tsx +39 -0
  352. package/src/react/hooks/collectible/erc721-sale-details.tsx +184 -0
  353. package/src/react/hooks/collectible/index.ts +16 -0
  354. package/src/react/hooks/collectible/market-count.test.tsx +133 -0
  355. package/src/react/hooks/collectible/market-count.tsx +75 -0
  356. package/src/react/hooks/collectible/market-highest-offer.test.tsx +112 -0
  357. package/src/react/hooks/collectible/market-highest-offer.tsx +74 -0
  358. package/src/react/hooks/collectible/market-list-paginated.test.tsx +211 -0
  359. package/src/react/hooks/collectible/market-list-paginated.tsx +109 -0
  360. package/src/react/hooks/collectible/market-list.test.tsx +243 -0
  361. package/src/react/hooks/collectible/market-list.tsx +79 -0
  362. package/src/react/hooks/collectible/market-listings-count.test.tsx +110 -0
  363. package/src/react/hooks/collectible/market-listings-count.tsx +75 -0
  364. package/src/react/hooks/collectible/market-listings.test.tsx +140 -0
  365. package/src/react/hooks/collectible/market-listings.tsx +99 -0
  366. package/src/react/hooks/collectible/market-lowest-listing.test.tsx +157 -0
  367. package/src/react/hooks/collectible/market-lowest-listing.tsx +74 -0
  368. package/src/react/hooks/collectible/market-offers-count.test.tsx +110 -0
  369. package/src/react/hooks/collectible/market-offers-count.tsx +75 -0
  370. package/src/react/hooks/collectible/market-offers.test.tsx +139 -0
  371. package/src/react/hooks/collectible/market-offers.tsx +79 -0
  372. package/src/react/hooks/collectible/metadata.test.tsx +119 -0
  373. package/src/react/hooks/collectible/metadata.tsx +72 -0
  374. package/src/react/hooks/collectible/primary-sale-item.test.tsx +503 -0
  375. package/src/react/hooks/collectible/primary-sale-item.tsx +69 -0
  376. package/src/react/hooks/collectible/primary-sale-items-count.test.tsx +154 -0
  377. package/src/react/hooks/collectible/primary-sale-items-count.tsx +22 -0
  378. package/src/react/hooks/collectible/primary-sale-items.test.tsx +259 -0
  379. package/src/react/hooks/collectible/primary-sale-items.tsx +66 -0
  380. package/src/react/hooks/collectible/token-balances.test.tsx +175 -0
  381. package/src/react/hooks/collectible/token-balances.tsx +38 -0
  382. package/src/react/hooks/collection/__snapshots__/list.test.tsx.snap +303 -0
  383. package/src/react/hooks/collection/balance-details.test.tsx +163 -0
  384. package/src/react/hooks/collection/balance-details.tsx +106 -0
  385. package/src/react/hooks/collection/index.ts +11 -0
  386. package/src/react/hooks/collection/list.test.tsx +111 -0
  387. package/src/react/hooks/collection/list.tsx +80 -0
  388. package/src/react/hooks/collection/market-detail-polling.test.tsx +146 -0
  389. package/src/react/hooks/collection/market-detail-polling.tsx +65 -0
  390. package/src/react/hooks/collection/market-filtered-count.test.tsx +121 -0
  391. package/src/react/hooks/collection/market-filtered-count.tsx +39 -0
  392. package/src/react/hooks/collection/market-floor.test.tsx +104 -0
  393. package/src/react/hooks/collection/market-floor.tsx +74 -0
  394. package/src/react/hooks/collection/market-items-count.test.tsx +121 -0
  395. package/src/react/hooks/collection/market-items-count.tsx +90 -0
  396. package/src/react/hooks/collection/market-items-paginated.test.tsx +142 -0
  397. package/src/react/hooks/collection/market-items-paginated.tsx +110 -0
  398. package/src/react/hooks/collection/market-items.test.tsx +184 -0
  399. package/src/react/hooks/collection/market-items.tsx +95 -0
  400. package/src/react/hooks/collection/metadata.test.tsx +103 -0
  401. package/src/react/hooks/collection/metadata.tsx +75 -0
  402. package/src/react/hooks/collection/useCollectionActiveListingsCurrencies.test.tsx +150 -0
  403. package/src/react/hooks/collection/useCollectionActiveListingsCurrencies.tsx +74 -0
  404. package/src/react/hooks/collection/useCollectionActiveOffersCurrencies.test.tsx +150 -0
  405. package/src/react/hooks/collection/useCollectionActiveOffersCurrencies.tsx +74 -0
  406. package/src/react/hooks/config/__snapshots__/useMarketplaceConfig.test.tsx.snap +12 -11
  407. package/src/react/hooks/config/useConnectorMetadata.tsx +1 -1
  408. package/src/react/hooks/config/useMarketplaceConfig.test.tsx +3 -1
  409. package/src/react/hooks/config/useMarketplaceConfig.tsx +1 -1
  410. package/src/react/hooks/contracts/index.ts +1 -0
  411. package/src/react/hooks/contracts/useERC721Owner.test.tsx +82 -0
  412. package/src/react/hooks/contracts/useERC721Owner.tsx +47 -0
  413. package/src/react/hooks/contracts/useSalesContractABI.ts +2 -2
  414. package/src/react/hooks/currency/compare-prices.test.tsx +221 -0
  415. package/src/react/hooks/currency/compare-prices.tsx +104 -0
  416. package/src/react/hooks/currency/convert-to-usd.test.tsx +173 -0
  417. package/src/react/hooks/currency/convert-to-usd.tsx +96 -0
  418. package/src/react/hooks/currency/currency.test.tsx +131 -0
  419. package/src/react/hooks/currency/currency.tsx +65 -0
  420. package/src/react/hooks/currency/index.ts +4 -0
  421. package/src/react/hooks/currency/list.test.tsx +191 -0
  422. package/src/react/hooks/currency/list.tsx +65 -0
  423. package/src/react/hooks/data/orders/useOrders.test.tsx +143 -0
  424. package/src/react/hooks/data/orders/useOrders.tsx +73 -0
  425. package/src/react/hooks/data/tokens/useCurrencyBalance.tsx +1 -1
  426. package/src/react/hooks/index.ts +9 -12
  427. package/src/react/hooks/inventory/index.ts +1 -0
  428. package/src/react/hooks/inventory/inventory.test.tsx +160 -0
  429. package/src/react/hooks/inventory/inventory.tsx +17 -0
  430. package/src/react/hooks/token/balances.test.tsx +111 -0
  431. package/src/react/hooks/token/balances.tsx +59 -0
  432. package/src/react/hooks/token/currency-balance.test.tsx +83 -0
  433. package/src/react/hooks/token/currency-balance.tsx +151 -0
  434. package/src/react/hooks/token/index.ts +5 -0
  435. package/src/react/hooks/token/metadata-search.test.tsx +292 -0
  436. package/src/react/hooks/token/metadata-search.tsx +192 -0
  437. package/src/react/hooks/token/metadata.test.tsx +140 -0
  438. package/src/react/hooks/token/metadata.tsx +73 -0
  439. package/src/react/hooks/token/ranges.test.tsx +112 -0
  440. package/src/react/hooks/token/ranges.tsx +93 -0
  441. package/src/react/hooks/transactions/index.ts +5 -0
  442. package/src/react/hooks/transactions/useBuyTransaction.tsx +95 -0
  443. package/src/react/hooks/transactions/useCancelOrder.test.tsx +15 -35
  444. package/src/react/hooks/transactions/useCancelOrder.tsx +3 -9
  445. package/src/react/hooks/transactions/useCancelTransactionSteps.tsx +3 -9
  446. package/src/react/hooks/transactions/useGenerateCancelTransaction.test.tsx +23 -12
  447. package/src/react/hooks/transactions/useGenerateCancelTransaction.tsx +16 -11
  448. package/src/react/hooks/transactions/useGenerateListingTransaction.test.tsx +17 -57
  449. package/src/react/hooks/transactions/useGenerateListingTransaction.tsx +17 -12
  450. package/src/react/hooks/transactions/useGenerateOfferTransaction.test.tsx +14 -15
  451. package/src/react/hooks/transactions/useGenerateOfferTransaction.tsx +11 -11
  452. package/src/react/hooks/transactions/useGenerateSellTransaction.test.tsx +28 -38
  453. package/src/react/hooks/transactions/useGenerateSellTransaction.tsx +16 -15
  454. package/src/react/hooks/transactions/useMarketTransactionSteps.test.tsx +105 -0
  455. package/src/react/hooks/transactions/useMarketTransactionSteps.tsx +89 -0
  456. package/src/react/hooks/transactions/useOrderSteps.tsx +23 -36
  457. package/src/react/hooks/transactions/usePrimarySaleTransactionSteps.ts +196 -0
  458. package/src/react/hooks/transactions/useProcessStep.test.tsx +63 -59
  459. package/src/react/hooks/transactions/useProcessStep.ts +52 -54
  460. package/src/react/hooks/transactions/useTransactionExecution.test.tsx +99 -0
  461. package/src/react/hooks/transactions/useTransactionExecution.ts +31 -0
  462. package/src/react/hooks/transactions/useTransactionType.ts +20 -0
  463. package/src/react/hooks/transactions/useTransferTokens.test.tsx +16 -16
  464. package/src/react/hooks/transactions/useTransferTokens.tsx +17 -5
  465. package/src/react/hooks/ui/card-data/index.ts +4 -0
  466. package/src/react/hooks/ui/card-data/market-card-data-paged.test.tsx +375 -0
  467. package/src/react/hooks/ui/card-data/market-card-data-paged.tsx +265 -0
  468. package/src/react/hooks/ui/card-data/market-card-data.test.tsx +299 -0
  469. package/src/react/hooks/ui/card-data/market-card-data.tsx +178 -0
  470. package/src/react/hooks/ui/card-data/primary-sale-1155-card-data.tsx +89 -0
  471. package/src/react/hooks/ui/card-data/primary-sale-721-card-data.tsx +227 -0
  472. package/src/react/hooks/ui/index.ts +3 -1
  473. package/src/react/hooks/ui/url-state/filter-state.test.tsx +569 -0
  474. package/src/react/hooks/ui/url-state/filter-state.tsx +264 -0
  475. package/src/react/hooks/ui/url-state/index.ts +1 -0
  476. package/src/react/hooks/ui/useCollectibleCardOfferState.test.tsx +75 -0
  477. package/src/react/hooks/ui/useCollectibleCardOfferState.ts +47 -0
  478. package/src/react/hooks/ui/useFilters.test.tsx +4 -1
  479. package/src/react/hooks/ui/useFilters.tsx +2 -2
  480. package/src/react/hooks/util/optimisticCancelUpdates.test.ts +489 -0
  481. package/src/react/hooks/util/optimisticCancelUpdates.ts +21 -22
  482. package/src/react/hooks/utils/index.ts +0 -4
  483. package/src/react/hooks/utils/useAutoSelectFeeOption.test.tsx +8 -5
  484. package/src/react/hooks/utils/useAutoSelectFeeOption.tsx +33 -17
  485. package/src/react/hooks/utils/useRoyalty.test.tsx +1 -1
  486. package/src/react/hooks/utils/useRoyalty.tsx +99 -34
  487. package/src/react/hooks/utils/useWaasFeeOptions.tsx +234 -0
  488. package/src/react/hooks/utils/waasFeeOptionsStore.ts +141 -0
  489. package/src/react/index.ts +3 -0
  490. package/src/react/providers/index.tsx +3 -3
  491. package/src/react/providers/modal-provider.tsx +6 -17
  492. package/src/react/providers/provider.test.tsx +1 -1
  493. package/src/react/providers/shadow-root.tsx +1 -1
  494. package/src/react/providers/theme-provider.tsx +1 -1
  495. package/src/react/queries/checkout/index.ts +1 -0
  496. package/src/react/queries/checkout/primary-sale-checkout-options.ts +118 -0
  497. package/src/react/queries/collectible/balance.ts +113 -0
  498. package/src/react/queries/collectible/index.ts +15 -0
  499. package/src/react/queries/collectible/market-count.ts +91 -0
  500. package/src/react/queries/collectible/market-highest-offer.ts +74 -0
  501. package/src/react/queries/collectible/market-list-paginated.ts +110 -0
  502. package/src/react/queries/collectible/market-list.ts +116 -0
  503. package/src/react/queries/collectible/market-listings-count.ts +70 -0
  504. package/src/react/queries/collectible/market-listings.ts +71 -0
  505. package/src/react/queries/collectible/market-lowest-listing.ts +74 -0
  506. package/src/react/queries/collectible/market-offers-count.ts +70 -0
  507. package/src/react/queries/collectible/market-offers.ts +90 -0
  508. package/src/react/queries/collectible/metadata.ts +84 -0
  509. package/src/react/queries/collectible/primary-sale-item.ts +79 -0
  510. package/src/react/queries/collectible/primary-sale-items-count.ts +67 -0
  511. package/src/react/queries/collectible/primary-sale-items.ts +96 -0
  512. package/src/react/queries/collectible/queryKeys.ts +12 -0
  513. package/src/react/queries/collectible/token-balances.ts +83 -0
  514. package/src/react/queries/collection/activeListingsCurrencies.ts +74 -0
  515. package/src/react/queries/collection/activeOffersCurrencies.ts +74 -0
  516. package/src/react/queries/collection/balance-details.ts +103 -0
  517. package/src/react/queries/collection/index.ts +9 -0
  518. package/src/react/queries/collection/list.ts +195 -0
  519. package/src/react/queries/collection/market-detail.ts +60 -0
  520. package/src/react/queries/collection/market-filtered-count.ts +67 -0
  521. package/src/react/queries/collection/market-floor.ts +58 -0
  522. package/src/react/queries/collection/market-items-count.ts +69 -0
  523. package/src/react/queries/collection/market-items-paginated.ts +84 -0
  524. package/src/react/queries/collection/market-items.ts +72 -0
  525. package/src/react/queries/collection/metadata.ts +60 -0
  526. package/src/react/queries/collection/queryKeys.ts +12 -0
  527. package/src/react/queries/currency/compare-prices.ts +122 -0
  528. package/src/react/queries/currency/convert-to-usd.ts +99 -0
  529. package/src/react/queries/currency/currency.ts +82 -0
  530. package/src/react/queries/currency/index.ts +4 -0
  531. package/src/react/queries/currency/list.ts +100 -0
  532. package/src/react/queries/index.ts +6 -7
  533. package/src/react/queries/inventory/inventory.ts +139 -91
  534. package/src/react/queries/marketplace/config.ts +85 -0
  535. package/src/react/queries/marketplace/filters.ts +139 -0
  536. package/src/react/queries/marketplace/index.ts +2 -0
  537. package/src/react/queries/marketplace/queryKeys.ts +12 -0
  538. package/src/react/queries/orders.ts +48 -0
  539. package/src/react/queries/token/balances.ts +107 -0
  540. package/src/react/queries/token/index.ts +5 -0
  541. package/src/react/queries/token/metadata-search.ts +95 -0
  542. package/src/react/queries/token/metadata.ts +80 -0
  543. package/src/react/queries/token/queryKeys.ts +12 -0
  544. package/src/react/queries/token/ranges.ts +74 -0
  545. package/src/react/queries/token/supplies.ts +86 -0
  546. package/src/react/ssr/__tests__/__snapshots__/create-ssr-client.test.ts.snap +11 -10
  547. package/src/react/ssr/create-ssr-client.ts +1 -1
  548. package/src/react/ssr/index.ts +5 -0
  549. package/src/react/types/query.ts +8 -7
  550. package/src/react/ui/components/_internals/ErrorDisplay.tsx +87 -0
  551. package/src/react/ui/components/_internals/ErrorLogBox.tsx +8 -1
  552. package/src/react/ui/components/_internals/custom-select/CustomSelect.tsx +13 -14
  553. package/src/react/ui/components/_internals/pill/__tests__/Pill.test.tsx +9 -5
  554. package/src/react/ui/components/marketplace-collectible-card/ActionButton/ActionButton.stories.tsx +293 -0
  555. package/src/react/ui/components/marketplace-collectible-card/ActionButton/ActionButton.tsx +114 -0
  556. package/src/react/ui/components/marketplace-collectible-card/ActionButton/__tests__/ActionButtonBody.test.tsx +106 -0
  557. package/src/react/ui/components/marketplace-collectible-card/ActionButton/__tests__/NonOwnerActions.test.tsx +70 -0
  558. package/src/react/ui/components/marketplace-collectible-card/ActionButton/__tests__/OwnerActions.test.tsx +68 -0
  559. package/src/react/ui/components/marketplace-collectible-card/ActionButton/__tests__/useActionButtonLogic.test.tsx +101 -0
  560. package/src/react/ui/components/marketplace-collectible-card/ActionButton/components/ActionButtonBody.tsx +57 -0
  561. package/src/react/ui/components/marketplace-collectible-card/ActionButton/components/NonOwnerActions.tsx +136 -0
  562. package/src/react/ui/components/marketplace-collectible-card/ActionButton/components/OwnerActions.tsx +91 -0
  563. package/src/react/ui/components/marketplace-collectible-card/ActionButton/hooks/useActionButtonLogic.ts +97 -0
  564. package/src/react/ui/components/marketplace-collectible-card/ActionButton/index.ts +1 -0
  565. package/src/react/ui/components/marketplace-collectible-card/ActionButton/store.ts +85 -0
  566. package/src/react/ui/components/marketplace-collectible-card/Card/card-badge.tsx +37 -0
  567. package/src/react/ui/components/marketplace-collectible-card/Card/card-content.tsx +27 -0
  568. package/src/react/ui/components/marketplace-collectible-card/Card/card-footer.tsx +38 -0
  569. package/src/react/ui/components/marketplace-collectible-card/Card/card-media.tsx +69 -0
  570. package/src/react/ui/components/marketplace-collectible-card/Card/card-price.tsx +44 -0
  571. package/src/react/ui/components/marketplace-collectible-card/Card/card-sale-details.tsx +37 -0
  572. package/src/react/ui/components/marketplace-collectible-card/Card/card-skeleton.tsx +39 -0
  573. package/src/react/ui/components/marketplace-collectible-card/Card/card-title.tsx +109 -0
  574. package/src/react/ui/components/marketplace-collectible-card/Card/card.tsx +51 -0
  575. package/src/react/ui/components/marketplace-collectible-card/Card/index.ts +30 -0
  576. package/src/react/ui/components/marketplace-collectible-card/CollectibleCardSkeleton.tsx +1 -1
  577. package/src/react/ui/components/marketplace-collectible-card/_internals/PriceDisplay.tsx +87 -0
  578. package/src/react/ui/components/marketplace-collectible-card/constants.ts +20 -0
  579. package/src/react/ui/components/marketplace-collectible-card/index.ts +6 -0
  580. package/src/react/ui/components/marketplace-collectible-card/types.ts +31 -16
  581. package/src/react/ui/components/marketplace-collectible-card/utils/determineCardAction.ts +63 -0
  582. package/src/react/ui/components/marketplace-collectible-card/utils/formatPrice.ts +71 -2
  583. package/src/react/ui/components/marketplace-collectible-card/utils/index.ts +3 -0
  584. package/src/react/ui/components/marketplace-collectible-card/utils/renderSkeleton.tsx +44 -0
  585. package/src/react/ui/components/marketplace-collectible-card/utils/shopCardState.ts +83 -0
  586. package/src/react/ui/components/marketplace-collectible-card/utils/supplyStatus.ts +5 -5
  587. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCard.tsx +63 -78
  588. package/src/react/ui/components/marketplace-collectible-card/variants/MarketCardPresentation.tsx +170 -0
  589. package/src/react/ui/components/marketplace-collectible-card/variants/NonTradableInventoryCard.tsx +56 -38
  590. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCard.tsx +55 -65
  591. package/src/react/ui/components/marketplace-collectible-card/variants/ShopCardPresentation.tsx +144 -0
  592. package/src/react/ui/components/marketplace-logos/marketplace-logos.tsx +1 -5
  593. package/src/react/ui/components/media/Media.tsx +1 -1
  594. package/src/react/ui/components/media/MediaSkeleton.tsx +1 -1
  595. package/src/react/ui/hooks/index.ts +2 -0
  596. package/src/react/ui/icons/BellIcon.tsx +7 -3
  597. package/src/react/ui/icons/iconVariants.ts +11 -0
  598. package/src/react/ui/icons/index.ts +0 -3
  599. package/src/react/ui/index.ts +37 -8
  600. package/src/react/ui/modals/BuyModal/components/BuyModalContent.tsx +161 -0
  601. package/src/react/ui/modals/BuyModal/components/CollectibleMetadataSummary.tsx +141 -0
  602. package/src/react/ui/modals/BuyModal/components/CryptoPaymentModal.tsx +177 -0
  603. package/src/react/ui/modals/BuyModal/components/CryptoPaymentModalSkeleton.tsx +48 -0
  604. package/src/react/ui/modals/BuyModal/components/Modal.tsx +2 -2
  605. package/src/react/ui/modals/BuyModal/components/TrailsCss.ts +216 -0
  606. package/src/react/ui/modals/BuyModal/components/sequence-checkout/ERC1155QuantityModal.tsx +197 -0
  607. package/src/react/ui/modals/BuyModal/components/sequence-checkout/SequenceCheckoutNew.tsx +161 -0
  608. package/src/react/ui/modals/BuyModal/components/sequence-checkout/usePaymentModalParams.ts +204 -0
  609. package/src/react/ui/modals/BuyModal/components/types.ts +6 -5
  610. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155SalePaymentParams.test.tsx +369 -0
  611. package/src/react/ui/modals/BuyModal/hooks/useBuyModalData.ts +151 -0
  612. package/src/react/ui/modals/BuyModal/hooks/useERC1155SalePaymentParams.ts +244 -0
  613. package/src/react/ui/modals/BuyModal/hooks/useExecuteBundledTransactions.ts +167 -0
  614. package/src/react/ui/modals/BuyModal/hooks/useHasSufficientBalance.ts +30 -0
  615. package/src/react/ui/modals/BuyModal/hooks/useMarketPlatformFee.ts +2 -2
  616. package/src/react/ui/modals/BuyModal/index.tsx +6 -3
  617. package/src/react/ui/modals/BuyModal/internal/__tests__/determineCheckoutMode.test.ts +119 -0
  618. package/src/react/ui/modals/BuyModal/internal/buyModalContext.ts +146 -0
  619. package/src/react/ui/modals/BuyModal/internal/cryptoPaymentModalContext.tsx +399 -0
  620. package/src/react/ui/modals/BuyModal/internal/determineCheckoutMode.ts +49 -0
  621. package/src/react/ui/modals/BuyModal/store.ts +25 -94
  622. package/src/react/ui/modals/CreateListingModal/Modal.tsx +141 -308
  623. package/src/react/ui/modals/CreateListingModal/__tests__/Modal.test.tsx +35 -61
  624. package/src/react/ui/modals/CreateListingModal/index.tsx +16 -9
  625. package/src/react/ui/modals/CreateListingModal/internal/context.ts +416 -0
  626. package/src/react/ui/modals/CreateListingModal/internal/helpers/validation.ts +79 -0
  627. package/src/react/ui/modals/CreateListingModal/internal/hooks/index.ts +1 -0
  628. package/src/react/ui/modals/CreateListingModal/internal/hooks/use-collectible-approval.ts +49 -0
  629. package/src/react/ui/modals/CreateListingModal/internal/listing-mutations.ts +267 -0
  630. package/src/react/ui/modals/CreateListingModal/internal/store.ts +150 -0
  631. package/src/react/ui/modals/MakeOfferModal/Modal.tsx +130 -348
  632. package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.mock-data.ts +494 -0
  633. package/src/react/ui/modals/MakeOfferModal/__stories__/MakeOfferModal.stories.tsx +699 -0
  634. package/src/react/ui/modals/MakeOfferModal/__tests__/Modal.test.tsx +28 -155
  635. package/src/react/ui/modals/MakeOfferModal/index.tsx +17 -11
  636. package/src/react/ui/modals/MakeOfferModal/internal/context.ts +453 -0
  637. package/src/react/ui/modals/MakeOfferModal/internal/helpers/validation.ts +99 -0
  638. package/src/react/ui/modals/MakeOfferModal/internal/hooks/index.ts +1 -0
  639. package/src/react/ui/modals/MakeOfferModal/internal/hooks/use-erc20-allowance.ts +43 -0
  640. package/src/react/ui/modals/MakeOfferModal/internal/offer-mutations.ts +231 -0
  641. package/src/react/ui/modals/MakeOfferModal/internal/store.ts +150 -0
  642. package/src/react/ui/modals/SellModal/Modal.tsx +74 -213
  643. package/src/react/ui/modals/SellModal/index.tsx +5 -11
  644. package/src/react/ui/modals/SellModal/internal/context.ts +284 -0
  645. package/src/react/ui/modals/SellModal/internal/sell-mutations.ts +163 -0
  646. package/src/react/ui/modals/SellModal/internal/store.ts +76 -0
  647. package/src/react/ui/modals/SellModal/internal/use-generate-sell-transaction.ts +93 -0
  648. package/src/react/ui/modals/TransferModal/__tests__/store.test.ts +51 -345
  649. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TokenQuantityInput.tsx +36 -34
  650. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/WalletAddressInput.tsx +19 -28
  651. package/src/react/ui/modals/TransferModal/index.tsx +98 -97
  652. package/src/react/ui/modals/TransferModal/internal/context.ts +404 -0
  653. package/src/react/ui/modals/TransferModal/internal/store.ts +118 -0
  654. package/src/react/ui/modals/_internal/components/alertMessage/index.tsx +2 -3
  655. package/src/react/ui/modals/_internal/components/baseModal/ActionModal.tsx +338 -0
  656. package/src/react/ui/modals/_internal/components/baseModal/BaseModal.tsx +51 -0
  657. package/src/react/ui/modals/_internal/components/baseModal/ErrorBoundary.tsx +83 -0
  658. package/src/react/ui/modals/_internal/components/baseModal/ErrorModal.tsx +51 -0
  659. package/src/react/ui/modals/_internal/components/baseModal/LoadingModal.tsx +35 -0
  660. package/src/react/ui/modals/_internal/components/baseModal/SmartErrorHandler.tsx +31 -0
  661. package/src/react/ui/modals/_internal/components/baseModal/__tests__/ErrorBoundary.test.tsx +390 -0
  662. package/src/react/ui/modals/_internal/components/baseModal/errors/ModalInitializationError.tsx +91 -0
  663. package/src/react/ui/modals/_internal/components/baseModal/errors/errorActionType.ts +5 -0
  664. package/src/react/ui/modals/_internal/components/baseModal/index.ts +13 -0
  665. package/src/react/ui/modals/_internal/components/calendarDropdown/TimeSelector.tsx +1 -1
  666. package/src/react/ui/modals/_internal/components/calendarDropdown/index.tsx +14 -9
  667. package/src/react/ui/modals/_internal/components/consts.ts +19 -5
  668. package/src/react/ui/modals/_internal/components/currencyImage/index.tsx +5 -7
  669. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/__tests__/index.test.tsx +6 -14
  670. package/src/react/ui/modals/_internal/components/currencyOptionsSelect/index.tsx +17 -24
  671. package/src/react/ui/modals/_internal/components/expirationDateSelect/index.tsx +1 -1
  672. package/src/react/ui/modals/_internal/components/floorPriceText/__tests__/FloorPriceText.test.tsx +61 -40
  673. package/src/react/ui/modals/_internal/components/floorPriceText/index.tsx +23 -19
  674. package/src/react/ui/modals/_internal/components/priceInput/__tests__/PriceInput.test.tsx +3 -3
  675. package/src/react/ui/modals/_internal/components/priceInput/index.tsx +66 -66
  676. package/src/react/ui/modals/_internal/components/quantityInput/__tests__/index.test.tsx +22 -137
  677. package/src/react/ui/modals/_internal/components/quantityInput/index.tsx +84 -131
  678. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/__tests__/SelectWaasFeeOptions.test.tsx +14 -31
  679. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/_components/ActionButtons.tsx +37 -25
  680. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/index.tsx +13 -6
  681. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/store.ts +9 -26
  682. package/src/react/ui/modals/_internal/components/selectWaasFeeOptions/useWaasFeeOptionManager.tsx +27 -29
  683. package/src/react/ui/modals/_internal/components/switchChainErrorModal/store.ts +2 -2
  684. package/src/react/ui/modals/_internal/components/tokenPreview/index.tsx +10 -9
  685. package/src/react/ui/modals/_internal/components/transactionDetails/index.tsx +11 -7
  686. package/src/react/ui/modals/_internal/components/transactionPreview/index.tsx +8 -7
  687. package/src/react/ui/modals/_internal/components/transactionPreview/useTransactionPreviewTitle.tsx +1 -1
  688. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/TransactionStatusModal.test.tsx +3 -5
  689. package/src/react/ui/modals/_internal/components/transactionStatusModal/__tests__/utils.test.ts +3 -3
  690. package/src/react/ui/modals/_internal/components/transactionStatusModal/hooks/useTransactionStatus.ts +4 -15
  691. package/src/react/ui/modals/_internal/components/transactionStatusModal/index.tsx +14 -15
  692. package/src/react/ui/modals/_internal/components/transactionStatusModal/store.ts +8 -11
  693. package/src/react/ui/modals/_internal/components/waasFeeOptionsSelect/WaasFeeOptionsSelect.tsx +65 -10
  694. package/src/react/ui/modals/_internal/constants/opensea-currencies.ts +484 -0
  695. package/src/react/ui/modals/_internal/helpers/currency.ts +56 -0
  696. package/src/react/ui/modals/_internal/helpers/dnum-utils.ts +40 -0
  697. package/src/react/ui/modals/_internal/helpers/flow-state.ts +269 -0
  698. package/src/react/ui/modals/_internal/helpers/step-guards.ts +131 -0
  699. package/src/react/ui/modals/_internal/types/steps.ts +145 -0
  700. package/src/react/ui/modals/_internal/types.ts +2 -9
  701. package/src/react/utils/index.ts +2 -0
  702. package/src/react/utils/normalize-attributes.test.ts +94 -0
  703. package/src/react/utils/normalize-attributes.ts +89 -0
  704. package/src/react/utils/normalize-properties.test.ts +77 -0
  705. package/src/react/utils/normalize-properties.ts +60 -0
  706. package/src/react/utils/normalizePriceFilters.ts +25 -0
  707. package/src/react/utils/waitForTransactionReceipt.ts +2 -2
  708. package/src/styles/index.css +2 -0
  709. package/src/styles/styles.ts +2036 -374
  710. package/src/types/api-types.ts +6 -14
  711. package/src/types/buyModalErrors.ts +24 -30
  712. package/src/types/index.ts +4 -2
  713. package/src/types/sdk-config.ts +14 -1
  714. package/src/types/transactions.ts +10 -0
  715. package/src/types/types.ts +93 -14
  716. package/src/utils/__tests__/getMarketplaceDetails.test.ts +1 -1
  717. package/src/utils/_internal/error/base.ts +1 -1
  718. package/src/utils/_internal/error/transaction.ts +4 -5
  719. package/src/utils/abi/helpers.ts +38 -0
  720. package/src/utils/abi/index.ts +1 -0
  721. package/src/utils/decode/erc20.ts +2 -2
  722. package/src/utils/errors.ts +527 -0
  723. package/src/utils/getConduitAddressForOrderbook.ts +38 -0
  724. package/src/utils/getErrorMessage.ts +37 -0
  725. package/src/utils/getMarketplaceDetails.ts +1 -1
  726. package/src/utils/getSequenceMarketRequestId.ts +3 -7
  727. package/src/utils/getWagmiErrorMessage.ts +241 -0
  728. package/src/utils/getWebRPCErrorMessage.ts +63 -0
  729. package/src/utils/networkconfigToWagmiChain.ts +2 -1
  730. package/src/utils/price.ts +12 -10
  731. package/test/const.ts +3 -3
  732. package/test/globalSetup.ts +4 -5
  733. package/test/handlers.ts +2 -2
  734. package/test/server-setup.ts +8 -8
  735. package/test/setup.ts +11 -0
  736. package/test/test-utils.tsx +23 -6
  737. package/tsconfig.json +8 -1
  738. package/tsdown.config.ts +13 -3
  739. package/dist/BellIcon-DMKEumAz.js +0 -45
  740. package/dist/BellIcon-DMKEumAz.js.map +0 -1
  741. package/dist/CartIcon-UyB4NYKt.js +0 -102
  742. package/dist/CartIcon-UyB4NYKt.js.map +0 -1
  743. package/dist/CollectibleCard-z05qWzKE.d.ts +0 -8
  744. package/dist/_internal-DkS2VUn5.js +0 -22
  745. package/dist/_internal-DkS2VUn5.js.map +0 -1
  746. package/dist/abi-fa-o9gH3.js +0 -134
  747. package/dist/abi-fa-o9gH3.js.map +0 -1
  748. package/dist/alien_swap-Cq8LuElo.js +0 -6
  749. package/dist/alien_swap-Cq8LuElo.js.map +0 -1
  750. package/dist/api-GwTR0dBA.js +0 -210
  751. package/dist/api-GwTR0dBA.js.map +0 -1
  752. package/dist/aqua-xyz-0yye_c-Z.js +0 -6
  753. package/dist/aqua-xyz-0yye_c-Z.js.map +0 -1
  754. package/dist/aura-TaxFvTFQ.js +0 -6
  755. package/dist/aura-TaxFvTFQ.js.map +0 -1
  756. package/dist/blur-BupOTobO.js +0 -6
  757. package/dist/blur-BupOTobO.js.map +0 -1
  758. package/dist/builder-api-m4JAA6ee.js +0 -28
  759. package/dist/builder-api-m4JAA6ee.js.map +0 -1
  760. package/dist/builder.gen--XD71cNL.js +0 -303
  761. package/dist/builder.gen--XD71cNL.js.map +0 -1
  762. package/dist/coinbase-DTgZ4wDT.js +0 -6
  763. package/dist/coinbase-DTgZ4wDT.js.map +0 -1
  764. package/dist/collectibles-CZ6i8sXK.js +0 -324
  765. package/dist/collectibles-CZ6i8sXK.js.map +0 -1
  766. package/dist/collections-5NcU-7ZR.js +0 -331
  767. package/dist/collections-5NcU-7ZR.js.map +0 -1
  768. package/dist/components-CY8kx2kb.js +0 -123
  769. package/dist/components-CY8kx2kb.js.map +0 -1
  770. package/dist/contracts-DRJHF89h.js +0 -97
  771. package/dist/contracts-DRJHF89h.js.map +0 -1
  772. package/dist/create-config-BxyfYCEk.js +0 -172
  773. package/dist/create-config-BxyfYCEk.js.map +0 -1
  774. package/dist/create-config-CFBeD8CB.d.ts +0 -2019
  775. package/dist/element-D4dDznlu.js +0 -6
  776. package/dist/element-D4dDznlu.js.map +0 -1
  777. package/dist/filters-B5niI_fX.d.ts +0 -60
  778. package/dist/foundation-GHZOKAzN.js +0 -6
  779. package/dist/foundation-GHZOKAzN.js.map +0 -1
  780. package/dist/index-8scPf0CS.d.ts +0 -55
  781. package/dist/index-9qsplZ8r.d.ts +0 -18
  782. package/dist/index-BIuYTMc2.d.ts +0 -122
  783. package/dist/index-BNrz99xy.d.ts +0 -24
  784. package/dist/index-BYQOPS8e.d.ts +0 -1003
  785. package/dist/index-BkZ7SPLc.d.ts +0 -288
  786. package/dist/index-BnUku_aF.d.ts +0 -808
  787. package/dist/index-BtDAHMW_.d.ts +0 -50
  788. package/dist/index-C-c_M_sE.d.ts +0 -107
  789. package/dist/index-CNIiC8Z_.d.ts +0 -67
  790. package/dist/index-CbERNN3s.d.ts +0 -505
  791. package/dist/index-CsfxsN0t.d.ts +0 -61
  792. package/dist/index-DASjaiJL.d.ts +0 -406
  793. package/dist/index-DD7Vc4cE.d.ts +0 -809
  794. package/dist/index-DIc8OqWV.d.ts +0 -152
  795. package/dist/index-DVI_vggD.d.ts +0 -171
  796. package/dist/index-DqxQeYT2.d.ts +0 -450
  797. package/dist/index-Dsf9FRtr.d.ts +0 -121
  798. package/dist/index-DxAReMEO.d.ts +0 -357
  799. package/dist/index-UXRoZmd_.d.ts +0 -70
  800. package/dist/index-isFvc5gd.d.ts +0 -2541
  801. package/dist/index-j3nuJWyJ.d.ts +0 -139
  802. package/dist/index-nVb7o0hc.d.ts +0 -7
  803. package/dist/index-pbE88Tt7.d.ts +0 -1803
  804. package/dist/inventory--t6Zu55O.js +0 -75
  805. package/dist/inventory--t6Zu55O.js.map +0 -1
  806. package/dist/listCollectiblesPaginated-BlE5mSzh.d.ts +0 -327
  807. package/dist/listCollections-DWyqFSQ3.d.ts +0 -828
  808. package/dist/looks-rare-2HBhMpOf.js +0 -6
  809. package/dist/looks-rare-2HBhMpOf.js.map +0 -1
  810. package/dist/lowestListing-DsunDO1c.d.ts +0 -475
  811. package/dist/magic-eden-BYdTp-uk.js +0 -6
  812. package/dist/magic-eden-BYdTp-uk.js.map +0 -1
  813. package/dist/manifold-yE0x6ZmO.js +0 -6
  814. package/dist/manifold-yE0x6ZmO.js.map +0 -1
  815. package/dist/market-DuBpFsDg.js +0 -219
  816. package/dist/market-DuBpFsDg.js.map +0 -1
  817. package/dist/marketCurrencies-BgwmbGFk.d.ts +0 -164
  818. package/dist/marketCurrencies-Bolonndy.js +0 -59
  819. package/dist/marketCurrencies-Bolonndy.js.map +0 -1
  820. package/dist/marketplace-NQB-sEQL.js +0 -1913
  821. package/dist/marketplace-NQB-sEQL.js.map +0 -1
  822. package/dist/marketplace-logos-Cz9RrtQo.js +0 -50
  823. package/dist/marketplace-logos-Cz9RrtQo.js.map +0 -1
  824. package/dist/marketplace.gen-906FrJQJ.js +0 -1147
  825. package/dist/marketplace.gen-906FrJQJ.js.map +0 -1
  826. package/dist/marketplaceConfig-Bqjo7NYO.js +0 -85
  827. package/dist/marketplaceConfig-Bqjo7NYO.js.map +0 -1
  828. package/dist/mintify-BXQx3mZB.js +0 -6
  829. package/dist/mintify-BXQx3mZB.js.map +0 -1
  830. package/dist/network-DwdZ_5-7.js +0 -15
  831. package/dist/network-DwdZ_5-7.js.map +0 -1
  832. package/dist/networkconfigToWagmiChain-Ct-hGq8M.js +0 -16
  833. package/dist/networkconfigToWagmiChain-Ct-hGq8M.js.map +0 -1
  834. package/dist/nftx-B929_3Ce.js +0 -6
  835. package/dist/nftx-B929_3Ce.js.map +0 -1
  836. package/dist/okx-sZ0-Udny.js +0 -6
  837. package/dist/okx-sZ0-Udny.js.map +0 -1
  838. package/dist/open-sea-DO9PhTrz.js +0 -6
  839. package/dist/open-sea-DO9PhTrz.js.map +0 -1
  840. package/dist/orders-DH76ym2e.js +0 -469
  841. package/dist/orders-DH76ym2e.js.map +0 -1
  842. package/dist/primary-sale-1u4QlPdA.js +0 -3048
  843. package/dist/primary-sale-1u4QlPdA.js.map +0 -1
  844. package/dist/primary-sales-CECrqatg.js +0 -156
  845. package/dist/primary-sales-CECrqatg.js.map +0 -1
  846. package/dist/query-brXxOcH0.d.ts +0 -31
  847. package/dist/rarible-Ccb2hs7y.js +0 -6
  848. package/dist/rarible-Ccb2hs7y.js.map +0 -1
  849. package/dist/react/hooks/data/collectibles/index.d.ts +0 -11
  850. package/dist/react/hooks/data/collectibles/index.js +0 -39
  851. package/dist/react/hooks/data/collections/index.d.ts +0 -11
  852. package/dist/react/hooks/data/collections/index.js +0 -39
  853. package/dist/react/hooks/data/index.d.ts +0 -37
  854. package/dist/react/hooks/data/index.js +0 -39
  855. package/dist/react/hooks/data/inventory/index.d.ts +0 -37
  856. package/dist/react/hooks/data/inventory/index.js +0 -39
  857. package/dist/react/hooks/data/market/index.d.ts +0 -12
  858. package/dist/react/hooks/data/market/index.js +0 -39
  859. package/dist/react/hooks/data/orders/index.d.ts +0 -11
  860. package/dist/react/hooks/data/orders/index.js +0 -39
  861. package/dist/react/hooks/data/primary-sales/index.d.ts +0 -37
  862. package/dist/react/hooks/data/primary-sales/index.js +0 -39
  863. package/dist/react/hooks/data/tokens/index.d.ts +0 -5
  864. package/dist/react/hooks/data/tokens/index.js +0 -39
  865. package/dist/react/queries/collectibles/index.d.ts +0 -11
  866. package/dist/react/queries/collectibles/index.js +0 -22
  867. package/dist/react/queries/collections/index.d.ts +0 -11
  868. package/dist/react/queries/collections/index.js +0 -20
  869. package/dist/react/queries/market/index.d.ts +0 -6
  870. package/dist/react/queries/market/index.js +0 -22
  871. package/dist/react/queries/orders/index.d.ts +0 -11
  872. package/dist/react/queries/orders/index.js +0 -13
  873. package/dist/react/queries/primary-sales/index.d.ts +0 -4
  874. package/dist/react/queries/primary-sales/index.js +0 -13
  875. package/dist/react/queries/tokens/index.d.ts +0 -5
  876. package/dist/react/queries/tokens/index.js +0 -13
  877. package/dist/react/queries/utils/index.d.ts +0 -4
  878. package/dist/react/queries/utils/index.js +0 -22
  879. package/dist/react/ssr/index.js.map +0 -1
  880. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.d.ts +0 -3
  881. package/dist/react/ui/components/marketplace-collectible-card/components/footer/components/index.js +0 -22
  882. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.d.ts +0 -51
  883. package/dist/react/ui/components/marketplace-collectible-card/components/footer/index.js +0 -39
  884. package/dist/react/ui/modals/_internal/components/actionModal/index.d.ts +0 -40
  885. package/dist/react/ui/modals/_internal/components/actionModal/index.js +0 -39
  886. package/dist/react-CBsgOdVP.js +0 -13476
  887. package/dist/react-CBsgOdVP.js.map +0 -1
  888. package/dist/sequence-CRdb1yEs.js +0 -6
  889. package/dist/sequence-CRdb1yEs.js.map +0 -1
  890. package/dist/src-Dz2CfBL0.js +0 -8
  891. package/dist/src-Dz2CfBL0.js.map +0 -1
  892. package/dist/sudo-swap-BIklG2gq.js +0 -6
  893. package/dist/sudo-swap-BIklG2gq.js.map +0 -1
  894. package/dist/super-rare-h8645_5E.js +0 -6
  895. package/dist/super-rare-h8645_5E.js.map +0 -1
  896. package/dist/token-Cv7l2ZaL.js +0 -2091
  897. package/dist/token-Cv7l2ZaL.js.map +0 -1
  898. package/dist/tokenBalances-CouzNX4j.js +0 -57
  899. package/dist/tokenBalances-CouzNX4j.js.map +0 -1
  900. package/dist/tokenSupplies-C3zJll0M.d.ts +0 -265
  901. package/dist/tokens-BvIRUCGG.js +0 -225
  902. package/dist/tokens-BvIRUCGG.js.map +0 -1
  903. package/dist/transaction-DZUW5RHu.js +0 -76
  904. package/dist/transaction-DZUW5RHu.js.map +0 -1
  905. package/dist/types-B_-cnkcP.js +0 -13
  906. package/dist/types-B_-cnkcP.js.map +0 -1
  907. package/dist/types-CMDwfhfR.d.ts +0 -78
  908. package/dist/utils-9ToOvt-c.js +0 -235
  909. package/dist/utils-9ToOvt-c.js.map +0 -1
  910. package/dist/utils-B6di6O-C.js +0 -43
  911. package/dist/utils-B6di6O-C.js.map +0 -1
  912. package/dist/utils-BCYTEOvy.js +0 -122
  913. package/dist/utils-BCYTEOvy.js.map +0 -1
  914. package/dist/waitForTransactionReceipt-CbSeUSXe.js +0 -26
  915. package/dist/waitForTransactionReceipt-CbSeUSXe.js.map +0 -1
  916. package/dist/x2y2-OvF__ugj.js +0 -6
  917. package/dist/x2y2-OvF__ugj.js.map +0 -1
  918. package/dist/zora-DzCeu-eE.js +0 -6
  919. package/dist/zora-DzCeu-eE.js.map +0 -1
  920. package/src/react/_internal/api/__mocks__/builder.msw.ts +0 -239
  921. package/src/react/_internal/api/__mocks__/indexer.msw.ts +0 -216
  922. package/src/react/_internal/api/__mocks__/marketplace.msw.ts +0 -402
  923. package/src/react/_internal/api/__mocks__/metadata.msw.ts +0 -195
  924. package/src/react/_internal/api/builder.gen.ts +0 -773
  925. package/src/react/_internal/api/marketplace.gen.ts +0 -2718
  926. package/src/react/_internal/api/query-keys.ts +0 -124
  927. package/src/react/hooks/data/collectibles/index.ts +0 -6
  928. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.test.tsx +0 -141
  929. package/src/react/hooks/data/collectibles/useBalanceOfCollectible.tsx +0 -39
  930. package/src/react/hooks/data/collectibles/useCollectible.test.tsx +0 -117
  931. package/src/react/hooks/data/collectibles/useCollectible.tsx +0 -69
  932. package/src/react/hooks/data/collectibles/useCountOfCollectables.test.tsx +0 -128
  933. package/src/react/hooks/data/collectibles/useCountOfCollectables.tsx +0 -70
  934. package/src/react/hooks/data/collectibles/useListCollectibleActivities.test.tsx +0 -192
  935. package/src/react/hooks/data/collectibles/useListCollectibleActivities.tsx +0 -98
  936. package/src/react/hooks/data/collectibles/useListCollectibles.test.tsx +0 -231
  937. package/src/react/hooks/data/collectibles/useListCollectibles.tsx +0 -78
  938. package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.test.tsx +0 -211
  939. package/src/react/hooks/data/collectibles/useListCollectiblesPaginated.tsx +0 -107
  940. package/src/react/hooks/data/collectibles/useTokenBalances.test.tsx +0 -151
  941. package/src/react/hooks/data/collectibles/useTokenBalances.tsx +0 -38
  942. package/src/react/hooks/data/collections/__snapshots__/useListCollections.test.tsx.snap +0 -303
  943. package/src/react/hooks/data/collections/index.ts +0 -8
  944. package/src/react/hooks/data/collections/useCollection.test.tsx +0 -98
  945. package/src/react/hooks/data/collections/useCollection.tsx +0 -66
  946. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.test.tsx +0 -112
  947. package/src/react/hooks/data/collections/useCollectionActiveListingsCurrencies.tsx +0 -74
  948. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.test.tsx +0 -110
  949. package/src/react/hooks/data/collections/useCollectionActiveOffersCurrencies.tsx +0 -74
  950. package/src/react/hooks/data/collections/useCollectionBalanceDetails.test.tsx +0 -158
  951. package/src/react/hooks/data/collections/useCollectionBalanceDetails.tsx +0 -106
  952. package/src/react/hooks/data/collections/useCollectionDetails.test.tsx +0 -83
  953. package/src/react/hooks/data/collections/useCollectionDetails.ts +0 -69
  954. package/src/react/hooks/data/collections/useCollectionDetailsPolling.test.tsx +0 -137
  955. package/src/react/hooks/data/collections/useCollectionDetailsPolling.tsx +0 -64
  956. package/src/react/hooks/data/collections/useListCollectionActivities.test.tsx +0 -227
  957. package/src/react/hooks/data/collections/useListCollectionActivities.tsx +0 -93
  958. package/src/react/hooks/data/collections/useListCollections.test.tsx +0 -110
  959. package/src/react/hooks/data/collections/useListCollections.tsx +0 -80
  960. package/src/react/hooks/data/index.ts +0 -6
  961. package/src/react/hooks/data/inventory/index.ts +0 -1
  962. package/src/react/hooks/data/inventory/useInventory.test.tsx +0 -162
  963. package/src/react/hooks/data/inventory/useInventory.tsx +0 -12
  964. package/src/react/hooks/data/market/index.ts +0 -3
  965. package/src/react/hooks/data/market/useCurrency.test.tsx +0 -127
  966. package/src/react/hooks/data/market/useCurrency.tsx +0 -65
  967. package/src/react/hooks/data/market/useListMarketCardData.test.tsx +0 -297
  968. package/src/react/hooks/data/market/useListMarketCardData.tsx +0 -165
  969. package/src/react/hooks/data/market/useMarketCurrencies.test.tsx +0 -216
  970. package/src/react/hooks/data/market/useMarketCurrencies.tsx +0 -65
  971. package/src/react/hooks/data/orders/index.ts +0 -11
  972. package/src/react/hooks/data/orders/useCountItemsOrdersForCollection.tsx +0 -90
  973. package/src/react/hooks/data/orders/useCountListingsForCollectible.test.tsx +0 -107
  974. package/src/react/hooks/data/orders/useCountListingsForCollectible.tsx +0 -75
  975. package/src/react/hooks/data/orders/useCountOffersForCollectible.test.tsx +0 -107
  976. package/src/react/hooks/data/orders/useCountOffersForCollectible.tsx +0 -75
  977. package/src/react/hooks/data/orders/useFloorOrder.test.tsx +0 -100
  978. package/src/react/hooks/data/orders/useFloorOrder.tsx +0 -70
  979. package/src/react/hooks/data/orders/useGetCountOfFilteredOrders.tsx +0 -39
  980. package/src/react/hooks/data/orders/useHighestOffer.test.tsx +0 -101
  981. package/src/react/hooks/data/orders/useHighestOffer.tsx +0 -72
  982. package/src/react/hooks/data/orders/useListItemsOrdersForCollection.tsx +0 -93
  983. package/src/react/hooks/data/orders/useListItemsOrdersForCollectionPaginated.tsx +0 -108
  984. package/src/react/hooks/data/orders/useListListingsForCollectible.test.tsx +0 -140
  985. package/src/react/hooks/data/orders/useListListingsForCollectible.tsx +0 -101
  986. package/src/react/hooks/data/orders/useListOffersForCollectible.test.tsx +0 -139
  987. package/src/react/hooks/data/orders/useListOffersForCollectible.tsx +0 -80
  988. package/src/react/hooks/data/orders/useLowestListing.test.tsx +0 -146
  989. package/src/react/hooks/data/orders/useLowestListing.tsx +0 -72
  990. package/src/react/hooks/data/primary-sales/index.ts +0 -7
  991. package/src/react/hooks/data/primary-sales/useCountOfPrimarySaleItems.tsx +0 -13
  992. package/src/react/hooks/data/primary-sales/useErc721SalesData.tsx +0 -184
  993. package/src/react/hooks/data/primary-sales/useGetCountOfPrimarySaleItems.tsx +0 -48
  994. package/src/react/hooks/data/primary-sales/useList1155ShopCardData.tsx +0 -96
  995. package/src/react/hooks/data/primary-sales/useList721ShopCardData.tsx +0 -194
  996. package/src/react/hooks/data/primary-sales/useListPrimarySaleItems.tsx +0 -66
  997. package/src/react/hooks/data/primary-sales/usePrimarySaleItem.tsx +0 -71
  998. package/src/react/hooks/data/tokens/index.ts +0 -5
  999. package/src/react/hooks/data/tokens/useCurrencyBalance.test.tsx +0 -83
  1000. package/src/react/hooks/data/tokens/useGetTokenRanges.test.tsx +0 -111
  1001. package/src/react/hooks/data/tokens/useGetTokenRanges.tsx +0 -94
  1002. package/src/react/hooks/data/tokens/useListBalances.test.tsx +0 -100
  1003. package/src/react/hooks/data/tokens/useListBalances.tsx +0 -29
  1004. package/src/react/hooks/data/tokens/useListTokenMetadata.test.tsx +0 -137
  1005. package/src/react/hooks/data/tokens/useListTokenMetadata.tsx +0 -73
  1006. package/src/react/hooks/data/tokens/useSearchTokenMetadata.test.tsx +0 -284
  1007. package/src/react/hooks/data/tokens/useSearchTokenMetadata.tsx +0 -189
  1008. package/src/react/hooks/data/tokens/useTokenSupplies.ts +0 -69
  1009. package/src/react/hooks/ui/useFilterState.tsx +0 -250
  1010. package/src/react/hooks/utils/useCheckoutOptions.test.tsx +0 -162
  1011. package/src/react/hooks/utils/useCheckoutOptions.tsx +0 -98
  1012. package/src/react/hooks/utils/useCheckoutOptionsSalesContract.test.tsx +0 -206
  1013. package/src/react/hooks/utils/useCheckoutOptionsSalesContract.tsx +0 -108
  1014. package/src/react/hooks/utils/useComparePrices.test.tsx +0 -215
  1015. package/src/react/hooks/utils/useComparePrices.tsx +0 -102
  1016. package/src/react/hooks/utils/useConvertPriceToUSD.test.tsx +0 -172
  1017. package/src/react/hooks/utils/useConvertPriceToUSD.tsx +0 -96
  1018. package/src/react/queries/collectibles/balanceOfCollectible.ts +0 -90
  1019. package/src/react/queries/collectibles/collectible.ts +0 -81
  1020. package/src/react/queries/collectibles/countOfCollectables.ts +0 -109
  1021. package/src/react/queries/collectibles/index.ts +0 -7
  1022. package/src/react/queries/collectibles/listCollectibleActivities.ts +0 -121
  1023. package/src/react/queries/collectibles/listCollectibles.ts +0 -115
  1024. package/src/react/queries/collectibles/listCollectiblesPaginated.ts +0 -104
  1025. package/src/react/queries/collectibles/tokenBalances.ts +0 -89
  1026. package/src/react/queries/collections/activeListingsCurrencies.ts +0 -84
  1027. package/src/react/queries/collections/activeOffersCurrencies.ts +0 -84
  1028. package/src/react/queries/collections/collection.ts +0 -69
  1029. package/src/react/queries/collections/collectionBalanceDetails.ts +0 -107
  1030. package/src/react/queries/collections/collectionDetails.ts +0 -79
  1031. package/src/react/queries/collections/index.ts +0 -7
  1032. package/src/react/queries/collections/listCollectionActivities.ts +0 -117
  1033. package/src/react/queries/collections/listCollections.ts +0 -175
  1034. package/src/react/queries/market/checkoutOptions.ts +0 -107
  1035. package/src/react/queries/market/checkoutOptionsSalesContract.ts +0 -108
  1036. package/src/react/queries/market/currency.ts +0 -92
  1037. package/src/react/queries/market/filters.ts +0 -152
  1038. package/src/react/queries/market/index.ts +0 -6
  1039. package/src/react/queries/market/marketCurrencies.ts +0 -120
  1040. package/src/react/queries/market/marketplaceConfig.ts +0 -117
  1041. package/src/react/queries/orders/countItemsOrdersForCollection.ts +0 -86
  1042. package/src/react/queries/orders/countListingsForCollectible.ts +0 -90
  1043. package/src/react/queries/orders/countOffersForCollectible.ts +0 -90
  1044. package/src/react/queries/orders/floorOrder.ts +0 -74
  1045. package/src/react/queries/orders/getCountOfFilteredOrders.ts +0 -88
  1046. package/src/react/queries/orders/highestOffer.ts +0 -78
  1047. package/src/react/queries/orders/index.ts +0 -11
  1048. package/src/react/queries/orders/listItemsOrdersForCollection.ts +0 -90
  1049. package/src/react/queries/orders/listItemsOrdersForCollectionPaginated.ts +0 -90
  1050. package/src/react/queries/orders/listListingsForCollectible.ts +0 -97
  1051. package/src/react/queries/orders/listOffersForCollectible.ts +0 -116
  1052. package/src/react/queries/orders/lowestListing.ts +0 -81
  1053. package/src/react/queries/primary-sales/countOfPrimarySaleItems.ts +0 -62
  1054. package/src/react/queries/primary-sales/index.ts +0 -4
  1055. package/src/react/queries/primary-sales/primarySaleItem.ts +0 -80
  1056. package/src/react/queries/primary-sales/primarySaleItems.ts +0 -94
  1057. package/src/react/queries/primary-sales/primarySaleItemsCount.ts +0 -79
  1058. package/src/react/queries/tokens/getTokenRanges.ts +0 -75
  1059. package/src/react/queries/tokens/index.ts +0 -5
  1060. package/src/react/queries/tokens/listBalances.ts +0 -71
  1061. package/src/react/queries/tokens/listTokenMetadata.ts +0 -81
  1062. package/src/react/queries/tokens/searchTokenMetadata.ts +0 -101
  1063. package/src/react/queries/tokens/tokenSupplies.ts +0 -84
  1064. package/src/react/queries/utils/comparePrices.ts +0 -132
  1065. package/src/react/queries/utils/convertPriceToUSD.ts +0 -105
  1066. package/src/react/queries/utils/index.ts +0 -2
  1067. package/src/react/ui/components/_internals/action-button/ActionButton.stories.tsx +0 -298
  1068. package/src/react/ui/components/_internals/action-button/ActionButton.tsx +0 -108
  1069. package/src/react/ui/components/_internals/action-button/__tests__/ActionButtonBody.test.tsx +0 -104
  1070. package/src/react/ui/components/_internals/action-button/__tests__/NonOwnerActions.test.tsx +0 -65
  1071. package/src/react/ui/components/_internals/action-button/__tests__/OwnerActions.test.tsx +0 -66
  1072. package/src/react/ui/components/_internals/action-button/__tests__/useActionButtonLogic.test.tsx +0 -99
  1073. package/src/react/ui/components/_internals/action-button/components/ActionButtonBody.tsx +0 -52
  1074. package/src/react/ui/components/_internals/action-button/components/NonOwnerActions.tsx +0 -145
  1075. package/src/react/ui/components/_internals/action-button/components/OwnerActions.tsx +0 -83
  1076. package/src/react/ui/components/_internals/action-button/hooks/useActionButtonLogic.ts +0 -97
  1077. package/src/react/ui/components/_internals/action-button/store.ts +0 -85
  1078. package/src/react/ui/components/marketplace-collectible-card/components/ActionButtonWrapper.tsx +0 -79
  1079. package/src/react/ui/components/marketplace-collectible-card/components/BaseCard.tsx +0 -68
  1080. package/src/react/ui/components/marketplace-collectible-card/components/footer/Footer.tsx +0 -165
  1081. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/FooterName.tsx +0 -103
  1082. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/PriceDisplay.tsx +0 -80
  1083. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/SaleDetailsPill.tsx +0 -29
  1084. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/TokenTypeBalancePill.tsx +0 -30
  1085. package/src/react/ui/components/marketplace-collectible-card/components/footer/components/index.ts +0 -4
  1086. package/src/react/ui/components/marketplace-collectible-card/components/footer/index.ts +0 -2
  1087. package/src/react/ui/icons/CalendarIcon.tsx +0 -37
  1088. package/src/react/ui/icons/CartIcon.tsx +0 -52
  1089. package/src/react/ui/icons/InfoIcon.tsx +0 -44
  1090. package/src/react/ui/modals/BuyModal/__tests__/BuyModalRouter.test.tsx +0 -557
  1091. package/src/react/ui/modals/BuyModal/__tests__/ERC1155ShopModal.test.tsx +0 -398
  1092. package/src/react/ui/modals/BuyModal/__tests__/ERC721ShopModal.test.tsx +0 -272
  1093. package/src/react/ui/modals/BuyModal/__tests__/Modal.test.tsx.bak +0 -112
  1094. package/src/react/ui/modals/BuyModal/__tests__/Modal1155.test.tsx +0 -251
  1095. package/src/react/ui/modals/BuyModal/__tests__/store.test.ts +0 -105
  1096. package/src/react/ui/modals/BuyModal/components/BuyModalRouter.tsx +0 -157
  1097. package/src/react/ui/modals/BuyModal/components/ERC1155BuyModal.tsx +0 -198
  1098. package/src/react/ui/modals/BuyModal/components/ERC1155QuantityModal.tsx +0 -208
  1099. package/src/react/ui/modals/BuyModal/components/ERC1155ShopModal.tsx +0 -124
  1100. package/src/react/ui/modals/BuyModal/components/ERC721BuyModal.tsx +0 -116
  1101. package/src/react/ui/modals/BuyModal/components/ERC721ShopModal.tsx +0 -86
  1102. package/src/react/ui/modals/BuyModal/hooks/__tests__/useCheckoutOptions.test.tsx +0 -115
  1103. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC1155Checkout.test.tsx +0 -395
  1104. package/src/react/ui/modals/BuyModal/hooks/__tests__/useERC721SalePaymentParams.test.tsx +0 -283
  1105. package/src/react/ui/modals/BuyModal/hooks/__tests__/useMarketPlatformFee.test.tsx +0 -145
  1106. package/src/react/ui/modals/BuyModal/hooks/useCheckoutOptions.ts +0 -86
  1107. package/src/react/ui/modals/BuyModal/hooks/useERC1155Checkout.ts +0 -103
  1108. package/src/react/ui/modals/BuyModal/hooks/useERC721SalePaymentParams.ts +0 -216
  1109. package/src/react/ui/modals/BuyModal/hooks/useLoadData.ts +0 -120
  1110. package/src/react/ui/modals/BuyModal/hooks/usePaymentModalParams.ts +0 -243
  1111. package/src/react/ui/modals/CreateListingModal/hooks/useCreateListing.tsx +0 -98
  1112. package/src/react/ui/modals/CreateListingModal/hooks/useGetTokenApproval.ts +0 -87
  1113. package/src/react/ui/modals/CreateListingModal/hooks/useTransactionSteps.tsx +0 -246
  1114. package/src/react/ui/modals/CreateListingModal/store.ts +0 -99
  1115. package/src/react/ui/modals/MakeOfferModal/hooks/useGetTokenApproval.tsx +0 -90
  1116. package/src/react/ui/modals/MakeOfferModal/hooks/useMakeOffer.tsx +0 -71
  1117. package/src/react/ui/modals/MakeOfferModal/hooks/useTransactionSteps.tsx +0 -241
  1118. package/src/react/ui/modals/MakeOfferModal/store.ts +0 -94
  1119. package/src/react/ui/modals/SellModal/__tests__/Modal.test.tsx +0 -85
  1120. package/src/react/ui/modals/SellModal/hooks/useGetTokenApproval.tsx +0 -79
  1121. package/src/react/ui/modals/SellModal/hooks/useSell.tsx +0 -77
  1122. package/src/react/ui/modals/SellModal/hooks/useTransactionSteps.tsx +0 -242
  1123. package/src/react/ui/modals/SellModal/store.ts +0 -62
  1124. package/src/react/ui/modals/SellModal/utils.ts +0 -38
  1125. package/src/react/ui/modals/SuccessfulPurchaseModal/__tests__/Modal.test.tsx +0 -157
  1126. package/src/react/ui/modals/SuccessfulPurchaseModal/index.tsx +0 -154
  1127. package/src/react/ui/modals/SuccessfulPurchaseModal/store.ts +0 -71
  1128. package/src/react/ui/modals/TransferModal/__tests__/__snapshots__/store.test.ts.snap +0 -17
  1129. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/__tests__/useHandleTransfer.test.tsx +0 -412
  1130. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/_components/TransferButton.tsx +0 -66
  1131. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/index.tsx +0 -137
  1132. package/src/react/ui/modals/TransferModal/_views/enterWalletAddress/useHandleTransfer.tsx +0 -97
  1133. package/src/react/ui/modals/TransferModal/_views/followWalletInstructions/index.tsx +0 -31
  1134. package/src/react/ui/modals/TransferModal/messages.ts +0 -14
  1135. package/src/react/ui/modals/TransferModal/store.ts +0 -122
  1136. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.test.tsx +0 -281
  1137. package/src/react/ui/modals/_internal/components/actionModal/ActionModal.tsx +0 -113
  1138. package/src/react/ui/modals/_internal/components/actionModal/ErrorModal.tsx +0 -35
  1139. package/src/react/ui/modals/_internal/components/actionModal/LoadingModal.tsx +0 -32
  1140. package/src/react/ui/modals/_internal/components/actionModal/index.ts +0 -1
  1141. package/src/types/custom.d.ts +0 -1
  1142. package/src/types/messages.ts +0 -43
  1143. package/src/types/new-marketplace-types.ts +0 -95
  1144. /package/dist/{index-CCggO_hw.d.ts → index20.d.ts} +0 -0
  1145. /package/dist/{index-CKefEBrI.d.ts → index25.d.ts} +0 -0
  1146. /package/dist/{index-DgsCqh_P.d.ts → index29.d.ts} +0 -0
  1147. /package/dist/{index-xpO4AQyS.d.ts → index30.d.ts} +0 -0
  1148. /package/dist/{queries-CyajGg_O.js → queries.js} +0 -0
  1149. /package/dist/{wagmi-Bseovd6Q.js → src.js} +0 -0
  1150. /package/src/react/ui/components/{_internals/action-button → marketplace-collectible-card/ActionButton}/types.ts +0 -0
  1151. /package/src/react/ui/modals/_internal/hooks/{useSelectWaasFeeOptions.ts → useSelectWaasFeeOptions.tsx} +0 -0
@@ -0,0 +1,170 @@
1
+ import { T as MarketplaceWalletType } from "./dist.js";
2
+ import { t as networkToWagmiChain } from "./networkconfigToWagmiChain.js";
3
+ import { n as MissingConfigError } from "./transaction.js";
4
+ import { allNetworks, findNetworkConfig } from "@0xsequence/network";
5
+ import { cookieStorage, createConfig, createStorage, http } from "wagmi";
6
+ import { apple, appleWaas, coinbaseWallet, ecosystemWallet, email, emailWaas, facebook, getConnectWallets, google, googleWaas, metaMask, sequence, twitch, walletConnect } from "@0xsequence/connect";
7
+ import React from "react";
8
+
9
+ //#region src/react/_internal/consts.ts
10
+ const DEFAULT_NETWORK = 137;
11
+
12
+ //#endregion
13
+ //#region src/react/_internal/wagmi/get-connectors.ts
14
+ function getConnectors({ marketplaceConfig, sdkConfig, walletType, ssr }) {
15
+ const connectors = commonConnectors(marketplaceConfig, sdkConfig, ssr);
16
+ if (walletType === MarketplaceWalletType.UNIVERSAL) connectors.push(...getUniversalWalletConfigs(sdkConfig, marketplaceConfig));
17
+ else if (walletType === MarketplaceWalletType.EMBEDDED) connectors.push(...getWaasConnectors(sdkConfig, marketplaceConfig));
18
+ else if (walletType === MarketplaceWalletType.ECOSYSTEM) connectors.push(getEcosystemConnector(marketplaceConfig, sdkConfig));
19
+ else throw new Error("Invalid wallet type");
20
+ return getConnectWallets(sdkConfig.projectAccessKey, connectors);
21
+ }
22
+ function commonConnectors(marketplaceConfig, sdkConfig, _ssr) {
23
+ const wallets = [];
24
+ const { title: appName } = marketplaceConfig.settings;
25
+ const walletOptions = marketplaceConfig.settings.walletOptions;
26
+ const walletConnectProjectId = sdkConfig.walletConnectProjectId;
27
+ if (walletOptions.connectors.includes("coinbase")) wallets.push(coinbaseWallet({ appName }));
28
+ const isBrowser = typeof window !== "undefined";
29
+ if (walletConnectProjectId && walletOptions.connectors.includes("walletconnect") && isBrowser) wallets.push(walletConnect({ projectId: walletConnectProjectId }));
30
+ if (walletOptions.connectors.includes("metamask")) wallets.push(metaMask({ dappMetadata: { name: appName } }));
31
+ return wallets;
32
+ }
33
+ function getUniversalWalletConfigs(config, marketplaceConfig) {
34
+ const sequenceWalletOverrides = config._internal?.overrides?.api?.sequenceWallet;
35
+ const sequenceWalletOptions = {
36
+ walletAppURL: sequenceWalletOverrides?.url || getSequenceWalletURL(sequenceWalletOverrides?.env || "production"),
37
+ defaultNetwork: DEFAULT_NETWORK,
38
+ connect: {
39
+ projectAccessKey: sequenceWalletOverrides?.accessKey || config.projectAccessKey,
40
+ app: marketplaceConfig.settings.title,
41
+ settings: { bannerUrl: marketplaceConfig.market.ogImage }
42
+ }
43
+ };
44
+ return [
45
+ sequence(sequenceWalletOptions),
46
+ email(sequenceWalletOptions),
47
+ facebook(sequenceWalletOptions),
48
+ google(sequenceWalletOptions),
49
+ apple(sequenceWalletOptions),
50
+ twitch(sequenceWalletOptions)
51
+ ];
52
+ }
53
+ function getWaasConnectors(config, marketplaceConfig) {
54
+ const { projectAccessKey } = config;
55
+ const waasConfigKey = marketplaceConfig.settings.walletOptions.embedded?.tenantKey;
56
+ if (!waasConfigKey) throw new MissingConfigError("Embedded wallet config is missing, please check your access key");
57
+ const waasOptions = marketplaceConfig.settings.walletOptions.oidcIssuers;
58
+ const googleClientId = waasOptions.google;
59
+ const appleClientId = waasOptions.apple;
60
+ const appleRedirectURI = typeof window !== "undefined" ? `${window.location.origin}${window.location.pathname}` : void 0;
61
+ const wallets = [];
62
+ if (marketplaceConfig.settings.walletOptions.embedded?.emailEnabled) wallets.push(emailWaas({
63
+ projectAccessKey,
64
+ waasConfigKey
65
+ }));
66
+ if (googleClientId) wallets.push(googleWaas({
67
+ projectAccessKey,
68
+ googleClientId,
69
+ waasConfigKey,
70
+ network: DEFAULT_NETWORK
71
+ }));
72
+ if (appleClientId) wallets.push(appleWaas({
73
+ projectAccessKey,
74
+ appleClientId,
75
+ appleRedirectURI,
76
+ waasConfigKey,
77
+ network: DEFAULT_NETWORK
78
+ }));
79
+ return wallets;
80
+ }
81
+ function getEcosystemConnector(marketplaceConfig, sdkConfig) {
82
+ const ecosystemOptions = marketplaceConfig.settings.walletOptions.ecosystem;
83
+ if (!ecosystemOptions) throw new MissingConfigError("ecosystem");
84
+ const { walletAppName, walletUrl, logoDarkUrl, logoLightUrl } = ecosystemOptions;
85
+ return ecosystemWallet({
86
+ projectAccessKey: sdkConfig.projectAccessKey,
87
+ walletUrl,
88
+ name: walletAppName,
89
+ defaultNetwork: DEFAULT_NETWORK,
90
+ logoDark: getEcosystemLogo(logoDarkUrl, walletAppName),
91
+ logoLight: getEcosystemLogo(logoLightUrl, walletAppName)
92
+ });
93
+ }
94
+ function getEcosystemLogo(url, name) {
95
+ if (!url) return () => null;
96
+ const Logo = () => React.createElement("img", {
97
+ src: url,
98
+ alt: name,
99
+ width: 32,
100
+ height: 32
101
+ });
102
+ Logo.displayName = "EcosystemLogo";
103
+ return Logo;
104
+ }
105
+ function getSequenceWalletURL(env) {
106
+ switch (env) {
107
+ case "development": return "https://dev.sequence.app";
108
+ case "next": return "https://next.sequence.app";
109
+ case "production":
110
+ default: return "https://sequence.app";
111
+ }
112
+ }
113
+
114
+ //#endregion
115
+ //#region src/react/_internal/wagmi/create-config.ts
116
+ const createWagmiConfig = (marketplaceConfig, sdkConfig, ssr) => {
117
+ const { chains, transports } = getWagmiChainsAndTransports({
118
+ marketplaceConfig,
119
+ sdkConfig
120
+ });
121
+ const walletType = marketplaceConfig.settings.walletOptions.walletType;
122
+ const connectors = getConnectors({
123
+ marketplaceConfig,
124
+ sdkConfig,
125
+ walletType,
126
+ ssr
127
+ });
128
+ const multiInjectedProviderDiscovery = marketplaceConfig.settings.walletOptions.includeEIP6963Wallets;
129
+ return createConfig({
130
+ connectors,
131
+ chains,
132
+ ssr,
133
+ multiInjectedProviderDiscovery,
134
+ storage: ssr ? createStorage({ storage: cookieStorage }) : void 0,
135
+ transports
136
+ });
137
+ };
138
+ function getWagmiChainsAndTransports({ marketplaceConfig, sdkConfig }) {
139
+ const chains = getChainConfigs(marketplaceConfig);
140
+ const nodeGatewayOverrides = sdkConfig._internal?.overrides?.api?.nodeGateway;
141
+ const nodeGatewayEnv = nodeGatewayOverrides?.env ?? "production";
142
+ const nodeGatewayUrl = nodeGatewayOverrides?.url;
143
+ return {
144
+ chains,
145
+ transports: getTransportConfigs(chains, nodeGatewayOverrides?.accessKey ?? sdkConfig.projectAccessKey, nodeGatewayEnv, nodeGatewayUrl)
146
+ };
147
+ }
148
+ function getChainConfigs(_marketConfig) {
149
+ return Object.values(allNetworks).map(networkToWagmiChain);
150
+ }
151
+ function getTransportConfigs(chains, projectAccessKey, nodeGatewayEnv, nodeGatewayUrl) {
152
+ return chains.reduce((acc, chain) => {
153
+ const network = findNetworkConfig(allNetworks, chain.id);
154
+ if (network) {
155
+ let rpcUrl;
156
+ if (nodeGatewayUrl) rpcUrl = nodeGatewayUrl;
157
+ else {
158
+ rpcUrl = network.rpcUrl;
159
+ if (nodeGatewayEnv === "development") rpcUrl = rpcUrl.replace("nodes.", "dev-nodes.");
160
+ if (!network.rpcUrl.endsWith(projectAccessKey)) rpcUrl = `${rpcUrl}/${projectAccessKey}`;
161
+ }
162
+ acc[chain.id] = http(rpcUrl);
163
+ }
164
+ return acc;
165
+ }, {});
166
+ }
167
+
168
+ //#endregion
169
+ export { getWaasConnectors as a, getEcosystemConnector as i, getWagmiChainsAndTransports as n, DEFAULT_NETWORK as o, getConnectors as r, createWagmiConfig as t };
170
+ //# sourceMappingURL=create-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-config.js","names":["wallets: Wallet[]","rpcUrl: string"],"sources":["../src/react/_internal/consts.ts","../src/react/_internal/wagmi/get-connectors.ts","../src/react/_internal/wagmi/create-config.ts"],"sourcesContent":["export const DEFAULT_NETWORK = 137;\n","import { MarketplaceWalletType } from '@0xsequence/api-client';\nimport {\n\tapple,\n\tappleWaas,\n\tcoinbaseWallet,\n\tecosystemWallet,\n\temail,\n\temailWaas,\n\tfacebook,\n\tgetConnectWallets,\n\tgoogle,\n\tgoogleWaas,\n\tmetaMask,\n\ttype SequenceOptions,\n\tsequence,\n\ttwitch,\n\ttype Wallet,\n\twalletConnect,\n} from '@0xsequence/connect';\nimport React, { type FunctionComponent } from 'react';\nimport type { CreateConnectorFn } from 'wagmi';\nimport type { Env, MarketplaceConfig, SdkConfig } from '../../../types';\nimport { MissingConfigError } from '../../../utils/_internal/error/transaction';\nimport { DEFAULT_NETWORK } from '../consts';\n\nexport function getConnectors({\n\tmarketplaceConfig,\n\tsdkConfig,\n\twalletType,\n\tssr,\n}: {\n\tmarketplaceConfig: MarketplaceConfig;\n\tsdkConfig: SdkConfig;\n\twalletType: MarketplaceWalletType;\n\tssr?: boolean;\n}): CreateConnectorFn[] {\n\tconst connectors = commonConnectors(marketplaceConfig, sdkConfig, ssr);\n\n\tif (walletType === MarketplaceWalletType.UNIVERSAL) {\n\t\tconnectors.push(...getUniversalWalletConfigs(sdkConfig, marketplaceConfig));\n\t} else if (walletType === MarketplaceWalletType.EMBEDDED) {\n\t\tconnectors.push(...getWaasConnectors(sdkConfig, marketplaceConfig));\n\t} else if (walletType === MarketplaceWalletType.ECOSYSTEM) {\n\t\tconnectors.push(getEcosystemConnector(marketplaceConfig, sdkConfig));\n\t} else {\n\t\tthrow new Error('Invalid wallet type');\n\t}\n\n\treturn getConnectWallets(sdkConfig.projectAccessKey, connectors);\n}\n\nfunction commonConnectors(\n\tmarketplaceConfig: MarketplaceConfig,\n\tsdkConfig: SdkConfig,\n\t_ssr?: boolean,\n): Wallet[] {\n\tconst wallets: Wallet[] = [];\n\tconst { title: appName } = marketplaceConfig.settings;\n\tconst walletOptions = marketplaceConfig.settings.walletOptions;\n\tconst walletConnectProjectId = sdkConfig.walletConnectProjectId;\n\n\tif (walletOptions.connectors.includes('coinbase')) {\n\t\twallets.push(\n\t\t\tcoinbaseWallet({\n\t\t\t\tappName,\n\t\t\t}),\n\t\t);\n\t}\n\n\tconst isBrowser = typeof window !== 'undefined';\n\tif (\n\t\twalletConnectProjectId &&\n\t\twalletOptions.connectors.includes('walletconnect') &&\n\t\tisBrowser\n\t) {\n\t\twallets.push(\n\t\t\twalletConnect({\n\t\t\t\tprojectId: walletConnectProjectId,\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (walletOptions.connectors.includes('metamask')) {\n\t\twallets.push(\n\t\t\tmetaMask({\n\t\t\t\tdappMetadata: {\n\t\t\t\t\tname: appName,\n\t\t\t\t},\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn wallets;\n}\n\nfunction getUniversalWalletConfigs(\n\tconfig: SdkConfig,\n\tmarketplaceConfig: MarketplaceConfig,\n): Wallet[] {\n\tconst sequenceWalletOverrides =\n\t\tconfig._internal?.overrides?.api?.sequenceWallet;\n\tconst sequenceWalletUrl =\n\t\tsequenceWalletOverrides?.url ||\n\t\tgetSequenceWalletURL(sequenceWalletOverrides?.env || 'production');\n\tconst projectAccessKey =\n\t\tsequenceWalletOverrides?.accessKey || config.projectAccessKey;\n\n\tconst sequenceWalletOptions = {\n\t\twalletAppURL: sequenceWalletUrl,\n\t\tdefaultNetwork: DEFAULT_NETWORK,\n\t\tconnect: {\n\t\t\tprojectAccessKey,\n\t\t\tapp: marketplaceConfig.settings.title,\n\t\t\tsettings: {\n\t\t\t\t// TODO: make a separate config for this?\n\t\t\t\tbannerUrl: marketplaceConfig.market.ogImage,\n\t\t\t},\n\t\t},\n\t} satisfies SequenceOptions;\n\n\treturn [\n\t\tsequence(sequenceWalletOptions),\n\t\temail(sequenceWalletOptions),\n\t\tfacebook(sequenceWalletOptions),\n\t\tgoogle(sequenceWalletOptions),\n\t\tapple(sequenceWalletOptions),\n\t\ttwitch(sequenceWalletOptions),\n\t] as const;\n}\n\nexport function getWaasConnectors(\n\tconfig: SdkConfig,\n\tmarketplaceConfig: MarketplaceConfig,\n): Wallet[] {\n\tconst { projectAccessKey } = config;\n\n\tconst waasConfigKey =\n\t\tmarketplaceConfig.settings.walletOptions.embedded?.tenantKey;\n\n\tif (!waasConfigKey)\n\t\tthrow new MissingConfigError(\n\t\t\t'Embedded wallet config is missing, please check your access key',\n\t\t);\n\n\tconst waasOptions = marketplaceConfig.settings.walletOptions.oidcIssuers;\n\tconst googleClientId = waasOptions.google;\n\tconst appleClientId = waasOptions.apple;\n\tconst appleRedirectURI =\n\t\ttypeof window !== 'undefined'\n\t\t\t? `${window.location.origin}${window.location.pathname}`\n\t\t\t: undefined;\n\n\tconst wallets: Wallet[] = [];\n\n\tif (marketplaceConfig.settings.walletOptions.embedded?.emailEnabled) {\n\t\twallets.push(\n\t\t\temailWaas({\n\t\t\t\tprojectAccessKey,\n\t\t\t\twaasConfigKey,\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (googleClientId) {\n\t\twallets.push(\n\t\t\tgoogleWaas({\n\t\t\t\tprojectAccessKey,\n\t\t\t\tgoogleClientId,\n\t\t\t\twaasConfigKey,\n\t\t\t\tnetwork: DEFAULT_NETWORK,\n\t\t\t}),\n\t\t);\n\t}\n\n\tif (appleClientId) {\n\t\twallets.push(\n\t\t\tappleWaas({\n\t\t\t\tprojectAccessKey,\n\t\t\t\tappleClientId,\n\t\t\t\tappleRedirectURI,\n\t\t\t\twaasConfigKey,\n\t\t\t\tnetwork: DEFAULT_NETWORK,\n\t\t\t}),\n\t\t);\n\t}\n\n\treturn wallets;\n}\n\nexport function getEcosystemConnector(\n\tmarketplaceConfig: MarketplaceConfig,\n\tsdkConfig: SdkConfig,\n): Wallet {\n\tconst ecosystemOptions = marketplaceConfig.settings.walletOptions.ecosystem;\n\tif (!ecosystemOptions) throw new MissingConfigError('ecosystem');\n\tconst { walletAppName, walletUrl, logoDarkUrl, logoLightUrl } =\n\t\tecosystemOptions;\n\n\treturn ecosystemWallet({\n\t\tprojectAccessKey: sdkConfig.projectAccessKey,\n\t\twalletUrl,\n\t\tname: walletAppName,\n\t\tdefaultNetwork: DEFAULT_NETWORK,\n\t\tlogoDark: getEcosystemLogo(logoDarkUrl, walletAppName),\n\t\tlogoLight: getEcosystemLogo(logoLightUrl, walletAppName),\n\t});\n}\n\nfunction getEcosystemLogo(\n\turl: string | undefined,\n\tname: string,\n): FunctionComponent {\n\tif (!url) return () => null;\n\tconst Logo = () =>\n\t\tReact.createElement('img', { src: url, alt: name, width: 32, height: 32 });\n\tLogo.displayName = 'EcosystemLogo';\n\treturn Logo;\n}\n\nfunction getSequenceWalletURL(env: Env) {\n\tswitch (env) {\n\t\tcase 'development':\n\t\t\treturn 'https://dev.sequence.app';\n\t\tcase 'next':\n\t\t\treturn 'https://next.sequence.app';\n\t\t// biome-ignore lint/complexity/noUselessSwitchCase: Production case kept for readability alongside other environments\n\t\tcase 'production':\n\t\tdefault:\n\t\t\treturn 'https://sequence.app';\n\t}\n}\n","import { allNetworks, findNetworkConfig } from '@0xsequence/network';\nimport type { Chain, Transport } from 'viem';\nimport { cookieStorage, createConfig, createStorage, http } from 'wagmi';\nimport type { Env, MarketplaceConfig, SdkConfig } from '../../../types';\nimport { networkToWagmiChain } from '../../../utils/networkconfigToWagmiChain';\nimport { getConnectors } from './get-connectors';\n\nexport const createWagmiConfig = (\n\tmarketplaceConfig: MarketplaceConfig,\n\tsdkConfig: SdkConfig,\n\tssr?: boolean,\n) => {\n\tconst { chains, transports } = getWagmiChainsAndTransports({\n\t\tmarketplaceConfig,\n\t\tsdkConfig,\n\t});\n\n\tconst walletType = marketplaceConfig.settings.walletOptions.walletType;\n\n\tconst connectors = getConnectors({\n\t\tmarketplaceConfig,\n\t\tsdkConfig,\n\t\twalletType,\n\t\tssr,\n\t});\n\n\tconst multiInjectedProviderDiscovery =\n\t\tmarketplaceConfig.settings.walletOptions.includeEIP6963Wallets;\n\n\treturn createConfig({\n\t\tconnectors,\n\t\tchains,\n\t\tssr,\n\t\tmultiInjectedProviderDiscovery,\n\t\tstorage: ssr\n\t\t\t? createStorage({\n\t\t\t\t\tstorage: cookieStorage,\n\t\t\t\t})\n\t\t\t: undefined,\n\t\ttransports,\n\t});\n};\n\nexport function getWagmiChainsAndTransports({\n\tmarketplaceConfig,\n\tsdkConfig,\n}: {\n\tmarketplaceConfig: MarketplaceConfig;\n\tsdkConfig: SdkConfig;\n}) {\n\tconst chains = getChainConfigs(marketplaceConfig);\n\tconst nodeGatewayOverrides = sdkConfig._internal?.overrides?.api?.nodeGateway;\n\tconst nodeGatewayEnv = nodeGatewayOverrides?.env ?? 'production';\n\tconst nodeGatewayUrl = nodeGatewayOverrides?.url;\n\tconst projectAccessKey =\n\t\tnodeGatewayOverrides?.accessKey ?? sdkConfig.projectAccessKey;\n\n\tconst transports = getTransportConfigs(\n\t\tchains,\n\t\tprojectAccessKey,\n\t\tnodeGatewayEnv,\n\t\tnodeGatewayUrl,\n\t);\n\n\treturn { chains, transports };\n}\n\nfunction getChainConfigs(\n\t_marketConfig: MarketplaceConfig,\n): [Chain, ...Chain[]] {\n\tconst chains = Object.values(allNetworks).map(networkToWagmiChain);\n\n\treturn chains as [Chain, ...Chain[]];\n}\n\nfunction getTransportConfigs(\n\tchains: [Chain, ...Chain[]],\n\tprojectAccessKey: string,\n\tnodeGatewayEnv: Env | undefined,\n\tnodeGatewayUrl?: string,\n): Record<number, Transport> {\n\treturn chains.reduce(\n\t\t(acc, chain) => {\n\t\t\tconst network = findNetworkConfig(allNetworks, chain.id);\n\t\t\tif (network) {\n\t\t\t\tlet rpcUrl: string;\n\t\t\t\tif (nodeGatewayUrl) {\n\t\t\t\t\t// Use manual URL if provided\n\t\t\t\t\trpcUrl = nodeGatewayUrl;\n\t\t\t\t} else {\n\t\t\t\t\t// Use default URL with environment prefix\n\t\t\t\t\trpcUrl = network.rpcUrl;\n\t\t\t\t\tif (nodeGatewayEnv === 'development') {\n\t\t\t\t\t\trpcUrl = rpcUrl.replace('nodes.', 'dev-nodes.');\n\t\t\t\t\t}\n\t\t\t\t\tif (!network.rpcUrl.endsWith(projectAccessKey))\n\t\t\t\t\t\trpcUrl = `${rpcUrl}/${projectAccessKey}`;\n\t\t\t\t}\n\t\t\t\tacc[chain.id] = http(rpcUrl);\n\t\t\t}\n\t\t\treturn acc;\n\t\t},\n\t\t{} as Record<number, Transport>,\n\t);\n}\n"],"mappings":"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"}
@@ -0,0 +1,186 @@
1
+ import { l as compareAddress } from "./utils.js";
2
+ import { g as getQueryClient, r as getMarketplaceClient } from "./api.js";
3
+ import { r as buildQueryOptions } from "./_internal.js";
4
+ import { n as marketplaceConfigOptions } from "./config.js";
5
+ import { formatUnits, isAddress, zeroAddress } from "viem";
6
+
7
+ //#region src/react/queries/currency/list.ts
8
+ /**
9
+ * Fetches supported currencies for a marketplace
10
+ */
11
+ async function fetchMarketCurrencies(params) {
12
+ const { chainId, includeNativeCurrency, collectionAddress, config } = params;
13
+ const includeNativeCurrencyOption = includeNativeCurrency ?? true;
14
+ let currencies = await getMarketplaceClient(config).listCurrencies({ chainId }).then((resp) => resp.currencies.map((currency) => ({
15
+ ...currency,
16
+ contractAddress: currency.contractAddress || zeroAddress
17
+ })));
18
+ if (collectionAddress) {
19
+ const currenciesOptions = (await getQueryClient().fetchQuery(marketplaceConfigOptions(config))).market.collections.find((collection) => compareAddress(collection.itemsAddress, collectionAddress))?.currencyOptions;
20
+ if (currenciesOptions) currencies = currencies.filter((currency) => currenciesOptions.includes(currency.contractAddress));
21
+ }
22
+ if (!includeNativeCurrencyOption) currencies = currencies.filter((currency) => !currency.nativeCurrency);
23
+ return currencies;
24
+ }
25
+ function getMarketCurrenciesQueryKey(params) {
26
+ return [
27
+ "currency",
28
+ "list",
29
+ {
30
+ chainId: params.chainId,
31
+ includeNativeCurrency: params.includeNativeCurrency,
32
+ collectionAddress: params.collectionAddress
33
+ }
34
+ ];
35
+ }
36
+ function marketCurrenciesQueryOptions(params) {
37
+ return buildQueryOptions({
38
+ getQueryKey: getMarketCurrenciesQueryKey,
39
+ requiredParams: ["chainId", "config"],
40
+ fetcher: fetchMarketCurrencies
41
+ }, params);
42
+ }
43
+
44
+ //#endregion
45
+ //#region src/react/queries/currency/convert-to-usd.ts
46
+ /**
47
+ * Converts a price amount from a specific currency to USD using exchange rates
48
+ */
49
+ async function fetchConvertPriceToUSD(params) {
50
+ const { chainId, currencyAddress, amountRaw, config } = params;
51
+ const currencyDetails = (await getQueryClient().fetchQuery(marketCurrenciesQueryOptions({
52
+ chainId,
53
+ config
54
+ }))).find((c) => c.contractAddress.toLowerCase() === currencyAddress.toLowerCase());
55
+ if (!currencyDetails) throw new Error("Currency not found");
56
+ const usdAmount = Number(formatUnits(BigInt(amountRaw), currencyDetails.decimals)) * currencyDetails.exchangeRate;
57
+ return {
58
+ usdAmount,
59
+ usdAmountFormatted: usdAmount.toFixed(2)
60
+ };
61
+ }
62
+ function getConvertPriceToUSDQueryKey(params) {
63
+ return [
64
+ "currency",
65
+ "convert-to-usd",
66
+ {
67
+ chainId: params.chainId,
68
+ currencyAddress: params.currencyAddress,
69
+ amountRaw: params.amountRaw
70
+ }
71
+ ];
72
+ }
73
+ function convertPriceToUSDQueryOptions(params) {
74
+ return buildQueryOptions({
75
+ getQueryKey: getConvertPriceToUSDQueryKey,
76
+ requiredParams: [
77
+ "chainId",
78
+ "currencyAddress",
79
+ "amountRaw",
80
+ "config"
81
+ ],
82
+ fetcher: fetchConvertPriceToUSD
83
+ }, params);
84
+ }
85
+
86
+ //#endregion
87
+ //#region src/react/queries/currency/compare-prices.ts
88
+ /**
89
+ * Compares prices between different currencies by converting both to USD
90
+ */
91
+ async function fetchComparePrices(params) {
92
+ const { chainId, priceAmountRaw, priceCurrencyAddress, compareToPriceAmountRaw, compareToPriceCurrencyAddress, config } = params;
93
+ const [priceUSD, compareToPriceUSD] = await Promise.all([fetchConvertPriceToUSD({
94
+ chainId,
95
+ currencyAddress: priceCurrencyAddress,
96
+ amountRaw: priceAmountRaw,
97
+ config
98
+ }), fetchConvertPriceToUSD({
99
+ chainId,
100
+ currencyAddress: compareToPriceCurrencyAddress,
101
+ amountRaw: compareToPriceAmountRaw,
102
+ config
103
+ })]);
104
+ const difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;
105
+ if (compareToPriceUSD.usdAmount === 0) throw new Error("Cannot compare to zero price");
106
+ const percentageDifference = difference / compareToPriceUSD.usdAmount * 100;
107
+ const isAbove = percentageDifference > 0;
108
+ const isSame = percentageDifference === 0;
109
+ return {
110
+ percentageDifference,
111
+ percentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),
112
+ status: isAbove ? "above" : isSame ? "same" : "below"
113
+ };
114
+ }
115
+ function getComparePricesQueryKey(params) {
116
+ return [
117
+ "currency",
118
+ "compare-prices",
119
+ {
120
+ chainId: params.chainId,
121
+ priceAmountRaw: params.priceAmountRaw,
122
+ priceCurrencyAddress: params.priceCurrencyAddress,
123
+ compareToPriceAmountRaw: params.compareToPriceAmountRaw,
124
+ compareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress
125
+ }
126
+ ];
127
+ }
128
+ function comparePricesQueryOptions(params) {
129
+ return buildQueryOptions({
130
+ getQueryKey: getComparePricesQueryKey,
131
+ requiredParams: [
132
+ "chainId",
133
+ "priceAmountRaw",
134
+ "priceCurrencyAddress",
135
+ "compareToPriceAmountRaw",
136
+ "compareToPriceCurrencyAddress",
137
+ "config"
138
+ ],
139
+ fetcher: fetchComparePrices
140
+ }, params);
141
+ }
142
+
143
+ //#endregion
144
+ //#region src/react/queries/currency/currency.ts
145
+ /**
146
+ * Fetches currency details from the marketplace API
147
+ */
148
+ async function fetchCurrency(params) {
149
+ const { chainId, currencyAddress, config } = params;
150
+ let currencies = getQueryClient().getQueryData([
151
+ "currency",
152
+ "list",
153
+ chainId
154
+ ]);
155
+ if (!currencies) currencies = (await getMarketplaceClient(config).listCurrencies({ chainId })).currencies;
156
+ if (!currencies?.length) throw new Error("No currencies returned");
157
+ const currency = currencies.find((currency$1) => currency$1.contractAddress.toLowerCase() === currencyAddress.toLowerCase());
158
+ if (!currency) throw new Error("Currency not found");
159
+ return currency;
160
+ }
161
+ function getCurrencyQueryKey(params) {
162
+ return [
163
+ "currency",
164
+ "currency",
165
+ {
166
+ chainId: String(params.chainId ?? 0),
167
+ currencyAddress: params.currencyAddress ?? ""
168
+ }
169
+ ];
170
+ }
171
+ function currencyQueryOptions(params) {
172
+ return buildQueryOptions({
173
+ getQueryKey: getCurrencyQueryKey,
174
+ requiredParams: [
175
+ "chainId",
176
+ "currencyAddress",
177
+ "config"
178
+ ],
179
+ fetcher: fetchCurrency,
180
+ customValidation: (p) => !!p.currencyAddress && isAddress(p.currencyAddress)
181
+ }, params);
182
+ }
183
+
184
+ //#endregion
185
+ export { fetchComparePrices as a, fetchConvertPriceToUSD as c, getMarketCurrenciesQueryKey as d, marketCurrenciesQueryOptions as f, comparePricesQueryOptions as i, getConvertPriceToUSDQueryKey as l, fetchCurrency as n, getComparePricesQueryKey as o, getCurrencyQueryKey as r, convertPriceToUSDQueryOptions as s, currencyQueryOptions as t, fetchMarketCurrencies as u };
186
+ //# sourceMappingURL=currency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currency.js","names":["currency"],"sources":["../src/react/queries/currency/list.ts","../src/react/queries/currency/convert-to-usd.ts","../src/react/queries/currency/compare-prices.ts","../src/react/queries/currency/currency.ts"],"sourcesContent":["import type {\n\tAddress,\n\tCurrency,\n\tListCurrenciesRequest,\n} from '@0xsequence/api-client';\nimport { zeroAddress } from 'viem';\nimport { compareAddress } from '../../../utils';\nimport {\n\tbuildQueryOptions,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketplaceConfigOptions } from '../marketplace/config';\n\nexport type FetchMarketCurrenciesParams = ListCurrenciesRequest & {\n\tincludeNativeCurrency?: boolean;\n\tcollectionAddress?: Address;\n};\n\nexport type MarketCurrenciesQueryOptions =\n\tSdkQueryParams<FetchMarketCurrenciesParams>;\n\n/**\n * Fetches supported currencies for a marketplace\n */\nexport async function fetchMarketCurrencies(\n\tparams: WithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>,\n): Promise<Currency[]> {\n\tconst { chainId, includeNativeCurrency, collectionAddress, config } = params;\n\tconst includeNativeCurrencyOption = includeNativeCurrency ?? true;\n\tconst marketplaceClient = getMarketplaceClient(config);\n\n\tlet currencies = await marketplaceClient\n\t\t.listCurrencies({\n\t\t\tchainId,\n\t\t})\n\t\t.then((resp) =>\n\t\t\tresp.currencies.map((currency) => ({\n\t\t\t\t...currency,\n\t\t\t\tcontractAddress: currency.contractAddress || zeroAddress,\n\t\t\t})),\n\t\t);\n\n\tif (collectionAddress) {\n\t\tconst queryClient = getQueryClient();\n\t\tconst marketplaceConfig = await queryClient.fetchQuery(\n\t\t\tmarketplaceConfigOptions(config),\n\t\t);\n\n\t\tconst currenciesOptions = marketplaceConfig.market.collections.find(\n\t\t\t(collection) =>\n\t\t\t\tcompareAddress(collection.itemsAddress, collectionAddress),\n\t\t)?.currencyOptions;\n\n\t\t// Filter currencies based on collection currency options\n\t\tif (currenciesOptions) {\n\t\t\tcurrencies = currencies.filter((currency) =>\n\t\t\t\tcurrenciesOptions.includes(currency.contractAddress),\n\t\t\t);\n\t\t}\n\t}\n\n\tif (!includeNativeCurrencyOption) {\n\t\tcurrencies = currencies.filter((currency) => !currency.nativeCurrency);\n\t}\n\n\treturn currencies;\n}\n\nexport function getMarketCurrenciesQueryKey(\n\tparams: MarketCurrenciesQueryOptions,\n) {\n\treturn [\n\t\t'currency',\n\t\t'list',\n\t\t{\n\t\t\tchainId: params.chainId,\n\t\t\tincludeNativeCurrency: params.includeNativeCurrency,\n\t\t\tcollectionAddress: params.collectionAddress,\n\t\t},\n\t] as const;\n}\n\nexport function marketCurrenciesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<MarketCurrenciesQueryOptions, 'chainId' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getMarketCurrenciesQueryKey,\n\t\t\trequiredParams: ['chainId', 'config'] as const,\n\t\t\tfetcher: fetchMarketCurrencies,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport { formatUnits } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { marketCurrenciesQueryOptions } from './list';\n\nexport type FetchConvertPriceToUSDParams = {\n\tchainId: ChainId;\n\tcurrencyAddress: Address;\n\tamountRaw: string;\n};\n\nexport type ConvertPriceToUSDReturn = {\n\tusdAmount: number;\n\tusdAmountFormatted: string;\n};\n\nexport type ConvertPriceToUSDQueryOptions =\n\tSdkQueryParams<FetchConvertPriceToUSDParams>;\n\n/**\n * Converts a price amount from a specific currency to USD using exchange rates\n */\nexport async function fetchConvertPriceToUSD(\n\tparams: WithRequired<\n\t\tConvertPriceToUSDQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t>,\n): Promise<ConvertPriceToUSDReturn> {\n\tconst { chainId, currencyAddress, amountRaw, config } = params;\n\n\tconst queryClient = getQueryClient();\n\tconst currencies = await queryClient.fetchQuery(\n\t\tmarketCurrenciesQueryOptions({\n\t\t\tchainId,\n\t\t\tconfig,\n\t\t}),\n\t);\n\n\tconst currencyDetails = currencies.find(\n\t\t(c: Currency) =>\n\t\t\tc.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currencyDetails) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\tconst amountDecimal = Number(\n\t\tformatUnits(BigInt(amountRaw), currencyDetails.decimals),\n\t);\n\tconst usdAmount = amountDecimal * currencyDetails.exchangeRate;\n\n\treturn {\n\t\tusdAmount,\n\t\tusdAmountFormatted: usdAmount.toFixed(2),\n\t};\n}\n\nexport function getConvertPriceToUSDQueryKey(\n\tparams: ConvertPriceToUSDQueryOptions,\n) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tcurrencyAddress: params.currencyAddress,\n\t\tamountRaw: params.amountRaw,\n\t};\n\n\treturn ['currency', 'convert-to-usd', apiArgs] as const;\n}\n\nexport function convertPriceToUSDQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tConvertPriceToUSDQueryOptions,\n\t\t\t'chainId' | 'currencyAddress' | 'amountRaw' | 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getConvertPriceToUSDQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'currencyAddress',\n\t\t\t\t'amountRaw',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchConvertPriceToUSD,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ChainId } from '@0xsequence/api-client';\nimport {\n\tbuildQueryOptions,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\nimport { fetchConvertPriceToUSD } from './convert-to-usd';\n\nexport type FetchComparePricesParams = {\n\tchainId?: ChainId;\n\tpriceAmountRaw?: string;\n\tpriceCurrencyAddress?: Address;\n\tcompareToPriceAmountRaw?: string;\n\tcompareToPriceCurrencyAddress?: Address;\n};\n\nexport type ComparePricesReturn = {\n\tpercentageDifference: number;\n\tpercentageDifferenceFormatted: string;\n\tstatus: 'above' | 'same' | 'below';\n};\n\nexport type ComparePricesQueryOptions =\n\tSdkQueryParams<FetchComparePricesParams>;\n\n/**\n * Compares prices between different currencies by converting both to USD\n */\nexport async function fetchComparePrices(\n\tparams: WithRequired<\n\t\tComparePricesQueryOptions,\n\t\t| 'chainId'\n\t\t| 'priceAmountRaw'\n\t\t| 'priceCurrencyAddress'\n\t\t| 'compareToPriceAmountRaw'\n\t\t| 'compareToPriceCurrencyAddress'\n\t\t| 'config'\n\t>,\n): Promise<ComparePricesReturn> {\n\tconst {\n\t\tchainId,\n\t\tpriceAmountRaw,\n\t\tpriceCurrencyAddress,\n\t\tcompareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress,\n\t\tconfig,\n\t} = params;\n\n\tconst [priceUSD, compareToPriceUSD] = await Promise.all([\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: priceCurrencyAddress,\n\t\t\tamountRaw: priceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t\tfetchConvertPriceToUSD({\n\t\t\tchainId,\n\t\t\tcurrencyAddress: compareToPriceCurrencyAddress,\n\t\t\tamountRaw: compareToPriceAmountRaw,\n\t\t\tconfig,\n\t\t}),\n\t]);\n\n\tconst difference = priceUSD.usdAmount - compareToPriceUSD.usdAmount;\n\n\tif (compareToPriceUSD.usdAmount === 0) {\n\t\tthrow new Error('Cannot compare to zero price');\n\t}\n\n\tconst percentageDifference = (difference / compareToPriceUSD.usdAmount) * 100;\n\tconst isAbove = percentageDifference > 0;\n\tconst isSame = percentageDifference === 0;\n\n\treturn {\n\t\tpercentageDifference,\n\t\tpercentageDifferenceFormatted: Math.abs(percentageDifference).toFixed(2),\n\t\tstatus: isAbove ? 'above' : isSame ? 'same' : 'below',\n\t};\n}\n\nexport function getComparePricesQueryKey(params: ComparePricesQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: params.chainId,\n\t\tpriceAmountRaw: params.priceAmountRaw,\n\t\tpriceCurrencyAddress: params.priceCurrencyAddress,\n\t\tcompareToPriceAmountRaw: params.compareToPriceAmountRaw,\n\t\tcompareToPriceCurrencyAddress: params.compareToPriceCurrencyAddress,\n\t};\n\n\treturn ['currency', 'compare-prices', apiArgs] as const;\n}\n\nexport function comparePricesQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<\n\t\t\tComparePricesQueryOptions,\n\t\t\t| 'chainId'\n\t\t\t| 'priceAmountRaw'\n\t\t\t| 'priceCurrencyAddress'\n\t\t\t| 'compareToPriceAmountRaw'\n\t\t\t| 'compareToPriceCurrencyAddress'\n\t\t\t| 'config'\n\t\t>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getComparePricesQueryKey,\n\t\t\trequiredParams: [\n\t\t\t\t'chainId',\n\t\t\t\t'priceAmountRaw',\n\t\t\t\t'priceCurrencyAddress',\n\t\t\t\t'compareToPriceAmountRaw',\n\t\t\t\t'compareToPriceCurrencyAddress',\n\t\t\t\t'config',\n\t\t\t] as const,\n\t\t\tfetcher: fetchComparePrices,\n\t\t},\n\t\tparams,\n\t);\n}\n","import type { Address, ListCurrenciesRequest } from '@0xsequence/api-client';\nimport { isAddress } from 'viem';\nimport {\n\tbuildQueryOptions,\n\ttype Currency,\n\tgetMarketplaceClient,\n\tgetQueryClient,\n\ttype SdkQueryParams,\n\ttype WithOptionalParams,\n\ttype WithRequired,\n} from '../../_internal';\n\nexport type FetchCurrencyParams = ListCurrenciesRequest & {\n\tcurrencyAddress: Address;\n};\n\n/**\n * Fetches currency details from the marketplace API\n */\nexport async function fetchCurrency(\n\tparams: WithRequired<\n\t\tCurrencyQueryOptions,\n\t\t'chainId' | 'currencyAddress' | 'config'\n\t>,\n): Promise<Currency | undefined> {\n\tconst { chainId, currencyAddress, config } = params;\n\tconst queryClient = getQueryClient();\n\n\tlet currencies = queryClient.getQueryData<Currency[]>([\n\t\t'currency',\n\t\t'list',\n\t\tchainId,\n\t]);\n\n\tif (!currencies) {\n\t\tconst marketplaceClient = getMarketplaceClient(config);\n\t\tconst response = await marketplaceClient.listCurrencies({ chainId });\n\t\tcurrencies = response.currencies;\n\t}\n\n\tif (!currencies?.length) {\n\t\tthrow new Error('No currencies returned');\n\t}\n\tconst currency = currencies.find(\n\t\t(currency) =>\n\t\t\tcurrency.contractAddress.toLowerCase() === currencyAddress.toLowerCase(),\n\t);\n\n\tif (!currency) {\n\t\tthrow new Error('Currency not found');\n\t}\n\n\treturn currency;\n}\n\nexport type CurrencyQueryOptions = SdkQueryParams<FetchCurrencyParams>;\n\nexport function getCurrencyQueryKey(params: CurrencyQueryOptions) {\n\tconst apiArgs = {\n\t\tchainId: String(params.chainId ?? 0),\n\t\tcurrencyAddress: params.currencyAddress ?? '',\n\t};\n\n\treturn ['currency', 'currency', apiArgs] as const;\n}\n\nexport function currencyQueryOptions(\n\tparams: WithOptionalParams<\n\t\tWithRequired<CurrencyQueryOptions, 'chainId' | 'currencyAddress' | 'config'>\n\t>,\n) {\n\treturn buildQueryOptions(\n\t\t{\n\t\t\tgetQueryKey: getCurrencyQueryKey,\n\t\t\trequiredParams: ['chainId', 'currencyAddress', 'config'] as const,\n\t\t\tfetcher: fetchCurrency,\n\t\t\tcustomValidation: (p) =>\n\t\t\t\t!!p.currencyAddress && isAddress(p.currencyAddress),\n\t\t},\n\t\tparams,\n\t);\n}\n"],"mappings":"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"}
@@ -0,0 +1,28 @@
1
+ 'use client'
2
+
3
+ import { useState } from "react";
4
+ import { TokenImage } from "@0xsequence/design-system";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/react/ui/modals/_internal/components/currencyImage/index.tsx
8
+ function CurrencyImage({ price }) {
9
+ const [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] = useState(null);
10
+ if (!price?.currency) return /* @__PURE__ */ jsx("div", { className: "h-3 w-3 rounded-full bg-background-secondary" });
11
+ if (imageLoadErrorCurrencyAddresses?.includes(price.currency.contractAddress)) return /* @__PURE__ */ jsx("div", { className: "h-3 w-3 rounded-full bg-background-secondary" });
12
+ return /* @__PURE__ */ jsx(TokenImage, {
13
+ src: price.currency.imageUrl,
14
+ onError: () => {
15
+ if (price) setImageLoadErrorCurrencyAddresses((prev) => {
16
+ if (!prev) return [price.currency.contractAddress];
17
+ if (!prev.includes(price.currency.contractAddress)) return [...prev, price.currency.contractAddress];
18
+ return prev;
19
+ });
20
+ },
21
+ size: "xs"
22
+ });
23
+ }
24
+ var currencyImage_default = CurrencyImage;
25
+
26
+ //#endregion
27
+ export { currencyImage_default as t };
28
+ //# sourceMappingURL=currencyImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currencyImage.js","names":[],"sources":["../src/react/ui/modals/_internal/components/currencyImage/index.tsx"],"sourcesContent":["'use client';\n\nimport type { Address } from '@0xsequence/api-client';\nimport { TokenImage } from '@0xsequence/design-system';\nimport { useState } from 'react';\nimport type { Price } from '../../../../../../types';\n\nfunction CurrencyImage({ price }: { price: Price | undefined }) {\n\tconst [imageLoadErrorCurrencyAddresses, setImageLoadErrorCurrencyAddresses] =\n\t\tuseState<Address[] | null>(null);\n\n\tif (!price?.currency) {\n\t\treturn <div className=\"h-3 w-3 rounded-full bg-background-secondary\" />;\n\t}\n\n\tif (\n\t\timageLoadErrorCurrencyAddresses?.includes(price.currency.contractAddress)\n\t) {\n\t\treturn <div className=\"h-3 w-3 rounded-full bg-background-secondary\" />;\n\t}\n\n\treturn (\n\t\t<TokenImage\n\t\t\tsrc={price.currency.imageUrl}\n\t\t\tonError={() => {\n\t\t\t\tif (price) {\n\t\t\t\t\tsetImageLoadErrorCurrencyAddresses((prev) => {\n\t\t\t\t\t\tif (!prev) return [price.currency.contractAddress];\n\t\t\t\t\t\tif (!prev.includes(price.currency.contractAddress)) {\n\t\t\t\t\t\t\treturn [...prev, price.currency.contractAddress];\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn prev;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}}\n\t\t\tsize=\"xs\"\n\t\t/>\n\t);\n}\nexport default CurrencyImage;\n"],"mappings":";;;;;AAOA,SAAS,cAAc,EAAE,SAAuC;CAC/D,MAAM,CAAC,iCAAiC,sCACvC,SAA2B,KAAK;AAEjC,KAAI,CAAC,OAAO,SACX,QAAO,oBAAC,SAAI,WAAU,iDAAiD;AAGxE,KACC,iCAAiC,SAAS,MAAM,SAAS,gBAAgB,CAEzE,QAAO,oBAAC,SAAI,WAAU,iDAAiD;AAGxE,QACC,oBAAC;EACA,KAAK,MAAM,SAAS;EACpB,eAAe;AACd,OAAI,MACH,qCAAoC,SAAS;AAC5C,QAAI,CAAC,KAAM,QAAO,CAAC,MAAM,SAAS,gBAAgB;AAClD,QAAI,CAAC,KAAK,SAAS,MAAM,SAAS,gBAAgB,CACjD,QAAO,CAAC,GAAG,MAAM,MAAM,SAAS,gBAAgB;AAEjD,WAAO;KACN;;EAGJ,MAAK;GACJ;;AAGJ,4BAAe"}