@huma-finance/sdk 0.0.21 → 0.0.24
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 +482 -482
- package/LICENSE +660 -660
- package/README.md +34 -34
- package/dist/cjs/graphql/generatedTypes.d.ts +40 -40
- package/dist/cjs/graphql/generatedTypes.js +8 -8
- package/dist/cjs/graphql/index.d.ts +1 -1
- package/dist/cjs/graphql/index.js +4 -4
- package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
- package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
- package/dist/cjs/helpers/PoolContractHelper.d.ts +104 -104
- package/dist/cjs/helpers/PoolContractHelper.js +102 -104
- package/dist/cjs/helpers/PoolContractHelper.js.map +1 -1
- package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
- package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
- package/dist/cjs/helpers/index.d.ts +3 -3
- package/dist/cjs/helpers/index.js +6 -6
- package/dist/cjs/hooks/index.d.ts +4 -4
- package/dist/cjs/hooks/index.js +7 -7
- package/dist/cjs/hooks/useContract.d.ts +13 -13
- package/dist/cjs/hooks/useContract.js +30 -30
- package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
- package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
- package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
- package/dist/cjs/hooks/usePoolContract.js +53 -53
- package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
- package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/services/ARWeaveService.d.ts +81 -81
- package/dist/cjs/services/ARWeaveService.js +140 -145
- package/dist/cjs/services/ARWeaveService.js.map +1 -1
- package/dist/cjs/services/EAService.d.ts +18 -20
- package/dist/cjs/services/EAService.js +12 -33
- package/dist/cjs/services/EAService.js.map +1 -1
- package/dist/cjs/services/ReceivableService.d.ts +87 -89
- package/dist/cjs/services/ReceivableService.js +188 -193
- package/dist/cjs/services/ReceivableService.js.map +1 -1
- package/dist/cjs/services/SubgraphService.d.ts +53 -53
- package/dist/cjs/services/SubgraphService.js +100 -93
- package/dist/cjs/services/SubgraphService.js.map +1 -1
- package/dist/cjs/services/index.d.ts +4 -4
- package/dist/cjs/services/index.js +7 -7
- package/dist/cjs/utils/chain.d.ts +14 -15
- package/dist/cjs/utils/chain.js +33 -37
- package/dist/cjs/utils/chain.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +3 -4
- package/dist/cjs/utils/index.js +6 -7
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/poolInfo.d.ts +8 -8
- package/dist/cjs/utils/poolInfo.js +12 -12
- package/dist/cjs/utils/web3.d.ts +4 -4
- package/dist/cjs/utils/web3.js +28 -28
- package/dist/graphql/generatedTypes.d.ts +40 -40
- package/dist/graphql/generatedTypes.js +4 -4
- package/dist/graphql/index.d.ts +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
- package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
- package/dist/helpers/PoolContractHelper.d.ts +104 -104
- package/dist/helpers/PoolContractHelper.js +94 -96
- package/dist/helpers/PoolContractHelper.js.map +1 -1
- package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
- package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
- package/dist/helpers/index.d.ts +3 -3
- package/dist/helpers/index.js +3 -3
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/useContract.d.ts +13 -13
- package/dist/hooks/useContract.js +26 -26
- package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
- package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
- package/dist/hooks/usePoolContract.d.ts +60 -60
- package/dist/hooks/usePoolContract.js +48 -48
- package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
- package/dist/hooks/useRealWorldReceivableContract.js +15 -15
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/services/ARWeaveService.d.ts +81 -81
- package/dist/services/ARWeaveService.js +135 -140
- package/dist/services/ARWeaveService.js.map +1 -1
- package/dist/services/EAService.d.ts +18 -20
- package/dist/services/EAService.js +9 -30
- package/dist/services/EAService.js.map +1 -1
- package/dist/services/ReceivableService.d.ts +87 -89
- package/dist/services/ReceivableService.js +184 -189
- package/dist/services/ReceivableService.js.map +1 -1
- package/dist/services/SubgraphService.d.ts +53 -53
- package/dist/services/SubgraphService.js +97 -90
- package/dist/services/SubgraphService.js.map +1 -1
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.js +4 -4
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/utils/chain.d.ts +14 -15
- package/dist/utils/chain.js +28 -31
- package/dist/utils/chain.js.map +1 -1
- package/dist/utils/index.d.ts +3 -4
- package/dist/utils/index.js +3 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/poolInfo.d.ts +8 -8
- package/dist/utils/poolInfo.js +8 -8
- package/dist/utils/web3.d.ts +4 -4
- package/dist/utils/web3.js +23 -23
- package/getting-started.md +190 -190
- package/package.json +3 -3
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +0 -22
- package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +0 -20
- package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +0 -17
- package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +0 -1
- package/dist/cjs/utils/maticGasStation.d.ts +0 -3
- package/dist/cjs/utils/maticGasStation.js +0 -39
- package/dist/cjs/utils/maticGasStation.js.map +0 -1
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +0 -18
- package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
- package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
- package/dist/hooks/useBaseCreditPoolReceivableContract.js +0 -16
- package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
- package/dist/hooks/usePool.d.ts +0 -0
- package/dist/hooks/usePool.js +0 -2
- package/dist/hooks/usePool.js.map +0 -1
- package/dist/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
- package/dist/hooks/useReceivableFactoringPoolContract.js +0 -13
- package/dist/hooks/useReceivableFactoringPoolContract.js.map +0 -1
- package/dist/utils/maticGasStation.d.ts +0 -3
- package/dist/utils/maticGasStation.js +0 -33
- package/dist/utils/maticGasStation.js.map +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ERC20_TRANSFERABLE_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
-
import { getContract } from '../utils';
|
|
3
|
-
/**
|
|
4
|
-
* Returns an ethers contract instance for the ERC20TransferableReceivable contract
|
|
5
|
-
* associated with the given pool name on the current chain.
|
|
6
|
-
*
|
|
7
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
-
* @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
|
|
10
|
-
*/
|
|
11
|
-
export function getERC20TransferableReceivableContract(signerOrProvider, chainId) {
|
|
12
|
-
var _a;
|
|
13
|
-
const erc20TransferableReceiable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.ERC20TransferableReceivable];
|
|
14
|
-
if (!erc20TransferableReceiable)
|
|
15
|
-
return null;
|
|
16
|
-
return getContract(erc20TransferableReceiable, ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
|
|
17
|
-
}
|
|
1
|
+
import { ERC20_TRANSFERABLE_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
+
import { getContract } from '../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an ethers contract instance for the ERC20TransferableReceivable contract
|
|
5
|
+
* associated with the given pool name on the current chain.
|
|
6
|
+
*
|
|
7
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
+
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
+
* @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
|
|
10
|
+
*/
|
|
11
|
+
export function getERC20TransferableReceivableContract(signerOrProvider, chainId) {
|
|
12
|
+
var _a;
|
|
13
|
+
const erc20TransferableReceiable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.ERC20TransferableReceivable];
|
|
14
|
+
if (!erc20TransferableReceiable)
|
|
15
|
+
return null;
|
|
16
|
+
return getContract(erc20TransferableReceiable, ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=ERC20TransferableReceivableContractHelper.js.map
|
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
-
import { BigNumberish, Contract, Overrides, ethers } from 'ethers';
|
|
3
|
-
import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
|
|
4
|
-
import { TransactionResponse } from '@ethersproject/providers';
|
|
5
|
-
/**
|
|
6
|
-
* Returns an ethers contract instance for a Huma pool contract
|
|
7
|
-
*
|
|
8
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
9
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
10
|
-
* @param {POOL_NAME} poolName The name of the pool contract to get.
|
|
11
|
-
* @param {POOL_TYPE} poolType The type of the pool contract to get.
|
|
12
|
-
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
13
|
-
*/
|
|
14
|
-
export declare function getPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Contract | null;
|
|
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}
|
|
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}
|
|
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
|
+
import { BigNumber } from '@ethersproject/bignumber';
|
|
2
|
+
import { BigNumberish, Contract, Overrides, ethers } from 'ethers';
|
|
3
|
+
import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
|
|
4
|
+
import { TransactionResponse } from '@ethersproject/providers';
|
|
5
|
+
/**
|
|
6
|
+
* Returns an ethers contract instance for a Huma pool contract
|
|
7
|
+
*
|
|
8
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
9
|
+
* @param {number} chainId The chain id where the contract instance exists
|
|
10
|
+
* @param {POOL_NAME} poolName The name of the pool contract to get.
|
|
11
|
+
* @param {POOL_TYPE} poolType The type of the pool contract to get.
|
|
12
|
+
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Contract | null;
|
|
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,97 +1,95 @@
|
|
|
1
|
-
import { getContract, getPoolInfo
|
|
2
|
-
/**
|
|
3
|
-
* Returns an ethers contract instance for a Huma pool contract
|
|
4
|
-
*
|
|
5
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
6
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
7
|
-
* @param {POOL_NAME} poolName The name of the pool contract to get.
|
|
8
|
-
* @param {POOL_TYPE} poolType The type of the pool contract to get.
|
|
9
|
-
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
10
|
-
*/
|
|
11
|
-
export function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
|
|
12
|
-
const poolInfo = getPoolInfo(chainId, poolName, poolType);
|
|
13
|
-
if (!poolInfo)
|
|
14
|
-
return null;
|
|
15
|
-
return getContract(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
|
|
16
|
-
}
|
|
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}
|
|
64
|
-
* @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
|
|
65
|
-
*/
|
|
66
|
-
export
|
|
67
|
-
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
68
|
-
if (!poolContract) {
|
|
69
|
-
throw new Error('Could not find pool contract');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* @
|
|
79
|
-
* @
|
|
80
|
-
* @param {
|
|
81
|
-
* @param {
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
84
|
-
* @param {
|
|
85
|
-
* @
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
|
|
96
|
-
}
|
|
1
|
+
import { getContract, getPoolInfo } from '../utils';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an ethers contract instance for a Huma pool contract
|
|
4
|
+
*
|
|
5
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
6
|
+
* @param {number} chainId The chain id where the contract instance exists
|
|
7
|
+
* @param {POOL_NAME} poolName The name of the pool contract to get.
|
|
8
|
+
* @param {POOL_TYPE} poolType The type of the pool contract to get.
|
|
9
|
+
* @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
|
|
10
|
+
*/
|
|
11
|
+
export function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
|
|
12
|
+
const poolInfo = getPoolInfo(chainId, poolName, poolType);
|
|
13
|
+
if (!poolInfo)
|
|
14
|
+
return null;
|
|
15
|
+
return getContract(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
|
|
16
|
+
}
|
|
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 = {}) {
|
|
67
|
+
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
68
|
+
if (!poolContract) {
|
|
69
|
+
throw new Error('Could not find pool contract');
|
|
70
|
+
}
|
|
71
|
+
// TODO: Generate typechain for pool contract
|
|
72
|
+
return poolContract.drawdown(drawdownAmount, gasOpts);
|
|
73
|
+
}
|
|
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 = {}) {
|
|
88
|
+
const poolContract = getPoolContract(signer, chainId, poolName, poolType);
|
|
89
|
+
if (!poolContract) {
|
|
90
|
+
throw new Error('Could not find pool contract');
|
|
91
|
+
}
|
|
92
|
+
// TODO: Generate typechain for pool contract
|
|
93
|
+
return poolContract.makePayment(await signer.getAddress(), paymentAmount, gasOpts);
|
|
94
|
+
}
|
|
97
95
|
//# sourceMappingURL=PoolContractHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,
|
|
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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Contract, ethers } from 'ethers';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an ethers contract instance for the RealWorldReceivable contract
|
|
4
|
-
* associated with the given pool name on the current chain.
|
|
5
|
-
*
|
|
6
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
-
* @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
|
|
9
|
-
*/
|
|
10
|
-
export declare function getRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
1
|
+
import { Contract, ethers } from 'ethers';
|
|
2
|
+
/**
|
|
3
|
+
* Returns an ethers contract instance for the RealWorldReceivable contract
|
|
4
|
+
* associated with the given pool name on the current chain.
|
|
5
|
+
*
|
|
6
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
7
|
+
* @param {number} chainId The chain id where the contract instance exists
|
|
8
|
+
* @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { REAL_WORLD_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
-
import { getContract } from '../utils';
|
|
3
|
-
/**
|
|
4
|
-
* Returns an ethers contract instance for the RealWorldReceivable contract
|
|
5
|
-
* associated with the given pool name on the current chain.
|
|
6
|
-
*
|
|
7
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
-
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
-
* @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
|
|
10
|
-
*/
|
|
11
|
-
export function getRealWorldReceivableContract(signerOrProvider, chainId) {
|
|
12
|
-
var _a;
|
|
13
|
-
const realWorldReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.RealWorldReceivable];
|
|
14
|
-
if (!realWorldReceivable)
|
|
15
|
-
return null;
|
|
16
|
-
return getContract(realWorldReceivable, REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
|
|
17
|
-
}
|
|
1
|
+
import { REAL_WORLD_RECEIVABLE_ABI, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
2
|
+
import { getContract } from '../utils';
|
|
3
|
+
/**
|
|
4
|
+
* Returns an ethers contract instance for the RealWorldReceivable contract
|
|
5
|
+
* associated with the given pool name on the current chain.
|
|
6
|
+
*
|
|
7
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
|
|
8
|
+
* @param {number} chainId The chain id where the contract instance exists
|
|
9
|
+
* @returns {Contract | null} A contract instance for the RealWorldReceivable contract or null if it could not be found.
|
|
10
|
+
*/
|
|
11
|
+
export function getRealWorldReceivableContract(signerOrProvider, chainId) {
|
|
12
|
+
var _a;
|
|
13
|
+
const realWorldReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.RealWorldReceivable];
|
|
14
|
+
if (!realWorldReceivable)
|
|
15
|
+
return null;
|
|
16
|
+
return getContract(realWorldReceivable, REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=RealWorldReceivableContractHelper.js.map
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './RealWorldReceivableContractHelper';
|
|
2
|
-
export * from './ERC20TransferableReceivableContractHelper';
|
|
3
|
-
export * from './PoolContractHelper';
|
|
1
|
+
export * from './RealWorldReceivableContractHelper';
|
|
2
|
+
export * from './ERC20TransferableReceivableContractHelper';
|
|
3
|
+
export * from './PoolContractHelper';
|
package/dist/helpers/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './RealWorldReceivableContractHelper';
|
|
2
|
-
export * from './ERC20TransferableReceivableContractHelper';
|
|
3
|
-
export * from './PoolContractHelper';
|
|
1
|
+
export * from './RealWorldReceivableContractHelper';
|
|
2
|
+
export * from './ERC20TransferableReceivableContractHelper';
|
|
3
|
+
export * from './PoolContractHelper';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './useContract';
|
|
2
|
-
export * from './useRealWorldReceivableContract';
|
|
3
|
-
export * from './useERC20TransferableReceivableContract';
|
|
4
|
-
export * from './usePoolContract';
|
|
1
|
+
export * from './useContract';
|
|
2
|
+
export * from './useRealWorldReceivableContract';
|
|
3
|
+
export * from './useERC20TransferableReceivableContract';
|
|
4
|
+
export * from './usePoolContract';
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './useContract';
|
|
2
|
-
export * from './useRealWorldReceivableContract';
|
|
3
|
-
export * from './useERC20TransferableReceivableContract';
|
|
4
|
-
export * from './usePoolContract';
|
|
1
|
+
export * from './useContract';
|
|
2
|
+
export * from './useRealWorldReceivableContract';
|
|
3
|
+
export * from './useERC20TransferableReceivableContract';
|
|
4
|
+
export * from './usePoolContract';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Contract } from '@ethersproject/contracts';
|
|
2
|
-
import { ethers } from 'ethers';
|
|
3
|
-
/**
|
|
4
|
-
* Custom hook for creating an ethers instance of a smart contract.
|
|
5
|
-
*
|
|
6
|
-
* @template T - The type of the contract.
|
|
7
|
-
* @param {string | null | undefined} address - The address of the smart contract instance.
|
|
8
|
-
* @param {any} ABI - The ABI of the smart contract.
|
|
9
|
-
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
|
|
10
|
-
* Note that this signerOrProvider must be connected to the same network as the smart contract in question.
|
|
11
|
-
* @returns {T | null} An instance of the smart contract, or null if an error occurs.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useContract<T extends Contract = Contract>(address: string | null | undefined, ABI: any, signerOrProvider: ethers.providers.Provider | ethers.Signer): T | null;
|
|
1
|
+
import { Contract } from '@ethersproject/contracts';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
/**
|
|
4
|
+
* Custom hook for creating an ethers instance of a smart contract.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of the contract.
|
|
7
|
+
* @param {string | null | undefined} address - The address of the smart contract instance.
|
|
8
|
+
* @param {any} ABI - The ABI of the smart contract.
|
|
9
|
+
* @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
|
|
10
|
+
* Note that this signerOrProvider must be connected to the same network as the smart contract in question.
|
|
11
|
+
* @returns {T | null} An instance of the smart contract, or null if an error occurs.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useContract<T extends Contract = Contract>(address: string | null | undefined, ABI: any, signerOrProvider: ethers.providers.Provider | ethers.Signer): T | null;
|