@georgeroman/wyvern-v2-sdk
TypeScript icon, indicating that this package has built-in type declarations

0.0.32 • Public • Published

Reservoir Wyvern V2 SDK

This repository contains an SDK for interacting with instances of Wyvern V2 contracts (including OpenSea).

Build and test

This package doesn't have tests on its own, but it relies on the core package for testing (which makes intensive use of this SDK for easily interacting with Wyvern V2 instances during tests).

Usage

import { Builders, Helpers, Order } from "@georgeroman/wyvern-v2-sdk";

// Create an unsigned sell order
let sellOrder: Order = Builders.Erc721.SingleItem.sell({
  exchange: exchange.address,
  maker: seller.address,
  target: erc721.address,
  tokenId: "0",
  paymentToken: AddressZero,
  basePrice: parseEther("1").toString(),
  fee: "250",
  feeRecipient: feeRecipient.address,
  listingTime: (Math.floor(Date.now() / 1000) - 300).toString(),
  expirationTime: "0",
  salt: "0",
});
// Sign the sell order
sellOrder = await Helpers.Order.sign(seller, sellOrder);

// Create a matching buy order for the sell order
const buyOrder: Order = Builders.Erc721.SingleItem.matchingBuy(
  buyer.address,
  sellOrder
);

// Trigger settlement
await Helpers.Wyvern.match(buyer, buyOrder, sellOrder);

Package Sidebar

Install

npm i @georgeroman/wyvern-v2-sdk

Weekly Downloads

1

Version

0.0.32

License

MIT

Unpacked Size

153 kB

Total Files

53

Last publish

Collaborators

  • georgeroman