@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.
Files changed (180) hide show
  1. package/dist/abis/BaseCreditPool.json +1179 -1179
  2. package/dist/abis/BaseFeeManager.json +480 -480
  3. package/dist/abis/BasePoolConfig.json +1364 -1364
  4. package/dist/abis/ERC20TransferableReceivable.json +648 -648
  5. package/dist/abis/HDT.json +512 -512
  6. package/dist/abis/IConstantFlowAgreementV1.json +890 -890
  7. package/dist/abis/ISuperfluid.json +1122 -1122
  8. package/dist/abis/InvoiceNFT.json +625 -625
  9. package/dist/abis/Multisend.json +26 -26
  10. package/dist/abis/RealWorldReceivable.json +823 -823
  11. package/dist/abis/ReceivableFactoringPool.json +1529 -1529
  12. package/dist/abis/StreamFactoringPool.json +1523 -1523
  13. package/dist/abis/StreamFeeManager.json +522 -522
  14. package/dist/abis/SuperfluidPoolProcessor.json +692 -692
  15. package/dist/abis/TestERC20.json +358 -358
  16. package/dist/abis/TradableStream.json +850 -850
  17. package/dist/abis/Transfer.json +24 -24
  18. package/dist/abis/TransferNFT.json +27 -27
  19. package/dist/abis/erc20.json +127 -117
  20. package/dist/abis/erc2612.json +132 -132
  21. package/dist/abis/erc721.json +673 -673
  22. package/dist/abis/index.js +3 -3
  23. package/dist/abis/types/BaseCreditPool.js +1 -1
  24. package/dist/abis/types/BaseFeeManager.js +1 -1
  25. package/dist/abis/types/BasePoolConfig.js +1 -1
  26. package/dist/abis/types/ERC20TransferableReceivable.js +1 -1
  27. package/dist/abis/types/Erc20.d.ts +184 -168
  28. package/dist/abis/types/Erc20.js +1 -1
  29. package/dist/abis/types/Erc2612.js +1 -1
  30. package/dist/abis/types/Erc721.js +1 -1
  31. package/dist/abis/types/HDT.js +1 -1
  32. package/dist/abis/types/IConstantFlowAgreementV1.js +1 -1
  33. package/dist/abis/types/ISuperfluid.js +1 -1
  34. package/dist/abis/types/InvoiceNFT.js +1 -1
  35. package/dist/abis/types/Multisend.js +1 -1
  36. package/dist/abis/types/RealWorldReceivable.js +1 -1
  37. package/dist/abis/types/ReceivableFactoringPool.js +1 -1
  38. package/dist/abis/types/StreamFactoringPool.js +1 -1
  39. package/dist/abis/types/StreamFeeManager.js +1 -1
  40. package/dist/abis/types/SuperfluidPoolProcessor.js +1 -1
  41. package/dist/abis/types/TestERC20.js +1 -1
  42. package/dist/abis/types/TradableStream.js +1 -1
  43. package/dist/abis/types/Transfer.js +1 -1
  44. package/dist/abis/types/TransferNFT.js +1 -1
  45. package/dist/abis/types/common.js +1 -1
  46. package/dist/abis/types/factories/BaseCreditPool__factory.js +1192 -1193
  47. package/dist/abis/types/factories/BaseCreditPool__factory.js.map +1 -1
  48. package/dist/abis/types/factories/BaseFeeManager__factory.js +493 -494
  49. package/dist/abis/types/factories/BaseFeeManager__factory.js.map +1 -1
  50. package/dist/abis/types/factories/BasePoolConfig__factory.js +1377 -1378
  51. package/dist/abis/types/factories/BasePoolConfig__factory.js.map +1 -1
  52. package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js +661 -662
  53. package/dist/abis/types/factories/ERC20TransferableReceivable__factory.js.map +1 -1
  54. package/dist/abis/types/factories/Erc20__factory.d.ts +193 -175
  55. package/dist/abis/types/factories/Erc20__factory.js +259 -236
  56. package/dist/abis/types/factories/Erc20__factory.js.map +1 -1
  57. package/dist/abis/types/factories/Erc2612__factory.js +278 -279
  58. package/dist/abis/types/factories/Erc2612__factory.js.map +1 -1
  59. package/dist/abis/types/factories/Erc721__factory.js +686 -687
  60. package/dist/abis/types/factories/Erc721__factory.js.map +1 -1
  61. package/dist/abis/types/factories/HDT__factory.js +525 -526
  62. package/dist/abis/types/factories/HDT__factory.js.map +1 -1
  63. package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js +903 -904
  64. package/dist/abis/types/factories/IConstantFlowAgreementV1__factory.js.map +1 -1
  65. package/dist/abis/types/factories/ISuperfluid__factory.js +1135 -1136
  66. package/dist/abis/types/factories/ISuperfluid__factory.js.map +1 -1
  67. package/dist/abis/types/factories/InvoiceNFT__factory.js +638 -639
  68. package/dist/abis/types/factories/InvoiceNFT__factory.js.map +1 -1
  69. package/dist/abis/types/factories/Multisend__factory.js +39 -40
  70. package/dist/abis/types/factories/Multisend__factory.js.map +1 -1
  71. package/dist/abis/types/factories/RealWorldReceivable__factory.js +836 -837
  72. package/dist/abis/types/factories/RealWorldReceivable__factory.js.map +1 -1
  73. package/dist/abis/types/factories/ReceivableFactoringPool__factory.js +1542 -1543
  74. package/dist/abis/types/factories/ReceivableFactoringPool__factory.js.map +1 -1
  75. package/dist/abis/types/factories/StreamFactoringPool__factory.js +1536 -1537
  76. package/dist/abis/types/factories/StreamFactoringPool__factory.js.map +1 -1
  77. package/dist/abis/types/factories/StreamFeeManager__factory.js +535 -536
  78. package/dist/abis/types/factories/StreamFeeManager__factory.js.map +1 -1
  79. package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js +705 -706
  80. package/dist/abis/types/factories/SuperfluidPoolProcessor__factory.js.map +1 -1
  81. package/dist/abis/types/factories/TestERC20__factory.js +371 -372
  82. package/dist/abis/types/factories/TestERC20__factory.js.map +1 -1
  83. package/dist/abis/types/factories/TradableStream__factory.js +863 -864
  84. package/dist/abis/types/factories/TradableStream__factory.js.map +1 -1
  85. package/dist/abis/types/factories/TransferNFT__factory.js +40 -41
  86. package/dist/abis/types/factories/TransferNFT__factory.js.map +1 -1
  87. package/dist/abis/types/factories/Transfer__factory.js +37 -38
  88. package/dist/abis/types/factories/Transfer__factory.js.map +1 -1
  89. package/dist/abis/types/factories/index.js +24 -24
  90. package/dist/abis/types/index.js +22 -22
  91. package/dist/cjs/abis/erc20.json +10 -0
  92. package/dist/cjs/abis/types/Erc20.d.ts +17 -1
  93. package/dist/cjs/abis/types/factories/Erc20__factory.d.ts +18 -0
  94. package/dist/cjs/abis/types/factories/Erc20__factory.js +24 -0
  95. package/dist/cjs/abis/types/factories/Erc20__factory.js.map +1 -1
  96. package/dist/cjs/hooks/useCLPoolContract.d.ts +1 -0
  97. package/dist/cjs/hooks/usePoolContract.d.ts +1 -0
  98. package/dist/cjs/hooks/usePoolContract.js +3 -2
  99. package/dist/cjs/hooks/usePoolContract.js.map +1 -1
  100. package/dist/cjs/hooks/useRFPoolContract.d.ts +1 -0
  101. package/dist/cjs/hooks/web3/index.d.ts +1 -5
  102. package/dist/cjs/hooks/web3/index.js +61 -62
  103. package/dist/cjs/hooks/web3/index.js.map +1 -1
  104. package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.js +2 -0
  105. package/dist/cjs/hooks/web3/useJsonRpcUrlsMap.js.map +1 -1
  106. package/dist/cjs/utils/chain.d.ts +4 -1
  107. package/dist/cjs/utils/chain.js +11 -1
  108. package/dist/cjs/utils/chain.js.map +1 -1
  109. package/dist/cjs/utils/credit.js +2 -0
  110. package/dist/cjs/utils/credit.js.map +1 -1
  111. package/dist/cjs/utils/jsonRpcEndpoints.js +5 -12
  112. package/dist/cjs/utils/jsonRpcEndpoints.js.map +1 -1
  113. package/dist/cjs/utils/notifi.d.ts +1 -0
  114. package/dist/cjs/utils/notifi.js +6 -3
  115. package/dist/cjs/utils/notifi.js.map +1 -1
  116. package/dist/cjs/utils/number.d.ts +1 -0
  117. package/dist/cjs/utils/number.js +16 -3
  118. package/dist/cjs/utils/number.js.map +1 -1
  119. package/dist/cjs/utils/pool.d.ts +3 -2
  120. package/dist/cjs/utils/pool.js +33 -75
  121. package/dist/cjs/utils/pool.js.map +1 -1
  122. package/dist/cjs/utils/realWorldReceivable.d.ts +2 -2
  123. package/dist/hooks/index.js +18 -18
  124. package/dist/hooks/useActiveRoute.js +7 -7
  125. package/dist/hooks/useAsyncError.js +22 -22
  126. package/dist/hooks/useCLPoolContract.d.ts +28 -27
  127. package/dist/hooks/useContractFunction.js +54 -54
  128. package/dist/hooks/useERC2612Permit/ethPermit/index.js +139 -139
  129. package/dist/hooks/useERC2612Permit/ethPermit/lib.js +21 -21
  130. package/dist/hooks/useERC2612Permit/ethPermit/rpc.js +96 -96
  131. package/dist/hooks/useERC2612Permit/index.js +31 -31
  132. package/dist/hooks/useForceRefresh.js +8 -8
  133. package/dist/hooks/useGetSizes.js +19 -19
  134. package/dist/hooks/useMQ.js +14 -14
  135. package/dist/hooks/useMount.js +8 -8
  136. package/dist/hooks/useParamsSearch.js +6 -6
  137. package/dist/hooks/usePoolContract.d.ts +74 -73
  138. package/dist/hooks/usePoolContract.js +3 -2
  139. package/dist/hooks/usePoolContract.js.map +1 -1
  140. package/dist/hooks/useRFPoolContract.d.ts +23 -22
  141. package/dist/hooks/useRefresh.js +47 -47
  142. package/dist/hooks/web3/index.d.ts +11 -15
  143. package/dist/hooks/web3/index.js +60 -61
  144. package/dist/hooks/web3/index.js.map +1 -1
  145. package/dist/hooks/web3/useConnectors.js +24 -24
  146. package/dist/hooks/web3/useJsonRpcUrlsMap.js +2 -0
  147. package/dist/hooks/web3/useJsonRpcUrlsMap.js.map +1 -1
  148. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  149. package/dist/utils/JsonRpcConnector.js +38 -38
  150. package/dist/utils/WalletConnect.js +49 -50
  151. package/dist/utils/WalletConnect.js.map +1 -1
  152. package/dist/utils/chain.d.ts +4 -1
  153. package/dist/utils/chain.js +9 -0
  154. package/dist/utils/chain.js.map +1 -1
  155. package/dist/utils/common.js +10 -10
  156. package/dist/utils/const.js +2 -2
  157. package/dist/utils/contractError.json +73 -73
  158. package/dist/utils/credit.js +37 -35
  159. package/dist/utils/credit.js.map +1 -1
  160. package/dist/utils/errors.js +39 -39
  161. package/dist/utils/jsonRpcEndpoints.js +5 -12
  162. package/dist/utils/jsonRpcEndpoints.js.map +1 -1
  163. package/dist/utils/notifi.d.ts +1 -0
  164. package/dist/utils/notifi.js +4 -2
  165. package/dist/utils/notifi.js.map +1 -1
  166. package/dist/utils/number.d.ts +6 -5
  167. package/dist/utils/number.js +14 -2
  168. package/dist/utils/number.js.map +1 -1
  169. package/dist/utils/pool.d.ts +3 -2
  170. package/dist/utils/pool.js +33 -75
  171. package/dist/utils/pool.js.map +1 -1
  172. package/dist/utils/realWorldReceivable.d.ts +2 -2
  173. package/dist/utils/request.js +38 -38
  174. package/dist/utils/scientificToDecimal.js +57 -57
  175. package/dist/utils/string.js +1 -1
  176. package/dist/utils/style.js +12 -12
  177. package/dist/utils/time.js +50 -50
  178. package/dist/utils/transaction.js +87 -87
  179. package/dist/utils/web3.js +34 -34
  180. package/package.json +5 -4
