@huma-finance/sdk 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API.md CHANGED
@@ -11,8 +11,8 @@
11
11
  <dd><p>An object that contains functions to interact with Huma's receivables.</p></dd>
12
12
  <dt><a href="#SubgraphService">SubgraphService</a> : <code>object</code></dt>
13
13
  <dd><p>An object that contains functions to interact with Huma's Subgraph storage.</p></dd>
14
- <dt><a href="#ARWeaveService">ARWeaveService</a> : <code>object</code></dt>
15
- <dd><p>An object that contains functions to interact with Huma-related data stored on ARWeave</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
16
  </dl>
17
17
 
18
18
  ## Functions
@@ -166,15 +166,164 @@ in Huma's pools that can be drawn down by the borrower.</p>
166
166
  **Kind**: global namespace
167
167
 
168
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, recipient, 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>
169
176
  * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
170
177
  * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
171
178
  * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
172
179
  * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, 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, recipient, 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
+ | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
280
+ | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
281
+ | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
282
+ | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
283
+ | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
284
+ | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
285
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
286
+ | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
287
+ | 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> |
288
+ | [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> |
289
+ | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
290
+
291
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
292
+
293
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
294
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
295
+
296
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
297
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
298
+ <li>An array of receivables owned by the owner for the pool.</li>
299
+ </ul>
300
+
301
+ | Param | Type | Description |
302
+ | --- | --- | --- |
303
+ | 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> |
304
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
305
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
306
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
307
+
308
+ <a name="ReceivableService.getTokenIdByARWeaveId"></a>
309
+
310
+ ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
311
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
312
+
313
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
314
+ **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
315
+ <li>Either the token Id or null if no token was found.</li>
316
+ </ul>
317
+
318
+ | Param | Type | Description |
319
+ | --- | --- | --- |
320
+ | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
321
+ | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
173
322
 
174
323
  <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
175
324
 
176
325
  ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
177
- <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
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
178
327
 
179
328
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
180
329
  **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
@@ -191,7 +340,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
191
340
  <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
192
341
 
193
342
  ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
194
- <p>Declares a payment on a RealWorldReceivable given a tokenID of the receivable.</p>
343
+ <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
195
344
 
196
345
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
197
346
  **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
@@ -207,7 +356,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
207
356
  | Param | Type | Description |
208
357
  | --- | --- | --- |
209
358
  | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
210
- | receivableTokenId | <code>BigNumberish</code> | <p>The ID of the receivable token to pay.</p> |
359
+ | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
211
360
  | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
212
361
  | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
213
362
 
@@ -252,19 +401,36 @@ in Huma's pools that can be drawn down by the borrower.</p>
252
401
  | --- | --- | --- | --- |
253
402
  | 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> |
254
403
  | 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> |
255
- | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
404
+ | chainId | <code>number</code> | | <p>The chain Id to mint the receivable token on and pay ARWeave funds from.</p> |
256
405
  | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
257
406
  | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
258
407
  | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
259
408
  | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
260
409
  | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
261
410
  | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
262
- | metadata | <code>JSON</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
411
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
263
412
  | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
264
413
  | 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> |
265
414
  | [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> |
266
415
  | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
267
416
 
417
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
418
+
419
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
420
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
421
+
422
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
423
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
424
+ <li>An array of receivables owned by the owner for the pool.</li>
425
+ </ul>
426
+
427
+ | Param | Type | Description |
428
+ | --- | --- | --- |
429
+ | 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> |
430
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
431
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
432
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
433
+
268
434
  <a name="SubgraphService"></a>
269
435
 
270
436
  ## SubgraphService : <code>object</code>
@@ -320,12 +486,279 @@ in Huma's pools that can be drawn down by the borrower.</p>
320
486
  | poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
321
487
  | poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
322
488
 
323
- <a name="ARWeaveService"></a>
489
+ <a name="ReceivableService"></a>
324
490
 
325
- ## ARWeaveService : <code>object</code>
326
- <p>An object that contains functions to interact with Huma-related data stored on ARWeave</p>
491
+ ## ReceivableService : <code>object</code>
492
+ <p>An object that contains functions to interact with Huma's receivables.</p>
327
493
 
328
494
  **Kind**: global namespace
495
+
496
+ * [ReceivableService](#ReceivableService) : <code>object</code>
497
+ * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
498
+ * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
499
+ * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
500
+ * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
501
+ * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
502
+ * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
503
+ * [.getTokenIdByARWeaveId(signer, arweaveId)](#ReceivableService.getTokenIdByARWeaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
504
+ * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
505
+ * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
506
+ * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
507
+ * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
508
+ * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
509
+
510
+ <a name="ReceivableService.getTokenIdByARWeaveId"></a>
511
+
512
+ ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
513
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
514
+
515
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
516
+ **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
517
+ <li>Either the token Id or null if no token was found.</li>
518
+ </ul>
519
+
520
+ | Param | Type | Description |
521
+ | --- | --- | --- |
522
+ | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
523
+ | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
524
+
525
+ <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
526
+
527
+ ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
528
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
529
+
530
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
531
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
532
+ <li>A Promise of the transaction receipt.</li>
533
+ </ul>
534
+
535
+ | Param | Type | Description |
536
+ | --- | --- | --- |
537
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
538
+ | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
539
+ | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
540
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
541
+
542
+ <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
543
+
544
+ ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
545
+ <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
546
+
547
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
548
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
549
+ <li>A Promise of the transaction receipt.</li>
550
+ </ul>
551
+ **Throws**:
552
+
553
+ - <code>Error</code> <ul>
554
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
555
+ </ul>
556
+
557
+
558
+ | Param | Type | Description |
559
+ | --- | --- | --- |
560
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
561
+ | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
562
+ | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
563
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
564
+
565
+ <a name="ReceivableService.createReceivable"></a>
566
+
567
+ ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
568
+ <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
569
+
570
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
571
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
572
+ <li>A Promise of the transaction response.</li>
573
+ </ul>
574
+ **Throws**:
575
+
576
+ - <code>Error</code> <ul>
577
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
578
+ </ul>
579
+
580
+
581
+ | Param | Type | Description |
582
+ | --- | --- | --- |
583
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
584
+ | 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> |
585
+ | 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> |
586
+ | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
587
+ | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
588
+ | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
589
+ | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
590
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
591
+
592
+ <a name="ReceivableService.createReceivableWithMetadata"></a>
593
+
594
+ ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
595
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
596
+
597
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
598
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
599
+ <li>The transaction receipt.</li>
600
+ </ul>
601
+
602
+ | Param | Type | Default | Description |
603
+ | --- | --- | --- | --- |
604
+ | 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> |
605
+ | 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> |
606
+ | chainId | <code>number</code> | | <p>The chain Id to mint the receivable token on and pay ARWeave funds from.</p> |
607
+ | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
608
+ | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
609
+ | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
610
+ | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
611
+ | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
612
+ | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
613
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
614
+ | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
615
+ | 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> |
616
+ | [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> |
617
+ | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
618
+
619
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
620
+
621
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
622
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
623
+
624
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
625
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
626
+ <li>An array of receivables owned by the owner for the pool.</li>
627
+ </ul>
628
+
629
+ | Param | Type | Description |
630
+ | --- | --- | --- |
631
+ | 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> |
632
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
633
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
634
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
635
+
636
+ <a name="ReceivableService.getTokenIdByARWeaveId"></a>
637
+
638
+ ### ReceivableService.getTokenIdByARWeaveId(signer, arweaveId) ⇒ <code>Promise.&lt;(string\|null\|undefined)&gt;</code>
639
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
640
+
641
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
642
+ **Returns**: <code>Promise.&lt;(string\|null\|undefined)&gt;</code> - <ul>
643
+ <li>Either the token Id or null if no token was found.</li>
644
+ </ul>
645
+
646
+ | Param | Type | Description |
647
+ | --- | --- | --- |
648
+ | signer | <code>ethers.Signer</code> | <p>The signer used to lookup metadata uploads for</p> |
649
+ | arweaveId | <code>string</code> | <p>The internal ARWeave identifier to lookup a token by</p> |
650
+
651
+ <a name="ReceivableService.declareReceivablePaymentByReferenceId"></a>
652
+
653
+ ### ReceivableService.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
654
+ <p>Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.</p>
655
+
656
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
657
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
658
+ <li>A Promise of the transaction receipt.</li>
659
+ </ul>
660
+
661
+ | Param | Type | Description |
662
+ | --- | --- | --- |
663
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
664
+ | referenceId | <code>string</code> | <p>An internal identifier value added as a tag on ARWeave</p> |
665
+ | paymentAmount | <code>number</code> | <p>The amount to declare paid to the receivable.</p> |
666
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
667
+
668
+ <a name="ReceivableService.declareReceivablePaymentByTokenId"></a>
669
+
670
+ ### ReceivableService.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
671
+ <p>Declares a payment on a RealWorldReceivable given a tokenId of the receivable.</p>
672
+
673
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
674
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
675
+ <li>A Promise of the transaction receipt.</li>
676
+ </ul>
677
+ **Throws**:
678
+
679
+ - <code>Error</code> <ul>
680
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
681
+ </ul>
682
+
683
+
684
+ | Param | Type | Description |
685
+ | --- | --- | --- |
686
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction. Note only the receivable owner can pay the receivable.</p> |
687
+ | receivableTokenId | <code>BigNumberish</code> | <p>The Id of the receivable token to pay.</p> |
688
+ | paymentAmount | <code>number</code> | <p>The amount to pay the receivable.</p> |
689
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
690
+
691
+ <a name="ReceivableService.createReceivable"></a>
692
+
693
+ ### ReceivableService.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
694
+ <p>Creates a new RealWorldReceivable token on the given chain of the signer</p>
695
+
696
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
697
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
698
+ <li>A Promise of the transaction response.</li>
699
+ </ul>
700
+ **Throws**:
701
+
702
+ - <code>Error</code> <ul>
703
+ <li>Throws an error if the RealWorldReceivable contract is not available on the network.</li>
704
+ </ul>
705
+
706
+
707
+ | Param | Type | Description |
708
+ | --- | --- | --- |
709
+ | signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
710
+ | 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> |
711
+ | 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> |
712
+ | currencyCode | <code>number</code> | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
713
+ | receivableAmount | <code>number</code> | <p>The amount of the receivable token to mint.</p> |
714
+ | maturityDate | <code>number</code> | <p>The maturity date of the receivable token, in UNIX timestamp format.</p> |
715
+ | uri | <code>string</code> | <p>The URI of the receivable token metadata.</p> |
716
+ | [gasOpts] | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
717
+
718
+ <a name="ReceivableService.createReceivableWithMetadata"></a>
719
+
720
+ ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, recipient, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
721
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
722
+
723
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
724
+ **Returns**: <code>Promise.&lt;TransactionResponse&gt;</code> - <ul>
725
+ <li>The transaction receipt.</li>
726
+ </ul>
727
+
728
+ | Param | Type | Default | Description |
729
+ | --- | --- | --- | --- |
730
+ | 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> |
731
+ | 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> |
732
+ | chainId | <code>number</code> | | <p>The chain Id to mint the receivable token on and pay ARWeave funds from.</p> |
733
+ | recipient | <code>string</code> | | <p>The receivable token recipient.</p> |
734
+ | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
735
+ | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
736
+ | currencyCode | <code>number</code> | | <p>The ISO 4217 currency code that the receivable is denominated in</p> |
737
+ | receivableAmount | <code>number</code> | | <p>The receivable amount.</p> |
738
+ | maturityDate | <code>number</code> | | <p>The maturity date of the receivable, in UNIX timestamp format.</p> |
739
+ | metadata | <code>Record.&lt;string, any&gt;</code> | | <p>The metadata in JSON format. This will be uploaded onto ARWeave</p> |
740
+ | referenceId | <code>number</code> | | <p>An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.</p> |
741
+ | 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> |
742
+ | [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> |
743
+ | [gasOpts] | <code>Overrides</code> | | <p>Optional gas overrides for the transaction.</p> |
744
+
745
+ <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
746
+
747
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
748
+ <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
749
+
750
+ **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
751
+ **Returns**: <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code> - <ul>
752
+ <li>An array of receivables owned by the owner for the pool.</li>
753
+ </ul>
754
+
755
+ | Param | Type | Description |
756
+ | --- | --- | --- |
757
+ | 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> |
758
+ | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
759
+ | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
760
+ | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
761
+
329
762
  <a name="defaultWrapper"></a>
330
763
 
331
764
  ## defaultWrapper()
@@ -59,13 +59,13 @@ declare function prefundBundlr(config: BundlrConfig, signer: string, amount: num
59
59
  * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
60
60
  * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
61
61
  * environment, this should be a private key string.
62
- * @param {JSON} data - The data to store in the Bundlr instance.
62
+ * @param {Record<string, unknown>} data - The data to store in the Bundlr instance.
63
63
  * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
64
64
  * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
65
65
  * Bundlr node should already be funded or else uploads will fail.
66
66
  * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
67
67
  */
68
- declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
68
+ declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: Record<string, unknown>, tags: {
69
69
  name: string;
70
70
  value: string;
71
71
  }[], lazyFund?: boolean): Promise<UploadResponse>;
@@ -81,6 +81,16 @@ declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provide
81
81
  * @returns {Promise<any>} Promise resolving with the queried data.
82
82
  */
83
83
  declare function queryForMetadata(chainId: number, sender: string, referenceId: string): Promise<string | null>;
84
+ /**
85
+ * Helper method to fetch data from an ARWeave URL.
86
+ *
87
+ * @async
88
+ * @function
89
+ * @memberof ArweaveService
90
+ * @param {string} url - The ARWeave metadata URL to query.
91
+ * @returns {Promise<JSON>} Promise resolving with the queried data.
92
+ */
93
+ declare function fetchMetadataFromUrl(url: string): Promise<JSON | null>;
84
94
  /**
85
95
  * An object that contains functions to interact with Huma-related data stored on ARWeave
86
96
  * @namespace ARWeaveService
@@ -91,5 +101,6 @@ export declare const ARWeaveService: {
91
101
  prefundBundlr: typeof prefundBundlr;
92
102
  getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
93
103
  getBundlrInstance: typeof getBundlrInstance;
104
+ fetchMetadataFromUrl: typeof fetchMetadataFromUrl;
94
105
  };
95
106
  export {};
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ARWeaveService = exports.getBundlrNetworkConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const client_1 = tslib_1.__importDefault(require("@bundlr-network/client"));
6
+ const axios_1 = tslib_1.__importDefault(require("axios"));
6
7
  const graphql_request_1 = tslib_1.__importStar(require("graphql-request"));
7
8
  /**
8
9
  * Get the configuration for Bundlr network given a chain ID
@@ -94,7 +95,7 @@ signer, amount) {
94
95
  * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
95
96
  * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
96
97
  * environment, this should be a private key string.
97
- * @param {JSON} data - The data to store in the Bundlr instance.
98
+ * @param {Record<string, unknown>} data - The data to store in the Bundlr instance.
98
99
  * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
99
100
  * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
100
101
  * Bundlr node should already be funded or else uploads will fail.
@@ -156,6 +157,25 @@ async function queryForMetadata(chainId, sender, referenceId) {
156
157
  });
157
158
  return (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.transactions) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.node) === null || _d === void 0 ? void 0 : _d.id;
158
159
  }
160
+ /**
161
+ * Helper method to fetch data from an ARWeave URL.
162
+ *
163
+ * @async
164
+ * @function
165
+ * @memberof ArweaveService
166
+ * @param {string} url - The ARWeave metadata URL to query.
167
+ * @returns {Promise<JSON>} Promise resolving with the queried data.
168
+ */
169
+ async function fetchMetadataFromUrl(url) {
170
+ try {
171
+ const response = await axios_1.default.get(url);
172
+ return response.data;
173
+ }
174
+ catch (error) {
175
+ console.error('Error fetching data:', error);
176
+ return null;
177
+ }
178
+ }
159
179
  /**
160
180
  * An object that contains functions to interact with Huma-related data stored on ARWeave
161
181
  * @namespace ARWeaveService
@@ -166,5 +186,6 @@ exports.ARWeaveService = {
166
186
  prefundBundlr,
167
187
  getBundlrNetworkConfig,
168
188
  getBundlrInstance,
189
+ fetchMetadataFromUrl,
169
190
  };
170
191
  //# sourceMappingURL=ARWeaveService.js.map