genlayer 0.39.1 → 0.39.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/.claude/skills/release/SKILL.md +89 -0
- package/.github/e2e-track +1 -0
- package/.github/workflows/e2e-housekeeper.yml +84 -0
- package/.github/workflows/e2e.yml +740 -0
- package/.github/workflows/publish.yml +42 -29
- package/.github/workflows/validate-code.yml +1 -1
- package/CHANGELOG.md +13 -0
- package/CONTRIBUTING.md +24 -0
- package/README.md +50 -1
- package/dist/index.js +418 -48
- package/package.json +3 -4
- package/scripts/release.sh +157 -0
- package/src/commands/contracts/deploy.ts +6 -1
- package/src/commands/contracts/estimateFees.ts +133 -0
- package/src/commands/contracts/fees.ts +236 -0
- package/src/commands/contracts/index.ts +43 -0
- package/src/commands/contracts/write.ts +16 -3
- package/src/commands/localnet/validators.ts +4 -5
- package/src/lib/clients/jsonRpcClient.ts +9 -4
- package/src/lib/clients/system.ts +19 -17
- package/tests/actions/deploy.test.ts +49 -0
- package/tests/actions/estimateFees.test.ts +271 -0
- package/tests/actions/validators.test.ts +5 -5
- package/tests/actions/write.test.ts +47 -0
- package/tests/commands/deploy.test.ts +25 -0
- package/tests/commands/estimateFees.test.ts +98 -0
- package/tests/commands/write.test.ts +26 -0
- package/tests/libs/jsonRpcClient.test.ts +18 -0
- package/tests/libs/system.test.ts +36 -3
- package/tsconfig.json +2 -3
|
@@ -56,4 +56,22 @@ describe("JsonRpcClient - Successful and Unsuccessful Requests", () => {
|
|
|
56
56
|
body: expect.stringContaining('"method":"testMethod"'),
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
+
|
|
60
|
+
test("should reject JSON-RPC error responses even when HTTP status is ok", async () => {
|
|
61
|
+
(fetch as Mock).mockResolvedValueOnce({
|
|
62
|
+
ok: true,
|
|
63
|
+
json: async () => ({
|
|
64
|
+
jsonrpc: "2.0",
|
|
65
|
+
error: { code: -32603, message: "RPC failed" },
|
|
66
|
+
id: "1",
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const params: JsonRPCParams = {
|
|
71
|
+
method: "testMethod",
|
|
72
|
+
params: ["param1"],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
await expect(rpcClient.request(params)).rejects.toThrowError("RPC failed");
|
|
76
|
+
});
|
|
59
77
|
});
|
|
@@ -70,13 +70,15 @@ describe("System Functions - Error Paths", () => {
|
|
|
70
70
|
await expect(getVersion(toolName)).rejects.toThrow(`Error getting ${toolName} version.`);
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
test("getVersion
|
|
73
|
+
test("getVersion throws when stdout does not match version pattern", async () => {
|
|
74
74
|
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.resolve({
|
|
75
75
|
stdout: "",
|
|
76
76
|
stderr: ""
|
|
77
77
|
}));
|
|
78
|
-
const
|
|
79
|
-
expect(
|
|
78
|
+
const toolName = "git";
|
|
79
|
+
await expect(getVersion(toolName)).rejects.toThrow(
|
|
80
|
+
`Could not parse ${toolName} version from output`
|
|
81
|
+
);
|
|
80
82
|
});
|
|
81
83
|
|
|
82
84
|
test("getVersion throw error if stdout undefined", async () => {
|
|
@@ -87,6 +89,17 @@ describe("System Functions - Error Paths", () => {
|
|
|
87
89
|
await expect(getVersion(toolName)).rejects.toThrow(`Error getting ${toolName} version.`);
|
|
88
90
|
});
|
|
89
91
|
|
|
92
|
+
test("getVersion throws when stdout has non-matching version format (e.g. major-only)", async () => {
|
|
93
|
+
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.resolve({
|
|
94
|
+
stdout: "Docker version 25",
|
|
95
|
+
stderr: ""
|
|
96
|
+
}));
|
|
97
|
+
const toolName = "docker";
|
|
98
|
+
await expect(getVersion(toolName)).rejects.toThrow(
|
|
99
|
+
`Could not parse ${toolName} version from output`
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
|
|
90
103
|
test("checkCommand returns false if the command does not exist", async () => {
|
|
91
104
|
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.reject({
|
|
92
105
|
stdout: "",
|
|
@@ -96,6 +109,26 @@ describe("System Functions - Error Paths", () => {
|
|
|
96
109
|
await expect(checkCommand(`${toolName} --version`, toolName)).rejects.toThrow(new MissingRequirementError(toolName));
|
|
97
110
|
});
|
|
98
111
|
|
|
112
|
+
test("checkCommand throws MissingRequirementError when binary is not installed (ENOENT)", async () => {
|
|
113
|
+
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.reject({
|
|
114
|
+
code: 'ENOENT',
|
|
115
|
+
stderr: '',
|
|
116
|
+
message: 'spawn ENOENT'
|
|
117
|
+
}));
|
|
118
|
+
const toolName = 'docker';
|
|
119
|
+
await expect(checkCommand(`${toolName} --version`, toolName)).rejects.toThrow(new MissingRequirementError(toolName));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test("checkCommand throws MissingRequirementError when command exits without stderr", async () => {
|
|
123
|
+
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.reject({
|
|
124
|
+
code: 127,
|
|
125
|
+
stderr: '',
|
|
126
|
+
message: 'command failed'
|
|
127
|
+
}));
|
|
128
|
+
const toolName = 'docker';
|
|
129
|
+
await expect(checkCommand(`${toolName} --version`, toolName)).rejects.toThrow(new MissingRequirementError(toolName));
|
|
130
|
+
});
|
|
131
|
+
|
|
99
132
|
test("executeCommand throws an error if the command fails", async () => {
|
|
100
133
|
vi.mocked(util.promisify).mockReturnValueOnce(() => Promise.reject(new Error("Execution failed")));
|
|
101
134
|
await expect(executeCommand({
|
package/tsconfig.json
CHANGED
|
@@ -39,9 +39,8 @@
|
|
|
39
39
|
] /* Allow multiple folders to be treated as one when resolving modules. */,
|
|
40
40
|
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
41
41
|
"types": [
|
|
42
|
-
"
|
|
43
|
-
"node"
|
|
44
|
-
"@types/jest"
|
|
42
|
+
"vitest/globals",
|
|
43
|
+
"node"
|
|
45
44
|
] /* Specify type package names to be included without being referenced in a source file. */,
|
|
46
45
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
47
46
|
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|