@huma-finance/sdk 0.0.7 → 0.0.8

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.
Files changed (87) hide show
  1. package/README.md +23 -7
  2. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +2 -1
  3. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +5 -4
  4. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -1
  5. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -0
  6. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +22 -0
  7. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js.map +1 -0
  8. package/dist/cjs/helpers/PoolContractHelper.d.ts +12 -0
  9. package/dist/cjs/helpers/PoolContractHelper.js +21 -0
  10. package/dist/cjs/helpers/PoolContractHelper.js.map +1 -0
  11. package/dist/cjs/helpers/index.d.ts +2 -0
  12. package/dist/cjs/helpers/index.js +2 -0
  13. package/dist/cjs/helpers/index.js.map +1 -1
  14. package/dist/cjs/hooks/index.d.ts +0 -1
  15. package/dist/cjs/hooks/index.js +0 -1
  16. package/dist/cjs/hooks/index.js.map +1 -1
  17. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +2 -1
  18. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +5 -4
  19. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +1 -1
  20. package/dist/cjs/hooks/useContract.d.ts +6 -4
  21. package/dist/cjs/hooks/useContract.js +6 -4
  22. package/dist/cjs/hooks/useContract.js.map +1 -1
  23. package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +5 -5
  24. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +6 -9
  25. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js.map +1 -1
  26. package/dist/cjs/hooks/usePoolContract.d.ts +11 -4
  27. package/dist/cjs/hooks/usePoolContract.js +8 -3
  28. package/dist/cjs/hooks/usePoolContract.js.map +1 -1
  29. package/dist/cjs/services/ARWeaveService.d.ts +36 -14
  30. package/dist/cjs/services/ARWeaveService.js +33 -22
  31. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  32. package/dist/cjs/services/EAService.d.ts +25 -2
  33. package/dist/cjs/services/EAService.js +4 -2
  34. package/dist/cjs/services/EAService.js.map +1 -1
  35. package/dist/cjs/services/ReceivableService.d.ts +30 -11
  36. package/dist/cjs/services/ReceivableService.js +40 -24
  37. package/dist/cjs/services/ReceivableService.js.map +1 -1
  38. package/dist/cjs/services/SubgraphService.d.ts +18 -4
  39. package/dist/cjs/services/SubgraphService.js +34 -25
  40. package/dist/cjs/services/SubgraphService.js.map +1 -1
  41. package/dist/cjs/utils/poolInfo.d.ts +1 -1
  42. package/dist/cjs/utils/poolInfo.js +2 -2
  43. package/dist/cjs/utils/poolInfo.js.map +1 -1
  44. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +2 -1
  45. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +3 -2
  46. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -1
  47. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -0
  48. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +18 -0
  49. package/dist/helpers/ERC20TransferableReceivableContractHelper.js.map +1 -0
  50. package/dist/helpers/PoolContractHelper.d.ts +12 -0
  51. package/dist/helpers/PoolContractHelper.js +17 -0
  52. package/dist/helpers/PoolContractHelper.js.map +1 -0
  53. package/dist/helpers/index.d.ts +2 -0
  54. package/dist/helpers/index.js +2 -0
  55. package/dist/helpers/index.js.map +1 -1
  56. package/dist/hooks/index.d.ts +0 -1
  57. package/dist/hooks/index.js +0 -1
  58. package/dist/hooks/index.js.map +1 -1
  59. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +2 -1
  60. package/dist/hooks/useBaseCreditPoolReceivableContract.js +3 -2
  61. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -1
  62. package/dist/hooks/useContract.d.ts +6 -4
  63. package/dist/hooks/useContract.js +6 -4
  64. package/dist/hooks/useContract.js.map +1 -1
  65. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +5 -5
  66. package/dist/hooks/useERC20TransferableReceivableContract.js +5 -8
  67. package/dist/hooks/useERC20TransferableReceivableContract.js.map +1 -1
  68. package/dist/hooks/usePoolContract.d.ts +11 -4
  69. package/dist/hooks/usePoolContract.js +8 -3
  70. package/dist/hooks/usePoolContract.js.map +1 -1
  71. package/dist/services/ARWeaveService.d.ts +36 -14
  72. package/dist/services/ARWeaveService.js +33 -19
  73. package/dist/services/ARWeaveService.js.map +1 -1
  74. package/dist/services/EAService.d.ts +25 -2
  75. package/dist/services/EAService.js +3 -1
  76. package/dist/services/EAService.js.map +1 -1
  77. package/dist/services/ReceivableService.d.ts +30 -11
  78. package/dist/services/ReceivableService.js +36 -16
  79. package/dist/services/ReceivableService.js.map +1 -1
  80. package/dist/services/SubgraphService.d.ts +18 -4
  81. package/dist/services/SubgraphService.js +34 -22
  82. package/dist/services/SubgraphService.js.map +1 -1
  83. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  84. package/dist/utils/poolInfo.d.ts +1 -1
  85. package/dist/utils/poolInfo.js +1 -1
  86. package/dist/utils/poolInfo.js.map +1 -1
  87. package/package.json +3 -3
