genlayer 0.38.10 → 0.38.11
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/CHANGELOG.md +6 -0
- package/dist/index.js +14 -4
- package/package.json +1 -1
- package/src/commands/staking/StakingAction.ts +17 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.38.11 (2026-04-01)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* work around GenLayer RPC rejecting JSON-RPC id=0 ([74b71ab](https://github.com/genlayerlabs/genlayer-cli/commit/74b71ab91a6e80343d5d1560fcacbe37f74bac64))
|
|
8
|
+
|
|
3
9
|
## 0.38.10 (2026-03-31)
|
|
4
10
|
|
|
5
11
|
### Bug Fixes
|
package/dist/index.js
CHANGED
|
@@ -20078,7 +20078,7 @@ var require_cli_table3 = __commonJS({
|
|
|
20078
20078
|
import { program } from "commander";
|
|
20079
20079
|
|
|
20080
20080
|
// package.json
|
|
20081
|
-
var version = "0.38.
|
|
20081
|
+
var version = "0.38.11";
|
|
20082
20082
|
var package_default = {
|
|
20083
20083
|
name: "genlayer",
|
|
20084
20084
|
version,
|
|
@@ -56040,6 +56040,16 @@ function initializeTransactionsCommands(program2) {
|
|
|
56040
56040
|
// src/commands/staking/StakingAction.ts
|
|
56041
56041
|
import { readFileSync as readFileSync8, existsSync as existsSync8 } from "fs";
|
|
56042
56042
|
import { ethers as ethers6, ZeroAddress } from "ethers";
|
|
56043
|
+
var glHttpConfig = {
|
|
56044
|
+
async fetchFn(url, init) {
|
|
56045
|
+
if (init?.body) {
|
|
56046
|
+
const body = JSON.parse(init.body);
|
|
56047
|
+
if (body.id === 0) body.id = 1;
|
|
56048
|
+
init = { ...init, body: JSON.stringify(body) };
|
|
56049
|
+
}
|
|
56050
|
+
return fetch(url, init);
|
|
56051
|
+
}
|
|
56052
|
+
};
|
|
56043
56053
|
var STAKING_TREE_ABI = [
|
|
56044
56054
|
{
|
|
56045
56055
|
name: "validatorsRoot",
|
|
@@ -56181,11 +56191,11 @@ var StakingAction = class extends BaseAction {
|
|
|
56181
56191
|
const account = privateKeyToAccount(privateKey);
|
|
56182
56192
|
const publicClient = createPublicClient({
|
|
56183
56193
|
chain: network,
|
|
56184
|
-
transport: http3(rpcUrl)
|
|
56194
|
+
transport: http3(rpcUrl, glHttpConfig)
|
|
56185
56195
|
});
|
|
56186
56196
|
const walletClient = createWalletClient({
|
|
56187
56197
|
chain: network,
|
|
56188
|
-
transport: http3(rpcUrl),
|
|
56198
|
+
transport: http3(rpcUrl, glHttpConfig),
|
|
56189
56199
|
account
|
|
56190
56200
|
});
|
|
56191
56201
|
return {
|
|
@@ -56207,7 +56217,7 @@ var StakingAction = class extends BaseAction {
|
|
|
56207
56217
|
}
|
|
56208
56218
|
const publicClient = createPublicClient({
|
|
56209
56219
|
chain: network,
|
|
56210
|
-
transport: http3(rpcUrl)
|
|
56220
|
+
transport: http3(rpcUrl, glHttpConfig)
|
|
56211
56221
|
});
|
|
56212
56222
|
const root = await publicClient.readContract({
|
|
56213
56223
|
address: stakingAddress,
|
package/package.json
CHANGED
|
@@ -3,9 +3,22 @@ import {createClient, createAccount, formatStakingAmount, parseStakingAmount, ab
|
|
|
3
3
|
import type {GenLayerClient, GenLayerChain, Address} from "genlayer-js/types";
|
|
4
4
|
import {readFileSync, existsSync} from "fs";
|
|
5
5
|
import {ethers, ZeroAddress} from "ethers";
|
|
6
|
-
import {createPublicClient, createWalletClient, http, type PublicClient, type WalletClient, type Chain, type Account} from "viem";
|
|
6
|
+
import {createPublicClient, createWalletClient, http, type PublicClient, type WalletClient, type Chain, type Account, type HttpTransportConfig} from "viem";
|
|
7
7
|
import {privateKeyToAccount} from "viem/accounts";
|
|
8
8
|
|
|
9
|
+
// GenLayer RPC rejects JSON-RPC requests with id=0 (treats 0 as missing).
|
|
10
|
+
// Viem starts its id counter at 0, so we ensure non-zero ids.
|
|
11
|
+
const glHttpConfig: HttpTransportConfig = {
|
|
12
|
+
async fetchFn(url, init) {
|
|
13
|
+
if (init?.body) {
|
|
14
|
+
const body = JSON.parse(init.body as string);
|
|
15
|
+
if (body.id === 0) body.id = 1;
|
|
16
|
+
init = {...init, body: JSON.stringify(body)};
|
|
17
|
+
}
|
|
18
|
+
return fetch(url, init);
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
9
22
|
// Extended ABI for tree traversal (not in SDK)
|
|
10
23
|
const STAKING_TREE_ABI = [
|
|
11
24
|
{
|
|
@@ -201,12 +214,12 @@ export class StakingAction extends BaseAction {
|
|
|
201
214
|
|
|
202
215
|
const publicClient = createPublicClient({
|
|
203
216
|
chain: network,
|
|
204
|
-
transport: http(rpcUrl),
|
|
217
|
+
transport: http(rpcUrl, glHttpConfig),
|
|
205
218
|
});
|
|
206
219
|
|
|
207
220
|
const walletClient = createWalletClient({
|
|
208
221
|
chain: network,
|
|
209
|
-
transport: http(rpcUrl),
|
|
222
|
+
transport: http(rpcUrl, glHttpConfig),
|
|
210
223
|
account,
|
|
211
224
|
});
|
|
212
225
|
|
|
@@ -232,7 +245,7 @@ export class StakingAction extends BaseAction {
|
|
|
232
245
|
|
|
233
246
|
const publicClient = createPublicClient({
|
|
234
247
|
chain: network,
|
|
235
|
-
transport: http(rpcUrl),
|
|
248
|
+
transport: http(rpcUrl, glHttpConfig),
|
|
236
249
|
});
|
|
237
250
|
|
|
238
251
|
// Get the root of the validator tree
|