@huma-finance/sdk 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API.md +443 -10
- package/dist/cjs/services/ARWeaveService.d.ts +13 -2
- package/dist/cjs/services/ARWeaveService.js +22 -1
- package/dist/cjs/services/ARWeaveService.js.map +1 -1
- package/dist/cjs/services/ReceivableService.d.ts +23 -7
- package/dist/cjs/services/ReceivableService.js +160 -43
- package/dist/cjs/services/ReceivableService.js.map +1 -1
- package/dist/services/ARWeaveService.d.ts +13 -2
- package/dist/services/ARWeaveService.js +22 -1
- package/dist/services/ARWeaveService.js.map +1 -1
- package/dist/services/ReceivableService.d.ts +23 -7
- package/dist/services/ReceivableService.js +161 -44
- package/dist/services/ReceivableService.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { Web3Provider } from '@ethersproject/providers';
|
|
2
|
-
import {
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
import { PoolContractMap, PoolSubgraphMap, SupplementaryContracts, SupplementaryContractsMap, } from '@huma-finance/shared';
|
|
3
4
|
import request, { gql } from 'graphql-request';
|
|
4
5
|
import { ARWeaveService } from './ARWeaveService';
|
|
5
6
|
import { getRealWorldReceivableContract } from '../helpers';
|
|
6
7
|
import { getDefaultGasOptions, getChainIdFromSignerOrProvider } from '../utils';
|
|
7
8
|
/**
|
|
8
|
-
* Declares a payment on a RealWorldReceivable given a reference
|
|
9
|
+
* Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.
|
|
9
10
|
*
|
|
10
11
|
* @async
|
|
11
12
|
* @function
|
|
12
13
|
* @memberof ReceivableService
|
|
13
|
-
* @param {ethers.Signer} signer - The signer used to
|
|
14
|
-
* @param {string}
|
|
15
|
-
* @
|
|
16
|
-
* @param {Overrides} [gasOpts] - The gas options to use for the transaction.
|
|
17
|
-
* @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
|
|
14
|
+
* @param {ethers.Signer} signer - The signer used to lookup metadata uploads for
|
|
15
|
+
* @param {string} arweaveId - The internal ARWeave identifier to lookup a token by
|
|
16
|
+
* @returns {Promise<string | null | undefined>} - Either the token Id or null if no token was found.
|
|
18
17
|
*/
|
|
19
|
-
async function
|
|
18
|
+
async function getTokenIdByARWeaveId(signer, arweaveId) {
|
|
20
19
|
var _a, _b, _c;
|
|
20
|
+
if (arweaveId === null) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
21
23
|
const chainId = await getChainIdFromSignerOrProvider(signer);
|
|
22
24
|
const signerAddress = await signer.getAddress();
|
|
23
25
|
if (!chainId) {
|
|
24
|
-
throw new Error('No Chain
|
|
26
|
+
throw new Error('No Chain Id found');
|
|
25
27
|
}
|
|
26
|
-
//
|
|
27
|
-
const dataID = await ARWeaveService.queryForMetadata(chainId, signerAddress, referenceId);
|
|
28
|
-
// Fetch receivables with the same ARWeave ID
|
|
28
|
+
// Fetch receivables with the same ARWeave Id
|
|
29
29
|
const receivablesQuery = gql `
|
|
30
30
|
query ReceivablesByURIQuery($owner: String!, $uri: String!) {
|
|
31
31
|
receivables(where: { owner: $owner, uri: $uri }) {
|
|
@@ -37,40 +37,65 @@ async function declareReceivablePaymentByReferenceId(signer, referenceId, paymen
|
|
|
37
37
|
tokenId
|
|
38
38
|
}
|
|
39
39
|
`;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
receivableSubgraph = `https://api.thegraph.com/subgraphs/name/00labs/huma-receivables-goerli`;
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
throw new Error('No receivable subgraph exists for this chain');
|
|
40
|
+
const receivableSubgraph = PoolSubgraphMap[chainId].receivablesSubgraph;
|
|
41
|
+
if (!receivableSubgraph) {
|
|
42
|
+
throw new Error('No receivable subgraph exists for this chain');
|
|
47
43
|
}
|
|
48
44
|
const receivablesData = await request(receivableSubgraph, receivablesQuery, {
|
|
49
45
|
owner: signerAddress,
|
|
50
|
-
uri: `https://arweave.net/${
|
|
46
|
+
uri: `https://arweave.net/${arweaveId}`,
|
|
51
47
|
});
|
|
52
|
-
if (!(
|
|
53
|
-
|
|
48
|
+
if (!((_a = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
49
|
+
console.log('No receivables found with this ARWeave Id.');
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
if (((_b = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables) === null || _b === void 0 ? void 0 : _b.length) > 1) {
|
|
53
|
+
console.log(`This owner has multiple receivables with the same ARWeave URI, so we don't know which to use. Please burn
|
|
54
|
+
unnecessary receivables or pay the correct token manually using declareReceivablePaymentByTokenId`);
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return (_c = receivablesData === null || receivablesData === void 0 ? void 0 : receivablesData.receivables[0]) === null || _c === void 0 ? void 0 : _c.tokenId;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Declares a payment on a RealWorldReceivable given a reference Id of the receivable, which was used as an index for ARWeave data.
|
|
61
|
+
*
|
|
62
|
+
* @async
|
|
63
|
+
* @function
|
|
64
|
+
* @memberof ReceivableService
|
|
65
|
+
* @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
|
|
66
|
+
* @param {string} referenceId - An internal identifier value added as a tag on ARWeave
|
|
67
|
+
* @param {number} paymentAmount - The amount to declare paid to the receivable.
|
|
68
|
+
* @param {Overrides} [gasOpts] - The gas options to use for the transaction.
|
|
69
|
+
* @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
|
|
70
|
+
*/
|
|
71
|
+
async function declareReceivablePaymentByReferenceId(signer, referenceId, paymentAmount, gasOpts = {}) {
|
|
72
|
+
const chainId = await getChainIdFromSignerOrProvider(signer);
|
|
73
|
+
const signerAddress = await signer.getAddress();
|
|
74
|
+
if (!chainId) {
|
|
75
|
+
throw new Error('No Chain Id found');
|
|
54
76
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
77
|
+
// Get ARWeave Id
|
|
78
|
+
const dataId = await ARWeaveService.queryForMetadata(chainId, signerAddress, referenceId);
|
|
79
|
+
// Fetch receivables with the same ARWeave Id
|
|
80
|
+
const tokenId = await getTokenIdByARWeaveId(signer, dataId);
|
|
81
|
+
if (tokenId == null) {
|
|
82
|
+
throw new Error('Could not find tokenId for this ARWeave Id. Please check your logs for more details.');
|
|
58
83
|
}
|
|
59
84
|
const contract = getRealWorldReceivableContract(signer, chainId);
|
|
60
85
|
if (!contract) {
|
|
61
86
|
throw new Error('Could not find RealWorldReceivable contract');
|
|
62
87
|
}
|
|
63
88
|
gasOpts = await getDefaultGasOptions(gasOpts, chainId);
|
|
64
|
-
return contract.declarePayment(
|
|
89
|
+
return contract.declarePayment(tokenId, paymentAmount, gasOpts);
|
|
65
90
|
}
|
|
66
91
|
/**
|
|
67
|
-
* Declares a payment on a RealWorldReceivable given a
|
|
92
|
+
* Declares a payment on a RealWorldReceivable given a tokenId of the receivable.
|
|
68
93
|
*
|
|
69
94
|
* @async
|
|
70
95
|
* @function
|
|
71
96
|
* @memberof ReceivableService
|
|
72
97
|
* @param {ethers.Signer} signer - The signer used to send the transaction. Note only the receivable owner can pay the receivable.
|
|
73
|
-
* @param {BigNumberish} receivableTokenId - The
|
|
98
|
+
* @param {BigNumberish} receivableTokenId - The Id of the receivable token to pay.
|
|
74
99
|
* @param {number} paymentAmount - The amount to pay the receivable.
|
|
75
100
|
* @param {Overrides} [gasOpts] - The gas options to use for the transaction.
|
|
76
101
|
* @returns {Promise<TransactionResponse>} - A Promise of the transaction receipt.
|
|
@@ -80,7 +105,7 @@ async function declareReceivablePaymentByTokenId(signer, receivableTokenId, paym
|
|
|
80
105
|
var _a;
|
|
81
106
|
const chainId = await getChainIdFromSignerOrProvider(signer);
|
|
82
107
|
if (!chainId) {
|
|
83
|
-
throw new Error('No Chain
|
|
108
|
+
throw new Error('No Chain Id found');
|
|
84
109
|
}
|
|
85
110
|
const realWorldReceivable = (_a = SupplementaryContractsMap[chainId]) === null || _a === void 0 ? void 0 : _a[SupplementaryContracts.RealWorldReceivable];
|
|
86
111
|
if (!realWorldReceivable) {
|
|
@@ -114,7 +139,7 @@ async function createReceivable(signer, poolName, poolType, currencyCode, receiv
|
|
|
114
139
|
var _a, _b;
|
|
115
140
|
const chainId = await getChainIdFromSignerOrProvider(signer);
|
|
116
141
|
if (!chainId) {
|
|
117
|
-
throw new Error('No Chain
|
|
142
|
+
throw new Error('No Chain Id found');
|
|
118
143
|
}
|
|
119
144
|
const poolInfo = chainId
|
|
120
145
|
? (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[poolType]) === null || _b === void 0 ? void 0 : _b[poolName]
|
|
@@ -139,14 +164,14 @@ async function createReceivable(signer, poolName, poolType, currencyCode, receiv
|
|
|
139
164
|
* If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
|
|
140
165
|
* from server calls.
|
|
141
166
|
* @param {string | null} privateKey - Private key of the wallet used to upload metadata to ARWeave. Only required if calling this function from a server.
|
|
142
|
-
* @param {number} chainId - The chain
|
|
167
|
+
* @param {number} chainId - The chain Id to mint the receivable token on and pay ARWeave funds from.
|
|
143
168
|
* @param {string} recipient - The receivable token recipient.
|
|
144
169
|
* @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
|
|
145
170
|
* @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
|
|
146
171
|
* @param {number} currencyCode - The ISO 4217 currency code that the receivable is denominated in
|
|
147
172
|
* @param {number} receivableAmount - The receivable amount.
|
|
148
173
|
* @param {number} maturityDate - The maturity date of the receivable, in UNIX timestamp format.
|
|
149
|
-
* @param {
|
|
174
|
+
* @param {Record<string, any>} metadata - The metadata in JSON format. This will be uploaded onto ARWeave
|
|
150
175
|
* @param {number} referenceId - An internal identifier value added as a tag on ARWeave, for easily querying the metadata later.
|
|
151
176
|
* @param {Array<{ name: string, value: string }>} extraTags - Any extraTags you'd like to tag your metadata with. Note that metadata on
|
|
152
177
|
* ARWeave is indexed by these tags, so make sure to include any tags that you'd like to be able to query by.
|
|
@@ -156,27 +181,118 @@ async function createReceivable(signer, poolName, poolType, currencyCode, receiv
|
|
|
156
181
|
* @returns {Promise<TransactionResponse>} - The transaction receipt.
|
|
157
182
|
*/
|
|
158
183
|
async function createReceivableWithMetadata(signerOrProvider, privateKey, chainId, poolName, poolType, currencyCode, receivableAmount, maturityDate, metadata, referenceId, extraTags, lazyFund = true, gasOpts) {
|
|
184
|
+
if (typeof metadata !== 'object' || Array.isArray(metadata)) {
|
|
185
|
+
throw new Error('Input must be a JSON object.');
|
|
186
|
+
}
|
|
159
187
|
const config = ARWeaveService.getBundlrNetworkConfig(chainId);
|
|
160
188
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
{ name: 'appName', value: 'HumaFinance' },
|
|
164
|
-
{ name: 'poolName', value: poolName },
|
|
165
|
-
{ name: 'poolType', value: poolType },
|
|
166
|
-
{ name: 'referenceId', value: referenceId },
|
|
167
|
-
...extraTags,
|
|
168
|
-
];
|
|
169
|
-
const response = await ARWeaveService.storeData(config, signerOrProvider instanceof Web3Provider ? signerOrProvider : privateKey, metadata, tags, lazyFund);
|
|
170
|
-
console.log(`Data uploaded ==> https://arweave.net/${response.id}`);
|
|
171
|
-
return await createReceivable(signerOrProvider instanceof Web3Provider
|
|
189
|
+
// Check to see if metadata with referenceId has already been minted
|
|
190
|
+
const signer = signerOrProvider instanceof Web3Provider
|
|
172
191
|
? signerOrProvider.getSigner()
|
|
173
|
-
: signerOrProvider
|
|
192
|
+
: signerOrProvider;
|
|
193
|
+
const signerAddress = await signer.getAddress();
|
|
194
|
+
const dataId = await ARWeaveService.queryForMetadata(chainId, signerAddress, referenceId);
|
|
195
|
+
let arweaveId;
|
|
196
|
+
if (dataId != null) {
|
|
197
|
+
// If there already exists metadata with this reference Id, check if there exists
|
|
198
|
+
// a token with that ARWeave Id as metadata.
|
|
199
|
+
const tokenId = await getTokenIdByARWeaveId(signer, dataId);
|
|
200
|
+
if (tokenId == null) {
|
|
201
|
+
console.log(`Reusing existing metadata ${dataId} to mint new receivable`);
|
|
202
|
+
arweaveId = dataId;
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
throw new Error('A token already exists with this reference Id, canceling mint');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
const tags = [
|
|
210
|
+
{ name: 'Content-Type', value: 'application/json' },
|
|
211
|
+
{ name: 'appName', value: 'HumaFinance' },
|
|
212
|
+
{ name: 'poolName', value: poolName },
|
|
213
|
+
{ name: 'poolType', value: poolType },
|
|
214
|
+
{ name: 'referenceId', value: referenceId },
|
|
215
|
+
...extraTags,
|
|
216
|
+
];
|
|
217
|
+
// Append referenceId to metadata (if it's not already there)
|
|
218
|
+
if (!Object.prototype.hasOwnProperty.call(metadata, 'referenceId')) {
|
|
219
|
+
metadata.referenceId = referenceId;
|
|
220
|
+
}
|
|
221
|
+
const response = await ARWeaveService.storeData(config, signerOrProvider instanceof Web3Provider
|
|
222
|
+
? signerOrProvider
|
|
223
|
+
: privateKey, metadata, tags, lazyFund);
|
|
224
|
+
arweaveId = response.id;
|
|
225
|
+
console.log(`Data uploaded ==> https://arweave.net/${arweaveId}`);
|
|
226
|
+
}
|
|
227
|
+
return await createReceivable(signer, poolName, poolType, currencyCode, receivableAmount, maturityDate, `https://arweave.net/${arweaveId}`, gasOpts);
|
|
174
228
|
}
|
|
175
229
|
catch (e) {
|
|
176
230
|
console.error(e);
|
|
177
231
|
throw e;
|
|
178
232
|
}
|
|
179
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Creates a RealWorldReceivable token with metadata uploaded onto ARWeave
|
|
236
|
+
*
|
|
237
|
+
* @async
|
|
238
|
+
* @function
|
|
239
|
+
* @memberof ReceivableService
|
|
240
|
+
* @param {Web3Provider | ethers.Signer} signerOrProvider - If calling this function from a browser, this function expects a Web3Provider.
|
|
241
|
+
* If calling this function from a server, this function expects an ethers Signer. Note that privateKey only needs to be included
|
|
242
|
+
* from server calls.
|
|
243
|
+
* @param {string} owner - The receivable token owner to query from.
|
|
244
|
+
* @param {POOL_NAME} poolName - The pool name. Used to lookup the pool address to pay to.
|
|
245
|
+
* @param {POOL_TYPE} poolType - The pool type. Used to lookup the pool address to pay to.
|
|
246
|
+
* @returns {Promise<RealWorldReceivableInfo[]>} - An array of receivables owned by the owner for the pool.
|
|
247
|
+
*/
|
|
248
|
+
async function loadReceivablesOfOwnerWithMetadata(signerOrProvider, owner, poolName, poolType) {
|
|
249
|
+
var _a, _b;
|
|
250
|
+
if (!ethers.utils.isAddress(owner)) {
|
|
251
|
+
throw new Error('Invalid owner address');
|
|
252
|
+
}
|
|
253
|
+
const chainId = await getChainIdFromSignerOrProvider(signerOrProvider);
|
|
254
|
+
if (!chainId) {
|
|
255
|
+
throw new Error('No Chain Id found');
|
|
256
|
+
}
|
|
257
|
+
const poolInfo = chainId
|
|
258
|
+
? (_b = (_a = PoolContractMap[chainId]) === null || _a === void 0 ? void 0 : _a[poolType]) === null || _b === void 0 ? void 0 : _b[poolName]
|
|
259
|
+
: undefined;
|
|
260
|
+
if (!poolInfo) {
|
|
261
|
+
throw new Error('RealWorldReceivable is not available on this network');
|
|
262
|
+
}
|
|
263
|
+
const rwrContract = getRealWorldReceivableContract(signerOrProvider, chainId);
|
|
264
|
+
if (!rwrContract) {
|
|
265
|
+
throw new Error('Could not find RealWorldReceivable contract');
|
|
266
|
+
}
|
|
267
|
+
// Load all receivables of owner
|
|
268
|
+
const balance = await rwrContract.balanceOf(owner);
|
|
269
|
+
// Create empty array with length of balance
|
|
270
|
+
const tokens = Array.from(Array(balance.toNumber()));
|
|
271
|
+
const fetchPromises = tokens.map(async (_, tokenIndex) => {
|
|
272
|
+
const tokenId = await rwrContract.tokenOfOwnerByIndex(owner, tokenIndex);
|
|
273
|
+
const rwrInfo = await rwrContract.rwrInfoMapping(tokenId);
|
|
274
|
+
// If a RWR uploaded by an owner is not for this specific pool, skip it
|
|
275
|
+
if (rwrInfo.poolAddress.toLowerCase() !== poolInfo.pool.toLowerCase()) {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
const tokenURI = await rwrContract.tokenURI(tokenId);
|
|
279
|
+
const metadata = await ARWeaveService.fetchMetadataFromUrl(tokenURI);
|
|
280
|
+
return {
|
|
281
|
+
tokenId,
|
|
282
|
+
poolAddress: rwrInfo.poolAddress,
|
|
283
|
+
receivableAmount: rwrInfo.receivableAmount,
|
|
284
|
+
paidAmount: rwrInfo.paidAmount,
|
|
285
|
+
creationDate: rwrInfo.creationDate,
|
|
286
|
+
maturityDate: rwrInfo.maturityDate,
|
|
287
|
+
currencyCode: rwrInfo.currencyCode,
|
|
288
|
+
tokenURI,
|
|
289
|
+
metadata,
|
|
290
|
+
};
|
|
291
|
+
});
|
|
292
|
+
const tokenData = await Promise.all(fetchPromises);
|
|
293
|
+
// Filter undefined
|
|
294
|
+
return tokenData.filter((token) => token !== undefined);
|
|
295
|
+
}
|
|
180
296
|
/**
|
|
181
297
|
* An object that contains functions to interact with Huma's receivables.
|
|
182
298
|
* @namespace ReceivableService
|
|
@@ -186,5 +302,6 @@ export const ReceivableService = {
|
|
|
186
302
|
createReceivable,
|
|
187
303
|
declareReceivablePaymentByTokenId,
|
|
188
304
|
declareReceivablePaymentByReferenceId,
|
|
305
|
+
loadReceivablesOfOwnerWithMetadata,
|
|
189
306
|
};
|
|
190
307
|
//# sourceMappingURL=ReceivableService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReceivableService.js","sourceRoot":"","sources":["../../src/services/ReceivableService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,YAAY,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"Receiv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