@huma-finance/widgets 0.0.12 → 0.0.15

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 (47) hide show
  1. package/API.md +6 -5
  2. package/dist/cjs/index.cjs +5058 -5968
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/index.d.ts +9 -6
  5. package/dist/index.js +5059 -5969
  6. package/dist/index.js.map +1 -1
  7. package/package.json +16 -16
  8. package/src/components/ApproveAllowanceModal.tsx +5 -2
  9. package/src/components/ChainNotSupportedModal.tsx +33 -0
  10. package/src/components/ChooseAmountModal.tsx +322 -322
  11. package/src/components/ConfirmTransferModal.tsx +153 -0
  12. package/src/components/CreditLine/borrow/1-Evaluation.tsx +1 -2
  13. package/src/components/CreditLine/borrow/index.tsx +4 -6
  14. package/src/components/Factoring/FactoredList.tsx +1 -1
  15. package/src/components/InvoiceFactoring/borrow/1-Evaluation.tsx +1 -4
  16. package/src/components/InvoiceFactoring/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +5 -3
  17. package/src/components/InvoiceFactoring/borrow/3-ConfirmTransfer.tsx +37 -0
  18. package/src/components/InvoiceFactoring/borrow/index.tsx +5 -7
  19. package/src/components/StreamFactoring/borrow/1-Evaluation.tsx +12 -4
  20. package/src/components/StreamFactoring/borrow/2-ChooseAmount.tsx +4 -1
  21. package/src/components/StreamFactoring/borrow/3-ConfirmTransfer.tsx +18 -80
  22. package/src/components/StreamFactoring/borrow/4-ApproveAllowance.tsx +4 -36
  23. package/src/components/StreamFactoring/borrow/5-Permit.tsx +14 -14
  24. package/src/components/SuperfluidFactoring/SuperfluidFactoredList.tsx +10 -1
  25. package/src/components/SuperfluidFactoring/SuperfluidUpcomingList.tsx +4 -22
  26. package/src/cosmos/CreditLineBorrow.fixture.tsx +1 -0
  27. package/src/cosmos/CreditLinePayment.fixture.tsx +1 -0
  28. package/src/cosmos/SDKTesting.fixture.tsx +615 -615
  29. package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +3 -0
  30. package/src/cosmos/utils/env.ts +6 -0
  31. package/src/hooks/useEA.ts +10 -29
  32. package/src/index.tsx +88 -7
  33. package/src/reportWebVitals.ts +9 -9
  34. package/src/store/widgets.store.ts +0 -1
  35. package/src/utilTypes.d.ts +2 -0
  36. package/webpack.cosmos.js +9 -9
  37. package/src/components/AllowListModal.tsx +0 -113
  38. package/src/components/CreditLine/borrow/2-AllowList.tsx +0 -34
  39. package/src/components/InvoiceFactoring/borrow/2-AllowList.tsx +0 -34
  40. package/src/components/InvoiceFactoring/borrow/4-ConfirmTransfer.tsx +0 -104
  41. /package/src/components/CreditLine/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +0 -0
  42. /package/src/components/CreditLine/borrow/{4-Transfer.tsx → 3-Transfer.tsx} +0 -0
  43. /package/src/components/CreditLine/borrow/{5-ApproveAllowance.tsx → 4-ApproveAllowance.tsx} +0 -0
  44. /package/src/components/CreditLine/borrow/{6-Success.tsx → 5-Success.tsx} +0 -0
  45. /package/src/components/InvoiceFactoring/borrow/{5-ApproveNFT.tsx → 4-ApproveNFT.tsx} +0 -0
  46. /package/src/components/InvoiceFactoring/borrow/{6-Transfer.tsx → 5-Transfer.tsx} +0 -0
  47. /package/src/components/InvoiceFactoring/borrow/{7-Success.tsx → 6-Success.tsx} +0 -0
@@ -1,16 +1,14 @@
1
1
  import { gql, useQuery } from '@apollo/client'
