@huma-finance/widgets 0.0.29 → 0.0.30

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -30,8 +30,8 @@
30
30
  "@ethersproject/experimental": "^5.7.0",
31
31
  "@ethersproject/providers": "^5.6.0",
32
32
  "@ethersproject/units": "^5.6.0",
33
- "@huma-finance/sdk": "^0.0.29",
34
- "@huma-finance/shared": "^0.0.29",
33
+ "@huma-finance/sdk": "^0.0.30",
34
+ "@huma-finance/shared": "^0.0.30",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -191,5 +191,5 @@
191
191
  "optionalDependencies": {
192
192
  "encoding": "^0.1.13"
193
193
  },
194
- "gitHead": "5d4e05a6e7a187f3eec272cb62b5e17f37d30dd1"
194
+ "gitHead": "90e96b82dd363680ab6db853dd12ecc213932923"
195
195
  }
@@ -1,85 +1,85 @@
1
- import { Box } from '@mui/material'
2
- import { useWeb3React } from '@web3-react/core'
3
- import {
4
- CreditEvent,
5
- POOL_NAME,
6
- POOL_TYPE,
7
- PoolContractMap,
8
- PoolMap,
9
- useFactoring,
10
- } from '@huma-finance/shared'
11
- import React from 'react'
12
-
13
- import { Activity } from '../Activity'
14
- import { ApolloWrapper } from '../ApolloWrapper'
15
- import { StreamFactoringBorrow } from '../StreamFactoring/borrow'
16
- import { SuperfluidFactoredList } from './SuperfluidFactoredList'
17
- import { StreamItem, SuperfluidUpcomingList } from './SuperfluidUpcomingList'
18
-
19
- export function SuperfluidFactoring(): React.ReactElement {
20
- const poolName = POOL_NAME.Superfluid
21
- const { chainId } = useWeb3React()
22
- const {
23
- accountStats,
24
- accountHasActiveLoan,
25
- actionType,
26
- loading,
27
- poolInfo,
28
- modalIsOpen,
29
- selectedItem,
30
- styles,
31
- handleGetPaid,
32
- handleGetPaidSuccess,
33
- handlePayManually,
34
- handleClose,
35
- } = useFactoring<StreamItem>(poolName, POOL_TYPE.Stream)
36
-
37
- return (
38
- <Box css={styles.wrapper}>
39
- <Box css={styles.title}>Stream Factoring</Box>
40
- <Box css={styles.description} marginBottom='47px'>
41
- {PoolMap.Stream[poolName]?.borrowDesc}
42
- </Box>
43
- {poolInfo && (
44
- <SuperfluidFactoredList
45
- poolInfo={poolInfo}
46
- handlePayManually={handlePayManually}
47
- loading={loading && actionType === 'payment'}
48
- accountStats={accountStats}
49
- />
50
- )}
51
- <ApolloWrapper uri={poolInfo?.extra?.subgraph!}>
52
- <SuperfluidUpcomingList
53
- poolInfo={poolInfo}
54
- handleGetPaid={handleGetPaid}
55
- hasActiveLoan={accountHasActiveLoan}
56
- loading={loading && actionType === 'borrow'}
57
- />
58
- </ApolloWrapper>
59
- <ApolloWrapper uri={PoolContractMap[chainId!]?.subgraph}>
60
- {poolInfo && (
61
- <Activity
62
- poolInfo={poolInfo}
63
- targetEvents={[
64
- CreditEvent.DrawdownMadeWithReceivable,
65
- CreditEvent.PaymentMade,
66
- CreditEvent.ReceivedPaymentProcessed,
67
- ]}
68
- />
69
- )}
70
- </ApolloWrapper>
71
- {poolInfo && selectedItem && actionType === 'borrow' && (
72
- <StreamFactoringBorrow
73
- poolName={POOL_NAME.Superfluid}
74
- poolType={POOL_TYPE.Stream}
75
- payerAddress={selectedItem.payer}
76
- superToken={selectedItem.tokenId}
77
- currentFlowRate={selectedItem.flowrate}
78
- isOpen={modalIsOpen}
79
- handleClose={handleClose}
80
- handleSuccess={handleGetPaidSuccess}
81
- />
82
- )}
83
- </Box>
84
- )
85
- }
1
+ import { Box } from '@mui/material'
2
+ import { useWeb3React } from '@web3-react/core'
3
+ import {
4
+ CreditEvent,
5
+ POOL_NAME,
6
+ POOL_TYPE,
7
+ PoolMap,
8
+ PoolSubgraphMap,
9
+ useFactoring,
10
+ } from '@huma-finance/shared'
11
+ import React from 'react'
12
+
13
+ import { Activity } from '../Activity'
14
+ import { ApolloWrapper } from '../ApolloWrapper'
15
+ import { StreamFactoringBorrow } from '../StreamFactoring/borrow'
16
+ import { SuperfluidFactoredList } from './SuperfluidFactoredList'
17
+ import { StreamItem, SuperfluidUpcomingList } from './SuperfluidUpcomingList'
18
+
19
+ export function SuperfluidFactoring(): React.ReactElement {
20
+ const poolName = POOL_NAME.Superfluid
21
+ const { chainId } = useWeb3React()
22
+ const {
23
+ accountStats,
24
+ accountHasActiveLoan,
25
+ actionType,
26
+ loading,
27
+ poolInfo,
28
+ modalIsOpen,
29
+ selectedItem,
30
+ styles,
31
+ handleGetPaid,
32
+ handleGetPaidSuccess,
33
+ handlePayManually,
34
+ handleClose,
35
+ } = useFactoring<StreamItem>(poolName, POOL_TYPE.Stream)
36
+
37
+ return (
38
+ <Box css={styles.wrapper}>
39
+ <Box css={styles.title}>Stream Factoring</Box>
40
+ <Box css={styles.description} marginBottom='47px'>
41
+ {PoolMap.Stream[poolName]?.borrowDesc}
42
+ </Box>
43
+ {poolInfo && (
44
+ <SuperfluidFactoredList
45
+ poolInfo={poolInfo}
46
+ handlePayManually={handlePayManually}
47
+ loading={loading && actionType === 'payment'}
48
+ accountStats={accountStats}
49
+ />
50
+ )}
51
+ <ApolloWrapper uri={PoolSubgraphMap[chainId!]?.subgraph!}>
52
+ <SuperfluidUpcomingList
53
+ poolInfo={poolInfo}
54
+ handleGetPaid={handleGetPaid}
55
+ hasActiveLoan={accountHasActiveLoan}
56
+ loading={loading && actionType === 'borrow'}
57
+ />
58
+ </ApolloWrapper>
59
+ <ApolloWrapper uri={PoolSubgraphMap[chainId!]?.subgraph}>
60
+ {poolInfo && (
61
+ <Activity
62
+ poolInfo={poolInfo}
63
+ targetEvents={[
64
+ CreditEvent.DrawdownMadeWithReceivable,
65
+ CreditEvent.PaymentMade,
66
+ CreditEvent.ReceivedPaymentProcessed,
67
+ ]}
68
+ />
69
+ )}
70
+ </ApolloWrapper>
71
+ {poolInfo && selectedItem && actionType === 'borrow' && (
72
+ <StreamFactoringBorrow
73
+ poolName={POOL_NAME.Superfluid}
74
+ poolType={POOL_TYPE.Stream}
75
+ payerAddress={selectedItem.payer}
76
+ superToken={selectedItem.tokenId}
77
+ currentFlowRate={selectedItem.flowrate}
78
+ isOpen={modalIsOpen}
79
+ handleClose={handleClose}
80
+ handleSuccess={handleGetPaidSuccess}
81
+ />
82
+ )}
83
+ </Box>
84
+ )
85
+ }