package/README.md CHANGED
@@ -1,15 +1,31 @@
1
1
  # Huma SDK
2
2
 
3
- This is a React SDK package providing helpful hooks, utilities, and API helpers to interact with the Huma protocol.
3
+ The Huma SDK includes utilities and services for interacting with different layers of our protocol including contracts, our evaluation agent underwriting service, and data storage hosted on ARWeave, Subgraph, on-chain, etc. It's currently offered just as a Javascript NPM package at https://www.npmjs.com/package/@huma-finance/sdk.
4
+
5
+ ## Getting Started
6
+
7
+ We recommend onboarding onto our SDK using the [Getting Started guide](docs/getting-started.md)
4
8
 
5
9
  ## Documentation
6
10
 
7
- For documentation on the different functions offered please refer to the [API](API.md)
11
+ For extensive documentation on the different functions offered please refer to the [API documentation](API.md)
12
+
13
+ ## Features
14
+
15
+ - Services
16
+ - `ARWeaveService` contains helper methods for storing data on ARWeave conforming to Huma data standards, querying for metadata, and prefunding ARWeave nodes to pay for data uploading.
17
+ - `EAService` contains helper methods to request credit approvals from Huma's Evaluation Agent layer.
18
+ - `ReceivableService` contains helper methods to manage minting and paying Receivable tokens
19
+ - `SubgraphService` contains helper methods for querying Huma's subgraphs
20
+ - Hooks
21
+ - React hooks for fetching ethers.js Contract instances of Huma contracts
22
+ - Helpers
23
+ - Helper functions for fetching ethers.js Contract instances of Huma contracts
8
24
 
9
- ## Example Usage
25
+ ## Examples
10
26
 
11
- To see how the Huma SDK can be used, feel free to use our interactive example in the `huma-widgets` package.
27
+ To see how the Huma SDK can be used, feel free to use our interactive example in the huma-widgets package.
12
28
 
13
- 1. Open up the `huma-widgets` package in your terminal
14
- 2. Run `yarn cosmos`
15
- 3. Open up `localhost:8000` in your browser and navigate to the `SDKTesting` fixture
29
+ 1. Open up the huma-widgets package in your terminal
30
+ 2. Run yarn cosmos
31
+ 3. Open up localhost:8000 in your browser and navigate to the SDKTesting fixture
@@ -3,7 +3,8 @@ import { Contract, ethers } from 'ethers';
3
3
  * Returns an ethers contract instance for the BaseCreditPoolReceivable contract
4
4
  * associated with the given pool name on the current chain.
5
5
  *
6
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
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
7
8
  * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
8
9
  */
9
10
  export declare function getBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -1,21 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBaseCreditPoolReceivableContract = void 0;
4
- const huma_shared_1 = require("@00labs/huma-shared");
4
+ const shared_1 = require("@huma-finance/shared");
5
5
  const utils_1 = require("../utils");
6
6
  /**
7
7
  * Returns an ethers contract instance for the BaseCreditPoolReceivable contract
8
8
  * associated with the given pool name on the current chain.
9
9
  *
10
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
10
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
+ * @param {number} chainId The chain id where the contract instance exists
11
12
  * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
12
13
  */
13
14
  function getBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
14
15
  var _a;
