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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@1inch/limit-order-protocol

v2.0.5

Published

Utility for limit order protocol

Downloads

445

Readme

Utils library for 1inch Limit Orders Protocol V2

This is the package of utilities for working with the 1inch Limit Orders Protocol

You can find general overview and docs on 1inch limit orders protocol here.

Smart contract addresses

  • Ethereum mainnet: 0x119c71d3bbac22029622cbaec24854d3d32d2828
  • BSC mainnet: 0x1e38eff998df9d3669e32f4ff400031385bf6362
  • Polygon mainnet: 0x94bc2a1c732bcad7343b25af48385fe76e08734f
  • Optimism mainnet: 0x11431a89893025d2a48dca4eddc396f8c8117187
  • Arbitrum mainnet: 0x7f069df72b7a39bce9806e3afaf579e54d8cf2b9
  • Smart contracts source code repository is available here

Test coverage

| Statements | Branches | Functions | Lines | | ------------------------------------------------------------------------ | --------------------------------------------------------------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------- | | Statements | Branches | Functions | Lines |

Installation

Node

npm install @1inch/limit-order-protocol

Yarn

yarn add @1inch/limit-order-protocol

Contributing

See CONTRIBUTING.md

Changelog

See CHANGELOG.md


About

Contract allows users to place limit orders, that later could be filled on-chain. Limit order itself is a data structure created off-chain and signed according to EIP-712.

Most probably you would need use following classes:

LimitOrderBuilder - to create a limit order
LimitOrderPredicateBuilder - to create a predicate for limit order
LimitOrderProtocolFacade - to interact with the protocol on the blockchain

Key features of the protocol is extreme flexibility and high gas efficiency that achieved by using following order types.

I. Limit order

A limit order is a financial instrument with which you can put up an ERC-20 token for sale at a fixed price.
For example, you can put up for sale 2 WBTC tokens at the price of 82415 DAI tokens.

1inch limit orders protocol has many tools for flexible trade management:

  • Partial fill
  • Predicates
  • Single cancellation
  • Bunch cancellation
  • Fullness check
  • Validation

Note: You can create a limit order even if your balance is insufficient to execute the limit order right now. However you must have an allowance for the maker asset.

For market making, there are RFQ orders that have special optimization that does not require a large amount of gas for execution.

Limit orders in the 1inch aggregation protocol

1inch aggregation protocol - the protocol sources liquidity from various exchanges and is capable of splitting a single trade transaction across multiple DEXes to ensure the best rates.
You can send your limit orders to the 1inch database and then your order will participate in the 1inch aggregation protocol.

REST API (swagger):

Docs

  1. Quick start
  2. Create a limit order
  3. Limit order structure
  4. Limit order remaining
  5. Nonce
  6. Validate a limit order
  7. Predicate
  8. Fill a limit order
  9. Cancel a limit order
  10. Cancel all limit orders
  11. Domain separator

II. RFQ order

A request for quotation (RFQ) is a business process in which a customer requests a quote from a supplier (market maker) for the purchase of some tokens.

Technically, RFQ orders are a stripped-down version of standard orders, which contains less data and tools to manage, which in turn allows to spend significantly less gas for their execution.

Docs:

  1. Creating an RFQ order
  2. RFQ order structure
  3. Canceling an RFQ order
  4. Filling an RFQ order