@huma-finance/sdk 0.0.28 → 0.0.30

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 (121) hide show
  1. package/API.md +608 -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/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  9. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js +22 -0
  10. package/dist/cjs/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  11. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  12. package/dist/cjs/helpers/ERC20TransferableReceivableContractHelper.js +21 -21
  13. package/dist/cjs/helpers/PoolContractHelper.d.ts +119 -104
  14. package/dist/cjs/helpers/PoolContractHelper.js +142 -104
  15. package/dist/cjs/helpers/PoolContractHelper.js.map +1 -1
  16. package/dist/cjs/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  17. package/dist/cjs/helpers/RealWorldReceivableContractHelper.js +21 -21
  18. package/dist/cjs/helpers/index.d.ts +3 -3
  19. package/dist/cjs/helpers/index.js +6 -6
  20. package/dist/cjs/hooks/index.d.ts +4 -4
  21. package/dist/cjs/hooks/index.js +7 -7
  22. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  23. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js +20 -0
  24. package/dist/cjs/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  25. package/dist/cjs/hooks/useContract.d.ts +13 -13
  26. package/dist/cjs/hooks/useContract.js +30 -30
  27. package/dist/cjs/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  28. package/dist/cjs/hooks/useERC20TransferableReceivableContract.js +20 -20
  29. package/dist/cjs/hooks/usePoolContract.d.ts +60 -60
  30. package/dist/cjs/hooks/usePoolContract.js +53 -53
  31. package/dist/cjs/hooks/useRealWorldReceivableContract.d.ts +10 -10
  32. package/dist/cjs/hooks/useRealWorldReceivableContract.js +19 -19
  33. package/dist/cjs/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  34. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js +17 -0
  35. package/dist/cjs/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  36. package/dist/cjs/index.d.ts +4 -4
  37. package/dist/cjs/index.js +7 -7
  38. package/dist/cjs/services/ARWeaveService.d.ts +95 -81
  39. package/dist/cjs/services/ARWeaveService.js +169 -145
  40. package/dist/cjs/services/ARWeaveService.js.map +1 -1
  41. package/dist/cjs/services/EAService.d.ts +20 -20
  42. package/dist/cjs/services/EAService.js +33 -33
  43. package/dist/cjs/services/ReceivableService.d.ts +89 -89
  44. package/dist/cjs/services/ReceivableService.js +193 -193
  45. package/dist/cjs/services/SubgraphService.d.ts +53 -53
  46. package/dist/cjs/services/SubgraphService.js +93 -93
  47. package/dist/cjs/services/index.d.ts +4 -4
  48. package/dist/cjs/services/index.js +7 -7
  49. package/dist/cjs/utils/chain.d.ts +15 -15
  50. package/dist/cjs/utils/chain.js +37 -37
  51. package/dist/cjs/utils/index.d.ts +4 -4
  52. package/dist/cjs/utils/index.js +7 -7
  53. package/dist/cjs/utils/maticGasStation.d.ts +3 -3
  54. package/dist/cjs/utils/maticGasStation.js +38 -38
  55. package/dist/cjs/utils/poolInfo.d.ts +8 -8
  56. package/dist/cjs/utils/poolInfo.js +12 -12
  57. package/dist/cjs/utils/web3.d.ts +5 -4
  58. package/dist/cjs/utils/web3.js +33 -28
  59. package/dist/cjs/utils/web3.js.map +1 -1
  60. package/dist/graphql/generatedTypes.d.ts +40 -40
  61. package/dist/graphql/generatedTypes.js +4 -4
  62. package/dist/graphql/index.d.ts +1 -1
  63. package/dist/graphql/index.js +1 -1
  64. package/dist/helpers/BaseCreditPoolReceivableContractHelper.d.ts +10 -0
  65. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js +18 -0
  66. package/dist/helpers/BaseCreditPoolReceivableContractHelper.js.map +1 -0
  67. package/dist/helpers/ERC20TransferableReceivableContractHelper.d.ts +10 -10
  68. package/dist/helpers/ERC20TransferableReceivableContractHelper.js +17 -17
  69. package/dist/helpers/PoolContractHelper.d.ts +119 -104
  70. package/dist/helpers/PoolContractHelper.js +133 -96
  71. package/dist/helpers/PoolContractHelper.js.map +1 -1
  72. package/dist/helpers/RealWorldReceivableContractHelper.d.ts +10 -10
  73. package/dist/helpers/RealWorldReceivableContractHelper.js +17 -17
  74. package/dist/helpers/index.d.ts +3 -3
  75. package/dist/helpers/index.js +3 -3
  76. package/dist/hooks/index.d.ts +4 -4
  77. package/dist/hooks/index.js +4 -4
  78. package/dist/hooks/useBaseCreditPoolReceivableContract.d.ts +10 -0
  79. package/dist/hooks/useBaseCreditPoolReceivableContract.js +16 -0
  80. package/dist/hooks/useBaseCreditPoolReceivableContract.js.map +1 -0
  81. package/dist/hooks/useContract.d.ts +13 -13
  82. package/dist/hooks/useContract.js +26 -26
  83. package/dist/hooks/useERC20TransferableReceivableContract.d.ts +12 -12
  84. package/dist/hooks/useERC20TransferableReceivableContract.js +16 -16
  85. package/dist/hooks/usePool.d.ts +0 -0
  86. package/dist/hooks/usePool.js +2 -0
  87. package/dist/hooks/usePool.js.map +1 -0
  88. package/dist/hooks/usePoolContract.d.ts +60 -60
  89. package/dist/hooks/usePoolContract.js +48 -48
  90. package/dist/hooks/useRealWorldReceivableContract.d.ts +10 -10
  91. package/dist/hooks/useRealWorldReceivableContract.js +15 -15
  92. package/dist/hooks/useReceivableFactoringPoolContract.d.ts +10 -0
  93. package/dist/hooks/useReceivableFactoringPoolContract.js +13 -0
  94. package/dist/hooks/useReceivableFactoringPoolContract.js.map +1 -0
  95. package/dist/index.d.ts +4 -4
  96. package/dist/index.js +4 -4
  97. package/dist/services/ARWeaveService.d.ts +95 -81
  98. package/dist/services/ARWeaveService.js +164 -140
  99. package/dist/services/ARWeaveService.js.map +1 -1
  100. package/dist/services/EAService.d.ts +20 -20
  101. package/dist/services/EAService.js +30 -30
  102. package/dist/services/ReceivableService.d.ts +89 -89
  103. package/dist/services/ReceivableService.js +189 -189
  104. package/dist/services/SubgraphService.d.ts +53 -53
  105. package/dist/services/SubgraphService.js +90 -90
  106. package/dist/services/index.d.ts +4 -4
  107. package/dist/services/index.js +4 -4
  108. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  109. package/dist/utils/chain.d.ts +15 -15
  110. package/dist/utils/chain.js +31 -31
  111. package/dist/utils/index.d.ts +4 -4
  112. package/dist/utils/index.js +4 -4
  113. package/dist/utils/maticGasStation.d.ts +3 -3
  114. package/dist/utils/maticGasStation.js +33 -33
  115. package/dist/utils/poolInfo.d.ts +8 -8
  116. package/dist/utils/poolInfo.js +8 -8
  117. package/dist/utils/web3.d.ts +5 -4
  118. package/dist/utils/web3.js +27 -23
  119. package/dist/utils/web3.js.map +1 -1
  120. package/getting-started.md +190 -190
  121. package/package.json +6 -4
