npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@liqpro/liq-onchain

v0.56.0

Published

Onchain helpers for the Liq perpetuals exchange — deposits, collateral, accounts, positions, and settlement via viem.

Readme

@liq/onchain

Onchain helpers for the Liq perpetuals exchange — deposits, collateral, accounts, positions, and settlement via viem.

Overview

@liq/onchain provides the LiqOnchain façade and individual service classes for all onchain interactions: depositing USDC collateral, managing SNX accounts, reading open positions, and submitting settlement transactions to the Synthetix V3 PerpsMarketProxy. It also exports the canonical contract ABIs and EIP-712 signing utilities. The only runtime dependencies are @liq/core and viem.

Key Exports

LiqOnchain (façade)

Instantiated with OnchainConfig ({ chainId, walletClient, publicClient }). Exposes:

| Property | Service | Description | | ------------- | ------------------------- | ---------------------------------------------------- | | .accounts | AccountsService | Create SNX account NFTs, set book mode | | .collateral | CollateralService | Read available + locked margins | | .deposit | DepositService | USDC → sUSDC → modifyCollateral flow | | .positions | OnchainPositionsService | Read open positions from PerpsMarketProxy | | .delegate | Delegate7702Client | Gasless relay reads: delegate address, state(user) | | .settlement | SettlementService | Call settleBookOrders() |

Builders (standalone, no wallet required)

  • DepositBuilder / WithdrawBuilderbuild(): TxPlan returns the deposit / withdraw steps; each step's forwarderSafe flag says whether it can ride a wallet-sender batch
  • executeTypedData(chainId, user, { calls, nonce, deadline }) — the signTypedData arguments of a relayed batch
  • claimFaucetCall(faucetAddress, token) — the faucet claim as one PlanStep (forwarderSafe: false); sent by whichever sender the plan uses, wallet included
  • RepayBuilder.build() — the repay legs of a withdraw as a TxPlan (WithdrawBuilder.afterRepay)
  • tokenTransferPlan(token, amount, recipients) — a TxPlan of one direct ERC-20 transfer per recipient (forwarderSafe: false: transfer reads msg.sender); token is the { token, decimals } pair a getCollateral result already is, so the address and its decimals cannot drift apart

Sending a plan

A builder only returns a TxPlan (readonly PlanStep[]); turning it into transactions is the sender's job, picked at the call site:

  • executePlan(plan, { sender, publicClient }) — sends the plan group by group, waits for each receipt, stops at the first that doesn't land
  • walletSender(config) — batches a contiguous forwarderSafe run of steps into one TrustedMulticallForwarder.aggregate3 call; a step marked forwarderSafe: false (a bare ERC-20 approve) goes as its own transaction
  • relaySender(config) — sends the whole plan as one Delegate7702.execute batch through the gasless relay (ADR-0063)
  • landedOrThrow(outcome, what) — the outcome as a throw: returns LandedTx[] when the plan landed, throws PlanRevertedError (or the sender/transport's own error) otherwise

Signing utilities

  • signOrder(walletClient, domain, order) — EIP-712 sign an order message
  • buildSigningArgs(chainId, verifyingContract, order) — build signTypedData arguments

ABIs

  • perpsMarketProxyAbi, perpsAccountProxyAbi, bookOrderModuleAbi
  • spotMarketProxyAbi, trustedMulticallForwarderAbi, isolatedMarginManagerAbi, erc20Abi, oracleManagerProxyAbi
  • Legacy aliases: PERPS_MARKET_PROXY_ABI, PERPS_ACCOUNT_PROXY_ABI, SPOT_MARKET_PROXY_ABI, ERC20_ABI, TRUSTED_MULTICALL_FORWARDER_ABI

Oracle helpers

  • OnchainMarketsService.getChainlinkFeedAddress(nodeId) — resolves a price node's Chainlink-type (RedStone) feed address, or null when that node isn't type 3

Chain helpers

  • getViemChain(chainId) — returns viem Chain object for a given chain ID

Install

pnpm add @liq/onchain

Dependencies

  • @liq/core — chain config, contract addresses, shared types
  • viem — onchain interaction (read/write contracts, wallet client)

Build

moon run liq-onchain:build    # tsup → dist/