Compare commits

..
Author SHA1 Message Date
Jonas DanielsandGitHub 2108af7cf3 Version Packages (#2633) 2024-04-02 22:58:28 -07:00
Jonas DanielsandGitHub e4d243ef34 fix(adapters): sendTransaction within viemAdapter.walletClient.toViem() (#2662) 2024-04-02 19:41:42 -07:00
Jonas DanielsandGitHub 421ffa024c chore: Add job name for build step (#2665) 2024-04-02 19:38:04 -07:00
Jonas DanielsandGitHub 286b9f1e0b build: Add build:packages and build:legacy_packages scripts (#2664) 2024-04-02 19:32:57 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
46e880d9e2 build(deps): bump expo-file-system from 15.9.0 to 16.0.8 (#2658)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-03 02:28:04 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
7116ae0ce6 build(deps): bump @google-cloud/kms from 3.0.1 to 4.2.0 (#2653)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-03 02:27:56 +00:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1042b5538a build(deps-dev): bump @tanstack/eslint-plugin-query from 5.28.6 to 5.28.11 (#2654)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-03 02:13:09 +00:00
Jonas DanielsandGitHub 9d319f462c chore: Update lint script in package.json (#2663) 2024-04-02 18:48:06 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ed19f73fae build(deps): bump @typescript-eslint/eslint-plugin from 7.4.0 to 7.5.0 (#2650)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 18:42:50 -07:00
8718354e69 chore(chains): update chains (#2640)
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-03 00:23:19 +00:00
Jonas DanielsandGitHub 945ea1d9ad chore(CI/tests): update workflows (#2660) 2024-04-02 17:12:27 -07:00
Jonas DanielsandGitHub 02c8d51b84 chore(CI): Update CI configuration for packages and legacy packages (#2659) 2024-04-02 16:36:41 -07:00
Jonas DanielsandGitHub 47f7b4df39 test: run "Account Permissions" only if TW_SECRET_KEY is defined (#2657) 2024-04-02 16:32:22 -07:00
Jonas DanielsandGitHub 891fde539d chore: Update linting script (#2656) 2024-04-02 16:21:47 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
9666940fed build(deps): bump peter-evans/create-pull-request from 3 to 6 (#2648)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 16:18:16 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
b7b5ad2c11 build(deps): bump octokit/request-action from 2.1.0 to 2.2.0 (#2647)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 16:14:53 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
5de549c5d2 build(deps): bump actions/checkout from 2 to 4 (#2646)
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-02 16:14:32 -07:00
Jonas DanielsandGitHub 1de78fb2f3 chore(ci): Add concurrency control to CI workflow (#2644) 2024-04-02 16:13:32 -07:00
Jonas DanielsandGitHub 603ea56c54 chore: Remove legacy e2e tests workflow (#2643) 2024-04-02 15:35:57 -07:00
Jonas DanielsandGitHub 7365634c0a chore: Update CI configuration (#2642) 2024-04-02 15:33:42 -07:00
Jonas DanielsandGitHub b76d89dbb2 chore(workflows): cleanup workflows (#2641) 2024-04-02 15:16:37 -07:00
Jonas DanielsandGitHub de7f7d701c update workflows (#2639) 2024-04-02 14:58:54 -07:00
32fa0c6aa8 chore(chains): update chains (#2638)
Co-authored-by: GitHub Action <[email protected]>
2024-04-02 14:10:32 -07:00
Joaquim VergesandGitHub c508751f38 refactor: optimize encode with async params (#2636) 2024-04-02 20:52:49 +00:00
fbf4556d48 chore(chains): update chains (#2635)
Co-authored-by: GitHub Action <[email protected]>
2024-04-02 13:53:06 -07:00
FirekeeperandGitHub c9f290a1d4 Unity 4.9.1 (#2634) 2024-04-02 17:54:19 +00:00
5fb92c0a98 chore(chains): update chains (#2630)
Co-authored-by: GitHub Action <[email protected]>
2024-04-02 09:56:18 -07:00
9af8561284 [SDK] ZkSync deterministic deployments (#2592)
Signed-off-by: Yash <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-02 16:45:05 +00:00
160 changed files with 2258 additions and 3164 deletions
+37 -17
View File
@@ -2,28 +2,48 @@
# Platform team owns everything by default
* @thirdweb-dev/platform
* @jnsdls @joaquim @MananTank
# Devrel owns all markdown files (README etc.)
# legacy packages
legacy_packages/auth/ @jnsdls
legacy_packages/chains/ @jnsdls
legacy_packages/cli/ @jnsdls
legacy_packages/contracts-js/ @jnsdls
legacy_packages/crypto/ @jnsdls
legacy_packages/generated-abis/ @jnsdls
legacy_packages/merkletree/ @jnsdls
legacy_packages/pay/ @jnsdls
legacy_packages/payments/ @jnsdls
legacy_packages/react/ @MananTank @jnsdls
legacy_packages/react-core/ @MananTank @jnsdls
legacy_packages/react-native/ @jnsdls
legacy_packages/react-native-compat/ @jnsdls
legacy_packages/sdk/ @joaquim @jnsdls
legacy_packages/storage/ @jnsdls
legacy_packages/wallets/ @MananTank @jnsdls
*.md @thirdweb-dev/devrel
.changeset/
# Shared ownership of the react and react-core packages
# legacy e2e
legacy_e2e/ @jnsdls
packages/react/ @thirdweb-dev/product @thirdweb-dev/platform
packages/react-core/ @thirdweb-dev/product @thirdweb-dev/platform
# packages
# Shared ownership of the CLI
## specific thirdweb pieces
packages/thirdweb/src/react/ @MananTank
packages/thirdweb/src/reactive/ @MananTank
packages/thirdweb/src/gas/ @joaquim
packages/thirdweb/src/pay/ @MananTank @IDubuque
packages/cli/ @thirdweb-dev/product @thirdweb-dev/platform
packages/typedoc-gen/ @MananTank
# owned by phil for now
packages/service-utils/ @arcoraven
packages/eslint-config-thirdweb/ @jnsdls
packages/tw-tsconfig/ @jnsdls
packages/unity-js-bridge/ @joaquim @0xFirekeeper
# 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
# .github folder + .changeset + turbo config is owned by jonas for now
scripts/ @jnsdls
.github/ @jnsdls
.changeset/config.json @jnsdls
turbo.json @jnsdls
@@ -4,6 +4,12 @@ description: "Sets up Node.js and runs install"
runs:
using: composite
steps:
# we use bun for some test suites
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
# pnpm for our dependencies
- uses: pnpm/action-setup@v3
with:
version: 8
@@ -11,6 +17,7 @@ runs:
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
registry-url: "https://registry.npmjs.org"
cache: "pnpm"
+5
View File
@@ -9,3 +9,8 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
+109
View File
@@ -0,0 +1,109 @@
name: CI
on:
push:
branches: ["main"]
paths:
- "packages/**"
- "package.json"
pull_request:
types: [opened, synchronize]
paths:
- "packages/**"
- "package.json"
# trigger on merge group as well (merge queue)
merge_group:
types: [checks_requested]
branches: ["main"]
workflow_dispatch:
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 }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest-16
name: Build Packages
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Build Packages
run: pnpm build:packages
lint:
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- run: pnpm lint
test:
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest-16
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1
- run: pnpm test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./packages
e2e:
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
# TODO actually run e2e tests
benchmark:
# cannot run benchmarks on merge group
if: github.event_name != 'merge_group'
timeout-minutes: 15
name: "Benchmarks"
runs-on: ubuntu-latest-16
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: "pnpm bench"
+96
View File
@@ -0,0 +1,96 @@
name: CI (Legacy Packages)
on:
push:
branches: ["main"]
paths:
- "legacy_packages/**"
- "legacy_e2e/**"
- "package.json"
pull_request:
types: [opened, synchronize]
paths:
- "legacy_packages/**"
- "legacy_e2e/**"
- "package.json"
# trigger on merge group as well (merge queue)
merge_group:
types: [checks_requested]
branches: ["main"]
workflow_dispatch:
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 }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest-16
name: Build Packages
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Build Packages
run: pnpm build:legacy_packages
lint:
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- run: pnpm lint:legacy
test:
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest-16
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- run: pnpm test:legacy
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./legacy_packages
e2e:
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest-16
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Setup & Install
uses: ./.github/composite-actions/install
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run e2e tests
run: pnpm e2e:legacy
env:
NODE_OPTIONS: "--max_old_space_size=4096"
CLI_E2E_API_KEY: ${{ secrets.CLI_E2E_API_KEY }}
-232
View File
@@ -1,232 +0,0 @@
name: Build, Lint & Test & Benchmark
on:
push:
branches: ["main"]
pull_request:
types: [opened, synchronize]
# trigger on merge group as well (merge queue)
merge_group:
types: [checks_requested]
workflow_dispatch:
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 }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs:
build:
timeout-minutes: 15
name: Build
runs-on: ubuntu-latest-16
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 25
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- name: Install
uses: ./.github/composite-actions/install
- run: pnpm 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@v4
timeout-minutes: 5
id: cache-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
lint:
timeout-minutes: 15
name: Lint Packages
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v4
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: pnpm lint
test:
timeout-minutes: 15
name: Unit Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
# we use bun for some test suites
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v4
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1
- run: pnpm test
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./legacy_packages
test_legacy:
timeout-minutes: 15
name: Unit Tests (Legacy)
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
# we use bun for some test suites
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v4
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- run: pnpm test:legacy
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
directory: ./legacy_packages
e2e:
timeout-minutes: 15
name: E2E Tests
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
# we use bun for some test suites
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.0.35
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v4
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: pnpm e2e
env:
NODE_OPTIONS: "--max_old_space_size=4096"
CLI_E2E_API_KEY: ${{ secrets.CLI_E2E_API_KEY }}
benchmark:
# only run if is not merge_group
if: github.event_name != 'merge_group'
timeout-minutes: 15
name: "Benchmark"
runs-on: ubuntu-latest-16
needs: build
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/cache@v4
timeout-minutes: 5
id: restore-build
with:
path: ./*
key: ${{ github.sha }}-${{ github.run_number }}
- name: Set up foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: "pnpm bench"
+7 -3
View File
@@ -20,6 +20,10 @@ on:
schedule:
- cron: "37 9 * * 3"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
analyze:
name: Analyze
@@ -42,7 +46,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +59,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -68,4 +72,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
+1 -1
View File
@@ -51,7 +51,7 @@ jobs:
steps:
- name: get pull request ref
id: get_pull_request_ref
uses: octokit/request-action@v2.1.0
uses: octokit/request-action@v2.2.0
with:
route: GET /repos/{owner}/{repository}/pulls/{issue_id}
owner: ${{ github.repository_owner }}
+2 -2
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install bun
uses: oven-sh/setup-bun@v1
@@ -49,7 +49,7 @@ jobs:
- name: Create or Update Pull Request
if: env.CHANGES_FOUND == 'true'
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
with:
title: "chore(chains): update chains"
branch: "sync-chains"
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth
## 4.1.54
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.4.32
## 4.1.53
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.53",
"version": "4.1.54",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
@@ -58,7 +58,7 @@
"scripts": {
"build": "preconstruct build",
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/ && bunx publint --strict --level warning",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/ && rm -rf node_modules/",
"test": "vitest",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.87
### Patch Changes
- [#2635](https://github.com/thirdweb-dev/js/pull/2635) [`fbf4556`](https://github.com/thirdweb-dev/js/commit/fbf4556d489b3be7c0c0ff85736e803573f55228) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.86
### Patch Changes
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"chain": "SC20",
"chainId": 11221,
"explorers": [
{
"name": "shinescan",
"url": "https://shinescan.io",
"standard": "none",
"icon": {
"url": "ipfs://QmUBkpY3prCTZHpx1fjrYLAJ6dPaGvNVTj97iy6p3NPUi1",
"width": 161,
"height": 161,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmUBkpY3prCTZHpx1fjrYLAJ6dPaGvNVTj97iy6p3NPUi1",
"width": 161,
"height": 161,
"format": "png"
},
"infoURL": "https://shinechain.tech",
"name": "Shine Chain",
"nativeCurrency": {
"name": "Shine",
"symbol": "SC20",
"decimals": 18
},
"networkId": 11221,
"rpc": [
"https://11221.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.shinescan.io"
],
"shortName": "SC20",
"slug": "shine-chain",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 18109,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser7737 Testnet",
"nativeCurrency": {
"name": "QaUser7737 Testnet Token",
"symbol": "XSP",
"decimals": 18
},
"networkId": 18109,
"redFlags": [],
"rpc": [
"https://18109.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser7737 Testnet",
"slug": "qauser7737-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 24545,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser9167 Testnet",
"nativeCurrency": {
"name": "QaUser9167 Testnet Token",
"symbol": "HBG",
"decimals": 18
},
"networkId": 24545,
"redFlags": [],
"rpc": [
"https://24545.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser9167 Testnet",
"slug": "qauser9167-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 29830,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser6165 Testnet",
"nativeCurrency": {
"name": "QaUser6165 Testnet Token",
"symbol": "TGQ",
"decimals": 18
},
"networkId": 29830,
"redFlags": [],
"rpc": [
"https://29830.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser6165 Testnet",
"slug": "qauser6165-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 3084,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "XL Network Testnet",
"nativeCurrency": {
"name": "XL Network Testnet Token",
"symbol": "XLN",
"decimals": 18
},
"networkId": 3084,
"redFlags": [],
"rpc": [
"https://3084.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/xlnetworkt/testnet/rpc"
],
"shortName": "XL Network Testnet",
"slug": "xl-network-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 31646,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser9492 Testnet",
"nativeCurrency": {
"name": "QaUser9492 Testnet Token",
"symbol": "UVI",
"decimals": 18
},
"networkId": 31646,
"redFlags": [],
"rpc": [
"https://31646.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser9492 Testnet",
"slug": "qauser9492-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 48137,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser9608 Testnet",
"nativeCurrency": {
"name": "QaUser9608 Testnet Token",
"symbol": "ASI",
"decimals": 18
},
"networkId": 48137,
"redFlags": [],
"rpc": [
"https://48137.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser9608 Testnet",
"slug": "qauser9608-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 7317,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser5017 Testnet",
"nativeCurrency": {
"name": "QaUser5017 Testnet Token",
"symbol": "IHS",
"decimals": 18
},
"networkId": 7317,
"redFlags": [],
"rpc": [
"https://7317.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser5017 Testnet",
"slug": "qauser5017-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 7507,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser7740 Testnet",
"nativeCurrency": {
"name": "QaUser7740 Testnet Token",
"symbol": "RUI",
"decimals": 18
},
"networkId": 7507,
"redFlags": [],
"rpc": [
"https://7507.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser7740 Testnet",
"slug": "qauser7740-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 764984,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "Lamina1 Testnet",
"nativeCurrency": {
"name": "Lamina1 Testnet Token",
"symbol": "L1T",
"decimals": 18
},
"networkId": 764984,
"redFlags": [],
"rpc": [
"https://764984.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/lamina1tes/testnet/rpc"
],
"shortName": "Lamina1 Testnet",
"slug": "lamina1-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 7909,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser3870 Testnet",
"nativeCurrency": {
"name": "QaUser3870 Testnet Token",
"symbol": "RAY",
"decimals": 18
},
"networkId": 7909,
"redFlags": [],
"rpc": [
"https://7909.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser3870 Testnet",
"slug": "qauser3870-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 86663,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser7218 Testnet",
"nativeCurrency": {
"name": "QaUser7218 Testnet Token",
"symbol": "GCY",
"decimals": 18
},
"networkId": 86663,
"redFlags": [],
"rpc": [
"https://86663.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser7218 Testnet",
"slug": "qauser7218-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 87460,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser1360 Testnet",
"nativeCurrency": {
"name": "QaUser1360 Testnet Token",
"symbol": "KYP",
"decimals": 18
},
"networkId": 87460,
"redFlags": [],
"rpc": [
"https://87460.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser1360 Testnet",
"slug": "qauser1360-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 92978,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser4903 Testnet",
"nativeCurrency": {
"name": "QaUser4903 Testnet Token",
"symbol": "CQS",
"decimals": 18
},
"networkId": 92978,
"redFlags": [],
"rpc": [
"https://92978.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser4903 Testnet",
"slug": "qauser4903-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 99181,
"explorers": [],
"faucets": [],
"features": [],
"icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256,
"height": 256,
"format": "svg"
},
"infoURL": "https://avacloud.io",
"name": "QaUser9727 Testnet",
"nativeCurrency": {
"name": "QaUser9727 Testnet Token",
"symbol": "PCE",
"decimals": 18
},
"networkId": 99181,
"redFlags": [],
"rpc": [
"https://99181.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser9727 Testnet",
"slug": "qauser9727-testnet",
"testnet": true
} as const satisfies Chain;
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.86",
"version": "0.1.87",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
@@ -30,7 +30,7 @@
"db:sync": "bun scripts/sync-db.ts",
"build": "tsc && preconstruct build",
"push": "yalc push",
"test": "bun test"
"test": "vitest"
},
"engines": {
"node": ">=18"
File diff suppressed because one or more lines are too long
@@ -1,3 +1,4 @@
import { expect, test } from "vitest";
import { getChainByChainId, Goerli } from "../src";
test("expect chainId 5 to be goerli", () => {
+7 -2
View File
@@ -1,3 +1,4 @@
import { beforeEach, describe, expect, test } from "vitest";
import { Ethereum } from "../src";
import {
type ChainRPCOptions,
@@ -79,7 +80,9 @@ describe("chains/utils", () => {
],
],
])("getValidChainRPCs(Ethereum, %s, %s) = %p", (clientId, mode, expected) => {
expect(getValidChainRPCs(Ethereum, clientId, mode)).toEqual(expected);
expect(
getValidChainRPCs(Ethereum, clientId, mode as "http" | "ws"),
).toEqual(expected);
});
test.each(CHAIN_RPC_TEST_CASES)(
@@ -188,7 +191,9 @@ describe("chains/utils with APP_BUNDLE_ID", () => {
],
],
])("getValidChainRPCs(Ethereum, %s, %s) = %p", (clientId, mode, expected) => {
expect(getValidChainRPCs(Ethereum, clientId, mode)).toEqual(expected);
expect(
getValidChainRPCs(Ethereum, clientId, mode as "http" | "ws"),
).toEqual(expected);
});
test.each([
+10
View File
@@ -1,5 +1,15 @@
# thirdweb
## 0.13.62
### Patch Changes
- Updated dependencies [[`9af8561`](https://github.com/thirdweb-dev/js/commit/9af85612845573b54b54cb72e55404aad2c74700), [`fbf4556`](https://github.com/thirdweb-dev/js/commit/fbf4556d489b3be7c0c0ff85736e803573f55228)]:
- @thirdweb-dev/sdk@4.0.56
- @thirdweb-dev/chains@0.1.87
- @thirdweb-dev/wallets@2.4.32
- @thirdweb-dev/auth@4.1.54
## 0.13.61
### Patch Changes
-40
View File
@@ -1,40 +0,0 @@
import { CREATE_MESSAGES } from "../constants/constants";
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
// load env variables
require("dotenv-mono").load();
// this creates an app, can take some time that's fine
jest.setTimeout(150_000);
describe("npx thirdweb create", () => {
it("should create app (CRA) successfully", async () => {
const { spawn, cleanup, exists } = await prepareEnvironment();
const { waitForText, waitForFinish, getExitCode, pressKey } = await spawn(
"node",
"./dist/cli/index.js create",
);
await waitForText(CREATE_MESSAGES.typeOfProject);
await pressKey("enter");
await waitForText(CREATE_MESSAGES.projectName);
await pressKey("enter");
await waitForText(CREATE_MESSAGES.framework);
// select CRA
await pressKey("arrowDown");
await pressKey("enter");
await waitForText(CREATE_MESSAGES.language);
await pressKey("enter");
// wait for program to finish
await waitForFinish();
// check if the app was created
expect(await exists("thirdweb-app/package.json")).toEqual(true);
// the process should exit with code 0
expect(getExitCode()).toEqual(0);
await cleanup(); // cleanup after test
});
});
-55
View File
@@ -1,55 +0,0 @@
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { copyFile } from "fs/promises";
import { resolve } from "path";
import { ERROR_MESSAGES } from "../constants/constants";
import { describe, it, expect } from "vitest";
// load env variables
require("dotenv-mono").load();
const apiSecretKey = process.env.TW_SECRET_KEY as string;
// function to skip tests based on condition
const itif = (condition: boolean) => (condition ? it : it.skip);
// this creates an app, can take some time that's fine
describe(
"npx thirdweb deploy",
{
timeout: 120_000,
},
() => {
itif(!!apiSecretKey)("should return deploy page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment();
await copyFile(
resolve("./e2e/files/BasicContract.sol"),
`${path}/BasicContract.sol`,
);
const { waitForText, waitForFinish, getExitCode, writeText, getStderr } =
await spawn(
"node",
`./dist/cli/index.js deploy --contract -k ${apiSecretKey}`,
);
expect(await exists("BasicContract.sol")).toEqual(true);
await waitForText(ERROR_MESSAGES.noConfiguration);
await writeText("y");
// wait for program to finish
await waitForFinish();
expect(getStderr().at(-1)).toContain(
"https://thirdweb.com/contracts/deploy/",
);
// the process should exit with code 0
expect(getExitCode()).toEqual(0);
await cleanup(); // cleanup after test
});
},
);
-98
View File
@@ -1,98 +0,0 @@
import { CREATE_MESSAGES } from "../constants/constants";
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { describe, it, expect } from "vitest";
// load env variables
require("dotenv-mono").load();
describe(
"npx thirdweb detect",
{
timeout: 240_000,
},
() => {
it("should detect ERC721Base extensions", async () => {
const { spawn, cleanup, exists } = await prepareEnvironment();
const create = await spawn("node", "./dist/cli/index.js create");
await create.waitForText(CREATE_MESSAGES.typeOfProject);
// select contract
await create.pressKey("arrowDown");
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.projectName);
// use default name
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.framework);
// select hardhat
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.contractName);
// set contract name
await create.writeText("Contract");
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.contract);
// select ERC721
await create.pressKey("arrowDown");
await create.pressKey("enter");
await create.waitForText(CREATE_MESSAGES.extensions);
// select no extra extensions
await create.pressKey("enter");
// wait for program to finish
await create.waitForFinish();
// check if the contract was created
expect(await exists("thirdweb-contracts/contracts/Contract.sol")).toEqual(
true,
);
// check that hardhat config exists
expect(await exists("thirdweb-contracts/hardhat.config.js")).toEqual(
true,
);
await create.writeText("cd thirdweb-contracts");
await create.pressKey("enter");
await create.writeText("npm install");
await create.pressKey("enter");
const detect = await spawn(
"node",
"./dist/cli/index.js detect",
"./thirdweb-contracts",
);
// Select pnpm as package manager.
await detect.pressKey("arrowDown");
await detect.pressKey("enter");
// wait for program to finish
await detect.waitForFinish();
const lines = detect.getStdout();
// Detected extensions
expect(
lines.findIndex((line) => line.includes("ERC721")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("ERC721Burnable")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("ERC721Mintable")),
).toBeGreaterThan(-1);
// Suggested extensions
expect(
lines.findIndex((line) => line.includes("- ERC721Enumerable")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("- ERC721LazyMintable")),
).toBeGreaterThan(-1);
expect(
lines.findIndex((line) => line.includes("- ERC721SignatureMint")),
).toBeGreaterThan(-1);
await cleanup(); // cleanup after test
});
},
);
@@ -1,6 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BasicContract {
constructor() {}
}
-52
View File
@@ -1,52 +0,0 @@
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { copyFile } from "fs/promises";
import { resolve } from "path";
import { ERROR_MESSAGES } from "../constants/constants";
import { describe, it, expect } from "vitest";
// load env variables
require("dotenv-mono").load();
// eslint-disable-next-line turbo/no-undeclared-env-vars
const apiSecretKey = process.env.TW_SECRET_KEY as string;
// function to skip tests based on condition
const itif = (condition: boolean) => (condition ? it : it.skip);
describe(
"npx thirdweb publish",
{
timeout: 120_000,
},
() => {
// conditionally skip test if there's no api key
itif(!!apiSecretKey)("should return publish page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment();
await copyFile(
resolve("./e2e/files/BasicContract.sol"),
`${path}/BasicContract.sol`,
);
const { waitForText, waitForFinish, getExitCode, writeText, getStderr } =
await spawn("node", `./dist/cli/index.js publish -k ${apiSecretKey}`);
expect(await exists("BasicContract.sol")).toEqual(true);
await waitForText(ERROR_MESSAGES.noConfiguration);
await writeText("y");
// wait for program to finish
await waitForFinish();
expect(getStderr().at(-1)).toContain(
"https://thirdweb.com/contracts/publish/",
);
// the process should exit with code 0
expect(getExitCode()).toEqual(0);
await cleanup(); // cleanup after test
});
},
);
+1 -2
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/cli",
"main": "dist/cli/index.js",
"version": "0.13.61",
"version": "0.13.62",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -65,7 +65,6 @@
"build": "pnpm clean && tsup --env.NODE_ENV production --minify --format cjs --external hardhat --dts-resolve",
"build:watch": "pnpm run build --watch",
"generate-thirdweb-package": "node scripts/generate-thirdweb-package.js",
"e2e": "vitest",
"push": "yalc push"
},
"files": [
+2 -2
View File
@@ -44,12 +44,12 @@
},
"scripts": {
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/ && bunx publint --strict --level warning",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"build": "tsc && preconstruct build",
"push": "yalc push",
"test": "bun test",
"test": "vitest",
"benchmark:aes-encrypt": "bun benchmark/aes-encrypt.ts",
"benchmark:aes-decrypt": "bun benchmark/aes-decrypt.ts",
"benchmark:sha256": "bun benchmark/sha256.ts",
+1 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from "vitest";
import { aesEncrypt, aesDecrypt, aesDecryptCompat } from "../src";
import { AES } from "crypto-js";
describe("AES", () => {
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import {
keccak256SyncHex,
keccak256SyncHexPrefixed,
@@ -12,6 +13,7 @@ const STRING_TO_HASH = "hello world";
describe("keccak256", () => {
it("keccak256SyncHexPrefixed === ethers.utils.keccak256", async () => {
const out = keccak256SyncHexPrefixed(STRING_TO_HASH);
// eslint-disable-next-line no-restricted-globals
const ethersOut = utils.keccak256(Buffer.from(STRING_TO_HASH));
expect(out).toEqual(ethersOut);
+7 -2
View File
@@ -1,3 +1,4 @@
import { describe, expect, it } from "vitest";
import { sha256, sha256Hex, sha256Sync, sha256HexSync } from "../src";
import { createHash } from "node:crypto";
@@ -6,7 +7,9 @@ const STRING_TO_HASH = "hello world";
describe("sha256", () => {
it("sha256", async () => {
const out = await sha256(STRING_TO_HASH);
const hash = createHash("sha256").update(STRING_TO_HASH).digest();
const hash = new Uint8Array(
createHash("sha256").update(STRING_TO_HASH).digest(),
);
expect(out).toEqual(hash);
});
@@ -18,7 +21,9 @@ describe("sha256", () => {
it("sha256Sync", async () => {
const out = sha256Sync(STRING_TO_HASH);
const hash = createHash("sha256").update(STRING_TO_HASH).digest();
const hash = new Uint8Array(
createHash("sha256").update(STRING_TO_HASH).digest(),
);
expect(out).toEqual(hash);
});
+3 -15
View File
@@ -27,38 +27,26 @@
},
"sideEffects": false,
"dependencies": {
"@thirdweb-dev/crypto": "workspace:*",
"buffer": "^6.0.3",
"buffer-reverse": "^1.0.1",
"treeify": "^1.1.0"
},
"devDependencies": {
"@preconstruct/cli": "2.7.0",
"@thirdweb-dev/crypto": "workspace:*",
"@thirdweb-dev/tsconfig": "workspace:*",
"@types/benchmark": "^2.1.5",
"@types/treeify": "^1.0.3",
"benchmark": "^2.1.4",
"circomlibjs": "^0.1.7",
"eslint-config-thirdweb": "workspace:*",
"ethereum-cryptography": "^1.2.0",
"ethereumjs-util": "^7.1.5",
"keccak256": "^1.0.6",
"sha1": "^1.1.1",
"tape": "^4.17.0",
"typescript": "5.4.3"
},
"scripts": {
"format": "prettier --write 'src/**/*'",
"lint": "eslint src/ && bunx publint --strict --level warning",
"lint": "eslint src/",
"fix": "eslint src/ --fix",
"clean": "rm -rf dist/",
"build": "tsc && preconstruct build",
"push": "yalc push",
"test": "bun test && node test/MerkleTree.js",
"benchmark:aes-encrypt": "bun benchmark/aes-encrypt.ts",
"benchmark:aes-decrypt": "bun benchmark/aes-decrypt.ts",
"benchmark:sha256": "bun benchmark/sha256.ts",
"benchmark": "bun run benchmark:aes-encrypt && bun run benchmark:aes-decrypt && bun run benchmark:sha256"
"test": "vitest"
},
"engines": {
"node": ">=18"
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,9 @@
import { describe, it as test, expect } from "vitest";
import { MerkleTree } from "../src/index";
import { keccak256Sync, sha256Sync } from "@thirdweb-dev/crypto";
describe("MerkleTree", () => {
it("sha256 with keccak256 leaves", () => {
test("sha256 with keccak256 leaves", () => {
const leaves = ["a", "b", "c"].map(keccak256Sync);
const tree = new MerkleTree(leaves, sha256Sync);
@@ -14,7 +15,7 @@ describe("MerkleTree", () => {
expect(tree.getHexLayers()).toMatchSnapshot();
});
it("sha256 with keccak256 leaves with duplicate odd option", () => {
test("sha256 with keccak256 leaves with duplicate odd option", () => {
const leaves = ["a", "b", "c"].map(keccak256Sync);
const tree = new MerkleTree(leaves, sha256Sync, { duplicateOdd: true });
@@ -26,7 +27,7 @@ describe("MerkleTree", () => {
expect(tree.getHexLayers()).toMatchSnapshot();
});
it("sha256 with sort pairs option", () => {
test("sha256 with sort pairs option", () => {
const leaves = ["a", "b", "c", "d", "e", "f"].map(sha256Sync);
const tree = new MerkleTree(leaves, sha256Sync, { sortPairs: true });
@@ -34,7 +35,7 @@ describe("MerkleTree", () => {
expect(tree.getHexRoot()).toMatchSnapshot();
});
it("sha256 verify with positional hex proof and no pairSort", () => {
test("sha256 verify with positional hex proof and no pairSort", () => {
const leaves = ["a", "b", "c", "d", "e", "f"].map(sha256Sync);
const tree = new MerkleTree(leaves, sha256Sync, { sortPairs: false });
@@ -64,7 +65,7 @@ describe("MerkleTree", () => {
).toBe(true);
});
it("sha256 verify with hex proof and pairSort", () => {
test("sha256 verify with hex proof and pairSort", () => {
const leaves = ["a", "b", "c", "d", "e", "f"].map(sha256Sync);
const tree = new MerkleTree(leaves, sha256Sync, { sortPairs: true });
@@ -79,7 +80,7 @@ describe("MerkleTree", () => {
).toBe(true);
});
it("keccak256 with sort leaves and sort pairs option", () => {
test("keccak256 with sort leaves and sort pairs option", () => {
const leaves = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"].map(
keccak256Sync,
);
@@ -92,7 +93,7 @@ describe("MerkleTree", () => {
expect(tree.getHexRoot()).toMatchSnapshot();
});
it("keccak256 with sort option", () => {
test("keccak256 with sort option", () => {
const leaves = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"].map(
keccak256Sync,
);
@@ -102,7 +103,7 @@ describe("MerkleTree", () => {
expect(tree.getHexRoot()).toMatchSnapshot();
});
it("sha256 with sha256 leaves and sort pairs option and duplicate odd option", () => {
test("sha256 with sha256 leaves and sort pairs option and duplicate odd option", () => {
const leaves = ["a", "b", "c", "d", "e", "f"].map(sha256Sync);
const tree = new MerkleTree(leaves, sha256Sync, {
sortPairs: true,
@@ -113,7 +114,7 @@ describe("MerkleTree", () => {
expect(tree.getHexRoot()).toMatchSnapshot();
});
it("sha256 with hash leaves option", () => {
test("sha256 with hash leaves option", () => {
const expectedRoot =
"0x1f7379539707bcaea00564168d1d4d626b09b73f8a2a365234c62d763f854da2";
@@ -126,7 +127,7 @@ describe("MerkleTree", () => {
expect(tree2.getHexRoot()).toEqual(expectedRoot);
});
it("sha256 with hash leaves option and duplicate odd option", () => {
test("sha256 with hash leaves option and duplicate odd option", () => {
const leaves = ["a", "b", "c", "d", "e", "f"];
const tree = new MerkleTree(leaves, sha256Sync, {
hashLeaves: true,
@@ -138,7 +139,7 @@ describe("MerkleTree", () => {
expect(tree.getRoot().toString("hex")).toEqual(root);
});
it("solidity keccak256", () => {
test("solidity keccak256", () => {
const leaves = ["a", "b", "c"].map(keccak256Sync);
const a_hash =
@@ -1,8 +1,12 @@
// Bun Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`MerkleTree sha256 with keccak256 leaves 1`] = `"0x311d2e46f49b15fff8b746b74ad57f2cc9e0d9939fda94387141a2d3fdf187ae"`;
exports[`MerkleTree > keccak256 with sort leaves and sort pairs option 1`] = `"0x60219f87561939610b484575e45c6e81156a53b86d7cd16640d930d14f21758e"`;
exports[`MerkleTree sha256 with keccak256 leaves 2`] = `
exports[`MerkleTree > keccak256 with sort option 1`] = `"0x60219f87561939610b484575e45c6e81156a53b86d7cd16640d930d14f21758e"`;
exports[`MerkleTree > sha256 with keccak256 leaves 1`] = `"0x311d2e46f49b15fff8b746b74ad57f2cc9e0d9939fda94387141a2d3fdf187ae"`;
exports[`MerkleTree > sha256 with keccak256 leaves 2`] = `
[
"0x3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1cb",
"0xb5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510",
@@ -10,7 +14,7 @@ exports[`MerkleTree sha256 with keccak256 leaves 2`] = `
]
`;
exports[`MerkleTree sha256 with keccak256 leaves 3`] = `
exports[`MerkleTree > sha256 with keccak256 leaves 3`] = `
[
[
"0x3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1cb",
@@ -27,9 +31,9 @@ exports[`MerkleTree sha256 with keccak256 leaves 3`] = `
]
`;
exports[`MerkleTree sha256 with keccak256 leaves with duplicate odd option 1`] = `"0xbcdd0f60308db788712205115fe4273bfda49fa0925611fee765a63df9ab96a1"`;
exports[`MerkleTree > sha256 with keccak256 leaves with duplicate odd option 1`] = `"0xbcdd0f60308db788712205115fe4273bfda49fa0925611fee765a63df9ab96a1"`;
exports[`MerkleTree sha256 with keccak256 leaves with duplicate odd option 2`] = `
exports[`MerkleTree > sha256 with keccak256 leaves with duplicate odd option 2`] = `
[
"0x3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1cb",
"0xb5553de315e0edf504d9150af82dafa5c4667fa618ed0a6f19c69b41166c5510",
@@ -37,7 +41,7 @@ exports[`MerkleTree sha256 with keccak256 leaves with duplicate odd option 2`] =
]
`;
exports[`MerkleTree sha256 with keccak256 leaves with duplicate odd option 3`] = `
exports[`MerkleTree > sha256 with keccak256 leaves with duplicate odd option 3`] = `
[
[
"0x3ac225168df54212a25c1c01fd35bebfea408fdac2e31ddd6f80a4bbf9a5f1cb",
@@ -54,10 +58,6 @@ exports[`MerkleTree sha256 with keccak256 leaves with duplicate odd option 3`] =
]
`;
exports[`MerkleTree sha256 with sort pairs option 1`] = `"0xa30ba95a1a5dc397fe45ea20105363b08d682b864a28f4940419a29349a28325"`;
exports[`MerkleTree > sha256 with sha256 leaves and sort pairs option and duplicate odd option 1`] = `"0xa5260b2a7ec31584e5d5689a5628c2b3d949e2397334fd71c107478e5f887eaf"`;
exports[`MerkleTree keccak256 with sort option 1`] = `"0x60219f87561939610b484575e45c6e81156a53b86d7cd16640d930d14f21758e"`;
exports[`MerkleTree sha256 with sha256 leaves and sort pairs option and duplicate odd option 1`] = `"0xa5260b2a7ec31584e5d5689a5628c2b3d949e2397334fd71c107478e5f887eaf"`;
exports[`MerkleTree keccak256 with sort leaves and sort pairs option 1`] = `"0x60219f87561939610b484575e45c6e81156a53b86d7cd16640d930d14f21758e"`;
exports[`MerkleTree > sha256 with sort pairs option 1`] = `"0xa30ba95a1a5dc397fe45ea20105363b08d682b864a28f4940419a29349a28325"`;

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