@huma-finance/sdk 0.0.36 → 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 (119) hide show
  1. package/API.md +650 -822
  2. package/LICENSE +660 -660
  3. package/README.md +37 -37
  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 -119
  14. package/dist/cjs/helpers/PoolContractHelper.js +143 -143
  15. package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  16. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
  17. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js.map +1 -1
  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 +106 -106
  39. package/dist/cjs/services/ARWeaveService.js +190 -190
  40. package/dist/cjs/services/EAService.d.ts +20 -20
  41. package/dist/cjs/services/EAService.js +33 -33
  42. package/dist/cjs/services/ReceivableService.d.ts +104 -104
  43. package/dist/cjs/services/ReceivableService.js +308 -308
  44. package/dist/cjs/services/ReceivableService.js.map +1 -1
  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 -5
  58. package/dist/cjs/utils/web3.js +33 -33
  59. package/dist/graphql/generatedTypes.d.ts +40 -40
  60. package/dist/graphql/generatedTypes.js +4 -4
  61. package/dist/graphql/index.d.ts +1 -1
  62. package/dist/graphql/index.js +1 -1
  63. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  64. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +18 -0
  65. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  66. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  67. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
  68. package/dist/helpers/PoolContractHelper.d.ts +119 -119
  69. package/dist/helpers/PoolContractHelper.js +134 -134
  70. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  71. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  72. package/dist/helpers/RealWorldReceivableContractHelper.js.map +1 -1
  73. package/dist/helpers/index.d.ts +3 -3
  74. package/dist/helpers/index.js +3 -3
  75. package/dist/hooks/index.d.ts +4 -4
  76. package/dist/hooks/index.js +4 -4
  77. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  78. package/dist/hooks/useBaseCreditPoolReceivableContract.js +16 -0
  79. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  80. package/dist/hooks/useContract.d.ts +13 -13
  81. package/dist/hooks/useContract.js +26 -26
  82. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  83. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  84. package/dist/hooks/usePool.d.ts +0 -0
  85. package/dist/hooks/usePool.js +2 -0
  86. package/dist/hooks/usePool.js.map +1 -0
  87. package/dist/hooks/usePoolContract.d.ts +60 -60
  88. package/dist/hooks/usePoolContract.js +48 -48
  89. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  90. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  91. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  92. package/dist/hooks/useReceivableFactoringPoolContract.js +13 -0
  93. package/dist/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  94. package/dist/index.d.ts +4 -4
  95. package/dist/index.js +4 -4
  96. package/dist/services/ARWeaveService.d.ts +106 -106
  97. package/dist/services/ARWeaveService.js +185 -185
  98. package/dist/services/EAService.d.ts +20 -20
  99. package/dist/services/EAService.js +30 -30
  100. package/dist/services/ReceivableService.d.ts +104 -104
  101. package/dist/services/ReceivableService.js +305 -305
  102. package/dist/services/ReceivableService.js.map +1 -1
  103. package/dist/services/SubgraphService.d.ts +53 -53
  104. package/dist/services/SubgraphService.js +90 -90
  105. package/dist/services/index.d.ts +4 -4
  106. package/dist/services/index.js +4 -4
  107. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  108. package/dist/utils/chain.d.ts +15 -15
  109. package/dist/utils/chain.js +31 -31
  110. package/dist/utils/index.d.ts +4 -4
  111. package/dist/utils/index.js +4 -4
  112. package/dist/utils/maticGasStation.d.ts +3 -3
  113. package/dist/utils/maticGasStation.js +33 -33
  114. package/dist/utils/poolInfo.d.ts +8 -8
  115. package/dist/utils/poolInfo.js +8 -8
  116. package/dist/utils/web3.d.ts +5 -5
  117. package/dist/utils/web3.js +27 -27
  118. package/getting-started.md +190 -190
  119. package/package.json +3 -3
