Compare commits

..
Author SHA1 Message Date
2e12c769f9 Version Packages (#2600)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-04-02 18:18:07 +02:00
Manan Tank d89f009f14 feat: Wallet connection improvements (#2632) 2024-04-02 16:04:34 +00:00
Joaquim Verges 1c29556f14 refactor: get userOp gas prices from bundler (#2631) 2024-04-02 15:15:01 +00:00
github-actions[bot]andGitHub Action 15697ae741 chore(chains): update chains (#2629)
Co-authored-by: GitHub Action <[email protected]>
2024-04-02 02:01:58 -07:00
Jonas Daniels d2ffb82071 refactor: Update import statement for AutoConnect in ConnectWallet.tsx (#2628) 2024-04-02 00:58:10 -07:00
Jonas Daniels e8063936c9 fix(WalletConnectConnection): fix wallet connect uri parsing (#2626) 2024-04-01 22:38:20 -07:00
Joaquim VergesandJonas Daniels 0394eb22bf feat: add ERC4337 account / factory extensions (#2606)
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-02 01:38:38 +00:00
+1 7234e6bc10 [SDK] Native privateKeyAccount implementation (#2525)
Signed-off-by: Joaquim Verges <[email protected]>
Signed-off-by: jxom  <[email protected]>
Signed-off-by: greg <[email protected]>
Signed-off-by: Jonas Daniels <[email protected]>
Co-authored-by: Jonas Daniels <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: Joaquim Verges <[email protected]>
Co-authored-by: Manan Tank <[email protected]>
Co-authored-by: jxom <[email protected]>
Co-authored-by: Nacho Iacovino <[email protected]>
Co-authored-by: Winston Yeo <[email protected]>
Co-authored-by: iketw <[email protected]>
Co-authored-by: Winston Yeo <[email protected]>
Co-authored-by: Isaac Dubuque <[email protected]>
2024-04-01 18:27:35 -07:00
Jonas Daniels 26a50b1e05 chore: update depdendencies (#2623) 2024-04-01 15:41:52 -07:00
Joaquim Verges 00be583b89 chore(v4): get gas price from bundler for userOps (#2622) 2024-04-01 22:19:38 +00:00
Jonas Daniels 8c9def769c feat: add turbo build and update-version commands to release script (#2621) 2024-04-01 13:47:06 -07:00
dependabot[bot]andJonas Daniels 213f313034 build(deps): bump viem from 2.9.5 to 2.9.6 (#2610)
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Jonas Daniels <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-01 13:22:41 -07:00
gregandJonas Daniels 3aaad1e9bf [SDK] generateWallet utility function (#2602)
Co-authored-by: Jonas Daniels <[email protected]>
2024-04-01 09:59:01 -07:00
github-actions[bot]andGitHub Action 55848db4ea chore(chains): update chains (#2605)
Co-authored-by: GitHub Action <[email protected]>
2024-04-01 09:58:37 -07:00
Jonas Daniels 0c83897f62 test: add erc20 approve test (#2596) 2024-03-30 18:12:12 -07:00
Jonas Daniels b6a6eae3cc chore(tests): skip tests that will fail without secret key set (#2604) 2024-03-30 16:58:28 -07:00
github-actions[bot]andGitHub Action f7b45fa04e chore(chains): update chains (#2601)
Co-authored-by: GitHub Action <[email protected]>
2024-03-30 16:57:35 -07:00
github-actions[bot]andGitHub Action 82e5f53bc4 chore(chains): update chains (#2597)
Co-authored-by: GitHub Action <[email protected]>
2024-03-30 06:34:10 -07:00
Joaquim Verges 13c3083ac4 Update README.md (#2599)
Signed-off-by: Joaquim Verges <[email protected]>
2024-03-29 21:12:36 -07:00
755cffe590 Version Packages (#2589)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 16:17:16 -07:00
Manan Tank dd1141f9af fix: Do not open wallet uri when connected using official WC modal (#2595) 2024-03-29 23:00:55 +00:00
Joaquim Verges 968fdc3ebe chore: add smart wallet exports for user op types (#2594) 2024-03-29 22:29:21 +00:00
github-actions[bot]andGitHub Action 2ef20589b7 chore(chains): update chains (#2593)
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 15:07:03 -07:00
Manan Tank 6d63920c0a feat: add walletConnect, Fix WC connection issues (#2591) 2024-03-29 21:58:03 +00:00
github-actions[bot]andGitHub Action 3ef378659e chore(chains): update chains (#2590)
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 14:24:29 -07:00
Joaquim Verges eba8f1c198 fix: 721/1155 claimTo with custom currency (#2588) 2024-03-29 19:45:02 +00:00
52f827e8f2 Version Packages (#2586)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-03-29 11:37:16 -07:00
Jonas Daniels 6063f40f87 fix(cli): fix execution on windows and when prettier is not installed (#2587) 2024-03-29 18:16:38 +00:00
Yash 6bd1b82a58 [CLI] Publish and deploy updates for ZKSync (#2584) 2024-03-29 17:12:50 +00:00
Manan Tank 052892b396 [v5] Fix WC session request (#2585) 2024-03-29 17:09:06 +00:00
206 changed files with 5186 additions and 1776 deletions
+5 -4
View File
@@ -19,6 +19,7 @@ env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }} TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
jobs: jobs:
build: build:
@@ -118,9 +119,9 @@ jobs:
- run: pnpm test - run: pnpm test
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v4
with: with:
files: ./packages/thirdweb/coverage/lcov.info directory: ./legacy_packages
test_legacy: test_legacy:
timeout-minutes: 15 timeout-minutes: 15
@@ -154,9 +155,9 @@ jobs:
- run: pnpm test:legacy - run: pnpm test:legacy
- name: Upload coverage reports to Codecov - name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v4
with: with:
files: ./legacy_packages/sdk/coverage/evm/lcov.info directory: ./legacy_packages
e2e: e2e:
timeout-minutes: 15 timeout-minutes: 15
+2 -18
View File
@@ -18,9 +18,6 @@
<p align="center"><strong>All-in-one web3 SDK for Browser, Node and Mobile apps</strong></p> <p align="center"><strong>All-in-one web3 SDK for Browser, Node and Mobile apps</strong></p>
> [!IMPORTANT]
> We rewrote the thirdweb SDK from scratch for performance! Head over to the [v5 SDK](https://github.com/thirdweb-dev/js/tree/main/packages/thirdweb).
## Features ## Features
- Support for React & React-Native - Support for React & React-Native
@@ -53,19 +50,6 @@
| React Native Hooks | ✅ | ❌ | ❌ | ❌ | | React Native Hooks | ✅ | ❌ | ❌ | ❌ |
| React Native UI Components | ✅ | ❌ | ❌ | ❌ | | React Native UI Components | ✅ | ❌ | ❌ | ❌ |
## Packages
| Package | Description |
| ----------------------------------------------- | --------------------------------------------------------------------------- |
| [/sdk](./legacy_packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps |
| [/wallets](./legacy_packages/wallets) | Unified web3 Wallet library to integrate any wallet into your applications. |
| [/react](./legacy_packages/react) | Ultimate collection of React hooks for your web3 apps |
| [/react-native](./legacy_packages/react-native) | Ultimate collection of React hooks for your native mobile web3 apps |
| [/auth](./legacy_packages/auth) | Best in class wallet authentication for Node backends |
| [/storage](./legacy_packages/storage) | Best in class decentralized storage SDK for Browser and Node |
| [/cli](./legacy_packages/cli) | Publish and deploy smart contracts without dealing with private keys |
| [/chains](./legacy_packages/chains) | All EVM chain information as JS objects for easy handling |
## Contributing ## Contributing
We welcome contributions from all developers regardless of experience level. If you are interested in contributing, please read our [Contributing Guide](.github/contributing.md) to learn how the repo works, how to test your changes, and how to submit a pull request. We welcome contributions from all developers regardless of experience level. If you are interested in contributing, please read our [Contributing Guide](.github/contributing.md) to learn how the repo works, how to test your changes, and how to submit a pull request.
@@ -74,9 +58,9 @@ See our [open source page](https://thirdweb.com/open-source) for more informatio
## Additional Resources ## Additional Resources
- [SDK Documentation](https://portal.thirdweb.com/typescript/v5) - [Documentation](https://portal.thirdweb.com/typescript/v5)
- [Templates](https://thirdweb.com/templates) - [Templates](https://thirdweb.com/templates)
- [YouTube](https://www.youtube.com/c/thirdweb_) - [YouTube](https://www.youtube.com/c/thirdweb)
## Support ## Support
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/auth # @thirdweb-dev/auth
## 4.1.53
### Patch Changes
- Updated dependencies [[`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075)]:
- @thirdweb-dev/wallets@2.4.31
## 4.1.52
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.4.30
## 4.1.51
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.4.29
## 4.1.50 ## 4.1.50
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/auth", "name": "@thirdweb-dev/auth",
"version": "4.1.50", "version": "4.1.53",
"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": {
+1 -1
View File
@@ -6,7 +6,7 @@ import { describe, it, beforeAll, beforeEach, expect } from "vitest";
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv-mono").load(); require("dotenv-mono").load();
describe( describe.runIf(process.env.TW_SECRET_KEY)(
"Wallet Authentication - EVM", "Wallet Authentication - EVM",
{ {
timeout: 60000, timeout: 60000,
@@ -7,7 +7,7 @@ import { describe, it, beforeEach, beforeAll, expect } from "vitest";
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
require("dotenv-mono").load(); require("dotenv-mono").load();
describe( describe.runIf(process.env.TW_SECRET_KEY)(
"Wallet Authentication - EVM - Smart Wallet", "Wallet Authentication - EVM - Smart Wallet",
{ {
timeout: 60000, timeout: 60000,
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/chains # @thirdweb-dev/chains
## 0.1.86
### Patch Changes
- [#2597](https://github.com/thirdweb-dev/js/pull/2597) [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.85
### Patch Changes
- [#2590](https://github.com/thirdweb-dev/js/pull/2590) [`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.84 ## 0.1.84
### Patch Changes ### Patch Changes
+2 -1
View File
@@ -46,7 +46,8 @@ export default {
"https://evm.humans.stakepool.dev.br", "https://evm.humans.stakepool.dev.br",
"https://mainnet-humans-evm.konsortech.xyz", "https://mainnet-humans-evm.konsortech.xyz",
"https://evm-rpc.mainnet.humans.zone", "https://evm-rpc.mainnet.humans.zone",
"https://json-rpc.humans.bh.rocks" "https://json-rpc.humans.bh.rocks",
"https://evm-rpc.humans.huginn.tech"
], ],
"shortName": "humans", "shortName": "humans",
"slug": "humans-ai", "slug": "humans-ai",
+41
View File
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "NetMind",
"chainId": 1100789,
"explorers": [
{
"name": "NetMind Testnet Explorer",
"url": "https://testbrower.protago-dev.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmQNipd6uen7sm7HZXGbqhcSVkUXxu3Tp6c3BoeFpvmywp",
"width": 500,
"height": 500,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmQNipd6uen7sm7HZXGbqhcSVkUXxu3Tp6c3BoeFpvmywp",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://netmind.ai",
"name": "Netmind Chain Testnet",
"nativeCurrency": {
"name": "NMT",
"symbol": "NMT",
"decimals": 18
},
"networkId": 1100789,
"rpc": [
"https://1100789.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testblock.protago-dev.com"
],
"shortName": "nmtTest",
"slug": "netmind-chain-testnet",
"testnet": true,
"title": "NetMind Chain Testnet"
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 11227,
"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": "Jiritsu Testnet",
"nativeCurrency": {
"name": "Jiritsu Testnet Token",
"symbol": "TZW",
"decimals": 18
},
"networkId": 11227,
"redFlags": [],
"rpc": [
"https://11227.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/jiritsutes/testnet/rpc"
],
"shortName": "Jiritsu Testnet",
"slug": "jiritsu-testnet",
"testnet": true
} as const satisfies Chain;
+5 -5
View File
@@ -11,8 +11,8 @@ export default {
"height": 300, "height": 300,
"format": "png" "format": "png"
}, },
"infoURL": "https://raas.gelato.network/rollups/details/public/op-celestia-testnet", "infoURL": "https://raas.gelato.network/rollups/details/public/opcelestia-raspberry",
"name": "Gelato OP Celestia", "name": "OP Celestia Rasberry",
"nativeCurrency": { "nativeCurrency": {
"name": "Ether", "name": "Ether",
"symbol": "ETH", "symbol": "ETH",
@@ -21,8 +21,8 @@ export default {
"networkId": 123420111, "networkId": 123420111,
"redFlags": [], "redFlags": [],
"rpc": [], "rpc": [],
"shortName": "opcelestia", "shortName": "opcelestia-rasberry",
"slug": "gelato-op-celestia", "slug": "op-celestia-rasberry",
"testnet": true, "testnet": true,
"title": "Gelato OP Celestia Testnet" "title": "OP Celestia Rasberry"
} as const satisfies Chain; } as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 12781,
"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": "playdapp Testnet",
"nativeCurrency": {
"name": "playdapp Testnet Token",
"symbol": "PDA",
"decimals": 18
},
"networkId": 12781,
"redFlags": [],
"rpc": [
"https://12781.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/playdappte/testnet/rpc"
],
"shortName": "playdapp Testnet",
"slug": "playdapp-testnet",
"testnet": true
} as const satisfies Chain;
+12 -2
View File
@@ -2,9 +2,19 @@ import type { Chain } from "../src/types";
export default { export default {
"chain": "Avalanche", "chain": "Avalanche",
"chainId": 13396, "chainId": 13396,
"explorers": [], "explorers": [
{
"name": "Masa Explorer",
"url": "https://subnets.avax.network/masa",
"standard": "EIP3091"
}
],
"faucets": [], "faucets": [],
"features": [], "features": [
{
"name": "EIP1559"
}
],
"icon": { "icon": {
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg", "url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
"width": 256, "width": 256,
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 26031,
"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": "QaUser7894 Testnet",
"nativeCurrency": {
"name": "QaUser7894 Testnet Token",
"symbol": "YUT",
"decimals": 18
},
"networkId": 26031,
"redFlags": [],
"rpc": [
"https://26031.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser7894 Testnet",
"slug": "qauser7894-testnet",
"testnet": true
} as const satisfies Chain;
+46
View File
@@ -0,0 +1,46 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 282828,
"explorers": [
{
"name": "zillscout",
"url": "https://sepolia.zillnet.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmfVmjLNiBh8KyCr9mwDZh34aEhhQ2LAjuP87DFxhfd9nn",
"width": 264,
"height": 264,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmfVmjLNiBh8KyCr9mwDZh34aEhhQ2LAjuP87DFxhfd9nn",
"width": 264,
"height": 264,
"format": "png"
},
"infoURL": "https://zillnet.io",
"name": "Zillion Sepolia Testnet",
"nativeCurrency": {
"name": "Sepolia Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 282828,
"parent": {
"type": "L2",
"chain": "eip155-11155111"
},
"rpc": [
"https://282828.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://sepolia.zillnet.io/rpc"
],
"shortName": "zillsep",
"slip44": 1,
"slug": "zillion-sepolia-testnet",
"status": "active",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 40868,
"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": "QaUser5110 Testnet",
"nativeCurrency": {
"name": "QaUser5110 Testnet Token",
"symbol": "CRL",
"decimals": 18
},
"networkId": 40868,
"redFlags": [],
"rpc": [
"https://40868.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser5110 Testnet",
"slug": "qauser5110-testnet",
"testnet": true
} as const satisfies Chain;
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"chain": "Azra Testnet",
"chainId": 5106,
"explorers": [
{
"name": "blockscout",
"url": "https://explorerl2new-azra-testnet-6hz86owb1n.t.conduit.xyz",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://azragames.com",
"name": "Azra Testnet",
"nativeCurrency": {
"name": "ETH",
"symbol": "ETH",
"decimals": 18
},
"networkId": 5106,
"rpc": [
"https://5106.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-azra-testnet-6hz86owb1n.t.conduit.xyz"
],
"shortName": "azra-testnet",
"slug": "azra-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 54763,
"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": "QaUser3051 Testnet",
"nativeCurrency": {
"name": "QaUser3051 Testnet Token",
"symbol": "DSX",
"decimals": 18
},
"networkId": 54763,
"redFlags": [],
"rpc": [
"https://54763.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser3051 Testnet",
"slug": "qauser3051-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 555666,
"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": "EclipseChain Testnet",
"nativeCurrency": {
"name": "EclipseChain Testnet Token",
"symbol": "ECLPS",
"decimals": 18
},
"networkId": 555666,
"redFlags": [],
"rpc": [
"https://555666.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/eclipsecha/testnet/rpc"
],
"shortName": "EclipseChain Testnet",
"slug": "eclipsechain-testnet",
"testnet": true
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 57973,
"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": "QaUser5524 Testnet",
"nativeCurrency": {
"name": "QaUser5524 Testnet Token",
"symbol": "ADN",
"decimals": 18
},
"networkId": 57973,
"redFlags": [],
"rpc": [
"https://57973.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
],
"shortName": "QaUser5524 Testnet",
"slug": "qauser5524-testnet",
"testnet": true
} as const satisfies Chain;
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"chain": "BounceBit",
"chainId": 6000,
"explorers": [
{
"name": "BBScan Testnet Explorer",
"url": "https://bbscan.io",
"standard": "none"
}
],
"faucets": [],
"infoURL": "https://bouncebit.io",
"name": "BounceBit Testnet",
"nativeCurrency": {
"name": "BounceBit",
"symbol": "BB",
"decimals": 18
},
"networkId": 6000,
"rpc": [
"https://6000.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://fullnode-testnet.bouncebitapi.com/"
],
"shortName": "bouncebit-testnet",
"slug": "bouncebit-testnet",
"testnet": true
} as const satisfies Chain;
+1 -1
View File
@@ -10,7 +10,7 @@ export default {
}, },
{ {
"name": "Astar zkEVM Testnet zKyoto", "name": "Astar zkEVM Testnet zKyoto",
"url": "hhttps://zkyoto.explorer.startale.com/", "url": "https://zkyoto.explorer.startale.com",
"standard": "EIP3091" "standard": "EIP3091"
} }
], ],
+52
View File
@@ -0,0 +1,52 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 70700,
"explorers": [
{
"name": "Proof of Play Apex Explorer",
"url": "https://explorer.apex.proofofplay.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmW3NPDe6WRqucrWbe8pg3GqSMPi8V6Qa1fAiaQuqjxSJC",
"width": 1256,
"height": 1256,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmW3NPDe6WRqucrWbe8pg3GqSMPi8V6Qa1fAiaQuqjxSJC",
"width": 1256,
"height": 1256,
"format": "png"
},
"infoURL": "https://proofofplay.com",
"name": "Proof of Play - Apex",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 70700,
"parent": {
"type": "L2",
"chain": "eip155-42161",
"bridges": [
{
"url": "https://bridge.arbitrum.io"
},
{
"url": "https://relay.link/bridge/apex/"
}
]
},
"rpc": [
"https://70700.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.apex.proofofplay.com"
],
"shortName": "pop-apex",
"slug": "proof-of-play-apex",
"testnet": false
} as const satisfies Chain;
+44
View File
@@ -0,0 +1,44 @@
import type { Chain } from "../src/types";
export default {
"chain": "OEX",
"chainId": 7798,
"explorers": [
{
"name": "OpenEX Long Testnet Explorer",
"url": "https://scan.long.openex.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://bafkreidnu6p6vmmplerzvkboq7fz73ygkomzpnnokuxstrqv2fvxgmgg7i",
"width": 512,
"height": 512,
"format": "png"
}
}
],
"faucets": [
"https://long.hub.openex.network/faucet"
],
"icon": {
"url": "ipfs://bafkreidnu6p6vmmplerzvkboq7fz73ygkomzpnnokuxstrqv2fvxgmgg7i",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://openex.network",
"name": "OpenEX LONG Testnet",
"nativeCurrency": {
"name": "USDT Testnet",
"symbol": "USDT",
"decimals": 18
},
"networkId": 7798,
"rpc": [
"https://7798.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://long.rpc.openex.network/"
],
"shortName": "oex",
"slip44": 1,
"slug": "openex-long-testnet",
"testnet": true,
"title": "OpenEX LONG Testnet"
} as const satisfies Chain;
+1
View File
@@ -39,6 +39,7 @@ export default {
"shortName": "maticmum", "shortName": "maticmum",
"slip44": 1, "slip44": 1,
"slug": "mumbai", "slug": "mumbai",
"status": "active",
"testnet": true, "testnet": true,
"title": "Polygon Testnet Mumbai" "title": "Polygon Testnet Mumbai"
} as const satisfies Chain; } as const satisfies Chain;
+7 -22
View File
@@ -2,19 +2,7 @@ import type { Chain } from "../src/types";
export default { export default {
"chain": "ETH", "chain": "ETH",
"chainId": 88153591557, "chainId": 88153591557,
"explorers": [ "explorers": [],
{
"name": "blockscout",
"url": "https://gelato-orbit-anytrust-testnet.blockscout.com/",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmQXw4QEDR4AbUwX9scH7aGhiSDhQRxu6LCQoUkgsYgGyK/Gelato%20brand%20mark.png",
"width": 300,
"height": 300,
"format": "png"
}
}
],
"faucets": [], "faucets": [],
"features": [], "features": [],
"icon": { "icon": {
@@ -23,8 +11,8 @@ export default {
"height": 300, "height": 300,
"format": "png" "format": "png"
}, },
"infoURL": "https://raas.gelato.network/rollups/details/public/gelato-orbit-anytrust-testnet", "infoURL": "https://raas.gelato.network/rollups/details/public/arb-blueberry",
"name": "Gelato Orbit Anytrust", "name": "Arbitrum Blueberry",
"nativeCurrency": { "nativeCurrency": {
"name": "Ether", "name": "Ether",
"symbol": "ETH", "symbol": "ETH",
@@ -32,12 +20,9 @@ export default {
}, },
"networkId": 88153591557, "networkId": 88153591557,
"redFlags": [], "redFlags": [],
"rpc": [ "rpc": [],
"https://88153591557.rpc.thirdweb.com/${THIRDWEB_API_KEY}", "shortName": "arb-blueberry",
"https://rpc.gelato-orbit-anytrust-testnet.gelato.digital" "slug": "arbitrum-blueberry",
],
"shortName": "orbitanytrust",
"slug": "gelato-orbit-anytrust",
"testnet": true, "testnet": true,
"title": "Gelato Orbit Anytrust Testnet" "title": "Arbitrum Blueberry"
} as const satisfies Chain; } as const satisfies Chain;
+42
View File
@@ -0,0 +1,42 @@
import type { Chain } from "../src/types";
export default {
"chain": "ETH",
"chainId": 94204209,
"explorers": [
{
"name": "blockscout",
"url": "https://polygon-blackberry.gelatoscout.com/",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYotcuJYjUBXZ33CYoWMyNnJbjK14f8ma6sge55Z5bg5W/polygon-blackberry.svg",
"width": 300,
"height": 300,
"format": "svg"
}
}
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmYotcuJYjUBXZ33CYoWMyNnJbjK14f8ma6sge55Z5bg5W/polygon-blackberry.svg",
"width": 300,
"height": 300,
"format": "svg"
},
"infoURL": "https://raas.gelato.network/rollups/details/public/polygon-blackberry",
"name": "Polygon Blackberry",
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"networkId": 94204209,
"redFlags": [],
"rpc": [
"https://94204209.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.polygon-blackberry.gelato.digital"
],
"shortName": "polygon-blackberry",
"slug": "polygon-blackberry",
"testnet": true
} as const satisfies Chain;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/chains", "name": "@thirdweb-dev/chains",
"version": "0.1.84", "version": "0.1.86",
"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": {
File diff suppressed because one or more lines are too long
+34
View File
@@ -1,5 +1,39 @@
# thirdweb # thirdweb
## 0.13.61
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
- Updated dependencies [[`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075), [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/wallets@2.4.31
- @thirdweb-dev/sdk@4.0.55
- @thirdweb-dev/chains@0.1.86
- @thirdweb-dev/auth@4.1.53
- @thirdweb-dev/storage@2.0.13
## 0.13.60
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
- @thirdweb-dev/sdk@4.0.54
- @thirdweb-dev/wallets@2.4.30
- @thirdweb-dev/auth@4.1.52
## 0.13.59
### Patch Changes
- [#2584](https://github.com/thirdweb-dev/js/pull/2584) [`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0) Thanks [@kumaryash90](https://github.com/kumaryash90)! - cli changes for zksync publish
- Updated dependencies [[`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0)]:
- @thirdweb-dev/sdk@4.0.53
- @thirdweb-dev/wallets@2.4.29
- @thirdweb-dev/auth@4.1.51
## 0.13.58 ## 0.13.58
### Patch Changes ### Patch Changes
+2 -2
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.58", "version": "0.13.61",
"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",
@@ -15,7 +15,7 @@
"@types/cross-spawn": "^6.0.6", "@types/cross-spawn": "^6.0.6",
"@types/inquirer": "^8.2.10", "@types/inquirer": "^8.2.10",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/node": "20.11.30", "@types/node": "20.12.2",
"@types/prompts": "^2.4.9", "@types/prompts": "^2.4.9",
"@types/tar": "^6.1.11", "@types/tar": "^6.1.11",
"@types/update-notifier": "^6.0.8", "@types/update-notifier": "^6.0.8",
+1
View File
@@ -377,6 +377,7 @@ const main = async () => {
.option("--dry-run", "dry run (skip actually publishing)") .option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs") .option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode") .option("--ci", "Continuous Integration mode")
.option("--zksync", "Publish with ZKSync settings")
.option( .option(
"--link-lib <library:address...>", "--link-lib <library:address...>",
"Specify library names and addresses", "Specify library names and addresses",
+109 -3
View File
@@ -61,9 +61,7 @@ export async function processProject(
logger.debug("Processing project at path " + projectPath); logger.debug("Processing project at path " + projectPath);
const projectType = options.zksync const projectType = await detect(projectPath, options);
? "hardhat"
: await detect(projectPath, options);
if (projectType === "none") { if (projectType === "none") {
if (command === "deploy") { if (command === "deploy") {
@@ -106,9 +104,25 @@ export async function processProject(
} }
let compiledResult: { contracts: ContractPayload[] }; let compiledResult: { contracts: ContractPayload[] };
let zkCompiledResult: { contracts: ContractPayload[] };
const compileLoader = spinner("Compiling project..."); const compileLoader = spinner("Compiling project...");
try { try {
compiledResult = await build(projectPath, projectType, options); compiledResult = await build(projectPath, projectType, options);
if (options.zksync) {
zkCompiledResult = await build(projectPath, "zk-hardhat", options);
if (
compiledResult.contracts.length !== zkCompiledResult.contracts.length
) {
logger.error(
"Length mismatch: zksolc and solc compiled contracts differ.",
);
process.exit(1);
}
} else {
zkCompiledResult = { contracts: [] };
}
} catch (e) { } catch (e) {
compileLoader.fail("Compilation failed"); compileLoader.fail("Compilation failed");
logger.error(e); logger.error(e);
@@ -223,6 +237,23 @@ export async function processProject(
process.exit(1); process.exit(1);
} }
let zkSelectedContracts: ContractPayload[] = [];
if (options.zksync) {
const fileNames = selectedContracts.map((selected) => selected.fileName);
zkSelectedContracts = zkCompiledResult.contracts.filter((contract) => {
const index = fileNames.indexOf(contract.fileName);
return index !== -1;
});
if (zkSelectedContracts.length !== selectedContracts.length) {
info(
"Selected contract not present in zksolc compiled contracts. Aborting.",
);
process.exit(1);
}
}
if (options.dryRun) { if (options.dryRun) {
info("Dry run, skipping deployment"); info("Dry run, skipping deployment");
process.exit(0); process.exit(0);
@@ -332,6 +363,81 @@ export async function processProject(
metadataUri: metadataURIs[i], metadataUri: metadataURIs[i],
bytecodeUri: bytecodeURIs[i], bytecodeUri: bytecodeURIs[i],
analytics, analytics,
compilers: {
solc: [
{
compilerVersion: compiledResult.contracts[0].compilerVersion,
evmVersion: compiledResult.contracts[0].evmVersion,
metadataUri: metadataURIs[i],
bytecodeUri: bytecodeURIs[i],
},
],
},
};
});
}
// upload zk-contracts if present
if (zkSelectedContracts.length > 0) {
for (let i = 0; i < zkSelectedContracts.length; i++) {
const contract = zkSelectedContracts[i];
if (contract.sources) {
// upload sources in batches to avoid getting rate limited (needs to be single uploads)
const batchSize = 3;
for (let j = 0; j < contract.sources.length; j = j + batchSize) {
const batch = contract.sources.slice(j, j + batchSize);
logger.debug(`Uploading Sources:\n${batch.join("\n")}\n`);
await Promise.all(
batch.map(async (c) => {
const file = readFileSync(c, "utf-8");
if (file.includes(soliditySDKPackage)) {
usesSoliditySDK = true;
}
return await storage.upload(file, {
uploadWithoutDirectory: true,
});
}),
);
}
}
}
// Upload build output metadatas (need to be single uploads)
const zkMetadataURIs = await Promise.all(
zkSelectedContracts.map(async (c) => {
logger.debug(`Uploading ${c.name}...`);
return await storage.upload(JSON.parse(JSON.stringify(c.metadata)), {
uploadWithoutDirectory: true,
});
}),
);
// Upload batch all bytecodes
const zkBytecodes = zkSelectedContracts.map((c) => c.bytecode);
const zkBytecodeURIs = await storage.uploadBatch(zkBytecodes);
combinedContents = combinedContents.map((c, i) => {
return {
...c,
compilers: {
zksolc: [
{
compilerVersion: zkCompiledResult.contracts[0].compilerVersion,
evmVersion: zkCompiledResult.contracts[0].evmVersion,
metadataUri: zkMetadataURIs[i],
bytecodeUri: zkBytecodeURIs[i],
},
],
solc: [
{
compilerVersion: compiledResult.contracts[0].compilerVersion,
evmVersion: compiledResult.contracts[0].evmVersion,
metadataUri: metadataURIs[i],
bytecodeUri: bytecodeURIs[i],
},
],
},
}; };
}); });
} }
@@ -56,6 +56,8 @@ export class BrownieBuilder extends BaseBuilder {
sources: [], // TODO sources: [], // TODO
fileName: "", // TODO fileName: "", // TODO
name: contractName, name: contractName,
compilerVersion: "",
evmVersion: "",
}); });
break; break;
} }
@@ -5,6 +5,7 @@ import { FoundryBuilder } from "./foundry";
import { HardhatBuilder } from "./hardhat"; import { HardhatBuilder } from "./hardhat";
import { SolcBuilder } from "./solc"; import { SolcBuilder } from "./solc";
import { TruffleBuilder } from "./truffle"; import { TruffleBuilder } from "./truffle";
import { ZKHardhatBuilder } from "./zkHardhat";
export default async function build( export default async function build(
path: string, path: string,
@@ -19,6 +20,10 @@ export default async function build(
builder = new HardhatBuilder(); builder = new HardhatBuilder();
break; break;
} }
case "zk-hardhat": {
builder = new ZKHardhatBuilder();
break;
}
case "foundry": { case "foundry": {
builder = new FoundryBuilder(); builder = new FoundryBuilder();
break; break;
@@ -107,6 +107,9 @@ export class FoundryBuilder extends BaseBuilder {
contractInfo.rawMetadata || contractInfo.rawMetadata ||
this.sanitizeParsedMetadata(parsedMetadata, contractInfo.abi); this.sanitizeParsedMetadata(parsedMetadata, contractInfo.abi);
const evmVersion = metadata.settings?.evmVersion || "";
const compilerVersion = metadata.compiler?.version || "";
const sources = Object.keys(parsedMetadata.sources) const sources = Object.keys(parsedMetadata.sources)
.map((path) => { .map((path) => {
if (path.startsWith("/") && existsSync(path)) { if (path.startsWith("/") && existsSync(path)) {
@@ -146,6 +149,8 @@ export class FoundryBuilder extends BaseBuilder {
bytecode, bytecode,
fileName, fileName,
sources, sources,
compilerVersion,
evmVersion,
}); });
} }
} }
@@ -36,22 +36,7 @@ export class HardhatBuilder extends BaseBuilder {
logger.debug("successfully extracted hardhat config", actualHardhatConfig); logger.debug("successfully extracted hardhat config", actualHardhatConfig);
await execute("npx hardhat clean", options.projectPath); await execute("npx hardhat clean", options.projectPath);
let ignoreIpfsHash = false;
if (options.zksync) {
const zkNetwork = Object.entries(actualHardhatConfig.networks).find(
(network) => {
return (network[1] as any).zksync;
},
);
ignoreIpfsHash = (zkNetwork?.[1] as any).zksync; // IPFS hash can't be recovered from ZKSync bytecode
await execute(
`npx hardhat compile --network ${zkNetwork?.[0]}`,
options.projectPath,
);
} else {
await execute(`npx hardhat compile`, options.projectPath); await execute(`npx hardhat compile`, options.projectPath);
}
const solcConfigs = actualHardhatConfig.solidity.compilers; const solcConfigs = actualHardhatConfig.solidity.compilers;
if (solcConfigs) { if (solcConfigs) {
@@ -127,7 +112,7 @@ export class HardhatBuilder extends BaseBuilder {
} }
let bytecode = info.evm.bytecode.object; let bytecode = info.evm.bytecode.object;
let deployedBytecode = info.evm.deployedBytecode?.object || bytecode; let deployedBytecode = info.evm.deployedBytecode.object;
// link external libraries if any // link external libraries if any
bytecode = linkLibrary(bytecode, libraries); bytecode = linkLibrary(bytecode, libraries);
@@ -135,9 +120,10 @@ export class HardhatBuilder extends BaseBuilder {
const { metadata, abi } = info; const { metadata, abi } = info;
const meta = metadata.solc_metadata const meta = JSON.parse(metadata);
? JSON.parse(metadata.solc_metadata)
: JSON.parse(metadata); const evmVersion = meta.settings?.evmVersion || "";
const compilerVersion = meta.compiler?.version || "";
const sources = Object.keys(meta.sources) const sources = Object.keys(meta.sources)
.map((path) => { .map((path) => {
const directPath = join(options.projectPath, path); const directPath = join(options.projectPath, path);
@@ -165,20 +151,15 @@ export class HardhatBuilder extends BaseBuilder {
); );
const fileName = fileNames.length > 0 ? fileNames[0] : ""; const fileName = fileNames.length > 0 ? fileNames[0] : "";
if ( if (this.shouldProcessContract(abi, deployedBytecode, contractName)) {
this.shouldProcessContract(
abi,
deployedBytecode,
contractName,
ignoreIpfsHash,
)
) {
contracts.push({ contracts.push({
metadata: JSON.stringify(meta), metadata,
bytecode, bytecode,
name: contractName, name: contractName,
fileName, fileName,
sources, sources,
compilerVersion,
evmVersion,
}); });
} }
} }
@@ -116,6 +116,9 @@ export class SolcBuilder extends BaseBuilder {
const parsedMetadata = JSON.parse(metadata); const parsedMetadata = JSON.parse(metadata);
const abi = parsedMetadata.output.abi; const abi = parsedMetadata.output.abi;
const evmVersion = parsedMetadata.settings?.evmVersion || "";
const compilerVersion = parsedMetadata.compiler?.version || "";
const target = parsedMetadata.settings.compilationTarget; const target = parsedMetadata.settings.compilationTarget;
if ( if (
Object.keys(target).length === 0 || Object.keys(target).length === 0 ||
@@ -156,6 +159,8 @@ export class SolcBuilder extends BaseBuilder {
name: contractName, name: contractName,
fileName, fileName,
sources: _sources, sources: _sources,
compilerVersion,
evmVersion,
}); });
} }
} }
@@ -13,10 +13,9 @@ export class TruffleBuilder extends BaseBuilder {
}> { }> {
// get the current config first // get the current config first
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
const truffleConfig = require(join( const truffleConfig = require(
options.projectPath, join(options.projectPath, "truffle-config.js"),
"truffle-config.js", );
));
const buildPath = join( const buildPath = join(
options.projectPath, options.projectPath,
@@ -42,6 +41,9 @@ export class TruffleBuilder extends BaseBuilder {
const meta = JSON.parse(metadata); const meta = JSON.parse(metadata);
const abi = meta.output.abi; const abi = meta.output.abi;
const evmVersion = meta.settings?.evmVersion || "";
const compilerVersion = meta.compiler?.version || "";
const target = meta.settings.compilationTarget; const target = meta.settings.compilationTarget;
if ( if (
Object.keys(target).length === 0 || Object.keys(target).length === 0 ||
@@ -81,6 +83,8 @@ export class TruffleBuilder extends BaseBuilder {
name: contractName, name: contractName,
fileName, fileName,
sources, sources,
compilerVersion,
evmVersion,
}); });
} }
} }
@@ -0,0 +1,171 @@
import { findFiles } from "../../common/file-helper";
import { execute } from "../helpers/exec";
import { logger } from "../helpers/logger";
import { ContractPayload } from "../interfaces/ContractPayload";
import { BaseBuilder } from "./builder-base";
import { existsSync, readFileSync } from "fs";
import { HardhatConfig } from "hardhat/types";
import { join, resolve } from "path";
export class ZKHardhatBuilder extends BaseBuilder {
public async compile(options: any): Promise<{
contracts: ContractPayload[];
}> {
//we get our very own extractor script from the dir that we're in during execution
// this is `./dist/cli` (for all purposes of the CLI)
// then we look up the hardhat config extractor file path from there
const configExtractorScriptPath = resolve(
__dirname,
"../helpers/hardhat-config-extractor.js",
);
//the hardhat extractor **logs out** the runtime config of hardhat, we take that stdout and parse it
const stringifiedConfig = (
await execute(
`npx hardhat run "${configExtractorScriptPath}" --no-compile`,
options.projectPath,
)
).stdout;
//voila the hardhat config
const actualHardhatConfig = JSON.parse(
stringifiedConfig.split("__tw__")[1],
) as HardhatConfig;
logger.debug("successfully extracted hardhat config", actualHardhatConfig);
await execute("npx hardhat clean", options.projectPath);
let ignoreIpfsHash = false;
const zkNetwork = Object.entries(actualHardhatConfig.networks).find(
(network) => {
return (network[1] as any).zksync;
},
);
if (!(zkNetwork?.[1] as any).zksync) {
logger.warn("ZKSync settings not found. Aborting.");
process.exit(1);
}
ignoreIpfsHash = (zkNetwork?.[1] as any).zksync; // IPFS hash can't be recovered from ZKSync bytecode
await execute(
`npx hardhat compile --network ${zkNetwork?.[0]}`,
options.projectPath,
);
const artifactsPath = actualHardhatConfig.paths.artifacts;
const sourcesDir = actualHardhatConfig.paths.sources.replace(
options.projectPath,
"",
);
const contractsPath = join(artifactsPath, sourcesDir);
const contracts: ContractPayload[] = [];
const files: string[] = [];
findFiles(contractsPath, /^.*(?<!dbg)\.json$/, files);
const buildOutputPath = join(artifactsPath, "build-info");
const buildFiles: string[] = [];
findFiles(buildOutputPath, /^.*(?<!dbg)\.json$/, buildFiles);
for (const buildFile of buildFiles) {
const buildJsonFile = readFileSync(buildFile, "utf-8");
const buildJson = JSON.parse(buildJsonFile);
const contractBuildOutputs = buildJson.output.contracts;
for (const [contractPath, contractInfos] of Object.entries(
contractBuildOutputs,
)) {
if (contractPath.includes("@")) {
// skip library contracts
logger.debug("Skipping", contractPath, "(not a source target)");
continue;
}
for (const [contractName, contractInfo] of Object.entries(
contractInfos as any,
)) {
const info = contractInfo as any;
if (
!info.evm ||
!info.evm.bytecode ||
!info.evm.bytecode.object ||
!info.metadata ||
!info.abi
) {
logger.debug("Skipping", contractPath, "(no bytecode or metadata)");
continue;
}
const bytecode = info.evm.bytecode.object;
const deployedBytecode =
info.evm.deployedBytecode?.object || bytecode;
const { metadata, abi } = info;
const meta = metadata.solc_metadata
? JSON.parse(metadata.solc_metadata)
: JSON.parse(metadata);
// Find and add zk_version to solc_metadata settings - needed for verification
// TODO: it's a workaround. remove it (e.g. when ipfs hash issue is resolved)
const zkVersion = metadata.zk_version;
meta.settings["zkVersion"] = zkVersion;
const evmVersion = meta.settings?.evmVersion || "";
const compilerVersion = zkVersion || "";
const sources = Object.keys(meta.sources)
.map((path) => {
const directPath = join(options.projectPath, path);
if (existsSync(directPath)) {
return directPath;
}
const sourcePath = join(options.projectPath, sourcesDir, path);
if (existsSync(sourcePath)) {
return sourcePath;
}
const nodeModulesPath = join(
options.projectPath,
"node_modules",
path,
);
if (existsSync(nodeModulesPath)) {
return nodeModulesPath;
}
return undefined;
})
.filter((path) => path !== undefined) as string[];
const fileNames = Object.keys(
meta?.settings?.compilationTarget || {},
);
const fileName = fileNames.length > 0 ? fileNames[0] : "";
if (
this.shouldProcessContract(
abi,
deployedBytecode,
contractName,
ignoreIpfsHash,
)
) {
contracts.push({
metadata: JSON.stringify(meta),
bytecode,
name: contractName,
fileName,
sources,
compilerVersion,
evmVersion,
});
}
}
}
}
return {
contracts,
};
}
}
@@ -27,6 +27,17 @@ export default async function detect(
.filter((detector) => detector.matches(path)) .filter((detector) => detector.matches(path))
.map((detector) => detector.projectType); .map((detector) => detector.projectType);
if (options.zksync) {
const hardhatProject = possibleProjectTypes.filter(
(projectType) => projectType === "hardhat",
);
if (hardhatProject.length === 0) {
logger.warn("ZKSync compilation requires hardhat plugins. Aborting.");
process.exit(1);
}
}
//if there is no project returned at all then just return unknown} //if there is no project returned at all then just return unknown}
if (!possibleProjectTypes.length) { if (!possibleProjectTypes.length) {
const canCompile = hasContracts(path); const canCompile = hasContracts(path);
@@ -51,15 +62,28 @@ export default async function detect(
} }
//if there is only one possible option just return it //if there is only one possible option just return it
if (possibleProjectTypes.length === 1) { if (possibleProjectTypes.length === 1) {
if (options.zksync) {
info("ZKSync compilation will use hardhat");
} else {
info(`Detected project type: ${possibleProjectTypes[0]}`); info(`Detected project type: ${possibleProjectTypes[0]}`);
}
return possibleProjectTypes[0]; return possibleProjectTypes[0];
} }
if (options.zksync) {
info("ZKSync compilation will use hardhat");
info(
`For regular solc compilation, these are the available options: ${possibleProjectTypes
.map((s) => `"${s}"`)
.join(", ")}`,
);
} else {
info( info(
`Detected multiple possible build tools: ${possibleProjectTypes `Detected multiple possible build tools: ${possibleProjectTypes
.map((s) => `"${s}"`) .map((s) => `"${s}"`)
.join(", ")}`, .join(", ")}`,
); );
}
const question = "How would you like to compile your contracts"; const question = "How would you like to compile your contracts";
@@ -26,4 +26,8 @@ export interface ContractPayload {
* The source file paths * The source file paths
*/ */
sources: string[]; sources: string[];
compilerVersion: string;
evmVersion: string;
} }
@@ -2,6 +2,7 @@ export type ProjectType =
| "brownie" | "brownie"
| "foundry" | "foundry"
| "hardhat" | "hardhat"
| "zk-hardhat"
| "truffle" | "truffle"
| "solc" | "solc"
| "vite" | "vite"
@@ -1,5 +1,11 @@
# @thirdweb-dev/contracts-js # @thirdweb-dev/contracts-js
## 1.3.20
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
## 1.3.19 ## 1.3.19
### Patch Changes ### Patch Changes
+2 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/contracts-js", "name": "@thirdweb-dev/contracts-js",
"version": "1.3.19", "version": "1.3.20",
"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": {
@@ -355,7 +355,6 @@
"./dist/abis/IPlatformFee.json": "./dist/abis/IPlatformFee.json", "./dist/abis/IPlatformFee.json": "./dist/abis/IPlatformFee.json",
"./dist/abis/Base64.json": "./dist/abis/Base64.json", "./dist/abis/Base64.json": "./dist/abis/Base64.json",
"./dist/abis/ProxyForUpgradeable.json": "./dist/abis/ProxyForUpgradeable.json", "./dist/abis/ProxyForUpgradeable.json": "./dist/abis/ProxyForUpgradeable.json",
"./dist/abis/Helpers.json": "./dist/abis/Helpers.json",
"./dist/abis/StringSet.json": "./dist/abis/StringSet.json", "./dist/abis/StringSet.json": "./dist/abis/StringSet.json",
"./dist/abis/VRFV2WrapperConsumerBase.json": "./dist/abis/VRFV2WrapperConsumerBase.json", "./dist/abis/VRFV2WrapperConsumerBase.json": "./dist/abis/VRFV2WrapperConsumerBase.json",
"./dist/abis/ITokenERC1155.json": "./dist/abis/ITokenERC1155.json", "./dist/abis/ITokenERC1155.json": "./dist/abis/ITokenERC1155.json",
@@ -425,7 +424,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/contracts-js", "repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/contracts-js",
"dependencies": { "dependencies": {
"@thirdweb-dev/contracts": "3.12.1" "@thirdweb-dev/contracts": "3.13.0"
}, },
"devDependencies": { "devDependencies": {
"@ethersproject/abi": "^5.7.0", "@ethersproject/abi": "^5.7.0",
+8
View File
@@ -1,5 +1,13 @@
# @thirdweb-dev/crypto # @thirdweb-dev/crypto
## 0.2.4
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
- [#2610](https://github.com/thirdweb-dev/js/pull/2610) [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump viem from 2.9.5 to 2.9.6
## 0.2.3 ## 0.2.3
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/crypto", "name": "@thirdweb-dev/crypto",
"version": "0.2.3", "version": "0.2.4",
"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": {
@@ -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.64", "js-awe": "^1.0.65",
"tinybench": "^2.6.0", "tinybench": "^2.6.0",
"typescript": "5.4.3", "typescript": "5.4.3",
"viem": "2.9.5" "viem": "2.9.6"
}, },
"scripts": { "scripts": {
"format": "prettier --write 'src/**/*'", "format": "prettier --write 'src/**/*'",
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/merkletree # @thirdweb-dev/merkletree
## 0.2.4
### Patch Changes
- Updated dependencies [[`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107)]:
- @thirdweb-dev/crypto@0.2.4
## 0.2.3 ## 0.2.3
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/merkletree", "name": "@thirdweb-dev/merkletree",
"version": "0.2.3", "version": "0.2.4",
"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": {
+30
View File
@@ -1,5 +1,35 @@
# @thirdweb-dev/react-core # @thirdweb-dev/react-core
## 4.4.29
### Patch Changes
- Updated dependencies [[`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075), [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/wallets@2.4.31
- @thirdweb-dev/sdk@4.0.55
- @thirdweb-dev/chains@0.1.86
- @thirdweb-dev/auth@4.1.53
- @thirdweb-dev/storage@2.0.13
## 4.4.28
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
- @thirdweb-dev/sdk@4.0.54
- @thirdweb-dev/wallets@2.4.30
- @thirdweb-dev/auth@4.1.52
## 4.4.27
### Patch Changes
- Updated dependencies [[`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0)]:
- @thirdweb-dev/sdk@4.0.53
- @thirdweb-dev/wallets@2.4.29
- @thirdweb-dev/auth@4.1.51
## 4.4.26 ## 4.4.26
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-core", "name": "@thirdweb-dev/react-core",
"version": "4.4.26", "version": "4.4.29",
"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",
@@ -1,5 +1,15 @@
# @thirdweb-dev/react-native-compat # @thirdweb-dev/react-native-compat
## 0.7.26
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
## 0.7.25
## 0.7.24
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes
@@ -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.23", "version": "0.7.26",
"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",
@@ -22,7 +22,7 @@
}, },
"dependencies": { "dependencies": {
"@ethersproject/shims": "^5.7.0", "@ethersproject/shims": "^5.7.0",
"@walletconnect/react-native-compat": "2.9.2", "@walletconnect/react-native-compat": "2.11.3",
"base-64": "^1.0.0", "base-64": "^1.0.0",
"big-integer": "^1.6.52", "big-integer": "^1.6.52",
"react-native-get-random-values": "^1.11.0", "react-native-get-random-values": "^1.11.0",
@@ -35,7 +35,7 @@
}, },
"devDependencies": { "devDependencies": {
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/node": "20.11.30", "@types/node": "20.12.2",
"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",
+32
View File
@@ -1,5 +1,37 @@
# @thirdweb-dev/react-native # @thirdweb-dev/react-native
## 0.7.26
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
- Updated dependencies [[`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075), [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/wallets@2.4.31
- @thirdweb-dev/sdk@4.0.55
- @thirdweb-dev/chains@0.1.86
- @thirdweb-dev/react-core@4.4.29
- @thirdweb-dev/storage@2.0.13
## 0.7.25
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
- @thirdweb-dev/react-core@4.4.28
- @thirdweb-dev/sdk@4.0.54
- @thirdweb-dev/wallets@2.4.30
## 0.7.24
### Patch Changes
- Updated dependencies [[`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0)]:
- @thirdweb-dev/sdk@4.0.53
- @thirdweb-dev/react-core@4.4.27
- @thirdweb-dev/wallets@2.4.29
## 0.7.23 ## 0.7.23
### Patch Changes ### Patch Changes
+4 -4
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-native", "name": "@thirdweb-dev/react-native",
"version": "0.7.23", "version": "0.7.26",
"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",
@@ -38,14 +38,14 @@
"@thirdweb-dev/wallets": "workspace:*", "@thirdweb-dev/wallets": "workspace:*",
"abitype": "1.0.0", "abitype": "1.0.0",
"aws-amplify": "^5.3.18", "aws-amplify": "^5.3.18",
"expo-application": "5.7.0", "expo-application": "5.8.3",
"expo-clipboard": "^4.8.0", "expo-clipboard": "^4.8.0",
"expo-document-picker": "^11.10.1", "expo-document-picker": "^11.10.1",
"expo-file-system": "^15.9.0", "expo-file-system": "^15.9.0",
"expo-secure-store": "^12.8.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.3.0",
"react-native-svg": "^13.14.0", "react-native-svg": "15.1.0",
"secrets.js-34r7h": "^2.0.2", "secrets.js-34r7h": "^2.0.2",
"tiny-invariant": "^1.3.3" "tiny-invariant": "^1.3.3"
}, },
+32
View File
@@ -1,5 +1,37 @@
# @thirdweb-dev/react # @thirdweb-dev/react
## 4.4.29
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
- Updated dependencies [[`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075), [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/wallets@2.4.31
- @thirdweb-dev/sdk@4.0.55
- @thirdweb-dev/chains@0.1.86
- @thirdweb-dev/react-core@4.4.29
- @thirdweb-dev/payments@1.0.3
## 4.4.28
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
- @thirdweb-dev/react-core@4.4.28
- @thirdweb-dev/sdk@4.0.54
- @thirdweb-dev/wallets@2.4.30
## 4.4.27
### Patch Changes
- Updated dependencies [[`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0)]:
- @thirdweb-dev/sdk@4.0.53
- @thirdweb-dev/react-core@4.4.27
- @thirdweb-dev/wallets@2.4.29
## 4.4.26 ## 4.4.26
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react", "name": "@thirdweb-dev/react",
"version": "4.4.26", "version": "4.4.29",
"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",
@@ -102,9 +102,9 @@
"dependencies": { "dependencies": {
"@emotion/css": "11.10.5", "@emotion/css": "11.10.5",
"@emotion/react": "^11.11.4", "@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.18",
"@radix-ui/colors": "^0.1.9", "@radix-ui/colors": "^0.1.9",
"@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",
Binary file not shown.
+26
View File
@@ -1,5 +1,31 @@
# @thirdweb-dev/sdk # @thirdweb-dev/sdk
## 4.0.55
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
- Updated dependencies [[`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/contracts-js@1.3.20
- @thirdweb-dev/crypto@0.2.4
- @thirdweb-dev/chains@0.1.86
- @thirdweb-dev/merkletree@0.2.4
- @thirdweb-dev/storage@2.0.13
## 4.0.54
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
## 4.0.53
### Patch Changes
- [#2584](https://github.com/thirdweb-dev/js/pull/2584) [`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0) Thanks [@kumaryash90](https://github.com/kumaryash90)! - cli changes for zksync publish
## 4.0.52 ## 4.0.52
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/sdk", "name": "@thirdweb-dev/sdk",
"version": "4.0.52", "version": "4.0.55",
"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",
@@ -89,7 +89,7 @@
"@types/chai": "^4.3.14", "@types/chai": "^4.3.14",
"@types/deep-equal-in-any-order": "^1.0.3", "@types/deep-equal-in-any-order": "^1.0.3",
"@types/mocha": "^10.0.6", "@types/mocha": "^10.0.6",
"@types/node": "20.11.30", "@types/node": "20.12.2",
"@types/uuid": "^9.0.8", "@types/uuid": "^9.0.8",
"chai": "^4.4.1", "chai": "^4.4.1",
"deep-equal-in-any-order": "^1.1.20", "deep-equal-in-any-order": "^1.1.20",
@@ -129,7 +129,7 @@
} }
}, },
"dependencies": { "dependencies": {
"@eth-optimism/sdk": "3.2.2", "@eth-optimism/sdk": "3.2.3",
"@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:*",
@@ -487,6 +487,7 @@ export class ContractPublisher extends RPCConnectionHandler {
bytecodeUri: predeployMetadata.bytecodeUri, bytecodeUri: predeployMetadata.bytecodeUri,
name: predeployMetadata.name, name: predeployMetadata.name,
analytics: predeployMetadata.analytics, analytics: predeployMetadata.analytics,
compilers: predeployMetadata.compilers,
publisher, publisher,
}); });
const fullMetadataUri = await this.storage.upload(fullMetadata); const fullMetadataUri = await this.storage.upload(fullMetadata);
@@ -112,6 +112,14 @@ export type Abi = z.output<typeof AbiSchema>;
*/ */
export type AbiInput = z.input<typeof AbiSchema>; export type AbiInput = z.input<typeof AbiSchema>;
/**
* @internal
*/
export const CompilerTypeInput = /* @__PURE__ */ (() =>
z.union([z.literal("solc"), z.literal("zksolc")]))();
export type CompilerType = z.input<typeof CompilerTypeInput>;
/** /**
* @internal * @internal
*/ */
@@ -122,6 +130,21 @@ export const PreDeployMetadata = /* @__PURE__ */ (() =>
metadataUri: z.string(), metadataUri: z.string(),
bytecodeUri: z.string(), bytecodeUri: z.string(),
analytics: z.any().optional(), analytics: z.any().optional(),
compilers: z
.record(
CompilerTypeInput,
// z.record(
z.array(
z.object({
compilerVersion: z.string().optional(),
evmVersion: z.string().optional(),
metadataUri: z.string(),
bytecodeUri: z.string(),
}),
),
// ),
)
.optional(),
}) })
.catchall(z.any()))(); .catchall(z.any()))();
@@ -6,9 +6,9 @@ import { getChainProvider } from "../constants/urls";
import { Abi } from "../schema/contracts/custom"; import { Abi } from "../schema/contracts/custom";
import { twProxyArtifactZK } from "./temp-artifact/TWProxy"; import { twProxyArtifactZK } from "./temp-artifact/TWProxy";
import { fetchSourceFilesFromMetadata } from "../common/fetchSourceFilesFromMetadata"; import { fetchSourceFilesFromMetadata } from "../common/fetchSourceFilesFromMetadata";
import { fetchRawPredeployMetadata } from "../common/feature-detection/fetchRawPredeployMetadata";
import { fetchContractMetadata } from "../common/fetchContractMetadata"; import { fetchContractMetadata } from "../common/fetchContractMetadata";
import { checkVerificationStatus } from "../common/verification"; import { checkVerificationStatus } from "../common/verification";
import { ThirdwebSDK } from "../core/sdk";
const RequestStatus = { const RequestStatus = {
OK: "1", OK: "1",
@@ -27,7 +27,8 @@ export async function zkVerify(
explorerAPIUrl: string, explorerAPIUrl: string,
explorerAPIKey: string, explorerAPIKey: string,
storage: ThirdwebStorage, storage: ThirdwebStorage,
contractUri?: string, metadataUri?: string,
zkVersion?: string,
encodedConstructorArgs?: string, encodedConstructorArgs?: string,
) { ) {
try { try {
@@ -43,18 +44,24 @@ export async function zkVerify(
}; };
compilerMetadata.metadata.sources = twProxyArtifactZK.sources; compilerMetadata.metadata.sources = twProxyArtifactZK.sources;
} else { } else {
invariant(contractUri, "No contract URI provided"); if (!metadataUri || metadataUri.length === 0) {
const rawMeta = await fetchRawPredeployMetadata(contractUri, storage); metadataUri = await fetchFromMultiChainRegistry(
const metadataUri = rawMeta.compilers?.zksolc?.metadataUri; contractAddress,
chainId,
);
}
invariant(metadataUri && metadataUri.length > 0, "No contract URI found");
invariant(metadataUri, "ZkSolc metadata not found");
const parsedMetadata = await fetchContractMetadata(metadataUri, storage); const parsedMetadata = await fetchContractMetadata(metadataUri, storage);
const zk_version =
parsedMetadata.metadata.settings.zk_version || zkVersion;
invariant(zk_version, "zk version not found");
compilerMetadata = { compilerMetadata = {
name: parsedMetadata.name, name: parsedMetadata.name,
abi: parsedMetadata.abi, abi: parsedMetadata.abi,
metadata: parsedMetadata.metadata, metadata: parsedMetadata.metadata,
zk_version: rawMeta.zk_version, zk_version,
}; };
} }
@@ -172,13 +179,28 @@ async function zkFetchConstructorParams(
utils.hexDataSlice(transaction.data, 4), utils.hexDataSlice(transaction.data, 4),
); );
return decoded[2]; return decoded[2].startsWith("0x") ? decoded[2] : `0x${decoded[2]}`;
} else { } else {
// TODO: decode for create2 deployments via factory // TODO: decode for create2 deployments via factory
return ""; return "0x";
} }
} else { } else {
// Could not retrieve constructor parameters, using empty parameters as fallback // Could not retrieve constructor parameters, using empty parameters as fallback
return ""; return "0x";
} }
} }
async function fetchFromMultiChainRegistry(
address: string,
chainId: number,
): Promise<string | undefined> {
try {
// random wallet is fine here, we're doing gasless calls
const sdk = new ThirdwebSDK("polygon");
const uri = await sdk.multiChainRegistry.getContractMetadataURI(
chainId,
address,
);
return uri;
} catch (e) {}
}
Binary file not shown.
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/storage # @thirdweb-dev/storage
## 2.0.13
### Patch Changes
- Updated dependencies [[`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107)]:
- @thirdweb-dev/crypto@0.2.4
## 2.0.12 ## 2.0.12
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/storage", "name": "@thirdweb-dev/storage",
"version": "2.0.12", "version": "2.0.13",
"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": {
+28 -20
View File
@@ -10,19 +10,7 @@ require("dotenv-mono").load();
const secretKey = process.env.TW_SECRET_KEY as string; const secretKey = process.env.TW_SECRET_KEY as string;
describe("IPFS", { timeout: 30000 }, async () => { describe("storage:utility functions", () => {
if (!secretKey) {
throw new Error("TW_SECRET_KEY is not set in the environment variables");
}
const storage = new ThirdwebStorage({
secretKey: secretKey,
});
const authorizedUrls = prepareGatewayUrls(
DEFAULT_GATEWAY_URLS,
undefined,
secretKey,
);
it("Should replace tokens in tokenized gateway URL", async () => { it("Should replace tokens in tokenized gateway URL", async () => {
const url = getGatewayUrlForCid( const url = getGatewayUrlForCid(
"https://{cid}.example.com/{path}", "https://{cid}.example.com/{path}",
@@ -42,6 +30,21 @@ describe("IPFS", { timeout: 30000 }, async () => {
"https://example.com/ipfs/bafybeie4vcsw3ew6io6paaltdvwkpcoeyn6uoewvu7op7fhhztpnivqnyy/1.jpg", "https://example.com/ipfs/bafybeie4vcsw3ew6io6paaltdvwkpcoeyn6uoewvu7op7fhhztpnivqnyy/1.jpg",
); );
}); });
});
// these cannot run on forks because of the missing secret key env variable
describe.skipIf(!secretKey)(
"storage:functionality",
{ timeout: 30000 },
async () => {
const storage = new ThirdwebStorage({
secretKey: secretKey,
});
const authorizedUrls = prepareGatewayUrls(
DEFAULT_GATEWAY_URLS,
undefined,
secretKey,
);
it("Should resolve scheme with gateway URL", async () => { it("Should resolve scheme with gateway URL", async () => {
const uri = `ipfs://QmYtBTkEnTGrzkns2L8R4rL3keowVg3nGcBhPbwrbAWTRP`; const uri = `ipfs://QmYtBTkEnTGrzkns2L8R4rL3keowVg3nGcBhPbwrbAWTRP`;
@@ -115,10 +118,12 @@ describe("IPFS", { timeout: 30000 }, async () => {
}, },
); );
expect(uris[0].endsWith("first"), `${uris[0]} does not end with 'first'`).to expect(uris[0].endsWith("first"), `${uris[0]} does not end with 'first'`)
.be.true;
expect(uris[1].endsWith("second"), `${uris[1]} does not end with 'second'`)
.to.be.true; .to.be.true;
expect(
uris[1].endsWith("second"),
`${uris[1]} does not end with 'second'`,
).to.be.true;
const data1 = await (await storage.download(uris[0])).text(); const data1 = await (await storage.download(uris[0])).text();
expect(data1).to.equal("data1"); expect(data1).to.equal("data1");
@@ -226,8 +231,8 @@ describe("IPFS", { timeout: 30000 }, async () => {
expect(uris[0].endsWith("0"), `${uris[0]} does not end with '0'`).to.be expect(uris[0].endsWith("0"), `${uris[0]} does not end with '0'`).to.be
.true; .true;
expect(uris[1].endsWith("1"), `${uris[1]} does not end with '0.jpg'`).to.be expect(uris[1].endsWith("1"), `${uris[1]} does not end with '0.jpg'`).to
.true; .be.true;
const data0 = await storage.downloadJSON(uris[0]); const data0 = await storage.downloadJSON(uris[0]);
const data1 = await storage.downloadJSON(uris[1]); const data1 = await storage.downloadJSON(uris[1]);
@@ -270,7 +275,9 @@ describe("IPFS", { timeout: 30000 }, async () => {
const json = await storage.downloadJSON(uri); const json = await storage.downloadJSON(uri);
expect(json.name).to.equal("Upload Without Directory"); expect(json.name).to.equal("Upload Without Directory");
expect(json.description).to.equal("Uploading alone without a directory..."); expect(json.description).to.equal(
"Uploading alone without a directory...",
);
}); });
it("Should throw an error on upload without directory with multiple uploads", async () => { it("Should throw an error on upload without directory with multiple uploads", async () => {
@@ -624,4 +631,5 @@ describe("IPFS", { timeout: 30000 }, async () => {
expect(res.status).to.equal(200); expect(res.status).to.equal(200);
}); });
}); },
);
+27
View File
@@ -1,5 +1,32 @@
# @thirdweb-dev/wallets # @thirdweb-dev/wallets
## 2.4.31
### Patch Changes
- [#2622](https://github.com/thirdweb-dev/js/pull/2622) [`00be583`](https://github.com/thirdweb-dev/js/commit/00be583b8902a1a0e5382ffdaafa6b9e31316075) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Get gas price from bundler for userOperations
- Updated dependencies [[`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19), [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107), [`82e5f53`](https://github.com/thirdweb-dev/js/commit/82e5f53bc49208cbc43ef3eb64e3a4b6ef6c7cf6)]:
- @thirdweb-dev/contracts-js@1.3.20
- @thirdweb-dev/crypto@0.2.4
- @thirdweb-dev/sdk@4.0.55
- @thirdweb-dev/chains@0.1.86
## 2.4.30
### Patch Changes
- Updated dependencies [[`3ef3786`](https://github.com/thirdweb-dev/js/commit/3ef378659e83341663dfaded417e33b5af29bbbc)]:
- @thirdweb-dev/chains@0.1.85
- @thirdweb-dev/sdk@4.0.54
## 2.4.29
### Patch Changes
- Updated dependencies [[`6bd1b82`](https://github.com/thirdweb-dev/js/commit/6bd1b82a58505ec3af3a12ceeab51d78ee3b8bc0)]:
- @thirdweb-dev/sdk@4.0.53
## 2.4.28 ## 2.4.28
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/wallets", "name": "@thirdweb-dev/wallets",
"version": "2.4.28", "version": "2.4.31",
"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": {
@@ -15,6 +15,7 @@ import {
import { Transaction, getDynamicFeeData } from "@thirdweb-dev/sdk"; import { Transaction, getDynamicFeeData } from "@thirdweb-dev/sdk";
import { HttpRpcClient } from "./http-rpc-client"; import { HttpRpcClient } from "./http-rpc-client";
import type { BaseApiParams, PaymasterAPI, UserOpOptions } from "../types"; import type { BaseApiParams, PaymasterAPI, UserOpOptions } from "../types";
import { isTwUrl } from "../../../utils/url";
const DUMMY_SIGNATURE = const DUMMY_SIGNATURE =
"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"; "0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c";
@@ -191,6 +192,15 @@ export abstract class BaseAccountAPI {
tx.encode(), tx.encode(),
); );
let { maxFeePerGas, maxPriorityFeePerGas } = info; let { maxFeePerGas, maxPriorityFeePerGas } = info;
// get fees from bundler if available
if (isTwUrl(httpRpcClient.bundlerUrl)) {
const bundlerFeeData = await httpRpcClient.getUserOperationGasPrice();
maxFeePerGas = BigNumber.from(bundlerFeeData.maxFeePerGas);
maxPriorityFeePerGas = BigNumber.from(
bundlerFeeData.maxPriorityFeePerGas,
);
} else {
// if bundler is not available, try to get fees from the network if not passed explicitly
if (!maxFeePerGas || !maxPriorityFeePerGas) { if (!maxFeePerGas || !maxPriorityFeePerGas) {
const feeData = await getDynamicFeeData( const feeData = await getDynamicFeeData(
this.provider as providers.JsonRpcProvider, this.provider as providers.JsonRpcProvider,
@@ -212,6 +222,7 @@ export abstract class BaseAccountAPI {
} }
} }
} }
}
if (!maxFeePerGas || !maxPriorityFeePerGas) { if (!maxFeePerGas || !maxPriorityFeePerGas) {
throw new Error( throw new Error(
"maxFeePerGas or maxPriorityFeePerGas could not be calculated, please pass them explicitely", "maxFeePerGas or maxPriorityFeePerGas could not be calculated, please pass them explicitely",
@@ -134,6 +134,17 @@ export class HttpRpcClient {
); );
} }
async getUserOperationGasPrice(): Promise<{
maxFeePerGas: string;
maxPriorityFeePerGas: string;
}> {
await this.initializing;
return await this.userOpJsonRpcProvider.send(
"thirdweb_getUserOperationGasPrice",
[],
);
}
async getUserOperationReceipt(userOpHash: string): Promise<any> { async getUserOperationReceipt(userOpHash: string): Promise<any> {
await this.initializing; await this.initializing;
return await this.userOpJsonRpcProvider.send( return await this.userOpJsonRpcProvider.send(
+4 -4
View File
@@ -27,7 +27,7 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\"", "format": "prettier --write \"**/*.{ts,tsx,md}\"",
"changeset": "changeset", "changeset": "changeset",
"version-packages": "changeset version", "version-packages": "changeset version",
"release": "node ./scripts/pre-release.mjs && changeset publish", "release": "node ./scripts/pre-release.mjs && turbo run update-version && turbo run build && changeset publish",
"version-packages:nightly": "node scripts/pre-nightly.mjs && changeset version --snapshot nightly", "version-packages:nightly": "node scripts/pre-nightly.mjs && changeset version --snapshot nightly",
"release:nightly": "node ./scripts/pre-release.mjs && turbo run update-version && turbo run build && changeset publish --tag nightly", "release:nightly": "node ./scripts/pre-release.mjs && turbo run update-version && turbo run build && changeset publish --tag nightly",
"version-packages:next": "node scripts/pre-nightly.mjs && changeset version --snapshot next", "version-packages:next": "node scripts/pre-nightly.mjs && changeset version --snapshot next",
@@ -49,10 +49,10 @@
"@manypkg/get-packages": "2.2.1", "@manypkg/get-packages": "2.2.1",
"@playwright/test": "1.31.2", "@playwright/test": "1.31.2",
"@trivago/prettier-plugin-sort-imports": "4.3.0", "@trivago/prettier-plugin-sort-imports": "4.3.0",
"@types/node": "20.11.30", "@types/node": "20.12.2",
"eslint": "8.57.0", "eslint": "8.57.0",
"prettier": "3.2.5", "prettier": "3.2.5",
"turbo": "1.13.0", "turbo": "1.13.1",
"yalc": "1.0.0-pre.53" "yalc": "1.0.0-pre.53"
}, },
"_______ALL_PACKAGE_DEV_DEPENDENCIES_GO_IN_HERE_SO_CONSUMERS_DONT_END_UP_INSTALLING_THEM______": "_______ALL_PACKAGE_DEV_DEPENDENCIES_GO_IN_HERE_SO_CONSUMERS_DONT_END_UP_INSTALLING_THEM______", "_______ALL_PACKAGE_DEV_DEPENDENCIES_GO_IN_HERE_SO_CONSUMERS_DONT_END_UP_INSTALLING_THEM______": "_______ALL_PACKAGE_DEV_DEPENDENCIES_GO_IN_HERE_SO_CONSUMERS_DONT_END_UP_INSTALLING_THEM______",
@@ -60,7 +60,7 @@
"@codspeed/vitest-plugin": "3.1.0", "@codspeed/vitest-plugin": "3.1.0",
"@size-limit/preset-big-lib": "11.1.2", "@size-limit/preset-big-lib": "11.1.2",
"@tanstack/eslint-plugin-query": "5.28.6", "@tanstack/eslint-plugin-query": "5.28.6",
"@types/bun": "1.0.11", "@types/bun": "1.0.12",
"@types/react": "18.2.17", "@types/react": "18.2.17",
"@viem/anvil": "0.0.9", "@viem/anvil": "0.0.9",
"@vitest/coverage-v8": "1.4.0", "@vitest/coverage-v8": "1.4.0",
@@ -1,5 +1,11 @@
# eslint-config-thirdweb # eslint-config-thirdweb
## 0.1.8
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
## 0.1.7 ## 0.1.7
### Patch Changes ### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "eslint-config-thirdweb", "name": "eslint-config-thirdweb",
"version": "0.1.7", "version": "0.1.8",
"main": "index.js", "main": "index.js",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
@@ -8,7 +8,7 @@
"@typescript-eslint/parser": "7.4.0", "@typescript-eslint/parser": "7.4.0",
"eslint-config-next": "13.4.12", "eslint-config-next": "13.4.12",
"eslint-config-prettier": "9.1.0", "eslint-config-prettier": "9.1.0",
"eslint-config-turbo": "1.13.0", "eslint-config-turbo": "1.13.1",
"eslint-plugin-react": "7.34.1" "eslint-plugin-react": "7.34.1"
}, },
"publishConfig": { "publishConfig": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/service-utils # @thirdweb-dev/service-utils
## 0.4.25
### Patch Changes
- [#2623](https://github.com/thirdweb-dev/js/pull/2623) [`26a50b1`](https://github.com/thirdweb-dev/js/commit/26a50b1e0591529748fb3f0d3fb7cd2ffcc47f19) Thanks [@jnsdls](https://github.com/jnsdls)! - update depdendencies
## 0.4.24 ## 0.4.24
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/service-utils", "name": "@thirdweb-dev/service-utils",
"version": "0.4.24", "version": "0.4.25",
"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": {
@@ -43,10 +43,10 @@
"zod": "3.22.4" "zod": "3.22.4"
}, },
"devDependencies": { "devDependencies": {
"@cloudflare/workers-types": "4.20240320.1", "@cloudflare/workers-types": "4.20240329.0",
"@preconstruct/cli": "2.7.0", "@preconstruct/cli": "2.7.0",
"@thirdweb-dev/tsconfig": "workspace:*", "@thirdweb-dev/tsconfig": "workspace:*",
"@types/node": "20.11.30", "@types/node": "20.12.2",
"eslint": "8.57.0", "eslint": "8.57.0",
"eslint-config-thirdweb": "workspace:*", "eslint-config-thirdweb": "workspace:*",
"typescript": "5.4.3" "typescript": "5.4.3"
+41
View File
@@ -1,5 +1,46 @@
# thirdweb # thirdweb
## 5.1.0
### Minor Changes
- [#2602](https://github.com/thirdweb-dev/js/pull/2602) [`3aaad1e`](https://github.com/thirdweb-dev/js/commit/3aaad1e9bfa978139a4c2092e17d2b93193bb890) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Adds generateAccount function for generating a random local account
### Patch Changes
- [#2525](https://github.com/thirdweb-dev/js/pull/2525) [`7234e6b`](https://github.com/thirdweb-dev/js/commit/7234e6bc10e9d410b991f76d126e978a77fa203f) Thanks [@gregfromstl](https://github.com/gregfromstl)! - Better private-key account support
- [#2626](https://github.com/thirdweb-dev/js/pull/2626) [`e806393`](https://github.com/thirdweb-dev/js/commit/e8063936c91724e540bd7a20c90e480a1f86dabe) Thanks [@jnsdls](https://github.com/jnsdls)! - fix wallet connect uri parsing
- [#2632](https://github.com/thirdweb-dev/js/pull/2632) [`d89f009`](https://github.com/thirdweb-dev/js/commit/d89f009f14fc3500a05dcc21f6b7f688dfe81db4) Thanks [@MananTank](https://github.com/MananTank)! - Various Improvements for wallet connection
- change `accountsChanged` event to `accountChanged` event and emit new `Account` object instead of creating it in the connection manager
- WalletConnect connection improvements
- [#2610](https://github.com/thirdweb-dev/js/pull/2610) [`213f313`](https://github.com/thirdweb-dev/js/commit/213f31303409698d93e5da6eea22df6833512107) Thanks [@dependabot](https://github.com/apps/dependabot)! - build(deps): bump viem from 2.9.5 to 2.9.6
- [#2606](https://github.com/thirdweb-dev/js/pull/2606) [`0394eb2`](https://github.com/thirdweb-dev/js/commit/0394eb22bf5256e8e66c664834c0e7e8fe638bb4) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add ERC4337 extensions
- [#2631](https://github.com/thirdweb-dev/js/pull/2631) [`1c29556`](https://github.com/thirdweb-dev/js/commit/1c29556f146b7c8ea28ed193b4d04e7099a9363e) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Get userOp prices from bundler
## 5.0.3
### Patch Changes
- [#2595](https://github.com/thirdweb-dev/js/pull/2595) [`dd1141f`](https://github.com/thirdweb-dev/js/commit/dd1141f9af002817fb4fd4c002f5d77fde4ac950) Thanks [@MananTank](https://github.com/MananTank)! - Do not subscribe to `session_request_sent` event when using `walletConnect` because that is already handled when connecting with official Modal
- [#2591](https://github.com/thirdweb-dev/js/pull/2591) [`6d63920`](https://github.com/thirdweb-dev/js/commit/6d63920c0a25a395fed091f749e6e5438dce0b5d) Thanks [@MananTank](https://github.com/MananTank)! - Add `walletConnect`, fix WC connection issues
- [#2588](https://github.com/thirdweb-dev/js/pull/2588) [`eba8f1c`](https://github.com/thirdweb-dev/js/commit/eba8f1c19839ad89391d03271ef96b51d5f515ed) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix 721/1155 claimTo
## 5.0.2
### Patch Changes
- [#2585](https://github.com/thirdweb-dev/js/pull/2585) [`052892b`](https://github.com/thirdweb-dev/js/commit/052892b39677755b3167da7520d48446a5ce7c59) Thanks [@MananTank](https://github.com/MananTank)! - Fix wallet not opened on WC sessions request event on page reload on mobile
- [#2587](https://github.com/thirdweb-dev/js/pull/2587) [`6063f40`](https://github.com/thirdweb-dev/js/commit/6063f40f87b2a108840cb08e1e9025542931b7e0) Thanks [@jnsdls](https://github.com/jnsdls)! - [CLI] - fix execution on windows and when prettier is not installed
## 5.0.1 ## 5.0.1
### Patch Changes ### Patch Changes
+3 -3
View File
@@ -1,6 +1,6 @@
{ {
"name": "thirdweb", "name": "thirdweb",
"version": "5.0.1", "version": "5.1.0",
"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.5" "viem": "2.9.6"
}, },
"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 --bail=1", "test": "vitest run -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",
+30 -1
View File
@@ -89,6 +89,21 @@ const walletInfos = allSupportedWallets.map((wallet) => {
return { id: wallet.id, name: wallet.name }; return { id: wallet.id, name: wallet.name };
}); });
const customWalletInfos = [
{
id: "smart",
name: "Smart Wallet",
},
{
id: "embedded",
name: "Embedded Wallet",
},
{
id: "walletConnect",
name: "WalletConnect",
},
];
// clean the __geneated__ folder within `src/wallets/` directory // clean the __geneated__ folder within `src/wallets/` directory
const OUT_PATH = join(__dirname, "../../src/wallets/__generated__"); const OUT_PATH = join(__dirname, "../../src/wallets/__generated__");
@@ -141,7 +156,7 @@ export type MinimalWalletInfo = {
/** /**
* @internal * @internal
*/ */
const ALL_MINIMAL_WALLET_INFOS = <const>${JSON.stringify(walletInfos, null, 2)} satisfies MinimalWalletInfo[]; const ALL_MINIMAL_WALLET_INFOS = <const>${JSON.stringify([...walletInfos, ...customWalletInfos], null, 2)} satisfies MinimalWalletInfo[];
export default ALL_MINIMAL_WALLET_INFOS; export default ALL_MINIMAL_WALLET_INFOS;
`, `,
@@ -222,6 +237,19 @@ const walletImports = allSupportedWallets
) )
.join("\n"); .join("\n");
const customWalletImports = ["smart", "embedded", "walletConnect"]
.map(
(walletId) =>
`case "${walletId}": {
return (
image
? import("../custom/${walletId}/image.js").then((img) => img.default)
: import("../custom/${walletId}/index.js").then((w) => w.wallet)
) as Promise<[TImage] extends [true] ? string : any>;
}`,
)
.join("\n");
await writeFile( await writeFile(
join(OUT_PATH, "getWalletInfo.ts"), join(OUT_PATH, "getWalletInfo.ts"),
await format( await format(
@@ -238,6 +266,7 @@ import type { WalletId } from "../wallet-types.js";
*/ */
export async function getWalletInfo<TImage extends boolean>(id: WalletId, image?: TImage): Promise<[TImage] extends [true] ? string : WalletInfo> { export async function getWalletInfo<TImage extends boolean>(id: WalletId, image?: TImage): Promise<[TImage] extends [true] ? string : WalletInfo> {
switch (id) { switch (id) {
${customWalletImports}
${walletImports} ${walletImports}
default: { default: {
throw new Error(\`Wallet with id \${id} not found\`); throw new Error(\`Wallet with id \${id} not found\`);
@@ -0,0 +1,53 @@
import { describe, test, expect, beforeAll } from "vitest";
import { privateKeyAccount } from "../wallets/private-key.js";
import { TEST_CLIENT } from "../../test/src/test-clients.js";
import { viemAdapter } from "./viem.js";
import { defineChain } from "../chains/utils.js";
import type { WalletClient } from "viem";
import { typedData } from "~test/typed-data.js";
import { ANVIL_PKEY_A } from "~test/test-wallets.js";
const account = privateKeyAccount({
privateKey: ANVIL_PKEY_A,
client: TEST_CLIENT,
});
describe("walletClient.toViem", () => {
let walletClient: WalletClient;
beforeAll(() => {
walletClient = viemAdapter.walletClient.toViem({
client: TEST_CLIENT,
account,
chain: defineChain(31337),
});
});
test("should return an viem wallet client", async () => {
expect(walletClient).toBeDefined();
expect(walletClient.signMessage).toBeDefined();
});
test("should sign typed data", async () => {
expect(walletClient.signTypedData).toBeDefined();
if (!walletClient.account) {
throw new Error("Account not found");
}
const signature = await walletClient.signTypedData({
...typedData.basic,
primaryType: "Mail",
account: walletClient.account,
});
expect(signature).toMatchInlineSnapshot(
`"0x32f3d5975ba38d6c2fba9b95d5cbed1febaa68003d3d588d51f2de522ad54117760cfc249470a75232552e43991f53953a3d74edf6944553c6bef2469bb9e5921b"`,
);
});
test("should contain a local account", async () => {
expect(walletClient.account?.type).toBe("local");
});
});
+23 -3
View File
@@ -4,19 +4,22 @@ import {
type GetContractReturnType, type GetContractReturnType,
type PublicClient, type PublicClient,
type Chain as ViemChain, type Chain as ViemChain,
type Account as ViemAccount,
type WalletClient, type WalletClient,
createWalletClient, createWalletClient,
custom, custom,
type TransactionSerializableEIP1559, type TransactionSerializableEIP1559,
} from "viem"; } from "viem";
import { getContract, type ThirdwebContract } from "../contract/contract.js"; import { getContract, type ThirdwebContract } from "../contract/contract.js";
import type { Abi } from "abitype"; import type { Abi, Address } from "abitype";
import type { Chain } from "../chains/types.js"; import type { Chain } from "../chains/types.js";
import type { ThirdwebClient } from "../client/client.js"; import type { ThirdwebClient } from "../client/client.js";
import { resolveContractAbi } from "../contract/actions/resolve-abi.js"; import { resolveContractAbi } from "../contract/actions/resolve-abi.js";
import { getRpcUrlForChain } from "../chains/utils.js"; import { getRpcUrlForChain } from "../chains/utils.js";
import type { Account } from "../wallets/interfaces/wallet.js"; import { type Account, getAccountKey } from "../wallets/interfaces/wallet.js";
import { getRpcClient } from "../rpc/rpc.js"; import { getRpcClient } from "../rpc/rpc.js";
import { secp256k1 } from "@noble/curves/secp256k1";
import { toHex } from "../utils/encoding/hex.js";
export const viemAdapter = { export const viemAdapter = {
contract: { contract: {
@@ -214,9 +217,26 @@ function toViemWalletClient(options: ToViemWalletClientOptions): WalletClient {
}, },
}); });
// viem defaults to JsonRpcAccounts so we pass the whole account if it's locally generated
let viemAccountOrAddress: ViemAccount | Address;
const possibleAccountKey = getAccountKey(account);
if (possibleAccountKey && account.signTransaction) {
viemAccountOrAddress = {
...account,
signTransaction: account.signTransaction,
source: "custom",
type: "local" as const,
publicKey: toHex(
secp256k1.getPublicKey(possibleAccountKey.slice(2), false),
),
};
} else {
viemAccountOrAddress = account.address;
}
return createWalletClient({ return createWalletClient({
transport, transport,
account: account.address, account: viemAccountOrAddress,
chain: viemChain, chain: viemChain,
key: "thirdweb-wallet", key: "thirdweb-wallet",
}); });
+20 -2
View File
@@ -23,7 +23,10 @@ async function main() {
} }
default: { default: {
const isWindows = /^win/.test(process.platform);
let bunAvailable = false; let bunAvailable = false;
// bun has no windows support yet anyways
if (!isWindows) {
try { try {
const res = execSync("bun --version", { const res = execSync("bun --version", {
stdio: "ignore", stdio: "ignore",
@@ -35,9 +38,24 @@ async function main() {
} catch { } catch {
bunAvailable = false; bunAvailable = false;
} }
const runner = bunAvailable ? "bunx" : "npx"; }
let runner = "npx";
switch (true) {
case bunAvailable:
runner = "bun";
break;
case isWindows:
runner = "npx.cmd";
break;
}
const args = command
? ["--yes", "@thirdweb-dev/cli@latest", command, ...rest]
: ["--yes", "@thirdweb-dev/cli@latest", ...rest];
// 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@latest", command, ...rest], { spawn(runner, args, {
stdio: "inherit", stdio: "inherit",
}); });
} }
@@ -12,12 +12,13 @@ import {
type AbiFunction, type AbiFunction,
formatAbiItem, formatAbiItem,
} from "abitype"; } from "abitype";
import { format } from "prettier";
import { prepareMethod } from "../../../utils/abi/prepare-method.js"; import { prepareMethod } from "../../../utils/abi/prepare-method.js";
import { mkdir, writeFile } from "node:fs/promises"; import { mkdir, writeFile } from "node:fs/promises";
import { packageDirectory } from "./utils.js"; import { packageDirectory } from "./utils.js";
import { join } from "node:path"; import { join } from "node:path";
import { existsSync } from "node:fs"; import { existsSync } from "node:fs";
import type { Options } from "prettier";
const client = createThirdwebClient({ clientId: "test" }); const client = createThirdwebClient({ clientId: "test" });
@@ -150,7 +151,7 @@ async function generateFromAbi(abi: Abi | string[]) {
); );
} }
const prettified = await format(body, { const prettified = await prettifyCode(body, {
parser: "babel-ts", parser: "babel-ts",
}); });
return prettified; return prettified;
@@ -330,3 +331,18 @@ function lowercaseFirstLetter(str: string) {
function eventNameToPreparedEventName(name: string) { function eventNameToPreparedEventName(name: string) {
return `${lowercaseFirstLetter(name)}Event`; return `${lowercaseFirstLetter(name)}Event`;
} }
const printedPrettierWarning = false;
async function prettifyCode(code: string, options: Options) {
try {
const { format } = await import("prettier/standalone.js");
return await format(code, options);
} catch (e) {
if (!printedPrettierWarning) {
console.info("Prettier not found, skipping code formatting.");
}
}
return code;
}
@@ -12,7 +12,9 @@ import { prepareAutoFactoryDeployTransaction } from "./deploy-via-autofactory.js
import { initialize } from "../../extensions/prebuilts/__generated__/DropERC721/write/initialize.js"; import { initialize } from "../../extensions/prebuilts/__generated__/DropERC721/write/initialize.js";
import { getDeployedInfraContract } from "./utils/infra.js"; import { getDeployedInfraContract } from "./utils/infra.js";
describe("deployFromMetadata", () => { // skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("deployFromMetadata", () => {
it("should deploy published contract with existing infra", async () => { it("should deploy published contract with existing infra", async () => {
const cloneFactoryContract = await getDeployedCloneFactoryContract({ const cloneFactoryContract = await getDeployedCloneFactoryContract({
chain: FORKED_ETHEREUM_CHAIN, chain: FORKED_ETHEREUM_CHAIN,
@@ -7,7 +7,9 @@ import { getDeployedCreate2Factory } from "./create-2-factory.js";
import { getDeployedInfraContract } from "./infra.js"; import { getDeployedInfraContract } from "./infra.js";
import { fail } from "assert"; import { fail } from "assert";
describe("bootstrap", () => { // skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("bootstrap", () => {
it("should bootstrap onchain infra", async () => { it("should bootstrap onchain infra", async () => {
await deployCloneFactory({ await deployCloneFactory({
chain: ANVIL_CHAIN, chain: ANVIL_CHAIN,
@@ -7,7 +7,9 @@ import {
import { transferEvent } from "../../extensions/erc721/__generated__/IERC721A/events/Transfer.js"; import { transferEvent } from "../../extensions/erc721/__generated__/IERC721A/events/Transfer.js";
import { prepareEvent } from "../prepare-event.js"; import { prepareEvent } from "../prepare-event.js";
describe("getEvents", () => { // skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("getEvents", () => {
it("should get all events", async () => { it("should get all events", async () => {
const events = await getContractEvents({ const events = await getContractEvents({
contract: USDC_CONTRACT, contract: USDC_CONTRACT,
+3
View File
@@ -18,3 +18,6 @@ export {
type ERC1155ContractType, type ERC1155ContractType,
deployERC1155Contract, deployERC1155Contract,
} from "../extensions/prebuilts/deploy-erc1155.js"; } from "../extensions/prebuilts/deploy-erc1155.js";
export { prepareDirectDeployTransaction } from "../contract/deployment/deploy-with-abi.js";
export { deployViaAutoFactory } from "../contract/deployment/deploy-via-autofactory.js";
@@ -0,0 +1,60 @@
// ACCOUNT
export {
type AddAdminOptions,
addAdmin,
} from "../../extensions/erc4337/account/addAdmin.js";
export {
type RemoveAdminOptions,
removeAdmin,
} from "../../extensions/erc4337/account/removeAdmin.js";
export {
type AddSessionKeyOptions,
addSessionKey,
} from "../../extensions/erc4337/account/addSessionKey.js";
export {
type RemoveSessionKeyOptions,
removeSessionKey,
} from "../../extensions/erc4337/account/removeSessionKey.js";
export { getAllActiveSigners } from "../../extensions/erc4337/__generated__/IAccountPermissions/read/getAllActiveSigners.js";
export { getAllAdmins } from "../../extensions/erc4337/__generated__/IAccountPermissions/read/getAllAdmins.js";
export { getAllSigners } from "../../extensions/erc4337/__generated__/IAccountPermissions/read/getAllSigners.js";
export {
getPermissionsForSigner,
type GetPermissionsForSignerParams,
} from "../../extensions/erc4337/__generated__/IAccountPermissions/read/getPermissionsForSigner.js";
export {
isActiveSigner,
type IsActiveSignerParams,
} from "../../extensions/erc4337/__generated__/IAccountPermissions/read/isActiveSigner.js";
export { isAdmin } from "../../extensions/erc4337/__generated__/IAccountPermissions/read/isAdmin.js";
export { adminUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccountPermissions/events/AdminUpdated.js";
export { signerPermissionsUpdatedEvent } from "../../extensions/erc4337/__generated__/IAccountPermissions/events/SignerPermissionsUpdated.js";
// FACTORY
export { getAllAccounts } from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAllAccounts.js";
export {
getAccountsOfSigner,
type GetAccountsOfSignerParams,
} from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAccountsOfSigner.js";
export {
getAddress as predictAccountAddress,
type GetAddressParams as PredictAccountAddressParams,
} from "../../extensions/erc4337/__generated__/IAccountFactory/read/getAddress.js";
// ENTRYPOINT
export { accountDeployedEvent } from "../../extensions/erc4337/__generated__/IEntryPoint/events/AccountDeployed.js";
export { userOperationEventEvent } from "../../extensions/erc4337/__generated__/IEntryPoint/events/UserOperationEvent.js";
export { userOperationRevertReasonEvent } from "../../extensions/erc4337/__generated__/IEntryPoint/events/UserOperationRevertReason.js";
export {
getUserOpHash,
type GetUserOpHashParams,
} from "../../extensions/erc4337/__generated__/IEntryPoint/read/getUserOpHash.js";
export {
simulateHandleOp,
type SimulateHandleOpParams,
} from "../../extensions/erc4337/__generated__/IEntryPoint/write/simulateHandleOp.js";
@@ -108,6 +108,7 @@ export {
type SimulateOptions, type SimulateOptions,
} from "../transaction/actions/simulate.js"; } from "../transaction/actions/simulate.js";
export { waitForReceipt } from "../transaction/actions/wait-for-tx-receipt.js"; export { waitForReceipt } from "../transaction/actions/wait-for-tx-receipt.js";
export { signTransaction } from "../transaction/actions/sign-transaction.js";
/** /**
* EVENTS * EVENTS
@@ -43,6 +43,10 @@ export {
simulateTransaction, simulateTransaction,
type SimulateOptions, type SimulateOptions,
} from "../transaction/actions/simulate.js"; } from "../transaction/actions/simulate.js";
export {
signTransaction,
type SignTransactionOptions,
} from "../transaction/actions/sign-transaction.js";
//types & utils //types & utils
export { export {
+10
View File
@@ -27,6 +27,16 @@ export {
resolveSignature, resolveSignature,
resolveSignatures, resolveSignatures,
} from "../utils/signatures/resolve-signature.js"; } from "../utils/signatures/resolve-signature.js";
export { type SignOptions, sign } from "../utils/signatures/sign.js";
export { signatureToHex } from "../utils/signatures/signature-to-hex.js";
export {
type SignMessageOptions,
signMessage,
} from "../utils/signatures/sign-message.js";
export {
type SignTypedDataOptions,
signTypedData,
} from "../utils/signatures/sign-typed-data.js";
// ------------------------------------------------ // ------------------------------------------------
// encoding // encoding
+7
View File
@@ -2,19 +2,26 @@ export {
createWallet, createWallet,
smartWallet, smartWallet,
embeddedWallet, embeddedWallet,
walletConnect,
} from "../wallets/create-wallet.js"; } from "../wallets/create-wallet.js";
export type { Wallet, Account } from "../wallets/interfaces/wallet.js"; export type { Wallet, Account } from "../wallets/interfaces/wallet.js";
export type { ConnectionStatus } from "../wallets/manager/index.js"; export type { ConnectionStatus } from "../wallets/manager/index.js";
// utils
export { export {
getWalletBalance, getWalletBalance,
type GetWalletBalanceOptions, type GetWalletBalanceOptions,
} from "../wallets/utils/getWalletBalance.js"; } from "../wallets/utils/getWalletBalance.js";
export {
generateAccount,
type GenerateAccountOptions,
} from "../wallets/utils/generateAccount.js";
// private-key // private-key
export { export {
privateKeyAccount, privateKeyAccount,
privateKeyToAccount,
type PrivateKeyAccountOptions, type PrivateKeyAccountOptions,
} from "../wallets/private-key.js"; } from "../wallets/private-key.js";
@@ -1,3 +1,10 @@
export { smartWallet } from "../../wallets/create-wallet.js"; export { smartWallet } from "../../wallets/create-wallet.js";
export type {
SmartWalletConnectionOptions,
SmartWalletOptions,
UserOperation,
PaymasterResult,
} from "../../wallets/smart/types.js";
// TODO: add exports for smart wallet utils here // TODO: add exports for smart wallet utils here
@@ -2,7 +2,7 @@ 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";
describe("shared.getContractMetadata", () => { describe.runIf(process.env.TW_SECRET_KEY)("shared.getContractMetadata", () => {
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,
@@ -2,7 +2,9 @@ import { describe, it, expect } from "vitest";
import { resolveAddress } from "./resolve-address.js"; import { resolveAddress } from "./resolve-address.js";
import { TEST_CLIENT } from "../../../test/src/test-clients.js"; import { TEST_CLIENT } from "../../../test/src/test-clients.js";
describe("ENS", () => { // skip this test suite if there is no secret key available to test with
// TODO: remove reliance on secret key during unit tests entirely
describe.runIf(process.env.TW_SECRET_KEY)("ENS", () => {
it("should resolve ENS", async () => { it("should resolve ENS", async () => {
const name = "vitalik.eth"; const name = "vitalik.eth";
const address = await resolveAddress({ const address = await resolveAddress({
@@ -3,7 +3,7 @@ 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";
describe("erc1155.getClaimConditions", () => { describe.runIf(process.env.TW_SECRET_KEY)("erc1155.getClaimConditions", () => {
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,

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