Skip to content

Commit

Permalink
remove unneeded async fns, remove esModuleInterop, upgrade output to …
Browse files Browse the repository at this point in the history
…es6, bump package.json version to v2 (#246)

* remove unneeded async fns, remove esModuleInterop, bump package.json version to v2 (for interface changes due to async removal for certain fns and es6 bump)

* fix
  • Loading branch information
ryanio authored May 25, 2023
1 parent da2852f commit 8207431
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 173 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
artifacts
cache
coverage
lib
lib
typechain-types
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
project: ["tsconfig.json"],
},
rules: {
"no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
"@typescript-eslint/require-await": "error",
"object-shorthand": ["error", "always"],
},
};
9 changes: 0 additions & 9 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ const config: HardhatUserConfig = {
},
},
},
{
version: "0.4.23",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
],
},
networks: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opensea/seaport-js",
"version": "1.3.0",
"version": "2.0.0",
"description": "[Seaport](https://github.com/ProjectOpenSea/seaport) is a new marketplace protocol for safely and efficiently buying and selling NFTs. This is a JavaScript library intended to make interfacing with the contract reasonable and easy.",
"license": "MIT",
"author": "OpenSea Developers",
Expand Down
9 changes: 5 additions & 4 deletions src/__tests__/ascending-descending-amounts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect } from "chai";
import { BigNumber } from "ethers";
import { parseEther } from "ethers/lib/utils";
import { ethers } from "hardhat";
import sinon from "sinon";
import { ItemType, MAX_INT, OrderType } from "../constants";
import { CreateOrderInput, CurrencyItem } from "../types";
import * as fulfill from "../utils/fulfill";
Expand All @@ -16,6 +15,8 @@ import {
} from "./utils/balance";
import { describeWithFixture } from "./utils/setup";

const sinon = require("sinon");

const SECONDS_IN_WEEK = 604800;

