Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
521c85c1ba Version Packages (#618)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-23 09:29:36 -08:00
Jonas DanielsandGitHub b7a5b45441 fix base goerli slug (#619) 2023-02-23 17:17:37 +00:00
Jonas DanielsandGitHub d7deaa48f2 [chains] - add support for base goerli (#617) 2023-02-23 16:58:25 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
98fc320a86 Version Packages (#614)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-22 21:48:03 -08:00
Joaquim VergesandGitHub 5712650074 [SDK] Handle custom currencies for any chain (#616) 2023-02-23 05:33:00 +00:00
Jonas DanielsandGitHub 1b0bc87efb [sdk] add code cov (#615) 2023-02-23 01:26:53 +00:00
Jonas DanielsandGitHub a3472a1331 [chains] - DX improvements & chain updates (#613) 2023-02-23 00:01:59 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
7c3f050883 Version Packages (#609)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-22 13:59:28 -08:00
8b68f20678 refactor: Release to Publish (#567)
Co-authored-by: Jonas Daniels <[email protected]>
2023-02-22 21:36:03 +00:00
Jonas DanielsandGitHub 3d644fb8cb [react] - add mediarenderer prop (#608) 2023-02-21 10:30:21 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
690ff925c3 Version Packages (#603)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-02-20 20:13:14 -08:00
Jonas DanielsandGitHub 4fe6797427 clean up remaining workflows (#605) 2023-02-19 02:12:39 +00:00
Jonas DanielsandGitHub f3408d05d8 [sdk] - fix possible crash in StaticJsonRpcBatchProvider (#604) 2023-02-19 01:47:29 +00:00
Jonas Daniels 845e818c66 CI all in one? 2023-02-18 14:55:51 -08:00
Jonas Daniels 5178256e84 try out new ci action 2023-02-18 14:40:23 -08:00
Jonas DanielsandGitHub 66cf1fb5c2 [various] - upgrade dependencies (#601) 2023-02-18 22:10:45 +00:00
Jonas Daniels df792f0b81 make merge queue work 2023-02-18 14:10:16 -08:00
Jonas Daniels ae0f967356 make platform own everything by default 2023-02-18 13:55:33 -08:00
Jonas Daniels 076718112f devrel should not own changeset markdown files 2023-02-18 13:54:00 -08:00
Jonas Daniels 7c9f86cc44 improve codeowners 2023-02-18 13:51:56 -08:00
Jonas DanielsandGitHub 9c90371426 Jd/add codeowners (#602) 2023-02-18 13:49:09 -08:00
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
180 changed files with 11446 additions and 5697 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
+117
View File
@@ -0,0 +1,117 @@
name: Build, Lint & Test
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
# trigger on merge group as well (merge queue)
merge_group:
types: [checks_requested]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# To use Remote Caching, uncomment the next lines and follow the steps below.
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
jobs:
build:
name: Build
runs-on: ubuntu-latest-16
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 25
- name: Install
uses: ./.github/composite-actions/install
- run: yarn build
# We use week in the turbo cache key to keep the cache from infinitely growing
- id: get-week
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
timeout-minutes: 5
id: cache-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
lint:
name: Lint Packages
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: yarn lint
test:
name: Unit Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: yarn test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: ./packages/sdk/coverage/evm/lcov.info,./packages/sdk/coverage/solana/lcov.info,
e2e:
name: E2E Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16
check-latest: true
- uses: actions/cache@v3
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run e2e tests
run: yarn e2e
env:
NODE_OPTIONS: "--max_old_space_size=4096"
-29
View File
@@ -1,29 +0,0 @@
name: Integration tests
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
integration-tests:
timeout-minutes: 30
runs-on: ubuntu-latest-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/**}"
+2 -2
View File
@@ -8,8 +8,8 @@
<h1 align="center"><a href='http://thirdweb.com/'>thirdweb</a> JavaScript/TypeScript monorepo</h1>
<p align="center">
<a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml">
<img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml">
<img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/>
</a>
<a href="https://discord.gg/thirdweb">
<img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/>
+2 -2
View File
@@ -13,7 +13,7 @@
]
},
"scripts": {
"test": "turbo run test test:evm test:solana",
"test": "turbo run test test:evm test:solana --filter=./packages/*",
"e2e": "turbo run e2e",
"build": "turbo run build --filter=./packages/*",
"build:release": "turbo run build --force --filter=./packages/*",
@@ -41,7 +41,7 @@
"mocha": "^10.2.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.7.1",
"turbo": "^1.4.6",
"turbo": "^1.8.2",
"yalc": "^1.0.0-pre.53"
},
"manypkg": {
+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
View File
@@ -5,6 +5,8 @@
</p>
<h1 align="center">thirdweb Auth</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.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)));
}
}
+34
View File
@@ -1,5 +1,39 @@
# @thirdweb-dev/chains
## 0.1.5
### Patch Changes
- [#617](https://github.com/thirdweb-dev/js/pull/617) [`d7deaa4`](https://github.com/thirdweb-dev/js/commit/d7deaa48f2f943deb8f2ad7459d17de930c00517) Thanks [@jnsdls](https://github.com/jnsdls)! - Add Base Goerli
- [#619](https://github.com/thirdweb-dev/js/pull/619) [`b7a5b45`](https://github.com/thirdweb-dev/js/commit/b7a5b454415596316f58a75f14472631242cc115) Thanks [@jnsdls](https://github.com/jnsdls)! - fix the slug for base-goerli
## 0.1.4
### Patch Changes
- [#613](https://github.com/thirdweb-dev/js/pull/613) [`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9) Thanks [@jnsdls](https://github.com/jnsdls)! - Update Chains
- [#616](https://github.com/thirdweb-dev/js/pull/616) [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - new chains
## 0.1.3
### Patch Changes
- [#608](https://github.com/thirdweb-dev/js/pull/608) [`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains
## 0.1.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
## 0.1.1
### Patch Changes
- [#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
+24 -4
View File
@@ -5,12 +5,32 @@
</p>
<h1 align="center">thirdweb chains</h1>
<p align="center">
<!-- <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> -->
<!-- <a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/></a> -->
<!-- <a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a> -->
<a href="https://www.npmjs.com/package/@thirdweb-dev/chains"><img src="https://img.shields.io/npm/v/@thirdweb-dev/chains?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
<!-- <p align="center"><strong>Best in class Web3 SDK for Browser, Node and Mobile apps</strong></p> -->
<br />
### todo
## Installation
```bash
yarn add @thirdweb-dev/chains
```
## Contributing
### Adding / Overriding Chain Data
Chain data is automatically pulled in from [ethereum-lists/chains](https://github.com/ethereum-lists/chains) on every build.
#### Overriding Chain Data
Chain data can be overridden by running `yarn override-chain` and following the prompts.
#### Adding A New Chain
In cases where a chain is not listed in the [ethereum-lists/chains](https://github.com/ethereum-lists/chains) repo, you can add it manually by running `yarn add-chain` and following the prompts.
> Prefer adding chains to the ethereum-lists/chains repo instead of manually adding them here.
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "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"
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "Bitcichain Mainnet",
"chain": "BITCI",
"icon": {
"url": "ipfs://QmbxmfWw5sVMASz5EbR1DCgLfk8PnqpSJGQKpYuEUpoxqn",
"width": 64,
"height": 64,
"format": "svg"
},
"rpc": [
"https://bitcichain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.bitci.com"
],
"faucets": [],
"nativeCurrency": {
"name": "Bitci",
"symbol": "BITCI",
"decimals": 18
},
"infoURL": "https://www.bitcichain.com",
"shortName": "bitci",
"chainId": 1907,
"networkId": 1907,
"explorers": [
{
"name": "Bitci Explorer",
"url": "https://bitciexplorer.com",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "bitcichain"
} as const;
+35
View File
@@ -0,0 +1,35 @@
export default {
"name": "Bitcichain Testnet",
"chain": "TBITCI",
"icon": {
"url": "ipfs://QmbxmfWw5sVMASz5EbR1DCgLfk8PnqpSJGQKpYuEUpoxqn",
"width": 64,
"height": 64,
"format": "svg"
},
"rpc": [
"https://bitcichain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.bitcichain.com"
],
"faucets": [
"https://faucet.bitcichain.com"
],
"nativeCurrency": {
"name": "Test Bitci",
"symbol": "TBITCI",
"decimals": 18
},
"infoURL": "https://www.bitcichain.com",
"shortName": "tbitci",
"chainId": 1908,
"networkId": 1908,
"explorers": [
{
"name": "Bitci Explorer Testnet",
"url": "https://testnet.bitciexplorer.com",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "bitcichain-testnet"
} as const;
+6
View File
@@ -22,6 +22,12 @@ export default {
"standard": "none"
}
],
"icon": {
"url": "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
"height": 512,
"width": 512,
"format": "png"
},
"testnet": false,
"slug": "gather-network"
} as const;
+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;
+9 -1
View File
@@ -5,7 +5,9 @@ export default {
"https://gather-testnet-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet.gather.network"
],
"faucets": [],
"faucets": [
"https://testnet-faucet.gather.network/"
],
"nativeCurrency": {
"name": "Gather",
"symbol": "GTH",
@@ -23,5 +25,11 @@ export default {
}
],
"testnet": true,
"icon": {
"url": "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
"height": 512,
"width": 512,
"format": "png"
},
"slug": "gather-testnet-network"
} as const;
+34
View File
@@ -0,0 +1,34 @@
export default {
"name": "Hika Network Testnet",
"title": "Hika Network Testnet",
"chain": "HIK",
"icon": {
"url": "ipfs://QmW44FPm3CMM2JDs8BQxLNvUtykkUtrGkQkQsUDJSi3Gmp",
"width": 350,
"height": 84,
"format": "png"
},
"rpc": [
"https://hika-network-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.hika.network/"
],
"faucets": [],
"nativeCurrency": {
"name": "Hik Token",
"symbol": "HIK",
"decimals": 18
},
"infoURL": "https://hika.network/",
"shortName": "hik",
"chainId": 5729,
"networkId": 5729,
"explorers": [
{
"name": "Hika Network Testnet Explorer",
"url": "https://scan-testnet.hika.network",
"standard": "none"
}
],
"testnet": true,
"slug": "hika-network-testnet"
} 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"
}
],
+40
View File
@@ -0,0 +1,40 @@
export default {
"name": "Base Goerli Testnet",
"chain": "ETH",
"rpc": [
"https://base-goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://goerli.base.org"
],
"faucets": [
"https://www.coinbase.com/faucets/base-ethereum-goerli-faucet"
],
"nativeCurrency": {
"name": "Goerli Ether",
"symbol": "ETH",
"decimals": 18
},
"infoURL": "https://base.org",
"shortName": "basegor",
"chainId": 84531,
"networkId": 84531,
"explorers": [
{
"name": "basescout",
"url": "https://base-goerli.blockscout.com",
"standard": "none"
},
{
"name": "basescan",
"url": "https://goerli.basescan.org",
"standard": "none"
}
],
"testnet": true,
"icon": {
"url": "ipfs://QmW5Vn15HeRkScMfPcW12ZdZcC2yUASpu6eCsECRdEmjjj/base-512.png",
"height": 512,
"width": 512,
"format": "png"
},
"slug": "base-goerli"
} as const;
+33
View File
@@ -0,0 +1,33 @@
export default {
"name": "MARO Blockchain Mainnet",
"chain": "MARO Blockchain",
"icon": {
"url": "ipfs://bafkreig47k53aipns6nu3u5fxpysp7mogzk6zyvatgpbam7yut3yvtuefa",
"width": 160,
"height": 160,
"format": "png"
},
"rpc": [
"https://maro-blockchain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-mainnet.ma.ro"
],
"faucets": [],
"nativeCurrency": {
"name": "MARO",
"symbol": "MARO",
"decimals": 18
},
"infoURL": "https://ma.ro/",
"shortName": "maro",
"chainId": 8848,
"networkId": 8848,
"explorers": [
{
"name": "MARO Scan",
"url": "https://scan.ma.ro/#",
"standard": "none"
}
],
"testnet": false,
"slug": "maro-blockchain"
} as const;
+38
View File
@@ -0,0 +1,38 @@
export default {
"name": "Bitkub Chain",
"chain": "BKC",
"icon": {
"url": "ipfs://QmYFYwyquipwc9gURQGcEd4iAq7pq15chQrJ3zJJe9HuFT",
"width": 1000,
"height": 1000,
"format": "png"
},
"rpc": [
"https://bitkub-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.bitkubchain.io",
"wss://wss.bitkubchain.io"
],
"faucets": [],
"nativeCurrency": {
"name": "Bitkub Coin",
"symbol": "KUB",
"decimals": 18
},
"infoURL": "https://www.bitkubchain.com/",
"shortName": "bkc",
"chainId": 96,
"networkId": 96,
"explorers": [
{
"name": "Bitkub Chain Explorer",
"url": "https://bkcscan.com",
"standard": "none",
"icon": "bkc"
}
],
"redFlags": [
"reusedChainId"
],
"testnet": false,
"slug": "bitkub-chain"
} as const;
+27
View File
@@ -0,0 +1,27 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "Localhost",
chain: "ETH",
rpc: ["http://localhost:8545"],
faucets: [],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
// hard code eth icon for now
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
shortName: "local",
chainId: 1337,
networkId: 1337,
testnet: true,
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 192837465,
icon: {
url: "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
height: 512,
width: 512,
format: "png",
},
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
@@ -0,0 +1,15 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 356256156,
testnet: true,
icon: {
url: "ipfs://Qmc9AJGg9aNhoH56n3deaZeUc8Ty1jDYJsW6Lu6hgSZH4S",
height: 512,
width: 512,
format: "png",
},
faucets: ["https://testnet-faucet.gather.network/"],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}"],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}"],
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
+17
View File
@@ -0,0 +1,17 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: [
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 8453,
icon: {
url: "ipfs://QmW5Vn15HeRkScMfPcW12ZdZcC2yUASpu6eCsECRdEmjjj/base-512.png",
height: 512,
width: 512,
format: "png",
},
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 84531,
testnet: true,
icon: {
url: "ipfs://QmW5Vn15HeRkScMfPcW12ZdZcC2yUASpu6eCsECRdEmjjj/base-512.png",
height: 512,
width: 512,
format: "png",
},
};
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
};
-153
View File
@@ -1,153 +0,0 @@
{
"1": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"5": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"137": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"80001": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"250": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"4002": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/fantom/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"43114": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://avalanche-mainnet.infura.io/v3/${INFURA_API_KEY}"]
},
"43113": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}"]
},
"10": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}",
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"420": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/optimism/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"42161": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": ["https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}"]
},
"421613": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
},
"rpc": [
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}"
]
},
"56": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
},
"97": {
"icon": {
"url": "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png",
"height": 512,
"width": 512,
"format": "png",
"sizes": [16, 32, 64, 128, 256, 512]
}
}
}
+6 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.0",
"version": "0.1.5",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
@@ -18,20 +18,21 @@
"author": "thirdweb eng <[email protected]>",
"devDependencies": {
"axios": "^0.27.2",
"plop": "^3.1.2",
"typescript": "^4.7.4"
},
"preconstruct": {
"entrypoints": [
"index.ts"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
"scripts": {
"build": "node ./scripts/generate-package.mjs && tsc && preconstruct build",
"push": "yalc push"
"push": "yalc push",
"plop": "plop",
"add-chain": "plop add-chain",
"override-chain": "plop override-chain"
}
}
@@ -0,0 +1,11 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
{{> namePartial}}
{{> chainPartial}}
{{> shortNamePartial}}
{{> chainIdPartial}}
{{> isTestnetPartial}}
};
@@ -0,0 +1,22 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
{{!-- if we have a name --}}
{{#if name}}
{{> namePartial}}
{{/if}}
{{!-- if we have a chain --}}
{{#if chain}}
{{> chainPartial}}
{{/if}}
{{#if shortName}}
{{> shortNamePartial}}
{{/if}}
{{!-- chainId always exists --}}
{{> chainIdPartial}}
{{#if isTestnet}}
{{> isTestnetPartial}}
{{/if}}
};
+80
View File
@@ -0,0 +1,80 @@
const chainIdPrompt = {
type: "number",
name: "chainId",
message: "Chain ID",
validate: (value) => {
if (value.length === 0) {
return "ChainId is required";
}
if (!/^\d+$/.test(value)) {
return "ChainId must be a number";
}
return true;
},
};
const stringPrompt = (id, title, isRequired) => ({
type: "input",
name: id,
message: title,
validate: (value) => {
if (isRequired && value.length === 0) {
return `${title} is required`;
}
return true;
},
});
const testnetPrompt = {
type: "confirm",
name: "isTestnet",
message: "Is this a testnet?",
};
export default function (
/** @type {import('plop').NodePlopAPI} */
plop,
) {
// add partials
plop.setPartial("chainIdPartial", "chainId: {{chainId}},\n");
plop.setPartial("namePartial", `name: "{{name}}",\n`);
plop.setPartial("chainPartial", `chain: "{{chain}}",\n`);
plop.setPartial("shortNamePartial", `shortName: "{{shortName}}",\n`);
plop.setPartial("isTestnetPartial", `testnet: {{isTestnet}},\n`);
plop.setGenerator("add-chain", {
description: "add a new chain",
prompts: [
chainIdPrompt,
stringPrompt("name", "Name", true),
stringPrompt("chain", "Chain", true),
stringPrompt("shortName", "Short Name", true),
testnetPrompt,
],
actions: [
{
type: "add",
path: "data/additional/{{chainId}}.mjs",
templateFile: "plop-templates/add-chain.hbs",
},
],
});
plop.setGenerator("override-chain", {
description: "add an override for a chain",
prompts: [
chainIdPrompt,
stringPrompt("name", "Name"),
stringPrompt("chain", "Chain"),
stringPrompt("shortName", "Short Name"),
testnetPrompt,
],
actions: [
{
type: "add",
path: "data/overrides/{{chainId}}.mjs",
templateFile: "plop-templates/chain-override.hbs",
},
],
});
}
+35 -31
View File
@@ -1,11 +1,15 @@
// @ts-check
import axios from "axios";
import merge from "deepmerge";
import fs from "fs";
import path from "path";
const combineMerge = (target, source, options) => {
/** @typedef {import("../src/types").Chain} Chain */
const combineMerge = (target, source) => {
let destination = target.slice();
source.forEach((item, index) => {
source.forEach((item) => {
if (target.indexOf(item) === -1) {
destination = [item, ...destination];
}
@@ -15,16 +19,39 @@ const combineMerge = (target, source, options) => {
const chainsDir = "./chains";
/** @typedef {{name: string, chain: string, icon: string, rpc: string[], faucets?: any[], nativeCurrency: {name: string, symbol: string, decimals: number}, infoURL?: string, shortName: string, chainId: number, networkId: number, slip44?: number, ens: {registry: string}, explorers?: {name: string, url: string, standard: string}[] }} Chain */
const chainsJsonUrl = "https://chainid.network/chains.json";
const iconRoute =
"https://raw.githubusercontent.com/ethereum-lists/chains/master/_data/icons";
const overrides = JSON.parse(fs.readFileSync("./overrides.json"));
/** @type {Record<number, Partial<Chain>>} */
let overrides = {};
// get all overides by reading the overrides directory and importing them
const overridesDir = path.join(process.cwd(), "./data/overrides");
const overridesFiles = fs.readdirSync(overridesDir);
for (const file of overridesFiles) {
const override = await import(path.join(overridesDir, file));
// get file name without extension
const chainId = parseInt(file.split(".")[0]);
overrides[chainId] = override.default;
}
// chains from remote src
/** @type {Chain[]} */
let chains = (await axios.get(chainsJsonUrl)).data;
// immediately filter out localhost
chains = chains.filter((c) => c.chainId !== 1337);
// additional chains
// get all additional chains by reading the additional chains directory and importing them
const additionalChainsDir = path.join(process.cwd(), "./data/additional");
const additionalChainsFiles = fs.readdirSync(additionalChainsDir);
for (const file of additionalChainsFiles) {
const additionalChain = await import(path.join(additionalChainsDir, file));
chains.push(additionalChain.default);
}
chains = chains
.filter((c) => c.status !== "deprecated")
@@ -44,32 +71,6 @@ chains = chains
};
});
chains = chains.filter((c) => c.chainId !== 1337);
// inject in localhost
chains.push({
name: "Localhost",
chain: "ETH",
rpc: ["http://localhost:8545"],
faucets: [],
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
// hard code eth icon for now
icon: {
url: "ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
height: 512,
width: 512,
format: "png",
sizes: [16, 32, 64, 128, 256, 512],
},
shortName: "local",
chainId: 1337,
networkId: 1337,
testnet: true,
});
const imports = [];
const exports = [];
const exportNames = [];
@@ -118,6 +119,9 @@ function findSlug(chain) {
if (slug === "binance-smart-chain-testnet") {
slug = "binance-testnet";
}
if (slug === "base-goerli-testnet") {
slug = "base-goerli";
}
// end special cases
takenSlugs[slug] = true;
File diff suppressed because one or more lines are too long
+1
View File
@@ -33,6 +33,7 @@ export type Chain = {
testnet: boolean;
slug: string;
slip44?: number;
status?: string;
};
// MinimalChain is a subset of Chain with only the fields that are required / non-optional
+37
View File
@@ -1,5 +1,42 @@
# thirdweb
## 0.9.25
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.9.5
## 0.9.24
### Patch Changes
- Updated dependencies [[`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/sdk@3.9.4
## 0.9.23
### Patch Changes
- [#567](https://github.com/thirdweb-dev/js/pull/567) [`8b68f20`](https://github.com/thirdweb-dev/js/commit/8b68f206789f478c9a2198ad8c277329583bdc31) Thanks [@shift4id](https://github.com/shift4id)! - `thirdweb release` is deprecated, use `thirdweb publish` instead
- Updated dependencies []:
- @thirdweb-dev/sdk@3.9.3
## 0.9.22
### Patch Changes
- Updated dependencies [[`f3408d0`](https://github.com/thirdweb-dev/js/commit/f3408d05d84ff8418a3f76961367e47565ed32b4), [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/sdk@3.9.2
## 0.9.21
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.9.1
## 0.9.20
### Patch Changes
+8 -5
View File
@@ -6,6 +6,7 @@
<h1 align="center">thirdweb CLI</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/cli"><img src="https://img.shields.io/npm/v/@thirdweb-dev/cli?color=red&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
@@ -41,10 +42,10 @@ Deploying contracts this way gives you access to:
## Releasing your contract
```shell
npx thirdweb@latest release
npx thirdweb@latest publish
```
Creates an official release of your contract, along with:
Creates an official published contract, along with:
- author attribution
- contract information
@@ -52,9 +53,9 @@ Creates an official release of your contract, along with:
- versioning
- release notes
Creating releases this way gives you shareable URL to let others to deploy your contracts in one click. It lets you manage released versions and get attribution for deployed contracts. Contract releases are registered on-chain (Polygon) and IPFS, for free (gasless).
Publishing contracts this way gives you shareable URL to let others deploy your contracts in one click. It lets you manage published versions and get attribution for deployed contracts. Published contracts are registered on-chain (Polygon) and IPFS, for free (gasless).
Deploying released contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts.
Deploying published contracts give deployers access to automatic SDKs to integrate into their app and dashboards to manage and monitor the deployed contracts.
## Detecting contract extensions
@@ -94,7 +95,7 @@ Clone the repo and run this command after installing the CLI tool:
```bash
$ cd examples/hardhat
$ npx thirdweb@latest release
$ npx thirdweb@latest publish
```
## Local Development
@@ -106,11 +107,13 @@ The simplest way to work on the CLI locally is to:
```bash
git clone https://github.com/thirdweb-dev/js.git
```
2. From the project root run
```bash
yarn && yarn build
```
3. From inside `js/packages/cli` Run the `build:watch` command to compile any changes in real time
```bash
+4 -4
View File
@@ -6,8 +6,8 @@ import { resolve } from "path";
// this creates an app, can take some time that's fine
jest.setTimeout(120_000);
describe("npx thirdweb release", () => {
it("should return release page url", async () => {
describe("npx thirdweb publish", () => {
it("should return publish page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment();
await copyFile(
@@ -16,7 +16,7 @@ describe("npx thirdweb release", () => {
);
const { waitForText, waitForFinish, getExitCode, writeText, getStderr } =
await spawn("node", "./dist/cli/index.js release");
await spawn("node", "./dist/cli/index.js publish");
expect(await exists("BasicContract.sol")).toEqual(true);
@@ -27,7 +27,7 @@ describe("npx thirdweb release", () => {
await waitForFinish();
expect(getStderr().at(-1)).toContain(
"https://thirdweb.com/contracts/release/",
"https://thirdweb.com/contracts/publish/",
);
// the process should exit with code 0
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.9.20",
"version": "0.9.25",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+33 -5
View File
@@ -266,7 +266,7 @@ const main = async () => {
)
.option(
"-n, --name [name]",
"Name of the pre-built or released contract (such as nft-drop)",
"Name of the pre-built or published contract (such as nft-drop)",
)
.option(
"-f, --file [name]",
@@ -278,7 +278,7 @@ const main = async () => {
)
.option(
"-cv, --contract-version [version]",
"Version of the released contract",
"Version of the published contract",
)
.option("--app", "Deploy a web app to decentralized storage")
.option("--contract", "Deploy a smart contract to blockchains")
@@ -291,8 +291,36 @@ const main = async () => {
program
.command("release")
.description("[Deprecated] use 'publish' instead.")
.option("-p, --path <project-path>", "path to project", ".")
.option(
"-f, --file [name]",
"Filter for contract files that contain the file name",
)
.option(
"-cn, --contract-name [name]",
"Filter for contracts that contain this contract name",
)
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
logger.warn(
"'release' is deprecated and will be removed in a future update. Please use 'publish' instead.",
);
const url = await processProject(options, "publish");
info(
`Open this link to publish your contracts: ${chalk.blueBright(
url.toString(),
)}`,
);
open(url.toString());
});
program
.command("publish")
.description(
"Release your protocol so other devs can deploy them and unlock SDKs, Dashboards and Analytics",
"Publish your protocol so other devs can deploy them and unlock SDKs, Dashboards and Analytics",
)
.option("-p, --path <project-path>", "path to project", ".")
.option(
@@ -307,9 +335,9 @@ const main = async () => {
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.action(async (options) => {
const url = await processProject(options, "release");
const url = await processProject(options, "publish");
info(
`Open this link to release your contracts: ${chalk.blueBright(
`Open this link to publish your contracts: ${chalk.blueBright(
url.toString(),
)}`,
);
+1 -1
View File
@@ -13,7 +13,7 @@ import path from "path";
export async function processProject(
options: any,
command: "deploy" | "release",
command: "deploy" | "publish",
) {
// TODO: allow overriding the default storage
const storage = new ThirdwebStorage();
@@ -211,9 +211,9 @@ export async function createContractProject({
console.log(" Deploys your contracts with the thirdweb deploy flow.");
console.log();
console.log(
chalk.cyan(` ${packageManager}${useYarn ? "" : " run"} release`),
chalk.cyan(` ${packageManager}${useYarn ? "" : " run"} publish`),
);
console.log(" Releases your contracts with the thirdweb release flow.");
console.log(" Publishes your contracts with the thirdweb publish flow.");
console.log();
console.log("We suggest that you begin by typing:");
console.log();
@@ -3,7 +3,7 @@ export default function generateDashboardUrl(
version: string | undefined,
): string | undefined {
const splitName = name.split("/");
// Released contract
// Published contract
if (splitName.length > 1) {
return `https://thirdweb.com/dashboard/${splitName[0]}/${splitName[1]}${
version ? `/${version}` : ""
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/pay
## 0.1.1
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
## 0.1.0
### Minor Changes
+3 -3
View File
@@ -5,9 +5,9 @@
</p>
<h1 align="center">thirdweb wallets</h1>
<p align="center">
<!-- <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> -->
<!-- <a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/></a> -->
<!-- <a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a> -->
<a href="https://www.npmjs.com/package/@thirdweb-dev/wallets"><img src="https://img.shields.io/npm/v/@thirdweb-dev/wallets?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
<!-- <p align="center"><strong>Best in class Web3 SDK for Browser, Node and Mobile apps</strong></p> -->
+1 -4
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/pay",
"version": "0.1.0",
"version": "0.1.1",
"main": "dist/thirdweb-dev-pay.cjs.js",
"module": "dist/thirdweb-dev-pay.esm.js",
"exports": {
@@ -29,9 +29,6 @@
"index.ts",
"integrations/**"
],
"___experimentalFlags_WILL_CHANGE_IN_PATCH": {
"exports": true
},
"exports": true
},
"sideEffects": false,
+41
View File
@@ -1,5 +1,46 @@
# @thirdweb-dev/react-core
## 3.9.5
### Patch Changes
- Updated dependencies [[`d7deaa4`](https://github.com/thirdweb-dev/js/commit/d7deaa48f2f943deb8f2ad7459d17de930c00517), [`b7a5b45`](https://github.com/thirdweb-dev/js/commit/b7a5b454415596316f58a75f14472631242cc115)]:
- @thirdweb-dev/chains@0.1.5
## 3.9.4
### Patch Changes
- Updated dependencies [[`a3472a1`](https://github.com/thirdweb-dev/js/commit/a3472a133175826d052ee986907de014e3cf3ad9), [`5712650`](https://github.com/thirdweb-dev/js/commit/5712650074e2415bbea4173a0bb68d727ff2db90)]:
- @thirdweb-dev/chains@0.1.4
## 3.9.3
### Patch Changes
- Updated dependencies [[`3d644fb`](https://github.com/thirdweb-dev/js/commit/3d644fb8cbae8bc3ee624505831b9f5c6996898a)]:
- @thirdweb-dev/chains@0.1.3
## 3.9.2
### Patch Changes
- [#601](https://github.com/thirdweb-dev/js/pull/601) [`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19) Thanks [@jnsdls](https://github.com/jnsdls)! - upgrade dependencies
- Updated dependencies [[`66cf1fb`](https://github.com/thirdweb-dev/js/commit/66cf1fb5c2e8deb486543ee028d786bb8eef6c19)]:
- @thirdweb-dev/chains@0.1.2
- @thirdweb-dev/auth@3.0.6
## 3.9.1
### Patch Changes
- [#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 -2
View File
@@ -5,8 +5,8 @@
</p>
<h1 align="center">thirdweb React Core SDK</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/CI.yml/badge.svg"/></a>
<a href="https://www.npmjs.com/package/@thirdweb-dev/react-core"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-core?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
+2 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.9.0",
"version": "3.9.5",
"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.
+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 Compat</h1>
<p align="center">
<a href="https://www.npmjs.com/package/@thirdweb-dev/react-native-compat"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native-compat?color=red&label=npm&logo=npm" alt="npm version"/></a>
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
</p>
<p align="center"><strong>Shims for thirdweb in React Native Projects</strong></p>
<br />
## 👷🚧 Alpha 🚧👷
<br />
## Getting Started
Head over to the [documentation](https://portal.thirdweb.com/react-native) to learn more
@@ -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"],
};

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