@@ -1,51 +1,51 @@
1
- import moment from 'moment';
2
- import { isEmpty } from './common';
3
- export const MILLISECONDS = 1000;
4
- export const DAY_SECONDS = 24 * 60 * 60;
5
- export const TIME_FORMAT_LL = 'll';
6
- export const timestampToStr = (timestamp, format) => moment.unix(timestamp).format(format);
7
- /**
8
- * Convert timestamp to format ll: Nov 12, 2022
9
- *
10
- * @param timestamp
11
- * @returns format ll: Nov 12, 2022
12
- */
13
- export const timestampToLL = (timestamp) => {
14
- if (!timestamp) {
15
- return '';
16
- }
17
- return timestampToStr(timestamp, TIME_FORMAT_LL);
18
- };
19
- /**
20
- * get unix time in seconds
21
- *
22
- * @returns timestamp
23
- */
24
- export const getUnixTimestamp = (date) => {
25
- if (date) {
26
- return date.unix();
27
- }
28
- return Math.floor(Date.now() / MILLISECONDS);
29
- };
30
- export const secondsToDays = (seconds) => {
31
- if (isEmpty(seconds)) {
32
- return 0;
33
- }
34
- try {
35
- return seconds / DAY_SECONDS;
36
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
- }
38
- catch (error) {
39
- return 0;
40
- }
41
- };
42
- // eslint-disable-next-line no-promise-executor-return
43
- const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
44
- export const timeUtil = {
45
- timestampToStr,
46
- timestampToLL,
47
- getUnixTimestamp,
48
- secondsToDays,
49
- sleep,
50
- };
1
+ import moment from 'moment';
2
+ import { isEmpty } from './common';
3
+ export const MILLISECONDS = 1000;
4
+ export const DAY_SECONDS = 24 * 60 * 60;
5
+ export const TIME_FORMAT_LL = 'll';
6
+ export const timestampToStr = (timestamp, format) => moment.unix(timestamp).format(format);
7
+ /**
8
+ * Convert timestamp to format ll: Nov 12, 2022
9
+ *
10
+ * @param timestamp
11
+ * @returns format ll: Nov 12, 2022
12
+ */
13
+ export const timestampToLL = (timestamp) => {
14
+ if (!timestamp) {
15
+ return '';
16
+ }
17
+ return timestampToStr(timestamp, TIME_FORMAT_LL);
18
+ };
19
+ /**
20
+ * get unix time in seconds
21
+ *
22
+ * @returns timestamp
23
+ */
24
+ export const getUnixTimestamp = (date) => {
25
+ if (date) {
26
+ return date.unix();
27
+ }
28
+ return Math.floor(Date.now() / MILLISECONDS);
29
+ };
30
+ export const secondsToDays = (seconds) => {
31
+ if (isEmpty(seconds)) {
32
+ return 0;
33
+ }
34
+ try {
35
+ return seconds / DAY_SECONDS;
36
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
37
+ }
38
+ catch (error) {
39
+ return 0;
40
+ }
41
+ };
42
+ // eslint-disable-next-line no-promise-executor-return
43
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
44
+ export const timeUtil = {
45
+ timestampToStr,
46
+ timestampToLL,
47
+ getUnixTimestamp,
48
+ secondsToDays,
49
+ sleep,
50
+ };
51
51
  //# sourceMappingURL=time.js.map
