@huma-finance/widgets 0.0.11 → 0.0.13

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 (46) hide show
  1. package/API.md +6 -5
  2. package/dist/cjs/index.cjs +5058 -5959
  3. package/dist/cjs/index.cjs.map +1 -1
  4. package/dist/index.d.ts +9 -6
  5. package/dist/index.js +5059 -5960
  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 +31 -0
  10. package/src/components/ChooseAmountModal.tsx +322 -315
  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/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +2 -8
  14. package/src/components/CreditLine/borrow/{5-Transfer.tsx → 3-Transfer.tsx} +17 -3
  15. package/src/components/CreditLine/borrow/4-ApproveAllowance.tsx +1 -1
  16. package/src/components/CreditLine/borrow/index.tsx +3 -5
  17. package/src/components/Factoring/FactoredList.tsx +1 -1
  18. package/src/components/InvoiceFactoring/borrow/1-Evaluation.tsx +1 -4
  19. package/src/components/InvoiceFactoring/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +5 -3
  20. package/src/components/InvoiceFactoring/borrow/3-ConfirmTransfer.tsx +37 -0
  21. package/src/components/InvoiceFactoring/borrow/index.tsx +5 -7
  22. package/src/components/StreamFactoring/borrow/1-Evaluation.tsx +11 -3
  23. package/src/components/StreamFactoring/borrow/2-ChooseAmount.tsx +4 -1
  24. package/src/components/StreamFactoring/borrow/3-ConfirmTransfer.tsx +18 -80
  25. package/src/components/StreamFactoring/borrow/4-ApproveAllowance.tsx +4 -36
  26. package/src/components/StreamFactoring/borrow/5-Permit.tsx +14 -14
  27. package/src/components/SuperfluidFactoring/SuperfluidUpcomingList.tsx +1 -1
  28. package/src/cosmos/CreditLineBorrow.fixture.tsx +1 -0
  29. package/src/cosmos/CreditLinePayment.fixture.tsx +1 -0
  30. package/src/cosmos/SDKTesting.fixture.tsx +615 -557
  31. package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +3 -0
  32. package/src/cosmos/utils/env.ts +6 -0
  33. package/src/hooks/useEA.ts +10 -29
  34. package/src/index.tsx +75 -7
  35. package/src/reportWebVitals.ts +9 -9
  36. package/src/store/widgets.store.ts +0 -1
  37. package/src/utilTypes.d.ts +2 -0
  38. package/webpack.cosmos.js +9 -9
  39. package/src/components/AllowListModal.tsx +0 -113
  40. package/src/components/CreditLine/borrow/2-AllowList.tsx +0 -34
  41. package/src/components/InvoiceFactoring/borrow/2-AllowList.tsx +0 -34
  42. package/src/components/InvoiceFactoring/borrow/4-ConfirmTransfer.tsx +0 -104
  43. /package/src/components/CreditLine/borrow/{6-Success.tsx → 5-Success.tsx} +0 -0
  44. /package/src/components/InvoiceFactoring/borrow/{5-ApproveNFT.tsx → 4-ApproveNFT.tsx} +0 -0
  45. /package/src/components/InvoiceFactoring/borrow/{6-Transfer.tsx → 5-Transfer.tsx} +0 -0
  46. /package/src/components/InvoiceFactoring/borrow/{7-Success.tsx → 6-Success.tsx} +0 -0
@@ -1,14 +1,14 @@
1
- import { Contract, ethers } from 'ethers'
2
1
  import {
3
2
  CHAINS,
4
3
  Erc2612,
5
4
  PoolInfoType,
6
- StreamFactoringPool,
5
+ SuperfluidPoolProcessor,
7
6
  useERC2612Permit,
8
7
  useMount,
9
8
  } from '@huma-finance/shared'
10
9
  import ERC2612Abi from '@huma-finance/shared/dist/abis/erc2612.json'
11
- import PoolAbi from '@huma-finance/shared/dist/abis/StreamFactoringPool.json'
10
+ import PoolProcessorAbi from '@huma-finance/shared/dist/abis/SuperfluidPoolProcessor.json'
11
+ import { Contract, ethers } from 'ethers'
12
12
  import React from 'react'
13
13
  import { useDispatch } from 'react-redux'
14
14
 
@@ -46,12 +46,12 @@ export function Permit({
46
46
  const getApproveAllowanceCallData = async () => {
47
47
  const erc2612PermitResult = await getERC2612PermitMessage(
48
48
  tokenAddress,
49
- poolInfo.pool,
49
+ poolInfo.poolProcessor!,
50
50
  borrowAmountBN!,
51
51
  )
52
52
  const tokenContract = new Contract(tokenAddress, ERC2612Abi) as Erc2612
53
53
  return tokenContract.interface.encodeFunctionData('permit', [
54
- poolInfo.pool,
54
+ poolInfo.poolProcessor!,
55
55
  borrowAmountBN!,
56
56
  erc2612PermitResult.nonce,
57
57
  erc2612PermitResult.deadline,
@@ -67,7 +67,7 @@ export function Permit({
67
67
  borrower,
68
68
  superToken,
69
69
  payerAddress,
70
- poolInfo.pool,
70
+ poolInfo.poolProcessor!,
71
71
  stream!.borrowFlowrate!,
72
72
  stream!.durationInSeconds!,
73
73
  )
@@ -96,14 +96,14 @@ export function Permit({
96
96
  NFTPermitResult.s,
97
97
  ],
98
98
  )
99
- const poolContract = new Contract(
100
- poolInfo.pool,
101
- PoolAbi,
102
- ) as StreamFactoringPool
99
+ const poolProcessorContract = new Contract(
100
+ poolInfo.poolProcessor!,
101
+ PoolProcessorAbi,
102
+ ) as SuperfluidPoolProcessor
103
103
 
104
- return poolContract.interface.encodeFunctionData(
105
- 'drawdownWithAuthorization',
106
- [borrowAmountBN!, poolInfo.assetAddress!, drawdownEncodedData],
104
+ return poolProcessorContract.interface.encodeFunctionData(
105
+ 'mintAndDrawdown',
106
+ [borrower, borrowAmountBN!, poolInfo.assetAddress!, drawdownEncodedData],
107
107
  )
108
108
  }
109
109
 
@@ -120,7 +120,7 @@ export function Permit({
120
120
  }
121
121
 
122
122
  const drawdownCalldata = await getDrawdownCallData()
123
- addresses.push(poolInfo.pool)
123
+ addresses.push(poolInfo.poolProcessor!)
124
124
  callData.push(drawdownCalldata)
125
125
 
126
126
  dispatch(setMultisend({ addresses, callData }))
@@ -139,7 +139,7 @@ export function SuperfluidUpcomingList({
139
139
  if (Number(Number(flowrateMonth).toFixed(0)) > 0) {
140
140
  return {
141
141
  id: item.id,
142
- icon: <ReceiptIcon css={{ width: '18px' }} />,
142
+ icon: <ReceiptIcon css={{ width: '24px' }} />,
143
143
  token: item.token.symbol,
144
144
  tokenId: item.token.id,
145
145
  payer: item.sender.id,
@@ -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
  </>