@huma-finance/sdk 0.0.33 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API.md CHANGED
@@ -11,8 +11,6 @@
11
11
  <dd><p>An object that contains functions to interact with Huma's receivables.</p></dd>
12
12
  <dt><a href="#SubgraphService">SubgraphService</a> : <code>object</code></dt>
13
13
  <dd><p>An object that contains functions to interact with Huma's Subgraph storage.</p></dd>
14
- <dt><a href="#ReceivableService">ReceivableService</a> : <code>object</code></dt>
15
- <dd><p>An object that contains functions to interact with Huma's receivables.</p></dd>
16
14
  </dl>
17
15
 
18
16
  ## Functions
@@ -56,6 +54,19 @@ Note that this does not approve a creditline in Huma's pools and an approve call
56
54
  <dd><p>Get the chain ID from a signer or provider object.</p></dd>
57
55
  <dt><a href="#getPoolInfo">getPoolInfo(poolName, poolType)</a> ⇒ <code>PoolInfoType</code> | <code>undefined</code></dt>
58
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>
59
70
  </dl>
60
71
 
61
72
  ## Typedefs
@@ -146,489 +157,32 @@ Note that this does not approve a creditline in Huma's pools and an approve call
146
157
  <p>Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
147
158
  in Huma's pools that can be drawn down by the borrower.</p>
148
159
 
