@huma-finance/sdk 0.0.53 → 0.0.54-beta.423
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/dist/cjs/helpers/v2/CreditContractHelper.d.ts +9 -1
- package/dist/cjs/helpers/v2/CreditContractHelper.js +16 -1
- package/dist/cjs/helpers/v2/CreditContractHelper.js.map +1 -1
- package/dist/helpers/v2/CreditContractHelper.d.ts +9 -1
- package/dist/helpers/v2/CreditContractHelper.js +14 -0
- package/dist/helpers/v2/CreditContractHelper.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
|
|
2
|
-
import { POOL_NAME } from '@huma-finance/shared';
|
|
2
|
+
import { CreditRecordStructOutput, POOL_NAME } from '@huma-finance/shared';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the current pool balance available for borrowing
|
|
@@ -8,6 +8,14 @@ import { ethers } from 'ethers';
|
|
|
8
8
|
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getAvailableBalanceForPool(poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the credit record of the borrower
|
|
13
|
+
*
|
|
14
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
|
|
15
|
+
* @param {string} borrower - The address of the borrower to check the credit record for
|
|
16
|
+
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCreditRecordForPool(poolName: POOL_NAME, borrower: string, provider: JsonRpcProvider | Web3Provider): Promise<CreditRecordStructOutput>;
|
|
11
19
|
/**
|
|
12
20
|
* Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
|
|
13
21
|
* currently available for borrowing as the credit limit might exceed the available pool balance. Use
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAvailableCreditForPool = exports.getAvailableBalanceForPool = void 0;
|
|
3
|
+
exports.getAvailableCreditForPool = exports.getCreditRecordForPool = exports.getAvailableBalanceForPool = void 0;
|
|
4
4
|
const shared_1 = require("@huma-finance/shared");
|
|
5
5
|
/**
|
|
6
6
|
* Returns the current pool balance available for borrowing
|
|
@@ -16,6 +16,21 @@ async function getAvailableBalanceForPool(poolName, provider) {
|
|
|
16
16
|
return safeContract.getAvailableBalanceForPool();
|
|
17
17
|
}
|
|
18
18
|
exports.getAvailableBalanceForPool = getAvailableBalanceForPool;
|
|
19
|
+
/**
|
|
20
|
+
* Returns the credit record of the borrower
|
|
21
|
+
*
|
|
22
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
|
|
23
|
+
* @param {string} borrower - The address of the borrower to check the credit record for
|
|
24
|
+
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
25
|
+
*/
|
|
26
|
+
async function getCreditRecordForPool(poolName, borrower, provider) {
|
|
27
|
+
const creditRecord = await (0, shared_1.getCreditRecordV2)(poolName, borrower, provider);
|
|
28
|
+
if (!creditRecord) {
|
|
29
|
+
throw new Error('Could not find credit record for pool');
|
|
30
|
+
}
|
|
31
|
+
return creditRecord;
|
|
32
|
+
}
|
|
33
|
+
exports.getCreditRecordForPool = getCreditRecordForPool;
|
|
19
34
|
/**
|
|
20
35
|
* Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
|
|
21
36
|
* currently available for borrowing as the credit limit might exceed the available pool balance. Use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../../src/helpers/v2/CreditContractHelper.ts"],"names":[],"mappings":";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AaC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers';
|
|
2
|
-
import { POOL_NAME } from '@huma-finance/shared';
|
|
2
|
+
import { CreditRecordStructOutput, POOL_NAME } from '@huma-finance/shared';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
/**
|
|
5
5
|
* Returns the current pool balance available for borrowing
|
|
@@ -8,6 +8,14 @@ import { ethers } from 'ethers';
|
|
|
8
8
|
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
9
9
|
*/
|
|
10
10
|
export declare function getAvailableBalanceForPool(poolName: POOL_NAME, provider: JsonRpcProvider | Web3Provider): Promise<ethers.BigNumber>;
|
|
11
|
+
/**
|
|
12
|
+
* Returns the credit record of the borrower
|
|
13
|
+
*
|
|
14
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
|
|
15
|
+
* @param {string} borrower - The address of the borrower to check the credit record for
|
|
16
|
+
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getCreditRecordForPool(poolName: POOL_NAME, borrower: string, provider: JsonRpcProvider | Web3Provider): Promise<CreditRecordStructOutput>;
|
|
11
19
|
/**
|
|
12
20
|
* Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
|
|
13
21
|
* currently available for borrowing as the credit limit might exceed the available pool balance. Use
|
|
@@ -12,6 +12,20 @@ export async function getAvailableBalanceForPool(poolName, provider) {
|
|
|
12
12
|
}
|
|
13
13
|
return safeContract.getAvailableBalanceForPool();
|
|
14
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Returns the credit record of the borrower
|
|
17
|
+
*
|
|
18
|
+
* @param {POOL_NAME} poolName - The name of the credit pool to get the contract instance for.
|
|
19
|
+
* @param {string} borrower - The address of the borrower to check the credit record for
|
|
20
|
+
* @param {JsonRpcProvider | Web3Provider} provider The provider instance to use for reading from the contract.
|
|
21
|
+
*/
|
|
22
|
+
export async function getCreditRecordForPool(poolName, borrower, provider) {
|
|
23
|
+
const creditRecord = await getCreditRecordV2(poolName, borrower, provider);
|
|
24
|
+
if (!creditRecord) {
|
|
25
|
+
throw new Error('Could not find credit record for pool');
|
|
26
|
+
}
|
|
27
|
+
return creditRecord;
|
|
28
|
+
}
|
|
15
29
|
/**
|
|
16
30
|
* Returns the borrower's remaining credit they can use for borrowing. Note that this might not be
|
|
17
31
|
* currently available for borrowing as the credit limit might exceed the available pool balance. Use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/v2/CreditContractHelper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"CreditContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/v2/CreditContractHelper.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GAGtB,MAAM,sBAAsB,CAAA;AAG7B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,QAAmB,EACnB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAEpE,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;KACzD;IAED,OAAO,YAAY,CAAC,0BAA0B,EAAE,CAAA;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,QAAmB,EACnB,QAAgB,EAChB,QAAwC;IAExC,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IAE1E,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,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