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

@cowprotocol/sdk-order-signing

v0.1.31

Published

TypeScript order signing for CoW Protocol SDK

Readme

SDK Order Signing

This package provides EIP-712 order signing and cancellation utilities for the CoW Protocol. It handles all the cryptographic operations required to sign orders and cancellations according to CoW Protocol's specifications.

Installation

npm install @cowprotocol/sdk-order-signing
or
pnpm add @cowprotocol/sdk-order-signing
or
yarn add @cowprotocol/sdk-order-signing

Usage

import { OrderSigningUtils, SupportedChainId, UnsignedOrder, SigningResult } from '@cowprotocol/sdk-order-signing'
import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
import { JsonRpcProvider, Wallet } from 'ethers'

// Configure the adapter
const provider = new JsonRpcProvider('YOUR_RPC_URL')
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
const adapter = new EthersV6Adapter({ provider, signer: wallet })

// Configure the global adapter
setGlobalAdapter(adapter)

// Sign an order using static methods
const orderToSign: UnsignedOrder = {
  sellToken: '0xA0b86a33E6417b528874E10EB3a95beb4F25A0E3',
  buyToken: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
  sellAmount: '1000000000000000000',
  buyAmount: '1000000000000000000',
  validTo: Math.floor(Date.now() / 1000) + 3600,
  appData: '0x0000000000000000000000000000000000000000000000000000000000000000',
  feeAmount: '0',
  kind: 'sell',
  partiallyFillable: false,
  sellTokenBalance: 'erc20',
  buyTokenBalance: 'erc20',
  receiver: '0x0000000000000000000000000000000000000000',
}

const signingResult: SigningResult = await OrderSigningUtils.signOrder(
  orderToSign,
  SupportedChainId.MAINNET,
  adapter.signer,
)

// Sign order cancellation
const orderId = 'ORDER_UID_TO_CANCEL'
const cancellationResult = await OrderSigningUtils.signOrderCancellation(
  orderId,
  SupportedChainId.MAINNET,
  adapter.signer,
)

// Generate order ID
const { orderId: generatedId, orderDigest } = await OrderSigningUtils.generateOrderId(
  SupportedChainId.MAINNET,
  orderToSign as any,
  { owner: await adapter.signer.getAddress() },
)

Usage with CoW SDK

import { CowSdk, OrderSigningUtils, SupportedChainId, UnsignedOrder } from '@cowprotocol/cow-sdk'
import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
import { JsonRpcProvider, Wallet } from 'ethers'

// Configure the adapter
const provider = new JsonRpcProvider('YOUR_RPC_URL')
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
const adapter = new EthersV6Adapter({ provider, signer: wallet })

// Initialize the unified SDK
const sdk = new CowSdk({
  chainId: SupportedChainId.MAINNET,
  adapter,
})

// Use static methods through sdk.orderSigning
const signingResult = await sdk.orderSigning.signOrder(orderToSign, SupportedChainId.MAINNET, adapter.signer)

// Sign cancellation
const cancellationResult = await sdk.orderSigning.signOrderCancellation(
  orderId,
  SupportedChainId.MAINNET,
  adapter.signer,
)

Signing Schemes

The SDK supports multiple signing schemes:

EIP-712 (Default)

Standard wallet signature using EIP-712 typed data:

// Automatically uses EIP-712 for wallet signers
const result = await OrderSigningUtils.signOrder(order, chainId, signer)

Smart Contract Wallets (Pre-sign)

For smart contract wallets like Safe:

import { SigningScheme } from '@cowprotocol/sdk-order-signing'

// For smart contract wallets, specify the signing scheme
// Then execute the pre-sign transaction on-chain

EIP-1271

For contracts that implement EIP-1271:

// Used for contracts that can validate signatures
// The SDK automatically detects and handles this

Integration with Order Book

This package works seamlessly with the Order Book API:

// 1. Sign the order
const signingResult = await OrderSigningUtils.signOrder(order, chainId, signer)

// 2. Submit to order book
const orderId = await orderBookApi.sendOrder({ ...order, ...signingResult })

// 3. Cancel if needed
const cancellation = await OrderSigningUtils.signOrderCancellation(orderId, chainId, signer)
await orderBookApi.sendSignedOrderCancellations({ ...cancellation, orderUids: [orderId] })

Note: This package handles the cryptographic aspects of CoW Protocol orders. It's typically used in conjunction with the Trading SDK or Order Book API for complete order management workflows.