Skip to content

Commit

Permalink
feat(evmApi): nft endpoints
Browse files Browse the repository at this point in the history
* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.0.0 [skip ci]

# [1.0.0](v0.0.184...v1.0.0) (2022-01-17)

### Bug Fixes

* export for Moralis.Units ([106dbc1](106dbc1))
* prevent walletconnect disconnect error ([bc8a63b](bc8a63b))

* feat!: replace web3 for ethers ([7874c77](7874c77))

### Features

* add Moralis.Chains ([faa8aca](faa8aca))
* remove web3Library ([96f2f83](96f2f83))

### BREAKING CHANGES

* Moralis.web3 will use internally Ethers, response types might differ, and Moralis.web3 will no longer return a web3 instance, but an Ethers instance. This can be overwritten via the `web3Library` option when calling `Moralis.start`.

* docs: update 1.0.0 breaking changes in changelog

* build: new deployment [ci skip]

* fix: re-add isMetaMaskInstalled

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.0.1 [skip ci]

## [1.0.1](v1.0.0...v1.0.1) (2022-01-17)

### Bug Fixes

* re-add isMetaMaskInstalled ([4673e18](4673e18))

* build: new deployment [ci skip]

* fix: typings for ethers

* chore(release): set `package.json` to 1.0.2 [skip ci]

## [1.0.2](v1.0.1...v1.0.2) (2022-01-19)

### Bug Fixes

* typings for ethers ([855b41d](855b41d))

* chore: fix spelling of Chains.js

Co-authored-by: Rayyan Alam <[email protected]>

