@huma-finance/sdk 0.0.12 → 0.0.15
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 +50 -0
- package/dist/cjs/helpers/PoolContractHelper.d.ts +92 -3
- package/dist/cjs/helpers/PoolContractHelper.js +69 -5
- package/dist/cjs/helpers/PoolContractHelper.js.map +1 -1
- package/dist/cjs/services/ARWeaveService.js +16 -16
- package/dist/cjs/services/ReceivableService.js +11 -11
- package/dist/cjs/utils/poolInfo.d.ts +0 -1
- package/dist/cjs/utils/poolInfo.js +0 -1
- package/dist/cjs/utils/poolInfo.js.map +1 -1
- package/dist/helpers/PoolContractHelper.d.ts +92 -3
- package/dist/helpers/PoolContractHelper.js +66 -4
- package/dist/helpers/PoolContractHelper.js.map +1 -1
- package/dist/services/ARWeaveService.js +16 -16
- package/dist/services/ReceivableService.js +11 -11
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/poolInfo.d.ts +0 -1
- package/dist/utils/poolInfo.js +0 -1
- package/dist/utils/poolInfo.js.map +1 -1
- package/package.json +5 -4
package/API.md
CHANGED
|
@@ -16,11 +16,17 @@
|
|
|
16
16
|
## Functions
|
|
17
17
|
|
|
18
18
|
<dl>
|
|
19
|
+
<dt><a href="#defaultWrapper">defaultWrapper()</a></dt>
|
|
20
|
+
<dd><p>All built-in and custom scalars, mapped to their actual values</p></dd>
|
|
19
21
|
<dt><a href="#getERC20TransferableReceivableContract">getERC20TransferableReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
|
|
20
22
|
<dd><p>Returns an ethers contract instance for the ERC20TransferableReceivable contract
|
|
21
23
|
associated with the given pool name on the current chain.</p></dd>
|
|
22
24
|
<dt><a href="#getPoolContract">getPoolContract(signerOrProvider, chainId, poolName, poolType)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
|
|
23
25
|
<dd><p>Returns an ethers contract instance for a Huma pool contract</p></dd>
|
|
26
|
+
<dt><a href="#drawdownFromPool">drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts)</a> ⇒ <code>Promise.<TransactionResponse></code></dt>
|
|
27
|
+
<dd><p>Calls drawdown on a Huma pool contract</p></dd>
|
|
28
|
+
<dt><a href="#makePaymentToPool">makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts)</a> ⇒ <code>Promise.<TransactionResponse></code></dt>
|
|
29
|
+
<dd><p>Calls drawdown on a Huma pool contract</p></dd>
|
|
24
30
|
<dt><a href="#getRealWorldReceivableContract">getRealWorldReceivableContract(signerOrProvider, chainId)</a> ⇒ <code>Contract</code> | <code>null</code></dt>
|
|
25
31
|
<dd><p>Returns an ethers contract instance for the RealWorldReceivable contract
|
|
26
32
|
associated with the given pool name on the current chain.</p></dd>
|
|
@@ -282,6 +288,12 @@ associated with the given pool name on the current chain.</p></dd>
|
|
|
282
288
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the pool.</p> |
|
|
283
289
|
| poolType | <code>POOL\_TYPE</code> | <p>The type of the pool.</p> |
|
|
284
290
|
|
|
291
|
+
<a name="defaultWrapper"></a>
|
|
292
|
+
|
|
293
|
+
## defaultWrapper()
|
|
294
|
+
<p>All built-in and custom scalars, mapped to their actual values</p>
|
|
295
|
+
|
|
296
|
+
**Kind**: global function
|
|
285
297
|
<a name="getERC20TransferableReceivableContract"></a>
|
|
286
298
|
|
|
287
299
|
## getERC20TransferableReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
|
|
@@ -311,6 +323,44 @@ associated with the given pool name on the current chain.</p>
|
|
|
311
323
|
| poolName | <code>POOL\_NAME</code> | <p>The name of the pool contract to get.</p> |
|
|
312
324
|
| poolType | <code>POOL\_TYPE</code> | <p>The type of the pool contract to get.</p> |
|
|
313
325
|
|
|
326
|
+
<a name="drawdownFromPool"></a>
|
|
327
|
+
|
|
328
|
+
## drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts) ⇒ <code>Promise.<TransactionResponse></code>
|
|
329
|
+
<p>Calls drawdown on a Huma pool contract</p>
|
|
330
|
+
|
|
331
|
+
**Kind**: global function
|
|
332
|
+
**Returns**: <code>Promise.<TransactionResponse></code> - <ul>
|
|
333
|
+
<li>A Promise of the transaction response.</li>
|
|
334
|
+
</ul>
|
|
335
|
+
|
|
336
|
+
| Param | Type | Description |
|
|
337
|
+
| --- | --- | --- |
|
|
338
|
+
| signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
|
|
339
|
+
| chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
|
|
340
|
+
| 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> |
|
|
341
|
+
| 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> |
|
|
342
|
+
| drawdownAmount | <code>BigNumberish</code> | <p>The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.</p> |
|
|
343
|
+
| gasOpts | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
|
|
344
|
+
|
|
345
|
+
<a name="makePaymentToPool"></a>
|
|
346
|
+
|
|
347
|
+
## makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts) ⇒ <code>Promise.<TransactionResponse></code>
|
|
348
|
+
<p>Calls drawdown on a Huma pool contract</p>
|
|
349
|
+
|
|
350
|
+
**Kind**: global function
|
|
351
|
+
**Returns**: <code>Promise.<TransactionResponse></code> - <ul>
|
|
352
|
+
<li>A Promise of the transaction response.</li>
|
|
353
|
+
</ul>
|
|
354
|
+
|
|
355
|
+
| Param | Type | Description |
|
|
356
|
+
| --- | --- | --- |
|
|
357
|
+
| signer | <code>ethers.Signer</code> | <p>The signer used to send the transaction.</p> |
|
|
358
|
+
| chainId | <code>number</code> | <p>The chain ID of the pool to call drawdown on. Used to lookup the pool address.</p> |
|
|
359
|
+
| 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> |
|
|
360
|
+
| 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> |
|
|
361
|
+
| paymentAmount | <code>BigNumberish</code> | <p>The amount of tokens to payback, denominated in the ERC20 tokens of the pool.</p> |
|
|
362
|
+
| gasOpts | <code>Overrides</code> | <p>The gas options to use for the transaction.</p> |
|
|
363
|
+
|
|
314
364
|
<a name="getRealWorldReceivableContract"></a>
|
|
315
365
|
|
|
316
366
|
## getRealWorldReceivableContract(signerOrProvider, chainId) ⇒ <code>Contract</code> \| <code>null</code>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import { BigNumberish, Contract, Overrides, ethers } from 'ethers';
|
|
2
3
|
import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
|
|
3
4
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
4
5
|
/**
|
|
@@ -11,5 +12,93 @@ import { TransactionResponse } from '@ethersproject/providers';
|
|
|
11
12
|
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
12
13
|
*/
|
|
13
14
|
export declare function getPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Contract | null;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Return type of getCreditRecord
|
|
17
|
+
*
|
|
18
|
+
* @memberof getCreditRecord
|
|
19
|
+
* @typedef {Object} CreditRecord
|
|
20
|
+
* @property {BigNumber} unbilledPrincipal - The amount of principal not included in the bill
|
|
21
|
+
* @property {BigNumber} dueDate - Unix timestamp due date of the next payment
|
|
22
|
+
* @property {BigNumber} correction - the adjustment of interest over or under-counted because of drawdown
|
|
23
|
+
* or principal payment in the middle of a billing period
|
|
24
|
+
* @property {BigNumber} totalDue - The due amount of the next payment
|
|
25
|
+
* @property {BigNumber} feesAndInterestDue - Interest and fees due for the next payment
|
|
26
|
+
* @property {number} missedPeriods - # of consecutive missed payments, for default processing
|
|
27
|
+
* @property {number} remainingPeriods - # of payment periods until the maturity of the credit line
|
|
28
|
+
* @property {number} state - status of the credit line.
|
|
29
|
+
* For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49
|
|
30
|
+
*/
|
|
31
|
+
export type CreditRecord = [
|
|
32
|
+
BigNumber,
|
|
33
|
+
BigNumber,
|
|
34
|
+
BigNumber,
|
|
35
|
+
BigNumber,
|
|
36
|
+
BigNumber,
|
|
37
|
+
number,
|
|
38
|
+
number,
|
|
39
|
+
number
|
|
40
|
+
] & {
|
|
41
|
+
unbilledPrincipal: BigNumber;
|
|
42
|
+
dueDate: BigNumber;
|
|
43
|
+
correction: BigNumber;
|
|
44
|
+
totalDue: BigNumber;
|
|
45
|
+
feesAndInterestDue: BigNumber;
|
|
46
|
+
missedPeriods: number;
|
|
47
|
+
remainingPeriods: number;
|
|
48
|
+
state: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
|
|
52
|
+
*
|
|
53
|
+
* @namespace getCreditRecord
|
|
54
|
+
* @async
|
|
55
|
+
* @function
|
|
56
|
+
* @param {string} address - The address to lookup.
|
|
57
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
58
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
59
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
60
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
61
|
+
* @returns {Promise<CreditRecord>} - A Promise of the transaction response.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getCreditRecord(address: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Promise<CreditRecord>;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
|
|
66
|
+
*
|
|
67
|
+
* @async
|
|
68
|
+
* @function
|
|
69
|
+
* @param {string} address - The address to lookup.
|
|
70
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
71
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
72
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
73
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
74
|
+
* @returns {Promise<BigNumber>} - A Promise of the transaction response.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTotalDue(address: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Promise<BigNumber>;
|
|
77
|
+
/**
|
|
78
|
+
* Calls drawdown on a Huma pool contract
|
|
79
|
+
*
|
|
80
|
+
* @async
|
|
81
|
+
* @function
|
|
82
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
83
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
84
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
85
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
86
|
+
* @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
|
|
87
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
88
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
89
|
+
*/
|
|
90
|
+
export declare function drawdownFromPool(signer: ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, drawdownAmount: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Calls drawdown on a Huma pool contract
|
|
93
|
+
*
|
|
94
|
+
* @async
|
|
95
|
+
* @function
|
|
96
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
97
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
98
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
99
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
100
|
+
* @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
|
|
101
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
102
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
103
|
+
*/
|
|
104
|
+
export declare function makePaymentToPool(signer: ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, paymentAmount: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePaymentToPool = exports.drawdownFromPool = exports.getPoolContract = void 0;
|
|
3
|
+
exports.makePaymentToPool = exports.drawdownFromPool = exports.getTotalDue = exports.getCreditRecord = exports.getPoolContract = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
/**
|
|
6
6
|
* Returns an ethers contract instance for a Huma pool contract
|
|
@@ -18,22 +18,86 @@ function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
|
|
|
18
18
|
return (0, utils_1.getContract)(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
|
|
19
19
|
}
|
|
20
20
|
exports.getPoolContract = getPoolContract;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
|
|
23
|
+
*
|
|
24
|
+
* @namespace getCreditRecord
|
|
25
|
+
* @async
|
|
26
|
+
* @function
|
|
27
|
+
* @param {string} address - The address to lookup.
|
|
28
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
29
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
30
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
31
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
32
|
+
* @returns {Promise<CreditRecord>} - A Promise of the transaction response.
|
|
33
|
+
*/
|
|
34
|
+
async function getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) {
|
|
35
|
+
const poolContract = getPoolContract(signerOrProvider, chainId, poolName, poolType);
|
|
36
|
+
if (!poolContract) {
|
|
37
|
+
throw new Error('Could not find pool contract');
|
|
38
|
+
}
|
|
39
|
+
return poolContract.creditRecordMapping(address);
|
|
40
|
+
}
|
|
41
|
+
exports.getCreditRecord = getCreditRecord;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
|
|
44
|
+
*
|
|
45
|
+
* @async
|
|
46
|
+
* @function
|
|
47
|
+
* @param {string} address - The address to lookup.
|
|
48
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
49
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
50
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
51
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
52
|
+
* @returns {Promise<BigNumber>} - A Promise of the transaction response.
|
|
53
|
+
*/
|
|
54
|
+
async function getTotalDue(address, signerOrProvider, chainId, poolName, poolType) {
|
|
55
|
+
const creditRecord = await getCreditRecord(address, signerOrProvider, chainId, poolName, poolType);
|
|
56
|
+
return creditRecord.totalDue;
|
|
57
|
+
}
|
|
58
|
+
exports.getTotalDue = getTotalDue;
|
|
59
|
+
/**
|
|
60
|
+
* Calls drawdown on a Huma pool contract
|
|
61
|
+
*
|
|
62
|
+
* @async
|
|
63
|
+
* @function
|
|
64
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
65
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
66
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
67
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
68
|
+
* @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
|
|
69
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
70
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
71
|
+
*/
|
|
72
|
+
function drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts = {}) {
|
|
22
73
|
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
23
74
|
if (!poolContract) {
|
|
24
75
|
throw new Error('Could not find pool contract');
|
|
25
76
|
}
|
|
26
77
|
// TODO: Generate typechain for pool contract
|
|
27
|
-
return poolContract.drawdown(drawdownAmount);
|
|
78
|
+
return poolContract.drawdown(drawdownAmount, gasOpts);
|
|
28
79
|
}
|
|
29
80
|
exports.drawdownFromPool = drawdownFromPool;
|
|
30
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Calls drawdown on a Huma pool contract
|
|
83
|
+
*
|
|
84
|
+
* @async
|
|
85
|
+
* @function
|
|
86
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
87
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
88
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
89
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
90
|
+
* @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
|
|
91
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
92
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
93
|
+
*/
|
|
94
|
+
async function makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts = {}) {
|
|
31
95
|
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
32
96
|
if (!poolContract) {
|
|
33
97
|
throw new Error('Could not find pool contract');
|
|
34
98
|
}
|
|
35
99
|
// TODO: Generate typechain for pool contract
|
|
36
|
-
return poolContract.makePayment(await signer.getAddress(), paymentAmount);
|
|
100
|
+
return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
|
|
37
101
|
}
|
|
38
102
|
exports.makePaymentToPool = makePaymentToPool;
|
|
39
103
|
//# sourceMappingURL=PoolContractHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":";;;AAKA,oCAAmD;AAEnD;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC7B,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,OAAO,IAAA,mBAAW,EAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;AACvE,CAAC;AAXD,0CAWC;AAsCD;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,eAAe,CAClC,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IAED,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,OAAO,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAClD,CAAC;AAnBD,0CAmBC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IAED,OAAO,YAAY,CAAC,QAAQ,CAAA;AAC9B,CAAC;AAhBD,kCAgBC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAC9B,MAAqB,EACrB,OAAe,EACf,QAAmB,EACnB,QAAmB,EACnB,cAA4B,EAC5B,UAAqB,EAAE;IAEvB,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,6CAA6C;IAC7C,OAAO,YAAY,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC;AAhBD,4CAgBC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,OAAe,EACf,QAAmB,EACnB,QAAmB,EACnB,aAA2B,EAC3B,UAAqB,EAAE;IAEvB,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,6CAA6C;IAC7C,OAAO,YAAY,CAAC,WAAW,CAC7B,MAAM,MAAM,CAAC,UAAU,EAAE,EACzB,aAAa,EACb,OAAO,CACR,CAAA;AACH,CAAC;AApBD,8CAoBC"}
|
|
@@ -104,22 +104,22 @@ async function storeData(config, signerOrPrivateKey, data, tags, lazyFund = true
|
|
|
104
104
|
async function queryForMetadata(chainId, sender, referenceId) {
|
|
105
105
|
var _a, _b, _c, _d;
|
|
106
106
|
const config = getBundlrNetworkConfig(chainId);
|
|
107
|
-
const query = (0, graphql_request_1.gql) `
|
|
108
|
-
query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
|
|
109
|
-
transactions(
|
|
110
|
-
owners: [$sender]
|
|
111
|
-
tags: [
|
|
112
|
-
{ name: "appName", values: ["HumaFinance"] }
|
|
113
|
-
{ name: "referenceId", values: [$referenceId] }
|
|
114
|
-
]
|
|
115
|
-
) {
|
|
116
|
-
edges {
|
|
117
|
-
node {
|
|
118
|
-
id
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
107
|
+
const query = (0, graphql_request_1.gql) `
|
|
108
|
+
query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
|
|
109
|
+
transactions(
|
|
110
|
+
owners: [$sender]
|
|
111
|
+
tags: [
|
|
112
|
+
{ name: "appName", values: ["HumaFinance"] }
|
|
113
|
+
{ name: "referenceId", values: [$referenceId] }
|
|
114
|
+
]
|
|
115
|
+
) {
|
|
116
|
+
edges {
|
|
117
|
+
node {
|
|
118
|
+
id
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
123
|
`;
|
|
124
124
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
125
125
|
const data = await (0, graphql_request_1.default)(`${config.nodeUrl}/graphql`, query, {
|
|
@@ -29,16 +29,16 @@ async function declareReceivablePaymentByReferenceId(signer, referenceId, paymen
|
|
|
29
29
|
// Get ARWeave ID
|
|
30
30
|
const dataID = await ARWeaveService_1.ARWeaveService.queryForMetadata(chainId, signerAddress, referenceId);
|
|
31
31
|
// Fetch receivables with the same ARWeave ID
|
|
32
|
-
const receivablesQuery = (0, graphql_request_1.gql) `
|
|
33
|
-
query ReceivablesByURIQuery($owner: String!, $uri: String!) {
|
|
34
|
-
receivables(where: { owner: $owner, uri: $uri }) {
|
|
35
|
-
...ReceivableFields
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
fragment ReceivableFields on Receivable {
|
|
40
|
-
tokenId
|
|
41
|
-
}
|
|
32
|
+
const receivablesQuery = (0, graphql_request_1.gql) `
|
|
33
|
+
query ReceivablesByURIQuery($owner: String!, $uri: String!) {
|
|
34
|
+
receivables(where: { owner: $owner, uri: $uri }) {
|
|
35
|
+
...ReceivableFields
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
fragment ReceivableFields on Receivable {
|
|
40
|
+
tokenId
|
|
41
|
+
}
|
|
42
42
|
`;
|
|
43
43
|
let receivableSubgraph;
|
|
44
44
|
switch (chainId) {
|
|
@@ -56,7 +56,7 @@ async function declareReceivablePaymentByReferenceId(signer, referenceId, paymen
|
|
|
56
56
|
throw new Error('No receivables found with this ARWeave ID.');
|
|
57
57
|
}
|
|
58
58
|
else if (((_b = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
59
|
-
throw new Error(`This owner has multiple receivables with the same URI. Please burn
|
|
59
|
+
throw new Error(`This owner has multiple receivables with the same URI. Please burn
|
|
60
60
|
unnecessary receivables or pay the correct token manually using declareReceivablePaymentByTokenId`);
|
|
61
61
|
}
|
|
62
62
|
const contract = (0, helpers_1.getRealWorldReceivableContract)(signer, chainId);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { POOL_NAME, POOL_TYPE, PoolInfoType } from '@huma-finance/shared';
|
|
2
2
|
/**
|
|
3
3
|
* Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given
|
|
4
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The Web3 provider or signer.
|
|
5
4
|
* @param {POOL_NAME} poolName - The name of the pool.
|
|
6
5
|
* @param {POOL_TYPE} poolType - The type of the pool.
|
|
7
6
|
* @returns {PoolInfoType|undefined} - The pool info or undefined if the chain ID is not supported.
|
|
@@ -4,7 +4,6 @@ exports.getPoolInfo = void 0;
|
|
|
4
4
|
const shared_1 = require("@huma-finance/shared");
|
|
5
5
|
/**
|
|
6
6
|
* Returns the pool info based on the provided pool name and type, using the same chain ID as the provider/signer given
|
|
7
|
-
* @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The Web3 provider or signer.
|
|
8
7
|
* @param {POOL_NAME} poolName - The name of the pool.
|
|
9
8
|
* @param {POOL_TYPE} poolType - The type of the pool.
|
|
10
9
|
* @returns {PoolInfoType|undefined} - The pool info or undefined if the chain ID is not supported.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolInfo.js","sourceRoot":"","sources":["../../../src/utils/poolInfo.ts"],"names":[],"mappings":";;;AAAA,iDAK6B;AAE7B
|
|
1
|
+
{"version":3,"file":"poolInfo.js","sourceRoot":"","sources":["../../../src/utils/poolInfo.ts"],"names":[],"mappings":";;;AAAA,iDAK6B;AAE7B;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CACzB,OAAe,EACf,QAAmB,EACnB,QAAmB,EACO,EAAE,eAAC,OAAA,MAAA,MAAA,wBAAe,CAAC,OAAO,CAAC,0CAAG,QAAQ,CAAC,0CAAG,QAAQ,CAAC,CAAA,EAAA,CAAA;AAJlE,QAAA,WAAW,eAIuD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import { BigNumberish, Contract, Overrides, ethers } from 'ethers';
|
|
2
3
|
import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
|
|
3
4
|
import { TransactionResponse } from '@ethersproject/providers';
|
|
4
5
|
/**
|
|
@@ -11,5 +12,93 @@ import { TransactionResponse } from '@ethersproject/providers';
|
|
|
11
12
|
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
12
13
|
*/
|
|
13
14
|
export declare function getPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Contract | null;
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Return type of getCreditRecord
|
|
17
|
+
*
|
|
18
|
+
* @memberof getCreditRecord
|
|
19
|
+
* @typedef {Object} CreditRecord
|
|
20
|
+
* @property {BigNumber} unbilledPrincipal - The amount of principal not included in the bill
|
|
21
|
+
* @property {BigNumber} dueDate - Unix timestamp due date of the next payment
|
|
22
|
+
* @property {BigNumber} correction - the adjustment of interest over or under-counted because of drawdown
|
|
23
|
+
* or principal payment in the middle of a billing period
|
|
24
|
+
* @property {BigNumber} totalDue - The due amount of the next payment
|
|
25
|
+
* @property {BigNumber} feesAndInterestDue - Interest and fees due for the next payment
|
|
26
|
+
* @property {number} missedPeriods - # of consecutive missed payments, for default processing
|
|
27
|
+
* @property {number} remainingPeriods - # of payment periods until the maturity of the credit line
|
|
28
|
+
* @property {number} state - status of the credit line.
|
|
29
|
+
* For more info: https://github.com/00labs/huma-contracts/blob/b075a8f957de281e0885e37dbd72a422b6a54a38/contracts/libraries/BaseStructs.sol#L49
|
|
30
|
+
*/
|
|
31
|
+
export type CreditRecord = [
|
|
32
|
+
BigNumber,
|
|
33
|
+
BigNumber,
|
|
34
|
+
BigNumber,
|
|
35
|
+
BigNumber,
|
|
36
|
+
BigNumber,
|
|
37
|
+
number,
|
|
38
|
+
number,
|
|
39
|
+
number
|
|
40
|
+
] & {
|
|
41
|
+
unbilledPrincipal: BigNumber;
|
|
42
|
+
dueDate: BigNumber;
|
|
43
|
+
correction: BigNumber;
|
|
44
|
+
totalDue: BigNumber;
|
|
45
|
+
feesAndInterestDue: BigNumber;
|
|
46
|
+
missedPeriods: number;
|
|
47
|
+
remainingPeriods: number;
|
|
48
|
+
state: number;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
|
|
52
|
+
*
|
|
53
|
+
* @namespace getCreditRecord
|
|
54
|
+
* @async
|
|
55
|
+
* @function
|
|
56
|
+
* @param {string} address - The address to lookup.
|
|
57
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
58
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
59
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
60
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
61
|
+
* @returns {Promise<CreditRecord>} - A Promise of the transaction response.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getCreditRecord(address: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Promise<CreditRecord>;
|
|
64
|
+
/**
|
|
65
|
+
* Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
|
|
66
|
+
*
|
|
67
|
+
* @async
|
|
68
|
+
* @function
|
|
69
|
+
* @param {string} address - The address to lookup.
|
|
70
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
71
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
72
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
73
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
74
|
+
* @returns {Promise<BigNumber>} - A Promise of the transaction response.
|
|
75
|
+
*/
|
|
76
|
+
export declare function getTotalDue(address: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Promise<BigNumber>;
|
|
77
|
+
/**
|
|
78
|
+
* Calls drawdown on a Huma pool contract
|
|
79
|
+
*
|
|
80
|
+
* @async
|
|
81
|
+
* @function
|
|
82
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
83
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
84
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
85
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
86
|
+
* @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
|
|
87
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
88
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
89
|
+
*/
|
|
90
|
+
export declare function drawdownFromPool(signer: ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, drawdownAmount: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Calls drawdown on a Huma pool contract
|
|
93
|
+
*
|
|
94
|
+
* @async
|
|
95
|
+
* @function
|
|
96
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
97
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
98
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
99
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
100
|
+
* @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
|
|
101
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
102
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
103
|
+
*/
|
|
104
|
+
export declare function makePaymentToPool(signer: ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, paymentAmount: BigNumberish, gasOpts?: Overrides): Promise<TransactionResponse>;
|
|
@@ -14,20 +14,82 @@ export function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
|
|
|
14
14
|
return null;
|
|
15
15
|
return getContract(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Gets the credit record of a wallet in a Huma pool. Denominated in the ERC20 tokens of the pool.
|
|
19
|
+
*
|
|
20
|
+
* @namespace getCreditRecord
|
|
21
|
+
* @async
|
|
22
|
+
* @function
|
|
23
|
+
* @param {string} address - The address to lookup.
|
|
24
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
25
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
26
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
27
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
28
|
+
* @returns {Promise<CreditRecord>} - A Promise of the transaction response.
|
|
29
|
+
*/
|
|
30
|
+
export async function getCreditRecord(address, signerOrProvider, chainId, poolName, poolType) {
|
|
31
|
+
const poolContract = getPoolContract(signerOrProvider, chainId, poolName, poolType);
|
|
32
|
+
if (!poolContract) {
|
|
33
|
+
throw new Error('Could not find pool contract');
|
|
34
|
+
}
|
|
35
|
+
return poolContract.creditRecordMapping(address);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the total due for a Huma pool of the given wallet. Denominated in the ERC20 tokens of the pool.
|
|
39
|
+
*
|
|
40
|
+
* @async
|
|
41
|
+
* @function
|
|
42
|
+
* @param {string} address - The address to lookup.
|
|
43
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to read data.
|
|
44
|
+
* @param {number} chainId - The chain ID of the pool. Used to lookup the pool address.
|
|
45
|
+
* @param {POOL_NAME} poolName - The name of the credit pool. Used to lookup the pool address.
|
|
46
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool. Used to lookup the pool address.
|
|
47
|
+
* @returns {Promise<BigNumber>} - A Promise of the transaction response.
|
|
48
|
+
*/
|
|
49
|
+
export async function getTotalDue(address, signerOrProvider, chainId, poolName, poolType) {
|
|
50
|
+
const creditRecord = await getCreditRecord(address, signerOrProvider, chainId, poolName, poolType);
|
|
51
|
+
return creditRecord.totalDue;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Calls drawdown on a Huma pool contract
|
|
55
|
+
*
|
|
56
|
+
* @async
|
|
57
|
+
* @function
|
|
58
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
59
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
60
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
61
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
62
|
+
* @param {BigNumberish} drawdownAmount - The amount of tokens to withdraw, denominated in the ERC20 tokens of the pool.
|
|
63
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
64
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
65
|
+
*/
|
|
66
|
+
export function drawdownFromPool(signer, chainId, poolName, poolType, drawdownAmount, gasOpts = {}) {
|
|
18
67
|
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
19
68
|
if (!poolContract) {
|
|
20
69
|
throw new Error('Could not find pool contract');
|
|
21
70
|
}
|
|
22
71
|
// TODO: Generate typechain for pool contract
|
|
23
|
-
return poolContract.drawdown(drawdownAmount);
|
|
72
|
+
return poolContract.drawdown(drawdownAmount, gasOpts);
|
|
24
73
|
}
|
|
25
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Calls drawdown on a Huma pool contract
|
|
76
|
+
*
|
|
77
|
+
* @async
|
|
78
|
+
* @function
|
|
79
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction.
|
|
80
|
+
* @param {number} chainId - The chain ID of the pool to call drawdown on. Used to lookup the pool address.
|
|
81
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
82
|
+
* @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
|
|
83
|
+
* @param {BigNumberish} paymentAmount - The amount of tokens to payback, denominated in the ERC20 tokens of the pool.
|
|
84
|
+
* @param {Overrides} gasOpts - The gas options to use for the transaction.
|
|
85
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
86
|
+
*/
|
|
87
|
+
export async function makePaymentToPool(signer, chainId, poolName, poolType, paymentAmount, gasOpts = {}) {
|
|
26
88
|
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
27
89
|
if (!poolContract) {
|
|
28
90
|
throw new Error('Could not find pool contract');
|
|
29
91
|
}
|
|
30
92
|
// TODO: Generate typechain for pool contract
|
|
31
|
-
return poolContract.makePayment(await signer.getAddress(), paymentAmount);
|
|
93
|
+
return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
|
|
32
94
|
}
|
|
33
95
|
//# sourceMappingURL=PoolContractHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAEnD;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAE1B,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAA;AACvE,CAAC;AAsCD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,eAAe,CAClC,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IAED,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,OAAO,YAAY,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAA;AAClD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAe,EACf,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,MAAM,eAAe,CACxC,OAAO,EACP,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IAED,OAAO,YAAY,CAAC,QAAQ,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAqB,EACrB,OAAe,EACf,QAAmB,EACnB,QAAmB,EACnB,cAA4B,EAC5B,UAAqB,EAAE;IAEvB,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,6CAA6C;IAC7C,OAAO,YAAY,CAAC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;AACvD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAqB,EACrB,OAAe,EACf,QAAmB,EACnB,QAAmB,EACnB,aAA2B,EAC3B,UAAqB,EAAE;IAEvB,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;KAChD;IAED,6CAA6C;IAC7C,OAAO,YAAY,CAAC,WAAW,CAC7B,MAAM,MAAM,CAAC,UAAU,EAAE,EACzB,aAAa,EACb,OAAO,CACR,CAAA;AACH,CAAC"}
|
|
@@ -99,22 +99,22 @@ async function storeData(config, signerOrPrivateKey, data, tags, lazyFund = true
|
|
|
99
99
|
async function queryForMetadata(chainId, sender, referenceId) {
|
|
100
100
|
var _a, _b, _c, _d;
|
|
101
101
|
const config = getBundlrNetworkConfig(chainId);
|
|
102
|
-
const query = gql `
|
|
103
|
-
query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
|
|
104
|
-
transactions(
|
|
105
|
-
owners: [$sender]
|
|
106
|
-
tags: [
|
|
107
|
-
{ name: "appName", values: ["HumaFinance"] }
|
|
108
|
-
{ name: "referenceId", values: [$referenceId] }
|
|
109
|
-
]
|
|
110
|
-
) {
|
|
111
|
-
edges {
|
|
112
|
-
node {
|
|
113
|
-
id
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
102
|
+
const query = gql `
|
|
103
|
+
query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
|
|
104
|
+
transactions(
|
|
105
|
+
owners: [$sender]
|
|
106
|
+
tags: [
|
|
107
|
+
{ name: "appName", values: ["HumaFinance"] }
|
|
108
|
+
{ name: "referenceId", values: [$referenceId] }
|
|
109
|
+
]
|
|
110
|
+
) {
|
|
111
|
+
edges {
|
|
112
|
+
node {
|
|
113
|
+
id
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
118
|
`;
|
|
119
119
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
120
|
const data = await request(`${config.nodeUrl}/graphql`, query, {
|