@huma-finance/sdk 0.0.27 → 0.0.29

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 (133) hide show
  1. package/API.md +482 -482
  2. package/LICENSE +660 -660
  3. package/README.md +34 -34
  4. package/dist/cjs/graphql/generatedTypes.d.ts +40 -40
  5. package/dist/cjs/graphql/generatedTypes.js +8 -8
  6. package/dist/cjs/graphql/index.d.ts +1 -1
  7. package/dist/cjs/graphql/index.js +4 -4
  8. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  9. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +22 -0
  10. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  11. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  12. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
  13. package/dist/cjs/helpers/PoolContractHelper.d.ts +119 -104
  14. package/dist/cjs/helpers/PoolContractHelper.js +142 -102
  15. package/dist/cjs/helpers/PoolContractHelper.js.map +1 -1
  16. package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  17. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
  18. package/dist/cjs/helpers/index.d.ts +3 -3
  19. package/dist/cjs/helpers/index.js +6 -6
  20. package/dist/cjs/hooks/index.d.ts +4 -4
  21. package/dist/cjs/hooks/index.js +7 -7
  22. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  23. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +20 -0
  24. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  25. package/dist/cjs/hooks/useContract.d.ts +13 -13
  26. package/dist/cjs/hooks/useContract.js +30 -30
  27. package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  28. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
  29. package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
  30. package/dist/cjs/hooks/usePoolContract.js +53 -53
  31. package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
  32. package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
  33. package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  34. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +17 -0
  35. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  36. package/dist/cjs/index.d.ts +4 -4
  37. package/dist/cjs/index.js +7 -7
  38. package/dist/cjs/services/ARWeaveService.d.ts +81 -81
  39. package/dist/cjs/services/ARWeaveService.js +145 -140
  40. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  41. package/dist/cjs/services/EAService.d.ts +20 -18
  42. package/dist/cjs/services/EAService.js +33 -12
  43. package/dist/cjs/services/EAService.js.map +1 -1
  44. package/dist/cjs/services/ReceivableService.d.ts +89 -87
  45. package/dist/cjs/services/ReceivableService.js +193 -188
  46. package/dist/cjs/services/ReceivableService.js.map +1 -1
  47. package/dist/cjs/services/SubgraphService.d.ts +53 -53
  48. package/dist/cjs/services/SubgraphService.js +93 -100
  49. package/dist/cjs/services/SubgraphService.js.map +1 -1
  50. package/dist/cjs/services/index.d.ts +4 -4
  51. package/dist/cjs/services/index.js +7 -7
  52. package/dist/cjs/utils/chain.d.ts +15 -14
  53. package/dist/cjs/utils/chain.js +37 -33
  54. package/dist/cjs/utils/chain.js.map +1 -1
  55. package/dist/cjs/utils/index.d.ts +4 -3
  56. package/dist/cjs/utils/index.js +7 -6
  57. package/dist/cjs/utils/index.js.map +1 -1
  58. package/dist/cjs/utils/maticGasStation.d.ts +3 -0
  59. package/dist/cjs/utils/maticGasStation.js +39 -0
  60. package/dist/cjs/utils/maticGasStation.js.map +1 -0
  61. package/dist/cjs/utils/poolInfo.d.ts +8 -8
  62. package/dist/cjs/utils/poolInfo.js +12 -12
  63. package/dist/cjs/utils/web3.d.ts +5 -4
  64. package/dist/cjs/utils/web3.js +33 -28
  65. package/dist/cjs/utils/web3.js.map +1 -1
  66. package/dist/graphql/generatedTypes.d.ts +40 -40
  67. package/dist/graphql/generatedTypes.js +4 -4
  68. package/dist/graphql/index.d.ts +1 -1
  69. package/dist/graphql/index.js +1 -1
  70. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  71. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +18 -0
  72. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  73. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  74. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
  75. package/dist/helpers/PoolContractHelper.d.ts +119 -104
  76. package/dist/helpers/PoolContractHelper.js +133 -94
  77. package/dist/helpers/PoolContractHelper.js.map +1 -1
  78. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  79. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  80. package/dist/helpers/index.d.ts +3 -3
  81. package/dist/helpers/index.js +3 -3
  82. package/dist/hooks/index.d.ts +4 -4
  83. package/dist/hooks/index.js +4 -4
  84. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  85. package/dist/hooks/useBaseCreditPoolReceivableContract.js +16 -0
  86. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  87. package/dist/hooks/useContract.d.ts +13 -13
  88. package/dist/hooks/useContract.js +26 -26
  89. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  90. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  91. package/dist/hooks/usePool.d.ts +0 -0
  92. package/dist/hooks/usePool.js +2 -0
  93. package/dist/hooks/usePool.js.map +1 -0
  94. package/dist/hooks/usePoolContract.d.ts +60 -60
  95. package/dist/hooks/usePoolContract.js +48 -48
  96. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  97. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  98. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  99. package/dist/hooks/useReceivableFactoringPoolContract.js +13 -0
  100. package/dist/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  101. package/dist/index.d.ts +4 -4
  102. package/dist/index.js +4 -4
  103. package/dist/services/ARWeaveService.d.ts +81 -81
  104. package/dist/services/ARWeaveService.js +140 -135
  105. package/dist/services/ARWeaveService.js.map +1 -1
  106. package/dist/services/EAService.d.ts +20 -18
  107. package/dist/services/EAService.js +30 -9
  108. package/dist/services/EAService.js.map +1 -1
  109. package/dist/services/ReceivableService.d.ts +89 -87
  110. package/dist/services/ReceivableService.js +189 -184
  111. package/dist/services/ReceivableService.js.map +1 -1
  112. package/dist/services/SubgraphService.d.ts +53 -53
  113. package/dist/services/SubgraphService.js +90 -97
  114. package/dist/services/SubgraphService.js.map +1 -1
  115. package/dist/services/index.d.ts +4 -4
  116. package/dist/services/index.js +4 -4
  117. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  118. package/dist/utils/chain.d.ts +15 -14
  119. package/dist/utils/chain.js +31 -28
  120. package/dist/utils/chain.js.map +1 -1
  121. package/dist/utils/index.d.ts +4 -3
  122. package/dist/utils/index.js +4 -3
  123. package/dist/utils/index.js.map +1 -1
  124. package/dist/utils/maticGasStation.d.ts +3 -0
  125. package/dist/utils/maticGasStation.js +34 -0
  126. package/dist/utils/maticGasStation.js.map +1 -0
  127. package/dist/utils/poolInfo.d.ts +8 -8
  128. package/dist/utils/poolInfo.js +8 -8
  129. package/dist/utils/web3.d.ts +5 -4
  130. package/dist/utils/web3.js +27 -23
  131. package/dist/utils/web3.js.map +1 -1
  132. package/getting-started.md +190 -190
  133. package/package.json +3 -3
