@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.
Files changed (131) hide show
  1. package/API.md +482 -482
  2. package/LICENSE +660 -660
  3. package/README.md +34 -34
  4. package/dist/cjs/graphql/generatedTypes.d.ts +40 -40
  5. package/dist/cjs/graphql/generatedTypes.js +8 -8
  6. package/dist/cjs/graphql/index.d.ts +1 -1
  7. package/dist/cjs/graphql/index.js +4 -4
  8. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  9. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
  10. package/dist/cjs/helpers/PoolContractHelper.d.ts +104 -104
  11. package/dist/cjs/helpers/PoolContractHelper.js +102 -104
  12. package/dist/cjs/helpers/PoolContractHelper.js.map +1 -1
  13. package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  14. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
  15. package/dist/cjs/helpers/index.d.ts +3 -3
  16. package/dist/cjs/helpers/index.js +6 -6
  17. package/dist/cjs/hooks/index.d.ts +4 -4
  18. package/dist/cjs/hooks/index.js +7 -7
  19. package/dist/cjs/hooks/useContract.d.ts +13 -13
  20. package/dist/cjs/hooks/useContract.js +30 -30
  21. package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  22. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
  23. package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
  24. package/dist/cjs/hooks/usePoolContract.js +53 -53
  25. package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
  26. package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
  27. package/dist/cjs/index.d.ts +4 -4
  28. package/dist/cjs/index.js +7 -7
  29. package/dist/cjs/services/ARWeaveService.d.ts +81 -81
  30. package/dist/cjs/services/ARWeaveService.js +140 -145
  31. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  32. package/dist/cjs/services/EAService.d.ts +18 -20
  33. package/dist/cjs/services/EAService.js +12 -33
  34. package/dist/cjs/services/EAService.js.map +1 -1
  35. package/dist/cjs/services/ReceivableService.d.ts +87 -89
  36. package/dist/cjs/services/ReceivableService.js +188 -193
  37. package/dist/cjs/services/ReceivableService.js.map +1 -1
  38. package/dist/cjs/services/SubgraphService.d.ts +53 -53
  39. package/dist/cjs/services/SubgraphService.js +100 -93
  40. package/dist/cjs/services/SubgraphService.js.map +1 -1
  41. package/dist/cjs/services/index.d.ts +4 -4
  42. package/dist/cjs/services/index.js +7 -7
  43. package/dist/cjs/utils/chain.d.ts +14 -15
  44. package/dist/cjs/utils/chain.js +33 -37
  45. package/dist/cjs/utils/chain.js.map +1 -1
  46. package/dist/cjs/utils/index.d.ts +3 -4
  47. package/dist/cjs/utils/index.js +6 -7
  48. package/dist/cjs/utils/index.js.map +1 -1
  49. package/dist/cjs/utils/poolInfo.d.ts +8 -8
  50. package/dist/cjs/utils/poolInfo.js +12 -12
  51. package/dist/cjs/utils/web3.d.ts +4 -4
  52. package/dist/cjs/utils/web3.js +28 -28
  53. package/dist/graphql/generatedTypes.d.ts +40 -40
  54. package/dist/graphql/generatedTypes.js +4 -4
  55. package/dist/graphql/index.d.ts +1 -1
  56. package/dist/graphql/index.js +1 -1
  57. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  58. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
  59. package/dist/helpers/PoolContractHelper.d.ts +104 -104
  60. package/dist/helpers/PoolContractHelper.js +94 -96
  61. package/dist/helpers/PoolContractHelper.js.map +1 -1
  62. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  63. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  64. package/dist/helpers/index.d.ts +3 -3
  65. package/dist/helpers/index.js +3 -3
  66. package/dist/hooks/index.d.ts +4 -4
  67. package/dist/hooks/index.js +4 -4
  68. package/dist/hooks/useContract.d.ts +13 -13
  69. package/dist/hooks/useContract.js +26 -26
  70. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  71. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  72. package/dist/hooks/usePoolContract.d.ts +60 -60
  73. package/dist/hooks/usePoolContract.js +48 -48
  74. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  75. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  76. package/dist/index.d.ts +4 -4
  77. package/dist/index.js +4 -4
  78. package/dist/services/ARWeaveService.d.ts +81 -81
  79. package/dist/services/ARWeaveService.js +135 -140
  80. package/dist/services/ARWeaveService.js.map +1 -1
  81. package/dist/services/EAService.d.ts +18 -20
  82. package/dist/services/EAService.js +9 -30
  83. package/dist/services/EAService.js.map +1 -1
  84. package/dist/services/ReceivableService.d.ts +87 -89
  85. package/dist/services/ReceivableService.js +184 -189
  86. package/dist/services/ReceivableService.js.map +1 -1
  87. package/dist/services/SubgraphService.d.ts +53 -53
  88. package/dist/services/SubgraphService.js +97 -90
  89. package/dist/services/SubgraphService.js.map +1 -1
  90. package/dist/services/index.d.ts +4 -4
  91. package/dist/services/index.js +4 -4
  92. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  93. package/dist/utils/chain.d.ts +14 -15
  94. package/dist/utils/chain.js +28 -31
  95. package/dist/utils/chain.js.map +1 -1
  96. package/dist/utils/index.d.ts +3 -4
  97. package/dist/utils/index.js +3 -4
  98. package/dist/utils/index.js.map +1 -1
  99. package/dist/utils/poolInfo.d.ts +8 -8
  100. package/dist/utils/poolInfo.js +8 -8
  101. package/dist/utils/web3.d.ts +4 -4
  102. package/dist/utils/web3.js +23 -23
  103. package/getting-started.md +190 -190
  104. package/package.json +3 -3
  105. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
  106. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +0 -22
  107. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
  108. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
  109. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +0 -20
  110. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
  111. package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
  112. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +0 -17
  113. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +0 -1
  114. package/dist/cjs/utils/maticGasStation.d.ts +0 -3
  115. package/dist/cjs/utils/maticGasStation.js +0 -39
  116. package/dist/cjs/utils/maticGasStation.js.map +0 -1
  117. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +0 -10
  118. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +0 -18
  119. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +0 -1
  120. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +0 -10
  121. package/dist/hooks/useBaseCreditPoolReceivableContract.js +0 -16
  122. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +0 -1
  123. package/dist/hooks/usePool.d.ts +0 -0
  124. package/dist/hooks/usePool.js +0 -2
  125. package/dist/hooks/usePool.js.map +0 -1
  126. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +0 -10
  127. package/dist/hooks/useReceivableFactoringPoolContract.js +0 -13
  128. package/dist/hooks/useReceivableFactoringPoolContract.js.map +0 -1
  129. package/dist/utils/maticGasStation.d.ts +0 -3
  130. package/dist/utils/maticGasStation.js +0 -33
  131. package/dist/utils/maticGasStation.js.map +0 -1
