Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ EXAMPLES:

#### Staking Operations

Manage staking for validators and delegators on testnet-asimov. Staking is not available on localnet/studio.
Manage staking for validators and delegators on testnet-bradbury (or testnet-asimov). Staking is not available on localnet/studio.

```bash
USAGE:
Expand All @@ -325,7 +325,7 @@ COMMANDS:
banned-validators List all banned validators

COMMON OPTIONS (all commands):
--network <network> Network to use (localnet, testnet-asimov)
--network <network> Network to use (localnet, testnet-bradbury, testnet-asimov)
--rpc <rpcUrl> RPC URL override
--staking-address <address> Staking contract address override

Expand All @@ -342,11 +342,11 @@ OPTIONS (exit commands):
--validator <address> Validator address (for delegator commands)

EXAMPLES:
# Get epoch info (uses --network to specify testnet-asimov)
genlayer staking epoch-info --network testnet-asimov
# Get epoch info (uses --network to specify testnet-bradbury)
genlayer staking epoch-info --network testnet-bradbury

# Or set network globally first
genlayer network set testnet-asimov
genlayer network set testnet-bradbury

# Join as validator with 42000 GEN
genlayer staking validator-join --amount 42000gen
Expand Down
2 changes: 1 addition & 1 deletion docs/delegator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ You'll be prompted to set a password. This creates an encrypted keystore file.
## Step 2: Set Network to Testnet

```bash
genlayer network testnet-asimov
genlayer network testnet-bradbury
```

## Step 3: Fund Your Account
Expand Down
4 changes: 2 additions & 2 deletions docs/validator-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ Output:
## Step 3: Set Network to Testnet

```bash
genlayer network testnet-asimov
genlayer network testnet-bradbury
```

Verify with:
```bash
genlayer account show
```

You should see `network: 'Asimov Testnet'`.
You should see `network: 'Bradbury Testnet'`.

## Step 4: Fund Your Account

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"dotenv": "^17.0.0",
"ethers": "^6.13.4",
"fs-extra": "^11.3.0",
"genlayer-js": "^0.18.10",
"genlayer-js": "^0.21.0",
"inquirer": "^12.0.0",
"keytar": "^7.9.0",
"node-fetch": "^3.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/commands/contracts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ export class DeployAction extends BaseAction {

this.log("Deployment Receipt:", result);

const contractAddress =
result.data?.contract_address ?? // localnet/studio
(result.txDataDecoded as any)?.contractAddress; // testnet

this.succeedSpinner("Contract deployed successfully.", {
"Transaction Hash": hash,
"Contract Address": result.data?.contract_address,
"Contract Address": contractAddress,
});
} catch (error) {
this.failSpinner("Error deploying contract", error);
Expand Down
3 changes: 2 additions & 1 deletion src/lib/actions/BaseAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import chalk from "chalk";
import inquirer from "inquirer";
import { inspect } from "util";
import {createClient, createAccount} from "genlayer-js";
import {localnet, studionet, testnetAsimov} from "genlayer-js/chains";
import {localnet, studionet, testnetAsimov, testnetBradbury} from "genlayer-js/chains";
import type {GenLayerClient, GenLayerChain, Hash, Address, Account} from "genlayer-js/types";

// Built-in networks - always resolve fresh from genlayer-js
export const BUILT_IN_NETWORKS: Record<string, GenLayerChain> = {
"localnet": localnet,
"studionet": studionet,
"testnet-asimov": testnetAsimov,
"testnet-bradbury": testnetBradbury,
};

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/actions/setNetwork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {describe, test, vi, beforeEach, afterEach, expect} from "vitest";
import {NetworkActions} from "../../src/commands/network/setNetwork";
import {ConfigFileManager} from "../../src/lib/config/ConfigFileManager";
import inquirer from "inquirer";
import {localnet, studionet, testnetAsimov} from "genlayer-js/chains";
import {localnet, studionet, testnetAsimov, testnetBradbury} from "genlayer-js/chains";

vi.mock("../../src/lib/config/ConfigFileManager");
vi.mock("inquirer");
Expand Down Expand Up @@ -109,6 +109,7 @@ describe("NetworkActions", () => {
{name: localnet.name, value: "localnet"},
{name: studionet.name, value: "studionet"},
{name: testnetAsimov.name, value: "testnet-asimov"},
{name: testnetBradbury.name, value: "testnet-bradbury"},
],
},
]);
Expand Down
1 change: 1 addition & 0 deletions tests/actions/staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ vi.mock("genlayer-js/chains", () => ({
localnet: {id: 1, name: "localnet", rpcUrls: {default: {http: ["http://localhost:8545"]}}},
studionet: {id: 2, name: "studionet", rpcUrls: {default: {http: ["https://studionet.genlayer.com"]}}},
testnetAsimov: {id: 3, name: "testnet-asimov", rpcUrls: {default: {http: ["https://testnet.genlayer.com"]}}},
testnetBradbury: {id: 4, name: "testnet-bradbury", rpcUrls: {default: {http: ["https://testnet.genlayer.com"]}}},
}));

const mockTxResult = {
Expand Down
21 changes: 13 additions & 8 deletions tests/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import {describe, it, expect, beforeAll} from "vitest";
import {createClient, parseStakingAmount, formatStakingAmount} from "genlayer-js";
import {testnetAsimov} from "genlayer-js/chains";
import type {Address} from "genlayer-js/types";
import {testnetAsimov, testnetBradbury} from "genlayer-js/chains";
import type {Address, GenLayerChain} from "genlayer-js/types";

const TIMEOUT = 30_000;

describe("Testnet Asimov - CLI Staking Smoke Tests", () => {
const testnets: {name: string; chain: GenLayerChain}[] = [
{name: "Asimov", chain: testnetAsimov},
{name: "Bradbury", chain: testnetBradbury},
];

for (const {name, chain} of testnets) {

describe(`Testnet ${name} - CLI Staking Smoke Tests`, () => {
let client: ReturnType<typeof createClient>;

beforeAll(() => {
client = createClient({chain: testnetAsimov});
client = createClient({chain});
});

it("getEpochInfo returns valid epoch info", async () => {
const info = await client.getEpochInfo();
expect(typeof info.currentEpoch).toBe("bigint");
expect(typeof info.lastFinalizedEpoch).toBe("bigint");
expect(typeof info.validatorMinStake).toBe("string");
expect(typeof info.validatorMinStakeRaw).toBe("bigint");
expect(typeof info.delegatorMinStake).toBe("string");
expect(typeof info.delegatorMinStakeRaw).toBe("bigint");
expect(typeof info.activeValidatorsCount).toBe("bigint");
expect(typeof info.epochMinDuration).toBe("bigint");
expect(info.currentEpoch >= 0n).toBe(true);
Expand Down Expand Up @@ -127,3 +130,5 @@ describe("Testnet Asimov - CLI Staking Smoke Tests", () => {
expect(formatted).toContain("1.5");
});
});

} // end for loop over testnets
Loading