Compare commits

...
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
c578a437cc Version Packages (#1234)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-26 18:42:04 -07:00
Danny FridayandGitHub 0c5b03b8d6 Remove ipfs-2 gateway (#1246) 2023-06-27 00:31:06 +00:00
nkrishangandGitHub 9af346eead [SDK][React] SmartWalletFactory: use getAllAccounts instead of event logs of AccountCreated to get accounts of a factory (#1241) 2023-06-26 17:51:22 +00:00
iketwandGitHub d9fb134ad4 [RN] better design for custom details button (#1245) 2023-06-26 15:25:19 +00:00
Mariano FuentesandGitHub 1c7264b403 Fix install bug (#1240) 2023-06-24 00:59:52 +00:00
Joaquim VergesandGitHub a140ee99b2 add zora extension in auto docs (#1239) 2023-06-24 00:23:07 +00:00
iketwandGitHub 6e1fe6e582 [React] Add Rainbow and Trust wallets connection hooks (#1238) 2023-06-23 23:06:59 +00:00
iketwandGitHub 536b0f1240 [React] Add Rainbow Wallet (#1237) 2023-06-23 22:11:40 +00:00
b626782b0e [React/Wallets] Add Trust Wallet (#1236)
Co-authored-by: Manan Tank <[email protected]>
2023-06-23 21:23:13 +00:00
Nacho IacovinoandGitHub 1d76334dd3 [React] Fix required type for address on useSmartWalletsForAddress (#1235) 2023-06-23 18:44:00 +00:00
nkrishangandGitHub d498c79a91 [SDK] Fix smartWalletFactory.getAllWallets (#1233) 2023-06-23 18:20:03 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
736b45ac8e Version Packages (#1211)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-23 10:33:33 -07:00
Nacho IacovinoandGitHub b5e1d3bb2b [React] Add useSmartWalletsForAddress hook (#1230) 2023-06-23 12:00:37 +00:00
Jonas DanielsandGitHub 6816219ac1 [chains] - add/update chains (#1229) 2023-06-22 23:57:03 +00:00
Nacho IacovinoandGitHub 48065bcd91 [SDK] Accept string in shared metadata (#1222) 2023-06-22 23:39:34 +00:00
Manan TankandGitHub a388d07a3d Add Magic Connect support (#1226) 2023-06-22 20:28:04 +00:00
Nacho IacovinoandGitHub 483e2b9109 [SDK] Fix namespace for platformFees (#1225) 2023-06-22 19:24:04 +00:00
Nacho IacovinoandGitHub f7f4f20737 [React + SDK] Better return type for get shared metadata (#1224) 2023-06-22 18:46:57 +00:00
Joaquim VergesandGitHub 6aa6f7e0bd [SDK] fix maxId in getAll for Open Edition contracts (#1223) 2023-06-22 03:42:24 +00:00
d4d9550713 [React + SDK] Add get shared metadata (#1218)
Co-authored-by: Jonas Daniels <[email protected]>
2023-06-22 01:56:48 +00:00
iketwandGitHub 3cb298ac4b [RN/Wallets] Fix Coinbase Wallet connection rejection error (#1220) 2023-06-22 00:29:24 +00:00
Joaquim VergesandGitHub c747670b98 [SDK] Fix nextTokenIdToMint for open edition (#1219) 2023-06-22 00:08:55 +00:00
Joaquim VergesandGitHub c08e6ba988 [SDK] Fix claim counts for Open Edition contracts (#1216) 2023-06-21 23:49:27 +00:00
Manan TankandGitHub 60fb188943 [react] Fix safeWallet tree-shaking (#1212) 2023-06-21 20:17:13 +00:00
iketwandGitHub 1ce8558df4 [Wallets] Fix switchChain in WCV2 connector (#1214) 2023-06-21 16:28:16 +00:00
iketwandGitHub 3ce5f9a0c3 [RC/Wallets] Improve error messages for wc and auth (#1213) 2023-06-21 15:45:03 +00:00
3d615a62d0 [SDK] Code abstraction; import/export updates (#1188)
Co-authored-by: Manan Tank <[email protected]>
2023-06-21 14:40:12 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
6ce366f59e Version Packages (#1190)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-06-20 23:26:22 -07:00
8a2d92046a [SDK] update polygon gas station url (#1208)
Co-authored-by: Joaquim Verges <[email protected]>
2023-06-21 06:04:20 +00:00
YashandGitHub 45ae105ed3 [SDK] Minimal forwarders for ZKSync (#1191) 2023-06-21 05:53:53 +00:00
Jonas DanielsandGitHub 23d61cfeff [SDK] - open edition feature (#1193) 2023-06-21 02:33:58 +00:00
nkrishangandGitHub 990c665de9 Feature detection and SDK class for Smart Wallet. (#1134) 2023-06-20 23:46:01 +00:00
Joaquim VergesandGitHub 08eaefcf0b [SDK] shortcut getAllOwners for NFT drops to only check claimed (#1203) 2023-06-20 23:40:36 +00:00
Manan TankandGitHub 3d62278aba [wallets, react, react-core] Add eslint-plugin-better-tree-shaking (#1206) 2023-06-20 20:53:22 +00:00
iketwandGitHub 3ab7d1e975 [ReactNative] Export more components for easy development (#1205) 2023-06-20 19:19:21 +00:00
Manan TankandGitHub c6f44722f9 [sdk] Add eslint-plugin-better-tree-shaking (#1199) 2023-06-20 15:06:30 +00:00
Joaquim VergesandGitHub e0ce4a3759 [SDK] Zora claim extension (#1197) 2023-06-20 04:47:02 +00:00
iketwandGitHub 04416e7c93 [RN] Return connection Promise for better error handling (#1202) 2023-06-19 20:30:41 +00:00
Manan TankandGitHub 5166b24a48 [readme] Update install command for windows in contributing.md (#1200) 2023-06-19 17:29:33 +00:00
Manan TankandGitHub bb7ca20e49 [sdk] Better PURE annotations for tree-shaking (#1198) 2023-06-17 19:34:08 +00:00
Jonas DanielsandGitHub f41f1a2958 [chains] - fix arbitrum goerli (#1192) 2023-06-16 21:55:21 +00:00
Manan TankandGitHub d9b7360d1d [sdk] Refactor erc-721.ts, erc-1155.ts, erc-20.ts (#1196) 2023-06-16 21:36:38 +00:00
Manan TankandGitHub 8941b22682 [sdk] Add PURE annotations for improved tree-shaking (#1189) 2023-06-16 13:51:28 +00:00
312 changed files with 13016 additions and 5399 deletions
+6
View File
@@ -59,9 +59,15 @@ To begin:
```
pnpm install
```
If you are on windows, use the `--ignore-scripts` flag
```
pnpm install --ignore-scripts
```
Now you have got the repo on your local machine, and you're ready to start making your changes!
<br/>
### Test Your Changes
We use [yalc](https://github.com/wclr/yalc) to test changes locally.
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/auth
## 3.2.3
### Patch Changes
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f)]:
- @thirdweb-dev/wallets@0.3.3
## 3.2.2
### Patch Changes
- Updated dependencies [[`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273)]:
- @thirdweb-dev/wallets@0.3.2
## 3.2.1
### Patch Changes
- Updated dependencies [[`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939)]:
- @thirdweb-dev/wallets@0.3.1
## 3.2.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.2.0",
"version": "3.2.3",
"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.24
### Patch Changes
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
## 0.1.23
### Patch Changes
- [#1229](https://github.com/thirdweb-dev/js/pull/1229) [`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052) Thanks [@jnsdls](https://github.com/jnsdls)! - add/update chains
## 0.1.22
### Patch Changes
- [#1192](https://github.com/thirdweb-dev/js/pull/1192) [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89) Thanks [@jnsdls](https://github.com/jnsdls)! - fix arbitrum goerli infura url
## 0.1.21
### Patch Changes
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "BRC Chain Mainnet",
"chain": "BRC",
"rpc": [
"https://brc-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.brcchain.io"
],
"faucets": [
"https://faucet.brcchain.io"
],
"nativeCurrency": {
"name": "BRC Chain mainnet native token",
"symbol": "BRC",
"decimals": 18
},
"infoURL": "https://bridge.brcchain.io",
"shortName": "BRC",
"chainId": 12123,
"networkId": 12123,
"icon": {
"url": "ipfs://QmX8qGX7xoZqYUpHxA85uZwQX2fgbTHvmddE1NfseDyBED",
"width": 512,
"height": 512,
"format": "png"
},
"explorers": [
{
"name": "BRC Chain Explorer",
"url": "https://scan.brcchain.io",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "brc-chain"
} as const satisfies Chain;
+2 -2
View File
@@ -4,7 +4,7 @@ export default {
"chain": "ATH",
"rpc": [
"https://atheios.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://wallet.atheios.com:8797"
"https://rpc.atheios.org/"
],
"faucets": [],
"nativeCurrency": {
@@ -12,7 +12,7 @@ export default {
"symbol": "ATH",
"decimals": 18
},
"infoURL": "https://atheios.com",
"infoURL": "https://atheios.org",
"shortName": "ath",
"chainId": 1620,
"networkId": 11235813,
-51
View File
@@ -1,51 +0,0 @@
import type { Chain } from "../src/types";
export default {
"name": "Horizen Yuma Testnet",
"shortName": "Yuma",
"chain": "Yuma",
"icon": {
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
"width": 1213,
"height": 1213,
"format": "png"
},
"rpc": [
"https://horizen-yuma-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://yuma-testnet.horizenlabs.io/ethv1"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [
"https://yuma-testnet-faucet.horizen.io"
],
"nativeCurrency": {
"name": "Testnet Zen",
"symbol": "tZEN",
"decimals": 18
},
"infoURL": "https://horizen.io/",
"chainId": 1662,
"networkId": 1662,
"slip44": 121,
"explorers": [
{
"name": "Yuma Testnet Block Explorer",
"url": "https://yuma-explorer.horizen.io",
"icon": {
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
"width": 1213,
"height": 1213,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "horizen-yuma-testnet"
} as const satisfies Chain;
+2 -1
View File
@@ -11,7 +11,8 @@ export default {
},
"rpc": [
"https://horizen-gobi-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://gobi-testnet.horizenlabs.io/ethv1"
"https://gobi-testnet.horizenlabs.io/ethv1",
"https://rpc.ankr.com/horizen_testnet_evm"
],
"features": [
{
+2 -2
View File
@@ -19,8 +19,8 @@ export default {
"networkId": 1,
"icon": {
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
"width": 200,
"height": 200,
"width": 180,
"height": 180,
"format": "png"
},
"explorers": [
-12
View File
@@ -2,12 +2,6 @@ import type { Chain } from "../src/types";
export default {
"name": "Metaplayerone Dubai Testnet",
"chain": "MP1 Dubai-Testnet",
"icon": {
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
"width": 42,
"height": 23,
"format": "svg"
},
"rpc": [
"https://metaplayerone-dubai-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-dubai.mp1network.com/"
@@ -26,12 +20,6 @@ export default {
{
"name": "MP1Scan",
"url": "https://dubai.mp1scan.io",
"icon": {
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
"width": 42,
"height": 23,
"format": "svg"
},
"standard": "EIP3091"
}
],
+2 -2
View File
@@ -21,8 +21,8 @@ export default {
"networkId": 1,
"icon": {
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
"width": 200,
"height": 200,
"width": 180,
"height": 180,
"format": "png"
},
"explorers": [
-12
View File
@@ -24,22 +24,10 @@ export default {
"shortName": "ncnt",
"chainId": 303,
"networkId": 303,
"icon": {
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
"width": 62,
"height": 59,
"format": "svg"
},
"explorers": [
{
"name": "neuroscan",
"url": "https://testnet.ncnscan.com",
"icon": {
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
"width": 62,
"height": 59,
"format": "svg"
},
"standard": "EIP3091"
}
],
-12
View File
@@ -25,22 +25,10 @@ export default {
"shortName": "ncn",
"chainId": 313,
"networkId": 313,
"icon": {
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
"width": 62,
"height": 59,
"format": "svg"
},
"explorers": [
{
"name": "neuroscan",
"url": "https://ncnscan.com",
"icon": {
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
"width": 62,
"height": 59,
"format": "svg"
},
"standard": "EIP3091"
}
],
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "Peperium Chain Testnet",
"chain": "PERIUM",
"rpc": [
"https://peperium-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.peperium.io"
],
"faucets": [],
"nativeCurrency": {
"name": "Peperium Chain Testnet",
"symbol": "PERIUM",
"decimals": 18
},
"infoURL": "https://peperium.io",
"shortName": "PERIUM",
"chainId": 4001,
"networkId": 4001,
"icon": {
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
"width": 160,
"height": 160,
"format": "png"
},
"explorers": [
{
"name": "Peperium Chain Explorer",
"url": "https://scan-testnet.peperium.io",
"icon": {
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
"width": 160,
"height": 160,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "peperium-chain-testnet"
} as const satisfies Chain;
+24
View File
@@ -0,0 +1,24 @@
import type { Chain } from "../src/types";
export default {
"name": "Omega Mainnet",
"chain": "OmegaNetwork",
"shortName": "OmegaNetwork",
"chainId": 408,
"testnet": false,
"icon": {
"format": "png",
"url": "ipfs://bafkreig676zxfhwhcx5bvvvjxedx6ftr2wq4iiznrwm3c6ozrprbc4oxwm",
"height": 512,
"width": 512
},
"rpc": [
"https://omega.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://mainnet-rpc.omtch.com"
],
"nativeCurrency": {
"name": "Omega Network Coin",
"symbol": "OMN",
"decimals": 18
},
"slug": "omega"
} as const satisfies Chain;
+1 -1
View File
@@ -14,7 +14,7 @@ export default {
"rpc": [
"https://arbitrum-goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://goerli-rollup.arbitrum.io/rpc/"
],
"faucets": [],
+35
View File
@@ -0,0 +1,35 @@
import type { Chain } from "../src/types";
export default {
"name": "opBNB",
"chain": "opBNB",
"shortName": "opBNB",
"chainId": 5611,
"testnet": true,
"nativeCurrency": {
"name": "Testnet bnb",
"symbol": "Tbnb",
"decimals": 18
},
"rpc": [
"https://opbnb.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://opbnb-testnet-rpc.bnbchain.org"
],
"explorers": [
{
"name": "opBNB Scan",
"url": "https://opbnbscan.com/",
"standard": ""
}
],
"faucets": [
"https://opbnb-testnet-bridge.bnbchain.org/"
],
"infoURL": "https://docs.bnbchain.org/",
"icon": {
"url": "ipfs://QmfFvfFsQKby3M32uqr8T55ENBnTHL8bkdeeu6rYVL2n4z/opbnblogo.svg",
"height": 512,
"width": 512,
"format": "svg"
},
"slug": "opbnb"
} as const satisfies Chain;
+12 -12
View File
@@ -4,7 +4,7 @@ export default {
"chain": "ETH",
"rpc": [
"https://zora.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.zora.co/"
"https://rpc.zora.energy/"
],
"faucets": [],
"nativeCurrency": {
@@ -12,23 +12,23 @@ export default {
"symbol": "ETH",
"decimals": 18
},
"infoURL": "https://zora.co",
"shortName": "zora",
"chainId": 7777777,
"networkId": 7777777,
"explorers": [
{
"name": "Zora Network Explorer",
"url": "https://explorer.zora.co",
"standard": "EIP3091"
}
],
"icon": {
"url": "ipfs://QmZ6qaRwTPFEZUspwMUjaxC6KhmzcELdRQcQzS3P72Dzts/Vector.svg",
"height": 512,
"width": 512,
"format": "svg"
},
"infoURL": "https://zora.energy",
"shortName": "zora",
"chainId": 7777777,
"networkId": 7777777,
"explorers": [
{
"name": "Zora Network Explorer",
"url": "https://explorer.zora.energy",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "zora"
} as const satisfies Chain;
+27
View File
@@ -2,6 +2,12 @@ import type { Chain } from "../src/types";
export default {
"name": "Patex",
"chain": "ETH",
"icon": {
"url": "ipfs://QmTNTSNn3t5WpSEzQmUYbkxYkBKaH6QahyVdVrRKyPHChr",
"width": 800,
"height": 800,
"format": "png"
},
"rpc": [
"https://patex.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.patex.io/"
@@ -12,10 +18,31 @@ export default {
"symbol": "ETH",
"decimals": 18
},
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"infoURL": "https://patex.io/",
"shortName": "peth",
"chainId": 789,
"networkId": 789,
"explorers": [
{
"name": "patexscan",
"url": "https://patexscan.io",
"icon": {
"url": "ipfs://QmTNTSNn3t5WpSEzQmUYbkxYkBKaH6QahyVdVrRKyPHChr",
"width": 800,
"height": 800,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "patex"
} as const satisfies Chain;
+15 -19
View File
@@ -1,39 +1,35 @@
import type { Chain } from "../src/types";
export default {
"name": "Shardeum Liberty 2.X",
"name": "Shardeum Sphinx DApp 1.X",
"shortName": "Sphinx",
"chain": "Shardeum",
"chainId": 8081,
"icon": {
"url": "ipfs://Qma1bfuubpepKn7DLDy4NPSKDeT3S4VPCNhu6UmdGrb6YD",
"width": 609,
"height": 533,
"height": 1200,
"width": 1200,
"url": "ipfs://QmQWzHUy4kmk1eGksDREGQL3GWrssdAPBxHt4aKGAFHSfJ",
"format": "png"
},
"rpc": [
"https://shardeum-liberty-2-x.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://liberty20.shardeum.org/"
],
"faucets": [
"https://faucet.liberty20.shardeum.org"
"https://shardeum-sphinx-dapp-1-x.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://dapps.shardeum.org/sphinx"
],
"nativeCurrency": {
"name": "Shardeum SHM",
"name": "Shardeum",
"symbol": "SHM",
"decimals": 18
},
"infoURL": "https://docs.shardeum.org/",
"shortName": "Liberty20",
"chainId": 8081,
"networkId": 8081,
"explorers": [
{
"name": "Shardeum Scan",
"url": "https://explorer-liberty20.shardeum.org",
"url": "https://explorer-dapps.shardeum.org",
"standard": "EIP3091"
}
],
"redFlags": [
"reusedChainId"
"faucets": [
"https://faucet-dapps.shardeum.org/"
],
"testnet": false,
"slug": "shardeum-liberty-2-x"
"infoURL": "https://docs.shardeum.org/",
"testnet": true,
"slug": "shardeum-sphinx-dapp-1-x"
} as const satisfies Chain;
+23
View File
@@ -0,0 +1,23 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "Omega Mainnet",
chain: "OmegaNetwork",
shortName: "OmegaNetwork",
chainId: 408,
testnet: false,
icon: {
format: "png",
url: "ipfs://bafkreig676zxfhwhcx5bvvvjxedx6ftr2wq4iiznrwm3c6ozrprbc4oxwm",
height: 512,
width: 512,
},
rpc: ["https://mainnet-rpc.omtch.com"],
nativeCurrency: {
name: "Omega Network Coin",
symbol: "OMN",
decimals: 18,
},
};
+32
View File
@@ -0,0 +1,32 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "opBNB",
chain: "opBNB",
shortName: "opBNB",
chainId: 5611,
testnet: true,
nativeCurrency: {
name: "Testnet bnb",
symbol: "Tbnb",
decimals: 18,
},
rpc: ["https://opbnb-testnet-rpc.bnbchain.org"],
explorers: [
{
name: "opBNB Scan",
url: "https://opbnbscan.com/",
standard: "",
},
],
faucets: ["https://opbnb-testnet-bridge.bnbchain.org/"],
infoURL: "https://docs.bnbchain.org/",
icon: {
url: "ipfs://QmfFvfFsQKby3M32uqr8T55ENBnTHL8bkdeeu6rYVL2n4z/opbnblogo.svg",
height: 512,
width: 512,
format: "svg",
},
};
+32
View File
@@ -0,0 +1,32 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Omit<Chain, "slug">} */
export default {
name: "Shardeum Sphinx DApp 1.X",
shortName: "Sphinx",
chain: "Shardeum",
chainId: 8081,
icon: {
height: 1200,
width: 1200,
url: "ipfs://QmQWzHUy4kmk1eGksDREGQL3GWrssdAPBxHt4aKGAFHSfJ",
format: "png",
},
rpc: ["https://dapps.shardeum.org/sphinx"],
nativeCurrency: {
name: "Shardeum",
symbol: "SHM",
decimals: 18,
},
explorers: [
{
name: "Shardeum Scan",
url: "https://explorer-dapps.shardeum.org",
standard: "EIP3091",
},
],
faucets: ["https://faucet-dapps.shardeum.org/"],
infoURL: "https://docs.shardeum.org/",
testnet: true,
};
+1 -1
View File
@@ -10,7 +10,7 @@ export default {
format: "png",
},
rpc: [
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.21",
"version": "0.1.24",
"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
+27
View File
@@ -1,5 +1,32 @@
# thirdweb
## 0.10.26
### Patch Changes
- [#1240](https://github.com/thirdweb-dev/js/pull/1240) [`1c7264b4`](https://github.com/thirdweb-dev/js/commit/1c7264b40330d068ece67df537a0f5db0f6aedca) Thanks [@Marfuen](https://github.com/Marfuen)! - Small bug fix for updating packages using --nightly
- Updated dependencies [[`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
- @thirdweb-dev/sdk@3.10.25
- @thirdweb-dev/storage@1.1.5
- @thirdweb-dev/chains@0.1.24
## 0.10.25
### Patch Changes
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
- @thirdweb-dev/chains@0.1.23
- @thirdweb-dev/sdk@3.10.24
## 0.10.24
### Patch Changes
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
- @thirdweb-dev/sdk@3.10.23
- @thirdweb-dev/chains@0.1.22
## 0.10.23
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.10.23",
"version": "0.10.26",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+5 -5
View File
@@ -1,8 +1,8 @@
import * as toml from "@iarna/toml";
import { PackageManagerType } from "../core/types/ProjectType";
import { existsSync, readFileSync } from "fs";
import { runCommand } from "../create/helpers/run-command";
import path from "path";
import { PackageManagerType } from "../core/types/ProjectType";
import { runCommand } from "../create/helpers/run-command";
import { IProcessAppTypeArgs, IProcessContractAppTypeArgs } from "./types";
export function convertDependenciesToStringFormat(dependenciesObject: object) {
@@ -174,7 +174,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
case "npm":
runner = "npm";
installCommand = ["install"];
updateCommand = ["update"]
updateCommand = ["install", "--legacy-peer-deps"]
break;
case "yarn":
runner = "yarn";
@@ -223,7 +223,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
}
if (typeOfAction === "install") {
if (!dependenciesToAdd.length) {return;}
if (!dependenciesToAdd.length) { return; }
const commands = [...installCommand, ...dependenciesToAdd];
await runCommand(runner, commands, printLogs);
@@ -233,7 +233,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
}
}
if (typeOfAction === "update") {
if (!dependenciesToUpdate.length) {return;}
if (!dependenciesToUpdate.length) { return; }
const commands = [...updateCommand, ...dependenciesToUpdate];
await runCommand(runner, commands, printLogs);
}
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/contracts-js
## 1.3.7
### Patch Changes
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
## 1.3.6
### Patch Changes
- [#1197](https://github.com/thirdweb-dev/js/pull/1197) [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added Zora drop ABI
- [#1134](https://github.com/thirdweb-dev/js/pull/1134) [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94) Thanks [@nkrishang](https://github.com/nkrishang)! - Introduce SmartWallet sdk class
## 1.3.5
### Patch Changes
File diff suppressed because one or more lines are too long
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/contracts-js",
"version": "1.3.5",
"version": "1.3.7",
"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.5"
"@thirdweb-dev/contracts": "3.5.9"
},
"devDependencies": {
"@babel/preset-env": "^7.18.10",
@@ -41,7 +41,7 @@
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist/",
"typechain": "rm -rf ./src && typechain --target ethers-v5 --out-dir src './node_modules/@thirdweb-dev/contracts/abi/*.json'",
"typechain": "rm -rf ./src && cp ./external_abis/*.json ./node_modules/@thirdweb-dev/contracts/abi && typechain --target ethers-v5 --out-dir src './node_modules/@thirdweb-dev/contracts/abi/*.json'",
"extract-abi": "node ./scripts/extract-abis.mjs",
"build": "pnpm typechain && tsc && pnpm preconstruct build && pnpm extract-abi",
"push": "yalc push"
@@ -9,15 +9,20 @@ import {
import { basename, join, resolve } from "path";
const main = () => {
const libFolder = resolve(
const sourceFolders = [];
sourceFolders.push(resolve(
"node_modules",
"@thirdweb-dev/contracts/abi",
);
));
sourceFolders.push(resolve(
"external_abis",
));
const destinationFolder = "./dist/abis";
if (existsSync(destinationFolder)) {
rmSync(destinationFolder, { recursive: true });
}
mkdirSync(destinationFolder);
for(const libFolder of sourceFolders) {
const abiFiles = readdirSync(libFolder);
for (const abiFile of abiFiles) {
const contractJsonFile = readFileSync(join(libFolder, abiFile), "utf-8");
@@ -28,6 +33,7 @@ const main = () => {
JSON.stringify(abi, null, 2),
);
}
}
};
main();
+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = {
// import rules
"import/first": "error",
"import/newline-after-import": "error",
"import/no-cycle": "warn",
"import/no-cycle": "error",
"import/no-useless-path-segments": "error",
//eslint
+4
View File
@@ -1,4 +1,8 @@
module.exports = {
root: true,
extends: ["thirdweb"],
plugins: ["better-tree-shaking"],
rules: {
"better-tree-shaking/no-top-level-side-effects": "error",
},
};
+44
View File
@@ -1,5 +1,49 @@
# @thirdweb-dev/react-core
## 3.14.3
### Patch Changes
- [#1235](https://github.com/thirdweb-dev/js/pull/1235) [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix required type for address on useSmartWalletsForAddress
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
- @thirdweb-dev/wallets@0.3.3
- @thirdweb-dev/sdk@3.10.25
- @thirdweb-dev/storage@1.1.5
- @thirdweb-dev/chains@0.1.24
## 3.14.2
### Patch Changes
- [#1230](https://github.com/thirdweb-dev/js/pull/1230) [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add useSmartWalletsForAddress hook
- [#1224](https://github.com/thirdweb-dev/js/pull/1224) [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Better return type for get shared metadata
- [#1213](https://github.com/thirdweb-dev/js/pull/1213) [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1) Thanks [@iketw](https://github.com/iketw)! - [ReactCore/Wallets] Improve error messages for wc and auth
- [#1218](https://github.com/thirdweb-dev/js/pull/1218) [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Add get for shared metadata
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
- @thirdweb-dev/chains@0.1.23
- @thirdweb-dev/sdk@3.10.24
- @thirdweb-dev/wallets@0.3.2
## 3.14.1
### Patch Changes
- [#1206](https://github.com/thirdweb-dev/js/pull/1206) [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939) Thanks [@MananTank](https://github.com/MananTank)! - Add eslint-plugin-better-tree-shaking
- [#1193](https://github.com/thirdweb-dev/js/pull/1193) [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a) Thanks [@jnsdls](https://github.com/jnsdls)! - add shared metadata extension (open edition)
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
- @thirdweb-dev/sdk@3.10.23
- @thirdweb-dev/wallets@0.3.1
- @thirdweb-dev/chains@0.1.22
## 3.14.0
### Patch Changes
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.14.0",
"version": "3.14.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -87,6 +87,7 @@
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-inclusive-language": "^2.2.0",
"eslint-plugin-prettier": "^4.2.1",
@@ -1,2 +1,2 @@
// eslint-disable-next-line turbo/no-undeclared-env-vars
// eslint-disable-next-line turbo/no-undeclared-env-vars, better-tree-shaking/no-top-level-side-effects
export const __DEV__ = process.env.NODE_ENV !== "production";
@@ -1,5 +1,5 @@
import { createContext } from "react";
export const ThirdwebThemeContext = createContext<"light" | "dark" | undefined>(
undefined,
);
export const ThirdwebThemeContext = /* @__PURE__ */ createContext<
"light" | "dark" | undefined
>(undefined);
@@ -88,7 +88,7 @@ type ThirdwebWalletContextData = {
getWalletConfig: (walletInstance: WalletInstance) => WalletConfig | undefined;
};
const ThirdwebWalletContext = createContext<
const ThirdwebWalletContext = /* @__PURE__ */ createContext<
ThirdwebWalletContextData | undefined
>(undefined);
@@ -52,7 +52,7 @@ function ChangeActiveWalletOnAccountSwitch() {
try {
await switchAccount(data.address);
} catch (err) {
console.warn(
console.debug(
`[Auth] Failed to switch account to ${data.address} with error:\n`,
err,
);
@@ -63,7 +63,7 @@ function ChangeActiveWalletOnAccountSwitch() {
try {
await logout();
} catch (err) {
console.warn(`[Auth] Failed to logout with error:\n`, err);
console.debug(`[Auth] Failed to logout with error:\n`, err);
}
};
@@ -38,7 +38,7 @@ export interface ThirdwebAuthConfig {
export interface ThirdwebAuthContext extends ThirdwebAuthConfig {}
export const ThirdwebAuthContext = createContext<
export const ThirdwebAuthContext = /* @__PURE__ */ createContext<
ThirdwebAuthContext | undefined
>(undefined);
@@ -8,9 +8,10 @@ interface ThirdwebConfigContext {
infuraApiKey?: string;
}
const ThirdwebConfigContext = createContext<ThirdwebConfigContext>({
chains: defaultChains,
});
const ThirdwebConfigContext =
/* @__PURE__ */ createContext<ThirdwebConfigContext>({
chains: defaultChains,
});
export const ThirdwebConfigProvider: React.FC<
PropsWithChildren<{
@@ -26,7 +26,9 @@ const INITIAL_CONTEXT_VALUE: ThirdwebConnectedWalletContext = {
};
const ThirdwebConnectedWalletContext =
createContext<ThirdwebConnectedWalletContext>(INITIAL_CONTEXT_VALUE);
/* @__PURE__ */ createContext<ThirdwebConnectedWalletContext>(
INITIAL_CONTEXT_VALUE,
);
export const ThirdwebConnectedWalletProvider: React.FC<
PropsWithChildren<{ signer?: Signer }>
+71 -4
View File
@@ -1,3 +1,4 @@
import { BasicNFTInput } from "@thirdweb-dev/sdk/dist/declarations/src/core/schema/nft";
import {
requiredParamInvariant,
RequiredParam,
@@ -23,6 +24,7 @@ import {
useMutation,
UseMutationResult,
useQueryClient,
UseQueryResult,
} from "@tanstack/react-query";
import { Erc1155, QueryAllParams, NFT } from "@thirdweb-dev/sdk";
import { BigNumber, BigNumberish, providers } from "ethers";
@@ -318,6 +320,44 @@ export function useNFTBalance(
);
}
/**
* Get the shared metadata of an Open Edition NFT contract
*
* @example
* ```javascript
* const { data: sharedMetadata, isLoading, error } = useSharedMetadata(contract);
* ```
*
* @param contract - an instance of a {@link NFTContract}
* @returns a response object that includes the shared metadata of the contract
* @twfeature ERC721SharedMetadata
* @see {@link https://portal.thirdweb.com/react/react.usesharedmetadata?utm_source=sdk | Documentation}
* @beta
*/
export function useSharedMetadata(
contract: RequiredParam<NFTContract>,
): UseQueryResult<BasicNFTInput | undefined> {
const contractAddress = contract?.getAddress();
const { erc721 } = getErcs(contract);
return useQueryWithNetwork(
cacheKeys.contract.nft.sharedMetadata.get(contractAddress),
() => {
requiredParamInvariant(contract, "No Contract instance provided");
if (erc721) {
invariant(
erc721.sharedMetadata.get,
"Contract instance does not support sharedMetadata.get",
);
return erc721.sharedMetadata.get();
}
invariant(false, "Unknown NFT type");
},
{
enabled: !!contract,
},
);
}
/** **********************/
/** WRITE HOOKS **/
/** **********************/
@@ -604,10 +644,6 @@ export function useAirdropNFT(contract: Erc1155) {
);
}
/** **********************/
/** WRITE HOOKS **/
/** **********************/
/**
* Burn an NFT
*
@@ -676,3 +712,34 @@ export function useBurnNFT<TContract extends NFTContract>(
},
);
}
/**
* Set shared metadata
* TODO add docs
* @private
*/
export function useSetSharedMetadata<TContract extends NFTContract>(
contract: RequiredParam<TContract>,
) {
const activeChainId = useSDKChainId();
const contractAddress = contract?.getAddress();
const queryClient = useQueryClient();
const { erc721 } = getErcs(contract);
return useMutation(
async (data: BasicNFTInput) => {
if (erc721) {
return await erc721.sharedMetadata.set(data);
}
invariant(false, "Unknown NFT type");
},
{
onSettled: () =>
invalidateContractAndBalances(
queryClient,
contractAddress,
activeChainId,
),
},
);
}
@@ -14,14 +14,10 @@ import {
useQueryClient,
UseQueryResult,
} from "@tanstack/react-query";
import type {
AccountEvent, SmartContract,
} from "@thirdweb-dev/sdk";
import type { AccountEvent, SmartContract } from "@thirdweb-dev/sdk";
import type { BytesLike } from "ethers";
import invariant from "tiny-invariant";
/** **********************/
/** READ HOOKS **/
/** **********************/
@@ -41,7 +37,7 @@ import invariant from "tiny-invariant";
* @beta
*/
export function useSmartWallets(
contract: RequiredParam<SmartContract>
contract: RequiredParam<SmartContract>,
): UseQueryResult<AccountEvent[]> {
const contractAddress = contract?.getAddress();
return useQueryWithNetwork(
@@ -49,10 +45,46 @@ export function useSmartWallets(
() => {
requiredParamInvariant(contract, "No Contract instance provided");
invariant(
contract.smartWalletFactory.getAllWallets,
"Contract instance does not support contract.smartWalletFactory.getAllWallets",
contract.smartWalletFactory.getAllAccounts,
"Contract instance does not support contract.smartWalletFactory.getAllAccounts",
);
return contract.smartWalletFactory.getAllWallets();
return contract.smartWalletFactory.getAllAccounts();
},
{ enabled: !!contract },
);
}
/**
* Get all wallets associated with the provided address
*
* @example
* ```javascript
* const { data: smartWalletsForAddress, isLoading, error } = useSmartWalletsForAddress(contract, "{{wallet_address}}");
* ```
*
* @param contract - an instance of a smart wallet factory contract
* @returns a response object that includes an array of all smart wallets associated with the adress
* @twfeature SmartWalletFactory
* @see {@link https://portal.thirdweb.com/react/react.usesmartwalletsforaddress?utm_source=sdk | Documentation}
* @beta
*/
export function useSmartWalletsForAddress(
contract: RequiredParam<SmartContract>,
address: RequiredParam<WalletAddress>,
): UseQueryResult<string[]> {
const contractAddress = contract?.getAddress();
return useQueryWithNetwork(
cacheKeys.contract.smartWalletFactory.getAllForAddress(
contractAddress,
address,
),
() => {
requiredParamInvariant(contract, "No Contract instance provided");
invariant(
contract.smartWalletFactory.getAssociatedWallets,
"Contract instance does not support contract.smartWalletFactory.getAssociatedWallets",
);
return contract.smartWalletFactory.getAssociatedWallets(address || "");
},
{ enabled: !!contract },
);
@@ -79,7 +111,10 @@ export function useIsSmartWalletDeployed(
): UseQueryResult<boolean> {
const contractAddress = contract?.getAddress();
return useQueryWithNetwork(
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(contractAddress, admin),
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(
contractAddress,
admin,
),
() => {
requiredParamInvariant(contract, "No Contract instance provided");
invariant(
@@ -130,9 +165,7 @@ export function useIsSmartWalletDeployed(
* @see {@link https://portal.thirdweb.com/react/react.usecreatesmartwallet?utm_source=sdk | Documentation}
* @beta
*/
export function useCreateSmartWallet(
contract: RequiredParam<SmartContract>,
) {
export function useCreateSmartWallet(contract: RequiredParam<SmartContract>) {
const activeChainId = useSDKChainId();
const contractAddress = contract?.getAddress();
const queryClient = useQueryClient();
@@ -141,10 +174,7 @@ export function useCreateSmartWallet(
async (admin: string, extraData?: BytesLike) => {
requiredParamInvariant(contract, "contract is undefined");
return contract.smartWalletFactory.createWallet(
admin,
extraData,
);
return contract.smartWalletFactory.createWallet(admin, extraData);
},
{
onSettled: () =>
+3
View File
@@ -167,6 +167,8 @@ export {
useTransferNFT,
useAirdropNFT,
useBurnNFT,
useSharedMetadata,
useSetSharedMetadata,
} from "./hooks/async/nft";
// roles
@@ -197,6 +199,7 @@ export {
useIsSmartWalletDeployed,
useSmartWallets,
useCreateSmartWallet,
useSmartWalletsForAddress,
} from "./hooks/async/smart-wallet-factory";
// thirdweb hooks (work as long as at least `<ThirdwebSdkProvider>` is used)
@@ -14,7 +14,7 @@ interface TWSDKContext {
_inProvider?: true;
}
const ThirdwebSDKContext = createContext<TWSDKContext>({});
const ThirdwebSDKContext = /* @__PURE__ */ createContext<TWSDKContext>({});
/**
*
@@ -123,6 +123,8 @@ export const cacheKeys = {
createContractCacheKey(contractAddress, ["smartWalletFactory"]),
isSmartWalletDeployed: (contractAdress: RequiredParam<ContractAddress>, admin: RequiredParam<string>) =>
createContractCacheKey(contractAdress, ["isSmartWalletDeployed", admin]),
getAllForAddress: (contractAdress: RequiredParam<ContractAddress>, address: RequiredParam<string>) =>
createContractCacheKey(contractAdress, ["getAllForAddress", address]),
},
app: {
@@ -190,6 +192,14 @@ export const cacheKeys = {
]),
},
},
sharedMetadata: {
get: (
contractAddress: RequiredParam<ContractAddress>,
) =>
createContractCacheKey(
contractAddress
),
},
drop: {
getAllUnclaimed: (
contractAddress: RequiredParam<ContractAddress>,
@@ -21,9 +21,9 @@ export interface ThirdwebAuthConfig {
interface ThirdwebAuthContext extends ThirdwebAuthConfig {}
const ThirdwebAuthContext = createContext<ThirdwebAuthContext | undefined>(
undefined,
);
const ThirdwebAuthContext = /* @__PURE__ */ createContext<
ThirdwebAuthContext | undefined
>(undefined);
export const ThirdwebAuthProvider: React.FC<
PropsWithChildren<{ value?: ThirdwebAuthConfig }>
@@ -94,7 +94,7 @@ interface ThirdwebSDKContext {
desiredNetwork: string;
_inProvider?: true;
}
const ThirdwebSDKContext = createContext<ThirdwebSDKContext>({
const ThirdwebSDKContext = /* @__PURE__ */ createContext<ThirdwebSDKContext>({
sdk: null,
desiredNetwork: "unknown",
});
@@ -1,5 +1,11 @@
# @thirdweb-dev/react-native-compat
## 0.2.22
## 0.2.21
## 0.2.20
## 0.2.19
## 0.2.18
+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.19",
"version": "0.2.22",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+97
View File
@@ -1,5 +1,102 @@
# @thirdweb-dev/react-native
## 0.2.22
### Patch Changes
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [RN]
- Added the option to import a new wallet in guest mode
- Added a "Request Testnet Funds" option when on testnets
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Export more components for easy development
- IconTextButton
Component that renders an icon and a text inside a button with border:
```javascript
<IconTextButton
mt="xs"
text="Switch Accounts"
icon={<SwitchIcon height={10} width={10} />}
onPress={() => {}}
/>
```
- NetworkButton: Used to render a Network
```javascript
<NetworkButton
chainIconUrl={chain?.icon?.url || ""}
chainName={chain?.name || "Unknown Network"}
onPress={onChangeNetworkPress}
/>
```
- Exported all icons from the assets folder for external use
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.2.21
### Patch Changes
- [#1220](https://github.com/thirdweb-dev/js/pull/1220) [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2) Thanks [@iketw](https://github.com/iketw)! - [RN/Wallets] Fix Coinbase wallet connection rejection error
Unhandled Rejections: We were rethrowing an error in an async function (connect) without any catch block to handle it. We were getting an Unhandled Promise Rejection, which lead to a crash in React Native when rejecting a connection from the Coinbase Wallet.
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.2.20
### Patch Changes
- [#1202](https://github.com/thirdweb-dev/js/pull/1202) [`04416e7c`](https://github.com/thirdweb-dev/js/commit/04416e7c93d3b090fe0145ada6de5dbec211e29d) Thanks [@iketw](https://github.com/iketw)! - [RN] Return connection Promise in wallets hooks for better error handling
- [#1205](https://github.com/thirdweb-dev/js/pull/1205) [`3ab7d1e9`](https://github.com/thirdweb-dev/js/commit/3ab7d1e97541ad5ff4f58ec2885fda9f9ab1a7c6) Thanks [@iketw](https://github.com/iketw)! - [RN] Added the option to import a new wallet in guest mode
- [#1205](https://github.com/thirdweb-dev/js/pull/1205) [`3ab7d1e9`](https://github.com/thirdweb-dev/js/commit/3ab7d1e97541ad5ff4f58ec2885fda9f9ab1a7c6) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Export more components for easy development
- IconTextButton
Component that renders an icon and a text inside a button with border:
```javascript
<IconTextButton
mt="xs"
text="Switch Accounts"
icon={<SwitchIcon height={10} width={10} />}
onPress={() => {}}
/>
```
- NetworkButton: Used to render a Network
```javascript
<NetworkButton
chainIconUrl={chain?.icon?.url || ""}
chainName={chain?.name || "Unknown Network"}
onPress={onChangeNetworkPress}
/>
```
- Exported all icons from the assets folder for external use
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 0.2.19
### Patch Changes
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.19",
"version": "0.2.22",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -24,7 +24,7 @@
"android"
],
"dependencies": {
"@coinbase/wallet-mobile-sdk": "^1.0.4",
"@coinbase/wallet-mobile-sdk": "1.0.6",
"@magic-sdk/provider": "17.2.0",
"@magic-sdk/react-native-bare": "^18.3.0",
"@shopify/restyle": "^2.4.1",
@@ -0,0 +1,12 @@
export * from "./back";
export * from "./close";
export * from "./copy";
export * from "./disconnect";
export * from "./down-arrow";
export * from "./eye-closed";
export * from "./eye-opened";
export * from "./qr-code";
export * from "./right-arrow";
export * from "./wallet";
export * from "./money";
export * from "./switch";
@@ -0,0 +1,22 @@
import Svg, { Circle, Path } from "react-native-svg";
import { IconStyleProp } from "./types";
const MoneyIcon = ({ width, height, color }: IconStyleProp) => {
return (
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
<Circle
cx="8"
cy="8"
r="6.335"
stroke={color || "#646D7A"}
stroke-width="1.33"
/>
<Path
d="M7.82244 11.7273V4.45455H8.28835V11.7273H7.82244ZM8.9446 6.92614C8.92566 6.7178 8.84138 6.55587 8.69176 6.44034C8.54403 6.32292 8.33286 6.2642 8.05824 6.2642C7.87642 6.2642 7.72491 6.28788 7.60369 6.33523C7.48248 6.38258 7.39157 6.44792 7.33097 6.53125C7.27036 6.61269 7.23911 6.70644 7.23722 6.8125C7.23343 6.89962 7.25047 6.97633 7.28835 7.04261C7.32813 7.1089 7.38494 7.16761 7.45881 7.21875C7.53456 7.26799 7.62547 7.31155 7.73153 7.34943C7.83759 7.38731 7.95691 7.42045 8.08949 7.44886L8.58949 7.5625C8.87737 7.625 9.13116 7.70833 9.35085 7.8125C9.57244 7.91667 9.75805 8.04072 9.90767 8.18466C10.0592 8.3286 10.1738 8.49432 10.2514 8.68182C10.3291 8.86932 10.3688 9.07955 10.3707 9.3125C10.3688 9.67992 10.276 9.99527 10.0923 10.2585C9.90862 10.5218 9.64441 10.7235 9.29972 10.8636C8.95691 11.0038 8.54309 11.0739 8.05824 11.0739C7.5715 11.0739 7.14725 11.0009 6.78551 10.8551C6.42377 10.7093 6.14252 10.4877 5.94176 10.1903C5.741 9.89299 5.63778 9.51705 5.6321 9.0625H6.97869C6.99006 9.25 7.04025 9.40625 7.12926 9.53125C7.21828 9.65625 7.34044 9.75095 7.49574 9.81534C7.65294 9.87973 7.83475 9.91193 8.04119 9.91193C8.23059 9.91193 8.39157 9.88636 8.52415 9.83523C8.65862 9.78409 8.76184 9.71307 8.83381 9.62216C8.90578 9.53125 8.94271 9.42708 8.9446 9.30966C8.94271 9.19981 8.90862 9.10606 8.84233 9.02841C8.77604 8.94886 8.67377 8.88068 8.53551 8.82386C8.39915 8.76515 8.22491 8.71117 8.01278 8.66193L7.40483 8.51989C6.90104 8.40436 6.50426 8.2178 6.21449 7.96023C5.92472 7.70076 5.78078 7.35038 5.78267 6.90909C5.78078 6.54924 5.87737 6.2339 6.07244 5.96307C6.26752 5.69223 6.53741 5.48106 6.8821 5.32955C7.2268 5.17803 7.61979 5.10227 8.06108 5.10227C8.51184 5.10227 8.90294 5.17898 9.23438 5.33239C9.56771 5.4839 9.82623 5.69697 10.0099 5.97159C10.1937 6.24621 10.2874 6.56439 10.2912 6.92614H8.9446Z"
fill={color || "#646D7A"}
/>
</Svg>
);
};
export default MoneyIcon;
@@ -0,0 +1,18 @@
import Svg, { Path } from "react-native-svg";
import { IconStyleProp } from "./types";
const SwitchIcon = ({ width, height, color }: IconStyleProp) => {
return (
<Svg width={width} height={height} viewBox="0 0 12 12" fill="none">
<Path
d="M7.99967 0.666626H10.6663M10.6663 0.666626V3.33329M10.6663 0.666626L7.83301 4.16663M1.33301 10.6666L3.99967 7.99996M7.99967 10.6666H10.6663M10.6663 10.6666V7.99996M10.6663 10.6666L1.33301 1.33329"
stroke={color || "#646D7A"}
stroke-width="1.33333"
stroke-linecap="round"
stroke-linejoin="round"
/>
</Svg>
);
};
export default SwitchIcon;
@@ -1,8 +1,9 @@
import Svg, { Path } from "react-native-svg";
import { IconStyleProp } from "./types";
const PocketWalletIcon = ({ size }: { size: number }) => {
const PocketWalletIcon = ({ width, height }: IconStyleProp) => {
return (
<Svg width={size} height={size} viewBox="0 0 16 16" fill="none">
<Svg width={width} height={height} viewBox="0 0 16 16" fill="none">
<Path
d="M13.3337 7.99996V5.33329H4.00033C3.6467 5.33329 3.30756 5.19282 3.05752 4.94277C2.80747 4.69272 2.66699 4.35358 2.66699 3.99996C2.66699 3.26663 3.26699 2.66663 4.00033 2.66663H12.0003V5.33329"
stroke="#646D7A"
@@ -1,7 +1,10 @@
import { ThemeProvider } from "../styles/ThemeProvider";
import { WalletDetailsButton } from "./ConnectWalletDetails/WalletDetailsButton";
import {
ConnectWalletDetailsProps,
WalletDetailsButton,
} from "./ConnectWalletDetails/WalletDetailsButton";
import { useAddress } from "@thirdweb-dev/react-core";
import React, { useEffect, useRef } from "react";
import { useEffect, useRef } from "react";
import { Animated } from "react-native";
import { ConnectWalletButton } from "./ConnectWalletFlow/ConnectWalletButton";
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
@@ -10,7 +13,7 @@ export type ConnectWalletProps = {
/**
* render a custom button to display the connected wallet details instead of the default button
*/
detailsButton?: React.ReactElement;
detailsButton?: ConnectWalletDetailsProps["detailsButton"];
} & ConnectWalletButtonProps;
export const ConnectWallet = ({
@@ -1,8 +1,8 @@
import { StyleSheet, View } from "react-native";
import { Linking, StyleSheet, View } from "react-native";
import Box from "../base/Box";
import { Toast } from "../base/Toast";
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
import { NetworkButton } from "./NetworkButton";
import { NetworkButton } from "../base/NetworkButton";
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
import {
useActiveChain,
@@ -22,6 +22,8 @@ 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";
export const ConnectWalletDetailsModal = () => {
const theme = useAppTheme();
@@ -113,7 +115,7 @@ export const ConnectWalletDetailsModal = () => {
onPress={onExportLocalWalletPress}
>
<>
<PocketWalletIcon size={16} />
<PocketWalletIcon width={16} height={16} />
<View style={styles.exportWalletInfo}>
<Text variant="bodySmall">Backup wallet</Text>
</View>
@@ -134,7 +136,7 @@ export const ConnectWalletDetailsModal = () => {
onPress={onImportLocalWalletPress}
>
<>
<PocketWalletIcon size={16} />
<PocketWalletIcon width={16} height={16} />
<View style={styles.exportWalletInfo}>
<Text variant="bodySmall">Import wallet</Text>
</View>
@@ -192,6 +194,18 @@ export const ConnectWalletDetailsModal = () => {
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"} />
@@ -109,7 +109,7 @@ export const SmartWalletAdditionalActions = ({
onPress={onExportPress}
>
<>
<PocketWalletIcon size={16} />
<PocketWalletIcon width={16} height={16} />
<View style={styles.exportWalletInfo}>
<Text variant="bodySmall">
{wallet?.walletId === walletIds.localWallet
@@ -3,8 +3,7 @@ import BaseButton from "../base/BaseButton";
import { ChainIcon } from "../base/ChainIcon";
import Text from "../base/Text";
import { WalletIcon } from "../base/WalletIcon";
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
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";
@@ -12,7 +11,7 @@ import Box from "../base/Box";
export type ConnectWalletDetailsProps = {
address: string;
detailsButton?: React.ReactElement;
detailsButton?: React.FC<{ onPress: () => void }>;
};
export const WalletDetailsButton = ({
@@ -20,7 +19,7 @@ export const WalletDetailsButton = ({
detailsButton,
}: ConnectWalletDetailsProps) => {
const activeWallet = useWallet();
const chain = useActiveChain();
const chain = useChain();
const balanceQuery = useBalance();
const { setModalState } = useModalState();
@@ -38,15 +37,15 @@ export const WalletDetailsButton = ({
return (
<>
<BaseButton
backgroundColor="background"
borderColor="border"
style={styles.walletDetails}
onPress={onPress}
>
{detailsButton ? (
detailsButton
) : (
{detailsButton ? (
detailsButton({ onPress })
) : (
<BaseButton
backgroundColor="background"
borderColor="border"
style={styles.walletDetails}
onPress={onPress}
>
<Box flex={1} flexDirection="row" justifyContent="space-between">
<ChainIcon size={32} chainIconUrl={chain?.icon?.url} />
<Box justifyContent="center" alignItems="flex-start">
@@ -70,8 +69,8 @@ export const WalletDetailsButton = ({
iconUri={activeWallet?.getMeta().iconURL || ""}
/>
</Box>
)}
</BaseButton>
</BaseButton>
)}
</>
);
};
@@ -39,13 +39,13 @@ export const ConnectWalletFlow = () => {
const connectActiveWallet = useCallback(
async (wallet: WalletConfig, data?: any) => {
setIsConnecting(true);
connect(wallet, { ...data })
.catch((error) => {
console.error("Error connecting to the wallet", error);
})
.finally(() => {
onClose(true);
});
try {
await connect(wallet, { ...data });
} catch (error) {
console.error("Error connecting to the wallet", error);
} finally {
onClose(true);
}
},
[connect, onClose],
);
@@ -0,0 +1,62 @@
import { ReactNode } from "react";
import { Theme } from "../../styles/theme";
import BaseButton from "./BaseButton";
import ImageSvgUri from "./ImageSvgUri";
import Text from "./Text";
import { StyleSheet } from "react-native";
type IconTextProps = {
icon?:
| { iconUrl?: string; iconWidth?: number; iconHeight?: number }
| ReactNode;
text: string;
padding?: keyof Theme["spacing"];
onPress: () => void;
} & (typeof BaseButton)["arguments"];
export const IconTextButton = ({
icon,
onPress,
text,
p,
...args
}: IconTextProps) => {
return (
<BaseButton
p={p || "md"}
backgroundColor="background"
style={styles.networkContainer}
onPress={onPress}
borderColor="border"
{...args}
>
{icon && icon.iconUrl ? (
<ImageSvgUri
imageUrl={icon.iconUrl}
height={icon.iconHeight}
width={icon.iconWidth}
/>
) : (
icon
)}
<Text variant="bodySmall" style={styles.networkText}>
{text}
</Text>
{/* <RightArrowIcon size={10} /> */}
</BaseButton>
);
};
const styles = StyleSheet.create({
networkText: {
marginLeft: 16,
},
networkContainer: {
borderRadius: 8,
borderWidth: 0.5,
display: "flex",
flexDirection: "row",
justifyContent: "flex-start",
alignItems: "center",
},
});
@@ -1,7 +1,7 @@
import { Theme } from "../../styles/theme";
import BaseButton from "../base/BaseButton";
import { ChainIcon } from "../base/ChainIcon";
import Text from "../base/Text";
import BaseButton from "./BaseButton";
import { ChainIcon } from "./ChainIcon";
import Text from "./Text";
import { StyleSheet } from "react-native";
interface NetworkButtonProps {
@@ -1,3 +1,4 @@
export { IconTextButton } from "./IconTextButton";
export { ActiveDot } from "./ActiveDot";
export { AddressDisplay } from "./AddressDisplay";
export { default as BaseButton } from "./BaseButton";
@@ -11,3 +12,7 @@ export { TextInput } from "./TextInput";
export { Toast } from "./Toast";
export { WalletButton } from "./WalletButton";
export { WalletIcon } from "./WalletIcon";
export { NetworkButton } from "./NetworkButton";
export { TWModal } from "./modal/TWModal";
export { ModalFooter } from "./modal/ModalFooter";
export { ModalHeaderTextClose } from "./modal/ModalHeaderTextClose";
+3
View File
@@ -39,6 +39,9 @@ export { createSecureStorage } from "../core/SecureStorage";
// ui components
export * from "./components/base";
// assets / icons
export * from "./assets";
// providers
// export * from "./providers/full";
export * from "./providers/thirdweb-provider";
@@ -72,10 +72,10 @@ export class CoinbaseWalletConnector extends WagmiConnector<
this.emit("message", { type: "connecting" });
const account = (await provider.request({
const accounts: string[] = await provider.request({
method: "eth_requestAccounts",
params: [],
})) as Address;
});
// Switch to chain if provided
let id = await this.getChainId();
let unsupported = this.isChainUnsupported(id);
@@ -93,7 +93,7 @@ export class CoinbaseWalletConnector extends WagmiConnector<
}
return {
account,
account: accounts[0],
chain: { id, unsupported },
provider: new providers.Web3Provider(
provider as unknown as providers.ExternalProvider,
@@ -18,8 +18,11 @@ export function useCoinbaseWallet(callbackURL: string) {
return useCallback(
async (connectOptions?: { chainId?: number; callbackURL: string }) => {
const { coinbaseWallet } = await import("../wallets/coinbase-wallet");
// @ts-ignore
connect(coinbaseWallet({ callbackURL: callbackURL }), connectOptions);
return connect(
// @ts-ignore
coinbaseWallet({ callbackURL: callbackURL }),
connectOptions,
);
},
[connect, callbackURL],
);
@@ -12,7 +12,7 @@ export function useMetaMaskWallet() {
return useCallback(
async (connectOptions?: { chainId?: number }) => {
const { metamaskWallet } = await import("../wallets/metamask-wallet");
connect(metamaskWallet(), connectOptions);
return connect(metamaskWallet(), connectOptions);
},
[connect],
);
@@ -12,7 +12,7 @@ export function useRainbowWallet() {
return useCallback(
async (connectOptions?: { chainId?: number }) => {
const { rainbowWallet } = await import("../wallets/rainbow-wallet");
connect(rainbowWallet(), connectOptions);
return connect(rainbowWallet(), connectOptions);
},
[connect],
);
@@ -12,7 +12,7 @@ export function useTrustWallet() {
return useCallback(
async (connectOptions?: { chainId?: number }) => {
const { trustWallet } = await import("../wallets/trust-wallet");
connect(trustWallet(), connectOptions);
return connect(trustWallet(), connectOptions);
},
[connect],
);
+2
View File
@@ -1,7 +1,9 @@
module.exports = {
root: true,
extends: ["thirdweb"],
plugins: ["better-tree-shaking"],
rules: {
"@next/next/no-img-element": "off",
"better-tree-shaking/no-top-level-side-effects": "error",
},
};
+75
View File
@@ -1,5 +1,80 @@
# @thirdweb-dev/react
## 3.14.3
### Patch Changes
- [#1238](https://github.com/thirdweb-dev/js/pull/1238) [`6e1fe6e5`](https://github.com/thirdweb-dev/js/commit/6e1fe6e582d4178884fc1793b330a9e477df5b4d) Thanks [@iketw](https://github.com/iketw)! - '[React] Adds Rainbow and Trust wallets hooks'
```javascript
import { useRainbowWallet, useTrustWallet } from "@thirdweb-dev/react";
const connectWithRainbow = useRainbowWallet();
const connectWithTrust = useTrustWallet();
```
- [#1237](https://github.com/thirdweb-dev/js/pull/1237) [`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b) Thanks [@iketw](https://github.com/iketw)! - [React] Add Rainbow Wallet (implementing the WalletConnect wallet)
```javascript
import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react";
const activeChain = "ethereum";
<ThirdwebProvider
activeChain={activeChain}
supportedWallets={[rainbowWallet()]}
>
<App />
</ThirdwebProvider>;
```
- [#1236](https://github.com/thirdweb-dev/js/pull/1236) [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f) Thanks [@iketw](https://github.com/iketw)! - [Wallets/React] Add Trust Wallet
```javascript
import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react";
const activeChain = "mumbai";
<ThirdwebProvider
activeChain={activeChain}
autoSwitch={true}
supportedWallets={[trustWallet()]}
>
<App />
</ThirdwebProvider>;
```
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.14.2
### Patch Changes
- [#1226](https://github.com/thirdweb-dev/js/pull/1226) [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1) Thanks [@MananTank](https://github.com/MananTank)! - Add Magic Connect support
- Updated dependencies [[`6816219a`](https://github.com/thirdweb-dev/js/commit/6816219ac13ae571a0c90db6ab389c319bc1f052), [`48065bcd`](https://github.com/thirdweb-dev/js/commit/48065bcd91c13e1f44d54343b5c6c2646b9e86e4), [`3cb298ac`](https://github.com/thirdweb-dev/js/commit/3cb298ac4b04d295899b5ac77c7fc5869ec2f5f2), [`b5e1d3bb`](https://github.com/thirdweb-dev/js/commit/b5e1d3bb2b82785d6d3e5c899d27691bdb638625), [`6aa6f7e0`](https://github.com/thirdweb-dev/js/commit/6aa6f7e0bd2313e2e1ad96dd41aad91e6694d380), [`f7f4f207`](https://github.com/thirdweb-dev/js/commit/f7f4f20737ac5d78424ca9c91220f00b85adde6b), [`3ce5f9a0`](https://github.com/thirdweb-dev/js/commit/3ce5f9a0c3fc7e99b5abf691a87048ab8475f6b1), [`d4d95507`](https://github.com/thirdweb-dev/js/commit/d4d95507130b2b5408bfaa73ef3b708ca00c773e), [`a388d07a`](https://github.com/thirdweb-dev/js/commit/a388d07a3d449e56dc53fed9600931022f4a15e1), [`1ce8558d`](https://github.com/thirdweb-dev/js/commit/1ce8558df47186bcba5ee8564fdb04583bf115dd), [`483e2b91`](https://github.com/thirdweb-dev/js/commit/483e2b910934d75276a68bae64d04c47cd7d57e3), [`c08e6ba9`](https://github.com/thirdweb-dev/js/commit/c08e6ba988ad97aa27d5868cec8abe3498d07a0a), [`60fb1889`](https://github.com/thirdweb-dev/js/commit/60fb18894372f14d9cd815fa9a239926d31bb273), [`3d615a62`](https://github.com/thirdweb-dev/js/commit/3d615a62d0a6801f6fb0e63f9b95c2f98446add1)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.14.1
### Patch Changes
- [#1206](https://github.com/thirdweb-dev/js/pull/1206) [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939) Thanks [@MananTank](https://github.com/MananTank)! - Add eslint-plugin-better-tree-shaking
- Updated dependencies [[`d9b7360d`](https://github.com/thirdweb-dev/js/commit/d9b7360d1d78abcdaca89aa35e66388cbc5eb26c), [`8a2d9204`](https://github.com/thirdweb-dev/js/commit/8a2d92046a416c99c6bfecf63a6fdb6cc02ea175), [`990c665d`](https://github.com/thirdweb-dev/js/commit/990c665de9e5c1070dc80fe0f1b434e251f70a94), [`3d62278a`](https://github.com/thirdweb-dev/js/commit/3d62278aba79101ae1158fb726d6ddfed505c939), [`c6f44722`](https://github.com/thirdweb-dev/js/commit/c6f44722f9d123db4e7c4c799fe8e0374a02107c), [`45ae105e`](https://github.com/thirdweb-dev/js/commit/45ae105ed3e48bfbf6be84aa12ecb0fb55a917b7), [`f41f1a29`](https://github.com/thirdweb-dev/js/commit/f41f1a2958a2cedcf0496c9a3ca284d0b98f1b89), [`bb7ca20e`](https://github.com/thirdweb-dev/js/commit/bb7ca20e49c5c374b12a4ed746a2ac3db488abd9), [`23d61cfe`](https://github.com/thirdweb-dev/js/commit/23d61cfeff2e5a885c511416d7491e7933ed404a), [`8941b226`](https://github.com/thirdweb-dev/js/commit/8941b22682d1b15a6e0d311b1e8548b95d6cfadf), [`e0ce4a37`](https://github.com/thirdweb-dev/js/commit/e0ce4a37596a91a072f8551e323fce6723113dcb)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.14.0
### Minor Changes
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.14.0",
"version": "3.14.3",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -107,6 +107,7 @@
"eslint": "^8.42.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-thirdweb": "workspace:*",
"eslint-plugin-better-tree-shaking": "0.0.3",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-inclusive-language": "^2.2.0",
"eslint-plugin-prettier": "^4.2.1",
+1 -1
View File
@@ -3,7 +3,7 @@ import styled from "@emotion/styled";
import { Chain } from "@thirdweb-dev/chains";
import { resolveIpfsUri } from "@thirdweb-dev/react-core";
const defaultChainIcon = resolveIpfsUri(
const defaultChainIcon = /* @__PURE__ */ resolveIpfsUri(
"ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png",
);
+1 -1
View File
@@ -28,6 +28,6 @@ export const CopyIcon: React.FC<{
);
};
const CheckIconStyled = styled(CheckIcon)<{ theme?: Theme }>`
const CheckIconStyled = /* @__PURE__ */ styled(CheckIcon)<{ theme?: Theme }>`
color: ${(p) => p.theme.icon.success};
`;
+3 -1
View File
@@ -117,7 +117,9 @@ export const DragNDrop: React.FC<{
);
};
const UploadIconSecondary = styled(UploadIcon)<{ theme?: Theme }>`
const UploadIconSecondary = /* @__PURE__ */ styled(UploadIcon)<{
theme?: Theme;
}>`
color: ${(props) => props.theme.text.secondary};
transition: transform 200ms ease, color 200ms ease;
`;
+3 -1
View File
@@ -152,7 +152,9 @@ const DialogContent = styled.div<{ theme?: Theme }>`
}
`;
const DialogTitle = styled(Dialog.Title)<{ theme?: Theme }>`
const DialogTitle = /* @__PURE__ */ styled(/* @__PURE__ */ Dialog.Title)<{
theme?: Theme;
}>`
margin: 0;
font-weight: 500;
color: ${(p) => p.theme.text.neutral};
+13 -3
View File
@@ -1,4 +1,10 @@
import { fontSize, radius, shadow, spacing, type Theme } from "../design-system";
import {
fontSize,
radius,
shadow,
spacing,
type Theme,
} from "../design-system";
import { keyframes } from "@emotion/react";
import styled from "@emotion/styled";
import * as RXPopover from "@radix-ui/react-popover";
@@ -35,7 +41,9 @@ from {
}
`;
const PopoverContent = styled(RXPopover.Content)<{ theme?: Theme }>`
const PopoverContent = /* @__PURE__ */ styled(
/* @__PURE__ */ RXPopover.Content,
)<{ theme?: Theme }>`
border-radius: ${radius.sm};
padding: ${spacing.sm} ${spacing.md};
background-color: ${(p) => p.theme.bg.inverted};
@@ -48,7 +56,9 @@ const PopoverContent = styled(RXPopover.Content)<{ theme?: Theme }>`
font-size: ${fontSize.md};
`;
const PopoverArrow = styled(RXPopover.Arrow)<{ theme?: Theme }>`
const PopoverArrow = /* @__PURE__ */ styled(/* @__PURE__ */ RXPopover.Arrow)<{
theme?: Theme;
}>`
fill: ${(p) => p.theme.bg.inverted};
`;
+2 -2
View File
@@ -56,7 +56,7 @@ const QRCodeContainer = styled.div`
box-shadow: ${shadow.md};
`;
const StyledReactQrCode = styled(ReactQrCode)`
const StyledReactQrCode = /* @__PURE__ */ styled(ReactQrCode)`
width: 200px;
height: 200px;
border-radius: ${radius.md};
@@ -67,7 +67,7 @@ const StyledReactQrCode = styled(ReactQrCode)`
}
`;
const QRSkeleton = styled(Skeleton)`
const QRSkeleton = /* @__PURE__ */ styled(Skeleton)`
width: 200px;
height: 200px;
border-radius: ${radius.md};
+10 -2
View File
@@ -40,7 +40,11 @@ to {
}
`;
const TooltipContent = styled(RadixTooltip.Content)<{ theme?: Theme }>`
const TooltipContent = /* @__PURE__ */ styled(
/* @__PURE__ */ RadixTooltip.Content,
)<{
theme?: Theme;
}>`
background: ${(p) => p.theme.tooltip.bg};
color: ${(p) => p.theme.tooltip.text};
border-radius: ${radius.sm};
@@ -56,6 +60,10 @@ const TooltipContent = styled(RadixTooltip.Content)<{ theme?: Theme }>`
line-height: 1.5;
`;
const TooltipArrow = styled(RadixTooltip.Arrow)<{ theme?: Theme }>`
const TooltipArrow = /* @__PURE__ */ styled(
/* @__PURE__ */ RadixTooltip.Arrow,
)<{
theme?: Theme;
}>`
fill: ${(p) => p.theme.tooltip.bg};
`;
@@ -5,7 +5,7 @@ import styled from "@emotion/styled";
import { Title } from "@radix-ui/react-dialog";
import { ChevronLeftIcon } from "@radix-ui/react-icons";
export const ModalTitle = styled(Title)<{
export const ModalTitle = /* @__PURE__ */ styled(Title)<{
theme?: Theme;
centerOnMobile?: boolean;
}>`
@@ -22,7 +22,7 @@ import React, {
} from "react";
import type { MediaRendererProps } from "./types";
const ModelViewer = lazy(() => import("./ModelViewer"));
const ModelViewer = /* @__PURE__ */ lazy(() => import("./ModelViewer"));
interface PlayButtonProps {
onClick: () => void;
@@ -76,7 +76,10 @@ const PlayButton: React.FC<PlayButtonProps> = ({ onClick, isPlaying }) => {
);
};
const VideoPlayer = React.forwardRef<HTMLVideoElement, MediaRendererProps>(
const VideoPlayer = /* @__PURE__ */ React.forwardRef<
HTMLVideoElement,
MediaRendererProps
>(
(
{
src,
@@ -176,186 +179,189 @@ const VideoPlayer = React.forwardRef<HTMLVideoElement, MediaRendererProps>(
VideoPlayer.displayName = "VideoPlayer";
const AudioPlayer = React.forwardRef<HTMLAudioElement, MediaRendererProps>(
({ src, alt, poster, style, height, width, ...restProps }, ref) => {
const audioRef = useRef<HTMLAudioElement>(null);
const [playing, setPlaying] = useState(false);
const [muted, setMuted] = useState(true);
const AudioPlayer = /* @__PURE__ */ React.forwardRef<
HTMLAudioElement,
MediaRendererProps
>(({ src, alt, poster, style, height, width, ...restProps }, ref) => {
const audioRef = useRef<HTMLAudioElement>(null);
const [playing, setPlaying] = useState(false);
const [muted, setMuted] = useState(true);
useEffect(() => {
if (audioRef.current) {
if (playing) {
audioRef.current.play();
} else {
audioRef.current.pause();
audioRef.current.currentTime = 0;
}
useEffect(() => {
if (audioRef.current) {
if (playing) {
audioRef.current.play();
} else {
audioRef.current.pause();
audioRef.current.currentTime = 0;
}
}, [playing]);
}
}, [playing]);
return (
<div style={{ position: "relative", ...style }} {...restProps}>
{poster ? (
<img
height={height}
width={width}
src={poster}
style={{
height: "100%",
width: "100%",
pointerEvents: "none",
objectFit: "contain",
}}
alt={alt}
/>
) : (
<div
style={{
width: "100%",
height: "100%",
display: "grid",
placeItems: "center",
pointerEvents: "none",
backgroundColor: "#fff",
color: "rgb(138, 147, 155)",
}}
>
<CarbonDocumentAudio style={{ height: "64px", width: "64px" }} />
</div>
)}
<PlayButton
onClick={() => {
setPlaying((prev) => !prev);
setMuted(false);
}}
isPlaying={playing}
/>
<audio
ref={mergeRefs([audioRef, ref])}
src={src ?? undefined}
loop
playsInline
muted={muted}
preload="none"
controlsList="nodownload"
return (
<div style={{ position: "relative", ...style }} {...restProps}>
{poster ? (
<img
height={height}
width={width}
src={poster}
style={{
position: "absolute",
opacity: 0,
pointerEvents: "none",
zIndex: -1,
visibility: "hidden",
}}
/>
</div>
);
},
);
AudioPlayer.displayName = "AudioPlayer";
const IframePlayer = React.forwardRef<HTMLIFrameElement, MediaRendererProps>(
({ src, alt, poster, requireInteraction, style, ...restProps }, ref) => {
const [playing, setPlaying] = useState(!requireInteraction);
return (
<div style={{ position: "relative", ...style }} {...restProps}>
<iframe
src={playing ? src ?? undefined : undefined}
ref={ref}
style={{
objectFit: "contain",
zIndex: 1,
height: "100%",
width: "100%",
transition: "opacity .5s",
opacity: !poster ? 1 : playing ? 1 : 0,
pointerEvents: "none",
objectFit: "contain",
}}
sandbox="allow-scripts"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
alt={alt}
/>
{poster && (
<img
src={poster}
style={{
objectFit: "contain",
pointerEvents: "none",
position: "absolute",
width: "100%",
height: "100%",
zIndex: 2,
transition: "opacity .5s",
opacity: playing ? 0 : 1,
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
alt={alt}
/>
)}
<PlayButton
onClick={() => {
setPlaying((prev) => !prev);
}}
isPlaying={playing}
/>
</div>
);
},
);
IframePlayer.displayName = "IframePlayer";
const LinkPlayer = React.forwardRef<HTMLAnchorElement, MediaRendererProps>(
({ src, alt, style, ...restProps }, ref) => {
return (
<div style={{ position: "relative", ...style }} {...restProps}>
) : (
<div
style={{
width: "100%",
height: "100%",
display: "grid",
placeItems: "center",
pointerEvents: "none",
backgroundColor: "#fff",
color: "rgb(138, 147, 155)",
}}
>
<div
<CarbonDocumentAudio style={{ height: "64px", width: "64px" }} />
</div>
)}
<PlayButton
onClick={() => {
setPlaying((prev) => !prev);
setMuted(false);
}}
isPlaying={playing}
/>
<audio
ref={mergeRefs([audioRef, ref])}
src={src ?? undefined}
loop
playsInline
muted={muted}
preload="none"
controlsList="nodownload"
style={{
position: "absolute",
opacity: 0,
pointerEvents: "none",
zIndex: -1,
visibility: "hidden",
}}
/>
</div>
);
});
AudioPlayer.displayName = "AudioPlayer";
const IframePlayer = /* @__PURE__ */ React.forwardRef<
HTMLIFrameElement,
MediaRendererProps
>(({ src, alt, poster, requireInteraction, style, ...restProps }, ref) => {
const [playing, setPlaying] = useState(!requireInteraction);
return (
<div style={{ position: "relative", ...style }} {...restProps}>
<iframe
src={playing ? src ?? undefined : undefined}
ref={ref}
style={{
objectFit: "contain",
zIndex: 1,
height: "100%",
width: "100%",
transition: "opacity .5s",
opacity: !poster ? 1 : playing ? 1 : 0,
}}
sandbox="allow-scripts"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"
/>
{poster && (
<img
src={poster}
style={{
objectFit: "contain",
pointerEvents: "none",
position: "absolute",
width: "100%",
height: "100%",
zIndex: 2,
transition: "opacity .5s",
opacity: playing ? 0 : 1,
top: 0,
left: 0,
right: 0,
bottom: 0,
}}
alt={alt}
/>
)}
<PlayButton
onClick={() => {
setPlaying((prev) => !prev);
}}
isPlaying={playing}
/>
</div>
);
});
IframePlayer.displayName = "IframePlayer";
const LinkPlayer = /* @__PURE__ */ React.forwardRef<
HTMLAnchorElement,
MediaRendererProps
>(({ src, alt, style, ...restProps }, ref) => {
return (
<div style={{ position: "relative", ...style }} {...restProps}>
<div
style={{
width: "100%",
height: "100%",
display: "grid",
placeItems: "center",
backgroundColor: "#fff",
color: "rgb(138, 147, 155)",
}}
>
<div
style={{
display: "flex",
flexDirection: "column",
gap: "8px",
alignItems: "center",
flexWrap: "nowrap",
}}
>
<CarbonDocumentUnknown
style={{
display: "flex",
flexDirection: "column",
gap: "8px",
alignItems: "center",
flexWrap: "nowrap",
maxWidth: "128px",
minWidth: "48px",
width: "50%",
aspectRatio: "1",
}}
/>
<a
rel="noopener noreferrer"
style={{
textDecoration: "underline",
color: "rgb(138, 147, 155)",
}}
href={src ?? undefined}
target="_blank"
ref={ref as unknown as React.LegacyRef<HTMLAnchorElement>}
>
<CarbonDocumentUnknown
style={{
maxWidth: "128px",
minWidth: "48px",
width: "50%",
aspectRatio: "1",
}}
/>
<a
rel="noopener noreferrer"
style={{
textDecoration: "underline",
color: "rgb(138, 147, 155)",
}}
href={src ?? undefined}
target="_blank"
ref={ref as unknown as React.LegacyRef<HTMLAnchorElement>}
>
{alt || "File"}
</a>
</div>
{alt || "File"}
</a>
</div>
</div>
);
},
);
</div>
);
});
LinkPlayer.displayName = "LinkPlayer";
@@ -380,7 +386,7 @@ LinkPlayer.displayName = "LinkPlayer";
*
* You can try switching out the `src` prop to different types of URLs and media types to explore the possibilities.
*/
export const MediaRenderer = React.forwardRef<
export const MediaRenderer = /* @__PURE__ */ React.forwardRef<
HTMLMediaElement,
MediaRendererProps
>(
@@ -11,23 +11,24 @@ declare global {
}
}
export const ModelViewer = React.forwardRef<HTMLDivElement, MediaRendererProps>(
({ src, alt, poster, style }, ref) => {
return (
<div style={{ ...style }} ref={ref}>
{src ? (
<model-viewer
src={src}
alt={alt || "3D Model"}
camera-controls
poster={poster ? poster : null}
style={{ width: "100%", height: "100%" } as CSSStyleDeclaration}
/>
) : null}
</div>
);
},
);
export const ModelViewer = /* @__PURE__ */ React.forwardRef<
HTMLDivElement,
MediaRendererProps
>(({ src, alt, poster, style }, ref) => {
return (
<div style={{ ...style }} ref={ref}>
{src ? (
<model-viewer
src={src}
alt={alt || "3D Model"}
camera-controls
poster={poster ? poster : null}
style={{ width: "100%", height: "100%" } as CSSStyleDeclaration}
/>
) : null}
</div>
);
});
ModelViewer.displayName = "ModelViewer";
@@ -41,7 +41,7 @@ export interface ThirdwebNftMediaProps extends SharedMediaProps {
* }
* ```
*/
export const ThirdwebNftMedia = React.forwardRef<
export const ThirdwebNftMedia = /* @__PURE__ */ React.forwardRef<
HTMLMediaElement,
ThirdwebNftMediaProps
>(({ metadata, width = "300px", height = "300px", style, ...props }, ref) => {
+1 -1
View File
@@ -1,2 +1,2 @@
// eslint-disable-next-line turbo/no-undeclared-env-vars
// eslint-disable-next-line turbo/no-undeclared-env-vars, better-tree-shaking/no-top-level-side-effects
export const __DEV__ = process.env.NODE_ENV !== "production";
@@ -0,0 +1,15 @@
import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
export function useRainbowWallet() {
const connect = useConnect();
return useCallback(
async (connectOptions?: { chainId?: number }) => {
const { rainbowWallet } = await import(
"../../../wallet/wallets/rainbow/RainbowWallet"
);
return connect(rainbowWallet(), connectOptions);
},
[connect],
);
}
@@ -0,0 +1,15 @@
import { useConnect } from "@thirdweb-dev/react-core";
import { useCallback } from "react";
export function useTrustWallet() {
const connect = useConnect();
return useCallback(
async (connectOptions?: { chainId?: number }) => {
const { trustWallet } = await import(
"../../../wallet/wallets/trustWallet/TrustWallet"
);
return connect(trustWallet(), connectOptions);
},
[connect],
);
}
+2
View File
@@ -20,6 +20,8 @@ export { ThirdwebProvider } from "./providers/thirdweb-provider";
export { useInstalledWallets } from "../wallet/hooks/useInstalledWallets";
// wallet connection hooks
export { useRainbowWallet } from "./hooks/wallets/useRainbowWallet";
export { useTrustWallet } from "./hooks/wallets/useTrustWallet";
export { useMetamask } from "./hooks/wallets/useMetamask";
export { useCoinbaseWallet } from "./hooks/wallets/useCoinbaseWallet";
export { useFrameWallet } from "./hooks/wallets/useFrame";
+3 -1
View File
@@ -26,7 +26,9 @@ function useForceUpdate() {
}, []);
}
const useIsomorphicLayoutEffect = canUseDOM() ? useLayoutEffect : useEffect;
const useIsomorphicLayoutEffect = /* @__PURE__ */ canUseDOM()
? useLayoutEffect
: useEffect;
/**
* Portal from `@reach/portal`
@@ -8,16 +8,18 @@ type ModalConfig = {
data: any;
};
const WalletModalOpen = createContext(false);
const SetWalletModalOpen = createContext<BoolSetter | undefined>(undefined);
const WalletModalOpen = /* @__PURE__ */ createContext(false);
const SetWalletModalOpen = /* @__PURE__ */ createContext<
BoolSetter | undefined
>(undefined);
export const ModalConfigCtx = createContext<ModalConfig>({
export const ModalConfigCtx = /* @__PURE__ */ createContext<ModalConfig>({
title: "",
theme: "dark",
data: undefined,
});
export const SetModalConfigCtx = createContext<
export const SetModalConfigCtx = /* @__PURE__ */ createContext<
React.Dispatch<React.SetStateAction<ModalConfig>>
>(() => {});
+2
View File
@@ -4,7 +4,9 @@ export { coinbaseWallet } from "./wallet/wallets/coinbase/coinbaseWallet";
export { frameWallet } from "./wallet/wallets/frame/frameWallet";
export { metamaskWallet } from "./wallet/wallets/metamask/metamaskWallet";
export { paperWallet } from "./wallet/wallets/paperWallet";
export { rainbowWallet } from "./wallet/wallets/rainbow/RainbowWallet";
export { safeWallet } from "./wallet/wallets/safe/safeWallet";
export { trustWallet } from "./wallet/wallets/trustWallet/TrustWallet";
export { walletConnect } from "./wallet/wallets/walletConnect";
export { walletConnectV1 } from "./wallet/wallets/walletConnectV1";
export { smartWallet } from "./wallet/wallets/smartWallet/smartWallet";
@@ -151,7 +151,7 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = (props) => {
});
setIsWalletModalOpen(true);
}}
data-test="connect-wallet-button"
data-test="connect-wallet-button"
>
{isLoading ? <Spinner size="sm" color="inverted" /> : btnTitle}
</AnimatedButton>
@@ -175,6 +175,6 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = (props) => {
);
};
const AnimatedButton = styled(Button)`
const AnimatedButton = /* @__PURE__ */ styled(Button)`
animation: ${fadeInAnimation} 300ms ease;
`;
@@ -108,7 +108,7 @@ export const ConnectedWalletDetails: React.FC<{
className={`${TW_CONNECTED_WALLET} ${props.className || ""}`}
data-theme={props.theme}
style={props.style}
data-test="connected-wallet-details"
data-test="connected-wallet-details"
>
<ChainIcon
chain={chain}
@@ -458,7 +458,9 @@ const dropdownContentFade = keyframes`
}
`;
const DropDownContent = styled(DropdownMenu.Content)<{ theme?: Theme }>`
const DropDownContent = /* @__PURE__ */ styled(
/* @__PURE__ */ DropdownMenu.Content,
)<{ theme?: Theme }>`
width: 360px;
box-sizing: border-box;
max-width: 100%;
@@ -576,19 +578,25 @@ const MenuButton = styled.button<{ theme?: Theme }>`
}
`;
const MenuLink = MenuButton.withComponent("a");
const MenuLink = /* @__PURE__ */ MenuButton.withComponent("a");
export const DropdownMenuItem = styled(DropdownMenu.Item)<{ theme?: Theme }>`
export const DropdownMenuItem = /* @__PURE__ */ styled(
/* @__PURE__ */ DropdownMenu.Item,
)<{ theme?: Theme }>`
outline: none;
`;
export const StyledChevronRightIcon = styled(ChevronRightIcon)<{
export const StyledChevronRightIcon = /* @__PURE__ */ styled(
/* @__PURE__ */ ChevronRightIcon,
)<{
theme?: Theme;
}>`
color: ${(props) => props.theme.text.secondary};
`;
const DisconnectIconButton = styled(IconButton)<{ theme?: Theme }>`
const DisconnectIconButton = /* @__PURE__ */ styled(IconButton)<{
theme?: Theme;
}>`
margin-right: -${spacing.xxs};
margin-left: auto;
color: ${(props) => props.theme.icon.secondary};
@@ -374,7 +374,7 @@ const NetworkTab = (props: {
);
};
const NetworkList = memo(function NetworkList(props: {
const NetworkList = /* @__PURE__ */ memo(function NetworkList(props: {
chains: Chain[];
onSwitch: (chain: Chain) => void;
renderChain?: RenderChain;
@@ -503,7 +503,9 @@ const NetworkList = memo(function NetworkList(props: {
);
});
const TabButton = styled(Tabs.Trigger)<{ theme?: Theme }>`
const TabButton = /* @__PURE__ */ styled(/* @__PURE__ */ Tabs.Trigger)<{
theme?: Theme;
}>`
all: unset;
font-size: ${fontSize.md};
font-weight: 500;
@@ -575,7 +577,7 @@ const NetworkButton = styled.button<{ theme?: Theme }>`
}
`;
const StyledMagnifyingGlassIcon = styled(MagnifyingGlassIcon)<{
const StyledMagnifyingGlassIcon = /* @__PURE__ */ styled(MagnifyingGlassIcon)<{
theme?: Theme;
}>`
color: ${(p) => p.theme.text.secondary};
@@ -583,7 +585,7 @@ const StyledMagnifyingGlassIcon = styled(MagnifyingGlassIcon)<{
left: 18px;
`;
const SearchInput = styled(Input)<{ theme?: Theme }>`
const SearchInput = /* @__PURE__ */ styled(Input)<{ theme?: Theme }>`
padding: ${spacing.sm} ${spacing.md} ${spacing.sm} 60px;
`;
@@ -67,7 +67,7 @@ const TitleContainer = styled.div`
}
`;
const Desc = styled(ModalDescription)`
const Desc = /* @__PURE__ */ styled(ModalDescription)`
${media.mobile} {
max-width: 240px;
margin: 0 auto;
@@ -65,7 +65,7 @@ const IconContainer = styled.div`
}
`;
const Desc = styled(ModalDescription)`
const Desc = /* @__PURE__ */ styled(ModalDescription)`
${media.mobile} {
padding: 0 ${spacing.lg};
}
@@ -3,6 +3,7 @@ import { assertWindowEthereum } from "@thirdweb-dev/wallets";
export function useInstalledWallets() {
let isMetamaskInstalled = false;
let isCoinbaseWalletInstalled = false;
let isTrustWalletInstalled: boolean | undefined = false;
if (assertWindowEthereum(globalThis.window)) {
isMetamaskInstalled = globalThis.window.ethereum?.isMetaMask;
@@ -10,11 +11,13 @@ export function useInstalledWallets() {
globalThis.window.ethereum?.isCoinbaseWallet ||
globalThis.window.ethereum?.providers?.some((p) => p.isCoinbaseWallet) ||
false;
isTrustWalletInstalled = globalThis.window.ethereum?.isTrust;
}
const installedWallets = {
metamask: !!isMetamaskInstalled,
coinbaseWallet: !!isCoinbaseWalletInstalled,
trustWallet: !!isTrustWalletInstalled,
};
return installedWallets;

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