@muritavo/testing-toolkit 0.4.1 → 0.5.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 +2 -1
- package/dist/client/blockchain.js +104 -68
- package/dist/client/blockchain.js.map +1 -1
- package/dist/client/emulator.js +0 -1
- package/dist/client/emulator.js.map +1 -1
- package/dist/native/blockchain.d.ts +13 -3
- package/dist/native/blockchain.js +366 -52
- package/dist/native/blockchain.js.map +1 -1
- package/dist/native/emulator.d.ts +13 -0
- package/dist/native/emulator.js +45 -12
- package/dist/native/emulator.js.map +1 -1
- package/dist/src/client/blockchain.d.ts +13 -0
- package/dist/src/client/blockchain.js +149 -0
- package/dist/src/client/blockchain.js.map +1 -0
- package/dist/src/client/emulator.d.ts +65 -0
- package/dist/src/client/emulator.js +250 -0
- package/dist/src/client/emulator.js.map +1 -0
- package/dist/src/client/utility.d.ts +7 -0
- package/dist/src/client/utility.js +39 -0
- package/dist/src/client/utility.js.map +1 -0
- package/dist/src/native/blockchain.d.ts +50 -0
- package/dist/src/native/blockchain.js +649 -0
- package/dist/src/native/blockchain.js.map +1 -0
- package/dist/src/native/consts.d.ts +5 -0
- package/dist/src/native/consts.js +9 -0
- package/dist/src/native/consts.js.map +1 -0
- package/dist/src/native/emulator.d.ts +49 -0
- package/dist/src/native/emulator.js +274 -0
- package/dist/src/native/emulator.js.map +1 -0
- package/dist/src/types/contract.d.ts +79 -0
- package/dist/src/types/contract.js +31 -0
- package/dist/src/types/contract.js.map +1 -0
- package/dist/src/utility/index.d.ts +1 -0
- package/dist/src/utility/index.js +12 -0
- package/dist/src/utility/index.js.map +1 -0
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.d.ts +42 -0
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.js +76 -0
- package/dist/test/hardhat-configs/hardhat-with-graphql/hardhat.config.js.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1 @@
|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;oBACpB,SAAS,EAAE;wBACT,IAAI,EAAE,yBAAgB;wBACtB,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC;qBAC5B;iBACF,CAAC,EAAA;;gBANI,OAAO,GAAG,SAMd;gBACF,qBAAM,OAAO,CAAC,cAAc,EAAE,EAAA;;gBAA9B,SAA8B,CAAC;gBAC/B,OAAO,CAAC,OAAO,EAAE,CAAC;;;;KACnB,CAAC;AAVW,QAAA,cAAc,kBAUzB;AAEF,IAAM,mCAAmC,GAAG;IAC1C,SAAS,EAAE;QACT,IAAI,EAAE;YACJ,IAAI,EAAE,IAAc;SACrB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,IAAc;SACrB;QACD,SAAS,EAAE;YACT,IAAI,EAAE,IAAc;SACrB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,IAAc;SACrB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,IAAc;SACrB;QACD,MAAM,EAAE;YACN,IAAI,EAAE,IAAc;SACrB;QACD,EAAE,EAAE;YACF,OAAO,EAAE,IAAe;YACxB,IAAI,EAAE,IAAc;SACrB;KACF;CACO,CAAC;AAIX;;;;GAIG;AACH,SAAS,QAAQ,CAAC,QAAgD;IAChE,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,gSASnB,CAAC,CAAC;IACD,CAAC;IACD,IAAM,iBAAiB,GAAG,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC7D,IAAI,CAAC,iBAAiB,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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>;
|