diff --git a/README.md b/README.md index b567cf40..39d8540e 100644 --- a/README.md +++ b/README.md @@ -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: @@ -325,7 +325,7 @@ COMMANDS: banned-validators List all banned validators COMMON OPTIONS (all commands): - --network Network to use (localnet, testnet-asimov) + --network Network to use (localnet, testnet-bradbury, testnet-asimov) --rpc RPC URL override --staking-address
Staking contract address override @@ -342,11 +342,11 @@ OPTIONS (exit commands): --validator
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 diff --git a/docs/delegator-guide.md b/docs/delegator-guide.md index 25380c42..7c5b1e29 100644 --- a/docs/delegator-guide.md +++ b/docs/delegator-guide.md @@ -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 diff --git a/docs/validator-guide.md b/docs/validator-guide.md index 48b19ad8..e023b04a 100644 --- a/docs/validator-guide.md +++ b/docs/validator-guide.md @@ -64,7 +64,7 @@ Output: ## Step 3: Set Network to Testnet ```bash -genlayer network testnet-asimov +genlayer network testnet-bradbury ``` Verify with: @@ -72,7 +72,7 @@ Verify with: genlayer account show ``` -You should see `network: 'Asimov Testnet'`. +You should see `network: 'Bradbury Testnet'`. ## Step 4: Fund Your Account diff --git a/package-lock.json b/package-lock.json index 07734cd0..b33a66a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,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", @@ -5581,9 +5581,9 @@ } }, "node_modules/genlayer-js": { - "version": "0.18.10", - "resolved": "https://registry.npmjs.org/genlayer-js/-/genlayer-js-0.18.10.tgz", - "integrity": "sha512-/femmDnoGMm9fTotobkqTndOE//UcJWY1QYLQFueE/rE25shL77vCjKWtg/hj0U8xxg26Mksfjcr/crO22i5kA==", + "version": "0.21.0", + "resolved": "https://registry.npmjs.org/genlayer-js/-/genlayer-js-0.21.0.tgz", + "integrity": "sha512-zUlz74nZPwNcpPiiGk5Njfn0YLbRhmPsIQECMYHivDBp5DI5lrUQt5H3wd4Q+p7af3lk0uzg0jbo31iVaAyTiA==", "license": "MIT", "dependencies": { "eslint-plugin-import": "^2.30.0", diff --git a/package.json b/package.json index c809a896..b50958c1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/commands/contracts/deploy.ts b/src/commands/contracts/deploy.ts index 31454c96..d4f1d703 100644 --- a/src/commands/contracts/deploy.ts +++ b/src/commands/contracts/deploy.ts @@ -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); diff --git a/src/lib/actions/BaseAction.ts b/src/lib/actions/BaseAction.ts index fd7d72ce..086b6add 100644 --- a/src/lib/actions/BaseAction.ts +++ b/src/lib/actions/BaseAction.ts @@ -5,7 +5,7 @@ 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 @@ -13,6 +13,7 @@ export const BUILT_IN_NETWORKS: Record = { "localnet": localnet, "studionet": studionet, "testnet-asimov": testnetAsimov, + "testnet-bradbury": testnetBradbury, }; /** diff --git a/tests/actions/setNetwork.test.ts b/tests/actions/setNetwork.test.ts index 0b185030..a7698150 100644 --- a/tests/actions/setNetwork.test.ts +++ b/tests/actions/setNetwork.test.ts @@ -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"); @@ -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"}, ], }, ]); diff --git a/tests/actions/staking.test.ts b/tests/actions/staking.test.ts index 56fffc76..3d314c5c 100644 --- a/tests/actions/staking.test.ts +++ b/tests/actions/staking.test.ts @@ -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 = { diff --git a/tests/smoke.test.ts b/tests/smoke.test.ts index d5b4d34b..767226e9 100644 --- a/tests/smoke.test.ts +++ b/tests/smoke.test.ts @@ -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; 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); @@ -127,3 +130,5 @@ describe("Testnet Asimov - CLI Staking Smoke Tests", () => { expect(formatted).toContain("1.5"); }); }); + +} // end for loop over testnets