@huma-finance/sdk 0.0.28 → 0.0.30

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 (121) hide show
  1. package/API.md +608 -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 -104
  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 +95 -81
  39. package/dist/cjs/services/ARWeaveService.js +169 -145
  40. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  41. package/dist/cjs/services/EAService.d.ts +20 -20
  42. package/dist/cjs/services/EAService.js +33 -33
  43. package/dist/cjs/services/ReceivableService.d.ts +89 -89
  44. package/dist/cjs/services/ReceivableService.js +193 -193
  45. package/dist/cjs/services/SubgraphService.d.ts +53 -53
  46. package/dist/cjs/services/SubgraphService.js +93 -93
  47. package/dist/cjs/services/index.d.ts +4 -4
  48. package/dist/cjs/services/index.js +7 -7
  49. package/dist/cjs/utils/chain.d.ts +15 -15
  50. package/dist/cjs/utils/chain.js +37 -37
  51. package/dist/cjs/utils/index.d.ts +4 -4
  52. package/dist/cjs/utils/index.js +7 -7
  53. package/dist/cjs/utils/maticGasStation.d.ts +3 -3
  54. package/dist/cjs/utils/maticGasStation.js +38 -38
  55. package/dist/cjs/utils/poolInfo.d.ts +8 -8
  56. package/dist/cjs/utils/poolInfo.js +12 -12
  57. package/dist/cjs/utils/web3.d.ts +5 -4
  58. package/dist/cjs/utils/web3.js +33 -28
  59. package/dist/cjs/utils/web3.js.map +1 -1
  60. package/dist/graphql/generatedTypes.d.ts +40 -40
  61. package/dist/graphql/generatedTypes.js +4 -4
  62. package/dist/graphql/index.d.ts +1 -1
  63. package/dist/graphql/index.js +1 -1
  64. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  65. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +18 -0
  66. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  67. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  68. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
  69. package/dist/helpers/PoolContractHelper.d.ts +119 -104
  70. package/dist/helpers/PoolContractHelper.js +133 -96
  71. package/dist/helpers/PoolContractHelper.js.map +1 -1
  72. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  73. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  74. package/dist/helpers/index.d.ts +3 -3
  75. package/dist/helpers/index.js +3 -3
  76. package/dist/hooks/index.d.ts +4 -4
  77. package/dist/hooks/index.js +4 -4
  78. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  79. package/dist/hooks/useBaseCreditPoolReceivableContract.js +16 -0
  80. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  81. package/dist/hooks/useContract.d.ts +13 -13
  82. package/dist/hooks/useContract.js +26 -26
  83. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  84. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  85. package/dist/hooks/usePool.d.ts +0 -0
  86. package/dist/hooks/usePool.js +2 -0
  87. package/dist/hooks/usePool.js.map +1 -0
  88. package/dist/hooks/usePoolContract.d.ts +60 -60
  89. package/dist/hooks/usePoolContract.js +48 -48
  90. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  91. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  92. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  93. package/dist/hooks/useReceivableFactoringPoolContract.js +13 -0
  94. package/dist/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  95. package/dist/index.d.ts +4 -4
  96. package/dist/index.js +4 -4
  97. package/dist/services/ARWeaveService.d.ts +95 -81
  98. package/dist/services/ARWeaveService.js +164 -140
  99. package/dist/services/ARWeaveService.js.map +1 -1
  100. package/dist/services/EAService.d.ts +20 -20
  101. package/dist/services/EAService.js +30 -30
  102. package/dist/services/ReceivableService.d.ts +89 -89
  103. package/dist/services/ReceivableService.js +189 -189
  104. package/dist/services/SubgraphService.d.ts +53 -53
  105. package/dist/services/SubgraphService.js +90 -90
  106. package/dist/services/index.d.ts +4 -4
  107. package/dist/services/index.js +4 -4
  108. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  109. package/dist/utils/chain.d.ts +15 -15
  110. package/dist/utils/chain.js +31 -31
  111. package/dist/utils/index.d.ts +4 -4
  112. package/dist/utils/index.js +4 -4
  113. package/dist/utils/maticGasStation.d.ts +3 -3
  114. package/dist/utils/maticGasStation.js +33 -33
  115. package/dist/utils/poolInfo.d.ts +8 -8
  116. package/dist/utils/poolInfo.js +8 -8
  117. package/dist/utils/web3.d.ts +5 -4
  118. package/dist/utils/web3.js +27 -23
  119. package/dist/utils/web3.js.map +1 -1
  120. package/getting-started.md +190 -190
  121. package/package.json +6 -4
