@huma-finance/shared 0.0.31 → 0.0.32
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/LICENSE +660 -660
- package/README.md +28 -28
- package/dist/abis/BaseCreditPoolReceivable.json +764 -0
- package/dist/abis/ERC20TransferrableReceivable.json +648 -0
- package/dist/abis/types/BaseCreditPoolReceivable.d.ts +518 -0
- package/dist/abis/types/BaseCreditPoolReceivable.js +2 -0
- package/dist/abis/types/BaseCreditPoolReceivable.js.map +1 -0
- package/dist/abis/types/ERC20TransferrableReceivable.d.ts +407 -0
- package/dist/abis/types/ERC20TransferrableReceivable.js +2 -0
- package/dist/abis/types/ERC20TransferrableReceivable.js.map +1 -0
- package/dist/abis/types/factories/BaseCreditPoolReceivable__factory.d.ts +597 -0
- package/dist/abis/types/factories/BaseCreditPoolReceivable__factory.js +778 -0
- package/dist/abis/types/factories/BaseCreditPoolReceivable__factory.js.map +1 -0
- package/dist/abis/types/factories/BaseCreditPool__factory.js +2 -1
- package/dist/abis/types/factories/BaseCreditPool__factory.js.map +1 -1
- package/dist/abis/types/factories/BaseFeeManager__factory.js +2 -1
- package/dist/abis/types/factories/BaseFeeManager__factory.js.map +1 -1
- package/dist/abis/types/factories/BasePoolConfig__factory.js +2 -1
- package/dist/abis/types/factories/BasePoolConfig__factory.js.map +1 -1
- package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js +2 -1
- package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js.map +1 -1
- package/dist/abis/types/factories/ERC20TransferrableReceivable__factory.d.ts +508 -0
- package/dist/abis/types/factories/ERC20TransferrableReceivable__factory.js +663 -0
- package/dist/abis/types/factories/ERC20TransferrableReceivable__factory.js.map +1 -0
- package/dist/abis/types/factories/Erc20__factory.js +2 -1
- package/dist/abis/types/factories/Erc20__factory.js.map +1 -1
- package/dist/abis/types/factories/Erc2612__factory.js +2 -1
- package/dist/abis/types/factories/Erc2612__factory.js.map +1 -1
- package/dist/abis/types/factories/Erc721__factory.js +2 -1
- package/dist/abis/types/factories/Erc721__factory.js.map +1 -1
- package/dist/abis/types/factories/HDT__factory.js +2 -1
- package/dist/abis/types/factories/HDT__factory.js.map +1 -1
- package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js +2 -1
- package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js.map +1 -1
- package/dist/abis/types/factories/ISuperfluid__factory.js +2 -1
- package/dist/abis/types/factories/ISuperfluid__factory.js.map +1 -1
- package/dist/abis/types/factories/InvoiceNFT__factory.js +2 -1
- package/dist/abis/types/factories/InvoiceNFT__factory.js.map +1 -1
- package/dist/abis/types/factories/Multisend__factory.js +2 -1
- package/dist/abis/types/factories/Multisend__factory.js.map +1 -1
- package/dist/abis/types/factories/RealWorldReceivable__factory.js +2 -1
- package/dist/abis/types/factories/RealWorldReceivable__factory.js.map +1 -1
- package/dist/abis/types/factories/ReceivableFactoringPool__factory.js +2 -1
- package/dist/abis/types/factories/ReceivableFactoringPool__factory.js.map +1 -1
- package/dist/abis/types/factories/StreamFactoringPool__factory.js +2 -1
- package/dist/abis/types/factories/StreamFactoringPool__factory.js.map +1 -1
- package/dist/abis/types/factories/StreamFeeManager__factory.js +2 -1
- package/dist/abis/types/factories/StreamFeeManager__factory.js.map +1 -1
- package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js +2 -1
- package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js.map +1 -1
- package/dist/abis/types/factories/TestERC20__factory.js +2 -1
- package/dist/abis/types/factories/TestERC20__factory.js.map +1 -1
- package/dist/abis/types/factories/TradableStream__factory.js +2 -1
- package/dist/abis/types/factories/TradableStream__factory.js.map +1 -1
- package/dist/abis/types/factories/TransferNFT__factory.js +2 -1
- package/dist/abis/types/factories/TransferNFT__factory.js.map +1 -1
- package/dist/abis/types/factories/Transfer__factory.js +2 -1
- package/dist/abis/types/factories/Transfer__factory.js.map +1 -1
- package/dist/cjs/abis/BaseCreditPool.json +1179 -1179
- package/dist/cjs/abis/BaseCreditPoolReceivable.json +764 -0
- package/dist/cjs/abis/BaseFeeManager.json +480 -480
- package/dist/cjs/abis/BasePoolConfig.json +1364 -1364
- package/dist/cjs/abis/ERC20TransferableReceivable.json +648 -648
- package/dist/cjs/abis/HDT.json +512 -512
- package/dist/cjs/abis/IConstantFlowAgreementV1.json +890 -890
- package/dist/cjs/abis/ISuperfluid.json +1122 -1122
- package/dist/cjs/abis/InvoiceNFT.json +625 -625
- package/dist/cjs/abis/Multisend.json +26 -26
- package/dist/cjs/abis/RealWorldReceivable.json +823 -823
- package/dist/cjs/abis/ReceivableFactoringPool.json +1529 -1529
- package/dist/cjs/abis/StreamFactoringPool.json +1523 -1523
- package/dist/cjs/abis/StreamFeeManager.json +522 -522
- package/dist/cjs/abis/SuperfluidPoolProcessor.json +692 -692
- package/dist/cjs/abis/TestERC20.json +358 -358
- package/dist/cjs/abis/TradableStream.json +850 -850
- package/dist/cjs/abis/Transfer.json +24 -24
- package/dist/cjs/abis/TransferNFT.json +27 -27
- package/dist/cjs/abis/erc20.json +117 -117
- package/dist/cjs/abis/erc2612.json +132 -132
- package/dist/cjs/abis/erc721.json +673 -673
- package/dist/cjs/abis/index.d.ts +3 -3
- package/dist/cjs/abis/index.js +12 -12
- package/dist/cjs/abis/types/BaseCreditPool.d.ts +803 -803
- package/dist/cjs/abis/types/BaseCreditPool.js +2 -2
- package/dist/cjs/abis/types/BaseCreditPoolReceivable.d.ts +518 -0
- package/dist/cjs/abis/types/BaseCreditPoolReceivable.js +3 -0
- package/dist/cjs/abis/types/BaseCreditPoolReceivable.js.map +1 -0
- package/dist/cjs/abis/types/BaseFeeManager.d.ts +408 -408
- package/dist/cjs/abis/types/BaseFeeManager.js +2 -2
- package/dist/cjs/abis/types/BasePoolConfig.d.ts +1097 -1097
- package/dist/cjs/abis/types/BasePoolConfig.js +2 -2
- package/dist/cjs/abis/types/ERC20TransferableReceivable.d.ts +407 -407
- package/dist/cjs/abis/types/ERC20TransferableReceivable.js +2 -2
- package/dist/cjs/abis/types/Erc20.d.ts +168 -168
- package/dist/cjs/abis/types/Erc20.js +2 -2
- package/dist/cjs/abis/types/Erc2612.d.ts +192 -192
- package/dist/cjs/abis/types/Erc2612.js +2 -2
- package/dist/cjs/abis/types/Erc721.d.ts +474 -474
- package/dist/cjs/abis/types/Erc721.js +2 -2
- package/dist/cjs/abis/types/HDT.d.ts +369 -369
- package/dist/cjs/abis/types/HDT.js +2 -2
- package/dist/cjs/abis/types/IConstantFlowAgreementV1.d.ts +573 -573
- package/dist/cjs/abis/types/IConstantFlowAgreementV1.js +2 -2
- package/dist/cjs/abis/types/ISuperfluid.d.ts +728 -728
- package/dist/cjs/abis/types/ISuperfluid.js +2 -2
- package/dist/cjs/abis/types/InvoiceNFT.d.ts +425 -425
- package/dist/cjs/abis/types/InvoiceNFT.js +2 -2
- package/dist/cjs/abis/types/Multisend.d.ts +50 -50
- package/dist/cjs/abis/types/Multisend.js +2 -2
- package/dist/cjs/abis/types/RealWorldReceivable.d.ts +564 -564
- package/dist/cjs/abis/types/RealWorldReceivable.js +2 -2
- package/dist/cjs/abis/types/ReceivableFactoringPool.d.ts +999 -999
- package/dist/cjs/abis/types/ReceivableFactoringPool.js +2 -2
- package/dist/cjs/abis/types/StreamFactoringPool.d.ts +985 -985
- package/dist/cjs/abis/types/StreamFactoringPool.js +2 -2
- package/dist/cjs/abis/types/StreamFeeManager.d.ts +440 -440
- package/dist/cjs/abis/types/StreamFeeManager.js +2 -2
- package/dist/cjs/abis/types/SuperfluidPoolProcessor.d.ts +398 -398
- package/dist/cjs/abis/types/SuperfluidPoolProcessor.js +2 -2
- package/dist/cjs/abis/types/TestERC20.d.ts +270 -270
- package/dist/cjs/abis/types/TestERC20.js +2 -2
- package/dist/cjs/abis/types/TradableStream.d.ts +607 -607
- package/dist/cjs/abis/types/TradableStream.js +2 -2
- package/dist/cjs/abis/types/Transfer.d.ts +45 -45
- package/dist/cjs/abis/types/Transfer.js +2 -2
- package/dist/cjs/abis/types/TransferNFT.d.ts +45 -45
- package/dist/cjs/abis/types/TransferNFT.js +2 -2
- package/dist/cjs/abis/types/common.d.ts +22 -22
- package/dist/cjs/abis/types/common.js +2 -2
- package/dist/cjs/abis/types/factories/BaseCreditPoolReceivable__factory.d.ts +597 -0
- package/dist/cjs/abis/types/factories/BaseCreditPoolReceivable__factory.js +782 -0
- package/dist/cjs/abis/types/factories/BaseCreditPoolReceivable__factory.js.map +1 -0
- package/dist/cjs/abis/types/factories/BaseCreditPool__factory.d.ts +931 -931
- package/dist/cjs/abis/types/factories/BaseCreditPool__factory.js +1196 -1196
- package/dist/cjs/abis/types/factories/BaseFeeManager__factory.d.ts +379 -379
- package/dist/cjs/abis/types/factories/BaseFeeManager__factory.js +497 -497
- package/dist/cjs/abis/types/factories/BasePoolConfig__factory.d.ts +1074 -1074
- package/dist/cjs/abis/types/factories/BasePoolConfig__factory.js +1381 -1381
- package/dist/cjs/abis/types/factories/ERC20TransferableReceivable__factory.d.ts +508 -508
- package/dist/cjs/abis/types/factories/ERC20TransferableReceivable__factory.js +665 -665
- package/dist/cjs/abis/types/factories/Erc20__factory.d.ts +175 -175
- package/dist/cjs/abis/types/factories/Erc20__factory.js +239 -239
- package/dist/cjs/abis/types/factories/Erc2612__factory.d.ts +209 -209
- package/dist/cjs/abis/types/factories/Erc2612__factory.js +282 -282
- package/dist/cjs/abis/types/factories/Erc721__factory.d.ts +539 -539
- package/dist/cjs/abis/types/factories/Erc721__factory.js +690 -690
- package/dist/cjs/abis/types/factories/HDT__factory.d.ts +399 -399
- package/dist/cjs/abis/types/factories/HDT__factory.js +529 -529
- package/dist/cjs/abis/types/factories/IConstantFlowAgreementV1__factory.d.ts +695 -695
- package/dist/cjs/abis/types/factories/IConstantFlowAgreementV1__factory.js +907 -907
- package/dist/cjs/abis/types/factories/ISuperfluid__factory.d.ts +866 -866
- package/dist/cjs/abis/types/factories/ISuperfluid__factory.js +1139 -1139
- package/dist/cjs/abis/types/factories/InvoiceNFT__factory.d.ts +489 -489
- package/dist/cjs/abis/types/factories/InvoiceNFT__factory.js +642 -642
- package/dist/cjs/abis/types/factories/Multisend__factory.d.ts +26 -26
- package/dist/cjs/abis/types/factories/Multisend__factory.js +43 -43
- package/dist/cjs/abis/types/factories/RealWorldReceivable__factory.d.ts +645 -645
- package/dist/cjs/abis/types/factories/RealWorldReceivable__factory.js +840 -840
- package/dist/cjs/abis/types/factories/ReceivableFactoringPool__factory.d.ts +1204 -1204
- package/dist/cjs/abis/types/factories/ReceivableFactoringPool__factory.js +1546 -1546
- package/dist/cjs/abis/types/factories/StreamFactoringPool__factory.d.ts +1200 -1200
- package/dist/cjs/abis/types/factories/StreamFactoringPool__factory.js +1540 -1540
- package/dist/cjs/abis/types/factories/StreamFeeManager__factory.d.ts +412 -412
- package/dist/cjs/abis/types/factories/StreamFeeManager__factory.js +539 -539
- package/dist/cjs/abis/types/factories/SuperfluidPoolProcessor__factory.d.ts +546 -546
- package/dist/cjs/abis/types/factories/SuperfluidPoolProcessor__factory.js +709 -709
- package/dist/cjs/abis/types/factories/TestERC20__factory.d.ts +280 -280
- package/dist/cjs/abis/types/factories/TestERC20__factory.js +375 -375
- package/dist/cjs/abis/types/factories/TradableStream__factory.d.ts +663 -663
- package/dist/cjs/abis/types/factories/TradableStream__factory.js +867 -867
- package/dist/cjs/abis/types/factories/TransferNFT__factory.d.ts +28 -28
- package/dist/cjs/abis/types/factories/TransferNFT__factory.js +44 -44
- package/dist/cjs/abis/types/factories/Transfer__factory.d.ts +25 -25
- package/dist/cjs/abis/types/factories/Transfer__factory.js +41 -41
- package/dist/cjs/abis/types/factories/index.d.ts +21 -21
- package/dist/cjs/abis/types/factories/index.js +48 -48
- package/dist/cjs/abis/types/index.d.ts +43 -43
- package/dist/cjs/abis/types/index.js +47 -47
- package/dist/cjs/hooks/index.d.ts +18 -18
- package/dist/cjs/hooks/index.js +21 -21
- package/dist/cjs/hooks/useActiveRoute.d.ts +8 -8
- package/dist/cjs/hooks/useActiveRoute.js +11 -11
- package/dist/cjs/hooks/useAsyncError.d.ts +14 -14
- package/dist/cjs/hooks/useAsyncError.js +26 -26
- package/dist/cjs/hooks/useCLPoolContract.d.ts +27 -27
- package/dist/cjs/hooks/useCLPoolContract.js +53 -53
- package/dist/cjs/hooks/useContract.d.ts +7 -7
- package/dist/cjs/hooks/useContract.js +49 -49
- package/dist/cjs/hooks/useContractFunction.d.ts +18 -18
- package/dist/cjs/hooks/useContractFunction.js +57 -57
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/index.d.ts +35 -35
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/index.js +145 -145
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/lib.d.ts +1 -1
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/lib.js +26 -26
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/rpc.d.ts +10 -10
- package/dist/cjs/hooks/useERC2612Permit/ethPermit/rpc.js +104 -104
- package/dist/cjs/hooks/useERC2612Permit/index.d.ts +6 -6
- package/dist/cjs/hooks/useERC2612Permit/index.js +35 -35
- package/dist/cjs/hooks/useFactoring.d.ts +19 -19
- package/dist/cjs/hooks/useFactoring.js +94 -94
- package/dist/cjs/hooks/useForceRefresh.d.ts +1 -1
- package/dist/cjs/hooks/useForceRefresh.js +12 -12
- package/dist/cjs/hooks/useGetSizes.d.ts +12 -12
- package/dist/cjs/hooks/useGetSizes.js +23 -23
- package/dist/cjs/hooks/useInvoiceNFTContract.d.ts +11 -11
- package/dist/cjs/hooks/useInvoiceNFTContract.js +72 -72
- package/dist/cjs/hooks/useMQ.d.ts +6 -6
- package/dist/cjs/hooks/useMQ.js +18 -18
- package/dist/cjs/hooks/useMount.d.ts +2 -2
- package/dist/cjs/hooks/useMount.js +13 -13
- package/dist/cjs/hooks/useParamsSearch.d.ts +2 -2
- package/dist/cjs/hooks/useParamsSearch.js +11 -11
- package/dist/cjs/hooks/usePool.d.ts +4 -4
- package/dist/cjs/hooks/usePool.js +45 -45
- package/dist/cjs/hooks/usePoolContract.d.ts +73 -73
- package/dist/cjs/hooks/usePoolContract.js +309 -309
- package/dist/cjs/hooks/useRFPoolContract.d.ts +22 -22
- package/dist/cjs/hooks/useRFPoolContract.js +41 -41
- package/dist/cjs/hooks/useRefresh.d.ts +1 -1
- package/dist/cjs/hooks/useRefresh.js +51 -51
- package/dist/cjs/hooks/web3/index.d.ts +15 -15
- package/dist/cjs/hooks/web3/index.js +147 -147
- package/dist/cjs/hooks/web3/useConnectors.d.ts +17 -17
- package/dist/cjs/hooks/web3/useConnectors.js +30 -30
- package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.d.ts +13 -13
- package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.js +62 -62
- package/dist/cjs/index.d.ts +5 -5
- package/dist/cjs/index.js +8 -8
- package/dist/cjs/services/EAService.d.ts +153 -153
- package/dist/cjs/services/EAService.js +80 -80
- package/dist/cjs/services/IdentityService.d.ts +52 -35
- package/dist/cjs/services/IdentityService.js +83 -56
- package/dist/cjs/services/IdentityService.js.map +1 -1
- package/dist/cjs/services/RNService.d.ts +14 -14
- package/dist/cjs/services/RNService.js +13 -13
- package/dist/cjs/services/index.d.ts +3 -3
- package/dist/cjs/services/index.js +6 -6
- package/dist/cjs/utils/JsonRpcConnector.d.ts +11 -11
- package/dist/cjs/utils/JsonRpcConnector.js +42 -42
- package/dist/cjs/utils/WalletConnect.d.ts +10 -10
- package/dist/cjs/utils/WalletConnect.js +55 -55
- package/dist/cjs/utils/chain.d.ts +36 -35
- package/dist/cjs/utils/chain.js +116 -113
- package/dist/cjs/utils/chain.js.map +1 -1
- package/dist/cjs/utils/common.d.ts +4 -4
- package/dist/cjs/utils/common.js +17 -17
- package/dist/cjs/utils/config.d.ts +8 -8
- package/dist/cjs/utils/config.js +44 -44
- package/dist/cjs/utils/const.d.ts +2 -2
- package/dist/cjs/utils/const.js +5 -5
- package/dist/cjs/utils/contractError.json +73 -73
- package/dist/cjs/utils/contractconfig.json +19 -19
- package/dist/cjs/utils/credit.d.ts +21 -21
- package/dist/cjs/utils/credit.js +39 -39
- package/dist/cjs/utils/errors.d.ts +26 -26
- package/dist/cjs/utils/errors.js +46 -46
- package/dist/cjs/utils/index.d.ts +20 -20
- package/dist/cjs/utils/index.js +23 -23
- package/dist/cjs/utils/jsonRpcEndpoints.d.ts +12 -12
- package/dist/cjs/utils/jsonRpcEndpoints.js +28 -28
- package/dist/cjs/utils/notifi.d.ts +3 -3
- package/dist/cjs/utils/notifi.js +39 -28
- package/dist/cjs/utils/notifi.js.map +1 -1
- package/dist/cjs/utils/number.d.ts +5 -5
- package/dist/cjs/utils/number.js +61 -55
- package/dist/cjs/utils/number.js.map +1 -1
- package/dist/cjs/utils/pool.d.ts +95 -96
- package/dist/cjs/utils/pool.js +416 -416
- package/dist/cjs/utils/pool.js.map +1 -1
- package/dist/cjs/utils/realWorldReceivable.d.ts +12 -12
- package/dist/cjs/utils/realWorldReceivable.js +2 -2
- package/dist/cjs/utils/request.d.ts +3 -3
- package/dist/cjs/utils/request.js +45 -45
- package/dist/cjs/utils/scientificToDecimal.d.ts +1 -1
- package/dist/cjs/utils/scientificToDecimal.js +61 -61
- package/dist/cjs/utils/string.d.ts +1 -1
- package/dist/cjs/utils/string.js +5 -5
- package/dist/cjs/utils/style.d.ts +1 -1
- package/dist/cjs/utils/style.js +16 -16
- package/dist/cjs/utils/time.d.ts +26 -26
- package/dist/cjs/utils/time.js +58 -58
- package/dist/cjs/utils/transaction.d.ts +32 -32
- package/dist/cjs/utils/transaction.js +96 -96
- package/dist/cjs/utils/web3.d.ts +4 -4
- package/dist/cjs/utils/web3.js +39 -39
- package/dist/components/icons/approve-lender.svg +30 -0
- package/dist/components/icons/auto-payback.svg +40 -0
- package/dist/components/icons/check-circle.svg +3 -0
- package/dist/components/icons/check-green.svg +3 -0
- package/dist/components/icons/check.svg +10 -0
- package/dist/components/icons/donut.svg +904 -0
- package/dist/components/icons/ellipse.svg +3 -0
- package/dist/components/icons/ethereum.svg +1 -0
- package/dist/components/icons/huma-full.svg +22 -0
- package/dist/components/icons/huma.svg +15 -0
- package/dist/components/icons/index.d.ts +19 -0
- package/dist/components/icons/index.js +70 -0
- package/dist/components/icons/index.js.map +1 -0
- package/dist/components/icons/loader.svg +229 -0
- package/dist/components/icons/metamask.svg +31 -0
- package/dist/components/icons/polygon.svg +16 -0
- package/dist/components/icons/receipt.svg +3 -0
- package/dist/components/icons/separator.svg +3 -0
- package/dist/components/icons/sorry.svg +31 -0
- package/dist/components/icons/usdc.svg +5 -0
- package/dist/components/icons/wallet-connect.svg +12 -0
- package/dist/hooks/useCLPoolContract.js +38 -38
- package/dist/hooks/useContract.js +40 -40
- package/dist/hooks/useFactoring.js +90 -90
- package/dist/hooks/useInvoiceNFTContract.js +64 -64
- package/dist/hooks/usePool.js +39 -39
- package/dist/hooks/usePoolContract.js +286 -286
- package/dist/hooks/useRFPoolContract.js +29 -29
- package/dist/hooks/web3/index.js +142 -142
- package/dist/hooks/web3/useJsonRpcUrlsMap.js +53 -53
- package/dist/index.js +5 -5
- package/dist/services/EAService.js +77 -77
- package/dist/services/IdentityService.d.ts +52 -35
- package/dist/services/IdentityService.js +80 -53
- package/dist/services/IdentityService.js.map +1 -1
- package/dist/services/RNService.js +10 -10
- package/dist/services/index.js +3 -3
- package/dist/theme/breakpoints.d.ts +5 -0
- package/dist/theme/breakpoints.js +4 -0
- package/dist/theme/breakpoints.js.map +1 -0
- package/dist/theme/components.d.ts +6 -0
- package/dist/theme/components.js +62 -0
- package/dist/theme/components.js.map +1 -0
- package/dist/theme/coreThemeConstants.d.ts +18 -0
- package/dist/theme/coreThemeConstants.js +30 -0
- package/dist/theme/coreThemeConstants.js.map +1 -0
- package/dist/theme/cssMixins.d.ts +20 -0
- package/dist/theme/cssMixins.js +90 -0
- package/dist/theme/cssMixins.js.map +1 -0
- package/dist/theme/index.d.ts +8 -0
- package/dist/theme/index.js +27 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/palette.d.ts +53 -0
- package/dist/theme/palette.js +137 -0
- package/dist/theme/palette.js.map +1 -0
- package/dist/theme/shape.d.ts +2 -0
- package/dist/theme/shape.js +5 -0
- package/dist/theme/shape.js.map +1 -0
- package/dist/theme/theme.types.d.ts +72 -0
- package/dist/theme/theme.types.js +2 -0
- package/dist/theme/theme.types.js.map +1 -0
- package/dist/theme/typography.d.ts +2 -0
- package/dist/theme/typography.js +116 -0
- package/dist/theme/typography.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/WalletConnect.js +2 -1
- package/dist/utils/WalletConnect.js.map +1 -1
- package/dist/utils/chain.d.ts +36 -35
- package/dist/utils/chain.js +109 -106
- package/dist/utils/chain.js.map +1 -1
- package/dist/utils/config.d.ts +8 -8
- package/dist/utils/config.js +41 -41
- package/dist/utils/contractconfig.json +19 -19
- package/dist/utils/ddLogger.d.ts +4 -0
- package/dist/utils/ddLogger.js +48 -0
- package/dist/utils/ddLogger.js.map +1 -0
- package/dist/utils/index.d.ts +20 -20
- package/dist/utils/index.js +20 -20
- package/dist/utils/jsonRpcEndpoints.js +25 -25
- package/dist/utils/notifi.d.ts +3 -3
- package/dist/utils/notifi.js +34 -23
- package/dist/utils/notifi.js.map +1 -1
- package/dist/utils/number.js +54 -48
- package/dist/utils/number.js.map +1 -1
- package/dist/utils/pool.d.ts +95 -96
- package/dist/utils/pool.js +409 -409
- package/dist/utils/pool.js.map +1 -1
- package/dist/utils/realWorldReceivable.d.ts +12 -12
- package/dist/utils/realWorldReceivable.js +1 -1
- package/dist/utils/sentry.d.ts +1 -0
- package/dist/utils/sentry.js +19 -0
- package/dist/utils/sentry.js.map +1 -0
- package/dist/utils/storage.d.ts +12 -0
- package/dist/utils/storage.js +32 -0
- package/dist/utils/storage.js.map +1 -0
- package/package.json +2 -2
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { POOL_TYPE } from '../utils/pool';
|
|
2
|
-
import { useAccountStats, useBaseConfigPoolContract, useCreditRecord, useFeeManager, useLenderApproved, useLenderPosition, usePoolAllowance, usePoolBalance, usePoolContract, usePoolUnderlyingToken, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenContract, } from './usePoolContract';
|
|
3
|
-
export function useCLPoolContract(poolName) {
|
|
4
|
-
return usePoolContract(poolName, POOL_TYPE.CreditLine);
|
|
5
|
-
}
|
|
6
|
-
export function useCLBaseConfigPoolContract(poolName) {
|
|
7
|
-
return useBaseConfigPoolContract(poolName, POOL_TYPE.CreditLine);
|
|
8
|
-
}
|
|
9
|
-
export function useCLPoolUnderlyingTokenContract(poolName) {
|
|
10
|
-
return usePoolUnderlyingTokenContract(poolName, POOL_TYPE.CreditLine);
|
|
11
|
-
}
|
|
12
|
-
export function useCLPoolUnderlyingToken(poolName) {
|
|
13
|
-
return usePoolUnderlyingToken(poolName, POOL_TYPE.CreditLine);
|
|
14
|
-
}
|
|
15
|
-
export function useCLPoolUnderlyingTokenBalance(poolName, account) {
|
|
16
|
-
return usePoolUnderlyingTokenBalance(poolName, POOL_TYPE.CreditLine, account);
|
|
17
|
-
}
|
|
18
|
-
export function useCLPoolBalance(poolName) {
|
|
19
|
-
return usePoolBalance(poolName, POOL_TYPE.CreditLine);
|
|
20
|
-
}
|
|
21
|
-
export function useCLStats(poolName, account) {
|
|
22
|
-
return useAccountStats(poolName, POOL_TYPE.CreditLine, account);
|
|
23
|
-
}
|
|
24
|
-
export function useCLCreditRecord(poolName, account) {
|
|
25
|
-
return useCreditRecord(poolName, POOL_TYPE.CreditLine, account);
|
|
26
|
-
}
|
|
27
|
-
export function useCLFeeManager(poolName) {
|
|
28
|
-
return useFeeManager(poolName, POOL_TYPE.CreditLine);
|
|
29
|
-
}
|
|
30
|
-
export function useCLPoolAllowance(poolName, account) {
|
|
31
|
-
return usePoolAllowance(poolName, POOL_TYPE.CreditLine, account);
|
|
32
|
-
}
|
|
33
|
-
export function useCLLenderPosition(poolName, account) {
|
|
34
|
-
return useLenderPosition(poolName, POOL_TYPE.CreditLine, account);
|
|
35
|
-
}
|
|
36
|
-
export function useCLLenderApproved(poolName, account) {
|
|
37
|
-
return useLenderApproved(poolName, POOL_TYPE.CreditLine, account);
|
|
38
|
-
}
|
|
1
|
+
import { POOL_TYPE } from '../utils/pool';
|
|
2
|
+
import { useAccountStats, useBaseConfigPoolContract, useCreditRecord, useFeeManager, useLenderApproved, useLenderPosition, usePoolAllowance, usePoolBalance, usePoolContract, usePoolUnderlyingToken, usePoolUnderlyingTokenBalance, usePoolUnderlyingTokenContract, } from './usePoolContract';
|
|
3
|
+
export function useCLPoolContract(poolName) {
|
|
4
|
+
return usePoolContract(poolName, POOL_TYPE.CreditLine);
|
|
5
|
+
}
|
|
6
|
+
export function useCLBaseConfigPoolContract(poolName) {
|
|
7
|
+
return useBaseConfigPoolContract(poolName, POOL_TYPE.CreditLine);
|
|
8
|
+
}
|
|
9
|
+
export function useCLPoolUnderlyingTokenContract(poolName) {
|
|
10
|
+
return usePoolUnderlyingTokenContract(poolName, POOL_TYPE.CreditLine);
|
|
11
|
+
}
|
|
12
|
+
export function useCLPoolUnderlyingToken(poolName) {
|
|
13
|
+
return usePoolUnderlyingToken(poolName, POOL_TYPE.CreditLine);
|
|
14
|
+
}
|
|
15
|
+
export function useCLPoolUnderlyingTokenBalance(poolName, account) {
|
|
16
|
+
return usePoolUnderlyingTokenBalance(poolName, POOL_TYPE.CreditLine, account);
|
|
17
|
+
}
|
|
18
|
+
export function useCLPoolBalance(poolName) {
|
|
19
|
+
return usePoolBalance(poolName, POOL_TYPE.CreditLine);
|
|
20
|
+
}
|
|
21
|
+
export function useCLStats(poolName, account) {
|
|
22
|
+
return useAccountStats(poolName, POOL_TYPE.CreditLine, account);
|
|
23
|
+
}
|
|
24
|
+
export function useCLCreditRecord(poolName, account) {
|
|
25
|
+
return useCreditRecord(poolName, POOL_TYPE.CreditLine, account);
|
|
26
|
+
}
|
|
27
|
+
export function useCLFeeManager(poolName) {
|
|
28
|
+
return useFeeManager(poolName, POOL_TYPE.CreditLine);
|
|
29
|
+
}
|
|
30
|
+
export function useCLPoolAllowance(poolName, account) {
|
|
31
|
+
return usePoolAllowance(poolName, POOL_TYPE.CreditLine, account);
|
|
32
|
+
}
|
|
33
|
+
export function useCLLenderPosition(poolName, account) {
|
|
34
|
+
return useLenderPosition(poolName, POOL_TYPE.CreditLine, account);
|
|
35
|
+
}
|
|
36
|
+
export function useCLLenderApproved(poolName, account) {
|
|
37
|
+
return useLenderApproved(poolName, POOL_TYPE.CreditLine, account);
|
|
38
|
+
}
|
|
39
39
|
//# sourceMappingURL=useCLPoolContract.js.map
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { useWeb3React } from '@web3-react/core';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import ERC20_ABI from '../abis/erc20.json';
|
|
4
|
-
import ERC721_ABI from '../abis/erc721.json';
|
|
5
|
-
import MULTISEND_ABI from '../abis/Multisend.json';
|
|
6
|
-
import TEST_ERC20_ABI from '../abis/TestERC20.json';
|
|
7
|
-
import { SupplementaryContracts, SupplementaryContractsMap, } from '../utils/pool';
|
|
8
|
-
import { getContract } from '../utils/web3';
|
|
9
|
-
// returns null on errors
|
|
10
|
-
export function useContract(address,
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
-
ABI, withSignerIfPossible = true) {
|
|
13
|
-
const { provider, account, chainId } = useWeb3React();
|
|
14
|
-
return useMemo(() => {
|
|
15
|
-
if (!address || !ABI || !provider || !chainId)
|
|
16
|
-
return null;
|
|
17
|
-
try {
|
|
18
|
-
return getContract(address, ABI, provider, withSignerIfPossible && account ? account : undefined);
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
}, [address, ABI, provider, chainId, withSignerIfPossible, account]);
|
|
24
|
-
}
|
|
25
|
-
export function useERC20Contract(tokenAddress, withSignerIfPossible) {
|
|
26
|
-
return useContract(tokenAddress, ERC20_ABI, withSignerIfPossible);
|
|
27
|
-
}
|
|
28
|
-
export function useTestERC20Contract(tokenAddress, withSignerIfPossible) {
|
|
29
|
-
return useContract(tokenAddress, TEST_ERC20_ABI, withSignerIfPossible);
|
|
30
|
-
}
|
|
31
|
-
export function useERC721Contract(NFTAddress) {
|
|
32
|
-
return useContract(NFTAddress, ERC721_ABI, false);
|
|
33
|
-
}
|
|
34
|
-
export function useMultiSendContract() {
|
|
35
|
-
var _a;
|
|
36
|
-
const { chainId } = useWeb3React();
|
|
37
|
-
return useContract(chainId
|
|
38
|
-
? (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.MultiSend]
|
|
39
|
-
: undefined, MULTISEND_ABI, true);
|
|
40
|
-
}
|
|
1
|
+
import { useWeb3React } from '@web3-react/core';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import ERC20_ABI from '../abis/erc20.json';
|
|
4
|
+
import ERC721_ABI from '../abis/erc721.json';
|
|
5
|
+
import MULTISEND_ABI from '../abis/Multisend.json';
|
|
6
|
+
import TEST_ERC20_ABI from '../abis/TestERC20.json';
|
|
7
|
+
import { SupplementaryContracts, SupplementaryContractsMap, } from '../utils/pool';
|
|
8
|
+
import { getContract } from '../utils/web3';
|
|
9
|
+
// returns null on errors
|
|
10
|
+
export function useContract(address,
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
ABI, withSignerIfPossible = true) {
|
|
13
|
+
const { provider, account, chainId } = useWeb3React();
|
|
14
|
+
return useMemo(() => {
|
|
15
|
+
if (!address || !ABI || !provider || !chainId)
|
|
16
|
+
return null;
|
|
17
|
+
try {
|
|
18
|
+
return getContract(address, ABI, provider, withSignerIfPossible && account ? account : undefined);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}, [address, ABI, provider, chainId, withSignerIfPossible, account]);
|
|
24
|
+
}
|
|
25
|
+
export function useERC20Contract(tokenAddress, withSignerIfPossible) {
|
|
26
|
+
return useContract(tokenAddress, ERC20_ABI, withSignerIfPossible);
|
|
27
|
+
}
|
|
28
|
+
export function useTestERC20Contract(tokenAddress, withSignerIfPossible) {
|
|
29
|
+
return useContract(tokenAddress, TEST_ERC20_ABI, withSignerIfPossible);
|
|
30
|
+
}
|
|
31
|
+
export function useERC721Contract(NFTAddress) {
|
|
32
|
+
return useContract(NFTAddress, ERC721_ABI, false);
|
|
33
|
+
}
|
|
34
|
+
export function useMultiSendContract() {
|
|
35
|
+
var _a;
|
|
36
|
+
const { chainId } = useWeb3React();
|
|
37
|
+
return useContract(chainId
|
|
38
|
+
? (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.MultiSend]
|
|
39
|
+
: undefined, MULTISEND_ABI, true);
|
|
40
|
+
}
|
|
41
41
|
//# sourceMappingURL=useContract.js.map
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { css, useTheme } from '@mui/material';
|
|
2
|
-
import { useWeb3React } from '@web3-react/core';
|
|
3
|
-
import { useCallback, useState } from 'react';
|
|
4
|
-
import { useMQ } from './useMQ';
|
|
5
|
-
import { usePoolInfo } from './usePool';
|
|
6
|
-
import { useAccountStats } from './usePoolContract';
|
|
7
|
-
import { useRefresh } from './useRefresh';
|
|
8
|
-
import { hasRFActiveLoan } from '../utils/credit';
|
|
9
|
-
export function useFactoring(poolName, poolType, getPaidSuccessCallback) {
|
|
10
|
-
const theme = useTheme();
|
|
11
|
-
const { account } = useWeb3React();
|
|
12
|
-
const poolInfo = usePoolInfo(poolName, poolType);
|
|
13
|
-
const [accountStats, refreshReceivableStats] = useAccountStats(poolName, poolType, account);
|
|
14
|
-
const { creditRecord, receivableInfo } = accountStats;
|
|
15
|
-
const accountHasActiveLoan = hasRFActiveLoan(creditRecord, receivableInfo);
|
|
16
|
-
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
17
|
-
const [selectedItem, setSelectedItem] = useState();
|
|
18
|
-
const [actionType, setActionType] = useState();
|
|
19
|
-
const [subscribe, loading] = useRefresh();
|
|
20
|
-
const { isMdSize, isXsSize } = useMQ();
|
|
21
|
-
const getPadding = useCallback(() => {
|
|
22
|
-
if (isXsSize) {
|
|
23
|
-
return '0 8px 8px 8px';
|
|
24
|
-
}
|
|
25
|
-
if (isMdSize) {
|
|
26
|
-
return '0 32px 32px 32px';
|
|
27
|
-
}
|
|
28
|
-
return '0 90px 90px 90px';
|
|
29
|
-
}, [isMdSize, isXsSize]);
|
|
30
|
-
const styles = {
|
|
31
|
-
wrapper: css `
|
|
32
|
-
max-width: 1307px;
|
|
33
|
-
padding: ${getPadding()};
|
|
34
|
-
margin: 0 auto;
|
|
35
|
-
`,
|
|
36
|
-
title: css `
|
|
37
|
-
font-family: 'Uni-Neue-Black';
|
|
38
|
-
color: ${theme.palette.text.primary};
|
|
39
|
-
font-size: 24px;
|
|
40
|
-
margin-bottom: 16px;
|
|
41
|
-
`,
|
|
42
|
-
description: css `
|
|
43
|
-
font-family: 'Uni-Neue-Regular';
|
|
44
|
-
color: ${theme.palette.text.primary};
|
|
45
|
-
font-size: 1rem;
|
|
46
|
-
`,
|
|
47
|
-
};
|
|
48
|
-
const handleGetPaid = useCallback((item) => {
|
|
49
|
-
setModalIsOpen(true);
|
|
50
|
-
setSelectedItem(item);
|
|
51
|
-
setActionType('borrow');
|
|
52
|
-
}, []);
|
|
53
|
-
const handleGetPaidSuccess = useCallback((blockNumber) => {
|
|
54
|
-
const callbackFn = () => {
|
|
55
|
-
refreshReceivableStats();
|
|
56
|
-
if (getPaidSuccessCallback) {
|
|
57
|
-
getPaidSuccessCallback();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
if (blockNumber) {
|
|
61
|
-
subscribe(blockNumber, callbackFn);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
callbackFn();
|
|
65
|
-
}
|
|
66
|
-
}, [getPaidSuccessCallback, refreshReceivableStats, subscribe]);
|
|
67
|
-
const handlePayManually = useCallback((item) => {
|
|
68
|
-
setModalIsOpen(true);
|
|
69
|
-
setSelectedItem(item);
|
|
70
|
-
setActionType('payment');
|
|
71
|
-
}, []);
|
|
72
|
-
const handleClose = useCallback(() => {
|
|
73
|
-
setActionType(undefined);
|
|
74
|
-
setModalIsOpen(false);
|
|
75
|
-
}, []);
|
|
76
|
-
return {
|
|
77
|
-
accountStats,
|
|
78
|
-
accountHasActiveLoan,
|
|
79
|
-
actionType,
|
|
80
|
-
loading,
|
|
81
|
-
poolInfo,
|
|
82
|
-
modalIsOpen,
|
|
83
|
-
selectedItem,
|
|
84
|
-
styles,
|
|
85
|
-
handleGetPaid,
|
|
86
|
-
handleGetPaidSuccess,
|
|
87
|
-
handlePayManually,
|
|
88
|
-
handleClose,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
1
|
+
import { css, useTheme } from '@mui/material';
|
|
2
|
+
import { useWeb3React } from '@web3-react/core';
|
|
3
|
+
import { useCallback, useState } from 'react';
|
|
4
|
+
import { useMQ } from './useMQ';
|
|
5
|
+
import { usePoolInfo } from './usePool';
|
|
6
|
+
import { useAccountStats } from './usePoolContract';
|
|
7
|
+
import { useRefresh } from './useRefresh';
|
|
8
|
+
import { hasRFActiveLoan } from '../utils/credit';
|
|
9
|
+
export function useFactoring(poolName, poolType, getPaidSuccessCallback) {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const { account } = useWeb3React();
|
|
12
|
+
const poolInfo = usePoolInfo(poolName, poolType);
|
|
13
|
+
const [accountStats, refreshReceivableStats] = useAccountStats(poolName, poolType, account);
|
|
14
|
+
const { creditRecord, receivableInfo } = accountStats;
|
|
15
|
+
const accountHasActiveLoan = hasRFActiveLoan(creditRecord, receivableInfo);
|
|
16
|
+
const [modalIsOpen, setModalIsOpen] = useState(false);
|
|
17
|
+
const [selectedItem, setSelectedItem] = useState();
|
|
18
|
+
const [actionType, setActionType] = useState();
|
|
19
|
+
const [subscribe, loading] = useRefresh();
|
|
20
|
+
const { isMdSize, isXsSize } = useMQ();
|
|
21
|
+
const getPadding = useCallback(() => {
|
|
22
|
+
if (isXsSize) {
|
|
23
|
+
return '0 8px 8px 8px';
|
|
24
|
+
}
|
|
25
|
+
if (isMdSize) {
|
|
26
|
+
return '0 32px 32px 32px';
|
|
27
|
+
}
|
|
28
|
+
return '0 90px 90px 90px';
|
|
29
|
+
}, [isMdSize, isXsSize]);
|
|
30
|
+
const styles = {
|
|
31
|
+
wrapper: css `
|
|
32
|
+
max-width: 1307px;
|
|
33
|
+
padding: ${getPadding()};
|
|
34
|
+
margin: 0 auto;
|
|
35
|
+
`,
|
|
36
|
+
title: css `
|
|
37
|
+
font-family: 'Uni-Neue-Black';
|
|
38
|
+
color: ${theme.palette.text.primary};
|
|
39
|
+
font-size: 24px;
|
|
40
|
+
margin-bottom: 16px;
|
|
41
|
+
`,
|
|
42
|
+
description: css `
|
|
43
|
+
font-family: 'Uni-Neue-Regular';
|
|
44
|
+
color: ${theme.palette.text.primary};
|
|
45
|
+
font-size: 1rem;
|
|
46
|
+
`,
|
|
47
|
+
};
|
|
48
|
+
const handleGetPaid = useCallback((item) => {
|
|
49
|
+
setModalIsOpen(true);
|
|
50
|
+
setSelectedItem(item);
|
|
51
|
+
setActionType('borrow');
|
|
52
|
+
}, []);
|
|
53
|
+
const handleGetPaidSuccess = useCallback((blockNumber) => {
|
|
54
|
+
const callbackFn = () => {
|
|
55
|
+
refreshReceivableStats();
|
|
56
|
+
if (getPaidSuccessCallback) {
|
|
57
|
+
getPaidSuccessCallback();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
if (blockNumber) {
|
|
61
|
+
subscribe(blockNumber, callbackFn);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
callbackFn();
|
|
65
|
+
}
|
|
66
|
+
}, [getPaidSuccessCallback, refreshReceivableStats, subscribe]);
|
|
67
|
+
const handlePayManually = useCallback((item) => {
|
|
68
|
+
setModalIsOpen(true);
|
|
69
|
+
setSelectedItem(item);
|
|
70
|
+
setActionType('payment');
|
|
71
|
+
}, []);
|
|
72
|
+
const handleClose = useCallback(() => {
|
|
73
|
+
setActionType(undefined);
|
|
74
|
+
setModalIsOpen(false);
|
|
75
|
+
}, []);
|
|
76
|
+
return {
|
|
77
|
+
accountStats,
|
|
78
|
+
accountHasActiveLoan,
|
|
79
|
+
actionType,
|
|
80
|
+
loading,
|
|
81
|
+
poolInfo,
|
|
82
|
+
modalIsOpen,
|
|
83
|
+
selectedItem,
|
|
84
|
+
styles,
|
|
85
|
+
handleGetPaid,
|
|
86
|
+
handleGetPaidSuccess,
|
|
87
|
+
handlePayManually,
|
|
88
|
+
handleClose,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
91
|
//# sourceMappingURL=useFactoring.js.map
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { useWeb3React } from '@web3-react/core';
|
|
2
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import ERC20_TRANSFERRABLE_ABI from '../abis/ERC20TransferableReceivable.json';
|
|
4
|
-
import { POOL_TYPE, PoolContractMap } from '../utils/pool';
|
|
5
|
-
import { useContract } from './useContract';
|
|
6
|
-
export function useInvoiceNFTContract(poolName) {
|
|
7
|
-
var _a, _b, _c;
|
|
8
|
-
const { chainId } = useWeb3React();
|
|
9
|
-
const InvoiceNFTAddress = chainId
|
|
10
|
-
? (_c = (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress
|
|
11
|
-
: undefined;
|
|
12
|
-
return useContract(InvoiceNFTAddress, ERC20_TRANSFERRABLE_ABI);
|
|
13
|
-
}
|
|
14
|
-
export function useNFTIds(poolName, account) {
|
|
15
|
-
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
16
|
-
const [NFTTokenIds, setNFTTokenIds] = useState();
|
|
17
|
-
const [refreshCount, setRefreshCount] = useState(0);
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
const fetchData = async () => {
|
|
20
|
-
if (invoiceNFTContract && account) {
|
|
21
|
-
const ids = await invoiceNFTContract.getTokenIds(account);
|
|
22
|
-
setNFTTokenIds(ids);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
fetchData();
|
|
26
|
-
}, [account, invoiceNFTContract, refreshCount]);
|
|
27
|
-
const refresh = useCallback(() => {
|
|
28
|
-
setRefreshCount((pre) => pre + 1);
|
|
29
|
-
}, []);
|
|
30
|
-
return [NFTTokenIds, refresh];
|
|
31
|
-
}
|
|
32
|
-
export function useInvoiceNFTMetadata(poolName) {
|
|
33
|
-
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
34
|
-
const getTokenMetadatas = useCallback(async (tokenIds) => {
|
|
35
|
-
if (!tokenIds || !invoiceNFTContract) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
const getTokenMetadata = async (tokenId) => {
|
|
39
|
-
const uri = await invoiceNFTContract.tokenURI(tokenId);
|
|
40
|
-
const uriDecoded = atob(uri.split(',')[1]);
|
|
41
|
-
try {
|
|
42
|
-
return JSON.parse(uriDecoded);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
throw new Error(`Access invoice NFT metadata error.`);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const result = await Promise.all(tokenIds.map((tokenId) => getTokenMetadata(tokenId)));
|
|
49
|
-
// eslint-disable-next-line consistent-return
|
|
50
|
-
return result;
|
|
51
|
-
}, [invoiceNFTContract]);
|
|
52
|
-
return { getTokenMetadatas };
|
|
53
|
-
}
|
|
54
|
-
export function useInvoiceNFTApproved(poolName) {
|
|
55
|
-
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
56
|
-
const getApprovedBy = useCallback(async (tokenId) => {
|
|
57
|
-
if (!tokenId || !invoiceNFTContract) {
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
const approvedAddr = await invoiceNFTContract.getApproved(tokenId);
|
|
61
|
-
return approvedAddr;
|
|
62
|
-
}, [invoiceNFTContract]);
|
|
63
|
-
return { getApprovedBy };
|
|
64
|
-
}
|
|
1
|
+
import { useWeb3React } from '@web3-react/core';
|
|
2
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import ERC20_TRANSFERRABLE_ABI from '../abis/ERC20TransferableReceivable.json';
|
|
4
|
+
import { POOL_TYPE, PoolContractMap } from '../utils/pool';
|
|
5
|
+
import { useContract } from './useContract';
|
|
6
|
+
export function useInvoiceNFTContract(poolName) {
|
|
7
|
+
var _a, _b, _c;
|
|
8
|
+
const { chainId } = useWeb3React();
|
|
9
|
+
const InvoiceNFTAddress = chainId
|
|
10
|
+
? (_c = (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress
|
|
11
|
+
: undefined;
|
|
12
|
+
return useContract(InvoiceNFTAddress, ERC20_TRANSFERRABLE_ABI);
|
|
13
|
+
}
|
|
14
|
+
export function useNFTIds(poolName, account) {
|
|
15
|
+
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
16
|
+
const [NFTTokenIds, setNFTTokenIds] = useState();
|
|
17
|
+
const [refreshCount, setRefreshCount] = useState(0);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const fetchData = async () => {
|
|
20
|
+
if (invoiceNFTContract && account) {
|
|
21
|
+
const ids = await invoiceNFTContract.getTokenIds(account);
|
|
22
|
+
setNFTTokenIds(ids);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
fetchData();
|
|
26
|
+
}, [account, invoiceNFTContract, refreshCount]);
|
|
27
|
+
const refresh = useCallback(() => {
|
|
28
|
+
setRefreshCount((pre) => pre + 1);
|
|
29
|
+
}, []);
|
|
30
|
+
return [NFTTokenIds, refresh];
|
|
31
|
+
}
|
|
32
|
+
export function useInvoiceNFTMetadata(poolName) {
|
|
33
|
+
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
34
|
+
const getTokenMetadatas = useCallback(async (tokenIds) => {
|
|
35
|
+
if (!tokenIds || !invoiceNFTContract) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const getTokenMetadata = async (tokenId) => {
|
|
39
|
+
const uri = await invoiceNFTContract.tokenURI(tokenId);
|
|
40
|
+
const uriDecoded = atob(uri.split(',')[1]);
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(uriDecoded);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
throw new Error(`Access invoice NFT metadata error.`);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const result = await Promise.all(tokenIds.map((tokenId) => getTokenMetadata(tokenId)));
|
|
49
|
+
// eslint-disable-next-line consistent-return
|
|
50
|
+
return result;
|
|
51
|
+
}, [invoiceNFTContract]);
|
|
52
|
+
return { getTokenMetadatas };
|
|
53
|
+
}
|
|
54
|
+
export function useInvoiceNFTApproved(poolName) {
|
|
55
|
+
const invoiceNFTContract = useInvoiceNFTContract(poolName);
|
|
56
|
+
const getApprovedBy = useCallback(async (tokenId) => {
|
|
57
|
+
if (!tokenId || !invoiceNFTContract) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const approvedAddr = await invoiceNFTContract.getApproved(tokenId);
|
|
61
|
+
return approvedAddr;
|
|
62
|
+
}, [invoiceNFTContract]);
|
|
63
|
+
return { getApprovedBy };
|
|
64
|
+
}
|
|
65
65
|
//# sourceMappingURL=useInvoiceNFTContract.js.map
|
package/dist/hooks/usePool.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { useWeb3React } from '@web3-react/core';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { useHistory } from 'react-router';
|
|
4
|
-
import { POOL_NAME, POOL_TYPE, PoolContractMap, } from '../utils/pool';
|
|
5
|
-
import { useParamsSearch } from './useParamsSearch';
|
|
6
|
-
export const usePoolName = () => {
|
|
7
|
-
const history = useHistory();
|
|
8
|
-
const { poolName } = useParamsSearch();
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!poolName || !Object.values(POOL_NAME).includes(poolName)) {
|
|
11
|
-
history.push('/');
|
|
12
|
-
}
|
|
13
|
-
}, [history, poolName]);
|
|
14
|
-
return poolName;
|
|
15
|
-
};
|
|
16
|
-
export const usePoolChainCheck = () => {
|
|
17
|
-
const history = useHistory();
|
|
18
|
-
const { chainId } = useWeb3React();
|
|
19
|
-
const { poolName } = useParamsSearch();
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (chainId && poolName) {
|
|
22
|
-
const config = PoolContractMap[chainId];
|
|
23
|
-
const poolTypes = Object.keys(POOL_TYPE);
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
if (poolTypes.every((poolType) => { var _a; return !((_a = config === null || config === void 0 ? void 0 : config[poolType]) === null || _a === void 0 ? void 0 : _a[poolName]); })) {
|
|
26
|
-
history.push('/');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}, [chainId, history, poolName]);
|
|
30
|
-
return poolName;
|
|
31
|
-
};
|
|
32
|
-
export const usePoolInfo = (poolName, poolType) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const { chainId } = useWeb3React();
|
|
35
|
-
const poolInfo = chainId
|
|
36
|
-
? (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[poolType]) === null || _b === void 0 ? void 0 : _b[poolName]
|
|
37
|
-
: undefined;
|
|
38
|
-
return poolInfo;
|
|
39
|
-
};
|
|
1
|
+
import { useWeb3React } from '@web3-react/core';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useHistory } from 'react-router';
|
|
4
|
+
import { POOL_NAME, POOL_TYPE, PoolContractMap, } from '../utils/pool';
|
|
5
|
+
import { useParamsSearch } from './useParamsSearch';
|
|
6
|
+
export const usePoolName = () => {
|
|
7
|
+
const history = useHistory();
|
|
8
|
+
const { poolName } = useParamsSearch();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!poolName || !Object.values(POOL_NAME).includes(poolName)) {
|
|
11
|
+
history.push('/');
|
|
12
|
+
}
|
|
13
|
+
}, [history, poolName]);
|
|
14
|
+
return poolName;
|
|
15
|
+
};
|
|
16
|
+
export const usePoolChainCheck = () => {
|
|
17
|
+
const history = useHistory();
|
|
18
|
+
const { chainId } = useWeb3React();
|
|
19
|
+
const { poolName } = useParamsSearch();
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (chainId && poolName) {
|
|
22
|
+
const config = PoolContractMap[chainId];
|
|
23
|
+
const poolTypes = Object.keys(POOL_TYPE);
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
if (poolTypes.every((poolType) => { var _a; return !((_a = config === null || config === void 0 ? void 0 : config[poolType]) === null || _a === void 0 ? void 0 : _a[poolName]); })) {
|
|
26
|
+
history.push('/');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}, [chainId, history, poolName]);
|
|
30
|
+
return poolName;
|
|
31
|
+
};
|
|
32
|
+
export const usePoolInfo = (poolName, poolType) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const { chainId } = useWeb3React();
|
|
35
|
+
const poolInfo = chainId
|
|
36
|
+
? (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[poolType]) === null || _b === void 0 ? void 0 : _b[poolName]
|
|
37
|
+
: undefined;
|
|
38
|
+
return poolInfo;
|
|
39
|
+
};
|
|
40
40
|
//# sourceMappingURL=usePool.js.map
|