@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.
- package/API.md +6 -5
- package/dist/cjs/index.cjs +5058 -5959
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -6
- package/dist/index.js +5059 -5960
- package/dist/index.js.map +1 -1
- package/package.json +16 -16
- package/src/components/ApproveAllowanceModal.tsx +5 -2
- package/src/components/ChainNotSupportedModal.tsx +31 -0
- package/src/components/ChooseAmountModal.tsx +322 -315
- package/src/components/ConfirmTransferModal.tsx +153 -0
- package/src/components/CreditLine/borrow/1-Evaluation.tsx +1 -2
- package/src/components/CreditLine/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +2 -8
- package/src/components/CreditLine/borrow/{5-Transfer.tsx → 3-Transfer.tsx} +17 -3
- package/src/components/CreditLine/borrow/4-ApproveAllowance.tsx +1 -1
- package/src/components/CreditLine/borrow/index.tsx +3 -5
- package/src/components/Factoring/FactoredList.tsx +1 -1
- package/src/components/InvoiceFactoring/borrow/1-Evaluation.tsx +1 -4
- package/src/components/InvoiceFactoring/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +5 -3
- package/src/components/InvoiceFactoring/borrow/3-ConfirmTransfer.tsx +37 -0
- package/src/components/InvoiceFactoring/borrow/index.tsx +5 -7
- package/src/components/StreamFactoring/borrow/1-Evaluation.tsx +11 -3
- package/src/components/StreamFactoring/borrow/2-ChooseAmount.tsx +4 -1
- package/src/components/StreamFactoring/borrow/3-ConfirmTransfer.tsx +18 -80
- package/src/components/StreamFactoring/borrow/4-ApproveAllowance.tsx +4 -36
- package/src/components/StreamFactoring/borrow/5-Permit.tsx +14 -14
- package/src/components/SuperfluidFactoring/SuperfluidUpcomingList.tsx +1 -1
- package/src/cosmos/CreditLineBorrow.fixture.tsx +1 -0
- package/src/cosmos/CreditLinePayment.fixture.tsx +1 -0
- package/src/cosmos/SDKTesting.fixture.tsx +615 -557
- package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +3 -0
- package/src/cosmos/utils/env.ts +6 -0
- package/src/hooks/useEA.ts +10 -29
- package/src/index.tsx +75 -7
- package/src/reportWebVitals.ts +9 -9
- package/src/store/widgets.store.ts +0 -1
- package/src/utilTypes.d.ts +2 -0
- package/webpack.cosmos.js +9 -9
- package/src/components/AllowListModal.tsx +0 -113
- package/src/components/CreditLine/borrow/2-AllowList.tsx +0 -34
- package/src/components/InvoiceFactoring/borrow/2-AllowList.tsx +0 -34
- package/src/components/InvoiceFactoring/borrow/4-ConfirmTransfer.tsx +0 -104
- /package/src/components/CreditLine/borrow/{6-Success.tsx → 5-Success.tsx} +0 -0
- /package/src/components/InvoiceFactoring/borrow/{5-ApproveNFT.tsx → 4-ApproveNFT.tsx} +0 -0
- /package/src/components/InvoiceFactoring/borrow/{6-Transfer.tsx → 5-Transfer.tsx} +0 -0
- /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
|
-
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
|
100
|
-
poolInfo.
|
|
101
|
-
|
|
102
|
-
) as
|
|
99
|
+
const poolProcessorContract = new Contract(
|
|
100
|
+
poolInfo.poolProcessor!,
|
|
101
|
+
PoolProcessorAbi,
|
|
102
|
+
) as SuperfluidPoolProcessor
|
|
103
103
|
|
|
104
|
-
return
|
|
105
|
-
'
|
|
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.
|
|
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: '
|
|
142
|
+
icon: <ReceiptIcon css={{ width: '24px' }} />,
|
|
143
143
|
token: item.token.symbol,
|
|
144
144
|
tokenId: item.token.id,
|
|
145
145
|
payer: item.sender.id,
|