15
- const baseCreditPoolReceivable = (_a = huma_shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[huma_shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
16
+ const baseCreditPoolReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
16
17
  if (!baseCreditPoolReceivable)
17
18
  return null;
18
- return (0, utils_1.getContract)(baseCreditPoolReceivable, huma_shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
19
+ return (0, utils_1.getContract)(baseCreditPoolReceivable, shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
19
20
  }
20
21
  exports.getBaseCreditPoolReceivableContract = getBaseCreditPoolReceivableContract;
21
22
  //# sourceMappingURL=BaseCreditPoolReceivableContractHelper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseCreditPoolReceivableContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/BaseCreditPoolReceivableContractHelper.ts"],"names":[],"mappings":";;;AACA,qDAI4B;AAE5B,oCAAsC;AAEtC;;;;;;GAMG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,uCAAyB,CAAC,OAAO,CAAC,0CAChC,oCAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,IAAI,CAAC,wBAAwB;QAAE,OAAO,IAAI,CAAA;IAE1C,OAAO,IAAA,mBAAW,EAChB,wBAAwB,EACxB,6CAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAhBD,kFAgBC"}
1
+ {"version":3,"file":"BaseCreditPoolReceivableContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/BaseCreditPoolReceivableContractHelper.ts"],"names":[],"mappings":";;;AACA,iDAI6B;AAE7B,oCAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,kCAAyB,CAAC,OAAO,CAAC,0CAChC,+BAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,IAAI,CAAC,wBAAwB;QAAE,OAAO,IAAI,CAAA;IAE1C,OAAO,IAAA,mBAAW,EAChB,wBAAwB,EACxB,wCAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAhBD,kFAgBC"}
@@ -0,0 +1,10 @@
1
+ import { Contract, ethers } from 'ethers';
2
+ /**
3
+ * Returns an ethers contract instance for the BaseCreditPoolReceivable 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 BaseCreditPoolReceivable contract or null if it could not be found.
9
+ */
10
+ export declare function getERC20TransferableReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getERC20TransferableReceivableContract = void 0;
4
+ const shared_1 = require("@huma-finance/shared");
5
+ const utils_1 = require("../utils");
6
+ /**
7
+ * Returns an ethers contract instance for the BaseCreditPoolReceivable contract
8
+ * associated with the given pool name on the current chain.
9
+ *
10
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
+ * @param {number} chainId The chain id where the contract instance exists
12
+ * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
13
+ */
14
+ function getERC20TransferableReceivableContract(signerOrProvider, chainId) {
15
+ var _a;
16
+ const erc20TransferableReceiable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.ERC20TransferableReceivable];
17
+ if (!erc20TransferableReceiable)
18
+ return null;
19
+ return (0, utils_1.getContract)(erc20TransferableReceiable, shared_1.ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
20
+ }
21
+ exports.getERC20TransferableReceivableContract = getERC20TransferableReceivableContract;
22
+ //# sourceMappingURL=ERC20TransferableReceivableContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ERC20TransferableReceivableContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/ERC20TransferableReceivableContractHelper.ts"],"names":[],"mappings":";;;AACA,iDAI6B;AAE7B,oCAAsC;AAEtC;;;;;;;GAOG;AACH,SAAgB,sCAAsC,CACpD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,0BAA0B,GAC9B,MAAA,kCAAyB,CAAC,OAAO,CAAC,0CAChC,+BAAsB,CAAC,2BAA2B,CACnD,CAAA;IAEH,IAAI,CAAC,0BAA0B;QAAE,OAAO,IAAI,CAAA;IAE5C,OAAO,IAAA,mBAAW,EAChB,0BAA0B,EAC1B,0CAAiC,EACjC,gBAAgB,CACjB,CAAA;AACH,CAAC;AAhBD,wFAgBC"}
@@ -0,0 +1,12 @@
1
+ import { Contract, ethers } from 'ethers';
2
+ import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
3
+ /**
4
+ * Returns an ethers contract instance for a Huma pool contract
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
+ * @param {POOL_NAME} poolName The name of the pool contract to get.
9
+ * @param {POOL_TYPE} poolType The type of the pool contract to get.
10
+ * @returns {Contract | null} A contract instance for the Pool contract or null if it could not be found.
11
+ */
12
+ export declare function getPoolContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): Contract | null;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPoolContract = void 0;
4
+ const utils_1 = require("../utils");
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
+ function getPoolContract(signerOrProvider, chainId, poolName, poolType) {
15
+ const poolInfo = (0, utils_1.getPoolInfo)(chainId, poolName, poolType);
16
+ if (!poolInfo)
17
+ return null;
18
+ return (0, utils_1.getContract)(poolInfo.pool, poolInfo.poolAbi, signerOrProvider);
19
+ }
20
+ exports.getPoolContract = getPoolContract;
21
+ //# sourceMappingURL=PoolContractHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoolContractHelper.js","sourceRoot":"","sources":["../../../src/helpers/PoolContractHelper.ts"],"names":[],"mappings":";;;AAGA,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"}
@@ -1 +1,3 @@
1
1
  export * from './BaseCreditPoolReceivableContractHelper';
2
+ export * from './ERC20TransferableReceivableContractHelper';
3
+ export * from './PoolContractHelper';
@@ -2,4 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./BaseCreditPoolReceivableContractHelper"), exports);
5
+ tslib_1.__exportStar(require("./ERC20TransferableReceivableContractHelper"), exports);
6
+ tslib_1.__exportStar(require("./PoolContractHelper"), exports);
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,mFAAwD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/helpers/index.ts"],"names":[],"mappings":";;;AAAA,mFAAwD;AACxD,sFAA2D;AAC3D,+DAAoC"}
@@ -2,4 +2,3 @@ export * from './useContract';
2
2
  export * from './useBaseCreditPoolReceivableContract';
3
3
  export * from './useERC20TransferableReceivableContract';
4
4
  export * from './usePoolContract';
5
- export * from './useReceivableFactoringPoolContract';
@@ -5,5 +5,4 @@ tslib_1.__exportStar(require("./useContract"), exports);
5
5
  tslib_1.__exportStar(require("./useBaseCreditPoolReceivableContract"), exports);
6
6
  tslib_1.__exportStar(require("./useERC20TransferableReceivableContract"), exports);
7
7
  tslib_1.__exportStar(require("./usePoolContract"), exports);
8
- tslib_1.__exportStar(require("./useReceivableFactoringPoolContract"), exports);
9
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,gFAAqD;AACrD,mFAAwD;AACxD,4DAAiC;AACjC,+EAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":";;;AAAA,wDAA6B;AAC7B,gFAAqD;AACrD,mFAAwD;AACxD,4DAAiC"}
@@ -3,7 +3,8 @@ import { Contract, ethers } from 'ethers';
3
3
  * A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
4
4
  * associated with the given pool name on the current chain.
5
5
  *
6
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
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
7
8
  * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
8
9
  */
9
10
  export declare function useBaseCreditPoolReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useBaseCreditPoolReceivableContract = void 0;
4
- const huma_shared_1 = require("@00labs/huma-shared");
4
+ const shared_1 = require("@huma-finance/shared");
5
5
  const useContract_1 = require("./useContract");
6
6
  /**
7
7
  * A react hook that returns an ethers contract instance for the BaseCreditPoolReceivable contract
8
8
  * associated with the given pool name on the current chain.
9
9
  *
10
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
10
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
+ * @param {number} chainId The chain id where the contract instance exists
11
12
  * @returns {Contract | null} A contract instance for the BaseCreditPoolReceivable contract or null if it could not be found.
12
13
  */
13
14
  function useBaseCreditPoolReceivableContract(signerOrProvider, chainId) {
14
15
  var _a;
15
- const baseCreditPoolReceivable = (_a = huma_shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[huma_shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
16
- return (0, useContract_1.useContract)(baseCreditPoolReceivable, huma_shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
16
+ const baseCreditPoolReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.BaseCreditPoolReceivable];
17
+ return (0, useContract_1.useContract)(baseCreditPoolReceivable, shared_1.BASE_CREDIT_POOL_RECEIVABLE_ABI, signerOrProvider);
17
18
  }
18
19
  exports.useBaseCreditPoolReceivableContract = useBaseCreditPoolReceivableContract;
19
20
  //# sourceMappingURL=useBaseCreditPoolReceivableContract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBaseCreditPoolReceivableContract.js","sourceRoot":"","sources":["../../../src/hooks/useBaseCreditPoolReceivableContract.ts"],"names":[],"mappings":";;;AACA,qDAK4B;AAE5B,+CAA2C;AAE3C;;;;;;GAMG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,uCAAyB,CAAC,OAAO,CAAC,0CAChC,oCAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,OAAO,IAAA,yBAAW,EAChB,wBAAwB,EACxB,6CAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAdD,kFAcC"}
1
+ {"version":3,"file":"useBaseCreditPoolReceivableContract.js","sourceRoot":"","sources":["../../../src/hooks/useBaseCreditPoolReceivableContract.ts"],"names":[],"mappings":";;;AACA,iDAK6B;AAE7B,+CAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,mCAAmC,CACjD,gBAA2D,EAC3D,OAAe;;IAEf,MAAM,wBAAwB,GAC5B,MAAA,kCAAyB,CAAC,OAAO,CAAC,0CAChC,+BAAsB,CAAC,wBAAwB,CAChD,CAAA;IAEH,OAAO,IAAA,yBAAW,EAChB,wBAAwB,EACxB,wCAA+B,EAC/B,gBAAgB,CACjB,CAAA;AACH,CAAC;AAdD,kFAcC"}
@@ -2,10 +2,12 @@ import { Contract } from '@ethersproject/contracts';
2
2
  import { ethers } from 'ethers';
3
3
  /**
4
4
  * Custom hook for creating an ethers instance of a smart contract.
5
- * @param address - The address of the smart contract instance.
6
- * @param ABI - The ABI of the smart contract.
7
- * @param signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
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.
8
10
  * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
9
- * @returns An instance of the smart contract, or null if an error occurs.
11
+ * @returns {T | null} An instance of the smart contract, or null if an error occurs.
10
12
  */
11
13
  export declare function useContract<T extends Contract = Contract>(address: string | null | undefined, ABI: any, signerOrProvider: ethers.providers.Provider | ethers.Signer): T | null;
@@ -5,11 +5,13 @@ const react_1 = require("react");
5
5
  const web3_1 = require("../utils/web3");
6
6
  /**
7
7
  * Custom hook for creating an ethers instance of a smart contract.
8
- * @param address - The address of the smart contract instance.
9
- * @param ABI - The ABI of the smart contract.
10
- * @param signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
8
+ *
9
+ * @template T - The type of the contract.
10
+ * @param {string | null | undefined} address - The address of the smart contract instance.
11
+ * @param {any} ABI - The ABI of the smart contract.
12
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider used to sign transactions or retrieve blockchain data.
11
13
  * Note that this signerOrProvider must be connected to the same network as the smart contract in question.
12
- * @returns An instance of the smart contract, or null if an error occurs.
14
+ * @returns {T | null} An instance of the smart contract, or null if an error occurs.
13
15
  */
14
16
  function useContract(address,
15
17
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1 +1 @@
1
- {"version":3,"file":"useContract.js","sourceRoot":"","sources":["../../../src/hooks/useContract.ts"],"names":[],"mappings":";;;AACA,iCAA+B;AAG/B,wCAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,WAAW,CACzB,OAAkC;AAClC,8DAA8D;AAC9D,GAAQ,EACR,gBAA2D;IAE3D,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAA;QACtD,IAAI;YACF,OAAO,IAAA,kBAAW,EAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAA;SACnD;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,IAAI,CAAA;SACZ;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAM,CAAA;AAC3C,CAAC;AAdD,kCAcC"}
1
+ {"version":3,"file":"useContract.js","sourceRoot":"","sources":["../../../src/hooks/useContract.ts"],"names":[],"mappings":";;;AACA,iCAA+B;AAG/B,wCAA2C;AAE3C;;;;;;;;;GASG;AACH,SAAgB,WAAW,CACzB,OAAkC;AAClC,8DAA8D;AAC9D,GAAQ,EACR,gBAA2D;IAE3D,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAA;QACtD,IAAI;YACF,OAAO,IAAA,kBAAW,EAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAA;SACnD;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,IAAI,CAAA;SACZ;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAM,CAAA;AAC3C,CAAC;AAdD,kCAcC"}
@@ -1,12 +1,12 @@
1
- import { JsonRpcProvider, JsonRpcSigner } from '@ethersproject/providers';
2
- import { Contract } from 'ethers';
3
- import { POOL_NAME } from '@00labs/huma-shared';
1
+ import { Contract, ethers } from 'ethers';
2
+ import { POOL_NAME } from '@huma-finance/shared';
4
3
  /**
5
4
  * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
6
5
  * associated with the given pool name on the current chain.
7
6
  *
8
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
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
9
  * @param {POOL_NAME} poolName The name of the pool to get the contract for.
10
10
  * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
11
11
  */
12
- export declare function useERC20TransferableReceivableContract(signerOrProvider: JsonRpcProvider | JsonRpcSigner, poolName: POOL_NAME): Contract | null;
12
+ export declare function useERC20TransferableReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME): Contract | null;
@@ -1,24 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useERC20TransferableReceivableContract = void 0;
4
- const huma_shared_1 = require("@00labs/huma-shared");
4
+ const shared_1 = require("@huma-finance/shared");
5
5
  const useContract_1 = require("./useContract");
6
- const chain_1 = require("../utils/chain");
7
6
  /**
8
7
  * A react hook that returns an ethers contract instance for the ERC20TransferableReceivable contract
9
8
  * associated with the given pool name on the current chain.
10
9
  *
11
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider The provider or signer instance to use for the contract.
10
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider The provider or signer instance to use for the contract.
11
+ * @param {number} chainId The chain id where the contract instance exists
12
12
  * @param {POOL_NAME} poolName The name of the pool to get the contract for.
13
13
  * @returns {Contract | null} A contract instance for the ERC20TransferableReceivable contract or null if it could not be found.
14
14
  */
15
- function useERC20TransferableReceivableContract(signerOrProvider, poolName) {
15
+ function useERC20TransferableReceivableContract(signerOrProvider, chainId, poolName) {
16
16
  var _a, _b, _c;
17
- const chainId = (0, chain_1.getChainIdFromJsonSignerOrProvider)(signerOrProvider);
18
- const TransferableReceivableAddress = chainId
19
- ? (_c = (_b = (_a = huma_shared_1.PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[huma_shared_1.POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress
20
- : null;
21
- return (0, useContract_1.useContract)(TransferableReceivableAddress, huma_shared_1.ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
17
+ const TransferableReceivableAddress = (_c = (_b = (_a = shared_1.PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.POOL_TYPE.Invoice]) === null || _b === void 0 ? void 0 : _b[poolName]) === null || _c === void 0 ? void 0 : _c.assetAddress;
18
+ return (0, useContract_1.useContract)(TransferableReceivableAddress, shared_1.ERC20_TRANSFERABLE_RECEIVABLE_ABI, signerOrProvider);
22
19
  }
23
20
  exports.useERC20TransferableReceivableContract = useERC20TransferableReceivableContract;
24
21
  //# sourceMappingURL=useERC20TransferableReceivableContract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useERC20TransferableReceivableContract.js","sourceRoot":"","sources":["../../../src/hooks/useERC20TransferableReceivableContract.ts"],"names":[],"mappings":";;;AAEA,qDAM4B;AAE5B,+CAA2C;AAC3C,0CAAmE;AAEnE;;;;;;;GAOG;AACH,SAAgB,sCAAsC,CACpD,gBAAiD,EACjD,QAAmB;;IAEnB,MAAM,OAAO,GAAG,IAAA,0CAAkC,EAAC,gBAAgB,CAAC,CAAA;IAEpE,MAAM,6BAA6B,GAAG,OAAO;QAC3C,CAAC,CAAC,MAAA,MAAA,MAAA,6BAAe,CAAC,OAAO,CAAC,0CAAG,uBAAS,CAAC,OAAO,CAAC,0CAAG,QAAQ,CAAC,0CAAE,YAAY;QACzE,CAAC,CAAC,IAAI,CAAA;IAER,OAAO,IAAA,yBAAW,EAChB,6BAA6B,EAC7B,+CAAiC,EACjC,gBAAgB,CACjB,CAAA;AACH,CAAC;AAfD,wFAeC"}
1
+ {"version":3,"file":"useERC20TransferableReceivableContract.js","sourceRoot":"","sources":["../../../src/hooks/useERC20TransferableReceivableContract.ts"],"names":[],"mappings":";;;AACA,iDAM6B;AAE7B,+CAA2C;AAE3C;;;;;;;;GAQG;AACH,SAAgB,sCAAsC,CACpD,gBAA2D,EAC3D,OAAe,EACf,QAAmB;;IAEnB,MAAM,6BAA6B,GACjC,MAAA,MAAA,MAAA,wBAAe,CAAC,OAAO,CAAC,0CAAG,kBAAS,CAAC,OAAO,CAAC,0CAAG,QAAQ,CAAC,0CAAE,YAAY,CAAA;IAEzE,OAAO,IAAA,yBAAW,EAChB,6BAA6B,EAC7B,0CAAiC,EACjC,gBAAgB,CACjB,CAAA;AACH,CAAC;AAbD,wFAaC"}
@@ -1,11 +1,13 @@
1
1
  import { BigNumber } from '@ethersproject/bignumber';
2
2
  import { Contract, ethers } from 'ethers';
3
- import { POOL_NAME, POOL_TYPE } from '@00labs/huma-shared';
3
+ import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
4
  /**
5
- * A react hook that returns a contract instance of a specific pool using an ethers JsonRpcProvider or JsonRpcSigner.
5
+ * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
6
6
  *
7
+ * @namespace usePoolContract
7
8
  * @template T - The type of the contract.
8
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - A JsonRpcProvider or JsonRpcSigner instance.
9
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
10
+ * @param {number} chainId The chain id where the contract instance exists
9
11
  * @param {POOL_NAME} poolName - The name of the pool.
10
12
  * @param {POOL_TYPE} poolType - The type of the pool.
11
13
  * @returns {T} A contract instance of the specific pool.
@@ -13,6 +15,8 @@ import { POOL_NAME, POOL_TYPE } from '@00labs/huma-shared';
13
15
  export declare function usePoolContract<T extends Contract>(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): T | null;
14
16
  /**
15
17
  * CreditRecordDetails type object representing the details of a credit line.
18
+ *
19
+ * @memberof usePoolContract
16
20
  * @typedef {Object} CreditRecordDetails
17
21
  * @property {number} aprInBps - The APR (annual percentage rate) in basis points.
18
22
  * @property {BigNumber} correction - adjustment of interest over or under-counted because of drawdown
@@ -45,9 +49,12 @@ export type CreditRecordDetails = {
45
49
  /**
46
50
  * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
47
51
  *
52
+ * @namespace usePoolContract
48
53
  * @param {string} userAddress - The address of the user to get the credit record details for.
49
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
54
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
55
+ * @param {number} chainId The chain id where the contract instance exists
50
56
  * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
57
+ * @param {POOL_TYPE} poolType - The type of the pool.
51
58
  * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
52
59
  */
53
60
  export declare function useCreditRecordDetails(userAddress: string, signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE): [CreditRecordDetails | undefined, () => void];
@@ -5,10 +5,12 @@ const react_1 = require("react");
5
5
  const useContract_1 = require("./useContract");
6
6
  const poolInfo_1 = require("../utils/poolInfo");
7
7
  /**
8
- * A react hook that returns a contract instance of a specific pool using an ethers JsonRpcProvider or JsonRpcSigner.
8
+ * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
9
9
  *
10
+ * @namespace usePoolContract
10
11
  * @template T - The type of the contract.
11
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - A JsonRpcProvider or JsonRpcSigner instance.
12
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - An ethers signer or provider instance.
13
+ * @param {number} chainId The chain id where the contract instance exists
12
14
  * @param {POOL_NAME} poolName - The name of the pool.
13
15
  * @param {POOL_TYPE} poolType - The type of the pool.
14
16
  * @returns {T} A contract instance of the specific pool.
@@ -21,9 +23,12 @@ exports.usePoolContract = usePoolContract;
21
23
  /**
22
24
  * A react hook that returns the credit record details for a user in a given pool, as well as a function to refresh the data.
23
25
  *
26
+ * @namespace usePoolContract
24
27
  * @param {string} userAddress - The address of the user to get the credit record details for.
25
- * @param {JsonRpcProvider | JsonRpcSigner} signerOrProvider - The signer or provider object to use for the contract.
28
+ * @param {ethers.providers.Provider | ethers.Signer} signerOrProvider - The signer or provider object to use for the contract.
29
+ * @param {number} chainId The chain id where the contract instance exists
26
30
  * @param {POOL_NAME} poolName - The name of the pool to get the credit record details for.
31
+ * @param {POOL_TYPE} poolType - The type of the pool.
27
32
  * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
28
33
  */
29
34
  function useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) {
@@ -1 +1 @@
1
- {"version":3,"file":"usePoolContract.js","sourceRoot":"","sources":["../../../src/hooks/usePoolContract.ts"],"names":[],"mappings":";;;AAEA,iCAAwD;AAGxD,+CAA2C;AAC3C,gDAA+C;AAE/C;;;;;;;;GAQG;AACH,SAAgB,eAAe,CAC7B,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAA,sBAAW,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACzD,OAAO,IAAA,yBAAW,EAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;AAC5E,CAAC;AARD,0CAQC;AAkCD;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACpC,WAAmB,EACnB,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,eAAe,CAClC,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IACD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,IAAA,gBAAQ,GAAuB,CAAA;IACjC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAA;IAEnD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;YAC3B,IAAI,YAAY,IAAI,WAAW,EAAE;gBAC/B,MAAM,mBAAmB,GAAG,MAAM,YAAY,CAAC,mBAAmB,CAChE,WAAW,CACZ,CAAA;gBACD,MAAM,yBAAyB,GAC7B,MAAM,YAAY,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAA;gBAC3D,sBAAsB,iCACjB,mBAAmB,GACnB,yBAAyB,EAC5B,CAAA;aACH;QACH,CAAC,CAAA;QACD,SAAS,EAAE,CAAA;IACb,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/B,eAAe,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;IACnC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC;AAvCD,wDAuCC"}
1
+ {"version":3,"file":"usePoolContract.js","sourceRoot":"","sources":["../../../src/hooks/usePoolContract.ts"],"names":[],"mappings":";;;AAEA,iCAAwD;AAGxD,+CAA2C;AAC3C,gDAA+C;AAE/C;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAC7B,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAA,sBAAW,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACzD,OAAO,IAAA,yBAAW,EAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,OAAO,EAAE,gBAAgB,CAAC,CAAA;AAC5E,CAAC;AARD,0CAQC;AAoCD;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB,CACpC,WAAmB,EACnB,gBAA2D,EAC3D,OAAe,EACf,QAAmB,EACnB,QAAmB;IAEnB,MAAM,YAAY,GAAG,eAAe,CAClC,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,CACT,CAAA;IACD,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GACjD,IAAA,gBAAQ,GAAuB,CAAA;IACjC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAA;IAEnD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,KAAK,IAAI,EAAE;YAC3B,IAAI,YAAY,IAAI,WAAW,EAAE;gBAC/B,MAAM,mBAAmB,GAAG,MAAM,YAAY,CAAC,mBAAmB,CAChE,WAAW,CACZ,CAAA;gBACD,MAAM,yBAAyB,GAC7B,MAAM,YAAY,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAA;gBAC3D,sBAAsB,iCACjB,mBAAmB,GACnB,yBAAyB,EAC5B,CAAA;aACH;QACH,CAAC,CAAA;QACD,SAAS,EAAE,CAAA;IACb,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAC/B,eAAe,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAA;IACnC,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAA;AACvC,CAAC;AAvCD,wDAuCC"}
@@ -1,8 +1,15 @@
1
1
  import { FundResponse, UploadResponse } from '@bundlr-network/client/build/common/types';
2
2
  import { Web3Provider } from '@ethersproject/providers';
3
- import { POOL_NAME, POOL_TYPE } from '@00labs/huma-shared';
3
+ import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
4
  /**
5
5
  * The configuration for Bundlr network instances
6
+ *
7
+ * @typedef {Object} BundlrConfig
8
+ * @memberof ArweaveService
9
+ * @property {string} nodeUrl - The Bundlr node URL to use.
10
+ * @property {string} currency - The currency to pay for uploads with.
11
+ * Please see https://docs.bundlr.network/sdk/using-other-currencies for all the supported currencies
12
+ * @property {string} [providerUrl] - The provider URL, required for devnets.
6
13
  */
7
14
  export type BundlrConfig = {
8
15
  nodeUrl: string;
@@ -10,53 +17,68 @@ export type BundlrConfig = {
10
17
  providerUrl?: string;
11
18
  };
12
19
  /**
13
- * Get the configuration for Bundlr network given a chain ID.
20
+ * Get the configuration for Bundlr network given a chain ID
14
21
  *
15
22
  * @function
23
+ * @memberof ArweaveService
16
24
  * @param {number} chainId - The chain ID.
17
25
  * @returns {BundlrConfig} - The configuration for the Bundlr network.
18
- * nodeUrl - The node URL of the Bundlr network to use.
19
- * currency - The currency to pay for uploads with, if lazy funding.
20
- * providerUrl - The provider URL, required for devnets.
21
26
  */
22
27
  export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
23
28
  /**
24
- * Prefund the Bundlr network with the specified amount. Useful if not lazy funding.
29
+ * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
25
30
  *
26
31
  * @async
27
32
  * @function
33
+ * @memberof ArweaveService
28
34
  * @param {BundlrConfig} config - The configuration for the Bundlr network.
29
- * @param {any} wallet - The wallet to send funds from
30
- * @param {number} amount - The amount to fund.
35
+ * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
36
+ * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
31
37
  * @returns {Promise<FundResponse>} - The fund response.
32
38
  */
33
- export declare function prefundBundlr(config: BundlrConfig, wallet: any, amount: number): Promise<FundResponse>;
39
+ declare function prefundBundlr(config: BundlrConfig, signer: any, amount: number): Promise<FundResponse>;
34
40
  /**
35
41
  * Store data on ARWeave using the Bundlr Network.
42
+ *
36
43
  * @async
37
44
  * @function
45
+ * @memberof ArweaveService
38
46
  * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
39
- * @param {Web3Provider | ethers.Signer} wallet - Wallet object used for interacting with the Bundlr instance.
47
+ * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
40
48
  * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
41
- * environment, this should be an `ethers.Signer` instance.
49
+ * environment, this should be a private key string.
42
50
  * @param {JSON} data - The data to store in the Bundlr instance.
43
51
  * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
44
52
  * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
45
53
  * Bundlr node should already be funded or else uploads will fail.
46
54
  * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
47
55
  */
48
- export declare function storeData(config: BundlrConfig, wallet: Web3Provider | string, data: JSON, tags: {
56
+ declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
49
57
  name: string;
50
58
  value: string;
51
59
  }[], lazyFund?: boolean): Promise<UploadResponse>;
52
60
  /**
53
61
  * Helper method to query the Arweave network for receivables metadata previously uploaded.
62
+ *
54
63
  * @async
55
64
  * @function
65
+ * @memberof ArweaveService
66
+ * @param {number} chainId - The chain ID.
56
67
  * @param {POOL_NAME} poolName - The pool name tag to query.
57
68
  * @param {POOL_TYPE} poolType - The pool type tag to query.
58
69
  * @param {string} sender - The sender tag to query.
59
- * @param {string} internalID - The internal ID tag to query, whatever was used when uploading the metadata.
70
+ * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
60
71
  * @returns {Promise<any>} Promise resolving with the queried data.
61
72
  */
62
- export declare function queryForMetadata(chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, sender: string, internalId: string): Promise<string | null>;
73
+ declare function queryForMetadata(chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, sender: string, referenceId: string): Promise<string | null>;
74
+ /**
75
+ * An object that contains functions to interact with Huma-related data stored on ARWeave
76
+ * @namespace ARWeaveService
77
+ */
78
+ export declare const ARWeaveService: {
79
+ queryForMetadata: typeof queryForMetadata;
80
+ storeData: typeof storeData;
81
+ prefundBundlr: typeof prefundBundlr;
82
+ getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
83
+ };
84
+ export {};