Compare commits

..
Author SHA1 Message Date
3b12c5c926 Version Packages (#2574)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 03:59:31 -07:00
Jonas Daniels 02d2377ca5 build: Update dependencies in package.json (#2582) 2024-03-29 03:44:43 -07:00
github-actions[bot]andGitHub Action 9545005908 chore(chains): update chains (#2581)
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 03:43:37 -07:00
Jonas Daniels d93286bc1f chore: Update devDependencies versions (#2577) 2024-03-29 10:29:33 +00:00
github-actions[bot]andGitHub Action 50e7dbaa9d chore(chains): update chains (#2580)
Co-authored-by: GitHub Action <[email protected]>
2024-03-28 21:05:46 -07:00
Joaquim Verges 04961f0e9a feat: change getWalletBalance prop from account to address (#2576) 2024-03-28 23:45:15 +00:00
Jonas Daniels 37f8433c7c chore: Skip benchmark step for merge groups (#2575) 2024-03-28 22:29:33 +00:00
Jonas Daniels c81bb882c5 fix(evm): fix CWE-1333 (#2573) 2024-03-28 22:22:51 +00:00
Jonas Daniels 701cd880df chore: point CLI backwards compatibility @latest instead of @beta (#2572) 2024-03-28 22:10:17 +00:00
141 changed files with 6865 additions and 10222 deletions
+2 -2
View File
@@ -4,11 +4,11 @@ description: "Sets up Node.js and runs install"
runs: runs:
using: composite using: composite
steps: steps:
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
with: with:
version: 8 version: 8
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"
+59 -21
View File
@@ -28,14 +28,14 @@ jobs:
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 25 fetch-depth: 25
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- name: Install - name: Install
uses: ./.github/composite-actions/install uses: ./.github/composite-actions/install
@@ -46,7 +46,7 @@ jobs:
- id: get-week - id: get-week
run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT run: echo "WEEK=$(date +%U)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3 - uses: actions/cache@v4
timeout-minutes: 5 timeout-minutes: 5
id: cache-build id: cache-build
with: with:
@@ -60,7 +60,7 @@ jobs:
needs: build needs: build
steps: steps:
- name: Setup node - name: Setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
check-latest: true check-latest: true
@@ -68,13 +68,13 @@ jobs:
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
with: with:
version: 8 version: 8
- uses: actions/cache@v3 - uses: actions/cache@v4
timeout-minutes: 5 timeout-minutes: 5
id: restore-build id: restore-build
with: with:
@@ -90,7 +90,7 @@ jobs:
needs: build needs: build
steps: steps:
- name: Setup node - name: Setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
check-latest: true check-latest: true
@@ -99,13 +99,13 @@ jobs:
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
with: with:
version: 8 version: 8
- uses: actions/cache@v3 - uses: actions/cache@v4
timeout-minutes: 5 timeout-minutes: 5
id: restore-build id: restore-build
with: with:
@@ -120,16 +120,16 @@ jobs:
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3
with: with:
files: ./legacy_packages/sdk/coverage/evm/lcov.info,./packages/thirdweb/coverage/lcov.info files: ./packages/thirdweb/coverage/lcov.info
e2e: test_legacy:
timeout-minutes: 15 timeout-minutes: 15
name: E2E Tests name: Unit Tests (Legacy)
runs-on: ubuntu-latest-16 runs-on: ubuntu-latest-16
needs: build needs: build
steps: steps:
- name: Setup node - name: Setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
check-latest: true check-latest: true
@@ -138,13 +138,49 @@ jobs:
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
with: with:
version: 8 version: 8
- uses: actions/cache@v3 - 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@v3
with:
files: ./legacy_packages/sdk/coverage/evm/lcov.info
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 timeout-minutes: 5
id: restore-build id: restore-build
with: with:
@@ -161,22 +197,24 @@ jobs:
CLI_E2E_API_KEY: ${{ secrets.CLI_E2E_API_KEY }} CLI_E2E_API_KEY: ${{ secrets.CLI_E2E_API_KEY }}
benchmark: benchmark:
# only run if is not merge_group
if: github.event_name != 'merge_group'
timeout-minutes: 15 timeout-minutes: 15
name: "Benchmark" name: "Benchmark"
runs-on: ubuntu-latest-16 runs-on: ubuntu-latest-16
needs: build needs: build
steps: steps:
- name: Setup node - name: Setup node
uses: actions/setup-node@v3 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
check-latest: true check-latest: true
- uses: pnpm/action-setup@v2 - uses: pnpm/action-setup@v3
with: with:
version: 8 version: 8
- uses: actions/cache@v3 - uses: actions/cache@v4
timeout-minutes: 5 timeout-minutes: 5
id: restore-build id: restore-build
with: with:
+5 -6
View File
@@ -13,12 +13,12 @@ name: "CodeQL"
on: on:
push: push:
branches: [ "main" ] branches: ["main"]
pull_request: pull_request:
# The branches below must be a subset of the branches above # The branches below must be a subset of the branches above
branches: [ "main" ] branches: ["main"]
schedule: schedule:
- cron: '37 9 * * 3' - cron: "37 9 * * 3"
jobs: jobs:
analyze: analyze:
@@ -32,13 +32,13 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'javascript' ] language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
@@ -52,7 +52,6 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality # queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # 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) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
+2 -2
View File
@@ -24,13 +24,13 @@ jobs:
runs-on: ubuntu-latest-16 runs-on: ubuntu-latest-16
steps: steps:
- name: Checkout branch - name: Checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v4
# bun setup is required, because pnpm typdoc will run pnpm build and some packages uses bun for build # bun setup is required, because pnpm typdoc will run pnpm build and some packages uses bun for build
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- name: Install - name: Install
uses: ./.github/composite-actions/install uses: ./.github/composite-actions/install
+2 -2
View File
@@ -61,7 +61,7 @@ jobs:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: pull the repo. - name: pull the repo.
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
persist-credentials: true persist-credentials: true
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }} repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }}
@@ -70,7 +70,7 @@ jobs:
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- name: Install - name: Install
uses: ./.github/composite-actions/install uses: ./.github/composite-actions/install
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest-16 runs-on: ubuntu-latest-16
steps: steps:
- name: Checkout branch - name: Checkout branch
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
# Do not use the GITHUB_TOKEN by default # Do not use the GITHUB_TOKEN by default
@@ -35,7 +35,7 @@ jobs:
- name: Setup bun - name: Setup bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- name: Install - name: Install
uses: ./.github/composite-actions/install uses: ./.github/composite-actions/install
+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
- name: Install bun - name: Install bun
uses: oven-sh/setup-bun@v1 uses: oven-sh/setup-bun@v1
with: with:
bun-version: 1.0.21 bun-version: 1.0.35
- name: Run chains sync - name: Run chains sync
run: bun run db:sync run: bun run db:sync
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/auth # @thirdweb-dev/auth
## 4.1.50
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1)]:
- @thirdweb-dev/wallets@2.4.28
## 4.1.49 ## 4.1.49
### Patch Changes ### Patch Changes
+25 -32
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/auth", "name": "@thirdweb-dev/auth",
"version": "4.1.49", "version": "4.1.50",
"main": "dist/thirdweb-dev-auth.cjs.js", "main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js", "module": "dist/thirdweb-dev-auth.esm.js",
"browser": { "browser": {
@@ -61,7 +61,7 @@
"lint": "eslint src/ && bunx publint --strict --level warning", "lint": "eslint src/ && bunx publint --strict --level warning",
"fix": "eslint src/ --fix", "fix": "eslint src/ --fix",
"clean": "rm -rf dist/ && rm -rf node_modules/", "clean": "rm -rf dist/ && rm -rf node_modules/",
"test": "mocha --config './test/.mocharc.json' --timeout 240000 --parallel './test/**/*.test.ts'", "test": "vitest",
"push": "yalc push" "push": "yalc push"
}, },
"preconstruct": { "preconstruct": {
@@ -80,44 +80,37 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.7", "@microsoft/api-documenter": "^7.24.1",
"@babel/preset-env": "^7.23.8", "@microsoft/api-extractor": "^7.43.0",
"@babel/preset-typescript": "^7.23.3", "@microsoft/tsdoc": "^0.14.2",
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@swc-node/register": "^1.6.8", "@swc-node/register": "^1.9.0",
"@swc/core": "^1.3.71", "@swc/core": "^1.4.11",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/chai": "^4.3.5", "@types/cookie": "^0.6.0",
"@types/cookie": "^0.5.1", "@types/cookie-parser": "^1.4.7",
"@types/cookie-parser": "^1.4.3", "@types/express": "^4.17.21",
"@types/express": "^4.17.13", "@types/uuid": "^9.0.8",
"@types/mocha": "^10.0.0",
"@types/uuid": "^9.0.5",
"chai": "^4.3.6",
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.0", "eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"express": "^4.18.1", "express": "^4.19.2",
"fastify": "^4.25.2", "fastify": "^4.26.2",
"mocha": "10.4.0", "next": "^13.5.6",
"next": "^13.4", "next-auth": "^4.24.7",
"next-auth": "^4.22.3", "typescript": "5.4.3"
"typescript": "^5.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"cookie-parser": "^1.4.6", "cookie-parser": "^1.4.6",
"ethers": "^5", "ethers": "^5",
"express": "^4", "express": "^4",
"fastify": "^4.25.2", "fastify": "^4.25.2",
"next": "^12 || ^13 || ^14", "next": "^13.4 || ^14",
"next-auth": "^4" "next-auth": "^4"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
@@ -141,12 +134,12 @@
} }
}, },
"dependencies": { "dependencies": {
"@fastify/cookie": "^9.1.0", "@fastify/cookie": "^9.3.1",
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"cookie": "^0.5.0", "cookie": "^0.6.0",
"fastify-type-provider-zod": "^1.1.9", "fastify-type-provider-zod": "^1.1.9",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"zod": "^3.22.3" "zod": "^3.22.4"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
-8
View File
@@ -1,8 +0,0 @@
{
"extension": [
"ts"
],
"require": [
"@swc-node/register"
]
}
+11 -4
View File
@@ -1,15 +1,21 @@
import { ThirdwebAuth } from "../src/core"; import { ThirdwebAuth } from "../src/core";
import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers"; import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers";
import { expect } from "chai";
import { Wallet } from "ethers"; import { Wallet } from "ethers";
import { describe, it, beforeAll, beforeEach, expect } from "vitest";
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv-mono").load(); require("dotenv-mono").load();
describe("Wallet Authentication - EVM", async () => { describe(
"Wallet Authentication - EVM",
{
timeout: 60000,
},
async () => {
let adminWallet: any, signerWallet: any, attackerWallet: any; let adminWallet: any, signerWallet: any, attackerWallet: any;
let auth: ThirdwebAuth; let auth: ThirdwebAuth;
before(async () => { beforeAll(async () => {
const [adminSigner, signerSigner, attackerSigner] = [ const [adminSigner, signerSigner, attackerSigner] = [
Wallet.createRandom(), Wallet.createRandom(),
Wallet.createRandom(), Wallet.createRandom(),
@@ -374,4 +380,5 @@ describe("Wallet Authentication - EVM", async () => {
}); });
expect(user.address).to.equal(await signerWallet.getAddress()); expect(user.address).to.equal(await signerWallet.getAddress());
}); });
}); },
);
+11 -4
View File
@@ -1,16 +1,22 @@
import { LocalWallet, SmartWallet } from "@thirdweb-dev/wallets"; import { LocalWallet, SmartWallet } from "@thirdweb-dev/wallets";
import { ThirdwebAuth } from "../src/core"; import { ThirdwebAuth } from "../src/core";
import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers"; import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers";
import { expect } from "chai";
import { Wallet } from "ethers"; import { Wallet } from "ethers";
import { describe, it, beforeEach, beforeAll, expect } from "vitest";
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv-mono").load(); require("dotenv-mono").load();
describe("Wallet Authentication - EVM - Smart Wallet", async () => { describe(
"Wallet Authentication - EVM - Smart Wallet",
{
timeout: 60000,
},
async () => {
let adminWallet: any, signerWallet: any, attackerWallet: any; let adminWallet: any, signerWallet: any, attackerWallet: any;
let auth: ThirdwebAuth; let auth: ThirdwebAuth;
before(async () => { beforeAll(async () => {
const factoryAddress = "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052"; const factoryAddress = "0xbf1C9aA4B1A085f7DA890a44E82B0A1289A40052";
const chain = 421614; const chain = 421614;
const localWallet = new LocalWallet(); const localWallet = new LocalWallet();
@@ -381,4 +387,5 @@ describe("Wallet Authentication - EVM - Smart Wallet", async () => {
}); });
expect(user.address).to.equal(await signerWallet.getAddress()); expect(user.address).to.equal(await signerWallet.getAddress());
}); });
}); },
);
+8
View File
@@ -1,5 +1,13 @@
# @thirdweb-dev/chains # @thirdweb-dev/chains
## 0.1.84
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- [#2580](https://github.com/thirdweb-dev/js/pull/2580) [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.83 ## 0.1.83
### Patch Changes ### Patch Changes
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"chain": "Ankara",
"chainId": 72778,
"explorers": [
{
"name": "ankara",
"url": "https://explorer.ankara-cagacrypto.com",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://Qmeiop9gSdzU4NNJ6GCuPk6AeYwD9pbhEFVfRdk4dXs3kJ",
"width": 640,
"height": 640,
"format": "png"
},
"infoURL": "https://www.cagacrypto.com/",
"name": "CAGA crypto Ankara testnet",
"nativeCurrency": {
"name": "Caga",
"symbol": "CAGA",
"decimals": 18
},
"networkId": 72778,
"rpc": [
"https://72778.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://www.ankara-cagacrypto.com",
"wss://wss.ankara-cagacrypto.com"
],
"shortName": "caga",
"slug": "caga-crypto-ankara-testnet",
"testnet": true
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"chain": "SPENT",
"chainId": 9911,
"explorers": [
{
"name": "escscan",
"url": "https://escscan.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmVvQdmAj6GNQjP1dsxQKbA7xgzqsciooGTQtQ2RsJ37Lf",
"width": 335,
"height": 335,
"format": "svg"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmVvQdmAj6GNQjP1dsxQKbA7xgzqsciooGTQtQ2RsJ37Lf",
"width": 335,
"height": 335,
"format": "svg"
},
"infoURL": "https://espento.network",
"name": "Espento Mainnet",
"nativeCurrency": {
"name": "ESPENTO",
"symbol": "SPENT",
"decimals": 18
},
"networkId": 9911,
"rpc": [
"https://9911.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.escscan.com/"
],
"shortName": "spent",
"slug": "espento",
"testnet": false
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 99308,
"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": "Borne Gaming Testnet",
"nativeCurrency": {
"name": "Borne Gaming Testnet Token",
"symbol": "BORNE",
"decimals": 18
},
"networkId": 99308,
"redFlags": [],
"rpc": [
"https://99308.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/bornegamin/testnet/rpc"
],
"shortName": "Borne Gaming Testnet",
"slug": "borne-gaming-testnet",
"testnet": true
} as const satisfies Chain;
+3 -10
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/chains", "name": "@thirdweb-dev/chains",
"version": "0.1.83", "version": "0.1.84",
"main": "dist/thirdweb-dev-chains.cjs.js", "main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js", "module": "dist/thirdweb-dev-chains.esm.js",
"exports": { "exports": {
@@ -12,15 +12,11 @@
}, },
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.7", "@babel/runtime": "^7.24.1",
"@babel/preset-env": "^7.23.8",
"@babel/preset-typescript": "^7.23.3",
"@babel/runtime": "^7.23.8",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"plop": "^3.1.2", "typescript": "5.4.3"
"typescript": "^5.3.3"
}, },
"preconstruct": { "preconstruct": {
"entrypoints": [ "entrypoints": [
@@ -34,9 +30,6 @@
"db:sync": "bun scripts/sync-db.ts", "db:sync": "bun scripts/sync-db.ts",
"build": "tsc && preconstruct build", "build": "tsc && preconstruct build",
"push": "yalc push", "push": "yalc push",
"plop": "plop",
"add-chain": "plop add-chain",
"override-chain": "plop override-chain",
"test": "bun test" "test": "bun test"
}, },
"engines": { "engines": {
-80
View File
@@ -1,80 +0,0 @@
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",
},
],
});
}
File diff suppressed because one or more lines are too long
+13
View File
@@ -1,5 +1,18 @@
# thirdweb # thirdweb
## 0.13.58
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4), [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/sdk@4.0.52
- @thirdweb-dev/storage@2.0.12
- @thirdweb-dev/wallets@2.4.28
- @thirdweb-dev/chains@0.1.84
- @thirdweb-dev/auth@4.1.50
## 0.13.57 ## 0.13.57
### Patch Changes ### Patch Changes
+9 -3
View File
@@ -2,6 +2,7 @@ import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { copyFile } from "fs/promises"; import { copyFile } from "fs/promises";
import { resolve } from "path"; import { resolve } from "path";
import { ERROR_MESSAGES } from "../constants/constants"; import { ERROR_MESSAGES } from "../constants/constants";
import { describe, it, expect } from "vitest";
// load env variables // load env variables
require("dotenv-mono").load(); require("dotenv-mono").load();
@@ -12,9 +13,13 @@ const apiSecretKey = process.env.TW_SECRET_KEY as string;
const itif = (condition: boolean) => (condition ? it : it.skip); const itif = (condition: boolean) => (condition ? it : it.skip);
// this creates an app, can take some time that's fine // this creates an app, can take some time that's fine
jest.setTimeout(120_000);
describe("npx thirdweb deploy", () => { describe(
"npx thirdweb deploy",
{
timeout: 120_000,
},
() => {
itif(!!apiSecretKey)("should return deploy page url", async () => { itif(!!apiSecretKey)("should return deploy page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment(); const { spawn, cleanup, exists, path } = await prepareEnvironment();
@@ -46,4 +51,5 @@ describe("npx thirdweb deploy", () => {
await cleanup(); // cleanup after test await cleanup(); // cleanup after test
}); });
}); },
);
+15 -9
View File
@@ -1,13 +1,16 @@
import { CREATE_MESSAGES } from "../constants/constants"; import { CREATE_MESSAGES } from "../constants/constants";
import { prepareEnvironment } from "@gmrchk/cli-testing-library"; import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { describe, it, expect } from "vitest";
// load env variables // load env variables
require("dotenv-mono").load(); require("dotenv-mono").load();
// this creates an app, can take some time that's fine describe(
jest.setTimeout(240_000); "npx thirdweb detect",
{
describe("npx thirdweb detect", () => { timeout: 240_000,
},
() => {
it("should detect ERC721Base extensions", async () => { it("should detect ERC721Base extensions", async () => {
const { spawn, cleanup, exists } = await prepareEnvironment(); const { spawn, cleanup, exists } = await prepareEnvironment();
const create = await spawn("node", "./dist/cli/index.js create"); const create = await spawn("node", "./dist/cli/index.js create");
@@ -43,7 +46,9 @@ describe("npx thirdweb detect", () => {
); );
// check that hardhat config exists // check that hardhat config exists
expect(await exists("thirdweb-contracts/hardhat.config.js")).toEqual(true); expect(await exists("thirdweb-contracts/hardhat.config.js")).toEqual(
true,
);
await create.writeText("cd thirdweb-contracts"); await create.writeText("cd thirdweb-contracts");
await create.pressKey("enter"); await create.pressKey("enter");
@@ -66,9 +71,9 @@ describe("npx thirdweb detect", () => {
const lines = detect.getStdout(); const lines = detect.getStdout();
// Detected extensions // Detected extensions
expect(lines.findIndex((line) => line.includes("ERC721"))).toBeGreaterThan( expect(
-1, lines.findIndex((line) => line.includes("ERC721")),
); ).toBeGreaterThan(-1);
expect( expect(
lines.findIndex((line) => line.includes("ERC721Burnable")), lines.findIndex((line) => line.includes("ERC721Burnable")),
).toBeGreaterThan(-1); ).toBeGreaterThan(-1);
@@ -89,4 +94,5 @@ describe("npx thirdweb detect", () => {
await cleanup(); // cleanup after test await cleanup(); // cleanup after test
}); });
}); },
);
+9 -5
View File
@@ -2,6 +2,7 @@ import { prepareEnvironment } from "@gmrchk/cli-testing-library";
import { copyFile } from "fs/promises"; import { copyFile } from "fs/promises";
import { resolve } from "path"; import { resolve } from "path";
import { ERROR_MESSAGES } from "../constants/constants"; import { ERROR_MESSAGES } from "../constants/constants";
import { describe, it, expect } from "vitest";
// load env variables // load env variables
require("dotenv-mono").load(); require("dotenv-mono").load();
@@ -12,10 +13,12 @@ const apiSecretKey = process.env.TW_SECRET_KEY as string;
// function to skip tests based on condition // function to skip tests based on condition
const itif = (condition: boolean) => (condition ? it : it.skip); const itif = (condition: boolean) => (condition ? it : it.skip);
// this creates an app, can take some time that's fine describe(
jest.setTimeout(120_000); "npx thirdweb publish",
{
describe("npx thirdweb publish", () => { timeout: 120_000,
},
() => {
// conditionally skip test if there's no api key // conditionally skip test if there's no api key
itif(!!apiSecretKey)("should return publish page url", async () => { itif(!!apiSecretKey)("should return publish page url", async () => {
const { spawn, cleanup, exists, path } = await prepareEnvironment(); const { spawn, cleanup, exists, path } = await prepareEnvironment();
@@ -45,4 +48,5 @@ describe("npx thirdweb publish", () => {
await cleanup(); // cleanup after test await cleanup(); // cleanup after test
}); });
}); },
);
-5
View File
@@ -1,5 +0,0 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
};
+23 -29
View File
@@ -1,7 +1,7 @@
{ {
"name": "@thirdweb-dev/cli", "name": "@thirdweb-dev/cli",
"main": "dist/cli/index.js", "main": "dist/cli/index.js",
"version": "0.13.57", "version": "0.13.58",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -11,28 +11,23 @@
"devDependencies": { "devDependencies": {
"@gmrchk/cli-testing-library": "^0.1.2", "@gmrchk/cli-testing-library": "^0.1.2",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/async-retry": "^1.3.0", "@types/async-retry": "^1.4.8",
"@types/cross-spawn": "^6.0.2", "@types/cross-spawn": "^6.0.6",
"@types/inquirer": "^8.2.1", "@types/inquirer": "^8.2.10",
"@types/jest": "^29.5.3", "@types/js-yaml": "^4.0.9",
"@types/js-yaml": "^4.0.5", "@types/node": "20.11.30",
"@types/node": "^18.17.1", "@types/prompts": "^2.4.9",
"@types/prompts": "^2.4.4", "@types/tar": "^6.1.11",
"@types/rimraf": "^3.0.0", "@types/update-notifier": "^6.0.8",
"@types/tar": "^6.1.5", "@types/validate-npm-package-name": "^4.0.2",
"@types/update-notifier": "^6.0.4",
"@types/validate-npm-package-name": "^4.0.0",
"chalk": "^5.3.0", "chalk": "^5.3.0",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"dotenv-mono": "^1.3.10", "dotenv-mono": "^1.3.14",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"hardhat": "^2.17.0", "hardhat": "^2.22.2",
"jest": "^29.6.2",
"ora": "^6.3.1", "ora": "^6.3.1",
"ts-jest": "^29.1.1", "tsup": "8.0.2",
"ts-node": "^10.7.0", "typescript": "5.4.3"
"tsup": "^6.7.0",
"typescript": "^5.3.3"
}, },
"dependencies": { "dependencies": {
"@iarna/toml": "^2.2.5", "@iarna/toml": "^2.2.5",
@@ -42,22 +37,22 @@
"@thirdweb-dev/storage": "workspace:*", "@thirdweb-dev/storage": "workspace:*",
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"async-retry": "^1.3.3", "async-retry": "^1.3.3",
"commander": "^9.1.0", "commander": "^9.5.0",
"detect-package-manager": "^2.0.1", "detect-package-manager": "^2.0.1",
"enquirer": "^2.3.6", "enquirer": "^2.4.1",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"got": "11.8.5", "got": "11.8.5",
"inquirer": "^8.2.3", "inquirer": "^8.2.6",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"open": "^8.4.0", "open": "^8.4.2",
"prompts": "^2.4.2", "prompts": "^2.4.2",
"rimraf": "^3.0.2", "rimraf": "5.0.5",
"solc": "0.8.17", "solc": "0.8.25",
"tar": "^6.1.15", "tar": "^6.2.1",
"update-notifier": "^6.0.2", "update-notifier": "^6.0.2",
"validate-npm-package-name": "^4.0.0", "validate-npm-package-name": "^4.0.0",
"xdg-app-paths": "^8.3.0", "xdg-app-paths": "^8.3.0",
"yaml": "^2.3.4" "yaml": "^2.4.1"
}, },
"bin": { "bin": {
"thirdweb": "./dist/cli/index.js" "thirdweb": "./dist/cli/index.js"
@@ -67,11 +62,10 @@
"lint": "eslint src/", "lint": "eslint src/",
"fix": "eslint src/ --fix", "fix": "eslint src/ --fix",
"clean": "rm -rf dist/", "clean": "rm -rf dist/",
"cli": "node -r ts-node/register src/cli/index.ts",
"build": "pnpm clean && tsup --env.NODE_ENV production --minify --format cjs --external hardhat --dts-resolve", "build": "pnpm clean && tsup --env.NODE_ENV production --minify --format cjs --external hardhat --dts-resolve",
"build:watch": "pnpm run build --watch", "build:watch": "pnpm run build --watch",
"generate-thirdweb-package": "node scripts/generate-thirdweb-package.js", "generate-thirdweb-package": "node scripts/generate-thirdweb-package.js",
"e2e": "jest", "e2e": "vitest",
"push": "yalc push" "push": "yalc push"
}, },
"files": [ "files": [
@@ -1,5 +1,11 @@
# @thirdweb-dev/contracts-js # @thirdweb-dev/contracts-js
## 1.3.19
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 1.3.18 ## 1.3.18
### Patch Changes ### Patch Changes
+4 -6
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/contracts-js", "name": "@thirdweb-dev/contracts-js",
"version": "1.3.18", "version": "1.3.19",
"main": "dist/thirdweb-dev-contracts-js.cjs.js", "main": "dist/thirdweb-dev-contracts-js.cjs.js",
"module": "dist/thirdweb-dev-contracts-js.esm.js", "module": "dist/thirdweb-dev-contracts-js.esm.js",
"exports": { "exports": {
@@ -428,17 +428,15 @@
"@thirdweb-dev/contracts": "3.12.1" "@thirdweb-dev/contracts": "3.12.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.23.8",
"@babel/preset-typescript": "^7.23.3",
"@ethersproject/abi": "^5.7.0", "@ethersproject/abi": "^5.7.0",
"@ethersproject/providers": "^5.7.2", "@ethersproject/providers": "^5.7.2",
"@preconstruct/cli": "^2.8.1", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@typechain/ethers-v5": "10.0.0", "@typechain/ethers-v5": "10.0.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"typechain": "^8.3.1", "typechain": "^8.3.2",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"peerDependencies": { "peerDependencies": {
"ethers": "^5" "ethers": "^5"
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/crypto # @thirdweb-dev/crypto
## 0.2.3
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 0.2.2 ## 0.2.2
### Patch Changes ### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/crypto", "name": "@thirdweb-dev/crypto",
"version": "0.2.2", "version": "0.2.3",
"main": "dist/thirdweb-dev-crypto.cjs.js", "main": "dist/thirdweb-dev-crypto.cjs.js",
"module": "dist/thirdweb-dev-crypto.esm.js", "module": "dist/thirdweb-dev-crypto.esm.js",
"exports": { "exports": {
@@ -27,8 +27,8 @@
}, },
"sideEffects": false, "sideEffects": false,
"dependencies": { "dependencies": {
"@noble/hashes": "^1.3.2", "@noble/hashes": "^1.4.0",
"js-sha3": "^0.9.2" "js-sha3": "^0.9.3"
}, },
"devDependencies": { "devDependencies": {
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
@@ -37,10 +37,10 @@
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"js-awe": "^1.0.62", "js-awe": "^1.0.64",
"tinybench": "^2.5.1", "tinybench": "^2.6.0",
"typescript": "^5.3.3", "typescript": "5.4.3",
"viem": "^1.19.1" "viem": "2.9.5"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/merkletree # @thirdweb-dev/merkletree
## 0.2.3
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1)]:
- @thirdweb-dev/crypto@0.2.3
## 0.2.2 ## 0.2.2
### Patch Changes ### Patch Changes
+7 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/merkletree", "name": "@thirdweb-dev/merkletree",
"version": "0.2.2", "version": "0.2.3",
"main": "dist/thirdweb-dev-merkletree.cjs.js", "main": "dist/thirdweb-dev-merkletree.cjs.js",
"module": "dist/thirdweb-dev-merkletree.esm.js", "module": "dist/thirdweb-dev-merkletree.esm.js",
"exports": { "exports": {
@@ -35,17 +35,17 @@
"devDependencies": { "devDependencies": {
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/benchmark": "^2.1.4", "@types/benchmark": "^2.1.5",
"@types/treeify": "^1.0.2", "@types/treeify": "^1.0.3",
"benchmark": "^2.1.4", "benchmark": "^2.1.4",
"circomlibjs": "^0.1.7", "circomlibjs": "^0.1.7",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"ethereum-cryptography": "^1.0.3", "ethereum-cryptography": "^1.2.0",
"ethereumjs-util": "^7.0.9", "ethereumjs-util": "^7.1.5",
"keccak256": "^1.0.6", "keccak256": "^1.0.6",
"sha1": "^1.1.1", "sha1": "^1.1.1",
"tape": "^4.9.2", "tape": "^4.17.0",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/pay # @thirdweb-dev/pay
## 0.1.6
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 0.1.5 ## 0.1.5
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/pay", "name": "@thirdweb-dev/pay",
"version": "0.1.5", "version": "0.1.6",
"main": "dist/thirdweb-dev-pay.cjs.js", "main": "dist/thirdweb-dev-pay.cjs.js",
"module": "dist/thirdweb-dev-pay.esm.js", "module": "dist/thirdweb-dev-pay.esm.js",
"exports": { "exports": {
@@ -33,13 +33,13 @@
}, },
"sideEffects": false, "sideEffects": false,
"dependencies": { "dependencies": {
"@coinbase/cbpay-js": "^1.7.0" "@coinbase/cbpay-js": "^1.10.0"
}, },
"devDependencies": { "devDependencies": {
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/payments # @thirdweb-dev/payments
## 1.0.3
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 1.0.2 ## 1.0.2
### Patch Changes ### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/payments", "name": "@thirdweb-dev/payments",
"version": "1.0.2", "version": "1.0.3",
"main": "dist/thirdweb-dev-payments.cjs.js", "main": "dist/thirdweb-dev-payments.cjs.js",
"module": "dist/thirdweb-dev-payments.esm.js", "module": "dist/thirdweb-dev-payments.esm.js",
"types": "dist/thirdweb-dev-payments.cjs.d.ts", "types": "dist/thirdweb-dev-payments.cjs.d.ts",
@@ -44,7 +44,7 @@
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
+13
View File
@@ -1,5 +1,18 @@
# @thirdweb-dev/react-core # @thirdweb-dev/react-core
## 4.4.26
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4), [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/sdk@4.0.52
- @thirdweb-dev/storage@2.0.12
- @thirdweb-dev/wallets@2.4.28
- @thirdweb-dev/chains@0.1.84
- @thirdweb-dev/auth@4.1.50
## 4.4.25 ## 4.4.25
### Patch Changes ### Patch Changes
+16 -19
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-core", "name": "@thirdweb-dev/react-core",
"version": "4.4.25", "version": "4.4.26",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-core", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-core",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -57,34 +57,31 @@
}, },
"sideEffects:": false, "sideEffects:": false,
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.7", "@babel/preset-react": "^7.24.1",
"@babel/preset-env": "^7.23.8", "@babel/runtime": "^7.24.1",
"@babel/preset-react": "^7.23.3", "@microsoft/api-documenter": "^7.24.1",
"@babel/preset-typescript": "^7.23.3", "@microsoft/api-extractor": "^7.43.0",
"@babel/runtime": "^7.23.8", "@microsoft/tsdoc": "^0.14.2",
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/auth": "workspace:*", "@thirdweb-dev/auth": "workspace:*",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/js-cookie": "^3.0.6", "@types/js-cookie": "^3.0.6",
"@types/mime": "3.0.0", "@types/mime": "3.0.0",
"@types/react": "^18.2.17", "@types/react": "18.2.17",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.4", "eslint-plugin-better-tree-shaking": "0.0.4",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.0", "eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"react": "^18.2.0", "react": "18.2.0",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"dependencies": { "dependencies": {
"@tanstack/react-query": "^4.33.0", "@tanstack/react-query": "^4.36.1",
"@thirdweb-dev/auth": "workspace:*", "@thirdweb-dev/auth": "workspace:*",
"@thirdweb-dev/chains": "workspace:*", "@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/generated-abis": "workspace:^", "@thirdweb-dev/generated-abis": "workspace:^",
@@ -92,7 +89,7 @@
"@thirdweb-dev/storage": "workspace:*", "@thirdweb-dev/storage": "workspace:*",
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"mime": "3.0.0", "mime": "3.0.0",
"tiny-invariant": "^1.2.0" "tiny-invariant": "^1.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"ethers": ">=5.5.1", "ethers": ">=5.5.1",
@@ -15,7 +15,7 @@ import {
DAppMetaData, DAppMetaData,
SignerWallet, SignerWallet,
} from "@thirdweb-dev/wallets"; } from "@thirdweb-dev/wallets";
import React, { useMemo } from "react"; import { useMemo } from "react";
/** /**
* The possible props for the ThirdwebProvider. * The possible props for the ThirdwebProvider.
@@ -1,5 +1,11 @@
# @thirdweb-dev/react-native-compat # @thirdweb-dev/react-native-compat
## 0.7.23
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 0.7.22 ## 0.7.22
## 0.7.21 ## 0.7.21
@@ -1,7 +1,7 @@
{ {
"name": "@thirdweb-dev/react-native-compat", "name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects", "description": "Shims for Thirdweb in React Native Projects",
"version": "0.7.22", "version": "0.7.23",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native-compat", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native-compat",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -24,8 +24,8 @@
"@ethersproject/shims": "^5.7.0", "@ethersproject/shims": "^5.7.0",
"@walletconnect/react-native-compat": "2.9.2", "@walletconnect/react-native-compat": "2.9.2",
"base-64": "^1.0.0", "base-64": "^1.0.0",
"big-integer": "^1.6.51", "big-integer": "^1.6.52",
"react-native-get-random-values": "^1.10.0", "react-native-get-random-values": "^1.11.0",
"react-native-url-polyfill": "^2.0.0" "react-native-url-polyfill": "^2.0.0"
}, },
"peerDependencies": { "peerDependencies": {
@@ -34,14 +34,13 @@
"react-native": ">=0.70.0" "react-native": ">=0.70.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.23.8",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/node": "^18.17.1", "@types/node": "20.11.30",
"babel-plugin-module-resolver": "^5.0.0", "babel-plugin-module-resolver": "^5.0.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"react": "^18.2.0", "react": "18.2.0",
"react-native": "^0.71.11", "react-native": "^0.71.17",
"typescript": "^5.3.3" "typescript": "5.4.3"
} }
} }
+13
View File
@@ -1,5 +1,18 @@
# @thirdweb-dev/react-native # @thirdweb-dev/react-native
## 0.7.23
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4), [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/sdk@4.0.52
- @thirdweb-dev/react-core@4.4.26
- @thirdweb-dev/storage@2.0.12
- @thirdweb-dev/wallets@2.4.28
- @thirdweb-dev/chains@0.1.84
## 0.7.22 ## 0.7.22
### Patch Changes ### Patch Changes
+26 -31
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-native", "name": "@thirdweb-dev/react-native",
"version": "0.7.22", "version": "0.7.23",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-native",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -28,59 +28,54 @@
"@aws-sdk/client-lambda": "3.350.0", "@aws-sdk/client-lambda": "3.350.0",
"@aws-sdk/credential-providers": "3.350.0", "@aws-sdk/credential-providers": "3.350.0",
"@coinbase/wallet-mobile-sdk": "1.0.13", "@coinbase/wallet-mobile-sdk": "1.0.13",
"@paperxyz/embedded-wallet-service-sdk": "^1.2.4", "@paperxyz/embedded-wallet-service-sdk": "^1.2.5",
"@shopify/restyle": "^2.4.2", "@shopify/restyle": "^2.4.2",
"@tanstack/react-query": "^4.33.0", "@tanstack/react-query": "^4.36.1",
"@thirdweb-dev/chains": "workspace:*", "@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/react-core": "workspace:*", "@thirdweb-dev/react-core": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/sdk": "workspace:*",
"@thirdweb-dev/storage": "workspace:*", "@thirdweb-dev/storage": "workspace:*",
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"abitype": "^0.2.5", "abitype": "1.0.0",
"aws-amplify": "^5.3.8", "aws-amplify": "^5.3.18",
"expo-application": "5.7.0", "expo-application": "5.7.0",
"expo-clipboard": "^4.5.0", "expo-clipboard": "^4.8.0",
"expo-document-picker": "^11.2.2", "expo-document-picker": "^11.10.1",
"expo-file-system": "^15.2.2", "expo-file-system": "^15.9.0",
"expo-secure-store": "^12.1.1", "expo-secure-store": "^12.8.1",
"react-native-modal": "^13.0.1", "react-native-modal": "^13.0.1",
"react-native-qrcode-svg": "6.2.0", "react-native-qrcode-svg": "6.2.0",
"react-native-svg": "^13.9.0", "react-native-svg": "^13.14.0",
"secrets.js-34r7h": "^2.0.2", "secrets.js-34r7h": "^2.0.2",
"tiny-invariant": "^1.2.0" "tiny-invariant": "^1.3.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.7", "@react-native-async-storage/async-storage": "^1.23.1",
"@babel/preset-env": "^7.23.8", "@react-native-community/eslint-config": "^3.2.0",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-native-community/eslint-config": "^3.0.2",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/jest": "^29.5.3", "@types/react": "18.2.17",
"@types/react": "^18.2.17", "@types/react-native": "^0.71.13",
"@types/react-native": "^0.71.8", "eslint": "^8.57.0",
"babel-jest": "^29.6.2",
"eslint": "^8.56.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-i18next": "^6.0.3", "eslint-plugin-i18next": "^6.0.3",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.0", "eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"jest": "^29.6.2", "react": "18.2.0",
"react": "^18.2.0", "react-native": "^0.71.17",
"react-native": "^0.71.11",
"react-native-camera": "^4.2.1", "react-native-camera": "^4.2.1",
"rimraf": "^3.0.2", "rimraf": "5.0.5",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"optionalDependencies": { "optionalDependencies": {
"amazon-cognito-identity-js": "^6.3.3", "amazon-cognito-identity-js": "^6.3.12",
"react-native-aes-gcm-crypto": "^0.2.2", "react-native-aes-gcm-crypto": "^0.2.2",
"react-native-camera": "^4.2.1", "react-native-camera": "^4.2.1",
"react-native-inappbrowser-reborn": "^3.7.0", "react-native-inappbrowser-reborn": "^3.7.0",
"react-native-quick-base64": "^2.0.7", "react-native-quick-base64": "^2.0.8",
"react-native-quick-crypto": "^0.6.1" "react-native-quick-crypto": "^0.6.1"
}, },
"peerDependencies": { "peerDependencies": {
@@ -24,11 +24,11 @@ export type LocalWalletImportModalProps = {
onWalletImported: (wallet: LocalWalletInstance) => void; onWalletImported: (wallet: LocalWalletInstance) => void;
}; };
export const LocalWalletImportModal = ({ export const LocalWalletImportModal: React.FC<LocalWalletImportModalProps> = ({
isVisible, isVisible,
onClose, onClose,
onWalletImported, onWalletImported,
}: LocalWalletImportModalProps) => { }) => {
const l = useLocale(); const l = useLocale();
const [password, setPassword] = useState<string | undefined>(); const [password, setPassword] = useState<string | undefined>();
const [privateKeyOrMnemonic, setPrivateKeyOrMnemonic] = useState< const [privateKeyOrMnemonic, setPrivateKeyOrMnemonic] = useState<
@@ -140,12 +140,12 @@ export const LocalWalletImportModal = ({
const onPickFilePress = async () => { const onPickFilePress = async () => {
const result = await DocumentPicker.getDocumentAsync({ const result = await DocumentPicker.getDocumentAsync({
copyToCacheDirectory: true,
type: "application/json", type: "application/json",
multiple: false,
}); });
if (result.type === "success") { if (!result.canceled && result.assets.length > 0) {
setJsonFile(result.uri); setJsonFile(result.assets[0].uri);
setError(undefined); setError(undefined);
} else { } else {
setError(l.local_wallet.error_accessing_file); setError(l.local_wallet.error_accessing_file);
+13
View File
@@ -1,5 +1,18 @@
# @thirdweb-dev/react # @thirdweb-dev/react
## 4.4.26
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4), [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/sdk@4.0.52
- @thirdweb-dev/react-core@4.4.26
- @thirdweb-dev/payments@1.0.3
- @thirdweb-dev/wallets@2.4.28
- @thirdweb-dev/chains@0.1.84
## 4.4.25 ## 4.4.25
### Patch Changes ### Patch Changes
+22 -26
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react", "name": "@thirdweb-dev/react",
"version": "4.4.25", "version": "4.4.26",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -72,40 +72,36 @@
}, },
"sideEffects:": false, "sideEffects:": false,
"devDependencies": { "devDependencies": {
"@babel/core": "^7.23.7", "@babel/runtime": "^7.24.1",
"@babel/preset-env": "^7.23.8", "@microsoft/api-documenter": "^7.24.1",
"@babel/preset-react": "^7.23.3", "@microsoft/api-extractor": "^7.43.0",
"@babel/preset-typescript": "^7.23.3", "@microsoft/tsdoc": "^0.14.2",
"@babel/runtime": "^7.23.8",
"@microsoft/api-documenter": "^7.22.30",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/auth": "workspace:*", "@thirdweb-dev/auth": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/sdk": "workspace:*",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/qrcode": "^1.5.2", "@types/qrcode": "^1.5.5",
"@types/react": "^18.2.17", "@types/react": "18.2.17",
"@types/react-dom": "^18.2.7", "@types/react-dom": "^18.2.23",
"@types/uuid": "^9.0.5", "@types/uuid": "^9.0.8",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.4", "eslint-plugin-better-tree-shaking": "0.0.4",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.0", "eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-svg-jsx": "^1.2.2", "eslint-plugin-svg-jsx": "^1.2.4",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"react": "^18.2.0", "react": "18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"stream": "npm:stream-browserify@^3.0.0", "stream": "npm:stream-browserify@^3.0.0",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"dependencies": { "dependencies": {
"@emotion/css": "11.10.5", "@emotion/css": "11.10.5",
"@emotion/react": "^11.11.1", "@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@google/model-viewer": "^2.1.1", "@google/model-viewer": "^2.1.1",
"@headlessui/react": "1.7.6", "@headlessui/react": "1.7.6",
@@ -113,21 +109,21 @@
"@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-focus-scope": "^1.0.4", "@radix-ui/react-focus-scope": "^1.0.4",
"@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-popover": "^1.0.6", "@radix-ui/react-popover": "^1.0.7",
"@radix-ui/react-tabs": "^1.0.4", "@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.7", "@radix-ui/react-tooltip": "^1.0.7",
"@tanstack/react-query": "^4.33.0", "@tanstack/react-query": "^4.36.1",
"@thirdweb-dev/chains": "workspace:*", "@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/payments": "workspace:*", "@thirdweb-dev/payments": "workspace:*",
"@thirdweb-dev/react-core": "workspace:*", "@thirdweb-dev/react-core": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/sdk": "workspace:*",
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"copy-to-clipboard": "^3.3.2", "copy-to-clipboard": "^3.3.3",
"detect-browser": "^5.3.0", "detect-browser": "^5.3.0",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"qrcode": "^1.5.3", "qrcode": "^1.5.3",
"tiny-invariant": "^1.2.0" "tiny-invariant": "^1.3.3"
}, },
"peerDependencies": { "peerDependencies": {
"@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/sdk": "workspace:*",
Binary file not shown.
+15
View File
@@ -1,5 +1,20 @@
# @thirdweb-dev/sdk # @thirdweb-dev/sdk
## 4.0.52
### Patch Changes
- [#2573](https://github.com/thirdweb-dev/js/pull/2573) [`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4) Thanks [@jnsdls](https://github.com/jnsdls)! - fix CWE-1333
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/contracts-js@1.3.19
- @thirdweb-dev/merkletree@0.2.3
- @thirdweb-dev/storage@2.0.12
- @thirdweb-dev/chains@0.1.84
- @thirdweb-dev/crypto@0.2.3
## 4.0.51 ## 4.0.51
### Patch Changes ### Patch Changes
-3
View File
@@ -8,7 +8,4 @@ test-evm: FORCE
./scripts/waitForHardhatNode.sh ./scripts/waitForHardhatNode.sh
pnpm run test:all pnpm run test:all
test-sol: FORCE
./scripts/run_tests.sh
FORCE: ; FORCE: ;
+30 -31
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/sdk", "name": "@thirdweb-dev/sdk",
"version": "4.0.51", "version": "4.0.52",
"description": "The main thirdweb SDK.", "description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/sdk", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/sdk",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -75,42 +75,41 @@
"typedoc": "node scripts/typedoc.mjs" "typedoc": "node scripts/typedoc.mjs"
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-secrets-manager": "^3.378.0", "@aws-sdk/client-secrets-manager": "^3.543.0",
"@ethersproject/abstract-provider": "^5.7.0", "@ethersproject/abstract-provider": "^5.7.0",
"@microsoft/api-documenter": "^7.22.30", "@microsoft/api-documenter": "^7.24.1",
"@microsoft/api-extractor": "^7.36.3", "@microsoft/api-extractor": "^7.43.0",
"@microsoft/tsdoc": "^0.14.1", "@microsoft/tsdoc": "^0.14.2",
"@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-ethers": "^2.2.3",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@project-serum/anchor": "^0.25.0", "@swc-node/register": "^1.9.0",
"@swc-node/register": "^1.6.8", "@swc/core": "^1.4.11",
"@swc/core": "^1.3.71",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/bn.js": "^5.1.1", "@types/bn.js": "^5.1.5",
"@types/chai": "^4.3.5", "@types/chai": "^4.3.14",
"@types/deep-equal-in-any-order": "^1.0.1", "@types/deep-equal-in-any-order": "^1.0.3",
"@types/mocha": "^10.0.0", "@types/mocha": "^10.0.6",
"@types/node": "^18.17.1", "@types/node": "20.11.30",
"@types/uuid": "^9.0.5", "@types/uuid": "^9.0.8",
"chai": "^4.3.6", "chai": "^4.4.1",
"deep-equal-in-any-order": "^1.1.18", "deep-equal-in-any-order": "^1.1.20",
"dotenv-mono": "^1.3.10", "dotenv-mono": "^1.3.14",
"eslint": "^8.56.0", "eslint": "^8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.4", "eslint-plugin-better-tree-shaking": "0.0.4",
"eslint-plugin-import": "^2.26.0", "eslint-plugin-import": "^2.29.1",
"eslint-plugin-inclusive-language": "^2.2.0", "eslint-plugin-inclusive-language": "^2.2.1",
"eslint-plugin-prettier": "^5.0.0", "eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"ethers-aws-kms-signer": "^1.3.2", "ethers-aws-kms-signer": "^1.3.2",
"hardhat": "^2.17.0", "hardhat": "^2.22.2",
"mocha": "10.4.0", "mocha": "10.4.0",
"nyc": "^15.1.0", "nyc": "^15.1.0",
"rimraf": "^3.0.2", "rimraf": "5.0.5",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3", "typescript": "5.4.3",
"zksync-web3": "^0.14.3" "zksync-web3": "^0.14.4"
}, },
"peerDependencies": { "peerDependencies": {
"@aws-sdk/client-secrets-manager": "^3.215.0", "@aws-sdk/client-secrets-manager": "^3.215.0",
@@ -137,17 +136,17 @@
"@thirdweb-dev/generated-abis": "workspace:*", "@thirdweb-dev/generated-abis": "workspace:*",
"@thirdweb-dev/merkletree": "workspace:*", "@thirdweb-dev/merkletree": "workspace:*",
"@thirdweb-dev/storage": "workspace:*", "@thirdweb-dev/storage": "workspace:*",
"abitype": "^0.2.5", "abitype": "1.0.0",
"bn.js": "^5.2.1", "bn.js": "5.2.1",
"bs58": "^5.0.0", "bs58": "^5.0.0",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"eventemitter3": "^5.0.1", "eventemitter3": "^5.0.1",
"fast-deep-equal": "^3.1.3", "fast-deep-equal": "^3.1.3",
"tiny-invariant": "^1.2.0", "tiny-invariant": "^1.3.3",
"tweetnacl": "^1.0.3", "tweetnacl": "^1.0.3",
"uuid": "^9.0.1", "uuid": "^9.0.1",
"yaml": "^2.3.4", "yaml": "^2.4.1",
"zod": "^3.22.3" "zod": "^3.22.4"
}, },
"bugs": { "bugs": {
"url": "https://github.com/thirdweb-dev/js/issues" "url": "https://github.com/thirdweb-dev/js/issues"
@@ -404,6 +404,12 @@ export function parseRevertReason(error: any): string {
errorString = error.toString(); errorString = error.toString();
} }
// if the error is just too long, just return the message to limit Regexp processing time
// see: https://cwe.mitre.org/data/definitions/1333.html
if (errorString.length > 5000) {
return error.message || "";
}
return ( return (
parseMessageParts(/.*?"message":"([^"\\]*).*?/, errorString) || parseMessageParts(/.*?"message":"([^"\\]*).*?/, errorString) ||
parseMessageParts(/.*?"reason":"([^"\\]*).*?/, errorString) || parseMessageParts(/.*?"reason":"([^"\\]*).*?/, errorString) ||
@@ -65,7 +65,6 @@ export type ExtractFunctionType<
TAbi extends Abi, TAbi extends Abi,
TFunctionName extends TAbiFunctionNames<TAbi>, TFunctionName extends TAbiFunctionNames<TAbi>,
> = ( > = (
// @ts-expect-error - TODO: fix this
...args: ExtractFunctionInputsType<TAbi, TFunctionName> ...args: ExtractFunctionInputsType<TAbi, TFunctionName>
) => ExtractFunctionOutputsType<TAbi, TFunctionName>; ) => ExtractFunctionOutputsType<TAbi, TFunctionName>;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

+1 -1
View File
@@ -20,7 +20,7 @@ describe("Error Handling", async () => {
}); });
expect.fail(); expect.fail();
} catch (err) { } catch (err) {
expectError(err, "sender doesn't have enough funds to send tx"); expectError(err, "Sender doesn't have enough funds to send tx");
} }
}); });
Binary file not shown.
Binary file not shown.
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/storage # @thirdweb-dev/storage
## 2.0.12
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1)]:
- @thirdweb-dev/crypto@0.2.3
## 2.0.11 ## 2.0.11
### Patch Changes ### Patch Changes
+11 -19
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/storage", "name": "@thirdweb-dev/storage",
"version": "2.0.11", "version": "2.0.12",
"main": "dist/thirdweb-dev-storage.cjs.js", "main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js", "module": "dist/thirdweb-dev-storage.esm.js",
"exports": { "exports": {
@@ -20,9 +20,7 @@
"fix": "eslint src/ --fix", "fix": "eslint src/ --fix",
"clean": "rm -rf dist/", "clean": "rm -rf dist/",
"build": "tsc && preconstruct build", "build": "tsc && preconstruct build",
"test:all": "NODE_ENV=test SWC_NODE_PROJECT=./tsconfig.test.json mocha --timeout 30000 --parallel './test/**/*.test.ts'", "test": "vitest",
"test": "pnpm test:all",
"test:single": "NODE_ENV=test SWC_NODE_PROJECT=./tsconfig.test.json mocha --timeout 30000",
"push": "yalc push", "push": "yalc push",
"typedoc": "node scripts/typedoc.mjs" "typedoc": "node scripts/typedoc.mjs"
}, },
@@ -33,26 +31,20 @@
"exports": true "exports": true
}, },
"devDependencies": { "devDependencies": {
"@babel/preset-env": "^7.23.8", "@microsoft/api-documenter": "^7.24.1",
"@babel/preset-typescript": "^7.23.3", "@microsoft/api-extractor": "^7.43.0",
"@microsoft/api-documenter": "^7.22.30", "@microsoft/tsdoc": "^0.14.2",
"@microsoft/api-extractor": "^7.36.3",
"@microsoft/tsdoc": "^0.14.1",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@swc-node/register": "^1.6.8", "@swc-node/register": "^1.9.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/chai": "^4.3.5", "@types/uuid": "^9.0.8",
"@types/mocha": "^10.0.0", "eslint": "^8.57.0",
"@types/uuid": "^9.0.5",
"chai": "^4.3.6",
"eslint": "^8.56.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"esm": "^3.2.25", "esm": "^3.2.25",
"mocha": "10.4.0", "rimraf": "5.0.5",
"rimraf": "^3.0.2",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"dependencies": { "dependencies": {
"@thirdweb-dev/crypto": "workspace:*", "@thirdweb-dev/crypto": "workspace:*",
+4 -5
View File
@@ -1,17 +1,16 @@
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
import { expect } from "chai";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
import { getGatewayUrlForCid, IpfsUploader, ThirdwebStorage } from "../src"; import { getGatewayUrlForCid, IpfsUploader, ThirdwebStorage } from "../src";
import { DEFAULT_GATEWAY_URLS, prepareGatewayUrls } from "../src/common/urls"; import { DEFAULT_GATEWAY_URLS, prepareGatewayUrls } from "../src/common/urls";
import { describe, it, expect } from "vitest";
// load env variables // load env variables
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv-mono").load(); require("dotenv-mono").load();
const secretKey = process.env.TW_SECRET_KEY as string; const secretKey = process.env.TW_SECRET_KEY as string;
const itIfCI = process.env.CI ? it : it.skip; describe("IPFS", { timeout: 30000 }, async () => {
describe("IPFS", async () => {
if (!secretKey) { if (!secretKey) {
throw new Error("TW_SECRET_KEY is not set in the environment variables"); throw new Error("TW_SECRET_KEY is not set in the environment variables");
} }
@@ -413,7 +412,7 @@ describe("IPFS", async () => {
}); });
// only run this in CI because on local it will always be different (different api key) // only run this in CI because on local it will always be different (different api key)
itIfCI( it.runIf(process.env.CI)(
"Should return URIs with gateway URLs if specified on function", "Should return URIs with gateway URLs if specified on function",
async () => { async () => {
const uri = await storage.upload( const uri = await storage.upload(
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/wallets # @thirdweb-dev/wallets
## 2.4.28
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
- Updated dependencies [[`c81bb88`](https://github.com/thirdweb-dev/js/commit/c81bb882c505a5f1feb8f627377e76a771cce3f4), [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1), [`50e7dba`](https://github.com/thirdweb-dev/js/commit/50e7dbaa9dae77cb8cd865405c322495e2498c65)]:
- @thirdweb-dev/sdk@4.0.52
- @thirdweb-dev/contracts-js@1.3.19
- @thirdweb-dev/chains@0.1.84
- @thirdweb-dev/crypto@0.2.3
## 2.4.27 ## 2.4.27
### Patch Changes ### Patch Changes
+27 -33
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/wallets", "name": "@thirdweb-dev/wallets",
"version": "2.4.27", "version": "2.4.28",
"main": "dist/thirdweb-dev-wallets.cjs.js", "main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js", "module": "dist/thirdweb-dev-wallets.esm.js",
"browser": { "browser": {
@@ -520,34 +520,34 @@
"sideEffects": false, "sideEffects": false,
"dependencies": { "dependencies": {
"@account-abstraction/contracts": "^0.5.0", "@account-abstraction/contracts": "^0.5.0",
"@blocto/sdk": "^0.5.4", "@blocto/sdk": "0.5.5",
"@coinbase/wallet-sdk": "^3.7.1", "@coinbase/wallet-sdk": "^3.7.2",
"@google-cloud/kms": "3.0.1", "@google-cloud/kms": "3.0.1",
"@magic-ext/connect": "^6.7.2", "@magic-ext/connect": "^6.7.2",
"@magic-ext/oauth": "^7.6.2", "@magic-ext/oauth": "^7.6.2",
"@magic-sdk/provider": "^13.6.2", "@magic-sdk/provider": "^13.6.2",
"@metamask/eth-sig-util": "^4.0.0", "@metamask/eth-sig-util": "^4.0.1",
"@paperxyz/embedded-wallet-service-sdk": "^1.2.5", "@paperxyz/embedded-wallet-service-sdk": "^1.2.5",
"@paperxyz/sdk-common-utilities": "^0.1.0", "@paperxyz/sdk-common-utilities": "^0.1.1",
"@safe-global/safe-core-sdk": "^3.3.4", "@safe-global/safe-core-sdk": "^3.3.5",
"@safe-global/safe-ethers-adapters": "0.1.0-alpha.17", "@safe-global/safe-ethers-adapters": "0.1.0-alpha.17",
"@safe-global/safe-ethers-lib": "^1.9.4", "@safe-global/safe-ethers-lib": "^1.9.4",
"@thirdweb-dev/chains": "workspace:*", "@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/contracts-js": "workspace:*", "@thirdweb-dev/contracts-js": "workspace:*",
"@thirdweb-dev/crypto": "workspace:*", "@thirdweb-dev/crypto": "workspace:*",
"@thirdweb-dev/sdk": "workspace:*", "@thirdweb-dev/sdk": "workspace:*",
"@walletconnect/core": "^2.9.1", "@walletconnect/core": "^2.11.3",
"@walletconnect/ethereum-provider": "^2.9.1", "@walletconnect/ethereum-provider": "^2.11.3",
"@walletconnect/jsonrpc-utils": "^1.0.8", "@walletconnect/jsonrpc-utils": "^1.0.8",
"@walletconnect/modal": "^2.6.1", "@walletconnect/modal": "^2.6.2",
"@walletconnect/types": "^2.9.1", "@walletconnect/types": "^2.11.3",
"@walletconnect/utils": "^2.10.2", "@walletconnect/utils": "^2.11.3",
"@walletconnect/web3wallet": "^1.8.7", "@walletconnect/web3wallet": "^1.10.3",
"asn1.js": "5.4.1", "asn1.js": "5.4.1",
"bn.js": "5.2.0", "bn.js": "5.2.1",
"buffer": "^6.0.3", "buffer": "^6.0.3",
"eth-provider": "^0.13.6", "eth-provider": "^0.13.6",
"ethereumjs-util": "^7.1.3", "ethereumjs-util": "^7.1.5",
"eventemitter3": "^5.0.1", "eventemitter3": "^5.0.1",
"key-encoder": "2.0.3", "key-encoder": "2.0.3",
"magic-sdk": "^13.6.2", "magic-sdk": "^13.6.2",
@@ -582,34 +582,31 @@
} }
}, },
"devDependencies": { "devDependencies": {
"@aws-sdk/client-secrets-manager": "^3.378.0", "@aws-sdk/client-secrets-manager": "^3.543.0",
"@babel/plugin-transform-class-properties": "^7.23.3", "@babel/plugin-transform-class-properties": "^7.24.1",
"@babel/plugin-transform-flow-strip-types": "^7.23.3", "@babel/plugin-transform-flow-strip-types": "^7.24.1",
"@babel/plugin-transform-private-methods": "^7.23.3", "@babel/plugin-transform-private-methods": "^7.24.1",
"@microsoft/api-extractor": "^7.36.3", "@microsoft/api-extractor": "^7.43.0",
"@noble/ed25519": "^1.7.1", "@noble/ed25519": "^1.7.3",
"@nomiclabs/hardhat-ethers": "^2.2.3", "@nomiclabs/hardhat-ethers": "^2.2.3",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/bn.js": "^5.1.1", "@types/bn.js": "^5.1.5",
"@types/jest": "^29.5.3", "abitype": "1.0.0",
"abitype": "^0.2.5",
"babel-plugin-transform-inline-environment-variables": "^0.4.4", "babel-plugin-transform-inline-environment-variables": "^0.4.4",
"bs58": "^5.0.0", "bs58": "^5.0.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.4", "eslint-plugin-better-tree-shaking": "0.0.4",
"eslint-plugin-tsdoc": "^0.2.16", "eslint-plugin-tsdoc": "^0.2.17",
"ethereum-provider": "^0.7.7", "ethereum-provider": "^0.7.7",
"ethers": "^5.7.2", "ethers": "^5.7.2",
"ethers-aws-kms-signer": "^1.3.2", "ethers-aws-kms-signer": "^1.3.2",
"hardhat": "^2.17.0", "hardhat": "^2.22.2",
"jest": "^29.6.2", "rimraf": "5.0.5",
"rimraf": "^3.0.2",
"ts-jest": "^29.1.1",
"tweetnacl": "^1.0.3", "tweetnacl": "^1.0.3",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "^5.3.3" "typescript": "5.4.3"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
@@ -620,12 +617,9 @@
"preconstruct:fix": "preconstruct fix", "preconstruct:fix": "preconstruct fix",
"push": "yalc push", "push": "yalc push",
"typedoc": "node scripts/typedoc.mjs", "typedoc": "node scripts/typedoc.mjs",
"test": "jest" "test": "vitest"
}, },
"engines": { "engines": {
"node": ">=18" "node": ">=18"
},
"jest": {
"testTimeout": 30000
} }
} }
@@ -4,11 +4,10 @@ import { LocalWallet } from "../src/evm/wallets/local-wallet";
import { BaseSepoliaTestnet } from "@thirdweb-dev/chains"; import { BaseSepoliaTestnet } from "@thirdweb-dev/chains";
import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk"; import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk";
import { BigNumber, ethers } from "ethers"; import { BigNumber, ethers } from "ethers";
import { describe, it, expect, beforeAll } from "vitest";
require("dotenv-mono").load(); require("dotenv-mono").load();
jest.setTimeout(240_000);
let smartWallet: SmartWallet; let smartWallet: SmartWallet;
let smartWalletAddress: string; let smartWalletAddress: string;
let personalWallet: LocalWallet; let personalWallet: LocalWallet;
@@ -42,7 +41,12 @@ beforeAll(async () => {
); );
}); });
describeIf(!!process.env.TW_SECRET_KEY)("ERC20Paymaster core tests", () => { describeIf(!!process.env.TW_SECRET_KEY)(
"ERC20Paymaster core tests",
{
timeout: 240_000,
},
() => {
it("can connect", async () => { it("can connect", async () => {
expect(smartWalletAddress).toHaveLength(42); expect(smartWalletAddress).toHaveLength(42);
}); });
@@ -77,7 +81,10 @@ describeIf(!!process.env.TW_SECRET_KEY)("ERC20Paymaster core tests", () => {
await tempSmartWallet.connect({ await tempSmartWallet.connect({
personalWallet: tempLocalWallet, personalWallet: tempLocalWallet,
}); });
const claimTx = await contract.erc20.claimTo.prepare(smartWalletAddress, 1); // tx costs 1 const claimTx = await contract.erc20.claimTo.prepare(
smartWalletAddress,
1,
); // tx costs 1
const claimReceipt = await tempSmartWallet.execute(claimTx); const claimReceipt = await tempSmartWallet.execute(claimTx);
expect(claimReceipt.receipt.transactionHash).toHaveLength(66); expect(claimReceipt.receipt.transactionHash).toHaveLength(66);
balance = (await contract.erc20.balance()).value; balance = (await contract.erc20.balance()).value;
@@ -104,4 +111,5 @@ describeIf(!!process.env.TW_SECRET_KEY)("ERC20Paymaster core tests", () => {
balance = (await contract.erc20.balance()).value; balance = (await contract.erc20.balance()).value;
expect(balance).toEqual(ethers.utils.parseEther("1")); // we spent 1 token to claim 1 token expect(balance).toEqual(ethers.utils.parseEther("1")); // we spent 1 token to claim 1 token
}); });
}); },
);
@@ -4,11 +4,10 @@ import { LocalWallet } from "../src/evm/wallets/local-wallet";
import { ArbitrumSepolia } from "@thirdweb-dev/chains"; import { ArbitrumSepolia } from "@thirdweb-dev/chains";
import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk"; import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk";
import { checkContractWalletSignature } from "../src/evm/connectors/smart-wallet/lib/check-contract-wallet-signature"; import { checkContractWalletSignature } from "../src/evm/connectors/smart-wallet/lib/check-contract-wallet-signature";
import { describe, it, expect, beforeAll } from "vitest";
require("dotenv-mono").load(); require("dotenv-mono").load();
jest.setTimeout(240_000);
let smartWallet: SmartWallet; let smartWallet: SmartWallet;
let smartWalletAddress: string; let smartWalletAddress: string;
let personalWallet: LocalWallet; let personalWallet: LocalWallet;
@@ -39,7 +38,12 @@ beforeAll(async () => {
); );
}); });
describeIf(!!SECRET_KEY)("SmartWallet core tests", () => { describeIf(!!SECRET_KEY)(
"SmartWallet core tests",
{
timeout: 240_000,
},
() => {
it("can connect", async () => { it("can connect", async () => {
expect(smartWalletAddress).toHaveLength(42); expect(smartWalletAddress).toHaveLength(42);
}); });
@@ -151,4 +155,5 @@ describeIf(!!SECRET_KEY)("SmartWallet core tests", () => {
); );
expect(isValidV2).toEqual(true); expect(isValidV2).toEqual(true);
}); });
}); },
);
@@ -5,6 +5,7 @@ import { SmartWallet } from "../src/evm/wallets/smart-wallet";
import { EthersWallet } from "../src/evm/wallets/ethers"; import { EthersWallet } from "../src/evm/wallets/ethers";
import { EntryPoint__factory } from "@account-abstraction/contracts"; import { EntryPoint__factory } from "@account-abstraction/contracts";
import { AbstractWallet } from "../src"; import { AbstractWallet } from "../src";
import { describe, it, beforeAll } from "vitest";
// TODO make this work with a mock bundler/paymaster // TODO make this work with a mock bundler/paymaster
+7 -4
View File
@@ -11,7 +11,8 @@
}, },
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",
"test": "turbo run test --filter=./packages/* --filter=./legacy_packages/*", "test": "turbo run test --filter=./packages/*",
"test:legacy": "turbo run test --filter=./legacy_packages/*",
"e2e": "turbo run e2e", "e2e": "turbo run e2e",
"build": "turbo run build --filter=./packages/* --filter=./legacy_packages/*", "build": "turbo run build --filter=./packages/* --filter=./legacy_packages/*",
"bench": "turbo run bench", "bench": "turbo run bench",
@@ -77,7 +78,7 @@
"sharp": "^0.33.3", "sharp": "^0.33.3",
"size-limit": "11.1.2", "size-limit": "11.1.2",
"typedoc-gen": "workspace:*", "typedoc-gen": "workspace:*",
"typescript": "5.3.3", "typescript": "5.4.3",
"vitest": "1.4.0" "vitest": "1.4.0"
}, },
"manypkg": { "manypkg": {
@@ -89,7 +90,7 @@
"glob-parent@<5.1.2": ">=5.1.2", "glob-parent@<5.1.2": ">=5.1.2",
"nth-check@<2.0.1": ">=2.0.1", "nth-check@<2.0.1": ">=2.0.1",
"socket.io-parser@>=4.0.4 <4.2.3": ">=4.2.3", "socket.io-parser@>=4.0.4 <4.2.3": ">=4.2.3",
"fast-xml-parser@<4.2.4": ">=4.2.4", "fast-xml-parser@<=4.2.4": ">4.2.4",
"@openzeppelin/contracts@>=4.3.0 <4.9.1": ">=4.9.1", "@openzeppelin/contracts@>=4.3.0 <4.9.1": ">=4.9.1",
"@openzeppelin/contracts@>=4.7.0 <4.9.2": ">=4.9.2", "@openzeppelin/contracts@>=4.7.0 <4.9.2": ">=4.9.2",
"xml2js@<0.5.0": ">=0.5.0", "xml2js@<0.5.0": ">=0.5.0",
@@ -97,7 +98,9 @@
"semver@<7.5.2": ">=7.5.2", "semver@<7.5.2": ">=7.5.2",
"json5@<1.0.2": ">=1.0.2", "json5@<1.0.2": ">=1.0.2",
"protobufjs@>=6.10.0 <7.2.4": ">=7.2.4", "protobufjs@>=6.10.0 <7.2.4": ">=7.2.4",
"tough-cookie@<4.1.3": ">=4.1.3" "tough-cookie@<4.1.3": ">=4.1.3",
"@ethereumjs/util@<9.0.0": ">=9.0.0",
"axios@<0.28.0": ">=0.28.0"
} }
} }
} }
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/service-utils # @thirdweb-dev/service-utils
## 0.4.24
### Patch Changes
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 0.4.23 ## 0.4.23
### Patch Changes ### Patch Changes
+4 -7
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/service-utils", "name": "@thirdweb-dev/service-utils",
"version": "0.4.23", "version": "0.4.24",
"main": "dist/thirdweb-dev-service-utils.cjs.js", "main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js", "module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": { "exports": {
@@ -46,13 +46,10 @@
"@cloudflare/workers-types": "4.20240320.1", "@cloudflare/workers-types": "4.20240320.1",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/jest": "^29.5.3", "@types/node": "20.11.30",
"@types/node": "^20.11.30",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"jest": "^29.6.2", "typescript": "5.4.3"
"ts-jest": "^29.1.1",
"typescript": "^5.3.3"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
@@ -61,6 +58,6 @@
"clean": "rm -rf dist/", "clean": "rm -rf dist/",
"build": "tsc && preconstruct build", "build": "tsc && preconstruct build",
"push": "yalc push", "push": "yalc push",
"test": "jest" "test": "vitest"
} }
} }
@@ -1,5 +1,6 @@
import { authorize } from "."; import { authorize } from ".";
import { CoreServiceConfig } from "../api"; import { CoreServiceConfig } from "../api";
import { describe, it, expect } from "vitest";
const validServiceConfig: CoreServiceConfig = { const validServiceConfig: CoreServiceConfig = {
apiUrl: "https://api.example.com", apiUrl: "https://api.example.com",
@@ -1,5 +1,6 @@
import { validApiKeyMeta } from "../../mocks"; import { validApiKeyMeta } from "../../mocks";
import { ClientAuthorizationPayload, authorizeClient } from "./client"; import { ClientAuthorizationPayload, authorizeClient } from "./client";
import { describe, it, expect } from "vitest";
describe("authorizeClient", () => { describe("authorizeClient", () => {
const validAuthOptions: ClientAuthorizationPayload = { const validAuthOptions: ClientAuthorizationPayload = {
@@ -5,6 +5,7 @@ import {
} from "../../mocks"; } from "../../mocks";
import { CoreServiceConfig } from "../api"; import { CoreServiceConfig } from "../api";
import { ServiceAuthorizationPayload, authorizeService } from "./service"; import { ServiceAuthorizationPayload, authorizeService } from "./service";
import { describe, it, expect } from "vitest";
describe("authorizeService", () => { describe("authorizeService", () => {
it("should authorize service with valid service scope and action", () => { it("should authorize service with valid service scope and action", () => {
@@ -2,15 +2,16 @@ import { rateLimit } from ".";
import { validApiKeyMeta, validServiceConfig } from "../../mocks"; import { validApiKeyMeta, validServiceConfig } from "../../mocks";
import { updateRateLimitedAt } from "../api"; import { updateRateLimitedAt } from "../api";
import { AuthorizationResult } from "../authorize/types"; import { AuthorizationResult } from "../authorize/types";
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
const mockRedis = { const mockRedis = {
incr: jest.fn(), incr: vi.fn(),
expire: jest.fn(), expire: vi.fn(),
}; };
// Mocking the updateRateLimitedAt function // Mocking the updateRateLimitedAt function
jest.mock("../../../src/core/api", () => ({ vi.mock("../../../src/core/api", () => ({
updateRateLimitedAt: jest.fn(), updateRateLimitedAt: vi.fn(),
})); }));
const DEFAULT_AUTHZ_RESULT: AuthorizationResult = { const DEFAULT_AUTHZ_RESULT: AuthorizationResult = {
@@ -25,13 +26,13 @@ const DEFAULT_AUTHZ_RESULT: AuthorizationResult = {
describe("rateLimit", () => { describe("rateLimit", () => {
beforeEach(() => { beforeEach(() => {
// Clear mock function calls and reset any necessary state. // Clear mock function calls and reset any necessary state.
jest.clearAllMocks(); vi.clearAllMocks();
mockRedis.incr.mockReset(); mockRedis.incr.mockReset();
mockRedis.expire.mockReset(); mockRedis.expire.mockReset();
}); });
afterEach(() => { afterEach(() => {
jest.spyOn(global.Math, "random").mockRestore(); vi.spyOn(global.Math, "random").mockRestore();
}); });
it("should not rate limit if service scope is not in rate limits", async () => { it("should not rate limit if service scope is not in rate limits", async () => {
@@ -128,7 +129,7 @@ describe("rateLimit", () => {
it("enforces rate limit if sampled (hit)", async () => { it("enforces rate limit if sampled (hit)", async () => {
mockRedis.incr.mockResolvedValue(10); mockRedis.incr.mockResolvedValue(10);
jest.spyOn(global.Math, "random").mockReturnValue(0.08); vi.spyOn(global.Math, "random").mockReturnValue(0.08);
const result = await rateLimit({ const result = await rateLimit({
authzResult: DEFAULT_AUTHZ_RESULT, authzResult: DEFAULT_AUTHZ_RESULT,
@@ -146,7 +147,7 @@ describe("rateLimit", () => {
it("does not enforce rate limit if sampled (miss)", async () => { it("does not enforce rate limit if sampled (miss)", async () => {
mockRedis.incr.mockResolvedValue(10); mockRedis.incr.mockResolvedValue(10);
jest.spyOn(global.Math, "random").mockReturnValue(0.15); vi.spyOn(global.Math, "random").mockReturnValue(0.15);
const result = await rateLimit({ const result = await rateLimit({
authzResult: DEFAULT_AUTHZ_RESULT, authzResult: DEFAULT_AUTHZ_RESULT,
@@ -1,5 +1,6 @@
import { usageLimit } from "."; import { usageLimit } from ".";
import { validApiKeyMeta, validServiceConfig } from "../../mocks"; import { validApiKeyMeta, validServiceConfig } from "../../mocks";
import { describe, it, expect } from "vitest";
describe("usageLimit", () => { describe("usageLimit", () => {
it("should not usage limit if service scope is not in limits", async () => { it("should not usage limit if service scope is not in limits", async () => {
+10
View File
@@ -1,5 +1,15 @@
# thirdweb # thirdweb
## 5.0.1
### Patch Changes
- [#2572](https://github.com/thirdweb-dev/js/pull/2572) [`701cd88`](https://github.com/thirdweb-dev/js/commit/701cd880dfc81cf294bb48a23996b2dc737c3d4b) Thanks [@jnsdls](https://github.com/jnsdls)! - point CLI backwards compatibility @latest instead of @beta
- [#2576](https://github.com/thirdweb-dev/js/pull/2576) [`04961f0`](https://github.com/thirdweb-dev/js/commit/04961f0e9a333f9626519d726006def9fb67d7db) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Change getWalletBalance prop from account to address
- [#2577](https://github.com/thirdweb-dev/js/pull/2577) [`d93286b`](https://github.com/thirdweb-dev/js/commit/d93286bc1f8224d055b50ce3ffa4f302869cb2b1) Thanks [@jnsdls](https://github.com/jnsdls)! - update dependencies
## 5.0.0 ## 5.0.0
### Major Changes ### Major Changes
+1 -1
View File
@@ -14,7 +14,7 @@
## Installation ## Installation
```bash ```bash
npm install thirdweb@beta npm install thirdweb
``` ```
## Features ## Features
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "thirdweb", "name": "thirdweb",
"version": "5.0.0", "version": "5.0.1",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main" "url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -191,7 +191,7 @@
"mipd": "0.0.7", "mipd": "0.0.7",
"node-libs-browser": "2.2.1", "node-libs-browser": "2.2.1",
"uqr": "0.1.2", "uqr": "0.1.2",
"viem": "2.9.4" "viem": "2.9.5"
}, },
"peerDependencies": { "peerDependencies": {
"ethers": "^5 || ^6", "ethers": "^5 || ^6",
@@ -225,7 +225,7 @@
"push": "yalc push", "push": "yalc push",
"size": "size-limit", "size": "size-limit",
"test:watch": "vitest -c ./test/vitest.config.ts dev", "test:watch": "vitest -c ./test/vitest.config.ts dev",
"test": "CI=true vitest -c ./test/vitest.config.ts --coverage --retry=3 --bail=1 --pool=forks", "test": "CI=true vitest -c ./test/vitest.config.ts --coverage --bail=1",
"test:cov": "vitest dev -c ./test/vitest.config.ts --coverage", "test:cov": "vitest dev -c ./test/vitest.config.ts --coverage",
"test:dev": "vitest dev -c ./test/vitest.config.ts", "test:dev": "vitest dev -c ./test/vitest.config.ts",
"typedoc": "node scripts/typedoc.mjs", "typedoc": "node scripts/typedoc.mjs",
+18 -1
View File
@@ -6,7 +6,24 @@ const ANALYTICS_ENDPOINT = "https://c.thirdweb.com/event";
/** /**
* @internal * @internal
*/ */
export function track(client: ThirdwebClient, data: object) { export function trackConnect(args: {
client: ThirdwebClient;
walletType: string;
walletAddress: string;
}) {
const { client, walletType, walletAddress } = args;
track(client, {
source: "connectWallet",
action: "connect",
walletType,
walletAddress,
});
}
/**
* @internal
*/
function track(client: ThirdwebClient, data: object) {
const fetch = getClientFetch(client); const fetch = getClientFetch(client);
fetch(ANALYTICS_ENDPOINT, { fetch(ANALYTICS_ENDPOINT, {
+1 -1
View File
@@ -37,7 +37,7 @@ async function main() {
} }
const runner = bunAvailable ? "bunx" : "npx"; const runner = bunAvailable ? "bunx" : "npx";
// eslint-disable-next-line better-tree-shaking/no-top-level-side-effects // eslint-disable-next-line better-tree-shaking/no-top-level-side-effects
spawn(runner, ["--yes", "@thirdweb-dev/cli@beta", command, ...rest], { spawn(runner, ["--yes", "@thirdweb-dev/cli@latest", command, ...rest], {
stdio: "inherit", stdio: "inherit",
}); });
} }
@@ -1,4 +1,4 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { import {
resolveAbiFromContractApi, resolveAbiFromContractApi,
resolveContractAbi, resolveContractAbi,
@@ -7,18 +7,11 @@ import {
import { DOODLES_CONTRACT } from "~test/test-contracts.js"; import { DOODLES_CONTRACT } from "~test/test-contracts.js";
import { DOODLES_ABI } from "../../../test/src/abis/doodles.js"; import { DOODLES_ABI } from "../../../test/src/abis/doodles.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("resolveContractAbi", () => { describe("resolveContractAbi", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should use the abi on the contract if it exists", async () => { it("should use the abi on the contract if it exists", async () => {
const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT, abi: DOODLES_ABI }; const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT, abi: DOODLES_ABI };
const abi = await resolveContractAbi(DOODLES_CONTRACT_CLONE); const abi = await resolveContractAbi(DOODLES_CONTRACT_CLONE);
expect(abi).toMatchObject(DOODLES_ABI); expect(abi).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(0);
}); });
it("should resolve abi from contract", async () => { it("should resolve abi from contract", async () => {
@@ -26,7 +19,6 @@ describe("resolveContractAbi", () => {
const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT }; const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT };
const abi = await resolveContractAbi(DOODLES_CONTRACT_CLONE); const abi = await resolveContractAbi(DOODLES_CONTRACT_CLONE);
expect(abi).toMatchObject(DOODLES_ABI); expect(abi).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should cache the result on a contract level", async () => { it("should cache the result on a contract level", async () => {
@@ -34,46 +26,25 @@ describe("resolveContractAbi", () => {
const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT }; const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT };
const abi1 = await resolveContractAbi(DOODLES_CONTRACT_CLONE); const abi1 = await resolveContractAbi(DOODLES_CONTRACT_CLONE);
expect(abi1).toMatchObject(DOODLES_ABI); expect(abi1).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(1);
expect(fetchSpy).toHaveBeenCalledWith(
`https://contract.thirdweb.com/abi/1/${DOODLES_CONTRACT_CLONE.address}`,
expect.any(Object),
);
const abi2 = await resolveContractAbi(DOODLES_CONTRACT_CLONE); const abi2 = await resolveContractAbi(DOODLES_CONTRACT_CLONE);
expect(abi2).toMatchObject(DOODLES_ABI); expect(abi2).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
describe("resolveAbiFromContractApi", () => { it("should resolve abi from contract api", async () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should resolve abi from contract api", async () => {
// we do this so we don't hit any PRIOR cache // we do this so we don't hit any PRIOR cache
const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT }; const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT };
const abi = await resolveAbiFromContractApi(DOODLES_CONTRACT_CLONE); const abi = await resolveAbiFromContractApi(DOODLES_CONTRACT_CLONE);
expect(abi).toMatchObject(DOODLES_ABI); expect(abi).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(1);
expect(fetchSpy).toHaveBeenCalledWith(
`https://contract.thirdweb.com/abi/1/${DOODLES_CONTRACT_CLONE.address}`,
expect.any(Object),
);
});
}); });
describe("resolveAbiFromContractApi", () => { it.runIf(process.env.TW_SECRET_KEY)(
afterEach(() => { "should resolve abi from bytecode",
fetchSpy.mockClear();
});
it.runIf(process.env.TW_SECRET_KEY)(
"should resolve abi from contract api",
async () => { async () => {
// we do this so we don't hit any PRIOR cache // we do this so we don't hit any PRIOR cache
const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT }; const DOODLES_CONTRACT_CLONE = { ...DOODLES_CONTRACT };
const abi = await resolveAbiFromBytecode(DOODLES_CONTRACT_CLONE); const abi = await resolveAbiFromBytecode(DOODLES_CONTRACT_CLONE);
expect(abi).toMatchObject(DOODLES_ABI); expect(abi).toMatchObject(DOODLES_ABI);
expect(fetchSpy).toHaveBeenCalledTimes(2);
}, },
); );
});
@@ -1,14 +1,8 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getContractMetadata } from "./getContractMetadata.js"; import { getContractMetadata } from "./getContractMetadata.js";
import { USDC_CONTRACT } from "../../../../test/src/test-contracts.js"; import { USDC_CONTRACT } from "../../../../test/src/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("shared.getContractMetadata", () => { describe("shared.getContractMetadata", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the correct contract metadata", async () => { it("should return the correct contract metadata", async () => {
const metadata = await getContractMetadata({ const metadata = await getContractMetadata({
contract: USDC_CONTRACT, contract: USDC_CONTRACT,
@@ -1,14 +1,9 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { DROP1155_CONTRACT } from "../../../../../test/src/test-contracts.js"; import { DROP1155_CONTRACT } from "../../../../../test/src/test-contracts.js";
import { getActiveClaimCondition } from "./getActiveClaimCondition.js"; import { getActiveClaimCondition } from "./getActiveClaimCondition.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("erc1155.getClaimConditions", () => { describe("erc1155.getClaimConditions", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the correct claim conditions", async () => { it("should return the correct claim conditions", async () => {
const cc = await getActiveClaimCondition({ const cc = await getActiveClaimCondition({
contract: DROP1155_CONTRACT, contract: DROP1155_CONTRACT,
@@ -28,6 +23,5 @@ describe("erc1155.getClaimConditions", () => {
supplyClaimed: 1382n, supplyClaimed: 1382n,
}); });
// 1 call for the condition id and 1 call for the condition // 1 call for the condition id and 1 call for the condition
expect(fetchSpy).toHaveBeenCalledTimes(2);
}); });
}); });
@@ -1,14 +1,9 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getNFT } from "./getNFT.js"; import { getNFT } from "./getNFT.js";
import { DROP1155_CONTRACT } from "~test/test-contracts.js"; import { DROP1155_CONTRACT } from "~test/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("erc1155.getNFT", () => { describe("erc1155.getNFT", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => { it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => {
const nft = await getNFT({ const nft = await getNFT({
contract: DROP1155_CONTRACT, contract: DROP1155_CONTRACT,
@@ -45,7 +40,5 @@ describe("erc1155.getNFT", () => {
"type": "ERC1155", "type": "ERC1155",
} }
`); `);
// 2 fetch calls: 1 for RPC, 1 for fetching the tokenUri
expect(fetchSpy).toHaveBeenCalledTimes(2);
}); });
}); });
@@ -1,15 +1,10 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getBalance } from "./getBalance.js"; import { getBalance } from "./getBalance.js";
import { USDC_CONTRACT } from "~test/test-contracts.js"; import { USDC_CONTRACT } from "~test/test-contracts.js";
import { VITALIK_WALLET } from "~test/addresses.js"; import { VITALIK_WALLET } from "~test/addresses.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("erc20.getBalance", () => { describe("erc20.getBalance", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the getBalance result", async () => { it("should return the getBalance result", async () => {
const balance = await getBalance({ const balance = await getBalance({
contract: USDC_CONTRACT, contract: USDC_CONTRACT,
@@ -24,6 +19,5 @@ describe("erc20.getBalance", () => {
"value": 81831338n, "value": 81831338n,
} }
`); `);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
@@ -1,14 +1,9 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { NFT_DROP_CONTRACT } from "../../../../../test/src/test-contracts.js"; import { NFT_DROP_CONTRACT } from "../../../../../test/src/test-contracts.js";
import { getActiveClaimCondition } from "./getActiveClaimCondition.js"; import { getActiveClaimCondition } from "./getActiveClaimCondition.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("erc721.getClaimConditions", () => { describe("erc721.getClaimConditions", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the correct claim conditions", async () => { it("should return the correct claim conditions", async () => {
const cc = await getActiveClaimCondition({ const cc = await getActiveClaimCondition({
contract: NFT_DROP_CONTRACT, contract: NFT_DROP_CONTRACT,
@@ -25,7 +20,5 @@ describe("erc721.getClaimConditions", () => {
startTimestamp: 1704652200n, startTimestamp: 1704652200n,
supplyClaimed: 5598n, supplyClaimed: 5598n,
}); });
// 1 call for the condition id and 1 call for the condition
expect(fetchSpy).toHaveBeenCalledTimes(2);
}); });
}); });
@@ -1,15 +1,9 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getAllOwners } from "./getAllOwners.js"; import { getAllOwners } from "./getAllOwners.js";
import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js"; import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe.runIf(process.env.TW_SECRET_KEY)("erc721.getAllOwners", () => { describe.runIf(process.env.TW_SECRET_KEY)("erc721.getAllOwners", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("works for azuki", async () => { it("works for azuki", async () => {
const nfts = await getAllOwners({ const nfts = await getAllOwners({
contract: AZUKI_CONTRACT, contract: AZUKI_CONTRACT,
@@ -1,17 +1,12 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getNFT } from "./getNFT.js"; import { getNFT } from "./getNFT.js";
import { DOODLES_CONTRACT } from "~test/test-contracts.js"; import { DOODLES_CONTRACT } from "~test/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("erc721.getNFT", () => { describe("erc721.getNFT", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => { it.runIf(process.env.TW_SECRET_KEY)("without owner", async () => {
const nft = await getNFT({ const nft = await getNFT({
contract: DOODLES_CONTRACT, contract: { ...DOODLES_CONTRACT },
tokenId: 1n, tokenId: 1n,
includeOwner: false, includeOwner: false,
}); });
@@ -50,8 +45,6 @@ describe("erc721.getNFT", () => {
"type": "ERC721", "type": "ERC721",
} }
`); `);
// 2 fetch calls: 1 for RPC, 1 for fetching the tokenUri
expect(fetchSpy).toHaveBeenCalledTimes(2);
}); });
it.runIf(process.env.TW_SECRET_KEY)("with owner", async () => { it.runIf(process.env.TW_SECRET_KEY)("with owner", async () => {
@@ -1,15 +1,9 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getNFTs } from "./getNFTs.js"; import { getNFTs } from "./getNFTs.js";
import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js"; import { AZUKI_CONTRACT, DOODLES_CONTRACT } from "~test/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => { describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFTs", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("works for azuki", async () => { it("works for azuki", async () => {
const nfts = await getNFTs({ const nfts = await getNFTs({
contract: AZUKI_CONTRACT, contract: AZUKI_CONTRACT,
@@ -1,16 +1,10 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getFid } from "./getFid.js"; import { getFid } from "./getFid.js";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getFid", () => { describe("farcaster.getFid", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the address's fid", async () => { it("should return the address's fid", async () => {
const fid = await getFid({ const fid = await getFid({
client: TEST_CLIENT, client: TEST_CLIENT,
@@ -18,7 +12,6 @@ describe("farcaster.getFid", () => {
address: "0x6443ed8a3ffb006e3bb5a866bae6edfb93f8ff3e", address: "0x6443ed8a3ffb006e3bb5a866bae6edfb93f8ff3e",
}); });
expect(fid).toBe(7657n); expect(fid).toBe(7657n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should return 0 if the address has no fid", async () => { it("should return 0 if the address has no fid", async () => {
@@ -28,6 +21,5 @@ describe("farcaster.getFid", () => {
address: "0x0000000000000000000000000000000000000000", address: "0x0000000000000000000000000000000000000000",
}); });
expect(fid).toBe(0n); expect(fid).toBe(0n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
@@ -1,16 +1,10 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { getNonce } from "./getNonce.js"; import { getNonce } from "./getNonce.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getNonce", () => { describe("farcaster.getNonce", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the address's current nonce", async () => { it("should return the address's current nonce", async () => {
const nonce = await getNonce({ const nonce = await getNonce({
client: TEST_CLIENT, client: TEST_CLIENT,
@@ -18,6 +12,5 @@ describe("farcaster.getNonce", () => {
address: "0x6443ed8a3ffb006e3bb5a866bae6edfb93f8ff3e", address: "0x6443ed8a3ffb006e3bb5a866bae6edfb93f8ff3e",
}); });
expect(nonce).toBe(12n); expect(nonce).toBe(12n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
@@ -1,23 +1,16 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getRegistrationPrice } from "./getRegistrationPrice.js"; import { getRegistrationPrice } from "./getRegistrationPrice.js";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getRegistrationPrice", () => { describe("farcaster.getRegistrationPrice", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the price to register a new fid", async () => { it("should return the price to register a new fid", async () => {
const price = await getRegistrationPrice({ const price = await getRegistrationPrice({
client: TEST_CLIENT, client: TEST_CLIENT,
chain: FORKED_OPTIMISM_CHAIN, chain: FORKED_OPTIMISM_CHAIN,
}); });
expect(price).toBe(824603002115370n); expect(price).toBe(824603002115370n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should return the price to register a new fid with extra storage", async () => { it("should return the price to register a new fid with extra storage", async () => {
@@ -27,6 +20,5 @@ describe("farcaster.getRegistrationPrice", () => {
extraStorage: 3, extraStorage: 3,
}); });
expect(price).toBe(3298412008461477n); expect(price).toBe(3298412008461477n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
@@ -1,23 +1,16 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { getStoragePrice } from "./getStoragePrice.js"; import { getStoragePrice } from "./getStoragePrice.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getStoragePrice", () => { describe("farcaster.getStoragePrice", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the price to rent 1 unit of storage", async () => { it("should return the price to rent 1 unit of storage", async () => {
const price = await getStoragePrice({ const price = await getStoragePrice({
client: TEST_CLIENT, client: TEST_CLIENT,
chain: FORKED_OPTIMISM_CHAIN, chain: FORKED_OPTIMISM_CHAIN,
}); });
expect(price).toBe(824603002115370n); expect(price).toBe(824603002115370n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should return the price to rent 3 units of storage", async () => { it("should return the price to rent 3 units of storage", async () => {
@@ -27,7 +20,6 @@ describe("farcaster.getStoragePrice", () => {
units: 3, units: 3,
}); });
expect(price).toBe(824603002115370n * 3n); expect(price).toBe(824603002115370n * 3n);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should error when 0 units specified", async () => { it("should error when 0 units specified", async () => {
@@ -1,23 +1,16 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { getUsdRegistrationPrice } from "./getUsdRegistrationPrice.js"; import { getUsdRegistrationPrice } from "./getUsdRegistrationPrice.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getRegistrationPrice", () => { describe("farcaster.getRegistrationPrice", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the price to register a new fid in USD", async () => { it("should return the price to register a new fid in USD", async () => {
const price = await getUsdRegistrationPrice({ const price = await getUsdRegistrationPrice({
client: TEST_CLIENT, client: TEST_CLIENT,
chain: FORKED_OPTIMISM_CHAIN, chain: FORKED_OPTIMISM_CHAIN,
}); });
expect(price).toBe(3); expect(price).toBe(3);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should return the price to register a new fid with extra storage in USD", async () => { it("should return the price to register a new fid with extra storage in USD", async () => {
@@ -27,6 +20,5 @@ describe("farcaster.getRegistrationPrice", () => {
extraStorage: 3, extraStorage: 3,
}); });
expect(price).toBe(12); expect(price).toBe(12);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
}); });
@@ -1,23 +1,16 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { TEST_CLIENT } from "~test/test-clients.js"; import { TEST_CLIENT } from "~test/test-clients.js";
import { getUsdStoragePrice } from "./getUsdStoragePrice.js"; import { getUsdStoragePrice } from "./getUsdStoragePrice.js";
import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js"; import { FORKED_OPTIMISM_CHAIN } from "~test/chains.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("farcaster.getUsdStoragePrice", () => { describe("farcaster.getUsdStoragePrice", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the price to rent 1 unit of storage", async () => { it("should return the price to rent 1 unit of storage", async () => {
const price = await getUsdStoragePrice({ const price = await getUsdStoragePrice({
client: TEST_CLIENT, client: TEST_CLIENT,
chain: FORKED_OPTIMISM_CHAIN, chain: FORKED_OPTIMISM_CHAIN,
}); });
expect(price).toBe(3); expect(price).toBe(3);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should return the price to rent 3 units of storage", async () => { it("should return the price to rent 3 units of storage", async () => {
@@ -27,7 +20,6 @@ describe("farcaster.getUsdStoragePrice", () => {
units: 3, units: 3,
}); });
expect(price).toBe(9); expect(price).toBe(9);
expect(fetchSpy).toHaveBeenCalledTimes(1);
}); });
it("should error when 0 units specified", async () => { it("should error when 0 units specified", async () => {
@@ -1,4 +1,4 @@
import { describe, it, expect, vi, afterEach } from "vitest"; import { describe, it, expect } from "vitest";
import { getUniswapV3Pools } from "./getUniswapV3Pools.js"; import { getUniswapV3Pools } from "./getUniswapV3Pools.js";
import { import {
@@ -8,13 +8,7 @@ import {
MOG_CONTRACT_ADDRESS, MOG_CONTRACT_ADDRESS,
} from "~test/test-contracts.js"; } from "~test/test-contracts.js";
const fetchSpy = vi.spyOn(globalThis, "fetch");
describe("uniswap.getUniswapV3Pool", () => { describe("uniswap.getUniswapV3Pool", () => {
afterEach(() => {
fetchSpy.mockClear();
});
it("should return the WETH/OHM pool address and fee", async () => { it("should return the WETH/OHM pool address and fee", async () => {
const pools = await getUniswapV3Pools({ const pools = await getUniswapV3Pools({
contract: UNISWAPV3_FACTORY_CONTRACT, contract: UNISWAPV3_FACTORY_CONTRACT,
@@ -14,14 +14,14 @@ import { useWalletConnectionCtx } from "./useWalletConnectionCtx.js";
export function useWalletBalance( export function useWalletBalance(
options: Omit<Partial<GetWalletBalanceOptions>, "client">, options: Omit<Partial<GetWalletBalanceOptions>, "client">,
) { ) {
const { chain, account, tokenAddress } = options; const { chain, address, tokenAddress } = options;
const { client } = useWalletConnectionCtx(); const { client } = useWalletConnectionCtx();
const query = queryOptions({ const query = queryOptions({
// eslint-disable-next-line @tanstack/query/exhaustive-deps // eslint-disable-next-line @tanstack/query/exhaustive-deps
queryKey: [ queryKey: [
"walletBalance", "walletBalance",
chain?.id || -1, chain?.id || -1,
account?.address || "0x0", address || "0x0",
{ tokenAddress }, { tokenAddress },
] as const, ] as const,
queryFn: async () => { queryFn: async () => {
@@ -31,12 +31,12 @@ export function useWalletBalance(
if (!client) { if (!client) {
throw new Error("client is required"); throw new Error("client is required");
} }
if (!account) { if (!address) {
throw new Error("account is required"); throw new Error("address is required");
} }
return getWalletBalance({ chain, client, account, tokenAddress }); return getWalletBalance({ chain, client, address, tokenAddress });
}, },
enabled: !!chain && !!client && !!account, enabled: !!chain && !!client && !!address,
}); });
return useQuery(query); return useQuery(query);
} }
@@ -121,7 +121,7 @@ export const ConnectedWalletDetails: React.FC<{
const balanceQuery = useWalletBalance({ const balanceQuery = useWalletBalance({
chain: walletChain ? walletChain : undefined, chain: walletChain ? walletChain : undefined,
tokenAddress, tokenAddress,
account: activeAccount, address: activeAccount?.address,
}); });
const [screen, setScreen] = useState<WalletDetailsModalScreen>("main"); const [screen, setScreen] = useState<WalletDetailsModalScreen>("main");
@@ -6,7 +6,6 @@ import type { Wallet } from "../../../../../wallets/interfaces/wallet.js";
import type { InjectedSupportedWalletIds } from "../../../../../wallets/__generated__/wallet-ids.js"; import type { InjectedSupportedWalletIds } from "../../../../../wallets/__generated__/wallet-ids.js";
import { useWalletConnectionCtx } from "../../../../core/hooks/others/useWalletConnectionCtx.js"; import { useWalletConnectionCtx } from "../../../../core/hooks/others/useWalletConnectionCtx.js";
import type { WalletInfo } from "../../../../../wallets/wallet-info.js"; import type { WalletInfo } from "../../../../../wallets/wallet-info.js";
import { asyncLocalStorage } from "../../../../core/utils/asyncLocalStorage.js";
/** /**
* @internal * @internal
@@ -20,7 +19,7 @@ export const InjectedConnectUI = (props: {
done: () => void; done: () => void;
}) => { }) => {
const { wallet, done } = props; const { wallet, done } = props;
const { chain } = useWalletConnectionCtx(); const { client, chain } = useWalletConnectionCtx();
const [errorConnecting, setErrorConnecting] = useState(false); const [errorConnecting, setErrorConnecting] = useState(false);
const locale = props.locale; const locale = props.locale;
@@ -29,9 +28,8 @@ export const InjectedConnectUI = (props: {
connectPrompted.current = true; connectPrompted.current = true;
setErrorConnecting(false); setErrorConnecting(false);
await wait(1000); await wait(1000);
// set storage for the wallet if it supports it
wallet.setStorage?.(asyncLocalStorage);
await wallet.connect({ await wallet.connect({
client,
chain: chain, chain: chain,
}); });
@@ -40,7 +38,7 @@ export const InjectedConnectUI = (props: {
setErrorConnecting(true); setErrorConnecting(true);
console.error(e); console.error(e);
} }
}, [chain, done, wallet]); }, [client, chain, done, wallet]);
const connectPrompted = useRef(false); const connectPrompted = useRef(false);
useEffect(() => { useEffect(() => {
@@ -121,7 +121,7 @@ export function SwapScreenContent(props: {
const deferredTokenAmount = useDebouncedValue(tokenAmount, 300); const deferredTokenAmount = useDebouncedValue(tokenAmount, 300);
const fromTokenBalanceQuery = useWalletBalance({ const fromTokenBalanceQuery = useWalletBalance({
account: account, address: account.address,
chain: fromChain, chain: fromChain,
tokenAddress: isNativeToken(fromToken) ? undefined : fromToken.address, tokenAddress: isNativeToken(fromToken) ? undefined : fromToken.address,
}); });

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