@0xsequence/checkout 0.0.0-20250314205219

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 (416) hide show
  1. package/LICENSE +219 -0
  2. package/README.md +256 -0
  3. package/dist/cjs/api/data.js +165 -0
  4. package/dist/cjs/api/data.js.map +1 -0
  5. package/dist/cjs/api/index.js +18 -0
  6. package/dist/cjs/api/index.js.map +1 -0
  7. package/dist/cjs/components/CopyButton.js +24 -0
  8. package/dist/cjs/components/CopyButton.js.map +1 -0
  9. package/dist/cjs/components/DefaultIcon.js +13 -0
  10. package/dist/cjs/components/DefaultIcon.js.map +1 -0
  11. package/dist/cjs/components/NavigationHeader.js +23 -0
  12. package/dist/cjs/components/NavigationHeader.js.map +1 -0
  13. package/dist/cjs/components/SequenceCheckoutProvider/SequenceCheckoutProvider.js +215 -0
  14. package/dist/cjs/components/SequenceCheckoutProvider/SequenceCheckoutProvider.js.map +1 -0
  15. package/dist/cjs/components/SequenceCheckoutProvider/index.js +18 -0
  16. package/dist/cjs/components/SequenceCheckoutProvider/index.js.map +1 -0
  17. package/dist/cjs/constants/abi.js +188 -0
  18. package/dist/cjs/constants/abi.js.map +1 -0
  19. package/dist/cjs/constants/index.js +8 -0
  20. package/dist/cjs/constants/index.js.map +1 -0
  21. package/dist/cjs/contexts/AddFundsModal.js +7 -0
  22. package/dist/cjs/contexts/AddFundsModal.js.map +1 -0
  23. package/dist/cjs/contexts/CheckoutModal.js +8 -0
  24. package/dist/cjs/contexts/CheckoutModal.js.map +1 -0
  25. package/dist/cjs/contexts/Navigation.js +8 -0
  26. package/dist/cjs/contexts/Navigation.js.map +1 -0
  27. package/dist/cjs/contexts/SelectPaymentModal.js +7 -0
  28. package/dist/cjs/contexts/SelectPaymentModal.js.map +1 -0
  29. package/dist/cjs/contexts/SwapModal.js +8 -0
  30. package/dist/cjs/contexts/SwapModal.js.map +1 -0
  31. package/dist/cjs/contexts/TransactionStatusModal.js +7 -0
  32. package/dist/cjs/contexts/TransactionStatusModal.js.map +1 -0
  33. package/dist/cjs/contexts/TransferFundsModal.js +7 -0
  34. package/dist/cjs/contexts/TransferFundsModal.js.map +1 -0
  35. package/dist/cjs/contexts/genericContext.js +20 -0
  36. package/dist/cjs/contexts/genericContext.js.map +1 -0
  37. package/dist/cjs/contexts/index.js +24 -0
  38. package/dist/cjs/contexts/index.js.map +1 -0
  39. package/dist/cjs/hooks/index.js +30 -0
  40. package/dist/cjs/hooks/index.js.map +1 -0
  41. package/dist/cjs/hooks/useAddFundsModal.js +10 -0
  42. package/dist/cjs/hooks/useAddFundsModal.js.map +1 -0
  43. package/dist/cjs/hooks/useCheckoutModal.js +10 -0
  44. package/dist/cjs/hooks/useCheckoutModal.js.map +1 -0
  45. package/dist/cjs/hooks/useCheckoutOptionsSalesContract.js +20 -0
  46. package/dist/cjs/hooks/useCheckoutOptionsSalesContract.js.map +1 -0
  47. package/dist/cjs/hooks/useCheckoutWhitelistStatus.js +21 -0
  48. package/dist/cjs/hooks/useCheckoutWhitelistStatus.js.map +1 -0
  49. package/dist/cjs/hooks/useERC1155SaleContractCheckout.js +157 -0
  50. package/dist/cjs/hooks/useERC1155SaleContractCheckout.js.map +1 -0
  51. package/dist/cjs/hooks/useMarketplaceClient.js +40 -0
  52. package/dist/cjs/hooks/useMarketplaceClient.js.map +1 -0
  53. package/dist/cjs/hooks/useModalTheme.js +10 -0
  54. package/dist/cjs/hooks/useModalTheme.js.map +1 -0
  55. package/dist/cjs/hooks/useNavigation.js +24 -0
  56. package/dist/cjs/hooks/useNavigation.js.map +1 -0
  57. package/dist/cjs/hooks/useSardineClientToken.js +20 -0
  58. package/dist/cjs/hooks/useSardineClientToken.js.map +1 -0
  59. package/dist/cjs/hooks/useSelectPaymentModal.js +10 -0
  60. package/dist/cjs/hooks/useSelectPaymentModal.js.map +1 -0
  61. package/dist/cjs/hooks/useSkipOnCloseCallback.js +22 -0
  62. package/dist/cjs/hooks/useSkipOnCloseCallback.js.map +1 -0
  63. package/dist/cjs/hooks/useSwapModal.js +10 -0
  64. package/dist/cjs/hooks/useSwapModal.js.map +1 -0
  65. package/dist/cjs/hooks/useTransactionStatusModal.js +10 -0
  66. package/dist/cjs/hooks/useTransactionStatusModal.js.map +1 -0
  67. package/dist/cjs/hooks/useTransferFundsModal.js +10 -0
  68. package/dist/cjs/hooks/useTransferFundsModal.js.map +1 -0
  69. package/dist/cjs/index.js +27 -0
  70. package/dist/cjs/index.js.map +1 -0
  71. package/dist/cjs/utils/index.js +18 -0
  72. package/dist/cjs/utils/index.js.map +1 -0
  73. package/dist/cjs/utils/sardine.js +52 -0
  74. package/dist/cjs/utils/sardine.js.map +1 -0
  75. package/dist/cjs/utils/sizing.js +12 -0
  76. package/dist/cjs/utils/sizing.js.map +1 -0
  77. package/dist/cjs/utils/transak.js +41 -0
  78. package/dist/cjs/utils/transak.js.map +1 -0
  79. package/dist/cjs/views/AddFunds.js +50 -0
  80. package/dist/cjs/views/AddFunds.js.map +1 -0
  81. package/dist/cjs/views/CheckoutSelection/component/OrderSummaryItem.js +35 -0
  82. package/dist/cjs/views/CheckoutSelection/component/OrderSummaryItem.js.map +1 -0
  83. package/dist/cjs/views/CheckoutSelection/index.js +83 -0
  84. package/dist/cjs/views/CheckoutSelection/index.js.map +1 -0
  85. package/dist/cjs/views/PaymentSelection/Footer.js +12 -0
  86. package/dist/cjs/views/PaymentSelection/Footer.js.map +1 -0
  87. package/dist/cjs/views/PaymentSelection/OrderSummary/Price.js +42 -0
  88. package/dist/cjs/views/PaymentSelection/OrderSummary/Price.js.map +1 -0
  89. package/dist/cjs/views/PaymentSelection/OrderSummary/index.js +63 -0
  90. package/dist/cjs/views/PaymentSelection/OrderSummary/index.js.map +1 -0
  91. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.js +10 -0
  92. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.js.map +1 -0
  93. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/index.js +112 -0
  94. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/index.js.map +1 -0
  95. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.js +9 -0
  96. package/dist/cjs/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.js.map +1 -0
  97. package/dist/cjs/views/PaymentSelection/PayWithCrypto/index.js +134 -0
  98. package/dist/cjs/views/PaymentSelection/PayWithCrypto/index.js.map +1 -0
  99. package/dist/cjs/views/PaymentSelection/TransferFunds.js +50 -0
  100. package/dist/cjs/views/PaymentSelection/TransferFunds.js.map +1 -0
  101. package/dist/cjs/views/PaymentSelection/index.js +332 -0
  102. package/dist/cjs/views/PaymentSelection/index.js.map +1 -0
  103. package/dist/cjs/views/PendingCreditCardTransaction.js +295 -0
  104. package/dist/cjs/views/PendingCreditCardTransaction.js.map +1 -0
  105. package/dist/cjs/views/Swap/index.js +173 -0
  106. package/dist/cjs/views/Swap/index.js.map +1 -0
  107. package/dist/cjs/views/TransactionError.js +23 -0
  108. package/dist/cjs/views/TransactionError.js.map +1 -0
  109. package/dist/cjs/views/TransactionStatus/index.js +178 -0
  110. package/dist/cjs/views/TransactionStatus/index.js.map +1 -0
  111. package/dist/cjs/views/TransactionSuccess.js +23 -0
  112. package/dist/cjs/views/TransactionSuccess.js.map +1 -0
  113. package/dist/cjs/views/TransferToWallet/CopyButton.js +24 -0
  114. package/dist/cjs/views/TransferToWallet/CopyButton.js.map +1 -0
  115. package/dist/cjs/views/TransferToWallet/QRCode.js +13 -0
  116. package/dist/cjs/views/TransferToWallet/QRCode.js.map +1 -0
  117. package/dist/cjs/views/TransferToWallet/index.js +17 -0
  118. package/dist/cjs/views/TransferToWallet/index.js.map +1 -0
  119. package/dist/cjs/views/index.js +26 -0
  120. package/dist/cjs/views/index.js.map +1 -0
  121. package/dist/esm/api/data.js +159 -0
  122. package/dist/esm/api/data.js.map +1 -0
  123. package/dist/esm/api/index.js +2 -0
  124. package/dist/esm/api/index.js.map +1 -0
  125. package/dist/esm/components/CopyButton.js +20 -0
  126. package/dist/esm/components/CopyButton.js.map +1 -0
  127. package/dist/esm/components/DefaultIcon.js +9 -0
  128. package/dist/esm/components/DefaultIcon.js.map +1 -0
  129. package/dist/esm/components/NavigationHeader.js +19 -0
  130. package/dist/esm/components/NavigationHeader.js.map +1 -0
  131. package/dist/esm/components/SequenceCheckoutProvider/SequenceCheckoutProvider.js +210 -0
  132. package/dist/esm/components/SequenceCheckoutProvider/SequenceCheckoutProvider.js.map +1 -0
  133. package/dist/esm/components/SequenceCheckoutProvider/index.js +2 -0
  134. package/dist/esm/components/SequenceCheckoutProvider/index.js.map +1 -0
  135. package/dist/esm/constants/abi.js +185 -0
  136. package/dist/esm/constants/abi.js.map +1 -0
  137. package/dist/esm/constants/index.js +5 -0
  138. package/dist/esm/constants/index.js.map +1 -0
  139. package/dist/esm/contexts/AddFundsModal.js +3 -0
  140. package/dist/esm/contexts/AddFundsModal.js.map +1 -0
  141. package/dist/esm/contexts/CheckoutModal.js +4 -0
  142. package/dist/esm/contexts/CheckoutModal.js.map +1 -0
  143. package/dist/esm/contexts/Navigation.js +4 -0
  144. package/dist/esm/contexts/Navigation.js.map +1 -0
  145. package/dist/esm/contexts/SelectPaymentModal.js +3 -0
  146. package/dist/esm/contexts/SelectPaymentModal.js.map +1 -0
  147. package/dist/esm/contexts/SwapModal.js +4 -0
  148. package/dist/esm/contexts/SwapModal.js.map +1 -0
  149. package/dist/esm/contexts/TransactionStatusModal.js +3 -0
  150. package/dist/esm/contexts/TransactionStatusModal.js.map +1 -0
  151. package/dist/esm/contexts/TransferFundsModal.js +3 -0
  152. package/dist/esm/contexts/TransferFundsModal.js.map +1 -0
  153. package/dist/esm/contexts/genericContext.js +16 -0
  154. package/dist/esm/contexts/genericContext.js.map +1 -0
  155. package/dist/esm/contexts/index.js +8 -0
  156. package/dist/esm/contexts/index.js.map +1 -0
  157. package/dist/esm/hooks/index.js +14 -0
  158. package/dist/esm/hooks/index.js.map +1 -0
  159. package/dist/esm/hooks/useAddFundsModal.js +6 -0
  160. package/dist/esm/hooks/useAddFundsModal.js.map +1 -0
  161. package/dist/esm/hooks/useCheckoutModal.js +6 -0
  162. package/dist/esm/hooks/useCheckoutModal.js.map +1 -0
  163. package/dist/esm/hooks/useCheckoutOptionsSalesContract.js +16 -0
  164. package/dist/esm/hooks/useCheckoutOptionsSalesContract.js.map +1 -0
  165. package/dist/esm/hooks/useCheckoutWhitelistStatus.js +17 -0
  166. package/dist/esm/hooks/useCheckoutWhitelistStatus.js.map +1 -0
  167. package/dist/esm/hooks/useERC1155SaleContractCheckout.js +151 -0
  168. package/dist/esm/hooks/useERC1155SaleContractCheckout.js.map +1 -0
  169. package/dist/esm/hooks/useMarketplaceClient.js +36 -0
  170. package/dist/esm/hooks/useMarketplaceClient.js.map +1 -0
  171. package/dist/esm/hooks/useModalTheme.js +6 -0
  172. package/dist/esm/hooks/useModalTheme.js.map +1 -0
  173. package/dist/esm/hooks/useNavigation.js +20 -0
  174. package/dist/esm/hooks/useNavigation.js.map +1 -0
  175. package/dist/esm/hooks/useSardineClientToken.js +16 -0
  176. package/dist/esm/hooks/useSardineClientToken.js.map +1 -0
  177. package/dist/esm/hooks/useSelectPaymentModal.js +6 -0
  178. package/dist/esm/hooks/useSelectPaymentModal.js.map +1 -0
  179. package/dist/esm/hooks/useSkipOnCloseCallback.js +18 -0
  180. package/dist/esm/hooks/useSkipOnCloseCallback.js.map +1 -0
  181. package/dist/esm/hooks/useSwapModal.js +6 -0
  182. package/dist/esm/hooks/useSwapModal.js.map +1 -0
  183. package/dist/esm/hooks/useTransactionStatusModal.js +6 -0
  184. package/dist/esm/hooks/useTransactionStatusModal.js.map +1 -0
  185. package/dist/esm/hooks/useTransferFundsModal.js +6 -0
  186. package/dist/esm/hooks/useTransferFundsModal.js.map +1 -0
  187. package/dist/esm/index.js +13 -0
  188. package/dist/esm/index.js.map +1 -0
  189. package/dist/esm/utils/index.js +2 -0
  190. package/dist/esm/utils/index.js.map +1 -0
  191. package/dist/esm/utils/sardine.js +48 -0
  192. package/dist/esm/utils/sardine.js.map +1 -0
  193. package/dist/esm/utils/sizing.js +8 -0
  194. package/dist/esm/utils/sizing.js.map +1 -0
  195. package/dist/esm/utils/transak.js +36 -0
  196. package/dist/esm/utils/transak.js.map +1 -0
  197. package/dist/esm/views/AddFunds.js +46 -0
  198. package/dist/esm/views/AddFunds.js.map +1 -0
  199. package/dist/esm/views/CheckoutSelection/component/OrderSummaryItem.js +30 -0
  200. package/dist/esm/views/CheckoutSelection/component/OrderSummaryItem.js.map +1 -0
  201. package/dist/esm/views/CheckoutSelection/index.js +79 -0
  202. package/dist/esm/views/CheckoutSelection/index.js.map +1 -0
  203. package/dist/esm/views/PaymentSelection/Footer.js +8 -0
  204. package/dist/esm/views/PaymentSelection/Footer.js.map +1 -0
  205. package/dist/esm/views/PaymentSelection/OrderSummary/Price.js +38 -0
  206. package/dist/esm/views/PaymentSelection/OrderSummary/Price.js.map +1 -0
  207. package/dist/esm/views/PaymentSelection/OrderSummary/index.js +59 -0
  208. package/dist/esm/views/PaymentSelection/OrderSummary/index.js.map +1 -0
  209. package/dist/esm/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.js +6 -0
  210. package/dist/esm/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.js.map +1 -0
  211. package/dist/esm/views/PaymentSelection/PayWithCreditCard/index.js +108 -0
  212. package/dist/esm/views/PaymentSelection/PayWithCreditCard/index.js.map +1 -0
  213. package/dist/esm/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.js +5 -0
  214. package/dist/esm/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.js.map +1 -0
  215. package/dist/esm/views/PaymentSelection/PayWithCrypto/index.js +130 -0
  216. package/dist/esm/views/PaymentSelection/PayWithCrypto/index.js.map +1 -0
  217. package/dist/esm/views/PaymentSelection/TransferFunds.js +46 -0
  218. package/dist/esm/views/PaymentSelection/TransferFunds.js.map +1 -0
  219. package/dist/esm/views/PaymentSelection/index.js +326 -0
  220. package/dist/esm/views/PaymentSelection/index.js.map +1 -0
  221. package/dist/esm/views/PendingCreditCardTransaction.js +286 -0
  222. package/dist/esm/views/PendingCreditCardTransaction.js.map +1 -0
  223. package/dist/esm/views/Swap/index.js +169 -0
  224. package/dist/esm/views/Swap/index.js.map +1 -0
  225. package/dist/esm/views/TransactionError.js +18 -0
  226. package/dist/esm/views/TransactionError.js.map +1 -0
  227. package/dist/esm/views/TransactionStatus/index.js +170 -0
  228. package/dist/esm/views/TransactionStatus/index.js.map +1 -0
  229. package/dist/esm/views/TransactionSuccess.js +18 -0
  230. package/dist/esm/views/TransactionSuccess.js.map +1 -0
  231. package/dist/esm/views/TransferToWallet/CopyButton.js +20 -0
  232. package/dist/esm/views/TransferToWallet/CopyButton.js.map +1 -0
  233. package/dist/esm/views/TransferToWallet/QRCode.js +9 -0
  234. package/dist/esm/views/TransferToWallet/QRCode.js.map +1 -0
  235. package/dist/esm/views/TransferToWallet/index.js +13 -0
  236. package/dist/esm/views/TransferToWallet/index.js.map +1 -0
  237. package/dist/esm/views/index.js +10 -0
  238. package/dist/esm/views/index.js.map +1 -0
  239. package/dist/types/api/data.d.ts +21 -0
  240. package/dist/types/api/data.d.ts.map +1 -0
  241. package/dist/types/api/index.d.ts +2 -0
  242. package/dist/types/api/index.d.ts.map +1 -0
  243. package/dist/types/components/CopyButton.d.ts +9 -0
  244. package/dist/types/components/CopyButton.d.ts.map +1 -0
  245. package/dist/types/components/DefaultIcon.d.ts +6 -0
  246. package/dist/types/components/DefaultIcon.d.ts.map +1 -0
  247. package/dist/types/components/NavigationHeader.d.ts +8 -0
  248. package/dist/types/components/NavigationHeader.d.ts.map +1 -0
  249. package/dist/types/components/SequenceCheckoutProvider/SequenceCheckoutProvider.d.ts +7 -0
  250. package/dist/types/components/SequenceCheckoutProvider/SequenceCheckoutProvider.d.ts.map +1 -0
  251. package/dist/types/components/SequenceCheckoutProvider/index.d.ts +2 -0
  252. package/dist/types/components/SequenceCheckoutProvider/index.d.ts.map +1 -0
  253. package/dist/types/constants/abi.d.ts +46 -0
  254. package/dist/types/constants/abi.d.ts.map +1 -0
  255. package/dist/types/constants/index.d.ts +5 -0
  256. package/dist/types/constants/index.d.ts.map +1 -0
  257. package/dist/types/contexts/AddFundsModal.d.ts +22 -0
  258. package/dist/types/contexts/AddFundsModal.d.ts.map +1 -0
  259. package/dist/types/contexts/CheckoutModal.d.ts +56 -0
  260. package/dist/types/contexts/CheckoutModal.d.ts.map +1 -0
  261. package/dist/types/contexts/Navigation.d.ts +38 -0
  262. package/dist/types/contexts/Navigation.d.ts.map +1 -0
  263. package/dist/types/contexts/SelectPaymentModal.d.ts +43 -0
  264. package/dist/types/contexts/SelectPaymentModal.d.ts.map +1 -0
  265. package/dist/types/contexts/SwapModal.d.ts +25 -0
  266. package/dist/types/contexts/SwapModal.d.ts.map +1 -0
  267. package/dist/types/contexts/TransactionStatusModal.d.ts +25 -0
  268. package/dist/types/contexts/TransactionStatusModal.d.ts.map +1 -0
  269. package/dist/types/contexts/TransferFundsModal.d.ts +13 -0
  270. package/dist/types/contexts/TransferFundsModal.d.ts.map +1 -0
  271. package/dist/types/contexts/genericContext.d.ts +2 -0
  272. package/dist/types/contexts/genericContext.d.ts.map +1 -0
  273. package/dist/types/contexts/index.d.ts +8 -0
  274. package/dist/types/contexts/index.d.ts.map +1 -0
  275. package/dist/types/hooks/index.d.ts +14 -0
  276. package/dist/types/hooks/index.d.ts.map +1 -0
  277. package/dist/types/hooks/useAddFundsModal.d.ts +6 -0
  278. package/dist/types/hooks/useAddFundsModal.d.ts.map +1 -0
  279. package/dist/types/hooks/useCheckoutModal.d.ts +6 -0
  280. package/dist/types/hooks/useCheckoutModal.d.ts.map +1 -0
  281. package/dist/types/hooks/useCheckoutOptionsSalesContract.d.ts +6 -0
  282. package/dist/types/hooks/useCheckoutOptionsSalesContract.d.ts.map +1 -0
  283. package/dist/types/hooks/useCheckoutWhitelistStatus.d.ts +3 -0
  284. package/dist/types/hooks/useCheckoutWhitelistStatus.d.ts.map +1 -0
  285. package/dist/types/hooks/useERC1155SaleContractCheckout.d.ts +37 -0
  286. package/dist/types/hooks/useERC1155SaleContractCheckout.d.ts.map +1 -0
  287. package/dist/types/hooks/useMarketplaceClient.d.ts +9 -0
  288. package/dist/types/hooks/useMarketplaceClient.d.ts.map +1 -0
  289. package/dist/types/hooks/useModalTheme.d.ts +2 -0
  290. package/dist/types/hooks/useModalTheme.d.ts.map +1 -0
  291. package/dist/types/hooks/useNavigation.d.ts +11 -0
  292. package/dist/types/hooks/useNavigation.d.ts.map +1 -0
  293. package/dist/types/hooks/useSardineClientToken.d.ts +3 -0
  294. package/dist/types/hooks/useSardineClientToken.d.ts.map +1 -0
  295. package/dist/types/hooks/useSelectPaymentModal.d.ts +6 -0
  296. package/dist/types/hooks/useSelectPaymentModal.d.ts.map +1 -0
  297. package/dist/types/hooks/useSkipOnCloseCallback.d.ts +6 -0
  298. package/dist/types/hooks/useSkipOnCloseCallback.d.ts.map +1 -0
  299. package/dist/types/hooks/useSwapModal.d.ts +6 -0
  300. package/dist/types/hooks/useSwapModal.d.ts.map +1 -0
  301. package/dist/types/hooks/useTransactionStatusModal.d.ts +6 -0
  302. package/dist/types/hooks/useTransactionStatusModal.d.ts.map +1 -0
  303. package/dist/types/hooks/useTransferFundsModal.d.ts +6 -0
  304. package/dist/types/hooks/useTransferFundsModal.d.ts.map +1 -0
  305. package/dist/types/index.d.ts +14 -0
  306. package/dist/types/index.d.ts.map +1 -0
  307. package/dist/types/utils/index.d.ts +2 -0
  308. package/dist/types/utils/index.d.ts.map +1 -0
  309. package/dist/types/utils/sardine.d.ts +6 -0
  310. package/dist/types/utils/sardine.d.ts.map +1 -0
  311. package/dist/types/utils/sizing.d.ts +2 -0
  312. package/dist/types/utils/sizing.d.ts.map +1 -0
  313. package/dist/types/utils/transak.d.ts +7 -0
  314. package/dist/types/utils/transak.d.ts.map +1 -0
  315. package/dist/types/views/AddFunds.d.ts +2 -0
  316. package/dist/types/views/AddFunds.d.ts.map +1 -0
  317. package/dist/types/views/CheckoutSelection/component/OrderSummaryItem.d.ts +10 -0
  318. package/dist/types/views/CheckoutSelection/component/OrderSummaryItem.d.ts.map +1 -0
  319. package/dist/types/views/CheckoutSelection/index.d.ts +2 -0
  320. package/dist/types/views/CheckoutSelection/index.d.ts.map +1 -0
  321. package/dist/types/views/PaymentSelection/Footer.d.ts +2 -0
  322. package/dist/types/views/PaymentSelection/Footer.d.ts.map +1 -0
  323. package/dist/types/views/PaymentSelection/OrderSummary/Price.d.ts +2 -0
  324. package/dist/types/views/PaymentSelection/OrderSummary/Price.d.ts.map +1 -0
  325. package/dist/types/views/PaymentSelection/OrderSummary/index.d.ts +2 -0
  326. package/dist/types/views/PaymentSelection/OrderSummary/index.d.ts.map +1 -0
  327. package/dist/types/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.d.ts +11 -0
  328. package/dist/types/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.d.ts.map +1 -0
  329. package/dist/types/views/PaymentSelection/PayWithCreditCard/index.d.ts +9 -0
  330. package/dist/types/views/PaymentSelection/PayWithCreditCard/index.d.ts.map +1 -0
  331. package/dist/types/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.d.ts +2 -0
  332. package/dist/types/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.d.ts.map +1 -0
  333. package/dist/types/views/PaymentSelection/PayWithCrypto/index.d.ts +12 -0
  334. package/dist/types/views/PaymentSelection/PayWithCrypto/index.d.ts.map +1 -0
  335. package/dist/types/views/PaymentSelection/TransferFunds.d.ts +2 -0
  336. package/dist/types/views/PaymentSelection/TransferFunds.d.ts.map +1 -0
  337. package/dist/types/views/PaymentSelection/index.d.ts +4 -0
  338. package/dist/types/views/PaymentSelection/index.d.ts.map +1 -0
  339. package/dist/types/views/PendingCreditCardTransaction.d.ts +8 -0
  340. package/dist/types/views/PendingCreditCardTransaction.d.ts.map +1 -0
  341. package/dist/types/views/Swap/index.d.ts +2 -0
  342. package/dist/types/views/Swap/index.d.ts.map +1 -0
  343. package/dist/types/views/TransactionError.d.ts +3 -0
  344. package/dist/types/views/TransactionError.d.ts.map +1 -0
  345. package/dist/types/views/TransactionStatus/index.d.ts +9 -0
  346. package/dist/types/views/TransactionStatus/index.d.ts.map +1 -0
  347. package/dist/types/views/TransactionSuccess.d.ts +3 -0
  348. package/dist/types/views/TransactionSuccess.d.ts.map +1 -0
  349. package/dist/types/views/TransferToWallet/CopyButton.d.ts +10 -0
  350. package/dist/types/views/TransferToWallet/CopyButton.d.ts.map +1 -0
  351. package/dist/types/views/TransferToWallet/QRCode.d.ts +6 -0
  352. package/dist/types/views/TransferToWallet/QRCode.d.ts.map +1 -0
  353. package/dist/types/views/TransferToWallet/index.d.ts +2 -0
  354. package/dist/types/views/TransferToWallet/index.d.ts.map +1 -0
  355. package/dist/types/views/index.d.ts +10 -0
  356. package/dist/types/views/index.d.ts.map +1 -0
  357. package/package.json +73 -0
  358. package/src/api/data.ts +194 -0
  359. package/src/api/index.ts +1 -0
  360. package/src/components/CopyButton.tsx +32 -0
  361. package/src/components/DefaultIcon.tsx +22 -0
  362. package/src/components/NavigationHeader.tsx +57 -0
  363. package/src/components/SequenceCheckoutProvider/SequenceCheckoutProvider.tsx +363 -0
  364. package/src/components/SequenceCheckoutProvider/index.ts +1 -0
  365. package/src/constants/abi.ts +185 -0
  366. package/src/constants/index.ts +4 -0
  367. package/src/contexts/AddFundsModal.ts +25 -0
  368. package/src/contexts/CheckoutModal.ts +65 -0
  369. package/src/contexts/Navigation.ts +56 -0
  370. package/src/contexts/SelectPaymentModal.ts +50 -0
  371. package/src/contexts/SwapModal.ts +31 -0
  372. package/src/contexts/TransactionStatusModal.ts +29 -0
  373. package/src/contexts/TransferFundsModal.ts +16 -0
  374. package/src/contexts/genericContext.ts +19 -0
  375. package/src/contexts/index.ts +7 -0
  376. package/src/hooks/index.ts +13 -0
  377. package/src/hooks/useAddFundsModal.ts +7 -0
  378. package/src/hooks/useCheckoutModal.ts +7 -0
  379. package/src/hooks/useCheckoutOptionsSalesContract.ts +28 -0
  380. package/src/hooks/useCheckoutWhitelistStatus.ts +20 -0
  381. package/src/hooks/useERC1155SaleContractCheckout.ts +260 -0
  382. package/src/hooks/useMarketplaceClient.ts +49 -0
  383. package/src/hooks/useModalTheme.ts +7 -0
  384. package/src/hooks/useNavigation.ts +33 -0
  385. package/src/hooks/useSardineClientToken.ts +18 -0
  386. package/src/hooks/useSelectPaymentModal.ts +7 -0
  387. package/src/hooks/useSkipOnCloseCallback.ts +25 -0
  388. package/src/hooks/useSwapModal.ts +7 -0
  389. package/src/hooks/useTransactionStatusModal.ts +7 -0
  390. package/src/hooks/useTransferFundsModal.ts +7 -0
  391. package/src/index.ts +19 -0
  392. package/src/utils/index.ts +1 -0
  393. package/src/utils/sardine.ts +62 -0
  394. package/src/utils/sizing.ts +8 -0
  395. package/src/utils/transak.ts +72 -0
  396. package/src/views/AddFunds.tsx +59 -0
  397. package/src/views/CheckoutSelection/component/OrderSummaryItem.tsx +82 -0
  398. package/src/views/CheckoutSelection/index.tsx +207 -0
  399. package/src/views/PaymentSelection/Footer.tsx +39 -0
  400. package/src/views/PaymentSelection/OrderSummary/Price.tsx +66 -0
  401. package/src/views/PaymentSelection/OrderSummary/index.tsx +113 -0
  402. package/src/views/PaymentSelection/PayWithCreditCard/PaymentProviderOption.tsx +38 -0
  403. package/src/views/PaymentSelection/PayWithCreditCard/index.tsx +177 -0
  404. package/src/views/PaymentSelection/PayWithCreditCard/providers/SardineLogo.tsx +11 -0
  405. package/src/views/PaymentSelection/PayWithCrypto/index.tsx +250 -0
  406. package/src/views/PaymentSelection/TransferFunds.tsx +98 -0
  407. package/src/views/PaymentSelection/index.tsx +484 -0
  408. package/src/views/PendingCreditCardTransaction.tsx +429 -0
  409. package/src/views/Swap/index.tsx +289 -0
  410. package/src/views/TransactionError.tsx +39 -0
  411. package/src/views/TransactionStatus/index.tsx +337 -0
  412. package/src/views/TransactionSuccess.tsx +51 -0
  413. package/src/views/TransferToWallet/CopyButton.tsx +37 -0
  414. package/src/views/TransferToWallet/QRCode.tsx +25 -0
  415. package/src/views/TransferToWallet/index.tsx +36 -0
  416. package/src/views/index.ts +9 -0