@@ -1,60 +1,60 @@
1
- import { BigNumber } from '@ethersproject/bignumber';
2
- import { Contract, ethers } from 'ethers';
3
- import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
- /**
5
- * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
6
- *
7
- * @namespace usePoolContract
8
- * @template T - The type of the contract.
9
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
10
- * @param {number} chainId The chain id where the contract instance exists
11
- * @param {POOL_NAME} poolName - The name of the pool.
12
- * @param {POOL_TYPE} poolType - The type of the pool.
13
- * @returns {T} A contract instance of the specific pool.
14
- */
15
- export declare function usePoolContract<T extends Contract>(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
16
- /**
17
- * CreditRecordDetails type object representing the details of a credit line.
18
- *
19
- * @memberof usePoolContract
20
- * @typedef {Object} CreditRecordDetails
21
- * @property {number} aprInBps - The APR (annual percentage rate) in basis points.
22
- * @property {BigNumber} correction - adjustment of interest over or under-counted because of drawdown
23
- * or principal payment in the middle of a billing period
24
- * @property {BigNumber} creditLimit - The credit limit in the pools base currency.
25
- * @property {BigNumber} defaultAmount - The amount of the default, if any.
26
- * @property {BigNumber} dueDate - The due date of the next payment.
27
- * @property {BigNumber} feesAndInterestDue - The fees and interest due.
28
- * @property {number} intervalInDays - The interval in days between payment periods.
29
- * @property {number} missedPeriods - The number of missed periods.
30
- * @property {number} remainingPeriods - The number of remaining periods before this credit line is considered paid off.
31
- * @property {number} state - The state of the factorization. Please see the CreditState in huma-contracts for more details.
32
- * @property {BigNumber} totalDue - The total due amount of this credit line.
33
- * @property {BigNumber} unbilledPrincipal - The unbilled principal of the next payment.
34
- */
35
- export type CreditRecordDetails = {
36
- aprInBps: number;
37
- correction: BigNumber;
38
- creditLimit: BigNumber;
39
- defaultAmount: BigNumber;
40
- dueDate: BigNumber;
41
- feesAndInterestDue: BigNumber;
42
- intervalInDays: number;
43
- missedPeriods: number;
44
- remainingPeriods: number;
45
- state: number;
46
- totalDue: BigNumber;
47
- unbilledPrincipal: BigNumber;
48
- };
49
- /**
50
- * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
51
- *
52
- * @memberof usePoolContract
53
- * @param {string} userAddress - The address of the user to get the credit record details for.
54
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
55
- * @param {number} chainId The chain id where the contract instance exists
56
- * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
57
- * @param {POOL_TYPE} poolType - The type of the pool.
58
- * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
59
- */
60
- export declare function useCreditRecordDetails(userAddress: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): [CreditRecordDetails | undefined, () => void];
1
+ import { BigNumber } from '@ethersproject/bignumber';
2
+ import { Contract, ethers } from 'ethers';
3
+ import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
+ /**
5
+ * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
6
+ *
7
+ * @namespace usePoolContract
8
+ * @template T - The type of the contract.
9
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
10
+ * @param {number} chainId The chain id where the contract instance exists
11
+ * @param {POOL_NAME} poolName - The name of the pool.
12
+ * @param {POOL_TYPE} poolType - The type of the pool.
13
+ * @returns {T} A contract instance of the specific pool.
14
+ */
15
+ export declare function usePoolContract<T extends Contract>(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
16
+ /**
17
+ * CreditRecordDetails type object representing the details of a credit line.
18
+ *
19
+ * @memberof usePoolContract
20
+ * @typedef {Object} CreditRecordDetails
21
+ * @property {number} aprInBps - The APR (annual percentage rate) in basis points.
22
+ * @property {BigNumber} correction - adjustment of interest over or under-counted because of drawdown
23
+ * or principal payment in the middle of a billing period
24
+ * @property {BigNumber} creditLimit - The credit limit in the pools base currency.
25
+ * @property {BigNumber} defaultAmount - The amount of the default, if any.
26
+ * @property {BigNumber} dueDate - The due date of the next payment.
27
+ * @property {BigNumber} feesAndInterestDue - The fees and interest due.
28
+ * @property {number} intervalInDays - The interval in days between payment periods.
29
+ * @property {number} missedPeriods - The number of missed periods.
30
+ * @property {number} remainingPeriods - The number of remaining periods before this credit line is considered paid off.
31
+ * @property {number} state - The state of the factorization. Please see the CreditState in huma-contracts for more details.
32
+ * @property {BigNumber} totalDue - The total due amount of this credit line.
33
+ * @property {BigNumber} unbilledPrincipal - The unbilled principal of the next payment.
34
+ */
35
+ export type CreditRecordDetails = {
36
+ aprInBps: number;
37
+ correction: BigNumber;
38
+ creditLimit: BigNumber;
39
+ defaultAmount: BigNumber;
40
+ dueDate: BigNumber;
41
+ feesAndInterestDue: BigNumber;
42
+ intervalInDays: number;
43
+ missedPeriods: number;
44
+ remainingPeriods: number;
45
+ state: number;
46
+ totalDue: BigNumber;
47
+ unbilledPrincipal: BigNumber;
48
+ };
49
+ /**
50
+ * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
51
+ *
52
+ * @memberof usePoolContract
53
+ * @param {string} userAddress - The address of the user to get the credit record details for.
54
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
55
+ * @param {number} chainId The chain id where the contract instance exists
56
+ * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
57
+ * @param {POOL_TYPE} poolType - The type of the pool.
58
+ * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
59
+ */
60
+ export declare function useCreditRecordDetails(userAddress: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): [CreditRecordDetails | undefined, () => void];
@@ -1,54 +1,54 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCreditRecordDetails = exports.usePoolContract = void 0;
4
- const react_1 = require("react");
5
- const useContract_1 = require("./useContract");
6
- const poolInfo_1 = require("../utils/poolInfo");
7
- /**
8
- * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
9
- *
10
- * @namespace usePoolContract
11
- * @template T - The type of the contract.
12
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
13
- * @param {number} chainId The chain id where the contract instance exists
14
- * @param {POOL_NAME} poolName - The name of the pool.
15
- * @param {POOL_TYPE} poolType - The type of the pool.
16
- * @returns {T} A contract instance of the specific pool.
17
- */
18
- function usePoolContract(signerOrProvider, chainId, poolName, poolType) {
19
- const poolInfo = (0, poolInfo_1.getPoolInfo)(chainId, poolName, poolType);
20
- return (0, useContract_1.useContract)(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.pool, poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolAbi, signerOrProvider);
21
- }
22
- exports.usePoolContract = usePoolContract;
23
- /**
24
- * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
25
- *
26
- * @memberof usePoolContract
27
- * @param {string} userAddress - The address of the user to get the credit record details for.
28
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
29
- * @param {number} chainId The chain id where the contract instance exists
30
- * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
31
- * @param {POOL_TYPE} poolType - The type of the pool.
32
- * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
33
- */
34
- function useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) {
35
- const poolContract = usePoolContract(signerOrProvider, chainId, poolName, poolType);
36
- const [creditRecordDetails, setCreditRecordDetails] = (0, react_1.useState)();
37
- const [refreshCount, setRefreshCount] = (0, react_1.useState)(0);
38
- (0, react_1.useEffect)(() => {
39
- const fetchData = async () => {
40
- if (poolContract && userAddress) {
41
- const creditRecordMapping = await poolContract.creditRecordMapping(userAddress);
42
- const creditRecordStaticMapping = await poolContract.creditRecordStaticMapping(userAddress);
43
- setCreditRecordDetails(Object.assign(Object.assign({}, creditRecordMapping), creditRecordStaticMapping));
44
- }
45
- };
46
- fetchData();
47
- }, [userAddress, poolContract, refreshCount]);
48
- const refresh = (0, react_1.useCallback)(() => {
49
- setRefreshCount((pre) => pre + 1);
50
- }, []);
51
- return [creditRecordDetails, refresh];
52
- }
53
- exports.useCreditRecordDetails = useCreditRecordDetails;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCreditRecordDetails = exports.usePoolContract = void 0;
4
+ const react_1 = require("react");
5
+ const useContract_1 = require("./useContract");
6
+ const poolInfo_1 = require("../utils/poolInfo");
7
+ /**
8
+ * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
9
+ *
10
+ * @namespace usePoolContract
11
+ * @template T - The type of the contract.
12
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
13
+ * @param {number} chainId The chain id where the contract instance exists
14
+ * @param {POOL_NAME} poolName - The name of the pool.
15
+ * @param {POOL_TYPE} poolType - The type of the pool.
16
+ * @returns {T} A contract instance of the specific pool.
17
+ */
18
+ function usePoolContract(signerOrProvider, chainId, poolName, poolType) {
19
+ const poolInfo = (0, poolInfo_1.getPoolInfo)(chainId, poolName, poolType);
20
+ return (0, useContract_1.useContract)(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.pool, poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolAbi, signerOrProvider);
21
+ }
22
+ exports.usePoolContract = usePoolContract;
23
+ /**
24
+ * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
25
+ *
26
+ * @memberof usePoolContract
27
+ * @param {string} userAddress - The address of the user to get the credit record details for.
28
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
29
+ * @param {number} chainId The chain id where the contract instance exists
30
+ * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
31
+ * @param {POOL_TYPE} poolType - The type of the pool.
32
+ * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
33
+ */
34
+ function useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) {
35
+ const poolContract = usePoolContract(signerOrProvider, chainId, poolName, poolType);
36
+ const [creditRecordDetails, setCreditRecordDetails] = (0, react_1.useState)();
37
+ const [refreshCount, setRefreshCount] = (0, react_1.useState)(0);
38
+ (0, react_1.useEffect)(() => {
39
+ const fetchData = async () => {
40
+ if (poolContract && userAddress) {
41
+ const creditRecordMapping = await poolContract.creditRecordMapping(userAddress);
42
+ const creditRecordStaticMapping = await poolContract.creditRecordStaticMapping(userAddress);
43
+ setCreditRecordDetails(Object.assign(Object.assign({}, creditRecordMapping), creditRecordStaticMapping));
44
+ }
45
+ };
46
+ fetchData();
47
+ }, [userAddress, poolContract, refreshCount]);
48
+ const refresh = (0, react_1.useCallback)(() => {
49
+ setRefreshCount((pre) => pre + 1);
50
+ }, []);
51
+ return [creditRecordDetails, refresh];
52
+ }
53
+ exports.useCreditRecordDetails = useCreditRecordDetails;
54
54
  //# sourceMappingURL=usePoolContract.js.map
