@huma-finance/widgets 0.0.73-beta.924 → 0.0.73-beta.946

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 (281) hide show
  1. package/.env.example +3 -3
  2. package/{.eslintrc.js → .eslintrc.cjs} +1 -2
  3. package/.prettierrc.json +16 -0
  4. package/API.md +1 -1
  5. package/dist/index.js +220513 -11012
  6. package/dist/src/components/ApolloWrapper.d.ts +4 -0
  7. package/dist/src/components/ApproveAllowanceModal.d.ts +13 -0
  8. package/dist/src/components/ApproveAllowanceModalV2.d.ts +14 -0
  9. package/dist/src/components/BottomButton.d.ts +9 -0
  10. package/dist/src/components/ChainSupportProvider.d.ts +2 -0
  11. package/dist/src/components/ChooseAmountModal.d.ts +23 -0
  12. package/dist/src/components/ConfirmTransferModal.d.ts +19 -0
  13. package/dist/src/components/CreditLine/approve/1-ApproveAllowance.d.ts +9 -0
  14. package/dist/src/components/CreditLine/approve/2-Success.d.ts +8 -0
  15. package/dist/src/components/CreditLine/approve/index.d.ts +20 -0
  16. package/dist/src/components/CreditLine/autoPaybackV2/1-ApproveAllowance.d.ts +8 -0
  17. package/dist/src/components/CreditLine/autoPaybackV2/2-Success.d.ts +6 -0
  18. package/dist/src/components/CreditLine/autoPaybackV2/index.d.ts +15 -0
  19. package/dist/src/components/CreditLine/borrow/1-Evaluation.d.ts +8 -0
  20. package/dist/src/components/CreditLine/borrow/2-ChooseAmount.d.ts +8 -0
  21. package/dist/src/components/CreditLine/borrow/3-ApproveAllowance.d.ts +7 -0
  22. package/dist/src/components/CreditLine/borrow/4-Transfer.d.ts +7 -0
  23. package/dist/src/components/CreditLine/borrow/5-Success.d.ts +10 -0
  24. package/dist/src/components/CreditLine/borrow/6-Notifications.d.ts +6 -0
  25. package/dist/src/components/CreditLine/borrow/index.d.ts +19 -0
  26. package/dist/src/components/CreditLine/borrowV2/1-ChooseAmount.d.ts +9 -0
  27. package/dist/src/components/CreditLine/borrowV2/2-ApproveAllowance.d.ts +8 -0
  28. package/dist/src/components/CreditLine/borrowV2/3-Transfer.d.ts +7 -0
  29. package/dist/src/components/CreditLine/borrowV2/4-Success.d.ts +10 -0
  30. package/dist/src/components/CreditLine/borrowV2/5-Notifications.d.ts +6 -0
  31. package/dist/src/components/CreditLine/borrowV2/index.d.ts +15 -0
  32. package/dist/src/components/CreditLine/payment/1-ChooseAmount.d.ts +9 -0
  33. package/dist/src/components/CreditLine/payment/2-ApproveAllowance.d.ts +7 -0
  34. package/dist/src/components/CreditLine/payment/3-Transfer.d.ts +7 -0
  35. package/dist/src/components/CreditLine/payment/4-Success.d.ts +8 -0
  36. package/dist/src/components/CreditLine/payment/index.d.ts +17 -0
  37. package/dist/src/components/CreditLine/paymentV2/1-ChooseAmount.d.ts +11 -0
  38. package/dist/src/components/CreditLine/paymentV2/2-ApproveAllowance.d.ts +8 -0
  39. package/dist/src/components/CreditLine/paymentV2/3-Transfer.d.ts +8 -0
  40. package/dist/src/components/CreditLine/paymentV2/4-Success.d.ts +8 -0
  41. package/dist/src/components/CreditLine/paymentV2/index.d.ts +15 -0
  42. package/dist/src/components/CreditLine/solanaBorrow/1-ChooseAmount.d.ts +9 -0
  43. package/dist/src/components/CreditLine/solanaBorrow/2-Transfer.d.ts +7 -0
  44. package/dist/src/components/CreditLine/solanaBorrow/3-Done.d.ts +10 -0
  45. package/dist/src/components/CreditLine/solanaBorrow/index.d.ts +17 -0
  46. package/dist/src/components/CreditLine/solanaPayment/1-ChooseAmount.d.ts +9 -0
  47. package/dist/src/components/CreditLine/solanaPayment/2-Transfer.d.ts +7 -0
  48. package/dist/src/components/CreditLine/solanaPayment/3-Done.d.ts +8 -0
  49. package/dist/src/components/CreditLine/solanaPayment/index.d.ts +14 -0
  50. package/dist/src/components/CreditLine/supplyFLC/1-ApproveAllowance.d.ts +10 -0
  51. package/dist/src/components/CreditLine/supplyFLC/2-Transfer.d.ts +10 -0
  52. package/dist/src/components/CreditLine/supplyFLC/3-Success.d.ts +10 -0
  53. package/dist/src/components/CreditLine/supplyFLC/index.d.ts +15 -0
  54. package/dist/src/components/ErrorModal.d.ts +12 -0
  55. package/dist/src/components/HumaLoading.d.ts +7 -0
  56. package/dist/src/components/HumaSnackBar.d.ts +10 -0
  57. package/dist/src/components/InputAmountModal.d.ts +18 -0
  58. package/dist/src/components/InvoiceFactoring/borrow/1-Evaluation.d.ts +8 -0
  59. package/dist/src/components/InvoiceFactoring/borrow/2-ChooseAmount.d.ts +8 -0
  60. package/dist/src/components/InvoiceFactoring/borrow/3-ConfirmTransfer.d.ts +2 -0
  61. package/dist/src/components/InvoiceFactoring/borrow/4-ApproveNFT.d.ts +8 -0
  62. package/dist/src/components/InvoiceFactoring/borrow/5-Transfer.d.ts +8 -0
  63. package/dist/src/components/InvoiceFactoring/borrow/6-Success.d.ts +6 -0
  64. package/dist/src/components/InvoiceFactoring/borrow/index.d.ts +20 -0
  65. package/dist/src/components/InvoiceFactoring/payment/1-ChooseAmount.d.ts +8 -0
  66. package/dist/src/components/InvoiceFactoring/payment/2-ApproveAllowance.d.ts +7 -0
  67. package/dist/src/components/InvoiceFactoring/payment/3-Transfer.d.ts +7 -0
  68. package/dist/src/components/InvoiceFactoring/payment/4-Success.d.ts +8 -0
  69. package/dist/src/components/InvoiceFactoring/payment/index.d.ts +17 -0
  70. package/dist/src/components/Lend/addRedemptionV2/1-ChooseTranche.d.ts +8 -0
  71. package/dist/src/components/Lend/addRedemptionV2/2-ChooseAmount.d.ts +10 -0
  72. package/dist/src/components/Lend/addRedemptionV2/3-Transfer.d.ts +10 -0
  73. package/dist/src/components/Lend/addRedemptionV2/4-Done.d.ts +6 -0
  74. package/dist/src/components/Lend/addRedemptionV2/index.d.ts +23 -0
  75. package/dist/src/components/Lend/cancelRedemptionV2 /1-Transfer.d.ts +10 -0
  76. package/dist/src/components/Lend/cancelRedemptionV2 /2-Done.d.ts +10 -0
  77. package/dist/src/components/Lend/cancelRedemptionV2 /index.d.ts +22 -0
  78. package/dist/src/components/Lend/components/ApproveLenderBase.d.ts +14 -0
  79. package/dist/src/components/Lend/components/PersonaEvaluation.d.ts +17 -0
  80. package/dist/src/components/Lend/components/SecuritizeEvaluation.d.ts +8 -0
  81. package/dist/src/components/Lend/solanaAddRedemption/1-ChooseTranche.d.ts +8 -0
  82. package/dist/src/components/Lend/solanaAddRedemption/2-ChooseAmount.d.ts +11 -0
  83. package/dist/src/components/Lend/solanaAddRedemption/3-Transfer.d.ts +8 -0
  84. package/dist/src/components/Lend/solanaAddRedemption/4-Done.d.ts +8 -0
  85. package/dist/src/components/Lend/solanaAddRedemption/index.d.ts +19 -0
  86. package/dist/src/components/Lend/solanaCancelRedemption/1-ChooseTranche.d.ts +8 -0
  87. package/dist/src/components/Lend/solanaCancelRedemption/2-Transfer.d.ts +11 -0
  88. package/dist/src/components/Lend/solanaCancelRedemption/3-Done.d.ts +11 -0
  89. package/dist/src/components/Lend/solanaCancelRedemption/index.d.ts +16 -0
  90. package/dist/src/components/Lend/solanaEnableAutoRedemption/1-ApproveAllowance.d.ts +7 -0
  91. package/dist/src/components/Lend/solanaEnableAutoRedemption/2-Transfer.d.ts +9 -0
  92. package/dist/src/components/Lend/solanaEnableAutoRedemption/3-Success.d.ts +10 -0
  93. package/dist/src/components/Lend/solanaEnableAutoRedemption/index.d.ts +18 -0
  94. package/dist/src/components/Lend/solanaSupply/1-Evaluation.d.ts +12 -0
  95. package/dist/src/components/Lend/solanaSupply/2-ApproveLender.d.ts +10 -0
  96. package/dist/src/components/Lend/solanaSupply/3-ChooseTranche.d.ts +9 -0
  97. package/dist/src/components/Lend/solanaSupply/4-ChooseAmount.d.ts +13 -0
  98. package/dist/src/components/Lend/solanaSupply/5-ApproveAllowance.d.ts +7 -0
  99. package/dist/src/components/Lend/solanaSupply/6-Transfer.d.ts +11 -0
  100. package/dist/src/components/Lend/solanaSupply/7-Success.d.ts +12 -0
  101. package/dist/src/components/Lend/solanaSupply/8-PointsEarned.d.ts +11 -0
  102. package/dist/src/components/Lend/solanaSupply/index.d.ts +24 -0
  103. package/dist/src/components/Lend/solanaWithdraw/1-ConfirmTransfer.d.ts +9 -0
  104. package/dist/src/components/Lend/solanaWithdraw/2-Transfer.d.ts +9 -0
  105. package/dist/src/components/Lend/solanaWithdraw/3-Done.d.ts +10 -0
  106. package/dist/src/components/Lend/solanaWithdraw/index.d.ts +25 -0
  107. package/dist/src/components/Lend/stellarSupply/1-Evaluation.d.ts +4 -0
  108. package/dist/src/components/Lend/stellarSupply/2-ChooseTranche.d.ts +9 -0
  109. package/dist/src/components/Lend/stellarSupply/3-ChooseAmount.d.ts +12 -0
  110. package/dist/src/components/Lend/stellarSupply/4-Transfer.d.ts +8 -0
  111. package/dist/src/components/Lend/stellarSupply/5-Success.d.ts +10 -0
  112. package/dist/src/components/Lend/stellarSupply/index.d.ts +22 -0
  113. package/dist/src/components/Lend/supply/1-Evaluation/EvaluationEA.d.ts +8 -0
  114. package/dist/src/components/Lend/supply/1-Evaluation/EvaluationKYC.d.ts +8 -0
  115. package/dist/src/components/Lend/supply/1-Evaluation/index.d.ts +9 -0
  116. package/dist/src/components/Lend/supply/2-ChooseAmount.d.ts +11 -0
  117. package/dist/src/components/Lend/supply/3-ApproveAllowance.d.ts +7 -0
  118. package/dist/src/components/Lend/supply/4-Transfer.d.ts +7 -0
  119. package/dist/src/components/Lend/supply/5-Success.d.ts +9 -0
  120. package/dist/src/components/Lend/supply/6-Notifications.d.ts +6 -0
  121. package/dist/src/components/Lend/supply/index.d.ts +17 -0
  122. package/dist/src/components/Lend/supplyV2/1-ChooseTranche.d.ts +9 -0
  123. package/dist/src/components/Lend/supplyV2/2-Evaluation.d.ts +12 -0
  124. package/dist/src/components/Lend/supplyV2/3-ApproveLender.d.ts +10 -0
  125. package/dist/src/components/Lend/supplyV2/4-ChooseAmount.d.ts +14 -0
  126. package/dist/src/components/Lend/supplyV2/5-ApproveAllowance.d.ts +7 -0
  127. package/dist/src/components/Lend/supplyV2/6-Transfer.d.ts +11 -0
  128. package/dist/src/components/Lend/supplyV2/7-Success.d.ts +13 -0
  129. package/dist/src/components/Lend/supplyV2/8-Notifications.d.ts +8 -0
  130. package/dist/src/components/Lend/supplyV2/index.d.ts +23 -0
  131. package/dist/src/components/Lend/withdraw/1-CheckWithdrawble.d.ts +8 -0
  132. package/dist/src/components/Lend/withdraw/2-ChooseAmount.d.ts +10 -0
  133. package/dist/src/components/Lend/withdraw/3-Transfer.d.ts +7 -0
  134. package/dist/src/components/Lend/withdraw/4-Success.d.ts +8 -0
  135. package/dist/src/components/Lend/withdraw/index.d.ts +17 -0
  136. package/dist/src/components/Lend/withdrawV2/1-ConfirmTransfer.d.ts +11 -0
  137. package/dist/src/components/Lend/withdrawV2/2-Transfer.d.ts +9 -0
  138. package/dist/src/components/Lend/withdrawV2/3-Done.d.ts +10 -0
  139. package/dist/src/components/Lend/withdrawV2/index.d.ts +17 -0
  140. package/dist/src/components/LoadingModal.d.ts +9 -0
  141. package/dist/src/components/Notifi/NotifiContextWrapper.d.ts +7 -0
  142. package/dist/src/components/Notifi/NotifiSubscriptionModal.d.ts +7 -0
  143. package/dist/src/components/NumericFormatCustom.d.ts +14 -0
  144. package/dist/src/components/PointsEarned.d.ts +10 -0
  145. package/dist/src/components/ReceivableBackedCreditLine/borrow/1-ChooseAmount.d.ts +10 -0
  146. package/dist/src/components/ReceivableBackedCreditLine/borrow/2-ApproveAllowance.d.ts +8 -0
  147. package/dist/src/components/ReceivableBackedCreditLine/borrow/3-ApproveReceivable.d.ts +8 -0
  148. package/dist/src/components/ReceivableBackedCreditLine/borrow/4-Transfer.d.ts +8 -0
  149. package/dist/src/components/ReceivableBackedCreditLine/borrow/5-Success.d.ts +10 -0
  150. package/dist/src/components/ReceivableBackedCreditLine/borrow/6-Notifications.d.ts +6 -0
  151. package/dist/src/components/ReceivableBackedCreditLine/borrow/index.d.ts +17 -0
  152. package/dist/src/components/ReceivableBackedCreditLine/payment/1-ChoosePaymentType.d.ts +8 -0
  153. package/dist/src/components/ReceivableBackedCreditLine/payment/2-ChooseAmount.d.ts +12 -0
  154. package/dist/src/components/ReceivableBackedCreditLine/payment/3-ApproveAllowance.d.ts +10 -0
  155. package/dist/src/components/ReceivableBackedCreditLine/payment/4-CreateReceivable.d.ts +9 -0
  156. package/dist/src/components/ReceivableBackedCreditLine/payment/5-ApproveReceivable.d.ts +8 -0
  157. package/dist/src/components/ReceivableBackedCreditLine/payment/6-Transfer.d.ts +14 -0
  158. package/dist/src/components/ReceivableBackedCreditLine/payment/7-Success.d.ts +12 -0
  159. package/dist/src/components/ReceivableBackedCreditLine/payment/index.d.ts +21 -0
  160. package/dist/src/components/SignIn.d.ts +6 -0
  161. package/dist/src/components/SolanaErrorModal.d.ts +13 -0
  162. package/dist/src/components/SolanaTxDoneModal.d.ts +12 -0
  163. package/dist/src/components/SolanaTxSendModal.d.ts +12 -0
  164. package/dist/src/components/SolanaViewOnExplorer.d.ts +8 -0
  165. package/dist/src/components/StellarTxDoneModal.d.ts +12 -0
  166. package/dist/src/components/StellarTxSendModal.d.ts +8 -0
  167. package/dist/src/components/StellarViewOnExplorer.d.ts +8 -0
  168. package/dist/src/components/StreamFactoring/borrow/1-Evaluation.d.ts +9 -0
  169. package/dist/src/components/StreamFactoring/borrow/2-ChooseAmount.d.ts +8 -0
  170. package/dist/src/components/StreamFactoring/borrow/3-ConfirmTransfer.d.ts +2 -0
  171. package/dist/src/components/StreamFactoring/borrow/4-ApproveAllowance.d.ts +7 -0
  172. package/dist/src/components/StreamFactoring/borrow/5-Permit.d.ts +10 -0
  173. package/dist/src/components/StreamFactoring/borrow/6-Transfer.d.ts +7 -0
  174. package/dist/src/components/StreamFactoring/borrow/7-Success.d.ts +6 -0
  175. package/dist/src/components/StreamFactoring/borrow/index.d.ts +13 -0
  176. package/dist/src/components/StreamFactoring/payment/ChooseAmount.d.ts +8 -0
  177. package/dist/src/components/StreamFactoring/payment/Success.d.ts +8 -0
  178. package/dist/src/components/StreamFactoring/payment/Transfer.d.ts +7 -0
  179. package/dist/src/components/StreamFactoring/payment/index.d.ts +10 -0
  180. package/dist/src/components/SuperfluidFactoring/index.d.ts +12 -0
  181. package/dist/src/components/TxDoneModal.d.ts +9 -0
  182. package/dist/src/components/TxSendModal.d.ts +13 -0
  183. package/dist/src/components/TxSendModalV2.d.ts +13 -0
  184. package/dist/src/components/ViewOnExplorer.d.ts +6 -0
  185. package/dist/src/components/WidgetWrapper.d.ts +11 -0
  186. package/dist/src/components/WrapperModal.d.ts +8 -0
  187. package/dist/src/components/buttons/TableActionButton.d.ts +8 -0
  188. package/dist/src/components/buttons/index.d.ts +1 -0
  189. package/dist/src/components/humaModal/HumaModal.d.ts +13 -0
  190. package/dist/src/components/humaModal/HumaModalHeader.d.ts +12 -0
  191. package/dist/src/components/humaModal/index.d.ts +2 -0
  192. package/dist/src/components/icons/index.d.ts +23 -0
  193. package/dist/src/components/images/index.d.ts +3 -0
  194. package/dist/src/cosmos/CreditLineBorrow.fixture.d.ts +2 -0
  195. package/dist/src/cosmos/CreditLinePayment.fixture.d.ts +2 -0
  196. package/dist/src/cosmos/InvoiceFactoringBorrow.fixture.d.ts +2 -0
  197. package/dist/src/cosmos/InvoiceFactoringPayment.fixture.d.ts +2 -0
  198. package/dist/src/cosmos/LendSupply.fixture.d.ts +2 -0
  199. package/dist/src/cosmos/LendWithdraw.fixture.d.ts +2 -0
  200. package/dist/src/cosmos/SDKTesting.fixture.d.ts +2 -0
  201. package/dist/src/cosmos/SuperfluidFactoringBorrow.fixture.d.ts +2 -0
  202. package/dist/src/cosmos/WalletWrapper.d.ts +3 -0
  203. package/dist/src/cosmos/utils/index.d.ts +18 -0
  204. package/dist/src/hooks/useEA.d.ts +8 -0
  205. package/dist/src/hooks/useElementDimensions.d.ts +5 -0
  206. package/dist/src/hooks/useLogOnFirstMount.d.ts +3 -0
  207. package/dist/src/hooks/useNotifi.d.ts +10 -0
  208. package/dist/src/hooks/useRedux.d.ts +6 -0
  209. package/dist/src/index.d.ts +385 -0
  210. package/dist/src/reportWebVitals.d.ts +3 -0
  211. package/dist/src/setupTests.d.ts +0 -0
  212. package/dist/src/store/index.d.ts +10 -0
  213. package/dist/src/store/widgets.reducers.d.ts +58 -0
  214. package/dist/src/store/widgets.selectors.d.ts +4 -0
  215. package/dist/src/store/widgets.store.d.ts +61 -0
  216. package/dist/src/theme/breakpoints.d.ts +5 -0
  217. package/dist/src/theme/components.d.ts +2 -0
  218. package/dist/src/theme/coreThemeConstants.d.ts +18 -0
  219. package/dist/src/theme/cssMixins.d.ts +20 -0
  220. package/dist/src/theme/hooks/useGetSizes.d.ts +12 -0
  221. package/dist/src/theme/index.d.ts +2 -0
  222. package/dist/src/theme/palette.d.ts +53 -0
  223. package/dist/src/theme/shape.d.ts +2 -0
  224. package/dist/src/theme/theme.types.d.ts +71 -0
  225. package/dist/src/theme/typography.d.ts +2 -0
  226. package/dist/vite.config.d.ts +2 -0
  227. package/package.json +21 -34
  228. package/src/components/Lend/components/ApproveLenderBase.tsx +6 -3
  229. package/src/components/Lend/components/PersonaEvaluation.tsx +5 -2
  230. package/src/components/Lend/components/SecuritizeEvaluation.tsx +5 -2
  231. package/src/components/Lend/solanaSupply/1-Evaluation.tsx +3 -0
  232. package/src/components/Lend/solanaSupply/2-ApproveLender.tsx +3 -0
  233. package/src/components/Lend/solanaSupply/3-ChooseTranche.tsx +2 -0
  234. package/src/components/Lend/solanaSupply/4-ChooseAmount.tsx +2 -0
  235. package/src/components/Lend/solanaSupply/5-ApproveAllowance.tsx +2 -0
  236. package/src/components/Lend/solanaSupply/6-Transfer.tsx +3 -1
  237. package/src/components/Lend/solanaSupply/7-Success.tsx +2 -0
  238. package/src/components/Lend/solanaSupply/8-PointsEarned.tsx +8 -2
  239. package/src/components/Lend/solanaSupply/index.tsx +47 -8
  240. package/src/components/Lend/solanaWithdraw/1-ConfirmTransfer.tsx +2 -0
  241. package/src/components/Lend/solanaWithdraw/2-Transfer.tsx +2 -0
  242. package/src/components/Lend/solanaWithdraw/3-Done.tsx +2 -0
  243. package/src/components/Lend/solanaWithdraw/index.tsx +32 -7
  244. package/src/components/Lend/supply/1-Evaluation/EvaluationKYC.tsx +5 -2
  245. package/src/components/Lend/supplyV2/2-Evaluation.tsx +2 -2
  246. package/src/components/Lend/supplyV2/3-ApproveLender.tsx +1 -1
  247. package/src/components/Lend/supplyV2/6-Transfer.tsx +1 -2
  248. package/src/components/Lend/supplyV2/index.tsx +1 -1
  249. package/src/components/Notifi/NotifiContextWrapper.tsx +3 -3
  250. package/src/components/SolanaTxSendModal.tsx +23 -1
  251. package/src/components/icons/index.tsx +21 -21
  252. package/src/cosmos/InvoiceFactoringBorrow.fixture.tsx +1 -1
  253. package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +2 -4
  254. package/src/cosmos/utils/index.ts +4 -2
  255. package/src/hooks/useEA.ts +1 -2
  256. package/src/hooks/useLogOnFirstMount.ts +19 -0
  257. package/src/hooks/useNotifi.ts +1 -1
  258. package/src/index.tsx +4 -7
  259. package/src/store/widgets.reducers.ts +6 -0
  260. package/src/store/widgets.selectors.ts +20 -0
  261. package/src/store/widgets.store.ts +2 -0
  262. package/tsconfig.json +20 -17
  263. package/vite-env.d.ts +2 -0
  264. package/vite.config.ts +48 -0
  265. package/webpack.cosmos.js +1 -1
  266. package/.prettierrc.js +0 -16
  267. package/babel.config.js +0 -15
  268. package/config-overrides.js +0 -9
  269. package/dist/cjs/index.cjs +0 -11781
  270. package/dist/cjs/index.cjs.map +0 -1
  271. package/dist/index.d.ts +0 -758
  272. package/dist/index.js.map +0 -1
  273. package/public/favicon.ico +0 -0
  274. package/public/index.html +0 -40
  275. package/public/logo192.png +0 -0
  276. package/public/logo512.png +0 -0
  277. package/public/manifest.json +0 -25
  278. package/public/robots.txt +0 -3
  279. package/rollup.config.js +0 -81
  280. package/src/cosmos/utils/env.ts +0 -6
  281. package/src/react-app-env.d.ts +0 -1
