rocketh 0.4.41 → 0.5.2
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/.prettierignore +3 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +13 -0
- package/README.md +1 -21
- package/dist/chunk-INGRKRCC.js +648 -0
- package/dist/chunk-INGRKRCC.js.map +1 -0
- package/dist/cli.cjs +697 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +66 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +684 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +186 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -20
- package/src/cli.ts +37 -0
- package/src/environment/deployments.ts +79 -0
- package/src/environment/index.ts +392 -0
- package/src/environment/types.ts +158 -0
- package/src/executor/index.ts +302 -0
- package/src/executor/types.ts +42 -0
- package/src/index.ts +5 -0
- package/src/internal/types.ts +6 -0
- package/src/utils/fs.ts +70 -0
- package/src/utils/json.ts +26 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +5 -0
- package/.gitattributes +0 -1
- package/bitski_subprovider.js +0 -148
- package/geth_test_server.js +0 -194
- package/index.js +0 -424
- package/provider.js +0 -58
- package/providerengine.js +0 -128
- package/run.js +0 -1575
- package/run_ganache.js +0 -27
- package/utils.js +0 -188
- package/walletprovider.js +0 -232
package/providerengine.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
const ethers = require('ethers');
|
|
2
|
-
|
|
3
|
-
const ProviderEngine = function(fallbackURL, providers) {
|
|
4
|
-
this.lastId = 0;
|
|
5
|
-
if(fallbackURL) {
|
|
6
|
-
this.fallbackProvider = new ethers.providers.JsonRpcProvider(fallbackURL);
|
|
7
|
-
}
|
|
8
|
-
this.providers = providers || [];
|
|
9
|
-
for(let i = 0; i < providers.length; i++) {
|
|
10
|
-
providers[i].setEngine(this);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
ProviderEngine.prototype.send = function(payload, callback) {
|
|
15
|
-
this.sendPayload(payload, callback);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
ProviderEngine.prototype.sendAsync = function(payload, callback) {
|
|
19
|
-
this.sendPayload(payload, callback);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
ProviderEngine.prototype.sendPayload = async function(payload, callback) {
|
|
23
|
-
self = this;
|
|
24
|
-
let currentProvider = -1;
|
|
25
|
-
let result = null;
|
|
26
|
-
let error = null;
|
|
27
|
-
let stack = []
|
|
28
|
-
|
|
29
|
-
next();
|
|
30
|
-
|
|
31
|
-
function next(after) {
|
|
32
|
-
currentProvider++;
|
|
33
|
-
stack.unshift(after);
|
|
34
|
-
if (currentProvider >= self.providers.length) {
|
|
35
|
-
if(self.fallbackProvider) {
|
|
36
|
-
// console.log('calling ', payload.method, payload.params);
|
|
37
|
-
self.fallbackProvider.send(payload.method, payload.params)
|
|
38
|
-
.then((result) => {
|
|
39
|
-
callback(null, {id: payload.id, result: result, jsonrpc: payload.jsonrpc});
|
|
40
|
-
})
|
|
41
|
-
.catch((err) => {
|
|
42
|
-
let actualError = err;
|
|
43
|
-
if(err.responseText) {
|
|
44
|
-
try {
|
|
45
|
-
actualError = JSON.parse(err.responseText);
|
|
46
|
-
// if(actualError.error) {
|
|
47
|
-
// console.log('error ', (typeof actualError.error), actualError.error);
|
|
48
|
-
// // actualError = { data : actualError.error }; // wrap in data for web3.js error handling
|
|
49
|
-
// actualError = actualError.error;
|
|
50
|
-
// }
|
|
51
|
-
} catch(e) {
|
|
52
|
-
actualError = err;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
callback(actualError);
|
|
56
|
-
});
|
|
57
|
-
} else {
|
|
58
|
-
callback(new Error('Request for method "' + payload.method + '" not handled by any subprovider. Please check your subprovider configuration to ensure this method is handled.'))
|
|
59
|
-
}
|
|
60
|
-
} else {
|
|
61
|
-
try {
|
|
62
|
-
let provider = self.providers[currentProvider]
|
|
63
|
-
provider.handleRequest(payload, next, end);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
end(e);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function end(_error, _result) {
|
|
71
|
-
result = _result;
|
|
72
|
-
error = _error;
|
|
73
|
-
|
|
74
|
-
let current = -1;
|
|
75
|
-
|
|
76
|
-
nextAfter();
|
|
77
|
-
|
|
78
|
-
function nextAfter() {
|
|
79
|
-
current++;
|
|
80
|
-
if(current >= stack.length) {
|
|
81
|
-
done();
|
|
82
|
-
} else {
|
|
83
|
-
if (stack[current]) {
|
|
84
|
-
stack[current](error, result, nextAfter)
|
|
85
|
-
} else {
|
|
86
|
-
nextAfter();
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function done() {
|
|
93
|
-
var resultObj = {
|
|
94
|
-
id: payload.id,
|
|
95
|
-
jsonrpc: payload.jsonrpc,
|
|
96
|
-
result: result
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (error != null) {
|
|
100
|
-
resultObj.error = {
|
|
101
|
-
message: error.stack || error.message || error,
|
|
102
|
-
code: error.code || -32000 // TODO different code
|
|
103
|
-
}
|
|
104
|
-
// console.log('error', error, resultObj, payload);
|
|
105
|
-
// respond with both error formats
|
|
106
|
-
callback(error, resultObj)
|
|
107
|
-
} else {
|
|
108
|
-
// console.log('result', resultObj, payload);
|
|
109
|
-
callback(null, resultObj)
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
ProviderEngine.prototype.subscribe = function() {
|
|
115
|
-
console.error('Subscriptions are not supported yet');
|
|
116
|
-
throw new Error('Subscriptions are not supported yet');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
ProviderEngine.prototype.unsubscribe = function() {
|
|
120
|
-
console.error('Subscriptions are not supported yet');
|
|
121
|
-
throw new Error('Subscriptions are not supported yet');
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
ProviderEngine.prototype.disconnect = function() {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
module.exports = ProviderEngine;
|