@@ -1,10 +1,10 @@
1
- import { Contract, ethers } from 'ethers';
2
- /**
3
- * A react hook that returns an ethers contract instance for the RealWorldReceivable contract
4
- * associated with the given pool name on the current chain.
5
- *
6
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
7
- * @param {number} chainId The chain id where the contract instance exists
8
- * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
9
- */
10
- export declare function useRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
1
+ import { Contract, ethers } from 'ethers';
2
+ /**
3
+ * A react hook that returns an ethers contract instance for the RealWorldReceivable contract
4
+ * associated with the given pool name on the current chain.
5
+ *
6
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
7
+ * @param {number} chainId The chain id where the contract instance exists
8
+ * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
9
+ */
10
+ export declare function useRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRealWorldReceivableContract = void 0;
4
- const shared_1 = require("@huma-finance/shared");
5
- const useContract_1 = require("./useContract");
6
- /**
7
- * A react hook that returns an ethers contract instance for the RealWorldReceivable contract
8
- * associated with the given pool name on the current chain.
9
- *
10
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
- * @param {number} chainId The chain id where the contract instance exists
12
- * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
13
- */
14
- function useRealWorldReceivableContract(signerOrProvider, chainId) {
15
- var _a;
16
- const realWorldReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.RealWorldReceivable];
17
- return (0, useContract_1.useContract)(realWorldReceivable, shared_1.REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
18
- }
19
- exports.useRealWorldReceivableContract = useRealWorldReceivableContract;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRealWorldReceivableContract = void 0;
4
+ const shared_1 = require("@huma-finance/shared");
5
+ const useContract_1 = require("./useContract");
6
+ /**
7
+ * A react hook that returns an ethers contract instance for the RealWorldReceivable contract
8
+ * associated with the given pool name on the current chain.
9
+ *
10
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
+ * @param {number} chainId The chain id where the contract instance exists
12
+ * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
13
+ */
14
+ function useRealWorldReceivableContract(signerOrProvider, chainId) {
15
+ var _a;
16
+ const realWorldReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.RealWorldReceivable];
17
+ return (0, useContract_1.useContract)(realWorldReceivable, shared_1.REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
18
+ }
19
+ exports.useRealWorldReceivableContract = useRealWorldReceivableContract;
20
20
  //# sourceMappingURL=useRealWorldReceivableContract.js.map
