@muritavo/testing-toolkit 0.3.4 → 0.4.0
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/blockchain.d.ts +6 -0
- package/dist/client/blockchain.js +13 -2
- package/dist/client/blockchain.js.map +1 -1
- package/dist/client/emulator.d.ts +1 -1
- package/dist/native/blockchain.d.ts +14 -2
- package/dist/native/blockchain.js +113 -23
- package/dist/native/blockchain.js.map +1 -1
- package/dist/utility/index.d.ts +1 -0
- package/dist/utility/index.js +12 -0
- package/dist/utility/index.js.map +1 -0
- package/package.json +13 -4
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import GenericContract, { MapTypeToJS } from "../types/contract";
|
|
2
|
+
/**
|
|
3
|
+
* For future me: This is needed because when using
|
|
4
|
+
* on cypress-toolkit "startblockchain" and "invokecontract"
|
|
5
|
+
* are run in different contexts, so the port variable cannot be
|
|
6
|
+
* shared.
|
|
7
|
+
*/
|
|
2
8
|
export declare function setPort(_port: number): void;
|
|
3
9
|
export declare function invokeContract<C, M extends keyof C["methods"]>(wallet: string, _contract: C, contractMethodName: M, ...params: Parameters<C["methods"][M]>): Promise<C extends GenericContract<infer ABI> ? (ABI[number] & {
|
|
4
10
|
name: M;
|
|
@@ -41,11 +41,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.invokeContract = exports.setPort = void 0;
|
|
43
43
|
var web3_1 = __importDefault(require("web3"));
|
|
44
|
-
var port
|
|
44
|
+
var port;
|
|
45
|
+
/**
|
|
46
|
+
* For future me: This is needed because when using
|
|
47
|
+
* on cypress-toolkit "startblockchain" and "invokecontract"
|
|
48
|
+
* are run in different contexts, so the port variable cannot be
|
|
49
|
+
* shared.
|
|
50
|
+
*/
|
|
45
51
|
function setPort(_port) {
|
|
46
52
|
port = _port;
|
|
47
53
|
}
|
|
48
54
|
exports.setPort = setPort;
|
|
55
|
+
function _getPort() {
|
|
56
|
+
if (!port)
|
|
57
|
+
throw new Error("Please, indicate the port that the blockchain node is running (by default it runs on 8545) \nusing the setPort from \"@muritavo/testing-toolkit/dist/client/blockchain\"");
|
|
58
|
+
return port;
|
|
59
|
+
}
|
|
49
60
|
/// @ts-expect-error
|
|
50
61
|
function invokeContract(wallet, _contract, contractMethodName) {
|
|
51
62
|
/// @ts-expect-error
|
|
@@ -80,7 +91,7 @@ function invokeContract(wallet, _contract, contractMethodName) {
|
|
|
80
91
|
gas: 90000000,
|
|
81
92
|
gasPrice: "90000000000",
|
|
82
93
|
});
|
|
83
|
-
web3 = new web3_1.default(new web3_1.default.providers.HttpProvider("http://".concat("127.0.0.1", ":").concat(
|
|
94
|
+
web3 = new web3_1.default(new web3_1.default.providers.HttpProvider("http://".concat("127.0.0.1", ":").concat(_getPort())));
|
|
84
95
|
return [2 /*return*/, new Promise(function (r, rej) { return __awaiter(_this, void 0, void 0, function () {
|
|
85
96
|
var txHash, transaction, isMined;
|
|
86
97
|
return __generator(this, function (_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockchain.js","sourceRoot":"","sources":["../../src/client/blockchain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAwB;AAExB,IAAI,
|
|
1
|
+
{"version":3,"file":"blockchain.js","sourceRoot":"","sources":["../../src/client/blockchain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,8CAAwB;AAExB,IAAI,IAAY,CAAC;AACjB;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,KAAa;IACnC,IAAI,GAAG,KAAK,CAAC;AACf,CAAC;AAFD,0BAEC;AAED,SAAS,QAAQ;IACf,IAAI,CAAC,IAAI;QACP,MAAM,IAAI,KAAK,CACb,0KACoE,CACrE,CAAC;IACJ,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oB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O,CAAS,UAAC,CAAC,EAAE,GAAG;oCAC9C,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAE,UAAC,EAAU;wCACpC,CAAC,CAAC,EAAE,CAAC,CAAC;oCACR,CAAC,CAAC,CAAC;oCACH,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gCAClB,CAAC,CAAC,EAAA;;gCALI,MAAM,GAAG,SAKb;;;qCACK,IAAI;gCACW,qBAAM,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAA;;gCAA1D,WAAW,GAAG,SAA4C;gCAE1D,OAAO,GACX,CAAC,WAAW;oCACZ,CAAC,WAAW,CAAC,SAAS;oCACtB,WAAW,CAAC,MAAM,KAAK,SAAS;oCAC9B,CAAC,CAAC,SAAS,CAAC,oCAAoC;oCAChD,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC;qCAChC,CAAA,OAAO,KAAK,SAAS,CAAA,EAArB,wBAAqB;gCACvB,qBAAM,IAAI,OAAO,CAAO,UAAC,CAAC,IAAK,OAAA,UAAU,CAAC,cAAM,OAAA,CAAC,EAAE,EAAH,CAAG,EAAE,IAAI,CAAC,EAA3B,CAA2B,CAAC,EAAA;;gCAA3D,SAA2D,CAAC;;;gCAE5D,IAAI,OAAO;oCAAE,CAAC,EAAE,CAAC;;oCACZ,GAAG,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;gCAC1D,wBAAM;;;;;qBAGX,CAAQ,EAAC;;;CACX;AAnED,wCAmEC"}
|
|
@@ -10,7 +10,7 @@ export declare const deleteCollection: (projectId: string, collectionPath: strin
|
|
|
10
10
|
* @param projectId The current project id of the emulator instance
|
|
11
11
|
* @param cb The callback to be executed
|
|
12
12
|
*/
|
|
13
|
-
export declare const setupEmulator: (projectId: string, cb: (firestore:
|
|
13
|
+
export declare const setupEmulator: (projectId: string, cb: (firestore: firebase.firestore.Firestore, storage: firebase.storage.Storage) => Promise<void>, storageBucket?: string) => Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Creates a user on the auth emulator allowing him to authenticate to the emulator
|
|
16
16
|
* @param projectId The current project id of the emulator instance
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import debug from "debug";
|
|
1
2
|
import GenericContract from "../types/contract";
|
|
3
|
+
export declare const blockchainLogger: debug.Debugger;
|
|
2
4
|
type Addresses = {
|
|
3
5
|
[wallet: string]: {
|
|
4
6
|
secretKey: string;
|
|
5
7
|
};
|
|
6
8
|
};
|
|
7
|
-
export declare function startBlockchain({ projectRootFolder: projectFolder, port, }: {
|
|
9
|
+
export declare function startBlockchain({ projectRootFolder: projectFolder, port, graphqlProject, }: {
|
|
8
10
|
/** The NFT projects root folder so the contracts can be deployed from */
|
|
9
11
|
projectRootFolder: string;
|
|
10
12
|
/**
|
|
@@ -12,16 +14,26 @@ export declare function startBlockchain({ projectRootFolder: projectFolder, port
|
|
|
12
14
|
* @default 8545
|
|
13
15
|
* */
|
|
14
16
|
port?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Adds support for graphql for listening to blockchain events and indexing information.
|
|
19
|
+
*/
|
|
20
|
+
graphqlProject?: string;
|
|
15
21
|
}): Promise<Addresses>;
|
|
16
22
|
export declare function deployContract<const ABI extends any[] = []>({ contractAbi, contractName, args, }: {
|
|
17
23
|
contractAbi: ABI;
|
|
18
24
|
contractName: string;
|
|
19
25
|
args: any[];
|
|
20
26
|
}): Promise<{
|
|
21
|
-
address:
|
|
27
|
+
address: string;
|
|
22
28
|
owner: string;
|
|
23
29
|
contract: GenericContract<ABI, "allEvents" | (ABI[number] extends infer T ? T extends ABI[number] ? T extends {
|
|
24
30
|
type: "event";
|
|
25
31
|
} ? T["name"] : never : never : never)>;
|
|
26
32
|
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Takes a graph and deploys it into the graph-node
|
|
35
|
+
*/
|
|
36
|
+
export declare function deployGraph(graphPath: string, contractAddresses: {
|
|
37
|
+
[deployedContractName: string]: string;
|
|
38
|
+
}): Promise<void>;
|
|
27
39
|
export {};
|
|
@@ -73,15 +73,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
73
73
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
74
74
|
};
|
|
75
75
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
76
|
-
exports.deployContract = exports.startBlockchain = void 0;
|
|
76
|
+
exports.deployGraph = exports.deployContract = exports.startBlockchain = exports.blockchainLogger = void 0;
|
|
77
77
|
var debug_1 = __importDefault(require("debug"));
|
|
78
|
-
var
|
|
78
|
+
var blockchain_1 = require("../client/blockchain");
|
|
79
|
+
var child_process_1 = require("child_process");
|
|
80
|
+
var utility_1 = require("../utility");
|
|
81
|
+
var fs_1 = require("fs");
|
|
82
|
+
var path_1 = require("path");
|
|
83
|
+
exports.blockchainLogger = (0, debug_1.default)("@muritavo/testing-toolkit/blockchain");
|
|
79
84
|
var instance;
|
|
80
85
|
function startBlockchain(_a) {
|
|
81
86
|
return __awaiter(this, arguments, void 0, function (_b) {
|
|
82
87
|
var prevFork, serverInstance, accounts;
|
|
83
88
|
var _this = this;
|
|
84
|
-
var projectFolder = _b.projectRootFolder, _c = _b.port, port = _c === void 0 ? 8545 : _c;
|
|
89
|
+
var projectFolder = _b.projectRootFolder, _c = _b.port, port = _c === void 0 ? 8545 : _c, graphqlProject = _b.graphqlProject;
|
|
85
90
|
return __generator(this, function (_d) {
|
|
86
91
|
switch (_d.label) {
|
|
87
92
|
case 0:
|
|
@@ -105,7 +110,12 @@ function startBlockchain(_a) {
|
|
|
105
110
|
case 2: return [2 /*return*/, instance.addresses];
|
|
106
111
|
case 3:
|
|
107
112
|
if (projectFolder)
|
|
108
|
-
|
|
113
|
+
(0, exports.blockchainLogger)("Starting blockchain server at \"".concat(projectFolder, "\""));
|
|
114
|
+
if (graphqlProject)
|
|
115
|
+
(0, child_process_1.execSync)("docker-compose up --detach", {
|
|
116
|
+
cwd: graphqlProject,
|
|
117
|
+
stdio: "ignore",
|
|
118
|
+
});
|
|
109
119
|
return [4 /*yield*/, initHardhat(projectFolder)];
|
|
110
120
|
case 4:
|
|
111
121
|
serverInstance = _d.sent();
|
|
@@ -142,6 +152,7 @@ function startBlockchain(_a) {
|
|
|
142
152
|
addresses: accounts,
|
|
143
153
|
port: port,
|
|
144
154
|
};
|
|
155
|
+
(0, blockchain_1.setPort)(port);
|
|
145
156
|
return [2 /*return*/, accounts];
|
|
146
157
|
}
|
|
147
158
|
});
|
|
@@ -217,12 +228,12 @@ function deployContract(_a) {
|
|
|
217
228
|
return __generator(this, function (_e) {
|
|
218
229
|
switch (_e.label) {
|
|
219
230
|
case 0:
|
|
220
|
-
|
|
231
|
+
(0, exports.blockchainLogger)("Deploying contract ".concat(contractName, " with ").concat(args.length, " parameters ").concat(args
|
|
221
232
|
.map(function (a) { return "".concat(a, " (").concat(Array.isArray(a) ? "array" : typeof a, ")"); })
|
|
222
233
|
.join(", ")));
|
|
223
234
|
_e.label = 1;
|
|
224
235
|
case 1:
|
|
225
|
-
_e.trys.push([1,
|
|
236
|
+
_e.trys.push([1, 17, , 18]);
|
|
226
237
|
if (!(instance === null || instance === void 0 ? void 0 : instance.rootFolder))
|
|
227
238
|
throw new Error("You are trying to deploy a contract without defining the Blockchain Project folder. Please define it at startBlockchain command.");
|
|
228
239
|
getContract = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
@@ -255,8 +266,8 @@ function deployContract(_a) {
|
|
|
255
266
|
return [4 /*yield*/, lock_1.waitForDeployment()];
|
|
256
267
|
case 6:
|
|
257
268
|
_e.sent();
|
|
258
|
-
if (!(args.length > 0)) return [3 /*break*/,
|
|
259
|
-
|
|
269
|
+
if (!(args.length > 0)) return [3 /*break*/, 12];
|
|
270
|
+
(0, exports.blockchainLogger)("Initializing contract with owner ".concat(owner, " and args ").concat(args));
|
|
260
271
|
connection = lock_1.connect(owner);
|
|
261
272
|
initializationKey_1 = "initialize";
|
|
262
273
|
connection.interface.forEachFunction(function (func) {
|
|
@@ -271,30 +282,109 @@ function deployContract(_a) {
|
|
|
271
282
|
_e.sent();
|
|
272
283
|
_e.label = 8;
|
|
273
284
|
case 8:
|
|
274
|
-
_c = {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
285
|
+
_c = {};
|
|
286
|
+
return [4 /*yield*/, lock_1.getAddress()];
|
|
287
|
+
case 9:
|
|
288
|
+
_c.address = _e.sent();
|
|
289
|
+
return [4 /*yield*/, owner.getAddress()];
|
|
290
|
+
case 10:
|
|
291
|
+
_c.owner = _e.sent();
|
|
278
292
|
return [4 /*yield*/, getContract()];
|
|
279
|
-
case
|
|
293
|
+
case 11: return [2 /*return*/, (_c.contract = _e.sent(),
|
|
280
294
|
_c)];
|
|
281
|
-
case
|
|
282
|
-
_d = {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
295
|
+
case 12:
|
|
296
|
+
_d = {};
|
|
297
|
+
return [4 /*yield*/, lock_1.getAddress()];
|
|
298
|
+
case 13:
|
|
299
|
+
_d.address = _e.sent();
|
|
300
|
+
return [4 /*yield*/, owner.getAddress()];
|
|
301
|
+
case 14:
|
|
302
|
+
_d.owner = _e.sent();
|
|
286
303
|
return [4 /*yield*/, getContract()];
|
|
287
|
-
case
|
|
304
|
+
case 15: return [2 /*return*/, (_d.contract = _e.sent(),
|
|
288
305
|
_d)];
|
|
289
|
-
case
|
|
290
|
-
case
|
|
306
|
+
case 16: return [3 /*break*/, 18];
|
|
307
|
+
case 17:
|
|
291
308
|
e_2 = _e.sent();
|
|
292
|
-
|
|
309
|
+
(0, exports.blockchainLogger)("Something has gone wrong", e_2);
|
|
293
310
|
throw e_2;
|
|
294
|
-
case
|
|
311
|
+
case 18: return [2 /*return*/];
|
|
295
312
|
}
|
|
296
313
|
});
|
|
297
314
|
});
|
|
298
315
|
}
|
|
299
316
|
exports.deployContract = deployContract;
|
|
317
|
+
/**
|
|
318
|
+
* Takes a graph and deploys it into the graph-node
|
|
319
|
+
*/
|
|
320
|
+
function deployGraph(graphPath, contractAddresses) {
|
|
321
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
322
|
+
function generateGraphManifest() {
|
|
323
|
+
var graphManifestCacheDir = cacheDir({ name: "graph-manifest" });
|
|
324
|
+
var subgraphYml = parse((0, fs_1.readFileSync)((0, path_1.resolve)(graphPath, "subgraph.yaml")).toString());
|
|
325
|
+
function relativeToAbsolutePath(relativePath) {
|
|
326
|
+
return (0, path_1.resolve)(graphPath, relativePath);
|
|
327
|
+
}
|
|
328
|
+
subgraphYml.schema.file = relativeToAbsolutePath(subgraphYml.schema.file);
|
|
329
|
+
for (var _i = 0, _a = subgraphYml.dataSources; _i < _a.length; _i++) {
|
|
330
|
+
var dataSource = _a[_i];
|
|
331
|
+
dataSource.network = "localhost";
|
|
332
|
+
if (!contractAddresses[dataSource.source.abi])
|
|
333
|
+
throw new Error("Please, provide the address for the contract \"".concat(dataSource.source.abi, "\" deployed on the local hardhat node"));
|
|
334
|
+
dataSource.source.address = contractAddresses[dataSource.source.abi];
|
|
335
|
+
dataSource.mapping.file = relativeToAbsolutePath(dataSource.mapping.file);
|
|
336
|
+
for (var _b = 0, _c = dataSource.mapping.abis; _b < _c.length; _b++) {
|
|
337
|
+
var abi = _c[_b];
|
|
338
|
+
abi.file = relativeToAbsolutePath(abi.file);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
var graphManifestPath = (0, path_1.resolve)(graphManifestCacheDir, "subgraph.yaml");
|
|
342
|
+
if (!(0, fs_1.existsSync)(graphManifestCacheDir))
|
|
343
|
+
(0, fs_1.mkdirSync)(graphManifestCacheDir, { recursive: true });
|
|
344
|
+
(0, fs_1.writeFileSync)(graphManifestPath, stringify(subgraphYml));
|
|
345
|
+
return graphManifestPath;
|
|
346
|
+
}
|
|
347
|
+
var _a, parse, stringify, cacheDir, stdioMode, error_1, localhostGraphManifest;
|
|
348
|
+
return __generator(this, function (_b) {
|
|
349
|
+
switch (_b.label) {
|
|
350
|
+
case 0: return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("yaml")); })];
|
|
351
|
+
case 1:
|
|
352
|
+
_a = _b.sent(), parse = _a.parse, stringify = _a.stringify;
|
|
353
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require("find-cache-dir")); })];
|
|
354
|
+
case 2:
|
|
355
|
+
cacheDir = (_b.sent()).default;
|
|
356
|
+
stdioMode = exports.blockchainLogger.enabled ? undefined : "ignore";
|
|
357
|
+
_b.label = 3;
|
|
358
|
+
case 3:
|
|
359
|
+
if (!true) return [3 /*break*/, 8];
|
|
360
|
+
_b.label = 4;
|
|
361
|
+
case 4:
|
|
362
|
+
_b.trys.push([4, 5, , 7]);
|
|
363
|
+
(0, child_process_1.execSync)("yarn create-local", {
|
|
364
|
+
cwd: graphPath,
|
|
365
|
+
stdio: stdioMode,
|
|
366
|
+
});
|
|
367
|
+
return [3 /*break*/, 8];
|
|
368
|
+
case 5:
|
|
369
|
+
error_1 = _b.sent();
|
|
370
|
+
return [4 /*yield*/, (0, utility_1.wait)(1000)];
|
|
371
|
+
case 6:
|
|
372
|
+
_b.sent();
|
|
373
|
+
return [3 /*break*/, 7];
|
|
374
|
+
case 7: return [3 /*break*/, 3];
|
|
375
|
+
case 8:
|
|
376
|
+
localhostGraphManifest = generateGraphManifest();
|
|
377
|
+
(0, child_process_1.execSync)("yarn deploy-local ".concat(localhostGraphManifest, " -l v0.0.1"), {
|
|
378
|
+
cwd: graphPath,
|
|
379
|
+
stdio: stdioMode,
|
|
380
|
+
});
|
|
381
|
+
return [4 /*yield*/, (0, utility_1.wait)(1000)];
|
|
382
|
+
case 9:
|
|
383
|
+
_b.sent();
|
|
384
|
+
return [2 /*return*/];
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
exports.deployGraph = deployGraph;
|
|
300
390
|
//# sourceMappingURL=blockchain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blockchain.js","sourceRoot":"","sources":["../../src/native/blockchain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"blockchain.js","sourceRoot":"","sources":["../../src/native/blockchain.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAE1B,mDAA+C;AAC/C,+CAAyC;AACzC,sCAAkC;AAClC,yBAAwE;AACxE,6BAA+B;AAElB,QAAA,gBAAgB,GAAG,IAAA,eAAK,EAAC,sCAAsC,CAAC,CAAC;AAI9E,IAAI,QAYI,CAAC;AAET,SAAsB,eAAe;wDAAC,EAgBrC;;;YAfoB,aAAa,uBAAA,EAChC,YAAW,EAAX,IAAI,mBAAG,IAAI,KAAA,EACX,cAAc,oBAAA;;;;yBAcV,QAAQ,EAAR,wBAAQ;oBACJ,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;yBAC9D,QAAQ,EAAR,wBAAQ;oBACV,qBAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;4BAC9C,MAAM,EAAE,eAAe;4BACvB,MAAM,EAAE;gCACN;oCACE,OAAO,EAAE;wCACP,UAAU,EAAE,QAAQ,CAAC,GAAG;wCACxB,WAAW,EAAE,QAAQ,CAAC,WAAW;qCAClC;iCACF;6BACF;yBACF,CAAC,EAAA;;oBAVF,SAUE,CAAC;;wBAEL,sBAAO,QAAQ,CAAC,SAAS,EAAC;;oBAE5B,IAAI,aAAa;wBACf,IAAA,wBAAgB,EAAC,0CAAkC,aAAa,OAAG,CAAC,CAAC;oBACvE,IAAI,cAAc;wBAChB,IAA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S;qBACjB,CAAC,CAAC;oBAEH,qBAAM,IAAA,cAAI,EAAC,IAAI,CAAC,EAAA;;oBAAhB,SAAgB,CAAC;;;;;CAClB;AAtDD,kCAsDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function wait(timeMs: number): Promise<unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wait = void 0;
|
|
4
|
+
function wait(timeMs) {
|
|
5
|
+
return new Promise(function (r) {
|
|
6
|
+
setTimeout(function () {
|
|
7
|
+
r(null);
|
|
8
|
+
}, timeMs);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.wait = wait;
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,SAAgB,IAAI,CAAC,MAAc;IACjC,OAAO,IAAI,OAAO,CAAC,UAAC,CAAC;QACnB,UAAU,CAAC;YACT,CAAC,CAAC,IAAI,CAAC,CAAC;QACV,CAAC,EAAE,MAAM,CAAC,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAND,oBAMC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muritavo/testing-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "A series of functions to help with testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
11
|
"prepack": "tsc",
|
|
12
|
-
"test": "jest --watchAll"
|
|
12
|
+
"test": "jest --watchAll",
|
|
13
|
+
"graph-codegen": "cd ./test/graphs/simple-graph && graph codegen",
|
|
14
|
+
"graph-build": "cd ./test/graphs/simple-graph && graph build"
|
|
13
15
|
},
|
|
14
16
|
"repository": {
|
|
15
17
|
"type": "git",
|
|
@@ -22,24 +24,31 @@
|
|
|
22
24
|
},
|
|
23
25
|
"homepage": "https://github.com/Muritavo/testing-toolkit#readme",
|
|
24
26
|
"devDependencies": {
|
|
27
|
+
"@apollo/client": "^3.10.4",
|
|
28
|
+
"@graphprotocol/graph-ts": "^0.35.1",
|
|
25
29
|
"@nomicfoundation/hardhat-ethers": "^3.0.5",
|
|
30
|
+
"@types/debug": "^4.1.12",
|
|
26
31
|
"@types/jest": "^29.5.12",
|
|
27
32
|
"ethers": "^6.12.0",
|
|
33
|
+
"find-cache-dir": "^3.0.0",
|
|
28
34
|
"firebase": "^9.10.0",
|
|
29
35
|
"firebase-admin": "^11.5.0",
|
|
30
36
|
"ganache": "^7.8.0",
|
|
37
|
+
"graphql": "^16.8.1",
|
|
31
38
|
"hardhat": "^2.14.1",
|
|
32
39
|
"jest": "^29.7.0",
|
|
40
|
+
"react": "^18.3.1",
|
|
33
41
|
"text2png": "^2.3.0",
|
|
34
42
|
"ts-jest": "^29.1.2",
|
|
35
43
|
"web3": "^1",
|
|
36
|
-
"web3v4": "npm:web3@4.1.0"
|
|
44
|
+
"web3v4": "npm:web3@4.1.0",
|
|
45
|
+
"yaml": "^2.4.2"
|
|
37
46
|
},
|
|
38
47
|
"dependencies": {
|
|
39
48
|
"@firebase/rules-unit-testing": "^2.0.4",
|
|
40
49
|
"@types/kill-port": "^2.0.3",
|
|
41
50
|
"@types/node-fetch": "^2.6.2",
|
|
42
|
-
"kill-port": "^
|
|
51
|
+
"kill-port": "^1.6.0",
|
|
43
52
|
"node-fetch": "^1",
|
|
44
53
|
"typescript": "^5.4.2"
|
|
45
54
|
}
|