@@ -4,15 +4,23 @@ import {
4
4
  SolanaTokenUtils,
5
5
  TrancheType,
6
6
  } from '@huma-finance/shared'
7
- import { LenderStateAccount, SolanaPoolState } from '@huma-finance/web-shared'
7
+ import {
8
+ LenderStateAccount,
9
+ LoggingContext,
10
+ LoggingContextHelper,
11
+ SolanaPoolState,
12
+ } from '@huma-finance/web-shared'
8
13
  import React, { useCallback, useEffect, useState } from 'react'
9
14
  import { useDispatch } from 'react-redux'
10
15
 
11
16
  import { BN } from '@coral-xyz/anchor'
12
17
  import { Mint } from '@solana/spl-token'
13
18
  import { useAppSelector } from '../../../hooks/useRedux'
14
- import { setStep } from '../../../store/widgets.reducers'
15
- import { selectWidgetState } from '../../../store/widgets.selectors'
19
+ import { setLoggingContext, setStep } from '../../../store/widgets.reducers'
20
+ import {
21
+ selectWidgetLoggingContext,
22
+ selectWidgetState,
23
+ } from '../../../store/widgets.selectors'
16
24
  import { WIDGET_STEP } from '../../../store/widgets.store'
17
25
  import { ErrorModal } from '../../ErrorModal'
