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

@looksrare/sdk-v2

v0.10.0

Published

![GitHub package.json version](https://img.shields.io/github/package-json/v/LooksRare/sdk-v2) ![GitHub](https://img.shields.io/github/license/LooksRare/sdk-v2) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/LooksRare/sdk-v

Downloads

6,032

Readme

@looksrare/sdk-v2

GitHub package.json version GitHub GitHub Workflow Status npm

A collection of typescript tools to interact with LooksRare protocol V2 smart contracts 👀💎

Install

This package has a peer dependency on etherjs V5.

yarn add @looksrare/sdk-v2 ethers
npm install @looksrare/sdk-v2 ethers --save

Getting Started

The SDK expose a main class used to perform all the onchain operations:

import { ChainId } from "@looksrare/sdk-v2";
const looksrare = new LooksRare(ChainId.MAINNET, provider, signer);

The signer is optional if you need access to read only data (:warning: Calls to function that need a signer will throw a Signer is undefined exception):

import { ChainId } from "@looksrare/sdk-v2";
const looksrare = new LooksRare(ChainId.MAINNET, provider);

If you work on a hardhat setup, you can override the addresses as follow:

import { Addresses } from "@looksrare/sdk-v2";
const addresses: Addresses = {...};
const looksrare = new LooksRare(ChainId.HARDHAT, provider, signer, addresses);

:information_source: You can access the multicall provider after the instance creation:

const multicallProvider = looksrare.provider;

See 0xsequence doc to understand how to use it.

Documentation

Read the guides if you need help with the implementation.

You can also read the detailed api documentation.

FAQ

❓ How to use ABIs

The SDK exposes most of the LooksRare contract ABIs. For convenience, some commonly used ABIs are also exported.

import LooksRareProtocolABI from "@looksrare/sdk-v2/dist/abis/LooksRareProtocol.json";

❓ How to retrieve order nonce ?

Call the public api endpoint /orders/nonce, and use this nonce directly.

❓ What to do when the order is created and signed ?

Use the public api endpoint /orders to push the order to the database. After that, the order will be visible by everyone using the API (looksrare.org, aggregators, etc..).

❓ When should I use merkle tree orders ?

Merkle tree orders are used to create several orders with a single signature. You shouldn't use them when using a bot. Their main purpose is to facilitate orders creation using a user interface.

❓ Why do I need to call grantTransferManagerApproval ?

When you approve a collection to be traded on LooksRare, you approve the TransferManager instead of the exchange. Calling grantTransferManagerApproval gives the exchange contract the right to call the transfer function on the TransferManager. You need to call this function only once, the first time you use the V2.

❓ What are subset nonces and how to use them ?

tl;dr subset nonces allow you to cancel all the orders sharing the same subset nonce. Subset nonces allow you to group some orders together according to arbitrary rules (for example all your orders for a specific collection, all your orders above a certain threshold, etc). You can then cancel them all with a single call to cancelSubsetOrders. :information_source: Unlike order nonces, executing an order with a specific subset nonce doesn't invalidate other orders sharing the same subset nonce.

Resources

🔗 Developer documentation

🔗 Public API documentation

🔗 Developer discord

Ethers Version 5 & 6

The SDK maintains a version for Ethers V5 and V6. To use the SDK with Ethers V5 install versions < 1, e.g. 0.9.0. Version 6 of Ethers is on versions > 1.0.0