@@ -0,0 +1,10 @@
1
+ import { POOL_NAME, ReceivableFactoringPool } from '@00labs/huma-shared';
2
+ import { ethers } from 'ethers';
3
+ /**
4
+ * A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
5
+ *
6
+ * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
7
+ * @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
8
+ * @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
9
+ */
10
+ export declare function useReceivableFactoringPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): ReceivableFactoringPool | null;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useReceivableFactoringPoolContract = void 0;
4
+ const huma_shared_1 = require("@00labs/huma-shared");
5
+ const usePoolContract_1 = require("./usePoolContract");
6
+ /**
7
+ * A react hook that returns the instance of the ReceivableFactoringPool contract for a given signer or provider and pool name.
8
+ *
9
+ * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
10
+ * @param {POOL_NAME} poolName - The name of the pool to get the contract for. Check the type for more details.
11
+ * @returns {ReceivableFactoringPool} An ethers instance of the ReceivableFactoringPool contract.
12
+ */
13
+ function useReceivableFactoringPoolContract(signerOrProvider, chainId, poolName) {
14
+ return (0, usePoolContract_1.usePoolContract)(signerOrProvider, chainId, poolName, huma_shared_1.POOL_TYPE.Invoice);
15
+ }
16
+ exports.useReceivableFactoringPoolContract = useReceivableFactoringPoolContract;
17
+ //# sourceMappingURL=useReceivableFactoringPoolContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useReceivableFactoringPoolContract.js","sourceRoot":"","sources":["../../../src/hooks/useReceivableFactoringPoolContract.ts"],"names":[],"mappings":";;;AAAA,qDAI4B;AAG5B,uDAAmD;AAEnD;;;;;;GAMG;AACH,SAAgB,kCAAkC,CAChD,gBAA2D,EAC3D,OAAe,EACf,QAAmB;IAEnB,OAAO,IAAA,iCAAe,EACpB,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,uBAAS,CAAC,OAAO,CAClB,CAAA;AACH,CAAC;AAXD,gFAWC"}
@@ -1,4 +1,4 @@
1
- export * from './helpers';
2
- export * from './hooks';
3
- export * from './services';
4
- export * from './utils';
1
+ export * from './helpers';
2
+ export * from './hooks';
3
+ export * from './services';
4
+ export * from './utils';
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./helpers"), exports);
5
- tslib_1.__exportStar(require("./hooks"), exports);
6
- tslib_1.__exportStar(require("./services"), exports);
7
- tslib_1.__exportStar(require("./utils"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./helpers"), exports);
5
+ tslib_1.__exportStar(require("./hooks"), exports);
6
+ tslib_1.__exportStar(require("./services"), exports);
7
+ tslib_1.__exportStar(require("./utils"), exports);
8
8
  //# sourceMappingURL=index.js.map
@@ -1,81 +1,81 @@
1
- import { FundResponse, UploadResponse } from '@bundlr-network/client/build/common/types';
2
- import { Web3Provider } from '@ethersproject/providers';
3
- /**
4
- * The configuration for Bundlr network instances
5
- *
6
- * @typedef {Object} BundlrConfig
7
- * @memberof ArweaveService
8
- * @property {string} nodeUrl - The Bundlr node URL to use.
9
- * @property {string} currency - The currency to pay for uploads with.
10
- * Please see https://docs.bundlr.network/sdk/using-other-currencies for all the supported currencies
11
- * @property {string} [providerUrl] - The provider URL, required for devnets.
12
- */
13
- export type BundlrConfig = {
14
- nodeUrl: string;
15
- currency: string;
16
- providerUrl?: string;
17
- };
18
- /**
19
- * Get the configuration for Bundlr network given a chain ID
20
- *
21
- * @function
22
- * @memberof ArweaveService
23
- * @param {number} chainId - The chain ID.
24
- * @returns {BundlrConfig} - The configuration for the Bundlr network.
25
- */
26
- export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
27
- /**
28
- * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
29
- *
30
- * @async
31
- * @function
32
- * @memberof ArweaveService
33
- * @param {BundlrConfig} config - The configuration for the Bundlr network.
34
- * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
35
- * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
36
- * @returns {Promise<FundResponse>} - The fund response.
37
- */
38
- declare function prefundBundlr(config: BundlrConfig, signer: any, amount: number): Promise<FundResponse>;
39
- /**
40
- * Store data on ARWeave using the Bundlr Network.
41
- *
42
- * @async
43
- * @function
44
- * @memberof ArweaveService
45
- * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
46
- * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
47
- * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
48
- * environment, this should be a private key string.
49
- * @param {JSON} data - The data to store in the Bundlr instance.
50
- * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
51
- * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
52
- * Bundlr node should already be funded or else uploads will fail.
53
- * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
54
- */
55
- declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
56
- name: string;
57
- value: string;
58
- }[], lazyFund?: boolean): Promise<UploadResponse>;
59
- /**
60
- * Helper method to query the Arweave network for receivables metadata previously uploaded.
61
- *
62
- * @async
63
- * @function
64
- * @memberof ArweaveService
65
- * @param {number} chainId - The chain ID.
66
- * @param {string} sender - The sender tag to query.
67
- * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
68
- * @returns {Promise<any>} Promise resolving with the queried data.
69
- */
70
- declare function queryForMetadata(chainId: number, sender: string, referenceId: string): Promise<string | null>;
71
- /**
72
- * An object that contains functions to interact with Huma-related data stored on ARWeave
73
- * @namespace ARWeaveService
74
- */
75
- export declare const ARWeaveService: {
76
- queryForMetadata: typeof queryForMetadata;
77
- storeData: typeof storeData;
78
- prefundBundlr: typeof prefundBundlr;
79
- getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
80
- };
81
- export {};
1
+ import { FundResponse, UploadResponse } from '@bundlr-network/client/build/common/types';
2
+ import { Web3Provider } from '@ethersproject/providers';
3
+ /**
4
+ * The configuration for Bundlr network instances
5
+ *
6
+ * @typedef {Object} BundlrConfig
7
+ * @memberof ArweaveService
8
+ * @property {string} nodeUrl - The Bundlr node URL to use.
9
+ * @property {string} currency - The currency to pay for uploads with.
10
+ * Please see https://docs.bundlr.network/sdk/using-other-currencies for all the supported currencies
11
+ * @property {string} [providerUrl] - The provider URL, required for devnets.
12
+ */
13
+ export type BundlrConfig = {
14
+ nodeUrl: string;
15
+ currency: string;
16
+ providerUrl?: string;
17
+ };
18
+ /**
19
+ * Get the configuration for Bundlr network given a chain ID
20
+ *
21
+ * @function
22
+ * @memberof ArweaveService
23
+ * @param {number} chainId - The chain ID.
24
+ * @returns {BundlrConfig} - The configuration for the Bundlr network.
25
+ */
26
+ export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
27
+ /**
28
+ * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
29
+ *
30
+ * @async
31
+ * @function
32
+ * @memberof ArweaveService
33
+ * @param {BundlrConfig} config - The configuration for the Bundlr network.
34
+ * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
35
+ * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
36
+ * @returns {Promise<FundResponse>} - The fund response.
37
+ */
38
+ declare function prefundBundlr(config: BundlrConfig, signer: any, amount: number): Promise<FundResponse>;
39
+ /**
40
+ * Store data on ARWeave using the Bundlr Network.
41
+ *
42
+ * @async
43
+ * @function
44
+ * @memberof ArweaveService
45
+ * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
46
+ * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
47
+ * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
48
+ * environment, this should be a private key string.
49
+ * @param {JSON} data - The data to store in the Bundlr instance.
50
+ * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
51
+ * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
52
+ * Bundlr node should already be funded or else uploads will fail.
53
+ * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
54
+ */
55
+ declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
56
+ name: string;
57
+ value: string;
58
+ }[], lazyFund?: boolean): Promise<UploadResponse>;
59
+ /**
60
+ * Helper method to query the Arweave network for receivables metadata previously uploaded.
61
+ *
62
+ * @async
63
+ * @function
64
+ * @memberof ArweaveService
65
+ * @param {number} chainId - The chain ID.
66
+ * @param {string} sender - The sender tag to query.
67
+ * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
68
+ * @returns {Promise<any>} Promise resolving with the queried data.
69
+ */
70
+ declare function queryForMetadata(chainId: number, sender: string, referenceId: string): Promise<string | null>;
71
+ /**
72
+ * An object that contains functions to interact with Huma-related data stored on ARWeave
73
+ * @namespace ARWeaveService
74
+ */
75
+ export declare const ARWeaveService: {
76
+ queryForMetadata: typeof queryForMetadata;
77
+ storeData: typeof storeData;
78
+ prefundBundlr: typeof prefundBundlr;
79
+ getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
80
+ };
81
+ export {};