Skip to content

Commit

Permalink
Remove deps: web3, lodash, bignumber.js, ajv (#1000)
Browse files Browse the repository at this point in the history
* first pass

* add link to gh releases to changelog

* remove .vscode folder

* exclude test folder from builds

* disable esmoduleinterop

* remove fbemitter (deprecated), use native node EventEmitter and add browserify to create lib/bundle.js on build

* rename test files with spec

* use ethers.utils.parseUnits to convert startAmount to wei

* address review comments

* use assert.equal

* typo

* remove unused fn

* typo

* nits

* nit

* remove unused dev dep, update package-lock

* address review comments
  • Loading branch information
ryanio authored May 26, 2023
1 parent 2ce2460 commit d7ef00c
Show file tree
Hide file tree
Showing 68 changed files with 3,328 additions and 13,381 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module.exports = {
node: true,
},
root: true,
ignorePatterns: ["docs", "lib"],
ignorePatterns: ["docs", "lib", "src/typechain"],
reportUnusedDisableDirectives: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "import", "jest", "prettier"],
plugins: ["@typescript-eslint", "import", "prettier"],

extends: [
"eslint:recommended",
Expand Down
47 changes: 25 additions & 22 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@ jobs:
node-version-file: .nvmrc
cache: npm

- name: Upgrade npm
run: npm install -g npm

- name: Install dependencies
run: npm install --immutable --ignore-scripts

- name: Gen ABI
run: npm run abi-type-gen
run: npm install

- name: Run linters
run: npm run lint:check
Expand All @@ -39,37 +33,46 @@ jobs:
node-version-file: .nvmrc
cache: npm

- name: Upgrade npm
run: npm install -g npm

- name: Install dependencies
run: npm install --immutable --ignore-scripts

- name: Gen ABI
run: npm run abi-type-gen
run: npm install

- name: Run tests
env:
API_KEY: ${{ secrets.API_KEY }}
run: npm run test

# integration-test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version-file: .nvmrc
# cache: npm

# - name: Install dependencies
# run: npm install

# - name: Run integration tests
# env:
# API_KEY: ${{ secrets.API_KEY }}
# SELL_ORDER_CONTRACT_ADDRESS: ${{ secrets.SELL_ORDER_CONTRACT_ADDRESS }}
# SELL_ORDER_TOKEN_ID: ${{ secrets.SELL_ORDER_TOKEN_ID }}
# LISTING_AMOUNT: ${{ secrets.LISTING_AMOUNT }}
# ETH_TO_WRAP: ${{ secrets.ETH_TO_WRAP }}
# run: npm run test:integration

test-earliest-node-engine-support:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16.0.0" # specified in the package.json engines.node field
node-version: 16.0.0 # specified in the package.json engines.node field
cache: npm

- name: Upgrade npm
run: npm install -g npm

- name: Install dependencies
run: npm install --immutable --ignore-scripts

- name: Gen ABI
run: npm run abi-type-gen
run: npm install

- name: Run tests
env:
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@ jobs:
node-version-file: .nvmrc
cache: npm

- name: Upgrade npm
run: npm install -g npm

- name: Install dependencies
run: npm install --immutable --ignore-scripts

- name: Gen ABI
run: npm run abi-type-gen
run: npm install

- name: Build
- name: Build docs
run: npm run docs-build

- name: Deploy 🚀
if: github.ref == 'refs/heads/master'
- name: Deploy docs 🚀
if: github.ref == 'refs/heads/main'
uses: JamesIves/[email protected]
with:
branch: gh-pages
Expand Down
20 changes: 2 additions & 18 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,6 @@ on:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
- name: Upgrade npm
run: npm install -g npm
- run: npm ci
- run: npm test
- run: npm run build
- run: yarn build

publish-npm:
needs: build
runs-on: ubuntu-latest
Expand All @@ -32,10 +18,8 @@ jobs:
with:
node-version-file: .nvmrc
registry-url: https://registry.npmjs.org/
- name: Upgrade npm
run: npm install -g npm
- run: npm ci
- run: npm run build
- run: npm install
- run: npm test
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
npm run lint-staged
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn check-types
npm run check-types
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib
docs
.nyc_output
src/typechain
16 changes: 0 additions & 16 deletions .vscode/launch.json

This file was deleted.

18 changes: 0 additions & 18 deletions .vscode/settings.json

This file was deleted.

53 changes: 3 additions & 50 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,6 @@
# Changelog

Full changelog coming soon. For now, here are the most important changes for doing major migrations:
The changelog for recent versions can be found at

## Migrating to version 1.2

- `OpenSeaPort::computeFees()` No longer accepts an `isPrivate` parameter.

## Migrating to version 1.1

- `OpenSeaPort::computeFees()` No longer accepts a `fees` parameter, relying solely on `asset`.

## Migrating to version 1.0

Version 1.0 introduces bundling for semi-fungible and fungible assets, serialized asset collections, a smaller bundle size, and more, along with many bug fixes.

**Breaking directory changes**

- Many constants inside of `/utils` have been moved to `/constants`.
- Other utils have been moved to `/utils/utils`

**Breaking type changes**

- `profile_img_url` in the `OpenSeaAccount` type has been renamed to `profileImgUrl`
- `OpenSeaPort::computeFees()` now returns a new type, `ComputedFees`, which expands "BPS" to "BasisPoints" for each of its member keys

**Breaking interface changes**

- `OpenSeaPort::computeFees()` now takes in a single asset, and returns a new and more consistent type, `ComputedFees`
- `schemaName` has been moved out of main method calls and into the `Asset` type
- `OpenSeaAPI::getAsset()` now accepts named arguments, consistent with other methods
- `OpenSeaPort::createFactorySellOrders` now accepts an `assets` parameter consistent with the other `Asset` type parameters in other methods
- `OpenSeaPort::getTokenBalance()` no longer defaults to the WETH address if no `tokenAddress` is set. And it accepts a `schemaName` parameter instead of an ABI
- `OpenSeaPort::approveNonFungibleToken()` has been renamed to `approveSemiOrNonFungibleToken()`, though it always worked for semi-fungible tokens like ERC-1155

**Removed deprecations:**

- `OpenSeaPort::transferOne()`, replaced by `OpenSeaPort::transfer()`
- `tokenId` and `tokenAddress` parameters for most SDK methods, replaced by creating an `Asset` type and passing that in

## Migrating to version 0.6

Version 0.6 introduces some major new features, including trading fungible and semi-fungible assets (including ERC-20 and ERC-1155 assets). These have been architected to maximize backwards compatibility, but there were a few breaking changes:

- The `Asset` type now has `version` instead of `nftVersion` as a property
- Similarly, the `NFTVersion` type has been renamed `TokenStandardVersion`
- `computeFees` now takes in a single, annotated OpenSeaAsset as a parameter instead of a list of assets
- In `isAssetTransferrable`, `didOwnerApprove` was renamed to `useProxy`

Non-breaking changes with deprecation notices:

- `getFungibleTokens` has been deprecated. Use `api.getPaymentTokens`
- Methods now show a deprecation warning when used with `tokenId` or `tokenAddress` as arguments, instead of using `asset` or `assets` (of type `Asset`/`Asset[]`)
- https://docs.opensea.io/changelog
- https://github.com/ProjectOpenSea/opensea-js/releases
Loading

0 comments on commit d7ef00c

Please sign in to comment.