Compare commits

...
Author SHA1 Message Date
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
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
4516487a9a Version Packages (#600)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-17 17:38:12 -08:00
Adam MajmudarandGitHub 300fe4a933 [Storage] Pass through pinata metadata (#597) 2023-02-18 01:32:09 +00:00
Joaquim VergesandGitHub f580b8ac06 [React] fix react provider readonly chain mismatch (#599) 2023-02-18 01:24:16 +00:00
Adam MajmudarandGitHub f0de81d4b1 [Auth] Expose verifyLogin function (#588) 2023-02-17 17:15:08 -08:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
f3a863a3b1 Bump undici from 5.14.0 to 5.19.1 (#594)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-16 18:11:22 -08:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
128bca9e07 Version Packages (#595)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-16 17:37:38 -08:00
iketwGitHubiketwciaranightingaleJonas Danielsgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>github-actions[bot] <github-actions[bot]@users.noreply.github.com>Nacho Iacovino
18ba6b381e [React Native SDK] init package (#522)
Co-authored-by: iketw <[email protected]>
Co-authored-by: ciaranightingale <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nacho Iacovino <[email protected]>
2023-02-16 20:04:07 -05:00
Jonas Daniels 18c16101dd release-pr may use cache 2023-02-16 08:49:50 -08:00
Jonas DanielsandGitHub b6b94ca348 smaller workers (#593) 2023-02-16 08:45:38 -08:00
137 changed files with 10022 additions and 5468 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-32
# 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
+142
View File
@@ -0,0 +1,142 @@
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
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"
size:
name: Size Comparison
runs-on: ubuntu-latest-8
needs: build
timeout-minutes: 30
# only run on pull requests that are targeting main
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main'
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 }}
- 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/**}"
-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-32
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
+2 -2
View File
@@ -40,7 +40,7 @@ jobs:
comment_body: ${{ github.event.comment.body }}
deploy:
runs-on: ubuntu-latest-32
runs-on: ubuntu-latest-16
timeout-minutes: 30
needs: deploy-check
if: needs.deploy-check.outputs.triggered == 'true'
@@ -67,7 +67,7 @@ jobs:
uses: ./.github/composite-actions/install
- name: Build
run: yarn build:release
run: yarn build
- name: Configure npm
run: |
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
release:
name: Release
timeout-minutes: 30
runs-on: ubuntu-latest-32
runs-on: ubuntu-latest-16
steps:
- name: Checkout branch
uses: actions/checkout@v3
-20
View File
@@ -1,20 +0,0 @@
name: Compressed Size
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest-32
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/**}"
+1 -1
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/*",
+12
View File
@@ -1,5 +1,17 @@
# @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
- [#588](https://github.com/thirdweb-dev/js/pull/588) [`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e) Thanks [@adam-maj](https://github.com/adam-maj)! - Add verify login to auth
## 3.0.4
### Patch Changes
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.4",
"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"
}
}
}
+2 -1
View File
@@ -50,7 +50,8 @@ export class ThirdwebAuth {
statement: parsedOptions?.statement,
version: parsedOptions?.version,
uri:
parsedOptions?.uri || (isBrowser() ? window.location.href : undefined),
parsedOptions?.uri ||
(isBrowser() ? window.location.origin : undefined),
chain_id: chainId,
nonce: parsedOptions?.nonce,
expiration_time:
+28
View File
@@ -0,0 +1,28 @@
import { ThirdwebAuth } from "../core";
import { LoginPayload, VerifyOptions } from "../core/schema";
import { SignerWallet } from "./signer";
import { ethers } from "ethers";
const wallet = new SignerWallet(ethers.Wallet.createRandom());
const authMap = new Map<string, ThirdwebAuth>();
export async function verifyLogin(
domain: string,
payload: LoginPayload,
options?: Omit<VerifyOptions, "domain">,
) {
let auth: ThirdwebAuth;
if (!authMap.has(domain)) {
auth = new ThirdwebAuth(wallet, domain);
authMap.set(domain, auth);
} else {
auth = authMap.get(domain) as ThirdwebAuth;
}
try {
const address = await auth.verify(payload, options);
return { address, error: undefined };
} catch (err: any) {
return { address: undefined, error: err.message };
}
}
+2 -93
View File
@@ -1,93 +1,2 @@
import { SUPPORTED_CHAIN_ID, supportedChains } from "./evm";
import type { Ecosystem, GenericAuthWallet } from "@thirdweb-dev/wallets";
import { ethers } from "ethers";
const EIP1271_ABI = [
"function isValidSignature(bytes32 _message, bytes _signature) public view returns (bytes4)",
];
const EIP1271_MAGICVALUE = "0x1626ba7e";
export const checkContractWalletSignature = async (
message: string,
signature: string,
address: string,
chainId: number,
): Promise<boolean> => {
const rpcUrl =
supportedChains[chainId as SUPPORTED_CHAIN_ID]?.rpcUrls.default.http[0];
if (!rpcUrl) {
return false;
}
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const walletContract = new ethers.Contract(address, EIP1271_ABI, provider);
const hashMessage = ethers.utils.hashMessage(message);
try {
const res = await walletContract.isValidSignature(hashMessage, signature);
return res === EIP1271_MAGICVALUE;
} catch {
return false;
}
};
export class SignerWallet implements GenericAuthWallet {
type: Ecosystem = "evm";
#signer: ethers.Signer;
constructor(signer: ethers.Signer) {
this.#signer = signer;
}
public async getAddress(): Promise<string> {
return this.#signer.getAddress();
}
public async getChainId(): Promise<number> {
return this.#signer.getChainId();
}
public async signMessage(message: string): Promise<string> {
return await this.#signer.signMessage(message);
}
public async verifySignature(
message: string,
signature: string,
address: string,
chainId?: number,
): Promise<boolean> {
const messageHash = ethers.utils.hashMessage(message);
const messageHashBytes = ethers.utils.arrayify(messageHash);
const recoveredAddress = ethers.utils.recoverAddress(
messageHashBytes,
signature,
);
if (recoveredAddress === address) {
return true;
}
// Check if the address is a smart contract wallet
if (chainId !== undefined) {
try {
const isValid = await checkContractWalletSignature(
message,
signature,
address,
chainId || 1,
);
return isValid;
} catch {
// no-op
}
}
return false;
}
}
export class PrivateKeyWallet extends SignerWallet {
constructor(privateKey: string) {
super(new ethers.Wallet(privateKey));
}
}
export * from "./signer";
export * from "./auth";
+93
View File
@@ -0,0 +1,93 @@
import { SUPPORTED_CHAIN_ID, supportedChains } from "./evm";
import type { Ecosystem, GenericAuthWallet } from "@thirdweb-dev/wallets";
import { ethers } from "ethers";
const EIP1271_ABI = [
"function isValidSignature(bytes32 _message, bytes _signature) public view returns (bytes4)",
];
const EIP1271_MAGICVALUE = "0x1626ba7e";
export const checkContractWalletSignature = async (
message: string,
signature: string,
address: string,
chainId: number,
): Promise<boolean> => {
const rpcUrl =
supportedChains[chainId as SUPPORTED_CHAIN_ID]?.rpcUrls.default.http[0];
if (!rpcUrl) {
return false;
}
const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
const walletContract = new ethers.Contract(address, EIP1271_ABI, provider);
const hashMessage = ethers.utils.hashMessage(message);
try {
const res = await walletContract.isValidSignature(hashMessage, signature);
return res === EIP1271_MAGICVALUE;
} catch {
return false;
}
};
export class SignerWallet implements GenericAuthWallet {
type: Ecosystem = "evm";
#signer: ethers.Signer;
constructor(signer: ethers.Signer) {
this.#signer = signer;
}
public async getAddress(): Promise<string> {
return this.#signer.getAddress();
}
public async getChainId(): Promise<number> {
return this.#signer.getChainId();
}
public async signMessage(message: string): Promise<string> {
return await this.#signer.signMessage(message);
}
public async verifySignature(
message: string,
signature: string,
address: string,
chainId?: number,
): Promise<boolean> {
const messageHash = ethers.utils.hashMessage(message);
const messageHashBytes = ethers.utils.arrayify(messageHash);
const recoveredAddress = ethers.utils.recoverAddress(
messageHashBytes,
signature,
);
if (recoveredAddress === address) {
return true;
}
// Check if the address is a smart contract wallet
if (chainId !== undefined) {
try {
const isValid = await checkContractWalletSignature(
message,
signature,
address,
chainId || 1,
);
return isValid;
} catch {
// no-op
}
}
return false;
}
}
export class PrivateKeyWallet extends SignerWallet {
constructor(privateKey: string) {
super(new ethers.Wallet(privateKey));
}
}
+28
View File
@@ -0,0 +1,28 @@
import { ThirdwebAuth } from "../core";
import { LoginPayload, VerifyOptions } from "../core/schema";
import { KeypairWallet } from "./signer";
import { Keypair } from "@solana/web3.js";
const wallet = new KeypairWallet(Keypair.generate());
const authMap = new Map<string, ThirdwebAuth>();
export async function verifyLogin(
domain: string,
payload: LoginPayload,
options?: Omit<VerifyOptions, "domain">,
) {
let auth: ThirdwebAuth;
if (!authMap.has(domain)) {
auth = new ThirdwebAuth(wallet, domain);
authMap.set(domain, auth);
} else {
auth = authMap.get(domain) as ThirdwebAuth;
}
try {
const address = await auth.verify(payload, options);
return { address, error: undefined };
} catch (err: any) {
return { address: undefined, error: err.message };
}
}
+2 -69
View File
@@ -1,69 +1,2 @@
import * as ed25519 from "@noble/ed25519";
import { Signer, Keypair, PublicKey } from "@solana/web3.js";
import type { Ecosystem, GenericAuthWallet } from "@thirdweb-dev/wallets";
import bs58 from "bs58";
import nacl from "tweetnacl";
export interface SolanaSigner {
publicKey: PublicKey;
signMessage(message: Uint8Array): Promise<Uint8Array>;
}
export class SignerWallet implements GenericAuthWallet {
type: Ecosystem = "solana";
private signer: SolanaSigner;
constructor(signer: SolanaSigner) {
this.signer = signer;
}
public async getAddress(): Promise<string> {
return this.signer.publicKey.toBase58();
}
public async signMessage(message: string): Promise<string> {
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await this.signer.signMessage(encodedMessage);
const signature = bs58.encode(signedMessage);
return signature;
}
public async verifySignature(
message: string,
signature: string,
address: string,
): Promise<boolean> {
return nacl.sign.detached.verify(
new TextEncoder().encode(message),
bs58.decode(signature),
bs58.decode(address),
);
}
}
class KeypairSigner implements SolanaSigner {
private keypair: Signer;
public publicKey: PublicKey;
constructor(keypair: Signer) {
this.keypair = keypair;
this.publicKey = keypair.publicKey;
}
public async signMessage(message: Uint8Array): Promise<Uint8Array> {
return ed25519.sync.sign(message, this.keypair.secretKey.slice(0, 32));
}
}
export class KeypairWallet extends SignerWallet {
constructor(keypair: Keypair) {
super(new KeypairSigner(keypair));
}
}
export class PrivateKeyWallet extends KeypairWallet {
constructor(privateKey: string) {
super(Keypair.fromSecretKey(bs58.decode(privateKey)));
}
}
export * from "./signer";
export * from "./auth";
+69
View File
@@ -0,0 +1,69 @@
import * as ed25519 from "@noble/ed25519";
import { Signer, Keypair, PublicKey } from "@solana/web3.js";
import type { Ecosystem, GenericAuthWallet } from "@thirdweb-dev/wallets";
import bs58 from "bs58";
import nacl from "tweetnacl";
export interface SolanaSigner {
publicKey: PublicKey;
signMessage(message: Uint8Array): Promise<Uint8Array>;
}
export class SignerWallet implements GenericAuthWallet {
type: Ecosystem = "solana";
private signer: SolanaSigner;
constructor(signer: SolanaSigner) {
this.signer = signer;
}
public async getAddress(): Promise<string> {
return this.signer.publicKey.toBase58();
}
public async signMessage(message: string): Promise<string> {
const encodedMessage = new TextEncoder().encode(message);
const signedMessage = await this.signer.signMessage(encodedMessage);
const signature = bs58.encode(signedMessage);
return signature;
}
public async verifySignature(
message: string,
signature: string,
address: string,
): Promise<boolean> {
return nacl.sign.detached.verify(
new TextEncoder().encode(message),
bs58.decode(signature),
bs58.decode(address),
);
}
}
class KeypairSigner implements SolanaSigner {
private keypair: Signer;
public publicKey: PublicKey;
constructor(keypair: Signer) {
this.keypair = keypair;
this.publicKey = keypair.publicKey;
}
public async signMessage(message: Uint8Array): Promise<Uint8Array> {
return ed25519.sync.sign(message, this.keypair.secretKey.slice(0, 32));
}
}
export class KeypairWallet extends SignerWallet {
constructor(keypair: Keypair) {
super(new KeypairSigner(keypair));
}
}
export class PrivateKeyWallet extends KeypairWallet {
constructor(privateKey: string) {
super(Keypair.fromSecretKey(bs58.decode(privateKey)));
}
}
+18
View File
@@ -1,5 +1,23 @@
# @thirdweb-dev/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
- [#599](https://github.com/thirdweb-dev/js/pull/599) [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - New chains added
## 0.1.0
### Minor Changes
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "AmStar Testnet",
"chain": "AmStar",
"icon": {
"url": "ipfs://Qmd4TMQdnYxaUZqnVddh5S37NGH72g2kkK38ccCEgdZz1C",
"width": 599,
"height": 563,
"format": "png"
},
"rpc": [
"https://amstar-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.amstarscan.com"
],
"faucets": [],
"nativeCurrency": {
"name": "SINSO",
"symbol": "SINSO",
"decimals": 18
},
"infoURL": "https://sinso.io",
"shortName": "ASARt",
"chainId": 1138,
"networkId": 1138,
"explorers": [
{
"name": "amstarscan-testnet",
"url": "https://testnet.amstarscan.com",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "amstar-testnet"
} as const;
+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"
+21 -12
View File
@@ -1,36 +1,45 @@
export default {
"name": "zkSync alpha testnet",
"name": "zkSync Era Testnet",
"chain": "ETH",
"rpc": [
"https://zksync-alpha-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zksync-era-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zksync2-testnet.zksync.dev"
],
"faucets": [
"https://portal.zksync.io/faucet"
"https://goerli.portal.zksync.io/faucet"
],
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"infoURL": "https://v2-docs.zksync.io/",
"infoURL": "https://era.zksync.io/docs/",
"shortName": "zksync-goerli",
"chainId": 280,
"networkId": 280,
"icon": {
"url": "ipfs://QmdwQDr6vmBtXmK2TmknkEuZNoaDqTasFdZdu3DRw8b2wt",
"width": 1000,
"height": 1628,
"format": "png"
"url": "ipfs://Qma6H9xd8Ydah1bAFnmDuau1jeMh5NjGEL8tpdnjLbJ7m2",
"width": 512,
"height": 512,
"format": "svg"
},
"explorers": [
{
"name": "blockscout",
"url": "https://zksync2-testnet.zkscan.io",
"icon": "blockscout",
"name": "zkSync Era Block Explorer",
"url": "https://goerli.explorer.zksync.io",
"icon": "zksync-era",
"standard": "EIP3091"
}
],
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": [
{
"url": "https://goerli.portal.zksync.io/bridge"
}
]
},
"testnet": true,
"slug": "zksync-alpha-testnet"
"slug": "zksync-era-testnet"
} as const;
+62
View File
@@ -0,0 +1,62 @@
export default {
"name": "Hedera Mainnet",
"chain": "Hedera",
"icon": {
"url": "ipfs://QmQikzhvZKyMmbZJd7BVLZb2YTBDMgNDnaMCAErsVjsfuz",
"width": 1500,
"height": 1500,
"format": "png"
},
"rpc": [
"https://hedera.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet.hashio.io/api"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "hbar",
"symbol": "HBAR",
"decimals": 8
},
"infoURL": "https://hedera.com",
"shortName": "hedera-mainnet",
"chainId": 295,
"networkId": 295,
"slip44": 3030,
"explorers": [
{
"name": "HashScan",
"url": "https://hashscan.io/mainnet/dashboard",
"standard": "none"
},
{
"name": "Arkhia Explorer",
"url": "https://explorer.arkhia.io",
"standard": "none"
},
{
"name": "DragonGlass",
"url": "https://app.dragonglass.me",
"standard": "none"
},
{
"name": "Hedera Explorer",
"url": "https://hederaexplorer.io",
"standard": "none"
},
{
"name": "Ledger Works Explore",
"url": "https://explore.lworks.io",
"standard": "none"
}
],
"testnet": false,
"slug": "hedera"
} as const;
+64
View File
@@ -0,0 +1,64 @@
export default {
"name": "Hedera Testnet",
"chain": "Hedera",
"icon": {
"url": "ipfs://QmQikzhvZKyMmbZJd7BVLZb2YTBDMgNDnaMCAErsVjsfuz",
"width": 1500,
"height": 1500,
"format": "png"
},
"rpc": [
"https://hedera-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.hashio.io/api"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [
"https://portal.hedera.com"
],
"nativeCurrency": {
"name": "hbar",
"symbol": "HBAR",
"decimals": 8
},
"infoURL": "https://hedera.com",
"shortName": "hedera-testnet",
"chainId": 296,
"networkId": 296,
"slip44": 3030,
"explorers": [
{
"name": "HashScan",
"url": "https://hashscan.io/testnet/dashboard",
"standard": "none"
},
{
"name": "Arkhia Explorer",
"url": "https://explorer.arkhia.io",
"standard": "none"
},
{
"name": "DragonGlass",
"url": "https://app.dragonglass.me",
"standard": "none"
},
{
"name": "Hedera Explorer",
"url": "https://hederaexplorer.io",
"standard": "none"
},
{
"name": "Ledger Works Explore",
"url": "https://explore.lworks.io",
"standard": "none"
}
],
"testnet": true,
"slug": "hedera-testnet"
} as const;
+44
View File
@@ -0,0 +1,44 @@
export default {
"name": "Hedera Previewnet",
"chain": "Hedera",
"icon": {
"url": "ipfs://QmQikzhvZKyMmbZJd7BVLZb2YTBDMgNDnaMCAErsVjsfuz",
"width": 1500,
"height": 1500,
"format": "png"
},
"rpc": [
"https://hedera-previewnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://previewnet.hashio.io/api"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [
"https://portal.hedera.com"
],
"nativeCurrency": {
"name": "hbar",
"symbol": "HBAR",
"decimals": 8
},
"infoURL": "https://hedera.com",
"shortName": "hedera-previewnet",
"chainId": 297,
"networkId": 297,
"slip44": 3030,
"explorers": [
{
"name": "HashScan",
"url": "https://hashscan.io/previewnet/dashboard",
"standard": "none"
}
],
"testnet": false,
"slug": "hedera-previewnet"
} as const;
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "Hedera Localnet",
"chain": "Hedera",
"icon": {
"url": "ipfs://QmQikzhvZKyMmbZJd7BVLZb2YTBDMgNDnaMCAErsVjsfuz",
"width": 1500,
"height": 1500,
"format": "png"
},
"rpc": [],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "hbar",
"symbol": "HBAR",
"decimals": 8
},
"infoURL": "https://hedera.com",
"shortName": "hedera-localnet",
"chainId": 298,
"networkId": 298,
"slip44": 3030,
"explorers": [],
"testnet": false,
"slug": "hedera-localnet"
} as const;
+17 -10
View File
@@ -1,7 +1,10 @@
export default {
"name": "zkSync v2",
"name": "zkSync Era Mainnet",
"chain": "ETH",
"rpc": [],
"rpc": [
"https://zksync-era.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zksync2-mainnet.zksync.io"
],
"faucets": [],
"nativeCurrency": {
"name": "Ether",
@@ -13,24 +16,28 @@ export default {
"chainId": 324,
"networkId": 324,
"icon": {
"url": "ipfs://QmdwQDr6vmBtXmK2TmknkEuZNoaDqTasFdZdu3DRw8b2wt",
"width": 1000,
"height": 1628,
"format": "png"
"url": "ipfs://Qma6H9xd8Ydah1bAFnmDuau1jeMh5NjGEL8tpdnjLbJ7m2",
"width": 512,
"height": 512,
"format": "svg"
},
"explorers": [
{
"name": "zkSync v2 Block Explorer",
"name": "zkSync Era Block Explorer",
"url": "https://explorer.zksync.io",
"icon": "zksync-era",
"standard": "EIP3091"
}
],
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": []
"bridges": [
{
"url": "https://portal.zksync.io/bridge"
}
]
},
"status": "incubating",
"testnet": false,
"slug": "zksync-v2"
"slug": "zksync-era"
} as const;
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "Hika Devnet",
"chain": "Hika Network Testnet",
"icon": {
"url": "ipfs://QmW44FPm3CMM2JDs8BQxLNvUtykkUtrGkQkQsUDJSi3Gmp",
"width": 350,
"height": 84,
"format": "png"
},
"rpc": [
"https://hika-devnet.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-devnet"
} 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;
+1 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.0",
"version": "0.1.3",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
@@ -24,9 +24,6 @@
"entrypoints": [
"index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
File diff suppressed because one or more lines are too long
+23
View File
@@ -1,5 +1,28 @@
# thirdweb
## 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
- Updated dependencies []:
- @thirdweb-dev/sdk@3.9.1
## 0.9.20
### Patch Changes
+7 -5
View File
@@ -41,10 +41,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 +52,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 +94,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 +106,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.20",
"version": "0.9.23",
"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
+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,
+27
View File
@@ -1,5 +1,32 @@
# @thirdweb-dev/react-core
## 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
- [#588](https://github.com/thirdweb-dev/js/pull/588) [`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e) Thanks [@adam-maj](https://github.com/adam-maj)! - Update to use new Auth
- Updated dependencies [[`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e), [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611)]:
- @thirdweb-dev/auth@3.0.5
- @thirdweb-dev/chains@0.1.1
## 3.9.0
### Patch Changes
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.9.0",
"version": "3.9.3",
"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 //
@@ -0,0 +1,3 @@
*.pbxproj -text
# specific for windows script files
*.bat text eol=crlf
+70
View File
@@ -0,0 +1,70 @@
# OSX
#
.DS_Store
# XDE
.expo/
# VSCode
.vscode/
jsconfig.json
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Android/IJ
#
.classpath
.cxx
.gradle
.idea
.project
.settings
local.properties
android.iml
# Cocoapods
#
example/ios/Pods
# Ruby
example/vendor/
# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
# Expo
.expo/
# Turborepo
.turbo/
# generated by bob
lib/
@@ -0,0 +1 @@
{}
@@ -0,0 +1,7 @@
# @thirdweb-dev/react-native-compat
## 0.1.0
### Minor Changes
- [#522](https://github.com/thirdweb-dev/js/pull/522) [`18ba6b3`](https://github.com/thirdweb-dev/js/commit/18ba6b381ee5c72e0fe599ab9b32f2ef66443d5f) Thanks [@iketw](https://github.com/iketw)! - [React Native SDK] init package
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Non-Fungible Labs, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+3
View File
@@ -0,0 +1,3 @@
# @thirdweb-dev/react-native-compat
Shims for Thirdweb in React Native Projects
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
+40
View File
@@ -0,0 +1,40 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.1.0",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js",
"license": "Apache-2.0",
"main": "dist/index.js",
"files": [
"dist/*"
],
"keywords": [
"thirdweb",
"dapp",
"react",
"react-native"
],
"scripts": {
"prettier": "prettier --check './**/*.{js,ts,jsx,tsx}'",
"build": "tsc",
"push": "yalc push"
},
"dependencies": {
"@ethersproject/shims": "^5.7.0",
"@walletconnect/react-native-compat": "^2.3.3",
"events": "3.3.0",
"react-native-get-random-values": "^1.8.0",
"base-64": "^1.0.0",
"big-integer": "^1.6.51"
},
"peerDependencies": {
"ethers": ">=5.5.1",
"react": ">=18.0.0",
"react-native": ">=0.70.0",
"wagmi": ">=0.7.0"
},
"devDependencies": {
"babel-plugin-module-resolver": "^5.0.0"
}
}
@@ -0,0 +1 @@
import './shims';
+12
View File
@@ -0,0 +1,12 @@
import 'react-native-get-random-values';
import '@ethersproject/shims';
import '@walletconnect/react-native-compat';
if (typeof BigInt === 'undefined') {
global.BigInt = require('big-integer');
}
if (typeof Buffer === 'undefined') {
global.Buffer = require('buffer').Buffer;
}
global.btoa = global.btoa || require('base-64').encode;
global.atob = global.atob || require('base-64').decode;
@@ -0,0 +1,11 @@
{
"extends": "@thirdweb-dev/tsconfig/react-native-library.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"rootDir": "./src"
},
"typeRoots": ["../node_modules/@types"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
+5
View File
@@ -0,0 +1,5 @@
{
"presets": [
"module:metro-react-native-babel-preset"
]
}
+5
View File
@@ -0,0 +1,5 @@
# folders
dist/
node_modules/
# files
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["thirdweb"],
};
+13
View File
@@ -0,0 +1,13 @@
# XDE
.expo/
# VSCode
.vscode/
jsconfig.json
# node.js
#
node_modules/
npm-debug.log
yarn-debug.log
yarn-error.log
+1
View File
@@ -0,0 +1 @@
{}
+38
View File
@@ -0,0 +1,38 @@
# @thirdweb-dev/react-native
## 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
- Updated dependencies [[`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e), [`300fe4a`](https://github.com/thirdweb-dev/js/commit/300fe4a933f83ac59f89ff019f173cdfc6a2cdff), [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611)]:
- @thirdweb-dev/react-core@3.9.1
- @thirdweb-dev/storage@1.0.9
- @thirdweb-dev/chains@0.1.1
- @thirdweb-dev/sdk@3.9.1
## 0.1.0
### Minor Changes
- [#522](https://github.com/thirdweb-dev/js/pull/522) [`18ba6b3`](https://github.com/thirdweb-dev/js/commit/18ba6b381ee5c72e0fe599ab9b32f2ef66443d5f) Thanks [@iketw](https://github.com/iketw)! - [React Native SDK] init package
+201
View File
@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2021 Non-Fungible Labs, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+22
View File
@@ -0,0 +1,22 @@
<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 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://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>Powering react-native dapps.</strong></p>
<br />
## 👷🚧 Alpha 🚧👷
<br />
## Getting Started
Head over to the [documentation](https://portal.thirdweb.com/react-native) to learn more
+68
View File
@@ -0,0 +1,68 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.1.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"sideEffects": false,
"files": [
"dist/*"
],
"scripts": {
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"build": "tsc",
"push": "yalc push"
},
"keywords": [
"react-native",
"ios",
"android"
],
"dependencies": {
"@tanstack/react-query": "^4.0.10",
"@thirdweb-dev/chains": "*",
"@thirdweb-dev/react-core": "*",
"@thirdweb-dev/sdk": "*",
"@thirdweb-dev/storage": "*",
"tiny-invariant": "^1.2.0",
"wagmi": "^0.11.0"
},
"sideEffects:": false,
"devDependencies": {
"@babel/core": "^7.12.9",
"@react-native-community/eslint-config": "^3.0.2",
"@types/jest": "^29.2.1",
"@types/react": "^18.0.24",
"@types/react-native": "^0.71.0",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.33.0",
"@typescript-eslint/parser": "^5.33.0",
"babel-jest": "^29.2.1",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-inclusive-language": "^2.2.0",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.2.1",
"prettier": "^2.4.1",
"react": "^18.2.0",
"react-native": "^0.71.0",
"react-native-test-app": "^2.3.1",
"react-test-renderer": "^18.2.0",
"typescript": "^4.8.4"
},
"peerDependencies": {
"@react-native-async-storage/async-storage": "*",
"ethers": ">=5.5.1 <6",
"react": ">=18.0.0",
"react-native": ">=0.70.0"
},
"engines": {
"node": ">= 16.0.0"
}
}
+17
View File
@@ -0,0 +1,17 @@
const warnSet = new Set<`${string}:${string}`>();
export function showDeprecationWarning(
deprecated: string,
replacement: string,
) {
// deprecation warnings only in dev only in dev
if (__DEV__) {
if (warnSet.has(`${deprecated}:${replacement}`)) {
return;
}
warnSet.add(`${deprecated}:${replacement}`);
console.warn(
`\`${deprecated}\` is deprecated and will be removed in a future major version. Please use \`${replacement}\` instead.`,
);
}
}
@@ -0,0 +1,2 @@
export const TW_WC_PROJECT_ID = '145769e410f16970a79ff77b2d89a1e0'
export const WC_RELAY_URL = 'wss://relay.walletconnect.com'
@@ -0,0 +1,113 @@
import { useEffect, useState } from "react";
import invariant from "tiny-invariant";
import { useClient, useConnect, useDisconnect } from "wagmi";
import { WalletConnectConnector } from "wagmi/dist/connectors/walletConnect";
import { Linking } from "react-native";
import UniversalProvider from "@walletconnect/universal-provider/dist/types/UniversalProvider";
/**
* Hook for connecting to a mobile wallet with Wallet Connect
*
* ```javascript
* import { useWalletConnect } from "@thirdweb-dev/react-native"
* ```
*
*
* @example
* We can allows user to connect their mobile wallets as follows:
* ```javascript
* import { useWalletConnect } from "@thirdweb-dev/react-native"
*
* const App = () => {
* const {connect} = useWalletConnect()
*
* return (
* <Button onClick={connect} title={'Connect Wallet'} />
* )
* }
* ```
*
* Android: `connect` will trigger a modal with a list of available wallets to connect to on their device.
* iOS: `connect` will try to open the first app available to handle `wc://` links on the device.
*
* @public
*/
export function useWalletConnect() {
const client = useClient();
invariant(
client,
`useWalletConnect() can only be used inside <ThirdwebProvider />. If you are using <ThirdwebSDKProvider /> you will have to use your own wallet-connection logic.`,
);
const [displayUri, setDisplayUri] = useState<string | undefined>();
const [connectError, setConnectError] = useState<Error | null>();
const { connect, connectors, error: wagmiConnectError, isLoading, isSuccess } =
useConnect();
const walletConnector = connectors.find(
(c) => c.id === "walletConnect",
) as WalletConnectConnector;
invariant(
walletConnector,
"WalletConnectConnector not found, please make sure it is provided to your <ThirdwebProvider />",
);
const { disconnect } = useDisconnect();
useEffect(() => {
setConnectError(wagmiConnectError);
}, [wagmiConnectError]);
useEffect(() => {
// wagmi storage doesn't support async storage on mobile so we need to manually connect
// https://github.com/wagmi-dev/wagmi/discussions/1630
const getProvider = async () => {
const provider = await walletConnector.getProvider();
const univProvider = provider as unknown as UniversalProvider;
// waiting on wagmi to update to latest universal provider (tag 2.4.2)
// univProvider.client.on('session_request_sent', ({ topic, request, chainId }) => {
// // redirect to wallet
// Linking.openURL(displayUri);
// });
if (univProvider.client.session.length > 0) {
// wc client does not report a successful initialization
// so we need to wait for it to initialize before connecting
setTimeout(() => {
connect({ connector: walletConnector });
}, 100);
}
}
getProvider();
// eslint-disable-next-line react-hooks/exhaustive-deps -- we only want to run this once
}, [])
useEffect(() => {
walletConnector.addListener('message', async ({ type, data }) => {
switch (type) {
case 'display_uri':
invariant(typeof data === 'string', 'display_uri message data must be a string')
// store first part of the uri to trigger wallet connect
setDisplayUri(data);
Linking.openURL(data);
break;
}
})
walletConnector.addListener('connect', () => {
console.log('walletConnector connect')
});
walletConnector.addListener('disconnect', () => {
// we need to disconnect wagmi when the connector disconnects
disconnect();
})
return () => {
walletConnector.removeAllListeners();
}
}, [disconnect, walletConnector]);
return { connector: walletConnector, connect: () => { connect({ connector: walletConnector }) }, isLoading: isLoading, isSuccess: isSuccess, connectError, displayUri }
}
@@ -0,0 +1,14 @@
import invariant from "tiny-invariant";
import { useAccount as useWagmiAccount, useClient } from "wagmi";
/**
* @internal
*/
export function useAccount(): ReturnType<typeof useWagmiAccount> {
const wagmiContext = useClient();
invariant(
wagmiContext,
`useAccount() can only be used inside <ThirdwebProvider />. If you are using <ThirdwebSDKProvider /> you will have to use your own account logic.`,
);
return useWagmiAccount();
}
@@ -0,0 +1,46 @@
import { useCallback } from "react";
import invariant from "tiny-invariant";
import { useClient, useDisconnect as useWagmiDisconnect } from "wagmi";
/**
* Hook for disconnecting the currently connected wallet
*
* ```javascript
* import { useDisconnect } from "@thirdweb-dev/react"
* ```
*
*
* @example
* The following will enable users to disconnect their wallet from the page.
* ```javascript
* import { useDisconnect } from "@thirdweb-dev/react-native"
*
* const App = () => {
* const disconnect = useDisconnect()
*
* return (
* <Button onClick={disconnect} title={'Disconnect'} />
* )
* }
* ```
*
* Once users disconnect their wallet, the `useAddress`, `useChainId`, `useAccount`, and `useNetwork` hooks will no longer return values until a user connects their wallet again.
*
* @public
*/
export function useDisconnect() {
const wagmiClient = useClient();
invariant(
wagmiClient,
`useDisconnect() can only be used inside <ThirdwebProvider />. If you are using <ThirdwebSDKProvider /> you will have to use your own connection logic.`,
);
const { disconnect } = useWagmiDisconnect();
const disconnectInternal = useCallback(() => {
disconnect();
wagmiClient.queryClient.clear();
}, [disconnect, wagmiClient.queryClient]);
return disconnectInternal;
}
@@ -0,0 +1,35 @@
import invariant from "tiny-invariant";
import { useNetwork as useWagmiNetwork, useClient } from "wagmi";
/**
* Hook for getting metadata about the network the current wallet is connected to and switching networks
*
* @example
* ```javascript
* import { useNetwork, ChainId } from "@thirdweb-dev/react";
*
* const App = () => {
* const [, switchNetwork] = useNetwork();
*
* return (
* <button onClick={() => switchNetwork(ChainId.Polygon)}>
* Switch Network
* </button>
* );
* };
```
*
* It's important to note that some wallet apps do not support programmatic network switching and switchNetwork will be undefined.
* For those situations, you can typically switch networks in the wallet app this hook will still work.
*
* @public
*/
export function useNetwork(): ReturnType<typeof useWagmiNetwork> {
const wagmiContext = useClient();
invariant(
wagmiContext,
`useNetwork() can only be used inside <ThirdwebProvider />. If you are using <ThirdwebSDKProvider /> you will have to use your own network logic.`,
);
return useWagmiNetwork();
}
+11
View File
@@ -0,0 +1,11 @@
// providers
export * from "./providers/full";
// require to be inside `<ThirdwebProvider />`
export * from "./hooks/wagmi-required/useAccount";
export * from "./hooks/wagmi-required/useNetwork";
export * from "./hooks/connectors/useWalletConnect";
export * from "./hooks/wagmi-required/useDisconnect";
// re-export everything from react-core
export * from "@thirdweb-dev/react-core/evm";
@@ -0,0 +1,303 @@
import { QueryClient } from "@tanstack/react-query";
import { Chain, defaultChains } from "@thirdweb-dev/chains";
import {
ThirdwebAuthConfig,
ThirdwebConfigProvider,
ThirdwebSDKProvider,
ThirdwebSDKProviderProps,
} from "@thirdweb-dev/react-core/evm";
import type { SDKOptions } from "@thirdweb-dev/sdk";
import type { ThirdwebStorage } from "@thirdweb-dev/storage";
import { getDefaultProvider } from "ethers";
import { transformChainToMinimalWagmiChain } from "../utils/chains";
import React, { useMemo } from "react";
import invariant from "tiny-invariant";
import {
Connector, createClient, useSigner, WagmiConfig,
} from "wagmi";
import { WalletConnectConnector } from "wagmi/connectors/walletConnect";
import { TW_WC_PROJECT_ID, WC_RELAY_URL } from "../constants/walletConnect";
import { showDeprecationWarning } from "../../core/utils";
/**
* @internal
*/
export type WalletConnectConnectorType =
| WalletConnectConnector
| 'walletConnect'
| { name: 'walletConnect'; options: Omit<WalletConnectConnector['options'], 'version' | 'qrcode' | 'metadata'> };
/**
* @internal
*/
export type WalletConnector = WalletConnectConnectorType;
/**
* the metadata to pass to wallet connection dialog (may show up during the wallet-connection process)
* @remarks this is only used for wallet connect and wallet link, metamask does not support it
* @public
*/
export interface DAppMetaData {
/**
* the name of your app
*/
name: string;
/**
* optional - a description of your app
*/
description: string;
/**
* optional - a url that points to a logo (or favicon) of your app
*/
logoUrl: string;
/**
* optional - the url where your app is hosted
*/
url: string;
/**
* optional - whether to show the connect dialog in darkmode or not
*/
isDarkMode?: boolean;
}
/**
* The possible props for the ThirdwebProvider.
*/
export interface ThirdwebProviderProps<
TChains extends Chain[] = typeof defaultChains,
> {
/**
* The network to use for the SDK.
*/
activeChain?: TChains[number]["chainId"] | TChains[number]["slug"] | Chain;
/**
* Chains to support. If not provided, will default to the chains supported by the SDK.
*/
supportedChains?: Readonly<TChains>;
/**
* The {@link SDKOptions | Thirdweb SDK Options} to pass to the thirdweb SDK
* comes with sensible defaults
*/
sdkOptions?: SDKOptions;
/**
* An array of connector types (strings) or wallet connector objects that the dApp supports
* If not provided, will default to metamask (injected), wallet connect and walletlink (coinbase wallet) with sensible defaults
*/
walletConnectors?: WalletConnector[];
/**
* Metadata to pass to wallet connect and walletlink wallet connect. (Used to show *which* dApp is being connected to in mobile wallets that support it)
* Defaults to just the name being passed as `thirdweb powered dApp`.
*/
dAppMeta?: DAppMetaData;
/**
* The configuration used for thirdweb auth usage. Enables users to login
* to backends with their wallet.
*/
authConfig?: ThirdwebAuthConfig;
/**
* The storage interface to use with the sdk.
*/
storageInterface?: ThirdwebStorage;
/**
* The react-query client to use. (Defaults to a default client.)
*/
queryClient?: QueryClient;
/**
* The chainId that your dApp is running on.
* @deprecated - use `network` instead
*/
desiredChainId?: number | undefined;
/**
* A partial map of chainIds to rpc urls to use for certain chains
* If not provided, will default to the rpcUrls of the chain objects for the supported chains
* @deprecated - use `chains` instead
*/
chainRpc?: Record<number, string>;
}
// SDK handles this under the hood for us
const defaultdAppMeta: DAppMetaData = {
name: 'thirdweb powered dApp',
url: 'https://thirdweb.com',
logoUrl: 'https://thirdweb.com/favicon.ico',
description: 'thirdweb powered dApp',
};
const defaultWalletConnectors: Required<
ThirdwebProviderProps['walletConnectors']
> = ['walletConnect'];
/**
*
* The `<ThirdwebProvider />` component lets you control what networks you want users to connect to, what types of wallets can connect to your app, and the settings for the [Typescript SDK](https://docs.thirdweb.com/typescript).
*
* @example
* You can wrap your application with the provider as follows:
*
* ```jsx title="App.jsx"
* import { ThirdwebProvider, ChainId } from "@thirdweb-dev/react";
*
* const App = () => {
* return (
* <ThirdwebProvider desiredChainId={ChainId.Mainnet}>
* <YourApp />
* </ThirdwebProvider>
* );
* };
* ```
*
* @public
*
*/
export const ThirdwebProvider = <
TChains extends Chain[] = typeof defaultChains,
>({
sdkOptions,
// @ts-expect-error - different subtype of Chain[] but this works fine
supportedChains = defaultChains,
activeChain,
walletConnectors = defaultWalletConnectors,
dAppMeta = defaultdAppMeta,
authConfig,
storageInterface,
queryClient,
children,
// deprecated
desiredChainId,
chainRpc,
}: React.PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
if (chainRpc) {
showDeprecationWarning("chainRpc", "supportedChains");
}
if (desiredChainId) {
showDeprecationWarning("desiredChainId", "activeChain");
}
const mergedChains = useMemo(() => {
if (
!activeChain ||
typeof activeChain === "string" ||
typeof activeChain === "number"
) {
return supportedChains as Readonly<Chain[]>;
}
return [...supportedChains, activeChain] as Readonly<Chain[]>;
}, [supportedChains, activeChain]);
const _client = useMemo(() => {
const walletConnectClientMeta = {
name: dAppMeta.name,
url: dAppMeta.url,
icons: [dAppMeta.logoUrl],
description: dAppMeta.description,
};
const wagmiChains = mergedChains.map(transformChainToMinimalWagmiChain);
const client = createClient({
connectors: () => {
return walletConnectors
.map((connector) => {
if (connector instanceof Connector) {
return connector;
}
// wallet connect
if (
(typeof connector === 'string' &&
connector === 'walletConnect') ||
(typeof connector === 'object' &&
connector.name === 'walletConnect')
) {
const mainnet = wagmiChains.find((chain) => chain.id === 1);
invariant(mainnet, 'Mainnet chain not found');
return new WalletConnectConnector({
chains: [mainnet],
options: typeof connector === "string"
? {
metadata: walletConnectClientMeta,
qrcode: false,
version: '2',
projectId: TW_WC_PROJECT_ID,
relayUrl: WC_RELAY_URL,
logger: 'info',
}
: {
metadata: walletConnectClientMeta,
qrcode: false,
version: '2',
projectId: TW_WC_PROJECT_ID,
relayUrl: WC_RELAY_URL,
logger: 'info',
... connector.options
},
});
}
throw new Error(`Wallet connector not recognised: ${connector}`);
})
.filter((c) => c !== null);
},
provider: getDefaultProvider(),
});
return client;
}, [dAppMeta.description, dAppMeta.logoUrl, dAppMeta.name, dAppMeta.url, mergedChains, walletConnectors]);
const activeChainId = useMemo(() => {
if (!activeChain) {
return undefined;
}
if (typeof activeChain === "string" || typeof activeChain === "number") {
return activeChain;
}
return activeChain.chainId;
}, [activeChain]);
return (
<ThirdwebConfigProvider
value={{
chains: supportedChains,
}}
>
<WagmiConfig client={_client}>
<ThirdwebSDKProviderWagmiWrapper
queryClient={queryClient}
sdkOptions={sdkOptions}
supportedChains={supportedChains}
// desiredChainId is deprecated, we will remove it in the future but still need to pass it here for now
activeChain={activeChainId || desiredChainId}
storageInterface={storageInterface}
authConfig={authConfig}
>
{children}
</ThirdwebSDKProviderWagmiWrapper>
</WagmiConfig>
</ThirdwebConfigProvider>
);
};
const ThirdwebSDKProviderWagmiWrapper = <TChains extends Chain[]>({
children,
...props
}: React.PropsWithChildren<
Omit<ThirdwebSDKProviderProps<TChains>, "signer" | "provider">
>) => {
const {data} = useSigner();
return (
<ThirdwebSDKProvider signer={data || undefined} {...props}>
{children}
</ThirdwebSDKProvider>
);
};
@@ -0,0 +1,37 @@
import { Chain as WagmiChain } from "wagmi";
import { Chain } from "@thirdweb-dev/chains";
export function transformChainToMinimalWagmiChain(chain: Chain): WagmiChain {
return {
id: chain.chainId,
name: chain.name,
network: chain.slug,
nativeCurrency: {
name: chain.nativeCurrency.name,
symbol: chain.nativeCurrency.symbol,
decimals: chain.nativeCurrency.decimals as 18,
},
testnet: chain.testnet,
rpcUrls: {
default: {
http: chain.rpc as string[],
},
public: {
http: chain.rpc as string[],
},
},
blockExplorers: chain.explorers?.reduce((prev, explorer: {
name: string;
url: string;
standard: string;
}) => {
return {
...prev,
[explorer.name]: {
name: explorer.name,
url: explorer.url,
},
};
}, { default: { name: chain.explorers[0].name, url: chain.explorers[0].url } })
};
}
+1
View File
@@ -0,0 +1 @@
export * from "./evm";
+11
View File
@@ -0,0 +1,11 @@
{
"extends": "@thirdweb-dev/tsconfig/react-native-library.json",
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./src",
"rootDir": "./src"
},
"typeRoots": ["../node_modules/@types"],
"include": ["./src/**/*.ts", "./src/**/*.tsx"],
"exclude": ["node_modules", "**/*.test.ts", "**/*.test.tsx"]
}
+35
View File
@@ -1,5 +1,40 @@
# @thirdweb-dev/react
## 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
- [#599](https://github.com/thirdweb-dev/js/pull/599) [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix readonly chain mismatch
- [#588](https://github.com/thirdweb-dev/js/pull/588) [`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e) Thanks [@adam-maj](https://github.com/adam-maj)! - Update to use new Auth
- Updated dependencies [[`f0de81d`](https://github.com/thirdweb-dev/js/commit/f0de81d4b1ba33b2ac73ed16cfdea8fd4eb5da9e), [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611)]:
- @thirdweb-dev/react-core@3.9.1
- @thirdweb-dev/chains@0.1.1
- @thirdweb-dev/wallets@0.2.2
## 3.9.0
### Minor Changes
+89 -83
View File
@@ -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.0",
"version": "3.9.3",
"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>
* );
@@ -405,7 +405,8 @@ export const ThirdwebProvider = <
<ThirdwebSDKProviderWagmiWrapper
queryClient={queryClient}
sdkOptions={sdkOptions}
supportedChains={supportedChains}
// @ts-expect-error - we are passing the wrong type here, but it's ok because we are passing the correct type to the provider
supportedChains={mergedChains}
// desiredChainId is deprecated, we will remove it in the future but still need to pass it here for now
activeChain={activeChainId || desiredChainId}
storageInterface={storageInterface}
+27
View File
@@ -1,5 +1,32 @@
# @thirdweb-dev/sdk
## 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
- Updated dependencies [[`300fe4a`](https://github.com/thirdweb-dev/js/commit/300fe4a933f83ac59f89ff019f173cdfc6a2cdff), [`f580b8a`](https://github.com/thirdweb-dev/js/commit/f580b8ac06534df24b0194cbc632b4a8fd447611)]:
- @thirdweb-dev/storage@1.0.9
- @thirdweb-dev/chains@0.1.1
## 3.9.0
### Minor Changes
+1 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.9.0",
"version": "3.9.3",
"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,
+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>
+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";

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