@huma-finance/sdk 0.0.44-beta.147 → 0.0.44-beta.152

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
@@ -137,9 +137,9 @@ Note that this does not approve a creditline in Huma's pools and an approve call
137
137
 
138
138
  * [ARWeaveService](#ARWeaveService) : <code>object</code>
139
139
  * [.getBundlrNetworkConfig(chainId)](#ARWeaveService.getBundlrNetworkConfig) ⇒ <code>BundlrConfig</code>
140
- * [.getBundlrInstance(config, signer)](#ARWeaveService.getBundlrInstance) ⇒
141
- * [.prefundBundlr(config, signer, amount)](#ARWeaveService.prefundBundlr) ⇒ <code>Promise.&lt;FundResponse&gt;</code>
142
- * [.storeData(config, signerOrPrivateKey, data, tags, [lazyFund])](#ARWeaveService.storeData) ⇒ <code>Promise.&lt;UploadResponse&gt;</code>
140
+ * [.getBundlrInstance(config, privateKey)](#ARWeaveService.getBundlrInstance) ⇒
141
+ * [.prefundBundlr(config, privateKey, amount)](#ARWeaveService.prefundBundlr) ⇒ <code>Promise.&lt;FundResponse&gt;</code>
142
+ * [.storeData(config, privateKey, data, tags, [lazyFund])](#ARWeaveService.storeData) ⇒ <code>Promise.&lt;UploadResponse&gt;</code>
143
143
  * [.queryForMetadata(chainId, sender, referenceId)](#ARWeaveService.queryForMetadata) ⇒ <code>Promise.&lt;any&gt;</code>
144
144
  * [.fetchMetadataFromUrl(url)](#ARWeaveService.fetchMetadataFromUrl) ⇒ <code>Promise.&lt;JSON&gt;</code>
145
145
  * [.getURIFromARWeaveId(arweaveId)](#ARWeaveService.getURIFromARWeaveId) ⇒ <code>string</code>
@@ -161,7 +161,7 @@ Note that this does not approve a creditline in Huma's pools and an approve call
161
161
 
162
162
  <a name="ARWeaveService.getBundlrInstance"></a>
163
163
 
164
- ### ARWeaveService.getBundlrInstance(config, signer) ⇒
164
+ ### ARWeaveService.getBundlrInstance(config, privateKey) ⇒
165
165
  <p>Get a Bundlr instance for a specific network</p>
166
166
 
167
167
  **Kind**: static method of [<code>ARWeaveService</code>](#ARWeaveService)
@@ -170,11 +170,11 @@ Note that this does not approve a creditline in Huma's pools and an approve call
170
170
  | Param | Type | Description |
171
171
  | --- | --- | --- |
172
172
  | config | <code>BundlrConfig</code> | <p>The configuration for the Bundlr network.</p> |
173
- | signer | <code>string</code> | <p>The private key of the wallet to use Bundlr with.</p> |
173
+ | privateKey | <code>string</code> | <p>The private key of the wallet to use Bundlr with.</p> |
174
174
 
175
175
  <a name="ARWeaveService.prefundBundlr"></a>
176
176
 
177
- ### ARWeaveService.prefundBundlr(config, signer, amount) ⇒ <code>Promise.&lt;FundResponse&gt;</code>
177
+ ### ARWeaveService.prefundBundlr(config, privateKey, amount) ⇒ <code>Promise.&lt;FundResponse&gt;</code>
178
178
  <p>Prefund the Bundlr network with the specified amount. Required if not lazy funding.
179
179
  Important note: The amount is denominated in the base unit of currency for that network.
180
180
  If you want to upload 5 Matic to the Bundlr node, pass in an amount of 5.</p>
@@ -187,12 +187,12 @@ If you want to upload 5 Matic to the Bundlr node, pass in an amount of 5.</p>
187
187
  | Param | Type | Description |
188
188
  | --- | --- | --- |
189
189
  | config | <code>BundlrConfig</code> | <p>The configuration for the Bundlr network.</p> |
190
- | signer | <code>string</code> | <p>The private key of the wallet to send funds from.</p> |
190
+ | privateKey | <code>string</code> | <p>The private key of the wallet to send funds from.</p> |
191
191
  | amount | <code>number</code> | <p>The amount to fund, denoted in whatever currency specified by the config (e.g. MATIC, ETH)</p> |
192
192
 
193
193
  <a name="ARWeaveService.storeData"></a>
194
194
 
195
- ### ARWeaveService.storeData(config, signerOrPrivateKey, data, tags, [lazyFund]) ⇒ <code>Promise.&lt;UploadResponse&gt;</code>
195
+ ### ARWeaveService.storeData(config, privateKey, data, tags, [lazyFund]) ⇒ <code>Promise.&lt;UploadResponse&gt;</code>
196
196
  <p>Store data on ARWeave using the Bundlr Network.</p>
197
197
 
198
198
  **Kind**: static method of [<code>ARWeaveService</code>](#ARWeaveService)
@@ -201,7 +201,7 @@ If you want to upload 5 Matic to the Bundlr node, pass in an amount of 5.</p>
201
201
  | Param | Type | Default | Description |
202
202
  | --- | --- | --- | --- |
203
203
  | config | <code>BundlrConfig</code> | | <p>Configuration object for the Bundlr instance.</p> |
204
- | signerOrPrivateKey | <code>Web3Provider</code> \| <code>string</code> | | <p>Wallet object used for interacting with the Bundlr instance. If calling from a browser, this should be a <code>Web3Provider</code> instance. If calling from a Node.js environment, this should be a private key string.</p> |
204
+ | privateKey | <code>string</code> | | <p>Private key used for interacting with the Bundlr instance.</p> |
205
205
  | data | <code>Record.&lt;string, unknown&gt;</code> | | <p>The data to store in the Bundlr instance.</p> |
206
206
  | tags | <code>Array.&lt;{name: string, value: string}&gt;</code> | | <p>Array of tag objects with <code>name</code> and <code>value</code> properties.</p> |
207
207
  | [lazyFund] | <code>boolean</code> | <code>true</code> | <p>Optional flag to fund the Bundlr instance lazily. If set to <code>false</code>, the Bundlr node should already be funded or else uploads will fail.</p> |
@@ -294,10 +294,10 @@ in Huma's pools that can be drawn down by the borrower.</p>
294
294
  * [.declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByReferenceId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
295
295
  * [.declareReceivablePaymentByTokenId(signer, receivableTokenId, paymentAmount, [gasOpts])](#ReceivableService.declareReceivablePaymentByTokenId) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
296
296
  * [.createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, uri, [gasOpts])](#ReceivableService.createReceivable) ⇒ <code>Promise.&lt;(TransactionResponse\|null)&gt;</code>
297
- * [.uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, [lazyFund])](#ReceivableService.uploadOrFetchMetadataURI) ⇒ <code>Promise.&lt;string&gt;</code>
298
- * [.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
299
- * [.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType, pagination)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
300
- * [.getTotalCountOfReceivables(signerOrProvider, owner)](#ReceivableService.getTotalCountOfReceivables) ⇒ <code>Promise.&lt;number&gt;</code>
297
+ * [.uploadOrFetchMetadataURI(signer, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, [lazyFund])](#ReceivableService.uploadOrFetchMetadataURI) ⇒ <code>Promise.&lt;string&gt;</code>
298
+ * [.createReceivableWithMetadata(signer, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts])](#ReceivableService.createReceivableWithMetadata) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
299
+ * [.loadReceivablesOfOwnerWithMetadata(signer, owner, poolName, poolType, pagination)](#ReceivableService.loadReceivablesOfOwnerWithMetadata) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
300
+ * [.getTotalCountOfReceivables(signer, owner)](#ReceivableService.getTotalCountOfReceivables) ⇒ <code>Promise.&lt;number&gt;</code>
301
301
 
302
302
  <a name="ReceivableService.getTokenIdByURI"></a>
303
303
 
@@ -383,7 +383,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
383
383
 
384
384
  <a name="ReceivableService.uploadOrFetchMetadataURI"></a>
385
385
 
386
- ### ReceivableService.uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, [lazyFund]) ⇒ <code>Promise.&lt;string&gt;</code>
386
+ ### ReceivableService.uploadOrFetchMetadataURI(signer, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, [lazyFund]) ⇒ <code>Promise.&lt;string&gt;</code>
387
387
  <p>Uploads metadata onto ARWeave (or fetches the existing metadata with the same reference Id) and returns the ARWeave URL</p>
388
388
 
389
389
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
@@ -393,8 +393,8 @@ in Huma's pools that can be drawn down by the borrower.</p>
393
393
 
394
394
  | Param | Type | Default | Description |
395
395
  | --- | --- | --- | --- |
396
- | 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> |
397
- | 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> |
396
+ | signer | <code>ethers.Signer</code> | | <p>An ethers.signer instance used to de-dupe metadata uploads.</p> |
397
+ | privateKey | <code>string</code> | | <p>Private key of the wallet used to upload metadata to ARWeave.</p> |
398
398
  | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
399
399
  | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
400
400
  | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
@@ -405,7 +405,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
405
405
 
406
406
  <a name="ReceivableService.createReceivableWithMetadata"></a>
407
407
 
408
- ### ReceivableService.createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
408
+ ### ReceivableService.createReceivableWithMetadata(signer, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, [lazyFund], [gasOpts]) ⇒ <code>Promise.&lt;TransactionResponse&gt;</code>
409
409
  <p>Creates a RealWorldReceivable token with metadata uploaded onto ARWeave</p>
410
410
 
411
411
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
@@ -415,8 +415,8 @@ in Huma's pools that can be drawn down by the borrower.</p>
415
415
 
416
416
  | Param | Type | Default | Description |
417
417
  | --- | --- | --- | --- |
418
- | 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> |
419
- | 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> |
418
+ | signer | <code>ethers.Signer</code> | | <p>An ethers.signer instance used to de-dupe metadata uploads.</p> |
419
+ | privateKey | <code>string</code> | | <p>Private key of the wallet used to upload metadata to ARWeave.</p> |
420
420
  | chainId | <code>number</code> | | <p>The chain ID to mint the receivable token on and pay ARWeave funds from.</p> |
421
421
  | poolName | <code>POOL\_NAME</code> | | <p>The pool name. Used to lookup the pool address to pay to.</p> |
422
422
  | poolType | <code>POOL\_TYPE</code> | | <p>The pool type. Used to lookup the pool address to pay to.</p> |
@@ -431,7 +431,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
431
431
 
432
432
  <a name="ReceivableService.loadReceivablesOfOwnerWithMetadata"></a>
433
433
 
434
- ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType, pagination) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
434
+ ### ReceivableService.loadReceivablesOfOwnerWithMetadata(signer, owner, poolName, poolType, pagination) ⇒ <code>Promise.&lt;Array.&lt;RealWorldReceivableInfo&gt;&gt;</code>
435
435
  <p>Loads all RWRs belonging to the specified owner, including the RWR metadata</p>
436
436
 
437
437
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
@@ -441,7 +441,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
441
441
 
442
442
  | Param | Type | Description |
443
443
  | --- | --- | --- |
444
- | 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> |
444
+ | signer | <code>ethers.Signer</code> | <p>An ethers.signer instance used to de-dupe metadata uploads.</p> |
445
445
  | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
446
446
  | poolName | <code>POOL\_NAME</code> | <p>The pool name. Used to lookup the pool address to pay to.</p> |
447
447
  | poolType | <code>POOL\_TYPE</code> | <p>The pool type. Used to lookup the pool address to pay to.</p> |
@@ -449,7 +449,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
449
449
 
450
450
  <a name="ReceivableService.getTotalCountOfReceivables"></a>
451
451
 
452
- ### ReceivableService.getTotalCountOfReceivables(signerOrProvider, owner) ⇒ <code>Promise.&lt;number&gt;</code>
452
+ ### ReceivableService.getTotalCountOfReceivables(signer, owner) ⇒ <code>Promise.&lt;number&gt;</code>
453
453
  <p>Get the total count of all RWRs belonging to the specified owner</p>
454
454
 
455
455
  **Kind**: static method of [<code>ReceivableService</code>](#ReceivableService)
@@ -459,7 +459,7 @@ in Huma's pools that can be drawn down by the borrower.</p>
459
459
 
460
460
  | Param | Type | Description |
461
461
  | --- | --- | --- |
462
- | 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> |
462
+ | signer | <code>ethers.Signer</code> | <p>An ethers.signer instance used to de-dupe metadata uploads.</p> |
463
463
  | owner | <code>string</code> | <p>The receivable token owner to query from.</p> |
464
464
 
465
465
  <a name="SubgraphService"></a>
@@ -1,3 +1,4 @@
1
+ import Bundlr from '@bundlr-network/client/build/cjs/node/bundlr';
1
2
  import type { FundResponse, UploadResponse } from '@bundlr-network/client/build/cjs/common/types';
2
3
  import { Web3Provider } from '@ethersproject/providers';
3
4
  /**
@@ -31,10 +32,10 @@ export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
31
32
  * @function
32
33
  * @memberof ARWeaveService
33
34
  * @param {BundlrConfig} config - The configuration for the Bundlr network.
34
- * @param {string} signer - The private key of the wallet to use Bundlr with.
35
+ * @param {string} privateKey - The private key of the wallet to use Bundlr with.
35
36
  * @returns The Bundlr instance
36
37
  */
37
- declare function getBundlrInstance(config: BundlrConfig, signer: string): Promise<import("@bundlr-network/client/build/cjs/node/bundlr").default>;
38
+ declare function getBundlrInstance(config: BundlrConfig, privateKey: string): Promise<Bundlr>;
38
39
  /**
39
40
  * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
40
41
  * Important note: The amount is denominated in the base unit of currency for that network.
@@ -44,11 +45,11 @@ declare function getBundlrInstance(config: BundlrConfig, signer: string): Promis
44
45
  * @function
45
46
  * @memberof ARWeaveService
46
47
  * @param {BundlrConfig} config - The configuration for the Bundlr network.
47
- * @param {string} signer - The private key of the wallet to send funds from.
48
+ * @param {string} privateKey - The private key of the wallet to send funds from.
48
49
  * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config (e.g. MATIC, ETH)
49
50
  * @returns {Promise<FundResponse>} - The fund response.
50
51
  */
51
- declare function prefundBundlr(config: BundlrConfig, signer: string, amount: number): Promise<FundResponse>;
52
+ declare function prefundBundlr(config: BundlrConfig, privateKey: string, amount: number): Promise<FundResponse>;
52
53
  /**
53
54
  * Store data on ARWeave using the Bundlr Network.
54
55
  *
@@ -56,16 +57,14 @@ declare function prefundBundlr(config: BundlrConfig, signer: string, amount: num
56
57
  * @function
57
58
  * @memberof ARWeaveService
58
59
  * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
59
- * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
60
- * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
61
- * environment, this should be a private key string.
60
+ * @param {string} privateKey - Private key used for interacting with the Bundlr instance.
62
61
  * @param {Record<string, unknown>} data - The data to store in the Bundlr instance.
63
62
  * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
64
63
  * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
65
64
  * Bundlr node should already be funded or else uploads will fail.
66
65
  * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
67
66
  */
68
- declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: Record<string, unknown>, tags: {
67
+ declare function storeData(config: BundlrConfig, privateKey: Web3Provider | string, data: Record<string, unknown>, tags: {
69
68
  name: string;
70
69
  value: string;
71
70
  }[], lazyFund?: boolean): Promise<UploadResponse>;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ARWeaveService = exports.getBundlrNetworkConfig = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const client_1 = tslib_1.__importDefault(require("@bundlr-network/client"));
5
+ const bundlr_1 = tslib_1.__importDefault(require("@bundlr-network/client/build/cjs/node/bundlr"));
6
6
  const axios_1 = tslib_1.__importDefault(require("axios"));
7
7
  const graphql_request_1 = tslib_1.__importStar(require("graphql-request"));
8
8
  /**
@@ -58,11 +58,11 @@ exports.getBundlrNetworkConfig = getBundlrNetworkConfig;
58
58
  * @function
59
59
  * @memberof ARWeaveService
60
60
  * @param {BundlrConfig} config - The configuration for the Bundlr network.
61
- * @param {string} signer - The private key of the wallet to use Bundlr with.
61
+ * @param {string} privateKey - The private key of the wallet to use Bundlr with.
62
62
  * @returns The Bundlr instance
63
63
  */
64
- async function getBundlrInstance(config, signer) {
65
- const bundlr = new client_1.default(config.nodeUrl, config.currency, signer, config.providerUrl
64
+ async function getBundlrInstance(config, privateKey) {
65
+ const bundlr = new bundlr_1.default(config.nodeUrl, config.currency, privateKey, config.providerUrl
66
66
  ? {
67
67
  providerUrl: config.providerUrl,
68
68
  }
@@ -79,14 +79,14 @@ async function getBundlrInstance(config, signer) {
79
79
  * @function
80
80
  * @memberof ARWeaveService
81
81
  * @param {BundlrConfig} config - The configuration for the Bundlr network.
82
- * @param {string} signer - The private key of the wallet to send funds from.
82
+ * @param {string} privateKey - The private key of the wallet to send funds from.
83
83
  * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config (e.g. MATIC, ETH)
84
84
  * @returns {Promise<FundResponse>} - The fund response.
85
85
  */
86
86
  async function prefundBundlr(config,
87
87
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- signer, amount) {
89
- const bundlr = new client_1.default(config.nodeUrl, config.currency, signer, config.providerUrl
88
+ privateKey, amount) {
89
+ const bundlr = new bundlr_1.default(config.nodeUrl, config.currency, privateKey, config.providerUrl
90
90
  ? {
91
91
  providerUrl: config.providerUrl,
92
92
  }
@@ -103,17 +103,15 @@ signer, amount) {
103
103
  * @function
104
104
  * @memberof ARWeaveService
105
105
  * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
106
- * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
107
- * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
108
- * environment, this should be a private key string.
106
+ * @param {string} privateKey - Private key used for interacting with the Bundlr instance.
109
107
  * @param {Record<string, unknown>} data - The data to store in the Bundlr instance.
110
108
  * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
111
109
  * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
112
110
  * Bundlr node should already be funded or else uploads will fail.
113
111
  * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
114
112
  */
115
- async function storeData(config, signerOrPrivateKey, data, tags, lazyFund = true) {
116
- const bundlr = new client_1.default(config.nodeUrl, config.currency, signerOrPrivateKey, config.providerUrl
113
+ async function storeData(config, privateKey, data, tags, lazyFund = true) {
114
+ const bundlr = new bundlr_1.default(config.nodeUrl, config.currency, privateKey, config.providerUrl
117
115
  ? {
118
116
  providerUrl: config.providerUrl,
119
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ARWeaveService.js","sourceRoot":"","sources":["../../../src/services/ARWeaveService.ts"],"names":[],"mappings":";;;;AAAA,4EAA2C;AAM3C,0DAAyB;AACzB,2EAA8C;AAkB9C;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,QAAQ,OAAO,EAAE;QACf,KAAK,CAAC,EAAE,SAAS;YACf,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,UAAU;gBACpB,WAAW,EACT,8DAA8D;aACjE,CAAA;QACH,KAAK,KAAK,EAAE,SAAS;YACnB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,OAAO;gBACjB,WAAW,EAAE,qCAAqC;aACnD,CAAA;QACH,KAAK,GAAG,EAAE,QAAQ;YAChB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,OAAO;aAClB,CAAA;QACH,KAAK,KAAK,EAAE,YAAY;YACtB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,EAAE,EAAE,yDAAyD;gBACvE,wDAAwD;aACzD,CAAA;QACH,KAAK,KAAK,EAAE,OAAO;YACjB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,EAAE,EAAE,yDAAyD;aACxE,CAAA;QACH;YACE,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,EAAE;aACb,CAAA;KACJ;AACH,CAAC;AArCD,wDAqCC;AAED;;;;;;;;;GASG;AACH,KAAK,UAAU,iBAAiB,CAAC,MAAoB,EAAE,MAAc;IACnE,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAM,EACN,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SA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,OAAO,uBAAuB,SAAS,EAAE,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,gBAAgB;IAChB,SAAS;IACT,aAAa;IACb,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB;IACpB,mBAAmB;CACpB,CAAA"}
1
+ {"version":3,"file":"ARWeaveService.js","sourceRoot":"","sources":["../../../src/services/ARWeaveService.ts"],"names":[],"mappings":";;;;AAAA,kGAAiE;AAMjE,0DAAyB;AACzB,2EAA8C;AAkB9C;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,QAAQ,OAAO,EAAE;QACf,KAAK,CAAC,EAAE,SAAS;YACf,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,UAAU;gBACpB,WAAW,EACT,8DAA8D;aACjE,CAAA;QACH,KAAK,KAAK,EAAE,SAAS;YACnB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,OAAO;gBACjB,WAAW,EAAE,qCAAqC;aACnD,CAAA;QACH,KAAK,GAAG,EAAE,QAAQ;YAChB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,OAAO;aAClB,CAAA;QACH,KAAK,KAAK,EAAE,YAAY;YACtB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,EAAE,EAAE,yDAAyD;gBACvE,wDAAwD;aACzD,CAAA;QACH,KAAK,KAAK,EAAE,OAAO;YACjB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,EAAE,EAAE,yDAAyD;aACxE,CAAA;QACH;YACE,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,EAAE;aACb,CAAA;KACJ;AACH,CAAC;AArCD,wDAqCC;AAED;;;;;;;;;GASG;AACH,KAAK,UAAU,iBAAiB,CAAC,MAAoB,EAAE,UAAkB;IACvE,MAAM,MAAM,GAAG,I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EAAE;QACd,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAA;QAC5C,OAAO,IAAI,CAAA;KACZ;AACH,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,mBAAmB,CAAC,SAAiB;IAC5C,OAAO,uBAAuB,SAAS,EAAE,CAAA;AAC3C,CAAC;AAED;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,gBAAgB;IAChB,SAAS;IACT,aAAa;IACb,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB;IACpB,mBAAmB;CACpB,CAAA"}
@@ -1,4 +1,4 @@
1
- import { TransactionResponse, Web3Provider } from '@ethersproject/providers';
1
+ import { TransactionResponse } from '@ethersproject/providers';
2
2
  import { BigNumberish, ethers, Overrides } from 'ethers';
3
3
  import { POOL_NAME, POOL_TYPE, RealWorldReceivableInfo } from '@huma-finance/shared';
4
4
  import { Pagination } from './SubgraphService';
@@ -64,10 +64,8 @@ declare function createReceivable(signer: ethers.Signer, poolName: POOL_NAME, po
64
64
  * @async
65
65
  * @function
66
66
  * @memberof ReceivableService
67
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
68
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
69
- * from server calls.
70
- * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
67
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
68
+ * @param {string} privateKey - Private key of the wallet used to upload metadata to ARWeave.
71
69
  * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
72
70
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
73
71
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
@@ -79,7 +77,7 @@ declare function createReceivable(signer: ethers.Signer, poolName: POOL_NAME, po
79
77
  * metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.
80
78
  * @returns {Promise<string>} - The ARWeave metadata URI.
81
79
  */
82
- declare function uploadOrFetchMetadataURI(signerOrProvider: Web3Provider | ethers.Signer, privateKey: string | null, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, metadata: Record<string, unknown>, referenceId: string, extraTags: {
80
+ declare function uploadOrFetchMetadataURI(signer: ethers.Signer, privateKey: string, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, metadata: Record<string, unknown>, referenceId: string, extraTags: {
83
81
  name: string;
84
82
  value: string;
85
83
  }[], lazyFund?: boolean): Promise<string>;
@@ -89,10 +87,8 @@ declare function uploadOrFetchMetadataURI(signerOrProvider: Web3Provider | ether
89
87
  * @async
90
88
  * @function
91
89
  * @memberof ReceivableService
92
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
93
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
94
- * from server calls.
95
- * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
90
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
91
+ * @param {string} privateKey - Private key of the wallet used to upload metadata to ARWeave.
96
92
  * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
97
93
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
98
94
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
@@ -108,7 +104,7 @@ declare function uploadOrFetchMetadataURI(signerOrProvider: Web3Provider | ether
108
104
  * @param {Overrides} [gasOpts] - Optional gas overrides for the transaction.
109
105
  * @returns {Promise<TransactionResponse>} - The transaction receipt.
110
106
  */
111
- declare function createReceivableWithMetadata(signerOrProvider: Web3Provider | ethers.Signer, privateKey: string | null, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, metadata: Record<string, unknown>, referenceId: string, extraTags: {
107
+ declare function createReceivableWithMetadata(signer: ethers.Signer, privateKey: string, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, metadata: Record<string, unknown>, referenceId: string, extraTags: {
112
108
  name: string;
113
109
  value: string;
114
110
  }[], lazyFund?: boolean, gasOpts?: Overrides): Promise<TransactionResponse>;
@@ -118,29 +114,25 @@ declare function createReceivableWithMetadata(signerOrProvider: Web3Provider | e
118
114
  * @async
119
115
  * @function
120
116
  * @memberof ReceivableService
121
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
122
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
123
- * from server calls.
117
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
124
118
  * @param {string} owner - The receivable token owner to query from.
125
119
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
126
120
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
127
121
  * @param {Pagination} pagination - The pagination option.
128
122
  * @returns {Promise<RealWorldReceivableInfo[]>} - An array of receivables owned by the owner for the pool.
129
123
  */
130
- declare function loadReceivablesOfOwnerWithMetadata<T>(signerOrProvider: Web3Provider | ethers.Signer, owner: string, poolName: POOL_NAME, poolType: POOL_TYPE, pagination?: Pagination): Promise<RealWorldReceivableInfo<T>[]>;
124
+ declare function loadReceivablesOfOwnerWithMetadata<T>(signer: ethers.Signer, owner: string, poolName: POOL_NAME, poolType: POOL_TYPE, pagination?: Pagination): Promise<RealWorldReceivableInfo<T>[]>;
131
125
  /**
132
126
  * Get the total count of all RWRs belonging to the specified owner
133
127
  *
134
128
  * @async
135
129
  * @function
136
130
  * @memberof ReceivableService
137
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
138
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
139
- * from server calls.
131
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
140
132
  * @param {string} owner - The receivable token owner to query from.
141
133
  * @returns {Promise<number>} - Total count of receivables owned by the owner for the pool.
142
134
  */
143
- declare function getTotalCountOfReceivables(signerOrProvider: Web3Provider | ethers.Signer, owner: string): Promise<number>;
135
+ declare function getTotalCountOfReceivables(signer: ethers.Signer, owner: string): Promise<number>;
144
136
  /**
145
137
  * An object that contains functions to interact with Huma's receivables.
146
138
  * @namespace ReceivableService
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReceivableService = void 0;
4
- const providers_1 = require("@ethersproject/providers");
5
4
  const ethers_1 = require("ethers");
6
5
  const shared_1 = require("@huma-finance/shared");
7
6
  const graphql_request_1 = require("graphql-request");
@@ -32,16 +31,16 @@ async function getTokenIdByURI(signer, uri) {
32
31
  // Fetch receivables with the same ARWeave Id
33
32
  const receivablesQuery = (0, graphql_request_1.gql) `
34
33
  query ReceivablesByURIQuery($owner: String!, $uri: String!) {
35
- receivables(where: { owner: $owner, uri: $uri }) {
34
+ rwreceivables(where: { owner: $owner, tokenUri: $uri }) {
36
35
  ...ReceivableFields
37
36
  }
38
37
  }
39
38
 
40
- fragment ReceivableFields on Receivable {
39
+ fragment ReceivableFields on RWReceivable {
41
40
  tokenId
42
41
  }
43
42
  `;
44
- const receivableSubgraph = (_a = shared_1.PoolSubgraphMap[chainId]) === null || _a === void 0 ? void 0 : _a.receivablesSubgraph;
43
+ const receivableSubgraph = (_a = shared_1.PoolSubgraphMap[chainId]) === null || _a === void 0 ? void 0 : _a.subgraph;
45
44
  if (!receivableSubgraph) {
46
45
  throw new Error('No receivable subgraph exists for this chain');
47
46
  }
@@ -49,15 +48,15 @@ async function getTokenIdByURI(signer, uri) {
49
48
  owner: signerAddress,
50
49
  uri,
51
50
  });
52
- if (!((_b = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables) === null || _b === void 0 ? void 0 : _b.length)) {
51
+ if (!((_b = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.rwreceivables) === null || _b === void 0 ? void 0 : _b.length)) {
53
52
  console.log('No receivables found with this URI.');
54
53
  return null;
55
54
  }
56
- if (((_c = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables) === null || _c === void 0 ? void 0 : _c.length) > 1) {
55
+ if (((_c = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.rwreceivables) === null || _c === void 0 ? void 0 : _c.length) > 1) {
57
56
  throw new Error(`This owner has multiple receivables with the same URI, so we don't know which to use. Please burn
58
57
  unnecessary receivables. If paying, you can pay the correct token manually using declareReceivablePaymentByTokenId`);
59
58
  }
60
- return (_d = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables[0]) === null || _d === void 0 ? void 0 : _d.tokenId;
59
+ return (_d = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.rwreceivables[0]) === null || _d === void 0 ? void 0 : _d.tokenId;
61
60
  }
62
61
  /**
63
62
  * Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.
@@ -170,10 +169,8 @@ async function createReceivable(signer, poolName, poolType, currencyCode, receiv
170
169
  * @async
171
170
  * @function
172
171
  * @memberof ReceivableService
173
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
174
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
175
- * from server calls.
176
- * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
172
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
173
+ * @param {string} privateKey - Private key of the wallet used to upload metadata to ARWeave.
177
174
  * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
178
175
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
179
176
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
@@ -185,14 +182,11 @@ async function createReceivable(signer, poolName, poolType, currencyCode, receiv
185
182
  * metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.
186
183
  * @returns {Promise<string>} - The ARWeave metadata URI.
187
184
  */
188
- async function uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, lazyFund = true) {
185
+ async function uploadOrFetchMetadataURI(signer, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, lazyFund = true) {
189
186
  if (typeof metadata !== 'object' || Array.isArray(metadata)) {
190
187
  throw new Error('Input must be a JSON object.');
191
188
  }
192
189
  // Check to see if metadata with referenceId has already been minted
193
- const signer = signerOrProvider instanceof providers_1.Web3Provider
194
- ? signerOrProvider.getSigner()
195
- : signerOrProvider;
196
190
  const signerAddress = await signer.getAddress();
197
191
  const dataId = await ARWeaveService_1.ARWeaveService.queryForMetadata(chainId, signerAddress, referenceId);
198
192
  const config = ARWeaveService_1.ARWeaveService.getBundlrNetworkConfig(chainId);
@@ -214,7 +208,7 @@ async function uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, p
214
208
  if (!Object.prototype.hasOwnProperty.call(metadata, 'referenceId')) {
215
209
  metadata.referenceId = referenceId;
216
210
  }
217
- const response = await ARWeaveService_1.ARWeaveService.storeData(config, signerOrProvider instanceof providers_1.Web3Provider ? signerOrProvider : privateKey, metadata, tags, lazyFund);
211
+ const response = await ARWeaveService_1.ARWeaveService.storeData(config, privateKey, metadata, tags, lazyFund);
218
212
  arweaveId = response.id;
219
213
  console.log(`Data uploaded ==> ${ARWeaveService_1.ARWeaveService.getURIFromARWeaveId(arweaveId)}`);
220
214
  }
@@ -226,10 +220,8 @@ async function uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, p
226
220
  * @async
227
221
  * @function
228
222
  * @memberof ReceivableService
229
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
230
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
231
- * from server calls.
232
- * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
223
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
224
+ * @param {string} privateKey - Private key of the wallet used to upload metadata to ARWeave.
233
225
  * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
234
226
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
235
227
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
@@ -245,15 +237,12 @@ async function uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, p
245
237
  * @param {Overrides} [gasOpts] - Optional gas overrides for the transaction.
246
238
  * @returns {Promise<TransactionResponse>} - The transaction receipt.
247
239
  */
248
- async function createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, lazyFund = true, gasOpts) {
240
+ async function createReceivableWithMetadata(signer, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, lazyFund = true, gasOpts) {
249
241
  if (typeof metadata !== 'object' || Array.isArray(metadata)) {
250
242
  throw new Error('Input must be a JSON object.');
251
243
  }
252
244
  // Check to see if metadata with referenceId has already been minted
253
- const signer = signerOrProvider instanceof providers_1.Web3Provider
254
- ? signerOrProvider.getSigner()
255
- : signerOrProvider;
256
- const metadataURI = await uploadOrFetchMetadataURI(signerOrProvider, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, lazyFund);
245
+ const metadataURI = await uploadOrFetchMetadataURI(signer, privateKey, chainId, poolName, poolType, metadata, referenceId, extraTags, lazyFund);
257
246
  return createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadataURI, gasOpts);
258
247
  }
259
248
  /**
@@ -262,20 +251,18 @@ async function createReceivableWithMetadata(signerOrProvider, privateKey, chainI
262
251
  * @async
263
252
  * @function
264
253
  * @memberof ReceivableService
265
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
266
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
267
- * from server calls.
254
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
268
255
  * @param {string} owner - The receivable token owner to query from.
269
256
  * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
270
257
  * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
271
258
  * @param {Pagination} pagination - The pagination option.
272
259
  * @returns {Promise<RealWorldReceivableInfo[]>} - An array of receivables owned by the owner for the pool.
273
260
  */
274
- async function loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType, pagination) {
261
+ async function loadReceivablesOfOwnerWithMetadata(signer, owner, poolName, poolType, pagination) {
275
262
  if (!ethers_1.ethers.utils.isAddress(owner)) {
276
263
  throw new Error('Invalid owner address');
277
264
  }
278
- const chainId = await (0, utils_1.getChainIdFromSignerOrProvider)(signerOrProvider);
265
+ const chainId = await (0, utils_1.getChainIdFromSignerOrProvider)(signer);
279
266
  if (!chainId) {
280
267
  throw new Error('No Chain Id found');
281
268
  }
@@ -290,21 +277,19 @@ async function loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolN
290
277
  * @async
291
278
  * @function
292
279
  * @memberof ReceivableService
293
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
294
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
295
- * from server calls.
280
+ * @param {ethers.Signer} signer - An ethers.signer instance used to de-dupe metadata uploads.
296
281
  * @param {string} owner - The receivable token owner to query from.
297
282
  * @returns {Promise<number>} - Total count of receivables owned by the owner for the pool.
298
283
  */
299
- async function getTotalCountOfReceivables(signerOrProvider, owner) {
284
+ async function getTotalCountOfReceivables(signer, owner) {
300
285
  if (!ethers_1.ethers.utils.isAddress(owner)) {
301
286
  throw new Error('Invalid owner address');
302
287
  }
303
- const chainId = await (0, utils_1.getChainIdFromSignerOrProvider)(signerOrProvider);
288
+ const chainId = await (0, utils_1.getChainIdFromSignerOrProvider)(signer);
304
289
  if (!chainId) {
305
290
  throw new Error('No Chain Id found');
306
291
  }
307
- const rwrContract = (0, helpers_1.getRealWorldReceivableContract)(signerOrProvider, chainId);
292
+ const rwrContract = (0, helpers_1.getRealWorldReceivableContract)(signer, chainId);
308
293
  if (!rwrContract) {
309
294
  throw new Error('Could not find RealWorldReceivable contract');
310
295
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ReceivableService.js","sourceRoot":"","sources":["../../../src/services/ReceivableService.ts"],"names":[],"mappings":";;;AAAA,wDAA4E;AAC5E,mCAAwD;AACxD,iDAS6B;AAC7B,qDAA8C;AAE9C,qDAAiD;AACjD,wCAA2D;AAC3D,oCAA+E;AAE/E,uDAA+D;AAE/D;;;;;;;;;GASG;AACH,KAAK,UAAU,eAAe,CAC5B,MAAqB,EACrB,GAAkB;;IAElB,IAAI,GAAG,KAAK,IAAI,EAAE;QAChB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,MAAM,IAAA,sCAA8B,EAAC,MAAM,CAAC,CAAA;IAC5D,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAA;IAE/C,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;KACrC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;GAU3B,CAAA;IAED,MAAM,kBAAkB,GAAG,MAAA,wBAAe,CAAC,OAAO,CAAC,0CAAE,mBAAmB,CAAA;IACxE,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IAED,MAAM,eAAe,GAAkC,MAAM,IAAA,yBAAO,EAClE,kBAAkB,EAClB,gBAAgB,EAChB;QACE,KAAK,EAAE,aAAa;QACp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B,EAAC,gBAAgB,EAAE,OAAO,CAAC,CAAA;IAC7E,IAAI,CAAC,WAAW,EAAE;QAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;KAC/D;IAED,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAClD,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAA;AAC3B,CAAC;AAED;;;GAGG;AACU,QAAA,iBAAiB,GAAG;IAC/B,4BAA4B;IAC5B,gBAAgB;IAChB,iCAAiC;IACjC,qCAAqC;IACrC,kCAAkC;IAClC,0BAA0B;IAC1B,wBAAwB;IACxB,eAAe;CAChB,CAAA"}
1
+ {"version":3,"file":"ReceivableService.js","sourceRoot":"","sources":["../../../src/services/ReceivableService.ts"],"names":[],"mappings":";;;AACA,mCAAwD;AACxD,iDAS6B;AAC7B,qDAA8C;AAE9C,qDAAiD;AACjD,wCAA2D;AAC3D,oCAA+E;AAE/E,uDAA+D;AAE/D;;;;;;;;;GASG;AACH,KAAK,UAAU,eAAe,CAC5B,MAAqB,EACrB,GAAkB;;IAElB,IAAI,GAAG,KAAK,IAAI,EAAE;QAChB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,MAAM,IAAA,sCAA8B,EAAC,MAAM,CAAC,CAAA;IAC5D,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAA;IAE/C,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;KACrC;IAED,6CAA6C;IAC7C,MAAM,gBAAgB,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;GAU3B,CAAA;IAED,MAAM,kBAAkB,GAAG,MAAA,wBAAe,CAAC,OAAO,CAAC,0CAAE,QAAQ,CAAA;IAC7D,IAAI,CAAC,kBAAkB,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAA;KAChE;IAED,MAAM,e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