@huma-finance/sdk 0.0.31 → 0.0.33

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 +1037 -977
  2. package/LICENSE +660 -660
  3. package/README.md +34 -34
  4. package/dist/cjs/graphql/generatedTypes.d.ts +40 -40
  5. package/dist/cjs/graphql/generatedTypes.js +8 -8
  6. package/dist/cjs/graphql/index.d.ts +1 -1
  7. package/dist/cjs/graphql/index.js +4 -4
  8. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  9. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +22 -0
  10. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  11. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  12. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
  13. package/dist/cjs/helpers/PoolContractHelper.d.ts +119 -119
  14. package/dist/cjs/helpers/PoolContractHelper.js +142 -142
  15. package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  16. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
  17. package/dist/cjs/helpers/index.d.ts +3 -3
  18. package/dist/cjs/helpers/index.js +6 -6
  19. package/dist/cjs/hooks/index.d.ts +4 -4
  20. package/dist/cjs/hooks/index.js +7 -7
  21. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  22. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +20 -0
  23. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  24. package/dist/cjs/hooks/useContract.d.ts +13 -13
  25. package/dist/cjs/hooks/useContract.js +30 -30
  26. package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  27. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
  28. package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
  29. package/dist/cjs/hooks/usePoolContract.js +53 -53
  30. package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
  31. package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
  32. package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  33. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +17 -0
  34. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  35. package/dist/cjs/index.d.ts +4 -4
  36. package/dist/cjs/index.js +7 -7
  37. package/dist/cjs/services/ARWeaveService.d.ts +106 -106
  38. package/dist/cjs/services/ARWeaveService.js +190 -190
  39. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  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 -105
  43. package/dist/cjs/services/ReceivableService.js +309 -253
  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 +133 -133
  70. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  71. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  72. package/dist/helpers/index.d.ts +3 -3
  73. package/dist/helpers/index.js +3 -3
  74. package/dist/hooks/index.d.ts +4 -4
  75. package/dist/hooks/index.js +4 -4
  76. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  77. package/dist/hooks/useBaseCreditPoolReceivableContract.js +16 -0
  78. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  79. package/dist/hooks/useContract.d.ts +13 -13
  80. package/dist/hooks/useContract.js +26 -26
  81. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  82. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  83. package/dist/hooks/usePool.d.ts +0 -0
  84. package/dist/hooks/usePool.js +2 -0
  85. package/dist/hooks/usePool.js.map +1 -0
  86. package/dist/hooks/usePoolContract.d.ts +60 -60
  87. package/dist/hooks/usePoolContract.js +48 -48
  88. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  89. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  90. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  91. package/dist/hooks/useReceivableFactoringPoolContract.js +13 -0
  92. package/dist/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  93. package/dist/index.d.ts +4 -4
  94. package/dist/index.js +4 -4
  95. package/dist/services/ARWeaveService.d.ts +106 -106
  96. package/dist/services/ARWeaveService.js +185 -185
  97. package/dist/services/ARWeaveService.js.map +1 -1
  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 -105
  101. package/dist/services/ReceivableService.js +305 -249
  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,977 +1,1037 @@
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
- <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
- </dl>
17
-
18
- ## Functions
19
-
20
- <dl>
21
- <dt><a href="#defaultWrapper">defaultWrapper()</a></dt>
22
- <dd><p>All built-in and custom scalars, mapped to their actual values</p></dd>
23
- <dt><a href="#getERC20TransferableReceivableContract">getERC20TransferableReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
24
- <dd><p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
25
- associated with the given pool name on the current chain.</p></dd>
26
- <dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
27
- <dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
28
- <dt><a href="#getCreditRecord">getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;CreditRecord&gt;</code></dt>
29
- <dd><p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p></dd>
30
- <dt><a href="#getTotalDue">getTotalDue(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;BigNumber&gt;</code></dt>
31
- <dd><p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p></dd>
32
- <dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
33
- <dd><p>Calls drawdown on a Huma pool contract</p></dd>
34
- <dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
35
- <dd><p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
36
- attempt to first increase the allowance of the pool.</p></dd>
37
- <dt><a href="#approvePoolAllowance">approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
38
- <dd><p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p></dd>
39
- <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
40
- <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
41
- associated with the given pool name on the current chain.</p></dd>
42
- <dt><a href="#useContract">useContract(address, ABI, signerOrProvider)</a> ⇒ <code>T</code> | <code>null</code></dt>
43
- <dd><p>Custom hook for creating an ethers instance of a smart contract.</p></dd>
44
- <dt><a href="#useERC20TransferableReceivableContract">useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
45
- <dd><p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
46
- associated with the given pool name on the current chain.</p></dd>
47
- <dt><a href="#useRealWorldReceivableContract">useRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
48
- <dd><p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
49
- associated with the given pool name on the current chain.</p></dd>
50
- <dt><a href="#preapprove">preapprove(payload, chainId)</a> ⇒ <code>Promise.&lt;Approval&gt;</code></dt>
51
- <dd><p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
52
- Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p></dd>
53
- <dt><a href="#getChainIdFromJsonSignerOrProvider">getChainIdFromJsonSignerOrProvider(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="#getChainIdFromSignerOrProvider">getChainIdFromSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
56
- <dd><p>Get the chain ID from a signer or provider object.</p></dd>
57
- <dt><a href="#getPoolInfo">getPoolInfo(poolName, poolType)</a> ⇒ <code>PoolInfoType</code> | <code>undefined</code></dt>
58
- <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>
59
- </dl>
60
-
61
- ## Typedefs
62
-
63
- <dl>
64
- <dt><a href="#ApprovalResult">ApprovalResult</a> : <code>Object</code></dt>
65
- <dd><p>Object representing the response to the underwriting approval request.</p></dd>
66
- <dt><a href="#EAPayload">EAPayload</a> : <code>Object</code></dt>
67
- <dd><p>Object representing an invoice payload for underwriting approval.</p></dd>
68
- <dt><a href="#CreditEventPayload">CreditEventPayload</a> : <code>Object</code></dt>
69
- <dd><p>Represents the payload of a credit event.</p></dd>
70
- </dl>
71
-
72
- <a name="usePoolContract"></a>
73
-
74
- ## usePoolContract ⇒ <code>T</code>
75
- <p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p>
76
-
77
- **Kind**: global namespace
78
- **Returns**: <code>T</code> - <p>A contract instance of the specific pool.</p>
79
-
80
- | Param | Type | Description |
81
- | --- | --- | --- |
82
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>An ethers signer or provider instance.</p> |
83
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
84
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
85
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
86
-
87
-
88
- * [usePoolContract](#usePoolContract) ⇒ <code>T</code>
89
- * [.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType)](#usePoolContract.useCreditRecordDetails) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
90
- * [.CreditRecordDetails](#usePoolContract.CreditRecordDetails) : <code>Object</code>
91
-
92
- <a name="usePoolContract.useCreditRecordDetails"></a>
93
-
94
- ### usePoolContract.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
95
- <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>
96
-
97
- **Kind**: static method of [<code>usePoolContract</code>](#usePoolContract)
98
- **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>
99
-
100
- | Param | Type | Description |
101
- | --- | --- | --- |
102
- | userAddress | <code>string</code> | <p>The address of the user to get the credit record details for.</p> |
103
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to use for the contract.</p> |
104
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
105
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the credit record details for.</p> |
106
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
107
-
108
- <a name="usePoolContract.CreditRecordDetails"></a>
109
-
110
- ### usePoolContract.CreditRecordDetails : <code>Object</code>
111
- <p>CreditRecordDetails type object representing the details of a credit line.</p>
112
-
113
- **Kind**: static typedef of [<code>usePoolContract</code>](#usePoolContract)
114
- **Properties**
115
-
116
- | Name | Type | Description |
117
- | --- | --- | --- |
118
- | aprInBps | <code>number</code> | <p>The APR (annual percentage rate) in basis points.</p> |
119
- | 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> |
120
- | creditLimit | <code>BigNumber</code> | <p>The credit limit in the pools base currency.</p> |
121
- | defaultAmount | <code>BigNumber</code> | <p>The amount of the default, if any.</p> |
122
- | dueDate | <code>BigNumber</code> | <p>The due date of the next payment.</p> |
123
- | feesAndInterestDue | <code>BigNumber</code> | <p>The fees and interest due.</p> |
124
- | intervalInDays | <code>number</code> | <p>The interval in days between payment periods.</p> |
125
- | missedPeriods | <code>number</code> | <p>The number of missed periods.</p> |
126
- | remainingPeriods | <code>number</code> | <p>The number of remaining periods before this credit line is considered paid off.</p> |
127
- | state | <code>number</code> | <p>The state of the factorization. Please see the CreditState in huma-contracts for more details.</p> |
128
- | totalDue | <code>BigNumber</code> | <p>The total due amount of this credit line.</p> |
129
- | unbilledPrincipal | <code>BigNumber</code> | <p>The unbilled principal of the next payment.</p> |
130
-
131
- <a name="ARWeaveService"></a>
132
-
133
- ## ARWeaveService : <code>object</code>
134
- <p>An object that contains functions to interact with Huma-related data stored on ARWeave</p>
135
-
136
- **Kind**: global namespace
137
- <a name="EAService"></a>
138
-
139
- ## EAService : <code>object</code>
140
- <p>An object that contains functions to interact with Huma's EAVerse service.</p>
141
-
142
- **Kind**: global namespace
143
- <a name="EAService.approve"></a>
144
-
145
- ### EAService.approve(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
146
- <p>Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
147
- in Huma's pools that can be drawn down by the borrower.</p>
148
-
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
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
170
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
171
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
172
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
173
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
174
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
175
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
176
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
177
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
178
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
179
-
180
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
181
-
182
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
183
- <p>Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.</p>
184
-
185
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
186
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
187
- <li>A Promise of the transaction receipt.</li>
188
- </ul>
189
-
190
- | Param | Type | Description |
191
- | --- | --- | --- |
192
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
193
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
194
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
195
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
196
-
197
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
198
-
199
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
200
- <p>Declares a payment on a RealWorldReceivable given a tokenID of the receivable.</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
- **Throws**:
207
-
208
- - <code>Error</code> <ul>
209
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
210
- </ul>
211
-
212
-
213
- | Param | Type | Description |
214
- | --- | --- | --- |
215
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
216
- | receivableTokenId | <code>BigNumberish</code> | <p>The ID of the receivable token to pay.</p> |
217
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
218
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
219
-
220
- <a name="ReceivableService.createReceivable"></a>
221
-
222
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
223
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
224
-
225
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
226
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
227
- <li>A Promise of the transaction response.</li>
228
- </ul>
229
- **Throws**:
230
-
231
- - <code>Error</code> <ul>
232
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
233
- </ul>
234
-
235
-
236
- | Param | Type | Description |
237
- | --- | --- | --- |
238
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
239
- | 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> |
240
- | 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> |
241
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
242
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
243
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
244
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
245
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
246
-
247
- <a name="ReceivableService.createReceivableWithMetadata"></a>
248
-
249
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
250
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
251
-
252
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
253
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
254
- <li>The transaction receipt.</li>
255
- </ul>
256
-
257
- | Param | Type | Default | Description |
258
- | --- | --- | --- | --- |
259
- | 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> |
260
- | 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> |
261
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
262
- | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
263
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
264
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
265
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
266
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
267
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
268
- | metadata | <code>JSON</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
269
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
270
- | 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> |
271
- | [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> |
272
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
273
-
274
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
275
-
276
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
277
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
278
-
279
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
280
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
281
- <li>An array of receivables owned by the owner for the pool.</li>
282
- </ul>
283
-
284
- | Param | Type | Description |
285
- | --- | --- | --- |
286
- | 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> |
287
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
288
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
289
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
290
-
291
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
292
-
293
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
294
- <p>Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.</p>
295
-
296
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
297
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
298
- <li>A Promise of the transaction receipt.</li>
299
- </ul>
300
-
301
- | Param | Type | Description |
302
- | --- | --- | --- |
303
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
304
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
305
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
306
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
307
-
308
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
309
-
310
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
311
- <p>Declares a payment on a RealWorldReceivable given a tokenID of the receivable.</p>
312
-
313
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
314
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
315
- <li>A Promise of the transaction receipt.</li>
316
- </ul>
317
- **Throws**:
318
-
319
- - <code>Error</code> <ul>
320
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
321
- </ul>
322
-
323
-
324
- | Param | Type | Description |
325
- | --- | --- | --- |
326
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
327
- | receivableTokenId | <code>BigNumberish</code> | <p>The ID of the receivable token to pay.</p> |
328
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
329
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
330
-
331
- <a name="ReceivableService.createReceivable"></a>
332
-
333
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
334
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
335
-
336
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
337
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
338
- <li>A Promise of the transaction response.</li>
339
- </ul>
340
- **Throws**:
341
-
342
- - <code>Error</code> <ul>
343
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
344
- </ul>
345
-
346
-
347
- | Param | Type | Description |
348
- | --- | --- | --- |
349
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
350
- | 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> |
351
- | 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> |
352
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
353
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
354
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
355
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
356
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
357
-
358
- <a name="ReceivableService.createReceivableWithMetadata"></a>
359
-
360
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
361
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
362
-
363
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
364
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
365
- <li>The transaction receipt.</li>
366
- </ul>
367
-
368
- | Param | Type | Default | Description |
369
- | --- | --- | --- | --- |
370
- | 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> |
371
- | 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> |
372
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
373
- | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
374
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
375
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
376
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
377
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
378
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
379
- | metadata | <code>JSON</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
380
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
381
- | 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> |
382
- | [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> |
383
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
384
-
385
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
386
-
387
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
388
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
389
-
390
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
391
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
392
- <li>An array of receivables owned by the owner for the pool.</li>
393
- </ul>
394
-
395
- | Param | Type | Description |
396
- | --- | --- | --- |
397
- | 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> |
398
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
399
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
400
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
401
-
402
- <a name="SubgraphService"></a>
403
-
404
- ## SubgraphService : <code>object</code>
405
- <p>An object that contains functions to interact with Huma's Subgraph storage.</p>
406
-
407
- **Kind**: global namespace
408
-
409
- * [SubgraphService](#SubgraphService) : <code>object</code>
410
- * [.getSubgraphUrlForChainId(chainId)](#SubgraphService.getSubgraphUrlForChainId) <code>string</code>
411
- * [.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event)](#SubgraphService.getCreditEventsForUser) ⇒ <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
412
- * [.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType)](#SubgraphService.getLastFactorizedAmountFromPool) <code>Promise.&lt;number&gt;</code>
413
-
414
- <a name="SubgraphService.getSubgraphUrlForChainId"></a>
415
-
416
- ### SubgraphService.getSubgraphUrlForChainId(chainId) ⇒ <code>string</code>
417
- <p>Returns the subgraph URL for a given chain ID.</p>
418
-
419
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
420
- **Returns**: <code>string</code> - <p>The subgraph URL for the given chain ID.</p>
421
-
422
- | Param | Type | Description |
423
- | --- | --- | --- |
424
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
425
-
426
- <a name="SubgraphService.getCreditEventsForUser"></a>
427
-
428
- ### SubgraphService.getCreditEventsForUser(userAddress, chainId, poolName, poolType, event) <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code>
429
- <p>Returns the credit events for a given user.</p>
430
-
431
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
432
- **Returns**: <code>Promise.&lt;Array.&lt;CreditEventPayload&gt;&gt;</code> - <p>The credit events for the given user.</p>
433
-
434
- | Param | Type | Description |
435
- | --- | --- | --- |
436
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
437
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
438
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
439
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
440
- | event | <code>Array.&lt;number&gt;</code> | <p>The event types to filter by.</p> |
441
-
442
- <a name="SubgraphService.getLastFactorizedAmountFromPool"></a>
443
-
444
- ### SubgraphService.getLastFactorizedAmountFromPool(userAddress, chainId, poolName, poolType) ⇒ <code>Promise.&lt;number&gt;</code>
445
- <p>Returns the last factorized amount for a given user and pool.</p>
446
-
447
- **Kind**: static method of [<code>SubgraphService</code>](#SubgraphService)
448
- **Returns**: <code>Promise.&lt;number&gt;</code> - <p>The last factorized amount for the given user and pool.</p>
449
-
450
- | Param | Type | Description |
451
- | --- | --- | --- |
452
- | userAddress | <code>string</code> | <p>The address of the user.</p> |
453
- | chainId | <code>number</code> | <p>The ID of the chain.</p> |
454
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
455
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
456
-
457
- <a name="ReceivableService"></a>
458
-
459
- ## ReceivableService : <code>object</code>
460
- <p>An object that contains functions to interact with Huma's receivables.</p>
461
-
462
- **Kind**: global namespace
463
-
464
- * [ReceivableService](#ReceivableService) : <code>object</code>
465
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) <code>Promise.&lt;TransactionResponse&gt;</code>
466
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
467
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) <code>Promise.&lt;TransactionResponse&gt;</code>
468
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
469
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
470
- * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
471
- * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
472
- * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
473
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
474
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
475
-
476
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
477
-
478
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
479
- <p>Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.</p>
480
-
481
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
482
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
483
- <li>A Promise of the transaction receipt.</li>
484
- </ul>
485
-
486
- | Param | Type | Description |
487
- | --- | --- | --- |
488
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
489
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
490
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
491
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
492
-
493
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
494
-
495
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
496
- <p>Declares a payment on a RealWorldReceivable given a tokenID of the receivable.</p>
497
-
498
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
499
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
500
- <li>A Promise of the transaction receipt.</li>
501
- </ul>
502
- **Throws**:
503
-
504
- - <code>Error</code> <ul>
505
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
506
- </ul>
507
-
508
-
509
- | Param | Type | Description |
510
- | --- | --- | --- |
511
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
512
- | receivableTokenId | <code>BigNumberish</code> | <p>The ID of the receivable token to pay.</p> |
513
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
514
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
515
-
516
- <a name="ReceivableService.createReceivable"></a>
517
-
518
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
519
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
520
-
521
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
522
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
523
- <li>A Promise of the transaction response.</li>
524
- </ul>
525
- **Throws**:
526
-
527
- - <code>Error</code> <ul>
528
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
529
- </ul>
530
-
531
-
532
- | Param | Type | Description |
533
- | --- | --- | --- |
534
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
535
- | 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> |
536
- | 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> |
537
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
538
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
539
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
540
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
541
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
542
-
543
- <a name="ReceivableService.createReceivableWithMetadata"></a>
544
-
545
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
546
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
547
-
548
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
549
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
550
- <li>The transaction receipt.</li>
551
- </ul>
552
-
553
- | Param | Type | Default | Description |
554
- | --- | --- | --- | --- |
555
- | 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> |
556
- | 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> |
557
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
558
- | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
559
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
560
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
561
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
562
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
563
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
564
- | metadata | <code>JSON</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
565
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
566
- | 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> |
567
- | [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> |
568
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
569
-
570
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
571
-
572
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
573
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
574
-
575
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
576
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
577
- <li>An array of receivables owned by the owner for the pool.</li>
578
- </ul>
579
-
580
- | Param | Type | Description |
581
- | --- | --- | --- |
582
- | 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> |
583
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
584
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
585
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
586
-
587
- <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
588
-
589
- ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
590
- <p>Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.</p>
591
-
592
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
593
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
594
- <li>A Promise of the transaction receipt.</li>
595
- </ul>
596
-
597
- | Param | Type | Description |
598
- | --- | --- | --- |
599
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
600
- | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
601
- | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
602
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
603
-
604
- <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
605
-
606
- ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
607
- <p>Declares a payment on a RealWorldReceivable given a tokenID of the receivable.</p>
608
-
609
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
610
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
611
- <li>A Promise of the transaction receipt.</li>
612
- </ul>
613
- **Throws**:
614
-
615
- - <code>Error</code> <ul>
616
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
617
- </ul>
618
-
619
-
620
- | Param | Type | Description |
621
- | --- | --- | --- |
622
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
623
- | receivableTokenId | <code>BigNumberish</code> | <p>The ID of the receivable token to pay.</p> |
624
- | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
625
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
626
-
627
- <a name="ReceivableService.createReceivable"></a>
628
-
629
- ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
630
- <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
631
-
632
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
633
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
634
- <li>A Promise of the transaction response.</li>
635
- </ul>
636
- **Throws**:
637
-
638
- - <code>Error</code> <ul>
639
- <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
640
- </ul>
641
-
642
-
643
- | Param | Type | Description |
644
- | --- | --- | --- |
645
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
646
- | 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> |
647
- | 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> |
648
- | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
649
- | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
650
- | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
651
- | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
652
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
653
-
654
- <a name="ReceivableService.createReceivableWithMetadata"></a>
655
-
656
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
657
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
658
-
659
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
660
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
661
- <li>The transaction receipt.</li>
662
- </ul>
663
-
664
- | Param | Type | Default | Description |
665
- | --- | --- | --- | --- |
666
- | 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> |
667
- | 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> |
668
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
669
- | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
670
- | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
671
- | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
672
- | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
673
- | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
674
- | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
675
- | metadata | <code>JSON</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
676
- | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
677
- | 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> |
678
- | [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> |
679
- | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
680
-
681
- <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
682
-
683
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
684
- <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
685
-
686
- **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
687
- **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
688
- <li>An array of receivables owned by the owner for the pool.</li>
689
- </ul>
690
-
691
- | Param | Type | Description |
692
- | --- | --- | --- |
693
- | 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> |
694
- | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
695
- | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
696
- | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
697
-
698
- <a name="defaultWrapper"></a>
699
-
700
- ## defaultWrapper()
701
- <p>All built-in and custom scalars, mapped to their actual values</p>
702
-
703
- **Kind**: global function
704
- <a name="getERC20TransferableReceivableContract"></a>
705
-
706
- ## getERC20TransferableReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
707
- <p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
708
- associated with the given pool name on the current chain.</p>
709
-
710
- **Kind**: global function
711
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
712
-
713
- | Param | Type | Description |
714
- | --- | --- | --- |
715
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
716
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
717
-
718
- <a name="getPoolContract"></a>
719
-
720
- ## getPoolContract(signerOrProvider, chainId, poolName, poolType) ⇒ <code>Contract</code> \| <code>null</code>
721
- <p>Returns an ethers contract instance for a Huma pool contract</p>
722
-
723
- **Kind**: global function
724
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the Pool contract or null if it could not be found.</p>
725
-
726
- | Param | Type | Description |
727
- | --- | --- | --- |
728
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
729
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
730
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
731
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
732
-
733
- <a name="getCreditRecord"></a>
734
-
735
- ## getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;CreditRecord&gt;</code>
736
- <p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p>
737
-
738
- **Kind**: global function
739
- **Returns**: <code>Promise.&lt;CreditRecord&gt;</code> - <ul>
740
- <li>A Promise of the transaction response.</li>
741
- </ul>
742
-
743
- | Param | Type | Description |
744
- | --- | --- | --- |
745
- | address | <code>string</code> | <p>The address to lookup.</p> |
746
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
747
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
748
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
749
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
750
-
751
- <a name="getCreditRecord.CreditRecord"></a>
752
-
753
- ### getCreditRecord.CreditRecord : <code>Object</code>
754
- <p>Return type of getCreditRecord</p>
755
-
756
- **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
757
- **Properties**
758
-
759
- | Name | Type | Description |
760
- | --- | --- | --- |
761
- | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
762
- | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
763
- | 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> |
764
- | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
765
- | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
766
- | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
767
- | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
768
- | 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> |
769
-
770
- <a name="getTotalDue"></a>
771
-
772
- ## getTotalDue(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;BigNumber&gt;</code>
773
- <p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p>
774
-
775
- **Kind**: global function
776
- **Returns**: <code>Promise.&lt;BigNumber&gt;</code> - <ul>
777
- <li>A Promise of the transaction response.</li>
778
- </ul>
779
-
780
- | Param | Type | Description |
781
- | --- | --- | --- |
782
- | address | <code>string</code> | <p>The address to lookup.</p> |
783
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
784
- | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
785
- | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
786
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
787
-
788
- <a name="drawdownFromPool"></a>
789
-
790
- ## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
791
- <p>Calls drawdown on a Huma pool contract</p>
792
-
793
- **Kind**: global function
794
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
795
- <li>A Promise of the transaction response.</li>
796
- </ul>
797
-
798
- | Param | Type | Description |
799
- | --- | --- | --- |
800
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
801
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
802
- | 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> |
803
- | 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> |
804
- | drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
805
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
806
-
807
- <a name="makePaymentToPool"></a>
808
-
809
- ## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
810
- <p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
811
- attempt to first increase the allowance of the pool.</p>
812
-
813
- **Kind**: global function
814
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
815
- <li>A Promise of the transaction response.</li>
816
- </ul>
817
-
818
- | Param | Type | Description |
819
- | --- | --- | --- |
820
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
821
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
822
- | 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> |
823
- | 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> |
824
- | paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
825
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
826
-
827
- <a name="approvePoolAllowance"></a>
828
-
829
- ## approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
830
- <p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p>
831
-
832
- **Kind**: global function
833
- **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
834
- <li>A Promise of the transaction response.</li>
835
- </ul>
836
-
837
- | Param | Type | Description |
838
- | --- | --- | --- |
839
- | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
840
- | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
841
- | 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> |
842
- | 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> |
843
- | allowanceAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
844
- | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
845
-
846
- <a name="getRealWorldReceivableContract"></a>
847
-
848
- ## getRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
849
- <p>Returns an ethers contract instance for the RealWorldReceivable contract
850
- associated with the given pool name on the current chain.</p>
851
-
852
- **Kind**: global function
853
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
854
-
855
- | Param | Type | Description |
856
- | --- | --- | --- |
857
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
858
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
859
-
860
- <a name="useContract"></a>
861
-
862
- ## useContract(address, ABI, signerOrProvider) ⇒ <code>T</code> \| <code>null</code>
863
- <p>Custom hook for creating an ethers instance of a smart contract.</p>
864
-
865
- **Kind**: global function
866
- **Returns**: <code>T</code> \| <code>null</code> - <p>An instance of the smart contract, or null if an error occurs.</p>
867
-
868
- | Param | Type | Description |
869
- | --- | --- | --- |
870
- | address | <code>string</code> \| <code>null</code> \| <code>undefined</code> | <p>The address of the smart contract instance.</p> |
871
- | ABI | <code>any</code> | <p>The ABI of the smart contract.</p> |
872
- | 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> |
873
-
874
- <a name="useERC20TransferableReceivableContract"></a>
875
-
876
- ## useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) ⇒ <code>Contract</code> \| <code>null</code>
877
- <p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
878
- associated with the given pool name on the current chain.</p>
879
-
880
- **Kind**: global function
881
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
882
-
883
- | Param | Type | Description |
884
- | --- | --- | --- |
885
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
886
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
887
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the contract for.</p> |
888
-
889
- <a name="useRealWorldReceivableContract"></a>
890
-
891
- ## useRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
892
- <p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
893
- associated with the given pool name on the current chain.</p>
894
-
895
- **Kind**: global function
896
- **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
897
-
898
- | Param | Type | Description |
899
- | --- | --- | --- |
900
- | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
901
- | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
902
-
903
- <a name="preapprove"></a>
904
-
905
- ## preapprove(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
906
- <p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
907
- Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p>
908
-
909
- **Kind**: global function
910
- **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
911
-
912
- | Param | Type | Description |
913
- | --- | --- | --- |
914
- | payload | <code>EAPreapprovalPayload</code> | <p>The payload for the underwrite approval.</p> |
915
- | chainId | <code>number</code> | <p>The chain ID.</p> |
916
-
917
- <a name="getChainIdFromJsonSignerOrProvider"></a>
918
-
919
- ## getChainIdFromJsonSignerOrProvider(signerOrProvider) ⇒ <code>number</code>
920
- <p>Get the chain ID from a signer or provider object.</p>
921
-
922
- **Kind**: global function
923
- **Returns**: <code>number</code> - <ul>
924
- <li>The chain ID.</li>
925
- </ul>
926
-
927
- | Param | Type | Description |
928
- | --- | --- | --- |
929
- | signerOrProvider | <code>JsonRpcProvider</code> \| <code>JsonRpcSigner</code> | <p>The signer or provider object to get the chain ID from.</p> |
930
-
931
- <a name="getChainIdFromSignerOrProvider"></a>
932
-
933
- ## getChainIdFromSignerOrProvider(signerOrProvider) ⇒ <code>number</code>
934
- <p>Get the chain ID from a signer or provider object.</p>
935
-
936
- **Kind**: global function
937
- **Returns**: <code>number</code> - <ul>
938
- <li>The chain ID.</li>
939
- </ul>
940
-
941
- | Param | Type | Description |
942
- | --- | --- | --- |
943
- | signerOrProvider | <code>ethers.provider.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to get the chain ID from.</p> |
944
-
945
- <a name="getPoolInfo"></a>
946
-
947
- ## getPoolInfo(poolName, poolType) <code>PoolInfoType</code> \| <code>undefined</code>
948
- <p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p>
949
-
950
- **Kind**: global function
951
- **Returns**: <code>PoolInfoType</code> \| <code>undefined</code> - <ul>
952
- <li>The pool info or undefined if the chain ID is not supported.</li>
953
- </ul>
954
-
955
- | Param | Type | Description |
956
- | --- | --- | --- |
957
- | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
958
- | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
959
-
960
- <a name="ApprovalResult"></a>
961
-
962
- ## ApprovalResult : <code>Object</code>
963
- <p>Object representing the response to the underwriting approval request.</p>
964
-
965
- **Kind**: global typedef
966
- <a name="EAPayload"></a>
967
-
968
- ## EAPayload : <code>Object</code>
969
- <p>Object representing an invoice payload for underwriting approval.</p>
970
-
971
- **Kind**: global typedef
972
- <a name="CreditEventPayload"></a>
973
-
974
- ## CreditEventPayload : <code>Object</code>
975
- <p>Represents the payload of a credit event.</p>
976
-
977
- **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
+ <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
+ </dl>
17
+
18
+ ## Functions
19
+
20
+ <dl>
21
+ <dt><a href="#defaultWrapper">defaultWrapper()</a></dt>
22
+ <dd><p>All built-in and custom scalars, mapped to their actual values</p></dd>
23
+ <dt><a href="#getERC20TransferableReceivableContract">getERC20TransferableReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
24
+ <dd><p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
25
+ associated with the given pool name on the current chain.</p></dd>
26
+ <dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
27
+ <dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
28
+ <dt><a href="#getCreditRecord">getCreditRecord(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;CreditRecord&gt;</code></dt>
29
+ <dd><p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p></dd>
30
+ <dt><a href="#getTotalDue">getTotalDue(address, signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Promise.&lt;BigNumber&gt;</code></dt>
31
+ <dd><p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p></dd>
32
+ <dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
33
+ <dd><p>Calls drawdown on a Huma pool contract</p></dd>
34
+ <dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
35
+ <dd><p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
36
+ attempt to first increase the allowance of the pool.</p></dd>
37
+ <dt><a href="#approvePoolAllowance">approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts])</a> ⇒ <code>Promise.&lt;TransactionResponse&gt;</code></dt>
38
+ <dd><p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p></dd>
39
+ <dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
40
+ <dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
41
+ associated with the given pool name on the current chain.</p></dd>
42
+ <dt><a href="#useContract">useContract(address, ABI, signerOrProvider)</a> ⇒ <code>T</code> | <code>null</code></dt>
43
+ <dd><p>Custom hook for creating an ethers instance of a smart contract.</p></dd>
44
+ <dt><a href="#useERC20TransferableReceivableContract">useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
45
+ <dd><p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
46
+ associated with the given pool name on the current chain.</p></dd>
47
+ <dt><a href="#useRealWorldReceivableContract">useRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
48
+ <dd><p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
49
+ associated with the given pool name on the current chain.</p></dd>
50
+ <dt><a href="#preapprove">preapprove(payload, chainId)</a> ⇒ <code>Promise.&lt;Approval&gt;</code></dt>
51
+ <dd><p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
52
+ Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p></dd>
53
+ <dt><a href="#getChainIdFromJsonSignerOrProvider">getChainIdFromJsonSignerOrProvider(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="#getChainIdFromSignerOrProvider">getChainIdFromSignerOrProvider(signerOrProvider)</a> ⇒ <code>number</code></dt>
56
+ <dd><p>Get the chain ID from a signer or provider object.</p></dd>
57
+ <dt><a href="#getPoolInfo">getPoolInfo(poolName, poolType)</a> ⇒ <code>PoolInfoType</code> | <code>undefined</code></dt>
58
+ <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>
59
+ </dl>
60
+
61
+ ## Typedefs
62
+
63
+ <dl>
64
+ <dt><a href="#ApprovalResult">ApprovalResult</a> : <code>Object</code></dt>
65
+ <dd><p>Object representing the response to the underwriting approval request.</p></dd>
66
+ <dt><a href="#EAPayload">EAPayload</a> : <code>Object</code></dt>
67
+ <dd><p>Object representing an invoice payload for underwriting approval.</p></dd>
68
+ <dt><a href="#CreditEventPayload">CreditEventPayload</a> : <code>Object</code></dt>
69
+ <dd><p>Represents the payload of a credit event.</p></dd>
70
+ </dl>
71
+
72
+ <a name="usePoolContract"></a>
73
+
74
+ ## usePoolContract ⇒ <code>T</code>
75
+ <p>A react hook that returns a contract instance of a specific pool using an ethers provider or signer</p>
76
+
77
+ **Kind**: global namespace
78
+ **Returns**: <code>T</code> - <p>A contract instance of the specific pool.</p>
79
+
80
+ | Param | Type | Description |
81
+ | --- | --- | --- |
82
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>An ethers signer or provider instance.</p> |
83
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
84
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
85
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
86
+
87
+
88
+ * [usePoolContract](#usePoolContract) ⇒ <code>T</code>
89
+ * [.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType)](#usePoolContract.useCreditRecordDetails) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
90
+ * [.CreditRecordDetails](#usePoolContract.CreditRecordDetails) : <code>Object</code>
91
+
92
+ <a name="usePoolContract.useCreditRecordDetails"></a>
93
+
94
+ ### usePoolContract.useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Array.&lt;(CreditRecordDetails\|undefined), function(): void&gt;</code>
95
+ <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>
96
+
97
+ **Kind**: static method of [<code>usePoolContract</code>](#usePoolContract)
98
+ **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>
99
+
100
+ | Param | Type | Description |
101
+ | --- | --- | --- |
102
+ | userAddress | <code>string</code> | <p>The address of the user to get the credit record details for.</p> |
103
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to use for the contract.</p> |
104
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
105
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the credit record details for.</p> |
106
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
107
+
108
+ <a name="usePoolContract.CreditRecordDetails"></a>
109
+
110
+ ### usePoolContract.CreditRecordDetails : <code>Object</code>
111
+ <p>CreditRecordDetails type object representing the details of a credit line.</p>
112
+
113
+ **Kind**: static typedef of [<code>usePoolContract</code>](#usePoolContract)
114
+ **Properties**
115
+
116
+ | Name | Type | Description |
117
+ | --- | --- | --- |
118
+ | aprInBps | <code>number</code> | <p>The APR (annual percentage rate) in basis points.</p> |
119
+ | 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> |
120
+ | creditLimit | <code>BigNumber</code> | <p>The credit limit in the pools base currency.</p> |
121
+ | defaultAmount | <code>BigNumber</code> | <p>The amount of the default, if any.</p> |
122
+ | dueDate | <code>BigNumber</code> | <p>The due date of the next payment.</p> |
123
+ | feesAndInterestDue | <code>BigNumber</code> | <p>The fees and interest due.</p> |
124
+ | intervalInDays | <code>number</code> | <p>The interval in days between payment periods.</p> |
125
+ | missedPeriods | <code>number</code> | <p>The number of missed periods.</p> |
126
+ | remainingPeriods | <code>number</code> | <p>The number of remaining periods before this credit line is considered paid off.</p> |
127
+ | state | <code>number</code> | <p>The state of the factorization. Please see the CreditState in huma-contracts for more details.</p> |
128
+ | totalDue | <code>BigNumber</code> | <p>The total due amount of this credit line.</p> |
129
+ | unbilledPrincipal | <code>BigNumber</code> | <p>The unbilled principal of the next payment.</p> |
130
+
131
+ <a name="ARWeaveService"></a>
132
+
133
+ ## ARWeaveService : <code>object</code>
134
+ <p>An object that contains functions to interact with Huma-related data stored on ARWeave</p>
135
+
136
+ **Kind**: global namespace
137
+ <a name="EAService"></a>
138
+
139
+ ## EAService : <code>object</code>
140
+ <p>An object that contains functions to interact with Huma's EAVerse service.</p>
141
+
142
+ **Kind**: global namespace
143
+ <a name="EAService.approve"></a>
144
+
145
+ ### EAService.approve(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
146
+ <p>Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
147
+ in Huma's pools that can be drawn down by the borrower.</p>
148
+
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>
617
+
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>
620
+
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
+
626
+ | Param | Type | Description |
627
+ | --- | --- | --- |
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> |
632
+
633
+ <a name="ReceivableService.getTokenIdByARWeaveId"></a>
634
+
635
+ ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
636
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
637
+
638
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
639
+ **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
640
+ <li>Either the token Id or null if no token was found.</li>
641
+ </ul>
642
+
643
+ | Param | Type | Description |
644
+ | --- | --- | --- |
645
+ | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
646
+ | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
647
+
648
+ <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
649
+
650
+ ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
651
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
652
+
653
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
654
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
655
+ <li>A Promise of the transaction receipt.</li>
656
+ </ul>
657
+
658
+ | Param | Type | Description |
659
+ | --- | --- | --- |
660
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
661
+ | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
662
+ | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
663
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
664
+
665
+ <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
666
+
667
+ ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
668
+ <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
669
+
670
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
671
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
672
+ <li>A Promise of the transaction receipt.</li>
673
+ </ul>
674
+ **Throws**:
675
+
676
+ - <code>Error</code> <ul>
677
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
678
+ </ul>
679
+
680
+
681
+ | Param | Type | Description |
682
+ | --- | --- | --- |
683
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
684
+ | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
685
+ | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
686
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
687
+
688
+ <a name="ReceivableService.createReceivable"></a>
689
+
690
+ ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
691
+ <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
692
+
693
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
694
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
695
+ <li>A Promise of the transaction response.</li>
696
+ </ul>
697
+ **Throws**:
698
+
699
+ - <code>Error</code> <ul>
700
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
701
+ </ul>
702
+
703
+
704
+ | Param | Type | Description |
705
+ | --- | --- | --- |
706
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
707
+ | 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> |
708
+ | 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> |
709
+ | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
710
+ | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
711
+ | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
712
+ | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
713
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
714
+
715
+ <a name="ReceivableService.createReceivableWithMetadata"></a>
716
+
717
+ ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
718
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
719
+
720
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
721
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
722
+ <li>The transaction receipt.</li>
723
+ </ul>
724
+
725
+ | Param | Type | Default | Description |
726
+ | --- | --- | --- | --- |
727
+ | 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> |
728
+ | 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> |
729
+ | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
730
+ | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
731
+ | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
732
+ | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
733
+ | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
734
+ | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
735
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
736
+ | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
737
+ | 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> |
738
+ | [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> |
739
+ | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
740
+
741
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
742
+
743
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
744
+ <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
745
+
746
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
747
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
748
+ <li>An array of receivables owned by the owner for the pool.</li>
749
+ </ul>
750
+
751
+ | Param | Type | Description |
752
+ | --- | --- | --- |
753
+ | 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> |
754
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
755
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
756
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
757
+
758
+ <a name="defaultWrapper"></a>
759
+
760
+ ## defaultWrapper()
761
+ <p>All built-in and custom scalars, mapped to their actual values</p>
762
+
763
+ **Kind**: global function
764
+ <a name="getERC20TransferableReceivableContract"></a>
765
+
766
+ ## getERC20TransferableReceivableContract(signerOrProvider, chainId) <code>Contract</code> \| <code>null</code>
767
+ <p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
768
+ associated with the given pool name on the current chain.</p>
769
+
770
+ **Kind**: global function
771
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
772
+
773
+ | Param | Type | Description |
774
+ | --- | --- | --- |
775
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
776
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
777
+
778
+ <a name="getPoolContract"></a>
779
+
780
+ ## getPoolContract(signerOrProvider, chainId, poolName, poolType) <code>Contract</code> \| <code>null</code>
781
+ <p>Returns an ethers contract instance for a Huma pool contract</p>
782
+
783
+ **Kind**: global function
784
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the Pool contract or null if it could not be found.</p>
785
+
786
+ | Param | Type | Description |
787
+ | --- | --- | --- |
788
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
789
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
790
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
791
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
792
+
793
+ <a name="getCreditRecord"></a>
794
+
795
+ ## getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;CreditRecord&gt;</code>
796
+ <p>Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.</p>
797
+
798
+ **Kind**: global function
799
+ **Returns**: <code>Promise.&lt;CreditRecord&gt;</code> - <ul>
800
+ <li>A Promise of the transaction response.</li>
801
+ </ul>
802
+
803
+ | Param | Type | Description |
804
+ | --- | --- | --- |
805
+ | address | <code>string</code> | <p>The address to lookup.</p> |
806
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
807
+ | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
808
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
809
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
810
+
811
+ <a name="getCreditRecord.CreditRecord"></a>
812
+
813
+ ### getCreditRecord.CreditRecord : <code>Object</code>
814
+ <p>Return type of getCreditRecord</p>
815
+
816
+ **Kind**: static typedef of [<code>getCreditRecord</code>](#getCreditRecord)
817
+ **Properties**
818
+
819
+ | Name | Type | Description |
820
+ | --- | --- | --- |
821
+ | unbilledPrincipal | <code>BigNumber</code> | <p>The amount of principal not included in the bill</p> |
822
+ | dueDate | <code>BigNumber</code> | <p>Unix timestamp due date of the next payment</p> |
823
+ | 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> |
824
+ | totalDue | <code>BigNumber</code> | <p>The due amount of the next payment</p> |
825
+ | feesAndInterestDue | <code>BigNumber</code> | <p>Interest and fees due for the next payment</p> |
826
+ | missedPeriods | <code>number</code> | <h1>of consecutive missed payments, for default processing</h1> |
827
+ | remainingPeriods | <code>number</code> | <h1>of payment periods until the maturity of the credit line</h1> |
828
+ | 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> |
829
+
830
+ <a name="getTotalDue"></a>
831
+
832
+ ## getTotalDue(address, signerOrProvider, chainId, poolName, poolType) ⇒ <code>Promise.&lt;BigNumber&gt;</code>
833
+ <p>Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.</p>
834
+
835
+ **Kind**: global function
836
+ **Returns**: <code>Promise.&lt;BigNumber&gt;</code> - <ul>
837
+ <li>A Promise of the transaction response.</li>
838
+ </ul>
839
+
840
+ | Param | Type | Description |
841
+ | --- | --- | --- |
842
+ | address | <code>string</code> | <p>The address to lookup.</p> |
843
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider used to read data.</p> |
844
+ | chainId | <code>number</code> | <p>The chain ID of the pool. Used to lookup the pool address.</p> |
845
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the credit pool. Used to lookup the pool address.</p> |
846
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the credit pool. Used to lookup the pool address.</p> |
847
+
848
+ <a name="drawdownFromPool"></a>
849
+
850
+ ## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, [gasOpts]) <code>Promise.&lt;TransactionResponse&gt;</code>
851
+ <p>Calls drawdown on a Huma pool contract</p>
852
+
853
+ **Kind**: global function
854
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
855
+ <li>A Promise of the transaction response.</li>
856
+ </ul>
857
+
858
+ | Param | Type | Description |
859
+ | --- | --- | --- |
860
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
861
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
862
+ | 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> |
863
+ | 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> |
864
+ | drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
865
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
866
+
867
+ <a name="makePaymentToPool"></a>
868
+
869
+ ## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
870
+ <p>Calls makePayment on a Huma pool contract. If the pool does not have sufficient allowance to complete the operation,
871
+ attempt to first increase the allowance of the pool.</p>
872
+
873
+ **Kind**: global function
874
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
875
+ <li>A Promise of the transaction response.</li>
876
+ </ul>
877
+
878
+ | Param | Type | Description |
879
+ | --- | --- | --- |
880
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
881
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
882
+ | 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> |
883
+ | 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> |
884
+ | paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
885
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
886
+
887
+ <a name="approvePoolAllowance"></a>
888
+
889
+ ## approvePoolAllowance(signer, chainId, poolName, poolType, allowanceAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
890
+ <p>Approves an allowance for a Huma pool contract, which is required to do certain actions (e.g. makePayment)</p>
891
+
892
+ **Kind**: global function
893
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
894
+ <li>A Promise of the transaction response.</li>
895
+ </ul>
896
+
897
+ | Param | Type | Description |
898
+ | --- | --- | --- |
899
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
900
+ | chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
901
+ | 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> |
902
+ | 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> |
903
+ | allowanceAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
904
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
905
+
906
+ <a name="getRealWorldReceivableContract"></a>
907
+
908
+ ## getRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
909
+ <p>Returns an ethers contract instance for the RealWorldReceivable contract
910
+ associated with the given pool name on the current chain.</p>
911
+
912
+ **Kind**: global function
913
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
914
+
915
+ | Param | Type | Description |
916
+ | --- | --- | --- |
917
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
918
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
919
+
920
+ <a name="useContract"></a>
921
+
922
+ ## useContract(address, ABI, signerOrProvider) ⇒ <code>T</code> \| <code>null</code>
923
+ <p>Custom hook for creating an ethers instance of a smart contract.</p>
924
+
925
+ **Kind**: global function
926
+ **Returns**: <code>T</code> \| <code>null</code> - <p>An instance of the smart contract, or null if an error occurs.</p>
927
+
928
+ | Param | Type | Description |
929
+ | --- | --- | --- |
930
+ | address | <code>string</code> \| <code>null</code> \| <code>undefined</code> | <p>The address of the smart contract instance.</p> |
931
+ | ABI | <code>any</code> | <p>The ABI of the smart contract.</p> |
932
+ | 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> |
933
+
934
+ <a name="useERC20TransferableReceivableContract"></a>
935
+
936
+ ## useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) ⇒ <code>Contract</code> \| <code>null</code>
937
+ <p>A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
938
+ associated with the given pool name on the current chain.</p>
939
+
940
+ **Kind**: global function
941
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.</p>
942
+
943
+ | Param | Type | Description |
944
+ | --- | --- | --- |
945
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
946
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
947
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool to get the contract for.</p> |
948
+
949
+ <a name="useRealWorldReceivableContract"></a>
950
+
951
+ ## useRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
952
+ <p>A react hook that returns an ethers contract instance for the RealWorldReceivable contract
953
+ associated with the given pool name on the current chain.</p>
954
+
955
+ **Kind**: global function
956
+ **Returns**: <code>Contract</code> \| <code>null</code> - <p>A contract instance for the RealWorldReceivable contract or null if it could not be found.</p>
957
+
958
+ | Param | Type | Description |
959
+ | --- | --- | --- |
960
+ | signerOrProvider | <code>ethers.providers.Provider</code> \| <code>ethers.Signer</code> | <p>The provider or signer instance to use for the contract.</p> |
961
+ | chainId | <code>number</code> | <p>The chain id where the contract instance exists</p> |
962
+
963
+ <a name="preapprove"></a>
964
+
965
+ ## preapprove(payload, chainId) ⇒ <code>Promise.&lt;Approval&gt;</code>
966
+ <p>Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
967
+ Note that this does not approve a creditline in Huma's pools and an approve call is still required.</p>
968
+
969
+ **Kind**: global function
970
+ **Returns**: <code>Promise.&lt;Approval&gt;</code> - <p>Promise that returns the approval on success.</p>
971
+
972
+ | Param | Type | Description |
973
+ | --- | --- | --- |
974
+ | payload | <code>EAPreapprovalPayload</code> | <p>The payload for the underwrite approval.</p> |
975
+ | chainId | <code>number</code> | <p>The chain ID.</p> |
976
+
977
+ <a name="getChainIdFromJsonSignerOrProvider"></a>
978
+
979
+ ## getChainIdFromJsonSignerOrProvider(signerOrProvider) ⇒ <code>number</code>
980
+ <p>Get the chain ID from a signer or provider object.</p>
981
+
982
+ **Kind**: global function
983
+ **Returns**: <code>number</code> - <ul>
984
+ <li>The chain ID.</li>
985
+ </ul>
986
+
987
+ | Param | Type | Description |
988
+ | --- | --- | --- |
989
+ | signerOrProvider | <code>JsonRpcProvider</code> \| <code>JsonRpcSigner</code> | <p>The signer or provider object to get the chain ID from.</p> |
990
+
991
+ <a name="getChainIdFromSignerOrProvider"></a>
992
+
993
+ ## getChainIdFromSignerOrProvider(signerOrProvider) ⇒ <code>number</code>
994
+ <p>Get the chain ID from a signer or provider object.</p>
995
+
996
+ **Kind**: global function
997
+ **Returns**: <code>number</code> - <ul>
998
+ <li>The chain ID.</li>
999
+ </ul>
1000
+
1001
+ | Param | Type | Description |
1002
+ | --- | --- | --- |
1003
+ | signerOrProvider | <code>ethers.provider.Provider</code> \| <code>ethers.Signer</code> | <p>The signer or provider object to get the chain ID from.</p> |
1004
+
1005
+ <a name="getPoolInfo"></a>
1006
+
1007
+ ## getPoolInfo(poolName, poolType) ⇒ <code>PoolInfoType</code> \| <code>undefined</code>
1008
+ <p>Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given</p>
1009
+
1010
+ **Kind**: global function
1011
+ **Returns**: <code>PoolInfoType</code> \| <code>undefined</code> - <ul>
1012
+ <li>The pool info or undefined if the chain ID is not supported.</li>
1013
+ </ul>
1014
+
1015
+ | Param | Type | Description |
1016
+ | --- | --- | --- |
1017
+ | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
1018
+ | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
1019
+
1020
+ <a name="ApprovalResult"></a>
1021
+
1022
+ ## ApprovalResult : <code>Object</code>
1023
+ <p>Object representing the response to the underwriting approval request.</p>
1024
+
1025
+ **Kind**: global typedef
1026
+ <a name="EAPayload"></a>
1027
+
1028
+ ## EAPayload : <code>Object</code>
1029
+ <p>Object representing an invoice payload for underwriting approval.</p>
1030
+
1031
+ **Kind**: global typedef
1032
+ <a name="CreditEventPayload"></a>
1033
+
1034
+ ## CreditEventPayload : <code>Object</code>
1035
+ <p>Represents the payload of a credit event.</p>
1036
+
1037
+ **Kind**: global typedef