package/API.md CHANGED
@@ -1,822 +1,650 @@
1
- ## Objects
2
-
3
- <dl>
4
- <dt><a href="#usePoolContract">usePoolContract</a> ⇒ <code>T</code></dt>
5
- <dd><p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p></dd>
6
- <dt><a href="#ARWeaveService">ARWeaveService</a> : <code>object</code></dt>
7
- <dd><p>An object that contains functions to interact with Huma-related data stored on ARWeave</p></dd>
8
- <dt><a href="#EAService">EAService</a> : <code>object</code></dt>
9
- <dd><p>An object that contains functions to interact with Huma's EAVerse service.</p></dd>
10
- <dt><a href="#ReceivableService">ReceivableService</a> : <code>object</code></dt>
11
- <dd><p>An object that contains functions to interact with Huma's receivables.</p></dd>
12
- <dt><a href="#SubgraphService">SubgraphService</a> : <code>object</code></dt>
13
- <dd><p>An object that contains functions to interact with Huma's Subgraph storage.</p></dd>
14
- </dl>
15
-
16
- ## Functions
17
-
18
- <dl>
19
- <dt><a href="#defaultWrapper">defaultWrapper()</a></dt>
20
- <dd><p>All built-in and custom scalars, mapped to their actual values</p></dd>
21
- <dt><a href="#getERC20TransferableReceivableContract">getERC20TransferableReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
22
- <dd><p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
23
- associated with the given pool name on the current chain.</p></dd>
24
- <dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
25
- <dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
26
- <dt><a href="#getCreditRecord">getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;CreditRecord&gt;</code></dt>
27
- <dd><p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p></dd>
28
- <dt><a href="#getTotalDue">getTotalDue(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;BigNumber&gt;</code></dt>
29
- <dd><p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p></dd>
30
- <dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
31
- <dd><p>Calls drawdown on a Huma pool contract</p></dd>
32
- <dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
33
- <dd><p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
34
- attempt to first increase the allowance of the pool.</p></dd>
35
- <dt><a href="#approvePoolAllowance">approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
36
- <dd><p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p></dd>
37
- <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
38
- <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
39
- associated with the given pool name on the current chain.</p></dd>
40
- <dt><a href="#useContract">useContract(address, ABI, signerOrProvider)</a> ⇒ <code>T</code> | <code>null</code></dt>
41
- <dd><p>Custom hook for creating an ethers instance of a smart contract.</p></dd>
42
- <dt><a href="#useERC20TransferableReceivableContract">useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
43
- <dd><p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
44
- associated with the given pool name on the current chain.</p></dd>
45
- <dt><a href="#useRealWorldReceivableContract">useRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
46
- <dd><p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
47
- associated with the given pool name on the current chain.</p></dd>
48
- <dt><a href="#preapprove">preapprove(payload, chainId)</a> ⇒ <code>Promise.&lt;Approval&gt;</code></dt>
49
- <dd><p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
50
- Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p></dd>
51
- <dt><a href="#getChainIdFromJsonSignerOrProvider">getChainIdFromJsonSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
52
- <dd><p>Get the chain ID from a signer or provider object.</p></dd>
53
- <dt><a href="#getChainIdFromSignerOrProvider">getChainIdFromSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
54
- <dd><p>Get the chain ID from a signer or provider object.</p></dd>
55
- <dt><a href="#getPoolInfo">getPoolInfo(poolName, poolType)</a> ⇒ <code>PoolInfoType</code> | <code>undefined</code></dt>
56
- <dd><p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p></dd>
57
- <dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
58
- <dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
59
- <dt><a href="#getCreditRecord">getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)</a> <code>Promise.&lt;CreditRecord&gt;</code></dt>
60
- <dd><p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p></dd>
61
- <dt><a href="#getTotalDue">getTotalDue(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;BigNumber&gt;</code></dt>
62
- <dd><p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p></dd>
63
- <dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
64
- <dd><p>Calls drawdown on a Huma pool contract</p></dd>
65
- <dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts])</a> <code>Promise.&lt;TransactionResponse&gt;</code></dt>
66
- <dd><p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
67
- attempt to first increase the allowance of the pool.</p></dd>
68
- <dt><a href="#approvePoolAllowance">approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts])</a> <code>Promise.&lt;TransactionResponse&gt;</code></dt>
69
- <dd><p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p></dd>
70
- </dl>
71
-
72
- ## Typedefs
73
-
74
- <dl>
75
- <dt><a href="#ApprovalResult">ApprovalResult</a> : <code>Object</code></dt>
76
- <dd><p>Object representing the response to the underwriting approval request.</p></dd>
77
- <dt><a href="#EAPayload">EAPayload</a> : <code>Object</code></dt>
78
- <dd><p>Object representing an invoice payload for underwriting approval.</p></dd>
79
- <dt><a href="#CreditEventPayload">CreditEventPayload</a> : <code>Object</code></dt>
80
- <dd><p>Represents the payload of a credit event.</p></dd>
81
- </dl>
82
-
83
- <a name="usePoolContract"></a>
84
-
85
- ## usePoolContract <code>T</code>
86
- <p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p>
87
-
88
- **Kind**: global namespace
89
- **Returns**: <code>T</code> - <p>A contract instance of the specific pool.</p>
90
-
91
- | Param | Type | Description |
92
- | --- | --- | --- |
93
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>An ethers signer or provider instance.</p> |
94
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
95
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
96
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
97
-
98
-
99
- * [usePoolContract](#usePoolContract) <code>T</code>
100
- * [.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType)](#usePoolContract.useCreditRecordDetails) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
101
- * [.CreditRecordDetails](#usePoolContract.CreditRecordDetails) : <code>Object</code>
102
-
103
- <a name="usePoolContract.useCreditRecordDetails"></a>
104
-
105
- ### usePoolContract.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
106
- <p>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.</p>
107
-
108
- **Kind**: static method of [<code>usePoolContract</code>](#usePoolContract)
109
- **Returns**: <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code> - <p>An array containing the credit record details and a function to refresh the data.</p>
110
-
111
- | Param | Type | Description |
112
- | --- | --- | --- |
113
- | userAddress | <code>string</code> | <p>The address of the user to get the credit record details for.</p> |
114
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to use for the contract.</p> |
115
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
116
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the credit record details for.</p> |
117
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
118
-
119
- <a name="usePoolContract.CreditRecordDetails"></a>
120
-
121
- ### usePoolContract.CreditRecordDetails : <code>Object</code>
122
- <p>CreditRecordDetails type object representing the details of a credit line.</p>
123
-
124
- **Kind**: static typedef of [<code>usePoolContract</code>](#usePoolContract)
125
- **Properties**
126
-
127
- | Name | Type | Description |
128
- | --- | --- | --- |
129
- | aprInBps | <code>number</code> | <p>The APR (annual percentage rate) in basis points.</p> |
130
- | correction | <code>BigNumber</code> | <p>adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
131
- | creditLimit | <code>BigNumber</code> | <p>The credit limit in the pools base currency.</p> |
132
- | defaultAmount | <code>BigNumber</code> | <p>The amount of the default, if any.</p> |
133
- | dueDate | <code>BigNumber</code> | <p>The due date of the next payment.</p> |
134
- | feesAndInterestDue | <code>BigNumber</code> | <p>The fees and interest due.</p> |
135
- | intervalInDays | <code>number</code> | <p>The interval in days between payment periods.</p> |
136
- | missedPeriods | <code>number</code> | <p>The number of missed periods.</p> |
137
- | remainingPeriods | <code>number</code> | <p>The number of remaining periods before this credit line is considered paid off.</p> |
138
- | state | <code>number</code> | <p>The state of the factorization. Please see the CreditState in huma-contracts for more details.</p> |
139
- | totalDue | <code>BigNumber</code> | <p>The total due amount of this credit line.</p> |
140
- | unbilledPrincipal | <code>BigNumber</code> | <p>The unbilled principal of the next payment.</p> |
141
-
142
- <a name="ARWeaveService"></a>
143
-
144
- ## ARWeaveService : <code>object</code>
145
- <p>An object that contains functions to interact with Huma-related data stored on ARWeave</p>
146
-
147
- **Kind**: global namespace
148
- <a name="EAService"></a>
149
-
150
- ## EAService : <code>object</code>
151
- <p>An object that contains functions to interact with Huma's EAVerse service.</p>
152
-
153
- **Kind**: global namespace
154
- <a name="EAService.approve"></a>
155
-
156
- ### EAService.approve(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
157
- <p>Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
158
- in Huma's pools that can be drawn down by the borrower.</p>
159
-
160
- **Kind**: static method of [<code>EAService</code>](#EAService)
161
- **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
162
- **Throws**:
163
-
164
- - <code>EARejectionError</code> <p>If the underwrite approval is rejected.</p>
165
-
166
-
167
- | Param | Type | Description |
168
- | --- | --- | --- |
169
- | payload | [<code>EAPayload</code>](#EAPayload) | <p>The payload for the underwrite approval.</p> |
170
- | chainId | <code>number</code> | <p>The chain ID.</p> |
171
-
172
- <a name="ReceivableService"></a>
173
-
174
- ## ReceivableService : <code>object</code>
175
- <p>An object that contains functions to interact with Huma's receivables.</p>
176
-
177
- **Kind**: global namespace
178
-
179
- * [ReceivableService](#ReceivableService) : <code>object</code>
180
- * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
181
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
182
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
183
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
184
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
185
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
186
-
187
- <a name="ReceivableService.getTokenIdByARWeaveId"></a>
188
-
189
- ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
190
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
191
-
192
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
193
- **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
194
- <li>Either the token Id or null if no token was found.</li>
195
- </ul>
196
-
197
- | Param | Type | Description |
198
- | --- | --- | --- |
199
- | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
200
- | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
201
-
202
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
203
-
204
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
205
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
206
-
207
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
208
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
209
- <li>A Promise of the transaction receipt.</li>
210
- </ul>
211
-
212
- | Param | Type | Description |
213
- | --- | --- | --- |
214
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
215
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
216
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
217
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
218
-
219
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
220
-
221
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
222
- <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
223
-
224
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
225
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
226
- <li>A Promise of the transaction receipt.</li>
227
- </ul>
228
- **Throws**:
229
-
230
- - <code>Error</code> <ul>
231
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
232
- </ul>
233
-
234
-
235
- | Param | Type | Description |
236
- | --- | --- | --- |
237
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
238
- | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
239
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
240
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
241
-
242
- <a name="ReceivableService.createReceivable"></a>
243
-
244
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
245
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
246
-
247
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
248
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
249
- <li>A Promise of the transaction response.</li>
250
- </ul>
251
- **Throws**:
252
-
253
- - <code>Error</code> <ul>
254
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
255
- </ul>
256
-
257
-
258
- | Param | Type | Description |
259
- | --- | --- | --- |
260
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
261
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
262
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
263
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
264
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
265
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
266
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
267
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
268
-
269
- <a name="ReceivableService.createReceivableWithMetadata"></a>
270
-
271
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
272
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
273
-
274
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
275
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
276
- <li>The transaction receipt.</li>
277
- </ul>
278
-
279
- | Param | Type | Default | Description |
280
- | --- | --- | --- | --- |
281
- | signerOrProvider | <code>Web3Provider</code> \| <code>ethers.Signer</code> | | <p>If calling this function from a browser, this function expects a Web3Provider. If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included from server calls.</p> |
282
- | privateKey | <code>string</code> \| <code>null</code> | | <p>Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.</p> |
283
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
284
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
285
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
286
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
287
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
288
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
289
- | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
290
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
291
- | extraTags | <code>Array.&lt;{name: string, value: string}&gt;</code> | | <p>Any extraTags you'd like to tag your metadata with. Note that metadata on ARWeave is indexed by these tags, so make sure to include any tags that you'd like to be able to query by.</p> |
292
- | [lazyFund] | <code>boolean</code> | <code>true</code> | <p>Whether to lazy fund the ARWeave uploads. If true, the ARWeave uploads will be paid for by the metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.</p> |
293
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
294
-
295
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
296
-
297
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
298
- <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
299
-
300
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
301
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
302
- <li>An array of receivables owned by the owner for the pool.</li>
303
- </ul>
304
-
305
- | Param | Type | Description |
306
- | --- | --- | --- |
307
- | signerOrProvider | <code>Web3Provider</code> \| <code>ethers.Signer</code> | <p>If calling this function from a browser, this function expects a Web3Provider. If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included from server calls.</p> |
308
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
309
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
310
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
311
-
312
- <a name="SubgraphService"></a>
313
-
314
- ## SubgraphService : <code>object</code>
315
- <p>An object that contains functions to interact with Huma's Subgraph storage.</p>
316
-
317
- **Kind**: global namespace
318
-
319
- * [SubgraphService](#SubgraphService) : <code>object</code>
320
- * [.getSubgraphUrlForChainId(chainId)](#SubgraphService.getSubgraphUrlForChainId) ⇒ <code>string</code>
321
- * [.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event)](#SubgraphService.getCreditEventsForUser) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
322
- * [.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType)](#SubgraphService.getLastFactorizedAmountFromPool) <code>Promise.&lt;number&gt;</code>
323
-
324
- <a name="SubgraphService.getSubgraphUrlForChainId"></a>
325
-
326
- ### SubgraphService.getSubgraphUrlForChainId(chainId) ⇒ <code>string</code>
327
- <p>Returns the subgraph URL for a given chain ID.</p>
328
-
329
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
330
- **Returns**: <code>string</code> - <p>The subgraph URL for the given chain ID.</p>
331
-
332
- | Param | Type | Description |
333
- | --- | --- | --- |
334
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
335
-
336
- <a name="SubgraphService.getCreditEventsForUser"></a>
337
-
338
- ### SubgraphService.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
339
- <p>Returns the credit events for a given user.</p>
340
-
341
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
342
- **Returns**: <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code> - <p>The credit events for the given user.</p>
343
-
344
- | Param | Type | Description |
345
- | --- | --- | --- |
346
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
347
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
348
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
349
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
350
- | event | <code>Array.&lt;number&gt;</code> | <p>The event types to filter by.</p> |
351
-
352
- <a name="SubgraphService.getLastFactorizedAmountFromPool"></a>
353
-
354
- ### SubgraphService.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType) <code>Promise.&lt;number&gt;</code>
355
- <p>Returns the last factorized amount for a given user and pool.</p>
356
-
357
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
358
- **Returns**: <code>Promise.&lt;number&gt;</code> - <p>The last factorized amount for the given user and pool.</p>
359
-
360
- | Param | Type | Description |
361
- | --- | --- | --- |
362
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
363
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
364
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
365
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
366
-
367
- <a name="defaultWrapper"></a>
368
-
369
- ## defaultWrapper()
370
- <p>All built-in and custom scalars, mapped to their actual values</p>
371
-
372
- **Kind**: global function
373
- <a name="getERC20TransferableReceivableContract"></a>
374
-
375
- ## getERC20TransferableReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
376
- <p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
377
- associated with the given pool name on the current chain.</p>
378
-
379
- **Kind**: global function
380
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
381
-
382
- | Param | Type | Description |
383
- | --- | --- | --- |
384
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
385
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
386
-
387
- <a name="getPoolContract"></a>
388
-
389
- ## getPoolContract(signerOrProvider, chainId, poolName, poolType) <code>Contract</code> \| <code>null</code>
390
- <p>Returns an ethers contract instance for a Huma pool contract</p>
391
-
392
- **Kind**: global function
393
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the Pool contract or null if it could not be found.</p>
394
-
395
- | Param | Type | Description |
396
- | --- | --- | --- |
397
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
398
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
399
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
400
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
401
-
402
- <a name="getCreditRecord"></a>
403
-
404
- ## getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) <code>Promise.&lt;CreditRecord&gt;</code>
405
- <p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p>
406
-
407
- **Kind**: global function
408
- **Returns**: <code>Promise.&lt;CreditRecord&gt;</code> - <ul>
409
- <li>A Promise of the transaction response.</li>
410
- </ul>
411
-
412
- | Param | Type | Description |
413
- | --- | --- | --- |
414
- | address | <code>string</code> | <p>The address to lookup.</p> |
415
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
416
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
417
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
418
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
419
-
420
-
421
- * [getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)](#getCreditRecord) <code>Promise.&lt;CreditRecord&gt;</code>
422
- * [.CreditRecord](#getCreditRecord.CreditRecord) : <code>Object</code>
423
- * [.CreditRecord](#getCreditRecord.CreditRecord) : <code>Object</code>
424
-
425
- <a name="getCreditRecord.CreditRecord"></a>
426
-
427
- ### getCreditRecord.CreditRecord : <code>Object</code>
428
- <p>Return type of getCreditRecord</p>
429
-
430
- **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
431
- **Properties**
432
-
433
- | Name | Type | Description |
434
- | --- | --- | --- |
435
- | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
436
- | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
437
- | correction | <code>BigNumber</code> | <p>the adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
438
- | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
439
- | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
440
- | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
441
- | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
442
- | state | <code>number</code> | <p>status of the credit line. For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49</p> |
443
-
444
- <a name="getCreditRecord.CreditRecord"></a>
445
-
446
- ### getCreditRecord.CreditRecord : <code>Object</code>
447
- <p>Return type of getCreditRecord</p>
448
-
449
- **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
450
- **Properties**
451
-
452
- | Name | Type | Description |
453
- | --- | --- | --- |
454
- | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
455
- | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
456
- | correction | <code>BigNumber</code> | <p>the adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
457
- | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
458
- | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
459
- | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
460
- | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
461
- | state | <code>number</code> | <p>status of the credit line. For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49</p> |
462
-
463
- <a name="getTotalDue"></a>
464
-
465
- ## getTotalDue(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;BigNumber&gt;</code>
466
- <p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p>
467
-
468
- **Kind**: global function
469
- **Returns**: <code>Promise.&lt;BigNumber&gt;</code> - <ul>
470
- <li>A Promise of the transaction response.</li>
471
- </ul>
472
-
473
- | Param | Type | Description |
474
- | --- | --- | --- |
475
- | address | <code>string</code> | <p>The address to lookup.</p> |
476
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
477
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
478
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
479
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
480
-
481
- <a name="drawdownFromPool"></a>
482
-
483
- ## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
484
- <p>Calls drawdown on a Huma pool contract</p>
485
-
486
- **Kind**: global function
487
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
488
- <li>A Promise of the transaction response.</li>
489
- </ul>
490
-
491
- | Param | Type | Description |
492
- | --- | --- | --- |
493
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
494
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
495
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
496
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
497
- | drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
498
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
499
-
500
- <a name="makePaymentToPool"></a>
501
-
502
- ## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
503
- <p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
504
- attempt to first increase the allowance of the pool.</p>
505
-
506
- **Kind**: global function
507
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
508
- <li>A Promise of the transaction response.</li>
509
- </ul>
510
-
511
- | Param | Type | Description |
512
- | --- | --- | --- |
513
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
514
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
515
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
516
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
517
- | paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
518
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
519
-
520
- <a name="approvePoolAllowance"></a>
521
-
522
- ## approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
523
- <p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p>
524
-
525
- **Kind**: global function
526
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
527
- <li>A Promise of the transaction response.</li>
528
- </ul>
529
-
530
- | Param | Type | Description |
531
- | --- | --- | --- |
532
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
533
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
534
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
535
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
536
- | allowanceAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
537
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
538
-
539
- <a name="getRealWorldReceivableContract"></a>
540
-
541
- ## getRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
542
- <p>Returns an ethers contract instance for the RealWorldReceivable contract
543
- associated with the given pool name on the current chain.</p>
544
-
545
- **Kind**: global function
546
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
547
-
548
- | Param | Type | Description |
549
- | --- | --- | --- |
550
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
551
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
552
-
553
- <a name="useContract"></a>
554
-
555
- ## useContract(address, ABI, signerOrProvider) ⇒ <code>T</code> \| <code>null</code>
556
- <p>Custom hook for creating an ethers instance of a smart contract.</p>
557
-
558
- **Kind**: global function
559
- **Returns**: <code>T</code> \| <code>null</code> - <p>An instance of the smart contract, or null if an error occurs.</p>
560
-
561
- | Param | Type | Description |
562
- | --- | --- | --- |
563
- | address | <code>string</code> \| <code>null</code> \| <code>undefined</code> | <p>The address of the smart contract instance.</p> |
564
- | ABI | <code>any</code> | <p>The ABI of the smart contract.</p> |
565
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to sign transactions or retrieve blockchain data. Note that this signerOrProvider must be connected to the same network as the smart contract in question.</p> |
566
-
567
- <a name="useERC20TransferableReceivableContract"></a>
568
-
569
- ## useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) ⇒ <code>Contract</code> \| <code>null</code>
570
- <p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
571
- associated with the given pool name on the current chain.</p>
572
-
573
- **Kind**: global function
574
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
575
-
576
- | Param | Type | Description |
577
- | --- | --- | --- |
578
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
579
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
580
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the contract for.</p> |
581
-
582
- <a name="useRealWorldReceivableContract"></a>
583
-
584
- ## useRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
585
- <p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
586
- associated with the given pool name on the current chain.</p>
587
-
588
- **Kind**: global function
589
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
590
-
591
- | Param | Type | Description |
592
- | --- | --- | --- |
593
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
594
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
595
-
596
- <a name="preapprove"></a>
597
-
598
- ## preapprove(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
599
- <p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
600
- Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p>
601
-
602
- **Kind**: global function
603
- **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
604
-
605
- | Param | Type | Description |
606
- | --- | --- | --- |
607
- | payload | <code>EAPreapprovalPayload</code> | <p>The payload for the underwrite approval.</p> |
608
- | chainId | <code>number</code> | <p>The chain ID.</p> |
609
-
610
- <a name="getChainIdFromJsonSignerOrProvider"></a>
611
-
612
- ## getChainIdFromJsonSignerOrProvider(signerOrProvider) ⇒ <code>number</code>
613
- <p>Get the chain ID from a signer or provider object.</p>
614
-
615
- **Kind**: global function
616
- **Returns**: <code>number</code> - <ul>
617
- <li>The chain ID.</li>
618
- </ul>
619
-
620
- | Param | Type | Description |
621
- | --- | --- | --- |
622
- | signerOrProvider | <code>JsonRpcProvider</code> \| <code>JsonRpcSigner</code> | <p>The signer or provider object to get the chain ID from.</p> |
623
-
624
- <a name="getChainIdFromSignerOrProvider"></a>
625
-
626
- ## getChainIdFromSignerOrProvider(signerOrProvider) <code>number</code>
627
- <p>Get the chain ID from a signer or provider object.</p>
628
-
629
- **Kind**: global function
630
- **Returns**: <code>number</code> - <ul>
631
- <li>The chain ID.</li>
632
- </ul>
633
-
634
- | Param | Type | Description |
635
- | --- | --- | --- |
636
- | signerOrProvider | <code>ethers.provider.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to get the chain ID from.</p> |
637
-
638
- <a name="getPoolInfo"></a>
639
-
640
- ## getPoolInfo(poolName, poolType) ⇒ <code>PoolInfoType</code> \| <code>undefined</code>
641
- <p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p>
642
-
643
- **Kind**: global function
644
- **Returns**: <code>PoolInfoType</code> \| <code>undefined</code> - <ul>
645
- <li>The pool info or undefined if the chain ID is not supported.</li>
646
- </ul>
647
-
648
- | Param | Type | Description |
649
- | --- | --- | --- |
650
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
651
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
652
-
653
- <a name="getPoolContract"></a>
654
-
655
- ## getPoolContract(signerOrProvider, chainId, poolName, poolType) ⇒ <code>Contract</code> \| <code>null</code>
656
- <p>Returns an ethers contract instance for a Huma pool contract</p>
657
-
658
- **Kind**: global function
659
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the Pool contract or null if it could not be found.</p>
660
-
661
- | Param | Type | Description |
662
- | --- | --- | --- |
663
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
664
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
665
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
666
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
667
-
668
- <a name="getCreditRecord"></a>
669
-
670
- ## getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;CreditRecord&gt;</code>
671
- <p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p>
672
-
673
- **Kind**: global function
674
- **Returns**: <code>Promise.&lt;CreditRecord&gt;</code> - <ul>
675
- <li>A Promise of the transaction response.</li>
676
- </ul>
677
-
678
- | Param | Type | Description |
679
- | --- | --- | --- |
680
- | address | <code>string</code> | <p>The address to lookup.</p> |
681
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
682
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
683
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
684
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
685
-
686
-
687
- * [getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)](#getCreditRecord) ⇒ <code>Promise.&lt;CreditRecord&gt;</code>
688
- * [.CreditRecord](#getCreditRecord.CreditRecord) : <code>Object</code>
689
- * [.CreditRecord](#getCreditRecord.CreditRecord) : <code>Object</code>
690
-
691
- <a name="getCreditRecord.CreditRecord"></a>
692
-
693
- ### getCreditRecord.CreditRecord : <code>Object</code>
694
- <p>Return type of getCreditRecord</p>
695
-
696
- **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
697
- **Properties**
698
-
699
- | Name | Type | Description |
700
- | --- | --- | --- |
701
- | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
702
- | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
703
- | correction | <code>BigNumber</code> | <p>the adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
704
- | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
705
- | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
706
- | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
707
- | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
708
- | state | <code>number</code> | <p>status of the credit line. For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49</p> |
709
-
710
- <a name="getCreditRecord.CreditRecord"></a>
711
-
712
- ### getCreditRecord.CreditRecord : <code>Object</code>
713
- <p>Return type of getCreditRecord</p>
714
-
715
- **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
716
- **Properties**
717
-
718
- | Name | Type | Description |
719
- | --- | --- | --- |
720
- | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
721
- | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
722
- | correction | <code>BigNumber</code> | <p>the adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
723
- | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
724
- | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
725
- | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
726
- | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
727
- | state | <code>number</code> | <p>status of the credit line. For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49</p> |
728
-
729
- <a name="getTotalDue"></a>
730
-
731
- ## getTotalDue(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;BigNumber&gt;</code>
732
- <p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p>
733
-
734
- **Kind**: global function
735
- **Returns**: <code>Promise.&lt;BigNumber&gt;</code> - <ul>
736
- <li>A Promise of the transaction response.</li>
737
- </ul>
738
-
739
- | Param | Type | Description |
740
- | --- | --- | --- |
741
- | address | <code>string</code> | <p>The address to lookup.</p> |
742
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
743
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
744
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
745
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
746
-
747
- <a name="drawdownFromPool"></a>
748
-
749
- ## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
750
- <p>Calls drawdown on a Huma pool contract</p>
751
-
752
- **Kind**: global function
753
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
754
- <li>A Promise of the transaction response.</li>
755
- </ul>
756
-
757
- | Param | Type | Description |
758
- | --- | --- | --- |
759
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
760
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
761
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
762
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
763
- | drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
764
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
765
-
766
- <a name="makePaymentToPool"></a>
767
-
768
- ## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
769
- <p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
770
- attempt to first increase the allowance of the pool.</p>
771
-
772
- **Kind**: global function
773
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
774
- <li>A Promise of the transaction response.</li>
775
- </ul>
776
-
777
- | Param | Type | Description |
778
- | --- | --- | --- |
779
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
780
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
781
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
782
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
783
- | paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
784
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
785
-
786
- <a name="approvePoolAllowance"></a>
787
-
788
- ## approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
789
- <p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p>
790
-
791
- **Kind**: global function
792
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
793
- <li>A Promise of the transaction response.</li>
794
- </ul>
795
-
796
- | Param | Type | Description |
797
- | --- | --- | --- |
798
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
799
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
800
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
801
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
802
- | allowanceAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
803
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
804
-
805
- <a name="ApprovalResult"></a>
806
-
807
- ## ApprovalResult : <code>Object</code>
808
- <p>Object representing the response to the underwriting approval request.</p>
809
-
810
- **Kind**: global typedef
811
- <a name="EAPayload"></a>
812
-
813
- ## EAPayload : <code>Object</code>
814
- <p>Object representing an invoice payload for underwriting approval.</p>
815
-
816
- **Kind**: global typedef
817
- <a name="CreditEventPayload"></a>
818
-
819
- ## CreditEventPayload : <code>Object</code>
820
- <p>Represents the payload of a credit event.</p>
821
-
822
- **Kind**: global typedef
1
+ ## Objects
2
+
3
+ <dl>
4
+ <dt><a href="#usePoolContract">usePoolContract</a> ⇒ <code>T</code></dt>
5
+ <dd><p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p></dd>
6
+ <dt><a href="#ARWeaveService">ARWeaveService</a> : <code>object</code></dt>
7
+ <dd><p>An object that contains functions to interact with Huma-related data stored on ARWeave</p></dd>
8
+ <dt><a href="#EAService">EAService</a> : <code>object</code></dt>
9
+ <dd><p>An object that contains functions to interact with Huma's EAVerse service.</p></dd>
10
+ <dt><a href="#ReceivableService">ReceivableService</a> : <code>object</code></dt>
11
+ <dd><p>An object that contains functions to interact with Huma's receivables.</p></dd>
12
+ <dt><a href="#SubgraphService">SubgraphService</a> : <code>object</code></dt>
13
+ <dd><p>An object that contains functions to interact with Huma's Subgraph storage.</p></dd>
14
+ </dl>
15
+
16
+ ## Functions
17
+
18
+ <dl>
19
+ <dt><a href="#defaultWrapper">defaultWrapper()</a></dt>
20
+ <dd><p>All built-in and custom scalars, mapped to their actual values</p></dd>
21
+ <dt><a href="#getERC20TransferableReceivableContract">getERC20TransferableReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
22
+ <dd><p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
23
+ associated with the given pool name on the current chain.</p></dd>
24
+ <dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
25
+ <dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
26
+ <dt><a href="#getCreditRecord">getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;CreditRecord&gt;</code></dt>
27
+ <dd><p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p></dd>
28
+ <dt><a href="#getTotalDue">getTotalDue(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;BigNumber&gt;</code></dt>
29
+ <dd><p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p></dd>
30
+ <dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
31
+ <dd><p>Calls drawdown on a Huma pool contract</p></dd>
32
+ <dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
33
+ <dd><p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
34
+ attempt to first increase the allowance of the pool.</p></dd>
35
+ <dt><a href="#approvePoolAllowance">approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
36
+ <dd><p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p></dd>
37
+ <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
38
+ <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
39
+ associated with the given pool name on the current chain.</p></dd>
40
+ <dt><a href="#useContract">useContract(address, ABI, signerOrProvider)</a> ⇒ <code>T</code> | <code>null</code></dt>
41
+ <dd><p>Custom hook for creating an ethers instance of a smart contract.</p></dd>
42
+ <dt><a href="#useERC20TransferableReceivableContract">useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
43
+ <dd><p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
44
+ associated with the given pool name on the current chain.</p></dd>
45
+ <dt><a href="#useRealWorldReceivableContract">useRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
46
+ <dd><p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
47
+ associated with the given pool name on the current chain.</p></dd>
48
+ <dt><a href="#preapprove">preapprove(payload, chainId)</a> ⇒ <code>Promise.&lt;Approval&gt;</code></dt>
49
+ <dd><p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
50
+ Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p></dd>
51
+ <dt><a href="#getChainIdFromJsonSignerOrProvider">getChainIdFromJsonSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
52
+ <dd><p>Get the chain ID from a signer or provider object.</p></dd>
53
+ <dt><a href="#getChainIdFromSignerOrProvider">getChainIdFromSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
54
+ <dd><p>Get the chain ID from a signer or provider object.</p></dd>
55
+ <dt><a href="#getPoolInfo">getPoolInfo(poolName, poolType)</a> ⇒ <code>PoolInfoType</code> | <code>undefined</code></dt>
56
+ <dd><p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p></dd>
57
+ <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
58
+ <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
59
+ associated with the given pool name on the current chain.</p></dd>
60
+ </dl>
61
+
62
+ ## Typedefs
63
+
64
+ <dl>
65
+ <dt><a href="#ApprovalResult">ApprovalResult</a> : <code>Object</code></dt>
66
+ <dd><p>Object representing the response to the underwriting approval request.</p></dd>
67
+ <dt><a href="#EAPayload">EAPayload</a> : <code>Object</code></dt>
68
+ <dd><p>Object representing an invoice payload for underwriting approval.</p></dd>
69
+ <dt><a href="#CreditEventPayload">CreditEventPayload</a> : <code>Object</code></dt>
70
+ <dd><p>Represents the payload of a credit event.</p></dd>
71
+ </dl>
72
+
73
+ <a name="usePoolContract"></a>
74
+
75
+ ## usePoolContract <code>T</code>
76
+ <p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p>
77
+
78
+ **Kind**: global namespace
79
+ **Returns**: <code>T</code> - <p>A contract instance of the specific pool.</p>
80
+
81
+ | Param | Type | Description |
82
+ | --- | --- | --- |
83
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>An ethers signer or provider instance.</p> |
84
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
85
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
86
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
87
+
88
+
89
+ * [usePoolContract](#usePoolContract) ⇒ <code>T</code>
90
+ * [.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType)](#usePoolContract.useCreditRecordDetails) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
91
+ * [.CreditRecordDetails](#usePoolContract.CreditRecordDetails) : <code>Object</code>
92
+
93
+ <a name="usePoolContract.useCreditRecordDetails"></a>
94
+
95
+ ### usePoolContract.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
96
+ <p>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.</p>
97
+
98
+ **Kind**: static method of [<code>usePoolContract</code>](#usePoolContract)
99
+ **Returns**: <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code> - <p>An array containing the credit record details and a function to refresh the data.</p>
100
+
101
+ | Param | Type | Description |
102
+ | --- | --- | --- |
103
+ | userAddress | <code>string</code> | <p>The address of the user to get the credit record details for.</p> |
104
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to use for the contract.</p> |
105
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
106
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the credit record details for.</p> |
107
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
108
+
109
+ <a name="usePoolContract.CreditRecordDetails"></a>
110
+
111
+ ### usePoolContract.CreditRecordDetails : <code>Object</code>
112
+ <p>CreditRecordDetails type object representing the details of a credit line.</p>
113
+
114
+ **Kind**: static typedef of [<code>usePoolContract</code>](#usePoolContract)
115
+ **Properties**
116
+
117
+ | Name | Type | Description |
118
+ | --- | --- | --- |
119
+ | aprInBps | <code>number</code> | <p>The APR (annual percentage rate) in basis points.</p> |
120
+ | correction | <code>BigNumber</code> | <p>adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
121
+ | creditLimit | <code>BigNumber</code> | <p>The credit limit in the pools base currency.</p> |
122
+ | defaultAmount | <code>BigNumber</code> | <p>The amount of the default, if any.</p> |
123
+ | dueDate | <code>BigNumber</code> | <p>The due date of the next payment.</p> |
124
+ | feesAndInterestDue | <code>BigNumber</code> | <p>The fees and interest due.</p> |
125
+ | intervalInDays | <code>number</code> | <p>The interval in days between payment periods.</p> |
126
+ | missedPeriods | <code>number</code> | <p>The number of missed periods.</p> |
127
+ | remainingPeriods | <code>number</code> | <p>The number of remaining periods before this credit line is considered paid off.</p> |
128
+ | state | <code>number</code> | <p>The state of the factorization. Please see the CreditState in huma-contracts for more details.</p> |
129
+ | totalDue | <code>BigNumber</code> | <p>The total due amount of this credit line.</p> |
130
+ | unbilledPrincipal | <code>BigNumber</code> | <p>The unbilled principal of the next payment.</p> |
131
+
132
+ <a name="ARWeaveService"></a>
133
+
134
+ ## ARWeaveService : <code>object</code>
135
+ <p>An object that contains functions to interact with Huma-related data stored on ARWeave</p>
136
+
137
+ **Kind**: global namespace
138
+ <a name="EAService"></a>
139
+
140
+ ## EAService : <code>object</code>
141
+ <p>An object that contains functions to interact with Huma's EAVerse service.</p>
142
+
143
+ **Kind**: global namespace
144
+ <a name="EAService.approve"></a>
145
+
146
+ ### EAService.approve(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
147
+ <p>Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
148
+ in Huma's pools that can be drawn down by the borrower.</p>
149
+
150
+ **Kind**: static method of [<code>EAService</code>](#EAService)
151
+ **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
152
+ **Throws**:
153
+
154
+ - <code>EARejectionError</code> <p>If the underwrite approval is rejected.</p>
155
+
156
+
157
+ | Param | Type | Description |
158
+ | --- | --- | --- |
159
+ | payload | [<code>EAPayload</code>](#EAPayload) | <p>The payload for the underwrite approval.</p> |
160
+ | chainId | <code>number</code> | <p>The chain ID.</p> |
161
+
162
+ <a name="ReceivableService"></a>
163
+
164
+ ## ReceivableService : <code>object</code>
165
+ <p>An object that contains functions to interact with Huma's receivables.</p>
166
+
167
+ **Kind**: global namespace
168
+
169
+ * [ReceivableService](#ReceivableService) : <code>object</code>
170
+ * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
171
+ * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
172
+ * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
173
+ * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
174
+ * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) <code>Promise.&lt;TransactionResponse&gt;</code>
175
+ * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
176
+
177
+ <a name="ReceivableService.getTokenIdByARWeaveId"></a>
178
+
179
+ ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
180
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
181
+
182
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
183
+ **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
184
+ <li>Either the token Id or null if no token was found.</li>
185
+ </ul>
186
+
187
+ | Param | Type | Description |
188
+ | --- | --- | --- |
189
+ | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
190
+ | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
191
+
192
+ <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
193
+
194
+ ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
195
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
196
+
197
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
198
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
199
+ <li>A Promise of the transaction receipt.</li>
200
+ </ul>
201
+
202
+ | Param | Type | Description |
203
+ | --- | --- | --- |
204
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
205
+ | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
206
+ | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
207
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
208
+
209
+ <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
210
+
211
+ ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
212
+ <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
213
+
214
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
215
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
216
+ <li>A Promise of the transaction receipt.</li>
217
+ </ul>
218
+ **Throws**:
219
+
220
+ - <code>Error</code> <ul>
221
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
222
+ </ul>
223
+
224
+
225
+ | Param | Type | Description |
226
+ | --- | --- | --- |
227
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
228
+ | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
229
+ | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
230
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
231
+
232
+ <a name="ReceivableService.createReceivable"></a>
233
+
234
+ ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
235
+ <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
236
+
237
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
238
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
239
+ <li>A Promise of the transaction response.</li>
240
+ </ul>
241
+ **Throws**:
242
+
243
+ - <code>Error</code> <ul>
244
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
245
+ </ul>
246
+
247
+
248
+ | Param | Type | Description |
249
+ | --- | --- | --- |
250
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
251
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
252
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
253
+ | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
254
+ | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
255
+ | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
256
+ | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
257
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
258
+
259
+ <a name="ReceivableService.createReceivableWithMetadata"></a>
260
+
261
+ ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
262
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
263
+
264
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
265
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
266
+ <li>The transaction receipt.</li>
267
+ </ul>
268
+
269
+ | Param | Type | Default | Description |
270
+ | --- | --- | --- | --- |
271
+ | signerOrProvider | <code>Web3Provider</code> \| <code>ethers.Signer</code> | | <p>If calling this function from a browser, this function expects a Web3Provider. If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included from server calls.</p> |
272
+ | privateKey | <code>string</code> \| <code>null</code> | | <p>Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.</p> |
273
+ | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
274
+ | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
275
+ | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
276
+ | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
277
+ | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
278
+ | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
279
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
280
+ | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
281
+ | extraTags | <code>Array.&lt;{name: string, value: string}&gt;</code> | | <p>Any extraTags you'd like to tag your metadata with. Note that metadata on ARWeave is indexed by these tags, so make sure to include any tags that you'd like to be able to query by.</p> |
282
+ | [lazyFund] | <code>boolean</code> | <code>true</code> | <p>Whether to lazy fund the ARWeave uploads. If true, the ARWeave uploads will be paid for by the metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.</p> |
283
+ | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
284
+
285
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
286
+
287
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
288
+ <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
289
+
290
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
291
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
292
+ <li>An array of receivables owned by the owner for the pool.</li>
293
+ </ul>
294
+
295
+ | Param | Type | Description |
296
+ | --- | --- | --- |
297
+ | signerOrProvider | <code>Web3Provider</code> \| <code>ethers.Signer</code> | <p>If calling this function from a browser, this function expects a Web3Provider. If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included from server calls.</p> |
298
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
299
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
300
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
301
+
302
+ <a name="SubgraphService"></a>
303
+
304
+ ## SubgraphService : <code>object</code>
305
+ <p>An object that contains functions to interact with Huma's Subgraph storage.</p>
306
+
307
+ **Kind**: global namespace
308
+
309
+ * [SubgraphService](#SubgraphService) : <code>object</code>
310
+ * [.getSubgraphUrlForChainId(chainId)](#SubgraphService.getSubgraphUrlForChainId) <code>string</code>
311
+ * [.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event)](#SubgraphService.getCreditEventsForUser) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
312
+ * [.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType)](#SubgraphService.getLastFactorizedAmountFromPool) ⇒ <code>Promise.&lt;number&gt;</code>
313
+
314
+ <a name="SubgraphService.getSubgraphUrlForChainId"></a>
315
+
316
+ ### SubgraphService.getSubgraphUrlForChainId(chainId) ⇒ <code>string</code>
317
+ <p>Returns the subgraph URL for a given chain ID.</p>
318
+
319
+ **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
320
+ **Returns**: <code>string</code> - <p>The subgraph URL for the given chain ID.</p>
321
+
322
+ | Param | Type | Description |
323
+ | --- | --- | --- |
324
+ | chainId | <code>number</code> | <p>The ID of the chain.</p> |
325
+
326
+ <a name="SubgraphService.getCreditEventsForUser"></a>
327
+
328
+ ### SubgraphService.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
329
+ <p>Returns the credit events for a given user.</p>
330
+
331
+ **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
332
+ **Returns**: <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code> - <p>The credit events for the given user.</p>
333
+
334
+ | Param | Type | Description |
335
+ | --- | --- | --- |
336
+ | userAddress | <code>string</code> | <p>The address of the user.</p> |
337
+ | chainId | <code>number</code> | <p>The ID of the chain.</p> |
338
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
339
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
340
+ | event | <code>Array.&lt;number&gt;</code> | <p>The event types to filter by.</p> |
341
+
342
+ <a name="SubgraphService.getLastFactorizedAmountFromPool"></a>
343
+
344
+ ### SubgraphService.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType) <code>Promise.&lt;number&gt;</code>
345
+ <p>Returns the last factorized amount for a given user and pool.</p>
346
+
347
+ **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
348
+ **Returns**: <code>Promise.&lt;number&gt;</code> - <p>The last factorized amount for the given user and pool.</p>
349
+
350
+ | Param | Type | Description |
351
+ | --- | --- | --- |
352
+ | userAddress | <code>string</code> | <p>The address of the user.</p> |
353
+ | chainId | <code>number</code> | <p>The ID of the chain.</p> |
354
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
355
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
356
+
357
+ <a name="defaultWrapper"></a>
358
+
359
+ ## defaultWrapper()
360
+ <p>All built-in and custom scalars, mapped to their actual values</p>
361
+
362
+ **Kind**: global function
363
+ <a name="getERC20TransferableReceivableContract"></a>
364
+
365
+ ## getERC20TransferableReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
366
+ <p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
367
+ associated with the given pool name on the current chain.</p>
368
+
369
+ **Kind**: global function
370
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
371
+
372
+ | Param | Type | Description |
373
+ | --- | --- | --- |
374
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
375
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
376
+
377
+ <a name="getPoolContract"></a>
378
+
379
+ ## getPoolContract(signerOrProvider, chainId, poolName, poolType) ⇒ <code>Contract</code> \| <code>null</code>
380
+ <p>Returns an ethers contract instance for a Huma pool contract</p>
381
+
382
+ **Kind**: global function
383
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the Pool contract or null if it could not be found.</p>
384
+
385
+ | Param | Type | Description |
386
+ | --- | --- | --- |
387
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
388
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
389
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
390
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
391
+
392
+ <a name="getCreditRecord"></a>
393
+
394
+ ## getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;CreditRecord&gt;</code>
395
+ <p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p>
396
+
397
+ **Kind**: global function
398
+ **Returns**: <code>Promise.&lt;CreditRecord&gt;</code> - <ul>
399
+ <li>A Promise of the transaction response.</li>
400
+ </ul>
401
+
402
+ | Param | Type | Description |
403
+ | --- | --- | --- |
404
+ | address | <code>string</code> | <p>The address to lookup.</p> |
405
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
406
+ | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
407
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
408
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
409
+
410
+ <a name="getCreditRecord.CreditRecord"></a>
411
+
412
+ ### getCreditRecord.CreditRecord : <code>Object</code>
413
+ <p>Return type of getCreditRecord</p>
414
+
415
+ **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
416
+ **Properties**
417
+
418
+ | Name | Type | Description |
419
+ | --- | --- | --- |
420
+ | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
421
+ | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
422
+ | correction | <code>BigNumber</code> | <p>the adjustment of interest over or under-counted because of drawdown or principal payment in the middle of a billing period</p> |
423
+ | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
424
+ | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
425
+ | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
426
+ | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
427
+ | state | <code>number</code> | <p>status of the credit line. For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49</p> |
428
+
429
+ <a name="getTotalDue"></a>
430
+
431
+ ## getTotalDue(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;BigNumber&gt;</code>
432
+ <p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p>
433
+
434
+ **Kind**: global function
435
+ **Returns**: <code>Promise.&lt;BigNumber&gt;</code> - <ul>
436
+ <li>A Promise of the transaction response.</li>
437
+ </ul>
438
+
439
+ | Param | Type | Description |
440
+ | --- | --- | --- |
441
+ | address | <code>string</code> | <p>The address to lookup.</p> |
442
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
443
+ | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
444
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
445
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
446
+
447
+ <a name="drawdownFromPool"></a>
448
+
449
+ ## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
450
+ <p>Calls drawdown on a Huma pool contract</p>
451
+
452
+ **Kind**: global function
453
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
454
+ <li>A Promise of the transaction response.</li>
455
+ </ul>
456
+
457
+ | Param | Type | Description |
458
+ | --- | --- | --- |
459
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
460
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
461
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
462
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
463
+ | drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
464
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
465
+
466
+ <a name="makePaymentToPool"></a>
467
+
468
+ ## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
469
+ <p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
470
+ attempt to first increase the allowance of the pool.</p>
471
+
472
+ **Kind**: global function
473
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
474
+ <li>A Promise of the transaction response.</li>
475
+ </ul>
476
+
477
+ | Param | Type | Description |
478
+ | --- | --- | --- |
479
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
480
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
481
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
482
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
483
+ | paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
484
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
485
+
486
+ <a name="approvePoolAllowance"></a>
487
+
488
+ ## approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
489
+ <p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p>
490
+
491
+ **Kind**: global function
492
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
493
+ <li>A Promise of the transaction response.</li>
494
+ </ul>
495
+
496
+ | Param | Type | Description |
497
+ | --- | --- | --- |
498
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
499
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
500
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
501
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool to mint the receivable token from. Used to lookup the pool address.</p> |
502
+ | allowanceAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
503
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
504
+
505
+ <a name="getRealWorldReceivableContract"></a>
506
+
507
+ ## getRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
508
+ <p>Returns an ethers contract instance for the RealWorldReceivable contract
509
+ associated with the given pool name on the current chain.</p>
510
+
511
+ **Kind**: global function
512
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
513
+
514
+ | Param | Type | Description |
515
+ | --- | --- | --- |
516
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
517
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
518
+
519
+ <a name="useContract"></a>
520
+
521
+ ## useContract(address, ABI, signerOrProvider) ⇒ <code>T</code> \| <code>null</code>
522
+ <p>Custom hook for creating an ethers instance of a smart contract.</p>
523
+
524
+ **Kind**: global function
525
+ **Returns**: <code>T</code> \| <code>null</code> - <p>An instance of the smart contract, or null if an error occurs.</p>
526
+
527
+ | Param | Type | Description |
528
+ | --- | --- | --- |
529
+ | address | <code>string</code> \| <code>null</code> \| <code>undefined</code> | <p>The address of the smart contract instance.</p> |
530
+ | ABI | <code>any</code> | <p>The ABI of the smart contract.</p> |
531
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to sign transactions or retrieve blockchain data. Note that this signerOrProvider must be connected to the same network as the smart contract in question.</p> |
532
+
533
+ <a name="useERC20TransferableReceivableContract"></a>
534
+
535
+ ## useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) ⇒ <code>Contract</code> \| <code>null</code>
536
+ <p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
537
+ associated with the given pool name on the current chain.</p>
538
+
539
+ **Kind**: global function
540
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
541
+
542
+ | Param | Type | Description |
543
+ | --- | --- | --- |
544
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
545
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
546
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the contract for.</p> |
547
+
548
+ <a name="useRealWorldReceivableContract"></a>
549
+
550
+ ## useRealWorldReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
551
+ <p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
552
+ associated with the given pool name on the current chain.</p>
553
+
554
+ **Kind**: global function
555
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
556
+
557
+ | Param | Type | Description |
558
+ | --- | --- | --- |
559
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
560
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
561
+
562
+ <a name="preapprove"></a>
563
+
564
+ ## preapprove(payload, chainId) <code>Promise.&lt;Approval&gt;</code>
565
+ <p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
566
+ Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p>
567
+
568
+ **Kind**: global function
569
+ **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
570
+
571
+ | Param | Type | Description |
572
+ | --- | --- | --- |
573
+ | payload | <code>EAPreapprovalPayload</code> | <p>The payload for the underwrite approval.</p> |
574
+ | chainId | <code>number</code> | <p>The chain ID.</p> |
575
+
576
+ <a name="getChainIdFromJsonSignerOrProvider"></a>
577
+
578
+ ## getChainIdFromJsonSignerOrProvider(signerOrProvider) <code>number</code>
579
+ <p>Get the chain ID from a signer or provider object.</p>
580
+
581
+ **Kind**: global function
582
+ **Returns**: <code>number</code> - <ul>
583
+ <li>The chain ID.</li>
584
+ </ul>
585
+
586
+ | Param | Type | Description |
587
+ | --- | --- | --- |
588
+ | signerOrProvider | <code>JsonRpcProvider</code> \| <code>JsonRpcSigner</code> | <p>The signer or provider object to get the chain ID from.</p> |
589
+
590
+ <a name="getChainIdFromSignerOrProvider"></a>
591
+
592
+ ## getChainIdFromSignerOrProvider(signerOrProvider) <code>number</code>
593
+ <p>Get the chain ID from a signer or provider object.</p>
594
+
595
+ **Kind**: global function
596
+ **Returns**: <code>number</code> - <ul>
597
+ <li>The chain ID.</li>
598
+ </ul>
599
+
600
+ | Param | Type | Description |
601
+ | --- | --- | --- |
602
+ | signerOrProvider | <code>ethers.provider.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to get the chain ID from.</p> |
603
+
604
+ <a name="getPoolInfo"></a>
605
+
606
+ ## getPoolInfo(poolName, poolType) <code>PoolInfoType</code> \| <code>undefined</code>
607
+ <p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p>
608
+
609
+ **Kind**: global function
610
+ **Returns**: <code>PoolInfoType</code> \| <code>undefined</code> - <ul>
611
+ <li>The pool info or undefined if the chain ID is not supported.</li>
612
+ </ul>
613
+
614
+ | Param | Type | Description |
615
+ | --- | --- | --- |
616
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
617
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
618
+
619
+ <a name="getRealWorldReceivableContract"></a>
620
+
621
+ ## getRealWorldReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
622
+ <p>Returns an ethers contract instance for the RealWorldReceivable contract
623
+ associated with the given pool name on the current chain.</p>
624
+
625
+ **Kind**: global function
626
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
627
+
628
+ | Param | Type | Description |
629
+ | --- | --- | --- |
630
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
631
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
632
+
633
+ <a name="ApprovalResult"></a>
634
+
635
+ ## ApprovalResult : <code>Object</code>
636
+ <p>Object representing the response to the underwriting approval request.</p>
637
+
638
+ **Kind**: global typedef
639
+ <a name="EAPayload"></a>
640
+
641
+ ## EAPayload : <code>Object</code>
642
+ <p>Object representing an invoice payload for underwriting approval.</p>
643
+
644
+ **Kind**: global typedef
645
+ <a name="CreditEventPayload"></a>
646
+
647
+ ## CreditEventPayload : <code>Object</code>
648
+ <p>Represents the payload of a credit event.</p>
649
+
650
+ **Kind**: global typedef