@requestnetwork/request-client.js 0.30.1-next.1351 → 0.30.1-next.710
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/README.md +9 -13
- package/dist/api/content-data-extension.js +3 -3
- package/dist/api/content-data-extension.js.map +1 -1
- package/dist/api/request-network.d.ts +50 -15
- package/dist/api/request-network.d.ts.map +1 -1
- package/dist/api/request-network.js +187 -87
- package/dist/api/request-network.js.map +1 -1
- package/dist/api/request.d.ts +55 -6
- package/dist/api/request.d.ts.map +1 -1
- package/dist/api/request.js +171 -149
- package/dist/api/request.js.map +1 -1
- package/dist/api/utils.d.ts +5 -6
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/api/utils.js +1 -3
- package/dist/api/utils.js.map +1 -1
- package/dist/http-config-defaults.d.ts +4 -0
- package/dist/http-config-defaults.d.ts.map +1 -0
- package/dist/http-config-defaults.js +16 -0
- package/dist/http-config-defaults.js.map +1 -0
- package/dist/http-data-access.d.ts +40 -9
- package/dist/http-data-access.d.ts.map +1 -1
- package/dist/http-data-access.js +113 -95
- package/dist/http-data-access.js.map +1 -1
- package/dist/http-metamask-data-access.d.ts +7 -7
- package/dist/http-metamask-data-access.d.ts.map +1 -1
- package/dist/http-metamask-data-access.js +57 -61
- package/dist/http-metamask-data-access.js.map +1 -1
- package/dist/http-request-network.d.ts +15 -15
- package/dist/http-request-network.d.ts.map +1 -1
- package/dist/http-request-network.js +23 -25
- package/dist/http-request-network.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/mock-storage.d.ts +2 -5
- package/dist/mock-storage.d.ts.map +1 -1
- package/dist/mock-storage.js +24 -77
- package/dist/mock-storage.js.map +1 -1
- package/dist/no-persist-http-data-access.d.ts +10 -0
- package/dist/no-persist-http-data-access.d.ts.map +1 -0
- package/dist/no-persist-http-data-access.js +36 -0
- package/dist/no-persist-http-data-access.js.map +1 -0
- package/dist/report.html +9 -24
- package/dist/requestnetwork.min.js +441 -1
- package/dist/requestnetwork.min.js.LICENSE.txt +11 -24
- package/dist/requestnetwork.min.js.map +1 -1
- package/dist/types.js +2 -11
- package/dist/types.js.map +1 -1
- package/package.json +32 -43
- package/CHANGELOG.md +0 -2077
- package/dist/api/currency/erc20/celo.d.ts +0 -14
- package/dist/api/currency/erc20/celo.d.ts.map +0 -1
- package/dist/api/currency/erc20/celo.js +0 -26
- package/dist/api/currency/erc20/celo.js.map +0 -1
- package/dist/api/currency/erc20/networks.d.ts +0 -25
- package/dist/api/currency/erc20/networks.d.ts.map +0 -1
- package/dist/api/currency/erc20/networks.js +0 -14
- package/dist/api/currency/erc20/networks.js.map +0 -1
- package/dist/api/currency/erc20/rinkeby.d.ts +0 -19
- package/dist/api/currency/erc20/rinkeby.d.ts.map +0 -1
- package/dist/api/currency/erc20/rinkeby.js +0 -43
- package/dist/api/currency/erc20/rinkeby.js.map +0 -1
- package/dist/api/currency/erc20.d.ts +0 -62
- package/dist/api/currency/erc20.d.ts.map +0 -1
- package/dist/api/currency/erc20.js +0 -136
- package/dist/api/currency/erc20.js.map +0 -1
- package/dist/api/currency.d.ts +0 -45
- package/dist/api/currency.d.ts.map +0 -1
- package/dist/api/currency.js +0 -162
- package/dist/api/currency.js.map +0 -1
- package/dist/mock-data-access.d.ts +0 -11
- package/dist/mock-data-access.d.ts.map +0 -1
- package/dist/mock-data-access.js +0 -16
- package/dist/mock-data-access.js.map +0 -1
|
@@ -1,48 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
12
4
|
const data_access_1 = require("@requestnetwork/data-access");
|
|
13
5
|
const smart_contracts_1 = require("@requestnetwork/smart-contracts");
|
|
14
6
|
const types_1 = require("@requestnetwork/types");
|
|
15
|
-
const utils_1 = require("@requestnetwork/utils");
|
|
16
|
-
const axios_1 = require("axios");
|
|
17
7
|
const ethers_1 = require("ethers");
|
|
18
8
|
const events_1 = require("events");
|
|
19
9
|
const http_data_access_1 = require("./http-data-access");
|
|
20
|
-
// Maximum number of retries to attempt when http requests to the Node fail
|
|
21
|
-
const HTTP_REQUEST_MAX_RETRY = 3;
|
|
22
|
-
// Delay between retry in ms
|
|
23
|
-
const HTTP_REQUEST_RETRY_DELAY = 100;
|
|
24
10
|
/**
|
|
25
11
|
* Exposes a Data-Access module over HTTP
|
|
26
12
|
*/
|
|
27
13
|
class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
28
14
|
/**
|
|
29
15
|
* Creates an instance of HttpDataAccess.
|
|
30
|
-
* @param
|
|
16
|
+
* @param httpConfig Http config that will be used by the underlying http-data-access. @see ClientTypes.IHttpDataAccessConfig
|
|
17
|
+
* @param nodeConnectionConfig Configuration options to connect to the node.
|
|
31
18
|
*/
|
|
32
|
-
constructor({ nodeConnectionConfig, web3, ethereumProviderUrl, } = {
|
|
33
|
-
|
|
19
|
+
constructor({ httpConfig, nodeConnectionConfig, web3, ethereumProviderUrl, } = {
|
|
20
|
+
httpConfig: {},
|
|
34
21
|
}) {
|
|
35
|
-
super(nodeConnectionConfig);
|
|
22
|
+
super({ httpConfig, nodeConnectionConfig });
|
|
36
23
|
/**
|
|
37
24
|
* Cache block persisted directly (in case the node did not have the time to retrieve it)
|
|
38
25
|
* (public for easier testing)
|
|
39
26
|
*/
|
|
40
27
|
this.cache = {};
|
|
41
|
-
this.networkName = '';
|
|
28
|
+
this.networkName = 'private';
|
|
42
29
|
ethereumProviderUrl = ethereumProviderUrl ? ethereumProviderUrl : 'http://localhost:8545';
|
|
43
30
|
// Creates a local or default provider
|
|
44
31
|
this.provider = web3
|
|
45
|
-
? new ethers_1.ethers.providers.Web3Provider(web3
|
|
32
|
+
? new ethers_1.ethers.providers.Web3Provider(web3)
|
|
46
33
|
: new ethers_1.ethers.providers.JsonRpcProvider({ url: ethereumProviderUrl });
|
|
47
34
|
}
|
|
48
35
|
/**
|
|
@@ -51,7 +38,7 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
51
38
|
* @returns nothing
|
|
52
39
|
*/
|
|
53
40
|
initialize() {
|
|
54
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
42
|
// no-op, nothing to do
|
|
56
43
|
return;
|
|
57
44
|
});
|
|
@@ -63,33 +50,34 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
63
50
|
* @param topics The topics used to index the transaction
|
|
64
51
|
*/
|
|
65
52
|
persistTransaction(transactionData, channelId, topics) {
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
var _a, _b, _c;
|
|
54
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
if (!this.networkName) {
|
|
68
56
|
const network = yield this.provider.getNetwork();
|
|
69
57
|
this.networkName =
|
|
70
58
|
network.chainId === 1 ? 'mainnet' : network.chainId === 4 ? 'rinkeby' : 'private';
|
|
71
|
-
this.submitterContract = new ethers_1.ethers.Contract(smart_contracts_1.requestHashSubmitterArtifact.getAddress(this.networkName), smart_contracts_1.requestHashSubmitterArtifact.getContractAbi(), this.provider.getSigner());
|
|
72
59
|
}
|
|
60
|
+
const submitterContract = smart_contracts_1.requestHashSubmitterArtifact.connect(this.networkName, this.provider.getSigner());
|
|
73
61
|
// We don't use the node to persist the transaction, but we will Do it ourselves
|
|
74
62
|
// create a block and add the transaction in it
|
|
75
63
|
const block = data_access_1.Block.pushTransaction(data_access_1.Block.createEmptyBlock(), transactionData, channelId, topics);
|
|
76
64
|
// store the block on ipfs and get the the ipfs hash and size
|
|
77
|
-
const {
|
|
65
|
+
const { ipfsHash, ipfsSize } = yield this.fetch('POST', '/ipfsAdd', { data: block });
|
|
78
66
|
// get the fee required to submit the hash
|
|
79
|
-
const fee = yield
|
|
67
|
+
const fee = yield submitterContract.getFeesAmount(ipfsSize);
|
|
80
68
|
// submit the hash to ethereum
|
|
81
|
-
const tx = yield
|
|
82
|
-
|
|
69
|
+
const tx = yield submitterContract.submitHash(ipfsHash,
|
|
70
|
+
/* eslint-disable no-magic-numbers */
|
|
83
71
|
ethers_1.ethers.utils.hexZeroPad(ethers_1.ethers.utils.hexlify(ipfsSize), 32), { value: fee });
|
|
84
|
-
const ethBlock = yield this.provider.getBlock(tx.blockNumber);
|
|
72
|
+
const ethBlock = yield this.provider.getBlock((_a = tx.blockNumber) !== null && _a !== void 0 ? _a : -1);
|
|
85
73
|
// create the storage meta from the transaction receipt
|
|
86
74
|
const storageMeta = {
|
|
87
75
|
blockConfirmation: tx.confirmations,
|
|
88
|
-
blockNumber: tx.blockNumber,
|
|
76
|
+
blockNumber: (_b = tx.blockNumber) !== null && _b !== void 0 ? _b : -1,
|
|
89
77
|
blockTimestamp: ethBlock.timestamp,
|
|
90
|
-
fee,
|
|
78
|
+
fee: fee.toString(),
|
|
91
79
|
networkName: this.networkName,
|
|
92
|
-
smartContractAddress: tx.to,
|
|
80
|
+
smartContractAddress: (_c = tx.to) !== null && _c !== void 0 ? _c : '',
|
|
93
81
|
transactionHash: tx.hash,
|
|
94
82
|
};
|
|
95
83
|
// Add the block to the cache
|
|
@@ -97,37 +85,45 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
97
85
|
this.cache[channelId] = {};
|
|
98
86
|
}
|
|
99
87
|
this.cache[channelId][ipfsHash] = { block, storageMeta };
|
|
100
|
-
const
|
|
88
|
+
const eventEmitter = new events_1.EventEmitter();
|
|
89
|
+
const result = {
|
|
101
90
|
meta: {
|
|
102
|
-
storageMeta
|
|
91
|
+
storageMeta: {
|
|
92
|
+
ethereum: storageMeta,
|
|
93
|
+
ipfs: { size: ipfsSize },
|
|
94
|
+
state: types_1.StorageTypes.ContentState.PENDING,
|
|
95
|
+
timestamp: storageMeta.blockTimestamp,
|
|
96
|
+
},
|
|
103
97
|
topics: topics || [],
|
|
104
98
|
transactionStorageLocation: ipfsHash,
|
|
105
99
|
},
|
|
106
100
|
result: {},
|
|
107
|
-
}
|
|
101
|
+
};
|
|
108
102
|
// When the ethereum transaction is mined, emit an event 'confirmed'
|
|
109
|
-
tx.wait().then((txConfirmed) => {
|
|
110
|
-
// create the storage meta from the transaction receipt
|
|
111
|
-
const storageMetaConfirmed = {
|
|
112
|
-
blockConfirmation: txConfirmed.confirmations,
|
|
113
|
-
blockNumber: txConfirmed.blockNumber,
|
|
114
|
-
blockTimestamp: ethBlock.timestamp,
|
|
115
|
-
fee,
|
|
116
|
-
networkName: this.networkName,
|
|
117
|
-
smartContractAddress: txConfirmed.to,
|
|
118
|
-
transactionHash: txConfirmed.hash,
|
|
119
|
-
};
|
|
103
|
+
void tx.wait().then((txConfirmed) => {
|
|
120
104
|
// emit the event to tell the request transaction is confirmed
|
|
121
|
-
|
|
105
|
+
eventEmitter.emit('confirmed', {
|
|
122
106
|
meta: {
|
|
123
|
-
storageMeta:
|
|
107
|
+
storageMeta: {
|
|
108
|
+
ethereum: {
|
|
109
|
+
blockConfirmation: txConfirmed.confirmations,
|
|
110
|
+
blockNumber: txConfirmed.blockNumber,
|
|
111
|
+
blockTimestamp: ethBlock.timestamp,
|
|
112
|
+
fee: fee.toString(),
|
|
113
|
+
networkName: this.networkName,
|
|
114
|
+
smartContractAddress: txConfirmed.to,
|
|
115
|
+
transactionHash: txConfirmed.transactionHash,
|
|
116
|
+
},
|
|
117
|
+
state: types_1.StorageTypes.ContentState.CONFIRMED,
|
|
118
|
+
timestamp: ethBlock.timestamp,
|
|
119
|
+
},
|
|
124
120
|
topics: topics || [],
|
|
125
121
|
transactionStorageLocation: ipfsHash,
|
|
126
122
|
},
|
|
127
123
|
result: {},
|
|
128
124
|
});
|
|
129
125
|
});
|
|
130
|
-
return result;
|
|
126
|
+
return Object.assign(eventEmitter, result);
|
|
131
127
|
});
|
|
132
128
|
}
|
|
133
129
|
/**
|
|
@@ -137,21 +133,20 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
137
133
|
* @param timestampBoundaries filter timestamp boundaries
|
|
138
134
|
*/
|
|
139
135
|
getTransactionsByChannelId(channelId, timestampBoundaries) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
})();
|
|
136
|
+
var _a, _b, _c;
|
|
137
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
const data = yield this.fetchAndRetry('/getTransactionsByChannelId', {
|
|
139
|
+
params: { channelId, timestampBoundaries },
|
|
140
|
+
}, {
|
|
141
|
+
maxRetries: this.httpConfig.httpRequestMaxRetry,
|
|
142
|
+
retryDelay: this.httpConfig.httpRequestRetryDelay,
|
|
143
|
+
});
|
|
149
144
|
// get the transactions from the cache
|
|
150
145
|
const transactionsCached = this.getCachedTransactionsAndCleanCache(channelId, data.meta.transactionsStorageLocation, timestampBoundaries);
|
|
151
146
|
// merge cache and data from the node
|
|
152
147
|
return {
|
|
153
148
|
meta: {
|
|
154
|
-
storageMeta: data.meta.storageMeta.concat(transactionsCached.meta.storageMeta),
|
|
149
|
+
storageMeta: (_c = (_a = data.meta.storageMeta) === null || _a === void 0 ? void 0 : _a.concat((_b = transactionsCached.meta.storageMeta) !== null && _b !== void 0 ? _b : [])) !== null && _c !== void 0 ? _c : [],
|
|
155
150
|
transactionsStorageLocation: data.meta.transactionsStorageLocation.concat(transactionsCached.meta.transactionsStorageLocation),
|
|
156
151
|
},
|
|
157
152
|
result: {
|
|
@@ -175,6 +170,7 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
175
170
|
}
|
|
176
171
|
// Create a IReturnGetTransactions object to be merged later with the one from the node
|
|
177
172
|
return Object.keys(this.cache[channelId] || []).reduce((accumulator, location) => {
|
|
173
|
+
var _a;
|
|
178
174
|
const cache = this.cache[channelId][location];
|
|
179
175
|
// For each cached block for the channel, we return the transaction if they are in the time boundaries
|
|
180
176
|
if (this.cache[channelId][location] &&
|
|
@@ -183,7 +179,7 @@ class HttpMetaMaskDataAccess extends http_data_access_1.default {
|
|
|
183
179
|
timestampBoundaries.from <= (cache === null || cache === void 0 ? void 0 : cache.storageMeta.blockTimestamp)) &&
|
|
184
180
|
(timestampBoundaries.to === undefined ||
|
|
185
181
|
timestampBoundaries.to >= (cache === null || cache === void 0 ? void 0 : cache.storageMeta.blockTimestamp))))) {
|
|
186
|
-
accumulator.meta.storageMeta.push(cache === null || cache === void 0 ? void 0 : cache.storageMeta);
|
|
182
|
+
(_a = accumulator.meta.storageMeta) === null || _a === void 0 ? void 0 : _a.push(cache === null || cache === void 0 ? void 0 : cache.storageMeta);
|
|
187
183
|
accumulator.meta.transactionsStorageLocation.push(location);
|
|
188
184
|
// cache?.block.transactions will always contain one transaction
|
|
189
185
|
accumulator.result.transactions.push({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-metamask-data-access.js","sourceRoot":"","sources":["../src/http-metamask-data-access.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-metamask-data-access.js","sourceRoot":"","sources":["../src/http-metamask-data-access.ts"],"names":[],"mappings":";;;AAAA,6DAAoD;AACpD,qEAA+E;AAC/E,iDAAkG;AAClG,mCAAgC;AAChC,mCAAsC;AAC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ACD,OAAO,WAAW,CAAC;QACrB,CAAC,EACD;YACE,IAAI,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,2BAA2B,EAAE,EAAE,EAAE;YAC1D,MAAM,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE;SAC7B,CACF,CAAC;IACJ,CAAC;CACF;AAjQD,yCAiQC"}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { DecryptionProviderTypes, SignatureProviderTypes } from '@requestnetwork/types';
|
|
2
|
-
import {
|
|
1
|
+
import { ClientTypes, CurrencyTypes, DecryptionProviderTypes, SignatureProviderTypes } from '@requestnetwork/types';
|
|
2
|
+
import { PaymentNetworkOptions } from '@requestnetwork/payment-detection';
|
|
3
3
|
import RequestNetwork from './api/request-network';
|
|
4
|
-
import
|
|
4
|
+
import { NodeConnectionConfig } from './http-data-access';
|
|
5
5
|
/**
|
|
6
6
|
* Exposes RequestNetwork module configured to use http-data-access.
|
|
7
7
|
*/
|
|
8
8
|
export default class HttpRequestNetwork extends RequestNetwork {
|
|
9
|
-
/** Public for test purpose */
|
|
10
|
-
_mockStorage: MockStorage | undefined;
|
|
11
9
|
/**
|
|
12
10
|
* Creates an instance of HttpRequestNetwork.
|
|
13
11
|
*
|
|
14
|
-
* @param options.
|
|
15
|
-
* @param options.
|
|
12
|
+
* @param options.httpConfig Http config that will be used by the underlying data-access. @see ClientTypes.IHttpDataAccessConfig for available options.
|
|
13
|
+
* @param options.nodeConnectionConfig Configuration options to connect to the node.
|
|
14
|
+
* @param options.useMockStorage When true, will use a mock storage in memory. Meant to simplify local development and should never be used in production. Overrides `skipPersistence` when both are true.
|
|
16
15
|
* @param options.signatureProvider Module to handle the signature. If not given it will be impossible to create new transaction (it requires to sign).
|
|
17
|
-
* @param options.
|
|
18
|
-
* @param options.
|
|
19
|
-
*
|
|
16
|
+
* @param options.currencies custom currency list.
|
|
17
|
+
* @param options.currencyManager custom currency manager (will override `currencies`).
|
|
18
|
+
* @param options.skipPersistence allows creating a transaction without immediate persistence.
|
|
20
19
|
*/
|
|
21
|
-
constructor({ decryptionProvider,
|
|
20
|
+
constructor({ decryptionProvider, httpConfig, nodeConnectionConfig, signatureProvider, useMockStorage, currencyManager, paymentOptions, skipPersistence, }?: {
|
|
22
21
|
decryptionProvider?: DecryptionProviderTypes.IDecryptionProvider;
|
|
23
|
-
|
|
22
|
+
httpConfig?: Partial<ClientTypes.IHttpDataAccessConfig>;
|
|
23
|
+
nodeConnectionConfig?: Partial<NodeConnectionConfig>;
|
|
24
24
|
signatureProvider?: SignatureProviderTypes.ISignatureProvider;
|
|
25
25
|
useMockStorage?: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
currencyManager?: CurrencyTypes.ICurrencyManager;
|
|
27
|
+
paymentOptions?: Partial<PaymentNetworkOptions>;
|
|
28
|
+
skipPersistence?: boolean;
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=http-request-network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request-network.d.ts","sourceRoot":"","sources":["../src/http-request-network.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"http-request-network.d.ts","sourceRoot":"","sources":["../src/http-request-network.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,aAAa,EAEb,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,cAAc,MAAM,uBAAuB,CAAC;AACnD,OAAuB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAK1E;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,cAAc;IAC5D;;;;;;;;;;OAUG;gBAED,EACE,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,GAChB,GAAE;QACD,kBAAkB,CAAC,EAAE,uBAAuB,CAAC,mBAAmB,CAAC;QACjE,UAAU,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;QACxD,oBAAoB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACrD,iBAAiB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC;QAC9D,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,eAAe,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC;QACjD,cAAc,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAChD,eAAe,CAAC,EAAE,OAAO,CAAC;KAK3B;CAiBJ"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const currency_1 = require("@requestnetwork/currency");
|
|
3
4
|
const request_network_1 = require("./api/request-network");
|
|
4
5
|
const http_data_access_1 = require("./http-data-access");
|
|
5
|
-
const
|
|
6
|
-
const mock_data_access_1 = require("./mock-data-access");
|
|
6
|
+
const data_access_1 = require("@requestnetwork/data-access");
|
|
7
7
|
const mock_storage_1 = require("./mock-storage");
|
|
8
|
+
const no_persist_http_data_access_1 = require("./no-persist-http-data-access");
|
|
8
9
|
/**
|
|
9
10
|
* Exposes RequestNetwork module configured to use http-data-access.
|
|
10
11
|
*/
|
|
@@ -12,34 +13,31 @@ class HttpRequestNetwork extends request_network_1.default {
|
|
|
12
13
|
/**
|
|
13
14
|
* Creates an instance of HttpRequestNetwork.
|
|
14
15
|
*
|
|
15
|
-
* @param options.
|
|
16
|
-
* @param options.
|
|
16
|
+
* @param options.httpConfig Http config that will be used by the underlying data-access. @see ClientTypes.IHttpDataAccessConfig for available options.
|
|
17
|
+
* @param options.nodeConnectionConfig Configuration options to connect to the node.
|
|
18
|
+
* @param options.useMockStorage When true, will use a mock storage in memory. Meant to simplify local development and should never be used in production. Overrides `skipPersistence` when both are true.
|
|
17
19
|
* @param options.signatureProvider Module to handle the signature. If not given it will be impossible to create new transaction (it requires to sign).
|
|
18
|
-
* @param options.
|
|
19
|
-
* @param options.
|
|
20
|
-
*
|
|
20
|
+
* @param options.currencies custom currency list.
|
|
21
|
+
* @param options.currencyManager custom currency manager (will override `currencies`).
|
|
22
|
+
* @param options.skipPersistence allows creating a transaction without immediate persistence.
|
|
21
23
|
*/
|
|
22
|
-
constructor({ decryptionProvider,
|
|
23
|
-
|
|
24
|
-
useLocalEthereumBroadcast: false,
|
|
24
|
+
constructor({ decryptionProvider, httpConfig, nodeConnectionConfig, signatureProvider, useMockStorage, currencyManager, paymentOptions, skipPersistence, } = {
|
|
25
|
+
httpConfig: {},
|
|
25
26
|
useMockStorage: false,
|
|
27
|
+
skipPersistence: false,
|
|
26
28
|
}) {
|
|
27
|
-
let _mockStorage;
|
|
28
|
-
if (useMockStorage) {
|
|
29
|
-
_mockStorage = new mock_storage_1.default();
|
|
30
|
-
}
|
|
31
29
|
const dataAccess = useMockStorage
|
|
32
|
-
?
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
? new data_access_1.MockDataAccess(new mock_storage_1.MockStorage())
|
|
31
|
+
: skipPersistence
|
|
32
|
+
? new no_persist_http_data_access_1.NoPersistHttpDataAccess({
|
|
33
|
+
httpConfig,
|
|
34
|
+
nodeConnectionConfig,
|
|
35
|
+
})
|
|
36
|
+
: new http_data_access_1.default({ httpConfig, nodeConnectionConfig });
|
|
37
|
+
if (!currencyManager) {
|
|
38
|
+
currencyManager = currency_1.CurrencyManager.getDefault();
|
|
39
|
+
}
|
|
40
|
+
super({ dataAccess, signatureProvider, decryptionProvider, currencyManager, paymentOptions });
|
|
43
41
|
}
|
|
44
42
|
}
|
|
45
43
|
exports.default = HttpRequestNetwork;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-request-network.js","sourceRoot":"","sources":["../src/http-request-network.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"http-request-network.js","sourceRoot":"","sources":["../src/http-request-network.ts"],"names":[],"mappings":";;AAAA,uDAA2D;AAS3D,2DAAmD;AACnD,yDAA0E;AAC1E,6DAA6D;AAC7D,iDAA6C;AAC7C,+EAAwE;AAExE;;GAEG;AACH,MAAqB,kBAAmB,SAAQ,yBAAc;IAC5D;;;;;;;;;;OAUG;IACH,YACE,EACE,kBAAkB,EAClB,UAAU,EACV,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,MAUb;QACF,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,KAAK;QACrB,eAAe,EAAE,KAAK;KACvB;QAED,MAAM,UAAU,GAAgC,cAAc;YAC5D,CAAC,CAAC,IAAI,4BAAc,CAAC,IAAI,0BAAW,EAAE,CAAC;YACvC,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,IAAI,qDAAuB,CAAC;oBAC1B,UAAU;oBACV,oBAAoB;iBACrB,CAAC;gBACJ,CAAC,CAAC,IAAI,0BAAc,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC,CAAC;QAE7D,IAAI,CAAC,eAAe,EAAE;YACpB,eAAe,GAAG,0BAAe,CAAC,UAAU,EAAE,CAAC;SAChD;QAED,KAAK,CAAC,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC,CAAC;IAChG,CAAC;CACF;AApDD,qCAoDC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { PaymentReferenceCalculator } from '@requestnetwork/payment-detection';
|
|
2
|
-
import Currency from './api/currency';
|
|
3
2
|
import Request from './api/request';
|
|
4
3
|
import Utils from './api/utils';
|
|
5
4
|
import { default as RequestNetwork } from './http-request-network';
|
|
5
|
+
import { default as RequestNetworkBase } from './api/request-network';
|
|
6
|
+
import { default as HttpMetaMaskDataAccess } from './http-metamask-data-access';
|
|
6
7
|
import * as Types from './types';
|
|
7
|
-
export {
|
|
8
|
+
export { PaymentReferenceCalculator, Request, RequestNetwork, RequestNetworkBase, HttpMetaMaskDataAccess, Types, Utils, };
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAE/E,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EACL,0BAA0B,EAC1B,OAAO,EACP,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,EACL,KAAK,GACN,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Utils = exports.Types = exports.
|
|
3
|
+
exports.Utils = exports.Types = exports.HttpMetaMaskDataAccess = exports.RequestNetworkBase = exports.RequestNetwork = exports.Request = exports.PaymentReferenceCalculator = void 0;
|
|
4
4
|
const payment_detection_1 = require("@requestnetwork/payment-detection");
|
|
5
5
|
Object.defineProperty(exports, "PaymentReferenceCalculator", { enumerable: true, get: function () { return payment_detection_1.PaymentReferenceCalculator; } });
|
|
6
|
-
const currency_1 = require("./api/currency");
|
|
7
|
-
exports.Currency = currency_1.default;
|
|
8
6
|
const request_1 = require("./api/request");
|
|
9
7
|
exports.Request = request_1.default;
|
|
10
8
|
const utils_1 = require("./api/utils");
|
|
11
9
|
exports.Utils = utils_1.default;
|
|
12
10
|
const http_request_network_1 = require("./http-request-network");
|
|
13
11
|
Object.defineProperty(exports, "RequestNetwork", { enumerable: true, get: function () { return http_request_network_1.default; } });
|
|
12
|
+
const request_network_1 = require("./api/request-network");
|
|
13
|
+
Object.defineProperty(exports, "RequestNetworkBase", { enumerable: true, get: function () { return request_network_1.default; } });
|
|
14
|
+
const http_metamask_data_access_1 = require("./http-metamask-data-access");
|
|
15
|
+
Object.defineProperty(exports, "HttpMetaMaskDataAccess", { enumerable: true, get: function () { return http_metamask_data_access_1.default; } });
|
|
14
16
|
const Types = require("./types");
|
|
15
17
|
exports.Types = Types;
|
|
16
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yEAA+E;AAU7E,2GAVO,8CAA0B,OAUP;AAR5B,2CAAoC;AASlC,kBATK,iBAAO,CASL;AART,uCAAgC;AAa9B,gBAbK,eAAK,CAaL;AAZP,iEAAmE;AAQjE,+FARkB,8BAAc,OAQlB;AAPhB,2DAAsE;AAQpE,mGARkB,yBAAkB,OAQlB;AAPpB,2EAAgF;AAQ9E,uGARkB,mCAAsB,OAQlB;AAPxB,iCAAiC;AAQ/B,sBAAK"}
|
package/dist/mock-storage.d.ts
CHANGED
|
@@ -2,22 +2,19 @@ import { StorageTypes } from '@requestnetwork/types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Storage layer implemented with in-memory hashmap, to be used for testing.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export declare class MockStorage implements StorageTypes.IStorage {
|
|
6
6
|
private data;
|
|
7
7
|
private forceEmitError;
|
|
8
8
|
initialize(): Promise<void>;
|
|
9
|
-
_ipfsAdd(content: string): Promise<StorageTypes.IIpfsMeta>;
|
|
10
9
|
append(content: string): Promise<StorageTypes.IAppendResult>;
|
|
11
10
|
read(id: string): Promise<StorageTypes.IEntry>;
|
|
12
11
|
readMany(ids: string[]): Promise<StorageTypes.IEntry[]>;
|
|
13
12
|
getData(): Promise<StorageTypes.IEntriesWithLastTimestamp>;
|
|
14
|
-
getIgnoredData(): Promise<StorageTypes.IEntry[]>;
|
|
15
13
|
/**
|
|
16
14
|
* Gets information
|
|
17
15
|
*
|
|
18
|
-
* @param detailed if true get the list of files hash
|
|
19
16
|
*/
|
|
20
|
-
_getStatus(
|
|
17
|
+
_getStatus(): Promise<any>;
|
|
21
18
|
_makeNextAppendFailInsteadOfConfirmed(): void;
|
|
22
19
|
}
|
|
23
20
|
//# sourceMappingURL=mock-storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-storage.d.ts","sourceRoot":"","sources":["../src/mock-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"mock-storage.d.ts","sourceRoot":"","sources":["../src/mock-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIrD;;GAEG;AACH,qBAAa,WAAY,YAAW,YAAY,CAAC,QAAQ;IACvD,OAAO,CAAC,IAAI,CAA+C;IAG3D,OAAO,CAAC,cAAc,CAAS;IAElB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC;IAwC5D,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC;IAW9C,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IAIvD,OAAO,IAAI,OAAO,CAAC,YAAY,CAAC,yBAAyB,CAAC;IAWvE;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAahC,qCAAqC,IAAI,IAAI;CAGrD"}
|