Compare commits

...
Author SHA1 Message Date
Jonas DanielsGitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>GitHub Action
449ae19f94 Version Packages (#3352)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <[email protected]>
2024-06-18 10:08:57 +12:00
joaquim-verges 7304c5b0c7 refactor: respect Coinbase wallet optons when preloading (#3364) 2024-06-17 21:46:10 +00:00
dependabot 49cfdb3fd9 build(deps): bump @eth-optimism/sdk from 3.3.0 to 3.3.2 (#3357)
Bumps [@eth-optimism/sdk](https://github.com/ethereum-optimism/ecosystem) from 3.3.0 to 3.3.2.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/ethereum-optimism/ecosystem/commits/@eth-optimism/[email protected]">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@eth-optimism/sdk&package-manager=npm_and_yarn&previous-version=3.3.0&new-version=3.3.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

</details>

<!-- start pr-codex -->

---

## PR-Codex overview
This PR updates the `@eth-optimism/sdk` package to version 3.3.2 and makes corresponding changes in the `pnpm-lock.yaml` file.

### Detailed summary
- Updated `@eth-optimism/sdk` to version 3.3.2 in `package.json`
- Updated version and specifier in `pnpm-lock.yaml` for `@eth-optimism/sdk` to 3.3.2

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2024-06-17 20:47:43 +00:00
joaquim-verges 2d7ebe2111 fix: ConnectButton custom theme + customized component in playground (#3356) 2024-06-17 20:36:44 +00:00
kien-ngo a9ce10f39a Add ERC721 extension: updateMetadata & updateBatchBaseURI (#3347)
<!-- start pr-codex -->

## PR-Codex overview
This PR adds an ERC721 extension `updateMetadata` for updating NFT metadata in batches.

### Detailed summary
- Added `updateMetadata` function to update NFT metadata
- Implemented `getUpdateMetadataParams` to prepare transaction
- Added tests for `updateMetadata` function
- Introduced `freezeBatchBaseURI` function and related utilities

> The following files were skipped due to too many changes: `packages/thirdweb/src/extensions/erc721/__generated__/DropERC721/write/freezeBatchBaseURI.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/DropERC721/write/setMaxTotalSupply.ts`, `packages/thirdweb/src/extensions/erc721/__generated__/DropERC721/write/updateBatchBaseURI.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
2024-06-17 19:20:14 +00:00
github-actions[bot]GitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
321cf26342 chore(chains): update chains (#3348)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-06-17 11:31:07 -07:00
jnsdls d2ad36d76d [Fix] Ensure proper awaiting of the format function in generate script (#3349)
### TL;DR

This PR modifies the `generateFromAbi` function to ensure that the `format` function from Prettier is properly awaited. This solves issues with file writing inconsistencies.

### What changed?

- Added `await` to the `format` function calls within `generateFromAbi`.

### How to test?

1. Run the `generateFromAbi` script.
2. Ensure that generated files are consistently formatted.

### Why make this change?

This change ensures that the Prettier formatting is correctly applied before the files are written, resolving any inconsistencies and potential bugs caused by non-awaited formatting.

---
2024-06-17 18:26:12 +00:00
80 changed files with 1372 additions and 223 deletions
@@ -4,6 +4,7 @@ import type { Metadata } from "next";
import Image from "next/image";
import Link from "next/link";
import { CodeExample } from "../../../components/code/code-example";
import { CustomizedConnect } from "../../../components/sign-in/custom";
import { HooksPreview } from "../../../components/sign-in/hooks";
import { StyledConnectButton } from "../../../components/styled-connect-button";
import { StyledConnectEmbed } from "../../../components/styled-connect-embed";
@@ -70,6 +71,10 @@ export default function Page() {
<EmbedComponent />
</section>
<section className="container px-4 md:px-6 space-y-8">
<CustomizedComponent />
</section>
<section className="container px-4 md:px-6 space-y-8">
<Hooks />
</section>
@@ -146,6 +151,65 @@ return (
);
}
function CustomizedComponent() {
return (
<>
<div className="space-y-2">
<h2 className="text-2xl sm:text-3xl font-semibold tracking-tight">
Customized Component
</h2>
<p className="max-w-[600px]">
Change the look and feel of the connect button without rewriting your
own.
</p>
</div>
<CodeExample
preview={<CustomizedConnect />}
code={`import { createThirdwebClient } from "thirdweb";
import { ConnectEmbed } from "thirdweb/react";
const THIRDWEB_CLIENT = createThirdwebClient({
clientId: "<YOUR_CLIENT_ID>"
});
function App(){
return (
<ConnectButton
client={THIRDWEB_CLIENT}
connectButton={{
label: "Custom Connect Button",
}}
showAllWallets={false}
connectModal={{
title: "Custom Connect Modal",
size: "compact",
}}
theme={darkTheme({
colors: {
modalBg: "#281866",
accentButtonBg: "#281866",
connectedButtonBgHover: "#281866",
borderColor: "rgba(256, 256,256, 0.1)",
accentText: "rgba(256, 256,256, 0.1)",
connectedButtonBg: "#281866",
tertiaryBg: "rgba(256, 256,256, 0.1)",
primaryButtonBg: "#281866",
secondaryButtonBg: "rgba(256, 256,256, 0.1)",
primaryButtonText: "#E7E8E9",
primaryText: "#E7E8E9",
separatorLine: "rgba(256, 256,256, 0.1)",
},
})}
/>
);
};`}
lang="tsx"
/>
</>
);
}
function Hooks() {
return (
<>
@@ -0,0 +1,36 @@
"use client";
import { ConnectButton } from "thirdweb/react";
import { darkTheme, lightTheme } from "thirdweb/react";
import { THIRDWEB_CLIENT } from "../../lib/client";
export const CustomizedConnect = () => {
return (
<ConnectButton
client={THIRDWEB_CLIENT}
connectButton={{
label: "Custom Connect Button",
}}
showAllWallets={false}
connectModal={{
title: "Custom Connect Modal",
size: "compact",
}}
theme={darkTheme({
colors: {
modalBg: "#281866",
accentButtonBg: "#281866",
connectedButtonBgHover: "#281866",
borderColor: "rgba(256, 256,256, 0.1)",
accentText: "rgba(256, 256,256, 0.1)",
connectedButtonBg: "#281866",
tertiaryBg: "rgba(256, 256,256, 0.1)",
primaryButtonBg: "#281866",
secondaryButtonBg: "rgba(256, 256,256, 0.1)",
primaryButtonText: "#E7E8E9",
primaryText: "#E7E8E9",
separatorLine: "rgba(256, 256,256, 0.1)",
},
})}
/>
);
};
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth
## 4.1.96
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@2.5.38
## 4.1.95
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "4.1.95",
"version": "4.1.96",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.120
### Patch Changes
- [#3348](https://github.com/thirdweb-dev/js/pull/3348) [`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
## 0.1.119
### Patch Changes
@@ -4,12 +4,6 @@ export default {
"chainId": 107107114116,
"explorers": [],
"faucets": [],
"icon": {
"url": "ipfs://QmNTZ9nEomAXK6bLxUbMfTS1TvrsN22HU1zTtxHUpMkUhz",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://kakarot.org",
"name": "Kakarot Sepolia Deprecated",
"nativeCurrency": {
+3 -1
View File
@@ -36,7 +36,9 @@ export default {
},
"rpc": [
"https://1123.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://b2-testnet.alt.technology"
"https://b2-testnet.alt.technology",
"https://rpc.ankr.com/b2_testnet",
"https://testnet-rpc.bsquared.network"
],
"shortName": "B2-testnet",
"slug": "b2-testnet",
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"chain": "Artela",
"chainId": 11822,
"explorers": [
{
"name": "ArtelaScan",
"url": "https://betanet-scan.artela.network",
"standard": "EIP3091"
}
],
"faucets": [],
"infoURL": "https://artela.network/",
"name": "Artela Testnet",
"nativeCurrency": {
"name": "ART",
"symbol": "ART",
"decimals": 18
},
"networkId": 11822,
"rpc": [
"https://11822.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://betanet-rpc1.artela.network"
],
"shortName": "Artela",
"slug": "artela-testnet",
"testnet": true
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"chain": "CuckooAI",
"chainId": 1200,
"explorers": [
{
"name": "Cuckoo Chain Explorer",
"url": "https://mainnet-scan.cuckoo.network",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZjVDfk56DjqkCPymaweJJaj9ASGjjgcwJ95XsFDzj9us",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://cuckoo.network",
"name": "Cuckoo Chain",
"nativeCurrency": {
"name": "CuckooAI",
"symbol": "CAI",
"decimals": 18
},
"networkId": 1200,
"rpc": [
"https://1200.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.cuckoo.network",
"wss://mainnet-rpc.cuckoo.network"
],
"shortName": "cai",
"slug": "cuckoo-chain",
"testnet": false,
"title": "Cuckoo Chain"
} as const satisfies Chain;
+4 -3
View File
@@ -17,7 +17,7 @@ export default {
"format": "png"
},
"infoURL": "https://buildonhybrid.com",
"name": "Hybrid Testnet",
"name": "Hybrid Testnet (Deprecated)",
"nativeCurrency": {
"name": "Hybrid",
"symbol": "HYB",
@@ -28,7 +28,8 @@ export default {
"https://1224.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.buildonhybrid.com"
],
"shortName": "hyb",
"slug": "hybrid-testnet",
"shortName": "hyb_deprecated",
"slug": "hybrid-testnet-deprecated",
"status": "deprecated",
"testnet": true
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"chain": "HYB",
"chainId": 1225,
"explorers": [
{
"name": "Hybrid Testnet",
"url": "https://explorer.buildonhybrid.com",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdGfvH9qfvbMXYKosS1nHbw3q5UtFJky4hdMDmmKDTx8Y",
"width": 250,
"height": 250,
"format": "png"
},
"infoURL": "https://buildonhybrid.com",
"name": "Hybrid Testnet",
"nativeCurrency": {
"name": "Hybrid",
"symbol": "HYB",
"decimals": 18
},
"networkId": 1225,
"rpc": [
"https://1225.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://hybrid-testnet.rpc.caldera.xyz/http",
"wss://hybrid-testnet.rpc.caldera.xyz/ws"
],
"shortName": "hyb",
"slug": "hybrid-testnet",
"status": "active",
"testnet": true
} as const satisfies Chain;
-6
View File
@@ -15,12 +15,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmRySLe3su59dE5x5JPm2b1GeZfz6DR9qUzcbp3rt4SD3A",
"width": 300,
"height": 300,
"format": "png"
},
"infoURL": "https://astar.network",
"name": "zKatana",
"nativeCurrency": {
+6
View File
@@ -11,6 +11,12 @@ export default {
"name": "EIP155"
}
],
"icon": {
"url": "ipfs://QmVt5Y585JqBSrkpZmYaEnX9FW7tDwfDLmUGNyDdyV2Pd2",
"width": 48,
"height": 48,
"format": "svg"
},
"infoURL": "https://www.dioneprotocol.com/",
"name": "Odyssey Chain (Testnet)",
"nativeCurrency": {
+1 -13
View File
@@ -6,13 +6,7 @@ export default {
{
"name": "etherscan",
"url": "http://testnet-api.magape.io:81",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmPsxWMvnxnZ9dZcRJJMaE24o34dQsnsAMCJh3kVDrE1aB",
"width": 1000,
"height": 1000,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [],
@@ -21,12 +15,6 @@ export default {
"name": "EIP155"
}
],
"icon": {
"url": "ipfs://QmPsxWMvnxnZ9dZcRJJMaE24o34dQsnsAMCJh3kVDrE1aB",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://magape.io",
"name": "MagApe Testnet",
"nativeCurrency": {
@@ -15,12 +15,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmNTZ9nEomAXK6bLxUbMfTS1TvrsN22HU1zTtxHUpMkUhz",
"width": 1000,
"height": 1000,
"format": "png"
},
"infoURL": "https://kakarot.org",
"name": "Kakarot Sepolia",
"nativeCurrency": {
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "Gemuchain",
"chainId": 1903648807,
"explorers": [
{
"name": "Gemuchain Explorer",
"url": "https://gemutest-explorer.gemuchain.io",
"standard": "EIP3091",
"icon": {
"url": "https://explorer.gemuchain.io/assets/network_logo.svg",
"width": 345,
"height": 48,
"format": "svg"
}
}
],
"faucets": [],
"features": [],
"icon": {
"url": "https://raw.githubusercontent.com/UrfinDeuce/logos/05725373b48fb7e3de75737f621b21a4a6557c76/GemuChain%20logo.svg",
"width": 345,
"height": 48,
"format": "svg"
},
"name": "Gemuchain Lab",
"nativeCurrency": {
"name": "GEMU",
"symbol": "GEMU",
"decimals": 18
},
"networkId": 1903648807,
"redFlags": [],
"rpc": [
"https://1903648807.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://gemutest-rpc.gemuchain.io"
],
"shortName": "GEMU",
"slug": "gemuchain-lab",
"testnet": true
} as const satisfies Chain;
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "KYOTO",
"chainId": 1997,
"explorers": [
{
"name": "Kyotoscan",
"url": "https://kyotoscan.io",
"standard": "EIP3091"
}
],
"faucets": [],
"features": [
{
"name": "EIP155"
}
],
"infoURL": "https://kyotoprotocol.io",
"name": "Kyoto",
"nativeCurrency": {
"name": "Kyoto",
"symbol": "KYOTO",
"decimals": 18
},
"networkId": 1997,
"rpc": [
"https://1997.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.kyotochain.io"
],
"shortName": "kyoto",
"slip44": 1,
"slug": "kyoto",
"testnet": false
} as const satisfies Chain;
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdoUtvHDybu5ppYBZT8BMRp6AqByVSoQs8nFwKbaS55jd",
"width": 367,
"height": 367,
"format": "svg"
},
"infoURL": "https://milkomeda.com",
"name": "Milkomeda C1 Mainnet",
"nativeCurrency": {
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdoUtvHDybu5ppYBZT8BMRp6AqByVSoQs8nFwKbaS55jd",
"width": 367,
"height": 367,
"format": "svg"
},
"infoURL": "https://milkomeda.com",
"name": "Milkomeda C1 Testnet",
"nativeCurrency": {
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdoUtvHDybu5ppYBZT8BMRp6AqByVSoQs8nFwKbaS55jd",
"width": 367,
"height": 367,
"format": "svg"
},
"infoURL": "https://milkomeda.com",
"name": "Milkomeda A1 Mainnet",
"nativeCurrency": {
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmdoUtvHDybu5ppYBZT8BMRp6AqByVSoQs8nFwKbaS55jd",
"width": 367,
"height": 367,
"format": "svg"
},
"infoURL": "https://milkomeda.com",
"name": "Milkomeda A1 Testnet",
"nativeCurrency": {
+2 -2
View File
@@ -20,8 +20,8 @@ export default {
"networkId": 2136,
"rpc": [
"https://2136.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://test-market.bigsb.io",
"wss://test-market.bigsb.io"
"https://test-market.bigsb.network",
"wss://test-market.bigsb.network"
],
"shortName": "bigsb_testnet",
"slug": "bigshortbets-testnet",
+2 -20
View File
@@ -6,34 +6,16 @@ export default {
{
"name": "explorer",
"url": "https://testnet.meldscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
"standard": "EIP3091"
},
{
"name": "explorer",
"url": "https://subnets-test.avax.network/meld",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
},
"infoURL": "https://meld.com",
"name": "Kanazawa",
"nativeCurrency": {
+2 -1
View File
@@ -44,7 +44,8 @@ export default {
"https://mainnet.b2-rpc.com",
"https://rpc.bsquared.network",
"https://b2-mainnet.alt.technology",
"https://b2-mainnet-public.s.chainbase.com"
"https://b2-mainnet-public.s.chainbase.com",
"https://rpc.ankr.com/b2"
],
"shortName": "B2-mainnet",
"slug": "b2",
+41
View File
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "AILayer",
"chainId": 2648,
"explorers": [
{
"name": "blockscout",
"url": "https://testnet-explorer.ailayer.xyz",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYoqc8rm8PrBg9jqfpsrxd6zdPEqDozbyNVMkBo3QMAFP",
"width": 500,
"height": 500,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmYoqc8rm8PrBg9jqfpsrxd6zdPEqDozbyNVMkBo3QMAFP",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://ailayer.xyz/",
"name": "AILayer Testnet",
"nativeCurrency": {
"name": "BTC",
"symbol": "BTC",
"decimals": 18
},
"networkId": 2648,
"rpc": [
"https://2648.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.ailayer.xyz",
"wss://testnet-rpc.ailayer.xyz"
],
"shortName": "ailayer-testnet",
"slug": "ailayer-testnet",
"testnet": true
} as const satisfies Chain;
+41
View File
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "AILayer",
"chainId": 2649,
"explorers": [
{
"name": "blockscout",
"url": "https://mainnet-explorer.ailayer.xyz",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmYoqc8rm8PrBg9jqfpsrxd6zdPEqDozbyNVMkBo3QMAFP",
"width": 500,
"height": 500,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmYoqc8rm8PrBg9jqfpsrxd6zdPEqDozbyNVMkBo3QMAFP",
"width": 500,
"height": 500,
"format": "png"
},
"infoURL": "https://ailayer.xyz/",
"name": "AILayer Mainnet",
"nativeCurrency": {
"name": "BTC",
"symbol": "BTC",
"decimals": 18
},
"networkId": 2649,
"rpc": [
"https://2649.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.ailayer.xyz",
"wss://mainnet-rpc.ailayer.xyz"
],
"shortName": "ailayer-mainnet",
"slug": "ailayer",
"testnet": false
} as const satisfies Chain;
+2 -20
View File
@@ -6,34 +6,16 @@ export default {
{
"name": "explorer",
"url": "https://meldscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
"standard": "EIP3091"
},
{
"name": "explorer",
"url": "https://subnets.avax.network/meld",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
},
"infoURL": "https://meld.com",
"name": "Meld",
"nativeCurrency": {
+41
View File
@@ -0,0 +1,41 @@
import type { Chain } from "../src/types";
export default {
"chain": "GTC",
"chainId": 3490,
"explorers": [
{
"name": "GTCScan Explorer",
"url": "https://gtcscan.io",
"standard": "none",
"icon": {
"url": "ipfs://bafybeiaaq7gogws6uqcvo6imxbxfgpdhewybh7bxgtfny2i2as5nidbdje",
"width": 312,
"height": 312,
"format": "png"
}
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafybeiaaq7gogws6uqcvo6imxbxfgpdhewybh7bxgtfny2i2as5nidbdje",
"width": 312,
"height": 312,
"format": "png"
},
"infoURL": "https://gtcscan.io/",
"name": "GTCSCAN",
"nativeCurrency": {
"name": "GTC",
"symbol": "GTC",
"decimals": 18
},
"networkId": 3490,
"rpc": [
"https://3490.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://gtc-dataseed.gtcscan.io/"
],
"shortName": "gtc",
"slip44": 1,
"slug": "gtcscan",
"testnet": false
} as const satisfies Chain;
+6
View File
@@ -10,6 +10,12 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmcumhDxUyoLTHkcMKgPqkpGnnjwSTqE2KGFnDXXFY8mMo",
"width": 40,
"height": 38,
"format": "png"
},
"infoURL": "https://islamicoin.finance",
"name": "iChain Network",
"nativeCurrency": {
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"chain": "iChain Testnet",
"chainId": 3645,
"explorers": [
{
"name": "iChainscan",
"url": "https://test.ichainscan.com",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmcumhDxUyoLTHkcMKgPqkpGnnjwSTqE2KGFnDXXFY8mMo",
"width": 40,
"height": 38,
"format": "png"
},
"infoURL": "https://islamicoin.finance",
"name": "iChain Testnet",
"nativeCurrency": {
"name": "ISLAMICOIN",
"symbol": "ISLAMI",
"decimals": 18
},
"networkId": 3645,
"rpc": [
"https://3645.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://istanbul.ichainscan.com"
],
"shortName": "ISLAMIT",
"slug": "ichain-testnet",
"testnet": true
} as const satisfies Chain;
-6
View File
@@ -16,12 +16,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmZt75xixnEtFzqHTrJa8kJkV4cTXmUZqeMeHM8BcvomQc",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://oho.ai",
"name": "OHO Mainnet",
"nativeCurrency": {
-6
View File
@@ -10,12 +10,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmXARMjJGkXEVEdjUyxkeG4ffsWvEo9vSJpVon3JwRxckS",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://tobechain.net",
"name": "Tobe Chain",
"nativeCurrency": {
+2 -2
View File
@@ -4,8 +4,8 @@ export default {
"chainId": 44,
"explorers": [
{
"name": "subscan",
"url": "https://crab.subscan.io",
"name": "blockscout",
"url": "https://crab-scan.darwinia.network",
"standard": "EIP3091"
}
],
+1 -13
View File
@@ -6,22 +6,10 @@ export default {
{
"name": "etmpscan",
"url": "https://etmscan.network",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmT7DTqT1V2y42pRpt3sj9ifijfmbtkHN7D2vTfAUAS622",
"width": 512,
"height": 512,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmT7DTqT1V2y42pRpt3sj9ifijfmbtkHN7D2vTfAUAS622",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://etm.network",
"name": "Ennothem Mainnet Proterozoic",
"nativeCurrency": {
-6
View File
@@ -10,12 +10,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmT7DTqT1V2y42pRpt3sj9ifijfmbtkHN7D2vTfAUAS622",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://etm.network",
"name": "Ennothem Testnet Pioneer",
"nativeCurrency": {
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"chain": "Avalanche",
"chainId": 51290,
"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": "Test Using Resources",
"nativeCurrency": {
"name": "Test Using Resources Token",
"symbol": "JMH",
"decimals": 18
},
"networkId": 51290,
"redFlags": [],
"rpc": [
"https://51290.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/testsize2/testnet/rpc"
],
"shortName": "Test Using Resources",
"slug": "test-using-resources",
"testnet": true
} as const satisfies Chain;
+1 -13
View File
@@ -6,13 +6,7 @@ export default {
{
"name": "Pentagon Testnet Explorer",
"url": "https://explorer-testnet.pentagon.games",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmfU7W3Tm3tGWgnHBTG9vjB4PXGMvcL7Cq8R6MaSaC33DC",
"width": 512,
"height": 512,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [
@@ -26,12 +20,6 @@ export default {
"name": "EIP1559"
}
],
"icon": {
"url": "ipfs://QmfU7W3Tm3tGWgnHBTG9vjB4PXGMvcL7Cq8R6MaSaC33DC",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://pentagon.games",
"name": "Pentagon Testnet",
"nativeCurrency": {
+5 -5
View File
@@ -4,17 +4,17 @@ export default {
"chainId": 57451,
"explorers": [
{
"name": "coinsec network",
"name": "coinsecnetwork",
"url": "https://explorer.coinsec.network",
"standard": "EIP3091"
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmYV6beVVg3iS9RGPno7GAASpgjyBDoKmWGUcvAKe2nXWK",
"width": 50,
"height": 50,
"format": "png"
"url": "ipfs://QmeUyBe58BPndt6SpH9Tn1a8AYpNtHbMVhVyZt8Ppc4HTB",
"width": 200,
"height": 200,
"format": "svg"
},
"infoURL": "https://explorer.coinsec.network/",
"name": "COINSEC Network",
-6
View File
@@ -16,12 +16,6 @@ export default {
],
"faucets": [],
"features": [],
"icon": {
"url": "ipfs://QmRySLe3su59dE5x5JPm2b1GeZfz6DR9qUzcbp3rt4SD3A",
"width": 300,
"height": 300,
"format": "png"
},
"infoURL": "https://astar.network",
"name": "Astar zKyoto",
"nativeCurrency": {
+2 -1
View File
@@ -26,7 +26,8 @@ export default {
"networkId": 77001,
"rpc": [
"https://77001.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://public-node.api.boraportal.com/bora/mainnet"
"https://public-node.api.boraportal.com/bora/mainnet",
"https://public-node.api.boraportal.io/bora/mainnet"
],
"shortName": "BORAchain",
"slip44": 8217,
-6
View File
@@ -16,12 +16,6 @@ export default {
}
],
"faucets": [],
"icon": {
"url": "ipfs://QmVhezQHkqSZ5Tvtsw18giA1yBjV1URSsBQ7HenUh6p6oC",
"width": 512,
"height": 512,
"format": "png"
},
"infoURL": "https://octa.space",
"name": "OctaSpace",
"nativeCurrency": {
+4 -1
View File
@@ -10,6 +10,7 @@ export default {
}
],
"faucets": [
"https://bartio.faucet.berachain.com",
"https://bartio.faucet.berachain.com/"
],
"features": [],
@@ -19,6 +20,7 @@ export default {
"height": 360,
"format": "png"
},
"infoURL": "https://www.berachain.com",
"name": "Berachain bArtio",
"nativeCurrency": {
"name": "BERA",
@@ -31,7 +33,8 @@ export default {
"https://80084.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://quicknode-rpc.berachain.com",
"https://bartio.rpc.berachain.com",
"https://rpc.ankr.com/berachain_testnet"
"https://rpc.ankr.com/berachain_testnet",
"https://bera-testnet.nodeinfra.com"
],
"shortName": "Berachain",
"slug": "berachain-bartio",
+1 -1
View File
@@ -25,6 +25,6 @@ export default {
"https://subnets.avax.network/testsize/testnet/rpc"
],
"shortName": "Test Using Resources",
"slug": "test-using-resources",
"slug": "test-using-resources-test using resources",
"testnet": true
} as const satisfies Chain;
-6
View File
@@ -12,12 +12,6 @@ export default {
"faucets": [
"https://faucet.blocktonscan.com/"
],
"icon": {
"url": "ipfs://bafkreig3hoedafisrgc6iffdo2jcblm6kov35h72gcblc3zkmt7t4ucwhy",
"width": 800,
"height": 800,
"format": "png"
},
"infoURL": "https://blocktoncoin.com",
"name": "Blockton Blockchain",
"nativeCurrency": {
+1 -13
View File
@@ -6,24 +6,12 @@ export default {
{
"name": "mmtscan",
"url": "https://mmtscan.io",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmaF5gi2CbDKsJ2UchNkjBqmWjv8JEDP3vePBmxeUHiaK4",
"width": 250,
"height": 250,
"format": "png"
}
"standard": "EIP3091"
}
],
"faucets": [
"https://faucet.mmtscan.io/"
],
"icon": {
"url": "ipfs://QmaF5gi2CbDKsJ2UchNkjBqmWjv8JEDP3vePBmxeUHiaK4",
"width": 250,
"height": 250,
"format": "png"
},
"infoURL": "https://mmtchain.io/",
"name": "Mammoth Mainnet",
"nativeCurrency": {
+1 -13
View File
@@ -6,24 +6,12 @@ export default {
{
"name": "Shidoblock Testnet Explorer",
"url": "https://testnet.shidoscan.com",
"standard": "none",
"icon": {
"url": "ipfs://bafkreiatrf5pp7ywvrwvsv4otrex73u6v6bvhorqkxiop2hy2i572zjrba",
"width": 1080,
"height": 1080,
"format": "png"
}
"standard": "none"
}
],
"faucets": [
"https://testnet.shidoscan.com/faucet"
],
"icon": {
"url": "ipfs://bafkreiatrf5pp7ywvrwvsv4otrex73u6v6bvhorqkxiop2hy2i572zjrba",
"width": 1080,
"height": 1080,
"format": "png"
},
"infoURL": "https://www.nexablock.io",
"name": "Shido Testnet Block",
"nativeCurrency": {
+1 -13
View File
@@ -6,22 +6,10 @@ export default {
{
"name": "Shidoblock Mainnet Explorer",
"url": "https://shidoscan.com",
"standard": "none",
"icon": {
"url": "ipfs://bafkreiatrf5pp7ywvrwvsv4otrex73u6v6bvhorqkxiop2hy2i572zjrba",
"width": 1080,
"height": 1080,
"format": "png"
}
"standard": "none"
}
],
"faucets": [],
"icon": {
"url": "ipfs://bafkreiatrf5pp7ywvrwvsv4otrex73u6v6bvhorqkxiop2hy2i572zjrba",
"width": 1080,
"height": 1080,
"format": "png"
},
"infoURL": "https://shido.io",
"name": "Shido Mainnet Block",
"nativeCurrency": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.119",
"version": "0.1.120",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"exports": {
File diff suppressed because one or more lines are too long
+10
View File
@@ -1,5 +1,15 @@
# thirdweb
## 0.14.11
### Patch Changes
- Updated dependencies [[`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- @thirdweb-dev/chains@0.1.120
- @thirdweb-dev/sdk@4.0.98
- @thirdweb-dev/wallets@2.5.38
- @thirdweb-dev/auth@4.1.96
## 0.14.10
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/cli",
"main": "dist/cli/index.js",
"version": "0.14.10",
"version": "0.14.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/react-core
## 4.9.3
### Patch Changes
- Updated dependencies [[`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- @thirdweb-dev/chains@0.1.120
- @thirdweb-dev/sdk@4.0.98
- @thirdweb-dev/wallets@2.5.38
- @thirdweb-dev/auth@4.1.96
## 4.9.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "4.9.2",
"version": "4.9.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/react
## 4.9.3
### Patch Changes
- Updated dependencies [[`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- @thirdweb-dev/chains@0.1.120
- @thirdweb-dev/sdk@4.0.98
- @thirdweb-dev/react-core@4.9.3
- @thirdweb-dev/wallets@2.5.38
## 4.9.2
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "4.9.2",
"version": "4.9.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
Binary file not shown.
+8
View File
@@ -1,5 +1,13 @@
# @thirdweb-dev/sdk
## 4.0.98
### Patch Changes
- Updated dependencies [[`2d7ebe2`](https://github.com/thirdweb-dev/js/commit/2d7ebe2111d24448dd85ace25fc9fdbef987a57d), [`7304c5b`](https://github.com/thirdweb-dev/js/commit/7304c5b0c7060080f302160dc9b24b2becc17524), [`a9ce10f`](https://github.com/thirdweb-dev/js/commit/a9ce10f39ad47f386e8086e230679093aab08754), [`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- thirdweb@5.29.5
- @thirdweb-dev/chains@0.1.120
## 4.0.97
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "4.0.97",
"version": "4.0.98",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/legacy_packages/sdk",
"license": "Apache-2.0",
@@ -129,7 +129,7 @@
}
},
"dependencies": {
"@eth-optimism/sdk": "3.3.0",
"@eth-optimism/sdk": "3.3.2",
"@thirdweb-dev/chains": "workspace:*",
"@thirdweb-dev/contracts-js": "workspace:*",
"@thirdweb-dev/crypto": "workspace:*",
Binary file not shown.
@@ -1,5 +1,15 @@
# @thirdweb-dev/unity-js-bridge
## 0.6.47
### Patch Changes
- Updated dependencies [[`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- @thirdweb-dev/chains@0.1.120
- @thirdweb-dev/sdk@4.0.98
- @thirdweb-dev/wallets@2.5.38
- @thirdweb-dev/auth@4.1.96
## 0.6.46
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.6.46",
"version": "0.6.47",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+8
View File
@@ -1,5 +1,13 @@
# @thirdweb-dev/wallets
## 2.5.38
### Patch Changes
- Updated dependencies [[`321cf26`](https://github.com/thirdweb-dev/js/commit/321cf26342d0755204aa465bc2390e052d5ed071)]:
- @thirdweb-dev/chains@0.1.120
- @thirdweb-dev/sdk@4.0.98
## 2.5.37
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "2.5.37",
"version": "2.5.38",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"browser": {
+10
View File
@@ -1,5 +1,15 @@
# thirdweb
## 5.29.5
### Patch Changes
- [#3356](https://github.com/thirdweb-dev/js/pull/3356) [`2d7ebe2`](https://github.com/thirdweb-dev/js/commit/2d7ebe2111d24448dd85ace25fc9fdbef987a57d) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix ConnectButton theming prop
- [#3364](https://github.com/thirdweb-dev/js/pull/3364) [`7304c5b`](https://github.com/thirdweb-dev/js/commit/7304c5b0c7060080f302160dc9b24b2becc17524) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Respect coinbase wallet create settings when preloading the provider
- [#3347](https://github.com/thirdweb-dev/js/pull/3347) [`a9ce10f`](https://github.com/thirdweb-dev/js/commit/a9ce10f39ad47f386e8086e230679093aab08754) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add ERC721 extension: updateMetadata
## 5.29.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "thirdweb",
"version": "5.29.4",
"version": "5.29.5",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -0,0 +1,5 @@
[
"function updateBatchBaseURI(uint256 _index, string calldata _uri)",
"function freezeBatchBaseURI(uint256 _index)",
"function setMaxTotalSupply(uint256 _maxTotalSupply)"
]
@@ -55,7 +55,7 @@ export async function generateFromAbi(
events.map(async (e) => {
await writeFile(
join(outFolder, extensionFileName, "./events", `${e.name}.ts`),
format(generateEvent(e, extensionName), {
await format(generateEvent(e, extensionName), {
parser: "babel-ts",
trailingComma: "all",
}),
@@ -74,7 +74,7 @@ export async function generateFromAbi(
readFunctions.map(async (f) => {
await writeFile(
join(outFolder, extensionFileName, "./read", `${f.name}.ts`),
format(generateReadFunction(f, extensionName), {
await format(generateReadFunction(f, extensionName), {
parser: "babel-ts",
trailingComma: "all",
}),
@@ -93,7 +93,7 @@ export async function generateFromAbi(
writeFunctions.map(async (f) => {
await writeFile(
join(outFolder, extensionFileName, "./write", `${f.name}.ts`),
format(generateWriteFunction(f, extensionName), {
await format(generateWriteFunction(f, extensionName), {
parser: "babel-ts",
trailingComma: "all",
}),
@@ -163,3 +163,7 @@ export {
type BatchToReveal,
getBatchesToReveal,
} from "../../extensions/erc721/lazyMinting/read/getBatchesToReveal.js";
export {
updateMetadata,
type UpdateMetadataParams,
} from "../../extensions/erc721/drops/write/updateMetadata.js";
@@ -0,0 +1,141 @@
import type { AbiParameterToPrimitiveType } from "abitype";
import type {
BaseTransactionOptions,
WithOverrides,
} from "../../../../../transaction/types.js";
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
import { once } from "../../../../../utils/promise/once.js";
import type { ThirdwebContract } from "../../../../../contract/contract.js";
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
/**
* Represents the parameters for the "freezeBatchBaseURI" function.
*/
export type FreezeBatchBaseURIParams = WithOverrides<{
index: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_index" }>;
}>;
export const FN_SELECTOR = "0xa07ced9e" as const;
const FN_INPUTS = [
{
type: "uint256",
name: "_index",
},
] as const;
const FN_OUTPUTS = [] as const;
/**
* Checks if the `freezeBatchBaseURI` method is supported by the given contract.
* @param contract The ThirdwebContract.
* @returns A promise that resolves to a boolean indicating if the `freezeBatchBaseURI` method is supported.
* @extension ERC721
* @example
* ```ts
* import { isFreezeBatchBaseURISupported } from "thirdweb/extensions/erc721";
*
* const supported = await isFreezeBatchBaseURISupported(contract);
* ```
*/
export async function isFreezeBatchBaseURISupported(
contract: ThirdwebContract<any>,
) {
return detectMethod({
contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
});
}
/**
* Encodes the parameters for the "freezeBatchBaseURI" function.
* @param options - The options for the freezeBatchBaseURI function.
* @returns The encoded ABI parameters.
* @extension ERC721
* @example
* ```ts
* import { encodeFreezeBatchBaseURIParams } "thirdweb/extensions/erc721";
* const result = encodeFreezeBatchBaseURIParams({
* index: ...,
* });
* ```
*/
export function encodeFreezeBatchBaseURIParams(
options: FreezeBatchBaseURIParams,
) {
return encodeAbiParameters(FN_INPUTS, [options.index]);
}
/**
* Encodes the "freezeBatchBaseURI" function into a Hex string with its parameters.
* @param options - The options for the freezeBatchBaseURI function.
* @returns The encoded hexadecimal string.
* @extension ERC721
* @example
* ```ts
* import { encodeFreezeBatchBaseURI } "thirdweb/extensions/erc721";
* const result = encodeFreezeBatchBaseURI({
* index: ...,
* });
* ```
*/
export function encodeFreezeBatchBaseURI(options: FreezeBatchBaseURIParams) {
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
// we can do this because we know the specific formats of the values
return (FN_SELECTOR +
encodeFreezeBatchBaseURIParams(options).slice(
2,
)) as `${typeof FN_SELECTOR}${string}`;
}
/**
* Prepares a transaction to call the "freezeBatchBaseURI" function on the contract.
* @param options - The options for the "freezeBatchBaseURI" function.
* @returns A prepared transaction object.
* @extension ERC721
* @example
* ```ts
* import { freezeBatchBaseURI } from "thirdweb/extensions/erc721";
*
* const transaction = freezeBatchBaseURI({
* contract,
* index: ...,
* overrides: {
* ...
* }
* });
*
* // Send the transaction
* ...
*
* ```
*/
export function freezeBatchBaseURI(
options: BaseTransactionOptions<
| FreezeBatchBaseURIParams
| {
asyncParams: () => Promise<FreezeBatchBaseURIParams>;
}
>,
) {
const asyncOptions = once(async () => {
return "asyncParams" in options ? await options.asyncParams() : options;
});
return prepareContractCall({
contract: options.contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
params: async () => {
const resolvedOptions = await asyncOptions();
return [resolvedOptions.index] as const;
},
value: async () => (await asyncOptions()).overrides?.value,
accessList: async () => (await asyncOptions()).overrides?.accessList,
gas: async () => (await asyncOptions()).overrides?.gas,
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
maxPriorityFeePerGas: async () =>
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
nonce: async () => (await asyncOptions()).overrides?.nonce,
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
});
}
@@ -0,0 +1,144 @@
import type { AbiParameterToPrimitiveType } from "abitype";
import type {
BaseTransactionOptions,
WithOverrides,
} from "../../../../../transaction/types.js";
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
import { once } from "../../../../../utils/promise/once.js";
import type { ThirdwebContract } from "../../../../../contract/contract.js";
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
/**
* Represents the parameters for the "setMaxTotalSupply" function.
*/
export type SetMaxTotalSupplyParams = WithOverrides<{
maxTotalSupply: AbiParameterToPrimitiveType<{
type: "uint256";
name: "_maxTotalSupply";
}>;
}>;
export const FN_SELECTOR = "0x3f3e4c11" as const;
const FN_INPUTS = [
{
type: "uint256",
name: "_maxTotalSupply",
},
] as const;
const FN_OUTPUTS = [] as const;
/**
* Checks if the `setMaxTotalSupply` method is supported by the given contract.
* @param contract The ThirdwebContract.
* @returns A promise that resolves to a boolean indicating if the `setMaxTotalSupply` method is supported.
* @extension ERC721
* @example
* ```ts
* import { isSetMaxTotalSupplySupported } from "thirdweb/extensions/erc721";
*
* const supported = await isSetMaxTotalSupplySupported(contract);
* ```
*/
export async function isSetMaxTotalSupplySupported(
contract: ThirdwebContract<any>,
) {
return detectMethod({
contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
});
}
/**
* Encodes the parameters for the "setMaxTotalSupply" function.
* @param options - The options for the setMaxTotalSupply function.
* @returns The encoded ABI parameters.
* @extension ERC721
* @example
* ```ts
* import { encodeSetMaxTotalSupplyParams } "thirdweb/extensions/erc721";
* const result = encodeSetMaxTotalSupplyParams({
* maxTotalSupply: ...,
* });
* ```
*/
export function encodeSetMaxTotalSupplyParams(
options: SetMaxTotalSupplyParams,
) {
return encodeAbiParameters(FN_INPUTS, [options.maxTotalSupply]);
}
/**
* Encodes the "setMaxTotalSupply" function into a Hex string with its parameters.
* @param options - The options for the setMaxTotalSupply function.
* @returns The encoded hexadecimal string.
* @extension ERC721
* @example
* ```ts
* import { encodeSetMaxTotalSupply } "thirdweb/extensions/erc721";
* const result = encodeSetMaxTotalSupply({
* maxTotalSupply: ...,
* });
* ```
*/
export function encodeSetMaxTotalSupply(options: SetMaxTotalSupplyParams) {
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
// we can do this because we know the specific formats of the values
return (FN_SELECTOR +
encodeSetMaxTotalSupplyParams(options).slice(
2,
)) as `${typeof FN_SELECTOR}${string}`;
}
/**
* Prepares a transaction to call the "setMaxTotalSupply" function on the contract.
* @param options - The options for the "setMaxTotalSupply" function.
* @returns A prepared transaction object.
* @extension ERC721
* @example
* ```ts
* import { setMaxTotalSupply } from "thirdweb/extensions/erc721";
*
* const transaction = setMaxTotalSupply({
* contract,
* maxTotalSupply: ...,
* overrides: {
* ...
* }
* });
*
* // Send the transaction
* ...
*
* ```
*/
export function setMaxTotalSupply(
options: BaseTransactionOptions<
| SetMaxTotalSupplyParams
| {
asyncParams: () => Promise<SetMaxTotalSupplyParams>;
}
>,
) {
const asyncOptions = once(async () => {
return "asyncParams" in options ? await options.asyncParams() : options;
});
return prepareContractCall({
contract: options.contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
params: async () => {
const resolvedOptions = await asyncOptions();
return [resolvedOptions.maxTotalSupply] as const;
},
value: async () => (await asyncOptions()).overrides?.value,
accessList: async () => (await asyncOptions()).overrides?.accessList,
gas: async () => (await asyncOptions()).overrides?.gas,
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
maxPriorityFeePerGas: async () =>
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
nonce: async () => (await asyncOptions()).overrides?.nonce,
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
});
}
@@ -0,0 +1,149 @@
import type { AbiParameterToPrimitiveType } from "abitype";
import type {
BaseTransactionOptions,
WithOverrides,
} from "../../../../../transaction/types.js";
import { prepareContractCall } from "../../../../../transaction/prepare-contract-call.js";
import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
import { once } from "../../../../../utils/promise/once.js";
import type { ThirdwebContract } from "../../../../../contract/contract.js";
import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
/**
* Represents the parameters for the "updateBatchBaseURI" function.
*/
export type UpdateBatchBaseURIParams = WithOverrides<{
index: AbiParameterToPrimitiveType<{ type: "uint256"; name: "_index" }>;
uri: AbiParameterToPrimitiveType<{ type: "string"; name: "_uri" }>;
}>;
export const FN_SELECTOR = "0xde903ddd" as const;
const FN_INPUTS = [
{
type: "uint256",
name: "_index",
},
{
type: "string",
name: "_uri",
},
] as const;
const FN_OUTPUTS = [] as const;
/**
* Checks if the `updateBatchBaseURI` method is supported by the given contract.
* @param contract The ThirdwebContract.
* @returns A promise that resolves to a boolean indicating if the `updateBatchBaseURI` method is supported.
* @extension ERC721
* @example
* ```ts
* import { isUpdateBatchBaseURISupported } from "thirdweb/extensions/erc721";
*
* const supported = await isUpdateBatchBaseURISupported(contract);
* ```
*/
export async function isUpdateBatchBaseURISupported(
contract: ThirdwebContract<any>,
) {
return detectMethod({
contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
});
}
/**
* Encodes the parameters for the "updateBatchBaseURI" function.
* @param options - The options for the updateBatchBaseURI function.
* @returns The encoded ABI parameters.
* @extension ERC721
* @example
* ```ts
* import { encodeUpdateBatchBaseURIParams } "thirdweb/extensions/erc721";
* const result = encodeUpdateBatchBaseURIParams({
* index: ...,
* uri: ...,
* });
* ```
*/
export function encodeUpdateBatchBaseURIParams(
options: UpdateBatchBaseURIParams,
) {
return encodeAbiParameters(FN_INPUTS, [options.index, options.uri]);
}
/**
* Encodes the "updateBatchBaseURI" function into a Hex string with its parameters.
* @param options - The options for the updateBatchBaseURI function.
* @returns The encoded hexadecimal string.
* @extension ERC721
* @example
* ```ts
* import { encodeUpdateBatchBaseURI } "thirdweb/extensions/erc721";
* const result = encodeUpdateBatchBaseURI({
* index: ...,
* uri: ...,
* });
* ```
*/
export function encodeUpdateBatchBaseURI(options: UpdateBatchBaseURIParams) {
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
// we can do this because we know the specific formats of the values
return (FN_SELECTOR +
encodeUpdateBatchBaseURIParams(options).slice(
2,
)) as `${typeof FN_SELECTOR}${string}`;
}
/**
* Prepares a transaction to call the "updateBatchBaseURI" function on the contract.
* @param options - The options for the "updateBatchBaseURI" function.
* @returns A prepared transaction object.
* @extension ERC721
* @example
* ```ts
* import { updateBatchBaseURI } from "thirdweb/extensions/erc721";
*
* const transaction = updateBatchBaseURI({
* contract,
* index: ...,
* uri: ...,
* overrides: {
* ...
* }
* });
*
* // Send the transaction
* ...
*
* ```
*/
export function updateBatchBaseURI(
options: BaseTransactionOptions<
| UpdateBatchBaseURIParams
| {
asyncParams: () => Promise<UpdateBatchBaseURIParams>;
}
>,
) {
const asyncOptions = once(async () => {
return "asyncParams" in options ? await options.asyncParams() : options;
});
return prepareContractCall({
contract: options.contract,
method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS] as const,
params: async () => {
const resolvedOptions = await asyncOptions();
return [resolvedOptions.index, resolvedOptions.uri] as const;
},
value: async () => (await asyncOptions()).overrides?.value,
accessList: async () => (await asyncOptions()).overrides?.accessList,
gas: async () => (await asyncOptions()).overrides?.gas,
gasPrice: async () => (await asyncOptions()).overrides?.gasPrice,
maxFeePerGas: async () => (await asyncOptions()).overrides?.maxFeePerGas,
maxPriorityFeePerGas: async () =>
(await asyncOptions()).overrides?.maxPriorityFeePerGas,
nonce: async () => (await asyncOptions()).overrides?.nonce,
extraGas: async () => (await asyncOptions()).overrides?.extraGas,
});
}
@@ -0,0 +1,127 @@
import { beforeEach, describe, expect, it } from "vitest";
import { ANVIL_CHAIN } from "~test/chains.js";
import { TEST_CLIENT } from "~test/test-clients.js";
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
import {
type ThirdwebContract,
getContract,
} from "../../../../contract/contract.js";
import { deployERC721Contract } from "../../../../extensions/prebuilts/deploy-erc721.js";
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
import type { NFTInput } from "../../../../utils/nft/parseNft.js";
import { getNFT } from "../../read/getNFT.js";
import { getNFTs } from "../../read/getNFTs.js";
import { lazyMint } from "../../write/lazyMint.js";
import { getUpdateMetadataParams, updateMetadata } from "./updateMetadata.js";
let contract: ThirdwebContract;
const account = TEST_ACCOUNT_A;
const client = TEST_CLIENT;
const chain = ANVIL_CHAIN;
describe("erc721: updateMetadata", () => {
beforeEach(async () => {
const address = await deployERC721Contract({
client,
chain,
account,
type: "DropERC721",
params: {
name: "NFTDrop",
},
});
contract = getContract({
address,
client,
chain,
});
});
it("should update the metadata for the selected token | case 1", async () => {
const metadatas: NFTInput[] = [
{ name: "token 0" },
{ name: "token 1" },
{ name: "token 2" },
];
const lazyMintTx = lazyMint({ contract, nfts: metadatas });
await sendAndConfirmTransaction({ transaction: lazyMintTx, account });
const transaction = updateMetadata({
contract,
targetTokenId: 0n,
newMetadata: { name: "token 0 - updated" },
client,
});
await sendAndConfirmTransaction({ transaction, account });
const nfts = await getNFTs({ contract });
expect(nfts[0]?.metadata.name).toBe("token 0 - updated");
// The other tokens should not change
expect(nfts[1]?.metadata.name).toBe("token 1");
expect(nfts[2]?.metadata.name).toBe("token 2");
});
it("should update the metadata for the selected token | case 2", async () => {
const nftBatch1: NFTInput[] = [
{ name: "token 0" },
{ name: "token 1" },
{ name: "token 2" },
];
const batch1 = lazyMint({ contract, nfts: nftBatch1 });
await sendAndConfirmTransaction({ transaction: batch1, account });
const nftBatch2: NFTInput[] = [
{ name: "token 3" },
{ name: "token 4" },
{ name: "token 5" },
];
const batch2 = lazyMint({ contract, nfts: nftBatch2 });
await sendAndConfirmTransaction({ transaction: batch2, account });
// firstly, update the token in the first batch
const transaction1 = updateMetadata({
contract,
targetTokenId: 0n,
newMetadata: { name: "token 0 - updated" },
client,
});
await sendAndConfirmTransaction({ transaction: transaction1, account });
const nft = await getNFT({ contract, tokenId: 0n });
expect(nft.metadata.name).toBe("token 0 - updated");
const tokenUriAfterUpdatedFirstTime = nft.tokenURI;
// Update token in the second batch
const transaction2 = updateMetadata({
contract,
targetTokenId: 5n,
newMetadata: { name: "token 5 - updated" },
client,
});
await sendAndConfirmTransaction({ transaction: transaction2, account });
const allNfts = await getNFTs({ contract });
expect(allNfts[0]?.metadata.name).toBe("token 0 - updated");
expect(allNfts.at(-1)?.metadata.name).toBe("token 5 - updated");
// The tokenUri of tokenId#0 after the second updateMetadata should still be the same
// since it belong to another batch
expect(allNfts[0]?.tokenURI).toBe(tokenUriAfterUpdatedFirstTime);
});
it("should throw error if there's no batch", async () => {
await expect(() =>
getUpdateMetadataParams({
contract,
targetTokenId: 0n,
newMetadata: { name: "token 0 - updated" },
client,
}),
).rejects.toThrowError(
"No base URI set. Please set a base URI before updating metadata",
);
});
});
@@ -0,0 +1,123 @@
import type { ThirdwebClient } from "../../../../client/client.js";
import type { BaseTransactionOptions } from "../../../../transaction/types.js";
import type { NFT, NFTInput } from "../../../../utils/nft/parseNft.js";
import {
type UpdateBatchBaseURIParams,
updateBatchBaseURI,
} from "../../__generated__/DropERC721/write/updateBatchBaseURI.js";
import { getBaseURICount } from "../../__generated__/IBatchMintMetadata/read/getBaseURICount.js";
export type UpdateMetadataParams = {
targetTokenId: bigint;
newMetadata: NFTInput;
client: ThirdwebClient;
};
/**
* @internal
*/
export async function getUpdateMetadataParams(
options: BaseTransactionOptions<UpdateMetadataParams>,
): Promise<UpdateBatchBaseURIParams> {
const { contract, targetTokenId, newMetadata, client } = options;
const batchCount = await getBaseURICount(options);
if (batchCount === 0n) {
throw new Error(
"No base URI set. Please set a base URI before updating metadata",
);
}
// Look for the batchId & determine the start + end tokenId of the batch
const [{ getBatchIdAtIndex }, { getNFT }] = await Promise.all([
import("../../__generated__/IBatchMintMetadata/read/getBatchIdAtIndex.js"),
import("../../read/getNFT.js"),
]);
let startTokenId = 0n;
let endTokenId = 0n;
let batchIndex = 0n;
for (let i = 0n; i < batchCount; i += 1n) {
batchIndex = i;
endTokenId = await getBatchIdAtIndex({ contract, index: batchIndex });
if (endTokenId > targetTokenId) {
break;
}
startTokenId = endTokenId;
}
const range = Array.from(
{ length: Number(endTokenId - startTokenId) },
(_, k) => BigInt(k) + startTokenId,
);
const currentMetadatas = await Promise.all(
range.map((id) => getNFT({ contract, tokenId: id, includeOwner: false })),
);
// Abort if any of the items failed to load
if (currentMetadatas.some((item) => item === undefined || !item.tokenURI)) {
throw new Error(
`Failed to load all ${range.length} items from batchIndex: ${batchIndex}`,
);
}
const newMetadatas: NFTInput[] = [];
for (let i = 0; i < currentMetadatas.length; i++) {
const { id, metadata } = currentMetadatas[i] as NFT;
if (targetTokenId === id) {
newMetadatas.push(newMetadata);
} else {
newMetadatas.push(metadata);
}
}
const { uploadOrExtractURIs } = await import("../../../../utils/ipfs.js");
const batchOfUris = await uploadOrExtractURIs(
newMetadatas,
client,
Number(startTokenId),
);
if (!batchOfUris || !batchOfUris.length || !batchOfUris[0]) {
throw new Error("Failed to upload batch of new metadatas");
}
const baseUri = batchOfUris[0].substring(0, batchOfUris[0].lastIndexOf("/"));
// IMPORTANT: The new ipfs URI must have the trailing slash at the end
// this is required by the Drop contract
const uri = `${baseUri}/`;
return { index: batchIndex, uri };
}
/**
* Update the metadata of the single token in an NFT Drop (DropERC721) collection
* For NFT Collection, please use `setTokenURI`
* @param options
* @returns the prepared transaction
* @extension ERC721
* @example
* ```ts
* import { updateMetadata } from "thirdweb/extensions/erc721";
*
* const transaction = updateMetadata({
* contract,
* targetTokenId: 0n,
* newMetadata: {
* name: "this is the new nft name",
* description: "...",
* image: "new image uri"
* // ...
* }
* });
* ```
*/
export function updateMetadata(
options: BaseTransactionOptions<UpdateMetadataParams>,
) {
const { contract } = options;
return updateBatchBaseURI({
contract,
asyncParams: async () => getUpdateMetadataParams(options),
});
}
@@ -41,12 +41,7 @@ export function isValidTheme(theme: unknown): theme is Theme {
return (
theme === "dark" ||
theme === "light" ||
(typeof theme === "object" &&
theme !== null &&
"colors" in theme &&
"fontSizes" in theme &&
"radii" in theme &&
"space" in theme)
(typeof theme === "object" && theme !== null && "colors" in theme)
);
}
@@ -2,6 +2,7 @@ import { useQueries } from "@tanstack/react-query";
import type { ThirdwebClient } from "../../../client/client.js";
import { COINBASE } from "../../../wallets/constants.js";
import type { Wallet } from "../../../wallets/interfaces/wallet.js";
import type { CreateWalletArgs } from "../../../wallets/wallet-types.js";
export function usePreloadWalletProviders({
client,
@@ -18,7 +19,9 @@ export function usePreloadWalletProviders({
const { getCoinbaseWebProvider } = await import(
"../../../wallets/coinbase/coinbaseWebSDK.js"
);
await getCoinbaseWebProvider();
await getCoinbaseWebProvider(
w.getConfig() as CreateWalletArgs<typeof COINBASE>[1],
);
// return _something_
return true;
}
Binary file not shown.
+4 -9
View File
@@ -1091,8 +1091,8 @@ importers:
legacy_packages/sdk:
dependencies:
'@eth-optimism/sdk':
specifier: 3.3.0
version: 3.3.0([email protected])
specifier: 3.3.2
version: 3.3.2([email protected])
'@thirdweb-dev/chains':
specifier: workspace:*
version: link:../chains
@@ -6553,10 +6553,6 @@ packages:
resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
/@eth-optimism/[email protected]:
resolution: {integrity: sha512-YVwPHpBZgFwFX9qY8+iToVAAH7mSnVIVmih+YfHhqjAhlLvLZfYjvj+hRNgcB9eRyl1SOOB0jevp4JOOV1v2BA==}
dev: false
/@eth-optimism/[email protected]([email protected]):
resolution: {integrity: sha512-vQ04wfG9kMf1Fwy3FEMqH2QZbgS0gldKhcBeBUPfO8zu68L61VI97UDXmsMQXzTsEAxK8HnokW3/gosl4/NW3w==}
peerDependencies:
@@ -6618,13 +6614,12 @@ packages:
- utf-8-validate
dev: false
/@eth-optimism/[email protected].0([email protected]):
resolution: {integrity: sha512-0Wt9roWe3itdzp08caCQLoFqhmT47ssquKAzBe7yXI6saVL+f2vWl6VgEaq0aYe2FsWvD9L0tSAJHLx1FiquNw==}
/@eth-optimism/[email protected].2([email protected]):
resolution: {integrity: sha512-+zhxT0YkBIEzHsuIayQGjr8g9NawZo6/HYfzg1NSEFsE2Yt0NyCWqVDFTuuak0T6AvIa2kNcl3r0Z8drdb2QmQ==}
peerDependencies:
ethers: ^5
dependencies:
'@eth-optimism/contracts': 0.6.0([email protected])
'@eth-optimism/contracts-bedrock': 0.17.2
'@eth-optimism/core-utils': 0.13.2
ethers: 5.7.2
lodash: 4.17.21