@@ -1,54 +1,54 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useCreditRecordDetails = exports.usePoolContract = void 0;
4
- const react_1 = require("react");
5
- const useContract_1 = require("./useContract");
6
- const poolInfo_1 = require("../utils/poolInfo");
7
- /**
8
- * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
9
- *
10
- * @namespace usePoolContract
11
- * @template T - The type of the contract.
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
14
- * @param {POOL_NAME} poolName - The name of the pool.
15
- * @param {POOL_TYPE} poolType - The type of the pool.
16
- * @returns {T} A contract instance of the specific pool.
17
- */
18
- function usePoolContract(signerOrProvider, chainId, poolName, poolType) {
19
- const poolInfo = (0, poolInfo_1.getPoolInfo)(chainId, poolName, poolType);
20
- return (0, useContract_1.useContract)(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.pool, poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolAbi, signerOrProvider);
21
- }
22
- exports.usePoolContract = usePoolContract;
23
- /**
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.
25
- *
26
- * @memberof usePoolContract
27
- * @param {string} userAddress - The address of the user to get the credit record details for.
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
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.
32
- * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
33
- */
34
- function useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) {
35
- const poolContract = usePoolContract(signerOrProvider, chainId, poolName, poolType);
36
- const [creditRecordDetails, setCreditRecordDetails] = (0, react_1.useState)();
37
- const [refreshCount, setRefreshCount] = (0, react_1.useState)(0);
38
- (0, react_1.useEffect)(() => {
39
- const fetchData = async () => {
40
- if (poolContract && userAddress) {
41
- const creditRecordMapping = await poolContract.creditRecordMapping(userAddress);
42
- const creditRecordStaticMapping = await poolContract.creditRecordStaticMapping(userAddress);
43
- setCreditRecordDetails(Object.assign(Object.assign({}, creditRecordMapping), creditRecordStaticMapping));
44
- }
45
- };
46
- fetchData();
47
- }, [userAddress, poolContract, refreshCount]);
48
- const refresh = (0, react_1.useCallback)(() => {
49
- setRefreshCount((pre) => pre + 1);
50
- }, []);
51
- return [creditRecordDetails, refresh];
52
- }
53
- exports.useCreditRecordDetails = useCreditRecordDetails;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCreditRecordDetails = exports.usePoolContract = void 0;
4
+ const react_1 = require("react");
5
+ const useContract_1 = require("./useContract");
6
+ const poolInfo_1 = require("../utils/poolInfo");
7
+ /**
8
+ * A react hook that returns a contract instance of a specific pool using an ethers provider or signer
9
+ *
10
+ * @namespace usePoolContract
11
+ * @template T - The type of the contract.
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
14
+ * @param {POOL_NAME} poolName - The name of the pool.
15
+ * @param {POOL_TYPE} poolType - The type of the pool.
16
+ * @returns {T} A contract instance of the specific pool.
17
+ */
18
+ function usePoolContract(signerOrProvider, chainId, poolName, poolType) {
19
+ const poolInfo = (0, poolInfo_1.getPoolInfo)(chainId, poolName, poolType);
20
+ return (0, useContract_1.useContract)(poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.pool, poolInfo === null || poolInfo === void 0 ? void 0 : poolInfo.poolAbi, signerOrProvider);
21
+ }
22
+ exports.usePoolContract = usePoolContract;
23
+ /**
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.
25
+ *
26
+ * @memberof usePoolContract
27
+ * @param {string} userAddress - The address of the user to get the credit record details for.
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
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.
32
+ * @returns {Array<CreditRecordDetails | undefined, function():void>} An array containing the credit record details and a function to refresh the data.
33
+ */
34
+ function useCreditRecordDetails(userAddress, signerOrProvider, chainId, poolName, poolType) {
35
+ const poolContract = usePoolContract(signerOrProvider, chainId, poolName, poolType);
36
+ const [creditRecordDetails, setCreditRecordDetails] = (0, react_1.useState)();
37
+ const [refreshCount, setRefreshCount] = (0, react_1.useState)(0);
38
+ (0, react_1.useEffect)(() => {
39
+ const fetchData = async () => {
40
+ if (poolContract && userAddress) {
41
+ const creditRecordMapping = await poolContract.creditRecordMapping(userAddress);
42
+ const creditRecordStaticMapping = await poolContract.creditRecordStaticMapping(userAddress);
43
+ setCreditRecordDetails(Object.assign(Object.assign({}, creditRecordMapping), creditRecordStaticMapping));
44
+ }
45
+ };
46
+ fetchData();
47
+ }, [userAddress, poolContract, refreshCount]);
48
+ const refresh = (0, react_1.useCallback)(() => {
49
+ setRefreshCount((pre) => pre + 1);
50
+ }, []);
51
+ return [creditRecordDetails, refresh];
52
+ }
53
+ exports.useCreditRecordDetails = useCreditRecordDetails;
54
54
  //# sourceMappingURL=usePoolContract.js.map
