@wireio/stake
v3.1.2
Published
WireDev v3 Outpost and LIQ SDK
Readme
@wireio/stake
@wireio/stake version 3.1.0 targets WireDev v3 Outpost and LIQ staking integrations. The package name remains @wireio/stake; "Outpost" is the WireDev v3 infrastructure/API domain used by the EVM and Solana clients.
GitHub Release Notes: v3.0.1
@wireio/stake 3.0.1 is a breaking refactor from the experimental staking SDK surface to the current WireDev v3 Outpost/LIQ infrastructure.
Highlights:
- Rebuilt the EVM integration around the new WireDev v3 contract suite:
OPP,OPPInbound,ReserveManager,StakingManager,OperatorRegistry,OutpostManager,BAR, and the LIQ contracts. - Added
EvmOutpostClientwith ABI-aligned helpers for native/LiqETH conversion, queued withdrawals, LIQ staking, pretoken purchases, reserve creation/cancellation, swap requests, operator collateral, BAR bonding, OPP epoch reads/submits, and portfolio/status reads. - Aligned EVM reserve creation with the current
ReserveManagerABI: reserve creates now requireisPrivateand the creator's compressed secp256k1creatorPubKey. - Preserved the
Stakerfacade and familiar staking-domain methods where they map cleanly to v3 contracts:deposit,withdraw,stake,unstake,buy,depositAndStake,depositAndBuy, andunstakeAndWithdraw. - Updated WireDev EVM to chain id
31337and the VM RPC targethttps://ethereum-vm.gitgo.app, with future-proof registry slots for additional EVM chains once their v3 artifacts and address books exist. - Updated the WireDev EVM address book to the current deployment set, including OPP, reserve/staking managers, LIQ contracts, linked libraries, and mock/test helper addresses.
- Added the Solana WireDev
opp_outpostIDL/type surface while keeping the existing liqSOL program layout intact. WireDev Solana type helpers now derive directly from their checked-in JSON IDLs so imported artifacts and SDK types stay in sync during the v3 rollout. - Kept deprecated legacy EVM entrypoints as explicit failures where possible so old imports fail with actionable migration messages instead of silently calling removed contracts.
Breaking changes and removals:
- Legacy EVM
Depositor,Pretoken,ReceiptNFT,Pool,EthUsdPriceConsumer, bridge, and Instaswap flows are no longer part of the live WireDev v3 contract model. - EVM stake-to-Wire account-name variants and the pre-reserve bridge/Instaswap clients are removed; swaps use ReserveManager/OPP requests.
IStakingClientremains only as a deprecated alias; new code should useIOutpostClient.- This release is not intended to support the legacy experimental EVM infrastructure and WireDev v3 side by side.
Known follow-up work:
- Add mainnet/Hoodi/Monad/Polygon contract deployments when v3 artifacts are available.
- Complete additional chain deployments as their ReserveManager/OPP artifacts become available.
- Add OPP reserve programs for public Solana devnet/mainnet when matching deployments and IDLs are available.
Current Direction
Version 3.0.1 is not backward compatible with the earlier experimental SDK. The EVM WireDev artifact set no longer exposes the old Depositor, Pretoken, ReceiptNFT, Pool, EthUsdPriceConsumer, legacy bridge, or legacy Instaswap contracts. The SDK now treats the new infrastructure names as the public integration model:
- EVM Outpost:
OPP,OPPInbound,ReserveManager,StakingManager,OperatorRegistry,OutpostManager,BAR - EVM LIQ:
LiqEthToken,DepositManager,StakingModule,YieldOracle,WithdrawalQueue - Solana WireDev: existing liqSOL programs plus the new
opp_outpostprogram
Mainnet, Hoodi, Monad, and Polygon remain in the chain registry for connection/read-only future proofing, but the WireDev v3 EVM contract service is currently configured only for WireDev chain id 31337.
Important IDs
EVM_WIRE_DEVNET_CHAIN_ID:31337SOL_WIRE_DEVNET_CHAIN_ID:wiredev- Solana OPP Outpost program: derived from
src/assets/solana/wiredev/idl/opp_outpost.json
Primary Usage
import {EVM_WIRE_DEVNET_CHAIN_ID, EvmOutpostClient, Staker} from '@wireio/stake';
import {ethers} from 'ethers';
const provider = new ethers.providers.Web3Provider(window.ethereum);
const client = new EvmOutpostClient({
provider,
network: {
chainId: EVM_WIRE_DEVNET_CHAIN_ID,
name: 'WireDev EVM',
rpcUrls: ['https://ethereum-vm.gitgo.app'],
nativeCurrency: {symbol: 'ETH', decimals: 18},
},
});
const summary = await client.getOutpostSummary();
const reserve = await client.getReserve(1n, 1n);Staker still exists as the multi-chain selector used by Hub. It keeps the staking-domain convenience methods (deposit, withdraw, stake, unstake, buy) where those actions still exist, and concrete clients expose more explicit modules for reserves, swaps, operators, OPP, and chain-specific details.
EVM v3 Methods
EvmOutpostClient exposes ABI-aligned helpers:
- Reserve lifecycle:
createNativeReserve,createErc20ReserveWithApproval,createErc20ReserveWithPermit,cancelReserve,getReserve,reserveBalance - Reserve create helpers verify the configured
ReserveManagerinterface and chain/token setup before opening a value-bearing wallet transaction. A stale deployment address now fails locally with a configuration error instead of broadcasting against an incompatible proxy. Reserve creates also treat a failed gas simulation as a blocking error rather than substituting the general write fallback gas limit. - Swap requests:
requestNativeSwap,requestErc20SwapWithApproval,requestErc20SwapWithPermit - LIQ conversion:
depositNativeForLiqETH,requestLiqETHWithdrawal,claimLiqETHWithdrawal,getPendingWithdraws - LIQ staking:
stakeLiqETH,withdrawStakedLiqETH,refundStakedLiqETH - Pretokens:
purchaseWirePretokensWithLiqETH,purchaseWirePretokensFromYield - Operators/BAR:
depositOperatorCollateral,depositNonNativeOperatorCollateral,withdrawOperatorCollateral,commitUnderwriteIntent,bondActor,unbondActor - OPP:
emitOutboundEnvelope,finalizeOppEpoch,submitInboundEpoch - Reads:
getContracts,getNativeBalance,getErc20Balance,getPortfolio,getOutpostSummary
The flat compatibility methods map to the v3 contracts as follows:
deposit(amount)->DepositManager.deposit()throughdepositNativeForLiqETHwithdraw(amount)->LiqEthToken.safeBurn(...)throughrequestLiqETHWithdrawalstake(amount)->StakingManager.stakeLiqETH(...)unstake(tokenId)->StakingManager.withdrawStake(...)throughwithdrawStakedLiqETHbuy(amount)->StakingManager.purchasePretokensWithLiqETH(...)depositAndStake(amount)anddepositAndBuy(amount)run two-step flows using the net liqETH minted by the deposit event when availableunstakeAndWithdraw(tokenId)withdraws the stake to liqETH, then burns the received liqETH into a withdrawal request
Reserve-create helpers require the current ABI payload:
await client.createNativeReserve({
tokenCode,
reserveCode,
externalTokenAmount,
requestedWireAmount,
connectorWeightBps,
name,
description,
isPrivate: false,
creatorPubKey, // 33-byte compressed secp256k1 key for the connected EVM signer
});Deprecated from v3
These legacy flows are intentionally deprecated for WireDev v3:
getTrancheSnapshotfor EVM pretoken ladders- EVM
validatorDeposit stake(amount, wireAccount)/depositAndStake(amount, wireAccount)account-name variants fromDepositor.stakeLiqETHToWire- Pre-reserve Instaswap and bridge-deposit helpers
New swap flows call ReserveManager through EvmOutpostClient, the Solana
opp_outpost program through SolanaSwapClient, and sysio.uwrit for
WIRE-origin submission and final lifecycle state.
The Depositor-era Pretoken unit test and local transaction/routing scripts have
also been retired. They imported the removed src/networks/ethereum tree and
were not valid compatibility coverage. Active tests now exercise only the v3
client surface; local EVM smoke checks start from EvmOutpostClient.
Solana WireDev
The existing four Solana program IDLs remain in place. WireDev now also includes:
- IDL:
src/assets/solana/wiredev/idl/opp_outpost.json - Type helper:
src/assets/solana/wiredev/types/opp_outpost.ts - Program lookup name:
oppOutpost - Program ID constant:
PROGRAM_IDS_BY_CHAIN[SOL_WIRE_DEVNET_CHAIN_ID].OPP_OUTPOST
The changed WireDev Solana type helpers (liqsol_core, opp_outpost, transfer_hook, and validator_leaderboard) intentionally derive their exported TypeScript shape from the adjacent JSON IDL. This avoids stale generated literal types while the backend programs are still changing. liqsol_token remains unchanged for this refresh.
Reserve lifecycle helpers use the PDA seed contract confirmed in the matching
wire-solana program source. They are available through either
client.reserves or the standalone SolanaReserveClient:
const signature = await solanaClient.reserves.create({
tokenCode,
reserveCode,
externalTokenAmount,
requestedWireAmount,
connectorWeightBps: 5_000,
name: 'USDC / WIRE',
description: 'Public Solana reserve',
isPrivate: false,
mint: usdcMint,
});
const reserve = await solanaClient.reserves.get({tokenCode, reserveCode});create ensures the creator's classic SPL associated token account by default,
derives the reserve/vault/config/message-buffer PDAs, and submits the current
opp_outpost::create_reserve account shape. Matching and WIRE collateral remain
Wire-chain operations owned by @wireio/sdk-core's sysio.reserv client.
The same client exposes current native and classic-SPL source escrow through
client.swaps. The returned Solana signature confirms source submission, not
cross-chain settlement; applications should read sysio.uwrit for relay,
underwriting, completion, and revert state.
const signature = await solanaClient.swaps.requestNative({
sourceTokenCode: solTokenCode,
sourceReserveCode: primaryReserveCode,
sourceAmount: 100_000_000n,
targetChainCode: wireChainCode,
targetTokenCode: wireTokenCode,
targetReserveCode: primaryReserveCode,
targetRecipient: new TextEncoder().encode('alice'),
targetAmount: quotedWireAmount,
targetToleranceBps: 500,
});Both EVM and Solana creation paths validate the shared depot constraints before opening a wallet prompt, including the portable connector-weight range of 1–9,999 and the on-chain UTF-8 metadata limits.
Commands
npm ci
npx tsc -p tsconfig.json --noEmit
npm run prepare
npm testNotes for Hub Migration
Use WireDev as the first v3 target. Keep the familiar staking actions in Hub where the user intent is unchanged, but route advanced outpost work through the explicit modules: client.reserves, client.swaps, client.operators, and client.opp. Add mainnet/Hoodi/Monad/Polygon deployments when their v3 artifacts and address books are available.