@@ -1,97 +1,134 @@
1
- import { getContract, getPoolInfo, getDefaultGasOptions } from '../utils';
2
- /**
3
- * Returns an ethers contract instance for a Huma pool contract
4
- *
5
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
6
- * @param {number} chainId The chain id where the contract instance exists
7
- * @param {POOL_NAME} poolName The name of the pool contract to get.
8
- * @param {POOL_TYPE} poolType The type of the pool contract to get.
9
- * @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
10
- */
11
- export function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
12
- const poolInfo = getPoolInfo(chainId, poolName, poolType);
13
- if (!poolInfo)
14
- return null;
15
- return getContract(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
16
- }
17
- /**
18
- * Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
19
- *
20
- * @namespace getCreditRecord
21
- * @async
22
- * @function
23
- * @param {string} address - The address to lookup.
24
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
25
- * @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
26
- * @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
27
- * @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
28
- * @returns {Promise<CreditRecord>} - A Promise of the transaction response.
29
- */
30
- export async function getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) {
31
- const poolContract = getPoolContract(signerOrProvider, chainId, poolName, poolType);
32
- if (!poolContract) {
33
- throw new Error('Could not find pool contract');
34
- }
35
- return poolContract.creditRecordMapping(address);
36
- }
37
- /**
38
- * Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
39
- *
40
- * @async
41
- * @function
42
- * @param {string} address - The address to lookup.
43
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
44
- * @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
45
- * @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
46
- * @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
47
- * @returns {Promise<BigNumber>} - A Promise of the transaction response.
48
- */
49
- export async function getTotalDue(address, signerOrProvider, chainId, poolName, poolType) {
50
- const creditRecord = await getCreditRecord(address, signerOrProvider, chainId, poolName, poolType);
51
- return creditRecord.totalDue;
52
- }
53
- /**
54
- * Calls drawdown on a Huma pool contract
55
- *
56
- * @async
57
- * @function
58
- * @param {ethers.Signer} signer - The signer used to send the transaction.
59
- * @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
60
- * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
61
- * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
62
- * @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
63
- * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
64
- * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
65
- */
66
- export async function drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts = {}) {
67
- const poolContract = getPoolContract(signer, chainId, poolName, poolType);
68
- if (!poolContract) {
69
- throw new Error('Could not find pool contract');
70
- }
71
- gasOpts = await getDefaultGasOptions(gasOpts, chainId);
72
- // TODO: Generate typechain for pool contract
73
- return poolContract.drawdown(drawdownAmount, gasOpts);
74
- }
75
- /**
76
- * Calls drawdown on a Huma pool contract
77
- *
78
- * @async
79
- * @function
80
- * @param {ethers.Signer} signer - The signer used to send the transaction.
81
- * @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
82
- * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
83
- * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
84
- * @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
85
- * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
86
- * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
87
- */
88
- export async function makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts = {}) {
89
- const poolContract = getPoolContract(signer, chainId, poolName, poolType);
90
- if (!poolContract) {
91
- throw new Error('Could not find pool contract');
92
- }
93
- gasOpts = await getDefaultGasOptions(gasOpts, chainId);
94
- // TODO: Generate typechain for pool contract
95
- return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
96
- }
1
+ import { getContract, getPoolInfo, getDefaultGasOptions, getERC20Contract, } from '../utils';
2
+ /**
3
+ * Returns an ethers contract instance for a Huma pool contract
4
+ *
5
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
6
+ * @param {number} chainId The chain id where the contract instance exists
7
+ * @param {POOL_NAME} poolName The name of the pool contract to get.
8
+ * @param {POOL_TYPE} poolType The type of the pool contract to get.
9
+ * @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
10
+ */
11
+ export function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
12
+ const poolInfo = getPoolInfo(chainId, poolName, poolType);
13
+ if (!poolInfo)
14
+ return null;
15
+ return getContract(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
16
+ }
17
+ /**
18
+ * Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
19
+ *
20
+ * @namespace getCreditRecord
21
+ * @async
22
+ * @function
23
+ * @param {string} address - The address to lookup.
24
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
25
+ * @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
26
+ * @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
27
+ * @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
28
+ * @returns {Promise<CreditRecord>} - A Promise of the transaction response.
29
+ */
30
+ export async function getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) {
31
+ const poolContract = getPoolContract(signerOrProvider, chainId, poolName, poolType);
32
+ if (!poolContract) {
33
+ throw new Error('Could not find pool contract');
34
+ }
35
+ return poolContract.creditRecordMapping(address);
36
+ }
37
+ /**
38
+ * Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
39
+ *
40
+ * @async
41
+ * @function
42
+ * @param {string} address - The address to lookup.
43
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
44
+ * @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
45
+ * @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
46
+ * @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
47
+ * @returns {Promise<BigNumber>} - A Promise of the transaction response.
48
+ */
49
+ export async function getTotalDue(address, signerOrProvider, chainId, poolName, poolType) {
50
+ const creditRecord = await getCreditRecord(address, signerOrProvider, chainId, poolName, poolType);
51
+ return creditRecord.totalDue;
52
+ }
53
+ /**
54
+ * Calls drawdown on a Huma pool contract
55
+ *
56
+ * @async
57
+ * @function
58
+ * @param {ethers.Signer} signer - The signer used to send the transaction.
59
+ * @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
60
+ * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
61
+ * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
62
+ * @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
63
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
64
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
65
+ */
66
+ export async function drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts = {}) {
67
+ const poolContract = getPoolContract(signer, chainId, poolName, poolType);
68
+ if (!poolContract) {
69
+ throw new Error('Could not find pool contract');
70
+ }
71
+ gasOpts = await getDefaultGasOptions(gasOpts, chainId);
72
+ // TODO: Generate typechain for pool contract
73
+ return poolContract.drawdown(drawdownAmount, gasOpts);
74
+ }
75
+ /**
76
+ * Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
77
+ * attempt to first increase the allowance of the pool.
78
+ *
79
+ * @async
80
+ * @function
81
+ * @param {ethers.Signer} signer - The signer used to send the transaction.
82
+ * @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
83
+ * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
84
+ * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
85
+ * @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
86
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
87
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
88
+ */
89
+ export async function makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts = {}) {
90
+ const poolInfo = getPoolInfo(chainId, poolName, poolType);
91
+ if (!(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolUnderlyingToken.address)) {
92
+ throw new Error('Could not find pool underlying token address');
93
+ }
94
+ const poolTokenContract = getERC20Contract(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolUnderlyingToken.address, signer);
95
+ const poolContract = getPoolContract(signer, chainId, poolName, poolType);
96
+ if (!poolContract) {
97
+ throw new Error('Could not find pool contract');
98
+ }
99
+ gasOpts = await getDefaultGasOptions(gasOpts, chainId);
100
+ const allowance = await poolTokenContract.allowance(await signer.getAddress(), poolContract.address);
101
+ if (allowance.lt(paymentAmount)) {
102
+ const approvalTx = await poolTokenContract.approve(poolContract.address, paymentAmount, gasOpts);
103
+ await approvalTx.wait();
104
+ }
105
+ // TODO: Generate typechain for pool contract
106
+ return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
107
+ }
108
+ /**
109
+ * Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)
110
+ *
111
+ * @async
112
+ * @function
113
+ * @param {ethers.Signer} signer - The signer used to send the transaction.
114
+ * @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
115
+ * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
116
+ * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
117
+ * @param {BigNumberish} allowanceAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
118
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
119
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
120
+ */
121
+ export async function approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, gasOpts = {}) {
122
+ const poolInfo = getPoolInfo(chainId, poolName, poolType);
123
+ if (!(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolUnderlyingToken.address)) {
124
+ throw new Error('Could not find pool underlying token address');
125
+ }
126
+ const poolTokenContract = getERC20Contract(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolUnderlyingToken.address, signer);
127
+ const poolContract = getPoolContract(signer, chainId, poolName, poolType);
128
+ if (!poolContract) {
129
+ throw new Error('Could not find pool contract');
130
+ }
131
+ gasOpts = await getDefaultGasOptions(gasOpts, chainId);
132
+ return poolTokenContract.approve(poolContract.address, allowanceAmount, gasOpts);
133
+ }
97
134
  //# sourceMappingURL=PoolContractHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAEzE;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;AACvE,CAAC;AAsCD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,eAAe,CAClC,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IAED,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,OAAO,YAAY,CAAC,mBAAmB,CAAC,OA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,OAAO,CAAC,CAAA;IAEtD,OAAO,iBAAiB,CAAC,OAAO,CAC9B,YAAY,CAAC,OAAO,EACpB,eAAe,EACf,OAAO,CACR,CAAA;AACH,CAAC"}