149
- **Kind**: static method of [<code>EAService</code>](#EAService)
150
- **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
151
- **Throws**:
152
-
153
- - <code>EARejectionError</code> <p>If the underwrite approval is rejected.</p>
154
-
155
-
156
- | Param | Type | Description |
157
- | --- | --- | --- |
158
- | payload | [<code>EAPayload</code>](#EAPayload) | <p>The payload for the underwrite approval.</p> |
159
- | chainId | <code>number</code> | <p>The chain ID.</p> |
160
-
161
- <a name="ReceivableService"></a>
162
-
163
- ## ReceivableService : <code>object</code>
164
- <p>An object that contains functions to interact with Huma's receivables.</p>
165
-
166
- **Kind**: global namespace
167
-
168
- * [ReceivableService](#ReceivableService) : <code>object</code>
169
- * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
170
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
171
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
172
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
173
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
174
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
175
- * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
176
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
177
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
178
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
179
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
180
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
181
-
182
- <a name="ReceivableService.getTokenIdByARWeaveId"></a>
183
-
184
- ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
185
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
186
-
187
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
188
- **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
189
- <li>Either the token Id or null if no token was found.</li>
190
- </ul>
191
-
192
- | Param | Type | Description |
193
- | --- | --- | --- |
194
- | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
195
- | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
196
-
197
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
198
-
199
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
200
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
201
-
202
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
203
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
204
- <li>A Promise of the transaction receipt.</li>
205
- </ul>
206
-
207
- | Param | Type | Description |
208
- | --- | --- | --- |
209
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
210
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
211
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
212
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
213
-
214
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
215
-
216
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
217
- <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
218
-
219
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
220
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
221
- <li>A Promise of the transaction receipt.</li>
222
- </ul>
223
- **Throws**:
224
-
225
- - <code>Error</code> <ul>
226
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
227
- </ul>
228
-
229
-
230
- | Param | Type | Description |
231
- | --- | --- | --- |
232
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
233
- | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
234
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
235
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
236
-
237
- <a name="ReceivableService.createReceivable"></a>
238
-
239
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
240
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
241
-
242
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
243
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
244
- <li>A Promise of the transaction response.</li>
245
- </ul>
246
- **Throws**:
247
-
248
- - <code>Error</code> <ul>
249
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
250
- </ul>
251
-
252
-
253
- | Param | Type | Description |
254
- | --- | --- | --- |
255
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
256
- | 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> |
257
- | 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> |
258
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
259
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
260
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
261
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
262
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
263
-
264
- <a name="ReceivableService.createReceivableWithMetadata"></a>
265
-
266
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
267
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
268
-
269
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
270
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
271
- <li>The transaction receipt.</li>
272
- </ul>
273
-
274
- | Param | Type | Default | Description |
275
- | --- | --- | --- | --- |
276
- | 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> |
277
- | 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> |
278
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
279
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
280
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
281
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
282
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
283
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
284
- | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
285
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
286
- | 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> |
287
- | [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> |
288
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
289
-
290
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
291
-
292
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
293
- <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
294
-
295
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
296
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
297
- <li>An array of receivables owned by the owner for the pool.</li>
298
- </ul>
299
-
300
- | Param | Type | Description |
301
- | --- | --- | --- |
302
- | 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> |
303
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
304
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
305
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
306
-
307
- <a name="ReceivableService.getTokenIdByARWeaveId"></a>
308
-
309
- ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
310
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
311
-
312
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
313
- **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
314
- <li>Either the token Id or null if no token was found.</li>
315
- </ul>
316
-
317
- | Param | Type | Description |
318
- | --- | --- | --- |
319
- | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
320
- | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
321
-
322
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
323
-
324
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
325
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
326
-
327
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
328
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
329
- <li>A Promise of the transaction receipt.</li>
330
- </ul>
331
-
332
- | Param | Type | Description |
333
- | --- | --- | --- |
334
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
335
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
336
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
337
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
338
-
339
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
340
-
341
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
342
- <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
343
-
344
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
345
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
346
- <li>A Promise of the transaction receipt.</li>
347
- </ul>
348
- **Throws**:
349
-
350
- - <code>Error</code> <ul>
351
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
352
- </ul>
353
-
354
-
355
- | Param | Type | Description |
356
- | --- | --- | --- |
357
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
358
- | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
359
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
360
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
361
-
362
- <a name="ReceivableService.createReceivable"></a>
363
-
364
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
365
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
366
-
367
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
368
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
369
- <li>A Promise of the transaction response.</li>
370
- </ul>
371
- **Throws**:
372
-
373
- - <code>Error</code> <ul>
374
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
375
- </ul>
376
-
377
-
378
- | Param | Type | Description |
379
- | --- | --- | --- |
380
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
381
- | 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> |
382
- | 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> |
383
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
384
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
385
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
386
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
387
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
388
-
389
- <a name="ReceivableService.createReceivableWithMetadata"></a>
390
-
391
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
392
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
393
-
394
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
395
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
396
- <li>The transaction receipt.</li>
397
- </ul>
398
-
399
- | Param | Type | Default | Description |
400
- | --- | --- | --- | --- |
401
- | 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> |
402
- | 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> |
403
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
404
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
405
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
406
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
407
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
408
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
409
- | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
410
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
411
- | 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> |
412
- | [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> |
413
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
414
-
415
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
416
-
417
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
418
- <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
419
-
420
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
421
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
422
- <li>An array of receivables owned by the owner for the pool.</li>
423
- </ul>
424
-
425
- | Param | Type | Description |
426
- | --- | --- | --- |
427
- | 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> |
428
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
429
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
430
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
431
-
432
- <a name="SubgraphService"></a>
433
-
434
- ## SubgraphService : <code>object</code>
435
- <p>An object that contains functions to interact with Huma's Subgraph storage.</p>
436
-
437
- **Kind**: global namespace
438
-
439
- * [SubgraphService](#SubgraphService) : <code>object</code>
440
- * [.getSubgraphUrlForChainId(chainId)](#SubgraphService.getSubgraphUrlForChainId) ⇒ <code>string</code>
441
- * [.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event)](#SubgraphService.getCreditEventsForUser) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
442
- * [.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType)](#SubgraphService.getLastFactorizedAmountFromPool) ⇒ <code>Promise.&lt;number&gt;</code>
443
-
444
- <a name="SubgraphService.getSubgraphUrlForChainId"></a>
445
-
446
- ### SubgraphService.getSubgraphUrlForChainId(chainId) ⇒ <code>string</code>
447
- <p>Returns the subgraph URL for a given chain ID.</p>
448
-
449
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
450
- **Returns**: <code>string</code> - <p>The subgraph URL for the given chain ID.</p>
451
-
452
- | Param | Type | Description |
453
- | --- | --- | --- |
454
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
455
-
456
- <a name="SubgraphService.getCreditEventsForUser"></a>
457
-
458
- ### SubgraphService.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
459
- <p>Returns the credit events for a given user.</p>
460
-
461
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
462
- **Returns**: <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code> - <p>The credit events for the given user.</p>
463
-
464
- | Param | Type | Description |
465
- | --- | --- | --- |
466
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
467
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
468
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
469
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
470
- | event | <code>Array.&lt;number&gt;</code> | <p>The event types to filter by.</p> |
471
-
472
- <a name="SubgraphService.getLastFactorizedAmountFromPool"></a>
473
-
474
- ### SubgraphService.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType) ⇒ <code>Promise.&lt;number&gt;</code>
475
- <p>Returns the last factorized amount for a given user and pool.</p>
476
-
477
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
478
- **Returns**: <code>Promise.&lt;number&gt;</code> - <p>The last factorized amount for the given user and pool.</p>
479
-
480
- | Param | Type | Description |
481
- | --- | --- | --- |
482
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
483
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
484
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
485
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
486
-
487
- <a name="ReceivableService"></a>
488
-
489
- ## ReceivableService : <code>object</code>
490
- <p>An object that contains functions to interact with Huma's receivables.</p>
491
-
492
- **Kind**: global namespace
493
-
494
- * [ReceivableService](#ReceivableService) : <code>object</code>
495
- * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
496
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
497
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
498
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
499
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
500
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
501
- * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
502
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
503
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
504
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
505
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
506
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
507
-
508
- <a name="ReceivableService.getTokenIdByARWeaveId"></a>
509
-
510
- ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
511
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
512
-
513
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
514
- **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
515
- <li>Either the token Id or null if no token was found.</li>
516
- </ul>
517
-
518
- | Param | Type | Description |
519
- | --- | --- | --- |
520
- | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
521
- | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
522
-
523
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
524
-
525
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
526
- <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
527
-
528
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
529
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
530
- <li>A Promise of the transaction receipt.</li>
531
- </ul>
532
-
533
- | Param | Type | Description |
534
- | --- | --- | --- |
535
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
536
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
537
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
538
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
539
-
540
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
541
-
542
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
543
- <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
544
-
545
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
546
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
547
- <li>A Promise of the transaction receipt.</li>
548
- </ul>
549
- **Throws**:
550
-
551
- - <code>Error</code> <ul>
552
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
553
- </ul>
554
-
555
-
556
- | Param | Type | Description |
557
- | --- | --- | --- |
558
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
559
- | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
560
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
561
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
562
-
563
- <a name="ReceivableService.createReceivable"></a>
564
-
565
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
566
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
567
-
568
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
569
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
570
- <li>A Promise of the transaction response.</li>
571
- </ul>
572
- **Throws**:
573
-
574
- - <code>Error</code> <ul>
575
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
576
- </ul>
577
-
578
-
579
- | Param | Type | Description |
580
- | --- | --- | --- |
581
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
582
- | 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> |
583
- | 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> |
584
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
585
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
586
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
587
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
588
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
589
-
590
- <a name="ReceivableService.createReceivableWithMetadata"></a>
591
-
592
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
593
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
594
-
595
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
596
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
597
- <li>The transaction receipt.</li>
598
- </ul>
599
-
600
- | Param | Type | Default | Description |
601
- | --- | --- | --- | --- |
602
- | 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> |
603
- | 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> |
604
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
605
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
606
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
607
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
608
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
609
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
610
- | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
611
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
612
- | 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> |
613
- | [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> |
614
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
615
-
616
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
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**:
617
163
 
618
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
619
- <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
164
+ - <code>EARejectionError</code> <p>If the underwrite approval is rejected.</p>
620
165
 
621
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
622
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
623
- <li>An array of receivables owned by the owner for the pool.</li>
624
- </ul>
625
166
 
626
167
  | Param | Type | Description |
627
168
  | --- | --- | --- |
628
- | 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> |
629
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
630
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
631
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
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>
632
186
 
633
187
  <a name="ReceivableService.getTokenIdByARWeaveId"></a>
634
188
 
@@ -755,6 +309,61 @@ in Huma's pools that can be drawn down by the borrower.</p>
755
309
  | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
756
310
  | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
757
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
+
758
367
  <a name="defaultWrapper"></a>
759
368
 
760
369
  ## defaultWrapper()
@@ -808,6 +417,30 @@ associated with the given pool name on the current chain.</p>
808
417
  | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
809
418
  | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
810
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
+
811
444
  <a name="getCreditRecord.CreditRecord"></a>
812
445
 
813
446
  ### getCreditRecord.CreditRecord : <code>Object</code>
@@ -1017,6 +650,158 @@ Note that this does not approve a creditline in Huma's pools and an approve call
1017
650
  | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
1018
651
  | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
1019
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
+
1020
805
  <a name="ApprovalResult"></a>
1021
806
 
1022
807
  ## ApprovalResult : <code>Object</code>