@@ -1,146 +1,170 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ARWeaveService = exports.getBundlrNetworkConfig = void 0;
4
- const tslib_1 = require("tslib");
5
- const client_1 = tslib_1.__importDefault(require("@bundlr-network/client"));
6
- const graphql_request_1 = tslib_1.__importStar(require("graphql-request"));
7
- /**
8
- * Get the configuration for Bundlr network given a chain ID
9
- *
10
- * @function
11
- * @memberof ArweaveService
12
- * @param {number} chainId - The chain ID.
13
- * @returns {BundlrConfig} - The configuration for the Bundlr network.
14
- */
15
- function getBundlrNetworkConfig(chainId) {
16
- switch (chainId) {
17
- case 5: // Goerli
18
- return {
19
- nodeUrl: 'https://devnet.bundlr.network',
20
- currency: 'ethereum',
21
- providerUrl: 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
22
- };
23
- case 80001: // Mumbai
24
- return {
25
- nodeUrl: 'https://devnet.bundlr.network',
26
- currency: 'matic',
27
- providerUrl: 'https://rpc-mumbai.matic.today',
28
- };
29
- case 137: // Matic
30
- return {
31
- nodeUrl: 'https://node1.bundlr.network',
32
- currency: 'matic',
33
- };
34
- default:
35
- return {
36
- nodeUrl: '',
37
- currency: '',
38
- };
39
- }
40
- }
41
- exports.getBundlrNetworkConfig = getBundlrNetworkConfig;
42
- /**
43
- * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
44
- *
45
- * @async
46
- * @function
47
- * @memberof ArweaveService
48
- * @param {BundlrConfig} config - The configuration for the Bundlr network.
49
- * @param {any} signer - The wallet to send funds from. This can be either a web3 signer or a private key string.
50
- * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config.
51
- * @returns {Promise<FundResponse>} - The fund response.
52
- */
53
- async function prefundBundlr(config,
54
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
- signer, amount) {
56
- const bundlr = new client_1.default(config.nodeUrl, config.currency, signer, config.providerUrl
57
- ? {
58
- providerUrl: config.providerUrl,
59
- }
60
- : undefined);
61
- await bundlr.ready();
62
- return bundlr.fund(amount);
63
- }
64
- /**
65
- * Store data on ARWeave using the Bundlr Network.
66
- *
67
- * @async
68
- * @function
69
- * @memberof ArweaveService
70
- * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
71
- * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
72
- * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
73
- * environment, this should be a private key string.
74
- * @param {JSON} data - The data to store in the Bundlr instance.
75
- * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
76
- * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
77
- * Bundlr node should already be funded or else uploads will fail.
78
- * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
79
- */
80
- async function storeData(config, signerOrPrivateKey, data, tags, lazyFund = true) {
81
- const bundlr = new client_1.default(config.nodeUrl, config.currency, signerOrPrivateKey, config.providerUrl
82
- ? {
83
- providerUrl: config.providerUrl,
84
- }
85
- : undefined);
86
- await bundlr.ready();
87
- const dataStr = JSON.stringify(data);
88
- if (lazyFund) {
89
- const size = Buffer.byteLength(dataStr);
90
- const price = await bundlr.getPrice(size);
91
- // Add a buffer of 10% to account for fluctuations in the price
92
- price.multipliedBy(1.1);
93
- console.log(`Funding bundlr with ${price} ${config.currency} to upload data`);
94
- await bundlr.fund(price);
95
- }
96
- return bundlr.upload(dataStr, { tags });
97
- }
98
- /**
99
- * Helper method to query the Arweave network for receivables metadata previously uploaded.
100
- *
101
- * @async
102
- * @function
103
- * @memberof ArweaveService
104
- * @param {number} chainId - The chain ID.
105
- * @param {string} sender - The sender tag to query.
106
- * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
107
- * @returns {Promise<any>} Promise resolving with the queried data.
108
- */
109
- async function queryForMetadata(chainId, sender, referenceId) {
110
- var _a, _b, _c, _d;
111
- const config = getBundlrNetworkConfig(chainId);
112
- const query = (0, graphql_request_1.gql) `
113
- query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
114
- transactions(
115
- owners: [$sender]
116
- tags: [
117
- { name: "appName", values: ["HumaFinance"] }
118
- { name: "referenceId", values: [$referenceId] }
119
- ]
120
- ) {
121
- edges {
122
- node {
123
- id
124
- }
125
- }
126
- }
127
- }
128
- `;
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- const data = await (0, graphql_request_1.default)(`${config.nodeUrl}/graphql`, query, {
131
- sender,
132
- referenceId,
133
- });
134
- return (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.transactions) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.node) === null || _d === void 0 ? void 0 : _d.id;
135
- }
136
- /**
137
- * An object that contains functions to interact with Huma-related data stored on ARWeave
138
- * @namespace ARWeaveService
139
- */
140
- exports.ARWeaveService = {
141
- queryForMetadata,
142
- storeData,
143
- prefundBundlr,
144
- getBundlrNetworkConfig,
145
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ARWeaveService = exports.getBundlrNetworkConfig = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const client_1 = tslib_1.__importDefault(require("@bundlr-network/client"));
6
+ const graphql_request_1 = tslib_1.__importStar(require("graphql-request"));
7
+ /**
8
+ * Get the configuration for Bundlr network given a chain ID
9
+ *
10
+ * @function
11
+ * @memberof ArweaveService
12
+ * @param {number} chainId - The chain ID.
13
+ * @returns {BundlrConfig} - The configuration for the Bundlr network.
14
+ */
15
+ function getBundlrNetworkConfig(chainId) {
16
+ switch (chainId) {
17
+ case 5: // Goerli
18
+ return {
19
+ nodeUrl: 'https://devnet.bundlr.network',
20
+ currency: 'ethereum',
21
+ providerUrl: 'https://goerli.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161',
22
+ };
23
+ case 80001: // Mumbai
24
+ return {
25
+ nodeUrl: 'https://devnet.bundlr.network',
26
+ currency: 'matic',
27
+ providerUrl: 'https://rpc.ankr.com/polygon_mumbai',
28
+ };
29
+ case 137: // Matic
30
+ return {
31
+ nodeUrl: 'https://node1.bundlr.network',
32
+ currency: 'matic',
33
+ };
34
+ default:
35
+ return {
36
+ nodeUrl: '',
37
+ currency: '',
38
+ };
39
+ }
40
+ }
41
+ exports.getBundlrNetworkConfig = getBundlrNetworkConfig;
42
+ /**
43
+ * Get a Bundlr instance for a specific network
44
+ *
45
+ * @async
46
+ * @function
47
+ * @memberof ArweaveService
48
+ * @param {BundlrConfig} config - The configuration for the Bundlr network.
49
+ * @param {string} signer - The private key of the wallet to use Bundlr with.
50
+ * @returns The Bundlr instance
51
+ */
52
+ async function getBundlrInstance(config, signer) {
53
+ const bundlr = new client_1.default(config.nodeUrl, config.currency, signer, config.providerUrl
54
+ ? {
55
+ providerUrl: config.providerUrl,
56
+ }
57
+ : undefined);
58
+ await bundlr.ready();
59
+ return bundlr;
60
+ }
61
+ /**
62
+ * Prefund the Bundlr network with the specified amount. Required if not lazy funding.
63
+ * Important note: The amount is denominated in the base unit of currency for that network.
64
+ * If you want to upload 5 Matic to the Bundlr node, pass in an amount of 5.
65
+ *
66
+ * @async
67
+ * @function
68
+ * @memberof ArweaveService
69
+ * @param {BundlrConfig} config - The configuration for the Bundlr network.
70
+ * @param {string} signer - The private key of the wallet to send funds from.
71
+ * @param {number} amount - The amount to fund, denoted in whatever currency specified by the config (e.g. MATIC, ETH)
72
+ * @returns {Promise<FundResponse>} - The fund response.
73
+ */
74
+ async function prefundBundlr(config,
75
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ signer, amount) {
77
+ const bundlr = new client_1.default(config.nodeUrl, config.currency, signer, config.providerUrl
78
+ ? {
79
+ providerUrl: config.providerUrl,
80
+ }
81
+ : undefined);
82
+ await bundlr.ready();
83
+ // Convert currency to its atomic units (e.g. MATIC -> wei)
84
+ const atomicAmount = bundlr.utils.toAtomic(amount);
85
+ return bundlr.fund(atomicAmount);
86
+ }
87
+ /**
88
+ * Store data on ARWeave using the Bundlr Network.
89
+ *
90
+ * @async
91
+ * @function
92
+ * @memberof ArweaveService
93
+ * @param {BundlrConfig} config - Configuration object for the Bundlr instance.
94
+ * @param {Web3Provider | string} signerOrPrivateKey - Wallet object used for interacting with the Bundlr instance.
95
+ * If calling from a browser, this should be a `Web3Provider` instance. If calling from a Node.js
96
+ * environment, this should be a private key string.
97
+ * @param {JSON} data - The data to store in the Bundlr instance.
98
+ * @param {Array<{ name: string, value: string }>} tags - Array of tag objects with `name` and `value` properties.
99
+ * @param {boolean} [lazyFund=true] - Optional flag to fund the Bundlr instance lazily. If set to `false`, the
100
+ * Bundlr node should already be funded or else uploads will fail.
101
+ * @returns {Promise<UploadResponse>} Promise resolving with the upload response.
102
+ */
103
+ async function storeData(config, signerOrPrivateKey, data, tags, lazyFund = true) {
104
+ const bundlr = new client_1.default(config.nodeUrl, config.currency, signerOrPrivateKey, config.providerUrl
105
+ ? {
106
+ providerUrl: config.providerUrl,
107
+ }
108
+ : undefined);
109
+ await bundlr.ready();
110
+ const dataStr = JSON.stringify(data);
111
+ if (lazyFund) {
112
+ const size = Buffer.byteLength(dataStr);
113
+ const price = await bundlr.getPrice(size);
114
+ // Add a buffer of 20% to account for fluctuations in the price
115
+ const priceWithBuffer = price.multipliedBy(1.2).integerValue();
116
+ console.log(`Funding bundlr with ${priceWithBuffer} ${config.currency} to upload data`);
117
+ await bundlr.fund(priceWithBuffer);
118
+ }
119
+ return bundlr.upload(dataStr, { tags });
120
+ }
121
+ /**
122
+ * Helper method to query the Arweave network for receivables metadata previously uploaded.
123
+ *
124
+ * @async
125
+ * @function
126
+ * @memberof ArweaveService
127
+ * @param {number} chainId - The chain ID.
128
+ * @param {string} sender - The sender tag to query.
129
+ * @param {string} referenceId - The referenceId tag to query, whatever was used when uploading the metadata.
130
+ * @returns {Promise<any>} Promise resolving with the queried data.
131
+ */
132
+ async function queryForMetadata(chainId, sender, referenceId) {
133
+ var _a, _b, _c, _d;
134
+ const config = getBundlrNetworkConfig(chainId);
135
+ const query = (0, graphql_request_1.gql) `
136
+ query ArweaveHumaMetadataQuery($sender: String!, $referenceId: String!) {
137
+ transactions(
138
+ owners: [$sender]
139
+ tags: [
140
+ { name: "appName", values: ["HumaFinance"] }
141
+ { name: "referenceId", values: [$referenceId] }
142
+ ]
143
+ ) {
144
+ edges {
145
+ node {
146
+ id
147
+ }
148
+ }
149
+ }
150
+ }
151
+ `;
152
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
153
+ const data = await (0, graphql_request_1.default)(`${config.nodeUrl}/graphql`, query, {
154
+ sender,
155
+ referenceId,
156
+ });
157
+ return (_d = (_c = (_b = (_a = data === null || data === void 0 ? void 0 : data.transactions) === null || _a === void 0 ? void 0 : _a.edges) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.node) === null || _d === void 0 ? void 0 : _d.id;
158
+ }
159
+ /**
160
+ * An object that contains functions to interact with Huma-related data stored on ARWeave
161
+ * @namespace ARWeaveService
162
+ */
163
+ exports.ARWeaveService = {
164
+ queryForMetadata,
165
+ storeData,
166
+ prefundBundlr,
167
+ getBundlrNetworkConfig,
168
+ getBundlrInstance,
169
+ };
146
170
  //# sourceMappingURL=ARWeaveService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ARWeaveService.js","sourceRoot":"","sources":["../../../src/services/ARWeaveService.ts"],"names":[],"mappings":";;;;AAAA,4EAA2C;AAM3C,2EAA8C;AAkB9C;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,QAAQ,OAAO,EAAE;QACf,KAAK,CAAC,EAAE,SAAS;YACf,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,UAAU;gBACpB,WAAW,EACT,8DAA8D;aACjE,CAAA;QACH,KAAK,KAAK,EAAE,SAAS;YACnB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,OAAO;gBACjB,WAAW,EAAE,gCAAgC;aAC9C,CAAA;QACH,KAAK,GAAG,EAAE,QAAQ;YAChB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,OAAO;aAClB,CAAA;QACH;YACE,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,EAAE;aACb,CAAA;KACJ;AACH,CAAC;AA1BD,wDA0BC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,aAAa,CAC1B,MAAoB;AACpB,8DAA8D;AAC9D,MAAW,EACX,MAAc;IAEd,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAM,EACN,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SAAS,CACd,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,SAAS,CACtB,MAAoB,EACpB,kBAAyC,EACzC,IAAU,EACV,IAAuC,EACvC,WAAoB,IAAI;IAExB,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,kBAAkB,EAClB,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SAAS,CACd,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,QAAQ,EAAE;QACZ,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAEzC,+DAA+D;QAC/D,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;QACvB,OAAO,CAAC,GAAG,CACT,uBAAuB,KAAK,IAAI,MAAM,CAAC,QAAQ,iBAAiB,CACjE,CAAA;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;KACzB;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,gBAAgB,CAC7B,OAAe,EACf,MAAc,EACd,WAAmB;;IAEnB,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;GAgBhB,CAAA;IAED,8DAA8D;IAC9D,MAAM,IAAI,GAAQ,MAAM,IAAA,yBAAO,EAAC,GAAG,MAAM,CAAC,OAAO,UAAU,EAAE,KAAK,EAAE;QAClE,MAAM;QACN,WAAW;KACZ,CAAC,CAAA;IAEF,OAAO,MAAA,MAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,0CAAE,KAAK,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,EAAE,CAAA;AACjD,CAAC;AAED;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,gBAAgB;IAChB,SAAS;IACT,aAAa;IACb,sBAAsB;CACvB,CAAA"}
1
+ {"version":3,"file":"ARWeaveService.js","sourceRoot":"","sources":["../../../src/services/ARWeaveService.ts"],"names":[],"mappings":";;;;AAAA,4EAA2C;AAM3C,2EAA8C;AAkB9C;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,OAAe;IACpD,QAAQ,OAAO,EAAE;QACf,KAAK,CAAC,EAAE,SAAS;YACf,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,UAAU;gBACpB,WAAW,EACT,8DAA8D;aACjE,CAAA;QACH,KAAK,KAAK,EAAE,SAAS;YACnB,OAAO;gBACL,OAAO,EAAE,+BAA+B;gBACxC,QAAQ,EAAE,OAAO;gBACjB,WAAW,EAAE,qCAAqC;aACnD,CAAA;QACH,KAAK,GAAG,EAAE,QAAQ;YAChB,OAAO;gBACL,OAAO,EAAE,8BAA8B;gBACvC,QAAQ,EAAE,OAAO;aAClB,CAAA;QACH;YACE,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,EAAE;aACb,CAAA;KACJ;AACH,CAAC;AA1BD,wDA0BC;AAED;;;;;;;;;GASG;AACH,KAAK,UAAU,iBAAiB,CAAC,MAAoB,EAAE,MAAc;IACnE,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAM,EACN,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SAAS,CACd,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,aAAa,CAC1B,MAAoB;AACpB,8DAA8D;AAC9D,MAAc,EACd,MAAc;IAEd,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,MAAM,EACN,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SAAS,CACd,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,2DAA2D;IAC3D,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IAElD,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,KAAK,UAAU,SAAS,CACtB,MAAoB,EACpB,kBAAyC,EACzC,IAAU,EACV,IAAuC,EACvC,WAAoB,IAAI;IAExB,MAAM,MAAM,GAAG,IAAI,gBAAM,CACvB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,QAAQ,EACf,kBAAkB,EAClB,MAAM,CAAC,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC;QACH,CAAC,CAAC,SAAS,CACd,CAAA;IACD,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IAEpB,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAEpC,IAAI,QAAQ,EAAE;QACZ,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAEzC,+DAA+D;QAC/D,MAAM,eAAe,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,CAAA;QAC9D,OAAO,CAAC,GAAG,CACT,uBAAuB,eAAe,IAAI,MAAM,CAAC,QAAQ,iBAAiB,CAC3E,CAAA;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;KACnC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;AACzC,CAAC;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,gBAAgB,CAC7B,OAAe,EACf,MAAc,EACd,WAAmB;;IAEnB,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAA;IAC9C,MAAM,KAAK,GAAG,IAAA,qBAAG,EAAA;;;;;;;;;;;;;;;;GAgBhB,CAAA;IAED,8DAA8D;IAC9D,MAAM,IAAI,GAAQ,MAAM,IAAA,yBAAO,EAAC,GAAG,MAAM,CAAC,OAAO,UAAU,EAAE,KAAK,EAAE;QAClE,MAAM;QACN,WAAW;KACZ,CAAC,CAAA;IAEF,OAAO,MAAA,MAAA,MAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,0CAAE,KAAK,0CAAG,CAAC,CAAC,0CAAE,IAAI,0CAAE,EAAE,CAAA;AACjD,CAAC;AAED;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B,gBAAgB;IAChB,SAAS;IACT,aAAa;IACb,sBAAsB;IACtB,iBAAiB;CAClB,CAAA"}
@@ -1,20 +1,20 @@
1
- import { EAPayload, EAPreapprovalPayload } from '@huma-finance/shared';
2
- /**
3
- * Object representing the response to the underwriting approval request.
4
- * @typedef {Object} ApprovalResult
5
- */
6
- /**
7
- * Object representing an invoice payload for underwriting approval.
8
- *
9
- * @typedef {Object} EAPayload
10
- */
11
- export type { ApprovalResult, EAPayload } from '@huma-finance/shared';
12
- /**
13
- * An object that contains functions to interact with Huma's EAVerse service.
14
- *
15
- * @namespace EAService
16
- */
17
- export declare const EAService: {
18
- approve: (payload: EAPayload, chainId: number) => Promise<import("@huma-finance/shared").Approval>;
19
- preapprove: (payload: EAPreapprovalPayload, chainId: number) => Promise<import("@huma-finance/shared").PreapprovalResult>;
20
- };
1
+ import { EAPayload, EAPreapprovalPayload } from '@huma-finance/shared';
2
+ /**
3
+ * Object representing the response to the underwriting approval request.
4
+ * @typedef {Object} ApprovalResult
5
+ */
6
+ /**
7
+ * Object representing an invoice payload for underwriting approval.
8
+ *
9
+ * @typedef {Object} EAPayload
10
+ */
11
+ export type { ApprovalResult, EAPayload } from '@huma-finance/shared';
12
+ /**
13
+ * An object that contains functions to interact with Huma's EAVerse service.
14
+ *
15
+ * @namespace EAService
16
+ */
17
+ export declare const EAService: {
18
+ approve: (payload: EAPayload, chainId: number) => Promise<import("@huma-finance/shared").Approval>;
19
+ preapprove: (payload: EAPreapprovalPayload, chainId: number) => Promise<import("@huma-finance/shared").PreapprovalResult>;
20
+ };
@@ -1,34 +1,34 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EAService = void 0;
4
- const shared_1 = require("@huma-finance/shared");
5
- /**
6
- * Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
7
- * in Huma's pools that can be drawn down by the borrower.
8
- *
9
- * @memberof EAService
10
- * @param {EAPayload} payload The payload for the underwrite approval.
11
- * @param {number} chainId The chain ID.
12
- * @returns {Promise<Approval>} Promise that returns the approval on success.
13
- * @throws {EARejectionError} If the underwrite approval is rejected.
14
- */
15
- const approve = async (payload, chainId) => shared_1.EAService.approve(payload, chainId);
16
- /**
17
- * Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
18
- * Note that this does not approve a creditline in Huma's pools and an approve call is still required.
19
- *
20
- * @param {EAPreapprovalPayload} payload The payload for the underwrite approval.
21
- * @param {number} chainId The chain ID.
22
- * @returns {Promise<Approval>} Promise that returns the approval on success.
23
- */
24
- const preapprove = async (payload, chainId) => shared_1.EAService.preapprove(payload, chainId);
25
- /**
26
- * An object that contains functions to interact with Huma's EAVerse service.
27
- *
28
- * @namespace EAService
29
- */
30
- exports.EAService = {
31
- approve,
32
- preapprove,
33
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EAService = void 0;
4
+ const shared_1 = require("@huma-finance/shared");
5
+ /**
6
+ * Submits a credit underwriting request to Huma's EAVerse. This approves a creditline
7
+ * in Huma's pools that can be drawn down by the borrower.
8
+ *
9
+ * @memberof EAService
10
+ * @param {EAPayload} payload The payload for the underwrite approval.
11
+ * @param {number} chainId The chain ID.
12
+ * @returns {Promise<Approval>} Promise that returns the approval on success.
13
+ * @throws {EARejectionError} If the underwrite approval is rejected.
14
+ */
15
+ const approve = async (payload, chainId) => shared_1.EAService.approve(payload, chainId);
16
+ /**
17
+ * Checks whether or not a credit underwriting request to Huma's EAVerse would be approved.
18
+ * Note that this does not approve a creditline in Huma's pools and an approve call is still required.
19
+ *
20
+ * @param {EAPreapprovalPayload} payload The payload for the underwrite approval.
21
+ * @param {number} chainId The chain ID.
22
+ * @returns {Promise<Approval>} Promise that returns the approval on success.
23
+ */
24
+ const preapprove = async (payload, chainId) => shared_1.EAService.preapprove(payload, chainId);
25
+ /**
26
+ * An object that contains functions to interact with Huma's EAVerse service.
27
+ *
28
+ * @namespace EAService
29
+ */
30
+ exports.EAService = {
31
+ approve,
32
+ preapprove,
33
+ };
34
34
  //# sourceMappingURL=EAService.js.map
@@ -1,89 +1,89 @@
1
- import { TransactionResponse, Web3Provider } from '@ethersproject/providers';
2
- import { BigNumberish, ethers, Overrides } from 'ethers';
3
- import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
- /**
5
- * Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.
6
- *
7
- * @async
8
- * @function
9
- * @memberof ReceivableService
10
- * @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
11
- * @param {string} referenceId - An internal identifier value added as a tag on ARWeave
12
- * @param {number} paymentAmount - The amount to declare paid to the receivable.
13
- * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
14
- * @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
15
- */
16
- declare function declareReceivablePaymentByReferenceId(signer: ethers.Signer, referenceId: string, paymentAmount: number, gasOpts?: Overrides): Promise<TransactionResponse>;
17
- /**
18
- * Declares a payment on a RealWorldReceivable given a tokenID of the receivable.
19
- *
20
- * @async
21
- * @function
22
- * @memberof ReceivableService
23
- * @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
24
- * @param {BigNumberish} receivableTokenId - The ID of the receivable token to pay.
25
- * @param {number} paymentAmount - The amount to pay the receivable.
26
- * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
27
- * @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
28
- * @throws {Error} - Throws an error if the RealWorldReceivable contract is not available on the network.
29
- */
30
- declare function declareReceivablePaymentByTokenId(signer: ethers.Signer, receivableTokenId: BigNumberish, paymentAmount: number, gasOpts?: Overrides): Promise<TransactionResponse>;
31
- /**
32
- * Creates a new RealWorldReceivable token on the given chain of the signer
33
- *
34
- * @async
35
- * @function
36
- * @memberof ReceivableService
37
- * @param {ethers.Signer} signer - The signer used to send the transaction.
38
- * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
39
- * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
40
- * @param {number} currencyCode - The ISO 4217 currency code that the receivable is denominated in
41
- * @param {number} receivableAmount - The amount of the receivable token to mint.
42
- * @param {number} maturityDate - The maturity date of the receivable token, in UNIX timestamp format.
43
- * @param {string} uri - The URI of the receivable token metadata.
44
- * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
45
- * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
46
- * @throws {Error} - Throws an error if the RealWorldReceivable contract is not available on the network.
47
- */
48
- declare function createReceivable(signer: ethers.Signer, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, uri: string, gasOpts?: Overrides): Promise<TransactionResponse>;
49
- /**
50
- * Creates a RealWorldReceivable token with metadata uploaded onto ARWeave
51
- *
52
- * @async
53
- * @function
54
- * @memberof ReceivableService
55
- * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
56
- * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
57
- * from server calls.
58
- * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
59
- * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
60
- * @param {string} recipient - The receivable token recipient.
61
- * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
62
- * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
63
- * @param {number} currencyCode - The ISO 4217 currency code that the receivable is denominated in
64
- * @param {number} receivableAmount - The receivable amount.
65
- * @param {number} maturityDate - The maturity date of the receivable, in UNIX timestamp format.
66
- * @param {JSON} metadata - The metadata in JSON format. This will be uploaded onto ARWeave
67
- * @param {number} referenceId - An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.
68
- * @param {Array<{ name: string, value: string }>} extraTags - Any extraTags you'd like to tag your metadata with. Note that metadata on
69
- * ARWeave is indexed by these tags, so make sure to include any tags that you'd like to be able to query by.
70
- * @param {boolean} [lazyFund=true] - Whether to lazy fund the ARWeave uploads. If true, the ARWeave uploads will be paid for by the
71
- * metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.
72
- * @param {Overrides} [gasOpts] - Optional gas overrides for the transaction.
73
- * @returns {Promise<TransactionResponse>} - The transaction receipt.
74
- */
75
- declare function createReceivableWithMetadata(signerOrProvider: Web3Provider | ethers.Signer, privateKey: string | null, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, metadata: JSON, referenceId: string, extraTags: {
76
- name: string;
77
- value: string;
78
- }[], lazyFund?: boolean, gasOpts?: Overrides): Promise<TransactionResponse>;
79
- /**
80
- * An object that contains functions to interact with Huma's receivables.
81
- * @namespace ReceivableService
82
- */
83
- export declare const ReceivableService: {
84
- createReceivableWithMetadata: typeof createReceivableWithMetadata;
85
- createReceivable: typeof createReceivable;
86
- declareReceivablePaymentByTokenId: typeof declareReceivablePaymentByTokenId;
87
- declareReceivablePaymentByReferenceId: typeof declareReceivablePaymentByReferenceId;
88
- };
89
- export {};
1
+ import { TransactionResponse, Web3Provider } from '@ethersproject/providers';
2
+ import { BigNumberish, ethers, Overrides } from 'ethers';
3
+ import { POOL_NAME, POOL_TYPE } from '@huma-finance/shared';
4
+ /**
5
+ * Declares a payment on a RealWorldReceivable given a reference ID of the receivable, which was used as an index for ARWeave data.
6
+ *
7
+ * @async
8
+ * @function
9
+ * @memberof ReceivableService
10
+ * @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
11
+ * @param {string} referenceId - An internal identifier value added as a tag on ARWeave
12
+ * @param {number} paymentAmount - The amount to declare paid to the receivable.
13
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
14
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
15
+ */
16
+ declare function declareReceivablePaymentByReferenceId(signer: ethers.Signer, referenceId: string, paymentAmount: number, gasOpts?: Overrides): Promise<TransactionResponse>;
17
+ /**
18
+ * Declares a payment on a RealWorldReceivable given a tokenID of the receivable.
19
+ *
20
+ * @async
21
+ * @function
22
+ * @memberof ReceivableService
23
+ * @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
24
+ * @param {BigNumberish} receivableTokenId - The ID of the receivable token to pay.
25
+ * @param {number} paymentAmount - The amount to pay the receivable.
26
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
27
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
28
+ * @throws {Error} - Throws an error if the RealWorldReceivable contract is not available on the network.
29
+ */
30
+ declare function declareReceivablePaymentByTokenId(signer: ethers.Signer, receivableTokenId: BigNumberish, paymentAmount: number, gasOpts?: Overrides): Promise<TransactionResponse>;
31
+ /**
32
+ * Creates a new RealWorldReceivable token on the given chain of the signer
33
+ *
34
+ * @async
35
+ * @function
36
+ * @memberof ReceivableService
37
+ * @param {ethers.Signer} signer - The signer used to send the transaction.
38
+ * @param {POOL_NAME} poolName - The name of the credit pool to mint the receivable token from. Used to lookup the pool address.
39
+ * @param {POOL_TYPE} poolType - The type of the credit pool to mint the receivable token from. Used to lookup the pool address.
40
+ * @param {number} currencyCode - The ISO 4217 currency code that the receivable is denominated in
41
+ * @param {number} receivableAmount - The amount of the receivable token to mint.
42
+ * @param {number} maturityDate - The maturity date of the receivable token, in UNIX timestamp format.
43
+ * @param {string} uri - The URI of the receivable token metadata.
44
+ * @param {Overrides} [gasOpts] - The gas options to use for the transaction.
45
+ * @returns {Promise<TransactionResponse>} - A Promise of the transaction response.
46
+ * @throws {Error} - Throws an error if the RealWorldReceivable contract is not available on the network.
47
+ */
48
+ declare function createReceivable(signer: ethers.Signer, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, uri: string, gasOpts?: Overrides): Promise<TransactionResponse>;
49
+ /**
50
+ * Creates a RealWorldReceivable token with metadata uploaded onto ARWeave
51
+ *
52
+ * @async
53
+ * @function
54
+ * @memberof ReceivableService
55
+ * @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
56
+ * If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
57
+ * from server calls.
58
+ * @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
59
+ * @param {number} chainId - The chain ID to mint the receivable token on and pay ARWeave funds from.
60
+ * @param {string} recipient - The receivable token recipient.
61
+ * @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
62
+ * @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
63
+ * @param {number} currencyCode - The ISO 4217 currency code that the receivable is denominated in
64
+ * @param {number} receivableAmount - The receivable amount.
65
+ * @param {number} maturityDate - The maturity date of the receivable, in UNIX timestamp format.
66
+ * @param {JSON} metadata - The metadata in JSON format. This will be uploaded onto ARWeave
67
+ * @param {number} referenceId - An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.
68
+ * @param {Array<{ name: string, value: string }>} extraTags - Any extraTags you'd like to tag your metadata with. Note that metadata on
69
+ * ARWeave is indexed by these tags, so make sure to include any tags that you'd like to be able to query by.
70
+ * @param {boolean} [lazyFund=true] - Whether to lazy fund the ARWeave uploads. If true, the ARWeave uploads will be paid for by the
71
+ * metadata uploader immediately before uploading. If false, the ARWeave node must be pre-funded before calling this function.
72
+ * @param {Overrides} [gasOpts] - Optional gas overrides for the transaction.
73
+ * @returns {Promise<TransactionResponse>} - The transaction receipt.
74
+ */
75
+ declare function createReceivableWithMetadata(signerOrProvider: Web3Provider | ethers.Signer, privateKey: string | null, chainId: number, poolName: POOL_NAME, poolType: POOL_TYPE, currencyCode: number, receivableAmount: number, maturityDate: number, metadata: JSON, referenceId: string, extraTags: {
76
+ name: string;
77
+ value: string;
78
+ }[], lazyFund?: boolean, gasOpts?: Overrides): Promise<TransactionResponse>;
79
+ /**
80
+ * An object that contains functions to interact with Huma's receivables.
81
+ * @namespace ReceivableService
82
+ */
83
+ export declare const ReceivableService: {
84
+ createReceivableWithMetadata: typeof createReceivableWithMetadata;
85
+ createReceivable: typeof createReceivable;
86
+ declareReceivablePaymentByTokenId: typeof declareReceivablePaymentByTokenId;
87
+ declareReceivablePaymentByReferenceId: typeof declareReceivablePaymentByReferenceId;
88
+ };
89
+ export {};