Compare commits

..
Author SHA1 Message Date
github-actions[bot] e39b66f309 Version Packages (#198) 2022-09-23 19:34:55 -07:00
Joaquim VergesandJonas Daniels 5f5ab015e1 [SDK, SOL] Fixes for getOwned and solana balance (#199)
Co-authored-by: Jonas Daniels <[email protected]>
2022-09-24 02:11:58 +00:00
Jonas Daniels f4f05bd9a4 [React] - make web3 button network switch obvious (#197) 2022-09-24 00:16:56 +00:00
github-actions[bot]andgithub-actions[bot] 2f5b66bef9 Version Packages (#193)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-23 15:27:49 -07:00
Joaquim VergesandJonas Daniels 63258bc9c3 [React] Expose simple provider and useSDK hook for solana (#179)
Co-authored-by: Jonas Daniels <[email protected]>
2022-09-23 19:12:24 +00:00
Jonas Daniels a80fc97b6a [SDK] - update prebuilt contract roles to match contracts (#195) 2022-09-23 18:49:41 +00:00
Adam Majmudar 24f66e38c2 Switch to using XHR with timeout (#192) 2022-09-23 05:32:45 +00:00
github-actions[bot]andgithub-actions[bot] b5bfaefa85 Version Packages (#157)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-22 17:11:41 -07:00
Adam Majmudar 493ebf032e Add upload with gateway url for URIs (#190) 2022-09-22 17:06:59 -07:00
Adam Majmudar d608cea197 Add progress tracking to file upload (#189) 2022-09-22 15:15:00 -07:00
Adam Majmudar a9ec190ff9 Remove JSON types (#188) 2022-09-22 21:27:43 +00:00
3edec391be [CLI] thirdweb deploy redirects to contract deploy page if no contracts detected (#177)
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-22 14:07:32 -07:00
aeitherandJonas Daniels bdec5a59af [CLI] Fix "Invalid Project name" when a project with a capital letter is entered (#184)
Co-authored-by: Jonas Daniels <[email protected]>
2022-09-22 20:20:15 +00:00
Jonas Daniels 9d03619aab fix some lint issues (#187) 2022-09-22 19:02:22 +00:00
Jonas Daniels 0ccbca78dc [Storage] - handle special chars (#185) 2022-09-22 11:29:42 -07:00
Adam Majmudar 75c752cc14 Fix tests (#186) 2022-09-22 11:06:55 -07:00
Jonas Daniels 3580182fa9 [Storage] - allow uploading the same file multiple times in uploadBatch if it is *the same file* (#183) 2022-09-22 09:33:24 +00:00
Adam MajmudarandJonas Daniels b54f95dc90 Update expected input types for storage (#163)
Co-authored-by: Jonas Daniels <[email protected]>
2022-09-22 08:12:52 +00:00
Adam Majmudar f4074ddadc Replace schemes after replacing files (#180) 2022-09-22 06:43:22 +00:00
Jonas Daniels 208b0389a5 [React] - use internal Signer (#168) 2022-09-22 06:04:27 +00:00
YashandJoaquim Verges 3b877ba221 [SDK] Ozdefender EOA forwarder option (#174)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-22 04:47:00 +00:00
Adam Majmudar 45a400fd92 Change API for instantiating storage (#178) 2022-09-21 21:09:11 -07:00
Adam Majmudar 3332fa5697 Split create contract flow into steps (#175) 2022-09-21 22:51:47 +00:00
Joaquim Verges fdda564b1e [SOL] Fix browser build (#173) 2022-09-21 14:35:19 -07:00
Adam Majmudar 89db3db7ff Add changeset for CLI (#172) 2022-09-21 20:15:09 +00:00
Adam Majmudar bd9c705571 Add thirdweb deploy to end of thirdweb detect (#171) 2022-09-21 19:55:54 +00:00
Adam Majmudar 0ad0f21bcd Display yarn build command at the end of thirdweb create --contract (#169) 2022-09-21 19:18:42 +00:00
Joaquim Verges 4169b9428f [SDK] Syntax fixes for react native support (#167) 2022-09-21 09:35:22 -07:00
Jarrod Watts 2f9e8aaab4 Jw/lazymintabletwfeature (#165) 2022-09-21 04:17:11 +00:00
Adam Majmudar 421461ece0 Add README for Solana and Storage (#164) 2022-09-21 02:39:12 +00:00
Jarrod Watts 485ebc8400 [REACT] - Feature snippet generation logic (#155) 2022-09-21 10:40:41 +10:00
Joaquim Verges 772f8431e3 [SDK] Catch gas estimate errors in gasless tx (#162) 2022-09-20 23:00:12 +00:00
Joaquim Verges 5345479922 [SDK] Allow forcing direct deploys to deploy implementations from release flow (#161) 2022-09-20 15:19:18 -07:00
Adam Majmudar cfe8bbafa4 Add resolveScheme method to storage (#156) 2022-09-20 18:31:56 +00:00
Adam Majmudar 18dc8d33ed Fix nft collection docs (#159) 2022-09-20 18:07:30 +00:00
Jonas Daniels f8ab4779bb init paper checkout in v3 (#154) 2022-09-20 05:41:20 +00:00
Adam Majmudar 6fe16c5bf2 Add documentation for Solana (#152) 2022-09-19 22:13:25 -07:00
Adam Majmudar ba0e169654 Add support for string with name (#151) 2022-09-19 18:08:55 -07:00
Jarrod Watts 27b869ed93 Update README.md (#150) 2022-09-20 00:25:11 +00:00
github-actions[bot]andgithub-actions[bot] 091ce2eb45 Version Packages (#149)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 16:08:23 -07:00
Joaquim Verges e24a371508 fix changeset 2022-09-19 16:03:14 -07:00
Adam Majmudar b86afb4b09 Add documentation for storage (#147) 2022-09-19 22:26:44 +00:00
Joaquim Verges 964add6f20 [CLI, Storage] Fix deploy/release uploads via CLI (#148) 2022-09-19 14:56:42 -07:00
github-actions[bot]andgithub-actions[bot] ec414bbc42 Version Packages (#136)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-19 11:11:34 -07:00
Joaquim Verges 51dde28224 [SDK, React] Fix using external signers with ThirdwebSDKProvider (#143) 2022-09-19 18:03:39 +00:00
Adam Majmudar 57432d21c4 Update Storage SDK (#139) 2022-09-19 16:58:12 +00:00
Jarrod Watts 19d87c2885 Jw/react readme (#144) 2022-09-19 07:20:08 +00:00
Joaquim Verges 68812e9d27 Update README.md 2022-09-17 11:29:03 -07:00
Joaquim Verges 90c53475f0 Update README.md 2022-09-17 11:23:54 -07:00
Joaquim Verges 5a52585a7a [SOL] More solana integration (#140) 2022-09-16 19:15:35 -07:00
Joaquim Verges 6b48b9288b [SOL] solana dashboard integration (#138) 2022-09-16 13:19:17 -07:00
Joaquim Verges 9d74a43aac [SDK] Make contract events generic for better DX (#133) 2022-09-16 05:51:23 +00:00
Jonas Daniels 9c7e5518ff [SOL] - enforce owner when deploying (#137) 2022-09-15 22:24:05 -07:00
Jonas Daniels b234c58d44 [SDK] - less rpc calls = good (#135) 2022-09-16 03:43:24 +00:00
Adam Majmudar b1ae844e8b Reorder CLI commands (#134) 2022-09-15 20:20:43 -07:00
github-actions[bot]andgithub-actions[bot] 78bae497ba Version Packages (#126)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-15 14:00:20 -07:00
Joaquim Verges 3e425bf8e6 [SOL] get account type for a given address (#132) 2022-09-15 20:54:45 +00:00
Jarrod Watts 4dca5b21a6 Change feature detection URLs (#128) 2022-09-15 13:45:04 -07:00
Joaquim Verges 42c79e93dc [SDK] fix editing releases from the dashboard (#131) 2022-09-15 19:17:02 +00:00
Joaquim Verges 2951b5533c [SOL] New return type for registry.getAccountsForWallet (#130) 2022-09-15 18:09:52 +00:00
Joaquim Verges fe8751eeae [SDK] add ownable feature detection (#124) 2022-09-15 17:41:32 +00:00
Jonas Daniels a0cd47ec35 [SOL] - explicitly export the missing schemata (#129) 2022-09-15 17:13:20 +00:00
Jarrod Watts 3902e7aba4 Update read and write hook names for snippet generation (#127) 2022-09-15 17:36:23 +10:00
github-actions[bot]andgithub-actions[bot] 8717cb2c05 Version Packages (#118)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-14 19:38:16 -07:00
Jarrod Watts d57ab03f5d Add useContract hook snippet back in (#125) 2022-09-15 12:34:57 +10:00
Joaquim Verges 5aa3c433d7 [Solana] Add sdk.wallet.getBalance() (#123) 2022-09-14 19:27:52 +00:00
Joaquim Verges 98dd64a375 [SDK] handle legacy claim method signature in extensions (#122) 2022-09-14 19:15:47 +00:00
Joaquim Verges e25dd1ac8e [Solana] Handle WalletAdapter connections, internal cleanup (#120) 2022-09-14 05:04:08 +00:00
Jonas Daniels e68f9685b3 fix snippets (#119) 2022-09-14 03:16:58 +00:00
Joaquim Verges 84beda1cbb [Solana] Create account registry (#117) 2022-09-13 16:22:00 -07:00
github-actions[bot]andgithub-actions[bot] 32e7fb0c96 Version Packages (#92)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-09-13 15:24:45 -07:00
Joaquim Verges 8202cc60d8 v3 release notes (#116) 2022-09-13 15:16:00 -07:00
Jonas Daniels a37bc00991 [SDK] - add sales to token pre-built (#115) 2022-09-13 20:49:11 +00:00
Nacho IacovinoandJonas Daniels b442c97080 [SDK] Fix get owned for Signature Drop (#111)
Co-authored-by: Jonas Daniels <[email protected]>
2022-09-13 11:49:42 -07:00
Jonas Daniels 1df2dea18f [CLI, REACT] - small improvements (#114) 2022-09-13 17:51:01 +00:00
Jonas DanielsandJoaquim Verges 0fa6f3fcfb [REACT, SDK] universal use-contract & async pre-built contracts (#106)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-13 09:12:14 -07:00
Jonas Daniels b900b8503f Create codeql-analysis.yml (#113) 2022-09-13 07:44:16 +00:00
YashandJoaquim Verges 5a5bc36150 addPackContents function (#108)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-12 22:21:16 -07:00
Nacho Iacovino 8158a55e66 Remove incorrect await (#110) 2022-09-12 21:39:16 +00:00
Adam Majmudar f7ccc30f9d Add enabled check to useUser (#109) 2022-09-12 21:11:08 +00:00
Adam MajmudarandJoaquim Verges 78b40a94df [Solana] Add support for NFT Drop (#78)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-12 18:10:36 +00:00
Yash 95d850515c Pass empty trustedForwarders for Pack (#107) 2022-09-11 20:20:21 -07:00
Joaquim Verges 1244c38162 [Solana] Custom Program support (#94) 2022-09-10 22:34:33 -07:00
Joaquim Verges 7b923be499 add twfeature for non-ERC extensions 2022-09-10 21:23:00 -07:00
Adam Majmudar 0912dc5f9c [Solana] Remove error catch from supplyOf (#105) 2022-09-10 22:57:21 +00:00
052aa23888 Add test case and supplyOf (#102)
Co-authored-by: Jarrod Watts <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-10 22:45:16 +00:00
Joaquim Verges 6c10ed93cb Fix standard function snippets 2022-09-09 21:04:53 -07:00
Joaquim Verges 2327a9d611 generate feature snippets for all ERC standards (#101) 2022-09-10 12:29:20 +10:00
Nacho Iacovino 27ffbc252b [Multi] Fix typo (#100) 2022-09-10 01:27:40 +00:00
Jonas Daniels a70b590be1 [SDK] - do not prompt to deploy again if user rejected the first call (#99) 2022-09-09 17:15:54 -07:00
Adam MajmudarandJoaquim Verges 45818944e5 Add mint additional supply and balance (#97)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-09 23:21:06 +00:00
Adam Majmudar fe047d551e [Solana] Add nft helper common interface (#79) 2022-09-09 20:56:03 +00:00
82627ea031 [SDK, REACT] Switch to simpler detection API for ERC20/721/1155 extensions (#19)
Co-authored-by: Nacho Iacovino <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: Nacho Iacovino <[email protected]>
2022-09-09 13:45:51 -07:00
Adam Majmudar 1de14730bc Update auth docs domain to example.com (#96) 2022-09-09 19:02:27 +00:00
YashandJoaquim Verges 2adb8ff667 [SDK, React] Support arbitrum and optimism goerli testnets (#91)
Co-authored-by: Joaquim Verges <[email protected]>
2022-09-09 07:07:08 +00:00
Joaquim Verges 820a5191b5 [SDK] Expose ERC721Claimable/ERC1155Claimable features (#90) 2022-09-08 21:44:20 -07:00
Jarrod Watts c94ef909d0 Update README.md (#89) 2022-09-08 08:28:27 +00:00
Joaquim Verges 8aef97d6f1 apply prettier on everything (#80) 2022-09-08 04:38:16 +00:00
Jarrod Watts 8a5501fb80 Add contributing.md and update readme (#77) 2022-09-07 19:58:39 -07:00
409 changed files with 19689 additions and 8974 deletions
+132
View File
@@ -0,0 +1,132 @@
# Contributing to thirdweb
## Getting Started
To get started, read the [How this repo works](#how-this-repo-works) section below to learn about the structure of this repo.
From there, you can take a look at our [Good First Issues](https://github.com/thirdweb-dev/js/labels/good%20first%20issue) board and find an issue that interests you!
If you have any questions about the issue, feel free to ask on our [Discord server](https://discord.gg/thirdweb) in the `#contributors` channel; where you'll be able to get help from our team and other contributors.
<br/>
## How this repo works
[@thirdweb-dev/js](https://github.com/thirdweb-dev/js) is a monorepo, meaning it contains many projects within it.
We use [Turborepo](https://turborepo.org/docs/getting-started) to manage the monorepo, and help speed up the [CI/CD](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment) pipeline to ship to production faster 🚢.
You can see a quick outline of each of the projects within this repo below, which each live within the [/packages](/packages) directory:
| Package | Description | Latest Version |
| ------------------------------ | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [/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 to contribute
Let's explore how you can set up the repo on your local machine and start contributing!
This section requires some existing knowledge of [Git](https://git-scm.com/), [Node.js](https://nodejs.org/en/) and [Yarn](https://yarnpkg.com/).
<br/>
### Getting the repo
For OSS contributions, we use a [Forking Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/forking-workflow), meaning each developer will fork the repo and work on their own fork; and then submit a PR to the main repo when they're ready to merge their changes.
To begin:
1. [Create a fork](https://github.com/thirdweb-dev/js/fork) of this repository to your own GitHub account.
2. [Clone your fork](https://help.github.com/articles/cloning-a-repository/) to your local device.
3. Create a new branch on your fork to start working on your changes:
```
git checkout -b MY_BRANCH_NAME
```
4. Install the dependencies:
```
yarn
```
Now you have got the repo on your local machine, and you're ready to start making your changes!
<br/>
### Publish Your Changes
1. Use [changeset](https://github.com/changesets/changesets) to generate a changeset file:
```
yarn changeset
```
We follow [semantic versioning](https://semver.org/) for generating versioned releases of our packages (i.e. version = `MAJOR.MINOR.PATCH`)
- Update `major` for breaking changes
- Update `minor` for new features,
- Update `patch` for non-breaking bug fixes, etc)
2. Commit the changeset along with your changes:
```
git commit -am "My commit message"
```
3. Push your changes to the SDK:
```
git push origin MY_BRANCH_NAME
```
4. Create a [pull request](https://www.atlassian.com/git/tutorials/making-a-pull-request) to the `main` branch of the official (not your fork) SDK repo.
It's helpful to tag PRs with `[SDK]`, `[REACT]`, `[AUTH]`, (the name of the package you're modifying) to indicate the package that you are engaging with.
<br/>
### Testing Your Changes
When you make a pull request, your changes will be tested automatically by our CI/CD pipeline using [GitHub Actions](https://github.com/features/actions).
On your pull request, you can release your changes to a `dev` version by adding a **comment** with the following text:
```
/release-pr
```
This comment triggers the `release-pr` GitHub Action that publishes your changes to a `dev` version of the package(s) you are modifying.
Once this is done, you can test your changes by installing the `dev` version of the package(s).
If you don't already have a test project, you can use the [CLI](https://github.com/thirdweb-dev/thirdweb-cli) to create one:
```bash
npx thirdweb create
```
Inside your test project, you can install the `dev` version of the package(s) you are modifying.
For example, if you are modifying the `@thirdweb-dev/react` package, you can install the `dev` version of the package by running:
```
yarn add @thirdweb-dev/sdk@dev
```
This will install the `dev` version of the `@thirdweb-dev/react` package in your project, as you can see in the `package.json` file:
```diff
"dependencies": {
- "@thirdweb-dev/react": "^2",
+ "@thirdweb-dev/react": "^2.9.7-dev-b073878",
}
```
You can now test your changes in your test project!
+72
View File
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '37 9 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
+3
View File
@@ -1,2 +1,5 @@
lib
node_modules
dist
contracts-js
*.d.ts
+15 -15
View File
@@ -10,19 +10,19 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div
Examples of behavior that contributes to a positive environment for our community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
## Enforcement Responsibilities
@@ -64,7 +64,7 @@ Community leaders will follow these Community Impact Guidelines in determining t
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the community.
@@ -72,12 +72,12 @@ Community leaders will follow these Community Impact Guidelines in determining t
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, available at [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][mozilla coc].
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][faq]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[mozilla coc]: https://github.com/mozilla/diversity
[faq]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
+31 -23
View File
@@ -1,44 +1,52 @@
<p align="center">
<br />
<a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/packages/sdk/logo.svg?raw=true" width="200" alt=""/></a>
<br />
<br />
<a href="https://thirdweb.com">
<img src="https://github.com/thirdweb-dev/js/blob/main/packages/sdk/logo.svg?raw=true" width="200" alt=""/></a>
<br />
</p>
<h1 align="center">thirdweb JavaScript/TypeScript monorepo</h1>
<h1 align="center"><a href='http://thirdweb.com/'>thirdweb</a> JavaScript/TypeScript monorepo</h1>
<p align="center">
<a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml">
<img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/>
</a>
<a href="https://discord.gg/thirdweb">
<img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/>
</a>
</p>
<p align="center"><strong>Best in class web3 SDKs for Browser, Node and Mobile apps</strong></p>
<br />
## Packages
| Package | Description | Latest Version |
| ---------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Package | Description | Latest Version |
| ------------------------------ | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [/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> |
| [/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
## Documentation
### Contributing
Visit [https://portal.thirdweb.com/](https://portal.thirdweb.com/) to view the full documentation.
1. Create PRs to the monorepo
2. Tag PRs with `[SDK]`, `[REACT]`, `[AUTH]`, etc to indicate the package that you are engaging with (TBD a better process for this / if it is necessary)
3. Create a `changeset` (with `yarn changeset`) for every **user impacting** change and describe what changed (try to focus on the end-user impact as much as possible -- use `major` for breaking changes, `minor` for new features, `patch` for non-breaking bug fixes, etc)
4. when the PR builds and tests pass merge to main
<br />
### Releases
## Contributing
#### Nightly
We welcome contributions from all developers, regardless of experience level. If you are interested in contributing, please read our [Contributing Guide](.github/contributing.md) where you'll learn how the repo works, how to test your changes, and how to submit a pull request.
- every push to main automatically gets published to the `@nightly` tag as a snapshot version (based on the commit hash)
- nightly versions are published to npm under the `@nightly` tag
<br />
#### Stable
## Community
- every push to main that contains a changeset automatically gets added to the [Version Packages](https://github.com/thirdweb-dev/js/tree/changeset-release/main) PR
- to release a stable version of the code that is on main (with the change sets as the release notes / changelog) merge the `Version Packages` PR to main, this will automatically create new `@latest` packages for all of the packages in the monorepo that have changesets
The best place to discuss your ideas, ask questions, and troubleshoot issues is our [Discord server](https://discord.gg/thirdweb).
<br/>
## Security
If you believe you have found a security vulnerability in any of our packages, we kindly ask you not to open a public issue; and to disclose this to us by emailing `[email protected]`.
+7 -2
View File
@@ -19,13 +19,15 @@
"dev": "turbo run dev --no-cache --parallel --continue",
"fix:repo": "manypkg fix",
"lint": "turbo run lint",
"fix": "turbo run fix",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"changeset": "changeset",
"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"
"release:nightly": "node ./scripts/pre-release.mjs && changeset publish --tag nightly",
"push": "turbo run push"
},
"preconstruct": {
"packages": [
@@ -42,9 +44,12 @@
"eslint": "^8.21.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"turbo": "latest"
"turbo": "^1.4.6"
},
"manypkg": {
"defaultBranch": "main"
},
"devDependencies": {
"yalc": "^1.0.0-pre.53"
}
}
+56
View File
@@ -1,5 +1,61 @@
# @thirdweb-dev/auth
## 2.0.7
### Patch Changes
- Updated dependencies [[`5f5ab01`](https://github.com/thirdweb-dev/js/commit/5f5ab015e1dd3c471d6affe995ef36ec88932b3c)]:
- @thirdweb-dev/sdk@3.0.7
## 2.0.6
### Patch Changes
- Updated dependencies [[`a80fc97`](https://github.com/thirdweb-dev/js/commit/a80fc97b6a1e72ed46a400b4b602e180947fb870)]:
- @thirdweb-dev/sdk@3.0.6
## 2.0.5
### Patch Changes
- Updated dependencies [[`4169b94`](https://github.com/thirdweb-dev/js/commit/4169b9428f9001b7cad259a4e56fe610316cd191), [`3b877ba`](https://github.com/thirdweb-dev/js/commit/3b877ba221acfd85f80b99e1bc382055217f0a39), [`b54f95d`](https://github.com/thirdweb-dev/js/commit/b54f95dc906928ff2f9251748f254a16fe1f2cee), [`f8ab477`](https://github.com/thirdweb-dev/js/commit/f8ab4779bb2d6d66200e1e8fd558e0ac069a2f54), [`772f843`](https://github.com/thirdweb-dev/js/commit/772f8431e3a62d0ded62dae90a43e9a7edd5b1a2), [`a9ec190`](https://github.com/thirdweb-dev/js/commit/a9ec190ff99d2714cef2500d20ea0f3f73f07be3), [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9), [`5345479`](https://github.com/thirdweb-dev/js/commit/534547992243bdd3a77e34ec2b2487b5adab366a)]:
- @thirdweb-dev/sdk@3.0.5
## 2.0.4
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.0.4
## 2.0.3
### Patch Changes
- Updated dependencies [[`51dde28`](https://github.com/thirdweb-dev/js/commit/51dde28224209f1b8b26f436c204a5e702281564), [`9d74a43`](https://github.com/thirdweb-dev/js/commit/9d74a43aac21448beba63ba4e2637945965a3634), [`b234c58`](https://github.com/thirdweb-dev/js/commit/b234c58d44d8322e44b2d2ba87ad4ec7d699e961)]:
- @thirdweb-dev/sdk@3.0.3
## 2.0.2
### Patch Changes
- Updated dependencies [[`42c79e9`](https://github.com/thirdweb-dev/js/commit/42c79e93dc958ca46a55d705aeea44ffdbbcc5f6), [`fe8751e`](https://github.com/thirdweb-dev/js/commit/fe8751eeae7ad013b890a8092ddbd091ecbd6708)]:
- @thirdweb-dev/sdk@3.0.2
## 2.0.1
### Patch Changes
- Updated dependencies [[`98dd64a`](https://github.com/thirdweb-dev/js/commit/98dd64a375c302a879aab3c628ecfb84b4dd19da)]:
- @thirdweb-dev/sdk@3.0.1
## 2.0.0
### Patch Changes
- Updated dependencies [[`a70b590`](https://github.com/thirdweb-dev/js/commit/a70b590be1efa7c0ad93a724afb24870439558ed), [`a37bc00`](https://github.com/thirdweb-dev/js/commit/a37bc00991bf1a359f5f8aa8e24e2c388dcd99d8), [`b442c97`](https://github.com/thirdweb-dev/js/commit/b442c970808f6cb7457d29542bd826dba711579c), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`2adb8ff`](https://github.com/thirdweb-dev/js/commit/2adb8ff6673768a91fa411c2d069245190ad9397), [`5a5bc36`](https://github.com/thirdweb-dev/js/commit/5a5bc361507bd8707dc12e9000bb9a218221cf61), [`820a519`](https://github.com/thirdweb-dev/js/commit/820a5191b5e7af5aba5e4d1cc90cd895c0dade11), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`82627ea`](https://github.com/thirdweb-dev/js/commit/82627ea0311f612119d0596ed0f568267a7af16b)]:
- @thirdweb-dev/sdk@3.0.0
## 1.0.8
### Patch Changes
+1
View File
@@ -18,6 +18,7 @@ Install the latest version of the SDK with either `npm` or `yarn`:
```shell
npm install @thirdweb-dev/auth @thirdweb-dev/sdk ethers
```
```shell
yarn add @thirdweb-dev/auth @thirdweb-dev/sdk ethers
```
+7 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "1.0.8",
"version": "2.0.7",
"exports": {
"./package.json": "./package.json",
"./express": {
@@ -27,7 +27,10 @@
],
"scripts": {
"build": "preconstruct build",
"lint": "eslint"
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/ && rm -rf node_modules/"
},
"preconstruct": {
"entrypoints": [
@@ -57,7 +60,7 @@
"eslint-plugin-tsdoc": "^0.2.16",
"ethers": "^5.7.0",
"express": "^4.18.1",
"next": "12.2.0",
"next": "^12.2.0",
"next-auth": "^4.10.3",
"prettier": "^2.7.1",
"typescript": "^4.7.4"
@@ -66,7 +69,7 @@
"@thirdweb-dev/sdk": "*",
"ethers": ">=5.5.1",
"express": "^4.18.1",
"next": "12.2.0",
"next": "^12.2.0",
"next-auth": "^4.10.3"
},
"peerDependenciesMeta": {
+2 -2
View File
@@ -13,7 +13,7 @@ function redirectWithError(req: Request, res: Response, error: string) {
export default async function handler(
req: Request,
res: Response,
ctx: ThirdwebAuthContext
ctx: ThirdwebAuthContext,
) {
if (req.method !== "GET") {
return redirectWithError(req, res, "INVALID_METHOD");
@@ -44,7 +44,7 @@ export default async function handler(
httpOnly: true,
secure: true,
sameSite: "strict",
})
}),
);
if (ctx.callbacks?.login) {
+1 -1
View File
@@ -14,7 +14,7 @@ export default async function handler(req: Request, res: Response) {
serialize("thirdweb_auth_token", "", {
path: "/",
expires: new Date(Date.now() + 5 * 1000),
})
}),
);
return res.status(301).redirect(req.headers.referer as string);
+12 -4
View File
@@ -8,8 +8,12 @@ export type ThirdwebAuthConfig = {
domain: string;
authUrl?: string;
callbacks?: {
login?: (address: string) => (Promise<void> | void);
user?: (address: string) => (Promise<Omit<ThirdwebAuthUser, "address">> | Omit<ThirdwebAuthUser, "address">);
login?: (address: string) => Promise<void> | void;
user?: (
address: string,
) =>
| Promise<Omit<ThirdwebAuthUser, "address">>
| Omit<ThirdwebAuthUser, "address">;
};
};
@@ -17,8 +21,12 @@ export type ThirdwebAuthContext = {
sdk: ThirdwebSDK;
domain: string;
callbacks?: {
login?: (address: string) => (Promise<void> | void);
user?: (address: string) => (Promise<Omit<ThirdwebAuthUser, "address">> | Omit<ThirdwebAuthUser, "address">);
login?: (address: string) => Promise<void> | void;
user?: (
address: string,
) =>
| Promise<Omit<ThirdwebAuthUser, "address">>
| Omit<ThirdwebAuthUser, "address">;
};
};
+44 -34
View File
@@ -1,8 +1,16 @@
import { ThirdwebNextAuthConfig } from "./types";
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
import { serialize } from "cookie";
import { GetServerSidePropsContext, NextApiRequest, NextApiResponse } from "next";
import NextAuth, { NextAuthOptions, Session, unstable_getServerSession } from "next-auth";
import {
GetServerSidePropsContext,
NextApiRequest,
NextApiResponse,
} from "next";
import NextAuth, {
NextAuthOptions,
Session,
unstable_getServerSession,
} from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
@@ -21,10 +29,7 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
async authorize({ payload }: any) {
try {
const parsed = JSON.parse(payload);
const token = await sdk.auth.generateAuthToken(
cfg.domain,
parsed
);
const token = await sdk.auth.generateAuthToken(cfg.domain, parsed);
const address = await sdk.auth.authenticate(cfg.domain, token);
// Securely set httpOnly cookie on request to prevent XSS on frontend
@@ -36,7 +41,7 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
httpOnly: true,
secure: true,
sameSite: "strict",
})
}),
);
return { address };
@@ -47,19 +52,22 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
});
}
function nextOptions (
function nextOptions(
req: GetServerSidePropsContext["req"],
res: GetServerSidePropsContext["res"]
res: GetServerSidePropsContext["res"],
): NextAuthOptions {
async function session({ session }: { session: Session }) {
async function session({
session: _session,
}: {
session: Session;
}): Promise<Session> {
const token = req.cookies.thirdweb_auth_token || "";
try {
const address = await sdk.auth.authenticate(cfg.domain, token);
session.user = { ...session.user, address } as Session["user"];
return session;
_session.user = { ..._session.user, address } as Session["user"];
return _session;
} catch {
return session;
return _session;
}
}
@@ -69,35 +77,35 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
serialize("thirdweb_auth_token", "", {
path: "/",
expires: new Date(Date.now() + 5 * 1000),
})
}),
);
}
const providers: NextAuthOptions["providers"] = [
...cfg.nextOptions.providers,
ThirdwebProvider(res),
]
];
const configSession = cfg.nextOptions.callbacks?.session
const configSession = cfg.nextOptions.callbacks?.session;
const callbacks: NextAuthOptions["callbacks"] = {
...cfg.nextOptions.callbacks,
session: configSession
? async (params) => {
params.session = await session(params);
return configSession(params);
}
: session
params.session = await session(params);
return configSession(params);
}
: session,
};
const configSignOut = cfg.nextOptions.events?.signOut
const configSignOut = cfg.nextOptions.events?.signOut;
const events: NextAuthOptions["events"] = {
...cfg.nextOptions.events,
signOut: configSignOut
? async (params) => {
signOut();
return configSignOut(params);
}
: signOut
signOut();
return configSignOut(params);
}
: signOut,
};
return {
@@ -106,23 +114,25 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
callbacks,
events,
};
};
}
async function getUser(
...args:
| [NextApiRequest, NextApiResponse]
| [GetServerSidePropsContext["req"], GetServerSidePropsContext["res"]]
) {
return unstable_getServerSession(args[0], args[1], nextOptions(args[0], args[1]));
return unstable_getServerSession(
args[0],
args[1],
nextOptions(args[0], args[1]),
);
}
function NextAuthHandler(
...args: [] | [NextApiRequest, NextApiResponse]
) {
function NextAuthHandler(...args: [] | [NextApiRequest, NextApiResponse]) {
if (args.length === 0) {
return (req: NextApiRequest, res: NextApiResponse) => {
return NextAuth(req, res, nextOptions(req, res));
}
};
}
return NextAuth(args[0], args[1], nextOptions(args[0], args[1]));
@@ -130,6 +140,6 @@ export function ThirdwebNextAuth(cfg: ThirdwebNextAuthConfig) {
return {
NextAuthHandler,
getUser
}
getUser,
};
}
+1 -1
View File
@@ -4,4 +4,4 @@ export type ThirdwebNextAuthConfig = {
privateKey: string;
domain: string;
nextOptions: NextAuthOptions;
}
};
+2 -2
View File
@@ -20,7 +20,7 @@ export * from "./types";
async function ThirdwebAuthRouter(
req: NextApiRequest,
res: NextApiResponse,
ctx: ThirdwebAuthContext
ctx: ThirdwebAuthContext,
) {
// Catch-all route must be named with [...thirdweb]
const { thirdweb } = req.query;
@@ -58,7 +58,7 @@ export function ThirdwebAuth(cfg: ThirdwebAuthConfig) {
}
async function getUser(
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest
req: GetServerSidePropsContext["req"] | NextRequest | NextApiRequest,
) {
const { sdk, domain } = ctx;
let user: ThirdwebAuthUser | null = null;
+3 -3
View File
@@ -6,7 +6,7 @@ import { NextApiRequest, NextApiResponse } from "next";
function redirectWithError(
req: NextApiRequest,
res: NextApiResponse,
error: string
error: string,
) {
const encodedError = encodeURIComponent(error);
const url = new URL(req.headers.referer as string);
@@ -17,7 +17,7 @@ function redirectWithError(
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
ctx: ThirdwebAuthContext
ctx: ThirdwebAuthContext,
) {
if (req.method !== "GET") {
return redirectWithError(req, res, "INVALID_METHOD");
@@ -48,7 +48,7 @@ export default async function handler(
httpOnly: true,
secure: true,
sameSite: "strict",
})
}),
);
if (ctx.callbacks?.login) {
+2 -2
View File
@@ -3,7 +3,7 @@ import { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
res: NextApiResponse,
) {
if (req.method !== "GET") {
return res.status(400).json({
@@ -17,7 +17,7 @@ export default async function handler(
serialize("thirdweb_auth_token", "", {
path: "/",
expires: new Date(Date.now() + 5 * 1000),
})
}),
);
return res.status(301).redirect(req.headers.referer as string);
+1 -1
View File
@@ -4,7 +4,7 @@ import { NextApiRequest, NextApiResponse } from "next";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
ctx: ThirdwebAuthContext
ctx: ThirdwebAuthContext,
) {
if (req.method !== "GET") {
return res.status(400).json({
+12 -4
View File
@@ -6,8 +6,12 @@ export type ThirdwebAuthConfig = {
privateKey: string;
domain: string;
callbacks?: {
login?: (address: string) => (Promise<void> | void);
user?: (address: string) => (Promise<Omit<ThirdwebAuthUser, "address">> | Omit<ThirdwebAuthUser, "address">);
login?: (address: string) => Promise<void> | void;
user?: (
address: string,
) =>
| Promise<Omit<ThirdwebAuthUser, "address">>
| Omit<ThirdwebAuthUser, "address">;
};
};
@@ -15,8 +19,12 @@ export type ThirdwebAuthContext = {
sdk: ThirdwebSDK;
domain: string;
callbacks?: {
login?: (address: string) => (Promise<void> | void);
user?: (address: string) => (Promise<Omit<ThirdwebAuthUser, "address">> | Omit<ThirdwebAuthUser, "address">);
login?: (address: string) => Promise<void> | void;
user?: (
address: string,
) =>
| Promise<Omit<ThirdwebAuthUser, "address">>
| Omit<ThirdwebAuthUser, "address">;
};
};
+72
View File
@@ -1,5 +1,77 @@
# thirdweb
## 0.7.18
### Patch Changes
- Updated dependencies [[`5f5ab01`](https://github.com/thirdweb-dev/js/commit/5f5ab015e1dd3c471d6affe995ef36ec88932b3c)]:
- @thirdweb-dev/sdk@3.0.7
## 0.7.17
### Patch Changes
- Updated dependencies [[`a80fc97`](https://github.com/thirdweb-dev/js/commit/a80fc97b6a1e72ed46a400b4b602e180947fb870)]:
- @thirdweb-dev/sdk@3.0.6
## 0.7.16
### Patch Changes
- [#172](https://github.com/thirdweb-dev/js/pull/172) [`89db3db`](https://github.com/thirdweb-dev/js/commit/89db3db7ff3d5af7e7a7b5f25e299b9faad44eb0) Thanks [@adam-maj](https://github.com/adam-maj)! - Add thirdweb deploy to end of thirdweb detect and yarn build to thirdweb create
- [#175](https://github.com/thirdweb-dev/js/pull/175) [`3332fa5`](https://github.com/thirdweb-dev/js/commit/3332fa5697b9ff2a4ded1f2c508304f59f434be2) Thanks [@adam-maj](https://github.com/adam-maj)! - Split create contract flow into two steps
- [#177](https://github.com/thirdweb-dev/js/pull/177) [`3edec39`](https://github.com/thirdweb-dev/js/commit/3edec391be169453aaee412846005a820939fab0) Thanks [@adam-maj](https://github.com/adam-maj)! - thirdweb deploy redirects to contract deploy page if no contracts detected
- [#184](https://github.com/thirdweb-dev/js/pull/184) [`bdec5a5`](https://github.com/thirdweb-dev/js/commit/bdec5a59af680802e206e3025b2c463fc7dcb740) Thanks [@aeither](https://github.com/aeither)! - Fix "Invalid Project name" when a project with a capital letter is entered
- Updated dependencies [[`4169b94`](https://github.com/thirdweb-dev/js/commit/4169b9428f9001b7cad259a4e56fe610316cd191), [`3b877ba`](https://github.com/thirdweb-dev/js/commit/3b877ba221acfd85f80b99e1bc382055217f0a39), [`b54f95d`](https://github.com/thirdweb-dev/js/commit/b54f95dc906928ff2f9251748f254a16fe1f2cee), [`f8ab477`](https://github.com/thirdweb-dev/js/commit/f8ab4779bb2d6d66200e1e8fd558e0ac069a2f54), [`772f843`](https://github.com/thirdweb-dev/js/commit/772f8431e3a62d0ded62dae90a43e9a7edd5b1a2), [`a9ec190`](https://github.com/thirdweb-dev/js/commit/a9ec190ff99d2714cef2500d20ea0f3f73f07be3), [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9), [`5345479`](https://github.com/thirdweb-dev/js/commit/534547992243bdd3a77e34ec2b2487b5adab366a)]:
- @thirdweb-dev/sdk@3.0.5
## 0.7.15
### Patch Changes
- [#148](https://github.com/thirdweb-dev/js/pull/148) [`964add6`](https://github.com/thirdweb-dev/js/commit/964add6f205577298b8f4b9ce7298e5bf09e88e7) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix deploy/release CLI uploads
- Updated dependencies []:
- @thirdweb-dev/sdk@3.0.4
## 0.7.14
### Patch Changes
- [#134](https://github.com/thirdweb-dev/js/pull/134) [`b1ae844`](https://github.com/thirdweb-dev/js/commit/b1ae844e8bbed59c0225b32f4115ae384fa23ef5) Thanks [@adam-maj](https://github.com/adam-maj)! - Update ordering of commands in npx thirdweb
- Updated dependencies [[`51dde28`](https://github.com/thirdweb-dev/js/commit/51dde28224209f1b8b26f436c204a5e702281564), [`9d74a43`](https://github.com/thirdweb-dev/js/commit/9d74a43aac21448beba63ba4e2637945965a3634), [`b234c58`](https://github.com/thirdweb-dev/js/commit/b234c58d44d8322e44b2d2ba87ad4ec7d699e961)]:
- @thirdweb-dev/sdk@3.0.3
## 0.7.13
### Patch Changes
- [#128](https://github.com/thirdweb-dev/js/pull/128) [`4dca5b2`](https://github.com/thirdweb-dev/js/commit/4dca5b21a66fe8ff4c4b24663e1b9ad6c446b7e2) Thanks [@jarrodwatts](https://github.com/jarrodwatts)! - Add new documentation for detectable features
- Updated dependencies [[`42c79e9`](https://github.com/thirdweb-dev/js/commit/42c79e93dc958ca46a55d705aeea44ffdbbcc5f6), [`fe8751e`](https://github.com/thirdweb-dev/js/commit/fe8751eeae7ad013b890a8092ddbd091ecbd6708)]:
- @thirdweb-dev/sdk@3.0.2
## 0.7.12
### Patch Changes
- Updated dependencies [[`98dd64a`](https://github.com/thirdweb-dev/js/commit/98dd64a375c302a879aab3c628ecfb84b4dd19da)]:
- @thirdweb-dev/sdk@3.0.1
## 0.7.11
### Patch Changes
- [#114](https://github.com/thirdweb-dev/js/pull/114) [`1df2dea`](https://github.com/thirdweb-dev/js/commit/1df2dea18f85f6760040c9000f2eb8aee8a6011b) Thanks [@jnsdls](https://github.com/jnsdls)! - remove deprecacted `publish` cli command (use `release` instead)
- Updated dependencies [[`a70b590`](https://github.com/thirdweb-dev/js/commit/a70b590be1efa7c0ad93a724afb24870439558ed), [`a37bc00`](https://github.com/thirdweb-dev/js/commit/a37bc00991bf1a359f5f8aa8e24e2c388dcd99d8), [`b442c97`](https://github.com/thirdweb-dev/js/commit/b442c970808f6cb7457d29542bd826dba711579c), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`2adb8ff`](https://github.com/thirdweb-dev/js/commit/2adb8ff6673768a91fa411c2d069245190ad9397), [`5a5bc36`](https://github.com/thirdweb-dev/js/commit/5a5bc361507bd8707dc12e9000bb9a218221cf61), [`820a519`](https://github.com/thirdweb-dev/js/commit/820a5191b5e7af5aba5e4d1cc90cd895c0dade11), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`82627ea`](https://github.com/thirdweb-dev/js/commit/82627ea0311f612119d0596ed0f568267a7af16b)]:
- @thirdweb-dev/sdk@3.0.0
## 0.7.10
### Patch Changes
+5 -3
View File
@@ -3,9 +3,11 @@ export const CREATE_MESSAGES = {
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?",
contract: "What type of contract do you want to start from?",
extensions: "What extensions do you want to add to your contract?",
} as const;
export const ERROR_MESSAGES = {
noConfiguration: "Failed to find a supported project configuration file in current directory"
}
noConfiguration:
"Failed to find a supported project configuration file in current directory",
};
+5 -7
View File
@@ -1,5 +1,5 @@
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
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);
@@ -7,12 +7,10 @@ jest.setTimeout(120_000);
describe("npx thirdweb create", () => {
it("should create app (CRA) successfully", async () => {
const { spawn, cleanup, exists } = await prepareEnvironment();
const {
waitForText,
waitForFinish,
getExitCode,
pressKey,
} = await spawn("node", "./dist/cli/index.js create");
const { waitForText, waitForFinish, getExitCode, pressKey } = await spawn(
"node",
"./dist/cli/index.js create",
);
await waitForText(CREATE_MESSAGES.typeOfProject);
await pressKey("enter");
+11 -11
View File
@@ -1,7 +1,7 @@
import { ERROR_MESSAGES } from "../constants/constants";
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);
@@ -10,25 +10,25 @@ 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`);
await copyFile(
resolve("./e2e/files/BasicContract.sol"),
`${path}/BasicContract.sol`,
);
const {
waitForText,
waitForFinish,
getExitCode,
writeText,
getStdout,
} = await spawn("node", "./dist/cli/index.js deploy");
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")
await writeText("y");
// wait for program to finish
await waitForFinish();
expect(getStdout().at(-1)).toContain("https://thirdweb.com/contracts/deploy/");
expect(getStdout().at(-1)).toContain(
"https://thirdweb.com/contracts/deploy/",
);
// the process should exit with code 0
expect(getExitCode()).toEqual(0);
+6 -3
View File
@@ -6,7 +6,7 @@ jest.setTimeout(120_000);
describe("npx thirdweb detect", () => {
it("should detect ERC721Base extensions", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment();
const { spawn, cleanup, exists } = await prepareEnvironment();
const create = await spawn("node", "./dist/cli/index.js create");
await create.waitForText(CREATE_MESSAGES.typeOfProject);
@@ -20,9 +20,12 @@ describe("npx thirdweb detect", () => {
// select hardhat
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.contract);
// select ERC721Base
// select ERC721
await create.pressKey("arrowDown");
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.extensions);
// select no extra extensions
await create.pressKey("enter");
// wait for program to finish
await create.waitForFinish();
@@ -70,7 +73,7 @@ describe("npx thirdweb detect", () => {
lines.findIndex((line) => line.includes("- ERC721Enumerable")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("- ERC721Droppable")),
lines.findIndex((line) => line.includes("- ERC721LazyMintable")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("- ERC721SignatureMint")),
+11 -11
View File
@@ -1,7 +1,7 @@
import { ERROR_MESSAGES } from "../constants/constants";
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);
@@ -10,25 +10,25 @@ 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`);
await copyFile(
resolve("./e2e/files/BasicContract.sol"),
`${path}/BasicContract.sol`,
);
const {
waitForText,
waitForFinish,
getExitCode,
writeText,
getStdout,
} = await spawn("node", "./dist/cli/index.js release");
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")
await writeText("y");
// wait for program to finish
await waitForFinish();
expect(getStdout().at(-1)).toContain("https://thirdweb.com/contracts/release/");
expect(getStdout().at(-1)).toContain(
"https://thirdweb.com/contracts/release/",
);
// the process should exit with code 0
expect(getExitCode()).toEqual(0);
+6 -5
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.7.10",
"version": "0.7.18",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -21,11 +21,10 @@
"@types/update-notifier": "^5.1.0",
"@types/validate-npm-package-name": "^4.0.0",
"hardhat": "^2.9.3",
"jest": "^29.0.1",
"jest": "^28",
"prettier": "^2.7.1",
"ts-jest": "^28.0.8",
"ts-node": "^10.7.0",
"tsc": "^2.0.4",
"tsup": "^6.2.3",
"typescript": "^4.7.4"
},
@@ -58,10 +57,12 @@
"thirdweb": "./dist/cli/index.js"
},
"scripts": {
"prettier": "prettier --write 'src/**/*'",
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"cli": "node -r ts-node/register src/cli/index.ts",
"build": "yarn clean && tsc --noEmit && tsup --env.NODE_ENV production --minify --format cjs --external hardhat --dts-resolve",
"build": "yarn clean && tsup --env.NODE_ENV production --minify --format cjs --external hardhat --dts-resolve",
"build:watch": "yarn run build --watch",
"generate-thirdweb-package": "node scripts/generate-thirdweb-package.js",
"e2e": "jest"
+47 -64
View File
@@ -36,51 +36,37 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$
program
.name("thirdweb-cli")
.description("Official thirdweb command line interface")
.version(cliVersion, "-v, --version", "output the current version");
.version(cliVersion, "-v, --version");
program
.command("detect")
.command("create")
.description(
"Compile contracts and detect implemented thirdweb contract extensions",
"Create a thirdweb app from any of our official templates. Checkout some examples you can use here: https://github.com/thirdweb-example/",
)
.option("-p, --path <project-path>", "path to project", ".")
.option("-d, --debug", "show debug logs")
.option("-a, --all", "run detection on all contracts")
.action(async (options) => {
await detectExtensions(options);
});
program
.command("publish")
.description("[Deprecated] use 'release' instead.")
.option("-p, --path <project-path>", "path to project", ".")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
logger.warn(
"'publish' is deprecated and will be removed in a future update. Please use 'release' instead.",
);
const url = await processProject(options, "release");
info(`Open this link to release your contracts:`);
logger.info(chalk.blueBright(url.toString()));
open(url.toString());
});
program
.command("release")
.description(
"Release contracts, making them available for others to deploy and unlocking SDKs, Dashboards and Analytics.",
.option("--app", `Create a thirdweb app.`)
.option("--contract", `Create a thirdweb contracts project.`)
.option("--ts, --typescript", `Initialize as a TypeScript project.`)
.option("--js, --javascript", `Initialize as a JavaScript project.`)
.option("--forge", `Initialize as a Forge project.`)
.option("--hardhat", `Initialize as a Hardhat project.`)
.option("--cra", `Initialize as a Create React App project.`)
.option("--next", `Initialize as a Next.js project.`)
.option("--vite", `Initialize as a Vite project.`)
.option(
"--use-npm",
`Explicitly tell the CLI to bootstrap the app using npm`,
)
.option(
"--use-pnpm",
`Explicitly tell the CLI to bootstrap the app using pnpm`,
)
.option("--framework [name]", `The preferred framework.`)
.option(
"-t, --template [name]",
`A template to start your project from. You can use an template repository name from the official thirdweb-example org.`,
)
.option("-p, --path <project-path>", "path to project", ".")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
const url = await processProject(options, "release");
info(`Open this link to release your contracts:`);
logger.info(chalk.blueBright(url.toString()));
open(url.toString());
await twCreate(options);
});
program
@@ -128,34 +114,31 @@ $$$$$$\\ $$$$$$$\\ $$\\ $$$$$$\\ $$$$$$$ |$$\\ $$\\ $$\\ $$$$$$\\ $$$$
});
program
.command("create")
.command("release")
.description(
"Create a thirdweb app from any of our official templates. Checkout some examples you can use here: https://github.com/thirdweb-example/",
)
.option("--app", `Create a thirdweb app.`)
.option("--contract", `Create a thirdweb contracts project.`)
.option("--ts, --typescript", `Initialize as a TypeScript project.`)
.option("--js, --javascript", `Initialize as a JavaScript project.`)
.option("--forge", `Initialize as a Forge project.`)
.option("--hardhat", `Initialize as a Hardhat project.`)
.option("--cra", `Initialize as a Create React App project.`)
.option("--next", `Initialize as a Next.js project.`)
.option("--vite", `Initialize as a Vite project.`)
.option(
"--use-npm",
`Explicitly tell the CLI to bootstrap the app using npm`,
)
.option(
"--use-pnpm",
`Explicitly tell the CLI to bootstrap the app using pnpm`,
)
.option("--framework [name]", `The preferred framework.`)
.option(
"-t, --template [name]",
`A template to start your project from. You can use an template repository name from the official thirdweb-example org.`,
"Release contracts, making them available for others to deploy and unlocking SDKs, Dashboards and Analytics.",
)
.option("-p, --path <project-path>", "path to project", ".")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
await twCreate(options);
const url = await processProject(options, "release");
info(`Open this link to release your contracts:`);
logger.info(chalk.blueBright(url.toString()));
open(url.toString());
});
program
.command("detect")
.description(
"Compile contracts and detect implemented thirdweb contract extensions",
)
.option("-p, --path <project-path>", "path to project", ".")
.option("-d, --debug", "show debug logs")
.option("-a, --all", "run detection on all contracts")
.action(async (options) => {
await detectExtensions(options);
});
program
+3 -3
View File
@@ -1,5 +1,5 @@
import { spinner } from "../core/helpers/logger";
import { IpfsStorage } from "@thirdweb-dev/storage";
import { ThirdwebStorage } from "@thirdweb-dev/storage";
import { existsSync, mkdirSync, writeFileSync } from "fs";
import path, { join } from "path";
@@ -13,10 +13,10 @@ export async function installGithubAction(options: any) {
: path.resolve(`${projectPath}/${options.path}`);
projectPath = resolvedPath;
}
const storage = new IpfsStorage();
const storage = new ThirdwebStorage();
const log = spinner("Installing thirdweb Github Action...");
try {
const ghActionData = await storage.getRaw(ghActionHash);
const ghActionData = await (await storage.download(ghActionHash)).text();
const dir = join(projectPath, ".github/workflows");
if (!existsSync(dir)) {
mkdirSync(dir, { recursive: true });
+26 -4
View File
@@ -1,12 +1,14 @@
import { ALWAYS_SUGGESTED } from "../constants/features";
import build from "../core/builder/build";
import detect from "../core/detection/detect";
import { logger, spinner, warn, info } from "../core/helpers/logger";
import { logger, spinner } from "../core/helpers/logger";
import { createContractsPrompt } from "../core/helpers/selector";
import { ContractFeatures, Feature } from "../core/interfaces/ContractFeatures";
import { ContractPayload } from "../core/interfaces/ContractPayload";
import { getPkgManager } from "../create/helpers/get-pkg-manager";
import { detectFeatures, FeatureWithEnabled } from "@thirdweb-dev/sdk";
import chalk from "chalk";
import { existsSync, readFileSync } from "fs";
import ora from "ora";
import path from "path";
@@ -41,7 +43,7 @@ export async function detectExtensions(options: any) {
compileLoader.succeed("Compilation successful");
let selectedContracts: ContractPayload[] = [];
if (compiledResult.contracts.length == 1) {
if (compiledResult.contracts.length === 1) {
selectedContracts = [compiledResult.contracts[0]];
} else {
if (options.all) {
@@ -70,13 +72,13 @@ export async function detectExtensions(options: any) {
const enabledFeatures: Feature[] = features.enabledFeatures.map(
(feature) => ({
name: feature.name,
reference: `https://portal.thirdweb.com/contracts/${feature.docLinks.contracts}`,
reference: `https://portal.thirdweb.com/extensions/${feature.name.toLowerCase()}`,
}),
);
const suggestedFeatures: Feature[] = features.suggestedFeatures.map(
(feature) => ({
name: feature.name,
reference: `https://portal.thirdweb.com/contracts/${feature.docLinks.contracts}`,
reference: `https://portal.thirdweb.com/extensions/${feature.name.toLowerCase()}`,
}),
);
@@ -113,6 +115,26 @@ export async function detectExtensions(options: any) {
)} - ${chalk.dim(chalk.gray(feature.reference))}`,
);
});
let deployCmd = `npx thirdweb@latest deploy`;
if (existsSync(projectPath + "/package.json")) {
const packageManager = getPkgManager();
const useYarn = packageManager === "yarn";
const pkgJson = JSON.parse(
readFileSync(projectPath + "/package.json", "utf-8"),
);
if (pkgJson?.scripts?.deploy === deployCmd) {
deployCmd = `${packageManager}${useYarn ? "" : " run"} deploy`;
}
}
logger.info(``);
ora(
`Once you're done writing your contracts, you can run the following command to deploy them:`,
).info();
logger.info(``);
logger.info(` ${chalk.cyan(deployCmd)}`);
logger.info(``);
});
}
+41 -17
View File
@@ -1,13 +1,14 @@
import { THIRDWEB_URL, cliVersion } from "../constants/urls";
import { cliVersion, THIRDWEB_URL } from "../constants/urls";
import build from "../core/builder/build";
import detect from "../core/detection/detect";
import { execute } from "../core/helpers/exec";
import { error, info, logger, spinner, warn } from "../core/helpers/logger";
import { error, info, logger, spinner } from "../core/helpers/logger";
import { createContractsPrompt } from "../core/helpers/selector";
import { ContractPayload } from "../core/interfaces/ContractPayload";
import { IpfsStorage } from "@thirdweb-dev/storage";
import { ThirdwebStorage } from "@thirdweb-dev/storage";
import chalk from "chalk";
import { readFileSync } from "fs";
import ora from "ora";
import path from "path";
export async function processProject(
@@ -15,7 +16,7 @@ export async function processProject(
command: "deploy" | "release",
) {
// TODO: allow overriding the default storage
const storage = new IpfsStorage();
const storage = new ThirdwebStorage();
logger.setSettings({
minLevel: options.debug ? "debug" : "info",
@@ -35,6 +36,27 @@ export async function processProject(
const projectType = await detect(projectPath, options);
if (projectType === "none") {
if (command === "deploy") {
info(
"No contracts detected in this directory. Redirecting to the thirdweb contract deployment page.",
);
return "https://thirdweb.com/contracts";
}
error("No detected contracts in this directory.");
logger.info(``);
ora(
`Detected contract files must end with the '.sol' extension and exist in this directory or the '/contracts' subdirectory`,
).info();
logger.info(``);
ora("To create a new contracts project, run the following command:").info();
logger.info(``);
logger.info(` ${chalk.cyan(`npx thirdweb@latest create --contract`)}`);
logger.info(``);
process.exit(1);
}
if (options.ci) {
logger.info("Installing dependencies...");
try {
@@ -65,7 +87,7 @@ export async function processProject(
}
compileLoader.succeed("Compilation successful");
if (compiledResult.contracts.length == 0) {
if (compiledResult.contracts.length === 0) {
logger.error(
"No deployable contract detected. Run with the '--debug' option to see what contracts were skipped and why.",
);
@@ -73,7 +95,7 @@ export async function processProject(
}
let selectedContracts: ContractPayload[] = [];
if (compiledResult.contracts.length == 1) {
if (compiledResult.contracts.length === 1) {
selectedContracts = [compiledResult.contracts[0]];
info(
`Processing contract: ${chalk.blueBright(
@@ -129,7 +151,9 @@ export async function processProject(
if (file.includes(soliditySDKPackage)) {
usesSoliditySDK = true;
}
return await storage.uploadSingle(file);
return await storage.upload(file, {
uploadWithoutDirectory: true,
});
}),
);
}
@@ -140,14 +164,15 @@ export async function processProject(
const metadataURIs = await Promise.all(
selectedContracts.map(async (c) => {
logger.debug(`Uploading ${c.name}...`);
const hash = await storage.uploadSingle(c.metadata);
return `ipfs://${hash}`;
return await storage.upload(JSON.parse(c.metadata), {
uploadWithoutDirectory: true,
});
}),
);
// Upload batch all bytecodes
const bytecodes = selectedContracts.map((c) => c.bytecode);
const { uris: bytecodeURIs } = await storage.uploadBatch(bytecodes);
const bytecodeURIs = await storage.uploadBatch(bytecodes);
const combinedContents = selectedContracts.map((c, i) => {
// attach analytics blob to metadata
@@ -167,16 +192,15 @@ export async function processProject(
};
});
let combinedURIs: string[] = [];
if (combinedContents.length == 1) {
if (combinedContents.length === 1) {
// use upload single if only one contract to get a clean IPFS hash
const metadataUri = await storage.uploadSingle(
JSON.stringify(combinedContents[0]),
);
const metadataUri = await storage.upload(combinedContents[0], {
uploadWithoutDirectory: true,
});
combinedURIs.push(metadataUri);
} else {
// otherwise upload batch
const { uris } = await storage.uploadMetadataBatch(combinedContents);
combinedURIs = uris;
combinedURIs = await storage.uploadBatch(combinedContents);
}
loader.succeed("Upload successful");
@@ -190,7 +214,7 @@ export async function processProject(
export function getUrl(hashes: string[], command: string) {
let url;
if (hashes.length == 1) {
if (hashes.length === 1) {
url = new URL(
THIRDWEB_URL +
`/contracts/${command}/` +
+2 -2
View File
@@ -21,7 +21,7 @@ contract Contract is ERC721Base {
{}
}`,
ERC721Signature: `// SPDX-License-Identifier: Apache-2.0
ERC721SignatureMint: `// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/base/ERC721SignatureMint.sol";
@@ -113,7 +113,7 @@ contract Contract is ERC1155Base {
{}
}`,
ERC1155Signature: `// SPDX-License-Identifier: Apache-2.0
ERC1155SignatureMint: `// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/base/ERC1155SignatureMint.sol";
+1
View File
@@ -19,4 +19,5 @@ export const PINATA_IPFS_URL = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
export const THIRDWEB_URL = `https://thirdweb.com`;
export const pkg = require("../../package.json");
export const cliVersion = pkg.version;
+5 -2
View File
@@ -1,6 +1,6 @@
import { findFiles } from "../../common/file-helper";
import { execute } from "../helpers/exec";
import { logger, spinner } from "../helpers/logger";
import { logger } from "../helpers/logger";
import { CompileOptions } from "../interfaces/Builder";
import { ContractPayload } from "../interfaces/ContractPayload";
import { BaseBuilder } from "./builder-base";
@@ -21,7 +21,10 @@ export class BrownieBuilder extends BaseBuilder {
config?.project_structure?.build || "./build",
);
existsSync(buildPath) && rmSync(buildPath, { recursive: true });
if (existsSync(buildPath)) {
rmSync(buildPath, { recursive: true });
}
await execute("brownie compile", options.projectPath);
const contractsPath = join(buildPath, "contracts/");
+1 -1
View File
@@ -1,5 +1,5 @@
import { ContractPayload } from "../interfaces/ContractPayload";
import { ProjectType } from "./../types/ProjectType";
import { ProjectType } from "../types/ProjectType";
import { BrownieBuilder } from "./brownie";
import { FoundryBuilder } from "./foundry";
import { HardhatBuilder } from "./hardhat";
@@ -2,8 +2,6 @@ import { extractIPFSHashFromBytecode } from "../helpers/ipfs";
import { logger } from "../helpers/logger";
import { CompileOptions, IBuilder } from "../interfaces/Builder";
import { ContractPayload } from "../interfaces/ContractPayload";
import { existsSync, readdirSync, statSync } from "fs";
import { basename, join } from "path";
export abstract class BaseBuilder implements IBuilder {
abstract compile(
@@ -20,7 +18,7 @@ export abstract class BaseBuilder implements IBuilder {
bytecode === "" ||
bytecode === "0x" ||
!abi ||
abi.length == 0
abi.length === 0
) {
return false;
}
+2 -1
View File
@@ -111,9 +111,10 @@ export class FoundryBuilder extends BaseBuilder {
}
private sort(object: any) {
if (typeof object != "object" || object instanceof Array)
if (typeof object !== "object" || object instanceof Array) {
// Not to sort the array
return object;
}
var keys = Object.keys(object);
keys.sort();
var newObject: any = {};
+1 -1
View File
@@ -1,6 +1,6 @@
import { findFiles } from "../../common/file-helper";
import { execute } from "../helpers/exec";
import { logger, spinner } from "../helpers/logger";
import { logger } from "../helpers/logger";
import { CompileOptions } from "../interfaces/Builder";
import { ContractPayload } from "../interfaces/ContractPayload";
import { BaseBuilder } from "./builder-base";
+3 -3
View File
@@ -1,5 +1,5 @@
import { findFiles } from "../../common/file-helper";
import { logger, spinner } from "../helpers/logger";
import { logger } from "../helpers/logger";
import { CompileOptions } from "../interfaces/Builder";
import { ContractPayload } from "../interfaces/ContractPayload";
import { BaseBuilder } from "./builder-base";
@@ -122,7 +122,7 @@ export class SolcBuilder extends BaseBuilder {
continue;
}
const sources = Object.keys(parsedMetadata.sources)
const _sources = Object.keys(parsedMetadata.sources)
.map((path) => {
const matchingSourcePath = inputPaths.find((p) => p.includes(path));
if (matchingSourcePath && existsSync(matchingSourcePath)) {
@@ -145,7 +145,7 @@ export class SolcBuilder extends BaseBuilder {
metadata,
bytecode,
name: contractName,
sources,
sources: _sources,
});
}
}
+5 -2
View File
@@ -1,6 +1,6 @@
import { findFiles } from "../../common/file-helper";
import { execute } from "../helpers/exec";
import { logger, spinner } from "../helpers/logger";
import { logger } from "../helpers/logger";
import { CompileOptions } from "../interfaces/Builder";
import { ContractPayload } from "../interfaces/ContractPayload";
import { BaseBuilder } from "./builder-base";
@@ -22,7 +22,10 @@ export class TruffleBuilder extends BaseBuilder {
truffleConfig.contracts_build_directory || "./build/contracts",
);
existsSync(buildPath) && rmSync(buildPath, { recursive: true });
if (existsSync(buildPath)) {
rmSync(buildPath, { recursive: true });
}
await execute("npx --yes truffle compile", options.projectPath);
const contracts: ContractPayload[] = [];
@@ -1,4 +1,3 @@
import { logger } from "../helpers/logger";
import { ProjectType } from "../types/ProjectType";
import { Detector } from "./detector";
import { existsSync } from "fs";
+41 -11
View File
@@ -1,11 +1,13 @@
import { ERROR_MESSAGES } from "../../../constants/constants";
import { info, logger, warn } from "../helpers/logger";
import { ProjectType } from "../types/ProjectType";
import { Detector } from "./detector";
import FoundryDetector from "./foundry";
import HardhatDetector from "./hardhat";
import TruffleDetector from "./truffle";
import fs, { exists, existsSync } from "fs";
import inquirer from "inquirer";
import { ERROR_MESSAGES } from "../../../constants/constants";
import { parse } from "path";
const { Confirm } = require("enquirer");
@@ -26,17 +28,24 @@ export default async function detect(
//if there is no project returned at all then just return unknown}
if (!possibleProjectTypes.length) {
warn(`${ERROR_MESSAGES.noConfiguration} ${path}`);
const prompt = new Confirm({
name: "continue",
message: "Do you want to continue and compile this project with solc instead?",
});
const shouldCompile = await prompt.run();
if (!shouldCompile) {
logger.warn("Aborted contract compilation");
process.exit(1);
const canCompile = hasContracts(path);
if (canCompile) {
warn(`${ERROR_MESSAGES.noConfiguration} ${path}`);
const prompt = new Confirm({
name: "continue",
message:
"Do you want to continue and compile this project with solc instead?",
});
const shouldCompile = await prompt.run();
if (!shouldCompile) {
logger.warn("Aborted contract compilation");
process.exit(1);
}
return "solc";
} else {
return "none";
}
return "unknown";
}
//if there is only one possible option just return it
if (possibleProjectTypes.length === 1) {
@@ -63,3 +72,24 @@ export default async function detect(
return answer[question];
}
}
// Check if a directory has any .sol files or a /contracts folder with .sol files
function hasContracts(path: any) {
return (
["", "/contracts"].filter((p) => {
const dirPath = path + p;
if (!existsSync(dirPath)) {
return false;
}
const files = fs.readdirSync(dirPath);
const contracts = files.filter((filePath) => {
const { ext } = parse(filePath);
return ext === ".sol";
});
return contracts.length > 0;
}).length > 0
);
}
@@ -1,4 +1,3 @@
import { logger } from "../helpers/logger";
import { ProjectType } from "../types/ProjectType";
import { Detector } from "./detector";
import { existsSync } from "fs";
@@ -1,4 +1,3 @@
import { logger } from "../helpers/logger";
import { ProjectType } from "../types/ProjectType";
import { Detector } from "./detector";
import { existsSync } from "fs";
@@ -1,4 +1,3 @@
import { logger } from "../helpers/logger";
import { ProjectType } from "../types/ProjectType";
import { Detector } from "./detector";
import { existsSync } from "fs";
+2 -2
View File
@@ -1,4 +1,3 @@
import { logger } from "./logger";
import { decodeFirstSync } from "cbor";
import { UnixFS } from "ipfs-unixfs";
import { DAGNode } from "ipld-dag-pb";
@@ -53,8 +52,9 @@ function hexToBytes(hex: string | number) {
hex = hex.replace(/^0x/i, "");
for (var bytes = [], c = 0; c < hex.length; c += 2)
for (var bytes = [], c = 0; c < hex.length; c += 2) {
bytes.push(parseInt(hex.slice(c, c + 2), 16));
}
return bytes;
}
+1 -1
View File
@@ -5,7 +5,7 @@ const { MultiSelect } = require("enquirer");
export function createContractsPrompt(
choices: { name: string; value: ContractPayload }[],
message: string
message: string,
) {
return new MultiSelect({
name: "value",
@@ -1,4 +1,3 @@
export interface Feature {
/**
* The name of the contract (with the .sol extension)
@@ -20,7 +19,6 @@ export interface ContractFeatures {
*/
name: string;
/**
* The features detected on the contract
*/
+2 -1
View File
@@ -3,4 +3,5 @@ export type ProjectType =
| "foundry"
| "hardhat"
| "truffle"
| "unknown";
| "solc"
| "none";
+60 -29
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env node
/* eslint-disable import/no-extraneous-dependencies */
import { CREATE_MESSAGES } from "../../constants/constants";
import { DownloadError, createApp } from "./helpers/create-app";
import { createContract } from "./helpers/create-contract";
import { getPkgManager } from "./helpers/get-pkg-manager";
@@ -8,7 +9,6 @@ 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 = "";
@@ -90,12 +90,15 @@ export async function twCreate(options: any) {
name: "path",
message: CREATE_MESSAGES.projectName,
initial: options.template || defaultName,
validate: (name) => {
const validation = validateNpmName(path.basename(path.resolve(name)));
format: (name: string) => name.toLowerCase(),
validate: (name: string) => {
const validation = validateNpmName(
path.basename(path.resolve(name.toLowerCase())),
);
if (validation.valid) {
return true;
}
return "Invalid project name: " + validation.problems![0];
return "Invalid project name: " + validation.problems?.[0];
},
});
@@ -175,36 +178,64 @@ export async function twCreate(options: any) {
// Select base contract
if (projectType === "contract" && !baseContract) {
const res = await prompts({
let standard = "none";
const standardPrompt = await prompts({
type: "select",
name: "baseContract",
name: "standard",
message: CREATE_MESSAGES.contract,
choices: [
{ title: "Empty Contract", value: "" },
{ title: "ERC721 Base", value: "ERC721Base" },
{ title: "ERC721 + Signature Mint", value: "ERC721Signature" },
{ title: "ERC721 + Lazy Mint", value: "ERC721LazyMint" },
{ title: "ERC721 + Delayed Reveal", value: "ERC721DelayedReveal" },
{ title: "ERC721 + Drop", value: "ERC721Drop" },
{ title: "ERC1155 Base", value: "ERC1155Base" },
{ title: "ERC1155 + Signature Mint", value: "ERC1155Signature" },
{ title: "ERC1155 + Lazy Mint", value: "ERC1155LazyMint" },
{ title: "ERC1155 + Delayed Reveal", value: "ERC1155DelayedReveal" },
{ title: "ERC1155 + Drop", value: "ERC1155Drop" },
{ title: "ERC20 Base", value: "ERC20Base" },
{ title: "ERC20 + Vote", value: "ERC20Vote" },
{ title: "ERC20 + Signature Mint", value: "ERC20SignatureMint" },
{
title: "ERC20 + Vote + Signature Mint",
value: "ERC20SignatureMintVote",
},
{ title: "ERC20 + Drop", value: "ERC20Drop" },
{ title: "ERC20 + Vote + Drop", value: "ERC20DropVote" },
{ title: "Empty Contract", value: "none" },
{ title: "ERC721", value: "erc721" },
{ title: "ERC20", value: "erc20" },
{ title: "ERC1155", value: "erc1155" },
],
});
if (typeof res.baseContract === "string") {
baseContract = res.baseContract.trim();
if (typeof standardPrompt.standard === "string") {
standard = standardPrompt.standard.trim();
}
if (standard === "none") {
baseContract = "";
} else {
let choices: prompts.Choice[] = [];
if (standard === "erc721") {
choices = [
{ title: "None", value: "ERC721Base" },
{ title: "Signature Mint", value: "ERC721SignatureMint" },
{ title: "Lazy Mint", value: "ERC721LazyMint" },
{ title: "Delayed Reveal", value: "ERC721DelayedReveal" },
{ title: "Drop", value: "ERC721Drop" },
];
} else if (standard === "erc20") {
choices = [
{ title: "None", value: "ERC20Base" },
{ title: "Vote", value: "ERC20Vote" },
{ title: "Signature Mint", value: "ERC20SignatureMint" },
{ title: "Vote + Signature Mint", value: "ERC20SignatureMintVote" },
{ title: "Drop", value: "ERC20Drop" },
{ title: "Vote + Drop", value: "ERC20DropVote" },
];
} else if (standard === "erc1155") {
choices = [
{ title: "None", value: "ERC1155Base" },
{ title: "Signature Mint", value: "ERC1155SignatureMint" },
{ title: "Lazy Mint", value: "ERC1155LazyMint" },
{ title: "Delayed Reveal", value: "ERC1155DelayedReveal" },
{ title: "Drop", value: "ERC1155Drop" },
];
}
const res = await prompts({
type: "select",
name: "baseContract",
message: CREATE_MESSAGES.extensions,
choices: choices,
});
if (typeof res.baseContract === "string") {
baseContract = res.baseContract.trim();
}
}
}
@@ -230,7 +261,7 @@ export async function twCreate(options: any) {
)} because of npm naming restrictions:`,
);
problems!.forEach((p) => console.error(` ${chalk.red.bold("*")} ${p}`));
problems?.forEach((p) => console.error(` ${chalk.red.bold("*")} ${p}`));
process.exit(1);
}
@@ -109,7 +109,7 @@ export async function createApp({
);
} catch (reason) {
throw new DownloadError(
isErrorLike(reason) ? reason.message : reason + "",
isErrorLike(reason) ? reason.message : String(reason),
);
}
@@ -137,7 +137,7 @@ export async function createApp({
);
} catch (reason) {
throw new DownloadError(
isErrorLike(reason) ? reason.message : reason + "",
isErrorLike(reason) ? reason.message : String(reason),
);
}
@@ -7,12 +7,12 @@ import { isFolderEmpty } from "./is-folder-empty";
import { getOnline } from "./is-online";
import { isWriteable } from "./is-writeable";
import { makeDir } from "./make-dir";
import { downloadAndExtractRepo, hasTemplate } from "./templates";
import { submodules } from "./submodules";
import { downloadAndExtractRepo } from "./templates";
import retry from "async-retry";
import chalk from "chalk";
import { writeFile } from "fs/promises";
import path from "path";
import { submodules } from "./submodules";
interface ICreateContract {
contractPath: string;
@@ -88,7 +88,7 @@ export async function createContract({
starter = "forge-starter";
} else {
console.error("Please provide a valid contracts framework.");
process.exit(1)
process.exit(1);
}
await retry(
@@ -115,7 +115,9 @@ export async function createContract({
await writeFile(contractFile, baseContractText);
}
} catch (reason) {
throw new DownloadError(isErrorLike(reason) ? reason.message : reason + "");
throw new DownloadError(
isErrorLike(reason) ? reason.message : String(reason),
);
}
console.log("Installing packages. This might take a couple of minutes.");
@@ -143,15 +145,21 @@ export async function createContract({
console.log(
`${chalk.green("Success!")} Created ${projectName} at ${contractPath}`,
);
console.log();
console.log("Inside that directory, you can run several commands:");
console.log();
console.log(chalk.cyan(` ${packageManager} ${useYarn ? "" : "run"} deploy`));
console.log(chalk.cyan(` ${packageManager}${useYarn ? "" : " run"} build`));
console.log(
" Compiles your contracts and detects thirdweb extensions implemented on them.",
);
console.log();
console.log(chalk.cyan(` ${packageManager}${useYarn ? "" : " run"} deploy`));
console.log(" Deploys your contracts with the thirdweb deploy flow.");
console.log();
console.log(
chalk.cyan(` ${packageManager} ${useYarn ? "" : "run"} release`),
chalk.cyan(` ${packageManager}${useYarn ? "" : " run"} release`),
);
console.log(" Releases your contracts with the thirdweb release flow..");
console.log(" Releases your contracts with the thirdweb release flow.");
console.log();
console.log("We suggest that you begin by typing:");
console.log();
@@ -4,6 +4,7 @@ export type PackageManager = "npm" | "pnpm" | "yarn";
export function getPkgManager(): PackageManager {
try {
// eslint-disable-next-line turbo/no-undeclared-env-vars
const userAgent = process.env.npm_config_user_agent;
if (userAgent) {
if (userAgent.startsWith("yarn")) {
+7 -3
View File
@@ -1,7 +1,7 @@
/* eslint-disable import/no-extraneous-dependencies */
import type { PackageManager } from "./get-pkg-manager";
import chalk from "chalk";
import spawn from "cross-spawn";
import type { PackageManager } from "./get-pkg-manager";
interface InstallArgs {
/**
@@ -53,9 +53,13 @@ export function install(
* Call `yarn add --exact (--offline)? (-D)? ...`.
*/
args = ["add", "--exact"];
if (!isOnline) args.push("--offline");
if (!isOnline) {
args.push("--offline");
}
args.push("--cwd", root);
if (devDependencies) args.push("--dev");
if (devDependencies) {
args.push("--dev");
}
args.push(...dependencies);
} else {
/**
+3 -1
View File
@@ -3,7 +3,9 @@ import dns from "dns";
import url from "url";
function getProxy(): string | undefined {
// eslint-disable-next-line turbo/no-undeclared-env-vars
if (process.env.https_proxy) {
// eslint-disable-next-line turbo/no-undeclared-env-vars
return process.env.https_proxy;
}
@@ -33,7 +35,7 @@ export function getOnline(): Promise<boolean> {
}
dns.lookup(hostname, (proxyErr) => {
resolve(proxyErr == null);
resolve(proxyErr === null);
});
});
});
@@ -14,6 +14,11 @@ export async function submodules(): Promise<void> {
await runCommand("rm", ["-rf", ".gitmodules"]);
await runCommand("rm", ["-rf", "lib"]);
await runCommand("touch", [".gitmodules"]);
await runCommand("git", ["submodule", "add", "https://github.com/foundry-rs/forge-std.git", "lib/forge-std"])
await runCommand("git", [
"submodule",
"add",
"https://github.com/foundry-rs/forge-std.git",
"lib/forge-std",
]);
await runCommand("git", ["submodule", "update", "--init", "--recursive"]);
}
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/contracts-js
## 1.1.8
### Patch Changes
- [#90](https://github.com/thirdweb-dev/js/pull/90) [`820a519`](https://github.com/thirdweb-dev/js/commit/820a5191b5e7af5aba5e4d1cc90cd895c0dade11) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update to contracts v3.1.7
## 1.1.7
### Patch Changes
+6 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@thirdweb-dev/contracts-js",
"version": "1.1.7",
"version": "1.1.8",
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
"module": "dist/thirdweb-dev-contracts-js.esm.js",
"license": "Apache-2.0",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
"dependencies": {
"@thirdweb-dev/contracts": "3.1.6-1"
"@thirdweb-dev/contracts": "3.1.8-0"
},
"devDependencies": {
"@babel/preset-env": "^7.18.10",
@@ -23,6 +23,10 @@
"dist/"
],
"scripts": {
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"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 && tsc && yarn preconstruct build && yarn extract-abi"
@@ -335,6 +335,7 @@ export interface ERC1155DelayedRevealInterface extends utils.Interface {
"OwnerUpdated(address,address)": EventFragment;
"RoyaltyForToken(uint256,address,uint256)": EventFragment;
"TokenURIRevealed(uint256,string)": EventFragment;
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
"TokensLazyMinted(uint256,uint256,string,bytes)": EventFragment;
"TransferBatch(address,address,address,uint256[],uint256[])": EventFragment;
"TransferSingle(address,address,address,uint256,uint256)": EventFragment;
@@ -347,6 +348,7 @@ export interface ERC1155DelayedRevealInterface extends utils.Interface {
getEvent(nameOrSignatureOrTopic: "OwnerUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RoyaltyForToken"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokenURIRevealed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensLazyMinted"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TransferBatch"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TransferSingle"): EventFragment;
@@ -423,6 +425,19 @@ export type TokenURIRevealedEvent = TypedEvent<
export type TokenURIRevealedEventFilter =
TypedEventFilter<TokenURIRevealedEvent>;
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
tokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface TokensLazyMintedEventObject {
startTokenId: BigNumber;
endTokenId: BigNumber;
@@ -1081,6 +1096,19 @@ export interface ERC1155DelayedReveal extends BaseContract {
revealedURI?: null
): TokenURIRevealedEventFilter;
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
"TokensLazyMinted(uint256,uint256,string,bytes)"(
startTokenId?: BigNumberish | null,
endTokenId?: null,
@@ -287,6 +287,7 @@ export interface ERC1155LazyMintInterface extends utils.Interface {
"DefaultRoyalty(address,uint256)": EventFragment;
"OwnerUpdated(address,address)": EventFragment;
"RoyaltyForToken(uint256,address,uint256)": EventFragment;
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
"TokensLazyMinted(uint256,uint256,string,bytes)": EventFragment;
"TransferBatch(address,address,address,uint256[],uint256[])": EventFragment;
"TransferSingle(address,address,address,uint256,uint256)": EventFragment;
@@ -298,6 +299,7 @@ export interface ERC1155LazyMintInterface extends utils.Interface {
getEvent(nameOrSignatureOrTopic: "DefaultRoyalty"): EventFragment;
getEvent(nameOrSignatureOrTopic: "OwnerUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RoyaltyForToken"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensLazyMinted"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TransferBatch"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TransferSingle"): EventFragment;
@@ -362,6 +364,19 @@ export type RoyaltyForTokenEvent = TypedEvent<
export type RoyaltyForTokenEventFilter = TypedEventFilter<RoyaltyForTokenEvent>;
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
tokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface TokensLazyMintedEventObject {
startTokenId: BigNumber;
endTokenId: BigNumber;
@@ -930,6 +945,19 @@ export interface ERC1155LazyMint extends BaseContract {
royaltyBps?: null
): RoyaltyForTokenEventFilter;
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
"TokensLazyMinted(uint256,uint256,string,bytes)"(
startTokenId?: BigNumberish | null,
endTokenId?: null,
+9 -9
View File
@@ -39,7 +39,7 @@ export interface ERC20BaseInterface extends utils.Interface {
"decimals()": FunctionFragment;
"decreaseAllowance(address,uint256)": FunctionFragment;
"increaseAllowance(address,uint256)": FunctionFragment;
"mint(address,uint256)": FunctionFragment;
"mintTo(address,uint256)": FunctionFragment;
"multicall(bytes[])": FunctionFragment;
"name()": FunctionFragment;
"nonces(address)": FunctionFragment;
@@ -64,7 +64,7 @@ export interface ERC20BaseInterface extends utils.Interface {
| "decimals"
| "decreaseAllowance"
| "increaseAllowance"
| "mint"
| "mintTo"
| "multicall"
| "name"
| "nonces"
@@ -106,7 +106,7 @@ export interface ERC20BaseInterface extends utils.Interface {
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "mint",
functionFragment: "mintTo",
values: [string, BigNumberish]
): string;
encodeFunctionData(
@@ -168,7 +168,7 @@ export interface ERC20BaseInterface extends utils.Interface {
functionFragment: "increaseAllowance",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "mintTo", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "multicall", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
@@ -314,7 +314,7 @@ export interface ERC20Base extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -407,7 +407,7 @@ export interface ERC20Base extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -497,7 +497,7 @@ export interface ERC20Base extends BaseContract {
overrides?: CallOverrides
): Promise<boolean>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: CallOverrides
@@ -624,7 +624,7 @@ export interface ERC20Base extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -721,7 +721,7 @@ export interface ERC20Base extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -73,7 +73,7 @@ export interface ERC20SignatureMintInterface extends utils.Interface {
"decimals()": FunctionFragment;
"decreaseAllowance(address,uint256)": FunctionFragment;
"increaseAllowance(address,uint256)": FunctionFragment;
"mint(address,uint256)": FunctionFragment;
"mintTo(address,uint256)": FunctionFragment;
"mintWithSignature((address,address,uint256,uint256,address,uint128,uint128,bytes32),bytes)": FunctionFragment;
"multicall(bytes[])": FunctionFragment;
"name()": FunctionFragment;
@@ -102,7 +102,7 @@ export interface ERC20SignatureMintInterface extends utils.Interface {
| "decimals"
| "decreaseAllowance"
| "increaseAllowance"
| "mint"
| "mintTo"
| "mintWithSignature"
| "multicall"
| "name"
@@ -148,7 +148,7 @@ export interface ERC20SignatureMintInterface extends utils.Interface {
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "mint",
functionFragment: "mintTo",
values: [string, BigNumberish]
): string;
encodeFunctionData(
@@ -226,7 +226,7 @@ export interface ERC20SignatureMintInterface extends utils.Interface {
functionFragment: "increaseAllowance",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "mintTo", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "mintWithSignature",
data: BytesLike
@@ -415,7 +415,7 @@ export interface ERC20SignatureMint extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -527,7 +527,7 @@ export interface ERC20SignatureMint extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -636,7 +636,7 @@ export interface ERC20SignatureMint extends BaseContract {
overrides?: CallOverrides
): Promise<boolean>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: CallOverrides
@@ -800,7 +800,7 @@ export interface ERC20SignatureMint extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -916,7 +916,7 @@ export interface ERC20SignatureMint extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -92,7 +92,7 @@ export interface ERC20SignatureMintVoteInterface extends utils.Interface {
"getPastVotes(address,uint256)": FunctionFragment;
"getVotes(address)": FunctionFragment;
"increaseAllowance(address,uint256)": FunctionFragment;
"mint(address,uint256)": FunctionFragment;
"mintTo(address,uint256)": FunctionFragment;
"mintWithSignature((address,address,uint256,uint256,address,uint128,uint128,bytes32),bytes)": FunctionFragment;
"multicall(bytes[])": FunctionFragment;
"name()": FunctionFragment;
@@ -129,7 +129,7 @@ export interface ERC20SignatureMintVoteInterface extends utils.Interface {
| "getPastVotes"
| "getVotes"
| "increaseAllowance"
| "mint"
| "mintTo"
| "mintWithSignature"
| "multicall"
| "name"
@@ -202,7 +202,7 @@ export interface ERC20SignatureMintVoteInterface extends utils.Interface {
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "mint",
functionFragment: "mintTo",
values: [string, BigNumberish]
): string;
encodeFunctionData(
@@ -303,7 +303,7 @@ export interface ERC20SignatureMintVoteInterface extends utils.Interface {
functionFragment: "increaseAllowance",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "mintTo", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "mintWithSignature",
data: BytesLike
@@ -561,7 +561,7 @@ export interface ERC20SignatureMintVote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -714,7 +714,7 @@ export interface ERC20SignatureMintVote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -858,7 +858,7 @@ export interface ERC20SignatureMintVote extends BaseContract {
overrides?: CallOverrides
): Promise<boolean>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: CallOverrides
@@ -1082,7 +1082,7 @@ export interface ERC20SignatureMintVote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -1245,7 +1245,7 @@ export interface ERC20SignatureMintVote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
+9 -9
View File
@@ -58,7 +58,7 @@ export interface ERC20VoteInterface extends utils.Interface {
"getPastVotes(address,uint256)": FunctionFragment;
"getVotes(address)": FunctionFragment;
"increaseAllowance(address,uint256)": FunctionFragment;
"mint(address,uint256)": FunctionFragment;
"mintTo(address,uint256)": FunctionFragment;
"multicall(bytes[])": FunctionFragment;
"name()": FunctionFragment;
"nonces(address)": FunctionFragment;
@@ -91,7 +91,7 @@ export interface ERC20VoteInterface extends utils.Interface {
| "getPastVotes"
| "getVotes"
| "increaseAllowance"
| "mint"
| "mintTo"
| "multicall"
| "name"
| "nonces"
@@ -160,7 +160,7 @@ export interface ERC20VoteInterface extends utils.Interface {
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "mint",
functionFragment: "mintTo",
values: [string, BigNumberish]
): string;
encodeFunctionData(
@@ -245,7 +245,7 @@ export interface ERC20VoteInterface extends utils.Interface {
functionFragment: "increaseAllowance",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "mint", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "mintTo", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "multicall", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "name", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "nonces", data: BytesLike): Result;
@@ -460,7 +460,7 @@ export interface ERC20Vote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -594,7 +594,7 @@ export interface ERC20Vote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -719,7 +719,7 @@ export interface ERC20Vote extends BaseContract {
overrides?: CallOverrides
): Promise<boolean>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: CallOverrides
@@ -906,7 +906,7 @@ export interface ERC20Vote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -1050,7 +1050,7 @@ export interface ERC20Vote extends BaseContract {
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
mint(
mintTo(
_to: string,
_amount: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -360,6 +360,7 @@ export interface ERC721DelayedRevealInterface extends utils.Interface {
"OwnerUpdated(address,address)": EventFragment;
"RoyaltyForToken(uint256,address,uint256)": EventFragment;
"TokenURIRevealed(uint256,string)": EventFragment;
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
"TokensLazyMinted(uint256,uint256,string,bytes)": EventFragment;
"Transfer(address,address,uint256)": EventFragment;
};
@@ -371,6 +372,7 @@ export interface ERC721DelayedRevealInterface extends utils.Interface {
getEvent(nameOrSignatureOrTopic: "OwnerUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RoyaltyForToken"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokenURIRevealed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensLazyMinted"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment;
}
@@ -457,6 +459,19 @@ export type TokenURIRevealedEvent = TypedEvent<
export type TokenURIRevealedEventFilter =
TypedEventFilter<TokenURIRevealedEvent>;
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
startTokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface TokensLazyMintedEventObject {
startTokenId: BigNumber;
endTokenId: BigNumber;
@@ -1093,6 +1108,19 @@ export interface ERC721DelayedReveal extends BaseContract {
revealedURI?: null
): TokenURIRevealedEventFilter;
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
"TokensLazyMinted(uint256,uint256,string,bytes)"(
startTokenId?: BigNumberish | null,
endTokenId?: null,
@@ -312,6 +312,7 @@ export interface ERC721LazyMintInterface extends utils.Interface {
"DefaultRoyalty(address,uint256)": EventFragment;
"OwnerUpdated(address,address)": EventFragment;
"RoyaltyForToken(uint256,address,uint256)": EventFragment;
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
"TokensLazyMinted(uint256,uint256,string,bytes)": EventFragment;
"Transfer(address,address,uint256)": EventFragment;
};
@@ -322,6 +323,7 @@ export interface ERC721LazyMintInterface extends utils.Interface {
getEvent(nameOrSignatureOrTopic: "DefaultRoyalty"): EventFragment;
getEvent(nameOrSignatureOrTopic: "OwnerUpdated"): EventFragment;
getEvent(nameOrSignatureOrTopic: "RoyaltyForToken"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
getEvent(nameOrSignatureOrTopic: "TokensLazyMinted"): EventFragment;
getEvent(nameOrSignatureOrTopic: "Transfer"): EventFragment;
}
@@ -396,6 +398,19 @@ export type RoyaltyForTokenEvent = TypedEvent<
export type RoyaltyForTokenEventFilter = TypedEventFilter<RoyaltyForTokenEvent>;
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
startTokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface TokensLazyMintedEventObject {
startTokenId: BigNumber;
endTokenId: BigNumber;
@@ -942,6 +957,19 @@ export interface ERC721LazyMint extends BaseContract {
royaltyBps?: null
): RoyaltyForTokenEventFilter;
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
"TokensLazyMinted(uint256,uint256,string,bytes)"(
startTokenId?: BigNumberish | null,
endTokenId?: null,
+13 -13
View File
@@ -24,7 +24,7 @@ import type {
utils,
} from "ethers";
export declare namespace MinimalForwarder {
export declare namespace Forwarder {
export type ForwardRequestStruct = {
from: string;
to: string;
@@ -64,12 +64,12 @@ export interface ForwarderInterface extends utils.Interface {
encodeFunctionData(
functionFragment: "execute",
values: [MinimalForwarder.ForwardRequestStruct, BytesLike]
values: [Forwarder.ForwardRequestStruct, BytesLike]
): string;
encodeFunctionData(functionFragment: "getNonce", values: [string]): string;
encodeFunctionData(
functionFragment: "verify",
values: [MinimalForwarder.ForwardRequestStruct, BytesLike]
values: [Forwarder.ForwardRequestStruct, BytesLike]
): string;
decodeFunctionResult(functionFragment: "execute", data: BytesLike): Result;
@@ -107,7 +107,7 @@ export interface Forwarder extends BaseContract {
functions: {
execute(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@@ -115,14 +115,14 @@ export interface Forwarder extends BaseContract {
getNonce(from: string, overrides?: CallOverrides): Promise<[BigNumber]>;
verify(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<[boolean]>;
};
execute(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
@@ -130,14 +130,14 @@ export interface Forwarder extends BaseContract {
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
callStatic: {
execute(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<[boolean, string]>;
@@ -145,7 +145,7 @@ export interface Forwarder extends BaseContract {
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
@@ -155,7 +155,7 @@ export interface Forwarder extends BaseContract {
estimateGas: {
execute(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
@@ -163,7 +163,7 @@ export interface Forwarder extends BaseContract {
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
@@ -171,7 +171,7 @@ export interface Forwarder extends BaseContract {
populateTransaction: {
execute(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
@@ -182,7 +182,7 @@ export interface Forwarder extends BaseContract {
): Promise<PopulatedTransaction>;
verify(
req: MinimalForwarder.ForwardRequestStruct,
req: Forwarder.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
@@ -0,0 +1,193 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
import type { FunctionFragment, Result } from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
PayableOverrides,
PopulatedTransaction,
Signer,
utils,
} from "ethers";
export declare namespace ForwarderChainlessDomain {
export type ForwardRequestStruct = {
from: string;
to: string;
value: BigNumberish;
gas: BigNumberish;
nonce: BigNumberish;
data: BytesLike;
chainid: BigNumberish;
};
export type ForwardRequestStructOutput = [
string,
string,
BigNumber,
BigNumber,
BigNumber,
string,
BigNumber
] & {
from: string;
to: string;
value: BigNumber;
gas: BigNumber;
nonce: BigNumber;
data: string;
chainid: BigNumber;
};
}
export interface ForwarderChainlessDomainInterface extends utils.Interface {
functions: {
"execute((address,address,uint256,uint256,uint256,bytes,uint256),bytes)": FunctionFragment;
"getNonce(address)": FunctionFragment;
"verify((address,address,uint256,uint256,uint256,bytes,uint256),bytes)": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic: "execute" | "getNonce" | "verify"
): FunctionFragment;
encodeFunctionData(
functionFragment: "execute",
values: [ForwarderChainlessDomain.ForwardRequestStruct, BytesLike]
): string;
encodeFunctionData(functionFragment: "getNonce", values: [string]): string;
encodeFunctionData(
functionFragment: "verify",
values: [ForwarderChainlessDomain.ForwardRequestStruct, BytesLike]
): string;
decodeFunctionResult(functionFragment: "execute", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "getNonce", data: BytesLike): Result;
decodeFunctionResult(functionFragment: "verify", data: BytesLike): Result;
events: {};
}
export interface ForwarderChainlessDomain extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: ForwarderChainlessDomainInterface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
execute(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getNonce(from: string, overrides?: CallOverrides): Promise<[BigNumber]>;
verify(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<[boolean]>;
};
execute(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
callStatic: {
execute(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<[boolean, string]>;
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<boolean>;
};
filters: {};
estimateGas: {
execute(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
getNonce(from: string, overrides?: CallOverrides): Promise<BigNumber>;
verify(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
};
populateTransaction: {
execute(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
getNonce(
from: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
verify(
req: ForwarderChainlessDomain.ForwardRequestStruct,
signature: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}
@@ -0,0 +1,142 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
import type { FunctionFragment, Result } from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
BaseContract,
BigNumber,
BytesLike,
CallOverrides,
ContractTransaction,
Overrides,
PopulatedTransaction,
Signer,
utils,
} from "ethers";
export interface ForwarderConsumerInterface extends utils.Interface {
functions: {
"caller()": FunctionFragment;
"isTrustedForwarder(address)": FunctionFragment;
"setCaller()": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic: "caller" | "isTrustedForwarder" | "setCaller"
): FunctionFragment;
encodeFunctionData(functionFragment: "caller", values?: undefined): string;
encodeFunctionData(
functionFragment: "isTrustedForwarder",
values: [string]
): string;
encodeFunctionData(functionFragment: "setCaller", values?: undefined): string;
decodeFunctionResult(functionFragment: "caller", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "isTrustedForwarder",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "setCaller", data: BytesLike): Result;
events: {};
}
export interface ForwarderConsumer extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: ForwarderConsumerInterface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
caller(overrides?: CallOverrides): Promise<[string]>;
isTrustedForwarder(
forwarder: string,
overrides?: CallOverrides
): Promise<[boolean]>;
setCaller(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
};
caller(overrides?: CallOverrides): Promise<string>;
isTrustedForwarder(
forwarder: string,
overrides?: CallOverrides
): Promise<boolean>;
setCaller(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
callStatic: {
caller(overrides?: CallOverrides): Promise<string>;
isTrustedForwarder(
forwarder: string,
overrides?: CallOverrides
): Promise<boolean>;
setCaller(overrides?: CallOverrides): Promise<void>;
};
filters: {};
estimateGas: {
caller(overrides?: CallOverrides): Promise<BigNumber>;
isTrustedForwarder(
forwarder: string,
overrides?: CallOverrides
): Promise<BigNumber>;
setCaller(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
};
populateTransaction: {
caller(overrides?: CallOverrides): Promise<PopulatedTransaction>;
isTrustedForwarder(
forwarder: string,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
setCaller(
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
};
}
@@ -0,0 +1,194 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
import type {
FunctionFragment,
Result,
EventFragment,
} from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
PayableOverrides,
PopulatedTransaction,
Signer,
utils,
} from "ethers";
export interface IClaimableERC1155Interface extends utils.Interface {
functions: {
"claim(address,uint256,uint256)": FunctionFragment;
"verifyClaim(address,uint256,uint256)": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic: "claim" | "verifyClaim"
): FunctionFragment;
encodeFunctionData(
functionFragment: "claim",
values: [string, BigNumberish, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "verifyClaim",
values: [string, BigNumberish, BigNumberish]
): string;
decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "verifyClaim",
data: BytesLike
): Result;
events: {
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
}
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
tokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface IClaimableERC1155 extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: IClaimableERC1155Interface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
claim(
_receiver: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
verifyClaim(
_claimer: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<[void]>;
};
claim(
_receiver: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
verifyClaim(
_claimer: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
callStatic: {
claim(
_receiver: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
verifyClaim(
_claimer: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
};
filters: {
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
tokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
};
estimateGas: {
claim(
_receiver: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
verifyClaim(
_claimer: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
};
populateTransaction: {
claim(
_receiver: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
verifyClaim(
_claimer: string,
_tokenId: BigNumberish,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}
@@ -0,0 +1,184 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
TypedEventFilter,
TypedEvent,
TypedListener,
OnEvent,
} from "./common";
import type {
FunctionFragment,
Result,
EventFragment,
} from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
BaseContract,
BigNumber,
BigNumberish,
BytesLike,
CallOverrides,
ContractTransaction,
PayableOverrides,
PopulatedTransaction,
Signer,
utils,
} from "ethers";
export interface IClaimableERC721Interface extends utils.Interface {
functions: {
"claim(address,uint256)": FunctionFragment;
"verifyClaim(address,uint256)": FunctionFragment;
};
getFunction(
nameOrSignatureOrTopic: "claim" | "verifyClaim"
): FunctionFragment;
encodeFunctionData(
functionFragment: "claim",
values: [string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "verifyClaim",
values: [string, BigNumberish]
): string;
decodeFunctionResult(functionFragment: "claim", data: BytesLike): Result;
decodeFunctionResult(
functionFragment: "verifyClaim",
data: BytesLike
): Result;
events: {
"TokensClaimed(address,address,uint256,uint256)": EventFragment;
};
getEvent(nameOrSignatureOrTopic: "TokensClaimed"): EventFragment;
}
export interface TokensClaimedEventObject {
claimer: string;
receiver: string;
startTokenId: BigNumber;
quantityClaimed: BigNumber;
}
export type TokensClaimedEvent = TypedEvent<
[string, string, BigNumber, BigNumber],
TokensClaimedEventObject
>;
export type TokensClaimedEventFilter = TypedEventFilter<TokensClaimedEvent>;
export interface IClaimableERC721 extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
interface: IClaimableERC721Interface;
queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;
listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;
functions: {
claim(
_receiver: string,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
verifyClaim(
_claimer: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<[void]>;
};
claim(
_receiver: string,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<ContractTransaction>;
verifyClaim(
_claimer: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
callStatic: {
claim(
_receiver: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
verifyClaim(
_claimer: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<void>;
};
filters: {
"TokensClaimed(address,address,uint256,uint256)"(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
TokensClaimed(
claimer?: string | null,
receiver?: string | null,
startTokenId?: BigNumberish | null,
quantityClaimed?: null
): TokensClaimedEventFilter;
};
estimateGas: {
claim(
_receiver: string,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<BigNumber>;
verifyClaim(
_claimer: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<BigNumber>;
};
populateTransaction: {
claim(
_receiver: string,
_quantity: BigNumberish,
overrides?: PayableOverrides & { from?: string | Promise<string> }
): Promise<PopulatedTransaction>;
verifyClaim(
_claimer: string,
_quantity: BigNumberish,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}
+7 -2
View File
@@ -68,7 +68,7 @@ export interface PackInterface extends utils.Interface {
"grantRole(bytes32,address)": FunctionFragment;
"hasRole(bytes32,address)": FunctionFragment;
"hasRoleWithSwitch(bytes32,address)": FunctionFragment;
"initialize(address,string,string,string,address,uint256)": FunctionFragment;
"initialize(address,string,string,string,address[],address,uint256)": FunctionFragment;
"isApprovedForAll(address,address)": FunctionFragment;
"isTrustedForwarder(address)": FunctionFragment;
"multicall(bytes[])": FunctionFragment;
@@ -238,7 +238,7 @@ export interface PackInterface extends utils.Interface {
): string;
encodeFunctionData(
functionFragment: "initialize",
values: [string, string, string, string, string, BigNumberish]
values: [string, string, string, string, string[], string, BigNumberish]
): string;
encodeFunctionData(
functionFragment: "isApprovedForAll",
@@ -808,6 +808,7 @@ export interface Pack extends BaseContract {
_name: string,
_symbol: string,
_contractURI: string,
_trustedForwarders: string[],
_royaltyRecipient: string,
_royaltyBps: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -1061,6 +1062,7 @@ export interface Pack extends BaseContract {
_name: string,
_symbol: string,
_contractURI: string,
_trustedForwarders: string[],
_royaltyRecipient: string,
_royaltyBps: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -1321,6 +1323,7 @@ export interface Pack extends BaseContract {
_name: string,
_symbol: string,
_contractURI: string,
_trustedForwarders: string[],
_royaltyRecipient: string,
_royaltyBps: BigNumberish,
overrides?: CallOverrides
@@ -1719,6 +1722,7 @@ export interface Pack extends BaseContract {
_name: string,
_symbol: string,
_contractURI: string,
_trustedForwarders: string[],
_royaltyRecipient: string,
_royaltyBps: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
@@ -1973,6 +1977,7 @@ export interface Pack extends BaseContract {
_name: string,
_symbol: string,
_contractURI: string,
_trustedForwarders: string[],
_royaltyRecipient: string,
_royaltyBps: BigNumberish,
overrides?: Overrides & { from?: string | Promise<string> }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,119 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
ForwarderConsumer,
ForwarderConsumerInterface,
} from "../ForwarderConsumer";
import type { Provider, TransactionRequest } from "@ethersproject/providers";
import { Signer, utils, Contract, ContractFactory, Overrides } from "ethers";
const _abi = [
{
inputs: [
{
internalType: "address",
name: "trustedForwarder",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "caller",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "forwarder",
type: "address",
},
],
name: "isTrustedForwarder",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "setCaller",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
];
const _bytecode =
"0x60a060405234801561001057600080fd5b5060405161024338038061024383398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516101b2610091600039600081816060015261010b01526101b26000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063013c5f3914610046578063572b6c0514610050578063fc9c8d39146100a5575b600080fd5b61004e6100d0565b005b61009061005e36600461014c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b60405190151581526020015b60405180910390f35b6000546100b8906001600160a01b031681565b6040516001600160a01b03909116815260200161009c565b6100d8610107565b6000805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316331415610147575060131936013560601c90565b503390565b60006020828403121561015e57600080fd5b81356001600160a01b038116811461017557600080fd5b939250505056fea26469706673582212203033bcb03d6adbf03a6c43b3ca4d4fb9215d10897a78f3dd600cb3516d0f953464736f6c634300080c0033";
type ForwarderConsumerConstructorParams =
| [signer?: Signer]
| ConstructorParameters<typeof ContractFactory>;
const isSuperArgs = (
xs: ForwarderConsumerConstructorParams
): xs is ConstructorParameters<typeof ContractFactory> => xs.length > 1;
export class ForwarderConsumer__factory extends ContractFactory {
constructor(...args: ForwarderConsumerConstructorParams) {
if (isSuperArgs(args)) {
super(...args);
} else {
super(_abi, _bytecode, args[0]);
}
}
override deploy(
trustedForwarder: string,
overrides?: Overrides & { from?: string | Promise<string> }
): Promise<ForwarderConsumer> {
return super.deploy(
trustedForwarder,
overrides || {}
) as Promise<ForwarderConsumer>;
}
override getDeployTransaction(
trustedForwarder: string,
overrides?: Overrides & { from?: string | Promise<string> }
): TransactionRequest {
return super.getDeployTransaction(trustedForwarder, overrides || {});
}
override attach(address: string): ForwarderConsumer {
return super.attach(address) as ForwarderConsumer;
}
override connect(signer: Signer): ForwarderConsumer__factory {
return super.connect(signer) as ForwarderConsumer__factory;
}
static readonly bytecode = _bytecode;
static readonly abi = _abi;
static createInterface(): ForwarderConsumerInterface {
return new utils.Interface(_abi) as ForwarderConsumerInterface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): ForwarderConsumer {
return new Contract(address, _abi, signerOrProvider) as ForwarderConsumer;
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,104 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
IClaimableERC1155,
IClaimableERC1155Interface,
} from "../IClaimableERC1155";
import type { Provider } from "@ethersproject/providers";
import { Contract, Signer, utils } from "ethers";
const _abi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "claimer",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "receiver",
type: "address",
},
{
indexed: true,
internalType: "uint256",
name: "tokenId",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "quantityClaimed",
type: "uint256",
},
],
name: "TokensClaimed",
type: "event",
},
{
inputs: [
{
internalType: "address",
name: "_receiver",
type: "address",
},
{
internalType: "uint256",
name: "_tokenId",
type: "uint256",
},
{
internalType: "uint256",
name: "_quantity",
type: "uint256",
},
],
name: "claim",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_claimer",
type: "address",
},
{
internalType: "uint256",
name: "_tokenId",
type: "uint256",
},
{
internalType: "uint256",
name: "_quantity",
type: "uint256",
},
],
name: "verifyClaim",
outputs: [],
stateMutability: "view",
type: "function",
},
];
export class IClaimableERC1155__factory {
static readonly abi = _abi;
static createInterface(): IClaimableERC1155Interface {
return new utils.Interface(_abi) as IClaimableERC1155Interface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): IClaimableERC1155 {
return new Contract(address, _abi, signerOrProvider) as IClaimableERC1155;
}
}
@@ -0,0 +1,94 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
IClaimableERC721,
IClaimableERC721Interface,
} from "../IClaimableERC721";
import type { Provider } from "@ethersproject/providers";
import { Contract, Signer, utils } from "ethers";
const _abi = [
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "claimer",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "receiver",
type: "address",
},
{
indexed: true,
internalType: "uint256",
name: "startTokenId",
type: "uint256",
},
{
indexed: false,
internalType: "uint256",
name: "quantityClaimed",
type: "uint256",
},
],
name: "TokensClaimed",
type: "event",
},
{
inputs: [
{
internalType: "address",
name: "_receiver",
type: "address",
},
{
internalType: "uint256",
name: "_quantity",
type: "uint256",
},
],
name: "claim",
outputs: [],
stateMutability: "payable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "_claimer",
type: "address",
},
{
internalType: "uint256",
name: "_quantity",
type: "uint256",
},
],
name: "verifyClaim",
outputs: [],
stateMutability: "view",
type: "function",
},
];
export class IClaimableERC721__factory {
static readonly abi = _abi;
static createInterface(): IClaimableERC721Interface {
return new utils.Interface(_abi) as IClaimableERC721Interface;
}
static connect(
address: string,
signerOrProvider: Signer | Provider
): IClaimableERC721 {
return new Contract(address, _abi, signerOrProvider) as IClaimableERC721;
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -237,7 +237,7 @@ const _abi = [
];
const _bytecode =
"0x60a060405234801561001057600080fd5b5060405161080a38038061080a83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610782610088600039600050506107826000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806361195e941161005b57806361195e9414610101578063bc197c8114610121578063d0d2fe2514610140578063f23a6e611461016e57600080fd5b806301ffc9a714610082578063150b7a02146100aa5780631da799c9146100e1575b600080fd5b61009561009036600461031a565b61018d565b60405190151581526020015b60405180910390f35b6100c86100b836600461041e565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016100a1565b6100f46100ef366004610486565b6101c4565b6040516100a191906104be565b61011461010f366004610514565b610275565b6040516100a1919061052d565b6100c861012f366004610602565b63bc197c8160e01b95945050505050565b61016061014e366004610514565b60009081526020819052604090205490565b6040519081526020016100a1565b6100c861017c3660046106ac565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b14806101be57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6101f0604080516080810190915260008082526020820190815260200160008152602001600081525090565b600083815260208181526040808320858452600290810183529281902081516080810190925280546001600160a01b038116835291939092840191600160a01b900460ff1690811115610245576102456104a8565b6002811115610256576102566104a8565b8152600182015460208201526002909101546040909101529392505050565b600081815260208190526040902060010180546060919061029590610711565b80601f01602080910402602001604051908101604052809291908181526020018280546102c190610711565b801561030e5780601f106102e35761010080835404028352916020019161030e565b820191906000526020600020905b8154815290600101906020018083116102f157829003601f168201915b50505050509050919050565b60006020828403121561032c57600080fd5b81356001600160e01b03198116811461034457600080fd5b9392505050565b80356001600160a01b038116811461036257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156103a6576103a6610367565b604052919050565b600082601f8301126103bf57600080fd5b813567ffffffffffffffff8111156103d9576103d9610367565b6103ec601f8201601f191660200161037d565b81815284602083860101111561040157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561043457600080fd5b61043d8561034b565b935061044b6020860161034b565b925060408501359150606085013567ffffffffffffffff81111561046e57600080fd5b61047a878288016103ae565b91505092959194509250565b6000806040838503121561049957600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b81516001600160a01b0316815260208201516080820190600381106104f357634e487b7160e01b600052602160045260246000fd5b80602084015250604083015160408301526060830151606083015292915050565b60006020828403121561052657600080fd5b5035919050565b600060208083528351808285015260005b8181101561055a5785810183015185820160400152820161053e565b8181111561056c576000604083870101525b50601f01601f1916929092016040019392505050565b600082601f83011261059357600080fd5b8135602067ffffffffffffffff8211156105af576105af610367565b8160051b6105be82820161037d565b92835284810182019282810190878511156105d857600080fd5b83870192505b848310156105f7578235825291830191908301906105de565b979650505050505050565b600080600080600060a0868803121561061a57600080fd5b6106238661034b565b94506106316020870161034b565b9350604086013567ffffffffffffffff8082111561064e57600080fd5b61065a89838a01610582565b9450606088013591508082111561067057600080fd5b61067c89838a01610582565b9350608088013591508082111561069257600080fd5b5061069f888289016103ae565b9150509295509295909350565b600080600080600060a086880312156106c457600080fd5b6106cd8661034b565b94506106db6020870161034b565b93506040860135925060608601359150608086013567ffffffffffffffff81111561070557600080fd5b61069f888289016103ae565b600181811c9082168061072557607f821691505b6020821081141561074657634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122063ab22b3a48b1c53655cbbcd318d8135a52905b628edc24f4e92b2d632f6938b64736f6c634300080c0033";
"0x60a060405234801561001057600080fd5b5060405161080a38038061080a83398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610782610088600039600050506107826000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c806361195e941161005b57806361195e9414610101578063bc197c8114610121578063d0d2fe2514610140578063f23a6e611461016e57600080fd5b806301ffc9a714610082578063150b7a02146100aa5780631da799c9146100e1575b600080fd5b61009561009036600461031a565b61018d565b60405190151581526020015b60405180910390f35b6100c86100b836600461041e565b630a85bd0160e11b949350505050565b6040516001600160e01b031990911681526020016100a1565b6100f46100ef366004610486565b6101c4565b6040516100a191906104be565b61011461010f366004610514565b610275565b6040516100a1919061052d565b6100c861012f366004610602565b63bc197c8160e01b95945050505050565b61016061014e366004610514565b60009081526020819052604090205490565b6040519081526020016100a1565b6100c861017c3660046106ac565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b14806101be57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6101f0604080516080810190915260008082526020820190815260200160008152602001600081525090565b600083815260208181526040808320858452600290810183529281902081516080810190925280546001600160a01b038116835291939092840191600160a01b900460ff1690811115610245576102456104a8565b6002811115610256576102566104a8565b8152600182015460208201526002909101546040909101529392505050565b600081815260208190526040902060010180546060919061029590610711565b80601f01602080910402602001604051908101604052809291908181526020018280546102c190610711565b801561030e5780601f106102e35761010080835404028352916020019161030e565b820191906000526020600020905b8154815290600101906020018083116102f157829003601f168201915b50505050509050919050565b60006020828403121561032c57600080fd5b81356001600160e01b03198116811461034457600080fd5b9392505050565b80356001600160a01b038116811461036257600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156103a6576103a6610367565b604052919050565b600082601f8301126103bf57600080fd5b813567ffffffffffffffff8111156103d9576103d9610367565b6103ec601f8201601f191660200161037d565b81815284602083860101111561040157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561043457600080fd5b61043d8561034b565b935061044b6020860161034b565b925060408501359150606085013567ffffffffffffffff81111561046e57600080fd5b61047a878288016103ae565b91505092959194509250565b6000806040838503121561049957600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b81516001600160a01b0316815260208201516080820190600381106104f357634e487b7160e01b600052602160045260246000fd5b80602084015250604083015160408301526060830151606083015292915050565b60006020828403121561052657600080fd5b5035919050565b600060208083528351808285015260005b8181101561055a5785810183015185820160400152820161053e565b8181111561056c576000604083870101525b50601f01601f1916929092016040019392505050565b600082601f83011261059357600080fd5b8135602067ffffffffffffffff8211156105af576105af610367565b8160051b6105be82820161037d565b92835284810182019282810190878511156105d857600080fd5b83870192505b848310156105f7578235825291830191908301906105de565b979650505050505050565b600080600080600060a0868803121561061a57600080fd5b6106238661034b565b94506106316020870161034b565b9350604086013567ffffffffffffffff8082111561064e57600080fd5b61065a89838a01610582565b9450606088013591508082111561067057600080fd5b61067c89838a01610582565b9350608088013591508082111561069257600080fd5b5061069f888289016103ae565b9150509295509295909350565b600080600080600060a086880312156106c457600080fd5b6106cd8661034b565b94506106db6020870161034b565b93506040860135925060608601359150608086013567ffffffffffffffff81111561070557600080fd5b61069f888289016103ae565b600181811c9082168061072557607f821691505b6020821081141561074657634e487b7160e01b600052602260045260246000fd5b5091905056fea26469706673582212203e53d067cb1c4843b363a71f982b383290f25ba6a9b7fa35ee94c898e9e2cd9664736f6c634300080c0033";
type TokenStoreConstructorParams =
| [signer?: Signer]
@@ -43,12 +43,16 @@ export { ERC721LazyMint__factory } from "./ERC721LazyMint__factory";
export { ERC721Multiwrap__factory } from "./ERC721Multiwrap__factory";
export { ERC721SignatureMint__factory } from "./ERC721SignatureMint__factory";
export { Forwarder__factory } from "./Forwarder__factory";
export { ForwarderChainlessDomain__factory } from "./ForwarderChainlessDomain__factory";
export { ForwarderConsumer__factory } from "./ForwarderConsumer__factory";
export { ForwarderEOAOnly__factory } from "./ForwarderEOAOnly__factory";
export { IAppURI__factory } from "./IAppURI__factory";
export { IBurnableERC1155__factory } from "./IBurnableERC1155__factory";
export { IBurnableERC20__factory } from "./IBurnableERC20__factory";
export { IBurnableERC721__factory } from "./IBurnableERC721__factory";
export { IClaimConditionsSinglePhase__factory } from "./IClaimConditionsSinglePhase__factory";
export { IClaimableERC1155__factory } from "./IClaimableERC1155__factory";
export { IClaimableERC721__factory } from "./IClaimableERC721__factory";
export { IContractDeployer__factory } from "./IContractDeployer__factory";
export { IContractFactory__factory } from "./IContractFactory__factory";
export { IContractMetadata__factory } from "./IContractMetadata__factory";
+8
View File
@@ -43,12 +43,16 @@ export type { ERC721LazyMint } from "./ERC721LazyMint";
export type { ERC721Multiwrap } from "./ERC721Multiwrap";
export type { ERC721SignatureMint } from "./ERC721SignatureMint";
export type { Forwarder } from "./Forwarder";
export type { ForwarderChainlessDomain } from "./ForwarderChainlessDomain";
export type { ForwarderConsumer } from "./ForwarderConsumer";
export type { ForwarderEOAOnly } from "./ForwarderEOAOnly";
export type { IAppURI } from "./IAppURI";
export type { IBurnableERC1155 } from "./IBurnableERC1155";
export type { IBurnableERC20 } from "./IBurnableERC20";
export type { IBurnableERC721 } from "./IBurnableERC721";
export type { IClaimConditionsSinglePhase } from "./IClaimConditionsSinglePhase";
export type { IClaimableERC1155 } from "./IClaimableERC1155";
export type { IClaimableERC721 } from "./IClaimableERC721";
export type { IContractDeployer } from "./IContractDeployer";
export type { IContractFactory } from "./IContractFactory";
export type { IContractMetadata } from "./IContractMetadata";
@@ -181,11 +185,15 @@ export { ERC721LazyMint__factory } from "./factories/ERC721LazyMint__factory";
export { ERC721Multiwrap__factory } from "./factories/ERC721Multiwrap__factory";
export { ERC721SignatureMint__factory } from "./factories/ERC721SignatureMint__factory";
export { Forwarder__factory } from "./factories/Forwarder__factory";
export { ForwarderChainlessDomain__factory } from "./factories/ForwarderChainlessDomain__factory";
export { ForwarderConsumer__factory } from "./factories/ForwarderConsumer__factory";
export { ForwarderEOAOnly__factory } from "./factories/ForwarderEOAOnly__factory";
export { IAppURI__factory } from "./factories/IAppURI__factory";
export { IBurnableERC1155__factory } from "./factories/IBurnableERC1155__factory";
export { IBurnableERC20__factory } from "./factories/IBurnableERC20__factory";
export { IBurnableERC721__factory } from "./factories/IBurnableERC721__factory";
export { IClaimableERC1155__factory } from "./factories/IClaimableERC1155__factory";
export { IClaimableERC721__factory } from "./factories/IClaimableERC721__factory";
export { IClaimConditionsSinglePhase__factory } from "./factories/IClaimConditionsSinglePhase__factory";
export { IContractDeployer__factory } from "./factories/IContractDeployer__factory";
export { IContractFactory__factory } from "./factories/IContractFactory__factory";
@@ -1,5 +1,11 @@
# eslint-config-thirdweb
## 0.1.4
### Patch Changes
- [#106](https://github.com/thirdweb-dev/js/pull/106) [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe) Thanks [@jnsdls](https://github.com/jnsdls)! - add sane eslint warns & errors
## 0.1.3
### Patch Changes
+43 -1
View File
@@ -1,7 +1,49 @@
module.exports = {
extends: ["next", "turbo", "prettier"],
plugins: ["@typescript-eslint"],
rules: {
"@next/next/no-html-link-for-pages": "off",
"react/jsx-key": "off",
//typescript rules
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-parameter-properties": "error",
"@typescript-eslint/no-unused-vars": "warn",
// import rules
"import/first": "error",
"import/newline-after-import": "error",
"import/no-cycle": "warn",
"import/no-useless-path-segments": "error",
//eslint
curly: "error",
eqeqeq: "error",
"no-implicit-coercion": ["error", { boolean: false }],
// has false positives
"no-shadow": "off",
// replaced with this
"@typescript-eslint/no-shadow": "error",
"no-unused-expressions": "error",
"no-useless-computed-key": "error",
// no restricted imports
"@typescript-eslint/no-restricted-imports": [
"error",
{
paths: [
{
name: "@thirdweb-dev/contracts-js",
message:
"Please only import types directly from @thirdweb-dev/contracts-js",
allowTypeImports: true,
},
],
},
],
},
};
+3 -1
View File
@@ -1,9 +1,11 @@
{
"name": "eslint-config-thirdweb",
"version": "0.1.3",
"version": "0.1.4",
"main": "index.js",
"license": "Apache-2.0",
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"eslint-config-next": "^12.0.8",
"eslint-config-prettier": "^8.3.0",
"eslint-config-turbo": "latest",
+156
View File
@@ -1,5 +1,161 @@
# @thirdweb-dev/react
## 3.0.7
### Patch Changes
- [#197](https://github.com/thirdweb-dev/js/pull/197) [`f4f05bd`](https://github.com/thirdweb-dev/js/commit/f4f05bd9a4ec98e9abc6716006353f330b7be055) Thanks [@jnsdls](https://github.com/jnsdls)! - make it obvious when the <Web3Button /> will trigger a network switch
- Updated dependencies [[`5f5ab01`](https://github.com/thirdweb-dev/js/commit/5f5ab015e1dd3c471d6affe995ef36ec88932b3c), [`5f5ab01`](https://github.com/thirdweb-dev/js/commit/5f5ab015e1dd3c471d6affe995ef36ec88932b3c)]:
- @thirdweb-dev/sdk@3.0.7
- @thirdweb-dev/solana@0.2.15
## 3.0.6
### Patch Changes
- [#179](https://github.com/thirdweb-dev/js/pull/179) [`63258bc`](https://github.com/thirdweb-dev/js/commit/63258bc9c3443db7d12fc1dc6fbd483926c92d3e) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Expose simple provider and useSDK hooks for Solana
- Updated dependencies [[`a80fc97`](https://github.com/thirdweb-dev/js/commit/a80fc97b6a1e72ed46a400b4b602e180947fb870)]:
- @thirdweb-dev/sdk@3.0.6
- @thirdweb-dev/solana@0.2.14
## 3.0.5
### Patch Changes
- [#167](https://github.com/thirdweb-dev/js/pull/167) [`4169b94`](https://github.com/thirdweb-dev/js/commit/4169b9428f9001b7cad259a4e56fe610316cd191) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Syntax changes for react native support
- [#168](https://github.com/thirdweb-dev/js/pull/168) [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9) Thanks [@jnsdls](https://github.com/jnsdls)! - use internals wherever possible to allow wider usecases with `<ThirdwebSDKProvider>` & add invariants to catch improper use of functionality that requires the full `<ThirdwebProvider` earlier
- [#168](https://github.com/thirdweb-dev/js/pull/168) [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9) Thanks [@jnsdls](https://github.com/jnsdls)! - fix case where `<ConnectWallet />` button would get stuck when user cancels connection
- [#168](https://github.com/thirdweb-dev/js/pull/168) [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9) Thanks [@jnsdls](https://github.com/jnsdls)! - allow passing `className` to `<ConnectWallet />` and `<Web3Button />` for possible style overrides
- Updated dependencies [[`4169b94`](https://github.com/thirdweb-dev/js/commit/4169b9428f9001b7cad259a4e56fe610316cd191), [`3b877ba`](https://github.com/thirdweb-dev/js/commit/3b877ba221acfd85f80b99e1bc382055217f0a39), [`b54f95d`](https://github.com/thirdweb-dev/js/commit/b54f95dc906928ff2f9251748f254a16fe1f2cee), [`f8ab477`](https://github.com/thirdweb-dev/js/commit/f8ab4779bb2d6d66200e1e8fd558e0ac069a2f54), [`772f843`](https://github.com/thirdweb-dev/js/commit/772f8431e3a62d0ded62dae90a43e9a7edd5b1a2), [`a9ec190`](https://github.com/thirdweb-dev/js/commit/a9ec190ff99d2714cef2500d20ea0f3f73f07be3), [`208b038`](https://github.com/thirdweb-dev/js/commit/208b0389a50ea48bbb9600fec60fec2f1671d4b9), [`5345479`](https://github.com/thirdweb-dev/js/commit/534547992243bdd3a77e34ec2b2487b5adab366a)]:
- @thirdweb-dev/sdk@3.0.5
## 3.0.4
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.0.4
## 3.0.3
### Patch Changes
- [#143](https://github.com/thirdweb-dev/js/pull/143) [`51dde28`](https://github.com/thirdweb-dev/js/commit/51dde28224209f1b8b26f436c204a5e702281564) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix using external signers with ThirdwebSDKProvider
- Updated dependencies [[`51dde28`](https://github.com/thirdweb-dev/js/commit/51dde28224209f1b8b26f436c204a5e702281564), [`9d74a43`](https://github.com/thirdweb-dev/js/commit/9d74a43aac21448beba63ba4e2637945965a3634), [`b234c58`](https://github.com/thirdweb-dev/js/commit/b234c58d44d8322e44b2d2ba87ad4ec7d699e961)]:
- @thirdweb-dev/sdk@3.0.3
## 3.0.2
### Patch Changes
- Updated dependencies [[`42c79e9`](https://github.com/thirdweb-dev/js/commit/42c79e93dc958ca46a55d705aeea44ffdbbcc5f6), [`fe8751e`](https://github.com/thirdweb-dev/js/commit/fe8751eeae7ad013b890a8092ddbd091ecbd6708)]:
- @thirdweb-dev/sdk@3.0.2
## 3.0.1
### Patch Changes
- Updated dependencies [[`98dd64a`](https://github.com/thirdweb-dev/js/commit/98dd64a375c302a879aab3c628ecfb84b4dd19da)]:
- @thirdweb-dev/sdk@3.0.1
## 3.0.0
### Major Changes
- [#19](https://github.com/thirdweb-dev/js/pull/19) [`82627ea`](https://github.com/thirdweb-dev/js/commit/82627ea0311f612119d0596ed0f568267a7af16b) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - 3.0.0 update
## _MAJOR VERSION CHANGE_
- 85% reduction in package size!
- Custom contracts are now first class citizens
[Full changelog](https://blog.thirdweb.com/sdk-major-update/)
#### Breaking changes:
1. Hooks now accept custom contracts direclty and handle the logic internally
before
```javascript
const { contract } = useContract(...)
const { data: nfts } = useNFTs(contract?.nft)
const { mutation: claim } = useClaimNFT(contract?.nft)
```
after
```javascript
const { contract } = useContract(...)
// works with any ERC721/ERC1155 contract
const { data: nfts} = useNFTs(contract)
const { mutation: claim } = useClaimNFT(contract)
```
2. Custom contract hooks for reading and writing have been renamed:
before
```javascript
const { contract } = useContract(...)
const { data } = useContractData(contract, "myReadFunction", ...args);
const { mutate: myFunction } = useContractCall(contract, "myWriteFunction");
```
after
```javascript
const { contract } = useContract(...)
const { data } = useContractRead(contract, "myReadFunction", ...args);
const { mutate: myFunction } = useContractWrite(contract, "myWriteFunction");
```
3. Web3Button benefits from the new Extension detection API:
before
```jsx
<Web3Button
contractAddress={...}
action={(contract) => contract.nft?.drop?.claim?.to(...)}
>
Claim
</Web3Button>
```
after
```jsx
<Web3Button
contractAddress={...}
action={(contract) => contract.erc721.claim(...) }
>
Claim
</Web3Button>
```
### Minor Changes
- [#106](https://github.com/thirdweb-dev/js/pull/106) [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe) Thanks [@jnsdls](https://github.com/jnsdls)! - switch all contracts to a new, universal `useContract()` hook
### Patch Changes
- [#109](https://github.com/thirdweb-dev/js/pull/109) [`f7ccc30`](https://github.com/thirdweb-dev/js/commit/f7ccc30f9da9bda8759c66e53bf2efdb4f975bf9) Thanks [@adam-maj](https://github.com/adam-maj)! - Add enabled check to useUser
- [#114](https://github.com/thirdweb-dev/js/pull/114) [`1df2dea`](https://github.com/thirdweb-dev/js/commit/1df2dea18f85f6760040c9000f2eb8aee8a6011b) Thanks [@jnsdls](https://github.com/jnsdls)! - only show deprecation method once & add optimism kovan and arbitrum rinkeby to deprecated networks
- [#91](https://github.com/thirdweb-dev/js/pull/91) [`2adb8ff`](https://github.com/thirdweb-dev/js/commit/2adb8ff6673768a91fa411c2d069245190ad9397) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Add arbitrum and optimism goerli; rename testnets
- Updated dependencies [[`a70b590`](https://github.com/thirdweb-dev/js/commit/a70b590be1efa7c0ad93a724afb24870439558ed), [`a37bc00`](https://github.com/thirdweb-dev/js/commit/a37bc00991bf1a359f5f8aa8e24e2c388dcd99d8), [`b442c97`](https://github.com/thirdweb-dev/js/commit/b442c970808f6cb7457d29542bd826dba711579c), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`2adb8ff`](https://github.com/thirdweb-dev/js/commit/2adb8ff6673768a91fa411c2d069245190ad9397), [`5a5bc36`](https://github.com/thirdweb-dev/js/commit/5a5bc361507bd8707dc12e9000bb9a218221cf61), [`820a519`](https://github.com/thirdweb-dev/js/commit/820a5191b5e7af5aba5e4d1cc90cd895c0dade11), [`0fa6f3f`](https://github.com/thirdweb-dev/js/commit/0fa6f3fcfbd571579baf9d2a0dbeee556ddbd5fe), [`82627ea`](https://github.com/thirdweb-dev/js/commit/82627ea0311f612119d0596ed0f568267a7af16b)]:
- @thirdweb-dev/sdk@3.0.0
## 2.9.7
### Patch Changes
+177 -54
View File
@@ -13,9 +13,17 @@
<p align="center"><strong>Ultimate collection of React hooks for your web3 apps</strong></p>
<br />
<br />
## Installation
You can install this SDK with either `npm` or `yarn`:
The easiest way to get started with the React SDK is to use the CLI:
```sh
npx thirdweb create --app
```
Alternatively, you can install the SDK into your existing project using npm or yarn:
```sh
npm install @thirdweb-dev/react @thirdweb-dev/sdk ethers
@@ -25,21 +33,19 @@ npm install @thirdweb-dev/react @thirdweb-dev/sdk ethers
yarn add @thirdweb-dev/react @thirdweb-dev/sdk ethers
```
## Starter Templates
<br />
We provide template repositories that already have the thirdweb React SDK setup and ready-to-go to help you get started with thirdweb quickly. You can find all the available starter respositories below.
## Getting Started
- Next.js ([typescript](https://github.com/thirdweb-example/next-typescript-starter) / [javascript](https://github.com/thirdweb-example/next-javascript-starter))
- Create React App ([typescript](https://github.com/thirdweb-example/cra-typescript-starter) / [javascript](https://github.com/thirdweb-example/cra-javascript-starter))
- Vite ([typescript](https://github.com/thirdweb-example/vite-typescript-starter) / [javascript](https://github.com/thirdweb-example/vite-javascript-starter))
Our SDK uses a [Provider Pattern](https://flexiple.com/react/provider-pattern-with-react-context-api/); meaning any component within the `ThirdwebProvider` will have access to the SDK. If you use the CLI to initialize your project, this is already set up for you.
## Quick Start
Let's take a look at a typical setup:
**Configure the thirdweb Provider**
<br />
In order to use the hooks offered by the React SDK, you need to first setup a `ThirdwebProvider` for your app which lets you optionally configure your app. You can use this configuration to control what networks you want users to connect to, what types of wallets can connect to your app, and the settings for the [Typescript SDK](https://docs.thirdweb.com/typescript).
### Configure the `ThirdwebProvider`
At the top level of your application, add a `ThirdwebProvider` as follows:
Specify the network your smart contracts are deployed to in the `desiredChainId` prop and wrap your application like so:
```jsx title="App.jsx"
import { ChainId, ThirdwebProvider } from "@thirdweb-dev/react";
@@ -53,79 +59,196 @@ const App = () => {
};
```
Now you'll be able to use all the hooks provided by the React SDK! Let's take a look.
Below are examples of where to set this up in your application:
**Let Users Connect Wallets**
<p>
<a href="https://github.com/thirdweb-example/cra-javascript-starter/blob/main/src/index.js">Create React App</a> •
<a href="https://github.com/thirdweb-example/next-javascript-starter/blob/main/pages/_app.js">Next.js</a> •
<a href="https://github.com/thirdweb-example/vite-javascript-starter/blob/main/src/main.jsx">Vite</a>
</p>
Next, we'll add a button to our app which will let users connect their wallets. For now, we'll make it so that users with MetaMask wallets can connect.
<br />
### Connect to a User's Wallet
Now the provider is set up, we can use all of the hooks and UI components available in the SDK, such as the [ConnectWallet](https://portal.thirdweb.com/sdk/ui-components/connectwalletbutton) component.
Once the user has connected their wallet, all the calls we make to interact with contracts using the SDK will be on behalf of the user.
```jsx title="ConnectMetamaskButton.jsx"
import { useAddress, useDisconnect, useMetamask } from "@thirdweb-dev/react";
import { ConnectWallet, useAddress } from "@thirdweb-dev/react";
export const ConnectMetamaskButtonComponent = () => {
const connectWithMetamask = useMetamask();
export const YourApp = () => {
const address = useAddress();
return (
<div>
{address ? (
<h4>Connected as {address}</h4>
<ConnectWallet />
</div>
);
};
```
The `ConnectWallet` component handles everything for us, including switching networks, accounts, displaying balances and more.
We can then get the connected address using the `useAddress` hook anywhere in the app.
<br/>
### Interact With Contracts
Connect to your smart contract using the [`useContract`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/getting-a-contract#connect-to-a-contract)
hook like so:
```jsx title="pages/index.jsx"
import { useContract } from "@thirdweb-dev/react";
export default function Home() {
const { contract } = useContract("<CONTRACT_ADDRESS>");
// Now you can use the contract in the rest of the component!
}
```
You can then use [`useContractRead`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/using-contracts) and [`useContractWrite`](https://portal.thirdweb.com/sdk/interacting-with-contracts/custom-contracts/using-contracts) to read data and write transactions to the contract.
You pass the `contract` object returned from `useContract` to these hooks as the first parameter and the name of the function (or view/mapping, etc.) on your smart contract as the second parameter. If your function requires parameters, you can pass them as additional arguments.
For example, we can read the `name` of our contract like so:
```jsx title="pages/index.jsx"
import {
useContract,
useContractRead,
useContractWrite,
} from "@thirdweb-dev/react";
export default function Home() {
const { contract } = useContract("<CONTRACT_ADDRESS>");
const { data: name, isLoading: loadingName } = useContractRead(
contract,
"name", // The name of the view/mapping/variable on your contract
);
const { mutate: setName, isLoading: settingName } = useContractWrite(
contract,
"setName", // The name of the function on your contract
);
}
```
<br />
### Using Extensions
Each [extension](https://portal.thirdweb.com/extensions) you implement in your smart contract unlocks new functionality in the SDK.
These hooks make it easy to interact with your smart contracts by implementing the complex logic for you under the hood.
For example, if your smart contract implements [ERC721Supply](https://portal.thirdweb.com/extensions/erc721supply#unlocked-features), you unlock the ability to [view all NFTs](https://portal.thirdweb.com/sdk/interacting-with-contracts/erc721supply#get-all-minted-nfts) on that contract using the SDK; which fetches all of your NFT metadata and the current owner of each NFT in parallel. In the React SDK, that is available using `useNFTs`:
```jsx
import { useContract, useNFTs } from "@thirdweb-dev/react";
export default function Home() {
const { contract } = useContract("<CONTRACT_ADDRESS>");
const { data: nfts, isLoading: isReadingNfts } = useNFTs(contract);
}
```
If we want to mint an NFT and our contract implements [ERC721Mintable](https://portal.thirdweb.com/extensions/erc721mintable#unlocked-features), we can use the [`useMintNFT`](https://portal.thirdweb.com/sdk/interacting-with-contracts/erc721mintable) hook to mint an NFT from the connected wallet; handling all of the logic of uploading and pinning the metadata to IPFS for us behind the scenes.
```jsx
import { useContract, useNFTs, useMintNFT } from "@thirdweb-dev/react";
export default function Home() {
const { contract } = useContract("<CONTRACT_ADDRESS>");
const { data: nfts, isLoading: isReadingNfts } = useNFTs(contract);
const { mutate: mintNFT, isLoading: isMintingNFT } = useMintNFT(contract);
}
```
<br />
### UI Components
The SDK provides many UI components to help you build your application.
For example, we can render each of the NFTs using the [`NFT Media Renderer`](https://portal.thirdweb.com/sdk/ui-components/nft-renderer)
component, making use of the loading state from `useNFTs`:
```jsx title="pages/index.jsx"
import { useContract, useNFTs, ThirdwebNftMedia } from "@thirdweb-dev/react";
export default function Home() {
const { contract } = useContract("<CONTRACT_ADDRESS>");
const { data: nfts, isLoading: isReadingNfts } = useNFTs(contract);
return (
<div>
<h2>My NFTs</h2>
{isReadingNfts ? (
<p>Loading...</p>
) : (
<button onClick={connectWithMetamask}>Connect Metamask Wallet</button>
<div>
{nfts.map((nft) => (
<ThirdwebNftMedia
key={nft.tokenId}
metadata={nft.metadata}
height={200}
/>
))}
</div>
)}
</div>
);
};
}
```
Here, we use the `useMetamask` hook to handle metamask connection. When a user clicks the button, we'll call the `connectWithMetamask` function, which will prompt users to connect their metamask wallet.
The [`Web3Button`](https://portal.thirdweb.com/sdk/ui-components/web3button) component ensures the user has connected their wallet and is currently configured to the same network as your smart contract before calling the function. It also has access to the `contract` directly, allowing you to perform any action on your smart contract when the button is clicked.
**Interact With Contracts**
For example, we can mint an NFT like so:
The thirdweb React SDK also enables you to interact directly with contracts through simple hooks!
```jsx title="pages/index.jsx"
import {
useContract,
useNFTs,
ThirdwebNftMedia,
Web3Button,
} from "@thirdweb-dev/react";
Let's setup a simple component to interact with an NFT Collection contract and get the data of all the NFTs on the contract.
```jsx title="NFTList.jsx"
import { useMintNFT, useNFTCollection, useNFTs } from "@thirdweb-dev/react";
const NFTListComponent = () => {
const address = useAddress();
const nftCollection = useNFTCollection("<NFT-COLLECTION-CONTRACT-ADDRESS>");
const { data: nfts } = useNFTs(nftCollection);
const { mutate: mintNFT } = useMintNFT(nftCollection);
const mint = () => {
mintNFT({
to: address,
metadata: {
name: "Cool NFT",
description: "Minted from react",
},
});
};
const contractAddress = "<CONTRACT_ADDRESS>";
export default function Home() {
const { contract } = useContract(contractAddress);
const { data: nfts, isLoading: isReadingNfts } = useNFTs(contract);
return (
<div>
<button onClick={mint}>Mint</button>
<ul>
{nfts?.map((nft) => (
<li key={nft.metadata.id.toString()}>{nft.metadata.name}</li>
))}
</ul>
{/* ... Existing Display Logic here ... */}
<Web3Button
contractAddress={contractAddress}
action={(contract) =>
contract.erc721.mint({
name: "Hello world!",
image:
// You can use a file or URL here!
"ipfs://QmZbovNXznTHpYn2oqgCFQYP4ZCpKDquenv5rFCX8irseo/0.png",
})
}
>
Mint NFT
</Web3Button>
</div>
);
};
}
```
Here, we get an `NFT Collection` contract instance from the [TypeScript SDK](https://docs.thirdweb.com/typescript). We can then use all the methods on this thirdweb contract SDK instance - here we use the `mintTo` method to mint an NFT on the contract, and we use `useNFTList` to display all the NFTs in the collection on the page.
And that's all for the setup! Just like that, you can setup a `ThirdwebProvider` and use all the hooks of the SDK, allowing you to let users connect wallets, interact with contracts, and more!
<br />
## Advanced Configuration
The `ThirdwebProvider` offers a number of configuration options to control the behavior of the React and Typescript SDK.
These all the configuration options of the `<ThirdwebProvider />`.
These are all the configuration options of the `<ThirdwebProvider />`.
We provide defaults for all of these, but you customize them to suit your needs.
```jsx title="App.jsx"
+46 -11
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "2.9.7",
"version": "3.0.7",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -8,19 +8,28 @@
"types": "dist/thirdweb-dev-react.cjs.d.ts",
"module": "dist/thirdweb-dev-react.esm.js",
"files": [
"dist/**/*",
"patches/**/*"
"dist/",
"solana/"
],
"preconstruct": {
"entrypoints": [
"index.ts",
"solana/index.ts"
]
},
"private": false,
"scripts": {
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"extract-api": "api-extractor run --local",
"clean": "rm -rf dist/",
"generate-docs": "api-extractor run --local && yarn api-documenter markdown -i ./temp -o ./docs && yarn generate-snippets",
"generate:md-docs": "yarn api-documenter markdown -i ./temp -o ./docs",
"generate-snippets": "node ./scripts/generate-snippets.mjs",
"generate-snippets": "node ./scripts/generate-snippets.mjs && node ./scripts/generate-feature-snippets.mjs",
"build": "tsc && preconstruct build",
"e2e": "yarn test-ct",
"test-ct": "playwright test -c playwright-ct.config.ts"
"test-ct": "playwright test -c playwright-ct.config.ts",
"push": "yalc push"
},
"sideEffects:": false,
"devDependencies": {
@@ -31,9 +40,14 @@
"@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",
"@playwright/experimental-ct-react": "1.25.1",
"@playwright/test": "1.25.1",
"@preconstruct/cli": "^2.2.1",
"@solana/wallet-adapter-base": "^0.9.17",
"@solana/wallet-adapter-react": "^0.15.19",
"@solana/wallet-adapter-wallets": "^0.19.0",
"@solana/web3.js": "^1.63.0",
"@thirdweb-dev/sdk": "*",
"@types/color": "^3.0.3",
"@types/mime": "^3.0.1",
"@types/react": "^18.0.5",
@@ -58,9 +72,8 @@
"@gnosis.pm/safe-core-sdk": "2.1.0",
"@gnosis.pm/safe-ethers-adapters": "0.1.0-alpha.9",
"@gnosis.pm/safe-ethers-lib": "1.1.0",
"@react-icons/all-files": "^4.1.0",
"@tanstack/react-query": "^4.0.10",
"@thirdweb-dev/sdk": "*",
"@thirdweb-dev/storage": "*",
"@zag-js/menu": "^0.1.11",
"@zag-js/react": "0.1.16",
"color": "^4.2.3",
@@ -69,11 +82,16 @@
"magic-sdk": "^8.1.1",
"mime": "^3.0.0",
"react-cool-dimensions": "^2.0.7",
"react-icons": "^4.4.0",
"tiny-invariant": "^1.2.0",
"wagmi": "^0.2.28"
},
"peerDependencies": {
"@solana/wallet-adapter-base": "^0.9.17",
"@solana/wallet-adapter-react": "^0.15.19",
"@solana/wallet-adapter-wallets": "^0.19.0",
"@solana/web3.js": "^1.63.0",
"@thirdweb-dev/sdk": "*",
"@thirdweb-dev/solana": "*",
"ethers": ">=5.5.1",
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
@@ -81,5 +99,22 @@
"resolutions": {
"ansi-regex": "^6.0.1",
"typescript": "^4.6.2"
},
"peerDependenciesMeta": {
"@solana/wallet-adapter-base": {
"optional": true
},
"@solana/wallet-adapter-react": {
"optional": true
},
"@solana/wallet-adapter-wallets": {
"optional": true
},
"@solana/web3.js": {
"optional": true
},
"@thirdweb-dev/solana": {
"optional": true
}
}
}
+12 -12
View File
@@ -1,13 +1,13 @@
import type { PlaywrightTestConfig } from '@playwright/experimental-ct-react';
import { devices } from '@playwright/experimental-ct-react';
import type { PlaywrightTestConfig } from "@playwright/experimental-ct-react";
import { devices } from "@playwright/experimental-ct-react";
/**
* See https://playwright.dev/docs/test-configuration.
*/
const config: PlaywrightTestConfig = {
testDir: './',
testDir: "./",
/* The base directory, relative to the config file, for snapshot files created with toMatchSnapshot and toHaveScreenshot. */
snapshotDir: './__snapshots__',
snapshotDir: "./__snapshots__",
/* Maximum time one test can run for. */
timeout: 10 * 1000,
/* Run tests in files in parallel */
@@ -19,11 +19,11 @@ const config: PlaywrightTestConfig = {
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: "on-first-retry",
/* Port to use for Playwright component endpoint. */
ctPort: 3100,
@@ -32,21 +32,21 @@ const config: PlaywrightTestConfig = {
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
name: "chromium",
use: {
...devices['Desktop Chrome'],
...devices["Desktop Chrome"],
},
},
{
name: 'firefox',
name: "firefox",
use: {
...devices['Desktop Firefox'],
...devices["Desktop Firefox"],
},
},
{
name: 'webkit',
name: "webkit",
use: {
...devices['Desktop Safari'],
...devices["Desktop Safari"],
},
},
],
@@ -0,0 +1,165 @@
import {
TSDocParser,
DocExcerpt,
TSDocConfiguration,
TSDocTagSyntaxKind,
TSDocTagDefinition,
} from "@microsoft/tsdoc";
import fs from "fs";
/**
* This is a simplistic solution until we implement proper DocNode rendering APIs.
*/
export class Formatter {
static renderDocNode(docNode) {
let result = "";
if (docNode) {
if (docNode instanceof DocExcerpt) {
result += docNode.content.toString();
}
for (const childNode of docNode.getChildNodes()) {
result += Formatter.renderDocNode(childNode);
}
}
return result;
}
static renderDocNodes(docNodes) {
let result = "";
for (const docNode of docNodes) {
result += Formatter.renderDocNode(docNode);
}
return result;
}
}
const config = new TSDocConfiguration();
const tag = new TSDocTagDefinition({
tagName: "@twfeature",
allowMultiple: true,
syntaxKind: TSDocTagSyntaxKind.BlockTag,
});
config.addTagDefinition(tag);
config.setSupportForTag(tag, true);
const tsdocParser = new TSDocParser(config);
const json = JSON.parse(
fs.readFileSync(`${process.cwd()}/temp/react.api.json`, "utf8"),
);
function languageNameToKey(languageName) {
switch (languageName) {
case "js":
case "jsx":
return "javascript";
case "ts":
case "tsx":
return "tyepscript";
default:
return languageName;
}
}
// Get all the DetectableFeature classes
const classes = json.members[0].members;
const features = {};
function parseExampleTag(docComment) {
const exampleBlocks = docComment._customBlocks.filter(
(b) => b._blockTag._tagName === "@example",
);
const examplesString = Formatter.renderDocNodes(exampleBlocks);
const regex = /```([a-zA-Z]*)\n([\S\s]*?)\n```/g;
let matches;
const examples = {};
while ((matches = regex.exec(examplesString)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (matches.index === regex.lastIndex) {
regex.lastIndex++;
}
examples[languageNameToKey(matches[1])] = matches[2];
}
return examples;
}
function parseTWFeatureTag(docComment) {
const featureBlocks = docComment._customBlocks.filter(
(b) => b._blockTag._tagName === "@twfeature",
);
const featuresString = Formatter.renderDocNodes(featureBlocks);
return featuresString.split(" | ").map((f) =>
f
.trim()
.replace(/\\n/g, "")
.replace("\n\n", "")
.replace(/`/g, "")
.replace(/@twfeature/g, ""),
);
}
const baseDocUrl = "https://docs.thirdweb.com/react/react.";
const extractReferenceLink = (m, kind, contractName) => {
if (kind === "Property") {
return m.excerptTokens
.filter((e) => e.kind === "Reference")
.map((e) => `${baseDocUrl}${e.text.toLowerCase()}`)[0];
}
if (kind === "Method") {
return `${baseDocUrl}${contractName}.${m.name}`.toLowerCase();
}
return `${baseDocUrl}${m.name}`.toLowerCase();
};
const parseMembers = (members, kind, contractName) => {
if (!members) {
return [];
}
members = [members];
const validMembers = members.filter((m) => m.kind === kind);
return validMembers
.map((m) => {
const parserContext = tsdocParser.parseString(m.docComment);
const docComment = parserContext.docComment;
const featureNames = parseTWFeatureTag(docComment);
if (featureNames.length > 0) {
for (const feature of featureNames) {
const examples = parseExampleTag(docComment);
if (Object.keys(examples).length > 0) {
const example = {
name: m.name,
summary: Formatter.renderDocNode(docComment.summarySection),
remarks: docComment.remarksBlock
? Formatter.renderDocNode(docComment.remarksBlock.content)
: null,
examples,
reference: {
javascript: extractReferenceLink(m, kind, contractName),
},
};
features[feature] = features[feature]
? features[feature].concat(example)
: [example];
}
}
}
})
.filter((m) => !!m);
};
classes.forEach((m) => {
parseMembers(m, "Function", m.name);
});
fs.writeFileSync(
`${process.cwd()}/docs/feature_snippets.json`,
JSON.stringify(features, null, 2),
);

Some files were not shown because too many files have changed in this diff Show More