Compare commits
71
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e5eb13b82 | ||
|
|
2b11353909 | ||
|
|
5882091eab | ||
|
|
8fc5f204b0 | ||
|
|
c953571588 | ||
|
|
edcd22d612 | ||
|
|
0d5503aae9 | ||
|
|
998e521733 | ||
|
|
be606dd3c9 | ||
|
|
d794b8f9f4 | ||
|
|
21b29490d4 | ||
|
|
7b1d62b323 | ||
|
|
e78da6b36c | ||
|
|
ed711c8cb2 | ||
|
|
05a7495a13 | ||
|
|
11bb053246 | ||
|
|
efb3546ec8 | ||
|
|
0a5d2b5bdd | ||
|
|
ac3e019cd1 | ||
|
|
3c5dc4804a | ||
|
|
30ac3aef84 | ||
|
|
ef4cb09219 | ||
|
|
ad7dae3b16 | ||
|
|
0fd8aa04a9 | ||
|
|
620e89dc25 | ||
|
|
86d33c4b3e | ||
|
|
d43f6171d9 | ||
|
|
06ca1c407d | ||
|
|
c578a437cc | ||
|
|
0c5b03b8d6 | ||
|
|
9af346eead | ||
|
|
d9fb134ad4 | ||
|
|
1c7264b403 | ||
|
|
a140ee99b2 | ||
|
|
6e1fe6e582 | ||
|
|
536b0f1240 | ||
|
|
b626782b0e | ||
|
|
1d76334dd3 | ||
|
|
d498c79a91 | ||
|
|
736b45ac8e | ||
|
|
b5e1d3bb2b | ||
|
|
6816219ac1 | ||
|
|
48065bcd91 | ||
|
|
a388d07a3d | ||
|
|
483e2b9109 | ||
|
|
f7f4f20737 | ||
|
|
6aa6f7e0bd | ||
|
|
d4d9550713 | ||
|
|
3cb298ac4b | ||
|
|
c747670b98 | ||
|
|
c08e6ba988 | ||
|
|
60fb188943 | ||
|
|
1ce8558df4 | ||
|
|
3ce5f9a0c3 | ||
|
|
3d615a62d0 | ||
|
|
6ce366f59e | ||
|
|
8a2d92046a | ||
|
|
45ae105ed3 | ||
|
|
23d61cfeff | ||
|
|
990c665de9 | ||
|
|
08eaefcf0b | ||
|
|
3d62278aba | ||
|
|
3ab7d1e975 | ||
|
|
c6f44722f9 | ||
|
|
e0ce4a3759 | ||
|
|
04416e7c93 | ||
|
|
5166b24a48 | ||
|
|
bb7ca20e49 | ||
|
|
f41f1a2958 | ||
|
|
d9b7360d1d | ||
|
|
8941b22682 |
@@ -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.
|
||||
|
||||
@@ -1,5 +1,56 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 3.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2b113539`](https://github.com/thirdweb-dev/js/commit/2b113539098384f910b3c4d54e1fde9d35a6f053), [`be606dd3`](https://github.com/thirdweb-dev/js/commit/be606dd3c93c1514834c1d970e864d7f949a07ab), [`998e5217`](https://github.com/thirdweb-dev/js/commit/998e521733efd6a67e42f9bf0beab5fbdccf08ae)]:
|
||||
- @thirdweb-dev/wallets@1.0.3
|
||||
|
||||
## 3.2.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ed711c8c`](https://github.com/thirdweb-dev/js/commit/ed711c8cb2ed6a0deb1b2a5eeec06df1d4edc5e8), [`05a7495a`](https://github.com/thirdweb-dev/js/commit/05a7495a132aabab5f48abbdb80a468ff6f65df8), [`e78da6b3`](https://github.com/thirdweb-dev/js/commit/e78da6b36cfa6d954234820563201bf760186ed1)]:
|
||||
- @thirdweb-dev/wallets@1.0.2
|
||||
|
||||
## 3.2.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`efb3546e`](https://github.com/thirdweb-dev/js/commit/efb3546ec8268156be00301af28b9d83ecd5ab08)]:
|
||||
- @thirdweb-dev/wallets@1.0.1
|
||||
|
||||
## 3.2.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1250](https://github.com/thirdweb-dev/js/pull/1250) [`d43f6171`](https://github.com/thirdweb-dev/js/commit/d43f6171d910e31b748b171b012174390aac3fff) Thanks [@adam-maj](https://github.com/adam-maj)! - Allow setting login payload validity duration
|
||||
|
||||
- Updated dependencies [[`ac3e019c`](https://github.com/thirdweb-dev/js/commit/ac3e019cd1776dbdb0d06b213420ad17586f678e), [`3c5dc480`](https://github.com/thirdweb-dev/js/commit/3c5dc4804abc56b933ec45e9e1da11eb182296cc)]:
|
||||
- @thirdweb-dev/wallets@1.0.0
|
||||
|
||||
## 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,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "3.2.0",
|
||||
"version": "3.2.7",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -25,6 +25,11 @@ export default async function handler(
|
||||
version: ctx.authOptions?.version,
|
||||
chainId: parsedPayload.data.chainId || ctx.authOptions?.chainId,
|
||||
resources: ctx.authOptions?.resources,
|
||||
expirationTime: ctx.authOptions?.loginPayloadDurationInSeconds
|
||||
? new Date(
|
||||
Date.now() + 1000 * ctx.authOptions.loginPayloadDurationInSeconds,
|
||||
)
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return res.status(200).json({ payload });
|
||||
|
||||
@@ -44,6 +44,7 @@ export type ThirdwebAuthConfig<
|
||||
validateTokenId?:
|
||||
| ((tokenId: string) => void)
|
||||
| ((tokenId: string) => Promise<void>);
|
||||
loginPayloadDurationInSeconds?: number;
|
||||
tokenDurationInSeconds?: number;
|
||||
refreshIntervalInSeconds?: number;
|
||||
};
|
||||
|
||||
@@ -25,6 +25,11 @@ export default async function handler(
|
||||
version: ctx.authOptions?.version,
|
||||
chainId: parsedPayload.data.chainId || ctx.authOptions?.chainId,
|
||||
resources: ctx.authOptions?.resources,
|
||||
expirationTime: ctx.authOptions?.loginPayloadDurationInSeconds
|
||||
? new Date(
|
||||
Date.now() + 1000 * ctx.authOptions.loginPayloadDurationInSeconds,
|
||||
)
|
||||
: undefined,
|
||||
});
|
||||
|
||||
return res.status(200).json({ payload });
|
||||
|
||||
@@ -55,6 +55,7 @@ export type ThirdwebAuthConfig<
|
||||
validateTokenId?:
|
||||
| ((tokenId: string) => void)
|
||||
| ((tokenId: string) => Promise<void>);
|
||||
loginPayloadDurationInSeconds?: number;
|
||||
tokenDurationInSeconds?: number;
|
||||
refreshIntervalInSeconds?: number;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1276](https://github.com/thirdweb-dev/js/pull/1276) [`5882091e`](https://github.com/thirdweb-dev/js/commit/5882091eab65978009a5a5305701f121851b10ad) Thanks [@MananTank](https://github.com/MananTank)! - Do not change order or RPCs in `getChainRPCs` to Fix RPC override issue
|
||||
|
||||
## 0.1.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1248](https://github.com/thirdweb-dev/js/pull/1248) [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - update chains
|
||||
|
||||
- [#1243](https://github.com/thirdweb-dev/js/pull/1243) [`0fd8aa04`](https://github.com/thirdweb-dev/js/commit/0fd8aa04a9424497758d13a51a72363edcc30e19) Thanks [@therealharpaljadeja](https://github.com/therealharpaljadeja)! - update 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
|
||||
|
||||
@@ -10,9 +10,9 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://ethereum.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||
"wss://mainnet.infura.io/ws/v3/${INFURA_API_KEY}",
|
||||
"https://eth-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://api.mycryptoapi.com/eth",
|
||||
"https://cloudflare-eth.com",
|
||||
"https://ethereum.publicnode.com"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Optimism",
|
||||
"name": "OP Mainnet",
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://optimism.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://optimism-mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://mainnet.optimism.io/"
|
||||
],
|
||||
"faucets": [],
|
||||
|
||||
@@ -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;
|
||||
@@ -10,8 +10,8 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://polygon.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://polygon-mainnet.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://polygon-rpc.com/",
|
||||
"https://rpc-mainnet.matic.network",
|
||||
"https://matic-mainnet.chainstacklabs.com",
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
@@ -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": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Pego Network",
|
||||
"chain": "PEGO",
|
||||
"rpc": [
|
||||
"https://pego-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://pegorpc.com",
|
||||
"https://node1.pegorpc.com",
|
||||
"https://node2.pegorpc.com",
|
||||
"https://node3.pegorpc.com"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Pego Native Token",
|
||||
"symbol": "PG",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://pego.network",
|
||||
"shortName": "pg",
|
||||
"chainId": 20201022,
|
||||
"networkId": 20201022,
|
||||
"icon": {
|
||||
"url": "ipfs://QmVf1afskRHuZjFSLCZH8397KrVNAoYgyAePX9VMBrPVtx",
|
||||
"width": 246,
|
||||
"height": 247,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Pego Network Explorer",
|
||||
"url": "https://scan.pego.network",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "pego-network"
|
||||
} as const satisfies Chain;
|
||||
@@ -19,8 +19,8 @@ export default {
|
||||
"networkId": 1,
|
||||
"icon": {
|
||||
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"width": 180,
|
||||
"height": 180,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -21,8 +21,8 @@ export default {
|
||||
"networkId": 1,
|
||||
"icon": {
|
||||
"url": "ipfs://QmT7PSXBiVBma6E15hNkivmstqLu3JSnG1jXN5pTmcCGRC",
|
||||
"width": 200,
|
||||
"height": 200,
|
||||
"width": 180,
|
||||
"height": 180,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -4,8 +4,8 @@ export default {
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://optimism-goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://goerli.optimism.io/"
|
||||
],
|
||||
"faucets": [
|
||||
|
||||
@@ -13,8 +13,8 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://arbitrum-goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://arbitrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://arb-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://abritrum-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://goerli-rollup.arbitrum.io/rpc/"
|
||||
],
|
||||
"faucets": [],
|
||||
|
||||
@@ -12,15 +12,20 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://celo-alfajores-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://alfajores-forno.celo-testnet.org",
|
||||
"wss://alfajores-forno.celo-testnet.org/ws"
|
||||
"wss://alfajores-forno.celo-testnet.org/ws",
|
||||
"https://alfajores-forno.celo-testnet.org"
|
||||
],
|
||||
"faucets": [
|
||||
"https://celo.org/developers/faucet",
|
||||
"https://cauldron.pretoriaresearchlab.io/alfajores-faucet"
|
||||
"https://cauldron.pretoriaresearchlab.io/alfajores-faucet",
|
||||
"https://celo.org/developers/faucet"
|
||||
],
|
||||
"infoURL": "https://docs.celo.org/",
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Celoscan",
|
||||
"url": "https://alfajores.celoscan.io/",
|
||||
"standard": "EIP3091"
|
||||
},
|
||||
{
|
||||
"name": "Celoscan",
|
||||
"url": "https://celoscan.io",
|
||||
|
||||
@@ -5,9 +5,9 @@ export default {
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://goerli.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"wss://goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://rpc.goerli.mudit.blog/",
|
||||
"https://ethereum-goerli.publicnode.com"
|
||||
],
|
||||
|
||||
@@ -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;
|
||||
@@ -5,7 +5,8 @@ export default {
|
||||
"rpc": [
|
||||
"https://rollux.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.rollux.com",
|
||||
"wss://rpc.rollux.com/wss"
|
||||
"wss://rpc.rollux.com/wss",
|
||||
"https://rpc.ankr.com/rollux/${ANKR_API_KEY}"
|
||||
],
|
||||
"faucets": [
|
||||
"https://rollux.id/faucetapp"
|
||||
|
||||
@@ -5,10 +5,10 @@ export default {
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://linea-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.goerli.linea.build",
|
||||
"wss://rpc.goerli.linea.build",
|
||||
"https://linea-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"wss://linea-goerli.infura.io/v3/${INFURA_API_KEY}"
|
||||
"wss://linea-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://rpc.goerli.linea.build",
|
||||
"wss://rpc.goerli.linea.build"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucetlink.to/goerli"
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "ETC",
|
||||
"rpc": [
|
||||
"https://ethereum-classic.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://www.ethercluster.com/etc"
|
||||
"https://etc.rivet.link"
|
||||
],
|
||||
"faucets": [
|
||||
"https://free-online-app.com/faucet-for-eth-evm-chains/?"
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "ETC",
|
||||
"rpc": [
|
||||
"https://ethereum-classic-testnet-mordor.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://www.ethercluster.com/mordor"
|
||||
"https://rpc.mordor.etccooperative.org"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -11,8 +11,8 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://mumbai.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
"https://matic-mumbai.chainstacklabs.com",
|
||||
"https://rpc-mumbai.maticvigil.com",
|
||||
"https://matic-testnet-archive-rpc.bwarelabs.com",
|
||||
|
||||
@@ -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;
|
||||
@@ -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,
|
||||
},
|
||||
};
|
||||
@@ -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",
|
||||
},
|
||||
};
|
||||
@@ -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,
|
||||
};
|
||||
@@ -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}",
|
||||
],
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// @ts-check
|
||||
/** @typedef { import("../../src/types").Chain } Chain */
|
||||
|
||||
/** @type {Partial<Chain>} */
|
||||
export default {
|
||||
explorers: [
|
||||
{
|
||||
name: "Celoscan",
|
||||
url: "https://alfajores.celoscan.io/",
|
||||
standard: "EIP3091",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.21",
|
||||
"version": "0.1.26",
|
||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -80,6 +80,33 @@ chains = chains
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Sort RPCs in chain
|
||||
* @param {Chain} chain
|
||||
*/
|
||||
function sortRPCs(chain) {
|
||||
const thirdwebRPCs = [];
|
||||
const alchemyRPCs = [];
|
||||
const infuraRPCs = [];
|
||||
const otherRPCs = [];
|
||||
|
||||
chain.rpc.forEach((rpc) => {
|
||||
if (rpc.includes("${THIRDWEB_API_KEY}")) {
|
||||
thirdwebRPCs.push(rpc);
|
||||
} else if (rpc.includes("${ALCHEMY_API_KEY}")) {
|
||||
alchemyRPCs.push(rpc);
|
||||
} else if (rpc.includes("${INFURA_API_KEY}")) {
|
||||
infuraRPCs.push(rpc);
|
||||
} else {
|
||||
otherRPCs.push(rpc);
|
||||
}
|
||||
});
|
||||
|
||||
chain.rpc = [...thirdwebRPCs, ...infuraRPCs, ...alchemyRPCs, ...otherRPCs];
|
||||
}
|
||||
|
||||
chains.forEach(sortRPCs);
|
||||
|
||||
const imports = [];
|
||||
const exports = [];
|
||||
const exportNames = [];
|
||||
@@ -146,6 +173,10 @@ function findSlug(chain) {
|
||||
if (slug === "base-goerli-testnet") {
|
||||
slug = "base-goerli";
|
||||
}
|
||||
// optimisim rename handling
|
||||
if (slug === "op") {
|
||||
slug = "optimism";
|
||||
}
|
||||
// end special cases
|
||||
|
||||
takenSlugs[slug] = true;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -28,59 +28,45 @@ export function getChainRPCs(
|
||||
...options,
|
||||
};
|
||||
|
||||
const modeChains = chain.rpc.filter((rpc) => {
|
||||
if (rpc.startsWith("http") && mode === "http") {
|
||||
return true;
|
||||
}
|
||||
if (rpc.startsWith("ws") && mode === "ws") {
|
||||
return true;
|
||||
const processedRPCs: string[] = [];
|
||||
|
||||
chain.rpc.forEach((rpc) => {
|
||||
// exclude RPC if mode mismatch
|
||||
if (mode === "http" && !rpc.startsWith("http")) {
|
||||
return;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (mode === "ws" && !rpc.startsWith("ws")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace API_KEY placeholder with value
|
||||
if (thirdwebApiKey && rpc.includes("${THIRDWEB_API_KEY}")) {
|
||||
processedRPCs.push(rpc.replace("${THIRDWEB_API_KEY}", thirdwebApiKey));
|
||||
} else if (infuraApiKey && rpc.includes("${INFURA_API_KEY}")) {
|
||||
processedRPCs.push(rpc.replace("${INFURA_API_KEY}", infuraApiKey));
|
||||
} else if (alchemyApiKey && rpc.includes("${ALCHEMY_API_KEY}")) {
|
||||
processedRPCs.push(rpc.replace("${ALCHEMY_API_KEY}", alchemyApiKey));
|
||||
}
|
||||
|
||||
// exclude RPCs with unknown placeholder
|
||||
else if (rpc.includes("${")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// add as is
|
||||
else {
|
||||
processedRPCs.push(rpc);
|
||||
}
|
||||
});
|
||||
|
||||
const thirdwebRPC = modeChains
|
||||
.filter((rpc) => {
|
||||
return rpc.includes("${THIRDWEB_API_KEY}") && thirdwebApiKey;
|
||||
})
|
||||
.map((rpc) =>
|
||||
thirdwebApiKey ? rpc.replace("${THIRDWEB_API_KEY}", thirdwebApiKey) : rpc,
|
||||
);
|
||||
|
||||
const alchemyRPC = modeChains
|
||||
.filter((rpc) => {
|
||||
return rpc.includes("${ALCHEMY_API_KEY}") && alchemyApiKey;
|
||||
})
|
||||
.map((rpc) =>
|
||||
alchemyApiKey ? rpc.replace("${ALCHEMY_API_KEY}", alchemyApiKey) : rpc,
|
||||
);
|
||||
|
||||
const infuraRPC = modeChains
|
||||
.filter((rpc) => {
|
||||
return rpc.includes("${INFURA_API_KEY}") && infuraApiKey;
|
||||
})
|
||||
.map((rpc) =>
|
||||
infuraApiKey ? rpc.replace("${INFURA_API_KEY}", infuraApiKey) : rpc,
|
||||
);
|
||||
|
||||
const allOtherRpcs = modeChains.filter((rpc) => {
|
||||
return !rpc.includes("${");
|
||||
});
|
||||
|
||||
const orderedRPCs = [
|
||||
...thirdwebRPC,
|
||||
...infuraRPC,
|
||||
...alchemyRPC,
|
||||
...allOtherRpcs,
|
||||
];
|
||||
|
||||
if (orderedRPCs.length === 0) {
|
||||
if (processedRPCs.length === 0) {
|
||||
throw new Error(
|
||||
`No RPC available for chainId "${chain.chainId}" with mode ${mode}`,
|
||||
);
|
||||
}
|
||||
|
||||
return orderedRPCs;
|
||||
return processedRPCs;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,50 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.10.28
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1274](https://github.com/thirdweb-dev/js/pull/1274) [`8fc5f204`](https://github.com/thirdweb-dev/js/commit/8fc5f204b00733089c02beee92c86b0f1fcac271) Thanks [@Marfuen](https://github.com/Marfuen)! - Added all detections for deploy command and some minor bug fixes
|
||||
|
||||
- Updated dependencies [[`2b113539`](https://github.com/thirdweb-dev/js/commit/2b113539098384f910b3c4d54e1fde9d35a6f053), [`c9535715`](https://github.com/thirdweb-dev/js/commit/c95357158819abd42d4b0900ecc2fa40fcb957f8), [`5882091e`](https://github.com/thirdweb-dev/js/commit/5882091eab65978009a5a5305701f121851b10ad)]:
|
||||
- @thirdweb-dev/sdk@3.10.27
|
||||
- @thirdweb-dev/chains@0.1.26
|
||||
|
||||
## 0.10.27
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ef4cb092`](https://github.com/thirdweb-dev/js/commit/ef4cb092192c58c9b292b29590b888f45f9fd23d), [`30ac3aef`](https://github.com/thirdweb-dev/js/commit/30ac3aef840bde51a61acf786c709cffd3c47354), [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087), [`0fd8aa04`](https://github.com/thirdweb-dev/js/commit/0fd8aa04a9424497758d13a51a72363edcc30e19)]:
|
||||
- @thirdweb-dev/sdk@3.10.26
|
||||
- @thirdweb-dev/chains@0.1.25
|
||||
|
||||
## 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
|
||||
|
||||
@@ -2,7 +2,7 @@ import { CREATE_MESSAGES } from "../constants/constants";
|
||||
import { prepareEnvironment } from "@gmrchk/cli-testing-library";
|
||||
|
||||
// this creates an app, can take some time that's fine
|
||||
jest.setTimeout(120_000);
|
||||
jest.setTimeout(240_000);
|
||||
|
||||
describe("npx thirdweb detect", () => {
|
||||
it("should detect ERC721Base extensions", async () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.10.23",
|
||||
"version": "0.10.28",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
import inquirer from "inquirer";
|
||||
import { info } from "../helpers/logger";
|
||||
import { FrameworkType, PackageManagerType } from "../types/ProjectType";
|
||||
import inquirer from "inquirer";
|
||||
import NextDetector from "./frameworks/next";
|
||||
import CRADetector from "./frameworks/cra";
|
||||
import RemixDetector from "./frameworks/remix";
|
||||
import GatsbyDetector from "./frameworks/gatsby";
|
||||
import VueDetector from "./frameworks/vue";
|
||||
import ReactNativeCLIDetector from "./frameworks/reactNativeCli";
|
||||
import DjangoDetector from "./frameworks/django";
|
||||
import ExpoDetector from "./frameworks/expo";
|
||||
import FoundryDetector from "./frameworks/foundry";
|
||||
import HardhatDetector from "./frameworks/hardhat";
|
||||
import { FrameworkDetector } from "./detector";
|
||||
import TruffleDetector from "./frameworks/truffle";
|
||||
import BrownieDetector from "./frameworks/brownie";
|
||||
import FastAPIDetector from "./frameworks/fastAPI";
|
||||
import FlaskDetector from "./frameworks/flask";
|
||||
import PopulusDetector from "./frameworks/populus";
|
||||
import FastifyDetector from "./frameworks/fastify";
|
||||
import CRADetector from "./frameworks/cra";
|
||||
import DjangoDetector from "./frameworks/django";
|
||||
import EchoDetector from "./frameworks/echo";
|
||||
import ExpoDetector from "./frameworks/expo";
|
||||
import FastAPIDetector from "./frameworks/fastAPI";
|
||||
import FastifyDetector from "./frameworks/fastify";
|
||||
import FiberDetector from "./frameworks/fiber";
|
||||
import FlaskDetector from "./frameworks/flask";
|
||||
import FoundryDetector from "./frameworks/foundry";
|
||||
import GatsbyDetector from "./frameworks/gatsby";
|
||||
import GinDetector from "./frameworks/gin";
|
||||
import HardhatDetector from "./frameworks/hardhat";
|
||||
import NextDetector from "./frameworks/next";
|
||||
import PopulusDetector from "./frameworks/populus";
|
||||
import ReactNativeCLIDetector from "./frameworks/reactNativeCli";
|
||||
import RemixDetector from "./frameworks/remix";
|
||||
import RevelDetector from "./frameworks/revel";
|
||||
import TruffleDetector from "./frameworks/truffle";
|
||||
import ViteDetector from "./frameworks/vite";
|
||||
import VueDetector from "./frameworks/vue";
|
||||
import ZenjectDetector from "./frameworks/zenject";
|
||||
|
||||
export default async function detect(
|
||||
@@ -50,6 +51,7 @@ export default async function detect(
|
||||
new RevelDetector(),
|
||||
new TruffleDetector(),
|
||||
new VueDetector(),
|
||||
new ViteDetector(),
|
||||
new ZenjectDetector(),
|
||||
];
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import inquirer from "inquirer";
|
||||
import { info } from "../helpers/logger";
|
||||
import { LibraryType, PackageManagerType } from "../types/ProjectType";
|
||||
import { LibraryDetector } from "./detector";
|
||||
import inquirer from "inquirer";
|
||||
import ReactDetector from "./libraries/react";
|
||||
import ExpressDetector from "./libraries/express";
|
||||
import ReactNativeDetector from "./libraries/reactNative";
|
||||
import ViteDetector from "./libraries/vite";
|
||||
import Web3PyDetector from "./libraries/web3py";
|
||||
import PlayMakerDetector from "./libraries/playmaker";
|
||||
import ReactDetector from "./libraries/react";
|
||||
import ReactNativeDetector from "./libraries/reactNative";
|
||||
import Web3PyDetector from "./libraries/web3py";
|
||||
|
||||
export default async function detect(
|
||||
path: string,
|
||||
@@ -19,7 +18,6 @@ export default async function detect(
|
||||
new ExpressDetector(),
|
||||
new ReactDetector(),
|
||||
new ReactNativeDetector(),
|
||||
new ViteDetector(),
|
||||
new Web3PyDetector(),
|
||||
new PlayMakerDetector(),
|
||||
];
|
||||
|
||||
+5
-5
@@ -1,10 +1,10 @@
|
||||
import { LibraryDetector } from "../detector";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
import { LibraryType } from "../../types/ProjectType";
|
||||
import { parsePackageJson } from "../../../lib/utils";
|
||||
import { FrameworkType } from "../../types/ProjectType";
|
||||
import { FrameworkDetector } from "../detector";
|
||||
|
||||
export default class ViteDetector implements LibraryDetector {
|
||||
public libraryType: LibraryType = "vite";
|
||||
export default class ViteDetector implements FrameworkDetector {
|
||||
public frameworkType: FrameworkType = "vite";
|
||||
|
||||
public matches(path: string): boolean {
|
||||
const packageJsonPath = path + "/package.json";
|
||||
@@ -16,7 +16,7 @@ export default class ViteDetector implements LibraryDetector {
|
||||
const packageJson = readFileSync(packageJsonPath);
|
||||
const { dependencies, devDependencies } = parsePackageJson(packageJson);
|
||||
const viteDependencyExists =
|
||||
dependencies["vite"] || devDependencies["vite"] || false;
|
||||
!!dependencies["vite"] || !!devDependencies["vite"] || false;
|
||||
|
||||
return viteDependencyExists;
|
||||
}
|
||||
@@ -56,6 +56,7 @@ export type FrameworkType =
|
||||
| "revel"
|
||||
| "fiber"
|
||||
| "zenject"
|
||||
| "vite"
|
||||
| "none";
|
||||
export type LibraryType =
|
||||
| "react"
|
||||
|
||||
@@ -1,30 +1,57 @@
|
||||
import NPMDetector from "../core/detection/npm";
|
||||
import ViteDetector from "../core/detection/vite";
|
||||
import YarnDetector from "../core/detection/yarn";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import detectFramework from "../core/detection/detectFramework";
|
||||
import detectPackageManager from "../core/detection/detectPackageManager";
|
||||
import { logger } from "../core/helpers/logger";
|
||||
import { runCommand } from "../create/helpers/run-command";
|
||||
import { upload } from "../storage/command";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
|
||||
export async function deployApp(distPath = "dist", projectPath = ".") {
|
||||
const storage = new ThirdwebStorage();
|
||||
const supportedFrameworks = [new ViteDetector()];
|
||||
const detectedPackageManager = await detectPackageManager(projectPath, {});
|
||||
const detectedFramework = await detectFramework(projectPath, {}, detectedPackageManager);
|
||||
|
||||
const possibleProjects = supportedFrameworks
|
||||
.filter((detector) => detector.matches(projectPath))
|
||||
.map((detector) => detector.projectType);
|
||||
|
||||
const hasYarn = new YarnDetector().matches(".");
|
||||
const hasNPM = new NPMDetector().matches(".");
|
||||
|
||||
if (possibleProjects.length === 0) {
|
||||
if (detectedFramework === "none") {
|
||||
throw new Error("No supported project detected");
|
||||
}
|
||||
|
||||
switch (detectedFramework) {
|
||||
case "next":
|
||||
distPath = "out";
|
||||
break;
|
||||
case "cra":
|
||||
distPath = "build";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
logger.info(`Detected project type: ${detectedFramework}`);
|
||||
logger.info(`Detected package manager: ${detectedPackageManager}`);
|
||||
logger.info(`distPath: ${distPath}`);
|
||||
logger.info(`projectPath: ${projectPath}`);
|
||||
|
||||
try {
|
||||
if (hasYarn) {
|
||||
await runCommand("yarn", ["build"]);
|
||||
} else if (hasNPM) {
|
||||
await runCommand("npm", ["build"]);
|
||||
switch (detectedPackageManager) {
|
||||
case "yarn":
|
||||
await runCommand("yarn", ["build"], true);
|
||||
if (detectedFramework === "next") {
|
||||
await runCommand("yarn", ["export"], true);
|
||||
}
|
||||
break;
|
||||
case "npm":
|
||||
await runCommand("npm", ["run", "build"], true);
|
||||
if (detectedFramework === "next") {
|
||||
await runCommand("npm", ["run", "export"], true);
|
||||
}
|
||||
break;
|
||||
case "pnpm":
|
||||
await runCommand("pnpm", ["build"], true);
|
||||
if (detectedFramework === "next") {
|
||||
await runCommand("pnpm", ["export"], true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Error("No supported package manager detected");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Can't build project");
|
||||
@@ -33,9 +60,9 @@ export async function deployApp(distPath = "dist", projectPath = ".") {
|
||||
|
||||
try {
|
||||
const uri = await upload(storage, distPath);
|
||||
return `https://thirdweb.com/app/deploy/${uri.replace("ipfs://", "")}`;
|
||||
return `${uri.replace("ipfs://", "https://ipfs-public.thirdwebcdn.com/ipfs/")}`;
|
||||
} catch (err) {
|
||||
console.error("Can't upload project");
|
||||
console.error("Can't upload project", err);
|
||||
return Promise.reject("Can't upload project");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { spinner } from "../core/helpers/logger";
|
||||
import { BufferOrStringWithName, ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { spinner } from "../core/helpers/logger";
|
||||
|
||||
function recurseFiles(
|
||||
uploadPath: string,
|
||||
|
||||
@@ -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
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: ["thirdweb"],
|
||||
plugins: ["better-tree-shaking"],
|
||||
rules: {
|
||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,91 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.14.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1271](https://github.com/thirdweb-dev/js/pull/1271) [`c9535715`](https://github.com/thirdweb-dev/js/commit/c95357158819abd42d4b0900ecc2fa40fcb957f8) Thanks [@nkrishang](https://github.com/nkrishang)! - Rename smart wallets to account
|
||||
|
||||
- [#1273](https://github.com/thirdweb-dev/js/pull/1273) [`edcd22d6`](https://github.com/thirdweb-dev/js/commit/edcd22d61236edb2832f9b2f9796e891d58cb145) Thanks [@MananTank](https://github.com/MananTank)! - Add `autoConnectTimeout` to `ThirdwebProvider` to timeout wallet autoconnect
|
||||
|
||||
- Updated dependencies [[`2b113539`](https://github.com/thirdweb-dev/js/commit/2b113539098384f910b3c4d54e1fde9d35a6f053), [`c9535715`](https://github.com/thirdweb-dev/js/commit/c95357158819abd42d4b0900ecc2fa40fcb957f8), [`be606dd3`](https://github.com/thirdweb-dev/js/commit/be606dd3c93c1514834c1d970e864d7f949a07ab), [`5882091e`](https://github.com/thirdweb-dev/js/commit/5882091eab65978009a5a5305701f121851b10ad), [`998e5217`](https://github.com/thirdweb-dev/js/commit/998e521733efd6a67e42f9bf0beab5fbdccf08ae)]:
|
||||
- @thirdweb-dev/wallets@1.0.3
|
||||
- @thirdweb-dev/sdk@3.10.27
|
||||
- @thirdweb-dev/chains@0.1.26
|
||||
|
||||
## 3.14.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ed711c8c`](https://github.com/thirdweb-dev/js/commit/ed711c8cb2ed6a0deb1b2a5eeec06df1d4edc5e8), [`05a7495a`](https://github.com/thirdweb-dev/js/commit/05a7495a132aabab5f48abbdb80a468ff6f65df8), [`e78da6b3`](https://github.com/thirdweb-dev/js/commit/e78da6b36cfa6d954234820563201bf760186ed1)]:
|
||||
- @thirdweb-dev/wallets@1.0.2
|
||||
|
||||
## 3.14.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`efb3546e`](https://github.com/thirdweb-dev/js/commit/efb3546ec8268156be00301af28b9d83ecd5ab08)]:
|
||||
- @thirdweb-dev/wallets@1.0.1
|
||||
|
||||
## 3.14.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1227](https://github.com/thirdweb-dev/js/pull/1227) [`06ca1c40`](https://github.com/thirdweb-dev/js/commit/06ca1c407dfee9d3d1fdaed1b6223ad0f9b8857b) Thanks [@nkrishang](https://github.com/nkrishang)! - Add react hooks for smart wallet
|
||||
|
||||
- [#1248](https://github.com/thirdweb-dev/js/pull/1248) [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Export account hooks
|
||||
|
||||
- [#1253](https://github.com/thirdweb-dev/js/pull/1253) [`ad7dae3b`](https://github.com/thirdweb-dev/js/commit/ad7dae3b163e61c7a6eb57f654885a7fdaa4cbb6) Thanks [@rattrayd11](https://github.com/rattrayd11)! - Stop using useActiveChain deprecated hook
|
||||
|
||||
- Updated dependencies [[`ef4cb092`](https://github.com/thirdweb-dev/js/commit/ef4cb092192c58c9b292b29590b888f45f9fd23d), [`ac3e019c`](https://github.com/thirdweb-dev/js/commit/ac3e019cd1776dbdb0d06b213420ad17586f678e), [`30ac3aef`](https://github.com/thirdweb-dev/js/commit/30ac3aef840bde51a61acf786c709cffd3c47354), [`3c5dc480`](https://github.com/thirdweb-dev/js/commit/3c5dc4804abc56b933ec45e9e1da11eb182296cc), [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087), [`0fd8aa04`](https://github.com/thirdweb-dev/js/commit/0fd8aa04a9424497758d13a51a72363edcc30e19)]:
|
||||
- @thirdweb-dev/sdk@3.10.26
|
||||
- @thirdweb-dev/wallets@1.0.0
|
||||
- @thirdweb-dev/chains@0.1.25
|
||||
|
||||
## 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.14.0",
|
||||
"version": "3.14.7",
|
||||
"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",
|
||||
@@ -112,10 +113,6 @@
|
||||
"ethers": ">=5.5.1",
|
||||
"react": ">=18.0.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"ansi-regex": "^6.0.1",
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@solana/web3.js": {
|
||||
"optional": true
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
import { Chain, defaultChains } from "@thirdweb-dev/chains";
|
||||
import { useCallback, useState } from "react";
|
||||
import { useActiveChain, useChainId } from "../../evm/hooks/wallet";
|
||||
import { useChain, useChainId } from "../../evm/hooks/wallet";
|
||||
import { useSupportedChains } from "../../evm/hooks/useSupportedChains";
|
||||
import { useSwitchChain, useWallet } from "./wallet-hooks";
|
||||
import { assertWindowEthereum, walletIds } from "@thirdweb-dev/wallets";
|
||||
@@ -29,7 +29,7 @@ type NetworkMetadata = {
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated - use `useActiveChain`, `useSwitchChain`, `useChainId` instead
|
||||
* @deprecated - use `useChain`, `useSwitchChain`, `useChainId` instead
|
||||
*
|
||||
* Hook for getting metadata about the network the current wallet is connected to and switching networks
|
||||
*
|
||||
@@ -55,7 +55,7 @@ type NetworkMetadata = {
|
||||
* @public
|
||||
*/
|
||||
export function useNetwork(): [NetworkMetadata, SwitchNetwork | undefined] {
|
||||
const chain = useActiveChain();
|
||||
const chain = useChain();
|
||||
const chainId = useChainId();
|
||||
const switchChain = useSwitchChain();
|
||||
const supportedChains = useSupportedChains();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -61,6 +61,15 @@ export interface ThirdwebProviderCoreProps<TChains extends Chain[]>
|
||||
* Whether or not to automatically switch to wallet's network to active chain
|
||||
*/
|
||||
autoSwitch?: boolean;
|
||||
|
||||
/**
|
||||
* Timeout for auto-connecting wallet in milliseconds
|
||||
*
|
||||
* If wallet fails to connect in this time, it will stop trying to connect and user will have to manually connect
|
||||
*
|
||||
* @defaultValue 15000
|
||||
*/
|
||||
autoConnectTimeout?: number;
|
||||
}
|
||||
|
||||
export const ThirdwebProviderCore = <TChains extends Chain[]>({
|
||||
@@ -145,6 +154,7 @@ export const ThirdwebProviderCore = <TChains extends Chain[]>({
|
||||
dAppMeta={dAppMeta}
|
||||
activeChain={activeChainWithKey}
|
||||
autoSwitch={props.autoSwitch}
|
||||
autoConnectTimeout={props.autoConnectTimeout}
|
||||
>
|
||||
<ThirdwebSDKProviderWrapper
|
||||
queryClient={props.queryClient}
|
||||
|
||||
@@ -88,7 +88,7 @@ type ThirdwebWalletContextData = {
|
||||
getWalletConfig: (walletInstance: WalletInstance) => WalletConfig | undefined;
|
||||
};
|
||||
|
||||
const ThirdwebWalletContext = createContext<
|
||||
const ThirdwebWalletContext = /* @__PURE__ */ createContext<
|
||||
ThirdwebWalletContextData | undefined
|
||||
>(undefined);
|
||||
|
||||
@@ -101,12 +101,15 @@ export function ThirdwebWalletProvider(
|
||||
dAppMeta?: DAppMetaData;
|
||||
chains: Chain[];
|
||||
autoSwitch?: boolean;
|
||||
autoConnectTimeout?: number;
|
||||
}>,
|
||||
) {
|
||||
const [signer, setSigner] = useState<Signer | undefined>(undefined);
|
||||
const [connectionStatus, setConnectionStatus] =
|
||||
useState<ConnectionStatus>("unknown");
|
||||
|
||||
const autoConnectTimeout = props.autoConnectTimeout || 15000;
|
||||
|
||||
const [activeWallet, setActiveWallet] = useState<
|
||||
WalletInstance | undefined
|
||||
>();
|
||||
@@ -311,8 +314,14 @@ export function ThirdwebWalletProvider(
|
||||
const personalWalletInstance = createWalletInstance(personalWalleObj);
|
||||
|
||||
try {
|
||||
await personalWalletInstance.autoConnect(
|
||||
personalWalletInfo.connectParams,
|
||||
await timeoutPromise(
|
||||
personalWalletInstance.autoConnect(
|
||||
personalWalletInfo.connectParams,
|
||||
),
|
||||
{
|
||||
ms: autoConnectTimeout,
|
||||
message: "Failed to Auto connect. Auto connect timed out.",
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -337,7 +346,10 @@ export function ThirdwebWalletProvider(
|
||||
|
||||
try {
|
||||
setConnectionStatus("connecting");
|
||||
await wallet.autoConnect(walletInfo.connectParams);
|
||||
await timeoutPromise(wallet.autoConnect(walletInfo.connectParams), {
|
||||
ms: autoConnectTimeout,
|
||||
message: "Failed to Auto connect. Auto connect timed out.",
|
||||
});
|
||||
setConnectedWallet(wallet, walletInfo.connectParams, true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
@@ -356,6 +368,7 @@ export function ThirdwebWalletProvider(
|
||||
props.shouldAutoConnect,
|
||||
activeWallet,
|
||||
connectionStatus,
|
||||
autoConnectTimeout,
|
||||
]);
|
||||
|
||||
const connectWallet = useCallback(
|
||||
@@ -496,3 +509,32 @@ async function saveLastConnectedWalletInfo(
|
||||
console.error("Error saving the last connected wallet info", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Timeout a promise with a given Error message if the promise does not resolve in given time
|
||||
*
|
||||
* @param promise - Promise to track for timeout
|
||||
* @param option - timeout options
|
||||
* @returns
|
||||
*/
|
||||
function timeoutPromise<T>(
|
||||
promise: Promise<T>,
|
||||
option: { ms: number; message: string },
|
||||
) {
|
||||
return new Promise<T>((resolve, reject) => {
|
||||
const timeoutId = setTimeout(() => {
|
||||
reject(new Error(option.message));
|
||||
}, option.ms);
|
||||
|
||||
promise.then(
|
||||
(res) => {
|
||||
clearTimeout(timeoutId);
|
||||
resolve(res);
|
||||
},
|
||||
(err) => {
|
||||
clearTimeout(timeoutId);
|
||||
reject(err);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 }>
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
import {
|
||||
RequiredParam,
|
||||
requiredParamInvariant,
|
||||
} from "../../../core/query-utils/required-param";
|
||||
import { useSDKChainId } from "../../providers/thirdweb-sdk-provider";
|
||||
import { WalletAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
} from "../../utils/cache-keys";
|
||||
import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork";
|
||||
import {
|
||||
useMutation,
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import type { AccountEvent, SmartContract } from "@thirdweb-dev/sdk";
|
||||
import type { BytesLike } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/** **********************/
|
||||
/** READ HOOKS **/
|
||||
/** **********************/
|
||||
|
||||
/**
|
||||
* Get all accounts
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: accounts, isLoading, error } = useAccounts(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account factory contract
|
||||
* @returns a response object that includes an array of all accounts with their associated admin
|
||||
* @twfeature AccountFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useaccounts?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useAccounts(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
): UseQueryResult<AccountEvent[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.accountFactory.getAll(contractAddress),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.accountFactory.getAllAccounts,
|
||||
"Contract instance does not support contract.accountFactory.getAllAccounts",
|
||||
);
|
||||
return contract.accountFactory.getAllAccounts();
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all accounts associated with the provided address
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: accountsForAddress, isLoading, error } = useAccountsForAddress(contract, "{{account_address}}");
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account factory contract
|
||||
* @returns a response object that includes an array of all accounts associated with the adress
|
||||
* @twfeature AccountFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useaccountsforaddress?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useAccountsForAddress(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
address: RequiredParam<WalletAddress>,
|
||||
): UseQueryResult<string[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.accountFactory.getAllForAddress(
|
||||
contractAddress,
|
||||
address,
|
||||
),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.accountFactory.getAssociatedAccounts,
|
||||
"Contract instance does not support contract.accountFactory.getAssociatedAccounts",
|
||||
);
|
||||
return contract.accountFactory.getAssociatedAccounts(address || "");
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a account has been deployed for the given admin
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: isAccountDeployed, isLoading, error } = useIsAccountDeployed(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account factory contract
|
||||
* @returns a boolean indicating if a account has been deployed for the given admin
|
||||
* @twfeature AccountFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useisaccountdeployed?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useIsAccountDeployed(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
admin: RequiredParam<WalletAddress>,
|
||||
extraData?: BytesLike,
|
||||
): UseQueryResult<boolean> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.accountFactory.isAccountDeployed(contractAddress, admin),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.accountFactory.isAccountDeployed,
|
||||
"Contract instance does not support contract.accountFactory.getAllAccounts",
|
||||
);
|
||||
invariant(admin, "No account address provided");
|
||||
return contract.accountFactory.isAccountDeployed(admin, extraData);
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/** **********************/
|
||||
/** WRITE HOOKS **/
|
||||
/** **********************/
|
||||
/**
|
||||
* Create a account
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* const Component = () => {
|
||||
* const { contract } = useContract("{{contract_address}}");
|
||||
* const {
|
||||
* mutate: createAccount,
|
||||
* isLoading,
|
||||
* error,
|
||||
* } = useCreateAccount(contract);
|
||||
*
|
||||
* if (error) {
|
||||
* console.error("failed to create account", error);
|
||||
* }
|
||||
*
|
||||
* return (
|
||||
* <button
|
||||
* disabled={isLoading}
|
||||
* onClick={() => createAccount("0x...")}
|
||||
* >
|
||||
* Create Account
|
||||
* </button>
|
||||
* );
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account factory contract
|
||||
* @returns a mutation object that can be used to create a account
|
||||
* @twfeature AccountFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usecreateaccount?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useCreateAccount(contract: RequiredParam<SmartContract>) {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation(
|
||||
async (admin: string, extraData?: BytesLike) => {
|
||||
requiredParamInvariant(contract, "contract is undefined");
|
||||
|
||||
return contract.accountFactory.createAccount(admin, extraData);
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
invalidateContractAndBalances(
|
||||
queryClient,
|
||||
contractAddress,
|
||||
activeChainId,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import type { providers } from "ethers";
|
||||
import {
|
||||
RequiredParam,
|
||||
requiredParamInvariant,
|
||||
} from "../../../core/query-utils/required-param";
|
||||
import { useSDKChainId } from "../../providers/thirdweb-sdk-provider";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
} from "../../utils/cache-keys";
|
||||
import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork";
|
||||
import {
|
||||
useMutation,
|
||||
UseMutationResult,
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import type {
|
||||
SignerWithRestrictions,
|
||||
SignerWithRestrictionsBatchInput,
|
||||
SmartContract,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
/** **********************/
|
||||
/** READ HOOKS **/
|
||||
/** **********************/
|
||||
|
||||
/**
|
||||
* Get all accounts
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: accounts, isLoading, error } = useAccountSigners(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account
|
||||
* @returns a response object that includes an array of all signers of the provided account
|
||||
* @twfeature Account
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useaccountsigners?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useAccountSigners(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
): UseQueryResult<SignerWithRestrictions[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.account.signers(contractAddress),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.account.getSignersWithRestrictions,
|
||||
"Contract instance does not support contract.account.getSignersWithRestrictions",
|
||||
);
|
||||
return contract.account.getSignersWithRestrictions();
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/** **********************/
|
||||
/** WRITE HOOKS **/
|
||||
/** **********************/
|
||||
/**
|
||||
* Set the account's entire snapshot of permissions
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* const Component = () => {
|
||||
* const { contract } = useContract("{{contract_address}}");
|
||||
* const {
|
||||
* mutate: setAccountSigners,
|
||||
* isLoading,
|
||||
* error,
|
||||
* } = useSetAccountSigners(contract);
|
||||
*
|
||||
* if (error) {
|
||||
* console.error("failed to set account signers", error);
|
||||
* }
|
||||
*
|
||||
* return (
|
||||
* <button
|
||||
* disabled={isLoading}
|
||||
* onClick={() => setAccountSigners("0x...")}
|
||||
* >
|
||||
* Set Account Signers
|
||||
* </button>
|
||||
* );
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a account contract
|
||||
* @returns a mutation object that can be used to set the account signers
|
||||
* @twfeature Account
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usesetaccountsigners?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useSetAccountSigners(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
): UseMutationResult<
|
||||
{ receipt: providers.TransactionReceipt },
|
||||
unknown,
|
||||
SignerWithRestrictionsBatchInput,
|
||||
unknown
|
||||
> {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation(
|
||||
async (permissionsSnapshot: SignerWithRestrictionsBatchInput) => {
|
||||
requiredParamInvariant(contract, "contract is undefined");
|
||||
|
||||
return contract.account.setAccess(permissionsSnapshot);
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
invalidateContractAndBalances(
|
||||
queryClient,
|
||||
contractAddress,
|
||||
activeChainId,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -504,7 +504,7 @@ export function useEnglishAuctionWinningBid(
|
||||
) {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.marketplace.auction.getWinningBid(
|
||||
cacheKeys.contract.marketplace.englishAuctions.getWinningBid(
|
||||
contractAddress,
|
||||
auctionId,
|
||||
),
|
||||
@@ -596,7 +596,7 @@ export function useBidBuffer(
|
||||
) {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.marketplace.getBidBufferBps(contractAddress),
|
||||
cacheKeys.contract.marketplace.auction.getBidBufferBps(contractAddress, listingId),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
|
||||
@@ -647,7 +647,7 @@ export function useMinimumNextBid(
|
||||
) {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.marketplace.auction.getWinner(
|
||||
cacheKeys.contract.marketplace.auction.getMinimumNextBid(
|
||||
contractAddress,
|
||||
listingId,
|
||||
),
|
||||
|
||||
@@ -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,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
import {
|
||||
RequiredParam,
|
||||
requiredParamInvariant,
|
||||
} from "../../../core/query-utils/required-param";
|
||||
import { useSDKChainId } from "../../providers/thirdweb-sdk-provider";
|
||||
import { WalletAddress } from "../../types";
|
||||
import {
|
||||
cacheKeys,
|
||||
invalidateContractAndBalances,
|
||||
} from "../../utils/cache-keys";
|
||||
import { useQueryWithNetwork } from "../query-utils/useQueryWithNetwork";
|
||||
import {
|
||||
useMutation,
|
||||
useQueryClient,
|
||||
UseQueryResult,
|
||||
} from "@tanstack/react-query";
|
||||
import type {
|
||||
AccountEvent, SmartContract,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import type { BytesLike } from "ethers";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
|
||||
|
||||
/** **********************/
|
||||
/** READ HOOKS **/
|
||||
/** **********************/
|
||||
|
||||
/**
|
||||
* Get all wallets
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: smartWallets, isLoading, error } = useSmartWallets(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a smart wallet factory contract
|
||||
* @returns a response object that includes an array of all smart wallets with their associated admin
|
||||
* @twfeature SmartWalletFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usesmartwallets?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useSmartWallets(
|
||||
contract: RequiredParam<SmartContract>
|
||||
): UseQueryResult<AccountEvent[]> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.smartWalletFactory.getAll(contractAddress),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.smartWalletFactory.getAllWallets,
|
||||
"Contract instance does not support contract.smartWalletFactory.getAllWallets",
|
||||
);
|
||||
return contract.smartWalletFactory.getAllWallets();
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a smart wallet has been deployed for the given admin
|
||||
*
|
||||
* @example
|
||||
* ```javascript
|
||||
* const { data: isSmartWalletDeployed, isLoading, error } = useIsSmartWalletDeployed(contract);
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a smart wallet factory contract
|
||||
* @returns a boolean indicating if a smart wallet has been deployed for the given admin
|
||||
* @twfeature SmartWalletFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.useissmartwalletdeployed?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useIsSmartWalletDeployed(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
admin: RequiredParam<WalletAddress>,
|
||||
extraData?: BytesLike,
|
||||
): UseQueryResult<boolean> {
|
||||
const contractAddress = contract?.getAddress();
|
||||
return useQueryWithNetwork(
|
||||
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(contractAddress, admin),
|
||||
() => {
|
||||
requiredParamInvariant(contract, "No Contract instance provided");
|
||||
invariant(
|
||||
contract.smartWalletFactory.isWalletDeployed,
|
||||
"Contract instance does not support contract.smartWalletFactory.getAllWallets",
|
||||
);
|
||||
invariant(admin, "No wallet address provided");
|
||||
return contract.smartWalletFactory.isWalletDeployed(admin, extraData);
|
||||
},
|
||||
{ enabled: !!contract },
|
||||
);
|
||||
}
|
||||
|
||||
/** **********************/
|
||||
/** WRITE HOOKS **/
|
||||
/** **********************/
|
||||
/**
|
||||
* Create a smart wallet
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
* const Component = () => {
|
||||
* const { contract } = useContract("{{contract_address}}");
|
||||
* const {
|
||||
* mutate: createSmartWallet,
|
||||
* isLoading,
|
||||
* error,
|
||||
* } = useCreateSmartWallet(contract);
|
||||
*
|
||||
* if (error) {
|
||||
* console.error("failed to create smart wallet", error);
|
||||
* }
|
||||
*
|
||||
* return (
|
||||
* <button
|
||||
* disabled={isLoading}
|
||||
* onClick={() => createSmartWallet("0x...")}
|
||||
* >
|
||||
* Create Smart Wallet
|
||||
* </button>
|
||||
* );
|
||||
* };
|
||||
* ```
|
||||
*
|
||||
* @param contract - an instance of a smart wallet factory contract
|
||||
* @returns a mutation object that can be used to create a smart wallet
|
||||
* @twfeature SmartWalletFactory
|
||||
* @see {@link https://portal.thirdweb.com/react/react.usecreatesmartwallet?utm_source=sdk | Documentation}
|
||||
* @beta
|
||||
*/
|
||||
export function useCreateSmartWallet(
|
||||
contract: RequiredParam<SmartContract>,
|
||||
) {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation(
|
||||
async (admin: string, extraData?: BytesLike) => {
|
||||
requiredParamInvariant(contract, "contract is undefined");
|
||||
|
||||
return contract.smartWalletFactory.createWallet(
|
||||
admin,
|
||||
extraData,
|
||||
);
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
invalidateContractAndBalances(
|
||||
queryClient,
|
||||
contractAddress,
|
||||
activeChainId,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -167,6 +167,8 @@ export {
|
||||
useTransferNFT,
|
||||
useAirdropNFT,
|
||||
useBurnNFT,
|
||||
useSharedMetadata,
|
||||
useSetSharedMetadata,
|
||||
} from "./hooks/async/nft";
|
||||
|
||||
// roles
|
||||
@@ -192,12 +194,16 @@ export {
|
||||
useBurnToken,
|
||||
} from "./hooks/async/token";
|
||||
|
||||
// smart wallet factory
|
||||
// account factory
|
||||
export {
|
||||
useIsSmartWalletDeployed,
|
||||
useSmartWallets,
|
||||
useCreateSmartWallet,
|
||||
} from "./hooks/async/smart-wallet-factory";
|
||||
useIsAccountDeployed,
|
||||
useAccounts,
|
||||
useCreateAccount,
|
||||
useAccountsForAddress,
|
||||
} from "./hooks/async/account-factory";
|
||||
|
||||
// account
|
||||
export { useAccountSigners, useSetAccountSigners } from "./hooks/async/account";
|
||||
|
||||
// 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>({});
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -118,11 +118,23 @@ export const cacheKeys = {
|
||||
overrides,
|
||||
]),
|
||||
|
||||
smartWalletFactory: {
|
||||
accountFactory: {
|
||||
getAll: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress, ["smartWalletFactory"]),
|
||||
isSmartWalletDeployed: (contractAdress: RequiredParam<ContractAddress>, admin: RequiredParam<string>) =>
|
||||
createContractCacheKey(contractAdress, ["isSmartWalletDeployed", admin]),
|
||||
createContractCacheKey(contractAddress, ["accountFactory"]),
|
||||
isAccountDeployed: (
|
||||
contractAdress: RequiredParam<ContractAddress>,
|
||||
admin: RequiredParam<string>,
|
||||
) => createContractCacheKey(contractAdress, ["isAccountDeployed", admin]),
|
||||
getAllForAddress: (
|
||||
contractAdress: RequiredParam<ContractAddress>,
|
||||
address: RequiredParam<string>,
|
||||
) =>
|
||||
createContractCacheKey(contractAdress, ["getAllForAddress", address]),
|
||||
},
|
||||
|
||||
account: {
|
||||
signers: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress, ["account", "signers"]),
|
||||
},
|
||||
|
||||
app: {
|
||||
@@ -190,6 +202,10 @@ export const cacheKeys = {
|
||||
]),
|
||||
},
|
||||
},
|
||||
sharedMetadata: {
|
||||
get: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress),
|
||||
},
|
||||
drop: {
|
||||
getAllUnclaimed: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
@@ -263,10 +279,16 @@ export const cacheKeys = {
|
||||
contractAddress,
|
||||
params ? ["getActiveListings", params] : ["getActiveListings"],
|
||||
),
|
||||
getBidBufferBps: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress, ["getBidBufferBps"]),
|
||||
|
||||
auction: {
|
||||
getBidBufferBps: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
listingId: RequiredParam<BigNumberish>,
|
||||
) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"auction",
|
||||
"getBidBufferBps",
|
||||
{ listingId },
|
||||
]),
|
||||
getWinningBid: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
listingId: RequiredParam<BigNumberish>,
|
||||
@@ -276,6 +298,15 @@ export const cacheKeys = {
|
||||
"getWinningBid",
|
||||
{ listingId },
|
||||
]),
|
||||
getMinimumNextBid: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
listingId: RequiredParam<BigNumberish>,
|
||||
) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"auction",
|
||||
"getMinimumNextBid",
|
||||
{ listingId },
|
||||
]),
|
||||
getWinner: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
listingId: RequiredParam<BigNumberish>,
|
||||
@@ -295,8 +326,8 @@ export const cacheKeys = {
|
||||
createContractCacheKey(
|
||||
contractAddress,
|
||||
params
|
||||
? ["getAllDirectListings", params]
|
||||
: ["getAllDirectListings"],
|
||||
? ["directListings", "getAll", params]
|
||||
: ["directListings", "getAll"],
|
||||
),
|
||||
getAllValid: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
@@ -305,20 +336,22 @@ export const cacheKeys = {
|
||||
createContractCacheKey(
|
||||
contractAddress,
|
||||
params
|
||||
? ["getAllValidDirectListings", params]
|
||||
: ["getAllValidDirectListings"],
|
||||
? ["directListings", "getAllValid", params]
|
||||
: ["directListings", "getAllValid"],
|
||||
),
|
||||
getListing: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
listingId: RequiredParam<BigNumberish>,
|
||||
) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"directListings",
|
||||
"getListing",
|
||||
{ listingId },
|
||||
]),
|
||||
getTotalCount: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"getTotalDirectListingsCount",
|
||||
"directListings",
|
||||
"getTotalCount",
|
||||
]),
|
||||
},
|
||||
|
||||
@@ -330,8 +363,8 @@ export const cacheKeys = {
|
||||
createContractCacheKey(
|
||||
contractAddress,
|
||||
params
|
||||
? ["getAllEnglishAuctions", params]
|
||||
: ["getAllEnglishAuctions"],
|
||||
? ["englishAuctions", "getAll", params]
|
||||
: ["englishAuctions", "getAll"],
|
||||
),
|
||||
getAllValid: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
@@ -340,14 +373,15 @@ export const cacheKeys = {
|
||||
createContractCacheKey(
|
||||
contractAddress,
|
||||
params
|
||||
? ["getAllEValidEnglishAuctions", params]
|
||||
: ["getAllEValidEnglishAuctions"],
|
||||
? ["englishAuctions", "getAllValid", params]
|
||||
: ["englishAuctions", "getAllValid"],
|
||||
),
|
||||
getAuction: (
|
||||
contractAddress: RequiredParam<ContractAddress>,
|
||||
auctionId: RequiredParam<BigNumberish>,
|
||||
) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"englishAuctions",
|
||||
"getAuction",
|
||||
{ auctionId },
|
||||
]),
|
||||
@@ -356,12 +390,14 @@ export const cacheKeys = {
|
||||
auctionId: RequiredParam<BigNumberish>,
|
||||
) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"englishAuctions",
|
||||
"getWinningBid",
|
||||
{ auctionId },
|
||||
]),
|
||||
getTotalCount: (contractAddress: RequiredParam<ContractAddress>) =>
|
||||
createContractCacheKey(contractAddress, [
|
||||
"getTotalEnglishAuctionsCount",
|
||||
"englishAuctions",
|
||||
"getTotalCount",
|
||||
]),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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,19 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.2.26
|
||||
|
||||
## 0.2.25
|
||||
|
||||
## 0.2.24
|
||||
|
||||
## 0.2.23
|
||||
|
||||
## 0.2.22
|
||||
|
||||
## 0.2.21
|
||||
|
||||
## 0.2.20
|
||||
|
||||
## 0.2.19
|
||||
|
||||
## 0.2.18
|
||||
|
||||
@@ -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.26",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,146 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.2.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1270](https://github.com/thirdweb-dev/js/pull/1270) [`0d5503aa`](https://github.com/thirdweb-dev/js/commit/0d5503aae90d9cd7a7adcabad19f7f45d9a37063) Thanks [@iketw](https://github.com/iketw)! - Only handle Coinbase callback URL if Coinbase is added as a supportedWallet
|
||||
|
||||
- [#1277](https://github.com/thirdweb-dev/js/pull/1277) [`2b113539`](https://github.com/thirdweb-dev/js/commit/2b113539098384f910b3c4d54e1fde9d35a6f053) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - remove ethers/lib/utils dependency
|
||||
|
||||
- Updated dependencies [[`2b113539`](https://github.com/thirdweb-dev/js/commit/2b113539098384f910b3c4d54e1fde9d35a6f053), [`c9535715`](https://github.com/thirdweb-dev/js/commit/c95357158819abd42d4b0900ecc2fa40fcb957f8), [`be606dd3`](https://github.com/thirdweb-dev/js/commit/be606dd3c93c1514834c1d970e864d7f949a07ab), [`edcd22d6`](https://github.com/thirdweb-dev/js/commit/edcd22d61236edb2832f9b2f9796e891d58cb145), [`5882091e`](https://github.com/thirdweb-dev/js/commit/5882091eab65978009a5a5305701f121851b10ad), [`998e5217`](https://github.com/thirdweb-dev/js/commit/998e521733efd6a67e42f9bf0beab5fbdccf08ae)]:
|
||||
- @thirdweb-dev/wallets@1.0.3
|
||||
- @thirdweb-dev/sdk@3.10.27
|
||||
- @thirdweb-dev/react-core@3.14.7
|
||||
- @thirdweb-dev/chains@0.1.26
|
||||
|
||||
## 0.2.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ed711c8c`](https://github.com/thirdweb-dev/js/commit/ed711c8cb2ed6a0deb1b2a5eeec06df1d4edc5e8), [`05a7495a`](https://github.com/thirdweb-dev/js/commit/05a7495a132aabab5f48abbdb80a468ff6f65df8), [`e78da6b3`](https://github.com/thirdweb-dev/js/commit/e78da6b36cfa6d954234820563201bf760186ed1)]:
|
||||
- @thirdweb-dev/wallets@1.0.2
|
||||
- @thirdweb-dev/react-core@3.14.6
|
||||
|
||||
## 0.2.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`efb3546e`](https://github.com/thirdweb-dev/js/commit/efb3546ec8268156be00301af28b9d83ecd5ab08)]:
|
||||
- @thirdweb-dev/wallets@1.0.1
|
||||
- @thirdweb-dev/react-core@3.14.5
|
||||
|
||||
## 0.2.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1215](https://github.com/thirdweb-dev/js/pull/1215) [`3c5dc480`](https://github.com/thirdweb-dev/js/commit/3c5dc4804abc56b933ec45e9e1da11eb182296cc) Thanks [@iketw](https://github.com/iketw)! - Migrate wallets to WCV2 and remove WCV1 support.
|
||||
|
||||
Please, check our changelogs for more info: https://blog.thirdweb.com/changelog/
|
||||
|
||||
- Updated dependencies [[`ef4cb092`](https://github.com/thirdweb-dev/js/commit/ef4cb092192c58c9b292b29590b888f45f9fd23d), [`06ca1c40`](https://github.com/thirdweb-dev/js/commit/06ca1c407dfee9d3d1fdaed1b6223ad0f9b8857b), [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087), [`ac3e019c`](https://github.com/thirdweb-dev/js/commit/ac3e019cd1776dbdb0d06b213420ad17586f678e), [`30ac3aef`](https://github.com/thirdweb-dev/js/commit/30ac3aef840bde51a61acf786c709cffd3c47354), [`3c5dc480`](https://github.com/thirdweb-dev/js/commit/3c5dc4804abc56b933ec45e9e1da11eb182296cc), [`ad7dae3b`](https://github.com/thirdweb-dev/js/commit/ad7dae3b163e61c7a6eb57f654885a7fdaa4cbb6), [`620e89dc`](https://github.com/thirdweb-dev/js/commit/620e89dc25c91557e2164a602c7aedd733525087), [`0fd8aa04`](https://github.com/thirdweb-dev/js/commit/0fd8aa04a9424497758d13a51a72363edcc30e19)]:
|
||||
- @thirdweb-dev/sdk@3.10.26
|
||||
- @thirdweb-dev/react-core@3.14.4
|
||||
- @thirdweb-dev/wallets@1.0.0
|
||||
- @thirdweb-dev/chains@0.1.25
|
||||
|
||||
## 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/wallets@0.3.3
|
||||
- @thirdweb-dev/react-core@3.14.3
|
||||
- @thirdweb-dev/sdk@3.10.25
|
||||
- @thirdweb-dev/storage@1.1.5
|
||||
- @thirdweb-dev/chains@0.1.24
|
||||
|
||||
## 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/chains@0.1.23
|
||||
- @thirdweb-dev/sdk@3.10.24
|
||||
- @thirdweb-dev/wallets@0.3.2
|
||||
- @thirdweb-dev/react-core@3.14.2
|
||||
|
||||
## 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/sdk@3.10.23
|
||||
- @thirdweb-dev/react-core@3.14.1
|
||||
- @thirdweb-dev/wallets@0.3.1
|
||||
- @thirdweb-dev/chains@0.1.22
|
||||
|
||||
## 0.2.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.2.19",
|
||||
"version": "0.2.26",
|
||||
"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",
|
||||
@@ -44,10 +44,6 @@
|
||||
"react-native-svg": "^13.8.0",
|
||||
"tiny-invariant": "^1.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"react-native-mmkv": "2.5.1",
|
||||
"@magic-sdk/provider": "17.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.19.3",
|
||||
"@babel/preset-env": "^7.1.6",
|
||||
|
||||
@@ -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 = ({
|
||||
|
||||
+18
-4
@@ -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"} />
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+14
-15
@@ -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",
|
||||
},
|
||||
});
|
||||
+3
-3
@@ -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";
|
||||
|
||||
@@ -17,7 +17,6 @@ export { localWallet } from "./wallets/wallets/local-wallet";
|
||||
export { LocalWallet } from "./wallets/wallets/LocalWallet";
|
||||
export { magicWallet } from "./wallets/wallets/magic-wallet";
|
||||
export { MagicWallet } from "./wallets/wallets/MagicWallet";
|
||||
export * from "./wallets/wallets/WalletConnectV1";
|
||||
export * from "./wallets/wallets/WalletConnectV2";
|
||||
export type { WCMeta } from "./wallets/types/wc";
|
||||
|
||||
@@ -39,6 +38,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";
|
||||
|
||||
@@ -65,7 +65,9 @@ export const ThirdwebProvider = <
|
||||
theme,
|
||||
...restProps
|
||||
}: PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
|
||||
useCoinbaseWalletListener();
|
||||
useCoinbaseWalletListener(
|
||||
!!supportedWallets.find((w) => w.id === walletIds.coinbase),
|
||||
);
|
||||
|
||||
const hasMagicConfig = useMemo(
|
||||
() => !!supportedWallets.find((wc) => wc.id === walletIds.magicLink),
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user