@muritavo/testing-toolkit 0.6.2 → 0.6.4
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/client/emulator.d.ts +1 -1
- package/dist/native/blockchain.js +34 -65
- package/dist/native/blockchain.js.map +1 -1
- package/package.json +1 -1
- package/dist/shared/blockchain.d.ts +0 -19
- package/dist/shared/blockchain.js +0 -4
- package/dist/shared/blockchain.js.map +0 -1
- package/dist/src/client/blockchain.d.ts +0 -13
- package/dist/src/client/blockchain.js +0 -149
- package/dist/src/client/blockchain.js.map +0 -1
- package/dist/src/client/emulator.d.ts +0 -65
- package/dist/src/client/emulator.js +0 -250
- package/dist/src/client/emulator.js.map +0 -1
- package/dist/src/client/utility.d.ts +0 -7
- package/dist/src/client/utility.js +0 -39
- package/dist/src/client/utility.js.map +0 -1
- package/dist/src/native/blockchain.d.ts +0 -50
- package/dist/src/native/blockchain.js +0 -649
- package/dist/src/native/blockchain.js.map +0 -1
- package/dist/src/native/consts.d.ts +0 -5
- package/dist/src/native/consts.js +0 -9
- package/dist/src/native/consts.js.map +0 -1
- package/dist/src/native/emulator.d.ts +0 -49
- package/dist/src/native/emulator.js +0 -274
- package/dist/src/native/emulator.js.map +0 -1
- package/dist/src/types/contract.d.ts +0 -79
- package/dist/src/types/contract.js +0 -31
- package/dist/src/types/contract.js.map +0 -1
- package/dist/src/utility/index.d.ts +0 -1
- package/dist/src/utility/index.js +0 -12
- package/dist/src/utility/index.js.map +0 -1
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.d.ts +0 -42
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.js +0 -76
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.js.map +0 -1
|
@@ -1,250 +0,0 @@
|
|
|
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
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
-
if (ar || !(i in from)) {
|
|
41
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
-
ar[i] = from[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.clearFirestore = exports.setEmulatorConfig = exports.clearAuth = exports.addAuthUser = exports.setupEmulator = exports.deleteCollection = void 0;
|
|
52
|
-
var node_fetch_1 = __importDefault(require("node-fetch"));
|
|
53
|
-
var rules_unit_testing_1 = require("@firebase/rules-unit-testing");
|
|
54
|
-
var consts_1 = require("../native/consts");
|
|
55
|
-
var emulatorConfig;
|
|
56
|
-
/**
|
|
57
|
-
* Deletes a collection from firebase
|
|
58
|
-
* @param projectId The current project id of the emulator instance
|
|
59
|
-
* @param collectionPath The collection path **starting with "/"**
|
|
60
|
-
*/
|
|
61
|
-
var deleteCollection = function (projectId, collectionPath) { return __awaiter(void 0, void 0, void 0, function () {
|
|
62
|
-
return __generator(this, function (_a) {
|
|
63
|
-
switch (_a.label) {
|
|
64
|
-
case 0: return [4 /*yield*/, (0, node_fetch_1.default)("http://".concat(consts_1.LOCALHOST_DOMAIN, ":").concat(_getPort("firestore"), "/emulator/v1/projects/").concat(projectId, "/databases/(default)/documents").concat(collectionPath), {
|
|
65
|
-
method: "delete",
|
|
66
|
-
})];
|
|
67
|
-
case 1:
|
|
68
|
-
_a.sent();
|
|
69
|
-
return [2 /*return*/];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}); };
|
|
73
|
-
exports.deleteCollection = deleteCollection;
|
|
74
|
-
/**
|
|
75
|
-
* Gives the developer the possibility to interact with an admin firestore emulator instance
|
|
76
|
-
* @param projectId The current project id of the emulator instance
|
|
77
|
-
* @param cb The callback to be executed
|
|
78
|
-
*/
|
|
79
|
-
var setupEmulator = function (projectId, cb, storageBucket) { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var testEnv;
|
|
81
|
-
return __generator(this, function (_a) {
|
|
82
|
-
switch (_a.label) {
|
|
83
|
-
case 0: return [4 /*yield*/, (0, rules_unit_testing_1.initializeTestEnvironment)({
|
|
84
|
-
projectId: projectId,
|
|
85
|
-
firestore: {
|
|
86
|
-
host: consts_1.LOCALHOST_DOMAIN,
|
|
87
|
-
port: _getPort("firestore"),
|
|
88
|
-
},
|
|
89
|
-
storage: {
|
|
90
|
-
host: consts_1.LOCALHOST_DOMAIN,
|
|
91
|
-
port: _getPort("storage"),
|
|
92
|
-
},
|
|
93
|
-
})];
|
|
94
|
-
case 1:
|
|
95
|
-
testEnv = _a.sent();
|
|
96
|
-
return [4 /*yield*/, testEnv.withSecurityRulesDisabled(function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
-
return __generator(this, function (_a) {
|
|
98
|
-
switch (_a.label) {
|
|
99
|
-
case 0: return [4 /*yield*/, cb(ctx.firestore({
|
|
100
|
-
merge: true,
|
|
101
|
-
}), ctx.storage(storageBucket))];
|
|
102
|
-
case 1:
|
|
103
|
-
_a.sent();
|
|
104
|
-
return [2 /*return*/];
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}); })];
|
|
108
|
-
case 2:
|
|
109
|
-
_a.sent();
|
|
110
|
-
return [2 /*return*/];
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}); };
|
|
114
|
-
exports.setupEmulator = setupEmulator;
|
|
115
|
-
/**
|
|
116
|
-
* Creates a user on the auth emulator allowing him to authenticate to the emulator
|
|
117
|
-
* @param projectId The current project id of the emulator instance
|
|
118
|
-
* @param email The email to authenticate the user with
|
|
119
|
-
* @param password The password to authenticate the user with
|
|
120
|
-
* @param localId A deterministic Id to be used for this user
|
|
121
|
-
*/
|
|
122
|
-
var addAuthUser = function (projectId_1, email_1, password_1) {
|
|
123
|
-
var args_1 = [];
|
|
124
|
-
for (var _i = 3; _i < arguments.length; _i++) {
|
|
125
|
-
args_1[_i - 3] = arguments[_i];
|
|
126
|
-
}
|
|
127
|
-
return __awaiter(void 0, __spreadArray([projectId_1, email_1, password_1], args_1, true), void 0, function (projectId, email, password, localId) {
|
|
128
|
-
var result;
|
|
129
|
-
if (localId === void 0) { localId = ""; }
|
|
130
|
-
return __generator(this, function (_a) {
|
|
131
|
-
switch (_a.label) {
|
|
132
|
-
case 0: return [4 /*yield*/, (0, node_fetch_1.default)("http://".concat(consts_1.LOCALHOST_DOMAIN, ":").concat(_getPort("auth"), "/identitytoolkit.googleapis.com/v1/projects/").concat(projectId, "/accounts"), {
|
|
133
|
-
body: JSON.stringify({
|
|
134
|
-
email: email,
|
|
135
|
-
password: password,
|
|
136
|
-
localId: localId,
|
|
137
|
-
}),
|
|
138
|
-
headers: {
|
|
139
|
-
"content-type": "application/json",
|
|
140
|
-
authorization: "Bearer owner",
|
|
141
|
-
},
|
|
142
|
-
method: "post",
|
|
143
|
-
})];
|
|
144
|
-
case 1:
|
|
145
|
-
result = _a.sent();
|
|
146
|
-
if (result.status > 300)
|
|
147
|
-
throw new Error("Creating account returned ".concat(result.status));
|
|
148
|
-
return [2 /*return*/];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
exports.addAuthUser = addAuthUser;
|
|
154
|
-
/**
|
|
155
|
-
* Clears all accounts from the auth emulator
|
|
156
|
-
*
|
|
157
|
-
* @param projectId The current project id of the emulator instance
|
|
158
|
-
*/
|
|
159
|
-
var clearAuth = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
160
|
-
var result;
|
|
161
|
-
return __generator(this, function (_a) {
|
|
162
|
-
switch (_a.label) {
|
|
163
|
-
case 0: return [4 /*yield*/, (0, node_fetch_1.default)("http://".concat(consts_1.LOCALHOST_DOMAIN, ":").concat(_getPort("auth"), "/emulator/v1/projects/").concat(projectId, "/accounts"), {
|
|
164
|
-
method: "delete",
|
|
165
|
-
})];
|
|
166
|
-
case 1:
|
|
167
|
-
result = _a.sent();
|
|
168
|
-
if (result.status > 300)
|
|
169
|
-
throw new Error("Cleaning accounts returned ".concat(result.status));
|
|
170
|
-
return [2 /*return*/];
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}); };
|
|
174
|
-
exports.clearAuth = clearAuth;
|
|
175
|
-
/**
|
|
176
|
-
* Sets the emulator ports config
|
|
177
|
-
* @param config Emulator ports config
|
|
178
|
-
*/
|
|
179
|
-
function setEmulatorConfig(config) {
|
|
180
|
-
emulatorConfig = config;
|
|
181
|
-
}
|
|
182
|
-
exports.setEmulatorConfig = setEmulatorConfig;
|
|
183
|
-
/**
|
|
184
|
-
* Clears all firestore documents from local emulator
|
|
185
|
-
* @param projectId The current project id of the emulator instance
|
|
186
|
-
*/
|
|
187
|
-
var clearFirestore = function (projectId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
188
|
-
var testEnv;
|
|
189
|
-
return __generator(this, function (_a) {
|
|
190
|
-
switch (_a.label) {
|
|
191
|
-
case 0: return [4 /*yield*/, (0, rules_unit_testing_1.initializeTestEnvironment)({
|
|
192
|
-
projectId: projectId,
|
|
193
|
-
firestore: {
|
|
194
|
-
host: consts_1.LOCALHOST_DOMAIN,
|
|
195
|
-
port: _getPort("firestore"),
|
|
196
|
-
},
|
|
197
|
-
})];
|
|
198
|
-
case 1:
|
|
199
|
-
testEnv = _a.sent();
|
|
200
|
-
return [4 /*yield*/, testEnv.clearFirestore()];
|
|
201
|
-
case 2:
|
|
202
|
-
_a.sent();
|
|
203
|
-
testEnv.cleanup();
|
|
204
|
-
return [2 /*return*/];
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
}); };
|
|
208
|
-
exports.clearFirestore = clearFirestore;
|
|
209
|
-
var FirebaseConfigEmulatorsShapeExample = {
|
|
210
|
-
emulators: {
|
|
211
|
-
auth: {
|
|
212
|
-
port: 9099,
|
|
213
|
-
},
|
|
214
|
-
functions: {
|
|
215
|
-
port: 5001,
|
|
216
|
-
},
|
|
217
|
-
firestore: {
|
|
218
|
-
port: 8080,
|
|
219
|
-
},
|
|
220
|
-
hosting: {
|
|
221
|
-
port: 5000,
|
|
222
|
-
},
|
|
223
|
-
storage: {
|
|
224
|
-
port: 9199,
|
|
225
|
-
},
|
|
226
|
-
pubsub: {
|
|
227
|
-
port: 8055,
|
|
228
|
-
},
|
|
229
|
-
ui: {
|
|
230
|
-
enabled: true,
|
|
231
|
-
port: 4000,
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Guarantees a firebase config has been provided before using the ports
|
|
237
|
-
* @param emulator The emulator type to get the port from
|
|
238
|
-
* @returns The port
|
|
239
|
-
*/
|
|
240
|
-
function _getPort(emulator) {
|
|
241
|
-
if (!emulatorConfig) {
|
|
242
|
-
throw new Error("You didn't set the emulator config. Provide it by using the following at your cypress support file:\n\nimport { setEmulatorConfig } from '@muritavo/cypress-toolkit/dist/support/emulator'\n...\n...\n...\nbefore() {\n setEmulatorConfig(require(\"THE_PATH_TO_YOUR_FIREBASE_JSON\"))\n}\n");
|
|
243
|
-
}
|
|
244
|
-
var emulatorConfigSet = emulatorConfig.emulators[emulator];
|
|
245
|
-
if (!emulatorConfigSet || !emulatorConfigSet.port) {
|
|
246
|
-
throw new Error("Emulator config not found");
|
|
247
|
-
}
|
|
248
|
-
return emulatorConfigSet.port;
|
|
249
|
-
}
|
|
250
|
-
//# sourceMappingURL=emulator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emulator.js","sourceRoot":"","sources":["../../../src/client/emulator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,mEAAyE;AAEzE,2CAAoD;AAEpD,IAAI,cAAmC,CAAC;AAExC;;;;GAIG;AACI,IAAM,gBAAgB,GAAG,UAC9B,SAAiB,EACjB,cAAsB;;;oBAEtB,qBAAM,IAAA,oBAAS,EACb,iBAAU,yBAAgB,cAAI,QAAQ,CACpC,WAAW,CACZ,mCAAyB,SAAS,2CAAiC,cAAc,CAAE,EACpF;oBACE,MAAM,EAAE,QAAQ;iBACjB,CACF,EAAA;;gBAPD,SAOC,CAAC;;;;KACH,CAAC;AAZW,QAAA,gBAAgB,oBAY3B;AAEF;;;;GAIG;AACI,IAAM,aAAa,GAAG,UAC3B,SAAiB,EACjB,EAGkB,EAClB,aAAsB;;;;oBAEN,qBAAM,IAAA,8CAAyB,EAAC;oBAC9C,SAAS,EAAE,SAAS;oBACpB,SAAS,EAAE;wBACT,IAAI,EAAE,yBAAgB;wBACtB,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC;qBAC5B;oBACD,OAAO,EAAE;wBACP,IAAI,EAAE,yBAAgB;wBACtB,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;qBAC1B;iBACF,CAAC,EAAA;;gBAVI,OAAO,GAAG,SAUd;gBACF,qBAAM,OAAO,CAAC,yBAAyB,CAAC,UAAO,GAAQ;;;wCACrD,qBAAM,EAAE,CACN,GAAG,CAAC,S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AM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates an random colored image with specified width, height and quality
|
|
3
|
-
* @param width width of the image
|
|
4
|
-
* @param height height of the image
|
|
5
|
-
* @param quality quality of the image
|
|
6
|
-
*/
|
|
7
|
-
export declare const generateImage: (cols: number, rows: number, strRandom: string, orientation?: "vertical" | "horizontal") => any;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateImage = void 0;
|
|
4
|
-
var text2png = require("text2png");
|
|
5
|
-
var firstEmoji = 0x1f604;
|
|
6
|
-
var emojisCount = 0x1f64f - firstEmoji;
|
|
7
|
-
/**
|
|
8
|
-
* Generates an random colored image with specified width, height and quality
|
|
9
|
-
* @param width width of the image
|
|
10
|
-
* @param height height of the image
|
|
11
|
-
* @param quality quality of the image
|
|
12
|
-
*/
|
|
13
|
-
var generateImage = function (cols, rows, strRandom, orientation) {
|
|
14
|
-
if (orientation === void 0) { orientation = "vertical"; }
|
|
15
|
-
strRandom =
|
|
16
|
-
orientation === "vertical" ? strRandom : "".concat(strRandom).concat(orientation);
|
|
17
|
-
var numFromStr = strRandom
|
|
18
|
-
.split("")
|
|
19
|
-
.reduce(function (r, char) { return r + char.charCodeAt(0); }, 0);
|
|
20
|
-
var rest = numFromStr % emojisCount;
|
|
21
|
-
var e = function (i) { return String.fromCodePoint(firstEmoji + rest + i); };
|
|
22
|
-
var template = "";
|
|
23
|
-
for (var i = 0; i < rows; i++) {
|
|
24
|
-
for (var c = 0; c < cols; c++) {
|
|
25
|
-
template += e(cols * i + c);
|
|
26
|
-
}
|
|
27
|
-
template += "\n";
|
|
28
|
-
}
|
|
29
|
-
var instance = text2png(template, {
|
|
30
|
-
output: "dataURL",
|
|
31
|
-
padding: 10,
|
|
32
|
-
font: "50px monospace",
|
|
33
|
-
color: "rgb(".concat(256 - (rest % 256), ", ").concat(256 - (numFromStr % 256), ", ").concat(256 - (Math.abs(numFromStr - rest) % 256), ")"),
|
|
34
|
-
backgroundColor: "rgb(".concat(rest % 256, ", ").concat(numFromStr % 256, ", ").concat(Math.abs(numFromStr - rest) % 256, ")"),
|
|
35
|
-
});
|
|
36
|
-
return instance;
|
|
37
|
-
};
|
|
38
|
-
exports.generateImage = generateImage;
|
|
39
|
-
//# sourceMappingURL=utility.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utility.js","sourceRoot":"","sources":["../../../src/client/utility.ts"],"names":[],"mappings":";;;AAAA,IAAI,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEnC,IAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,IAAM,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAEzC;;;;;GAKG;AACI,IAAM,aAAa,GAAG,UAC3B,IAAY,EACZ,IAAY,EACZ,SAAiB,EACjB,WAAmD;IAAnD,4BAAA,EAAA,wBAAmD;IAEnD,SAAS;QACP,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAG,SAAS,SAAG,WAAW,CAAE,CAAC;IACxE,IAAM,UAAU,GAAG,SAAS;SACzB,KAAK,CAAC,EAAE,CAAC;SACT,MAAM,CAAC,UAAC,CAAC,EAAE,IAAI,IAAK,OAAA,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAtB,CAAsB,EAAE,CAAC,CAAC,CAAC;IAClD,IAAM,IAAI,GAAG,UAAU,GAAG,WAAW,CAAC;IACtC,IAAM,CAAC,GAAG,UAAC,CAAS,IAAK,OAAA,MAAM,CAAC,aAAa,CAAC,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,EAA3C,CAA2C,CAAC;IAErE,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,QAAQ,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9B,CAAC;QACD,QAAQ,IAAI,IAAI,CAAC;IACnB,CAAC;IAED,IAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,EAAE;QAClC,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,cAAO,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,eAAK,GAAG,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,eAC3D,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,MACxC;QACH,eAAe,EAAE,cAAO,IAAI,GAAG,GAAG,eAAK,UAAU,GAAG,GAAG,eACrD,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,GAAG,MAChC;KACJ,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAlCW,QAAA,aAAa,iBAkCxB"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import debug from "debug";
|
|
2
|
-
import GenericContract from "../types/contract";
|
|
3
|
-
import { PartialDeep } from "type-fest";
|
|
4
|
-
export declare const blockchainLogger: debug.Debugger;
|
|
5
|
-
export type Addresses = {
|
|
6
|
-
[wallet: string]: {
|
|
7
|
-
secretKey: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export declare function bindToBlockchain({ projectFolder, graphqlProject, hardhatConfigImportPromiseFactory, port, }: {
|
|
11
|
-
port: number;
|
|
12
|
-
projectFolder: string;
|
|
13
|
-
graphqlProject?: string;
|
|
14
|
-
hardhatConfigImportPromiseFactory: () => Promise<PartialDeep<typeof import("../../test/hardhat-configs/hardhat-with-graphql/hardhat.config")["default"]>>;
|
|
15
|
-
}): Promise<Addresses>;
|
|
16
|
-
export declare function startBlockchain({ projectRootFolder: projectFolder, port, graphqlProject, }: {
|
|
17
|
-
/** The NFT projects root folder so the contracts can be deployed from */
|
|
18
|
-
projectRootFolder: string;
|
|
19
|
-
/**
|
|
20
|
-
* This indicates the port the ganache server will run at
|
|
21
|
-
* @default 8545
|
|
22
|
-
* */
|
|
23
|
-
port?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Adds support for graphql for listening to blockchain events and indexing information.
|
|
26
|
-
*/
|
|
27
|
-
graphqlProject?: string;
|
|
28
|
-
}): Promise<Addresses>;
|
|
29
|
-
export declare function deriveWallet(index: number, hardhat: any): {
|
|
30
|
-
key: string;
|
|
31
|
-
address: string;
|
|
32
|
-
};
|
|
33
|
-
export declare function deployContract<const ABI extends any[] = []>({ contractAbi, contractName, args, }: {
|
|
34
|
-
contractAbi: ABI;
|
|
35
|
-
contractName: string;
|
|
36
|
-
args: any[];
|
|
37
|
-
}): Promise<{
|
|
38
|
-
address: string;
|
|
39
|
-
owner: string;
|
|
40
|
-
contract: GenericContract<ABI, "allEvents" | (ABI[number] extends infer T ? T extends ABI[number] ? T extends {
|
|
41
|
-
type: "event";
|
|
42
|
-
} ? T["name"] : never : never : never)>;
|
|
43
|
-
}>;
|
|
44
|
-
/**
|
|
45
|
-
* Takes a graph and deploys it into the graph-node
|
|
46
|
-
*/
|
|
47
|
-
export declare function deployGraph(graphPath: string, contractAddresses: {
|
|
48
|
-
[deployedContractName: string]: string;
|
|
49
|
-
}, graphName: string, networkName: string): Promise<void>;
|
|
50
|
-
export declare function stopBlockchain(): Promise<void>;
|