package/LICENSE ADDED
@@ -0,0 +1,219 @@
1
+ Copyright (c) 2017-present Horizon Blockchain Games Inc.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+
16
+ ------------------------------------------------------------------------
17
+
18
+
19
+ Apache License
20
+ Version 2.0, January 2004
21
+ http://www.apache.org/licenses/
22
+
23
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
24
+
25
+ 1. Definitions.
26
+
27
+ "License" shall mean the terms and conditions for use, reproduction,
28
+ and distribution as defined by Sections 1 through 9 of this document.
29
+
30
+ "Licensor" shall mean the copyright owner or entity authorized by
31
+ the copyright owner that is granting the License.
32
+
33
+ "Legal Entity" shall mean the union of the acting entity and all
34
+ other entities that control, are controlled by, or are under common
35
+ control with that entity. For the purposes of this definition,
36
+ "control" means (i) the power, direct or indirect, to cause the
37
+ direction or management of such entity, whether by contract or
38
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
39
+ outstanding shares, or (iii) beneficial ownership of such entity.
40
+
41
+ "You" (or "Your") shall mean an individual or Legal Entity
42
+ exercising permissions granted by this License.
43
+
44
+ "Source" form shall mean the preferred form for making modifications,
45
+ including but not limited to software source code, documentation
46
+ source, and configuration files.
47
+
48
+ "Object" form shall mean any form resulting from mechanical
49
+ transformation or translation of a Source form, including but
50
+ not limited to compiled object code, generated documentation,
51
+ and conversions to other media types.
52
+
53
+ "Work" shall mean the work of authorship, whether in Source or
54
+ Object form, made available under the License, as indicated by a
55
+ copyright notice that is included in or attached to the work
56
+ (an example is provided in the Appendix below).
57
+
58
+ "Derivative Works" shall mean any work, whether in Source or Object
59
+ form, that is based on (or derived from) the Work and for which the
60
+ editorial revisions, annotations, elaborations, or other modifications
61
+ represent, as a whole, an original work of authorship. For the purposes
62
+ of this License, Derivative Works shall not include works that remain
63
+ separable from, or merely link (or bind by name) to the interfaces of,
64
+ the Work and Derivative Works thereof.
65
+
66
+ "Contribution" shall mean any work of authorship, including
67
+ the original version of the Work and any modifications or additions
68
+ to that Work or Derivative Works thereof, that is intentionally
69
+ submitted to Licensor for inclusion in the Work by the copyright owner
70
+ or by an individual or Legal Entity authorized to submit on behalf of
71
+ the copyright owner. For the purposes of this definition, "submitted"
72
+ means any form of electronic, verbal, or written communication sent
73
+ to the Licensor or its representatives, including but not limited to
74
+ communication on electronic mailing lists, source code control systems,
75
+ and issue tracking systems that are managed by, or on behalf of, the
76
+ Licensor for the purpose of discussing and improving the Work, but
77
+ excluding communication that is conspicuously marked or otherwise
78
+ designated in writing by the copyright owner as "Not a Contribution."
79
+
80
+ "Contributor" shall mean Licensor and any individual or Legal Entity
81
+ on behalf of whom a Contribution has been received by Licensor and
82
+ subsequently incorporated within the Work.
83
+
84
+ 2. Grant of Copyright License. Subject to the terms and conditions of
85
+ this License, each Contributor hereby grants to You a perpetual,
86
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
87
+ copyright license to reproduce, prepare Derivative Works of,
88
+ publicly display, publicly perform, sublicense, and distribute the
89
+ Work and such Derivative Works in Source or Object form.
90
+
91
+ 3. Grant of Patent License. Subject to the terms and conditions of
92
+ this License, each Contributor hereby grants to You a perpetual,
93
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
94
+ (except as stated in this section) patent license to make, have made,
95
+ use, offer to sell, sell, import, and otherwise transfer the Work,
96
+ where such license applies only to those patent claims licensable
97
+ by such Contributor that are necessarily infringed by their
98
+ Contribution(s) alone or by combination of their Contribution(s)
99
+ with the Work to which such Contribution(s) was submitted. If You
100
+ institute patent litigation against any entity (including a
101
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
102
+ or a Contribution incorporated within the Work constitutes direct
103
+ or contributory patent infringement, then any patent licenses
104
+ granted to You under this License for that Work shall terminate
105
+ as of the date such litigation is filed.
106
+
107
+ 4. Redistribution. You may reproduce and distribute copies of the
108
+ Work or Derivative Works thereof in any medium, with or without
109
+ modifications, and in Source or Object form, provided that You
110
+ meet the following conditions:
111
+
112
+ (a) You must give any other recipients of the Work or
113
+ Derivative Works a copy of this License; and
114
+
115
+ (b) You must cause any modified files to carry prominent notices
116
+ stating that You changed the files; and
117
+
118
+ (c) You must retain, in the Source form of any Derivative Works
119
+ that You distribute, all copyright, patent, trademark, and
120
+ attribution notices from the Source form of the Work,
121
+ excluding those notices that do not pertain to any part of
122
+ the Derivative Works; and
123
+
124
+ (d) If the Work includes a "NOTICE" text file as part of its
125
+ distribution, then any Derivative Works that You distribute must
126
+ include a readable copy of the attribution notices contained
127
+ within such NOTICE file, excluding those notices that do not
128
+ pertain to any part of the Derivative Works, in at least one
129
+ of the following places: within a NOTICE text file distributed
130
+ as part of the Derivative Works; within the Source form or
131
+ documentation, if provided along with the Derivative Works; or,
132
+ within a display generated by the Derivative Works, if and
133
+ wherever such third-party notices normally appear. The contents
134
+ of the NOTICE file are for informational purposes only and
135
+ do not modify the License. You may add Your own attribution
136
+ notices within Derivative Works that You distribute, alongside
137
+ or as an addendum to the NOTICE text from the Work, provided
138
+ that such additional attribution notices cannot be construed
139
+ as modifying the License.
140
+
141
+ You may add Your own copyright statement to Your modifications and
142
+ may provide additional or different license terms and conditions
143
+ for use, reproduction, or distribution of Your modifications, or
144
+ for any such Derivative Works as a whole, provided Your use,
145
+ reproduction, and distribution of the Work otherwise complies with
146
+ the conditions stated in this License.
147
+
148
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
149
+ any Contribution intentionally submitted for inclusion in the Work
150
+ by You to the Licensor shall be under the terms and conditions of
151
+ this License, without any additional terms or conditions.
152
+ Notwithstanding the above, nothing herein shall supersede or modify
153
+ the terms of any separate license agreement you may have executed
154
+ with Licensor regarding such Contributions.
155
+
156
+ 6. Trademarks. This License does not grant permission to use the trade
157
+ names, trademarks, service marks, or product names of the Licensor,
158
+ except as required for reasonable and customary use in describing the
159
+ origin of the Work and reproducing the content of the NOTICE file.
160
+
161
+ 7. Disclaimer of Warranty. Unless required by applicable law or
162
+ agreed to in writing, Licensor provides the Work (and each
163
+ Contributor provides its Contributions) on an "AS IS" BASIS,
164
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
165
+ implied, including, without limitation, any warranties or conditions
166
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
167
+ PARTICULAR PURPOSE. You are solely responsible for determining the
168
+ appropriateness of using or redistributing the Work and assume any
169
+ risks associated with Your exercise of permissions under this License.
170
+
171
+ 8. Limitation of Liability. In no event and under no legal theory,
172
+ whether in tort (including negligence), contract, or otherwise,
173
+ unless required by applicable law (such as deliberate and grossly
174
+ negligent acts) or agreed to in writing, shall any Contributor be
175
+ liable to You for damages, including any direct, indirect, special,
176
+ incidental, or consequential damages of any character arising as a
177
+ result of this License or out of the use or inability to use the
178
+ Work (including but not limited to damages for loss of goodwill,
179
+ work stoppage, computer failure or malfunction, or any and all
180
+ other commercial damages or losses), even if such Contributor
181
+ has been advised of the possibility of such damages.
182
+
183
+ 9. Accepting Warranty or Additional Liability. While redistributing
184
+ the Work or Derivative Works thereof, You may choose to offer,
185
+ and charge a fee for, acceptance of support, warranty, indemnity,
186
+ or other liability obligations and/or rights consistent with this
187
+ License. However, in accepting such obligations, You may act only
188
+ on Your own behalf and on Your sole responsibility, not on behalf
189
+ of any other Contributor, and only if You agree to indemnify,
190
+ defend, and hold each Contributor harmless for any liability
191
+ incurred by, or claims asserted against, such Contributor by reason
192
+ of your accepting any such warranty or additional liability.
193
+
194
+ END OF TERMS AND CONDITIONS
195
+
196
+ APPENDIX: How to apply the Apache License to your work.
197
+
198
+ To apply the Apache License to your work, attach the following
199
+ boilerplate notice, with the fields enclosed by brackets "[]"
200
+ replaced with your own identifying information. (Don't include
201
+ the brackets!) The text should be enclosed in the appropriate
202
+ comment syntax for the file format. We also recommend that a
203
+ file or class name and description of purpose be included on the
204
+ same "printed page" as the copyright notice for easier
205
+ identification within third-party archives.
206
+
207
+ Copyright [yyyy] [name of copyright owner]
208
+
209
+ Licensed under the Apache License, Version 2.0 (the "License");
210
+ you may not use this file except in compliance with the License.
211
+ You may obtain a copy of the License at
212
+
213
+ http://www.apache.org/licenses/LICENSE-2.0
214
+
215
+ Unless required by applicable law or agreed to in writing, software
216
+ distributed under the License is distributed on an "AS IS" BASIS,
217
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
218
+ See the License for the specific language governing permissions and
219
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,256 @@
1
+ # Sequence Web SDK Checkout
2
+
3
+ Sequence Checkout provides a seamless and flexible payment experience for interacting with NFTs, cryptocurrencies, and fiat currencies. It supports multiple payment options, including cryptocurrency transfers, currency swaps, and even credit card payments for whitelisted contracts.
4
+
5
+ ## Key Features
6
+
7
+ - **NFT Checkout**: Buy NFTs using either the main currency (e.g., ETH), a swapped currency, or a credit card.
8
+ - **Currency Swap**: Swap one token for another before completing the transaction.
9
+ - **Fiat Onramp**: Onboard users with fiat currency to interact with the blockchain.
10
+
11
+ # Installing the module
12
+
13
+ First install the package:
14
+
15
+ ```bash
16
+ npm install @0xsequence/checkout
17
+ # or
18
+ pnpm install @0xsequence/checkout
19
+ # or
20
+ yarn add @0xsequence/checkout
21
+ ```
22
+
23
+ Then the wallet provider module must placed below the Sequence Web SDK Core provider.
24
+
25
+ ```js
26
+ import { SequenceCheckoutProvider } from '@0xsequence/checkout'
27
+
28
+ const App = () => {
29
+ return (
30
+ <SequenceConnect config={config}>
31
+ <SequenceCheckoutProvider>
32
+ <Page />
33
+ </SequenceCheckoutProvider>
34
+ </SequenceConnect>
35
+ )
36
+ }
37
+ ```
38
+
39
+ # NFT Checkout (Sequence Pay)
40
+
41
+ <div align="center">
42
+ <img src="../../public/docs/checkout-modal.png">
43
+ </div>
44
+
45
+ Sequence Pay Checkout allows users to purchase NFTs using various payment methods. Users can pay with the main currency (e.g., ETH), swap tokens for payment, or use a credit card provided the smart contract is whitelisted (contact a member of the Sequence team to whitelist your contract for credit card payments).
46
+
47
+ ## Basic Usage
48
+
49
+ To enable this functionality in your app, use the `useSelectPaymentModal` hook from the `@0xsequence/checkout` package. The following code demonstrates how to set up the checkout modal and trigger it on a button click:
50
+
51
+ ```js
52
+ import { useSelectPaymentModal, type SelectPaymentSettings } from '@0xsequence/checkout'
53
+
54
+ const MyComponent = () => {
55
+ const { openSelectPaymentModal } = useSelectPaymentModal()
56
+
57
+ const onClick = () => {
58
+ const erc1155SalesContractAbi = [
59
+ {
60
+ type: 'function',
61
+ name: 'mint',
62
+ inputs: [
63
+ { name: 'to', type: 'address', internalType: 'address' },
64
+ { name: 'tokenIds', type: 'uint256[]', internalType: 'uint256[]' },
65
+ { name: 'amounts', type: 'uint256[]', internalType: 'uint256[]' },
66
+ { name: 'data', type: 'bytes', internalType: 'bytes' },
67
+ { name: 'expectedPaymentToken', type: 'address', internalType: 'address' },
68
+ { name: 'maxTotal', type: 'uint256', internalType: 'uint256' },
69
+ { name: 'proof', type: 'bytes32[]', internalType: 'bytes32[]' }
70
+ ],
71
+ outputs: [],
72
+ stateMutability: 'payable'
73
+ }
74
+ ]
75
+
76
+ const purchaseTransactionData = encodeFunctionData({
77
+ abi: erc1155SalesContractAbi,
78
+ functionName: 'mint',
79
+ args: [
80
+ recipientAddress,
81
+ collectibles.map(c => BigInt(c.tokenId)),
82
+ collectibles.map(c => BigInt(c.quantity)),
83
+ toHex(0),
84
+ currencyAddress,
85
+ price,
86
+ [toHex(0, { size: 32 })]
87
+ ]
88
+ })
89
+
90
+ const settings: SelectPaymentSettings = {
91
+ collectibles: [
92
+ {
93
+ tokenId: '1',
94
+ quantity: '1'
95
+ }
96
+ ],
97
+ chain: chainId,
98
+ price,
99
+ targetContractAddress: salesContractAddress,
100
+ recipientAddress: address,
101
+ currencyAddress,
102
+ collectionAddress,
103
+ creditCardProviders: ['sardine'],
104
+ copyrightText: 'ⓒ2024 Sequence',
105
+ onSuccess: (txnHash: string) => {
106
+ console.log('success!', txnHash)
107
+ },
108
+ onError: (error: Error) => {
109
+ console.error(error)
110
+ },
111
+ txData: purchaseTransactionData,
112
+ }
113
+
114
+ openSelectPaymentModal(settings)
115
+ }
116
+
117
+ return <button onClick={onClick}>Purchase collectible</button>
118
+ }
119
+ ```
120
+
121
+ ## Parameters
122
+
123
+ - **collectibles**: List of NFT collectibles, including their token IDs and quantities.
124
+ - **chain**: The blockchain network ID.
125
+ - **price**: Total price for the transaction in the selected currency. This value should not contain decimals.
126
+ - **currencyAddress**: The address of the currency used for executing the transaction on the target contract.
127
+ - **targetContractAddress**: The address of the smart contract handling the minting function.
128
+ creditCardProviders: Providers like sardine for credit card payments.
129
+ - **collectionAddress**: The contract address of the collectible such as an ERC-1155 or ERC-721
130
+ - **creditCardProviders**: The list of credit card providers to execute a payment with. It is up to the developer to make sure that the region, currency and network is compatible.
131
+ - **txData**: Encoded transaction data to interact with the mint function.
132
+ - **copyrightText**: The copyright text shown at the bottom of the modal.
133
+ - **onSuccess**: Callback function triggered once the transaction has been confirmed on the blockchain.
134
+ - **blockConfirmations**: The number of block confirmations required for the transaction to be considered successful and trigger `onSuccess`.
135
+ - **onError**: Callback function triggered if an error has occurred before or after sending the transaction.
136
+
137
+ ## Utility functions
138
+
139
+ The `@0xsequence/checkout` library indeed simplifies the integration of Web3 payment solutions by providing utility functions. One such function, `useERC1155SaleContractPaymentModal`, is tailored for use cases involving the minting of ERC-1155 tokens. This function works in conjunction with Sequence's wallet ecosystem and its deployable smart contract infrastructure, such as the ERC-1155 sale contract available through the [Sequence Builder](https://sequence.build).
140
+
141
+ ```js
142
+ import { useERC1155SaleContractCheckout } from "@0xsequence/checkout";
143
+ import { useAccount } from "wagmi";
144
+
145
+ const MyComponent = () => {
146
+ const { address: userAddress } = useAccount();
147
+ const { openCheckoutModal } = useERC1155SaleContractCheckout({
148
+ chain: 80001, // chainId of the chain the collectible is on
149
+ contractAddress: "0x0327b2f274e04d292e74a06809bcd687c63a4ba4", // address of the contract handling the minting function
150
+ wallet: userAddress!, // address of the recipient
151
+ collectionAddress: "0x888a322db4b8033bac3ff84412738c096f87f9d0", // address of the collection contract
152
+ items: [
153
+ // array of collectibles to purchase
154
+ {
155
+ tokenId: "0",
156
+ quantity: "1",
157
+ },
158
+ ],
159
+ onSuccess: (txnHash: string) => {
160
+ console.log("success!", txnHash);
161
+ },
162
+ onError: (error: Error) => {
163
+ console.error(error);
164
+ },
165
+ });
166
+
167
+ const onClick = () => {
168
+ if (!userAddress) {
169
+ return;
170
+ }
171
+ openCheckoutModal();
172
+ };
173
+
174
+ return <button onClick={onClick}>Buy ERC-1155 collectible!</button>;
175
+ };
176
+ ```
177
+
178
+ # Swap
179
+
180
+ <div align="center">
181
+ <img src="../../public/docs/swap-modal.png">
182
+ </div>
183
+
184
+ The **Swap Modal** allows users to swap one currency for another (e.g., ETH to USDC) before completing a transaction. This feature is useful when users need to convert their tokens into the correct currency for payment.
185
+
186
+ ## Basic Usage
187
+
188
+ Here’s an example of how to use the Swap Modal with the `useSwapModal` hook:
189
+
190
+ ```js
191
+ import { useSwapModal, type SwapModalSettings } from '@0xsequence/checkout'
192
+
193
+ const MyComponent = () => {
194
+ const { openSwapModal } = useSwapModal()
195
+
196
+ const onClick = () => {
197
+ const chainId = 137
198
+ const currencyAddress = '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359'
199
+ const currencyAmount = '20000'
200
+ const data = encodeFunctionData({ abi: parseAbi(['function demo()']), functionName: 'demo', args: []})
201
+
202
+ const swapModalSettings: SwapModalSettings = {
203
+ onSuccess: () => {
204
+ console.log('swap successful!')
205
+ },
206
+ chainId,
207
+ currencyAddress,
208
+ currencyAmount,
209
+ postSwapTransactions: [
210
+ {
211
+ to: '0x37470dac8a0255141745906c972e414b1409b470',
212
+ data
213
+ }
214
+ ],
215
+ title: 'Swap and Pay',
216
+ description: 'Select a token in your wallet to swap to 0.2 USDC.'
217
+ }
218
+
219
+ openSwapModal(swapModalSettings)
220
+ }
221
+
222
+ return <button onClick={onClick}>Swap and Pay</button>
223
+ }
224
+ ```
225
+
226
+ ## Key Parameters
227
+
228
+ - **currencyAddress**: The address of the token to swap from (e.g., USDC).
229
+ - **currencyAmount**: The amount to swap.
230
+ - **postSwapTransactions**: An optional array of transactions to be executed after the swap, using the swapped tokens.
231
+ - **title**: The modal’s title.
232
+ - **description**: A description of the swap and payment process.
233
+
234
+ # Fiat Onramp
235
+
236
+ <div align="center">
237
+ <img src="../../public/docs/fiat-onramp.png">
238
+ </div>
239
+
240
+ The Fiat Onramp feature allows users to convert traditional fiat currencies (e.g., USD) into cryptocurrencies. This feature makes it easier for non-crypto users to interact with decentralized applications (dApps) by onboarding them directly through fiat payments.
241
+
242
+ ```js
243
+ import { useAddFundsModal } from '@0xsequence/checkout'
244
+
245
+ const MyComponent = () => {
246
+ const { triggerAddFunds } = useAddFundsModal()
247
+
248
+ const onClick = () => {
249
+ triggerAddFunds({
250
+ walletAddress: recipientAddress
251
+ })
252
+ }
253
+
254
+ return <button onClick={onClick}>Add Funds</button>
255
+ }
256
+ ```
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchSupportedCountryCodes = exports.fetchSardineOrderStatus = exports.fetchSardineClientToken = void 0;
4
+ const connect_1 = require("@0xsequence/connect");
5
+ const network_1 = require("@0xsequence/network");
6
+ const fetchSardineClientToken = async ({ order, projectAccessKey, tokenMetadata }) => {
7
+ // Test credentials: https://docs.sardine.ai/docs/integrate-payments/nft-checkout-testing-credentials
8
+ const accessKey = connect_1.DEBUG ? '17xhjK4yjRf1fr0am8kgKfICAAAAAAAAA' : projectAccessKey;
9
+ const url = connect_1.DEBUG
10
+ ? 'https://dev-api.sequence.app/rpc/API/SardineGetNFTCheckoutToken'
11
+ : 'https://api.sequence.app/rpc/API/SardineGetNFTCheckoutToken';
12
+ const res = await fetch(url, {
13
+ method: 'POST',
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ 'X-Access-Key': `${accessKey || ''}`
17
+ },
18
+ body: JSON.stringify({
19
+ params: {
20
+ name: tokenMetadata?.name || 'Unknown',
21
+ imageUrl: tokenMetadata?.image || 'https://sequence.market/images/placeholder.png',
22
+ network: network_1.networks[order.chainId].name,
23
+ recipientAddress: order.recipientAddress,
24
+ contractAddress: order.contractAddress,
25
+ platform: 'calldata_execution',
26
+ blockchainNftId: order.nftId,
27
+ quantity: Number(order.nftQuantity),
28
+ decimals: Number(order?.nftDecimals || 0),
29
+ tokenAmount: order.currencyQuantity,
30
+ tokenAddress: order.currencyAddress,
31
+ tokenSymbol: order.currencySymbol,
32
+ tokenDecimals: Number(order.currencyDecimals),
33
+ callData: order.calldata,
34
+ ...(order?.approvedSpenderAddress ? { approvedSpenderAddress: order.approvedSpenderAddress } : {})
35
+ }
36
+ })
37
+ });
38
+ const { resp: { orderId, token } } = await res.json();
39
+ return {
40
+ token,
41
+ orderId
42
+ };
43
+ };
44
+ exports.fetchSardineClientToken = fetchSardineClientToken;
45
+ const fetchSardineOrderStatus = async (orderId, projectAccessKey) => {
46
+ // Test credentials: https://docs.sardine.ai/docs/integrate-payments/nft-checkout-testing-credentials
47
+ const accessKey = connect_1.DEBUG ? '17xhjK4yjRf1fr0am8kgKfICAAAAAAAAA' : projectAccessKey;
48
+ const url = connect_1.DEBUG
49
+ ? 'https://dev-api.sequence.app/rpc/API/SardineGetNFTCheckoutOrderStatus'
50
+ : 'https://api.sequence.app/rpc/API/SardineGetNFTCheckoutOrderStatus';
51
+ const response = await fetch(url, {
52
+ method: 'POST',
53
+ headers: {
54
+ 'Content-Type': 'application/json',
55
+ 'X-Access-Key': `${accessKey}`
56
+ },
57
+ body: JSON.stringify({
58
+ orderId
59
+ })
60
+ });
61
+ const json = await response.json();
62
+ console.log('json:', json);
63
+ return json;
64
+ };
65
+ exports.fetchSardineOrderStatus = fetchSardineOrderStatus;
66
+ const fetchSupportedCountryCodes = async () => {
67
+ // Can also be fetches from sardine api
68
+ const supportedCountries = [
69
+ 'AL',
70
+ 'AO',
71
+ 'AT',
72
+ 'BB',
73
+ 'BE',
74
+ 'BZ',
75
+ 'BJ',
76
+ 'BO',
77
+ 'BR',
78
+ 'BG',
79
+ 'KH',
80
+ 'KY',
81
+ 'CL',
82
+ 'CO',
83
+ 'KM',
84
+ 'CR',
85
+ 'HR',
86
+ 'CY',
87
+ 'CZ',
88
+ 'DK',
89
+ 'DM',
90
+ 'DO',
91
+ 'EC',
92
+ 'EG',
93
+ 'SV',
94
+ 'GQ',
95
+ 'EE',
96
+ 'FO',
97
+ 'FI',
98
+ 'FR',
99
+ 'GF',
100
+ 'DE',
101
+ 'GR',
102
+ 'GN',
103
+ 'GW',
104
+ 'GY',
105
+ 'HT',
106
+ 'HN',
107
+ 'HU',
108
+ 'IS',
109
+ 'ID',
110
+ 'IE',
111
+ 'IL',
112
+ 'IT',
113
+ 'JM',
114
+ 'JP',
115
+ 'KG',
116
+ 'LA',
117
+ 'LV',
118
+ 'LI',
119
+ 'LT',
120
+ 'LU',
121
+ 'MG',
122
+ 'MY',
123
+ 'MV',
124
+ 'MT',
125
+ 'MR',
126
+ 'MX',
127
+ 'MN',
128
+ 'MZ',
129
+ 'NL',
130
+ 'NO',
131
+ 'OM',
132
+ 'PA',
133
+ 'PY',
134
+ 'PE',
135
+ 'PH',
136
+ 'PL',
137
+ 'PT',
138
+ 'RO',
139
+ 'KN',
140
+ 'MF',
141
+ 'SA',
142
+ 'SC',
143
+ 'SG',
144
+ 'SK',
145
+ 'SI',
146
+ 'KR',
147
+ 'ES',
148
+ 'LK',
149
+ 'SE',
150
+ 'CH',
151
+ 'TZ',
152
+ 'TH',
153
+ 'TT',
154
+ 'TR',
155
+ 'AE',
156
+ 'GB',
157
+ 'UY',
158
+ 'UZ',
159
+ 'VU',
160
+ 'VN'
161
+ ];
162
+ return supportedCountries.map(countryCode => ({ code: countryCode }));
163
+ };
164
+ exports.fetchSupportedCountryCodes = fetchSupportedCountryCodes;
165
+ //# sourceMappingURL=data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.js","sourceRoot":"","sources":["../../../src/api/data.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./data"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB"}