@requestnetwork/request-client.js 0.40.1-next.1862 → 0.40.1-next.1863
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/dist/api/request-network.js +11 -11
- package/dist/api/request.js +16 -16
- package/dist/api/utils.d.ts +3 -3
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/http-data-access.js +10 -10
- package/dist/http-data-access.js.map +1 -1
- package/dist/http-metamask-data-access.js +4 -4
- package/dist/mock-storage.js +8 -8
- package/dist/report.html +2 -2
- package/dist/requestnetwork.min.js +3 -3
- package/dist/requestnetwork.min.js.LICENSE.txt +0 -15
- package/dist/requestnetwork.min.js.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +18 -18
|
@@ -36,7 +36,7 @@ class RequestNetwork {
|
|
|
36
36
|
* @returns The created request
|
|
37
37
|
*/
|
|
38
38
|
createRequest(parameters) {
|
|
39
|
-
return
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
const { requestParameters, topics, paymentNetwork } = yield this.prepareRequestParameters(parameters);
|
|
41
41
|
const requestLogicCreateResult = yield this.requestLogic.createRequest(requestParameters, parameters.signer, topics);
|
|
42
42
|
// create the request object
|
|
@@ -60,7 +60,7 @@ class RequestNetwork {
|
|
|
60
60
|
* @returns The created encrypted request
|
|
61
61
|
*/
|
|
62
62
|
_createEncryptedRequest(parameters, encryptionParams) {
|
|
63
|
-
return
|
|
63
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
64
64
|
const { requestParameters, topics, paymentNetwork } = yield this.prepareRequestParameters(parameters);
|
|
65
65
|
const requestLogicCreateResult = yield this.requestLogic.createEncryptedRequest(requestParameters, parameters.signer, encryptionParams, topics);
|
|
66
66
|
// create the request object
|
|
@@ -83,7 +83,7 @@ class RequestNetwork {
|
|
|
83
83
|
* @returns The requestId
|
|
84
84
|
*/
|
|
85
85
|
computeRequestId(parameters) {
|
|
86
|
-
return
|
|
86
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
87
87
|
const { requestParameters } = yield this.prepareRequestParameters(parameters);
|
|
88
88
|
return this.requestLogic.computeRequestId(requestParameters, parameters.signer);
|
|
89
89
|
});
|
|
@@ -96,7 +96,7 @@ class RequestNetwork {
|
|
|
96
96
|
* @returns the Request
|
|
97
97
|
*/
|
|
98
98
|
fromRequestId(requestId, options) {
|
|
99
|
-
return
|
|
99
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
const requestAndMeta = yield this.requestLogic.getRequestFromId(requestId);
|
|
101
101
|
// if no request found, throw a human readable message:
|
|
102
102
|
if (!requestAndMeta.result.request && !requestAndMeta.result.pending) {
|
|
@@ -127,7 +127,7 @@ class RequestNetwork {
|
|
|
127
127
|
* @returns the Requests
|
|
128
128
|
*/
|
|
129
129
|
fromIdentity(identity, updatedBetween, options) {
|
|
130
|
-
return
|
|
130
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
131
131
|
if (!this.supportedIdentities.includes(identity.type)) {
|
|
132
132
|
throw new Error(`${identity.type} is not supported`);
|
|
133
133
|
}
|
|
@@ -142,7 +142,7 @@ class RequestNetwork {
|
|
|
142
142
|
* @returns the requests
|
|
143
143
|
*/
|
|
144
144
|
fromMultipleIdentities(identities, updatedBetween, options) {
|
|
145
|
-
return
|
|
145
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
146
146
|
const identityNotSupported = identities.find((identity) => !this.supportedIdentities.includes(identity.type));
|
|
147
147
|
if (identityNotSupported) {
|
|
148
148
|
throw new Error(`${identityNotSupported.type} is not supported`);
|
|
@@ -158,11 +158,11 @@ class RequestNetwork {
|
|
|
158
158
|
* @returns the Requests
|
|
159
159
|
*/
|
|
160
160
|
fromTopic(topic, updatedBetween, options) {
|
|
161
|
-
return
|
|
161
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
162
162
|
// Gets all the requests indexed by the value of the identity
|
|
163
163
|
const requestsAndMeta = yield this.requestLogic.getRequestsByTopic(topic, updatedBetween);
|
|
164
164
|
// From the requests of the request-logic layer creates the request objects and gets the payment networks
|
|
165
|
-
const requestPromises = requestsAndMeta.result.requests.map((requestFromLogic) =>
|
|
165
|
+
const requestPromises = requestsAndMeta.result.requests.map((requestFromLogic) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
166
166
|
// get the request state. If the creation is not confirmed yet, get the pending state (useful for the payment network)
|
|
167
167
|
const requestState = requestFromLogic.request
|
|
168
168
|
? requestFromLogic.request
|
|
@@ -190,11 +190,11 @@ class RequestNetwork {
|
|
|
190
190
|
* @returns the Requests
|
|
191
191
|
*/
|
|
192
192
|
fromMultipleTopics(topics, updatedBetween, options) {
|
|
193
|
-
return
|
|
193
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
194
194
|
// Gets all the requests indexed by the value of the identity
|
|
195
195
|
const requestsAndMeta = yield this.requestLogic.getRequestsByMultipleTopics(topics, updatedBetween);
|
|
196
196
|
// From the requests of the request-logic layer creates the request objects and gets the payment networks
|
|
197
|
-
const requestPromises = requestsAndMeta.result.requests.map((requestFromLogic) =>
|
|
197
|
+
const requestPromises = requestsAndMeta.result.requests.map((requestFromLogic) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
198
198
|
// get the request state. If the creation is not confirmed yet, get the pending state (useful for the payment network)
|
|
199
199
|
const requestState = requestFromLogic.request
|
|
200
200
|
? requestFromLogic.request
|
|
@@ -234,7 +234,7 @@ class RequestNetwork {
|
|
|
234
234
|
*/
|
|
235
235
|
prepareRequestParameters(parameters) {
|
|
236
236
|
var _a, _b, _c, _d;
|
|
237
|
-
return
|
|
237
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
238
238
|
const currency = this.getCurrency(parameters.requestInfo.currency);
|
|
239
239
|
const requestParameters = Object.assign(Object.assign({}, parameters.requestInfo), { currency });
|
|
240
240
|
const contentData = parameters.contentData;
|
package/dist/api/request.js
CHANGED
|
@@ -70,7 +70,7 @@ class Request {
|
|
|
70
70
|
if ((options === null || options === void 0 ? void 0 : options.requestLogicCreateResult) && !this.disableEvents) {
|
|
71
71
|
const originalEmitter = options.requestLogicCreateResult;
|
|
72
72
|
originalEmitter
|
|
73
|
-
.on('confirmed', () =>
|
|
73
|
+
.on('confirmed', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
try {
|
|
75
75
|
this.emitter.emit('confirmed', yield this.refresh());
|
|
76
76
|
}
|
|
@@ -114,7 +114,7 @@ class Request {
|
|
|
114
114
|
* @returns The updated request
|
|
115
115
|
*/
|
|
116
116
|
accept(signerIdentity, refundInformation) {
|
|
117
|
-
return
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
118
118
|
const extensionsData = [];
|
|
119
119
|
if (refundInformation) {
|
|
120
120
|
if (!this.paymentNetwork) {
|
|
@@ -138,7 +138,7 @@ class Request {
|
|
|
138
138
|
* @returns The updated request
|
|
139
139
|
*/
|
|
140
140
|
cancel(signerIdentity, refundInformation) {
|
|
141
|
-
return
|
|
141
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
142
142
|
const extensionsData = [];
|
|
143
143
|
if (refundInformation) {
|
|
144
144
|
if (!this.paymentNetwork) {
|
|
@@ -163,7 +163,7 @@ class Request {
|
|
|
163
163
|
* @returns The updated request
|
|
164
164
|
*/
|
|
165
165
|
increaseExpectedAmountRequest(deltaAmount, signerIdentity, refundInformation) {
|
|
166
|
-
return
|
|
166
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
167
167
|
const extensionsData = [];
|
|
168
168
|
if (refundInformation) {
|
|
169
169
|
if (!this.paymentNetwork) {
|
|
@@ -189,7 +189,7 @@ class Request {
|
|
|
189
189
|
* @returns The updated request
|
|
190
190
|
*/
|
|
191
191
|
reduceExpectedAmountRequest(deltaAmount, signerIdentity, paymentInformation) {
|
|
192
|
-
return
|
|
192
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
193
193
|
const extensionsData = [];
|
|
194
194
|
if (paymentInformation) {
|
|
195
195
|
if (!this.paymentNetwork) {
|
|
@@ -214,7 +214,7 @@ class Request {
|
|
|
214
214
|
* @returns The updated request
|
|
215
215
|
*/
|
|
216
216
|
addPaymentInformation(paymentInformation, signerIdentity) {
|
|
217
|
-
return
|
|
217
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
218
218
|
const extensionsData = [];
|
|
219
219
|
if (!this.paymentNetwork) {
|
|
220
220
|
throw new Error('Cannot add payment information without payment network');
|
|
@@ -236,7 +236,7 @@ class Request {
|
|
|
236
236
|
* @returns The updated request
|
|
237
237
|
*/
|
|
238
238
|
addRefundInformation(refundInformation, signerIdentity) {
|
|
239
|
-
return
|
|
239
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
240
240
|
const extensionsData = [];
|
|
241
241
|
if (!this.paymentNetwork) {
|
|
242
242
|
throw new Error('Cannot add refund information without payment network');
|
|
@@ -259,7 +259,7 @@ class Request {
|
|
|
259
259
|
* @returns The updated request
|
|
260
260
|
*/
|
|
261
261
|
declareSentPayment(amount, note, signerIdentity) {
|
|
262
|
-
return
|
|
262
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
263
263
|
const extensionsData = [];
|
|
264
264
|
if (!this.paymentNetwork) {
|
|
265
265
|
throw new Error('Cannot declare sent payment without payment network');
|
|
@@ -290,7 +290,7 @@ class Request {
|
|
|
290
290
|
* @returns The updated request
|
|
291
291
|
*/
|
|
292
292
|
declareSentRefund(amount, note, signerIdentity) {
|
|
293
|
-
return
|
|
293
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
294
294
|
const extensionsData = [];
|
|
295
295
|
if (!this.paymentNetwork) {
|
|
296
296
|
throw new Error('Cannot declare sent refund without payment network');
|
|
@@ -323,7 +323,7 @@ class Request {
|
|
|
323
323
|
* @returns The updated request
|
|
324
324
|
*/
|
|
325
325
|
declareReceivedPayment(amount, note, signerIdentity, txHash, network) {
|
|
326
|
-
return
|
|
326
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
327
327
|
const extensionsData = [];
|
|
328
328
|
if (!this.paymentNetwork) {
|
|
329
329
|
throw new Error('Cannot declare received payment without payment network');
|
|
@@ -358,7 +358,7 @@ class Request {
|
|
|
358
358
|
* @returns The updated request
|
|
359
359
|
*/
|
|
360
360
|
declareReceivedRefund(amount, note, signerIdentity, txHash, network) {
|
|
361
|
-
return
|
|
361
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
362
362
|
const extensionsData = [];
|
|
363
363
|
if (!this.paymentNetwork) {
|
|
364
364
|
throw new Error('Cannot declare received refund without payment network');
|
|
@@ -390,7 +390,7 @@ class Request {
|
|
|
390
390
|
* @returns The updated request
|
|
391
391
|
*/
|
|
392
392
|
addDeclarativeDelegate(delegate, signerIdentity) {
|
|
393
|
-
return
|
|
393
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
394
394
|
const extensionsData = [];
|
|
395
395
|
if (!this.paymentNetwork) {
|
|
396
396
|
throw new Error('Cannot declare delegate without payment network');
|
|
@@ -416,7 +416,7 @@ class Request {
|
|
|
416
416
|
const requestDataPromise = this.refresh();
|
|
417
417
|
if (!this.disableEvents) {
|
|
418
418
|
eventEmitter
|
|
419
|
-
.on('confirmed', () =>
|
|
419
|
+
.on('confirmed', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
420
420
|
try {
|
|
421
421
|
const requestData = yield requestDataPromise;
|
|
422
422
|
requestData.emit('confirmed', yield this.refresh());
|
|
@@ -451,7 +451,7 @@ class Request {
|
|
|
451
451
|
return Object.assign(new events_1.EventEmitter(), Object.assign(Object.assign({}, requestData), { balance: this.balance, contentData: this.contentData, currency: currency ? currency.id : 'unknown', currencyInfo: requestData.currency, meta: this.requestMeta, pending }));
|
|
452
452
|
}
|
|
453
453
|
getEscrowData(paymentReference, network) {
|
|
454
|
-
return
|
|
454
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
455
455
|
const escrowContractAddress = smart_contracts_1.erc20EscrowToPayArtifact.getAddress(network);
|
|
456
456
|
const escrowInfoRetriever = new payment_detection_1.EscrowERC20InfoRetriever(paymentReference, escrowContractAddress, 0, '', '', network);
|
|
457
457
|
return yield escrowInfoRetriever.getEscrowRequestMapping();
|
|
@@ -464,7 +464,7 @@ class Request {
|
|
|
464
464
|
* @returns Refreshed request data
|
|
465
465
|
*/
|
|
466
466
|
refresh(requestAndMeta) {
|
|
467
|
-
return
|
|
467
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
468
468
|
if (this.confirmationErrorOccurredAtCreation) {
|
|
469
469
|
throw Error('request confirmation failed');
|
|
470
470
|
}
|
|
@@ -494,7 +494,7 @@ class Request {
|
|
|
494
494
|
* @returns return the balance
|
|
495
495
|
*/
|
|
496
496
|
refreshBalance() {
|
|
497
|
-
return
|
|
497
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
498
498
|
// TODO: PROT-1131 - add a pending balance
|
|
499
499
|
if (this.paymentNetwork && this.requestData) {
|
|
500
500
|
this.balance = yield this.paymentNetwork.getBalance(this.requestData);
|
package/dist/api/utils.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { RequestLogicTypes } from '@requestnetwork/types';
|
|
2
2
|
import { getCurrentTimestampInSecond } from '@requestnetwork/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Collection of utils functions related to the library, meant to simplify its use.
|
|
5
|
+
*/
|
|
3
6
|
declare const _default: {
|
|
4
7
|
formatGetRequestFromIdError: typeof formatGetRequestFromIdError;
|
|
5
8
|
/**
|
|
@@ -9,9 +12,6 @@ declare const _default: {
|
|
|
9
12
|
*/
|
|
10
13
|
getCurrentTimestampInSecond: typeof getCurrentTimestampInSecond;
|
|
11
14
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Collection of utils functions related to the library, meant to simplify its use.
|
|
14
|
-
*/
|
|
15
15
|
export default _default;
|
|
16
16
|
/**
|
|
17
17
|
* Formats a human readable message from ignored transactions
|
package/dist/api/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;;;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/api/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE;;GAEG;;;IAID;;;;OAIG;;;AAPL,wBASE;AAEF;;;;;GAKG;AACH,iBAAS,2BAA2B,CAClC,cAAc,EAAE,iBAAiB,CAAC,uBAAuB,GACxD,MAAM,CAcR"}
|
package/dist/http-data-access.js
CHANGED
|
@@ -33,7 +33,7 @@ class HttpDataAccess {
|
|
|
33
33
|
* @returns nothing
|
|
34
34
|
*/
|
|
35
35
|
initialize() {
|
|
36
|
-
return
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
// no-op, nothing to do
|
|
38
38
|
return;
|
|
39
39
|
});
|
|
@@ -44,7 +44,7 @@ class HttpDataAccess {
|
|
|
44
44
|
* @returns nothing
|
|
45
45
|
*/
|
|
46
46
|
close() {
|
|
47
|
-
return
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
48
|
// no-op, nothing to do
|
|
49
49
|
return;
|
|
50
50
|
});
|
|
@@ -56,7 +56,7 @@ class HttpDataAccess {
|
|
|
56
56
|
* @param topics The topics used to index the transaction
|
|
57
57
|
*/
|
|
58
58
|
persistTransaction(transactionData, channelId, topics) {
|
|
59
|
-
return
|
|
59
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
60
60
|
// We don't retry this request since it may fail because of a slow Storage
|
|
61
61
|
// For example, if the Ethereum network is slow and we retry the request three times
|
|
62
62
|
// three data will be persisted at the end
|
|
@@ -70,7 +70,7 @@ class HttpDataAccess {
|
|
|
70
70
|
const result = Object.assign(new events_1.EventEmitter(), data);
|
|
71
71
|
// Try to get the confirmation
|
|
72
72
|
new Promise((r) => setTimeout(r, this.httpConfig.getConfirmationDeferDelay))
|
|
73
|
-
.then(() =>
|
|
73
|
+
.then(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const confirmedData = yield this.fetchAndRetry('/getConfirmedTransaction', {
|
|
75
75
|
transactionHash,
|
|
76
76
|
}, {
|
|
@@ -97,7 +97,7 @@ class HttpDataAccess {
|
|
|
97
97
|
* @param timestampBoundaries filter timestamp boundaries
|
|
98
98
|
*/
|
|
99
99
|
getTransactionsByChannelId(channelId, timestampBoundaries) {
|
|
100
|
-
return
|
|
100
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
101
101
|
return this.fetchAndRetry('/getTransactionsByChannelId', { channelId, timestampBoundaries });
|
|
102
102
|
});
|
|
103
103
|
}
|
|
@@ -108,7 +108,7 @@ class HttpDataAccess {
|
|
|
108
108
|
* @param updatedBetween filter timestamp boundaries
|
|
109
109
|
*/
|
|
110
110
|
getChannelsByTopic(topic, updatedBetween) {
|
|
111
|
-
return
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
112
|
return this.fetchAndRetry('/getChannelsByTopic', { topic, updatedBetween });
|
|
113
113
|
});
|
|
114
114
|
}
|
|
@@ -119,7 +119,7 @@ class HttpDataAccess {
|
|
|
119
119
|
* @param updatedBetween filter timestamp boundaries
|
|
120
120
|
*/
|
|
121
121
|
getChannelsByMultipleTopics(topics, updatedBetween) {
|
|
122
|
-
return
|
|
122
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
123
123
|
return this.fetchAndRetry('/getChannelsByMultipleTopics', { topics, updatedBetween });
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -129,7 +129,7 @@ class HttpDataAccess {
|
|
|
129
129
|
* @param detailed if true get the list of files hashes
|
|
130
130
|
*/
|
|
131
131
|
_getStatus(detailed) {
|
|
132
|
-
return
|
|
132
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
133
133
|
return this.fetchAndRetry('/information', { detailed });
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -143,10 +143,10 @@ class HttpDataAccess {
|
|
|
143
143
|
*/
|
|
144
144
|
fetchAndRetry(url, params, retryConfig = {}) {
|
|
145
145
|
var _a, _b;
|
|
146
|
-
return
|
|
146
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
147
147
|
retryConfig.maxRetries = (_a = retryConfig.maxRetries) !== null && _a !== void 0 ? _a : this.httpConfig.httpRequestMaxRetry;
|
|
148
148
|
retryConfig.retryDelay = (_b = retryConfig.retryDelay) !== null && _b !== void 0 ? _b : this.httpConfig.httpRequestRetryDelay;
|
|
149
|
-
const { data } = yield (0, utils_1.retry)(() =>
|
|
149
|
+
const { data } = yield (0, utils_1.retry)(() => tslib_1.__awaiter(this, void 0, void 0, function* () { return axios_1.default.get(url, Object.assign(Object.assign({}, this.axiosConfig), { params })); }), retryConfig)();
|
|
150
150
|
return data;
|
|
151
151
|
});
|
|
152
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-data-access.js","sourceRoot":"","sources":["../src/http-data-access.ts"],"names":[],"mappings":";;;AACA,iCAAkD;AAElD,mCAAsC;AACtC,iEAAwD;AACxD,iDAAsE;AAEtE,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAqB,cAAc;IAajC;;;;OAIG;IACH,YACE,EACE,UAAU,EACV,o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C;KAAA;IAED;;;;;;;OAOG;IACa,aAAa,CAC3B,GAAW,EACX,MAAW,EACX,cAGI,EAAE;;;YAEN,WAAW,CAAC,UAAU,GAAG,MAAA,WAAW,CAAC,UAAU,mCAAI,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;YACvF,WAAW,CAAC,UAAU,GAAG,MAAA,WAAW,CAAC,UAAU,mCAAI,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC;YACzF,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,aAAK,EAC1B,GAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"http-data-access.js","sourceRoot":"","sources":["../src/http-data-access.ts"],"names":[],"mappings":";;;AACA,iCAAkD;AAElD,mCAAsC;AACtC,iEAAwD;AACxD,iDAAsE;AAEtE,8DAA8D;AAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAqB,cAAc;IAajC;;;;OAIG;IACH,YACE,EACE,UAAU,EACV,oBAAoB,MAIlB;QACF,UAAU,EAAE,EAAE;QACd,oBAAoB,EAAE,EAAE;KACzB;QAED,qDAAqD;QACrD,MAAM,oBAAoB,GAAG,WAAW,CAAC,OAAO,CAAC;QACjD,IAAI,CAAC,UAAU,mCACV,8BAAkB,GAClB,UAAU,CACd,CAAC;QACF,IAAI,CAAC,WAAW,mBACd,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE;gBACP,CAAC,IAAI,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,oBAAoB;aACnE,IACE,oBAAoB,CACxB,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACU,UAAU;;YACrB,uBAAuB;YACvB,OAAO;QACT,CAAC;KAAA;IAED;;;;OAIG;IACU,KAAK;;YAChB,uBAAuB;YACvB,OAAO;QACT,CAAC;KAAA;IAED;;;;;OAKG;IACU,kBAAkB,CAC7B,eAA6C,EAC7C,SAAiB,EACjB,MAAiB;;YAEjB,0EA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default {
|
|
|
41
41
|
* @returns nothing
|
|
42
42
|
*/
|
|
43
43
|
initialize() {
|
|
44
|
-
return
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
// no-op, nothing to do
|
|
46
46
|
return;
|
|
47
47
|
});
|
|
@@ -53,7 +53,7 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
53
53
|
* @param topics The topics used to index the transaction
|
|
54
54
|
*/
|
|
55
55
|
persistTransaction(transactionData, channelId, topics) {
|
|
56
|
-
return
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
57
|
if (!this.submitterContract) {
|
|
58
58
|
const network = yield this.provider.getNetwork();
|
|
59
59
|
this.networkName =
|
|
@@ -133,8 +133,8 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
133
133
|
* @param timestampBoundaries filter timestamp boundaries
|
|
134
134
|
*/
|
|
135
135
|
getTransactionsByChannelId(channelId, timestampBoundaries) {
|
|
136
|
-
return
|
|
137
|
-
const { data } = yield (0, utils_1.retry)(() =>
|
|
136
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
const { data } = yield (0, utils_1.retry)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
138
|
return axios_1.default.get('/getTransactionsByChannelId', Object.assign(this.axiosConfig, {
|
|
139
139
|
params: { channelId, timestampBoundaries },
|
|
140
140
|
}));
|
package/dist/mock-storage.js
CHANGED
|
@@ -15,12 +15,12 @@ class MockStorage {
|
|
|
15
15
|
this.forceEmitError = false;
|
|
16
16
|
}
|
|
17
17
|
initialize() {
|
|
18
|
-
return
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
return;
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
ipfsAdd(content) {
|
|
23
|
-
return
|
|
23
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
if (!content) {
|
|
25
25
|
throw Error('Error: no content provided');
|
|
26
26
|
}
|
|
@@ -38,7 +38,7 @@ class MockStorage {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
append(content) {
|
|
41
|
-
return
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
if (!content) {
|
|
43
43
|
throw Error('Error: no content provided');
|
|
44
44
|
}
|
|
@@ -78,7 +78,7 @@ class MockStorage {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
read(id) {
|
|
81
|
-
return
|
|
81
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
82
82
|
if (!id) {
|
|
83
83
|
throw Error('No id provided');
|
|
84
84
|
}
|
|
@@ -98,12 +98,12 @@ class MockStorage {
|
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
readMany(ids) {
|
|
101
|
-
return
|
|
101
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
return Promise.all(ids.map((id) => this.read(id)));
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
105
|
getData() {
|
|
106
|
-
return
|
|
106
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
const entries = Array.from(this.data.entries()).map(([id, { content, state, timestamp }]) => ({
|
|
108
108
|
content,
|
|
109
109
|
id,
|
|
@@ -121,7 +121,7 @@ class MockStorage {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
getIgnoredData() {
|
|
124
|
-
return
|
|
124
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
125
125
|
return [];
|
|
126
126
|
});
|
|
127
127
|
}
|
|
@@ -131,7 +131,7 @@ class MockStorage {
|
|
|
131
131
|
* @param detailed if true get the list of files hash
|
|
132
132
|
*/
|
|
133
133
|
_getStatus(detailed) {
|
|
134
|
-
return
|
|
134
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
135
135
|
return {
|
|
136
136
|
dataIds: {
|
|
137
137
|
count: Object.entries(this.data).length,
|