Skip to content

Conversation

@Joinhack
Copy link
Collaborator

@Joinhack Joinhack commented Nov 4, 2025

This PR reorganizes and expands the CLI commands, adds full stake contract support
Reorganizes command modules into subfolders (meta, program, register, stake, time, tools)
Fixes many require path issues, adds getBlsStakeContractClient in utils, and improves user-facing messages (e.g., "fail" → "failed", "invaild" → "invalid").

Add a new "stake" command group to the CLI with multiple subcommands to manage the BLESS staking contract.

New commands:
stake init — initialize stake state
stake deposit — deposit tokens and create a stake
stake unstake — mark stake for unstaking (by sequence)
stake withdraw — withdraw tokens (by sequence)
stake pending-admin — set a pending admin
stake accept-admin — accept pending admin
stake set-apr — set APR configuration (range)
stake set-factor — set APR factor (secondsPerPeriods, periodsPerYear)
stake pause — pause/resume stake activity
Adds index for stake commands at command/stake/index.js and implements related utility interactions.

Why

Exposes stake contract lifecycle and admin operations via CLI to make it easy to manage staking configuration and user stake flows from scripts or the terminal.
Supports both locally-signed and Squads (external multisig) signing flows via --squads option for compatible operations.

Files added

command/stake/index.js
command/stake/stake_init.js
command/stake/deposit.js
command/stake/unstake.js
command/stake/withdraw.js
command/stake/set_pending_admin.js
command/stake/accept_admin.js
command/stake/set_apr.js
command/stake/set_apr_factor.js
command/stake/pause.js
Key details

Each command supports:
--cluster: mainnet/testnet/devnet/localnet or custom RPC

--signer: path to signer keypair (defaults to WALLET_PATH)

--programId: override program id (useful for testnet/devnet/localnet)

--squads: if set, the command will create an unsigned/signable-by-Squads transaction (bs58 output) instead of submitting a signed transaction

For admin operations, there is --admin argument to specify admin pubkey or keypair depending on mode
Commands perform input validation (e.g., parsing BN for sequence/amount, validating public keys, JSON parsing for APR)
On squads mode, commands produce a base58 serialized transaction (via bs58Message) for external signing/relay
On non-squads mode, commands read local keypairs and submit transactions directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants