Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8696199849 | ||
|
|
05353fd8da | ||
|
|
baa87a1fbd | ||
|
|
407932680f | ||
|
|
6bec17c07a | ||
|
|
c379d19dfb | ||
|
|
3e2bec8a47 | ||
|
|
8b028c29d5 | ||
|
|
cc286841e2 | ||
|
|
576d968a89 | ||
|
|
f2bdf47b4f | ||
|
|
b92d3f7006 | ||
|
|
c9457bc2e7 | ||
|
|
3308bddd70 | ||
|
|
8954b8c5b6 | ||
|
|
3287c2b0f2 | ||
|
|
a5cdd85c77 | ||
|
|
e9e71cfcd8 | ||
|
|
27b3475d64 | ||
|
|
6ba9cad8d8 | ||
|
|
a5ad3d6828 | ||
|
|
9c817de558 | ||
|
|
326f52ae4e | ||
|
|
beafc856cf | ||
|
|
a85b35e75f | ||
|
|
5644ccd3ee | ||
|
|
14a5a31d70 | ||
|
|
83417c23d8 | ||
|
|
b6ebc82d5a | ||
|
|
091f175860 | ||
|
|
8811b99ad5 | ||
|
|
711783dbbf |
@@ -0,0 +1,18 @@
|
||||
name: "Install"
|
||||
description: "Sets up Node.js and runs install"
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
cache: "yarn"
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: yarn install --frozen-lockfile
|
||||
env:
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
|
||||
@@ -22,18 +22,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: "yarn"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Install
|
||||
uses: ./.github/composite-actions/install
|
||||
|
||||
- name: Build
|
||||
run: yarn build
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
# To use Remote Caching, uncomment the next lines and follow the steps below.
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: "yarn"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Create Release Pull Request or Publish to npm
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
# This expects you to have a script called release which does a build for your packages and calls changeset publish
|
||||
publish: yarn release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -15,17 +15,12 @@ jobs:
|
||||
timeout-minutes: 60
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: "yarn"
|
||||
- name: Install
|
||||
uses: ./.github/composite-actions/install
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
- name: Install Playwright
|
||||
run: npx playwright install --with-deps
|
||||
|
||||
- name: Run e2e tests
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
name: Release Nightly
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release Nightly
|
||||
runs-on: ubuntu-latest
|
||||
# To use Remote Caching, uncomment the next lines and follow the steps below.
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
steps:
|
||||
- name: Checkout Repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js environment
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: "yarn"
|
||||
|
||||
- name: Install Dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Create an .npmrc for nightly release
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: |
|
||||
cat << EOF > "$HOME/.npmrc"
|
||||
//registry.npmjs.org/:_authToken=$NPM_TOKEN
|
||||
EOF
|
||||
|
||||
- name: Publish Nightly version to NPM
|
||||
run: yarn release:nightly
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,81 @@
|
||||
# pulled from: https://github.com/changesets/changesets/pull/909
|
||||
|
||||
name: release-pr
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
deploy-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: acknowledge deployment request to commenter
|
||||
id: check
|
||||
uses: khan/pull-request-comment-trigger@master
|
||||
with:
|
||||
trigger: "/release-pr"
|
||||
reaction: rocket
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
- name: validate user
|
||||
id: validate_user
|
||||
if: ${{ steps.check.outputs.triggered == 'true' }}
|
||||
run: |
|
||||
if [[ "${AUTHOR_ASSOCIATION}" != 'MEMBER' && "${AUTHOR_ASSOCIATION}" != 'OWNER' && "${AUTHOR_ASSOCIATION}" != 'CONTRIBUTOR' ]]
|
||||
then
|
||||
echo "User authorization failed"
|
||||
exit 1
|
||||
else
|
||||
echo "User authorization successful"
|
||||
fi
|
||||
env:
|
||||
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }}
|
||||
- name: check outputs
|
||||
run: echo ${{ steps.check.outputs.triggered }}
|
||||
|
||||
outputs:
|
||||
triggered: ${{ steps.check.outputs.triggered }}
|
||||
comment_body: ${{ github.event.comment.body }}
|
||||
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
needs: deploy-check
|
||||
if: needs.deploy-check.outputs.triggered == 'true'
|
||||
steps:
|
||||
- name: get pull request ref
|
||||
id: get_pull_request_ref
|
||||
uses: octokit/[email protected]
|
||||
with:
|
||||
route: GET /repos/{owner}/{repository}/pulls/{issue_id}
|
||||
owner: ${{ github.repository_owner }}
|
||||
repository: ${{ github.event.repository.name }}
|
||||
issue_id: ${{ github.event.issue.number }}
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: pull the repo.
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
persist-credentials: true
|
||||
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }}
|
||||
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }}
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/composite-actions/install
|
||||
|
||||
- name: Build
|
||||
run: yarn build:release
|
||||
|
||||
- name: Configure npm
|
||||
run: |
|
||||
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Deploy pre-release
|
||||
run: |
|
||||
yarn changeset version --snapshot dev
|
||||
yarn changeset publish --tag dev --no-git-tag
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,49 @@
|
||||
name: Release Nightly & Stable
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".changeset/**"
|
||||
- "packages/**"
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install
|
||||
uses: ./.github/composite-actions/install
|
||||
|
||||
- name: Build
|
||||
run: yarn build:release
|
||||
|
||||
- name: Create release Pull Request or publish to NPM
|
||||
id: changesets
|
||||
uses: changesets/action@v1
|
||||
with:
|
||||
publish: yarn release
|
||||
version: yarn version-packages
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create @nightly release
|
||||
if: steps.changesets.outputs.published != 'true'
|
||||
run: |
|
||||
git checkout main
|
||||
yarn version-packages:nightly
|
||||
yarn release:nightly
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -15,12 +15,12 @@
|
||||
|
||||
| Package | Description | Latest Version |
|
||||
| ---------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [/sdk](./packages/sdk/README.md) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react/README.md) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth/README.md) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage/README.md) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli/README.md) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/solana](./packages/solana/README.md) | Solana SDK for Browser, Node and React Native | <a href="https://www.npmjs.com/package/@thirdweb-dev/solana"><img src="https://img.shields.io/npm/v/@thirdweb-dev/solana?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/sdk](./packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/solana](./packages/solana) | Solana SDK for Browser, Node and React Native | <a href="https://www.npmjs.com/package/@thirdweb-dev/solana"><img src="https://img.shields.io/npm/v/@thirdweb-dev/solana?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
|
||||
## How this monorepo functions
|
||||
|
||||
|
||||
+21
-16
@@ -2,7 +2,7 @@
|
||||
"name": "@thirdweb-dev/js",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"repository": "git@github.com:thirdweb-dev/js.git",
|
||||
"repository": "https://github.com/thirdweb-dev/js",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "MIT",
|
||||
"private": true,
|
||||
@@ -11,35 +11,40 @@
|
||||
"packages/*"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/changelog-github": "^0.4.6",
|
||||
"@changesets/cli": "^2.24.3",
|
||||
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-config-thirdweb": "*",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"turbo": "latest",
|
||||
"yarn-deduplicate": "^5.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "yarn-deduplicate yarn.lock",
|
||||
"test": "turbo run test",
|
||||
"e2e": "turbo run e2e",
|
||||
"build": "turbo run build",
|
||||
"build:release": "turbo run build --force",
|
||||
"dev": "turbo run dev --no-cache --parallel --continue",
|
||||
"fix:repo": "manypkg fix",
|
||||
"lint": "turbo run lint",
|
||||
"clean": "turbo run clean && rm -rf node_modules",
|
||||
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
|
||||
"changeset": "changeset",
|
||||
"release": "yarn build:release && changeset publish",
|
||||
"release:nightly": "yarn build:release && changeset version --snapshot nightly && changeset publish --tag nightly --no-git-tag"
|
||||
"version-packages": "changeset version",
|
||||
"release": "node ./scripts/pre-release.mjs && changeset publish",
|
||||
"version-packages:nightly": "changeset version --snapshot nightly",
|
||||
"release:nightly": "changeset publish --tag nightly"
|
||||
},
|
||||
"preconstruct": {
|
||||
"packages": [
|
||||
"packages/*"
|
||||
]
|
||||
},
|
||||
"packageManager": "[email protected]"
|
||||
"packageManager": "[email protected]",
|
||||
"dependencies": {
|
||||
"@changesets/changelog-github": "^0.4.6",
|
||||
"@changesets/cli": "^2.24.3",
|
||||
"@manypkg/cli": "^0.19.1",
|
||||
"@manypkg/get-packages": "^1.1.3",
|
||||
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
|
||||
"eslint": "^8.21.0",
|
||||
"postinstall-postinstall": "^2.1.0",
|
||||
"prettier": "^2.7.1",
|
||||
"turbo": "latest"
|
||||
},
|
||||
"manypkg": {
|
||||
"defaultBranch": "main"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,46 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
- Updated dependencies [[`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6)]:
|
||||
- @thirdweb-dev/sdk@2.4.8
|
||||
|
||||
## 1.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b)]:
|
||||
- @thirdweb-dev/sdk@2.4.7
|
||||
|
||||
## 1.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
- Updated dependencies [[`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117)]:
|
||||
- @thirdweb-dev/sdk@2.4.6
|
||||
|
||||
## 1.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
- Updated dependencies [[`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c)]:
|
||||
- @thirdweb-dev/sdk@2.4.5
|
||||
|
||||
## 1.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.8",
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
"./express": {
|
||||
@@ -16,11 +16,7 @@
|
||||
"default": "./next-auth/dist/thirdweb-dev-auth-next-auth.cjs.js"
|
||||
}
|
||||
},
|
||||
"repository": {
|
||||
"directory": "packages/auth",
|
||||
"type": "git",
|
||||
"url": "https://github.com/thirdweb-dev/js.git"
|
||||
},
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/auth",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
"files": [
|
||||
@@ -54,12 +50,12 @@
|
||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.2.16",
|
||||
"ethers": ">=5.5.1",
|
||||
"ethers": "^5.7.0",
|
||||
"express": "^4.18.1",
|
||||
"next": "12.2.0",
|
||||
"next-auth": "^4.10.3",
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.7.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
|
||||
## 0.7.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
- [#56](https://github.com/thirdweb-dev/js/pull/56) [`e9e71cf`](https://github.com/thirdweb-dev/js/commit/e9e71cfcd892611cd653431dc433b27532e9e3cc) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add basic tests
|
||||
|
||||
- Updated dependencies [[`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6)]:
|
||||
- @thirdweb-dev/sdk@2.4.8
|
||||
|
||||
## 0.7.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b)]:
|
||||
- @thirdweb-dev/sdk@2.4.7
|
||||
|
||||
## 0.7.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
- Updated dependencies [[`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117)]:
|
||||
- @thirdweb-dev/sdk@2.4.6
|
||||
|
||||
## 0.7.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
- Updated dependencies [[`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c)]:
|
||||
- @thirdweb-dev/sdk@2.4.5
|
||||
|
||||
## 0.7.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
export const CREATE_MESSAGES = {
|
||||
typeOfProject: "What type of project do you want to create?",
|
||||
projectName: "What is your project named?",
|
||||
framework: "What framework do you want to use?",
|
||||
language: "What language do you want to use?",
|
||||
contract: "What contract do you want to start from?",
|
||||
} as const;
|
||||
|
||||
export const ERROR_MESSAGES = {
|
||||
noConfiguration: "Failed to find a supported project configuration file in current directory"
|
||||
}
|
||||
@@ -1,36 +1,34 @@
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
import { CREATE_MESSAGES } from "../constants/constants";
|
||||
|
||||
// this creates an app, can take some time that's fine
|
||||
jest.setTimeout(120_000);
|
||||
|
||||
describe("npx thirdweb create", () => {
|
||||
it("should create app successfully", async () => {
|
||||
it("should create app (CRA) successfully", async () => {
|
||||
const { spawn, cleanup, exists } = await prepareEnvironment();
|
||||
const {
|
||||
// wait,
|
||||
waitForText,
|
||||
waitForFinish,
|
||||
// getStdout,
|
||||
// getStderr,
|
||||
getExitCode,
|
||||
// debug,
|
||||
pressKey,
|
||||
} = await spawn("node", "./dist/cli/index.js create");
|
||||
|
||||
await waitForText("What type of project do you want to create?");
|
||||
await waitForText(CREATE_MESSAGES.typeOfProject);
|
||||
await pressKey("enter");
|
||||
await waitForText("What is your project named?");
|
||||
await waitForText(CREATE_MESSAGES.projectName);
|
||||
await pressKey("enter");
|
||||
await waitForText("What framework do you want to use?");
|
||||
await waitForText(CREATE_MESSAGES.framework);
|
||||
// select CRA
|
||||
await pressKey("arrowDown");
|
||||
await pressKey("enter");
|
||||
await waitForText("What language do you want to use?");
|
||||
await waitForText(CREATE_MESSAGES.language);
|
||||
await pressKey("enter");
|
||||
|
||||
// wait for program to finish
|
||||
await waitForFinish();
|
||||
|
||||
//check if the app was created
|
||||
// check if the app was created
|
||||
expect(await exists("thirdweb-app/package.json")).toEqual(true);
|
||||
|
||||
// the process should exit with code 0
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
import { copyFile } from "fs/promises";
|
||||
import { resolve } from "path";
|
||||
import { ERROR_MESSAGES } from "../constants/constants";
|
||||
|
||||
// this creates an app, can take some time that's fine
|
||||
jest.setTimeout(120_000);
|
||||
|
||||
describe("npx thirdweb deploy", () => {
|
||||
it("should return deploy page url", async () => {
|
||||
const { spawn, cleanup, exists, path } = await prepareEnvironment();
|
||||
|
||||
await copyFile(resolve("./e2e/files/BasicContract.sol"), `${path}/BasicContract.sol`);
|
||||
|
||||
const {
|
||||
waitForText,
|
||||
waitForFinish,
|
||||
getExitCode,
|
||||
writeText,
|
||||
getStdout,
|
||||
} = await spawn("node", "./dist/cli/index.js deploy");
|
||||
|
||||
expect(await exists("BasicContract.sol")).toEqual(true);
|
||||
|
||||
await waitForText(ERROR_MESSAGES.noConfiguration);
|
||||
await writeText("y")
|
||||
|
||||
// wait for program to finish
|
||||
await waitForFinish();
|
||||
|
||||
expect(getStdout().at(-1)).toContain("https://thirdweb.com/contracts/deploy/");
|
||||
|
||||
// the process should exit with code 0
|
||||
expect(getExitCode()).toEqual(0);
|
||||
|
||||
await cleanup(); // cleanup after test
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,84 @@
|
||||
import { CREATE_MESSAGES } from "../constants/constants";
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
|
||||
// this creates an app, can take some time that's fine
|
||||
jest.setTimeout(120_000);
|
||||
|
||||
describe("npx thirdweb detect", () => {
|
||||
it("should detect ERC721Base extensions", async () => {
|
||||
const { spawn, cleanup, exists, path } = await prepareEnvironment();
|
||||
const create = await spawn("node", "./dist/cli/index.js create");
|
||||
|
||||
await create.waitForText(CREATE_MESSAGES.typeOfProject);
|
||||
// select contract
|
||||
await create.pressKey("arrowDown");
|
||||
await create.pressKey("enter");
|
||||
await create.waitForText(CREATE_MESSAGES.projectName);
|
||||
// use default name
|
||||
await create.pressKey("enter");
|
||||
await create.waitForText(CREATE_MESSAGES.framework);
|
||||
// select hardhat
|
||||
await create.pressKey("enter");
|
||||
await create.waitForText(CREATE_MESSAGES.contract);
|
||||
// select ERC721Base
|
||||
await create.pressKey("arrowDown");
|
||||
await create.pressKey("enter");
|
||||
|
||||
// wait for program to finish
|
||||
await create.waitForFinish();
|
||||
|
||||
// the process should exit with code 0
|
||||
expect(create.getExitCode()).toEqual(0);
|
||||
|
||||
// check if the contract was created
|
||||
expect(await exists("thirdweb-contracts/contracts/Contract.sol")).toEqual(
|
||||
true,
|
||||
);
|
||||
|
||||
// check that hardhat config exists
|
||||
expect(await exists("thirdweb-contracts/hardhat.config.js")).toEqual(true);
|
||||
|
||||
await create.writeText("cd thirdweb-contracts");
|
||||
await create.pressKey("enter");
|
||||
await create.writeText("npm install");
|
||||
await create.pressKey("enter");
|
||||
|
||||
const detect = await spawn(
|
||||
"node",
|
||||
"./dist/cli/index.js detect",
|
||||
"./thirdweb-contracts",
|
||||
);
|
||||
|
||||
// wait for program to finish
|
||||
await detect.waitForFinish();
|
||||
|
||||
const lines = detect.getStdout();
|
||||
|
||||
// Detected extensions
|
||||
expect(lines.findIndex((line) => line.includes("ERC721"))).toBeGreaterThan(
|
||||
-1,
|
||||
);
|
||||
expect(
|
||||
lines.findIndex((line) => line.includes("ERC721Burnable")),
|
||||
).toBeGreaterThan(-1);
|
||||
expect(
|
||||
lines.findIndex((line) => line.includes("ERC721Mintable")),
|
||||
).toBeGreaterThan(-1);
|
||||
|
||||
// Suggested extensions
|
||||
expect(
|
||||
lines.findIndex((line) => line.includes("- ERC721Enumerable")),
|
||||
).toBeGreaterThan(-1);
|
||||
expect(
|
||||
lines.findIndex((line) => line.includes("- ERC721Droppable")),
|
||||
).toBeGreaterThan(-1);
|
||||
expect(
|
||||
lines.findIndex((line) => line.includes("- ERC721SignatureMint")),
|
||||
).toBeGreaterThan(-1);
|
||||
|
||||
// the process should exit with code 0
|
||||
expect(detect.getExitCode()).toEqual(0);
|
||||
|
||||
await cleanup(); // cleanup after test
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
contract BasicContract {
|
||||
constructor() {}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
import { copyFile } from "fs/promises";
|
||||
import { resolve } from "path";
|
||||
import { ERROR_MESSAGES } from "../constants/constants";
|
||||
|
||||
// this creates an app, can take some time that's fine
|
||||
jest.setTimeout(120_000);
|
||||
|
||||
describe("npx thirdweb release", () => {
|
||||
it("should return release page url", async () => {
|
||||
const { spawn, cleanup, exists, path } = await prepareEnvironment();
|
||||
|
||||
await copyFile(resolve("./e2e/files/BasicContract.sol"), `${path}/BasicContract.sol`);
|
||||
|
||||
const {
|
||||
waitForText,
|
||||
waitForFinish,
|
||||
getExitCode,
|
||||
writeText,
|
||||
getStdout,
|
||||
} = await spawn("node", "./dist/cli/index.js release");
|
||||
|
||||
expect(await exists("BasicContract.sol")).toEqual(true);
|
||||
|
||||
await waitForText(ERROR_MESSAGES.noConfiguration);
|
||||
await writeText("y")
|
||||
|
||||
// wait for program to finish
|
||||
await waitForFinish();
|
||||
|
||||
expect(getStdout().at(-1)).toContain("https://thirdweb.com/contracts/release/");
|
||||
|
||||
// the process should exit with code 0
|
||||
expect(getExitCode()).toEqual(0);
|
||||
|
||||
await cleanup(); // cleanup after test
|
||||
});
|
||||
});
|
||||
@@ -1,12 +1,8 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.7.5",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com:thirdweb-dev/js.git",
|
||||
"directory": "packages/cli"
|
||||
},
|
||||
"version": "0.7.10",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
@@ -26,12 +22,12 @@
|
||||
"@types/validate-npm-package-name": "^4.0.0",
|
||||
"hardhat": "^2.9.3",
|
||||
"jest": "^29.0.1",
|
||||
"prettier": "^2.6.2",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^28.0.8",
|
||||
"ts-node": "^10.7.0",
|
||||
"tsc": "^2.0.4",
|
||||
"tsup": "^6.2.3",
|
||||
"typescript": "^4.6.3"
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@thirdweb-dev/sdk": "*",
|
||||
@@ -40,7 +36,7 @@
|
||||
"commander": "^9.1.0",
|
||||
"cpy": "^9.0.1",
|
||||
"enquirer": "^2.3.6",
|
||||
"ethers": "^5.6.9",
|
||||
"ethers": "^5.7.0",
|
||||
"form-data": "^4.0.0",
|
||||
"got": "11.8.5",
|
||||
"inquirer": "^8.2.3",
|
||||
@@ -56,7 +52,7 @@
|
||||
"update-check": "^1.5.4",
|
||||
"update-notifier": "^6.0.2",
|
||||
"validate-npm-package-name": "^4.0.0",
|
||||
"yaml": "^2.0.1"
|
||||
"yaml": "^2.1.1"
|
||||
},
|
||||
"bin": {
|
||||
"thirdweb": "./dist/cli/index.js"
|
||||
|
||||
@@ -28,7 +28,7 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$
|
||||
updateNotifier({
|
||||
pkg,
|
||||
shouldNotifyInNpmScript: true,
|
||||
//check every time while we're still building the CLI
|
||||
// check every time while we're still building the CLI
|
||||
updateCheckInterval: 0,
|
||||
}).notify();
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ export async function detectExtensions(options: any) {
|
||||
`Detected extension on ${chalk.blueBright(contractWithFeatures.name)}`,
|
||||
).stopAndPersist({ symbol: "🔎" });
|
||||
contractWithFeatures.enabledFeatures.map((feature) => {
|
||||
info(`${chalk.green(feature.name)}`);
|
||||
logger.info(`✔️ ${chalk.green(feature.name)}`);
|
||||
});
|
||||
}
|
||||
logger.info(``);
|
||||
|
||||
@@ -5,6 +5,7 @@ import FoundryDetector from "./foundry";
|
||||
import HardhatDetector from "./hardhat";
|
||||
import TruffleDetector from "./truffle";
|
||||
import inquirer from "inquirer";
|
||||
import { ERROR_MESSAGES } from "../../../constants/constants";
|
||||
|
||||
const { Confirm } = require("enquirer");
|
||||
|
||||
@@ -25,7 +26,7 @@ export default async function detect(
|
||||
|
||||
//if there is no project returned at all then just return unknown}
|
||||
if (!possibleProjectTypes.length) {
|
||||
warn("Failed to find a supported project configuration file in current directory " + path);
|
||||
warn(`${ERROR_MESSAGES.noConfiguration} ${path}`);
|
||||
const prompt = new Confirm({
|
||||
name: "continue",
|
||||
message: "Do you want to continue and compile this project with solc instead?",
|
||||
|
||||
@@ -8,6 +8,7 @@ import { validateNpmName } from "./helpers/validate-pkg";
|
||||
import chalk from "chalk";
|
||||
import path from "path";
|
||||
import prompts from "prompts";
|
||||
import { CREATE_MESSAGES } from "../../constants/constants";
|
||||
|
||||
let projectType: string = "";
|
||||
let projectPath: string = "";
|
||||
@@ -65,7 +66,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "select",
|
||||
name: "projectType",
|
||||
message: "What type of project do you want to create?",
|
||||
message: CREATE_MESSAGES.typeOfProject,
|
||||
choices: [
|
||||
{ title: "App", value: "app" },
|
||||
{ title: "Contract", value: "contract" },
|
||||
@@ -87,7 +88,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "text",
|
||||
name: "path",
|
||||
message: "What is your project named?",
|
||||
message: CREATE_MESSAGES.projectName,
|
||||
initial: options.template || defaultName,
|
||||
validate: (name) => {
|
||||
const validation = validateNpmName(path.basename(path.resolve(name)));
|
||||
@@ -123,7 +124,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "select",
|
||||
name: "framework",
|
||||
message: "What framework do you want to use?",
|
||||
message: CREATE_MESSAGES.framework,
|
||||
choices: [
|
||||
{ title: "Next.js", value: "next" },
|
||||
{ title: "Create React App", value: "cra" },
|
||||
@@ -140,7 +141,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "select",
|
||||
name: "language",
|
||||
message: "What language do you want to use?",
|
||||
message: CREATE_MESSAGES.language,
|
||||
choices: [
|
||||
{ title: "JavaScript", value: "javascript" },
|
||||
{ title: "TypeScript", value: "typescript" },
|
||||
@@ -160,7 +161,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "select",
|
||||
name: "framework",
|
||||
message: "What framework do you want to use?",
|
||||
message: CREATE_MESSAGES.framework,
|
||||
choices: [
|
||||
{ title: "Hardhat", value: "hardhat" },
|
||||
{ title: "Forge", value: "forge" },
|
||||
@@ -177,7 +178,7 @@ export async function twCreate(options: any) {
|
||||
const res = await prompts({
|
||||
type: "select",
|
||||
name: "baseContract",
|
||||
message: "What contract do you want to start from?",
|
||||
message: CREATE_MESSAGES.contract,
|
||||
choices: [
|
||||
{ title: "Empty Contract", value: "" },
|
||||
{ title: "ERC721 Base", value: "ERC721Base" },
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
(BigInt.prototype as any).toJSON = function () {
|
||||
return this.toString();
|
||||
};
|
||||
|
||||
console.log(`__tw__${JSON.stringify((globalThis as any).config)}__tw__`);
|
||||
|
||||
export {};
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": "@thirdweb-dev/tsconfig/sdk.json",
|
||||
"include": ["src"],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
"exclude": ["dist", "build", "node_modules"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
abis
|
||||
@@ -1,5 +1,29 @@
|
||||
# @thirdweb-dev/contracts-js
|
||||
|
||||
## 1.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
## 1.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#59](https://github.com/thirdweb-dev/js/pull/59) [`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b) Thanks [@jnsdls](https://github.com/jnsdls)! - move `abis` from top level into `dist` in contracts-js
|
||||
|
||||
## 1.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
## 1.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
## 1.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/contracts-js",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.7",
|
||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"directory": "packages/contracts-js",
|
||||
"type": "git",
|
||||
"url": "https://github.com/thirdweb-dev/js.git"
|
||||
},
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
||||
"dependencies": {
|
||||
"@thirdweb-dev/contracts": "3.1.6-1"
|
||||
},
|
||||
@@ -18,23 +14,17 @@
|
||||
"@preconstruct/cli": "^2.2.1",
|
||||
"ethers": "^5.7.0",
|
||||
"typechain": "^8.1.0",
|
||||
"typescript": "^4.8.2"
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ethers": "^5.7.0"
|
||||
},
|
||||
"files": [
|
||||
"abis/",
|
||||
"dist/"
|
||||
],
|
||||
"preconstruct": {
|
||||
"entrypoints": [
|
||||
"index.ts"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"typechain": "rm -rf ./src && typechain --target ethers-v5 --out-dir src '../../node_modules/@thirdweb-dev/contracts/abi/*.json'",
|
||||
"extract-abi": "node ./scripts/extract-abis.mjs",
|
||||
"build": "yarn typechain && yarn extract-abi && tsc && yarn preconstruct build"
|
||||
"build": "yarn typechain && tsc && yarn preconstruct build && yarn extract-abi"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ const main = () => {
|
||||
"node_modules",
|
||||
"@thirdweb-dev/contracts/abi",
|
||||
);
|
||||
const destinationFolder = "./abis";
|
||||
const destinationFolder = "./dist/abis";
|
||||
if (existsSync(destinationFolder)) {
|
||||
rmSync(destinationFolder, { recursive: true });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# eslint-config-thirdweb
|
||||
|
||||
## 0.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"name": "eslint-config-thirdweb",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.3",
|
||||
"main": "index.js",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"eslint-config-next": "^12.0.8",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-react": "^7.28.0",
|
||||
"eslint-config-turbo": "latest"
|
||||
"eslint-config-turbo": "latest",
|
||||
"eslint-plugin-react": "^7.28.0"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/eslint-config-thirdweb"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,50 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 2.9.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69), [`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a), [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339), [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30)]:
|
||||
- @thirdweb-dev/sdk@2.4.9
|
||||
- @thirdweb-dev/storage@0.2.8
|
||||
|
||||
## 2.9.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
- Updated dependencies [[`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6)]:
|
||||
- @thirdweb-dev/sdk@2.4.8
|
||||
- @thirdweb-dev/storage@0.2.7
|
||||
|
||||
## 2.9.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b)]:
|
||||
- @thirdweb-dev/sdk@2.4.7
|
||||
|
||||
## 2.9.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
- Updated dependencies [[`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117)]:
|
||||
- @thirdweb-dev/sdk@2.4.6
|
||||
- @thirdweb-dev/storage@0.2.6
|
||||
|
||||
## 2.9.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
- Updated dependencies [[`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c)]:
|
||||
- @thirdweb-dev/sdk@2.4.5
|
||||
- @thirdweb-dev/storage@0.2.5
|
||||
|
||||
## 2.9.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
+14
-18
@@ -1,11 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "2.9.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com:thirdweb-dev/js.git",
|
||||
"directory": "packages/react"
|
||||
},
|
||||
"version": "2.9.7",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/thirdweb-dev-react.cjs.js",
|
||||
@@ -32,8 +28,8 @@
|
||||
"@babel/preset-env": "^7.18.10",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@babel/preset-typescript": "^7.18.6",
|
||||
"@microsoft/api-documenter": "^7.15.3",
|
||||
"@microsoft/api-extractor": "^7.19.4",
|
||||
"@microsoft/api-documenter": "^7.19.4",
|
||||
"@microsoft/api-extractor": "^7.29.2",
|
||||
"@microsoft/tsdoc": "^0.14.1",
|
||||
"@playwright/experimental-ct-react": "^1.25.1",
|
||||
"@playwright/test": "^1.25.1",
|
||||
@@ -42,19 +38,19 @@
|
||||
"@types/mime": "^3.0.1",
|
||||
"@types/react": "^18.0.5",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
"@typescript-eslint/parser": "^5.2.0",
|
||||
"eslint": "^8.9.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-inclusive-language": "^2.1.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-tsdoc": "^0.2.14",
|
||||
"ethers": "^5.6.1",
|
||||
"prettier": "^2.5.1",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.2.16",
|
||||
"ethers": "^5.7.0",
|
||||
"prettier": "^2.7.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"typescript": "^4.6.2"
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@emotion/react": "^11.10.0",
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extension": ["ts"],
|
||||
"require": ["@swc-node/register", "./test/hooks.ts"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
node_modules/
|
||||
@@ -1,5 +1,57 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 2.4.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#74](https://github.com/thirdweb-dev/js/pull/74) [`baa87a1`](https://github.com/thirdweb-dev/js/commit/baa87a1fbd7eee24ce9a95e16028de8435f85e69) Thanks [@nkrishang](https://github.com/nkrishang)! - Updated forwarder address for Goerli
|
||||
|
||||
- [#75](https://github.com/thirdweb-dev/js/pull/75) [`4079326`](https://github.com/thirdweb-dev/js/commit/407932680fb024f17f12f578aa22c7f8c0c13339) Thanks [@jnsdls](https://github.com/jnsdls)! - add a default for factory deployments initializer function ("initialize")
|
||||
|
||||
- [#71](https://github.com/thirdweb-dev/js/pull/71) [`05353fd`](https://github.com/thirdweb-dev/js/commit/05353fd8da82f77fb642bb38a533fb99801aed30) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Allow for chain agnostic gasless tx
|
||||
|
||||
- Updated dependencies [[`f2bdf47`](https://github.com/thirdweb-dev/js/commit/f2bdf47b4fd06433be367c9aac6d11a8dbbf1a1a)]:
|
||||
- @thirdweb-dev/storage@0.2.8
|
||||
|
||||
## 2.4.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#61](https://github.com/thirdweb-dev/js/pull/61) [`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6) Thanks [@jnsdls](https://github.com/jnsdls)! - fix versions in dependencies before releasing stable
|
||||
|
||||
- Updated dependencies [[`3287c2b`](https://github.com/thirdweb-dev/js/commit/3287c2b0f233332fe4a095f973deed8efab91db6)]:
|
||||
- @thirdweb-dev/contracts-js@1.1.7
|
||||
- @thirdweb-dev/storage@0.2.7
|
||||
|
||||
## 2.4.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#59](https://github.com/thirdweb-dev/js/pull/59) [`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b) Thanks [@jnsdls](https://github.com/jnsdls)! - move `abis` from top level into `dist` in contracts-js
|
||||
|
||||
- Updated dependencies [[`6ba9cad`](https://github.com/thirdweb-dev/js/commit/6ba9cad8d8b933256599dc3b147601cd4828c89b)]:
|
||||
- @thirdweb-dev/contracts-js@1.1.6
|
||||
|
||||
## 2.4.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117) Thanks [@jnsdls](https://github.com/jnsdls)! - bump versions again
|
||||
|
||||
- Updated dependencies [[`5644ccd`](https://github.com/thirdweb-dev/js/commit/5644ccd3ee2ff330e4e5840d3266033376750117)]:
|
||||
- @thirdweb-dev/contracts-js@1.1.5
|
||||
- @thirdweb-dev/storage@0.2.6
|
||||
|
||||
## 2.4.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c) Thanks [@jnsdls](https://github.com/jnsdls)! - release-all-packages
|
||||
|
||||
- Updated dependencies [[`091f175`](https://github.com/thirdweb-dev/js/commit/091f1758604d40e825ea28a13c2699d67bc75d8c)]:
|
||||
- @thirdweb-dev/contracts-js@1.1.4
|
||||
- @thirdweb-dev/storage@0.2.5
|
||||
|
||||
## 2.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,13 +3,9 @@
|
||||
|
||||
SHELL := /bin/bash
|
||||
|
||||
build:
|
||||
yarn run build
|
||||
|
||||
test: FORCE
|
||||
docker start hh-node || docker run --name hh-node -d -p 8545:8545 ethereumoptimism/hardhat
|
||||
./test/scripts/waitForHardhatNode.sh
|
||||
yarn run build
|
||||
yarn run test:all
|
||||
|
||||
FORCE: ;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("node", () => {
|
||||
it("getContract().metadata.get()", async () => {
|
||||
const { execute, cleanup } = await prepareEnvironment();
|
||||
|
||||
const { code, stdout, stderr } = await execute(
|
||||
"node",
|
||||
"./e2e/node-scripts/basic.js",
|
||||
);
|
||||
|
||||
console.log("stderr", stderr);
|
||||
|
||||
expect(code).to.equal(0);
|
||||
expect(stdout[0]).to.contain("mintED Toasts");
|
||||
expect(stderr.length).to.equal(0);
|
||||
|
||||
await cleanup();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +0,0 @@
|
||||
const { ThirdwebSDK } = require("../..");
|
||||
|
||||
(async function () {
|
||||
const sdk = new ThirdwebSDK("rinkeby");
|
||||
const c = await sdk.getContract("0x10fDF181eDceAEF044328BeF07979FfaE209023f");
|
||||
console.log(await c.metadata.get());
|
||||
})();
|
||||
+22
-29
@@ -1,12 +1,8 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "2.4.4",
|
||||
"version": "2.4.9",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": {
|
||||
"directory": "packages/sdk",
|
||||
"type": "git",
|
||||
"url": "https://github.com/thirdweb-dev/js.git"
|
||||
},
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
"main": "dist/thirdweb-dev-sdk.cjs.js",
|
||||
"module": "dist/thirdweb-dev-sdk.esm.js",
|
||||
@@ -25,48 +21,46 @@
|
||||
"generate-docs": "yarn full-build && yarn generate-md-docs",
|
||||
"generate-snippets": "node ./scripts/generate-snippets.mjs && node ./scripts/generate-feature-snippets.mjs",
|
||||
"build": "tsc && preconstruct build",
|
||||
"test:all": "ts-mocha --parallel --paths -t 120000 -r esm -p tsconfig.testing.json './test/**/*.test.ts'",
|
||||
"test:all": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --timeout 30000 --parallel './test/**/*.test.ts'",
|
||||
"test": "make test",
|
||||
"test:single": "ts-mocha --paths -t 120000 -r esm -p tsconfig.testing.json",
|
||||
"e2e": "ts-mocha --parallel --paths -t 120000 -r esm -p tsconfig.testing.json './e2e/**/*.test.ts'"
|
||||
"test:single": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --timeout 30000 --"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cbor": "^8.1.0",
|
||||
"@esbuild-plugins/node-modules-polyfill": "^0.1.4",
|
||||
"@gmrchk/cli-testing-library": "^0.1.2",
|
||||
"@microsoft/api-documenter": "^7.13.53",
|
||||
"@microsoft/api-extractor": "^7.18.10",
|
||||
"@microsoft/api-documenter": "^7.19.4",
|
||||
"@microsoft/api-extractor": "^7.29.2",
|
||||
"@microsoft/tsdoc": "^0.14.1",
|
||||
"@nomiclabs/hardhat-ethers": "2.0.5",
|
||||
"@preconstruct/cli": "^2.2.1",
|
||||
"@swc-node/register": "^1.5.1",
|
||||
"@swc/core": "^1.2.177",
|
||||
"@typechain/ethers-v5": "10.0.0",
|
||||
"@types/chai": "^4.3.1",
|
||||
"@types/chai": "^4.3.3",
|
||||
"@types/deep-equal-in-any-order": "^1.0.1",
|
||||
"@types/expect": "^24.3.0",
|
||||
"@types/mocha": "^9.1.1",
|
||||
"@types/node": "^17.0.0",
|
||||
"@types/node": "^18.0.0",
|
||||
"@types/uuid": "^8.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
"@typescript-eslint/parser": "^5.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.33.0",
|
||||
"@typescript-eslint/parser": "^5.33.0",
|
||||
"cbor": "^8.1.0",
|
||||
"chai": "^4.3.6",
|
||||
"deep-equal-in-any-order": "^1.1.18",
|
||||
"eslint": "^8",
|
||||
"eslint": "^8.21.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-import": "^2.24.2",
|
||||
"eslint-plugin-inclusive-language": "^2.1.1",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"eslint-plugin-tsdoc": "^0.2.14",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.2.16",
|
||||
"esm": "^3.2.25",
|
||||
"ethers": "^5.6.2",
|
||||
"hardhat": "2.9.3",
|
||||
"ethers": "^5.7.0",
|
||||
"hardhat": "^2.9.3",
|
||||
"mocha": "^10.0.0",
|
||||
"node-stdlib-browser": "^1.2.0",
|
||||
"prettier": "^2.4.1",
|
||||
"ts-mocha": "^10.0.0",
|
||||
"ts-node": "^10.7.0",
|
||||
"typechain": "^8.0.0",
|
||||
"typescript": "^4.6.2"
|
||||
"prettier": "^2.7.1",
|
||||
"typechain": "^8.1.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ethers": "^5"
|
||||
@@ -93,6 +87,5 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/thirdweb-dev/js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/thirdweb-dev/js/blob/main/packages/sdk/README.md",
|
||||
"author": "thirdweb eng <[email protected]>"
|
||||
}
|
||||
|
||||
@@ -112,6 +112,14 @@ export async function prepareClaim(
|
||||
};
|
||||
}
|
||||
|
||||
type Snapshot =
|
||||
| {
|
||||
address: string;
|
||||
proof: string[];
|
||||
maxClaimable: string;
|
||||
}[]
|
||||
| undefined;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @param merkleRoot
|
||||
@@ -122,12 +130,12 @@ export async function fetchSnapshot(
|
||||
merkleRoot: string,
|
||||
merkleMetadata: Record<string, string> | undefined,
|
||||
storage: IStorage,
|
||||
) {
|
||||
): Promise<Snapshot> {
|
||||
if (!merkleMetadata) {
|
||||
return undefined;
|
||||
}
|
||||
const snapshotUri = merkleMetadata[merkleRoot];
|
||||
let snapshot = undefined;
|
||||
let snapshot: Snapshot = undefined;
|
||||
if (snapshotUri) {
|
||||
const raw = await storage.get(snapshotUri);
|
||||
const snapshotData = SnapshotSchema.parse(raw);
|
||||
@@ -203,7 +211,11 @@ export async function getClaimerProofs(
|
||||
merkleMetadata: Record<string, string>,
|
||||
storage: IStorage,
|
||||
): Promise<{ maxClaimable: BigNumber; proof: string[] }> {
|
||||
const claims = await fetchSnapshot(merkleRoot, merkleMetadata, storage);
|
||||
const claims: Snapshot = await fetchSnapshot(
|
||||
merkleRoot,
|
||||
merkleMetadata,
|
||||
storage,
|
||||
);
|
||||
if (claims === undefined) {
|
||||
return {
|
||||
proof: [],
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
import {
|
||||
getNativeTokenByChainId,
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
} from "../constants/currency";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { AmountSchema } from "../schema/shared";
|
||||
import { Amount, Currency, CurrencyValue, Price } from "../types/currency";
|
||||
import { BaseERC20 } from "../types/eips";
|
||||
import { IERC20, IERC20Metadata } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import ERC20MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC20Metadata.json";
|
||||
import {
|
||||
BigNumber,
|
||||
BigNumberish,
|
||||
@@ -8,16 +18,6 @@ import {
|
||||
utils,
|
||||
ethers,
|
||||
} from "ethers";
|
||||
import {
|
||||
getNativeTokenByChainId,
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
} from "../constants/currency";
|
||||
import { Amount, Currency, CurrencyValue, Price } from "../types/currency";
|
||||
import { AmountSchema } from "../schema/shared";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import ERC20MetadataAbi from "@thirdweb-dev/contracts-js/abis/IERC20Metadata.json";
|
||||
import { BaseERC20 } from "../types/eips";
|
||||
import { IERC20, IERC20Metadata } from "@thirdweb-dev/contracts-js";
|
||||
|
||||
export function isNativeToken(tokenAddress: string): boolean {
|
||||
return (
|
||||
|
||||
@@ -293,7 +293,7 @@ function hexToBytes(hex: string | number) {
|
||||
throw new Error(`Given value "${hex}" is not a valid hex string.`);
|
||||
}
|
||||
hex = hex.replace(/^0x/i, "");
|
||||
const bytes = [];
|
||||
const bytes: number[] = [];
|
||||
for (let c = 0; c < hex.length; c += 2) {
|
||||
bytes.push(parseInt(hex.slice(c, c + 2), 16));
|
||||
}
|
||||
|
||||
@@ -12,6 +12,16 @@ export const ForwardRequest = [
|
||||
{ name: "data", type: "bytes" },
|
||||
];
|
||||
|
||||
export const ChainAwareForwardRequest = [
|
||||
{ name: "from", type: "address" },
|
||||
{ name: "to", type: "address" },
|
||||
{ name: "value", type: "uint256" },
|
||||
{ name: "gas", type: "uint256" },
|
||||
{ name: "nonce", type: "uint256" },
|
||||
{ name: "data", type: "bytes" },
|
||||
{ name: "chainid", type: "uint256" },
|
||||
];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { BigNumber, BigNumberish, Contract, providers } from "ethers";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../constants/contract";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { SignerOrProvider } from "../core";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { MAX_BPS } from "../schema/shared";
|
||||
import {
|
||||
NewAuctionListing,
|
||||
NewDirectListing,
|
||||
Offer,
|
||||
} from "../types/marketplace";
|
||||
import invariant from "tiny-invariant";
|
||||
import { fetchCurrencyValue } from "./currency";
|
||||
import { MAX_BPS } from "../schema/shared";
|
||||
import { IERC1155, IERC165, IERC721 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/abis/IERC1155.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/abis/IERC721.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/abis/IERC165.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import { BigNumber, BigNumberish, Contract, providers } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/**
|
||||
* This method checks if the given token is approved for the transferrerContractAddress contract.
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { BigNumber, BigNumberish, Contract, ethers, providers } from "ethers";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../constants/contract";
|
||||
import {
|
||||
CommonNFTInput,
|
||||
CommonNFTOutput,
|
||||
@@ -6,17 +9,18 @@ import {
|
||||
NFTMetadataInput,
|
||||
NFTMetadataOrUri,
|
||||
} from "../schema/tokens/common";
|
||||
import type { IStorage } from "@thirdweb-dev/storage";
|
||||
import { IERC1155Metadata, IERC165, IERC721Metadata } from "@thirdweb-dev/contracts-js";
|
||||
import { UploadProgressEvent } from "../types/index";
|
||||
import { NotFoundError } from "./error";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../constants/contract";
|
||||
import ERC721MetadataAbi from "@thirdweb-dev/contracts-js/abis/IERC721Metadata.json";
|
||||
import ERC1155MetadataAbi from "@thirdweb-dev/contracts-js/abis/IERC1155Metadata.json";
|
||||
import ERC165MetadataAbi from "@thirdweb-dev/contracts-js/abis/IERC165.json";
|
||||
import { UploadProgressEvent } from "../types/index";
|
||||
IERC1155Metadata,
|
||||
IERC165,
|
||||
IERC721Metadata,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC165MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC721Metadata.json";
|
||||
import ERC1155MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155Metadata.json";
|
||||
import type { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, Contract, ethers, providers } from "ethers";
|
||||
|
||||
const FALLBACK_METADATA = {
|
||||
name: "Failed to load NFT metadata",
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ethers, Signer, providers } from "ethers";
|
||||
export interface EIP712StandardDomain {
|
||||
name: string;
|
||||
version: string;
|
||||
chainId: number;
|
||||
chainId?: number;
|
||||
verifyingContract: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export const OZ_DEFENDER_FORWARDER_ADDRESS =
|
||||
|
||||
const TWRegistry_address = "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd";
|
||||
const TWFactory_address = "0x5DBC7B840baa9daBcBe9D2492E45D7244B54A2A0";
|
||||
const ContractPublisher_address = "0x58c892e6bc196371f7fb425177b0E2aA906BC007"; // Polygon only
|
||||
const ContractPublisher_address = "0x664244560eBa21Bf82d7150C791bE1AbcD5B4cd7"; // Polygon only
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -17,6 +17,7 @@ const ContractPublisher_address = "0x58c892e6bc196371f7fb425177b0E2aA906BC007";
|
||||
export const CONTRACT_ADDRESSES: Record<
|
||||
SUPPORTED_CHAIN_ID,
|
||||
{
|
||||
openzeppelinForwarder: string;
|
||||
biconomyForwarder: string;
|
||||
twFactory: string;
|
||||
twRegistry: string;
|
||||
@@ -24,90 +25,105 @@ export const CONTRACT_ADDRESSES: Record<
|
||||
}
|
||||
> = {
|
||||
[ChainId.Mainnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x84a0856b038eaAd1cC7E297cF34A7e72685A8693",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.Rinkeby]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0xFD4973FeB2031D4409fB57afEE5dF2051b171104",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Goerli]: {
|
||||
openzeppelinForwarder: "0x5001A14CA6163143316a7C614e30e6041033Ac20",
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0xB1Bd9d7942A250BA2Dce27DD601F2ED4211A60C4",
|
||||
},
|
||||
[ChainId.Polygon]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x86C80a8aa58e0A4fa09A69624c31Ab2a6CAD56b8",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x308473Be900F4185A56587dE54bDFF5E8f7a6AE7",
|
||||
},
|
||||
[ChainId.Mumbai]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x9399BB24DBB5C4b782C70c2969F58716Ebbd6a3b",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3F17972CB27506eb4a6a3D59659e0B57a43fd16C",
|
||||
},
|
||||
[ChainId.Avalanche]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x64CD353384109423a966dCd3Aa30D884C9b2E057",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.AvalancheFujiTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: "0x6271Ca63D30507f2Dcbf99B52787032506D75BBF",
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Fantom]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0x97EA0Fcc552D5A8Fb5e9101316AAd0D62Ea0876B",
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.FantomTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: TWFactory_address,
|
||||
twRegistry: TWRegistry_address,
|
||||
twBYOCRegistry: "0x3E6eE864f850F5e5A98bc950B68E181Cf4010F23",
|
||||
},
|
||||
[ChainId.Arbitrum]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.ArbitrumTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xb0435b47ad26115A39c59735b814f3769F07C2c1",
|
||||
twRegistry: "0xcF4c511551aE4dab1F997866FC3900cd2aaeC40D",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.Optimism]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.OptimismTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
},
|
||||
[ChainId.BinanceSmartChainMainnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
twRegistry: "0x7c487845f98938Bb955B1D5AD069d9a30e4131fd",
|
||||
},
|
||||
[ChainId.BinanceSmartChainTestnet]: {
|
||||
openzeppelinForwarder: OZ_DEFENDER_FORWARDER_ADDRESS,
|
||||
biconomyForwarder: constants.AddressZero,
|
||||
twBYOCRegistry: constants.AddressZero,
|
||||
twFactory: "0xd24b3de085CFd8c54b94feAD08a7962D343E6DE0",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import DelayedRevealAbi from "@thirdweb-dev/contracts-js/abis/DelayedReveal.json";
|
||||
import DropSinglePhase1155 from "@thirdweb-dev/contracts-js/abis/DropSinglePhase1155.json";
|
||||
import IBurnableERC1155Abi from "@thirdweb-dev/contracts-js/abis/IBurnableERC1155.json";
|
||||
import Erc1155Abi from "@thirdweb-dev/contracts-js/abis/IERC1155.json";
|
||||
import Erc1155EnumerableAbi from "@thirdweb-dev/contracts-js/abis/IERC1155Enumerable.json";
|
||||
import ILazyMintAbi from "@thirdweb-dev/contracts-js/abis/ILazyMint.json";
|
||||
import IMintableERC1155Abi from "@thirdweb-dev/contracts-js/abis/IMintableERC1155.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/abis/IMulticall.json";
|
||||
import ISignatureMintERC1155Abi from "@thirdweb-dev/contracts-js/abis/ISignatureMintERC1155.json";
|
||||
import DelayedRevealAbi from "@thirdweb-dev/contracts-js/dist/abis/DelayedReveal.json";
|
||||
import DropSinglePhase1155 from "@thirdweb-dev/contracts-js/dist/abis/DropSinglePhase1155.json";
|
||||
import IBurnableERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IBurnableERC1155.json";
|
||||
import Erc1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import Erc1155EnumerableAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155Enumerable.json";
|
||||
import ILazyMintAbi from "@thirdweb-dev/contracts-js/dist/abis/ILazyMint.json";
|
||||
import IMintableERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IMintableERC1155.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/dist/abis/IMulticall.json";
|
||||
import ISignatureMintERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/ISignatureMintERC1155.json";
|
||||
|
||||
export const FEATURE_EDITION_BURNABLE = {
|
||||
name: "ERC1155Burnable",
|
||||
@@ -114,6 +114,7 @@ export const FEATURE_EDITION = {
|
||||
[FEATURE_EDITION_MINTABLE.name]: FEATURE_EDITION_MINTABLE,
|
||||
[FEATURE_EDITION_DROPPABLE.name]: FEATURE_EDITION_DROPPABLE,
|
||||
[FEATURE_EDITION_REVEALABLE.name]: FEATURE_EDITION_REVEALABLE,
|
||||
[FEATURE_EDITION_SIGNATURE_MINTABLE.name]: FEATURE_EDITION_SIGNATURE_MINTABLE,
|
||||
[FEATURE_EDITION_SIGNATURE_MINTABLE.name]:
|
||||
FEATURE_EDITION_SIGNATURE_MINTABLE,
|
||||
},
|
||||
} as const;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import IBurnableERC20Abi from "@thirdweb-dev/contracts-js/abis/IBurnableERC20.json";
|
||||
import IDropSinglePhase from "@thirdweb-dev/contracts-js/abis/IDropSinglePhase.json";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import IMintableERC20Abi from "@thirdweb-dev/contracts-js/abis/IMintableERC20.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/abis/IMulticall.json";
|
||||
import ISignatureMintERC20Abi from "@thirdweb-dev/contracts-js/abis/ISignatureMintERC20.json";
|
||||
import IBurnableERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IBurnableERC20.json";
|
||||
import IDropSinglePhase from "@thirdweb-dev/contracts-js/dist/abis/IDropSinglePhase.json";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import IMintableERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IMintableERC20.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/dist/abis/IMulticall.json";
|
||||
import ISignatureMintERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/ISignatureMintERC20.json";
|
||||
|
||||
export const FEATURE_TOKEN_DROPPABLE = {
|
||||
name: "ERC20Droppable",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import Erc721Abi from "@thirdweb-dev/contracts-js/abis/IERC721.json";
|
||||
import Erc721EnumerableAbi from "@thirdweb-dev/contracts-js/abis/IERC721Enumerable.json";
|
||||
import Erc721SupplyAbi from "@thirdweb-dev/contracts-js/abis/IERC721Supply.json";
|
||||
import IMintableERC721Abi from "@thirdweb-dev/contracts-js/abis/IMintableERC721.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/abis/IMulticall.json";
|
||||
import DelayedRevealAbi from "@thirdweb-dev/contracts-js/abis/IDelayedReveal.json";
|
||||
import ILazyMintAbi from "@thirdweb-dev/contracts-js/abis/ILazyMint.json";
|
||||
import IDropSinglePhase from "@thirdweb-dev/contracts-js/abis/IDropSinglePhase.json";
|
||||
import SignatureMintERC721Abi from "@thirdweb-dev/contracts-js/abis/SignatureMintERC721.json";
|
||||
import IBurnableERC721Abi from "@thirdweb-dev/contracts-js/abis/IBurnableERC721.json";
|
||||
import IBurnableERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IBurnableERC721.json";
|
||||
import DelayedRevealAbi from "@thirdweb-dev/contracts-js/dist/abis/IDelayedReveal.json";
|
||||
import IDropSinglePhase from "@thirdweb-dev/contracts-js/dist/abis/IDropSinglePhase.json";
|
||||
import Erc721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import Erc721EnumerableAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC721Enumerable.json";
|
||||
import Erc721SupplyAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC721Supply.json";
|
||||
import ILazyMintAbi from "@thirdweb-dev/contracts-js/dist/abis/ILazyMint.json";
|
||||
import IMintableERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IMintableERC721.json";
|
||||
import MulticallAbi from "@thirdweb-dev/contracts-js/dist/abis/IMulticall.json";
|
||||
import SignatureMintERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/SignatureMintERC721.json";
|
||||
|
||||
export const FEATURE_NFT_BURNABLE = {
|
||||
name: "ERC721Burnable",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import IContractMetadataAbi from "@thirdweb-dev/contracts-js/abis/IContractMetadata.json";
|
||||
import IPermissionsAbi from "@thirdweb-dev/contracts-js/abis/IPermissions.json";
|
||||
import IThirdwebPlatformFeeAbi from "@thirdweb-dev/contracts-js/abis/IPlatformFee.json";
|
||||
import IThirdwebPrimarySaleAbi from "@thirdweb-dev/contracts-js/abis/IPrimarySale.json";
|
||||
import IThirdwebRoyaltyAbi from "@thirdweb-dev/contracts-js/abis/IRoyalty.json";
|
||||
import IContractMetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IContractMetadata.json";
|
||||
import IPermissionsAbi from "@thirdweb-dev/contracts-js/dist/abis/IPermissions.json";
|
||||
import IThirdwebPlatformFeeAbi from "@thirdweb-dev/contracts-js/dist/abis/IPlatformFee.json";
|
||||
import IThirdwebPrimarySaleAbi from "@thirdweb-dev/contracts-js/dist/abis/IPrimarySale.json";
|
||||
import IThirdwebRoyaltyAbi from "@thirdweb-dev/contracts-js/dist/abis/IRoyalty.json";
|
||||
|
||||
export const FEATURE_ROYALTY = {
|
||||
name: "Royalty",
|
||||
|
||||
@@ -28,7 +28,7 @@ import { SDKOptions } from "../schema/sdk-options";
|
||||
import { NFTMetadata, NFTMetadataOrUri } from "../schema/tokens/common";
|
||||
import { QueryAllParams, UploadProgressEvent } from "../types";
|
||||
import { DropERC1155 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/DropERC1155.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/DropERC1155.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants } from "ethers";
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from "../schema/tokens/edition";
|
||||
import { QueryAllParams } from "../types";
|
||||
import { TokenERC1155 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/TokenERC1155.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/TokenERC1155.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants } from "ethers";
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { NFTCollection } from "./nft-collection";
|
||||
import { EditionDrop } from "./edition-drop";
|
||||
import { Edition } from "./edition";
|
||||
import { Token } from "./token";
|
||||
import { Vote } from "./vote";
|
||||
import { Split } from "./split";
|
||||
import { EditionDrop } from "./edition-drop";
|
||||
import { Marketplace } from "./marketplace";
|
||||
import { Pack } from "./pack";
|
||||
import { NFTDrop } from "./nft-drop";
|
||||
import { TokenDrop } from "./token-drop";
|
||||
import { SmartContract } from "./smart-contract";
|
||||
import { SignatureDrop } from "./signature-drop";
|
||||
import { Multiwrap } from "./multiwrap";
|
||||
import { NFTCollection } from "./nft-collection";
|
||||
import { NFTDrop } from "./nft-drop";
|
||||
import { Pack } from "./pack";
|
||||
import { SignatureDrop } from "./signature-drop";
|
||||
import { SmartContract } from "./smart-contract";
|
||||
import { Split } from "./split";
|
||||
import { Token } from "./token";
|
||||
import { TokenDrop } from "./token-drop";
|
||||
import { Vote } from "./vote";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
||||
@@ -19,7 +19,7 @@ import { DEFAULT_QUERY_ALL_COUNT } from "../types/QueryParams";
|
||||
import { AuctionListing, DirectListing } from "../types/marketplace";
|
||||
import { MarketplaceFilter } from "../types/marketplace/MarketPlaceFilter";
|
||||
import { Marketplace as MarketplaceContract } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/Marketplace.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/Marketplace.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
@@ -404,7 +404,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* @param contractAddress - the NFT contract address
|
||||
*/
|
||||
public async allowListingFromSpecificAssetOnly(contractAddress: string) {
|
||||
const encoded = [];
|
||||
const encoded: string[] = [];
|
||||
const members = await this.roles.get("asset");
|
||||
if (members.includes(constants.AddressZero)) {
|
||||
encoded.push(
|
||||
@@ -425,7 +425,7 @@ export class Marketplace implements UpdateableNetwork {
|
||||
* Allow listings from any NFT contract
|
||||
*/
|
||||
public async allowListingFromAnyAsset() {
|
||||
const encoded = [];
|
||||
const encoded: string[] = [];
|
||||
const members = await this.roles.get("asset");
|
||||
for (const addr in members) {
|
||||
encoded.push(
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
WrappedTokens,
|
||||
} from "../types/multiwrap";
|
||||
import { Multiwrap as MultiwrapContract } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/Multiwrap.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/Multiwrap.json";
|
||||
import {
|
||||
ITokenBundle,
|
||||
TokensWrappedEvent,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { getRoleHash } from "../common";
|
||||
import { Erc721WithQuantitySignatureMintable } from "../core";
|
||||
import { ContractEncoder } from "../core/classes/contract-encoder";
|
||||
import { ContractEvents } from "../core/classes/contract-events";
|
||||
import { ContractInterceptor } from "../core/classes/contract-interceptor";
|
||||
@@ -15,6 +14,7 @@ import { Erc721Burnable } from "../core/classes/erc-721-burnable";
|
||||
import { Erc721Enumerable } from "../core/classes/erc-721-enumerable";
|
||||
import { Erc721Mintable } from "../core/classes/erc-721-mintable";
|
||||
import { Erc721Supply } from "../core/classes/erc-721-supply";
|
||||
import { Erc721WithQuantitySignatureMintable } from "../core/classes/erc-721-with-quantity-signature-mintable";
|
||||
import { GasCostEstimator } from "../core/classes/gas-cost-estimator";
|
||||
import type {
|
||||
NetworkOrSignerOrProvider,
|
||||
@@ -26,7 +26,7 @@ import { TokenErc721ContractSchema } from "../schema/contracts/token-erc721";
|
||||
import { SDKOptions } from "../schema/sdk-options";
|
||||
import { QueryAllParams } from "../types";
|
||||
import { TokenERC721 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/TokenERC721.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/TokenERC721.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants } from "ethers";
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import { ClaimVerification } from "../types";
|
||||
import { DEFAULT_QUERY_ALL_COUNT, QueryAllParams } from "../types/QueryParams";
|
||||
import { UploadProgressEvent } from "../types/events";
|
||||
import { DropERC721 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/DropERC721.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/DropERC721.json";
|
||||
import {
|
||||
TokensClaimedEvent,
|
||||
TokensLazyMintedEvent,
|
||||
@@ -442,7 +442,7 @@ export class NFTDrop extends Erc721<DropERC721> {
|
||||
);
|
||||
const startingIndex = event[0].args.startTokenId;
|
||||
const endingIndex = event[0].args.endTokenId;
|
||||
const results = [];
|
||||
const results: TransactionResultWithId<NFTMetadata>[] = [];
|
||||
for (let id = startingIndex; id.lte(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
@@ -523,7 +523,7 @@ export class NFTDrop extends Erc721<DropERC721> {
|
||||
);
|
||||
const startingIndex: BigNumber = event[0].args.startTokenId;
|
||||
const endingIndex = startingIndex.add(quantity);
|
||||
const results = [];
|
||||
const results: TransactionResultWithId<NFTMetadataOwner>[] = [];
|
||||
for (let id = startingIndex; id.lt(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from "../schema/tokens/pack";
|
||||
import { QueryAllParams } from "../types";
|
||||
import { Pack as PackContract } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/Pack.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/Pack.json";
|
||||
import {
|
||||
ITokenBundle,
|
||||
PackCreatedEvent,
|
||||
@@ -207,9 +207,9 @@ export class Pack extends Erc1155<PackContract> {
|
||||
const { contents, perUnitAmounts } =
|
||||
await this.contractWrapper.readContract.getPackContents(packId);
|
||||
|
||||
const erc20Rewards = [];
|
||||
const erc721Rewards = [];
|
||||
const erc1155Rewards = [];
|
||||
const erc20Rewards: PackRewardsOutput["erc20Rewards"] = [];
|
||||
const erc721Rewards: PackRewardsOutput["erc721Rewards"] = [];
|
||||
const erc1155Rewards: PackRewardsOutput["erc1155Rewards"] = [];
|
||||
|
||||
for (let i = 0; i < contents.length; i++) {
|
||||
const reward = contents[i];
|
||||
@@ -435,9 +435,9 @@ export class Pack extends Erc1155<PackContract> {
|
||||
}
|
||||
const rewards = event[0].args.rewardUnitsDistributed;
|
||||
|
||||
const erc20Rewards = [];
|
||||
const erc721Rewards = [];
|
||||
const erc1155Rewards = [];
|
||||
const erc20Rewards: PackRewards["erc20Rewards"] = [];
|
||||
const erc721Rewards: PackRewards["erc721Rewards"] = [];
|
||||
const erc1155Rewards: PackRewards["erc1155Rewards"] = [];
|
||||
|
||||
for (const reward of rewards) {
|
||||
switch (reward.tokenType) {
|
||||
@@ -485,7 +485,7 @@ export class Pack extends Erc1155<PackContract> {
|
||||
|
||||
private async toPackContentArgs(metadataWithRewards: PackMetadataOutput) {
|
||||
const contents: ITokenBundle.TokenStruct[] = [];
|
||||
const numOfRewardUnits = [];
|
||||
const numOfRewardUnits: string[] = [];
|
||||
const { erc20Rewards, erc721Rewards, erc1155Rewards } = metadataWithRewards;
|
||||
|
||||
const provider = this.contractWrapper.getProvider();
|
||||
@@ -544,7 +544,7 @@ export class Pack extends Erc1155<PackContract> {
|
||||
);
|
||||
}
|
||||
|
||||
numOfRewardUnits.push(1);
|
||||
numOfRewardUnits.push("1");
|
||||
contents.push({
|
||||
assetContract: erc721.contractAddress,
|
||||
tokenType: 1,
|
||||
|
||||
@@ -10,18 +10,16 @@ import { ContractRoles } from "../core/classes/contract-roles";
|
||||
import { ContractRoyalty } from "../core/classes/contract-royalty";
|
||||
import { ContractPrimarySale } from "../core/classes/contract-sales";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { DelayedReveal } from "../core/classes/delayed-reveal";
|
||||
import { DropClaimConditions } from "../core/classes/drop-claim-conditions";
|
||||
import { Erc721 } from "../core/classes/erc-721";
|
||||
import { Erc721Burnable } from "../core/classes/erc-721-burnable";
|
||||
import { Erc721Claimable } from "../core/classes/erc-721-claimable";
|
||||
import { Erc721Droppable } from "../core/classes/erc-721-droppable";
|
||||
import { Erc721Enumerable } from "../core/classes/erc-721-enumerable";
|
||||
import { Erc721Supply } from "../core/classes/erc-721-supply";
|
||||
import { Erc721WithQuantitySignatureMintable } from "../core/classes/erc-721-with-quantity-signature-mintable";
|
||||
import { GasCostEstimator } from "../core/classes/gas-cost-estimator";
|
||||
import {
|
||||
DelayedReveal,
|
||||
DropClaimConditions,
|
||||
Erc721Claimable,
|
||||
Erc721Droppable,
|
||||
} from "../core/index";
|
||||
import {
|
||||
NetworkOrSignerOrProvider,
|
||||
TransactionResult,
|
||||
@@ -37,7 +35,7 @@ import {
|
||||
import { UploadProgressEvent } from "../types";
|
||||
import { DEFAULT_QUERY_ALL_COUNT, QueryAllParams } from "../types/QueryParams";
|
||||
import { SignatureDrop as SignatureDropContract } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/SignatureDrop.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/SignatureDrop.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants } from "ethers";
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ import { SDKOptions } from "../schema/sdk-options";
|
||||
import { SplitRecipient } from "../types/SplitRecipient";
|
||||
import { CurrencyValue } from "../types/currency";
|
||||
import { IERC20, Split as SplitContract } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/Split.json";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/Split.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, Contract } from "ethers";
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ import { DropErc20ContractSchema } from "../schema/contracts/drop-erc20";
|
||||
import { SDKOptions } from "../schema/sdk-options";
|
||||
import { Amount, CurrencyValue } from "../types";
|
||||
import { DropERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/DropERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/DropERC20.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { constants } from "ethers";
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import { SDKOptions } from "../schema/sdk-options";
|
||||
import { TokenMintInput } from "../schema/tokens/token";
|
||||
import { Amount, CurrencyValue } from "../types";
|
||||
import { TokenERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/TokenERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/TokenERC20.json";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { constants } from "ethers";
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ import {
|
||||
VoteSettings,
|
||||
} from "../types/vote";
|
||||
import { IERC20, VoteERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/abis/VoteERC20.json";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import ABI from "@thirdweb-dev/contracts-js/dist/abis/VoteERC20.json";
|
||||
import { ProposalCreatedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/VoteERC20";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, Contract, ethers } from "ethers";
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
ContractPublisher as OnChainContractPublisher,
|
||||
IContractPublisher,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ContractPublisherAbi from "@thirdweb-dev/contracts-js/abis/ContractPublisher.json";
|
||||
import ContractPublisherAbi from "@thirdweb-dev/contracts-js/dist/abis/ContractPublisher.json";
|
||||
import { ContractPublishedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/ContractPublisher";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { constants, utils } from "ethers";
|
||||
@@ -245,15 +245,15 @@ export class ContractPublisher extends RPCConnectionHandler {
|
||||
publisherAddress,
|
||||
);
|
||||
// since we can fetch from multiple publisher contracts, just keep the latest one in the list
|
||||
const map = data.reduce<
|
||||
Record<string, IContractPublisher.CustomContractInstanceStruct>
|
||||
>((acc, curr) => {
|
||||
const map = data.reduce((acc, curr) => {
|
||||
// replaces the previous contract with the latest one
|
||||
acc[curr.contractId] = curr;
|
||||
return acc;
|
||||
}, {});
|
||||
}, {} as Record<string, IContractPublisher.CustomContractInstanceStruct>);
|
||||
return Object.entries(map).map(([_, struct]) =>
|
||||
this.toPublishedContract(struct),
|
||||
this.toPublishedContract(
|
||||
struct as IContractPublisher.CustomContractInstanceStruct,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { convertToTWError } from "../../common";
|
||||
import {
|
||||
BiconomyForwarderAbi,
|
||||
ChainAwareForwardRequest,
|
||||
ForwardRequest,
|
||||
getAndIncrementNonce,
|
||||
} from "../../common/forwarder";
|
||||
@@ -8,7 +9,7 @@ import { getPolygonGasPriorityFee } from "../../common/gas-price";
|
||||
import { signEIP2612Permit } from "../../common/permit";
|
||||
import { signTypedDataInternal } from "../../common/sign";
|
||||
import { isBrowser } from "../../common/utils";
|
||||
import { ChainId } from "../../constants";
|
||||
import { CONTRACT_ADDRESSES, ChainId } from "../../constants";
|
||||
import { getContractAddressByChainId } from "../../constants/addresses";
|
||||
import { EventType } from "../../constants/events";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
@@ -264,17 +265,6 @@ export class ContractWrapper<
|
||||
args: any[],
|
||||
callOverrides?: CallOverrides,
|
||||
): Promise<providers.TransactionReceipt> {
|
||||
// one time verification that this is a valid contract (to avoid sending funds to wrong addresses)
|
||||
if (!this.isValidContract) {
|
||||
const code = await this.getProvider().getCode(this.readContract.address);
|
||||
this.isValidContract = code !== "0x";
|
||||
if (!this.isValidContract) {
|
||||
throw new Error(
|
||||
"The address you're trying to send a transaction to is not a smart contract. Make sure you are on the correct network and the contract address is correct",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!callOverrides) {
|
||||
callOverrides = await this.getCallOverrides();
|
||||
}
|
||||
@@ -297,6 +287,18 @@ export class ContractWrapper<
|
||||
this.emitTransactionEvent("completed", txHash);
|
||||
return receipt;
|
||||
} else {
|
||||
// one time verification that this is a valid contract (to avoid sending funds to wrong addresses)
|
||||
if (!this.isValidContract) {
|
||||
const code = await this.getProvider().getCode(
|
||||
this.readContract.address,
|
||||
);
|
||||
this.isValidContract = code !== "0x";
|
||||
if (!this.isValidContract) {
|
||||
throw new Error(
|
||||
"The address you're trying to send a transaction to is not a smart contract. Make sure you are on the correct network and the contract address is correct",
|
||||
);
|
||||
}
|
||||
}
|
||||
const tx = await this.sendTransactionByFunction(
|
||||
fn as keyof TContract["functions"],
|
||||
args,
|
||||
@@ -375,9 +377,8 @@ export class ContractWrapper<
|
||||
let gas = gasEstimate.mul(2);
|
||||
|
||||
// in some cases WalletConnect doesn't properly gives an estimate for how much gas it would actually use.
|
||||
// it'd estimate ~21740 on polygon.
|
||||
// as a fix, we're setting it to a high arbitrary number (500k) as the gas limit that should cover for most function calls.
|
||||
if (gasEstimate.lt(25000)) {
|
||||
if (gasEstimate.lt(50000)) {
|
||||
gas = BigNumber.from(500000);
|
||||
}
|
||||
|
||||
@@ -561,37 +562,60 @@ export class ContractWrapper<
|
||||
): Promise<string> {
|
||||
invariant(
|
||||
this.options.gasless && "openzeppelin" in this.options.gasless,
|
||||
"calling biconomySendFunction without biconomy",
|
||||
"calling openzeppelin gasless transaction without openzeppelin config in the SDK options",
|
||||
);
|
||||
const signer = this.getSigner();
|
||||
const provider = this.getProvider();
|
||||
invariant(signer, "provider is not set");
|
||||
invariant(provider, "provider is not set");
|
||||
const forwarderAddress =
|
||||
this.options.gasless.openzeppelin.relayerForwarderAddress;
|
||||
this.options.gasless.openzeppelin.relayerForwarderAddress ||
|
||||
CONTRACT_ADDRESSES[transaction.chainId as keyof typeof CONTRACT_ADDRESSES]
|
||||
.openzeppelinForwarder;
|
||||
const forwarder = Forwarder__factory.connect(forwarderAddress, provider);
|
||||
const nonce = await getAndIncrementNonce(forwarder, "getNonce", [
|
||||
transaction.from,
|
||||
]);
|
||||
const domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
chainId: transaction.chainId,
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
|
||||
const types = {
|
||||
ForwardRequest,
|
||||
};
|
||||
|
||||
let message: ForwardRequestMessage | PermitRequestMessage = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
};
|
||||
let domain;
|
||||
let types;
|
||||
let message: ForwardRequestMessage | PermitRequestMessage;
|
||||
if (this.options.gasless.experimentalChainlessSupport) {
|
||||
domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
types = {
|
||||
ForwardRequest: ChainAwareForwardRequest,
|
||||
};
|
||||
message = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
chainid: BigNumber.from(transaction.chainId).toString(),
|
||||
};
|
||||
} else {
|
||||
domain = {
|
||||
name: "GSNv2 Forwarder",
|
||||
version: "0.0.1",
|
||||
chainId: transaction.chainId,
|
||||
verifyingContract: forwarderAddress,
|
||||
};
|
||||
types = {
|
||||
ForwardRequest,
|
||||
};
|
||||
message = {
|
||||
from: transaction.from,
|
||||
to: transaction.to,
|
||||
value: BigNumber.from(0).toString(),
|
||||
gas: BigNumber.from(transaction.gasLimit).toString(),
|
||||
nonce: BigNumber.from(nonce).toString(),
|
||||
data: transaction.data,
|
||||
};
|
||||
}
|
||||
|
||||
let signature: BytesLike;
|
||||
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
import { BigNumber, BigNumberish, ethers } from "ethers";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { DropERC721, IThirdwebContract, SignatureDrop } from "@thirdweb-dev/contracts-js";
|
||||
import { hasFunction } from "../../common";
|
||||
import { fetchTokenMetadataForContract } from "../../common/nft";
|
||||
import { FeatureName } from "../../constants/contract-features";
|
||||
import {
|
||||
CommonNFTInput,
|
||||
NFTMetadata,
|
||||
NFTMetadataInput,
|
||||
} from "../../schema/tokens/common";
|
||||
import { TransactionResult, TransactionResultWithId } from "../index";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { fetchTokenMetadataForContract } from "../../common/nft";
|
||||
import { BatchToReveal } from "../../types/delayed-reveal";
|
||||
import { UploadProgressEvent } from "../../types/events";
|
||||
import {
|
||||
BaseDelayedRevealERC1155,
|
||||
BaseDelayedRevealERC721,
|
||||
} from "../../types/eips";
|
||||
import { hasFunction } from "../../common";
|
||||
import DeprecatedAbi from "@thirdweb-dev/contracts-js/abis/IDelayedRevealDeprecated.json";
|
||||
import { FeatureName } from "../../constants/contract-features";
|
||||
import { UploadProgressEvent } from "../../types/events";
|
||||
import { TransactionResult, TransactionResultWithId } from "../index";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import {
|
||||
DropERC721,
|
||||
IThirdwebContract,
|
||||
SignatureDrop,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import DeprecatedAbi from "@thirdweb-dev/contracts-js/dist/abis/IDelayedRevealDeprecated.json";
|
||||
import { TokensLazyMintedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/DropERC721";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, ethers } from "ethers";
|
||||
|
||||
/**
|
||||
* Handles delayed reveal logic
|
||||
@@ -75,9 +79,6 @@ export class DelayedReveal<
|
||||
* realNFTs,
|
||||
* "my secret password",
|
||||
* );
|
||||
* // Whenever you're ready, reveal your NFTs at any time!
|
||||
* const batchId = 0; // the batch to reveal
|
||||
* await contract.revealer.reveal(batchId, "my secret password");
|
||||
* ```
|
||||
* @public
|
||||
* @param placeholder - the placeholder NFT to show before the reveal
|
||||
@@ -156,7 +157,7 @@ export class DelayedReveal<
|
||||
);
|
||||
const startingIndex = events[0].args.startTokenId;
|
||||
const endingIndex = events[0].args.endTokenId;
|
||||
const results = [];
|
||||
const results: TransactionResultWithId[] = [];
|
||||
for (let id = startingIndex; id.lte(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
|
||||
@@ -1,5 +1,30 @@
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { includesErrorMessage } from "../../common";
|
||||
import {
|
||||
getClaimerProofs,
|
||||
prepareClaim,
|
||||
processClaimConditionInputs,
|
||||
transformResultToClaimCondition,
|
||||
updateExistingClaimConditions,
|
||||
} from "../../common/claim-conditions";
|
||||
import { isNativeToken } from "../../common/currency";
|
||||
import {
|
||||
detectContractFeature,
|
||||
hasFunction,
|
||||
} from "../../common/feature-detection";
|
||||
import { isNode } from "../../common/utils";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../constants/index";
|
||||
import { ClaimEligibility } from "../../enums";
|
||||
import { AmountSchema } from "../../schema";
|
||||
import {
|
||||
Amount,
|
||||
ClaimCondition,
|
||||
ClaimConditionInput,
|
||||
ClaimVerification,
|
||||
} from "../../types";
|
||||
import { BaseClaimConditionERC721, BaseDropERC20 } from "../../types/eips";
|
||||
import { TransactionResult } from "../types";
|
||||
import { ContractMetadata } from "./contract-metadata";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import {
|
||||
ContractMetadata as ContractMetadataContract,
|
||||
DropERC20,
|
||||
@@ -9,36 +34,11 @@ import {
|
||||
IERC20Metadata,
|
||||
SignatureDrop,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { BigNumber, BigNumberish, constants, ethers, utils } from "ethers";
|
||||
import { isNativeToken } from "../../common/currency";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import {
|
||||
Amount,
|
||||
ClaimCondition,
|
||||
ClaimConditionInput,
|
||||
ClaimVerification,
|
||||
} from "../../types";
|
||||
import { ClaimEligibility } from "../../enums";
|
||||
import { TransactionResult } from "../types";
|
||||
import {
|
||||
getClaimerProofs,
|
||||
prepareClaim,
|
||||
processClaimConditionInputs,
|
||||
transformResultToClaimCondition,
|
||||
updateExistingClaimConditions,
|
||||
} from "../../common/claim-conditions";
|
||||
import {
|
||||
detectContractFeature,
|
||||
hasFunction,
|
||||
} from "../../common/feature-detection";
|
||||
import { AmountSchema } from "../../schema";
|
||||
import { includesErrorMessage } from "../../common";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import { isNode } from "../../common/utils";
|
||||
import deepEqual from "fast-deep-equal";
|
||||
import { BaseClaimConditionERC721, BaseDropERC20 } from "../../types/eips";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../constants/index";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { IDropClaimCondition } from "@thirdweb-dev/contracts-js/dist/declarations/src/DropERC20";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish, constants, ethers, utils } from "ethers";
|
||||
import deepEqual from "fast-deep-equal";
|
||||
|
||||
/**
|
||||
* Manages claim conditions for NFT Drop contracts
|
||||
@@ -113,7 +113,7 @@ export class DropClaimConditions<
|
||||
};
|
||||
const startId = claimCondition.currentStartId.toNumber();
|
||||
const count = claimCondition.count.toNumber();
|
||||
const conditions = [];
|
||||
const conditions: IDropClaimCondition.ClaimConditionStructOutput[] = [];
|
||||
for (let i = startId; i < startId + count; i++) {
|
||||
conditions.push(
|
||||
await this.contractWrapper.readContract.getClaimConditionById(i),
|
||||
@@ -411,7 +411,7 @@ export class DropClaimConditions<
|
||||
merkleInfo[s.merkleRoot] = s.snapshotUri;
|
||||
});
|
||||
const metadata = await this.metadata.get();
|
||||
const encoded = [];
|
||||
const encoded: string[] = [];
|
||||
|
||||
// upload new merkle roots to snapshot URIs if updated
|
||||
if (!deepEqual(metadata.merkle, merkleInfo)) {
|
||||
|
||||
@@ -110,7 +110,7 @@ export class DropErc1155ClaimConditions<
|
||||
};
|
||||
const startId = claimCondition.currentStartId.toNumber();
|
||||
const count = claimCondition.count.toNumber();
|
||||
const conditions = [];
|
||||
const conditions: IDropClaimCondition.ClaimConditionStructOutput[] = [];
|
||||
for (let i = startId; i < startId + count; i++) {
|
||||
conditions.push(
|
||||
await this.contractWrapper.readContract.getClaimConditionById(
|
||||
@@ -471,7 +471,7 @@ export class DropErc1155ClaimConditions<
|
||||
);
|
||||
|
||||
const metadata = await this.metadata.get();
|
||||
const encoded = [];
|
||||
const encoded: string[] = [];
|
||||
|
||||
// keep the old merkle roots from other tokenIds
|
||||
for (const key of Object.keys(metadata.merkle || {})) {
|
||||
|
||||
@@ -11,6 +11,15 @@ import { BigNumberish, ethers } from "ethers";
|
||||
import { TransactionResult } from "../types";
|
||||
import { TransactionTask } from "./TransactionTask";
|
||||
|
||||
/**
|
||||
* Configure and claim ERC1155 NFTs
|
||||
* @remarks Manage claim phases and claim ERC1155 NFTs that have been lazily minted.
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = await sdk.getContract("{{contract_address}}");
|
||||
* await contract.edition.drop.claim.to("0x...", tokenId, quantity);
|
||||
* ```
|
||||
*/
|
||||
export class Erc1155Claimable implements DetectableFeature {
|
||||
featureName = FEATURE_NFT_CLAIMABLE.name;
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ export class Erc1155Droppable implements DetectableFeature {
|
||||
);
|
||||
const startingIndex = event[0].args.startTokenId;
|
||||
const endingIndex = event[0].args.endTokenId;
|
||||
const results = [];
|
||||
const results: TransactionResultWithId<NFTMetadata>[] = [];
|
||||
for (let id = startingIndex; id.lte(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
|
||||
@@ -107,6 +107,16 @@ export class Erc1155Mintable implements DetectableFeature {
|
||||
* @param to - the address to mint to
|
||||
* @param tokenId - the token id of the NFT to increase supply of
|
||||
* @param additionalSupply - the additional amount to mint
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Address of the wallet you want to mint the NFT to
|
||||
* const toAddress = "{{wallet_address}}"
|
||||
* const tokenId = 0;
|
||||
* const additionalSupply = 1000;
|
||||
*
|
||||
* const tx = await contract.edition.mint.additionalSupplyTo(toAddress, tokenId, additionalSupply);
|
||||
* ```
|
||||
*/
|
||||
public async additionalSupplyTo(
|
||||
to: string,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { IMintableERC20, IMulticall } from "@thirdweb-dev/contracts-js";
|
||||
import { Erc20 } from "./erc-20";
|
||||
import { TokenMintInput } from "../../schema";
|
||||
import { TransactionResult } from "../types";
|
||||
import { FEATURE_TOKEN_BATCH_MINTABLE } from "../../constants/erc20-features";
|
||||
import { TokenMintInput } from "../../schema";
|
||||
import { DetectableFeature } from "../interfaces/DetectableFeature";
|
||||
import { TransactionResult } from "../types";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import { Erc20 } from "./erc-20";
|
||||
import { IMintableERC20, IMulticall } from "@thirdweb-dev/contracts-js";
|
||||
|
||||
/**
|
||||
* Mint Many ERC20 Tokens at once
|
||||
@@ -52,7 +52,7 @@ export class Erc20BatchMintable implements DetectableFeature {
|
||||
* ```
|
||||
*/
|
||||
public async to(args: TokenMintInput[]): Promise<TransactionResult> {
|
||||
const encoded = [];
|
||||
const encoded: string[] = [];
|
||||
for (const arg of args) {
|
||||
encoded.push(
|
||||
this.contractWrapper.readContract.interface.encodeFunctionData(
|
||||
|
||||
@@ -159,7 +159,7 @@ export class Erc721Claimable implements DetectableFeature {
|
||||
);
|
||||
const startingIndex: BigNumber = event[0].args.startTokenId;
|
||||
const endingIndex = startingIndex.add(quantity);
|
||||
const results = [];
|
||||
const results: TransactionResultWithId<NFTMetadataOwner>[] = [];
|
||||
for (let id = startingIndex; id.lt(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
|
||||
@@ -156,7 +156,7 @@ export class Erc721Droppable implements DetectableFeature {
|
||||
);
|
||||
const startingIndex = event[0].args.startTokenId;
|
||||
const endingIndex = event[0].args.endTokenId;
|
||||
const results = [];
|
||||
const results: TransactionResultWithId<NFTMetadata>[] = [];
|
||||
for (let id = startingIndex; id.lte(endingIndex); id = id.add(1)) {
|
||||
results.push({
|
||||
id,
|
||||
|
||||
@@ -257,8 +257,11 @@ export class ContractFactory extends ContractWrapper<TWFactory> {
|
||||
const biconomyForwarder = chainEnum
|
||||
? CONTRACT_ADDRESSES[chainEnum].biconomyForwarder
|
||||
: constants.AddressZero;
|
||||
const openzeppelinForwarder = chainEnum
|
||||
? CONTRACT_ADDRESSES[chainEnum].openzeppelinForwarder
|
||||
: constants.AddressZero;
|
||||
return biconomyForwarder !== constants.AddressZero
|
||||
? [OZ_DEFENDER_FORWARDER_ADDRESS, biconomyForwarder]
|
||||
: [OZ_DEFENDER_FORWARDER_ADDRESS];
|
||||
? [openzeppelinForwarder, biconomyForwarder]
|
||||
: [openzeppelinForwarder];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,29 @@
|
||||
import { ListingNotFoundError, WrongListingTypeError } from "../../common";
|
||||
import {
|
||||
fetchCurrencyValue,
|
||||
isNativeToken,
|
||||
normalizePriceValue,
|
||||
setErc20Allowance,
|
||||
} from "../../common/currency";
|
||||
import {
|
||||
handleTokenApproval,
|
||||
isTokenApprovedForTransfer,
|
||||
mapOffer,
|
||||
validateNewListingParam,
|
||||
} from "../../common/marketplace";
|
||||
import { fetchTokenMetadataForContract } from "../../common/nft";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../../constants/contract";
|
||||
import { ListingType } from "../../enums";
|
||||
import { Price } from "../../types/currency";
|
||||
import {
|
||||
DirectListing,
|
||||
NewDirectListing,
|
||||
Offer,
|
||||
} from "../../types/marketplace";
|
||||
import { TransactionResult, TransactionResultWithId } from "../types";
|
||||
import { ContractWrapper } from "./contract-wrapper";
|
||||
import {
|
||||
IERC1155,
|
||||
@@ -6,6 +32,11 @@ import {
|
||||
IMarketplace,
|
||||
Marketplace,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import { ListingAddedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/Marketplace";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
BigNumber,
|
||||
BigNumberish,
|
||||
@@ -14,38 +45,7 @@ import {
|
||||
constants,
|
||||
utils,
|
||||
} from "ethers";
|
||||
import {
|
||||
DirectListing,
|
||||
NewDirectListing,
|
||||
Offer,
|
||||
} from "../../types/marketplace";
|
||||
import { ListingNotFoundError, WrongListingTypeError } from "../../common";
|
||||
import { ListingType } from "../../enums";
|
||||
import { TransactionResult, TransactionResultWithId } from "../types";
|
||||
import {
|
||||
fetchCurrencyValue,
|
||||
isNativeToken,
|
||||
normalizePriceValue,
|
||||
setErc20Allowance,
|
||||
} from "../../common/currency";
|
||||
import { Price } from "../../types/currency";
|
||||
import { fetchTokenMetadataForContract } from "../../common/nft";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../../constants/contract";
|
||||
import {
|
||||
handleTokenApproval,
|
||||
isTokenApprovedForTransfer,
|
||||
mapOffer,
|
||||
validateNewListingParam,
|
||||
} from "../../common/marketplace";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import invariant from "tiny-invariant";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/abis/IERC1155.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/abis/IERC721.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/abis/IERC165.json";
|
||||
import { ListingAddedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/Marketplace";
|
||||
|
||||
/**
|
||||
* Handles direct listings
|
||||
|
||||
@@ -183,7 +183,6 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* Get an instance of a SignatureDrop contract
|
||||
* @param contractAddress - the address of the deployed contract
|
||||
* @returns the contract
|
||||
* @internal
|
||||
*/
|
||||
public getSignatureDrop(contractAddress: string): SignatureDrop {
|
||||
return this.getBuiltInContract(
|
||||
@@ -361,6 +360,10 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
/**
|
||||
* Return all the contracts deployed by the specified address
|
||||
* @param walletAddress - the deployed address
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contracts = sdk.getContractList("{{wallet_address}}");
|
||||
* ```
|
||||
*/
|
||||
public async getContractList(walletAddress: string) {
|
||||
const addresses = await (
|
||||
@@ -431,6 +434,10 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* @param address - the address of the deployed contract
|
||||
* @returns the contract
|
||||
* @beta
|
||||
* @example
|
||||
* ```javascript
|
||||
* const contract = sdk.getContract("{{contract_address}}");
|
||||
* ```
|
||||
*/
|
||||
public async getContract(address: string) {
|
||||
if (this.contractCache.has(address)) {
|
||||
@@ -460,6 +467,17 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
* @param abi - the JSON abi
|
||||
* @returns the contract
|
||||
* @beta
|
||||
* @example
|
||||
* ```javascript
|
||||
* // Import your ABI from a JSON file
|
||||
* import myABI from "./path/to/myABI.json";
|
||||
*
|
||||
* const contract = sdk.getContractFromAbi(
|
||||
* "{{contract_address}}",
|
||||
* // Pass in the "abi" field from the JSON file
|
||||
* myABI.abi
|
||||
* );
|
||||
* ```
|
||||
*/
|
||||
public getContractFromAbi(address: string, abi: ContractInterface) {
|
||||
if (this.contractCache.has(address)) {
|
||||
|
||||
@@ -81,6 +81,7 @@ export type ForwardRequestMessage = {
|
||||
gas: string;
|
||||
nonce: string;
|
||||
data: BytesLike;
|
||||
chainid?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { RPCConnectionHandler } from "../classes/rpc-connection-handler";
|
||||
import { NetworkOrSignerOrProvider, TransactionResult } from "../types";
|
||||
import { SDKOptions } from "../../schema";
|
||||
import invariant from "tiny-invariant";
|
||||
import { Amount, CurrencyValue } from "../../types";
|
||||
import {
|
||||
fetchCurrencyValue,
|
||||
isNativeToken,
|
||||
normalizePriceValue,
|
||||
} from "../../common/currency";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../constants";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/abis/IERC20.json";
|
||||
import { SDKOptions } from "../../schema";
|
||||
import { Amount, CurrencyValue } from "../../types";
|
||||
import { ContractWrapper } from "../classes/contract-wrapper";
|
||||
import { RPCConnectionHandler } from "../classes/rpc-connection-handler";
|
||||
import { NetworkOrSignerOrProvider, TransactionResult } from "../types";
|
||||
import { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ethers, BigNumber, providers } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/**
|
||||
* Connect and Interact with a user wallet
|
||||
|
||||
@@ -115,7 +115,7 @@ export const ChainIdToAddressSchema = z.record(z.string(), z.string());
|
||||
*/
|
||||
export const FactoryDeploymentSchema = z.object({
|
||||
implementationAddresses: ChainIdToAddressSchema,
|
||||
implementationInitializerFunction: z.string(),
|
||||
implementationInitializerFunction: z.string().default("initialize"),
|
||||
factoryAddresses: ChainIdToAddressSchema,
|
||||
});
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ export const SDKOptionsSchema = z
|
||||
relayerUrl: z.string().url(),
|
||||
relayerForwarderAddress: z
|
||||
.string()
|
||||
.default(OZ_DEFENDER_FORWARDER_ADDRESS),
|
||||
.optional(),
|
||||
}),
|
||||
experimentalChainlessSupport: z.boolean().default(false),
|
||||
}),
|
||||
z.object({
|
||||
biconomy: z.object({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { signers } from "./before-setup";
|
||||
import { expect } from "chai";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { ThirdwebSDK } from "../src";
|
||||
import { signers } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Wallet Authentication", async () => {
|
||||
let adminWallet: SignerWithAddress,
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
import {
|
||||
CONTRACTS_MAP,
|
||||
ContractType,
|
||||
DEFAULT_IPFS_GATEWAY,
|
||||
Edition,
|
||||
EditionDrop,
|
||||
getNativeTokenByChainId,
|
||||
Marketplace,
|
||||
Multiwrap,
|
||||
NFTCollection,
|
||||
NFTDrop,
|
||||
Pack,
|
||||
SignatureDrop,
|
||||
Split,
|
||||
ThirdwebSDK,
|
||||
Token,
|
||||
TokenDrop,
|
||||
Vote,
|
||||
} from "../src";
|
||||
import { ChainId } from "../src/constants/chains";
|
||||
import { MockStorage } from "./mock/MockStorage";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
ContractPublisher,
|
||||
ContractPublisher__factory,
|
||||
DropERC1155__factory,
|
||||
DropERC20__factory,
|
||||
DropERC721__factory,
|
||||
Marketplace__factory,
|
||||
MockContractPublisher,
|
||||
MockContractPublisher__factory,
|
||||
Multiwrap__factory,
|
||||
Pack__factory,
|
||||
SignatureDrop__factory,
|
||||
Split__factory,
|
||||
TokenERC1155__factory,
|
||||
TokenERC20__factory,
|
||||
TokenERC721__factory,
|
||||
TWFactory,
|
||||
TWFactory__factory,
|
||||
TWFee__factory,
|
||||
TWRegistry,
|
||||
TWRegistry__factory,
|
||||
VoteERC20__factory,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
//@ts-expext-error TS2551: Cannot find name 'ethers'.
|
||||
import { ethers as hardhatEthers } from "hardhat";
|
||||
|
||||
const RPC_URL = "http://localhost:8545";
|
||||
|
||||
const jsonProvider = new ethers.providers.JsonRpcProvider(RPC_URL);
|
||||
const defaultProvider = hardhatEthers.provider;
|
||||
|
||||
let registryAddress: string;
|
||||
let sdk: ThirdwebSDK;
|
||||
const ipfsGatewayUrl = DEFAULT_IPFS_GATEWAY;
|
||||
let signer: SignerWithAddress;
|
||||
let signers: SignerWithAddress[];
|
||||
let storage: IStorage;
|
||||
let implementations: { [key in ContractType]?: string };
|
||||
|
||||
const fastForwardTime = async (timeInSeconds: number): Promise<void> => {
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
await defaultProvider.send("evm_mine", [now + timeInSeconds]);
|
||||
};
|
||||
|
||||
export const expectError = (e: unknown, message: string) => {
|
||||
if (e instanceof Error) {
|
||||
if (!e.message.includes(message)) {
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
before(async () => {
|
||||
signers = await hardhatEthers.getSigners();
|
||||
implementations = {};
|
||||
|
||||
[signer] = signers;
|
||||
|
||||
const trustedForwarderAddress = "0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81";
|
||||
await jsonProvider.send("hardhat_reset", []);
|
||||
|
||||
const registry = (await new ethers.ContractFactory(
|
||||
TWRegistry__factory.abi,
|
||||
TWRegistry__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress)) as TWRegistry;
|
||||
const registryContract = await registry.deployed();
|
||||
|
||||
const thirdwebFactoryDeployer = (await new ethers.ContractFactory(
|
||||
TWFactory__factory.abi,
|
||||
TWFactory__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress, registry.address)) as TWFactory;
|
||||
|
||||
const deployTxFactory = thirdwebFactoryDeployer.deployTransaction;
|
||||
await deployTxFactory.wait();
|
||||
const thirdwebRegistryAddress = await thirdwebFactoryDeployer.registry();
|
||||
registryAddress = thirdwebFactoryDeployer.address;
|
||||
|
||||
await registryContract.grantRole(
|
||||
await registryContract.OPERATOR_ROLE(),
|
||||
thirdwebFactoryDeployer.address,
|
||||
);
|
||||
|
||||
const thirdwebFeeDeployer = await new ethers.ContractFactory(
|
||||
TWFee__factory.abi,
|
||||
TWFee__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress, thirdwebFactoryDeployer.address);
|
||||
await thirdwebFactoryDeployer.deployed();
|
||||
|
||||
// Mock publisher for tests
|
||||
const mockPublisher = (await new ethers.ContractFactory(
|
||||
MockContractPublisher__factory.abi,
|
||||
MockContractPublisher__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy()) as MockContractPublisher;
|
||||
const contractPublisher = (await new ethers.ContractFactory(
|
||||
ContractPublisher__factory.abi,
|
||||
ContractPublisher__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(
|
||||
trustedForwarderAddress,
|
||||
mockPublisher.address,
|
||||
)) as ContractPublisher; // TODO needs MockPublisher here
|
||||
await contractPublisher.deployed();
|
||||
|
||||
async function deployContract(
|
||||
contractFactory: ethers.ContractFactory,
|
||||
contractType: ContractType,
|
||||
): Promise<ethers.Contract> {
|
||||
switch (contractType) {
|
||||
case Marketplace.contractType:
|
||||
case Multiwrap.contractType:
|
||||
const nativeTokenWrapperAddress = getNativeTokenByChainId(
|
||||
ChainId.Hardhat,
|
||||
).wrapped.address;
|
||||
return await contractFactory.deploy(nativeTokenWrapperAddress);
|
||||
case Pack.contractType:
|
||||
const addr = getNativeTokenByChainId(ChainId.Hardhat).wrapped.address;
|
||||
return await contractFactory.deploy(addr, trustedForwarderAddress);
|
||||
default:
|
||||
return await contractFactory.deploy();
|
||||
}
|
||||
}
|
||||
|
||||
for (const contractType in CONTRACTS_MAP) {
|
||||
if (contractType === "custom") {
|
||||
continue;
|
||||
}
|
||||
let factory;
|
||||
switch (contractType) {
|
||||
case Token.contractType:
|
||||
factory = TokenERC20__factory;
|
||||
break;
|
||||
case TokenDrop.contractType:
|
||||
factory = DropERC20__factory;
|
||||
break;
|
||||
case NFTCollection.contractType:
|
||||
factory = TokenERC721__factory;
|
||||
break;
|
||||
case NFTDrop.contractType:
|
||||
factory = DropERC721__factory;
|
||||
break;
|
||||
case SignatureDrop.contractType:
|
||||
factory = SignatureDrop__factory;
|
||||
break;
|
||||
case Edition.contractType:
|
||||
factory = TokenERC1155__factory;
|
||||
break;
|
||||
case EditionDrop.contractType:
|
||||
factory = DropERC1155__factory;
|
||||
break;
|
||||
case Split.contractType:
|
||||
factory = Split__factory;
|
||||
break;
|
||||
case Vote.contractType:
|
||||
factory = VoteERC20__factory;
|
||||
break;
|
||||
case Marketplace.contractType:
|
||||
factory = Marketplace__factory;
|
||||
break;
|
||||
case Pack.contractType:
|
||||
factory = Pack__factory;
|
||||
break;
|
||||
case Multiwrap.contractType:
|
||||
factory = Multiwrap__factory;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`No factory for contract: ${contractType}`);
|
||||
}
|
||||
|
||||
const contractFactory = new ethers.ContractFactory(
|
||||
factory.abi,
|
||||
factory.bytecode,
|
||||
).connect(signer);
|
||||
|
||||
const deployedContract: ethers.Contract = await deployContract(
|
||||
contractFactory,
|
||||
contractType as ContractType,
|
||||
);
|
||||
|
||||
await deployedContract.deployed();
|
||||
const tx = await thirdwebFactoryDeployer.addImplementation(
|
||||
deployedContract.address,
|
||||
);
|
||||
await tx.wait();
|
||||
implementations[contractType as ContractType] = deployedContract.address;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.registryAddress = thirdwebRegistryAddress;
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.factoryAddress = thirdwebFactoryDeployer.address;
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.contractPublisherAddress = contractPublisher.address;
|
||||
|
||||
storage = new MockStorage();
|
||||
sdk = new ThirdwebSDK(
|
||||
signer,
|
||||
{
|
||||
gasSettings: {
|
||||
maxPriceInGwei: 10000,
|
||||
},
|
||||
},
|
||||
storage,
|
||||
);
|
||||
});
|
||||
export {
|
||||
ipfsGatewayUrl,
|
||||
sdk,
|
||||
signers,
|
||||
jsonProvider,
|
||||
defaultProvider,
|
||||
registryAddress,
|
||||
fastForwardTime,
|
||||
storage,
|
||||
implementations,
|
||||
};
|
||||
@@ -1,21 +1,20 @@
|
||||
import { expectError, signers } from "./before-setup";
|
||||
import { assert, expect } from "chai";
|
||||
import invariant from "tiny-invariant";
|
||||
import {
|
||||
TokenERC20__factory,
|
||||
TokenERC721__factory,
|
||||
VoteERC20__factory,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
PayloadToSign20,
|
||||
SignedPayload721WithQuantitySignature,
|
||||
ThirdwebSDK,
|
||||
} from "../src";
|
||||
import { expectError, signers } from "./hooks";
|
||||
import "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
TokenERC20__factory,
|
||||
TokenERC721__factory,
|
||||
VoteERC20__factory,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { assert, expect } from "chai";
|
||||
import { ethers } from "ethers";
|
||||
|
||||
require("./before-setup");
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
|
||||
@@ -34,7 +33,7 @@ describe("Custom Contracts", async () => {
|
||||
let sdk: ThirdwebSDK;
|
||||
let simpleContractUri: string;
|
||||
|
||||
before(async () => {
|
||||
beforeAll(async () => {
|
||||
[adminWallet, samWallet, bobWallet] = signers;
|
||||
sdk = new ThirdwebSDK(adminWallet);
|
||||
simpleContractUri =
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../src/constants/currency";
|
||||
import { ClaimEligibility } from "../src/enums";
|
||||
import { EditionDrop, Token } from "../src/index";
|
||||
import { expectError, sdk, signers } from "./before-setup";
|
||||
import { expectError, sdk, signers } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect, use } from "chai";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Edition } from "../src/index";
|
||||
import { expectError, sdk, signers, storage } from "./before-setup";
|
||||
import { expectError, sdk, signers, storage } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ethers, Wallet } from "ethers";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
import { expect } from "chai";
|
||||
import { ContractEvent, NFTDrop, NFTCollection } from "../src";
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { expect } from "chai";
|
||||
import { ethers, Wallet } from "ethers";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
|
||||
@@ -35,17 +35,17 @@ describe("Events", async () => {
|
||||
);
|
||||
|
||||
dropContract2 = sdk.getNFTDrop(
|
||||
await sdk.deployer.deployBuiltInContract(NFTDrop.contractType, {
|
||||
name: `Testing drop from SDK`,
|
||||
description: "Test contract from tests",
|
||||
image:
|
||||
"https://pbs.twimg.com/profile_images/1433508973215367176/XBCfBn3g_400x400.jpg",
|
||||
primary_sale_recipient: AddressZero,
|
||||
seller_fee_basis_points: 500,
|
||||
fee_recipient: AddressZero,
|
||||
platform_fee_basis_points: 10,
|
||||
platform_fee_recipient: AddressZero,
|
||||
}),
|
||||
await sdk.deployer.deployBuiltInContract(NFTDrop.contractType, {
|
||||
name: `Testing drop from SDK`,
|
||||
description: "Test contract from tests",
|
||||
image:
|
||||
"https://pbs.twimg.com/profile_images/1433508973215367176/XBCfBn3g_400x400.jpg",
|
||||
primary_sale_recipient: AddressZero,
|
||||
seller_fee_basis_points: 500,
|
||||
fee_recipient: AddressZero,
|
||||
platform_fee_basis_points: 10,
|
||||
platform_fee_recipient: AddressZero,
|
||||
}),
|
||||
);
|
||||
|
||||
nftContract = sdk.getNFTCollection(
|
||||
@@ -79,9 +79,12 @@ describe("Events", async () => {
|
||||
|
||||
it("should emit Contract events", async () => {
|
||||
const events: ContractEvent[] = [];
|
||||
const remove = dropContract.events.addEventListener("TokensLazyMinted", (event) => {
|
||||
events.push(event);
|
||||
});
|
||||
const remove = dropContract.events.addEventListener(
|
||||
"TokensLazyMinted",
|
||||
(event) => {
|
||||
events.push(event);
|
||||
},
|
||||
);
|
||||
await dropContract.createBatch([
|
||||
{
|
||||
name: "1",
|
||||
@@ -110,7 +113,7 @@ describe("Events", async () => {
|
||||
},
|
||||
]);
|
||||
await dropContract2.claimConditions.set([{}]);
|
||||
await dropContract2.claim(1)
|
||||
await dropContract2.claim(1);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||
remove();
|
||||
expect(events.length).to.be.gt(0);
|
||||
|
||||
@@ -0,0 +1,254 @@
|
||||
import {
|
||||
CONTRACTS_MAP,
|
||||
ContractType,
|
||||
DEFAULT_IPFS_GATEWAY,
|
||||
Edition,
|
||||
EditionDrop,
|
||||
getNativeTokenByChainId,
|
||||
Marketplace,
|
||||
Multiwrap,
|
||||
NFTCollection,
|
||||
NFTDrop,
|
||||
Pack,
|
||||
SignatureDrop,
|
||||
Split,
|
||||
ThirdwebSDK,
|
||||
Token,
|
||||
TokenDrop,
|
||||
Vote,
|
||||
} from "../src";
|
||||
import { ChainId } from "../src/constants/chains";
|
||||
import { MockStorage } from "./mock/MockStorage";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
ContractPublisher,
|
||||
ContractPublisher__factory,
|
||||
DropERC1155__factory,
|
||||
DropERC20__factory,
|
||||
DropERC721__factory,
|
||||
Marketplace__factory,
|
||||
MockContractPublisher,
|
||||
MockContractPublisher__factory,
|
||||
Multiwrap__factory,
|
||||
Pack__factory,
|
||||
SignatureDrop__factory,
|
||||
Split__factory,
|
||||
TokenERC1155__factory,
|
||||
TokenERC20__factory,
|
||||
TokenERC721__factory,
|
||||
TWFactory,
|
||||
TWFactory__factory,
|
||||
TWFee__factory,
|
||||
TWRegistry,
|
||||
TWRegistry__factory,
|
||||
VoteERC20__factory,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { IStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
//@ts-expext-error TS2551: Cannot find name 'ethers'.
|
||||
import { ethers as hardhatEthers } from "hardhat";
|
||||
|
||||
const RPC_URL = "http://localhost:8545";
|
||||
|
||||
const jsonProvider = new ethers.providers.JsonRpcProvider(RPC_URL);
|
||||
const defaultProvider = hardhatEthers.provider;
|
||||
|
||||
let registryAddress: string;
|
||||
let sdk: ThirdwebSDK;
|
||||
const ipfsGatewayUrl = DEFAULT_IPFS_GATEWAY;
|
||||
let signer: SignerWithAddress;
|
||||
let signers: SignerWithAddress[];
|
||||
let storage: IStorage;
|
||||
let implementations: { [key in ContractType]?: string };
|
||||
|
||||
const fastForwardTime = async (timeInSeconds: number): Promise<void> => {
|
||||
const now = Math.floor(Date.now() / 1000);
|
||||
await defaultProvider.send("evm_mine", [now + timeInSeconds]);
|
||||
};
|
||||
|
||||
export const expectError = (e: unknown, message: string) => {
|
||||
if (e instanceof Error) {
|
||||
if (!e.message.includes(message)) {
|
||||
throw e;
|
||||
}
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
export const mochaHooks = {
|
||||
beforeAll: async () => {
|
||||
signers = await hardhatEthers.getSigners();
|
||||
implementations = {};
|
||||
|
||||
[signer] = signers;
|
||||
|
||||
const trustedForwarderAddress =
|
||||
"0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81";
|
||||
await jsonProvider.send("hardhat_reset", []);
|
||||
|
||||
const registry = (await new ethers.ContractFactory(
|
||||
TWRegistry__factory.abi,
|
||||
TWRegistry__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress)) as TWRegistry;
|
||||
const registryContract = await registry.deployed();
|
||||
|
||||
const thirdwebFactoryDeployer = (await new ethers.ContractFactory(
|
||||
TWFactory__factory.abi,
|
||||
TWFactory__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress, registry.address)) as TWFactory;
|
||||
|
||||
const deployTxFactory = thirdwebFactoryDeployer.deployTransaction;
|
||||
await deployTxFactory.wait();
|
||||
const thirdwebRegistryAddress = await thirdwebFactoryDeployer.registry();
|
||||
registryAddress = thirdwebFactoryDeployer.address;
|
||||
|
||||
await registryContract.grantRole(
|
||||
await registryContract.OPERATOR_ROLE(),
|
||||
thirdwebFactoryDeployer.address,
|
||||
);
|
||||
|
||||
const thirdwebFeeDeployer = await new ethers.ContractFactory(
|
||||
TWFee__factory.abi,
|
||||
TWFee__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(trustedForwarderAddress, thirdwebFactoryDeployer.address);
|
||||
await thirdwebFactoryDeployer.deployed();
|
||||
|
||||
// Mock publisher for tests
|
||||
const mockPublisher = (await new ethers.ContractFactory(
|
||||
MockContractPublisher__factory.abi,
|
||||
MockContractPublisher__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy()) as MockContractPublisher;
|
||||
const contractPublisher = (await new ethers.ContractFactory(
|
||||
ContractPublisher__factory.abi,
|
||||
ContractPublisher__factory.bytecode,
|
||||
)
|
||||
.connect(signer)
|
||||
.deploy(
|
||||
trustedForwarderAddress,
|
||||
mockPublisher.address,
|
||||
)) as ContractPublisher; // TODO needs MockPublisher here
|
||||
await contractPublisher.deployed();
|
||||
|
||||
async function deployContract(
|
||||
contractFactory: ethers.ContractFactory,
|
||||
contractType: ContractType,
|
||||
): Promise<ethers.Contract> {
|
||||
switch (contractType) {
|
||||
case Marketplace.contractType:
|
||||
case Multiwrap.contractType:
|
||||
const nativeTokenWrapperAddress = getNativeTokenByChainId(
|
||||
ChainId.Hardhat,
|
||||
).wrapped.address;
|
||||
return await contractFactory.deploy(nativeTokenWrapperAddress);
|
||||
case Pack.contractType:
|
||||
const addr = getNativeTokenByChainId(ChainId.Hardhat).wrapped.address;
|
||||
return await contractFactory.deploy(addr, trustedForwarderAddress);
|
||||
default:
|
||||
return await contractFactory.deploy();
|
||||
}
|
||||
}
|
||||
|
||||
for (const contractType in CONTRACTS_MAP) {
|
||||
if (contractType === "custom") {
|
||||
continue;
|
||||
}
|
||||
let factory;
|
||||
switch (contractType) {
|
||||
case Token.contractType:
|
||||
factory = TokenERC20__factory;
|
||||
break;
|
||||
case TokenDrop.contractType:
|
||||
factory = DropERC20__factory;
|
||||
break;
|
||||
case NFTCollection.contractType:
|
||||
factory = TokenERC721__factory;
|
||||
break;
|
||||
case NFTDrop.contractType:
|
||||
factory = DropERC721__factory;
|
||||
break;
|
||||
case SignatureDrop.contractType:
|
||||
factory = SignatureDrop__factory;
|
||||
break;
|
||||
case Edition.contractType:
|
||||
factory = TokenERC1155__factory;
|
||||
break;
|
||||
case EditionDrop.contractType:
|
||||
factory = DropERC1155__factory;
|
||||
break;
|
||||
case Split.contractType:
|
||||
factory = Split__factory;
|
||||
break;
|
||||
case Vote.contractType:
|
||||
factory = VoteERC20__factory;
|
||||
break;
|
||||
case Marketplace.contractType:
|
||||
factory = Marketplace__factory;
|
||||
break;
|
||||
case Pack.contractType:
|
||||
factory = Pack__factory;
|
||||
break;
|
||||
case Multiwrap.contractType:
|
||||
factory = Multiwrap__factory;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`No factory for contract: ${contractType}`);
|
||||
}
|
||||
|
||||
const contractFactory = new ethers.ContractFactory(
|
||||
factory.abi,
|
||||
factory.bytecode,
|
||||
).connect(signer);
|
||||
|
||||
const deployedContract: ethers.Contract = await deployContract(
|
||||
contractFactory,
|
||||
contractType as ContractType,
|
||||
);
|
||||
|
||||
await deployedContract.deployed();
|
||||
const tx = await thirdwebFactoryDeployer.addImplementation(
|
||||
deployedContract.address,
|
||||
);
|
||||
await tx.wait();
|
||||
implementations[contractType as ContractType] = deployedContract.address;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.registryAddress = thirdwebRegistryAddress;
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.factoryAddress = thirdwebFactoryDeployer.address;
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
process.env.contractPublisherAddress = contractPublisher.address;
|
||||
|
||||
storage = new MockStorage();
|
||||
sdk = new ThirdwebSDK(
|
||||
signer,
|
||||
{
|
||||
gasSettings: {
|
||||
maxPriceInGwei: 10000,
|
||||
},
|
||||
},
|
||||
storage,
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export {
|
||||
ipfsGatewayUrl,
|
||||
sdk,
|
||||
signers,
|
||||
jsonProvider,
|
||||
defaultProvider,
|
||||
registryAddress,
|
||||
fastForwardTime,
|
||||
storage,
|
||||
implementations,
|
||||
};
|
||||
@@ -1,14 +1,12 @@
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
import { BigNumber, BigNumberish, ethers } from "ethers";
|
||||
import {
|
||||
AuctionAlreadyStartedError,
|
||||
ListingNotFoundError,
|
||||
WrongListingTypeError,
|
||||
} from "../src/common/error";
|
||||
import { isWinningBid } from "../src/common/marketplace";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../src/constants/currency";
|
||||
import { ListingType } from "../src/enums/marketplace";
|
||||
import { Edition, Marketplace, NFTCollection, Token } from "../src/contracts";
|
||||
import { ListingType } from "../src/enums/marketplace";
|
||||
import { AuctionListing, DirectListing, Offer } from "../src/types/marketplace";
|
||||
import {
|
||||
expectError,
|
||||
@@ -16,8 +14,10 @@ import {
|
||||
jsonProvider,
|
||||
sdk,
|
||||
signers,
|
||||
} from "./before-setup";
|
||||
import { isWinningBid } from "../src/common/marketplace";
|
||||
} from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
import { BigNumber, BigNumberish, ethers } from "ethers";
|
||||
import { ethers as hardhatEthers } from "hardhat";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
@@ -215,7 +215,7 @@ describe("Marketplace Contract", async () => {
|
||||
assert.isDefined(listingId);
|
||||
});
|
||||
|
||||
it("should be able to restrict listing", async () => {
|
||||
it.skip("should be able to restrict listing", async () => {
|
||||
await marketplaceContract.allowListingFromSpecificAssetOnly(
|
||||
dummyBundleContract.getAddress(),
|
||||
);
|
||||
@@ -1087,9 +1087,7 @@ describe("Marketplace Contract", async () => {
|
||||
try {
|
||||
await marketplaceContract.direct.buyoutListing(directListingId, 1);
|
||||
assert.fail("should have thrown");
|
||||
} catch (err: any) {
|
||||
console.error(err);
|
||||
}
|
||||
} catch (err: any) {}
|
||||
});
|
||||
|
||||
it("should not return invalid direct listings", async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
import { Edition, Multiwrap, NFTCollection, Token } from "../src/contracts";
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Multiwrap Contract", async () => {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { NFTDrop, NFTMetadata, NFTMetadataInput, Token } from "../src";
|
||||
import { createSnapshot } from "../src/common";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../src/constants/currency";
|
||||
import { ClaimEligibility } from "../src/enums";
|
||||
import { expectError, sdk, signers, storage } from "./before-setup";
|
||||
import { expectError, sdk, signers, storage } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { NFTMetadataInput } from "../src";
|
||||
import { NFTCollection } from "../src/contracts";
|
||||
import { sdk, signers, storage } from "./before-setup";
|
||||
import { sdk, signers, storage } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { EditionMetadataInput, Pack, Edition } from "../src";
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
|
||||
import { assert } from "chai";
|
||||
import { BigNumber } from "ethers";
|
||||
import { EditionMetadataInput, Pack, Edition } from "../src";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
resolveContractUriFromAddress,
|
||||
ThirdwebSDK,
|
||||
} from "../src";
|
||||
import { implementations, signers } from "./before-setup";
|
||||
import { implementations, signers } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
import { expect } from "chai";
|
||||
import { ContractRegistry } from "../src/core/classes/registry";
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { expect } from "chai";
|
||||
|
||||
describe("Contract Registry", () => {
|
||||
let registry: ContractRegistry;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { Edition } from "../src/index";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
|
||||
import { assert } from "chai";
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { AddressZero } from "@ethersproject/constants";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert } from "chai";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { Edition } from "../src/index";
|
||||
import { sdk, signers } from "./before-setup";
|
||||
|
||||
import { sdk, signers } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
|
||||
global.fetch = require("cross-fetch");
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
} from "../src";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../src/constants/currency";
|
||||
import { SignedPayload721WithQuantitySignature } from "../src/schema/contracts/common/signature";
|
||||
import { expectError, sdk, signers, storage } from "./before-setup";
|
||||
import { expectError, sdk, signers, storage } from "./hooks";
|
||||
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
|
||||
import { assert, expect } from "chai";
|
||||
import { BigNumber, ethers } from "ethers";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user