2
2
  import { EmotionJSX } from '@emotion/react/types/jsx-namespace'
3
- import { Button } from '@mui/material'
4
- import { useWeb3React } from '@web3-react/core'
5
- import { History } from 'history'
6
3
  import {
7
4
  downScale,
8
5
  getWalletAddressAbbr,
9
6
  PoolInfoType,
10
7
  toBigNumber,
11
8
  } from '@huma-finance/shared'
9
+ import { Button } from '@mui/material'
10
+ import { useWeb3React } from '@web3-react/core'
12
11
  import React, { useCallback, useEffect, useState } from 'react'
13
- import { useHistory } from 'react-router'
14
12
 
15
13
  import { ColumnType } from '../../utilTypes'
16
14
  import { TableActionButton } from '../buttons'
@@ -71,7 +69,6 @@ type Props = {
71
69
  const getUpcomingColumns = (
72
70
  userHasActiveLoan: boolean,
73
71
  handleGetPaid: (id: StreamItem) => void,
74
- history: History,
75
72
  ): ColumnType<StreamItem>[] => [
76
73
  {
77
74
  title: '',
@@ -86,20 +83,6 @@ const getUpcomingColumns = (
86
83
  dataIndex: 'payerAbbr',
87
84
  },
88
85
  { title: 'Flow rate', dataIndex: 'flowrateMonth' },
89
- {
90
- title: 'Payer Approve',
91
- action: (record) => (
92
- <TableActionButton
93
- title='Go To Approve'
94
- handleClick={() =>
95
- history.push(
96
- `/superfluid?payer=${record.payer}&superToken=${record.tokenId}`,
97
- )
98
- }
99
- disabled={userHasActiveLoan}
100
- />
101
- ),
102
- },
103
86
  {
104
87
  title: 'Get Paid',
105
88
  action: (record) => (
@@ -118,7 +101,6 @@ export function SuperfluidUpcomingList({
118
101
  loading,
119
102
  handleGetPaid,
120
103
  }: Props): React.ReactElement {
121
- const history = useHistory()
122
104
  const { account, isActive } = useWeb3React()
123
105
  const [streams, setStreams] = useState<StreamItem[] | undefined>()
124
106
  const { data } = useQuery<{ streams: Stream[] }>(GET_RECEIVED_STREAMS, {
@@ -139,7 +121,7 @@ export function SuperfluidUpcomingList({
139
121
  if (Number(Number(flowrateMonth).toFixed(0)) > 0) {
140
122
  return {
141
123
  id: item.id,
142
- icon: <ReceiptIcon css={{ width: '18px' }} />,
124
+ icon: <ReceiptIcon css={{ width: '24px' }} />,
143
125
  token: item.token.symbol,
144
126
  tokenId: item.token.id,
145
127
  payer: item.sender.id,
@@ -161,7 +143,7 @@ export function SuperfluidUpcomingList({
161
143
  <UpcomingList<StreamItem>
162
144
  items={streams}
163
145
  loading={loading}
164
- columns={getUpcomingColumns(hasActiveLoan, handleGetPaid, history)}
146
+ columns={getUpcomingColumns(hasActiveLoan, handleGetPaid)}
165
147
  title='Ongoing Streams'
166
148
  connectWalletDesc='Please connect wallet to check your ongoing streams.'
167
149
  noItemDesc='You don’t have any ongoing streams eligible for factoring. For now, you can click the button
@@ -58,6 +58,7 @@ function Fixture() {
58
58
  poolType='CreditLine'
59
59
  handleClose={handleClose}
60
60
  handleApprove={handleApprove}
61
+ desiredChainId={5}
61
62
  />
62
63
  )}
63
64
  <Box marginTop={5}>Account: {testAccountRandom}</Box>
@@ -36,6 +36,7 @@ function Fixture() {
36
36
  poolName='HumaCreditLine'
37
37
  poolType='CreditLine'
38
38
  handleClose={handleClose}
39
+ desiredChainId={5}
39
40
  />
40
41
  )}
41
42
  </>