@@ -1,88 +1,88 @@
1
- import { ethers } from 'ethers';
2
- import TxErrors from './contractError.json';
3
- import { capitalizeFirstLetter } from './string';
4
- export var TxStateType;
5
- (function (TxStateType) {
6
- TxStateType["Success"] = "Success";
7
- TxStateType["Denied"] = "Denied";
8
- TxStateType["Invalid"] = "Invalid";
9
- TxStateType["Failed"] = "Failed";
10
- TxStateType["New"] = "New";
11
- TxStateType["GasEstimating"] = "GasEstimating";
12
- TxStateType["Signing"] = "Signing";
13
- TxStateType["Confirming"] = "Confirming";
14
- })(TxStateType || (TxStateType = {}));
15
- export const isTxFailed = (txState) => [TxStateType.Denied, TxStateType.Invalid, TxStateType.Failed].includes(txState);
16
- export const increaseGasLimit = (estimatedGasLimit) => {
17
- if (!estimatedGasLimit || Number.isNaN(estimatedGasLimit.toNumber())) {
18
- console.log('estimatedGasLimit', estimatedGasLimit);
19
- throw new Error('Estimated gas limited error.');
20
- }
21
- return estimatedGasLimit.mul(150).div(100);
22
- };
23
- const parseErrorMessageToUserFriendlyMessage = (message) => capitalizeFirstLetter(message
24
- .replace('()', '')
25
- .split(/(?=[A-Z])/)
26
- .join(' ')
27
- .toLowerCase());
28
- const findContractErrorMessage = (code) => {
29
- let reason = null;
30
- Object.keys(TxErrors).forEach((key) => {
31
- // @ts-ignore
32
- if (code.toLowerCase() === TxErrors[key].toLowerCase()) {
33
- reason = parseErrorMessageToUserFriendlyMessage(key);
34
- }
35
- });
36
- return reason;
37
- };
38
- export const getTransactionErrorFromHash = async (provider, txHash) => {
39
- const commonErrorMessage = 'Send transaction failed';
40
- try {
41
- const originTx = await provider.getTransaction(txHash);
42
- const { from, to, data, gasLimit, blockNumber } = originTx;
43
- // Only provide necessary params to get the tx return which can avoid unexpected error
44
- const tx = { from, to, data, gasLimit };
45
- const code = await provider.call(tx, blockNumber);
46
- const reason = findContractErrorMessage(code);
47
- return reason !== null && reason !== void 0 ? reason : commonErrorMessage;
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- }
50
- catch (error) {
51
- if (!error.data) {
52
- console.error(error);
53
- return commonErrorMessage;
54
- }
55
- const code = error.data.replace('Reverted ', '');
56
- const reason = ethers.utils.toUtf8String(`0x${code.substr(138)}`);
57
- return reason;
58
- }
59
- };
60
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
- export const getTransactionErrorFromError = (e) => {
62
- var _a, _b, _c, _d, _e;
63
- const errorCode = ((_c = (_b = (_a = e.error) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.originalError) === null || _c === void 0 ? void 0 : _c.data) || ((_e = (_d = e.error) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.data);
64
- if (errorCode) {
65
- const contractErrorMessage = findContractErrorMessage(errorCode);
66
- if (contractErrorMessage) {
67
- return contractErrorMessage;
68
- }
69
- }
70
- return null;
71
- };
72
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- export const decodeLogs = (txlogs, abi) => {
74
- const result = [];
75
- const iface = new ethers.utils.Interface(abi);
76
- // eslint-disable-next-line no-restricted-syntax
77
- for (const log of txlogs) {
78
- try {
79
- result.push(iface.parseLog(log));
80
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
- }
82
- catch (error) {
83
- console.error(error);
84
- }
85
- }
86
- return result;
87
- };
1
+ import { ethers } from 'ethers';
2
+ import TxErrors from './contractError.json';
3
+ import { capitalizeFirstLetter } from './string';
4
+ export var TxStateType;
5
+ (function (TxStateType) {
6
+ TxStateType["Success"] = "Success";
7
+ TxStateType["Denied"] = "Denied";
8
+ TxStateType["Invalid"] = "Invalid";
9
+ TxStateType["Failed"] = "Failed";
10
+ TxStateType["New"] = "New";
11
+ TxStateType["GasEstimating"] = "GasEstimating";
12
+ TxStateType["Signing"] = "Signing";
13
+ TxStateType["Confirming"] = "Confirming";
14
+ })(TxStateType || (TxStateType = {}));
15
+ export const isTxFailed = (txState) => [TxStateType.Denied, TxStateType.Invalid, TxStateType.Failed].includes(txState);
16
+ export const increaseGasLimit = (estimatedGasLimit) => {
17
+ if (!estimatedGasLimit || Number.isNaN(estimatedGasLimit.toNumber())) {
18
+ console.log('estimatedGasLimit', estimatedGasLimit);
19
+ throw new Error('Estimated gas limited error.');
20
+ }
21
+ return estimatedGasLimit.mul(150).div(100);
22
+ };
23
+ const parseErrorMessageToUserFriendlyMessage = (message) => capitalizeFirstLetter(message
24
+ .replace('()', '')
25
+ .split(/(?=[A-Z])/)
26
+ .join(' ')
27
+ .toLowerCase());
28
+ const findContractErrorMessage = (code) => {
29
+ let reason = null;
30
+ Object.keys(TxErrors).forEach((key) => {
31
+ // @ts-ignore
32
+ if (code.toLowerCase() === TxErrors[key].toLowerCase()) {
33
+ reason = parseErrorMessageToUserFriendlyMessage(key);
34
+ }
35
+ });
36
+ return reason;
37
+ };
38
+ export const getTransactionErrorFromHash = async (provider, txHash) => {
39
+ const commonErrorMessage = 'Send transaction failed';
40
+ try {
41
+ const originTx = await provider.getTransaction(txHash);
42
+ const { from, to, data, gasLimit, blockNumber } = originTx;
43
+ // Only provide necessary params to get the tx return which can avoid unexpected error
44
+ const tx = { from, to, data, gasLimit };
45
+ const code = await provider.call(tx, blockNumber);
46
+ const reason = findContractErrorMessage(code);
47
+ return reason !== null && reason !== void 0 ? reason : commonErrorMessage;
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ }
50
+ catch (error) {
51
+ if (!error.data) {
52
+ console.error(error);
53
+ return commonErrorMessage;
54
+ }
55
+ const code = error.data.replace('Reverted ', '');
56
+ const reason = ethers.utils.toUtf8String(`0x${code.substr(138)}`);
57
+ return reason;
58
+ }
59
+ };
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ export const getTransactionErrorFromError = (e) => {
62
+ var _a, _b, _c, _d, _e;
63
+ const errorCode = ((_c = (_b = (_a = e.error) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.originalError) === null || _c === void 0 ? void 0 : _c.data) || ((_e = (_d = e.error) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.data);
64
+ if (errorCode) {
65
+ const contractErrorMessage = findContractErrorMessage(errorCode);
66
+ if (contractErrorMessage) {
67
+ return contractErrorMessage;
68
+ }
69
+ }
70
+ return null;
71
+ };
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ export const decodeLogs = (txlogs, abi) => {
74
+ const result = [];
75
+ const iface = new ethers.utils.Interface(abi);
76
+ // eslint-disable-next-line no-restricted-syntax
77
+ for (const log of txlogs) {
78
+ try {
79
+ result.push(iface.parseLog(log));
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ }
82
+ catch (error) {
83
+ console.error(error);
84
+ }
85
+ }
86
+ return result;
87
+ };
88
88
  //# sourceMappingURL=transaction.js.map
@@ -1,35 +1,35 @@
1
- import { Contract } from '@ethersproject/contracts';
2
- import { AddressZero } from '@ethersproject/constants';
3
- import { getAddress } from '@ethersproject/address';
4
- // returns the checksummed address if the address is valid, otherwise returns false
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- export function isAddress(value) {
7
- try {
8
- // Alphabetical letters must be made lowercase for getAddress to work.
9
- // See documentation here: https://docs.ethers.io/v5/api/utils/address/
10
- return getAddress(value.toLowerCase());
11
- }
12
- catch (_a) {
13
- return false;
14
- }
15
- }
16
- // account is not optional
17
- function getSigner(provider, account) {
18
- return provider.getSigner(account).connectUnchecked();
19
- }
20
- // account is optional
21
- function getProviderOrSigner(provider, account) {
22
- return account ? getSigner(provider, account) : provider;
23
- }
24
- // account is optional
25
- export function getContract(address,
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- ABI, provider, account) {
28
- if (!isAddress(address) || address === AddressZero) {
29
- throw Error(`Invalid 'address' parameter '${address}'.`);
30
- }
31
- return new Contract(address, ABI,
32
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- getProviderOrSigner(provider, account));
34
- }
1
+ import { Contract } from '@ethersproject/contracts';
2
+ import { AddressZero } from '@ethersproject/constants';
3
+ import { getAddress } from '@ethersproject/address';
4
+ // returns the checksummed address if the address is valid, otherwise returns false
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ export function isAddress(value) {
7
+ try {
8
+ // Alphabetical letters must be made lowercase for getAddress to work.
9
+ // See documentation here: https://docs.ethers.io/v5/api/utils/address/
10
+ return getAddress(value.toLowerCase());
11
+ }
12
+ catch (_a) {
13
+ return false;
14
+ }
15
+ }
16
+ // account is not optional
17
+ function getSigner(provider, account) {
18
+ return provider.getSigner(account).connectUnchecked();
19
+ }
20
+ // account is optional
21
+ function getProviderOrSigner(provider, account) {
22
+ return account ? getSigner(provider, account) : provider;
23
+ }
24
+ // account is optional
25
+ export function getContract(address,
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ ABI, provider, account) {
28
+ if (!isAddress(address) || address === AddressZero) {
29
+ throw Error(`Invalid 'address' parameter '${address}'.`);
30
+ }
31
+ return new Contract(address, ABI,
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ getProviderOrSigner(provider, account));
34
+ }
35
35
  //# sourceMappingURL=web3.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/shared",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/index.js",
@@ -12,8 +12,9 @@
12
12
  "postbuild": "copyfiles -u 1 ./src/components/icons/*.svg dist",
13
13
  "build": "tsc --project ./tsconfig.build.json && tsc --project ./tsconfig.cjs.json",
14
14
  "contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"",
15
+ "lint": "eslint --max-warnings=0 \"src/**/*.{js,ts,tsx,graphql}\" \"tests/**/*.{js,ts,tsx,graphql}\"",
15
16
  "lint-staged": "lint-staged",
16
- "prettier": "prettier --write \"src/**/*.{js,ts,tsx,graphql}\"",
17
+ "prettier": "prettier --write \"**/*.{js,ts,tsx,graphql}\"",
17
18
  "test": "jest",
18
19
  "test:coverage": "jest --verbose --coverage"
19
20
  },
@@ -84,7 +85,7 @@
84
85
  }
85
86
  },
86
87
  "lint-staged": {
87
- "src/**/*.{js,ts,tsx,graphql}": [
88
+ "**/*.{js,ts,tsx,graphql}": [
88
89
  "eslint --fix --max-warnings=0",
89
90
  "prettier --write",
90
91
  "git add .",
@@ -149,5 +150,5 @@
149
150
  "optionalDependencies": {
150
151
  "encoding": "^0.1.13"
151
152
  },
152
- "gitHead": "88e081a522c4efde3d7a45c7a5789a06f8f833af"
153
+ "gitHead": "7ec34fafed3ca19acf9e1be6e3de27d6a03460a5"
153
154
  }