* build(deps-dev): bump jasmine from 3.99.0 to 4.0.2 (#188)

Bumps [jasmine](https://github.com/jasmine/jasmine-npm) from 3.99.0 to 4.0.2.
- [Release notes](https://github.com/jasmine/jasmine-npm/releases)
- [Commits](jasmine/jasmine-npm@v3.99.0...v4.0.2)

---
updated-dependencies:
- dependency-name: jasmine
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump @babel/runtime from 7.16.5 to 7.16.7 (#172)

Bumps [@babel/runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime) from 7.16.5 to 7.16.7.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.7/packages/babel-runtime)

---
updated-dependencies:
- dependency-name: "@babel/runtime"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* fix(deps): bump ethers from 5.5.1 to 5.5.3 (#184)

Bumps [ethers](https://github.com/ethers-io/ethers.js/tree/HEAD/packages/ethers) from 5.5.1 to 5.5.3.
- [Release notes](https://github.com/ethers-io/ethers.js/releases)
- [Changelog](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ethers-io/ethers.js/commits/v5.5.3/packages/ethers)

---
updated-dependencies:
- dependency-name: ethers
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* ci: update dependabot prefix for non dev deps (#203)

* build(deps): bump @babel/runtime-corejs3 from 7.16.5 to 7.16.8 (#185)

Bumps [@babel/runtime-corejs3](https://github.com/babel/babel/tree/HEAD/packages/babel-runtime-corejs3) from 7.16.5 to 7.16.8.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.8/packages/babel-runtime-corejs3)

---
updated-dependencies:
- dependency-name: "@babel/runtime-corejs3"
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps-dev): bump jest from 27.4.5 to 27.4.7 (#201)

Bumps [jest](https://github.com/facebook/jest) from 27.4.5 to 27.4.7.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](jestjs/jest@v27.4.5...v27.4.7)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(deps): bump ws from 8.4.0 to 8.4.2 (#202)

Bumps [ws](https://github.com/websockets/ws) from 8.4.0 to 8.4.2.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](websockets/ws@8.4.0...8.4.2)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps-dev): bump parse-server from `a43638f` to `826aa79` (#200)

Bumps [parse-server](https://github.com/parse-community/parse-server) from `a43638f` to `826aa79`.
- [Release notes](https://github.com/parse-community/parse-server/releases)
- [Commits](parse-community/parse-server@a43638f...826aa79)

---
updated-dependencies:
- dependency-name: parse-server
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.0.3 [skip ci]

## [1.0.3](v1.0.2...v1.0.3) (2022-01-19)

### Bug Fixes

* **deps:** bump ethers from 5.5.1 to 5.5.3 ([#184](#184)) ([abafda3](abafda3))
* **deps:** bump ws from 8.4.0 to 8.4.2 ([#202](#202)) ([ab99bea](ab99bea))

* chore(deps-dev): bump eslint from 8.6.0 to 8.7.0 (#207)

Bumps [eslint](https://github.com/eslint/eslint) from 8.6.0 to 8.7.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.6.0...v8.7.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump jest-environment-jsdom from 27.4.4 to 27.4.6 (#204)

Bumps [jest-environment-jsdom](https://github.com/facebook/jest/tree/HEAD/packages/jest-environment-jsdom) from 27.4.4 to 27.4.6.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.4.6/packages/jest-environment-jsdom)

---
updated-dependencies:
- dependency-name: jest-environment-jsdom
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump @babel/core from 7.16.7 to 7.16.10 (#205)

Bumps [@babel/core](https://github.com/babel/babel/tree/HEAD/packages/babel-core) from 7.16.7 to 7.16.10.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.10/packages/babel-core)

---
updated-dependencies:
- dependency-name: "@babel/core"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps-dev): bump openapi-typescript from 4.5.0 to 5.1.0 (#187)

Bumps [openapi-typescript](https://github.com/drwpow/openapi-typescript) from 4.5.0 to 5.1.0.
- [Release notes](https://github.com/drwpow/openapi-typescript/releases)
- [Commits](openapi-ts/openapi-typescript@v4.5.0...v5.1.0)

---
updated-dependencies:
- dependency-name: openapi-typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump babel-jest from 27.4.5 to 27.4.6 (#208)

Bumps [babel-jest](https://github.com/facebook/jest/tree/HEAD/packages/babel-jest) from 27.4.5 to 27.4.6.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v27.4.6/packages/babel-jest)

---
updated-dependencies:
- dependency-name: babel-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump @babel/plugin-transform-runtime (#209)

Bumps [@babel/plugin-transform-runtime](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-runtime) from 7.16.7 to 7.16.10.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.16.10/packages/babel-plugin-transform-runtime)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-runtime"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump core-js from 3.20.2 to 3.20.3 (#210)

Bumps [core-js](https://github.com/zloirock/core-js) from 3.20.2 to 3.20.3.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](zloirock/core-js@v3.20.2...v3.20.3)

---
updated-dependencies:
- dependency-name: core-js
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* chore: remove unused dependencies

* chore: remove unused dependencies

* chore: revert openapi-typescript bump

* build: new deployment [ci skip]

* fix: walletconnect import on CDN builds (#216)

* chore(release): set `package.json` to 1.0.4 [skip ci]

## [1.0.4](v1.0.3...v1.0.4) (2022-01-20)

### Bug Fixes

* walletconnect import on CDN builds ([#216](#216)) ([08629c9](08629c9))

* fix: export abstractWeb3Connector (#217)

We need to include this in the Moralis instance for CDN access

* chore(release): set `package.json` to 1.0.5 [skip ci]

## [1.0.5](v1.0.4...v1.0.5) (2022-01-20)

### Bug Fixes

* export abstractWeb3Connector ([#217](#217)) ([2f46cf5](2f46cf5))

* fix: include details on WEB3_DEACTIVATED event (#218)

* fix: move MoralisWeb3 types to Moralis (#219)

* fix: filter out walletconnect dependency warning (#220)

* chore(release): set `package.json` to 1.0.6 [skip ci]

## [1.0.6](v1.0.5...v1.0.6) (2022-01-20)

### Bug Fixes

* filter out walletconnect dependency warning ([#220](#220)) ([31e94ac](31e94ac))
* include details on WEB3_DEACTIVATED event ([#218](#218)) ([f2fe3e1](f2fe3e1))
* move MoralisWeb3 types to Moralis ([#219](#219)) ([945e79b](945e79b))

* fix: expose ethers type

* fix: Moralis.web3 might be null

* chore(release): set `package.json` to 1.0.7 [skip ci]

## [1.0.7](v1.0.6...v1.0.7) (2022-01-20)

### Bug Fixes

* expose ethers type ([03f8c38](03f8c38))
* Moralis.web3 might be null ([6a57509](6a57509))

* build: new deployment [ci skip]

* feat: add SolanaAPI

Feature/solana api

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.1.0 [skip ci]

# [1.1.0](v1.0.7...v1.1.0) (2022-01-21)

### Features

* add SolanaAPI ([f870001](f870001))

* build: new deployment [ci skip]

* fix: expose Moralis.web3Library

* fix: better error message when no appId provided

* chore: fix typo

* fix: avoid duplicate enableWeb3 calls

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.1.1 [skip ci]

## [1.1.1](v1.1.0...v1.1.1) (2022-01-26)

### Bug Fixes

* avoid duplicate enableWeb3 calls ([8df9484](8df9484))
* better error message when no appId provided ([225a696](225a696))
* expose Moralis.web3Library ([59a7c28](59a7c28))

* fix: set default address for Web3API and SolanaAPI

* chore(release): set `package.json` to 1.1.2 [skip ci]

## [1.1.2](v1.1.1...v1.1.2) (2022-01-26)

### Bug Fixes

* set default address for Web3API and SolanaAPI ([57d15cc](57d15cc))

* feat: add authentication via MagicLink

Integration to enableWeb3 and authenticate via MagicLink, by providing the `magicLink` provider.

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.2.0 [skip ci]

# [1.2.0](v1.1.2...v1.2.0) (2022-01-27)

### Features

* add authentication via MagicLink ([9420eb9](9420eb9))

* fix: update web3 on chainChange (#233)

* chore(release): set `package.json` to 1.2.1 [skip ci]

## [1.2.1](v1.2.0...v1.2.1) (2022-01-28)

### Bug Fixes

* update web3 on chainChange ([#233](#233)) ([0a9beda](0a9beda))

* fix: clear user state on logout (#234)

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.2.2 [skip ci]

## [1.2.2](v1.2.1...v1.2.2) (2022-01-28)

### Bug Fixes

* clear user state on logout ([#234](#234)) ([5485b11](5485b11))

* fix: type gen for web3Api when no queryparam (#236)

* chore(release): set `package.json` to 1.2.3 [skip ci]

## [1.2.3](v1.2.2...v1.2.3) (2022-01-28)

### Bug Fixes

* type gen for web3Api when no queryparam ([#236](#236)) ([515c86d](515c86d))

* fix: filter console warnings of magic and wc (#238)

* chore(release): set `package.json` to 1.2.4 [skip ci]

## [1.2.4](v1.2.3...v1.2.4) (2022-01-31)

### Bug Fixes

* filter console warnings of magic and wc ([#238](#238)) ([dec4e2e](dec4e2e))

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* fix: preserve sessions for walletconnect and magic (#249)

* fix: preserve sessions for walletconnect and magic

* fixup! fix: preserve sessions for walletconnect and magic

* fix: cleanup web3 on logout (#250)

* fix: cleanup web3 on logout

* test: mock moralis.cleanup

* fix: expose setting of 'any' network on  provider (#251)

* chore(release): set `package.json` to 1.2.5 [skip ci]

## [1.2.5](v1.2.4...v1.2.5) (2022-02-04)

### Bug Fixes

* cleanup web3 on logout ([#250](#250)) ([d676d87](d676d87))
* expose setting of 'any' network on  provider ([#251](#251)) ([16537fa](16537fa))
* preserve sessions for walletconnect and magic ([#249](#249)) ([82c33e6](82c33e6))

* fix: account for metamask disconnect issue (#252)

* chore(release): set `package.json` to 1.2.6 [skip ci]

## [1.2.6](v1.2.5...v1.2.6) (2022-02-04)

### Bug Fixes

* account for metamask disconnect issue ([#252](#252)) ([8664602](8664602))

* fix: prevent cleanup when enabling web3

* fix: prevent double cleanup on authentication

* fix: newsession param for walletconnect and magic

* fix: types for anyNetwork in enableWeb3

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.2.7 [skip ci]

## [1.2.7](v1.2.6...v1.2.7) (2022-02-07)

### Bug Fixes

* newsession param for walletconnect and magic ([a0928dc](a0928dc))
* prevent cleanup when enabling web3 ([01a7cd0](01a7cd0))
* prevent double cleanup on authentication ([bc4abe1](bc4abe1))
* types for anyNetwork in enableWeb3 ([4573a8a](4573a8a))

* feat: add web3Auth as connection method

* Initial Implementation

* feat: finished implementation

* chore: push pakage.json

* feat: fixed chain Id, and errors

* chore: update package.json

* feat: diff implementation of web3 auth

* feat: impl for social login

* chore: typo

* feat: changes per request, constatns for chains

* feat: Implemented functionality for CDN

* chore: typos/spelling

* fix: make web3Auth use defauls preset

* fix: filter out @web3auth/web3auth module error

* fix: remove obsolete reference to @web3auth/base

Co-authored-by: Erno <[email protected]>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.3.0 [skip ci]

# [1.3.0](v1.2.7...v1.3.0) (2022-02-09)

### Features

* add web3Auth as connection method ([a7724f1](a7724f1))

* fix: overloaded functions for executeFunction (#256)

* fix: FromWei type from number to string (#257)

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.3.1 [skip ci]

## [1.3.1](v1.3.0...v1.3.1) (2022-02-09)

### Bug Fixes

* FromWei type from number to string ([#257](#257)) ([fdb5804](fdb5804))
* overloaded functions for executeFunction ([#256](#256)) ([28b2468](28b2468))

* fix: use secure signing message for link action (#261)

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.3.2 [skip ci]

## [1.3.2](v1.3.1...v1.3.2) (2022-02-14)

### Bug Fixes

* use secure signing message for link action ([#261](#261)) ([f3be548](f3be548))

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* fix: better authentication types for connectors (#274)

* chore(release): set `package.json` to 1.3.3 [skip ci]

## [1.3.3](v1.3.2...v1.3.3) (2022-03-01)

### Bug Fixes

* better authentication types for connectors ([#274](#274)) ([d608166](d608166))

* fix: add missing type for User.me (#275)

* chore(release): set `package.json` to 1.3.4 [skip ci]

## [1.3.4](v1.3.3...v1.3.4) (2022-03-01)

### Bug Fixes

* add missing type for User.me ([#275](#275)) ([a3cbd0e](a3cbd0e))

* fix: prevent deletion of params in api call (#276)

* chore(release): set `package.json` to 1.3.5 [skip ci]

## [1.3.5](v1.3.4...v1.3.5) (2022-03-01)

### Bug Fixes

* prevent deletion of params in api call ([#276](#276)) ([505df2b](505df2b))

* Feature/nodejs signing ability (#281)

* added endpoint to track and implenented in start function

* adding signing abilities to nodejs

* update signerOrProvider getter

* add privateKey to ts definitions

* optimised code based on review comments

* remove validation for inputs with empty name value (#284)

* feat: sign with privateKey on NodeJs (#286)

(Manually bump version because deployment did not trigger)

* chore(release): set `package.json` to 1.4.0 [skip ci]

# [1.4.0](v1.3.5...v1.4.0) (2022-03-14)

### Features

* sign with privateKey on NodeJs ([#286](#286)) ([9455b3e](9455b3e))

* triggers fix

* fix: show rate limit info on api request (#290)

* chore(release): set `package.json` to 1.4.1 [skip ci]

## [1.4.1](v1.4.0...v1.4.1) (2022-03-15)

### Bug Fixes

* show rate limit info on api request ([#290](#290)) ([e5410ba](e5410ba))

* feat: add metrics for start event

* added endpoint to track and implenented in start function

* add event names enum

* handle cases when start function is called without serverurl

* validate serverUrl

* fix: better error handling for getSubdomain

* chore: remove unused error

Co-authored-by: Erno <[email protected]>

* fix(deps): bump follow-redirects from 1.14.7 to 1.14.9 (#270)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.7 to 1.14.9.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.14.7...v1.14.9)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.5.0 [skip ci]

# [1.5.0](v1.4.1...v1.5.0) (2022-03-15)

### Bug Fixes

* **deps:** bump follow-redirects from 1.14.7 to 1.14.9 ([#270](#270)) ([181edf1](181edf1))

### Features

* add metrics for start event ([28bb292](28bb292))

* fix: send sessionToken with apiRequest for correct rate-limiting

* added endpoint to track and implenented in start function

* add event names enum

* handle cases when start function is called without serverurl

* send sessionToken in request when making api calls.

* use Moralis object to get applicationId
and user data

Co-authored-by: Erno <[email protected]>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.5.1 [skip ci]

## [1.5.1](v1.5.0...v1.5.1) (2022-03-15)

### Bug Fixes

* send sessionToken with apiRequest for correct rate-limiting ([bef928b](bef928b))

* fix(deps): bump ethers from 5.5.3 to 5.6.0 (#287)

Bumps [ethers](https://github.com/ethers-io/ethers.js/tree/HEAD/packages/ethers) from 5.5.3 to 5.6.0.
- [Release notes](https://github.com/ethers-io/ethers.js/releases)
- [Changelog](https://github.com/ethers-io/ethers.js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ethers-io/ethers.js/commits/v5.6.0/packages/ethers)

---
updated-dependencies:
- dependency-name: ethers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump eslint from 8.7.0 to 8.11.0 (#289)

Bumps [eslint](https://github.com/eslint/eslint) from 8.7.0 to 8.11.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](eslint/eslint@v8.7.0...v8.11.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): bump openapi-typescript from 4.5.0 to 5.2.0 (#263)

Bumps [openapi-typescript](https://github.com/drwpow/openapi-typescript) from 4.5.0 to 5.2.0.
- [Release notes](https://github.com/drwpow/openapi-typescript/releases)
- [Commits](openapi-ts/openapi-typescript@v4.5.0...v5.2.0)

---
updated-dependencies:
- dependency-name: openapi-typescript
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(deps): bump axios from 0.24.0 to 0.26.1 (#288)

Bumps [axios](https://github.com/axios/axios) from 0.24.0 to 0.26.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](axios/axios@v0.24.0...v0.26.1)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.5.2 [skip ci]

## [1.5.2](v1.5.1...v1.5.2) (2022-03-15)

### Bug Fixes

* **deps:** bump axios from 0.24.0 to 0.26.1 ([#288](#288)) ([240c3f0](240c3f0))
* **deps:** bump ethers from 5.5.3 to 5.6.0 ([#287](#287)) ([3632dd6](3632dd6))

* fix: revert openapi-typescript (#293)

This is causing issues as it exports only esm

* chore(release): set `package.json` to 1.5.3 [skip ci]

## [1.5.3](v1.5.2...v1.5.3) (2022-03-15)

### Bug Fixes

* revert openapi-typescript ([#293](#293)) ([08c00dc](08c00dc))

* fix: add cursor to api responses (#294)

(manually bump version)

* chore(release): set `package.json` to 1.5.4 [skip ci]

## [1.5.4](v1.5.3...v1.5.4) (2022-03-16)

### Bug Fixes

* add cursor to api responses ([#294](#294)) ([e8770c5](e8770c5))

* fix: react-native compatibility for v0.64+

* Update EventEmitter.js

* Update EventEmitter.js

* chore(release): set `package.json` to 1.5.5 [skip ci]

## [1.5.5](v1.5.4...v1.5.5) (2022-03-19)

### Bug Fixes

* react-native compatibility for v0.64+ ([b906444](b906444))

* remove comment

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* fix: add repository url for semantic release (#307)

* chore(release): set `package.json` to 1.5.6 [skip ci]

## [1.5.6](v1.5.5...v1.5.6) (2022-03-29)

### Bug Fixes

* add repository url for semantic release ([#307](#307)) ([13394d1](13394d1))

* fix(deps): bump minimist from 1.2.5 to 1.2.6 (#305)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build: new deployment [ci skip]

* chore(release): set `package.json` to 1.5.7 [skip ci]

## [1.5.7](v1.5.6...v1.5.7) (2022-03-30)

### Bug Fixes

* **deps:** bump minimist from 1.2.5 to 1.2.6 ([#305](#305)) ([0e6c490](0e6c490))

* build: new deployment [ci skip]

* fix: return exact rate limit response coming from api (#303)

* chore(release): set `package.json` to 1.5.8 [skip ci]

## [1.5.8](v1.5.7...v1.5.8) (2022-03-31)

### Bug Fixes

* return exact rate limit response coming from api ([#303](#303)) ([33a05e6](33a05e6))

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* fix: plugin triggers to handle web3sign correctly (#309)

Manual bump sto trigger semantic-release

* chore(release): set `package.json` to 1.5.9 [skip ci]

## [1.5.9](v1.5.8...v1.5.9) (2022-04-08)

### Bug Fixes

* plugin triggers to handle web3sign correctly ([#309](#309)) ([26fc670](26fc670))

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* build: new deployment [ci skip]

* initial setup v2

* remove demo

* Fix tests,a dd docs, and cleanup core

* feat: cleanup evm logic and add datatypes

* cleanup server logic

* docs: update main docs

* fix: old MoralisData reference

* chore: cleanup core and todos

* test: update test app and logging

* feat(evmApi): pagination resolver

resolve pagination for endpoints with pagination options

* little optimisation to paginated resolver

* toJson function

* response to reviews

* remove unused code

* fix issue with getNextParams

* feat(evmApi): getAllTokenIds

Fetch and transform token.getAllTokenIds

* fix import errors

* get all token Ids

* feat(evmApi): EvmNFT related

PR for issues related to EvmNFT datatype (issues that return EvmNFT
type)

* include getNFTsForContract

* chore: cleanup and validation on parse metadata

Co-authored-by: Moralis Runner <[email protected]>
Co-authored-by: semantic-release-bot <[email protected]>
Co-authored-by: Erno <[email protected]>
Co-authored-by: Rayyan Alam <[email protected]>
Co-authored-by: Rayyan Alam <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Erno Wever <[email protected]>
Co-authored-by: Michael Kantor <[email protected]>
  • Loading branch information
9 people authored May 23, 2022
1 parent 47b3c19 commit 859a6a1
Show file tree
Hide file tree
Showing 13 changed files with 586 additions and 0 deletions.
95 changes: 95 additions & 0 deletions packages/core/src/dataTypes/tokens/EvmNFT.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { MoralisDataObject, MoralisDataObjectValue } from '../abstract';
import { EvmAddress, EvmAddressish } from '../EvmAddress';
import { CoreErrorCode, MoralisCoreError } from '../../Error';
import { maybe } from '../utils';

export enum ContractType {
ERC721 = 'ERC721',
ERC1155 = 'ERC1155',
}

interface EvmNFTInput {
tokenId: number | string;
contractType: string;
tokenUri?: string;
tokenAddress: EvmAddressish;
tokenHash?: string;
metadata?: string;
name?: string;
symbol?: string;
}

interface EvmNFTData {
tokenId: number | string;
contractType: ContractType;
tokenUri?: string;
tokenAddress: EvmAddress;
tokenHash?: string;
metadata: MoralisDataObjectValue;
name?: string;
symbol?: string;
}

export class EvmNFT implements MoralisDataObject {
private _value: EvmNFTData;

constructor(value: EvmNFTInput) {
this._value = EvmNFT.parse(value);
}

static parse = (value: EvmNFTInput): EvmNFTData => ({
...value,
contractType: this.validateType(value.contractType),
tokenAddress: EvmAddress.create(value.tokenAddress),
metadata: maybe(value.metadata, this.validateMetadata),
tokenUri: maybe(value.tokenUri),
tokenHash: maybe(value.tokenHash),
name: maybe(value.name),
symbol: maybe(value.symbol),
});

private static validateType(value: string) {
switch (value.toUpperCase()) {
case ContractType.ERC1155:
return ContractType.ERC1155;
case ContractType.ERC721:
return ContractType.ERC721;
default:
throw new MoralisCoreError({
code: CoreErrorCode.INVALID_ARGUMENT,
message: 'Invalid contract type provided',
});
}
}

private static validateMetadata = (value: string): MoralisDataObjectValue => {
try {
return JSON.parse(value);
} catch (error) {
throw new MoralisCoreError({
code: CoreErrorCode.INVALID_ARGUMENT,
message: 'Invalid metadata provided, cannot parse the value to JSON',
});
}
};

equals(value: this): boolean {
return value._value.tokenUri === this._value.tokenUri;
}

toJSON() {
const value = this._value;
return {
...value,
tokenAddress: value.tokenAddress.format(),
};
}

format() {
return this.toJSON();
}

get result() {
return this._value;
}
}
1 change: 1 addition & 0 deletions packages/core/src/dataTypes/tokens/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './Erc20';
export * from './Erc20Value';
export * from './EvmNFT';
14 changes: 14 additions & 0 deletions packages/evmApi/src/EvmApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import {
getNFTTradesResolver,
getTokenAddressTransfersResolver,
getNftTransfersFromToBlockResolver,
getAllTokenIdsResolver,
searchNFTsResolver,
getNFTOwnersResolver,
getTokenIdOwnersResolver,
getTokenIdMetadataResolver,
} from './resolvers/token';
import { getPairReservesResolver } from './resolvers/defi';
import { resolveAddressResolver, resolveDomainResolver } from './resolvers/resolve';
Expand All @@ -18,6 +23,8 @@ import {
getNFTTransfersResolver,
getTransactionsResolver,
getTokenTransfersResolver,
getNFTsResolver,
getNFTsForContractResolver,
} from './resolvers/account';
import {
getBlockResolver,
Expand Down Expand Up @@ -56,6 +63,8 @@ export class MoralisEvmApi extends ApiModule {
getNFTTransfers: getNFTTransfersResolver.fetch,
getTokenTransfers: getTokenTransfersResolver.fetch,
getTransactions: getTransactionsResolver.fetch,
getNFTs: getNFTsResolver.fetch,
getNFTsForContract: getNFTsForContractResolver.fetch,
};
}
get resolve() {
Expand All @@ -80,6 +89,11 @@ export class MoralisEvmApi extends ApiModule {
getNFTTrades: getNFTTradesResolver.fetch,
getNFTLowestPrice: getNFTLowestPriceResolver.fetch,
getWalletTokenIdTransfers: getWalletTokenIdTransfersResolver.fetch,
getAllTokenIds: getAllTokenIdsResolver.fetch,
searchNFTs: searchNFTsResolver.fetch,
getNFTOwners: getNFTOwnersResolver.fetch,
getTokenIdOwners: getTokenIdOwnersResolver.fetch,
getTokenIdMetadata: getTokenIdMetadataResolver.fetch,
};
}
get info() {
Expand Down
54 changes: 54 additions & 0 deletions packages/evmApi/src/resolvers/account/getNFTs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { EvmChain, EvmChainish, EvmAddressish, EvmAddress, EvmNFT } from '@moralis/core';
import { operations } from '../../generated/types';
import { Camelize } from '../../utils/toCamelCase';
import { EvmPaginatedResolver, PaginatedOptions } from '../PaginatedResolver';

type operation = 'getNFTs';

type QueryParams = operations[operation]['parameters']['query'];
type PathParams = operations[operation]['parameters']['path'];
type ApiParams = QueryParams & PathParams;

export interface Params extends Camelize<Omit<ApiParams, 'chain' | 'address' | 'token_addresses'>>, PaginatedOptions {
chain?: EvmChainish;
tokenAddresses?: EvmAddressish[];
address: EvmAddressish;
}

type ApiResult = operations[operation]['responses']['200']['content']['application/json'];

export const getNFTsResolver = new EvmPaginatedResolver({
getPath: (params: Params) => `${params.address}/nft`,
apiToResult: (data: ApiResult) =>
data.result?.map((nft) => ({
token: new EvmNFT({
contractType: nft.contract_type,
tokenAddress: nft.token_address,
tokenId: nft.token_id,
tokenUri: nft.token_uri,
metadata: nft.metadata,
name: nft.name,
symbol: nft.symbol,
}),
syncedAt: nft.synced_at ? new Date(nft.synced_at) : undefined,
blockNumberMinted: nft.block_number_minted,
blockNumber: nft.block_number,
ownerOf: EvmAddress.create(nft.owner_of),
// TODO: below are data returned that are not present in swagger docs so no type definition (report to api squad)
// tokenHash: nft.token_hash
// lastMetadataSync: nft.last_metadata_sync ? new Date(nft.last_metadata_sync) : undefined,
// lastTokenUriSync: nft.last_token_uri_sync ? new Date(nft.last_token_uri_sync) : undefined,
})),
resultToJson: (data) =>
data?.map((nft) => ({
...nft,
syncedAt: nft.syncedAt?.toLocaleDateString(),
token: nft.token.toJSON(),
})),
parseParams: (params: Params): ApiParams => ({
...params,
chain: params.chain ? EvmChain.create(params.chain).apiHex : 'eth',
token_addresses: params.tokenAddresses?.map((address) => EvmAddress.create(address).lowercase),
address: EvmAddress.create(params.address).lowercase,
}),
});
55 changes: 55 additions & 0 deletions packages/evmApi/src/resolvers/account/getNFTsForContract.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { EvmChain, EvmChainish, EvmAddressish, EvmAddress, EvmNFT } from '@moralis/core';
import { operations } from '../../generated/types';
import { Camelize } from '../../utils/toCamelCase';
import { EvmPaginatedResolver, PaginatedOptions } from '../PaginatedResolver';

type operation = 'getNFTsForContract';

type QueryParams = operations[operation]['parameters']['query'];
type PathParams = operations[operation]['parameters']['path'];
type ApiParams = QueryParams & PathParams;

export interface Params extends Camelize<Omit<ApiParams, 'chain' | 'address' | 'token_address'>>, PaginatedOptions {
chain?: EvmChainish;
address: EvmAddressish;
tokenAddress: EvmAddressish;
}

type ApiResult = operations[operation]['responses']['200']['content']['application/json'];

export const getNFTsForContractResolver = new EvmPaginatedResolver({
getPath: (params: Params) => `${params.address}/nft/${params.tokenAddress}`,
apiToResult: (data: ApiResult) =>
data.result?.map((nft) => ({
token: new EvmNFT({
contractType: nft.contract_type,
tokenAddress: nft.token_address,
tokenId: nft.token_id,
tokenUri: nft.token_uri,
metadata: nft.metadata,
name: nft.name,
symbol: nft.symbol,
}),
syncedAt: nft.synced_at ? new Date(nft.synced_at) : undefined,
blockNumberMinted: nft.block_number_minted,
blockNumber: nft.block_number,
ownerOf: EvmAddress.create(nft.owner_of),
amount: nft.amount,
// TODO: below are data returned that are not present in swagger docs so no type definition (report to api squad)
// tokenHash: nft.token_hash
// lastMetadataSync: nft.last_metadata_sync ? new Date(nft.last_metadata_sync) : undefined,
// lastTokenUriSync: nft.last_token_uri_sync ? new Date(nft.last_token_uri_sync) : undefined,
})),
resultToJson: (data) =>
data?.map((nft) => ({
...nft,
syncedAt: nft.syncedAt?.toLocaleDateString(),
token: nft.token.toJSON(),
})),
parseParams: (params: Params): ApiParams => ({
...params,
chain: params.chain ? EvmChain.create(params.chain).apiHex : 'eth',
address: EvmAddress.create(params.address).lowercase,
token_address: EvmAddress.create(params.tokenAddress).lowercase,
}),
});
2 changes: 2 additions & 0 deletions packages/evmApi/src/resolvers/account/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export { getNativeBalanceResolver } from './getNativeBalance';
export { getNFTTransfersResolver } from './getNFTTransfers';
export { getTokenTransfersResolver } from './getTokenTransfers';
export { getTransactionsResolver } from './getTransactions';
export { getNFTsResolver } from './getNFTs';
export { getNFTsForContractResolver } from './getNFTsForContract';
49 changes: 49 additions & 0 deletions packages/evmApi/src/resolvers/token/getAllTokenIds.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { EvmChain, EvmChainish, EvmAddressish, EvmAddress, EvmNFT } from '@moralis/core';
import { operations } from '../../generated/types';
import { Camelize } from '../../utils/toCamelCase';
import { EvmPaginatedResolver, PaginatedOptions } from '../PaginatedResolver';

type operation = 'getAllTokenIds';

type QueryParams = operations[operation]['parameters']['query'];
type PathParams = operations[operation]['parameters']['path'];
type ApiParams = QueryParams & PathParams;
export interface Params extends Camelize<Omit<ApiParams, 'chain' | 'address'>>, PaginatedOptions {
chain?: EvmChainish;
address: EvmAddressish;
}

type ApiResult = operations[operation]['responses']['200']['content']['application/json'];

export const getAllTokenIdsResolver = new EvmPaginatedResolver({
getPath: (params: Params) => `nft/${params.address}`,
apiToResult: (data: ApiResult) =>
data.result?.map((nft) => ({
token: new EvmNFT({
contractType: nft.contract_type,
tokenAddress: nft.token_address,
tokenId: nft.token_id,
tokenUri: nft.token_uri,
metadata: nft.metadata,
name: nft.name,
symbol: nft.symbol,
}),
syncedAt: nft.synced_at ? new Date(nft.synced_at) : undefined,
amount: nft.amount,
// TODO: below are data returned that are not present in swagger docs so no type definition (report to api squad)
// tokenHash: nft.token_hash
// blockNumberMinted: nft.
// lastMetadataSync: nft.last_metadata_sync ? new Date(nft.last_metadata_sync) : undefined,
// lastTokenUriSync: nft.last_token_uri_sync ? new Date(nft.last_token_uri_sync) : undefined,
})),
resultToJson: (data) =>
data?.map((nft) => ({
...nft,
token: nft.token.toJSON(),
})),
parseParams: (params: Params): ApiParams => ({
...params,
chain: params.chain ? EvmChain.create(params.chain).apiHex : 'eth',
address: EvmAddress.create(params.address).lowercase,
}),
});
53 changes: 53 additions & 0 deletions packages/evmApi/src/resolvers/token/getNFTOwners.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { EvmChain, EvmChainish, EvmAddressish, EvmAddress, EvmNFT } from '@moralis/core';
import { operations } from '../../generated/types';
import { Camelize } from '../../utils/toCamelCase';
import { EvmPaginatedResolver, PaginatedOptions } from '../PaginatedResolver';

type operation = 'getNFTOwners';

type QueryParams = operations[operation]['parameters']['query'];
type PathParams = operations[operation]['parameters']['path'];
type ApiParams = QueryParams & PathParams;

export interface Params extends Camelize<Omit<ApiParams, 'chain' | 'address'>>, PaginatedOptions {
chain?: EvmChainish;
address: EvmAddressish;
}

type ApiResult = operations[operation]['responses']['200']['content']['application/json'];

export const getNFTOwnersResolver = new EvmPaginatedResolver({
getPath: (params: Params) => `nft/${params.address}/owners`,
apiToResult: (data: ApiResult) =>
data.result?.map((nft) => ({
token: new EvmNFT({
contractType: nft.contract_type,
tokenAddress: nft.token_address,
tokenId: nft.token_id,
tokenUri: nft.token_uri,
metadata: nft.metadata,
name: nft.name,
symbol: nft.symbol,
}),
syncedAt: nft.synced_at ? new Date(nft.synced_at) : undefined,
blockNumberMinted: nft.block_number_minted,
blockNumber: nft.block_number,
ownerOf: EvmAddress.create(nft.owner_of),
amount: nft.amount,
// TODO: below are data returned that are not present in swagger docs so no type definition (report to api squad)
// tokenHash: nft.token_hash
// lastMetadataSync: nft.last_metadata_sync ? new Date(nft.last_metadata_sync) : undefined,
// lastTokenUriSync: nft.last_token_uri_sync ? new Date(nft.last_token_uri_sync) : undefined,
})),
resultToJson: (data) =>
data?.map((nft) => ({
...nft,
syncedAt: nft.syncedAt?.toLocaleDateString(),
token: nft.token.toJSON(),
})),
parseParams: (params: Params): ApiParams => ({
...params,
chain: params.chain ? EvmChain.create(params.chain).apiHex : 'eth',
address: EvmAddress.create(params.address).lowercase,
}),
});
Loading

0 comments on commit 859a6a1

Please sign in to comment.