18
26
  import { WidgetWrapper } from '../../WidgetWrapper'
@@ -64,6 +72,12 @@ export function SolanaLendWithdraw({
64
72
  2,
65
73
  )
66
74
  const [withdrawnAmount, setWithdrawnAmount] = useState<BN>()
75
+ const loggingHelper = useAppSelector(selectWidgetLoggingContext)
76
+
77
+ const handleCloseFlow = () => {
78
+ loggingHelper.logAction('ExitFlow', {})
79
+ handleClose()
80
+ }
67
81
 
68
82
  // After withdrawn success, the handleSuccess will refresh
69
83
  // the lenderStateAccount which will update the withdrawableAmount to 0
@@ -76,9 +90,20 @@ export function SolanaLendWithdraw({
76
90
 
77
91
  useEffect(() => {
78
92
  if (!step) {
93
+ // Set initial logging context
94
+ const context: LoggingContext = {
95
+ flow: 'Withdraw',
96
+ chainId: poolInfo.chainId,
97
+ poolName: poolInfo.poolName,
98
+ poolType: poolInfo.poolType,
99
+ }
100
+ const loggingHelperInit = new LoggingContextHelper(context)
101
+ loggingHelperInit.logAction('StartFlow', {})
102
+ dispatch(setLoggingContext(context))
103
+
79
104
  dispatch(setStep(WIDGET_STEP.ConfirmTransfer))
80
105
  }
81
- }, [dispatch, step])
106
+ }, [dispatch, poolInfo.chainId, poolInfo.poolName, poolInfo.poolType, step])
82
107
 
83
108
  useEffect(() => {
84
109
  const trancheAssets =
@@ -111,7 +136,7 @@ export function SolanaLendWithdraw({
111
136
  <WidgetWrapper
112
137
  isOpen
113
138
  loadingTitle={title}
114
- handleClose={handleClose}
139
+ handleClose={handleCloseFlow}
115
140
  handleSuccess={handleWithdrawSuccess}
116
141
  >
117
142
  {step === WIDGET_STEP.ConfirmTransfer && (
@@ -132,7 +157,7 @@ export function SolanaLendWithdraw({
132
157
  <Done
133
158
  poolUnderlyingToken={poolInfo.underlyingMint}
134
159
  withdrawAmount={withdrawnAmount}
135
- handleAction={handleClose}
160
+ handleAction={handleCloseFlow}
136
161
  />
137
162
  )}
138
163
  {step === WIDGET_STEP.Error && (
@@ -140,7 +165,7 @@ export function SolanaLendWithdraw({
140
165
  title={title}
141
166
  errorReason='Sorry there was an error'
142
167
  errorMessage={errorMessage}
143
- handleOk={handleClose}
168
+ handleOk={handleCloseFlow}
144
169
  />
145
170
  )}
146
171
  </WidgetWrapper>
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  CHAINS,
3
- checkIsDev,
4
3
  configUtil,
5
4
  DocSignatureStatus,
6
5
  IdentityService,
@@ -8,7 +7,11 @@ import {
8
7
  timeUtil,
9
8
  VerificationStatusResult,
10
9
  } from '@huma-finance/shared'
11
- import { useAuthErrorHandling, useParamsSearch } from '@huma-finance/web-shared'
10
+ import {
11
+ useAuthErrorHandling,
12
+ useParamsSearch,
13
+ checkIsDev,
14
+ } from '@huma-finance/web-shared'
12
15
  import { Box, css, useTheme } from '@mui/material'
13
16
  import { useWeb3React } from '@web3-react/core'
14
17
  import React, { useCallback, useEffect, useMemo, useState } from 'react'
@@ -14,7 +14,7 @@ type Props = {
14
14
  poolInfo: PoolInfoV2
15
15
  networkType: NETWORK_TYPE
16
16
  campaign?: Campaign
17
- documentHash: string
17
+ documentHash?: string
18
18
  handleClose: (options?: CloseModalOptions) => void
19
19
  }
20
20
 
@@ -30,7 +30,7 @@ export function Evaluation({
30
30
  <SecuritizeEvaluation poolInfo={poolInfo} handleClose={handleClose} />
31
31
  )
32
32
  }
33
- if (poolInfo.KYC?.Persona) {
33
+ if (poolInfo.KYC?.Persona && documentHash) {
34
34
  return (
35
35
  <PersonaEvaluation
36
36
  poolInfo={poolInfo}
@@ -11,7 +11,7 @@ import { ApproveLenderBase } from '../components/ApproveLenderBase'
11
11
  type Props = {
12
12
  poolInfo: PoolInfoV2
13
13
  isUniTranche: boolean
14
- documentHash: string
14
+ documentHash?: string
15
15
  changeTranche: (tranche: TrancheType) => void
16
16
  }
17
17
 
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  CampaignService,
3
- checkIsDev,
4
3
  NETWORK_TYPE,
5
4
  PoolInfoV2,
6
5
  TrancheType,
7
6
  } from '@huma-finance/shared'
8
- import { useTrancheVaultContractV2 } from '@huma-finance/web-shared'
7
+ import { useTrancheVaultContractV2, checkIsDev } from '@huma-finance/web-shared'
9
8
  import { useWeb3React } from '@web3-react/core'
10
9
  import { ethers } from 'ethers'
11
10
  import React, { useCallback } from 'react'
@@ -47,7 +47,7 @@ export interface Campaign {
47
47
  export interface LendSupplyPropsV2 {
48
48
  poolName: keyof typeof POOL_NAME
49
49
  campaign?: Campaign
50
- documentHash: string
50
+ documentHash?: string
51
51
  handleClose: (options?: CloseModalOptions) => void
52
52
  handleSuccess?: (blockNumber?: number) => void
53
53
  }
@@ -29,14 +29,14 @@ export function NotifiContextWrapper({
29
29
 
30
30
  let cardId = ''
31
31
  if (chainId === ChainEnum.Celo || chainId === ChainEnum.Alfajores) {
32
- cardId = process.env.REACT_APP_NOTIFI_CONFIG_ID_CELO ?? ''
32
+ cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_CELO ?? ''
33
33
  } else if (chainId === ChainEnum.Polygon || chainId === ChainEnum.Amoy) {
34
- cardId = process.env.REACT_APP_NOTIFI_CONFIG_ID_POLYGON ?? ''
34
+ cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_POLYGON ?? ''
35
35
  } else if (
36
36
  chainId === ChainEnum.Scroll ||
37
37
  chainId === ChainEnum.ScrollSepolia
38
38
  ) {
39
- cardId = process.env.REACT_APP_NOTIFI_CONFIG_ID_SCROLL ?? ''
39
+ cardId = import.meta.env.VITE_NOTIFI_CONFIG_ID_SCROLL ?? ''
40
40
  }
41
41
 
42
42
  if (!cardId) {
@@ -9,11 +9,12 @@ import { useConnection, useWallet } from '@solana/wallet-adapter-react'
9
9
  import { Transaction } from '@solana/web3.js'
10
10
  import { useForceRefresh } from '@huma-finance/web-shared'
11
11
  import { Box, Button, css, Typography, useTheme } from '@mui/material'
12
- import { useAppDispatch } from '../hooks/useRedux'
12
+ import { useAppDispatch, useAppSelector } from '../hooks/useRedux'
13
13
  import { setError, setSolanaSignature } from '../store/widgets.reducers'
14
14
  import { LoadingModal } from './LoadingModal'
15
15
  import { SolanaViewOnExplorer } from './SolanaViewOnExplorer'
16
16
  import { SorryImg } from './images'
17
+ import { selectWidgetLoggingContext } from '../store/widgets.selectors'
17
18
 
18
19
  type Props = {
19
20
  chainId: SolanaChainEnum
@@ -33,6 +34,7 @@ export function SolanaTxSendModal({
33
34
  const [signature, setSignature] = useState<string>('')
34
35
  const [showRetryScreen, setShowRetryScreen] = useState<boolean>(false)
35
36
  const [useHighPriority, setUseHighPriority] = useState<boolean>(true)
37
+ const loggingHelper = useAppSelector(selectWidgetLoggingContext)
36
38
  const [refreshCount, refresh] = useForceRefresh()
37
39
 
38
40
  const styles = {
@@ -98,7 +100,14 @@ export function SolanaTxSendModal({
98
100
  useHighPriority ? 'High' : undefined,
99
101
  process.env.REACT_APP_HELIUS_API_KEY,
100
102
  )
103
+ loggingHelper.logAction('SigningTransaction', {
104
+ priceData: optimizedTx.instructions[0].data,
105
+ unitsData: optimizedTx.instructions[1].data,
106
+ recentBlockhash: optimizedTx.recentBlockhash,
107
+ lastValidBlockHeight: optimizedTx.lastValidBlockHeight,
108
+ })
101
109
  const signedTx = await signTransaction(optimizedTx)
110
+ loggingHelper.logAction('SendingTransaction', {})
102
111
  const signatureResult = await connection.sendRawTransaction(
103
112
  signedTx.serialize(),
104
113
  {
@@ -123,6 +132,9 @@ export function SolanaTxSendModal({
123
132
  result?.value?.confirmationStatus === 'confirmed'
124
133
  ) {
125
134
  if (result?.value?.err) {
135
+ loggingHelper.logAction('TransactionError', {
136
+ signature: signatureResult,
137
+ })
126
138
  dispatch(
127
139
  setError({
128
140
  errorMessage:
@@ -131,6 +143,10 @@ export function SolanaTxSendModal({
131
143
  )
132
144
  return
133
145
  }
146
+
147
+ loggingHelper.logAction('TransactionSuccess', {
148
+ signature: signatureResult,
149
+ })
134
150
  handleSuccess({ signature: signatureResult })
135
151
  return
136
152
  }
@@ -144,6 +160,9 @@ export function SolanaTxSendModal({
144
160
  optimizedTx.lastValidBlockHeight! >
145
161
  100
146
162
  ) {
163
+ loggingHelper.logAction('ShowRetryScreenDueToExpiration', {
164
+ signature: signatureResult,
165
+ })
147
166
  setShowRetryScreen(true)
148
167
  return
149
168
  }
@@ -155,6 +174,8 @@ export function SolanaTxSendModal({
155
174
  console.log(error)
156
175
 
157
176
  const err = error as Error
177
+ loggingHelper.logAction('UnknownError', { error: err?.message })
178
+ loggingHelper.logError(err)
158
179
  dispatch(setError({ errorMessage: err?.message || '' }))
159
180
  }
160
181
  }
@@ -170,6 +191,7 @@ export function SolanaTxSendModal({
170
191
  tx,
171
192
  refreshCount,
172
193
  useHighPriority,
194
+ loggingHelper,
173
195
  ])
174
196
 
175
197
  const handleRetry = useCallback(
@@ -1,25 +1,25 @@
1
1
  import { SvgIconProps } from '@mui/material'
2
- import { ReactComponent as HumaLogoSvg } from './huma.svg'
3
- import { ReactComponent as HumaFullLogoSvg } from './huma-full.svg'
4
- import { ReactComponent as MetamaskSvg } from './metamask.svg'
5
- import { ReactComponent as WalletConnectSvg } from './wallet-connect.svg'
6
- import { ReactComponent as EthereumSvg } from './ethereum.svg'
7
- import { ReactComponent as PolygonSvg } from './polygon.svg'
8
- import { ReactComponent as ReceiptSvg } from './receipt.svg'
9
- import { ReactComponent as SeparatorSvg } from './separator.svg'
10
- import { ReactComponent as LoaderSvg } from './loader.svg'
11
- import { ReactComponent as SorrySvg } from './sorry.svg'
12
- import { ReactComponent as CheckSvg } from './check.svg'
13
- import { ReactComponent as CheckGreenSvg } from './check-green.svg'
14
- import { ReactComponent as CheckCircleSvg } from './check-circle.svg'
15
- import { ReactComponent as AutoPaybackSvg } from './auto-payback.svg'
16
- import { ReactComponent as ApproveLenderSvg } from './approve-lender.svg'
17
- import { ReactComponent as DonutSvg } from './donut.svg'
18
- import { ReactComponent as UsdcSvg } from './usdc.svg'
19
- import { ReactComponent as CeloSvg } from './celo.svg'
20
- import { ReactComponent as CongratulationsSvg } from './congratulations.svg'
21
- import { ReactComponent as RibbonSvg } from './ribbon.svg'
22
- import { ReactComponent as HumaPointsSvg } from './huma-points.svg'
2
+ import HumaLogoSvg from './huma.svg?react'
3
+ import HumaFullLogoSvg from './huma-full.svg?react'
4
+ import MetamaskSvg from './metamask.svg?react'
5
+ import WalletConnectSvg from './wallet-connect.svg?react'
6
+ import EthereumSvg from './ethereum.svg?react'
7
+ import PolygonSvg from './polygon.svg?react'
8
+ import ReceiptSvg from './receipt.svg?react'
9
+ import SeparatorSvg from './separator.svg?react'
10
+ import LoaderSvg from './loader.svg?react'
11
+ import SorrySvg from './sorry.svg?react'
12
+ import CheckSvg from './check.svg?react'
13
+ import CheckGreenSvg from './check-green.svg?react'
14
+ import CheckCircleSvg from './check-circle.svg?react'
15
+ import AutoPaybackSvg from './auto-payback.svg?react'
16
+ import ApproveLenderSvg from './approve-lender.svg?react'
17
+ import DonutSvg from './donut.svg?react'
18
+ import UsdcSvg from './usdc.svg?react'
19
+ import CeloSvg from './celo.svg?react'
20
+ import CongratulationsSvg from './congratulations.svg?react'
21
+ import RibbonSvg from './ribbon.svg?react'
22
+ import HumaPointsSvg from './huma-points.svg?react'
23
23
 
24
24
  export function HumaIcon(props: SvgIconProps): React.ReactElement {
25
25
  return <HumaLogoSvg {...props} />
@@ -64,7 +64,7 @@ function Fixture() {
64
64
  type='link'
65
65
  variant='contained'
66
66
  href={
67
- process.env.REACT_APP_CREATE_INVOICE_URL ??
67
+ import.meta.env.VITE_CREATE_INVOICE_URL ??
68
68
  'https://huma-request-apps-create.netlify.app/'
69
69
  }
70
70
  target='_blank'
@@ -1,11 +1,9 @@
1
+ import { JsonRpcProvider } from '@ethersproject/providers'
1
2
  import { SuperfluidFactoringWidget } from '..'
2
- import { initEnv } from './utils/env'
3
3
  import { WalletWrapper } from './WalletWrapper'
4
4
 
5
- initEnv()
6
-
7
5
  function Fixture() {
8
- return <SuperfluidFactoringWidget />
6
+ return <SuperfluidFactoringWidget provider={new JsonRpcProvider()} />
9
7
  }
10
8
 
11
9
  export default (
@@ -138,11 +138,13 @@ export const getProvider = (chainId = ChainEnum.Goerli) => {
138
138
  const rpcUrlMap: { [x: number]: { name: string; url: string } } = {
139
139
  [ChainEnum.Goerli]: {
140
140
  name: 'Goerli',
141
- url: `https://goerli.infura.io/v3/${process.env.REACT_APP_INFURA_API_KEY}`,
141
+ url: `https://goerli.infura.io/v3/${import.meta.env.VITE_INFURA_API_KEY}`,
142
142
  },
143
143
  [ChainEnum.Mumbai]: {
144
144
  name: 'Mumbai',
145
- url: `https://polygon-mumbai.g.alchemy.com/v2/${process.env.REACT_APP_ALCHEMY_API_KEY}`,
145
+ url: `https://polygon-mumbai.g.alchemy.com/v2/${
146
+ import.meta.env.VITE_ALCHEMY_API_KEY
147
+ }`,
146
148
  },
147
149
  }
148
150
  return new JsonRpcProvider(rpcUrlMap[chainId].url, {
@@ -1,12 +1,11 @@
1
1
  import {
2
- checkIsDev,
3
2
  EAPayload,
4
3
  EARejectionError,
5
4
  EARejectMessage,
6
5
  EARejectReason,
7
6
  EAService,
8
7
  } from '@huma-finance/shared'
9
- import { useAuthErrorHandling } from '@huma-finance/web-shared'
8
+ import { useAuthErrorHandling, checkIsDev } from '@huma-finance/web-shared'
10
9
  import { useWeb3React } from '@web3-react/core'
11
10
  import { useCallback } from 'react'
12
11
 
@@ -0,0 +1,19 @@
1
+ import { useEffect, useRef } from 'react'
2
+ import { LoggingActions } from '@huma-finance/web-shared'
3
+ import { selectWidgetLoggingContext } from '../store/widgets.selectors'
4
+ import { useAppSelector } from './useRedux'
5
+
6
+ const useLogOnFirstMount = (action: LoggingActions, data: object = {}) => {
7
+ const loggingHelper = useAppSelector(selectWidgetLoggingContext)
8
+ const hasLogged = useRef(false)
9
+
10
+ useEffect(() => {
11
+ // Only log the action once
12
+ if (!hasLogged.current) {
13
+ loggingHelper.logAction(action, data)
14
+ hasLogged.current = true
15
+ }
16
+ }, [action, data, loggingHelper])
17
+ }
18
+
19
+ export default useLogOnFirstMount
@@ -1,6 +1,5 @@
1
1
  import { useEffect, useState } from 'react'
2
2
  import {
3
- checkIsDev,
4
3
  doesChainSupportNotifi,
5
4
  getBlockchainConfigFromChain,
6
5
  } from '@huma-finance/shared'
@@ -13,6 +12,7 @@ import {
13
12
  useNotifiFrontendClientContext,
14
13
  useNotifiUserSettingContext,
15
14
  } from '@notifi-network/notifi-react'
15
+ import { checkIsDev } from '@huma-finance/web-shared'
16
16
 
17
17
  export const useDoesChainSupportNotifi = (chainId: number | undefined) => {
18
18
  const [notifiChainSupported, setNotifiChainSupported] = useState(false)
package/src/index.tsx CHANGED
@@ -1,6 +1,5 @@
1
1
  import { JsonRpcProvider } from '@ethersproject/providers'
2
2
  import { ThemeProvider } from '@mui/material'
3
- import { Provider as Eip1193Provider } from '@web3-react/types'
4
3
  import { Provider as AtomProvider } from 'jotai'
5
4
  import { useEffect, useState } from 'react'
6
5
  import { Provider as ReduxProvider } from 'react-redux'
@@ -117,13 +116,13 @@ type JsonRpcConnectionMap = {
117
116
  * @typedef {Object} WidgetProps
118
117
  * @property {desiredChainId|undefined} desiredChainId Optional desired chain id, will trigger the switch network action if different from the current chain id
119
118
  * @property {JsonRpcConnectionMap|undefined} jsonRpcUrlMap Optional mapping of your JSON-RPC connections indexed by chainId
120
- * @property {Eip1193Provider|JsonRpcProvider} provider EIP-1193 provider or JsonRpc Provider
119
+ * @property {JsonRpcProvider} provider EIP-1193 provider or JsonRpc Provider
121
120
  */
122
121
  type WidgetProps = {
123
122
  handleClose?: () => void
124
123
  desiredChainId?: number
125
124
  jsonRpcUrlMap?: JsonRpcConnectionMap
126
- provider: Eip1193Provider | JsonRpcProvider
125
+ provider: JsonRpcProvider
127
126
  }
128
127
 
129
128
  function Widget(props: WCProps<WidgetProps>) {
@@ -132,10 +131,8 @@ function Widget(props: WCProps<WidgetProps>) {
132
131
 
133
132
  useEffect(() => {
134
133
  const getChainId = async () => {
135
- if (provider instanceof JsonRpcProvider) {
136
- const network = await provider.getNetwork()
137
- setChainId(network?.chainId)
138
- }
134
+ const network = await provider.getNetwork()
135
+ setChainId(network?.chainId)
139
136
  }
140
137
  getChainId()
141
138
  }, [provider])
@@ -1,5 +1,6 @@
1
1
  import { Approval } from '@huma-finance/shared'
2
2
  import { createSlice, PayloadAction } from '@reduxjs/toolkit'
3
+ import { LoggingContext } from '@huma-finance/web-shared'
3
4
 
4
5
  import {
5
6
  initialWidgetState,
@@ -34,6 +35,7 @@ export const widgetSlice = createSlice({
34
35
  state.redeemShares = undefined
35
36
  state.solanaSignature = undefined
36
37
  state.txHash = undefined
38
+ state.loggingContext = undefined
37
39
  },
38
40
  setStep: (state, { payload }: PayloadAction<WIDGET_STEP>) => {
39
41
  state.step = payload
@@ -116,6 +118,9 @@ export const widgetSlice = createSlice({
116
118
  ) => {
117
119
  state.pointsAccumulated = payload
118
120
  },
121
+ setLoggingContext: (state, { payload }: PayloadAction<LoggingContext>) => {
122
+ state.loggingContext = payload
123
+ },
119
124
  setError: (
120
125
  state,
121
126
  {
@@ -147,6 +152,7 @@ export const {
147
152
  setSolanaSignature,
148
153
  setTxHash,
149
154
  setPointsAccumulated,
155
+ setLoggingContext,
150
156
  } = widgetSlice.actions
151
157
 
152
158
  export default widgetSlice.reducer
@@ -1,3 +1,23 @@
1
+ import { LoggingContextHelper } from '@huma-finance/web-shared'
1
2
  import { RootState } from '.'
2
3
 
3
4
  export const selectWidgetState = (state: RootState) => state.widget
5
+
6
+ let cachedContext: LoggingContextHelper | null = null
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ let cachedLoggingContext: any = null
9
+
10
+ export const selectWidgetLoggingContext = (
11
+ state: RootState,
12
+ ): LoggingContextHelper => {
13
+ if (state.widget.loggingContext === cachedLoggingContext) {
14
+ return cachedContext!
15
+ }
16
+
17
+ cachedLoggingContext = state.widget.loggingContext
18
+ cachedContext = state.widget.loggingContext
19
+ ? new LoggingContextHelper(state.widget.loggingContext)
20
+ : new LoggingContextHelper()
21
+
22
+ return cachedContext
23
+ }
@@ -1,4 +1,5 @@
1
1
  import { Approval } from '@huma-finance/shared'
2
+ import { LoggingContext } from '@huma-finance/web-shared'
2
3
 
3
4
  export enum WIDGET_TYPE {
4
5
  BORROW = 'BORROW',
@@ -62,6 +63,7 @@ export type WidgetState = {
62
63
  solanaSignature?: string
63
64
  pointsAccumulated?: number
64
65
  txHash?: string
66
+ loggingContext?: LoggingContext
65
67
  }
66
68
 
67
69
  export const initialWidgetState: WidgetState = {}
package/tsconfig.json CHANGED
@@ -1,35 +1,38 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es5",
4
- "lib": ["dom", "dom.iterable", "esnext"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "esModuleInterop": true,
8
3
  "allowSyntheticDefaultImports": true,
9
- "strict": true,
4
+ "composite": true,
5
+ "declaration": true,
6
+ "declarationDir": "dts",
7
+ "emitDeclarationOnly": true,
8
+ "esModuleInterop": true,
10
9
  "forceConsistentCasingInFileNames": true,
11
- "noFallthroughCasesInSwitch": true,
10
+ "isolatedModules": true,
11
+ "jsx": "react-jsx",
12
+ "jsxImportSource": "@emotion/react",
13
+ "lib": ["dom", "dom.iterable", "esnext"],
12
14
  "module": "esnext",
13
15
  "moduleResolution": "node",
16
+ "noFallthroughCasesInSwitch": true,
14
17
  "resolveJsonModule": true,
15
- "isolatedModules": true,
16
- "jsxImportSource": "@emotion/react",
17
- "jsx": "react-jsx",
18
- "declaration": true,
19
- "declarationDir": "dts",
20
- "emitDeclarationOnly": true,
21
- "composite": true
18
+ "skipLibCheck": true,
19
+ "strict": true,
20
+ "target": "ES2020",
21
+ "paths": {
22
+ "@huma-finance/web-shared": ["../huma-web-shared/src"],
23
+ "@huma-finance/shared": ["../huma-shared/src"]
24
+ }
22
25
  },
23
- "include": ["src/**/*", "src/**/*.json"],
26
+ "include": ["src/**/*", "src/**/*.json", "./*.ts", "./*.d.ts"],
24
27
  "references": [
25
28
  {
26
29
  "path": "../huma-shared"
27
30
  },
28
31
  {
29
- "path": "../huma-web-shared"
32
+ "path": "../huma-sdk"
30
33
  },
31
34
  {
32
- "path": "../huma-sdk"
35
+ "path": "../huma-web-shared"
33
36
  }
34
37
  ]
35
38
  }
package/vite-env.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /// <reference types="vite/client" />
2
+ /// <reference types="vite-plugin-svgr/client" />
package/vite.config.ts ADDED
@@ -0,0 +1,48 @@
1
+ import path from 'path'
2
+ import { defineConfig } from 'vite'
3
+ import svgr from 'vite-plugin-svgr'
4
+ import { nodePolyfills } from 'vite-plugin-node-polyfills'
5
+ import dts from 'vite-plugin-dts'
6
+
7
+ export default defineConfig({
8
+ build: {
9
+ lib: {
10
+ entry: path.resolve(__dirname, 'src/index.tsx'),
11
+ fileName: 'index',
12
+ formats: ['es'],
13
+ name: 'widget',
14
+ },
15
+ rollupOptions: {
16
+ external: [
17
+ 'react',
18
+ '@solana/wallet-adapter-react',
19
+ '@solana/wallet-adapter-base',
20
+ '@huma-finance/web-shared',
21
+ ], // Mark dependencies as external
22
+ output: {
23
+ globals: {
24
+ react: 'React',
25
+ },
26
+ },
27
+ },
28
+ },
29
+ plugins: [svgr(), nodePolyfills(), dts()],
30
+ // These aliases are required; otherwise contexts aren't shared properly
31
+ // between the monorepo packages: https://github.com/vitejs/vite/discussions/13410
32
+ resolve: {
33
+ alias: {
34
+ '@solana/wallet-adapter-react': path.resolve(
35
+ __dirname,
36
+ '../../../../node_modules/@solana/wallet-adapter-react',
37
+ ),
38
+ '@solana/wallet-adapter-base': path.resolve(
39
+ __dirname,
40
+ '../../../../node_modules/@solana/wallet-adapter-base',
41
+ ),
42
+ '@huma-finance/web-shared': path.resolve(
43
+ __dirname,
44
+ '../huma-web-shared/src',
45
+ ),
46
+ },
47
+ },
48
+ })
package/webpack.cosmos.js CHANGED
@@ -41,7 +41,7 @@ module.exports = (webpackConfig) => {
41
41
  ...Object.entries(dotenv.config().parsed).reduce(
42
42
  (acc, curr) => ({
43
43
  ...acc,
44
- [`process.env.${curr[0]}`]: JSON.stringify(curr[1]),
44
+ [`import.meta.env.${curr[0]}`]: JSON.stringify(curr[1]),
45
45
  }),
46
46
  {},
47
47
  ),
package/.prettierrc.js DELETED
@@ -1,16 +0,0 @@
1
- module.exports = {
2
- semi: false,
3
- tabWidth: 2,
4
- singleQuote: true,
5
- trailingComma: 'all',
6
- jsxSingleQuote: true,
7
- bracketSpacing: true,
8
- overrides: [
9
- {
10
- "files": "*.json",
11
- "options": {
12
- "printWidth": 80
13
- }
14
- }
15
- ],
16
- }