Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
98fc320a86 Version Packages (#614)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-22 21:48:03 -08:00
Joaquim VergesandGitHub 5712650074 [SDK] Handle custom currencies for any chain (#616) 2023-02-23 05:33:00 +00:00
Jonas DanielsandGitHub 1b0bc87efb [sdk] add code cov (#615) 2023-02-23 01:26:53 +00:00
Jonas DanielsandGitHub a3472a1331 [chains] - DX improvements & chain updates (#613) 2023-02-23 00:01:59 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
7c3f050883 Version Packages (#609)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-22 13:59:28 -08:00
8b68f20678 refactor: Release to Publish (#567)
Co-authored-by: Jonas Daniels <[email protected]>
2023-02-22 21:36:03 +00:00
Jonas DanielsandGitHub 3d644fb8cb [react] - add mediarenderer prop (#608) 2023-02-21 10:30:21 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
690ff925c3 Version Packages (#603)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-20 20:13:14 -08:00
Jonas DanielsandGitHub 4fe6797427 clean up remaining workflows (#605) 2023-02-19 02:12:39 +00:00
Jonas DanielsandGitHub f3408d05d8 [sdk] - fix possible crash in StaticJsonRpcBatchProvider (#604) 2023-02-19 01:47:29 +00:00
Jonas Daniels 845e818c66 CI all in one? 2023-02-18 14:55:51 -08:00
Jonas Daniels 5178256e84 try out new ci action 2023-02-18 14:40:23 -08:00
Jonas DanielsandGitHub 66cf1fb5c2 [various] - upgrade dependencies (#601) 2023-02-18 22:10:45 +00:00
Jonas Daniels df792f0b81 make merge queue work 2023-02-18 14:10:16 -08:00
Jonas Daniels ae0f967356 make platform own everything by default 2023-02-18 13:55:33 -08:00
Jonas Daniels 076718112f devrel should not own changeset markdown files 2023-02-18 13:54:00 -08:00
Jonas Daniels 7c9f86cc44 improve codeowners 2023-02-18 13:51:56 -08:00
Jonas DanielsandGitHub 9c90371426 Jd/add codeowners (#602) 2023-02-18 13:49:09 -08:00
128 changed files with 7250 additions and 6716 deletions
+29
View File
@@ -0,0 +1,29 @@
# Order is important; the last matching pattern takes the most precedence.
# Platform team owns everything by default
* @thirdweb-dev/platform
# Devrel owns all markdown files (README etc.)
*.md @thirdweb-dev/devrel
.changeset/
# Shared ownership of the react and react-core packages
packages/react/ @thirdweb-dev/product @thirdweb-dev/platform
packages/react-core/ @thirdweb-dev/product @thirdweb-dev/platform
# Shared ownership of the CLI
packages/cli/ @thirdweb-dev/product @thirdweb-dev/platform
# Chains is owned specifically by jonas for now
packages/chains/ @jnsdls
# .github folder + .changeset + turbo config is owned by joaquim and jonas for now
.github/ @jnsdls @joaquim-verges
.changeset/config.json @jnsdls @joaquim-verges
turbo.json @joaquim-verges @jnsdls
+1 -1
View File
@@ -13,6 +13,6 @@ runs:
- name: Install dependencies
shell: bash
run: yarn install --frozen-lockfile
run: yarn
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1"
-34
View File
@@ -1,34 +0,0 @@
name: CI
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Test
timeout-minutes: 30
runs-on: ubuntu-latest-16
# To use Remote Caching, uncomment the next lines and follow the steps below.
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
uses: ./.github/composite-actions/install
# this already builds anything that changed...
- name: Build & Test
run: yarn test
+117
View File
@@ -0,0 +1,117 @@
name: Build, Lint & Test
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
# trigger on merge group as well (merge queue)
merge_group:
types: [checks_requested]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# To use Remote Caching, uncomment the next lines and follow the steps below.
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
name: Build
runs-on: ubuntu-latest-16
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 25
- name: Install
uses: ./.github/composite-actions/install
- run: yarn build
# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
timeout-minutes: 5
id: cache-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
lint:
name: Lint Packages
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: yarn lint
test:
name: Unit Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: yarn test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./packages/sdk/coverage/evm/lcov.info,./packages/sdk/coverage/solana/lcov.info,
e2e:
name: E2E Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run e2e tests
run: yarn e2e
env:
NODE_OPTIONS: "--max_old_space_size=4096"
-29
View File
@@ -1,29 +0,0 @@
name: Integration tests
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
integration-tests:
timeout-minutes: 30
runs-on: ubuntu-latest-16
steps:
- uses: actions/checkout@v3
- name: Install
uses: ./.github/composite-actions/install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run e2e tests
run: yarn e2e
env:
NODE_OPTIONS: "--max_old_space_size=4096"
-33
View File
@@ -1,33 +0,0 @@
name: Lint
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
timeout-minutes: 15
runs-on: ubuntu-latest
# To use Remote Caching, uncomment the next lines and follow the steps below.
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
uses: ./.github/composite-actions/install
- name: Lint
run: yarn lint
-20
View File
@@ -1,20 +0,0 @@
name: Compressed Size
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest-8
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: preactjs/compressed-size-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
strip-hash: "\\-(\\w{8})(?:\\.esm|\\.cjs)"
minimum-change-threshold: 100
# exclude source maps, node modules and any test related files
exclude: "{**/*.map,**/node_modules/**,**/test/**}"
+2 -2
View File
@@ -8,8 +8,8 @@
<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 href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml">
<img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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"/>
+2 -2
View File
@@ -13,7 +13,7 @@
]
},
"scripts": {
"test": "turbo run test test:evm test:solana",
"test": "turbo run test test:evm test:solana --filter=./packages/*",
"e2e": "turbo run e2e",
"build": "turbo run build --filter=./packages/*",
"build:release": "turbo run build --force --filter=./packages/*",
@@ -41,7 +41,7 @@
"mocha": "^10.2.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"turbo": "^1.4.6",
"turbo": "^1.8.2",
"yalc": "^1.0.0-pre.53"
},
"manypkg": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/auth
## 3.0.6
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
## 3.0.5
### Patch Changes
+2
View File
@@ -5,6 +5,8 @@
</p>
<h1 align="center">thirdweb Auth</h1>
<p align="center">
<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>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.5",
"version": "3.0.6",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"exports": {
@@ -50,9 +50,6 @@
"evm/index.ts",
"solana/index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"devDependencies": {
@@ -138,4 +135,4 @@
"uuid": "^9.0.0",
"zod": "^3.20.2"
}
}
}
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/chains
## 0.1.4
### Patch Changes
- [#613](https://github.com/thirdweb-dev/js/pull/613) [`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9) Thanks [@jnsdls](https://github.com/jnsdls)! - Update Chains
- [#616](https://github.com/thirdweb-dev/js/pull/616) [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - new chains
## 0.1.3
### Patch Changes
- [#608](https://github.com/thirdweb-dev/js/pull/608) [`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains
## 0.1.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
## 0.1.1
### Patch Changes
+24 -4
View File
@@ -5,12 +5,32 @@
</p>
<h1 align="center">thirdweb chains</h1>
<p align="center">
<!-- <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> -->
<!-- <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://www.npmjs.com/package/@thirdweb-dev/chains"><img src="https://img.shields.io/npm/v/@thirdweb-dev/chains?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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 SDK for Browser, Node and Mobile apps</strong></p> -->
<br />
### todo
## Installation
```bash
yarn add @thirdweb-dev/chains
```
## Contributing
### Adding / Overriding Chain Data
Chain data is automatically pulled in from [ethereum-lists/chains](https://github.com/ethereum-lists/chains) on every build.
#### Overriding Chain Data
Chain data can be overridden by running `yarn override-chain` and following the prompts.
#### Adding A New Chain
In cases where a chain is not listed in the [ethereum-lists/chains](https://github.com/ethereum-lists/chains) repo, you can add it manually by running `yarn add-chain` and following the prompts.
> Prefer adding chains to the ethereum-lists/chains repo instead of manually adding them here.
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "Arcology Testnet",
"chain": "Arcology",
"icon": {
"url": "ipfs://QmRD7itMvaZutfBjyA7V9xkMGDtsZiJSagPwd3ijqka8kE",
"width": 288,
"height": 288,
"format": "png"
},
"rpc": [
"https://arcology-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.arcology.network/rpc"
],
"faucets": [],
"nativeCurrency": {
"name": "Arcology Coin",
"symbol": "Acol",
"decimals": 18
},
"infoURL": "https://arcology.network/",
"shortName": "arcology",
"chainId": 118,
"networkId": 118,
"explorers": [
{
"name": "arcology",
"url": "https://testnet.arcology.network/explorer",
"standard": "none"
}
],
"testnet": true,
"slug": "arcology-testnet"
} as const;
+28
View File
@@ -0,0 +1,28 @@
export default {
"name": "BLG Testnet",
"chain": "BLG",
"icon": {
"url": "ipfs://QmUN5j2cre8GHKv52JE8ag88aAnRmuHMGFxePPvKMogisC",
"width": 512,
"height": 512,
"format": "svg"
},
"rpc": [
"https://blg-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.blgchain.com"
],
"faucets": [
"https://faucet.blgchain.com"
],
"nativeCurrency": {
"name": "Blg",
"symbol": "BLG",
"decimals": 18
},
"infoURL": "https://blgchain.com",
"shortName": "blgchain",
"chainId": 12321,
"networkId": 12321,
"testnet": true,
"slug": "blg-testnet"
} as const;
-1
View File
@@ -10,7 +10,6 @@ export default {
"rpc": [
"https://songbird-canary-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://songbird-api.flare.network/ext/C/rpc",
"https://songbird.towolabs.com/ext/C/rpc",
"https://sgb.ftso.com.au/ext/bc/C/rpc",
"https://sgb.lightft.so/rpc",
"https://sgb-rpc.ftso.eu"
+6
View File
@@ -22,6 +22,12 @@ export default {
"standard": "none"
}
],
"icon": {
"url": "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
"height": 512,
"width": 512,
"format": "png"
},
"testnet": false,
"slug": "gather-network"
} as const;
+9 -1
View File
@@ -5,7 +5,9 @@ export default {
"https://gather-testnet-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.gather.network"
],
"faucets": [],
"faucets": [
"https://testnet-faucet.gather.network/"
],
"nativeCurrency": {
"name": "Gather",
"symbol": "GTH",
@@ -23,5 +25,11 @@ export default {
}
],
"testnet": true,
"icon": {
"url": "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
"height": 512,
"width": 512,
"format": "png"
},
"slug": "gather-testnet-network"
} as const;
+34
View File
@@ -0,0 +1,34 @@
export default {
"name": "Hika Network",
"title": "Hika Network Testnet",
"chain": "HIK",
"icon": {
"url": "ipfs://QmW44FPm3CMM2JDs8BQxLNvUtykkUtrGkQkQsUDJSi3Gmp",
"width": 350,
"height": 84,
"format": "png"
},
"rpc": [
"https://hika-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.hika.network/"
],
"faucets": [],
"nativeCurrency": {
"name": "Hik Token",
"symbol": "HIK",
"decimals": 18
},
"infoURL": "https://hika.network/",
"shortName": "hik",
"chainId": 5729,
"networkId": 5729,
"explorers": [
{
"name": "Hika Network Testnet Explorer",
"url": "https://scan-testnet.hika.network",
"standard": "none"
}
],
"testnet": true,
"slug": "hika-network"
} as const;
+27
View File
@@ -0,0 +1,27 @@
export default {
"name": "Graphlinq Blockchain Mainnet",
"chain": "GLQ Blockchain",
"rpc": [
"https://graphlinq-blockchain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://glq-dataseed.graphlinq.io"
],
"faucets": [],
"nativeCurrency": {
"name": "GLQ",
"symbol": "GLQ",
"decimals": 18
},
"infoURL": "https://graphlinq.io",
"shortName": "glq",
"chainId": 614,
"networkId": 614,
"explorers": [
{
"name": "GLQ Explorer",
"url": "https://explorer.graphlinq.io",
"standard": "none"
}
],
"testnet": false,
"slug": "graphlinq-blockchain"
} as const;
+3 -1
View File
@@ -11,7 +11,9 @@ export default {
"https://bear-network-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://brnkc-test.bearnetwork.net"
],
"faucets": [],
"faucets": [
"https://faucet.bearnetwork.net"
],
"nativeCurrency": {
"name": "Bear Network Chain Testnet Token",
"symbol": "tBRNKC",
+7 -2
View File
@@ -24,8 +24,13 @@ export default {
"standard": "none"
},
{
"name": "Canto Cosmos Explorer (BigDipper)",
"url": "https://cosmos.explorer.canto.io",
"name": "Canto Cosmos Explorer",
"url": "https://cosmos-explorers.neobase.one",
"standard": "none"
},
{
"name": "Canto EVM Explorer (Blockscout)",
"url": "https://tuber.build",
"standard": "none"
}
],
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "MARO Blockchain Mainnet",
"chain": "MARO Blockchain",
"icon": {
"url": "ipfs://bafkreig47k53aipns6nu3u5fxpysp7mogzk6zyvatgpbam7yut3yvtuefa",
"width": 160,
"height": 160,
"format": "png"
},
"rpc": [
"https://maro-blockchain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-mainnet.ma.ro"
],
"faucets": [],
"nativeCurrency": {
"name": "MARO",
"symbol": "MARO",
"decimals": 18
},
"infoURL": "https://ma.ro/",
"shortName": "maro",
"chainId": 8848,
"networkId": 8848,
"explorers": [
{
"name": "MARO Scan",
"url": "https://scan.ma.ro/#",
"standard": "none"
}
],
"testnet": false,
"slug": "maro-blockchain"
} as const;
+38
View File
@@ -0,0 +1,38 @@
export default {
"name": "Bitkub Chain",
"chain": "BKC",
"icon": {
"url": "ipfs://QmYFYwyquipwc9gURQGcEd4iAq7pq15chQrJ3zJJe9HuFT",
"width": 1000,
"height": 1000,
"format": "png"
},
"rpc": [
"https://bitkub-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.bitkubchain.io",
"wss://wss.bitkubchain.io"
],
"faucets": [],
"nativeCurrency": {
"name": "Bitkub Coin",
"symbol": "KUB",
"decimals": 18
},
"infoURL": "https://www.bitkubchain.com/",
"shortName": "bkc",
"chainId": 96,
"networkId": 96,
"explorers": [
{
"name": "Bitkub Chain Explorer",
"url": "https://bkcscan.com",
"standard": "none",
"icon": "bkc"
}
],
"redFlags": [
"reusedChainId"
],
"testnet": false,
"slug": "bitkub-chain"
} as const;
+27
View File
@@ -0,0 +1,27 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "Localhost",
chain: "ETH",
rpc: ["http://localhost:8545"],
faucets: [],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
// hard code eth icon for now
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
shortName: "local",
chainId: 1337,
networkId: 1337,
testnet: true,
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 192837465,
icon: {
url: "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
height: 512,
width: 512,
format: "png",
},
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
@@ -0,0 +1,15 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 356256156,
testnet: true,
icon: {
url: "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
height: 512,
width: 512,
format: "png",
},
faucets: ["https://testnet-faucet.gather.network/"],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}"],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}"],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
-153
View File
@@ -1,153 +0,0 @@
{
"1": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"5": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"137": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"80001": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"250": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"4002": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"43114": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}"]
},
"43113": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}"]
},
"10": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"420": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"42161": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"421613": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"56": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"97": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
}
}
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.1",
"version": "0.1.4",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
@@ -18,20 +18,21 @@
"author": "thirdweb eng <[email protected]>",
"devDependencies": {
"axios": "^0.27.2",
"plop": "^3.1.2",
"typescript": "^4.7.4"
},
"preconstruct": {
"entrypoints": [
"index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
"scripts": {
"build": "node ./scripts/generate-package.mjs && tsc && preconstruct build",
"push": "yalc push"
"push": "yalc push",
"plop": "plop",
"add-chain": "plop add-chain",
"override-chain": "plop override-chain"
}
}
@@ -0,0 +1,11 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
{{> namePartial}}
{{> chainPartial}}
{{> shortNamePartial}}
{{> chainIdPartial}}
{{> isTestnetPartial}}
};
@@ -0,0 +1,22 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
{{!-- if we have a name --}}
{{#if name}}
{{> namePartial}}
{{/if}}
{{!-- if we have a chain --}}
{{#if chain}}
{{> chainPartial}}
{{/if}}
{{#if shortName}}
{{> shortNamePartial}}
{{/if}}
{{!-- chainId always exists --}}
{{> chainIdPartial}}
{{#if isTestnet}}
{{> isTestnetPartial}}
{{/if}}
};
+80
View File
@@ -0,0 +1,80 @@
const chainIdPrompt = {
type: "number",
name: "chainId",
message: "Chain ID",
validate: (value) => {
if (value.length === 0) {
return "ChainId is required";
}
if (!/^\d+$/.test(value)) {
return "ChainId must be a number";
}
return true;
},
};
const stringPrompt = (id, title, isRequired) => ({
type: "input",
name: id,
message: title,
validate: (value) => {
if (isRequired && value.length === 0) {
return `${title} is required`;
}
return true;
},
});
const testnetPrompt = {
type: "confirm",
name: "isTestnet",
message: "Is this a testnet?",
};
export default function (
/** @type {import('plop').NodePlopAPI} */
plop,
) {
// add partials
plop.setPartial("chainIdPartial", "chainId: {{chainId}},\n");
plop.setPartial("namePartial", `name: "{{name}}",\n`);
plop.setPartial("chainPartial", `chain: "{{chain}}",\n`);
plop.setPartial("shortNamePartial", `shortName: "{{shortName}}",\n`);
plop.setPartial("isTestnetPartial", `testnet: {{isTestnet}},\n`);
plop.setGenerator("add-chain", {
description: "add a new chain",
prompts: [
chainIdPrompt,
stringPrompt("name", "Name", true),
stringPrompt("chain", "Chain", true),
stringPrompt("shortName", "Short Name", true),
testnetPrompt,
],
actions: [
{
type: "add",
path: "data/additional/{{chainId}}.mjs",
templateFile: "plop-templates/add-chain.hbs",
},
],
});
plop.setGenerator("override-chain", {
description: "add an override for a chain",
prompts: [
chainIdPrompt,
stringPrompt("name", "Name"),
stringPrompt("chain", "Chain"),
stringPrompt("shortName", "Short Name"),
testnetPrompt,
],
actions: [
{
type: "add",
path: "data/overrides/{{chainId}}.mjs",
templateFile: "plop-templates/chain-override.hbs",
},
],
});
}
+32 -31
View File
@@ -1,11 +1,15 @@
// @ts-check
import axios from "axios";
import merge from "deepmerge";
import fs from "fs";
import path from "path";
const combineMerge = (target, source, options) => {
/** @typedef {import("../src/types").Chain} Chain */
const combineMerge = (target, source) => {
let destination = target.slice();
source.forEach((item, index) => {
source.forEach((item) => {
if (target.indexOf(item) === -1) {
destination = [item, ...destination];
}
@@ -15,16 +19,39 @@ const combineMerge = (target, source, options) => {
const chainsDir = "./chains";
/** @typedef {{name: string, chain: string, icon: string, rpc: string[], faucets?: any[], nativeCurrency: {name: string, symbol: string, decimals: number}, infoURL?: string, shortName: string, chainId: number, networkId: number, slip44?: number, ens: {registry: string}, explorers?: {name: string, url: string, standard: string}[] }} Chain */
const chainsJsonUrl = "https://chainid.network/chains.json";
const iconRoute =
"https://raw.githubusercontent.com/ethereum-lists/chains/master/_data/icons";
const overrides = JSON.parse(fs.readFileSync("./overrides.json"));
/** @type {Record<number, Partial<Chain>>} */
let overrides = {};
// get all overides by reading the overrides directory and importing them
const overridesDir = path.join(process.cwd(), "./data/overrides");
const overridesFiles = fs.readdirSync(overridesDir);
for (const file of overridesFiles) {
const override = await import(path.join(overridesDir, file));
// get file name without extension
const chainId = parseInt(file.split(".")[0]);
overrides[chainId] = override.default;
}
// chains from remote src
/** @type {Chain[]} */
let chains = (await axios.get(chainsJsonUrl)).data;
// immediately filter out localhost
chains = chains.filter((c) => c.chainId !== 1337);
// additional chains
// get all additional chains by reading the additional chains directory and importing them
const additionalChainsDir = path.join(process.cwd(), "./data/additional");
const additionalChainsFiles = fs.readdirSync(additionalChainsDir);
for (const file of additionalChainsFiles) {
const additionalChain = await import(path.join(additionalChainsDir, file));
chains.push(additionalChain.default);
}
chains = chains
.filter((c) => c.status !== "deprecated")
@@ -44,32 +71,6 @@ chains = chains
};
});
chains = chains.filter((c) => c.chainId !== 1337);
// inject in localhost
chains.push({
name: "Localhost",
chain: "ETH",
rpc: ["http://localhost:8545"],
faucets: [],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
// hard code eth icon for now
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
shortName: "local",
chainId: 1337,
networkId: 1337,
testnet: true,
});
const imports = [];
const exports = [];
const exportNames = [];
File diff suppressed because one or more lines are too long
+1
View File
@@ -33,6 +33,7 @@ export type Chain = {
testnet: boolean;
slug: string;
slip44?: number;
status?: string;
};
// MinimalChain is a subset of Chain with only the fields that are required / non-optional
+23
View File
@@ -1,5 +1,28 @@
# thirdweb
## 0.9.24
### Patch Changes
- Updated dependencies [[`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/sdk@3.9.4
## 0.9.23
### Patch Changes
- [#567](https://github.com/thirdweb-dev/js/pull/567) [`8b68f20`](https://github.com/thirdweb-dev/js/commit/8b68f206789f478c9a2198ad8c277329583bdc31) Thanks [@shift4id](https://github.com/shift4id)! - `thirdweb release` is deprecated, use `thirdweb publish` instead
- Updated dependencies []:
- @thirdweb-dev/sdk@3.9.3
## 0.9.22
### Patch Changes
- Updated dependencies [[`f3408d0`](https://github.com/thirdweb-dev/js/commit/f3408d05d84ff8418a3f76961367e47565ed32b4), [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/sdk@3.9.2
## 0.9.21
### Patch Changes
+8 -5
View File
@@ -6,6 +6,7 @@
<h1 align="center">thirdweb CLI</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/cli"><img src="https://img.shields.io/npm/v/@thirdweb-dev/cli?color=red&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
@@ -41,10 +42,10 @@ Deploying contracts this way gives you access to:
## Releasing your contract
```shell
npx thirdweb@latest release
npx thirdweb@latest publish
```
Creates an official release of your contract, along with:
Creates an official published contract, along with:
- author attribution
- contract information
@@ -52,9 +53,9 @@ Creates an official release of your contract, along with:
- versioning
- release notes
Creating releases this way gives you shareable URL to let others to deploy your contracts in one click. It lets you manage released versions and get attribution for deployed contracts. Contract releases are registered on-chain (Polygon) and IPFS, for free (gasless).
Publishing contracts this way gives you shareable URL to let others deploy your contracts in one click. It lets you manage published versions and get attribution for deployed contracts. Published contracts are registered on-chain (Polygon) and IPFS, for free (gasless).
Deploying released contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts.
Deploying published contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts.
## Detecting contract extensions
@@ -94,7 +95,7 @@ Clone the repo and run this command after installing the CLI tool:
```bash
$ cd examples/hardhat
$ npx thirdweb@latest release
$ npx thirdweb@latest publish
```
## Local Development
@@ -106,11 +107,13 @@ The simplest way to work on the CLI locally is to:
```bash
git clone https://github.com/thirdweb-dev/js.git
```
2. From the project root run
```bash
yarn && yarn build
```
3. From inside `js/packages/cli` Run the `build:watch` command to compile any changes in real time
```bash
+4 -4
View File
@@ -6,8 +6,8 @@ import { resolve } from "path";
// this creates an app, can take some time that's fine
jest.setTimeout(120_000);
describe("npx thirdweb release", () => {
it("should return release page url", async () => {
describe("npx thirdweb publish", () => {
it("should return publish page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment();
await copyFile(
@@ -16,7 +16,7 @@ describe("npx thirdweb release", () => {
);
const { waitForText, waitForFinish, getExitCode, writeText, getStderr } =
await spawn("node", "./dist/cli/index.js release");
await spawn("node", "./dist/cli/index.js publish");
expect(await exists("BasicContract.sol")).toEqual(true);
@@ -27,7 +27,7 @@ describe("npx thirdweb release", () => {
await waitForFinish();
expect(getStderr().at(-1)).toContain(
"https://thirdweb.com/contracts/release/",
"https://thirdweb.com/contracts/publish/",
);
// the process should exit with code 0
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.9.21",
"version": "0.9.24",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+33 -5
View File
@@ -266,7 +266,7 @@ const main = async () => {
)
.option(
"-n, --name [name]",
"Name of the pre-built or released contract (such as nft-drop)",
"Name of the pre-built or published contract (such as nft-drop)",
)
.option(
"-f, --file [name]",
@@ -278,7 +278,7 @@ const main = async () => {
)
.option(
"-cv, --contract-version [version]",
"Version of the released contract",
"Version of the published contract",
)
.option("--app", "Deploy a web app to decentralized storage")
.option("--contract", "Deploy a smart contract to blockchains")
@@ -291,8 +291,36 @@ const main = async () => {
program
.command("release")
.description("[Deprecated] use 'publish' instead.")
.option("-p, --path <project-path>", "path to project", ".")
.option(
"-f, --file [name]",
"Filter for contract files that contain the file name",
)
.option(
"-cn, --contract-name [name]",
"Filter for contracts that contain this contract name",
)
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
logger.warn(
"'release' is deprecated and will be removed in a future update. Please use 'publish' instead.",
);
const url = await processProject(options, "publish");
info(
`Open this link to publish your contracts: ${chalk.blueBright(
url.toString(),
)}`,
);
open(url.toString());
});
program
.command("publish")
.description(
"Release your protocol so other devs can deploy them and unlock SDKs, Dashboards and Analytics",
"Publish your protocol so other devs can deploy them and unlock SDKs, Dashboards and Analytics",
)
.option("-p, --path <project-path>", "path to project", ".")
.option(
@@ -307,9 +335,9 @@ const main = async () => {
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
const url = await processProject(options, "release");
const url = await processProject(options, "publish");
info(
`Open this link to release your contracts: ${chalk.blueBright(
`Open this link to publish your contracts: ${chalk.blueBright(
url.toString(),
)}`,
);
+1 -1
View File
@@ -13,7 +13,7 @@ import path from "path";
export async function processProject(
options: any,
command: "deploy" | "release",
command: "deploy" | "publish",
) {
// TODO: allow overriding the default storage
const storage = new ThirdwebStorage();
@@ -211,9 +211,9 @@ export async function createContractProject({
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"} publish`),
);
console.log(" Releases your contracts with the thirdweb release flow.");
console.log(" Publishes your contracts with the thirdweb publish flow.");
console.log();
console.log("We suggest that you begin by typing:");
console.log();
@@ -3,7 +3,7 @@ export default function generateDashboardUrl(
version: string | undefined,
): string | undefined {
const splitName = name.split("/");
// Released contract
// Published contract
if (splitName.length > 1) {
return `https://thirdweb.com/dashboard/${splitName[0]}/${splitName[1]}${
version ? `/${version}` : ""
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/pay
## 0.1.1
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
## 0.1.0
### Minor Changes
+3 -3
View File
@@ -5,9 +5,9 @@
</p>
<h1 align="center">thirdweb wallets</h1>
<p align="center">
<!-- <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> -->
<!-- <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://www.npmjs.com/package/@thirdweb-dev/wallets"><img src="https://img.shields.io/npm/v/@thirdweb-dev/wallets?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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 SDK for Browser, Node and Mobile apps</strong></p> -->
+1 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/pay",
"version": "0.1.0",
"version": "0.1.1",
"main": "dist/thirdweb-dev-pay.cjs.js",
"module": "dist/thirdweb-dev-pay.esm.js",
"exports": {
@@ -29,9 +29,6 @@
"index.ts",
"integrations/**"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
+24
View File
@@ -1,5 +1,29 @@
# @thirdweb-dev/react-core
## 3.9.4
### Patch Changes
- Updated dependencies [[`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/chains@0.1.4
## 3.9.3
### Patch Changes
- Updated dependencies [[`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a)]:
- @thirdweb-dev/chains@0.1.3
## 3.9.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
- Updated dependencies [[`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/chains@0.1.2
- @thirdweb-dev/auth@3.0.6
## 3.9.1
### Patch Changes
+2 -2
View File
@@ -5,8 +5,8 @@
</p>
<h1 align="center">thirdweb React Core SDK</h1>
<p align="center">
<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>
<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://www.npmjs.com/package/@thirdweb-dev/react-core"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-core?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.9.1",
"version": "3.9.4",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -33,9 +33,6 @@
"solana/index.ts",
"evm/index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"private": false,
@@ -103,4 +100,4 @@
"optional": true
}
}
}
}
+13 -13
View File
@@ -41,9 +41,9 @@ type AddEthereumChainParameter = {
export type Chain = {
id: number;
name: AddEthereumChainParameter['chainName'];
nativeCurrency?: AddEthereumChainParameter['nativeCurrency'];
rpcUrls: AddEthereumChainParameter['rpcUrls'];
name: AddEthereumChainParameter["chainName"];
nativeCurrency?: AddEthereumChainParameter["nativeCurrency"];
rpcUrls: AddEthereumChainParameter["rpcUrls"];
blockExplorers?: {
name: string;
url: string;
@@ -256,16 +256,16 @@ export type ExecuteAuctionSale = {
export type BuyNowParams<TListingType = ListingType> =
TListingType extends ListingType.Direct
? {
id: BigNumberish;
type: ListingType.Direct;
buyAmount: BigNumberish;
buyForWallet?: WalletAddress;
}
: {
id: BigNumberish;
type: ListingType.Auction;
};
? {
id: BigNumberish;
type: ListingType.Direct;
buyAmount: BigNumberish;
buyForWallet?: WalletAddress;
}
: {
id: BigNumberish;
type: ListingType.Auction;
};
// TOKEN DROP //
+21 -2
View File
@@ -1,3 +1,22 @@
# @thirdweb-dev/react-native-compat
<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 />
</p>
<h1 align="center">thirdweb React Native Compat</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/react-native-compat"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native-compat?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
Shims for Thirdweb in React Native Projects
</p>
<p align="center"><strong>Shims for thirdweb in React Native Projects</strong></p>
<br />
## 👷🚧 Alpha 🚧👷
<br />
## Getting Started
Head over to the [documentation](https://portal.thirdweb.com/react-native) to learn more
+30
View File
@@ -1,5 +1,35 @@
# @thirdweb-dev/react-native
## 0.1.4
### Patch Changes
- Updated dependencies [[`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/chains@0.1.4
- @thirdweb-dev/sdk@3.9.4
- @thirdweb-dev/react-core@3.9.4
## 0.1.3
### Patch Changes
- Updated dependencies [[`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a)]:
- @thirdweb-dev/chains@0.1.3
- @thirdweb-dev/react-core@3.9.3
- @thirdweb-dev/sdk@3.9.3
## 0.1.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
- Updated dependencies [[`f3408d0`](https://github.com/thirdweb-dev/js/commit/f3408d05d84ff8418a3f76961367e47565ed32b4), [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/sdk@3.9.2
- @thirdweb-dev/react-core@3.9.2
- @thirdweb-dev/storage@1.0.10
- @thirdweb-dev/chains@0.1.2
## 0.1.1
### Patch Changes
+2 -2
View File
@@ -5,8 +5,8 @@
</p>
<h1 align="center">thirdweb React Native SDK</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/react-native"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></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://www.npmjs.com/package/@thirdweb-dev/react-native"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.1.1",
"version": "0.1.4",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,13 +1,10 @@
import invariant from "tiny-invariant";
import {
useAccount as useWagmiAccount,
useClient
} from "wagmi";
import { useAccount as useWagmiAccount, useClient } from "wagmi";
/**
* @internal
*/
export function useAccount() {
export function useAccount(): ReturnType<typeof useWagmiAccount> {
const wagmiContext = useClient();
invariant(
wagmiContext,
@@ -1,8 +1,5 @@
import invariant from "tiny-invariant";
import {
useNetwork as useWagmiNetwork,
useClient
} from "wagmi";
import { useNetwork as useWagmiNetwork, useClient } from "wagmi";
/**
* Hook for getting metadata about the network the current wallet is connected to and switching networks
@@ -28,7 +25,7 @@ import {
* @public
*/
export function useNetwork() {
export function useNetwork(): ReturnType<typeof useWagmiNetwork> {
const wagmiContext = useClient();
invariant(
wagmiContext,
+31
View File
@@ -1,5 +1,36 @@
# @thirdweb-dev/react
## 3.9.4
### Patch Changes
- Updated dependencies [[`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/chains@0.1.4
- @thirdweb-dev/react-core@3.9.4
- @thirdweb-dev/wallets@0.2.5
## 3.9.3
### Patch Changes
- [#608](https://github.com/thirdweb-dev/js/pull/608) [`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a) Thanks [@jnsdls](https://github.com/jnsdls)! - `<MediaRenderer />` now accepts an optional mime type prop
- Updated dependencies [[`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a)]:
- @thirdweb-dev/chains@0.1.3
- @thirdweb-dev/react-core@3.9.3
- @thirdweb-dev/wallets@0.2.4
## 3.9.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
- Updated dependencies [[`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/react-core@3.9.2
- @thirdweb-dev/wallets@0.2.3
- @thirdweb-dev/chains@0.1.2
## 3.9.1
### Patch Changes
+90 -84
View File
@@ -6,7 +6,7 @@
<h1 align="center">thirdweb React SDK</h1>
<p align="center">
<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>
<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://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
@@ -309,107 +309,113 @@ const KitchenSinkExample = () => {
## Available hooks
### Main hooks
| Hook | Description |
| --- | --- |
| [`useSDK`](https://portal.thirdweb.com/react/react.usesdk) | Access the instance of the thirdweb SDK created by the ThirdwebProvider. |
| [`useContract`](https://portal.thirdweb.com/react/react.usecontract) | Use this resolve a contract address to a smart contract instance. |
| [`useContractWrite`](https://portal.thirdweb.com/react/react.usecontractwrite) | Use this to get data from a contract read-function call. |
| [`useContractRead`](https://portal.thirdweb.com/react/react.usecontractread) | Use this to get a function to make a write call to your contract. |
| [`useContractEvents`](https://portal.thirdweb.com/react/react.usecontractevents) | Use this to get the contract metadata for a (built-in or custom) contract. |
| Hook | Description |
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
| [`useSDK`](https://portal.thirdweb.com/react/react.usesdk) | Access the instance of the thirdweb SDK created by the ThirdwebProvider. |
| [`useContract`](https://portal.thirdweb.com/react/react.usecontract) | Use this resolve a contract address to a smart contract instance. |
| [`useContractWrite`](https://portal.thirdweb.com/react/react.usecontractwrite) | Use this to get data from a contract read-function call. |
| [`useContractRead`](https://portal.thirdweb.com/react/react.usecontractread) | Use this to get a function to make a write call to your contract. |
| [`useContractEvents`](https://portal.thirdweb.com/react/react.usecontractevents) | Use this to get the contract metadata for a (built-in or custom) contract. |
| [`useContractMetadata`](https://portal.thirdweb.com/react/react.usecontractmetadata) | Use this to get the contract metadata for a (built-in or custom) contract. |
### Wallet connection
| Hook | Description |
| --- | --- |
| [`useAddress`](https://portal.thirdweb.com/react/react.useaddress) | Hook for accessing the address of the connected wallet. |
| [`useMetamask`](https://portal.thirdweb.com/react/react.usemetamask) | Hook for connecting to a Metamask wallet. |
| [`useWalletConnect`](https://portal.thirdweb.com/react/react.usewalletconnect) | Hook for connecting to a mobile wallet with Wallet Connect. |
| [`useCoinbaseWallet`](https://portal.thirdweb.com/react/react.usecoinbasewallet) | Hook for connecting to a Coinbase wallet. |
| [`useMagic`](https://portal.thirdweb.com/react/react.usemagic) | Hook for connecting to an email wallet using magic link. |
| [`useGnosis`](https://portal.thirdweb.com/react/react.usegnosis) | Hook for connecting to a Gnosis Safe. |
| [`useDisconnect`](https://portal.thirdweb.com/react/react.usedisconnect) | Hook for disconnecting the currently connected wallet. |
| Hook | Description |
| -------------------------------------------------------------------------------- | ----------------------------------------------------------- |
| [`useAddress`](https://portal.thirdweb.com/react/react.useaddress) | Hook for accessing the address of the connected wallet. |
| [`useMetamask`](https://portal.thirdweb.com/react/react.usemetamask) | Hook for connecting to a Metamask wallet. |
| [`useWalletConnect`](https://portal.thirdweb.com/react/react.usewalletconnect) | Hook for connecting to a mobile wallet with Wallet Connect. |
| [`useCoinbaseWallet`](https://portal.thirdweb.com/react/react.usecoinbasewallet) | Hook for connecting to a Coinbase wallet. |
| [`useMagic`](https://portal.thirdweb.com/react/react.usemagic) | Hook for connecting to an email wallet using magic link. |
| [`useGnosis`](https://portal.thirdweb.com/react/react.usegnosis) | Hook for connecting to a Gnosis Safe. |
| [`useDisconnect`](https://portal.thirdweb.com/react/react.usedisconnect) | Hook for disconnecting the currently connected wallet. |
### Network connection
| Hook | Description |
| --- | --- |
| [`useChainId`](https://portal.thirdweb.com/react/react.usechainid) | Hook for accessing the chain ID of the network the current wallet is connected to |
| [`useNetwork`](https://portal.thirdweb.com/react/react.usenetwork) | Hook for getting metadata about the network the current wallet is connected to and switching networks. |
| Hook | Description |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| [`useChainId`](https://portal.thirdweb.com/react/react.usechainid) | Hook for accessing the chain ID of the network the current wallet is connected to |
| [`useNetwork`](https://portal.thirdweb.com/react/react.usenetwork) | Hook for getting metadata about the network the current wallet is connected to and switching networks. |
| [`useNetworkMismatch`](https://portal.thirdweb.com/react/react.usenetworkmismatch) | Hook for checking whether the connected wallet is on the correct network specified by the desiredChainId passed to the <ThirdwebProvider />. |
### NFT
| Hook | Description |
| --- | --- |
| [`useNFT`](https://portal.thirdweb.com/react/react.usenft) | Use this to get an individual NFT token of your NFTContract. |
| [`useNFTs`](https://portal.thirdweb.com/react/react.usenfts) | Use this to get a list of NFT tokens of your NFTContract. |
| [`useTotalCirculatingSupply`](https://portal.thirdweb.com/react/react.usetotalcirculatingsupply) | Use this to get a the total (minted) supply of your NFTContract. |
| [`useOwnedNFTs`](https://portal.thirdweb.com/react/react.useownednfts) | Use this to get a the owned NFTs for a specific Erc721OrErc1155 and wallet address. |
| [`useNFTBalance`](https://portal.thirdweb.com/react/react.usenftbalance) | Use this to get a the total balance of a NFTContract and wallet address. |
| [`useTotalCount`](https://portal.thirdweb.com/react/react.usetotalcount) | Use this to get the total count of NFT tokens of your NFTContract. |
| [`useMintNFT`](https://portal.thirdweb.com/react/react.usemintnft) | Use this to mint a new NFT on your Erc721OrErc1155. |
| [`useMintNFTSupply`](https://portal.thirdweb.com/react/react.usemintnftsupply) | Use this mint extra supply on your Erc1155. |
| [`useTransferNFT`](https://portal.thirdweb.com/react/react.usetransfernft) | Use this to transfer tokens on your NFTContract. |
| [`useAirdropNFT`](https://portal.thirdweb.com/react/react.useairdropnft) | Use this to airdrop tokens on your Erc1155. |
| [`useBurnNFT`](https://portal.thirdweb.com/react/react.useburnnft) | Use this to burn an NFT on your Erc721OrErc1155. |
| Hook | Description |
| ------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- |
| [`useNFT`](https://portal.thirdweb.com/react/react.usenft) | Use this to get an individual NFT token of your NFTContract. |
| [`useNFTs`](https://portal.thirdweb.com/react/react.usenfts) | Use this to get a list of NFT tokens of your NFTContract. |
| [`useTotalCirculatingSupply`](https://portal.thirdweb.com/react/react.usetotalcirculatingsupply) | Use this to get a the total (minted) supply of your NFTContract. |
| [`useOwnedNFTs`](https://portal.thirdweb.com/react/react.useownednfts) | Use this to get a the owned NFTs for a specific Erc721OrErc1155 and wallet address. |
| [`useNFTBalance`](https://portal.thirdweb.com/react/react.usenftbalance) | Use this to get a the total balance of a NFTContract and wallet address. |
| [`useTotalCount`](https://portal.thirdweb.com/react/react.usetotalcount) | Use this to get the total count of NFT tokens of your NFTContract. |
| [`useMintNFT`](https://portal.thirdweb.com/react/react.usemintnft) | Use this to mint a new NFT on your Erc721OrErc1155. |
| [`useMintNFTSupply`](https://portal.thirdweb.com/react/react.usemintnftsupply) | Use this mint extra supply on your Erc1155. |
| [`useTransferNFT`](https://portal.thirdweb.com/react/react.usetransfernft) | Use this to transfer tokens on your NFTContract. |
| [`useAirdropNFT`](https://portal.thirdweb.com/react/react.useairdropnft) | Use this to airdrop tokens on your Erc1155. |
| [`useBurnNFT`](https://portal.thirdweb.com/react/react.useburnnft) | Use this to burn an NFT on your Erc721OrErc1155. |
### Token
| Hook | Description |
| --- | --- |
| [`useTokenSupply`](https://portal.thirdweb.com/react/react.usetokensupply) | Use this to get a the total supply of your contract. |
| [`useTokenBalance`](https://portal.thirdweb.com/react/react.usetokenbalance) | Use this to get the balance of your contract for a given address. |
| [`useTokenDecimals`](https://portal.thirdweb.com/react/react.usetokendecimals) | Use this to get the decimals of your contract for a given address. |
| [`useMintToken`](https://portal.thirdweb.com/react/react.useminttoken) | Use this to mint new tokens on your contract. |
| [`useClaimToken`](https://portal.thirdweb.com/react/react.useclaimtoken) | Use this to claim tokens from your contract. |
| [`useTransferToken`](https://portal.thirdweb.com/react/react.usetransfertoken) | Use this to transfer tokens on your contract. |
| [`useTransferBatchToken`](https://portal.thirdweb.com/react/react.usetransferbatchtoken) | Use this to transfer batch tokens on your contract. |
| [`useBurnToken`](https://portal.thirdweb.com/react/react.useburntoken) | Use this to burn tokens on your contract. |
| Hook | Description |
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
| [`useTokenSupply`](https://portal.thirdweb.com/react/react.usetokensupply) | Use this to get a the total supply of your contract. |
| [`useTokenBalance`](https://portal.thirdweb.com/react/react.usetokenbalance) | Use this to get the balance of your contract for a given address. |
| [`useTokenDecimals`](https://portal.thirdweb.com/react/react.usetokendecimals) | Use this to get the decimals of your contract for a given address. |
| [`useMintToken`](https://portal.thirdweb.com/react/react.useminttoken) | Use this to mint new tokens on your contract. |
| [`useClaimToken`](https://portal.thirdweb.com/react/react.useclaimtoken) | Use this to claim tokens from your contract. |
| [`useTransferToken`](https://portal.thirdweb.com/react/react.usetransfertoken) | Use this to transfer tokens on your contract. |
| [`useTransferBatchToken`](https://portal.thirdweb.com/react/react.usetransferbatchtoken) | Use this to transfer batch tokens on your contract. |
| [`useBurnToken`](https://portal.thirdweb.com/react/react.useburntoken) | Use this to burn tokens on your contract. |
### Marketplace
| Hook | Description |
| --- | --- |
| [`useListing`](https://portal.thirdweb.com/react/react.uselisting) | Use this to get a specific listing from the marketplace. |
| [`useListings`](https://portal.thirdweb.com/react/react.uselistings) | Use this to get a list all listings from your marketplace contract. |
| [`useListingsCount`](https://portal.thirdweb.com/react/react.uselistingscount) | Use this to get a count of all listings on your marketplace contract. |
| [`useActiveListings`](https://portal.thirdweb.com/react/react.useactivelistings) | Use this to get a list active listings from your marketplace contract. |
| [`useWinningBid`](https://portal.thirdweb.com/react/react.usewinningbid) | Use this to get a the winning bid for an auction listing from your marketplace contract. |
| [`useAuctionWinner`](https://portal.thirdweb.com/react/react.useauctionwinner) | Use this to get the winner of an auction listing from your marketplace contract. |
| [`useBidBuffer`](https://portal.thirdweb.com/react/react.usebidbuffer) | Use this to get the buffer in basis points between offers from your marketplace contract. |
| [`useCreateDirectListing`](https://portal.thirdweb.com/react/react.usecreatedirectlisting) | Use this to create a new Direct Listing on your marketplace contract. |
| [`useCreateAuctionListing`](https://portal.thirdweb.com/react/react.usecreateauctionlisting) | Use this to create a new Auction Listing on your marketplace contract. |
| [`useCancelListing`](https://portal.thirdweb.com/react/react.usecancellisting) | Use this to cancel a listing on your marketplace contract. |
| [`useMakeBid`](https://portal.thirdweb.com/react/react.usemakebid) | Use this to place a bid on an auction listing from your marketplace contract. |
| [`useBuyNow`](https://portal.thirdweb.com/react/react.usebuynow) | Use this to buy out an auction listing from your marketplace contract. |
| Hook | Description |
| -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| [`useListing`](https://portal.thirdweb.com/react/react.uselisting) | Use this to get a specific listing from the marketplace. |
| [`useListings`](https://portal.thirdweb.com/react/react.uselistings) | Use this to get a list all listings from your marketplace contract. |
| [`useListingsCount`](https://portal.thirdweb.com/react/react.uselistingscount) | Use this to get a count of all listings on your marketplace contract. |
| [`useActiveListings`](https://portal.thirdweb.com/react/react.useactivelistings) | Use this to get a list active listings from your marketplace contract. |
| [`useWinningBid`](https://portal.thirdweb.com/react/react.usewinningbid) | Use this to get a the winning bid for an auction listing from your marketplace contract. |
| [`useAuctionWinner`](https://portal.thirdweb.com/react/react.useauctionwinner) | Use this to get the winner of an auction listing from your marketplace contract. |
| [`useBidBuffer`](https://portal.thirdweb.com/react/react.usebidbuffer) | Use this to get the buffer in basis points between offers from your marketplace contract. |
| [`useCreateDirectListing`](https://portal.thirdweb.com/react/react.usecreatedirectlisting) | Use this to create a new Direct Listing on your marketplace contract. |
| [`useCreateAuctionListing`](https://portal.thirdweb.com/react/react.usecreateauctionlisting) | Use this to create a new Auction Listing on your marketplace contract. |
| [`useCancelListing`](https://portal.thirdweb.com/react/react.usecancellisting) | Use this to cancel a listing on your marketplace contract. |
| [`useMakeBid`](https://portal.thirdweb.com/react/react.usemakebid) | Use this to place a bid on an auction listing from your marketplace contract. |
| [`useBuyNow`](https://portal.thirdweb.com/react/react.usebuynow) | Use this to buy out an auction listing from your marketplace contract. |
### Permissions Controls
| Hook | Description |
| --- | --- |
| [`useAllRoleMembers`](https://portal.thirdweb.com/react/react.useallrolemembers) | Use this to get the roles of all members. |
| [`useRoleMembers`](https://portal.thirdweb.com/react/react.userolemembers) | Use this to get the members of a role. |
| [`useIsAddressRole`](https://portal.thirdweb.com/react/react.useisaddressrole) | Use this to check if a WalletAddress is a member of a role. |
| Hook | Description |
| -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| [`useAllRoleMembers`](https://portal.thirdweb.com/react/react.useallrolemembers) | Use this to get the roles of all members. |
| [`useRoleMembers`](https://portal.thirdweb.com/react/react.userolemembers) | Use this to get the members of a role. |
| [`useIsAddressRole`](https://portal.thirdweb.com/react/react.useisaddressrole) | Use this to check if a WalletAddress is a member of a role. |
| [`useSetAllRoleMembers`](https://portal.thirdweb.com/react/react.usesetallrolemembers) | Use this to OVERWRITE the list of addresses that are members of specific roles. |
| [`useGrantRole`](https://portal.thirdweb.com/react/react.usegrantrole) | Use this to grant a WalletAddress a specific role. |
| [`useRevokeRole`](https://portal.thirdweb.com/react/react.userevokerole) | Use this to revoke a WalletAddress a specific role. |
| [`useGrantRole`](https://portal.thirdweb.com/react/react.usegrantrole) | Use this to grant a WalletAddress a specific role. |
| [`useRevokeRole`](https://portal.thirdweb.com/react/react.userevokerole) | Use this to revoke a WalletAddress a specific role. |
### Drop
| Hook | Description |
| --- | --- |
| [`useUnclaimedNFTs`](https://portal.thirdweb.com/react/react.useunclaimednfts) | Use this to get a list of unclaimed NFT tokens of your ERC721 Drop contract. |
| [`useClaimedNFTs`](https://portal.thirdweb.com/react/react.useclaimednfts) | Use this to get a list of claimed (minted) NFT tokens of your ERC721 Drop contract.. |
| [`useUnclaimedNFTSupply`](https://portal.thirdweb.com/react/react.useunclaimednftsupply) | Use this to get the total unclaimed NFT supply of your ERC721 Drop contract. |
| [`useClaimedNFTSupply`](https://portal.thirdweb.com/react/react.useclaimednftsupply) | Use this to get the total claimed (minted) NFT supply of your ERC721 Drop contract. |
| [`useBatchesToReveal`](https://portal.thirdweb.com/react/react.usebatchestoreveal) | Use this to get a list of batches that are ready to be revealed. |
| [`useClaimNFT`](https://portal.thirdweb.com/react/react.useclaimnft) | Use this to claim a NFT on your DropContract |
| [`useLazyMint`](https://portal.thirdweb.com/react/react.uselazymint) | Use this to lazy mint a batch of NFTs on your DropContract. |
| [`useDelayedRevealLazyMint`](https://portal.thirdweb.com/react/react.usedelayedreveallazymint) | Use this to lazy mint a batch of delayed reveal NFTs on your DropContract. |
| [`useRevealLazyMint`](https://portal.thirdweb.com/react/react.usereveallazymint) | Use this to reveal a batch of delayed reveal NFTs on your RevealableContract. |
| Hook | Description |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| [`useUnclaimedNFTs`](https://portal.thirdweb.com/react/react.useunclaimednfts) | Use this to get a list of unclaimed NFT tokens of your ERC721 Drop contract. |
| [`useClaimedNFTs`](https://portal.thirdweb.com/react/react.useclaimednfts) | Use this to get a list of claimed (minted) NFT tokens of your ERC721 Drop contract.. |
| [`useUnclaimedNFTSupply`](https://portal.thirdweb.com/react/react.useunclaimednftsupply) | Use this to get the total unclaimed NFT supply of your ERC721 Drop contract. |
| [`useClaimedNFTSupply`](https://portal.thirdweb.com/react/react.useclaimednftsupply) | Use this to get the total claimed (minted) NFT supply of your ERC721 Drop contract. |
| [`useBatchesToReveal`](https://portal.thirdweb.com/react/react.usebatchestoreveal) | Use this to get a list of batches that are ready to be revealed. |
| [`useClaimNFT`](https://portal.thirdweb.com/react/react.useclaimnft) | Use this to claim a NFT on your DropContract |
| [`useLazyMint`](https://portal.thirdweb.com/react/react.uselazymint) | Use this to lazy mint a batch of NFTs on your DropContract. |
| [`useDelayedRevealLazyMint`](https://portal.thirdweb.com/react/react.usedelayedreveallazymint) | Use this to lazy mint a batch of delayed reveal NFTs on your DropContract. |
| [`useRevealLazyMint`](https://portal.thirdweb.com/react/react.usereveallazymint) | Use this to reveal a batch of delayed reveal NFTs on your RevealableContract. |
### Claim Conditions
| Hook | Description |
| --- | --- |
| [`useActiveClaimCondition`](https://portal.thirdweb.com/react/react.useactiveclaimcondition) | Use this to get the active claim condition for ERC20, ERC721 or ERC1155 based contracts. |
| [`useClaimConditions`](https://portal.thirdweb.com/react/react.useclaimconditions) | Use this to get all claim conditions for ERC20, ERC721 or ERC1155 based contracts. |
| Hook | Description |
| ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| [`useActiveClaimCondition`](https://portal.thirdweb.com/react/react.useactiveclaimcondition) | Use this to get the active claim condition for ERC20, ERC721 or ERC1155 based contracts. |
| [`useClaimConditions`](https://portal.thirdweb.com/react/react.useclaimconditions) | Use this to get all claim conditions for ERC20, ERC721 or ERC1155 based contracts. |
| [`useClaimIneligibilityReasons`](https://portal.thirdweb.com/react/react.useclaimineligibilityreasons) | Use this to check for reasons that prevent claiming for either ERC20, ERC721 or ERC1155 based contracts. |
| [`useSetClaimConditions`](https://portal.thirdweb.com/react/react.usesetclaimconditions) | Use this to set claim conditions on your DropContract. |
| [`useResetClaimConditions`](https://portal.thirdweb.com/react/react.useresetclaimconditions) | Use this to reset claim conditions on your DropContract. |
| [`useSetClaimConditions`](https://portal.thirdweb.com/react/react.usesetclaimconditions) | Use this to set claim conditions on your DropContract. |
| [`useResetClaimConditions`](https://portal.thirdweb.com/react/react.useresetclaimconditions) | Use this to reset claim conditions on your DropContract. |
+1 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.9.1",
"version": "3.9.4",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -42,9 +42,6 @@
"evm/index.ts",
"evm/connectors/**.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"private": false,
@@ -36,6 +36,8 @@ export interface SharedMediaProps {
controls?: HTMLVideoElement["controls"];
children?: ReactNode;
mimeType?: string;
}
/**
@@ -65,7 +67,7 @@ interface PlayButtonProps {
isPlaying: boolean;
}
const PlayButton: React.VFC<PlayButtonProps> = ({ onClick, isPlaying }) => {
const PlayButton: React.FC<PlayButtonProps> = ({ onClick, isPlaying }) => {
const [isHovering, setIsHovering] = useState(false);
const onMouseEnter = () => setIsHovering(true);
const onMouseLeave = () => setIsHovering(false);
@@ -295,10 +297,7 @@ const IframePlayer = React.forwardRef<HTMLIFrameElement, MediaRendererProps>(
const [playing, setPlaying] = useState(!requireInteraction);
return (
<div
style={{ position: "relative", ...style }}
{...restProps}
>
<div style={{ position: "relative", ...style }} {...restProps}>
<iframe
src={playing ? src ?? undefined : undefined}
ref={ref}
@@ -432,6 +431,7 @@ export const MediaRenderer = React.forwardRef<
width = "300px",
height = "300px",
style,
mimeType,
...restProps
},
ref,
@@ -442,7 +442,7 @@ export const MediaRenderer = React.forwardRef<
height,
...style,
};
const videoOrImageSrc = useResolvedMediaType(src ?? undefined);
const videoOrImageSrc = useResolvedMediaType(src ?? undefined, mimeType);
const possiblePosterSrc = useResolvedMediaType(poster ?? undefined);
if (!videoOrImageSrc.mimeType) {
@@ -563,13 +563,14 @@ export interface MediaType {
* }
* ```
*/
export function useResolvedMediaType(uri?: string) {
export function useResolvedMediaType(uri?: string, mimeType?: string) {
const resolvedUrl = useMemo(() => resolveIpfsUri(uri), [uri]);
const resolvedMimType = useQuery(
["mime-type", resolvedUrl],
() => resolveMimeType(resolvedUrl),
{
enabled: !!resolvedUrl,
enabled: !!resolvedUrl && !mimeType,
initialData: mimeType,
},
);
@@ -21,7 +21,7 @@ export const ModelViewer = React.forwardRef<HTMLDivElement, MediaRendererProps>(
alt={alt || "3D Model"}
camera-controls
poster={poster ? poster : null}
style={{ width: '100%', height: '100%'} as CSSStyleDeclaration}
style={{ width: "100%", height: "100%" } as CSSStyleDeclaration}
/>
) : null}
</div>
@@ -18,7 +18,7 @@ export interface ThirdwebNftMediaProps extends SharedMediaProps {
* This component can be used to render NFTs from the thirdweb SDK.
* It will render the animation_url if it exists, otherwise it will render the image.
* The default size is 300px by 300px, but this can be changed using the `width` and `height` props.
*
*
* Props: {@link ThirdwebNftMediaProps}
*
* @example
@@ -43,7 +43,7 @@ export interface ThirdwebNftMediaProps extends SharedMediaProps {
export const ThirdwebNftMedia = React.forwardRef<
HTMLMediaElement,
ThirdwebNftMediaProps
>(({ metadata, width = "300px", height = "300px", style, ...props }, ref) => {
>(({ metadata, width = "300px", height = "300px", style, ...props }, ref) => {
return (
<MediaRenderer
src={metadata.animation_url || metadata.image}
@@ -52,7 +52,7 @@ export const ThirdwebNftMedia = React.forwardRef<
ref={ref}
width={width}
height={height}
style={{ ...style }}
style={{ ...style }}
{...props}
/>
);
@@ -9,13 +9,16 @@ import {
*
* @example
* ```javascript
* import { useNetwork, ChainId } from "@thirdweb-dev/react";
* import { useNetwork } from "@thirdweb-dev/react";
*
* const App = () => {
* const [, switchNetwork] = useNetwork();
*
*
* return (
* <button onClick={() => switchNetwork(ChainId.Polygon)}>
* // switchNetwork is undefined if the wallet does not support programmatic network switching
* // 137 is the chainId for Polygon in this example
* <button onClick={() => switchNetwork(137)}>
* Switch Network
* </button>
* );
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -2,4 +2,6 @@ docs/
etc/
temp/
temp-evm/
temp-solana/
temp-solana/
.nyc_output/
coverage/
+28
View File
@@ -1,5 +1,33 @@
# @thirdweb-dev/sdk
## 3.9.4
### Patch Changes
- [#616](https://github.com/thirdweb-dev/js/pull/616) [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle custom currencies for all chains
- Updated dependencies [[`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/chains@0.1.4
## 3.9.3
### Patch Changes
- Updated dependencies [[`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a)]:
- @thirdweb-dev/chains@0.1.3
## 3.9.2
### Patch Changes
- [#604](https://github.com/thirdweb-dev/js/pull/604) [`f3408d0`](https://github.com/thirdweb-dev/js/commit/f3408d05d84ff8418a3f76961367e47565ed32b4) Thanks [@jnsdls](https://github.com/jnsdls)! - fix possible crash in StaticJsonRpcBatchProvider
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
- Updated dependencies [[`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/storage@1.0.10
- @thirdweb-dev/chains@0.1.2
## 3.9.1
### Patch Changes
+1 -1
View File
@@ -6,7 +6,7 @@
<h1 align="center">thirdweb TypeScript SDK</h1>
<p align="center">
<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>
<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://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.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>
+8 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.9.1",
"version": "3.9.4",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -38,9 +38,6 @@
"solana/index.ts",
"solana/server/index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
@@ -54,12 +51,12 @@
"generate-docs:solana": "api-extractor run --local --config ./config/api-extractor-solana.json && api-documenter markdown -i ./temp -o ./docs/solana && rm -rf ./temp-solana && mv ./temp ./temp-solana",
"generate-snippets": "node ./scripts/generate-snippets.mjs && node ./scripts/generate-feature-snippets-evm.mjs",
"build": "tsc && preconstruct build",
"test:evm:all": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --config './test/evm/.mocharc.json' --timeout 90000 --parallel './test/evm/**/*.test.ts'",
"test:evm:all": "SWC_NODE_PROJECT=./tsconfig.test.json nyc --reporter lcovonly --report-dir ./coverage/evm mocha --config './test/evm/.mocharc.json' --timeout 90000 --parallel './test/evm/**/*.test.ts'",
"test:evm": "make test-evm",
"test:evm:single": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --config './test/evm/.mocharc.json' --timeout 90000",
"node:solana:start": "DEBUG='amman:(info|error|debug)' amman start --forceClone",
"node:solana:stop": "amman stop",
"test:solana:all": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --config './test/solana/.mocharc.json' --timeout 30000 --parallel './test/solana/**/*.test.ts'",
"test:solana:all": "SWC_NODE_PROJECT=./tsconfig.test.json nyc --reporter lcovonly --report-dir ./coverage/solana mocha --config './test/solana/.mocharc.json' --timeout 30000 --parallel './test/solana/**/*.test.ts'",
"test:solana": "make test-sol",
"test:solana:single": "SWC_NODE_PROJECT=./tsconfig.test.json mocha --config './test/solana/.mocharc.json' --timeout 30000",
"push": "yalc push"
@@ -69,14 +66,14 @@
"@metaplex-foundation/amman-client": "^0.2.1",
"@metaplex-foundation/js": "^0.17.6",
"@metaplex-foundation/mpl-token-metadata": "^2.3.3",
"@project-serum/anchor": "^0.25.0",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.62.0",
"@microsoft/api-documenter": "^7.19.4",
"@microsoft/api-extractor": "^7.29.2",
"@microsoft/tsdoc": "^0.14.1",
"@nomiclabs/hardhat-ethers": "^2.0.5",
"@preconstruct/cli": "^2.2.1",
"@project-serum/anchor": "^0.25.0",
"@solana/spl-token": "^0.3.5",
"@solana/web3.js": "^1.62.0",
"@swc-node/register": "^1.5.1",
"@swc/core": "^1.2.177",
"@thirdweb-dev/wallets": "*",
@@ -98,6 +95,7 @@
"ethers": "^5.7.2",
"hardhat": "^2.9.3",
"mocha": "^10.0.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"typescript": "^4.7.4"
},
@@ -135,9 +133,9 @@
}
},
"dependencies": {
"@thirdweb-dev/chains": "*",
"@thirdweb-dev/contracts-js": "*",
"@thirdweb-dev/storage": "*",
"@thirdweb-dev/chains": "*",
"bn.js": "^5.2.1",
"bs58": "^5.0.0",
"cross-fetch": "^3.1.5",
+1 -1
View File
@@ -1,5 +1,5 @@
import { NATIVE_TOKENS, SUPPORTED_CHAIN_ID } from "../constants";
import { Feature } from "../constants/contract-features";
import { NATIVE_TOKENS, SUPPORTED_CHAIN_ID } from "../constants/index";
import { ContractSource } from "../schema";
import { BigNumber, BigNumberish, ethers, providers } from "ethers";
@@ -446,7 +446,7 @@ export async function fetchPreDeployMetadata(
}
/**
* Fetch and parse the full metadata AFTER creating a release, with all the extra information (version, readme, etc)
* Fetch and parse the full metadata AFTER publishing a contract, with all the extra information (version, readme, etc)
* @internal
* @param publishMetadataUri
* @param storage
+1 -4
View File
@@ -74,10 +74,7 @@ async function getDomainSeperator(signer: Signer, contractAddress: string) {
try {
return await contract.getDomainSeperator();
} catch (err2) {
console.error(
'Error getting domain separator',
err2
)
console.error("Error getting domain separator", err2);
}
}
}
@@ -258,7 +258,6 @@ export class ShardedMerkleTree {
sort: true,
});
} catch (e) {
console.warn("No merkle entry found for address", address);
return null;
}
}
+1 -1
View File
@@ -171,7 +171,7 @@ type DropContract = Extract<
"nft-drop" | "token-drop" | "edition-drop" | "signature-drop"
>;
// @deprecated - should not be needed anymore, rely on the release data instead
// @deprecated - should not be needed anymore, rely on the publish data instead
export const APPROVED_IMPLEMENTATIONS: Record<
SUPPORTED_CHAIN_ID,
Record<DropContract, string>
+25
View File
@@ -1,3 +1,6 @@
import { ChainInfo } from "../schema";
import { defaultChains } from "@thirdweb-dev/chains";
/**
* @public
*/
@@ -62,3 +65,25 @@ export const SUPPORTED_CHAIN_IDS: SUPPORTED_CHAIN_ID[] = [
ChainId.Hardhat,
ChainId.Localhost,
];
// @ts-expect-error
let supportedChains: ChainInfo[] = defaultChains;
/**
* @internal
*/
export function setSupportedChains(chains: ChainInfo[] | undefined) {
if (chains && chains.length > 0) {
supportedChains = chains;
} else {
// @ts-expect-error
supportedChains = defaultChains;
}
}
/**
* @internal
*/
export function getSupportedChains() {
return supportedChains;
}
+14 -1
View File
@@ -1,5 +1,5 @@
import { NativeToken } from "../types/currency";
import { ChainId, SUPPORTED_CHAIN_ID } from "./chains";
import { ChainId, getSupportedChains, SUPPORTED_CHAIN_ID } from "./chains";
import { ethers } from "ethers";
/**
@@ -185,6 +185,19 @@ export const NATIVE_TOKENS: Record<
* @public
*/
export function getNativeTokenByChainId(chainId: ChainId): NativeToken {
const chain = getSupportedChains().find((c) => c.chainId === chainId);
if (chain && chain.nativeCurrency) {
return {
name: chain.nativeCurrency.name,
symbol: chain.nativeCurrency.symbol,
decimals: 18,
wrapped: {
address: ethers.constants.AddressZero,
name: `Wrapped ${chain.nativeCurrency.name}`,
symbol: `W${chain.nativeCurrency.symbol}`,
},
};
}
return (
NATIVE_TOKENS[chainId as SUPPORTED_CHAIN_ID] || {
name: "Ether",
+13 -13
View File
@@ -71,7 +71,7 @@ export const EditionDropInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
const contractInfo = await getContractInfo(address, provider);
return !contractInfo || contractInfo.version > 2
? (await import("@thirdweb-dev/contracts-js/dist/abis/DropERC1155.json"))
@@ -117,7 +117,7 @@ export const EditionInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (
await import("@thirdweb-dev/contracts-js/dist/abis/TokenERC1155.json")
).default;
@@ -158,7 +158,7 @@ export const MarketplaceInitializer = {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (
await import("@thirdweb-dev/contracts-js/dist/abis/Marketplace.json")
).default;
@@ -199,7 +199,7 @@ export const MarketplaceV3Initializer = {
return await getCompositePluginABI(address, abi, provider, {}, storage);
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
const localAbi = (
await import("@thirdweb-dev/contracts-js/dist/abis/MarketplaceV3.json")
).default;
@@ -246,7 +246,7 @@ export const MultiwrapInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (await import("@thirdweb-dev/contracts-js/dist/abis/Multiwrap.json"))
.default;
},
@@ -286,7 +286,7 @@ export const NFTCollectionInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (
await import("@thirdweb-dev/contracts-js/dist/abis/TokenERC721.json")
).default;
@@ -326,7 +326,7 @@ export const NFTDropInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
const contractInfo = await getContractInfo(address, provider);
return !contractInfo || contractInfo.version > 3
? (await import("@thirdweb-dev/contracts-js/dist/abis/DropERC721.json"))
@@ -373,7 +373,7 @@ export const PackInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (await import("@thirdweb-dev/contracts-js/dist/abis/Pack.json"))
.default;
},
@@ -413,7 +413,7 @@ export const SignatureDropInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
const contractInfo = await getContractInfo(address, provider);
return !contractInfo || contractInfo.version > 4
? (
@@ -463,7 +463,7 @@ export const SplitInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (await import("@thirdweb-dev/contracts-js/dist/abis/Split.json"))
.default;
},
@@ -503,7 +503,7 @@ export const TokenDropInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
const contractInfo = await getContractInfo(address, provider);
return !contractInfo || contractInfo.version > 2
? (await import("@thirdweb-dev/contracts-js/dist/abis/DropERC20.json"))
@@ -546,7 +546,7 @@ export const TokenInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (
await import("@thirdweb-dev/contracts-js/dist/abis/TokenERC20.json")
).default;
@@ -587,7 +587,7 @@ export const VoteInitializer = {
if (abi) {
return abi;
}
// Deprecated - only needed for backwards compatibility with non-released contracts - should remove in v4
// Deprecated - only needed for backwards compatibility with non-published contracts - should remove in v4
return (await import("@thirdweb-dev/contracts-js/dist/abis/VoteERC20.json"))
.default;
},
@@ -1,12 +1,16 @@
import { getDeployArguments } from "../../common/deploy";
import {
extractConstructorParamsFromAbi,
extractFunctionParamsFromAbi,
fetchExtendedReleaseMetadata,
fetchPreDeployMetadata,
} from "../../common/index";
import { ChainId, EventType, getNativeTokenByChainId } from "../../constants";
import { getContractAddressByChainId } from "../../constants/addresses";
} from "../../common";
import { getDeployArguments } from "../../common/deploy";
import {
ChainId,
EventType,
getContractAddressByChainId,
getNativeTokenByChainId,
} from "../../constants";
import {
EditionDropInitializer,
EditionInitializer,
@@ -24,9 +28,12 @@ import {
TokenInitializer,
VoteInitializer,
} from "../../contracts";
import { SDKOptions } from "../../schema/sdk-options";
import { DeployEvent, DeployEvents } from "../../types";
import { SDKOptions } from "../../schema";
import {
DeployEvent,
DeployEvents,
DeployMetadata,
DeployOptions,
MarketplaceContractDeployMetadata,
MarketplaceV3ContractDeployMetadata,
MultiwrapContractDeployMetadata,
@@ -34,11 +41,7 @@ import {
SplitContractDeployMetadata,
TokenContractDeployMetadata,
VoteContractDeployMetadata,
} from "../../types/deploy/deploy-metadata";
import {
DeployMetadata,
DeployOptions,
} from "../../types/deploy/deploy-options";
} from "../../types";
import { ThirdwebSDK } from "../sdk";
import {
ContractType,
@@ -477,7 +480,7 @@ export class ContractDeployer extends RPCConnectionHandler {
return deployedAddress;
}
// For all other chains, fetch from released contracts
// For all other chains, fetch from published contracts
// resolve contract name from type
const contractName = getContractName(contractType);
invariant(contractName, "Contract name not found");
@@ -492,15 +495,15 @@ export class ContractDeployer extends RPCConnectionHandler {
);
const activeChainId = (await this.getProvider().getNetwork()).chainId;
// fetch the release URI from the ContractPublisher contract
const release = await this.fetchReleaseFromPolygon(
// fetch the publish URI from the ContractPublisher contract
const publishedContract = await this.fetchPublishedContractFromPolygon(
THIRDWEB_DEPLOYER,
contractName,
version,
);
// fetch the deploy metadata from the release URI
// fetch the deploy metadata from the publish URI
const deployMeta = await this.fetchAndCacheDeployMetadata(
release.metadataUri,
publishedContract.metadataUri,
);
let implementationAddress =
deployMeta.extendedMetadata?.factoryDeploymentData
@@ -508,11 +511,11 @@ export class ContractDeployer extends RPCConnectionHandler {
if (implementationAddress) {
// implementation exists on the current chain, continue with normal flow
return this.deployContractFromUri(release.metadataUri, constructorParams);
return this.deployContractFromUri(publishedContract.metadataUri, constructorParams);
} else {
// implementation does NOT exist on chain, deploy the implementation first, then deploy a proxy
implementationAddress = await this.deployContractFromUri(
release.metadataUri,
publishedContract.metadataUri,
this.getConstructorParamsForImplementation(contractType, activeChainId),
{
forceDirectDeploy: true,
@@ -542,25 +545,25 @@ export class ContractDeployer extends RPCConnectionHandler {
}
/**
* Deploy any released contract by its name
* @param releaserAddress the address of the releaser
* Deploy any published contract by its name
* @param publisherAddress the address of the publisher
* @param contractName the name of the contract to deploy
* @param constructorParams the constructor params to pass to the contract
*/
public async deployReleasedContract(
releaserAddress: string,
publisherAddress: string,
contractName: string,
constructorParams: any[],
version = "latest",
options?: DeployOptions,
): Promise<string> {
const release = await this.fetchReleaseFromPolygon(
releaserAddress,
const publishedContract = await this.fetchPublishedContractFromPolygon(
publisherAddress,
contractName,
version,
);
return await this.deployContractFromUri(
release.metadataUri,
publishedContract.metadataUri,
constructorParams,
options,
);
@@ -896,20 +899,20 @@ export class ContractDeployer extends RPCConnectionHandler {
return data;
}
private async fetchReleaseFromPolygon(
releaserAddress: string,
private async fetchPublishedContractFromPolygon(
publisherAddress: string,
contractName: string,
version: string,
) {
const release = await new ThirdwebSDK("polygon")
const publishedContract = await new ThirdwebSDK("polygon")
.getPublisher()
.getVersion(releaserAddress, contractName, version);
if (!release) {
.getVersion(publisherAddress, contractName, version);
if (!publishedContract) {
throw new Error(
`No release found for '${contractName}' at version '${version}' by '${releaserAddress}'`,
`No published contract found for '${contractName}' at version '${version}' by '${publisherAddress}'`,
);
}
return release;
return publishedContract;
}
private getConstructorParamsForImplementation(
@@ -1,5 +1,5 @@
import { EventType } from "../../constants";
import { ContractEvent, EventQueryOptions } from "../../types/index";
import { ContractEvent, EventQueryOptions } from "../../types";
import { ContractWrapper } from "./contract-wrapper";
import { EventFragment } from "@ethersproject/abi";
import { BaseContract, Event, providers } from "ethers";
@@ -6,9 +6,9 @@ import {
fetchPreDeployMetadata,
fetchRawPredeployMetadata,
fetchSourceFilesFromMetadata,
isIncrementalVersion,
resolveContractUriFromAddress,
} from "../../common";
import { isIncrementalVersion } from "../../common/version-checker";
import { getContractPublisherAddress } from "../../constants";
import {
AbiFunction,
@@ -24,8 +24,8 @@ import {
PublishedContract,
PublishedContractFetched,
PublishedContractSchema,
} from "../../schema/contracts/custom";
import { SDKOptions } from "../../schema/sdk-options";
SDKOptions,
} from "../../schema";
import { NetworkInput, TransactionResult } from "../types";
import { ContractWrapper } from "./contract-wrapper";
import { RPCConnectionHandler } from "./rpc-connection-handler";
@@ -309,7 +309,7 @@ export class ContractPublisher extends RPCConnectionHandler {
(metadata) => metadata.publishedMetadata.version === version,
);
invariant(versionMatch, "Contract version not found");
// match the version back to the contract based on the release timestamp
// match the version back to the contract based on the published timestamp
return allVersions.find(
(contract) => contract.timestamp === versionMatch.publishedTimestamp,
);
@@ -1,3 +1,4 @@
import { TransactionResult, TransactionResultWithId } from "..";
import {
CommonNFTInput,
NFTMetadata,
@@ -9,13 +10,11 @@ import {
getBaseUriFromBatch,
} from "../../common/nft";
import { FeatureName } from "../../constants/contract-features";
import { BatchToReveal } from "../../types/delayed-reveal";
import { BatchToReveal, UploadProgressEvent } from "../../types";
import {
BaseDelayedRevealERC1155,
BaseDelayedRevealERC721,
} from "../../types/eips";
import { UploadProgressEvent } from "../../types/events";
import { TransactionResult, TransactionResultWithId } from "../index";
import { ContractWrapper } from "./contract-wrapper";
import type {
DropERC721_V3,
@@ -1,4 +1,9 @@
import { includesErrorMessage } from "../../common";
import { TransactionResult, TransactionTask } from "..";
import {
detectContractFeature,
hasFunction,
includesErrorMessage,
} from "../../common";
import {
abstractContractModelToLegacy,
abstractContractModelToNew,
@@ -11,10 +16,6 @@ import {
updateExistingClaimConditions,
} from "../../common/claim-conditions";
import { isNativeToken } from "../../common/currency";
import {
detectContractFeature,
hasFunction,
} from "../../common/feature-detection";
import { SnapshotFormatVersion } from "../../common/sharded-merkle-tree";
import { isNode } from "../../common/utils";
import { ClaimEligibility } from "../../enums";
@@ -34,7 +35,6 @@ import {
BaseClaimConditionERC1155,
PrebuiltEditionDrop,
} from "../../types/eips";
import { TransactionResult, TransactionTask } from "../index";
import { ContractMetadata } from "./contract-metadata";
import { ContractWrapper } from "./contract-wrapper";
import type {
+1 -1
View File
@@ -21,8 +21,8 @@ import {
FEATURE_NFT_TIERED_DROP,
FEATURE_NFT_SIGNATURE_MINTABLE_V2,
} from "../../constants/erc721-features";
import { ClaimOptions, UploadProgressEvent } from "../../types";
import { BaseDropERC721, BaseERC721 } from "../../types/eips";
import { ClaimOptions, UploadProgressEvent } from "../../types/index";
import { DetectableFeature } from "../interfaces/DetectableFeature";
import { UpdateableNetwork } from "../interfaces/contract";
import {
+10 -6
View File
@@ -1,15 +1,18 @@
import { fetchCurrencyValue } from "../common/currency";
import { fetchCurrencyValue } from "../common";
import { getCompositePluginABI } from "../common/plugin";
import { getChainProvider, NATIVE_TOKEN_ADDRESS } from "../constants";
import {
getChainProvider,
NATIVE_TOKEN_ADDRESS,
setSupportedChains,
} from "../constants";
import {
getContractTypeForRemoteName,
PREBUILT_CONTRACTS_MAP,
} from "../contracts";
import { SmartContract } from "../contracts/smart-contract";
import { AbiSchema } from "../schema";
import { SDKOptions } from "../schema/sdk-options";
import { ContractWithMetadata, CurrencyValue } from "../types/index";
import { ContractDeployer } from "./classes/contract-deployer";
import { AbiSchema, SDKOptions } from "../schema";
import { ContractWithMetadata, CurrencyValue } from "../types";
import { ContractDeployer } from "./classes";
import { ContractPublisher } from "./classes/contract-publisher";
import { MultichainRegistry } from "./classes/multichain-registry";
import {
@@ -177,6 +180,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
network = network.chainId;
}
super(network, options);
setSupportedChains(options?.supportedChains);
this.storageHandler = storage;
this.storage = storage;
this.wallet = new UserWallet(network, options);
+15 -6
View File
@@ -66,13 +66,22 @@ export class StaticJsonRpcBatchProvider extends providers.StaticJsonRpcProvider
// on whether it was a success or error
batch.forEach((inflightRequest_, index) => {
const payload = result[index];
if (payload.error) {
const error = new Error(payload.error.message);
(error as any).code = payload.error.code;
(error as any).data = payload.error.data;
inflightRequest_.reject(error);
// there may *not* be a payload for a given request (typically RPC error level)
if (payload) {
// if there is a payload, check for an error
if (payload.error) {
const error = new Error(payload.error.message);
(error as any).code = payload.error.code;
(error as any).data = payload.error.data;
inflightRequest_.reject(error);
} else {
// if there's no error resolve the request
inflightRequest_.resolve(payload.result);
}
} else {
inflightRequest_.resolve(payload.result);
// if there is no payload, reject the request
inflightRequest_.reject(new Error("No response for request"));
}
});
},
@@ -1,5 +1,5 @@
import { FileOrBufferOrStringSchema } from "../../../core/schema/shared";
import { toSemver } from "../../common/index";
import { toSemver } from "../../common";
import {
AddressSchema,
BigNumberishSchema,

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