describeWithFixture("As a user I want to create a dutch auction", (fixture) => {
Expand All @@ -24,7 +25,7 @@ describeWithFixture("As a user I want to create a dutch auction", (fixture) => {
let fulfiller: SignerWithAddress;
let multicallProvider: providers.MulticallProvider;

let fulfillStandardOrderSpy: sinon.SinonSpy;
let fulfillStandardOrderSpy: sinon.SinonSpy; // eslint-disable-line no-undef
let standardCreateOrderInput: CreateOrderInput;
let startTime: string;
let endTime: string;
Expand All @@ -45,7 +46,7 @@ describeWithFixture("As a user I want to create a dutch auction", (fixture) => {
fulfillStandardOrderSpy.restore();
});

describe("A single ERC721 is to be transferred", async () => {
describe("A single ERC721 is to be transferred", () => {
describe("Ascending dutch auction", () => {
beforeEach(async () => {
const { testErc721 } = fixture;
Expand Down Expand Up @@ -474,7 +475,7 @@ describeWithFixture("As a user I want to create a dutch auction", (fixture) => {
});
});

describe("Multiple ERC1155s are to be transferred", async () => {
describe("Multiple ERC1155s are to be transferred", () => {
describe("Ascending dutch auction", () => {
beforeEach(async () => {
const { testErc1155 } = fixture;
Expand Down
21 changes: 11 additions & 10 deletions src/__tests__/basic-fulfill.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect } from "chai";
import { BigNumber } from "ethers";
import { parseEther } from "ethers/lib/utils";
import { ethers } from "hardhat";
import sinon from "sinon";
import { ItemType, MAX_INT } from "../constants";
import { CreateOrderInput, CurrencyItem } from "../types";
import * as fulfill from "../utils/fulfill";
Expand All @@ -14,6 +13,8 @@ import {
} from "./utils/balance";
import { describeWithFixture } from "./utils/setup";

const sinon = require("sinon");

describeWithFixture(
"As a user I want to buy now or accept an offer",
(fixture) => {
Expand All @@ -22,7 +23,7 @@ describeWithFixture(
let fulfiller: SignerWithAddress;
let standardCreateOrderInput: CreateOrderInput;
let multicallProvider: providers.MulticallProvider;
let fulfillBasicOrderSpy: sinon.SinonSpy;
let fulfillBasicOrderSpy: sinon.SinonSpy; // eslint-disable-line no-undef
const nftId = "1";
const erc1155Amount = "3";
const OPENSEA_DOMAIN = "opensea.io";
Expand All @@ -39,8 +40,8 @@ describeWithFixture(
fulfillBasicOrderSpy.restore();
});

describe("A single ERC721 is to be transferred", async () => {
describe("[Buy now] I want to buy a single ERC721", async () => {
describe("A single ERC721 is to be transferred", () => {
describe("[Buy now] I want to buy a single ERC721", () => {
beforeEach(async () => {
const { testErc721 } = fixture;

Expand Down Expand Up @@ -157,7 +158,7 @@ describeWithFixture(
});

describe("with ERC20", () => {
beforeEach(async () => {
beforeEach(() => {
const { testErc20 } = fixture;

// Use ERC20 instead of eth
Expand Down Expand Up @@ -317,7 +318,7 @@ describeWithFixture(
});
});

describe("[Accept offer] I want to accept an offer for my single ERC721", async () => {
describe("[Accept offer] I want to accept an offer for my single ERC721", () => {
beforeEach(async () => {
const { testErc721, testErc20 } = fixture;

Expand Down Expand Up @@ -410,8 +411,8 @@ describeWithFixture(
});
});

describe("A single ERC1155 is to be transferred", async () => {
describe("[Buy now] I want to buy a single ERC1155", async () => {
describe("A single ERC1155 is to be transferred", () => {
describe("[Buy now] I want to buy a single ERC1155", () => {
beforeEach(async () => {
const { testErc1155 } = fixture;

Expand Down Expand Up @@ -538,7 +539,7 @@ describeWithFixture(
});

describe("with ERC20", () => {
beforeEach(async () => {
beforeEach(() => {
const { testErc20 } = fixture;

// Use ERC20 instead of eth
Expand Down Expand Up @@ -696,7 +697,7 @@ describeWithFixture(
});
});

describe("[Accept offer] I want to accept an offer for my single ERC1155", async () => {
describe("[Accept offer] I want to accept an offer for my single ERC1155", () => {
beforeEach(async () => {
const { testErc1155, seaportContract, testErc20 } = fixture;

Expand Down
23 changes: 12 additions & 11 deletions src/__tests__/bundle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect } from "chai";
import { BigNumber } from "ethers";
import { parseEther } from "ethers/lib/utils";
import { ethers } from "hardhat";
import sinon from "sinon";
import { ItemType, MAX_INT } from "../constants";
import { TestERC1155, TestERC721 } from "../typechain-types";
import { CreateOrderInput, CurrencyItem } from "../types";
Expand All @@ -16,6 +15,8 @@ import {
import { getTagFromDomain } from "../utils/usecase";
import { describeWithFixture } from "./utils/setup";

const sinon = require("sinon");

describeWithFixture(
"As a user I want to buy now or accept an offer for a bundle of items",
(fixture) => {
Expand All @@ -24,7 +25,7 @@ describeWithFixture(
let fulfiller: SignerWithAddress;
let multicallProvider: providers.MulticallProvider;

let fulfillStandardOrderSpy: sinon.SinonSpy;
let fulfillStandardOrderSpy: sinon.SinonSpy; // eslint-disable-line no-undef
let secondTestErc721: TestERC721;
let secondTestErc1155: TestERC1155;
let standardCreateOrderInput: CreateOrderInput;
Expand Down Expand Up @@ -54,8 +55,8 @@ describeWithFixture(
fulfillStandardOrderSpy.restore();
});

describe("A bundle of ERC721s is to be transferred", async () => {
describe("[Buy now] I want to buy a bundle of ERC721s", async () => {
describe("A bundle of ERC721s is to be transferred", () => {
describe("[Buy now] I want to buy a bundle of ERC721s", () => {
beforeEach(async () => {
const { testErc721 } = fixture;

Expand Down Expand Up @@ -247,7 +248,7 @@ describeWithFixture(
});
});

describe("[Accept offer] I want to accept an offer for my bundle of ERC721s", async () => {
describe("[Accept offer] I want to accept an offer for my bundle of ERC721s", () => {
beforeEach(async () => {
const { testErc20, testErc721 } = fixture;

Expand Down Expand Up @@ -411,8 +412,8 @@ describeWithFixture(
});
});

describe("A bundle of ERC721s and ERC1155s is to be transferred", async () => {
describe("[Buy now] I want to buy a bundle of ERC721s and ERC1155s", async () => {
describe("A bundle of ERC721s and ERC1155s is to be transferred", () => {
describe("[Buy now] I want to buy a bundle of ERC721s and ERC1155s", () => {
beforeEach(async () => {
const { testErc721, testErc1155 } = fixture;

Expand Down Expand Up @@ -612,7 +613,7 @@ describeWithFixture(
});
});

describe("[Accept offer] I want to accept an offer for my bundle of ERC721s and ERC1155s", async () => {
describe("[Accept offer] I want to accept an offer for my bundle of ERC721s and ERC1155s", () => {
beforeEach(async () => {
const { testErc20, testErc721, testErc1155 } = fixture;

Expand Down Expand Up @@ -803,8 +804,8 @@ describeWithFixture(
});
});

describe("A bundle of ERC1155s is to be transferred", async () => {
describe("[Buy now] I want to buy a bundle of ERC1155s", async () => {
describe("A bundle of ERC1155s is to be transferred", () => {
describe("[Buy now] I want to buy a bundle of ERC1155s", () => {
beforeEach(async () => {
const { testErc1155 } = fixture;

Expand Down Expand Up @@ -998,7 +999,7 @@ describeWithFixture(
});
});

describe("[Accept offer] I want to accept an offer for my bundle of ERC1155s", async () => {
describe("[Accept offer] I want to accept an offer for my bundle of ERC1155s", () => {
beforeEach(async () => {
const { testErc20, testErc1155 } = fixture;

Expand Down
13 changes: 7 additions & 6 deletions src/__tests__/criteria-based.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { expect } from "chai";
import { BigNumber } from "ethers";
import { parseEther } from "ethers/lib/utils";
import { ethers } from "hardhat";
import sinon from "sinon";
import { ItemType, MAX_INT } from "../constants";
import { CreateOrderInput, CurrencyItem, OrderWithCounter } from "../types";
import * as fulfill from "../utils/fulfill";
Expand All @@ -15,6 +14,8 @@ import {
} from "./utils/balance";
import { describeWithFixture } from "./utils/setup";

const sinon = require("sinon");

describeWithFixture(
"As a user I want to buy now or accept an offer for orders with criteria based items",
(fixture) => {
Expand All @@ -23,8 +24,8 @@ describeWithFixture(
let fulfiller: SignerWithAddress;
let multicallProvider: providers.MulticallProvider;

let fulfillStandardOrderSpy: sinon.SinonSpy;
let fulfillAvailableOrdersSpy: sinon.SinonSpy;
let fulfillStandardOrderSpy: sinon.SinonSpy; // eslint-disable-line no-undef
let fulfillAvailableOrdersSpy: sinon.SinonSpy; // eslint-disable-line no-undef
let standardCreateOrderInput: CreateOrderInput;

const nftId = "1";
Expand All @@ -45,7 +46,7 @@ describeWithFixture(
fulfillAvailableOrdersSpy.restore();
});

describe("A criteria based ERC721 is to be transferred", async () => {
describe("A criteria based ERC721 is to be transferred", () => {
describe("Collection based trades", () => {
describe("[Buy now] I want to buy a collection based listing", () => {
beforeEach(async () => {
Expand Down Expand Up @@ -922,7 +923,7 @@ describeWithFixture(
});
});

describe("A criteria based ERC1155 is to be transferred", async () => {
describe("A criteria based ERC1155 is to be transferred", () => {
describe("Collection based trades", () => {
describe("[Buy now] I want to buy a collection based listing", () => {
beforeEach(async () => {
Expand Down Expand Up @@ -1618,7 +1619,7 @@ describeWithFixture(
});
});

describe("A criteria based ERC721 to criteria based ERC1155 swap", async () => {
describe("A criteria based ERC721 to criteria based ERC1155 swap", () => {
describe("Collection based swaps", () => {
beforeEach(async () => {
const { testErc721, testErc1155 } = fixture;
Expand Down
Loading

0 comments on commit 8207431

Please sign in to comment.