@huma-finance/widgets 0.0.12 → 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 -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 +31 -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 +11 -3
  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/SuperfluidUpcomingList.tsx +1 -1
  25. package/src/cosmos/CreditLineBorrow.fixture.tsx +1 -0
  26. package/src/cosmos/CreditLinePayment.fixture.tsx +1 -0
  27. package/src/cosmos/SDKTesting.fixture.tsx +615 -615
  28. package/src/cosmos/SuperfluidFactoringBorrow.fixture.tsx +3 -0
  29. package/src/cosmos/utils/env.ts +6 -0
  30. package/src/hooks/useEA.ts +10 -29
  31. package/src/index.tsx +75 -7
  32. package/src/reportWebVitals.ts +9 -9
  33. package/src/store/widgets.store.ts +0 -1
  34. package/src/utilTypes.d.ts +2 -0
  35. package/webpack.cosmos.js +9 -9
  36. package/src/components/AllowListModal.tsx +0 -113
  37. package/src/components/CreditLine/borrow/2-AllowList.tsx +0 -34
  38. package/src/components/InvoiceFactoring/borrow/2-AllowList.tsx +0 -34
  39. package/src/components/InvoiceFactoring/borrow/4-ConfirmTransfer.tsx +0 -104
  40. /package/src/components/CreditLine/borrow/{3-ChooseAmount.tsx → 2-ChooseAmount.tsx} +0 -0
  41. /package/src/components/CreditLine/borrow/{4-Transfer.tsx → 3-Transfer.tsx} +0 -0
  42. /package/src/components/CreditLine/borrow/{5-ApproveAllowance.tsx → 4-ApproveAllowance.tsx} +0 -0
  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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
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.12",
34
- "@huma-finance/shared": "^0.0.12",
33
+ "@huma-finance/sdk": "^0.0.13",
34
+ "@huma-finance/shared": "^0.0.13",
35
35
  "@mui/icons-material": "^5.3.0",
36
36
  "@mui/material": "^5.0.6",
37
37
  "@mui/styles": "^5.0.2",
@@ -42,16 +42,16 @@
42
42
  "@walletconnect/ethereum-provider": "1.8.0",
43
43
  "@walletconnect/jsonrpc-http-connection": "^1.0.3",
44
44
  "@walletconnect/jsonrpc-provider": "^1.0.5",
45
- "@web3-react/coinbase-wallet": "8.0.34-beta.0",
46
- "@web3-react/core": "8.0.35-beta.0",
47
- "@web3-react/eip1193": "8.0.26-beta.0",
48
- "@web3-react/empty": "8.0.20-beta.0",
49
- "@web3-react/gnosis-safe": "8.0.6-beta.0",
50
- "@web3-react/metamask": "8.0.28-beta.0",
51
- "@web3-react/network": "8.0.27-beta.0",
52
- "@web3-react/types": "8.0.20-beta.0",
53
- "@web3-react/url": "8.0.25-beta.0",
54
- "@web3-react/walletconnect": "8.0.35-beta.0",
45
+ "@web3-react/coinbase-wallet": "^8.2.0",
46
+ "@web3-react/core": "^8.2.0",
47
+ "@web3-react/eip1193": "^8.2.0",
48
+ "@web3-react/empty": "^8.2.0",
49
+ "@web3-react/gnosis-safe": "^8.2.0",
50
+ "@web3-react/metamask": "^8.2.0",
51
+ "@web3-react/network": "^8.2.0",
52
+ "@web3-react/types": "^8.2.0",
53
+ "@web3-react/url": "^8.2.0",
54
+ "@web3-react/walletconnect": "^8.2.0",
55
55
  "buffer": "^6.0.3",
56
56
  "customize-cra": "^1.0.0",
57
57
  "dayjs": "^1.11.6",
@@ -85,7 +85,8 @@
85
85
  "lint-staged": "lint-staged",
86
86
  "e2e": "cypress run --config baseUrl=http://localhost:8000 --headed --browser chrome --e2e",
87
87
  "generateDocs": "jsdoc2md --files 'src/**/*.tsx' --configure ./jsdoc2md.json > API.md",
88
- "contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\""
88
+ "contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"",
89
+ "prettier": "prettier --write \"src/**/*.{js,ts,tsx,graphql}\""
89
90
  },
90
91
  "husky": {
91
92
  "hooks": {
@@ -125,7 +126,6 @@
125
126
  "@rollup/plugin-node-resolve": "^15.0.1",
126
127
  "@rollup/plugin-typescript": "^11.0.0",
127
128
  "@rollup/plugin-url": "^8.0.1",
128
- "@sentry/webpack-plugin": "^1.20.0",
129
129
  "@svgr/rollup": "^6.5.1",
130
130
  "@svgr/webpack": "^6.5.1",
131
131
  "@testing-library/cypress": "^9.0.0",
@@ -191,5 +191,5 @@
191
191
  "optionalDependencies": {
192
192
  "encoding": "^0.1.13"
193
193
  },
194
- "gitHead": "475917ee813766459198232d0cdf8b6e671b9e7d"
194
+ "gitHead": "d4c4b86cde3f84209204f8f926de995bb07a1bd2"
195
195
  }
@@ -23,7 +23,8 @@ import { WrapperModal } from './WrapperModal'
23
23
  type Props = {
24
24
  poolInfo: PoolInfoType
25
25
  showAutoPayback?: boolean
26
- allowanceAmount?: BigNumber
26
+ allowanceAmount?: BigNumber | string
27
+ spender?: string
27
28
  handleSuccess: () => void
28
29
  }
29
30
 
@@ -31,6 +32,7 @@ export function ApproveAllowanceModal({
31
32
  poolInfo,
32
33
  showAutoPayback = false,
33
34
  allowanceAmount,
35
+ spender,
34
36
  handleSuccess,
35
37
  }: Props): React.ReactElement | null {
36
38
  const theme = useTheme()
@@ -70,7 +72,7 @@ export function ApproveAllowanceModal({
70
72
  send({
71
73
  contract: poolUnderlyingTokenContract!,
72
74
  method: 'approve',
73
- params: [poolInfo.pool, allowanceAmount ?? MaxUint256],
75
+ params: [spender ?? poolInfo.pool, allowanceAmount ?? MaxUint256],
74
76
  provider,
75
77
  })
76
78
  }, [
@@ -79,6 +81,7 @@ export function ApproveAllowanceModal({
79
81
  poolUnderlyingTokenContract,
80
82
  provider,
81
83
  send,
84
+ spender,
82
85
  ])
83
86
 
84
87
  useMount(() => {
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+
3
+ import { ErrorModal } from './ErrorModal'
4
+ import { HumaModal, HumaModalHeader } from './humaModal'
5
+
6
+ type Props = {
7
+ handleClose: () => void
8
+ }
9
+
10
+ export function ChainNotSupportedModal({
11
+ handleClose,
12
+ }: Props): React.ReactElement | null {
13
+ return (
14
+ <HumaModal
15
+ isOpen
16
+ overflowY='auto'
17
+ onClose={handleClose}
18
+ width='480px'
19
+ padding='30px 40px'
20
+ disableBackdropClick
21
+ >
22
+ <HumaModalHeader onClose={handleClose} height={0} />
23
+ <ErrorModal
24
+ title='Network Not Supported'
25
+ errorReason='Please switch to a supported network.'
26
+ handleOk={handleClose}
27
+ okText='Close'
28
+ />
29
+ </HumaModal>
30
+ )
31
+ }