Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
03d1a6d73b Version Packages (#1311)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-11 14:34:02 -07:00
YashandGitHub fd74d79180 [Chains] Update chains: Linea Mainnet (#1320) 2023-07-11 17:42:19 +00:00
Jonas DanielsandGitHub 35f20ceb4f [all] add package resolutions (#1315) 2023-07-11 01:27:22 +00:00
iketwandGitHub db68bd04cd Passes API key to all packages (#1314) 2023-07-10 23:06:05 +00:00
Manan TankandGitHub 3df86ad16f [react] ConnectWallet UI fixes (#1310) 2023-07-10 15:42:50 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
4389083ca3 Version Packages (#1294)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-09 22:16:24 -07:00
Jonas DanielsandGitHub 4961b597a0 unblock storage (#1309) 2023-07-10 04:54:23 +00:00
nkrishangandGitHub 7e044c664d [SDK] Create ERC721LoyaltyCard and ERC721UpdatableMetadata (#1299) 2023-07-08 00:55:24 +00:00
iketwandGitHub 498df5d69a [RN] Fix ImageSvgUri render by trying Image first (#1306) 2023-07-07 16:47:53 +00:00
Nacho IacovinoandGitHub b8d4930305 [SDK] Add social_urls to CommonContractSchema (#1305) 2023-07-07 16:30:51 +00:00
Nacho IacovinoandGitHub 2c0bb07899 [SDK] Fix pack code snippets (#1304) 2023-07-07 15:24:34 +00:00
Joaquim VergesandGitHub 72ada47596 [SDK] Proper handling of custom contract metadata types (#1298) 2023-07-07 04:38:27 +00:00
iketwandGitHub dc9eee735c [RN] Improve svg rendering (#1300) 2023-07-07 00:46:12 +00:00
Adam MajmudarandGitHub b4aee9b591 [Wallets] Add all supported chains to safe server urls (#1301) 2023-07-07 00:38:39 +00:00
FirekeeperandGitHub b5c6eedb38 Firekeeper/default chains zksync (#1297) 2023-07-06 22:22:02 +00:00
iketwandGitHub 8672c8533c Ike/demo (#1283) 2023-07-06 22:08:04 +00:00
FirekeeperandGitHub bb207473f8 Firekeeper/default wallets wcv2 (#1293) 2023-07-06 21:00:46 +00:00
Tair AsimandGitHub 10b3a717da fix: handling authz errors from smart wallet connector (#1292) 2023-07-06 19:08:49 +00:00
Josh SteinandGitHub aa81bedaf2 deps: change Taro to Bubs testnet (#1289) 2023-07-06 03:56:52 +00:00
101 changed files with 1826 additions and 519 deletions
+19
View File
@@ -51,5 +51,24 @@
},
"manypkg": {
"defaultBranch": "main"
},
"pnpm": {
"overrides": {
"cross-fetch@>=3.0.0 <3.1.5": ">=3.1.5",
"got@<11.8.5": ">=11.8.5",
"glob-parent@<5.1.2": ">=5.1.2",
"node-fetch@<2.6.7": ">=2.6.7",
"nth-check@<2.0.1": ">=2.0.1",
"socket.io-parser@>=4.0.4 <4.2.3": ">=4.2.3",
"fast-xml-parser@<4.2.4": ">=4.2.4",
"@openzeppelin/contracts@>=4.3.0 <4.9.1": ">=4.9.1",
"@openzeppelin/contracts@>=4.7.0 <4.9.2": ">=4.9.2",
"xml2js@<0.5.0": ">=0.5.0",
"engine.io@>=5.1.0 <6.4.2": ">=6.4.2",
"semver@<7.5.2": ">=7.5.2",
"json5@<1.0.2": ">=1.0.2",
"protobufjs@>=6.10.0 <7.2.4": ">=7.2.4",
"tough-cookie@<4.1.3": ">=4.1.3"
}
}
}
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/auth
## 3.2.10
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@1.0.6
## 3.2.9
### Patch Changes
- Updated dependencies [[`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03), [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58)]:
- @thirdweb-dev/wallets@1.0.5
## 3.2.8
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.2.8",
"version": "3.2.10",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+18
View File
@@ -1,5 +1,23 @@
# @thirdweb-dev/chains
## 0.1.29
### Patch Changes
- [#1320](https://github.com/thirdweb-dev/js/pull/1320) [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Linea mainnet support
- [#1315](https://github.com/thirdweb-dev/js/pull/1315) [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a) Thanks [@jnsdls](https://github.com/jnsdls)! - add more chains
## 0.1.28
### Patch Changes
- [#1299](https://github.com/thirdweb-dev/js/pull/1299) [`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5) Thanks [@nkrishang](https://github.com/nkrishang)! - Add ERC721LoyaltyCard and ERC721UpdatableMetadata
- [#1297](https://github.com/thirdweb-dev/js/pull/1297) [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - add zksync as default chain
- [#1309](https://github.com/thirdweb-dev/js/pull/1309) [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352) Thanks [@jnsdls](https://github.com/jnsdls)! - unblock storage domains
## 0.1.27
### Patch Changes
+38
View File
@@ -0,0 +1,38 @@
import type { Chain } from "../src/types";
export default {
"name": "ShimmerEVM Testnet",
"title": "ShimmerEVM Testnet",
"chain": "ShimmerEVM",
"icon": {
"url": "ipfs://bafkreibky2sy6qhi6arktayvologkrgu5kudpgdxfkx4uosbvmstz7v4di",
"width": 720,
"height": 720,
"format": "png"
},
"rpc": [
"https://shimmerevm-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://json-rpc.evm.testnet.shimmer.network"
],
"faucets": [
"https://evm-toolkit.evm.testnet.shimmer.network",
"https://evm-faucet.testnet.shimmer.network"
],
"nativeCurrency": {
"name": "SMR",
"symbol": "SMR",
"decimals": 6
},
"infoURL": "https://shimmer.network",
"shortName": "shimmerevm-testnet",
"chainId": 1072,
"networkId": 1072,
"explorers": [
{
"name": "explorer",
"url": "https://explorer.evm.testnet.shimmer.network",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "shimmerevm-testnet"
} as const satisfies Chain;
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"name": "Mintara Testnet",
"title": "Mintara Testnet",
"chain": "Mintara",
"icon": {
"url": "ipfs://bafybeie7jzlzlpz7c3a3oh4x5joej23dj2qf3cexmchjyc72hv3fblcaja",
"width": 256,
"height": 256,
"format": "png"
},
"rpc": [
"https://mintara-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/mintara/testnet/rpc"
],
"faucets": [],
"nativeCurrency": {
"name": "MINTARA",
"symbol": "MNTR",
"decimals": 18
},
"infoURL": "https://playthink.co.jp",
"shortName": "mintara-testnet",
"chainId": 1079,
"networkId": 1079,
"explorers": [
{
"name": "explorer",
"url": "https://subnets-test.avax.network/mintara",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "mintara-testnet"
} as const satisfies Chain;
+9 -9
View File
@@ -1,8 +1,8 @@
import type { Chain } from "../src/types";
export default {
"name": "Taro Testnet",
"name": "Bubs Testnet",
"chain": "gETH",
"shortName": "Taro",
"shortName": "Bubs",
"chainId": 1582,
"testnet": true,
"icon": {
@@ -12,8 +12,8 @@ export default {
"height": 512
},
"rpc": [
"https://taro-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://taro-testnet.calderachain.xyz/http"
"https://bubs-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://bubs.calderachain.xyz/http"
],
"nativeCurrency": {
"decimals": 18,
@@ -22,15 +22,15 @@ export default {
},
"explorers": [
{
"url": "https://explorer.tarotestnet.com",
"name": "Taro Testnet Explorer",
"url": "https://explorer.bubstestnet.com",
"name": "Bubs Testnet Explorer",
"standard": "EIP3091"
}
],
"faucets": [
"https://tarotestnet.com"
"https://bubstestnet.com"
],
"infoURL": "https://tarotestnet.com",
"infoURL": "https://bubstestnet.com",
"networkId": 1582,
"slug": "taro-testnet"
"slug": "bubs-testnet"
} as const satisfies Chain;
+44
View File
@@ -0,0 +1,44 @@
import type { Chain } from "../src/types";
export default {
"name": "Moonsama Network",
"chain": "MSN",
"rpc": [
"https://moonsama-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.moonsama.com",
"wss://rpc.moonsama.com/ws"
],
"faucets": [
"https://multiverse.moonsama.com/faucet"
],
"nativeCurrency": {
"name": "Sama Token",
"symbol": "SAMA",
"decimals": 18
},
"infoURL": "https://moonsama.com",
"shortName": "msn",
"chainId": 2199,
"networkId": 2199,
"slip44": 2199,
"icon": {
"url": "ipfs://QmaQxfwpXYTomUd24PMx5tKjosupXcm99z1jL1XLq9LWBS",
"width": 468,
"height": 468,
"format": "png"
},
"explorers": [
{
"name": "blockscout",
"url": "https://explorer.moonsama.com",
"icon": {
"url": "ipfs://bafybeifu5tpui7dk5cjoo54kde7pmuthvnl7sdykobuarsxgu7t2izurnq",
"width": 512,
"height": 512,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "moonsama-network"
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "Plinga Mainnet",
"chain": "Plinga",
"icon": {
"url": "ipfs://bafybeibpvlod5nyev6wyuvp6pbestmgvru3ovbadsul32odpno26xwld6y",
"width": 1039,
"height": 1022,
"format": "svg"
},
"rpc": [
"https://plinga.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpcurl.mainnet.plgchain.com",
"https://rpcurl.plgchain.blockchain.evmnode.online",
"https://rpcurl.mainnet.plgchain.plinga.technology"
],
"faucets": [],
"nativeCurrency": {
"name": "Plinga",
"symbol": "PLINGA",
"decimals": 18
},
"infoURL": "https://www.plinga.technology/",
"shortName": "plgchain",
"chainId": 242,
"networkId": 242,
"explorers": [
{
"name": "plgscan",
"url": "https://www.plgscan.com",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "plinga"
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "Botanix Testnet",
"chain": "BTC",
"icon": {
"url": "ipfs://Qmf2iSjcrZwUDKhCVY9ZzfbSV2He2HSssbcG2yMz1mDerm",
"width": 32,
"height": 32,
"format": "png"
},
"rpc": [
"https://botanix-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.btxtestchain.com"
],
"faucets": [
"https://faucet.btxtestchain.com"
],
"nativeCurrency": {
"name": "Botanix",
"symbol": "BTC",
"decimals": 18
},
"infoURL": "https://btxtestchain.com",
"shortName": "BTCt",
"chainId": 3636,
"networkId": 3636,
"explorers": [
{
"name": "Botanix",
"url": "https://testnet.btxtestchain.com",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "botanix-testnet"
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "Botanix Mainnet",
"chain": "BTC",
"icon": {
"url": "ipfs://Qmf2iSjcrZwUDKhCVY9ZzfbSV2He2HSssbcG2yMz1mDerm",
"width": 32,
"height": 32,
"format": "png"
},
"rpc": [
"https://botanix.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.btxtestchain.com"
],
"faucets": [
"https://faucet.btxtestchain.com"
],
"nativeCurrency": {
"name": "Botanix",
"symbol": "BTC",
"decimals": 18
},
"infoURL": "https://btxtestchain.com",
"shortName": "BTCm",
"chainId": 3637,
"networkId": 3637,
"explorers": [
{
"name": "Botanix",
"url": "https://btxtestchain.com",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "botanix"
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "SenjePowers Testnet",
"chain": "SPC",
"icon": {
"url": "ipfs://QmcpyTj4hUyHJZ2VmSdkXFpPpRcNKRP1VxMs7Cp1anymNy",
"width": 504,
"height": 495,
"format": "png"
},
"rpc": [
"https://senjepowers-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://testnet-rpc.senjepowersscan.com"
],
"faucets": [
"https://faucet.senjepowersscan.com"
],
"nativeCurrency": {
"name": "SenjePowers",
"symbol": "SPC",
"decimals": 18
},
"infoURL": "https://senjepowersscan.com",
"shortName": "SPCt",
"chainId": 3698,
"networkId": 3698,
"explorers": [
{
"name": "SenjePowers",
"url": "https://testnet.senjepowersscan.com",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "senjepowers-testnet"
} as const satisfies Chain;
+48
View File
@@ -0,0 +1,48 @@
import type { Chain } from "../src/types";
export default {
"name": "AltLayer Zero Gas Network",
"chain": "ETH",
"rpc": [
"https://altlayer-zero-gas-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zero.alt.technology"
],
"faucets": [],
"nativeCurrency": {
"name": "ZERO",
"symbol": "ZERO",
"decimals": 18
},
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"infoURL": "https://altlayer.io",
"shortName": "alt-zerogas",
"chainId": 4000003,
"networkId": 4000003,
"icon": {
"url": "ipfs://QmcEfZJU7NMn9ycTAcEooQgGNfa2nYBToSUZHdFCFadcjb",
"width": 1080,
"height": 1025,
"format": "png"
},
"explorers": [
{
"name": "blockscout",
"url": "https://zero-explorer.alt.technology",
"icon": {
"url": "ipfs://bafybeifu5tpui7dk5cjoo54kde7pmuthvnl7sdykobuarsxgu7t2izurnq",
"width": 512,
"height": 512,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "altlayer-zero-gas-network"
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "MEVerse Chain Testnet",
"chain": "MEVerse",
"rpc": [
"https://meverse-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.meversetestnet.io"
],
"faucets": [],
"nativeCurrency": {
"name": "MEVerse",
"symbol": "MEV",
"decimals": 18
},
"infoURL": "https://www.meverse.sg",
"shortName": "TESTMEV",
"chainId": 4759,
"networkId": 4759,
"icon": {
"url": "ipfs://QmPuQ6gaCfUtNdRuaEDbdhot2m2KCy2ZHCJUvZXJAtdeyJ",
"width": 800,
"height": 800,
"format": "png"
},
"explorers": [
{
"name": "MEVerse Chain Testnet Explorer",
"url": "https://testnet.meversescan.io",
"standard": "none",
"icon": {
"url": "ipfs://QmPuQ6gaCfUtNdRuaEDbdhot2m2KCy2ZHCJUvZXJAtdeyJ",
"width": 800,
"height": 800,
"format": "png"
}
}
],
"testnet": true,
"slug": "meverse-chain-testnet"
} as const satisfies Chain;
+30
View File
@@ -0,0 +1,30 @@
import type { Chain } from "../src/types";
export default {
"name": "Shinarium Beta",
"chain": "Shinarium",
"rpc": [
"https://shinarium-beta.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.shinarium.org"
],
"faucets": [
"https://faucet.shinarium.org"
],
"nativeCurrency": {
"name": "Shina Inu",
"symbol": "SHI",
"decimals": 18
},
"infoURL": "https://shinarium.org",
"shortName": "shi",
"chainId": 534849,
"networkId": 534849,
"explorers": [
{
"name": "shinascan",
"url": "https://shinascan.shinarium.org",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "shinarium-beta"
} as const satisfies Chain;
+32
View File
@@ -0,0 +1,32 @@
import type { Chain } from "../src/types";
export default {
"name": "Linea Mainnet",
"chain": "Linea Mainnet",
"shortName": "linea-mainnet",
"chainId": 59144,
"testnet": false,
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"rpc": [],
"explorers": [
{
"name": "Linea Scan",
"url": "https://lineascan.build",
"standard": ""
}
],
"faucets": [
"https://www.infura.io/faucet/linea"
],
"infoURL": "https://docs.linea.build/overview",
"icon": {
"url": "ipfs://QmURjritnHL7a8TwZgsFwp3f272DJmG5paaPtWDZ98QZwH",
"height": 512,
"width": 512,
"format": "svg"
},
"slug": "linea"
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "Avocado",
"chain": "Avocado",
"rpc": [
"https://avocado.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.avocado.instadapp.io"
],
"faucets": [],
"nativeCurrency": {
"name": "USDC",
"symbol": "USDC",
"decimals": 18
},
"infoURL": "https://avocado.instadapp.io",
"shortName": "avocado",
"chainId": 634,
"networkId": 634,
"icon": {
"url": "ipfs://Qma9rJSgy32UL1iXtXKFZQJA6FjkcUcDU4HR6y13Wu1vjn",
"width": 600,
"height": 600,
"format": "png"
},
"explorers": [
{
"name": "avoscan",
"url": "https://avoscan.co",
"icon": {
"url": "ipfs://Qma9rJSgy32UL1iXtXKFZQJA6FjkcUcDU4HR6y13Wu1vjn",
"width": 600,
"height": 600,
"format": "png"
},
"standard": "none"
}
],
"testnet": false,
"slug": "avocado"
} as const satisfies Chain;
+34
View File
@@ -0,0 +1,34 @@
import type { Chain } from "../src/types";
export default {
"name": "ALL Mainnet",
"chain": "ALL",
"icon": {
"url": "ipfs://bafkreibqe2mgiqezi24sx272kunqt6pv7uzxhpkxuobvpbsptce3q6nn5i",
"width": 1000,
"height": 1000,
"format": "png"
},
"rpc": [
"https://all.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.alltra.global"
],
"faucets": [],
"nativeCurrency": {
"name": "ALL",
"symbol": "ALL",
"decimals": 18
},
"infoURL": "https://alltra.world",
"shortName": "ALL",
"chainId": 651940,
"networkId": 651940,
"explorers": [
{
"name": "Alltra SmartChain Explorer",
"url": "https://alltra.global",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "all"
} as const satisfies Chain;
+1 -2
View File
@@ -10,8 +10,7 @@ export default {
},
"rpc": [
"https://zetachain-athens-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://zetachain-athens-evm.blockpi.network/v1/rpc/public",
"wss://zetachain-athens.blockpi.network/rpc/v1/public/websocket"
"https://api.athens2.zetachain.com/evm"
],
"faucets": [
"https://labs.zetachain.com/get-zeta"
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "MEVerse Chain Mainnet",
"chain": "MEVerse",
"rpc": [
"https://meverse-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.meversemainnet.io"
],
"faucets": [],
"nativeCurrency": {
"name": "MEVerse",
"symbol": "MEV",
"decimals": 18
},
"infoURL": "https://www.meverse.sg",
"shortName": "MEV",
"chainId": 7518,
"networkId": 7518,
"icon": {
"url": "ipfs://QmPuQ6gaCfUtNdRuaEDbdhot2m2KCy2ZHCJUvZXJAtdeyJ",
"width": 800,
"height": 800,
"format": "png"
},
"explorers": [
{
"name": "MEVerse Chain Explorer",
"url": "https://www.meversescan.io",
"standard": "none",
"icon": {
"url": "ipfs://QmPuQ6gaCfUtNdRuaEDbdhot2m2KCy2ZHCJUvZXJAtdeyJ",
"width": 800,
"height": 800,
"format": "png"
}
}
],
"testnet": false,
"slug": "meverse-chain"
} as const satisfies Chain;
+7 -7
View File
@@ -3,9 +3,9 @@
/** @type {Omit<Chain, "slug">} */
export default {
name: "Taro Testnet",
name: "Bubs Testnet",
chain: "gETH",
shortName: "Taro",
shortName: "Bubs",
chainId: 1582,
testnet: true,
icon: {
@@ -14,7 +14,7 @@ export default {
width: 512,
height: 512,
},
rpc: ["https://taro-testnet.calderachain.xyz/http"],
rpc: ["https://bubs.calderachain.xyz/http"],
nativeCurrency: {
decimals: 18,
name: "Ether",
@@ -22,12 +22,12 @@ export default {
},
explorers: [
{
url: "https://explorer.tarotestnet.com",
name: "Taro Testnet Explorer",
url: "https://explorer.bubstestnet.com",
name: "Bubs Testnet Explorer",
standard: "EIP3091",
},
],
faucets: ["https://tarotestnet.com"],
infoURL: "https://tarotestnet.com",
faucets: ["https://bubstestnet.com"],
infoURL: "https://bubstestnet.com",
networkId: 1582,
};
+32
View File
@@ -0,0 +1,32 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "Linea Mainnet",
chain: "Linea Mainnet",
shortName: "linea-mainnet",
chainId: 59144,
testnet: false,
nativeCurrency: {
name: "Ether",
symbol: "ETH",
decimals: 18,
},
rpc: [],
explorers: [
{
name: "Linea Scan",
url: "https://lineascan.build",
standard: "",
},
],
faucets: ["https://www.infura.io/faucet/linea"],
infoURL: "https://docs.linea.build/overview",
icon: {
url: "ipfs://QmURjritnHL7a8TwZgsFwp3f272DJmG5paaPtWDZ98QZwH",
height: 512,
width: 512,
format: "svg",
},
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.27",
"version": "0.1.29",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
File diff suppressed because one or more lines are too long
+18
View File
@@ -1,5 +1,23 @@
# thirdweb
## 0.10.31
### Patch Changes
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/storage@1.1.8
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
## 0.10.30
### Patch Changes
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/sdk@3.10.29
- @thirdweb-dev/storage@1.1.7
## 0.10.29
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.10.29",
"version": "0.10.31",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/contracts-js
## 1.3.9
### Patch Changes
- [#1299](https://github.com/thirdweb-dev/js/pull/1299) [`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5) Thanks [@nkrishang](https://github.com/nkrishang)! - Add ERC721LoyaltyCard and ERC721UpdatableMetadata
## 1.3.8
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/contracts-js",
"version": "1.3.8",
"version": "1.3.9",
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
"module": "dist/thirdweb-dev-contracts-js.esm.js",
"browser": {
@@ -10,7 +10,7 @@
"license": "Apache-2.0",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
"dependencies": {
"@thirdweb-dev/contracts": "3.5.9"
"@thirdweb-dev/contracts": "3.6.0"
},
"devDependencies": {
"@babel/preset-env": "^7.22.5",
+22
View File
@@ -1,5 +1,27 @@
# @thirdweb-dev/react-core
## 3.14.10
### Patch Changes
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/storage@1.1.8
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
- @thirdweb-dev/wallets@1.0.6
## 3.14.9
### Patch Changes
- [#1309](https://github.com/thirdweb-dev/js/pull/1309) [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352) Thanks [@jnsdls](https://github.com/jnsdls)! - unblock storage domains
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03), [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/sdk@3.10.29
- @thirdweb-dev/wallets@1.0.5
- @thirdweb-dev/storage@1.1.7
## 3.14.8
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.14.8",
"version": "3.14.10",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,25 +1,10 @@
import mime from "mime/lite.js";
import {
parseGatewayUrls,
prepareGatewayUrls,
replaceSchemeWithGatewayUrl,
} from "@thirdweb-dev/storage";
// TODO legacy remove this when possible
export interface IPFSResolverOptions {
gatewayUrl: string;
}
export function resolveIpfsUri(uri?: string, options?: IPFSResolverOptions) {
if (!uri) {
return undefined;
}
const gatewayUrls = prepareGatewayUrls(
parseGatewayUrls(options?.gatewayUrl ? [options?.gatewayUrl] : undefined),
);
return replaceSchemeWithGatewayUrl(uri, gatewayUrls);
}
export async function resolveMimeType(url?: string) {
if (!url) {
return undefined;
@@ -328,7 +328,7 @@ export function useContractMetadata<TContract extends ValidContractInstance>(
cacheKeys.contract.metadata(contract?.getAddress()),
async () => {
requiredParamInvariant(contract, "contract is required");
return await contract.metadata.get();
return (await contract.metadata.get()) as any; // FIXME types
},
{
enabled: !!contract,
+1 -1
View File
@@ -1,4 +1,4 @@
export { resolveIpfsUri, resolveMimeType } from "../core/utils/ipfs";
export { resolveMimeType } from "../core/utils/ipfs";
export { ThirdwebThemeContext } from "../core/providers/theme-context";
export { ThirdwebProviderCore } from "../core/providers/thirdweb-provider";
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.2.29
## 0.2.28
## 0.2.27
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.27",
"version": "0.2.29",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+53
View File
@@ -1,5 +1,58 @@
# @thirdweb-dev/react-native
## 0.2.29
### Patch Changes
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/storage@1.1.8
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
- @thirdweb-dev/react-core@3.14.10
- @thirdweb-dev/wallets@1.0.6
## 0.2.28
### Patch Changes
- [#1283](https://github.com/thirdweb-dev/js/pull/1283) [`8672c853`](https://github.com/thirdweb-dev/js/commit/8672c8533c694cad46242672ec23b883049bd526) Thanks [@iketw](https://github.com/iketw)! - SDK improvements:
1. You can now pass an `extraRows` prop to the ConnectWallet button. This will render the `extraRows` at the bottom of the connected wallet details modal.
```javascript
import {
BaseButton,
Box,
ConnectWallet,
Text,
} from "@thirdweb-dev/react-native";
const extraRows = () => {
return (
<Box>
<Text variant="bodySmallSecondary" textAlign="center" mt="sm">
Extra option
</Text>
</Box>
);
};
<ConnectWallet theme={"dark"} extraRows={extraRows} />;
```
2. You can now import a local wallet by a mnemoic as well.
When creating a Local/Guest Wallet the import wallet modal accepts both a privateKey or a mnemonic. This makes it easier for users to import their wallets into your app
- [#1309](https://github.com/thirdweb-dev/js/pull/1309) [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352) Thanks [@jnsdls](https://github.com/jnsdls)! - unblock storage domains
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03), [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.2.27
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.27",
"version": "0.2.29",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -14,6 +14,11 @@ export type ConnectWalletProps = {
* render a custom button to display the connected wallet details instead of the default button
*/
detailsButton?: ConnectWalletDetailsProps["detailsButton"];
/**
* render custom rows in the Connect Wallet Details modal
*/
extraRows?: ConnectWalletDetailsProps["extraRows"];
} & ConnectWalletButtonProps;
export const ConnectWallet = ({
@@ -21,6 +26,7 @@ export const ConnectWallet = ({
theme,
buttonTitle,
modalTitle,
extraRows,
}: ConnectWalletProps) => {
const fadeAnim = useRef(new Animated.Value(0)).current;
const address = useAddress();
@@ -40,6 +46,7 @@ export const ConnectWallet = ({
<WalletDetailsButton
address={address}
detailsButton={detailsButton}
extraRows={extraRows}
/>
) : (
<ConnectWalletButton
@@ -1,11 +1,11 @@
import { Linking, StyleSheet, View } from "react-native";
import { Dimensions, Linking, StyleSheet, View } from "react-native";
import Box from "../base/Box";
import { Toast } from "../base/Toast";
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
import { NetworkButton } from "../base/NetworkButton";
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
import {
useActiveChain,
useChain,
useDisconnect,
useSetConnectedWallet,
useWallet,
@@ -18,24 +18,34 @@ import { useSmartWallet } from "../../providers/context-provider";
import BaseButton from "../base/BaseButton";
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
import Text from "../base/Text";
import { useModalState } from "../../providers/ui-context-provider";
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
import { useAppTheme } from "../../styles/hooks";
import { LocalWalletImportModal } from "../ConnectWalletFlow/LocalWalletImportModal";
import { IconTextButton } from "../base/IconTextButton";
import MoneyIcon from "../../assets/money";
import { TWModal } from "../base/modal/TWModal";
export const ConnectWalletDetailsModal = () => {
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
const DEVICE_WIDTH = Dimensions.get("window").width;
export const ConnectWalletDetailsModal = ({
isVisible,
onClosePress,
extraRows,
address,
}: {
isVisible: boolean;
onClosePress: () => void;
extraRows?: React.FC;
address?: string;
}) => {
const theme = useAppTheme();
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
const activeWallet = useWallet();
const chain = useActiveChain();
const chain = useChain();
const disconnect = useDisconnect();
const [smartWallet, setSmartWallet] = useSmartWallet();
const [addressCopied, setAddressCopied] = useState(false);
const [isImportModalVisible, setIsImportModalVisible] = useState(false);
const { modalState, setModalState } = useModalState();
const { address } = (modalState as WalletDetailsModal).data;
const setConnectedWallet = useSetConnectedWallet();
useEffect(() => {
@@ -50,8 +60,8 @@ export const ConnectWalletDetailsModal = () => {
const onDisconnectPress = () => {
disconnect().finally(() => {
setModalState(CLOSE_MODAL_STATE("ConnectWalletDetailsModal"));
setSmartWallet?.(undefined);
onClosePress();
});
};
@@ -176,45 +186,65 @@ export const ConnectWalletDetailsModal = () => {
]);
return (
<Box>
<ExportLocalWalletModal
isVisible={isExportModalVisible}
onClose={onExportModalClose}
/>
<WalletDetailsModalHeader
address={address}
onDisconnectPress={onDisconnectPress}
onAddressCopied={onAddressCopied}
/>
<View style={styles.currentNetwork}>
<Text variant="bodySmallSecondary">Current Network</Text>
<TWModal isVisible={isVisible} onBackdropPress={onClosePress}>
<View
style={[styles.modal, { backgroundColor: theme.colors.background }]}
>
<Box style={styles.contentContainer}>
<ExportLocalWalletModal
isVisible={isExportModalVisible}
onClose={onExportModalClose}
/>
<WalletDetailsModalHeader
address={address}
onDisconnectPress={onDisconnectPress}
onAddressCopied={onAddressCopied}
/>
<View style={styles.currentNetwork}>
<Text variant="bodySmallSecondary">Current Network</Text>
</View>
<NetworkButton
chainIconUrl={chain?.icon?.url || ""}
chainName={chain?.name || "Unknown Network"}
onPress={onChangeNetworkPress}
/>
{chain?.testnet && chain?.faucets?.length ? (
<IconTextButton
mt="xs"
text="Request Testnet Funds"
icon={<MoneyIcon height={10} width={10} />}
onPress={() => {
if (chain?.faucets?.[0]) {
Linking.openURL(chain.faucets[0]);
}
}}
/>
) : null}
{getAdditionalActions()}
{extraRows ? extraRows({}) : null}
{addressCopied === true ? (
<Toast text={"Address copied to clipboard"} />
) : null}
</Box>
</View>
<NetworkButton
chainIconUrl={chain?.icon?.url || ""}
chainName={chain?.name || "Unknown Network"}
onPress={onChangeNetworkPress}
/>
{chain?.testnet && chain?.faucets?.length ? (
<IconTextButton
mt="xs"
text="Request Testnet Funds"
icon={<MoneyIcon height={10} width={10} />}
onPress={() => {
if (chain?.faucets?.[0]) {
Linking.openURL(chain.faucets[0]);
}
}}
/>
) : null}
{getAdditionalActions()}
{addressCopied === true ? (
<Toast text={"Address copied to clipboard"} />
) : null}
</Box>
</TWModal>
);
};
const styles = StyleSheet.create({
modal: {
position: "absolute",
bottom: -20,
left: -20,
width: DEVICE_WIDTH,
borderTopLeftRadius: 24,
borderTopRightRadius: 24,
padding: 24,
},
contentContainer: {
maxHeight: MODAL_HEIGHT,
display: "flex",
},
exportWalletInfo: {
flex: 1,
justifyContent: "flex-start",
@@ -6,37 +6,47 @@ import { WalletIcon } from "../base/WalletIcon";
import { useWallet, useBalance, useChain } from "@thirdweb-dev/react-core";
import { StyleSheet } from "react-native";
import { LocalWallet } from "@thirdweb-dev/wallets";
import { useModalState } from "../../providers/ui-context-provider";
import Box from "../base/Box";
import { ConnectWalletDetailsModal } from "./ConnectWalletDetailsModal";
import { useState } from "react";
export type ConnectWalletDetailsProps = {
address: string;
address?: string;
detailsButton?: React.FC<{ onPress: () => void }>;
extraRows?: React.FC;
};
export const WalletDetailsButton = ({
address,
detailsButton,
extraRows,
}: ConnectWalletDetailsProps) => {
const activeWallet = useWallet();
const chain = useChain();
const balanceQuery = useBalance();
const { setModalState } = useModalState();
const [isModalVisible, setIsModalVisible] = useState(false);
const onPress = () => {
setModalState({
view: "WalletDetails",
data: {
address: address,
},
isOpen: true,
isSheet: true,
caller: "ConnectWalletDetails",
});
// setModalState({
// view: "WalletDetails",
// data: {
// address: address,
// },
// isOpen: true,
// isSheet: true,
// caller: "ConnectWalletDetails",
// });
setIsModalVisible(!isModalVisible);
};
return (
<>
<ConnectWalletDetailsModal
isVisible={isModalVisible}
onClosePress={onPress}
extraRows={extraRows}
address={address}
/>
{detailsButton ? (
detailsButton({ onPress })
) : (
@@ -12,7 +12,7 @@ import CopyIcon from "../../assets/copy";
import { useState } from "react";
interface WalletDetailsModalHeaderProps {
address: string;
address?: string;
onDisconnectPress: () => void;
onAddressCopied?: () => void;
loading?: boolean;
@@ -29,6 +29,9 @@ export const WalletDetailsModalHeader = ({
const [showLoading, setShowLoading] = useState(false);
const onAddressPress = async () => {
if (!address) {
return;
}
await Clipboard.setStringAsync(address);
onAddressCopied?.();
};
@@ -16,6 +16,7 @@ import * as FileSystem from "expo-file-system";
import { TWModal } from "../base/modal/TWModal";
import { localWallet } from "../../wallets/wallets/local-wallet";
import { TextInput } from "../base";
import { useAppTheme } from "../../styles/hooks";
export type LocalWalletImportModalProps = {
isVisible: boolean;
@@ -29,11 +30,14 @@ export const LocalWalletImportModal = ({
onWalletImported,
}: LocalWalletImportModalProps) => {
const [password, setPassword] = useState<string | undefined>();
const [privateKey, setPrivateKey] = useState<string | undefined>(undefined);
const [privateKeyOrMnemonic, setPrivateKeyOrMnemonic] = useState<
string | undefined
>(undefined);
const [jsonFile, setJsonFile] = useState<string | undefined>();
const [error, setError] = useState<string | undefined>();
const [isImporting, setIsImporting] = useState<boolean>(false);
const createWalletInstance = useCreateWalletInstance();
const theme = useAppTheme();
const createLocalWalletFromJsonFile = async () => {
if (!jsonFile || !password) {
@@ -65,17 +69,24 @@ export const LocalWalletImportModal = ({
};
const createLocalWalletPK = async () => {
if (!privateKey) {
if (!privateKeyOrMnemonic) {
return null;
}
const localWalletInstance = createWalletInstance(localWallet());
try {
await localWalletInstance.import({
privateKey: privateKey,
encryption: false,
});
if (privateKeyOrMnemonic.indexOf(" ") === -1) {
await localWalletInstance.import({
privateKey: privateKeyOrMnemonic,
encryption: false,
});
} else {
await localWalletInstance.import({
mnemonic: privateKeyOrMnemonic,
encryption: false,
});
}
} catch (err) {
console.error("Error importing the wallet", err);
return null;
@@ -88,27 +99,29 @@ export const LocalWalletImportModal = ({
setError(undefined);
setIsImporting(true);
let localWalletInstance = await createLocalWalletFromJsonFile();
setTimeout(async () => {
let localWalletInstance = await createLocalWalletFromJsonFile();
if (!localWalletInstance) {
localWalletInstance = await createLocalWalletPK();
}
if (!localWalletInstance) {
localWalletInstance = await createLocalWalletPK();
}
if (!localWalletInstance) {
setError("Please, double check your password or private key.");
setIsImporting(false);
return;
}
localWalletInstance.save({
strategy: "privateKey",
encryption: false,
});
onWalletImported(localWalletInstance);
if (!localWalletInstance) {
setError("Please, double check your password or private key.");
setIsImporting(false);
return;
}
localWalletInstance.save({
strategy: "privateKey",
encryption: false,
});
onWalletImported(localWalletInstance);
setIsImporting(false);
onCloseInternal();
onCloseInternal();
}, 0);
};
const onCloseInternal = () => {
@@ -139,7 +152,7 @@ export const LocalWalletImportModal = ({
};
const onPrivateKeyEntered = (text: string) => {
setPrivateKey(text);
setPrivateKeyOrMnemonic(text);
};
return (
@@ -180,11 +193,12 @@ export const LocalWalletImportModal = ({
{error}
</Text>
<Text variant="bodySmall" m="xs" textAlign="center">
---- Or enter a private key ----
---- Or Private key or Mnemonic ----
</Text>
<TextInput
secureTextEntry={true}
placeholder={"Private key"}
placeholder={"Private key / Mnemonic"}
placeholderTextColor={theme.colors.textSecondary}
onChangeText={onPrivateKeyEntered}
/>
<Box
@@ -2,7 +2,6 @@ import { useModalState } from "../providers/ui-context-provider";
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
import { Dimensions, StyleSheet, View } from "react-native";
import { useMemo } from "react";
import { ConnectWalletDetailsModal } from "./ConnectWalletDetails/ConnectWalletDetailsModal";
import { CLOSE_MODAL_STATE } from "../utils/modalTypes";
import { ThemeProvider } from "../styles/ThemeProvider";
import { useAppTheme } from "../styles/hooks";
@@ -24,8 +23,8 @@ export const MainModal = () => {
switch (modalState?.view) {
case "ConnectWalletFlow":
return <ConnectWalletFlow />;
case "WalletDetails":
return <ConnectWalletDetailsModal />;
// case "WalletDetails":
// return <ConnectWalletDetailsModal />;
case "WalletConnectSessionRequestModal":
return <SessionRequestModal />;
case "WalletConnectSessionProposalModal":
@@ -23,7 +23,7 @@ export const IconTextButton = ({
}: IconTextProps) => {
return (
<BaseButton
p={p || "md"}
p={p || "sm"}
backgroundColor="background"
style={styles.networkContainer}
onPress={onPress}
@@ -1,4 +1,5 @@
import { resolveIpfsUri } from "@thirdweb-dev/react-core";
import { useStorage } from "@thirdweb-dev/react-core";
import { useState } from "react";
import { Image } from "react-native";
import { SvgUri } from "react-native-svg";
@@ -13,21 +14,35 @@ const ImageSvgUri = ({
height: number;
imageAlt?: string;
}) => {
const isSvg = imageUrl.toLowerCase().endsWith(".svg");
const resolvedImageUrl = resolveIpfsUri(imageUrl) || "";
const storage = useStorage();
const resolvedImageUrl = storage
? storage.resolveScheme(imageUrl)
: imageUrl.replace("ipfs://", "https://ipfs.io/ipfs/");
const [error, setError] = useState(false);
if (!resolvedImageUrl || resolvedImageUrl === "") {
return null;
}
if (isSvg) {
return <SvgUri width={width} height={height} uri={resolvedImageUrl} />;
if (error) {
return (
<SvgUri
width={width}
height={height}
uri={resolvedImageUrl}
onError={() => setError(true)}
/>
);
} else {
// always try to render Image first, if error then try to render svg
// Image from RN handles onError better than SvgUri
return (
<Image
alt={imageAlt}
source={{ uri: resolvedImageUrl }}
style={[{ width: width, height: height }]}
onError={() => setError(true)}
/>
);
}
@@ -1,21 +1,37 @@
import Box from "./Box";
import Text from "./Text";
import { StyleSheet } from "react-native";
type LabelProps = {
text: string;
};
export const Label = ({ text }: LabelProps) => {
} & (typeof Text)["arguments"];
export const Label = ({ text, ...props }: LabelProps) => {
return (
<Box
justifyContent="center"
flexDirection="row"
alignItems="center"
paddingVertical="xxs"
paddingHorizontal="xs"
borderRadius="lg"
borderRadius="md"
backgroundColor="labelBackground"
>
<Text variant="bodyLarge">{text}</Text>
<Text
variant="bodySmall"
style={{
...style.text,
...props,
}}
>
{text}
</Text>
</Box>
);
};
const style = StyleSheet.create({
text: {
textAlign: "center",
paddingVertical: 3,
paddingHorizontal: 8,
},
});
@@ -4,6 +4,7 @@ import { ThemeProviderProps } from "../styles/ThemeProvider";
import { Theme, darkTheme, lightTheme } from "../styles/theme";
import { useAppTheme } from "../styles/hooks";
import { useTheme } from "@shopify/restyle";
import { PropsWithChildren } from "react";
type UIContextType = {
modalState: ModalState;
@@ -25,7 +26,7 @@ const UIContext = createContext<UIContextType>({
setTheme: () => {},
});
export const UIContextProvider = (props: React.PropsWithChildren<{}>) => {
export const UIContextProvider = (props: PropsWithChildren<{}>) => {
const [modalState, setModalState] = useState<ModalState>({
view: "Closed",
data: {},
@@ -9,7 +9,7 @@ export class RainbowWallet extends WalletConnectV2 {
static meta = {
name: "Rainbow",
iconURL:
"https://registry.walletconnect.org/v2/logo/md/7a33d7f1-3d12-4b5c-f3ee-5cd83cb1b500",
"ipfs://QmSZn47p4DVVBfzvg9BAX2EqwnPxkT1YAE7rUnrtd9CybQ/rainbow-logo.png",
links: {
native: "rainbow:",
universal: "https://rnbwapp.com",
@@ -7,7 +7,7 @@ export class TrustWallet extends WalletConnectV2 {
static meta = {
name: "Trust Wallet",
iconURL:
"https://registry.walletconnect.org/v2/logo/md/0528ee7e-16d1-4089-21e3-bbfb41933100",
"ipfs://QmNigQbXk7wKZwDcgN38Znj1ZZQ3JEG3DD6fUKLBU8SUTP/trust%20wallet.svg",
links: {
native: "trust:",
universal: "https://link.trustwallet.com",
+29
View File
@@ -1,5 +1,34 @@
# @thirdweb-dev/react
## 3.14.10
### Patch Changes
- [#1310](https://github.com/thirdweb-dev/js/pull/1310) [`3df86ad1`](https://github.com/thirdweb-dev/js/commit/3df86ad16f3daf1a0382d5b860ef6f24a69cc8d0) Thanks [@MananTank](https://github.com/MananTank)! - ConnectWallet UI fixes
- Hide Back button when not required
- Fix Rainbow wallet meta
- Fix backbutton not working on get-started screen when there's a single supported wallet
- Remove switchAccount button on mobile for metamask
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
- @thirdweb-dev/react-core@3.14.10
- @thirdweb-dev/wallets@1.0.6
## 3.14.9
### Patch Changes
- [#1309](https://github.com/thirdweb-dev/js/pull/1309) [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352) Thanks [@jnsdls](https://github.com/jnsdls)! - unblock storage domains
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03), [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/sdk@3.10.29
- @thirdweb-dev/wallets@1.0.5
- @thirdweb-dev/react-core@3.14.9
## 3.14.8
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.14.8",
"version": "3.14.10",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9 -6
View File
@@ -1,11 +1,10 @@
import type { Theme } from "../design-system";
import styled from "@emotion/styled";
import { Chain } from "@thirdweb-dev/chains";
import { resolveIpfsUri } from "@thirdweb-dev/react-core";
import { useStorage } from "@thirdweb-dev/react-core";
const defaultChainIcon = /* @__PURE__ */ resolveIpfsUri(
"ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
);
const defaultChainIcon =
"ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png";
export const ChainIcon: React.FC<{
chain?: Chain;
@@ -14,8 +13,12 @@ export const ChainIcon: React.FC<{
className?: string;
loading?: "lazy" | "eager";
}> = (props) => {
const url = props.chain?.icon?.url;
const src = url ? resolveIpfsUri(url) : defaultChainIcon;
const url = props.chain?.icon?.url || defaultChainIcon;
const storage = useStorage();
const src = storage
? storage.resolveScheme(url)
: url.replace("ipfs://", "https://ipfs.io/ipfs/");
return (
<div
+7 -2
View File
@@ -1,4 +1,4 @@
import { resolveIpfsUri } from "@thirdweb-dev/react-core";
import { useStorage } from "@thirdweb-dev/react-core";
export const Img: React.FC<{
width: string;
@@ -8,11 +8,16 @@ export const Img: React.FC<{
loading?: "eager" | "lazy";
className?: string;
}> = (props) => {
const storage = useStorage();
return (
<img
width={props.width}
height={props.height}
src={resolveIpfsUri(props.src)}
src={
storage
? storage.resolveScheme(props.src)
: props.src.replace("ipfs://", "https://ipfs.io/ipfs/")
}
alt={props.alt || ""}
loading={props.loading}
decoding="async"
@@ -7,11 +7,7 @@ import {
CarbonPlayFilledAlt,
} from "./Icons";
import { useQuery } from "@tanstack/react-query";
import {
resolveIpfsUri,
resolveMimeType,
useStorage,
} from "@thirdweb-dev/react-core";
import { resolveMimeType, useStorage } from "@thirdweb-dev/react-core";
import React, {
useEffect,
useMemo,
@@ -547,18 +543,19 @@ export function useResolvedMediaType(
) {
const storage = useStorage();
const resolvedUrl = useMemo(
() =>
resolveIpfsUri(
uri,
gatewayUrl
? { gatewayUrl }
: storage
? { gatewayUrl: storage.gatewayUrls["ipfs://"][0] }
: undefined,
),
[uri, storage, gatewayUrl],
);
const resolvedUrl = useMemo(() => {
if (!uri) {
return "";
}
if (gatewayUrl) {
return uri.replace("ipfs://", gatewayUrl);
}
if (storage) {
return storage.resolveScheme(uri);
}
return uri.replace("ipfs://", "https://ipfs.io/ipfs/");
}, [uri, storage, gatewayUrl]);
const resolvedMimType = useQuery(
["mime-type", resolvedUrl],
() => resolveMimeType(resolvedUrl),
@@ -304,7 +304,8 @@ export const ConnectedWalletDetails: React.FC<{
{activeWalletConfig &&
activeWalletConfig.id === walletIds.metamask &&
activeWalletConfig.isInstalled &&
activeWalletConfig.isInstalled() && (
activeWalletConfig.isInstalled() &&
!isMobile() && (
<MenuButton
type="button"
onClick={() => {
@@ -16,10 +16,11 @@ export const ConnectingScreen: React.FC<{
walletIconURL: string;
walletName: string;
supportLink: string;
hideBackButton: boolean;
}> = (props) => {
return (
<>
<BackButton onClick={props.onBack} />
{!props.hideBackButton && <BackButton onClick={props.onBack} />}
<IconContainer>
<Img
src={props.walletIconURL}
@@ -17,7 +17,7 @@ export const ScanScreen: React.FC<{
qrCodeUri?: string;
walletName: string;
walletIconURL: string;
hideBackButton?: boolean;
hideBackButton: boolean;
}> = (props) => {
const walletName = props.walletName.toLowerCase().includes("wallet")
? props.walletName
@@ -18,6 +18,8 @@ export const CoinbaseConnectUI = ({
"connecting" | "loading" | "scanning" | "get-started"
>("loading");
const hideBackButton = supportedWallets.length === 1;
const connectPrompted = useRef(false);
useEffect(() => {
if (screen !== "loading") {
@@ -61,6 +63,7 @@ export const CoinbaseConnectUI = ({
if (screen === "connecting" || screen === "loading") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={goBack}
walletName={meta.name}
walletIconURL={meta.iconURL}
@@ -77,7 +80,9 @@ export const CoinbaseConnectUI = ({
chromeExtensionLink={meta.urls?.chrome}
googlePlayStoreLink={meta.urls?.android}
appleStoreLink={meta.urls?.ios}
onBack={goBack}
onBack={() => {
setScreen("scanning");
}}
/>
);
}
@@ -89,7 +94,7 @@ export const CoinbaseConnectUI = ({
onConnected={close}
onGetStarted={() => setScreen("get-started")}
walletConfig={walletConfig}
hideBackButton={supportedWallets.length === 1}
hideBackButton={hideBackButton}
/>
);
}
@@ -12,7 +12,7 @@ export const CoinbaseScan: React.FC<{
onGetStarted: () => void;
onConnected: () => void;
walletConfig: WalletConfig<CoinbaseWallet>;
hideBackButton?: boolean;
hideBackButton: boolean;
}> = ({ walletConfig, onConnected, onGetStarted, onBack, hideBackButton }) => {
const createInstance = useCreateWalletInstance();
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>(undefined);
@@ -68,6 +68,7 @@ export const FrameConnectUI = (props: ConnectUIProps<FrameWallet>) => {
const { walletConfig, close, goBack } = props;
const downloadLink = "https://frame.sh";
const supportLink = "https://docs.frame.sh";
const hideBackButton = props.supportedWallets.length === 1;
useEffect(() => {
if (connectPrompted.current) {
@@ -98,6 +99,7 @@ export const FrameConnectUI = (props: ConnectUIProps<FrameWallet>) => {
if (screen === "connecting") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
@@ -13,6 +13,8 @@ export const MetamaskConnectUI = (props: ConnectUIProps<MetaMaskWallet>) => {
const { walletConfig, close } = props;
const connect = useConnect();
const hideBackButton = props.supportedWallets.length === 1;
const { goBack } = props;
const connectPrompted = useRef(false);
@@ -56,6 +58,7 @@ export const MetamaskConnectUI = (props: ConnectUIProps<MetaMaskWallet>) => {
if (screen === "connecting") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={props.goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
@@ -72,7 +75,9 @@ export const MetamaskConnectUI = (props: ConnectUIProps<MetaMaskWallet>) => {
chromeExtensionLink={walletConfig.meta.urls?.chrome}
googlePlayStoreLink={walletConfig.meta.urls?.android}
appleStoreLink={walletConfig.meta.urls?.ios}
onBack={props.goBack}
onBack={() => {
setScreen("scanning");
}}
/>
);
}
@@ -80,11 +85,12 @@ export const MetamaskConnectUI = (props: ConnectUIProps<MetaMaskWallet>) => {
if (screen === "scanning") {
return (
<MetamaskScan
onBack={props.goBack}
onBack={goBack}
onConnected={close}
onGetStarted={() => {
setScreen("get-started");
}}
hideBackButton={hideBackButton}
walletConfig={walletConfig}
/>
);
@@ -12,7 +12,8 @@ export const MetamaskScan: React.FC<{
onGetStarted: () => void;
onConnected: () => void;
walletConfig: WalletConfig<MetaMaskWallet>;
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
hideBackButton: boolean;
}> = ({ onBack, onConnected, onGetStarted, walletConfig, hideBackButton }) => {
const createInstance = useCreateWalletInstance();
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
@@ -54,6 +55,7 @@ export const MetamaskScan: React.FC<{
qrCodeUri={qrCodeUri}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
hideBackButton={hideBackButton}
/>
);
};
@@ -13,6 +13,8 @@ export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
const { walletConfig, close } = props;
const connect = useConnect();
const hideBackButton = props.supportedWallets.length === 1;
const { goBack } = props;
const connectPrompted = useRef(false);
@@ -36,6 +38,7 @@ export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
if (screen === "connecting") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={props.goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
@@ -52,7 +55,9 @@ export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
chromeExtensionLink={walletConfig.meta.urls?.chrome}
googlePlayStoreLink={walletConfig.meta.urls?.android}
appleStoreLink={walletConfig.meta.urls?.ios}
onBack={props.goBack}
onBack={() => {
setScreen("scanning");
}}
/>
);
}
@@ -65,6 +70,7 @@ export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
onGetStarted={() => {
setScreen("get-started");
}}
hideBackButton={hideBackButton}
walletConfig={walletConfig}
/>
);
@@ -12,7 +12,8 @@ export const RainbowScan: React.FC<{
onGetStarted: () => void;
onConnected: () => void;
walletConfig: WalletConfig<WalletConnect>;
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
hideBackButton: boolean;
}> = ({ onBack, onConnected, onGetStarted, walletConfig, hideBackButton }) => {
const createInstance = useCreateWalletInstance();
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
@@ -54,6 +55,7 @@ export const RainbowScan: React.FC<{
qrCodeUri={qrCodeUri}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
hideBackButton={hideBackButton}
/>
);
};
@@ -21,6 +21,10 @@ export const rainbowWallet = (
name: "Rainbow Wallet",
iconURL:
"ipfs://QmSZn47p4DVVBfzvg9BAX2EqwnPxkT1YAE7rUnrtd9CybQ/rainbow-logo.png",
urls: {
android: "https://rnbwapp.com/e/Va41HWS6Oxb",
ios: "https://rnbwapp.com/e/OeMdmkJ6Oxb",
},
},
create: (walletOptions: WalletOptions) => {
return new WalletConnect({
@@ -12,6 +12,7 @@ export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
>("connecting");
const { walletConfig, close } = props;
const connect = useConnect();
const hideBackButton = props.supportedWallets.length === 1;
const { goBack } = props;
@@ -54,6 +55,7 @@ export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
if (screen === "connecting") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={props.goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
@@ -70,7 +72,9 @@ export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
chromeExtensionLink={walletConfig.meta.urls?.chrome}
googlePlayStoreLink={walletConfig.meta.urls?.android}
appleStoreLink={walletConfig.meta.urls?.ios}
onBack={props.goBack}
onBack={() => {
setScreen("scanning");
}}
/>
);
}
@@ -78,6 +82,7 @@ export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
if (screen === "scanning") {
return (
<TrustScan
hideBackButton={hideBackButton}
onBack={props.goBack}
onConnected={close}
onGetStarted={() => {
@@ -11,8 +11,9 @@ export const TrustScan: React.FC<{
onBack: () => void;
onGetStarted: () => void;
onConnected: () => void;
hideBackButton: boolean;
walletConfig: WalletConfig<TrustWallet>;
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
}> = ({ onBack, onConnected, onGetStarted, walletConfig, hideBackButton }) => {
const createInstance = useCreateWalletInstance();
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
@@ -54,6 +55,7 @@ export const TrustScan: React.FC<{
qrCodeUri={qrCodeUri}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
hideBackButton={hideBackButton}
/>
);
};
@@ -12,6 +12,7 @@ export const ZerionConnectUI = (props: ConnectUIProps<ZerionWallet>) => {
>("connecting");
const { walletConfig, close } = props;
const connect = useConnect();
const hideBackButton = props.supportedWallets.length === 1;
const { goBack } = props;
@@ -54,6 +55,7 @@ export const ZerionConnectUI = (props: ConnectUIProps<ZerionWallet>) => {
if (screen === "connecting") {
return (
<ConnectingScreen
hideBackButton={hideBackButton}
onBack={props.goBack}
walletName={walletConfig.meta.name}
walletIconURL={walletConfig.meta.iconURL}
@@ -70,7 +72,9 @@ export const ZerionConnectUI = (props: ConnectUIProps<ZerionWallet>) => {
chromeExtensionLink={walletConfig.meta.urls?.chrome}
googlePlayStoreLink={walletConfig.meta.urls?.android}
appleStoreLink={walletConfig.meta.urls?.ios}
onBack={props.goBack}
onBack={() => {
setScreen("scanning");
}}
/>
);
}
@@ -78,6 +82,7 @@ export const ZerionConnectUI = (props: ConnectUIProps<ZerionWallet>) => {
if (screen === "scanning") {
return (
<ZerionScan
hideBackButton={hideBackButton}
onBack={props.goBack}
onConnected={close}
onGetStarted={() => {
@@ -87,6 +92,6 @@ export const ZerionConnectUI = (props: ConnectUIProps<ZerionWallet>) => {
/>
);
}
return null;
};
@@ -12,7 +12,8 @@ export const ZerionScan: React.FC<{
onGetStarted: () => void;
onConnected: () => void;
walletConfig: WalletConfig<ZerionWallet>;
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
hideBackButton: boolean;
}> = ({ onBack, onConnected, onGetStarted, walletConfig, hideBackButton }) => {
const createInstance = useCreateWalletInstance();
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
@@ -49,6 +50,7 @@ export const ZerionScan: React.FC<{
return (
<ScanScreen
hideBackButton={hideBackButton}
onBack={onBack}
onGetStarted={onGetStarted}
qrCodeUri={qrCodeUri}
+36
View File
@@ -1,5 +1,41 @@
# @thirdweb-dev/sdk
## 3.10.30
### Patch Changes
- [#1314](https://github.com/thirdweb-dev/js/pull/1314) [`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0) Thanks [@iketw](https://github.com/iketw)! - Passes API key to thirdweb storage ipfs uploader
If you want to use thirdweb's storage upload services you need to pass an API key.
You can grab one from: https://thirdweb.com/dashboard/settings
If using ThirdwebStorage directly:
```javascript
new ThirdwebStorage({
apiKey: <yourApiKey>,
});
```
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/storage@1.1.8
- @thirdweb-dev/chains@0.1.29
## 3.10.29
### Patch Changes
- [#1299](https://github.com/thirdweb-dev/js/pull/1299) [`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5) Thanks [@nkrishang](https://github.com/nkrishang)! - Add ERC721LoyaltyCard and ERC721UpdatableMetadata
- [#1298](https://github.com/thirdweb-dev/js/pull/1298) [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Proper types for contract.metadata.get() for custom contracts
- [#1304](https://github.com/thirdweb-dev/js/pull/1304) [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix pack code snippets
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/contracts-js@1.3.9
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/storage@1.1.7
## 3.10.28
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.28",
"version": "3.10.30",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
+7 -2
View File
@@ -8,8 +8,13 @@ export function createStorage(
if (storage) {
return storage;
} else if (options?.gatewayUrls) {
return new ThirdwebStorage({ gatewayUrls: options.gatewayUrls });
return new ThirdwebStorage({
gatewayUrls: options.gatewayUrls,
apiKey: options.thirdwebApiKey,
});
} else {
return new ThirdwebStorage();
return new ThirdwebStorage({
apiKey: options?.thirdwebApiKey,
});
}
}
@@ -29,6 +29,8 @@ import {
FEATURE_NFT_SIGNATURE_MINTABLE_V2,
FEATURE_NFT_SHARED_METADATA,
FEATURE_NFT_CLAIM_ZORA,
FEATURE_NFT_LOYALTY_CARD,
FEATURE_NFT_UPDATABLE_METADATA,
} from "./erc721-features";
import {
FEATURE_EDITION,
@@ -98,6 +100,8 @@ export type Feature =
| typeof FEATURE_NFT_BURNABLE
| typeof FEATURE_NFT_TIERED_DROP
| typeof FEATURE_NFT_SHARED_METADATA
| typeof FEATURE_NFT_LOYALTY_CARD
| typeof FEATURE_NFT_UPDATABLE_METADATA
| typeof FEATURE_EDITION
| typeof FEATURE_EDITION_ENUMERABLE
| typeof FEATURE_EDITION_MINTABLE
@@ -172,4 +176,6 @@ export const SUPPORTED_FEATURES: Record<string, Feature> = /* @__PURE__ */ {
[FEATURE_OFFERS.name]: FEATURE_OFFERS,
[FEATURE_ACCOUNT_FACTORY.name]: FEATURE_ACCOUNT_FACTORY,
[FEATURE_ACCOUNT.name]: FEATURE_ACCOUNT,
[FEATURE_NFT_LOYALTY_CARD.name]: FEATURE_NFT_LOYALTY_CARD,
[FEATURE_NFT_UPDATABLE_METADATA.name]: FEATURE_NFT_UPDATABLE_METADATA,
};
@@ -16,6 +16,8 @@ import SignatureMintERC721_V1Abi from "@thirdweb-dev/contracts-js/dist/abis/ISig
import TieredDropAbi from "@thirdweb-dev/contracts-js/dist/abis/LazyMintWithTier.json";
import SharedMetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/SharedMetadata.json";
import zora_IDropERC721 from "@thirdweb-dev/contracts-js/dist/abis/zora_IERC721Drop.json";
import ILoyaltyCardAbi from "@thirdweb-dev/contracts-js/dist/abis/ILoyaltyCard.json";
import INFTMetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/INFTMetadata.json";
export const FEATURE_NFT_BURNABLE = {
name: "ERC721Burnable",
@@ -211,6 +213,30 @@ export const FEATURE_NFT_SHARED_METADATA = /* @__PURE__ */ {
features: {},
} as const;
export const FEATURE_NFT_LOYALTY_CARD = {
name: "ERC721LoyaltyCard",
namespace: "nft.loyaltyCard",
docLinks: {
// TODO
sdk: "",
contracts: "",
},
abis: [ILoyaltyCardAbi],
features: {},
} as const;
export const FEATURE_NFT_UPDATABLE_METADATA = {
name: "ERC721UpdatableMetadata",
namespace: "nft.metadata",
docLinks: {
// TODO
sdk: "",
contracts: "",
},
abis: [INFTMetadataAbi],
features: {},
} as const;
export const FEATURE_NFT = /* @__PURE__ */ {
name: "ERC721",
namespace: "nft",
@@ -234,5 +260,7 @@ export const FEATURE_NFT = /* @__PURE__ */ {
[FEATURE_NFT_CLAIM_PHASES_V1.name]: FEATURE_NFT_CLAIM_PHASES_V1,
[FEATURE_NFT_CLAIM_PHASES_V2.name]: FEATURE_NFT_CLAIM_PHASES_V2,
[FEATURE_NFT_SHARED_METADATA.name]: FEATURE_NFT_SHARED_METADATA,
[FEATURE_NFT_LOYALTY_CARD.name]: FEATURE_NFT_LOYALTY_CARD,
[FEATURE_NFT_UPDATABLE_METADATA.name]: FEATURE_NFT_UPDATABLE_METADATA,
},
} as const;
@@ -355,7 +355,7 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC20 rewards to be included in the pack
* erc20Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* quantityPerReward: 5,
* quantity: 100,
* totalRewards: 20,
@@ -364,14 +364,14 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC721 rewards to be included in the pack
* erc721Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* }
* ],
* // ERC1155 rewards to be included in the pack
* erc1155Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* quantityPerReward: 1,
* totalRewards: 100,
@@ -404,7 +404,7 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC20 rewards to be included in the pack
* erc20Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* quantityPerReward: 5,
* quantity: 100,
* totalRewards: 20,
@@ -413,14 +413,14 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC721 rewards to be included in the pack
* erc721Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* }
* ],
* // ERC1155 rewards to be included in the pack
* erc1155Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* quantityPerReward: 1,
* totalRewards: 100,
@@ -484,7 +484,7 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC20 rewards to be included in the pack
* erc20Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* quantityPerReward: 5,
* quantity: 100,
* totalRewards: 20,
@@ -493,14 +493,14 @@ export class Pack extends StandardErc1155<PackContract> {
* // ERC721 rewards to be included in the pack
* erc721Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* }
* ],
* // ERC1155 rewards to be included in the pack
* erc1155Rewards: [
* {
* assetContract: "0x...",
* contractAddress: "0x...",
* tokenId: 0,
* quantityPerReward: 1,
* totalRewards: 100,
@@ -109,7 +109,7 @@ export class SmartContract<
public estimator: GasCostEstimator<TContract>;
public publishedMetadata: ContractPublishedMetadata<TContract>;
public abi: Abi;
public metadata: ContractMetadata<BaseContract, any>;
public metadata: ContractMetadata<BaseContract, typeof CustomContractSchema>;
/**
* Handle royalties
@@ -84,7 +84,9 @@ export class ContractWrapper<
this.readContract = this.writeContract.connect(
this.getProvider(),
) as TContract;
this.#storage = new ThirdwebStorage();
this.#storage = new ThirdwebStorage({
apiKey: options?.thirdwebApiKey,
});
}
public override updateSignerOrProvider(network: NetworkInput): void {
@@ -0,0 +1,63 @@
import { buildTransactionFunction } from "../../common/transactions";
import { FEATURE_NFT_LOYALTY_CARD } from "../../constants/erc721-features";
import { DetectableFeature } from "../interfaces/DetectableFeature";
import { ContractWrapper } from "./contract-wrapper";
import { Transaction } from "./transactions";
import type { ILoyaltyCard } from "@thirdweb-dev/contracts-js";
import { BigNumberish } from "ethers";
export class Erc721LoyaltyCard implements DetectableFeature {
featureName = FEATURE_NFT_LOYALTY_CARD.name;
private contractWrapper: ContractWrapper<ILoyaltyCard>;
constructor(contractWrapper: ContractWrapper<ILoyaltyCard>) {
this.contractWrapper = contractWrapper;
}
/**
* Cancel loyalty card NFTs
*
* @remarks Cancel loyalty card NFTs held by the connected wallet
*
* @example
* ```javascript
* // The token ID of the loyalty card you want to cancel
* const tokenId = 0;
*
* await contract.nft.loyaltyCard.cancel(tokenId);
* ```
*/
cancel = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish) => {
return Transaction.fromContractWrapper({
contractWrapper: this.contractWrapper,
method: "cancel",
args: [tokenId],
});
},
);
/**
* Revoke loyalty card NFTs
*
* @remarks Revoke loyalty card NFTs held by some owner.
*
* @example
* ```javascript
* // The token ID of the loyalty card you want to revoke
* const tokenId = 0;
*
* await contract.nft.loyaltyCard.revoke(tokenId);
* ```
*/
revoke = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish) => {
return Transaction.fromContractWrapper({
contractWrapper: this.contractWrapper,
method: "revoke",
args: [tokenId],
});
},
);
}
@@ -0,0 +1,51 @@
import { NFTMetadataOrUri } from "../../../core/schema/nft";
import { uploadOrExtractURI } from "../../common/nft";
import { buildTransactionFunction } from "../../common/transactions";
import { FEATURE_NFT_UPDATABLE_METADATA } from "../../constants/erc721-features";
import { DetectableFeature } from "../interfaces/DetectableFeature";
import { ContractWrapper } from "./contract-wrapper";
import { Transaction } from "./transactions";
import type { INFTMetadata } from "@thirdweb-dev/contracts-js";
import type { ThirdwebStorage } from "@thirdweb-dev/storage";
import { BigNumberish } from "ethers";
export class Erc721UpdatableMetadata implements DetectableFeature {
featureName = FEATURE_NFT_UPDATABLE_METADATA.name;
private contractWrapper: ContractWrapper<INFTMetadata>;
private storage: ThirdwebStorage;
constructor(
contractWrapper: ContractWrapper<INFTMetadata>,
storage: ThirdwebStorage,
) {
this.contractWrapper = contractWrapper;
this.storage = storage;
}
/**
* Update the metadata of an NFT
*
* @remarks Update the metadata of an NFT
*
* @example
* ```javascript
* // The token ID of the NFT whose metadata you want to update
* const tokenId = 0;
* // The new metadata
* const metadata = { name: "My NFT", description: "My NFT description""}
*
* await contract.nft.metadata.update(tokenId, metadata);
* ```
*/
update = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish, metadata: NFTMetadataOrUri) => {
const uri = await uploadOrExtractURI(metadata, this.storage);
return Transaction.fromContractWrapper({
contractWrapper: this.contractWrapper,
method: "setTokenURI",
args: [tokenId, uri],
});
},
);
}
@@ -27,6 +27,8 @@ import {
FEATURE_NFT_TIERED_DROP,
FEATURE_NFT_SIGNATURE_MINTABLE_V2,
FEATURE_NFT_SHARED_METADATA,
FEATURE_NFT_LOYALTY_CARD,
FEATURE_NFT_UPDATABLE_METADATA,
} from "../../constants/erc721-features";
import type { Address } from "../../schema/shared/Address";
import type { AddressOrEns } from "../../schema/shared/AddressOrEnsSchema";
@@ -58,6 +60,8 @@ import type {
Zora_IERC721Drop,
SharedMetadata,
OpenEditionERC721,
ILoyaltyCard,
INFTMetadata,
} from "@thirdweb-dev/contracts-js";
import type { ThirdwebStorage } from "@thirdweb-dev/storage";
import { BigNumber, BigNumberish, constants } from "ethers";
@@ -69,6 +73,8 @@ import { Erc721ClaimableWithConditions } from "./erc-721-claim-conditions";
import { Erc721Claimable } from "./erc-721-claimable";
import { Erc721SharedMetadata } from "./erc-721-shared-metadata";
import { Erc721ClaimableZora } from "./erc-721-claim-zora";
import { Erc721LoyaltyCard } from "./erc-721-loyalty-card";
import { Erc721UpdatableMetadata } from "./erc-721-metadata";
/**
* Standard ERC721 NFT functions
@@ -100,6 +106,8 @@ export class Erc721<
private claimCustom: Erc721Claimable | undefined;
private erc721SharedMetadata: Erc721SharedMetadata | undefined;
private claimZora: Erc721ClaimableZora | undefined;
private loyaltyCard: Erc721LoyaltyCard | undefined;
private updatableMetadata: Erc721UpdatableMetadata | undefined;
protected contractWrapper: ContractWrapper<T>;
protected storage: ThirdwebStorage;
@@ -125,6 +133,8 @@ export class Erc721<
this.claimCustom = this.detectErc721Claimable();
this.claimZora = this.detectErc721ClaimableZora();
this.erc721SharedMetadata = this.detectErc721SharedMetadata();
this.loyaltyCard = this.detectErc721LoyaltyCard();
this.updatableMetadata = this.detectErc721UpdatableMetadata();
this._chainId = chainId;
}
@@ -606,6 +616,54 @@ export class Erc721<
},
);
////// ERC721 Loyalty Card Extension //////
/**
* Cancel loyalty card NFTs
*
* @remarks Cancel loyalty card NFTs held by the connected wallet
*
* @example
* ```javascript
* // The token ID of the loyalty card you want to cancel
* const tokenId = 0;
*
* const result = await contract.erc721.cancel(tokenId);
* ```
* @twfeature ERC721LoyaltyCard
*/
cancel = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish) => {
return assertEnabled(
this.loyaltyCard,
FEATURE_NFT_LOYALTY_CARD,
).cancel.prepare(tokenId);
},
);
/**
* Revoke loyalty card NFTs
*
* @remarks Revoke loyalty card NFTs held by some owner.
*
* @example
* ```javascript
* // The token ID of the loyalty card you want to revoke
* const tokenId = 0;
*
* const result = await contract.erc721.revoke(tokenId);
* ```
* @twfeature ERC721LoyaltyCard
*/
revoke = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish) => {
return assertEnabled(
this.loyaltyCard,
FEATURE_NFT_LOYALTY_CARD,
).revoke.prepare(tokenId);
},
);
////// ERC721 LazyMint Extension //////
/**
@@ -649,6 +707,33 @@ export class Erc721<
},
);
////// ERC721 Metadata Extension //////
/**
* Update the metadata of an NFT
*
* @remarks Update the metadata of an NFT
*
* @example
* ```javascript
* // The token ID of the NFT whose metadata you want to update
* const tokenId = 0;
* // The new metadata
* const metadata = { name: "My NFT", description: "My NFT description""}
*
* await contract.erc721.update(tokenId, metadata);
* ```
* @twfeature ERC721UpdatableMetadata
*/
update = /* @__PURE__ */ buildTransactionFunction(
async (tokenId: BigNumberish, metadata: NFTMetadataOrUri) => {
return assertEnabled(
this.updatableMetadata,
FEATURE_NFT_UPDATABLE_METADATA,
).update.prepare(tokenId, metadata);
},
);
////// ERC721 Claimable Extension //////
/**
@@ -1120,4 +1205,28 @@ export class Erc721<
}
return undefined;
}
private detectErc721LoyaltyCard(): Erc721LoyaltyCard | undefined {
if (
detectContractFeature<ILoyaltyCard>(
this.contractWrapper,
"ERC721LoyaltyCard",
)
) {
return new Erc721LoyaltyCard(this.contractWrapper);
}
return undefined;
}
private detectErc721UpdatableMetadata(): Erc721UpdatableMetadata | undefined {
if (
detectContractFeature<INFTMetadata>(
this.contractWrapper,
"ERC721UpdatableMetadata",
)
) {
return new Erc721UpdatableMetadata(this.contractWrapper, this.storage);
}
return undefined;
}
}
+63 -2
View File
@@ -109,6 +109,8 @@ import {
PrecomputedDeploymentTransaction,
} from "../types/any-evm/deploy-data";
import { fetchContractMetadataFromAddress } from "../common/metadata-resolver";
import { LoyaltyCardContractDeploy } from "../schema/contracts/loyalty-card";
import { getDefaultTrustedForwarders } from "../constants";
/**
* The main entry point for the thirdweb SDK
@@ -708,7 +710,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
address,
chainId,
contractType: async () => "custom" as const,
metadata: async () => ({}),
metadata: async () => ({ name: "" }),
extensions: async () => [],
};
}
@@ -741,7 +743,7 @@ export class ThirdwebSDK extends RPCConnectionHandler {
address,
chainId,
contractType: async () => "custom" as const,
metadata: async () => ({}),
metadata: async () => ({ name: "" }),
extensions: async () => [],
};
}
@@ -945,6 +947,65 @@ export class ContractDeployer extends RPCConnectionHandler {
},
);
/**
* Deploys a new LoyaltyCard contract
*
* @remarks Deploys a LoyaltyCard contract and returns the address of the deployed contract
*
* @example
* ```javascript
* const contractAddress = await sdk.deployer.deployLoyaltyCard({
* name: "My Loyalty Program",
* primary_sale_recipient: "your-address",
* });
* ```
* @param metadata - the contract metadata
* @returns the address of the deployed contract
*/
deployLoyaltyCard = /* @__PURE__ */ buildDeployTransactionFunction(
async (
metadata: NFTContractDeployMetadata,
options?: DeployOptions,
): Promise<DeployTransaction> => {
const parsedMetadata = await LoyaltyCardContractDeploy.parseAsync(
metadata,
);
const contractURI = await this.storage.upload(parsedMetadata);
const chainId = (await this.getProvider().getNetwork()).chainId;
const trustedForwarders = getDefaultTrustedForwarders(chainId);
// add default forwarders to any custom forwarders passed in
if (
metadata.trusted_forwarders &&
metadata.trusted_forwarders.length > 0
) {
trustedForwarders.push(...metadata.trusted_forwarders);
}
const signerAddress = await this.getSigner()?.getAddress();
const deployArgs = [
signerAddress,
parsedMetadata.name,
parsedMetadata.symbol,
contractURI,
trustedForwarders,
parsedMetadata.primary_sale_recipient,
parsedMetadata.fee_recipient,
parsedMetadata.seller_fee_basis_points,
parsedMetadata.platform_fee_basis_points,
parsedMetadata.platform_fee_recipient,
];
return await this.deployReleasedContract.prepare(
THIRDWEB_DEPLOYER,
"LoyaltyCard",
deployArgs,
options,
);
},
);
/**
* Deploys a new SignatureDrop contract
*
@@ -16,6 +16,7 @@ export const CommonContractSchema = /* @__PURE__ */ (() =>
image: FileOrBufferOrStringSchema.optional(),
external_link: z.string().optional(),
app_uri: z.string().optional(),
social_urls: z.record(z.string()).optional(),
}))();
export type CommonContractSchemaInput = z.input<typeof CommonContractSchema>;
@@ -37,7 +37,7 @@ export type CustomContractMetadata = z.input<typeof BYOCContractMetadataSchema>;
export const CustomContractInput = /* @__PURE__ */ (() =>
BYOCContractMetadataSchema.merge(
CommonRoyaltySchema.merge(MerkleSchema).merge(CommonSymbolSchema).partial(),
))();
).catchall(z.any()))();
/**
* @internal
@@ -45,7 +45,7 @@ export const CustomContractInput = /* @__PURE__ */ (() =>
export const CustomContractOutput = /* @__PURE__ */ (() =>
CommonContractOutputSchema.merge(
CommonRoyaltySchema.merge(MerkleSchema).merge(CommonSymbolSchema).partial(),
))();
).catchall(z.any()))();
/**
* @internal
@@ -0,0 +1,24 @@
import {
CommonContractOutputSchema,
CommonContractSchema,
CommonPlatformFeeSchema,
CommonPrimarySaleSchema,
CommonRoyaltySchema,
CommonSymbolSchema,
CommonTrustedForwarderSchema,
} from "./common";
export const LoyaltyCardContractInput =
/* @__PURE__ */ CommonContractSchema.merge(CommonRoyaltySchema).merge(
CommonSymbolSchema,
);
export const LoyaltyCardContractOutput =
/* @__PURE__ */ CommonContractOutputSchema.merge(CommonRoyaltySchema).merge(
CommonSymbolSchema,
);
export const LoyaltyCardContractDeploy =
/* @__PURE__ */ LoyaltyCardContractInput.merge(CommonPlatformFeeSchema)
.merge(CommonPrimarySaleSchema)
.merge(CommonTrustedForwarderSchema);
+23
View File
@@ -1,5 +1,28 @@
# @thirdweb-dev/storage
## 1.1.8
### Patch Changes
- [#1314](https://github.com/thirdweb-dev/js/pull/1314) [`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0) Thanks [@iketw](https://github.com/iketw)! - Passes API key to thirdweb storage ipfs uploader
If you want to use thirdweb's storage upload services you need to pass an API key.
You can grab one from: https://thirdweb.com/dashboard/settings
If using ThirdwebStorage directly:
```javascript
new ThirdwebStorage({
apiKey: <yourApiKey>,
});
```
## 1.1.7
### Patch Changes
- [#1309](https://github.com/thirdweb-dev/js/pull/1309) [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352) Thanks [@jnsdls](https://github.com/jnsdls)! - unblock storage domains
## 1.1.6
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.1.6",
"version": "1.1.8",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
+4
View File
@@ -7,6 +7,10 @@ import CIDTool from "cid-tool";
export const DEFAULT_GATEWAY_URLS: GatewayUrls = {
// Note: Gateway URLs should have trailing slashes (we clean this on user input)
"ipfs://": [
"https://{cid}.gateway.ipfscdn.io/{path}",
"https://{cid}.ipfs.twipfs.com/{path}",
"https://{cid}.ipfs.twgateway.com/{path}",
"https://{cid}.ipfs.thirdwebstorage.com/{path}",
"https://{cid}.ipfs.thirdwebipfs.com/{path}",
"https://{cid}.ipfs.thirdwebgateway.com/{path}",
+5 -1
View File
@@ -53,7 +53,11 @@ export class ThirdwebStorage<T extends UploadOptions = IpfsUploadBatchOptions> {
public gatewayUrls: GatewayUrls;
constructor(options?: ThirdwebStorageOptions<T>) {
this.uploader = options?.uploader || new IpfsUploader();
this.uploader =
options?.uploader ||
new IpfsUploader({
apiKey: options?.apiKey,
});
this.downloader = options?.downloader || new StorageDownloader();
this.gatewayUrls = prepareGatewayUrls(
parseGatewayUrls(options?.gatewayUrls),
@@ -37,9 +37,11 @@ import FormData from "form-data";
*/
export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
public uploadWithGatewayUrl: boolean;
private apiKey?: string;
constructor(options?: IpfsUploaderOptions) {
this.uploadWithGatewayUrl = options?.uploadWithGatewayUrl || false;
this.apiKey = options?.apiKey || "";
}
async uploadBatch(
@@ -101,10 +103,19 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
process.env.NODE_ENV === "test" || !!process.env.CI
? "Storage SDK CI"
: "Storage SDK",
Authorization: `Bearer ${this.apiKey}`,
},
});
if (!res.ok) {
throw new Error(`Failed to get upload token`);
const response = await res.json();
// throw new Error(`Failed to get upload token`);
const error = response.error || response.statusText;
const code = response.code || "UNKNOWN";
throw new Error(
`IpfsUploader error: ${error} Status: ${response.status} Code: ${code}`,
);
}
const body = await res.text();
return body;
+1
View File
@@ -5,6 +5,7 @@ export type ThirdwebStorageOptions<T extends UploadOptions> = {
uploader?: IStorageUploader<T>;
downloader?: IStorageDownloader;
gatewayUrls?: GatewayUrls | string[];
apiKey?: string;
};
export * from "./download";
+5
View File
@@ -46,6 +46,11 @@ export type IpfsUploaderOptions = {
* Whether or not to replace any URLs with schemes with resolved URLs before upload
*/
uploadWithGatewayUrl?: boolean;
/**
* Optional apiKey to associate with the IpfsUploader.
* You can get an API key here: https://thirdweb.com/settings
*/
apiKey?: string;
};
/**
+1 -1
View File
@@ -431,7 +431,7 @@ describe("IPFS", async () => {
getGatewayUrlForCid(
DEFAULT_GATEWAY_URLS["ipfs://"][0],
// CID changes based on file contents (prod gateway vs staging gateway since they get written)
`bafybeicctk76y3z3hapwjp73msfpeolfklkgpfw2wnrcyrudk3ypmibdva/0`,
`bafybeibexk3gfppyxtrnyy5sqjkgvsjdqzzvwqjndna374y2od4qemseua/0`,
),
);
});
+37
View File
@@ -1,5 +1,42 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.47
### Patch Changes
- [#1314](https://github.com/thirdweb-dev/js/pull/1314) [`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0) Thanks [@iketw](https://github.com/iketw)! - Passes API key to thirdweb storage ipfs uploader
If you want to use thirdweb's storage upload services you need to pass an API key.
You can grab one from: https://thirdweb.com/dashboard/settings
If using ThirdwebStorage directly:
```javascript
new ThirdwebStorage({
apiKey: <yourApiKey>,
});
```
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/storage@1.1.8
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
- @thirdweb-dev/wallets@1.0.6
- @thirdweb-dev/auth@3.2.10
## 0.2.46
### Patch Changes
- [#1293](https://github.com/thirdweb-dev/js/pull/1293) [`bb207473`](https://github.com/thirdweb-dev/js/commit/bb207473f886d9a4470bcef1880a3a65882b6851) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - add more default wallets to wcv2 default modal
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03), [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/sdk@3.10.29
- @thirdweb-dev/wallets@1.0.5
- @thirdweb-dev/storage@1.1.7
- @thirdweb-dev/auth@3.2.9
## 0.2.45
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.45",
"version": "0.2.47",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
@@ -28,8 +28,6 @@ declare global {
}
}
const API_KEY =
"339d65590ba0fa79e4c8be0af33d64eda709e13652acb02c6be63f5a1fbef9c3";
const SEPARATOR = "/";
const SUB_SEPARATOR = "#";
@@ -128,9 +126,11 @@ class ThirdwebBridge implements TWBridge {
gatewayUrls: {
"ipfs://": [sdkOptions.storage.ipfsGatewayUrl],
},
apiKey: sdkOptions.apiKey,
})
: new ThirdwebStorage();
sdkOptions.thirdwebApiKey = sdkOptions.thirdwebApiKey || API_KEY;
: new ThirdwebStorage({
apiKey: sdkOptions.apiKey,
});
this.activeSDK = new ThirdwebSDK(chain, sdkOptions, storage);
for (let possibleWallet of WALLETS) {
let walletInstance: AbstractClientWallet;
@@ -159,6 +159,50 @@ class ThirdwebBridge implements TWBridge {
projectId: sdkOptions.wallet?.walletConnectProjectId,
dappMetadata,
chains: defaultChains,
qrModalOptions: {
explorerRecommendedWalletIds: [
"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96", // metamask
"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0", // trustwallet
"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f", // safe
"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369", // rainbow
"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a", // uniswap
"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18", // zerion
"ef333840daf915aafdc4a004525502d6d49d77bd9c65e0642dbaefb3c2893bef", // imtoken
"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6", // argent
"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d", // spot
"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7", // omni
"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d", // crypto.com
"20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66", // tokenpocket
"8837dd9413b1d9b585ee937d27a816590248386d9dbf59f5cd3422dbbb65683e", // robinhood wallet
"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041", // frontier
"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04", // blockchain.com
"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150", // safepal
"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662", // bitkeep
"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0", // zengo
"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576", // 1inch
"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4", // binance defi wallet
"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4", // exodus
"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927", // ledger live
"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2", // mew wallet
"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98", // alpha wallet
"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83", // keyring pro
"76a3d548a08cf402f5c7d021f24fd2881d767084b387a5325df88bc3d4b6f21b", // lobstr wallet
"dceb063851b1833cbb209e3717a0a0b06bf3fb500fe9db8cd3a553e4b1d02137", // onto
"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26", // math wallet
"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3", // unstoppable domains
"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa", // obvious
"5864e2ced7c293ed18ac35e0db085c09ed567d67346ccb6f58a0327a75137489", // fireblocks
"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568", // ambire wallet
"802a2041afdaf4c7e41a2903e98df333c8835897532699ad370f829390c6900f", // infinity wallet
"7424d97904535b14fe34f09f63d8ca66935546f798758dabd5b26c2309f2b1f9", // bridge wallet
"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd", // internet money wallet
"c482dfe368d4f004479977fd88e80dc9e81107f3245d706811581a6dfe69c534", // now wallet
"107bb20463699c4e614d3a2fb7b961e66f48774cb8f6d6c1aee789853280972c", // bitcoin.com wallet
"053ac0ac602e0969736941cf5aa07a3af57396d4601cb521a173a626e1015fb1", // au wallet
"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01", // coin98 super app
"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f", // abc wallet
],
},
});
break;
case walletIds.coinbase:
@@ -193,7 +237,7 @@ class ThirdwebBridge implements TWBridge {
const config: SmartWalletConfig = {
chain: chain,
factoryAddress: sdkOptions.smartWalletConfig?.factoryAddress,
thirdwebApiKey: sdkOptions.smartWalletConfig?.thirdwebApiKey,
thirdwebApiKey: sdkOptions.apiKey,
gasless: sdkOptions.smartWalletConfig?.gasless,
bundlerUrl: sdkOptions.smartWalletConfig?.bundlerUrl,
paymasterUrl: sdkOptions.smartWalletConfig?.paymasterUrl,
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/wallets
## 1.0.6
### Patch Changes
- Updated dependencies [[`db68bd04`](https://github.com/thirdweb-dev/js/commit/db68bd04cd8bb3ee6bff051d1d5b5a872353fde0), [`fd74d791`](https://github.com/thirdweb-dev/js/commit/fd74d7918072cda03b52f852ebb3f8dccb84074d), [`35f20ceb`](https://github.com/thirdweb-dev/js/commit/35f20ceb4f943e95d9566105096f06412978da7a)]:
- @thirdweb-dev/sdk@3.10.30
- @thirdweb-dev/chains@0.1.29
## 1.0.5
### Patch Changes
- [#1292](https://github.com/thirdweb-dev/js/pull/1292) [`10b3a717`](https://github.com/thirdweb-dev/js/commit/10b3a717da606632a05769ac821bdd21d6b63a03) Thanks [@assimovt](https://github.com/assimovt)! - Handle authz errors from thirdweb Bundler in smart wallet paymaster and rpc
- [#1301](https://github.com/thirdweb-dev/js/pull/1301) [`b4aee9b5`](https://github.com/thirdweb-dev/js/commit/b4aee9b59121bab5f9b3d9b7ecdc4bcb4cd66f58) Thanks [@adam-maj](https://github.com/adam-maj)! - Add all supported chains to safe server urls
- Updated dependencies [[`7e044c66`](https://github.com/thirdweb-dev/js/commit/7e044c664d8a034f5324b859ac3596860c86f9a5), [`72ada475`](https://github.com/thirdweb-dev/js/commit/72ada47596d5d5c08736c33215faeec636b7156a), [`2c0bb078`](https://github.com/thirdweb-dev/js/commit/2c0bb0789955f6cd397b6fdb8e990a505251c631), [`b5c6eedb`](https://github.com/thirdweb-dev/js/commit/b5c6eedb38aa3c52eb97f3d25ad83e38c55afe61), [`4961b597`](https://github.com/thirdweb-dev/js/commit/4961b597a098dae0a4eff01a9ef268a65fe1a352)]:
- @thirdweb-dev/chains@0.1.28
- @thirdweb-dev/sdk@3.10.29
## 1.0.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "1.0.4",
"version": "1.0.6",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
@@ -2,16 +2,26 @@
export const CHAIN_ID_TO_GNOSIS_SERVER_URL = {
// mainnet
1: "https://safe-transaction-mainnet.safe.global",
// avalanche
43114: "https://safe-transaction-avalanche.safe.global",
// polygon
137: "https://safe-transaction-polygon.safe.global",
// goerli
5: "https://safe-transaction-goerli.safe.global",
// bsc
56: "https://safe-transaction-bsc.safe.global",
// optimism
10: "https://safe-transaction-optimism.safe.global",
// bsc
56: "https://safe-transaction-bsc.safe.global",
// gnosis
100: "https://safe-transaction-gnosis-chain.safe.global",
// polygon
137: "https://safe-transaction-polygon.safe.global",
// avalanche
43114: "https://safe-transaction-avalanche.safe.global",
// arbitrum
42161: "https://safe-transaction-arbitrum.safe.global",
// celo
42220: "https://safe-transaction-celo.safe.global",
// base goerli
84531: "https://safe-transaction-base-testnet.safe.global",
// aurora
1313161554: "https://safe-transaction-aurora.safe.global",
} as const;
export const SafeSupportedChainsSet = /* @__PURE__ */ (() =>
@@ -65,34 +65,45 @@ export class ERC4337EthersSigner extends Signer {
unwrapError(errorIn: any): Error {
try {
let errorMsg = "Unknown Error";
if (errorIn.error) {
const error = new Error(
`The bundler has failed to include UserOperation in a batch: ${errorIn.error}`,
);
error.stack = errorIn.stack;
return error;
}
if (errorIn.body && typeof errorIn.body === "object") {
errorMsg = `The bundler has failed to include UserOperation in a batch: ${errorIn.error}`;
} else if (errorIn.body && typeof errorIn.body === "string") {
const errorBody = JSON.parse(errorIn.body);
let paymasterInfo: string = "";
let failedOpMessage: string | undefined =
errorBody?.error?.message || errorBody?.error?.data;
if (failedOpMessage?.includes("FailedOp") === true) {
const errorStatus = errorIn.status || "UNKNOWN";
const errorCode = errorBody?.code || "UNKNOWN";
let failedOpMessage =
errorBody?.error?.message ||
errorBody?.error?.data ||
errorBody?.error ||
errorIn.reason;
if (failedOpMessage?.includes("FailedOp")) {
let paymasterInfo: string = "";
// TODO: better error extraction methods will be needed
const matched = failedOpMessage.match(/FailedOp\((.*)\)/);
if (matched) {
const split = matched[1].split(",");
paymasterInfo = `(paymaster address: ${split[1]})`;
failedOpMessage = split[2];
}
errorMsg = `The bundler has failed to include UserOperation in a batch: ${failedOpMessage} ${paymasterInfo}`;
} else {
errorMsg = `RPC error: ${failedOpMessage}
Status: ${errorStatus}
Code: ${errorCode}`;
}
const error = new Error(
`The bundler has failed to include UserOperation in a batch: ${failedOpMessage} ${paymasterInfo}`,
);
error.stack = errorIn.stack;
return error;
}
const error = new Error(errorMsg);
error.stack = errorIn.stack;
return error;
} catch (error: any) {}
return errorIn;
}
@@ -22,32 +22,37 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
userOp: Partial<UserOperationStruct>,
): Promise<string> {
// Ask the paymaster to sign the transaction and return a valid paymasterAndData value.
try {
const response = await fetch(this.paymasterUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": this.apiKey,
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "pm_sponsorUserOperation",
params: [await toJSON(userOp), { entryPoint: this.entryPoint }],
}),
});
const res = await response.json();
if (res.result) {
const result = (res.result as any).paymasterAndData || res.result;
return result.toString();
} else {
throw new Error(
`Paymaster returned no result from: ${this.paymasterUrl}`,
);
}
} catch (e) {
console.error("PM - error", (e as any).result?.error || e);
throw e;
const response = await fetch(this.paymasterUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": this.apiKey,
},
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "pm_sponsorUserOperation",
params: [await toJSON(userOp), { entryPoint: this.entryPoint }],
}),
});
const res = await response.json();
if (!response.ok) {
const error = res.error || response.statusText;
const code = res.code || "UNKNOWN";
throw new Error(
`Paymaster error: ${error}
Status: ${response.status}
Code: ${code}`,
);
}
if (res.result) {
const result = (res.result as any).paymasterAndData || res.result;
return result.toString();
} else {
throw new Error(`Paymaster returned no result from ${this.paymasterUrl}`);
}
}
}

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