@@ -1,10 +1,10 @@
1
- import { Contract, ethers } from 'ethers';
2
- /**
3
- * A react hook that 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 useRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
1
+ import { Contract, ethers } from 'ethers';
2
+ /**
3
+ * A react hook that 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 useRealWorldReceivableContract(signerOrProvider: ethers.providers.Provider | ethers.Signer, chainId: number): Contract | null;
@@ -1,20 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRealWorldReceivableContract = void 0;
4
- const shared_1 = require("@huma-finance/shared");
5
- const useContract_1 = require("./useContract");
6
- /**
7
- * A react hook that returns an ethers contract instance for the RealWorldReceivable 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 RealWorldReceivable contract or null if it could not be found.
13
- */
14
- function useRealWorldReceivableContract(signerOrProvider, chainId) {
15
- var _a;
16
- const realWorldReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.RealWorldReceivable];
17
- return (0, useContract_1.useContract)(realWorldReceivable, shared_1.REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
18
- }
19
- exports.useRealWorldReceivableContract = useRealWorldReceivableContract;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useRealWorldReceivableContract = void 0;
4
+ const shared_1 = require("@huma-finance/shared");
5
+ const useContract_1 = require("./useContract");
6
+ /**
7
+ * A react hook that returns an ethers contract instance for the RealWorldReceivable 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 RealWorldReceivable contract or null if it could not be found.
13
+ */
14
+ function useRealWorldReceivableContract(signerOrProvider, chainId) {
15
+ var _a;
16
+ const realWorldReceivable = (_a = shared_1.SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[shared_1.SupplementaryContracts.RealWorldReceivable];
17
+ return (0, useContract_1.useContract)(realWorldReceivable, shared_1.REAL_WORLD_RECEIVABLE_ABI, signerOrProvider);
18
+ }
19
+ exports.useRealWorldReceivableContract = useRealWorldReceivableContract;
20
20
  //# sourceMappingURL=useRealWorldReceivableContract.js.map
@@ -1,4 +1,4 @@
1
- export * from './helpers';
2
- export * from './hooks';
3
- export * from './services';
4
- export * from './utils';
1
+ export * from './helpers';
2
+ export * from './hooks';
3
+ export * from './services';
4
+ export * from './utils';
package/dist/cjs/index.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./helpers"), exports);
5
- tslib_1.__exportStar(require("./hooks"), exports);
6
- tslib_1.__exportStar(require("./services"), exports);
7
- tslib_1.__exportStar(require("./utils"), exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./helpers"), exports);
5
+ tslib_1.__exportStar(require("./hooks"), exports);
6
+ tslib_1.__exportStar(require("./services"), exports);
7
+ tslib_1.__exportStar(require("./utils"), exports);
8
8
  //# sourceMappingURL=index.js.map
@@ -1,81 +1,81 @@
1
- import { FundResponse, UploadResponse } from '@bundlr-network/client/build/common/types';
2
- import { Web3Provider } from '@ethersproject/providers';
3
- /**
4
- * The configuration for Bundlr network instances
5
- *
6
- * @typedef {Object} BundlrConfig
7
- * @memberof ArweaveService
8
- * @property {string} nodeUrl - The Bundlr node URL to use.
9
- * @property {string} currency - The currency to pay for uploads with.
10
- * Please see https://docs.bundlr.network/sdk/using-other-currencies for all the supported currencies
11
- * @property {string} [providerUrl] - The provider URL, required for devnets.
12
- */
13
- export type BundlrConfig = {
14
- nodeUrl: string;
15
- currency: string;
16
- providerUrl?: string;
17
- };
18
- /**
19
- * Get the configuration for Bundlr network given a chain ID
20
- *
21
- * @function
22
- * @memberof ArweaveService
23
- * @param {number} chainId - The chain ID.
24
- * @returns {BundlrConfig} - The configuration for the Bundlr network.
25
- */
26
- export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
27
- /**
28
- * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
29
- *
30
- * @async
31
- * @function
32
- * @memberof ArweaveService
33
- * @param {BundlrConfig} config - The configuration for the Bundlr network.
34
- * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
35
- * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
36
- * @returns {Promise<FundResponse>} - The fund response.
37
- */
38
- declare function prefundBundlr(config: BundlrConfig, signer: any, amount: number): Promise<FundResponse>;
39
- /**
40
- * Store data on ARWeave using the Bundlr Network.
41
- *
42
- * @async
43
- * @function
44
- * @memberof ArweaveService
45
- * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
46
- * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
47
- * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
48
- * environment, this should be a private key string.
49
- * @param {JSON} data - The data to store in the Bundlr instance.
50
- * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
51
- * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
52
- * Bundlr node should already be funded or else uploads will fail.
53
- * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
54
- */
55
- declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
56
- name: string;
57
- value: string;
58
- }[], lazyFund?: boolean): Promise<UploadResponse>;
59
- /**
60
- * Helper method to query the Arweave network for receivables metadata previously uploaded.
61
- *
62
- * @async
63
- * @function
64
- * @memberof ArweaveService
65
- * @param {number} chainId - The chain ID.
66
- * @param {string} sender - The sender tag to query.
67
- * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
68
- * @returns {Promise<any>} Promise resolving with the queried data.
69
- */
70
- declare function queryForMetadata(chainId: number, sender: string, referenceId: string): Promise<string | null>;
71
- /**
72
- * An object that contains functions to interact with Huma-related data stored on ARWeave
73
- * @namespace ARWeaveService
74
- */
75
- export declare const ARWeaveService: {
76
- queryForMetadata: typeof queryForMetadata;
77
- storeData: typeof storeData;
78
- prefundBundlr: typeof prefundBundlr;
79
- getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
80
- };
81
- export {};
1
+ import { FundResponse, UploadResponse } from '@bundlr-network/client/build/common/types';
2
+ import { Web3Provider } from '@ethersproject/providers';
3
+ /**
4
+ * The configuration for Bundlr network instances
5
+ *
6
+ * @typedef {Object} BundlrConfig
7
+ * @memberof ArweaveService
8
+ * @property {string} nodeUrl - The Bundlr node URL to use.
9
+ * @property {string} currency - The currency to pay for uploads with.
10
+ * Please see https://docs.bundlr.network/sdk/using-other-currencies for all the supported currencies
11
+ * @property {string} [providerUrl] - The provider URL, required for devnets.
12
+ */
13
+ export type BundlrConfig = {
14
+ nodeUrl: string;
15
+ currency: string;
16
+ providerUrl?: string;
17
+ };
18
+ /**
19
+ * Get the configuration for Bundlr network given a chain ID
20
+ *
21
+ * @function
22
+ * @memberof ArweaveService
23
+ * @param {number} chainId - The chain ID.
24
+ * @returns {BundlrConfig} - The configuration for the Bundlr network.
25
+ */
26
+ export declare function getBundlrNetworkConfig(chainId: number): BundlrConfig;
27
+ /**
28
+ * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
29
+ *
30
+ * @async
31
+ * @function
32
+ * @memberof ArweaveService
33
+ * @param {BundlrConfig} config - The configuration for the Bundlr network.
34
+ * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
35
+ * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
36
+ * @returns {Promise<FundResponse>} - The fund response.
37
+ */
38
+ declare function prefundBundlr(config: BundlrConfig, signer: any, amount: number): Promise<FundResponse>;
39
+ /**
40
+ * Store data on ARWeave using the Bundlr Network.
41
+ *
42
+ * @async
43
+ * @function
44
+ * @memberof ArweaveService
45
+ * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
46
+ * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
47
+ * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
48
+ * environment, this should be a private key string.
49
+ * @param {JSON} data - The data to store in the Bundlr instance.
50
+ * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
51
+ * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
52
+ * Bundlr node should already be funded or else uploads will fail.
53
+ * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
54
+ */
55
+ declare function storeData(config: BundlrConfig, signerOrPrivateKey: Web3Provider | string, data: JSON, tags: {
56
+ name: string;
57
+ value: string;
58
+ }[], lazyFund?: boolean): Promise<UploadResponse>;
59
+ /**
60
+ * Helper method to query the Arweave network for receivables metadata previously uploaded.
61
+ *
62
+ * @async
63
+ * @function
64
+ * @memberof ArweaveService
65
+ * @param {number} chainId - The chain ID.
66
+ * @param {string} sender - The sender tag to query.
67
+ * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
68
+ * @returns {Promise<any>} Promise resolving with the queried data.
69
+ */
70
+ declare function queryForMetadata(chainId: number, sender: string, referenceId: string): Promise<string | null>;
71
+ /**
72
+ * An object that contains functions to interact with Huma-related data stored on ARWeave
73
+ * @namespace ARWeaveService
74
+ */
75
+ export declare const ARWeaveService: {
76
+ queryForMetadata: typeof queryForMetadata;
77
+ storeData: typeof storeData;
78
+ prefundBundlr: typeof prefundBundlr;
79
+ getBundlrNetworkConfig: typeof getBundlrNetworkConfig;
80
+ };
81
+ export {};