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

@pear-protocol/symmio-client

v0.3.24

Published

Standalone SDK for Symmio — account management, trading, deposits, withdrawals, and protocol interactions via MultiAccount

Readme

@pear-protocol/symmio-client

Pear Protocol's standalone SDK for Symmio — account management via MultiAccount, trading, deposits/withdrawals, batch operations, ClearingHouse, and administrative actions.

Package rename: this SDK now publishes as @pear-protocol/symmio-client.

Installation

bun add @pear-protocol/symmio-client viem

viem is a peer dependency and must be installed alongside @pear-protocol/symmio-client.

Quick Start

import { SymmioSDK } from '@pear-protocol/symmio-client';
import { createPublicClient, createWalletClient, http, custom } from 'viem';
import { arbitrum } from 'viem/chains';

// Set up viem clients
const publicClient = createPublicClient({
  chain: arbitrum,
  transport: http(),
});

const walletClient = createWalletClient({
  chain: arbitrum,
  transport: custom(window.ethereum),
});

// Initialize the Symmio client SDK
const sdk = new SymmioSDK({
  chainId: 42161,
  publicClient,
  walletClient,
});

Core Actions

Account Management

// Create an account
const hash = await sdk.account.addAccount('Trading Account');

// Edit account name
await sdk.account.editName(accountAddress, 'New Name');

// Get all accounts for a user
const accounts = await sdk.account.getAll(userAddress);

// Get account count
const count = await sdk.account.getCount(userAddress);

Token Approval

// Approve the MultiAccount contract to spend your USDC
await sdk.approval.approveCollateral(amount);

// Check approval state
import { ApprovalState } from '@pear-protocol/symmio-client';
const state = await sdk.approval.getState(tokenAddr, owner, spender, amount);

Deposits

// Standard deposit
await sdk.deposit.standard({
  account: '0x...',
  amount: 100_000_000n, // 100 USDC (6 decimals)
});

// Deposit and allocate in a single transaction
await sdk.deposit.depositAndAllocate({
  account: '0x...',
  amount: 100_000_000n,
});

Withdrawals

// Withdraw from an account
await sdk.withdraw.withdraw({
  account: '0x...',
  amount: 50_000_000n,
});

Allocate / Deallocate

// Allocate collateral to trading
await sdk.collateral.allocate(subAccount, { amount: 50_000_000n });

// Deallocate with Muon signature
const deallocSig = await sdk.getDeallocateSig(subAccount);
await sdk.collateral.deallocate(subAccount, {
  amount: 25_000_000n,
  upnlSig: deallocSig,
});

// Internal transfer between accounts
await sdk.collateral.internalTransfer(subAccount, {
  recipient: otherAccount,
  amount: 10_000_000n,
});

Trading

import { PositionType, OrderType, MARKET_ORDER_DEADLINE } from '@pear-protocol/symmio-client';

// Get Muon signature for opening a position
const quoteSig = await sdk.getQuoteSig(subAccount, symbolId);

// Open a position
await sdk.trade.sendQuote(subAccount, {
  partyBsWhiteList: ['0x...'],
  symbolId: 1,
  positionType: PositionType.LONG,
  orderType: OrderType.MARKET,
  price: 50000_000000000000000000n,
  quantity: 1_000000000000000000n,
  cva: ...,
  lf: ...,
  partyAmm: ...,
  partyBmm: ...,
  maxFundingRate: ...,
  deadline: BigInt(Math.floor(Date.now() / 1000)) + MARKET_ORDER_DEADLINE,
  affiliate: '0x...',
  upnlSig: quoteSig,
});

// Batch open multiple positions with one Muon sig
const batchSig = await sdk.getBatchSig(subAccount, [1, 2, 3]);
await sdk.trade.batchSendQuote(subAccount, {
  quotes: [quote1, quote2, quote3],
  upnlSig: batchSig,
});

// Close a position
await sdk.trade.closePosition(subAccount, {
  quoteId: 1n,
  closePrice: price,
  quantityToClose: quantity,
  orderType: OrderType.MARKET,
  deadline: BigInt(Math.floor(Date.now() / 1000)) + MARKET_ORDER_DEADLINE,
});

// Cancel operations
await sdk.trade.cancelQuote(subAccount, quoteId);
await sdk.trade.cancelCloseRequest(subAccount, quoteId);

Delegation

// Delegate access to trading selectors
await sdk.delegation.delegateAccess({
  account: subAccount,
  delegate: delegateAddress,
  selectors: ALL_TRADING_SELECTORS,
});

// Propose to revoke access (starts cooldown)
await sdk.delegation.proposeRevoke({
  account: subAccount,
  delegate: delegateAddress,
  selectors: ALL_TRADING_SELECTORS,
});

// Revoke access (after cooldown)
await sdk.delegation.revokeAccess({
  account: subAccount,
  delegate: delegateAddress,
  selectors: ALL_TRADING_SELECTORS,
});

Terms of Service

// Sign and store terms on-chain
const sig = await sdk.signature.signTerms();
await sdk.signature.storeSignature(sig);

// Check if user has signed
const hasSigned = await sdk.signature.hasSigned(userAddress);

Direct Action Modules

For advanced usage, all action modules are exported individually:

import {
  accountActions,
  depositActions,
  withdrawActions,
  allocateActions,
  tradeActions,
  closeActions,
  cancelActions,
  approvalActions,
  delegationActions,
  signatureActions,
  adminActions,
} from '@pear-protocol/symmio-client';

// Use prepare* functions for framework integration (wagmi, ethers, etc.)
const prepared = tradeActions.prepareSendQuote(
  multiAccount,
  account,
  subAccount,
  params
);
// prepared.config contains { account, to, data, value }

Utilities

import { toWei, fromWei, formatPrice, applySlippage } from '@pear-protocol/symmio-client';

const amount = toWei('100', 6);         // 100000000n
const display = fromWei(100000000n, 6);  // "100"
const slipped = applySlippage(price, 1.0, true); // +1% for longs

Architecture

@pear-protocol/symmio-client
├── client.ts          → SymmioSDK class (main entry point)
├── actions/           → All on-chain transaction builders + executors
│   ├── account.ts     → Account management (MultiAccount)
│   ├── deposit.ts     → Standard deposits
│   ├── withdraw.ts    → Withdrawals
│   ├── allocate.ts    → Allocate, deallocate, internal transfer
│   ├── trade.ts       → Open positions, batch, pair trades
│   ├── close.ts       → Close, batch close, ADL close
│   ├── cancel.ts      → Cancel quotes and close requests
│   ├── approval.ts    → ERC-20 token approvals
│   ├── delegation.ts  → Delegation and access management
│   ├── signature.ts   → Terms of service signing & storage
│   └── admin.ts       → Role admin
├── abis/              → Contract ABIs
├── clients/           → External service clients (Muon)
├── constants/         → Addresses, chains, selectors, defaults
├── types/             → Full TypeScript type system
└── utils/             → Encoding, gas, validation, formatting

Releases

This package uses Changesets for versioning and npm publishing.

# create a release note for your change
bun run changeset

# apply pending version bumps and refresh bun.lock
bun run version-packages

# publish the package to npm
bun run release

The GitHub Actions release workflow expects an NPM_TOKEN repository secret with publish access to @pear-protocol/symmio-client.

License

MIT