@@ -1,10 +1,10 @@
1
- import { Contract, ethers } from 'ethers';
2
- /**
3
- * 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 getRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
1
+ import { Contract, ethers } from 'ethers';
2
+ /**
3
+ * 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 getRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -1,18 +1,18 @@
1
- import { REAL_WORLD_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
2
- import { getContract } from '../utils';
3
- /**
4
- * Returns an ethers contract instance for the RealWorldReceivable contract
5
- * associated with the given pool name on the current chain.
6
- *
7
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
- * @param {number} chainId The chain id where the contract instance exists
9
- * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
10
- */
11
- export function getRealWorldReceivableContract(signerOrProvider, chainId) {
12
- var _a;
13
- const realWorldReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.RealWorldReceivable];
14
- if (!realWorldReceivable)
15
- return null;
16
- return getContract(realWorldReceivable, REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
17
- }
1
+ import { REAL_WORLD_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
2
+ import { getContract } from '../utils';
3
+ /**
4
+ * Returns an ethers contract instance for the RealWorldReceivable contract
5
+ * associated with the given pool name on the current chain.
6
+ *
7
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
+ * @param {number} chainId The chain id where the contract instance exists
9
+ * @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
10
+ */
11
+ export function getRealWorldReceivableContract(signerOrProvider, chainId) {
12
+ var _a;
13
+ const realWorldReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.RealWorldReceivable];
14
+ if (!realWorldReceivable)
15
+ return null;
16
+ return getContract(realWorldReceivable, REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
17
+ }
18
18
  //# sourceMappingURL=RealWorldReceivableContractHelper.js.map
@@ -1,3 +1,3 @@
1
- export * from './RealWorldReceivableContractHelper';
2
- export * from './ERC20TransferableReceivableContractHelper';
3
- export * from './PoolContractHelper';
1
+ export * from './RealWorldReceivableContractHelper';
2
+ export * from './ERC20TransferableReceivableContractHelper';
3
+ export * from './PoolContractHelper';
@@ -1,4 +1,4 @@
1
- export * from './RealWorldReceivableContractHelper';
2
- export * from './ERC20TransferableReceivableContractHelper';
3
- export * from './PoolContractHelper';
1
+ export * from './RealWorldReceivableContractHelper';
2
+ export * from './ERC20TransferableReceivableContractHelper';
3
+ export * from './PoolContractHelper';
4
4
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- export * from './useContract';
2
- export * from './useRealWorldReceivableContract';
3
- export * from './useERC20TransferableReceivableContract';
4
- export * from './usePoolContract';
1
+ export * from './useContract';
2
+ export * from './useRealWorldReceivableContract';
3
+ export * from './useERC20TransferableReceivableContract';
4
+ export * from './usePoolContract';
@@ -1,5 +1,5 @@
1
- export * from './useContract';
2
- export * from './useRealWorldReceivableContract';
3
- export * from './useERC20TransferableReceivableContract';
4
- export * from './usePoolContract';
1
+ export * from './useContract';
2
+ export * from './useRealWorldReceivableContract';
3
+ export * from './useERC20TransferableReceivableContract';
4
+ export * from './usePoolContract';
5
5
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,10 @@
1
+ import { Contract, ethers } from 'ethers';
2
+ /**
3
+ * A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable 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 BaseCreditPoolReceivable contract or null if it could not be found.
9
+ */
10
+ export declare function useBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -0,0 +1,16 @@
1
+ import { BASE_CREDIT_POOL_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
2
+ import { useContract } from './useContract';
3
+ /**
4
+ * A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
5
+ * associated with the given pool name on the current chain.
6
+ *
7
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
+ * @param {number} chainId The chain id where the contract instance exists
9
+ * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
10
+ */
11
+ export function useBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
12
+ var _a;
13
+ const baseCreditPoolReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.BaseCreditPoolReceivable];
14
+ return useContract(baseCreditPoolReceivable, BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
15
+ }
16
+ //# sourceMappingURL=useBaseCreditPoolReceivableContract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBaseCreditPoolReceivableContract.js","sourceRoot":"","sources":["../../src/hooks/useBaseCreditPoolReceivableContract.ts"],"names":[],"mappings":"AACA,OAAO,EACL,+BAA+B,EAE/B,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,yBAAyB,CAAC,OAAO,CAAC,0CAChC,sBAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,OAAO,WAAW,CAChB,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC"}
@@ -1,13 +1,13 @@
1
- import { Contract } from '@ethersproject/contracts';
2
- import { ethers } from 'ethers';
3
- /**
4
- * Custom hook for creating an ethers instance of a smart contract.
5
- *
6
- * @template T - The type of the contract.
7
- * @param {string | null | undefined} address - The address of the smart contract instance.
8
- * @param {any} ABI - The ABI of the smart contract.
9
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
10
- * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
11
- * @returns {T | null} An instance of the smart contract, or null if an error occurs.
12
- */
13
- export declare function useContract<T extends Contract = Contract>(address: string | null | undefined, ABI: any, signerOrProvider: ethers.providers.Provider | ethers.Signer): T | null;
1
+ import { Contract } from '@ethersproject/contracts';
2
+ import { ethers } from 'ethers';
3
+ /**
4
+ * Custom hook for creating an ethers instance of a smart contract.
5
+ *
6
+ * @template T - The type of the contract.
7
+ * @param {string | null | undefined} address - The address of the smart contract instance.
8
+ * @param {any} ABI - The ABI of the smart contract.
9
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
10
+ * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
11
+ * @returns {T | null} An instance of the smart contract, or null if an error occurs.
12
+ */
13
+ export declare function useContract<T extends Contract = Contract>(address: string | null | undefined, ABI: any, signerOrProvider: ethers.providers.Provider | ethers.Signer): T | null;
@@ -1,27 +1,27 @@
1
- import { useMemo } from 'react';
2
- import { getContract } from '../utils/web3';
3
- /**
4
- * Custom hook for creating an ethers instance of a smart contract.
5
- *
6
- * @template T - The type of the contract.
7
- * @param {string | null | undefined} address - The address of the smart contract instance.
8
- * @param {any} ABI - The ABI of the smart contract.
9
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
10
- * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
11
- * @returns {T | null} An instance of the smart contract, or null if an error occurs.
12
- */
13
- export function useContract(address,
14
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
- ABI, signerOrProvider) {
16
- return useMemo(() => {
17
- if (!address || !ABI || !signerOrProvider)
18
- return null;
19
- try {
20
- return getContract(address, ABI, signerOrProvider);
21
- }
22
- catch (error) {
23
- return null;
24
- }
25
- }, [address, ABI, signerOrProvider]);
26
- }
1
+ import { useMemo } from 'react';
2
+ import { getContract } from '../utils/web3';
3
+ /**
4
+ * Custom hook for creating an ethers instance of a smart contract.
5
+ *
6
+ * @template T - The type of the contract.
7
+ * @param {string | null | undefined} address - The address of the smart contract instance.
8
+ * @param {any} ABI - The ABI of the smart contract.
9
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
10
+ * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
11
+ * @returns {T | null} An instance of the smart contract, or null if an error occurs.
12
+ */
13
+ export function useContract(address,
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ ABI, signerOrProvider) {
16
+ return useMemo(() => {
17
+ if (!address || !ABI || !signerOrProvider)
18
+ return null;
19
+ try {
20
+ return getContract(address, ABI, signerOrProvider);
21
+ }
22
+ catch (error) {
23
+ return null;
24
+ }
25
+ }, [address, ABI, signerOrProvider]);
26
+ }
27
27
  //# sourceMappingURL=useContract.js.map
@@ -1,12 +1,12 @@
1
- import { Contract, ethers } from 'ethers';
2
- import { POOL_NAME } from '@huma-finance/shared';
3
- /**
4
- * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
5
- * associated with the given pool name on the current chain.
6
- *
7
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
- * @param {number} chainId The chain id where the contract instance exists
9
- * @param {POOL_NAME} poolName The name of the pool to get the contract for.
10
- * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
11
- */
12
- export declare function useERC20TransferableReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): Contract | null;
1
+ import { Contract, ethers } from 'ethers';
2
+ import { POOL_NAME } from '@huma-finance/shared';
3
+ /**
4
+ * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
5
+ * associated with the given pool name on the current chain.
6
+ *
7
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
+ * @param {number} chainId The chain id where the contract instance exists
9
+ * @param {POOL_NAME} poolName The name of the pool to get the contract for.
10
+ * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
11
+ */
12
+ export declare function useERC20TransferableReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): Contract | null;
@@ -1,17 +1,17 @@
1
- import { ERC20_TRANSFERABLE_RECEIVABLE_ABI, POOL_TYPE, PoolContractMap, } from '@huma-finance/shared';
2
- import { useContract } from './useContract';
3
- /**
4
- * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
5
- * associated with the given pool name on the current chain.
6
- *
7
- * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
- * @param {number} chainId The chain id where the contract instance exists
9
- * @param {POOL_NAME} poolName The name of the pool to get the contract for.
10
- * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
11
- */
12
- export function useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) {
13
- var _a, _b, _c;
14
- const TransferableReceivableAddress = (_c = (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress;
15
- return useContract(TransferableReceivableAddress, ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
16
- }
1
+ import { ERC20_TRANSFERABLE_RECEIVABLE_ABI, POOL_TYPE, PoolContractMap, } from '@huma-finance/shared';
2
+ import { useContract } from './useContract';
3
+ /**
4
+ * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
5
+ * associated with the given pool name on the current chain.
6
+ *
7
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
8
+ * @param {number} chainId The chain id where the contract instance exists
9
+ * @param {POOL_NAME} poolName The name of the pool to get the contract for.
10
+ * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
11
+ */
12
+ export function useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) {
13
+ var _a, _b, _c;
14
+ const TransferableReceivableAddress = (_c = (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress;
15
+ return useContract(TransferableReceivableAddress, ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
16
+ }
17
17
  //# sourceMappingURL=useERC20TransferableReceivableContract.js.map
File without changes
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=usePool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePool.js","sourceRoot":"","sources":["../../src/hooks/usePool.ts"],"names":[],"mappings":""}