@huma-finance/shared 0.0.35 → 0.0.37
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/dist/abis/BaseCreditPool.json +1179 -1179
- package/dist/abis/BaseFeeManager.json +480 -480
- package/dist/abis/BasePoolConfig.json +1364 -1364
- package/dist/abis/ERC20TransferableReceivable.json +648 -648
- package/dist/abis/HDT.json +512 -512
- package/dist/abis/IConstantFlowAgreementV1.json +890 -890
- package/dist/abis/ISuperfluid.json +1122 -1122
- package/dist/abis/InvoiceNFT.json +625 -625
- package/dist/abis/Multisend.json +26 -26
- package/dist/abis/RealWorldReceivable.json +823 -823
- package/dist/abis/ReceivableFactoringPool.json +1529 -1529
- package/dist/abis/StreamFactoringPool.json +1523 -1523
- package/dist/abis/StreamFeeManager.json +522 -522
- package/dist/abis/SuperfluidPoolProcessor.json +692 -692
- package/dist/abis/TestERC20.json +358 -358
- package/dist/abis/TradableStream.json +850 -850
- package/dist/abis/Transfer.json +24 -24
- package/dist/abis/TransferNFT.json +27 -27
- package/dist/abis/erc20.json +127 -117
- package/dist/abis/erc2612.json +132 -132
- package/dist/abis/erc721.json +673 -673
- package/dist/abis/index.js +3 -3
- package/dist/abis/types/BaseCreditPool.js +1 -1
- package/dist/abis/types/BaseFeeManager.js +1 -1
- package/dist/abis/types/BasePoolConfig.js +1 -1
- package/dist/abis/types/ERC20TransferableReceivable.js +1 -1
- package/dist/abis/types/Erc20.d.ts +184 -168
- package/dist/abis/types/Erc20.js +1 -1
- package/dist/abis/types/Erc2612.js +1 -1
- package/dist/abis/types/Erc721.js +1 -1
- package/dist/abis/types/HDT.js +1 -1
- package/dist/abis/types/IConstantFlowAgreementV1.js +1 -1
- package/dist/abis/types/ISuperfluid.js +1 -1
- package/dist/abis/types/InvoiceNFT.js +1 -1
- package/dist/abis/types/Multisend.js +1 -1
- package/dist/abis/types/RealWorldReceivable.js +1 -1
- package/dist/abis/types/ReceivableFactoringPool.js +1 -1
- package/dist/abis/types/StreamFactoringPool.js +1 -1
- package/dist/abis/types/StreamFeeManager.js +1 -1
- package/dist/abis/types/SuperfluidPoolProcessor.js +1 -1
- package/dist/abis/types/TestERC20.js +1 -1
- package/dist/abis/types/TradableStream.js +1 -1
- package/dist/abis/types/Transfer.js +1 -1
- package/dist/abis/types/TransferNFT.js +1 -1
- package/dist/abis/types/common.js +1 -1
- package/dist/abis/types/factories/BaseCreditPool__factory.js +1192 -1193
- package/dist/abis/types/factories/BaseCreditPool__factory.js.map +1 -1
- package/dist/abis/types/factories/BaseFeeManager__factory.js +493 -494
- package/dist/abis/types/factories/BaseFeeManager__factory.js.map +1 -1
- package/dist/abis/types/factories/BasePoolConfig__factory.js +1377 -1378
- package/dist/abis/types/factories/BasePoolConfig__factory.js.map +1 -1
- package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js +661 -662
- package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js.map +1 -1
- package/dist/abis/types/factories/Erc20__factory.d.ts +193 -175
- package/dist/abis/types/factories/Erc20__factory.js +259 -236
- package/dist/abis/types/factories/Erc20__factory.js.map +1 -1
- package/dist/abis/types/factories/Erc2612__factory.js +278 -279
- package/dist/abis/types/factories/Erc2612__factory.js.map +1 -1
- package/dist/abis/types/factories/Erc721__factory.js +686 -687
- package/dist/abis/types/factories/Erc721__factory.js.map +1 -1
- package/dist/abis/types/factories/HDT__factory.js +525 -526
- package/dist/abis/types/factories/HDT__factory.js.map +1 -1
- package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js +903 -904
- package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js.map +1 -1
- package/dist/abis/types/factories/ISuperfluid__factory.js +1135 -1136
- package/dist/abis/types/factories/ISuperfluid__factory.js.map +1 -1
- package/dist/abis/types/factories/InvoiceNFT__factory.js +638 -639
- package/dist/abis/types/factories/InvoiceNFT__factory.js.map +1 -1
- package/dist/abis/types/factories/Multisend__factory.js +39 -40
- package/dist/abis/types/factories/Multisend__factory.js.map +1 -1
- package/dist/abis/types/factories/RealWorldReceivable__factory.js +836 -837
- package/dist/abis/types/factories/RealWorldReceivable__factory.js.map +1 -1
- package/dist/abis/types/factories/ReceivableFactoringPool__factory.js +1542 -1543
- package/dist/abis/types/factories/ReceivableFactoringPool__factory.js.map +1 -1
- package/dist/abis/types/factories/StreamFactoringPool__factory.js +1536 -1537
- package/dist/abis/types/factories/StreamFactoringPool__factory.js.map +1 -1
- package/dist/abis/types/factories/StreamFeeManager__factory.js +535 -536
- package/dist/abis/types/factories/StreamFeeManager__factory.js.map +1 -1
- package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js +705 -706
- package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js.map +1 -1
- package/dist/abis/types/factories/TestERC20__factory.js +371 -372
- package/dist/abis/types/factories/TestERC20__factory.js.map +1 -1
- package/dist/abis/types/factories/TradableStream__factory.js +863 -864
- package/dist/abis/types/factories/TradableStream__factory.js.map +1 -1
- package/dist/abis/types/factories/TransferNFT__factory.js +40 -41
- package/dist/abis/types/factories/TransferNFT__factory.js.map +1 -1
- package/dist/abis/types/factories/Transfer__factory.js +37 -38
- package/dist/abis/types/factories/Transfer__factory.js.map +1 -1
- package/dist/abis/types/factories/index.js +24 -24
- package/dist/abis/types/index.js +22 -22
- package/dist/cjs/abis/erc20.json +10 -0
- package/dist/cjs/abis/types/Erc20.d.ts +17 -1
- package/dist/cjs/abis/types/factories/Erc20__factory.d.ts +18 -0
- package/dist/cjs/abis/types/factories/Erc20__factory.js +24 -0
- package/dist/cjs/abis/types/factories/Erc20__factory.js.map +1 -1
- package/dist/cjs/hooks/useCLPoolContract.d.ts +1 -0
- package/dist/cjs/hooks/usePoolContract.d.ts +1 -0
- package/dist/cjs/hooks/usePoolContract.js +3 -2
- package/dist/cjs/hooks/usePoolContract.js.map +1 -1
- package/dist/cjs/hooks/useRFPoolContract.d.ts +1 -0
- package/dist/cjs/hooks/web3/index.d.ts +1 -5
- package/dist/cjs/hooks/web3/index.js +61 -62
- package/dist/cjs/hooks/web3/index.js.map +1 -1
- package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.js +2 -0
- package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.js.map +1 -1
- package/dist/cjs/utils/chain.d.ts +4 -1
- package/dist/cjs/utils/chain.js +11 -1
- package/dist/cjs/utils/chain.js.map +1 -1
- package/dist/cjs/utils/credit.js +2 -0
- package/dist/cjs/utils/credit.js.map +1 -1
- package/dist/cjs/utils/jsonRpcEndpoints.js +5 -12
- package/dist/cjs/utils/jsonRpcEndpoints.js.map +1 -1
- package/dist/cjs/utils/notifi.d.ts +1 -0
- package/dist/cjs/utils/notifi.js +6 -3
- package/dist/cjs/utils/notifi.js.map +1 -1
- package/dist/cjs/utils/number.d.ts +1 -0
- package/dist/cjs/utils/number.js +16 -3
- package/dist/cjs/utils/number.js.map +1 -1
- package/dist/cjs/utils/pool.d.ts +3 -2
- package/dist/cjs/utils/pool.js +33 -75
- package/dist/cjs/utils/pool.js.map +1 -1
- package/dist/cjs/utils/realWorldReceivable.d.ts +2 -2
- package/dist/hooks/index.js +18 -18
- package/dist/hooks/useActiveRoute.js +7 -7
- package/dist/hooks/useAsyncError.js +22 -22
- package/dist/hooks/useCLPoolContract.d.ts +28 -27
- package/dist/hooks/useContractFunction.js +54 -54
- package/dist/hooks/useERC2612Permit/ethPermit/index.js +139 -139
- package/dist/hooks/useERC2612Permit/ethPermit/lib.js +21 -21
- package/dist/hooks/useERC2612Permit/ethPermit/rpc.js +96 -96
- package/dist/hooks/useERC2612Permit/index.js +31 -31
- package/dist/hooks/useForceRefresh.js +8 -8
- package/dist/hooks/useGetSizes.js +19 -19
- package/dist/hooks/useMQ.js +14 -14
- package/dist/hooks/useMount.js +8 -8
- package/dist/hooks/useParamsSearch.js +6 -6
- package/dist/hooks/usePoolContract.d.ts +74 -73
- package/dist/hooks/usePoolContract.js +3 -2
- package/dist/hooks/usePoolContract.js.map +1 -1
- package/dist/hooks/useRFPoolContract.d.ts +23 -22
- package/dist/hooks/useRefresh.js +47 -47
- package/dist/hooks/web3/index.d.ts +11 -15
- package/dist/hooks/web3/index.js +60 -61
- package/dist/hooks/web3/index.js.map +1 -1
- package/dist/hooks/web3/useConnectors.js +24 -24
- package/dist/hooks/web3/useJsonRpcUrlsMap.js +2 -0
- package/dist/hooks/web3/useJsonRpcUrlsMap.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/JsonRpcConnector.js +38 -38
- package/dist/utils/WalletConnect.js +49 -50
- package/dist/utils/WalletConnect.js.map +1 -1
- package/dist/utils/chain.d.ts +4 -1
- package/dist/utils/chain.js +9 -0
- package/dist/utils/chain.js.map +1 -1
- package/dist/utils/common.js +10 -10
- package/dist/utils/const.js +2 -2
- package/dist/utils/contractError.json +73 -73
- package/dist/utils/credit.js +37 -35
- package/dist/utils/credit.js.map +1 -1
- package/dist/utils/errors.js +39 -39
- package/dist/utils/jsonRpcEndpoints.js +5 -12
- package/dist/utils/jsonRpcEndpoints.js.map +1 -1
- package/dist/utils/notifi.d.ts +1 -0
- package/dist/utils/notifi.js +4 -2
- package/dist/utils/notifi.js.map +1 -1
- package/dist/utils/number.d.ts +6 -5
- package/dist/utils/number.js +14 -2
- package/dist/utils/number.js.map +1 -1
- package/dist/utils/pool.d.ts +3 -2
- package/dist/utils/pool.js +33 -75
- package/dist/utils/pool.js.map +1 -1
- package/dist/utils/realWorldReceivable.d.ts +2 -2
- package/dist/utils/request.js +38 -38
- package/dist/utils/scientificToDecimal.js +57 -57
- package/dist/utils/string.js +1 -1
- package/dist/utils/style.js +12 -12
- package/dist/utils/time.js +50 -50
- package/dist/utils/transaction.js +87 -87
- package/dist/utils/web3.js +34 -34
- package/package.json +5 -4
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import utf8 from 'utf8';
|
|
2
|
-
export const hexToUtf8 = (hex) => {
|
|
3
|
-
// if (!isHexStrict(hex))
|
|
4
|
-
// throw new Error('The parameter "'+ hex +'" must be a valid HEX string.');
|
|
5
|
-
let str = '';
|
|
6
|
-
let code = 0;
|
|
7
|
-
hex = hex.replace(/^0x/i, '');
|
|
8
|
-
// remove 00 padding from either side
|
|
9
|
-
hex = hex.replace(/^(?:00)*/, '');
|
|
10
|
-
hex = hex.split('').reverse().join('');
|
|
11
|
-
hex = hex.replace(/^(?:00)*/, '');
|
|
12
|
-
hex = hex.split('').reverse().join('');
|
|
13
|
-
const l = hex.length;
|
|
14
|
-
for (let i = 0; i < l; i += 2) {
|
|
15
|
-
code = parseInt(hex.substr(i, 2), 16);
|
|
16
|
-
// if (code !== 0) {
|
|
17
|
-
str += String.fromCharCode(code);
|
|
18
|
-
// }
|
|
19
|
-
}
|
|
20
|
-
return utf8.decode(str);
|
|
21
|
-
};
|
|
1
|
+
import utf8 from 'utf8';
|
|
2
|
+
export const hexToUtf8 = (hex) => {
|
|
3
|
+
// if (!isHexStrict(hex))
|
|
4
|
+
// throw new Error('The parameter "'+ hex +'" must be a valid HEX string.');
|
|
5
|
+
let str = '';
|
|
6
|
+
let code = 0;
|
|
7
|
+
hex = hex.replace(/^0x/i, '');
|
|
8
|
+
// remove 00 padding from either side
|
|
9
|
+
hex = hex.replace(/^(?:00)*/, '');
|
|
10
|
+
hex = hex.split('').reverse().join('');
|
|
11
|
+
hex = hex.replace(/^(?:00)*/, '');
|
|
12
|
+
hex = hex.split('').reverse().join('');
|
|
13
|
+
const l = hex.length;
|
|
14
|
+
for (let i = 0; i < l; i += 2) {
|
|
15
|
+
code = parseInt(hex.substr(i, 2), 16);
|
|
16
|
+
// if (code !== 0) {
|
|
17
|
+
str += String.fromCharCode(code);
|
|
18
|
+
// }
|
|
19
|
+
}
|
|
20
|
+
return utf8.decode(str);
|
|
21
|
+
};
|
|
22
22
|
//# sourceMappingURL=lib.js.map
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
import { __rest } from "tslib";
|
|
2
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
-
/* eslint-disable no-underscore-dangle */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const randomId = () => Math.floor(Math.random() * 10000000000);
|
|
6
|
-
export const send = (provider, method, params) => new Promise((resolve, reject) => {
|
|
7
|
-
const payload = {
|
|
8
|
-
id: randomId(),
|
|
9
|
-
method,
|
|
10
|
-
params,
|
|
11
|
-
};
|
|
12
|
-
const callback = (err, result) => {
|
|
13
|
-
if (err) {
|
|
14
|
-
reject(err);
|
|
15
|
-
}
|
|
16
|
-
else if (result.error) {
|
|
17
|
-
console.error(result.error);
|
|
18
|
-
reject(result.error);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
resolve(result.result);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
if (provider.getUncheckedSigner /* ethers provider */) {
|
|
25
|
-
provider
|
|
26
|
-
.send(method, params)
|
|
27
|
-
.then((r) => resolve(r))
|
|
28
|
-
.catch((e) => reject(e));
|
|
29
|
-
}
|
|
30
|
-
else if (provider.sendAsync) {
|
|
31
|
-
provider.sendAsync(payload, callback);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
provider.send(payload, callback).catch((error) => {
|
|
35
|
-
if (error.message ===
|
|
36
|
-
"Hardhat Network doesn't support JSON-RPC params sent as an object") {
|
|
37
|
-
provider
|
|
38
|
-
.send(method, params)
|
|
39
|
-
.then((r) => resolve(r))
|
|
40
|
-
.catch((e) => reject(e));
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const splitSignatureToRSV = (signature) => {
|
|
49
|
-
const r = `0x${signature.substring(2).substring(0, 64)}`;
|
|
50
|
-
const s = `0x${signature.substring(2).substring(64, 128)}`;
|
|
51
|
-
const v = parseInt(signature.substring(2).substring(128, 130), 16);
|
|
52
|
-
return { r, s, v };
|
|
53
|
-
};
|
|
54
|
-
const signWithEthers = async (signer, fromAddress, typeData) => {
|
|
55
|
-
const signerAddress = await signer.getAddress();
|
|
56
|
-
if (signerAddress.toLowerCase() !== fromAddress.toLowerCase()) {
|
|
57
|
-
throw new Error('Signer address does not match requested signing address');
|
|
58
|
-
}
|
|
59
|
-
const _a = typeData.types, { EIP712Domain: _unused } = _a, types = __rest(_a, ["EIP712Domain"]);
|
|
60
|
-
const rawSignature = await (signer.signTypedData
|
|
61
|
-
? signer.signTypedData(typeData.domain, types, typeData.message)
|
|
62
|
-
: signer._signTypedData(typeData.domain, types, typeData.message));
|
|
63
|
-
return splitSignatureToRSV(rawSignature);
|
|
64
|
-
};
|
|
65
|
-
export const signData = async (provider, fromAddress, typeData) => {
|
|
66
|
-
if (provider._signTypedData || provider.signTypedData) {
|
|
67
|
-
return signWithEthers(provider, fromAddress, typeData);
|
|
68
|
-
}
|
|
69
|
-
const typeDataString = typeof typeData === 'string' ? typeData : JSON.stringify(typeData);
|
|
70
|
-
const result = await send(provider, 'eth_signTypedData_v4', [
|
|
71
|
-
fromAddress,
|
|
72
|
-
typeDataString,
|
|
73
|
-
]).catch((error) => {
|
|
74
|
-
if (error.message === 'Method eth_signTypedData_v4 not supported.') {
|
|
75
|
-
return send(provider, 'eth_signTypedData', [fromAddress, typeData]);
|
|
76
|
-
}
|
|
77
|
-
throw error;
|
|
78
|
-
});
|
|
79
|
-
return {
|
|
80
|
-
r: result.slice(0, 66),
|
|
81
|
-
s: `0x${result.slice(66, 130)}`,
|
|
82
|
-
v: parseInt(result.slice(130, 132), 16),
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
let chainIdOverride = null;
|
|
86
|
-
export const setChainIdOverride = (id) => {
|
|
87
|
-
chainIdOverride = id;
|
|
88
|
-
};
|
|
89
|
-
export const getChainId = async (provider) => chainIdOverride || send(provider, 'eth_chainId');
|
|
90
|
-
export const call = (provider, to, data) => send(provider, 'eth_call', [
|
|
91
|
-
{
|
|
92
|
-
to,
|
|
93
|
-
data,
|
|
94
|
-
},
|
|
95
|
-
'latest',
|
|
96
|
-
]);
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
3
|
+
/* eslint-disable no-underscore-dangle */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
+
const randomId = () => Math.floor(Math.random() * 10000000000);
|
|
6
|
+
export const send = (provider, method, params) => new Promise((resolve, reject) => {
|
|
7
|
+
const payload = {
|
|
8
|
+
id: randomId(),
|
|
9
|
+
method,
|
|
10
|
+
params,
|
|
11
|
+
};
|
|
12
|
+
const callback = (err, result) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
reject(err);
|
|
15
|
+
}
|
|
16
|
+
else if (result.error) {
|
|
17
|
+
console.error(result.error);
|
|
18
|
+
reject(result.error);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
resolve(result.result);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
if (provider.getUncheckedSigner /* ethers provider */) {
|
|
25
|
+
provider
|
|
26
|
+
.send(method, params)
|
|
27
|
+
.then((r) => resolve(r))
|
|
28
|
+
.catch((e) => reject(e));
|
|
29
|
+
}
|
|
30
|
+
else if (provider.sendAsync) {
|
|
31
|
+
provider.sendAsync(payload, callback);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
provider.send(payload, callback).catch((error) => {
|
|
35
|
+
if (error.message ===
|
|
36
|
+
"Hardhat Network doesn't support JSON-RPC params sent as an object") {
|
|
37
|
+
provider
|
|
38
|
+
.send(method, params)
|
|
39
|
+
.then((r) => resolve(r))
|
|
40
|
+
.catch((e) => reject(e));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const splitSignatureToRSV = (signature) => {
|
|
49
|
+
const r = `0x${signature.substring(2).substring(0, 64)}`;
|
|
50
|
+
const s = `0x${signature.substring(2).substring(64, 128)}`;
|
|
51
|
+
const v = parseInt(signature.substring(2).substring(128, 130), 16);
|
|
52
|
+
return { r, s, v };
|
|
53
|
+
};
|
|
54
|
+
const signWithEthers = async (signer, fromAddress, typeData) => {
|
|
55
|
+
const signerAddress = await signer.getAddress();
|
|
56
|
+
if (signerAddress.toLowerCase() !== fromAddress.toLowerCase()) {
|
|
57
|
+
throw new Error('Signer address does not match requested signing address');
|
|
58
|
+
}
|
|
59
|
+
const _a = typeData.types, { EIP712Domain: _unused } = _a, types = __rest(_a, ["EIP712Domain"]);
|
|
60
|
+
const rawSignature = await (signer.signTypedData
|
|
61
|
+
? signer.signTypedData(typeData.domain, types, typeData.message)
|
|
62
|
+
: signer._signTypedData(typeData.domain, types, typeData.message));
|
|
63
|
+
return splitSignatureToRSV(rawSignature);
|
|
64
|
+
};
|
|
65
|
+
export const signData = async (provider, fromAddress, typeData) => {
|
|
66
|
+
if (provider._signTypedData || provider.signTypedData) {
|
|
67
|
+
return signWithEthers(provider, fromAddress, typeData);
|
|
68
|
+
}
|
|
69
|
+
const typeDataString = typeof typeData === 'string' ? typeData : JSON.stringify(typeData);
|
|
70
|
+
const result = await send(provider, 'eth_signTypedData_v4', [
|
|
71
|
+
fromAddress,
|
|
72
|
+
typeDataString,
|
|
73
|
+
]).catch((error) => {
|
|
74
|
+
if (error.message === 'Method eth_signTypedData_v4 not supported.') {
|
|
75
|
+
return send(provider, 'eth_signTypedData', [fromAddress, typeData]);
|
|
76
|
+
}
|
|
77
|
+
throw error;
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
r: result.slice(0, 66),
|
|
81
|
+
s: `0x${result.slice(66, 130)}`,
|
|
82
|
+
v: parseInt(result.slice(130, 132), 16),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
let chainIdOverride = null;
|
|
86
|
+
export const setChainIdOverride = (id) => {
|
|
87
|
+
chainIdOverride = id;
|
|
88
|
+
};
|
|
89
|
+
export const getChainId = async (provider) => chainIdOverride || send(provider, 'eth_chainId');
|
|
90
|
+
export const call = (provider, to, data) => send(provider, 'eth_call', [
|
|
91
|
+
{
|
|
92
|
+
to,
|
|
93
|
+
data,
|
|
94
|
+
},
|
|
95
|
+
'latest',
|
|
96
|
+
]);
|
|
97
97
|
//# sourceMappingURL=rpc.js.map
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { useWeb3React } from '@web3-react/core';
|
|
2
|
-
import { useCallback } from 'react';
|
|
3
|
-
import { signERC2612Permit, signTradableStreamPermit } from './ethPermit';
|
|
4
|
-
export const useERC2612Permit = () => {
|
|
5
|
-
const { account, provider, chainId } = useWeb3React();
|
|
6
|
-
const getDeadline = useCallback(async () => {
|
|
7
|
-
const FIVE_MINUTES = 5 * 60;
|
|
8
|
-
const latestBlock = await provider.getBlock('latest');
|
|
9
|
-
return latestBlock.timestamp + FIVE_MINUTES;
|
|
10
|
-
}, [provider]);
|
|
11
|
-
const getERC2612PermitMessage = useCallback(async (tokenAddress, spender, amount) => {
|
|
12
|
-
const deadline = await getDeadline();
|
|
13
|
-
const result = await signERC2612Permit(provider, tokenAddress, account, spender, amount, deadline);
|
|
14
|
-
return result;
|
|
15
|
-
}, [account, getDeadline, provider]);
|
|
16
|
-
const getTradableStreamPermitMessage = useCallback(async (NFT, receiver, tokenAddress, origin, owner, flowrate, durationInSeconds) => {
|
|
17
|
-
const domain = {
|
|
18
|
-
name: 'TradableStream',
|
|
19
|
-
version: '1',
|
|
20
|
-
chainId: chainId,
|
|
21
|
-
verifyingContract: NFT,
|
|
22
|
-
};
|
|
23
|
-
const deadline = await getDeadline();
|
|
24
|
-
const result = await signTradableStreamPermit(provider, domain, receiver, tokenAddress, origin, owner, flowrate, durationInSeconds, deadline);
|
|
25
|
-
return result;
|
|
26
|
-
}, [chainId, getDeadline, provider]);
|
|
27
|
-
return {
|
|
28
|
-
getERC2612PermitMessage,
|
|
29
|
-
getTradableStreamPermitMessage,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
1
|
+
import { useWeb3React } from '@web3-react/core';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { signERC2612Permit, signTradableStreamPermit } from './ethPermit';
|
|
4
|
+
export const useERC2612Permit = () => {
|
|
5
|
+
const { account, provider, chainId } = useWeb3React();
|
|
6
|
+
const getDeadline = useCallback(async () => {
|
|
7
|
+
const FIVE_MINUTES = 5 * 60;
|
|
8
|
+
const latestBlock = await provider.getBlock('latest');
|
|
9
|
+
return latestBlock.timestamp + FIVE_MINUTES;
|
|
10
|
+
}, [provider]);
|
|
11
|
+
const getERC2612PermitMessage = useCallback(async (tokenAddress, spender, amount) => {
|
|
12
|
+
const deadline = await getDeadline();
|
|
13
|
+
const result = await signERC2612Permit(provider, tokenAddress, account, spender, amount, deadline);
|
|
14
|
+
return result;
|
|
15
|
+
}, [account, getDeadline, provider]);
|
|
16
|
+
const getTradableStreamPermitMessage = useCallback(async (NFT, receiver, tokenAddress, origin, owner, flowrate, durationInSeconds) => {
|
|
17
|
+
const domain = {
|
|
18
|
+
name: 'TradableStream',
|
|
19
|
+
version: '1',
|
|
20
|
+
chainId: chainId,
|
|
21
|
+
verifyingContract: NFT,
|
|
22
|
+
};
|
|
23
|
+
const deadline = await getDeadline();
|
|
24
|
+
const result = await signTradableStreamPermit(provider, domain, receiver, tokenAddress, origin, owner, flowrate, durationInSeconds, deadline);
|
|
25
|
+
return result;
|
|
26
|
+
}, [chainId, getDeadline, provider]);
|
|
27
|
+
return {
|
|
28
|
+
getERC2612PermitMessage,
|
|
29
|
+
getTradableStreamPermitMessage,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
export const useForceRefresh = () => {
|
|
3
|
-
const [refreshCount, setRefreshCount] = useState(0);
|
|
4
|
-
const refresh = useCallback(() => {
|
|
5
|
-
setRefreshCount((pre) => pre + 1);
|
|
6
|
-
}, []);
|
|
7
|
-
return [refreshCount, refresh];
|
|
8
|
-
};
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export const useForceRefresh = () => {
|
|
3
|
+
const [refreshCount, setRefreshCount] = useState(0);
|
|
4
|
+
const refresh = useCallback(() => {
|
|
5
|
+
setRefreshCount((pre) => pre + 1);
|
|
6
|
+
}, []);
|
|
7
|
+
return [refreshCount, refresh];
|
|
8
|
+
};
|
|
9
9
|
//# sourceMappingURL=useForceRefresh.js.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { useMediaQuery } from '@mui/material';
|
|
2
|
-
export function useGetSizes(theme) {
|
|
3
|
-
const isMobileDisplay = useMediaQuery(theme.breakpoints.down('md'));
|
|
4
|
-
const isLgSize = useMediaQuery(theme.breakpoints.up('lg'));
|
|
5
|
-
const isBelowLgSize = useMediaQuery(theme.breakpoints.down('lg'));
|
|
6
|
-
const isXsSize = useMediaQuery(theme.breakpoints.down('sm'));
|
|
7
|
-
const isAboveSm = useMediaQuery(theme.breakpoints.up('sm'));
|
|
8
|
-
const isBelowMdSize = useMediaQuery(theme.breakpoints.down('md'));
|
|
9
|
-
const isMediumSize = isMobileDisplay && isAboveSm;
|
|
10
|
-
return {
|
|
11
|
-
isAboveSm,
|
|
12
|
-
isBelowLgSize,
|
|
13
|
-
isBelowMdSize,
|
|
14
|
-
isLgSize,
|
|
15
|
-
isMediumSize,
|
|
16
|
-
isMobileDisplay,
|
|
17
|
-
isXsSize,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
1
|
+
import { useMediaQuery } from '@mui/material';
|
|
2
|
+
export function useGetSizes(theme) {
|
|
3
|
+
const isMobileDisplay = useMediaQuery(theme.breakpoints.down('md'));
|
|
4
|
+
const isLgSize = useMediaQuery(theme.breakpoints.up('lg'));
|
|
5
|
+
const isBelowLgSize = useMediaQuery(theme.breakpoints.down('lg'));
|
|
6
|
+
const isXsSize = useMediaQuery(theme.breakpoints.down('sm'));
|
|
7
|
+
const isAboveSm = useMediaQuery(theme.breakpoints.up('sm'));
|
|
8
|
+
const isBelowMdSize = useMediaQuery(theme.breakpoints.down('md'));
|
|
9
|
+
const isMediumSize = isMobileDisplay && isAboveSm;
|
|
10
|
+
return {
|
|
11
|
+
isAboveSm,
|
|
12
|
+
isBelowLgSize,
|
|
13
|
+
isBelowMdSize,
|
|
14
|
+
isLgSize,
|
|
15
|
+
isMediumSize,
|
|
16
|
+
isMobileDisplay,
|
|
17
|
+
isXsSize,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
20
|
//# sourceMappingURL=useGetSizes.js.map
|
package/dist/hooks/useMQ.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useMediaQuery, useTheme } from '@mui/material';
|
|
2
|
-
export const useMQ = () => {
|
|
3
|
-
const theme = useTheme();
|
|
4
|
-
const isXsSize = useMediaQuery(theme.breakpoints.down('sm'));
|
|
5
|
-
const isSmSize = useMediaQuery(theme.breakpoints.down('md'));
|
|
6
|
-
const isMdSize = useMediaQuery(theme.breakpoints.down('lg'));
|
|
7
|
-
const isLgSize = useMediaQuery(theme.breakpoints.up('lg'));
|
|
8
|
-
return {
|
|
9
|
-
isXsSize,
|
|
10
|
-
isSmSize,
|
|
11
|
-
isMdSize,
|
|
12
|
-
isLgSize,
|
|
13
|
-
};
|
|
14
|
-
};
|
|
1
|
+
import { useMediaQuery, useTheme } from '@mui/material';
|
|
2
|
+
export const useMQ = () => {
|
|
3
|
+
const theme = useTheme();
|
|
4
|
+
const isXsSize = useMediaQuery(theme.breakpoints.down('sm'));
|
|
5
|
+
const isSmSize = useMediaQuery(theme.breakpoints.down('md'));
|
|
6
|
+
const isMdSize = useMediaQuery(theme.breakpoints.down('lg'));
|
|
7
|
+
const isLgSize = useMediaQuery(theme.breakpoints.up('lg'));
|
|
8
|
+
return {
|
|
9
|
+
isXsSize,
|
|
10
|
+
isSmSize,
|
|
11
|
+
isMdSize,
|
|
12
|
+
isLgSize,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
15
|
//# sourceMappingURL=useMQ.js.map
|
package/dist/hooks/useMount.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
export const isFunction = (value) => typeof value === 'function';
|
|
3
|
-
export const useMount = (fn) => {
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
fn === null || fn === void 0 ? void 0 : fn();
|
|
6
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7
|
-
}, []);
|
|
8
|
-
};
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export const isFunction = (value) => typeof value === 'function';
|
|
3
|
+
export const useMount = (fn) => {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
fn === null || fn === void 0 ? void 0 : fn();
|
|
6
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7
|
+
}, []);
|
|
8
|
+
};
|
|
9
9
|
//# sourceMappingURL=useMount.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useLocation } from 'react-router';
|
|
2
|
-
import * as queryString from 'query-string';
|
|
3
|
-
export const useParamsSearch = () => {
|
|
4
|
-
const location = useLocation();
|
|
5
|
-
return queryString.parse(location.search);
|
|
6
|
-
};
|
|
1
|
+
import { useLocation } from 'react-router';
|
|
2
|
+
import * as queryString from 'query-string';
|
|
3
|
+
export const useParamsSearch = () => {
|
|
4
|
+
const location = useLocation();
|
|
5
|
+
return queryString.parse(location.search);
|
|
6
|
+
};
|
|
7
7
|
//# sourceMappingURL=useParamsSearch.js.map
|
|
@@ -1,73 +1,74 @@
|
|
|
1
|
-
import { BigNumber, Contract } from 'ethers';
|
|
2
|
-
import { BaseFeeManager } from '../abis/types/BaseFeeManager';
|
|
3
|
-
import { POOL_NAME, POOL_TYPE } from '../utils/pool';
|
|
4
|
-
export type CreditRecordType = {
|
|
5
|
-
unbilledPrincipal: BigNumber;
|
|
6
|
-
dueDate: BigNumber;
|
|
7
|
-
correction: BigNumber;
|
|
8
|
-
totalDue: BigNumber;
|
|
9
|
-
feesAndInterestDue: BigNumber;
|
|
10
|
-
missedPeriods: number;
|
|
11
|
-
remainingPeriods: number;
|
|
12
|
-
state: number;
|
|
13
|
-
};
|
|
14
|
-
export type CreditRecordStaticType = {
|
|
15
|
-
creditLimit: BigNumber;
|
|
16
|
-
aprInBps: number;
|
|
17
|
-
intervalInDays: number;
|
|
18
|
-
defaultAmount: BigNumber;
|
|
19
|
-
};
|
|
20
|
-
export type ReceivableInfoType = {
|
|
21
|
-
receivableAsset: string;
|
|
22
|
-
receivableAmount: BigNumber;
|
|
23
|
-
receivableParam: BigNumber;
|
|
24
|
-
};
|
|
25
|
-
export type FeesType = {
|
|
26
|
-
_frontLoadingFeeFlat: BigNumber;
|
|
27
|
-
_frontLoadingFeeBps: BigNumber;
|
|
28
|
-
_lateFeeFlat: BigNumber;
|
|
29
|
-
_lateFeeBps: BigNumber;
|
|
30
|
-
_membershipFee: BigNumber;
|
|
31
|
-
};
|
|
32
|
-
export type AccountStats = {
|
|
33
|
-
creditRecord: CreditRecordType | undefined;
|
|
34
|
-
creditRecordStatic: CreditRecordStaticType | undefined;
|
|
35
|
-
receivableInfo: ReceivableInfoType | undefined;
|
|
36
|
-
isApproved: boolean;
|
|
37
|
-
payoffAmount: number;
|
|
38
|
-
principalAmount: number;
|
|
39
|
-
creditAvailableAmount: number;
|
|
40
|
-
totalDueAmount: number;
|
|
41
|
-
};
|
|
42
|
-
export declare function usePoolContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
43
|
-
export declare function useBaseConfigPoolContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
44
|
-
export declare function usePoolFeeManagerContract(poolName: POOL_NAME, poolType: POOL_TYPE): BaseFeeManager | null;
|
|
45
|
-
export declare function usePoolUnderlyingTokenContract(poolName: POOL_NAME, poolType: POOL_TYPE): import("../abis/types").Erc20 | null;
|
|
46
|
-
export declare function useHDTContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
47
|
-
export declare function usePoolNFTContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
48
|
-
export declare function usePoolUnderlyingToken(poolName: POOL_NAME, poolType: POOL_TYPE): Partial<{
|
|
49
|
-
address: string;
|
|
50
|
-
symbol: string;
|
|
51
|
-
decimals: number;
|
|
52
|
-
}>;
|
|
53
|
-
export declare function usePoolUnderlyingTokenBalance(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): BigNumber;
|
|
54
|
-
export declare function usePoolTotalValue(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
55
|
-
export declare function usePoolTotalSupply(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
56
|
-
export declare function usePoolBalance(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
57
|
-
export declare function useAccountStats(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): [AccountStats, () => void];
|
|
58
|
-
export declare function useCreditRecord(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): {
|
|
59
|
-
checkIsApproved: () => Promise<boolean>;
|
|
60
|
-
};
|
|
61
|
-
export declare function useFeeManager(poolName: POOL_NAME, poolType: POOL_TYPE): {
|
|
62
|
-
fees: FeesType | undefined;
|
|
63
|
-
getFeesCharged: (requestedLoan: number) => number;
|
|
64
|
-
};
|
|
65
|
-
export declare function usePoolAllowance(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): {
|
|
66
|
-
approved: boolean;
|
|
67
|
-
allowance: BigNumber;
|
|
68
|
-
loaded: boolean;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
export declare function
|
|
72
|
-
export declare function
|
|
73
|
-
export declare function
|
|
1
|
+
import { BigNumber, Contract } from 'ethers';
|
|
2
|
+
import { BaseFeeManager } from '../abis/types/BaseFeeManager';
|
|
3
|
+
import { POOL_NAME, POOL_TYPE } from '../utils/pool';
|
|
4
|
+
export type CreditRecordType = {
|
|
5
|
+
unbilledPrincipal: BigNumber;
|
|
6
|
+
dueDate: BigNumber;
|
|
7
|
+
correction: BigNumber;
|
|
8
|
+
totalDue: BigNumber;
|
|
9
|
+
feesAndInterestDue: BigNumber;
|
|
10
|
+
missedPeriods: number;
|
|
11
|
+
remainingPeriods: number;
|
|
12
|
+
state: number;
|
|
13
|
+
};
|
|
14
|
+
export type CreditRecordStaticType = {
|
|
15
|
+
creditLimit: BigNumber;
|
|
16
|
+
aprInBps: number;
|
|
17
|
+
intervalInDays: number;
|
|
18
|
+
defaultAmount: BigNumber;
|
|
19
|
+
};
|
|
20
|
+
export type ReceivableInfoType = {
|
|
21
|
+
receivableAsset: string;
|
|
22
|
+
receivableAmount: BigNumber;
|
|
23
|
+
receivableParam: BigNumber;
|
|
24
|
+
};
|
|
25
|
+
export type FeesType = {
|
|
26
|
+
_frontLoadingFeeFlat: BigNumber;
|
|
27
|
+
_frontLoadingFeeBps: BigNumber;
|
|
28
|
+
_lateFeeFlat: BigNumber;
|
|
29
|
+
_lateFeeBps: BigNumber;
|
|
30
|
+
_membershipFee: BigNumber;
|
|
31
|
+
};
|
|
32
|
+
export type AccountStats = {
|
|
33
|
+
creditRecord: CreditRecordType | undefined;
|
|
34
|
+
creditRecordStatic: CreditRecordStaticType | undefined;
|
|
35
|
+
receivableInfo: ReceivableInfoType | undefined;
|
|
36
|
+
isApproved: boolean;
|
|
37
|
+
payoffAmount: number;
|
|
38
|
+
principalAmount: number;
|
|
39
|
+
creditAvailableAmount: number;
|
|
40
|
+
totalDueAmount: number;
|
|
41
|
+
};
|
|
42
|
+
export declare function usePoolContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
43
|
+
export declare function useBaseConfigPoolContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
44
|
+
export declare function usePoolFeeManagerContract(poolName: POOL_NAME, poolType: POOL_TYPE): BaseFeeManager | null;
|
|
45
|
+
export declare function usePoolUnderlyingTokenContract(poolName: POOL_NAME, poolType: POOL_TYPE): import("../abis/types").Erc20 | null;
|
|
46
|
+
export declare function useHDTContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
47
|
+
export declare function usePoolNFTContract<T extends Contract>(poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
|
|
48
|
+
export declare function usePoolUnderlyingToken(poolName: POOL_NAME, poolType: POOL_TYPE): Partial<{
|
|
49
|
+
address: string;
|
|
50
|
+
symbol: string;
|
|
51
|
+
decimals: number;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function usePoolUnderlyingTokenBalance(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): BigNumber;
|
|
54
|
+
export declare function usePoolTotalValue(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
55
|
+
export declare function usePoolTotalSupply(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
56
|
+
export declare function usePoolBalance(poolName: POOL_NAME, poolType: POOL_TYPE): [BigNumber | undefined, () => void];
|
|
57
|
+
export declare function useAccountStats(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): [AccountStats, () => void];
|
|
58
|
+
export declare function useCreditRecord(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): {
|
|
59
|
+
checkIsApproved: () => Promise<boolean>;
|
|
60
|
+
};
|
|
61
|
+
export declare function useFeeManager(poolName: POOL_NAME, poolType: POOL_TYPE): {
|
|
62
|
+
fees: FeesType | undefined;
|
|
63
|
+
getFeesCharged: (requestedLoan: number) => number;
|
|
64
|
+
};
|
|
65
|
+
export declare function usePoolAllowance(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): {
|
|
66
|
+
approved: boolean;
|
|
67
|
+
allowance: BigNumber;
|
|
68
|
+
loaded: boolean;
|
|
69
|
+
refresh: () => void;
|
|
70
|
+
};
|
|
71
|
+
export declare function useLenderPosition(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): [BigNumber | undefined, () => void];
|
|
72
|
+
export declare function useLenderApproved(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): [boolean | undefined, () => void];
|
|
73
|
+
export declare function useWithdrawlLockoutInSeconds(poolName: POOL_NAME, poolType: POOL_TYPE): number | undefined;
|
|
74
|
+
export declare function useLastDepositTime(poolName: POOL_NAME, poolType: POOL_TYPE, account?: string): number | undefined;
|
|
@@ -205,6 +205,7 @@ export function usePoolAllowance(poolName, poolType, account) {
|
|
|
205
205
|
const [allowance, setAllowance] = useState(toBigNumber(0));
|
|
206
206
|
const [approved, setApproved] = useState(false);
|
|
207
207
|
const [loaded, setLoaded] = useState(false);
|
|
208
|
+
const [refreshCount, refresh] = useForceRefresh();
|
|
208
209
|
useEffect(() => {
|
|
209
210
|
const fetchData = async () => {
|
|
210
211
|
if (contract && poolInfo && account) {
|
|
@@ -215,8 +216,8 @@ export function usePoolAllowance(poolName, poolType, account) {
|
|
|
215
216
|
}
|
|
216
217
|
};
|
|
217
218
|
fetchData();
|
|
218
|
-
}, [account, contract, poolInfo]);
|
|
219
|
-
return { approved, allowance, loaded };
|
|
219
|
+
}, [account, contract, poolInfo, refreshCount]);
|
|
220
|
+
return { approved, allowance, loaded, refresh };
|
|
220
221
|
}
|
|
221
222
|
export function useLenderPosition(poolName, poolType, account) {
|
|
222
223
|
const poolInfo = usePoolInfo(poolName, poolType);
|