Compare commits
61
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df5f016d31 | ||
|
|
89102b0c89 | ||
|
|
e1846c4469 | ||
|
|
cc56037e64 | ||
|
|
23d90b3e77 | ||
|
|
6745078947 | ||
|
|
55d1f5c550 | ||
|
|
b694f3c300 | ||
|
|
217879ace1 | ||
|
|
35984362b0 | ||
|
|
bdabbef71a | ||
|
|
2f1df0b535 | ||
|
|
da57610802 | ||
|
|
119e785461 | ||
|
|
5f1e6abb39 | ||
|
|
59206233e1 | ||
|
|
4f99ccb49c | ||
|
|
292a321a95 | ||
|
|
74f898ac28 | ||
|
|
431445e3c6 | ||
|
|
fd7111d544 | ||
|
|
f3b2ae3f6d | ||
|
|
f5ae61aeba | ||
|
|
37e0af5753 | ||
|
|
a034b0321f | ||
|
|
8ffc597c06 | ||
|
|
8eecf4c2d5 | ||
|
|
32cc54423e | ||
|
|
bd86661f54 | ||
|
|
ee4c7de25c | ||
|
|
c68a4bdd1f | ||
|
|
68fa1896f7 | ||
|
|
e21bdd0328 | ||
|
|
c85810eee3 | ||
|
|
d24a6146d8 | ||
|
|
e94b7fdfed | ||
|
|
98efd090f6 | ||
|
|
189daf0280 | ||
|
|
f7b352a585 | ||
|
|
56ad0867bd | ||
|
|
d565100614 | ||
|
|
edaa5b2e6c | ||
|
|
77123a9a5a | ||
|
|
6fd10f94b4 | ||
|
|
afae0873b0 | ||
|
|
4a1d758110 | ||
|
|
c6e74ef0b0 | ||
|
|
bba9767adf | ||
|
|
a5e509438d | ||
|
|
f461290216 | ||
|
|
8febea4db0 | ||
|
|
30e5593dd1 | ||
|
|
f253909710 | ||
|
|
99ffa8ce3b | ||
|
|
61212d27d7 | ||
|
|
58df84f8ba | ||
|
|
b6f48e1088 | ||
|
|
d51230441a | ||
|
|
01e83b6f13 | ||
|
|
907d97bede | ||
|
|
3c8c5d56f2 |
@@ -20,14 +20,14 @@
|
||||
|
||||
## Packages
|
||||
|
||||
| Package | Description | Latest Version |
|
||||
| --------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [/sdk](./packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react-native) | Ultimate collection of React hooks for your native web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react-native"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| Package | Description | Latest Version |
|
||||
| ---------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| [/sdk](./packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react](./packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/react-native](./packages/react-native) | Ultimate collection of React hooks for your native mobile web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react-native"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/auth](./packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/storage](./packages/storage) | Best in class decentralized storage SDK for Browser and Node | <a href="https://www.npmjs.com/package/@thirdweb-dev/storage"><img src="https://img.shields.io/npm/v/@thirdweb-dev/storage?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
| [/cli](./packages/cli) | Publish and deploy smart contracts without dealing with private keys | <a href="https://www.npmjs.com/package/thirdweb"><img src="https://img.shields.io/npm/v/thirdweb?color=red&label=npm&logo=npm" alt="npm version"/></a> |
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
"eslint": "^8.37.0",
|
||||
"mocha": "^10.2.0",
|
||||
"prettier": "^2.8.7",
|
||||
"turbo": "^1.8.8",
|
||||
"turbo": "^1.9.8",
|
||||
"yalc": "1.0.0-pre.53"
|
||||
},
|
||||
"manypkg": {
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 3.0.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1101](https://github.com/thirdweb-dev/js/pull/1101) [`e1846c44`](https://github.com/thirdweb-dev/js/commit/e1846c44696bcb25a6a137d63e117e7d2ce9d979) Thanks [@adam-maj](https://github.com/adam-maj)! - Bump invalid before with 5 minute window
|
||||
|
||||
- [#1098](https://github.com/thirdweb-dev/js/pull/1098) [`67450789`](https://github.com/thirdweb-dev/js/commit/67450789473b6008b86453ee4f4c7b99461223a6) Thanks [@MananTank](https://github.com/MananTank)! - add sideEffects: false in package.json
|
||||
|
||||
- Updated dependencies []:
|
||||
- @thirdweb-dev/wallets@0.2.24
|
||||
|
||||
## 3.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`bba9767a`](https://github.com/thirdweb-dev/js/commit/bba9767adfe20e41055450b86e4448fcb2119855), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`68fa1896`](https://github.com/thirdweb-dev/js/commit/68fa1896f75d3514e00cc380924fd8bc623064f0), [`292a321a`](https://github.com/thirdweb-dev/js/commit/292a321a95ed2d847097eed205353dd69eeb8d54), [`f3b2ae3f`](https://github.com/thirdweb-dev/js/commit/f3b2ae3f6d9c66356c521d3b9c2a6c096dbb4b57), [`4f99ccb4`](https://github.com/thirdweb-dev/js/commit/4f99ccb49c584946de709fbc01017611d2828b76), [`c85810ee`](https://github.com/thirdweb-dev/js/commit/c85810eee318b10eee4ada61828adaa51f94ea6c), [`35984362`](https://github.com/thirdweb-dev/js/commit/35984362b0a60e5b9c3d3c9731450a8f47deb1c4)]:
|
||||
- @thirdweb-dev/wallets@0.2.23
|
||||
|
||||
## 3.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||
- @thirdweb-dev/wallets@0.2.22
|
||||
|
||||
## 3.0.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf)]:
|
||||
- @thirdweb-dev/wallets@0.2.21
|
||||
|
||||
## 3.0.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "3.0.19",
|
||||
"version": "3.0.23",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
@@ -54,6 +54,7 @@
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/auth",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"build": "preconstruct build",
|
||||
"format": "prettier --write 'src/**/*'",
|
||||
|
||||
@@ -54,7 +54,8 @@ export class ThirdwebAuth {
|
||||
nonce: parsedOptions?.nonce,
|
||||
expiration_time:
|
||||
parsedOptions?.expirationTime || new Date(Date.now() + 1000 * 60 * 5),
|
||||
invalid_before: parsedOptions?.invalidBefore,
|
||||
invalid_before:
|
||||
parsedOptions?.invalidBefore || new Date(Date.now() - 1000 * 60 * 5),
|
||||
resources: parsedOptions?.resources,
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1065](https://github.com/thirdweb-dev/js/pull/1065) [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a) Thanks [@iketw](https://github.com/iketw)! - [Chains] update chains
|
||||
|
||||
- [#1064](https://github.com/thirdweb-dev/js/pull/1064) [`c85810ee`](https://github.com/thirdweb-dev/js/commit/c85810eee318b10eee4ada61828adaa51f94ea6c) Thanks [@MananTank](https://github.com/MananTank)! - Do not cache signer in wallets
|
||||
|
||||
- [#1047](https://github.com/thirdweb-dev/js/pull/1047) [`6fd10f94`](https://github.com/thirdweb-dev/js/commit/6fd10f94b469dc5659e2ff4ce92a5aff86f3c89d) Thanks [@MananTank](https://github.com/MananTank)! - Fix tree-shaking issue in `@thirdweb-dev/chains`
|
||||
|
||||
- [#1090](https://github.com/thirdweb-dev/js/pull/1090) [`5f1e6abb`](https://github.com/thirdweb-dev/js/commit/5f1e6abb391f5c58dbdb207f569b3dd0b5d4729c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add base-goerli to default chains
|
||||
|
||||
## 0.1.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1040](https://github.com/thirdweb-dev/js/pull/1040) [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update chains
|
||||
|
||||
## 0.1.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1031](https://github.com/thirdweb-dev/js/pull/1031) [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains
|
||||
|
||||
- [#1033](https://github.com/thirdweb-dev/js/pull/1033) [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added faucet for optimism goerli
|
||||
|
||||
## 0.1.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -11,20 +11,23 @@ export default {
|
||||
"rpc": [
|
||||
"https://gnosis.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.gnosischain.com",
|
||||
"https://rpc.gnosis.gateway.fm",
|
||||
"https://rpc.ankr.com/gnosis",
|
||||
"https://gnosischain-rpc.gateway.pokt.network",
|
||||
"https://gnosis-mainnet.public.blastapi.io",
|
||||
"https://gnosis.api.onfinality.io/public",
|
||||
"https://gnosis.blockpi.network/v1/rpc/public",
|
||||
"https://web3endpoints.com/gnosischain-mainnet",
|
||||
"wss://rpc.gnosischain.com/wss"
|
||||
],
|
||||
"faucets": [
|
||||
"https://gnosisfaucet.com",
|
||||
"https://faucet.gimlu.com/gnosis",
|
||||
"https://stakely.io/faucet/gnosis-chain-xdai",
|
||||
"https://faucet.prussia.dev/xdai"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "xDAI",
|
||||
"symbol": "xDAI",
|
||||
"symbol": "XDAI",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://docs.gnosischain.com",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Chiado Testnet",
|
||||
"chain": "CHI",
|
||||
"name": "Gnosis Chiado Testnet",
|
||||
"chain": "GNO",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeidk4swpgdyqmpz6shd5onvpaujvwiwthrhypufnwr6xh3dausz2dm",
|
||||
"width": 1800,
|
||||
@@ -9,16 +9,17 @@ export default {
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://chiado-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://gnosis-chiado-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.chiadochain.net",
|
||||
"https://rpc.eu-central-2.gateway.fm/v3/gnosis/archival/chiado"
|
||||
"https://rpc.chiado.gnosis.gateway.fm",
|
||||
"wss://rpc.chiadochain.net/wss"
|
||||
],
|
||||
"faucets": [
|
||||
"https://gnosisfaucet.com"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Chiado xDAI",
|
||||
"symbol": "xDAI",
|
||||
"symbol": "XDAI",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://docs.gnosischain.com",
|
||||
@@ -39,5 +40,5 @@ export default {
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "chiado-testnet"
|
||||
"slug": "gnosis-chiado-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Siberium",
|
||||
"symbol": "SBR",
|
||||
"symbol": "SIBR",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://siberium.net",
|
||||
@@ -18,9 +18,9 @@ export default {
|
||||
"chainId": 111111,
|
||||
"networkId": 111111,
|
||||
"icon": {
|
||||
"url": "ipfs://QmVDeoGo2TZPDWiaNDdPCnH2tz2BCQ7viw8ugdDWnU5LFq",
|
||||
"width": 1920,
|
||||
"height": 1920,
|
||||
"url": "ipfs://QmYeMdWDZ1iaBFeSPorRyPi7RuSXTdDKTgW3rfnUf3W5ne",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "svg"
|
||||
},
|
||||
"explorers": [
|
||||
@@ -28,9 +28,9 @@ export default {
|
||||
"name": "Siberium Mainnet Explorer - blockscout - 1",
|
||||
"url": "https://explorer.main.siberium.net",
|
||||
"icon": {
|
||||
"url": "ipfs://QmVDeoGo2TZPDWiaNDdPCnH2tz2BCQ7viw8ugdDWnU5LFq",
|
||||
"width": 1920,
|
||||
"height": 1920,
|
||||
"url": "ipfs://QmYeMdWDZ1iaBFeSPorRyPi7RuSXTdDKTgW3rfnUf3W5ne",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "svg"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
@@ -39,9 +39,9 @@ export default {
|
||||
"name": "Siberium Mainnet Explorer - blockscout - 2",
|
||||
"url": "https://explorer.main.siberium.net.ru",
|
||||
"icon": {
|
||||
"url": "ipfs://QmVDeoGo2TZPDWiaNDdPCnH2tz2BCQ7viw8ugdDWnU5LFq",
|
||||
"width": 1920,
|
||||
"height": 1920,
|
||||
"url": "ipfs://QmYeMdWDZ1iaBFeSPorRyPi7RuSXTdDKTgW3rfnUf3W5ne",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "svg"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Origin Testnet",
|
||||
"chain": "Origin",
|
||||
"rpc": [
|
||||
"https://origin-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://json-rpc.origin.uptick.network"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Origin",
|
||||
"symbol": "UOC",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.uptick.network",
|
||||
"shortName": "auoc",
|
||||
"chainId": 1170,
|
||||
"networkId": 1170,
|
||||
"icon": {
|
||||
"url": "ipfs://QmRGJ6PqYHDTWuUQ6xfnK8S82NzRXiMjTnSGat9qtLuaLP",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Origin Explorer",
|
||||
"url": "https://evm-explorer.origin.uptick.network",
|
||||
"icon": {
|
||||
"url": "ipfs://QmRGJ6PqYHDTWuUQ6xfnK8S82NzRXiMjTnSGat9qtLuaLP",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "origin-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -10,9 +10,24 @@ export default {
|
||||
},
|
||||
"rpc": [
|
||||
"https://fibonacci.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://node1.fibo-api.asia"
|
||||
"https://node1.fibo-api.asia",
|
||||
"https://node2.fibo-api.asia",
|
||||
"https://node3.fibo-api.asia",
|
||||
"https://node4.fibo-api.asia",
|
||||
"https://node5.fibo-api.asia",
|
||||
"https://node6.fibo-api.asia",
|
||||
"https://node7.fibo-api.asia",
|
||||
"https://node1.fibo-rpc.asia",
|
||||
"https://node2.fibo-rpc.asia",
|
||||
"https://node3.fibo-rpc.asia",
|
||||
"https://node4.fibo-rpc.asia",
|
||||
"https://node5.fibo-rpc.asia",
|
||||
"https://node6.fibo-rpc.asia",
|
||||
"https://node7.fibo-rpc.asia"
|
||||
],
|
||||
"faucets": [
|
||||
"https://test.fibochain.org/faucets"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "FIBONACCI UTILITY TOKEN",
|
||||
"symbol": "FIBO",
|
||||
@@ -29,6 +44,6 @@ export default {
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"testnet": true,
|
||||
"slug": "fibonacci"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "XRP Ledger EVM Devnet Sidechain",
|
||||
"chain": "XRPL",
|
||||
"shortName": "XRPL-EVM-Devnet-Sidechain",
|
||||
"chainId": 1440001,
|
||||
"testnet": true,
|
||||
"icon": {
|
||||
"format": "png",
|
||||
"url": "ipfs://bafkreidmgxjwjircegjkvysgz25b2ukw6h7axoirkxv6idupzzqsdrljgy",
|
||||
"width": 780,
|
||||
"height": 680
|
||||
},
|
||||
"rpc": [
|
||||
"https://xrp-ledger-evm-devnet-sidechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-evm-sidechain.xrpl.org"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"decimals": 18,
|
||||
"name": "XRP",
|
||||
"symbol": "XRP"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"url": "https://evm-sidechain.xrpl.org/",
|
||||
"name": "XRP Ledger Explorer",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"slug": "xrp-ledger-evm-devnet-sidechain"
|
||||
} as const satisfies Chain;
|
||||
@@ -4,17 +4,17 @@ export default {
|
||||
"chain": "TSCS",
|
||||
"rpc": [
|
||||
"https://super-smart-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet.superexchain.com:8544"
|
||||
"https://testnetrpc.scschain.com"
|
||||
],
|
||||
"faucets": [
|
||||
"https://testnet.superexchain.com"
|
||||
"https://testnet.scschain.com"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Super Chain Native Token",
|
||||
"symbol": "TSCS",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://testnet.superexchain.com",
|
||||
"infoURL": "https://testnet.scschain.com",
|
||||
"shortName": "tscs",
|
||||
"chainId": 1969,
|
||||
"networkId": 1969,
|
||||
@@ -27,7 +27,7 @@ export default {
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://testnetscan.superexchain.com",
|
||||
"url": "https://testnetscan.scschain.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "SCS",
|
||||
"rpc": [
|
||||
"https://super-smart-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://superexchain.com:8545"
|
||||
"https://rpc.scschain.com"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
@@ -12,7 +12,7 @@ export default {
|
||||
"symbol": "SCS",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://superexchain.com",
|
||||
"infoURL": "https://scschain.com",
|
||||
"shortName": "scs",
|
||||
"chainId": 1970,
|
||||
"networkId": 1970,
|
||||
@@ -25,7 +25,7 @@ export default {
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://scan.superexchain.com",
|
||||
"url": "https://scan.scschain.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -12,15 +12,15 @@ export default {
|
||||
"symbol": "BTT",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://bittorrentchain.io/",
|
||||
"infoURL": "https:/bt.io",
|
||||
"shortName": "BTT",
|
||||
"chainId": 199,
|
||||
"networkId": 199,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "bttcscan",
|
||||
"url": "https://scan.bittorrentchain.io",
|
||||
"standard": "none"
|
||||
"name": "BitTorrent Chain Explorer",
|
||||
"url": "https://bttcscan.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
|
||||
@@ -11,8 +11,8 @@ export default {
|
||||
"rpc": [
|
||||
"https://dogechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.dogechain.dog",
|
||||
"https://rpc-us.dogechain.dog",
|
||||
"https://rpc01.dogechain.dog"
|
||||
"https://rpc01-sg.dogechain.dog",
|
||||
"https://rpc.ankr.com/dogechain"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Metaplayerone Network",
|
||||
"name": "Metaplayerone Dubai Testnet",
|
||||
"chain": "MP1 Dubai-Testnet",
|
||||
"icon": {
|
||||
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
|
||||
@@ -9,7 +9,7 @@ export default {
|
||||
"format": "svg"
|
||||
},
|
||||
"rpc": [
|
||||
"https://metaplayerone-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://metaplayerone-dubai-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-dubai.mp1network.com/"
|
||||
],
|
||||
"faucets": [],
|
||||
@@ -36,5 +36,5 @@ export default {
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "metaplayerone-network"
|
||||
"slug": "metaplayerone-dubai-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
"chain": "Kanazawa",
|
||||
"rpc": [
|
||||
"https://kanazawa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-kanazawa.meldlabs.dev/ext/bc/2Ci7VYrUd4fTBqGA5D2HA6UPHzQ4LQyr8rZQww9MGSv9rNkRzn/rpc"
|
||||
"https://subnets.avax.network/meld/testnet/rpc"
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
@@ -24,7 +24,19 @@ export default {
|
||||
"shortName": "kanazawa",
|
||||
"chainId": 222000222,
|
||||
"networkId": 222000222,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "explorer",
|
||||
"url": "https://subnets-test.avax.network/meld",
|
||||
"icon": {
|
||||
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
|
||||
"width": 4000,
|
||||
"height": 4000,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "kanazawa"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "SOMA Network Mainnet",
|
||||
"chain": "SOMA",
|
||||
"rpc": [
|
||||
"https://soma-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://data-mainnet-v1.somanetwork.io/"
|
||||
],
|
||||
"faucets": [
|
||||
"https://airdrop.somanetwork.io"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Soma Native Token",
|
||||
"symbol": "SMA",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://somanetwork.io",
|
||||
"shortName": "smam",
|
||||
"chainId": 2332,
|
||||
"networkId": 2332,
|
||||
"icon": {
|
||||
"url": "ipfs://QmadSU2tcyvuzssDYGJ4rVLag43QLnKwcBerZR2zKLVU2N",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"format": "png"
|
||||
},
|
||||
"status": "incubating",
|
||||
"explorers": [
|
||||
{
|
||||
"name": "SOMA Explorer Mainnet",
|
||||
"icon": {
|
||||
"url": "ipfs://QmadSU2tcyvuzssDYGJ4rVLag43QLnKwcBerZR2zKLVU2N",
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
"format": "png"
|
||||
},
|
||||
"url": "https://somascan.io",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "soma-network"
|
||||
} as const satisfies Chain;
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chain": "SHIB",
|
||||
"rpc": [
|
||||
"https://shibachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.shibachain.net"
|
||||
"https://rpc.shibchain.org"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
@@ -12,14 +12,14 @@ export default {
|
||||
"symbol": "SHIB",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.shibachain.net",
|
||||
"infoURL": "https://shibchain.org",
|
||||
"shortName": "shib",
|
||||
"chainId": 27,
|
||||
"networkId": 27,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Shiba Explorer",
|
||||
"url": "https://exp.shibachain.net",
|
||||
"url": "https://exp.shibchain.org",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -2,6 +2,12 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "LaChain",
|
||||
"chain": "LaChain",
|
||||
"icon": {
|
||||
"url": "ipfs://QmQxGA6rhuCQDXUueVcNvFRhMEWisyTmnF57TqL7h6k6cZ",
|
||||
"width": 1280,
|
||||
"height": 1280,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://lachain-lachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc1.mainnet.lachain.network",
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Optimism on Gnosis",
|
||||
"chain": "OGC",
|
||||
"rpc": [
|
||||
"https://optimism-on-gnosis.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://optimism.gnosischain.com",
|
||||
"wss://optimism.gnosischain.com/wss"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.gimlu.com/gnosis"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "xDAI",
|
||||
"symbol": "xDAI",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.xdaichain.com/for-developers/optimism-optimistic-rollups-on-gc",
|
||||
"shortName": "ogc",
|
||||
"chainId": 300,
|
||||
"networkId": 300,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://blockscout.com/xdai/optimism",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifu5tpui7dk5cjoo54kde7pmuthvnl7sdykobuarsxgu7t2izurnq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "optimism-on-gnosis"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,28 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Canxium Mainnet",
|
||||
"chain": "CAU",
|
||||
"rpc": [
|
||||
"https://canxium.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.canxium.org"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Canxium",
|
||||
"symbol": "CAU",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://canxium.org",
|
||||
"shortName": "cau",
|
||||
"chainId": 3003,
|
||||
"networkId": 3003,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "canxium explorer",
|
||||
"url": "https://explorer.canxium.org",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "canxium"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,45 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "PLAYA3ULL GAMES",
|
||||
"chain": "3ULL",
|
||||
"rpc": [
|
||||
"https://playa3ull-games.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://api.mainnet.playa3ull.games"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "3ULL",
|
||||
"symbol": "3ULL",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"infoURL": "https://playa3ull.games",
|
||||
"shortName": "3ULL",
|
||||
"chainId": 3011,
|
||||
"networkId": 3011,
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreib62bv2d65d7nidojgpkgatrt7smee2l4ov6i6ozqhpfaqsonxku4",
|
||||
"width": 512,
|
||||
"height": 443,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "PLAYA3ULL GAMES Explorer",
|
||||
"url": "https://3011.routescan.io",
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreib62bv2d65d7nidojgpkgatrt7smee2l4ov6i6ozqhpfaqsonxku4",
|
||||
"width": 512,
|
||||
"height": 443,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "playa3ull-games"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Neurochain Testnet",
|
||||
"chain": "NCN",
|
||||
"rpc": [
|
||||
"https://neurochain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://nc-rpc-test1.neurochain.io"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Neurochain",
|
||||
"symbol": "tNCN",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"infoURL": "https://www.neurochain.ai",
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "neurochain-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,49 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Neurochain Mainnet",
|
||||
"chain": "NCN",
|
||||
"rpc": [
|
||||
"https://neurochain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://nc-rpc-prd1.neurochain.io",
|
||||
"https://nc-rpc-prd2.neurochain.io"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Neurochain",
|
||||
"symbol": "NCN",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"infoURL": "https://www.neurochain.ai",
|
||||
"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"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "neurochain"
|
||||
} as const satisfies Chain;
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
"chain": "MELD",
|
||||
"rpc": [
|
||||
"https://meld.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://network-rpc.meld.com"
|
||||
"https://subnets.avax.network/meld/mainnet/rpc"
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
@@ -24,7 +24,19 @@ export default {
|
||||
"shortName": "meld",
|
||||
"chainId": 333000333,
|
||||
"networkId": 333000333,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "explorer",
|
||||
"url": "https://subnets.avax.network/meld",
|
||||
"icon": {
|
||||
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
|
||||
"width": 4000,
|
||||
"height": 4000,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "meld"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "SecureChain Testnet",
|
||||
"chain": "SCAI",
|
||||
"icon": {
|
||||
"url": "ipfs://Qme2Z8VFYjhHGfLQPBnfseNpEdRfmTDy7VXqrdH4AHETJf",
|
||||
"width": 150,
|
||||
"height": 150,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://securechain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet-rpc.securechain.ai"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.securechain.ai"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "SCAI",
|
||||
"symbol": "SCAI",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://securechain.ai",
|
||||
"shortName": "SCAIt",
|
||||
"chainId": 3434,
|
||||
"networkId": 3434,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "SecureChain",
|
||||
"url": "https://testnet.securechain.ai",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "securechain-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Bitfinity Network Testnet",
|
||||
"chain": "BFT",
|
||||
"rpc": [
|
||||
"https://bitfinity-network-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet.bitfinity.network"
|
||||
],
|
||||
"faucets": [
|
||||
"https://bitfinity.network/faucet"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "BITFINITY",
|
||||
"symbol": "BFT",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://bitfinity.network",
|
||||
"shortName": "Bitfinity",
|
||||
"chainId": 355113,
|
||||
"networkId": 355113,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Bitfinity Block Explorer",
|
||||
"url": "https://explorer.bitfinity.network",
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreiczbhnoc5wpjikskmehexmg3xmqr4fchrny64db4wmk3lrygqik5e",
|
||||
"width": 796,
|
||||
"height": 129,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "bitfinity-network-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "PulseChain Mainnet",
|
||||
"name": "PulseChain",
|
||||
"shortName": "pls",
|
||||
"chain": "PLS",
|
||||
"chainId": 369,
|
||||
@@ -8,10 +8,22 @@ export default {
|
||||
"infoURL": "https://pulsechain.com/",
|
||||
"rpc": [
|
||||
"https://pulsechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.mainnet.pulsechain.com/",
|
||||
"wss://rpc.mainnet.pulsechain.com/"
|
||||
"https://rpc.pulsechain.com/",
|
||||
"wss://rpc.pulsechain.com/"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"ens": {
|
||||
"registry": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
||||
},
|
||||
"status": "incubating",
|
||||
"nativeCurrency": {
|
||||
"name": "Pulse",
|
||||
"symbol": "PLS",
|
||||
|
||||
@@ -4,6 +4,7 @@ export default {
|
||||
"chain": "FTM",
|
||||
"rpc": [
|
||||
"https://fantom-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://fantom-testnet.publicnode.com",
|
||||
"https://rpc.testnet.fantom.network"
|
||||
],
|
||||
"faucets": [
|
||||
|
||||
@@ -18,6 +18,13 @@ export default {
|
||||
"shortName": "TelosEVMTestnet",
|
||||
"chainId": 41,
|
||||
"networkId": 41,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "teloscan",
|
||||
"url": "https://testnet.teloscan.io",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"icon": {
|
||||
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "LA Testnet",
|
||||
"chain": "LATestnet",
|
||||
"name": "LaTestnet",
|
||||
"chain": "LaTestnet",
|
||||
"icon": {
|
||||
"url": "ipfs://QmQxGA6rhuCQDXUueVcNvFRhMEWisyTmnF57TqL7h6k6cZ",
|
||||
"width": 1280,
|
||||
"height": 1280,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://la-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://latestnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.testnet.lachain.network"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.lachain.network"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Test La Coin",
|
||||
"name": "Test LaCoin",
|
||||
"symbol": "TLA",
|
||||
"decimals": 18
|
||||
},
|
||||
@@ -25,11 +31,11 @@ export default {
|
||||
"networkId": 418,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "LA Testnet Explorer",
|
||||
"name": "LaTestnet Explorer",
|
||||
"url": "https://testexplorer.lachain.network",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "la-testnet"
|
||||
"slug": "latestnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -8,7 +8,9 @@ export default {
|
||||
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://goerli.optimism.io/"
|
||||
],
|
||||
"faucets": [],
|
||||
"faucets": [
|
||||
"https://coinbase.com/faucets/optimism-goerli-faucet"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Goerli Ether",
|
||||
"symbol": "ETH",
|
||||
|
||||
@@ -11,7 +11,8 @@ export default {
|
||||
"rpc": [
|
||||
"https://avalanche-fuji.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://api.avax-test.network/ext/bc/C/rpc"
|
||||
"https://api.avax-test.network/ext/bc/C/rpc",
|
||||
"https://avalanche-fuji-c-chain.publicnode.com"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.avax.network/",
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Floripa",
|
||||
"title": "Wireshape Testnet Floripa",
|
||||
"name": "Wireshape Floripa Testnet",
|
||||
"title": "Wireshape Floripa Testnet",
|
||||
"chain": "Wireshape",
|
||||
"icon": {
|
||||
"url": "ipfs://QmTAyT3YrW2654CBRqRkec2cCznv6EBsbsRc2y6WQPbvXx",
|
||||
"width": 1280,
|
||||
"height": 1280,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://floripa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-floripa.wireshape.org"
|
||||
"https://wireshape-floripa-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-floripa.wireshape.org",
|
||||
"https://floripa.rpc.thirdweb.com"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
@@ -25,5 +32,5 @@ export default {
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "floripa"
|
||||
"slug": "wireshape-floripa-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
"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://rpc.goerli.mudit.blog/"
|
||||
"https://rpc.goerli.mudit.blog/",
|
||||
"https://ethereum-goerli.publicnode.com"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.paradigm.xyz/",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Sahara",
|
||||
"name": "Fastex Chain (Bahamut)",
|
||||
"title": "Bahamut mainnet Sahara",
|
||||
"chain": "Bahamut",
|
||||
"chain": "Fastex Chain (Bahamut)",
|
||||
"icon": {
|
||||
"url": "ipfs://QmSemioP83RXnDWwTZbet8VpwJxcFRboX4B3pcdhLZGodP",
|
||||
"width": 200,
|
||||
@@ -10,7 +10,7 @@ export default {
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://sahara.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://fastex-chain-bahamut.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc1.sahara.bahamutchain.com",
|
||||
"https://rpc2.sahara.bahamutchain.com"
|
||||
],
|
||||
@@ -40,5 +40,5 @@ export default {
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "sahara"
|
||||
"slug": "fastex-chain-bahamut"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Scroll Sepolia Testnet",
|
||||
"chain": "ETH",
|
||||
"status": "incubating",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://scroll.io",
|
||||
"shortName": "scr-sepolia",
|
||||
"chainId": 534351,
|
||||
"networkId": 534351,
|
||||
"explorers": [],
|
||||
"parent": {
|
||||
"type": "L2",
|
||||
"chain": "eip155-11155111",
|
||||
"bridges": []
|
||||
},
|
||||
"testnet": true,
|
||||
"slug": "scroll-sepolia-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -2,6 +2,7 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Scroll",
|
||||
"chain": "ETH",
|
||||
"status": "incubating",
|
||||
"rpc": [],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Scroll Alpha Testnet",
|
||||
"chain": "ETH",
|
||||
"status": "incubating",
|
||||
"status": "active",
|
||||
"rpc": [
|
||||
"https://scroll-alpha-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://alpha-rpc.scroll.io/l2"
|
||||
@@ -22,6 +22,11 @@ export default {
|
||||
"name": "Scroll Alpha Testnet Block Explorer",
|
||||
"url": "https://blockscout.scroll.io",
|
||||
"standard": "EIP3091"
|
||||
},
|
||||
{
|
||||
"name": "Scroll Alpha Testnet Block Explorer",
|
||||
"url": "https://scrollscan.co",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"parent": {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Scroll Pre-Alpha Testnet",
|
||||
"chain": "ETH",
|
||||
"rpc": [
|
||||
"https://scroll-pre-alpha-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://prealpha-rpc.scroll.io/l2"
|
||||
],
|
||||
"faucets": [
|
||||
"https://prealpha.scroll.io/faucet"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "TSETH",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://scroll.io",
|
||||
"shortName": "scr-prealpha",
|
||||
"chainId": 534354,
|
||||
"networkId": 534354,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Scroll L2 Block Explorer",
|
||||
"url": "https://l2scan.scroll.io",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "scroll-pre-alpha-testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -7,8 +7,8 @@ export default {
|
||||
"https://linea-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.goerli.linea.build",
|
||||
"wss://rpc.goerli.linea.build",
|
||||
"https://consensys-zkevm-goerli-prealpha.infura.io/v3/${INFURA_API_KEY}",
|
||||
"wss://consensys-zkevm-goerli-prealpha.infura.io/v3/${INFURA_API_KEY}"
|
||||
"https://linea-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"wss://linea-goerli.infura.io/v3/${INFURA_API_KEY}"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucetlink.to/goerli"
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "AxelChain Dev-Net",
|
||||
"chain": "AXEL",
|
||||
"rpc": [
|
||||
"https://axelchain-dev-net.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://aium-rpc-dev.viacube.com"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Axelium",
|
||||
"symbol": "AIUM",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://www.axel.org",
|
||||
"shortName": "aium-dev",
|
||||
"chainId": 61800,
|
||||
"networkId": 61800,
|
||||
"icon": {
|
||||
"url": "ipfs://QmNx8FRacfNeawhkjk5p57EKzDHkLGMaBBmK2VRL5CB2P2",
|
||||
"width": 40,
|
||||
"height": 40,
|
||||
"format": "svg"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "AxelChain Dev-Net Explorer",
|
||||
"url": "https://devexplorer2.viacube.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "axelchain-dev-net"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,44 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Fox Testnet Network",
|
||||
"chain": "FOX",
|
||||
"rpc": [
|
||||
"https://fox-testnet-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-testnet-v1.foxchain.app/",
|
||||
"https://rpc2-testnet-v1.foxchain.app/",
|
||||
"https://rpc3-testnet-v1.foxchain.app"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.foxchain.app"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "FOX Native Token",
|
||||
"symbol": "tFOX",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://foxchain.app",
|
||||
"shortName": "fox",
|
||||
"chainId": 6565,
|
||||
"networkId": 6565,
|
||||
"icon": {
|
||||
"url": "ipfs://Qmbp1rwhtRr6JQRyYqyfLqkbmzXr1T17zbmChsi2ouvg3M",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "FOX Testnet Explorer",
|
||||
"icon": {
|
||||
"url": "ipfs://Qmbp1rwhtRr6JQRyYqyfLqkbmzXr1T17zbmChsi2ouvg3M",
|
||||
"width": 100,
|
||||
"height": 100,
|
||||
"format": "png"
|
||||
},
|
||||
"url": "https://testnet.foxscan.app",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "fox-testnet-network"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Shibarium Beta",
|
||||
"chain": "Shibarium",
|
||||
"icon": {
|
||||
"url": "ipfs://QmYNVkoZgRjDBQzJz6kog9mA2yPzQFW2oSKvhnkwuBhLQE",
|
||||
"width": 2000,
|
||||
"height": 2000,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://shibarium-beta.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://puppynet.shibrpc.com"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "BONE",
|
||||
"symbol": "BONE",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://beta.shibariumtech.com",
|
||||
"shortName": "shibarium",
|
||||
"chainId": 719,
|
||||
"networkId": 719,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "shibscan",
|
||||
"url": "https://puppyscan.shib.io",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "shibarium-beta"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Dragonfly Mainnet (Hexapod)",
|
||||
"chain": "Dragonfly",
|
||||
"icon": {
|
||||
"url": "ipfs://QmPXhdPGufjcPzZ9Y6nY6QyW8MgA6793L88iPMRh1Q3gjJ",
|
||||
"width": 512,
|
||||
"height": 366,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://dragonfly-hexapod.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://dragonfly-rpc.switch.ch",
|
||||
"https://dragonfly-rpc.kore-technologies.ch",
|
||||
"https://dragonfly-rpc.phoenix-systems.io",
|
||||
"https://dragonfly-rpc.block-spirit.ch"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Dragonfly",
|
||||
"symbol": "DFLY",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://hexapod.network",
|
||||
"shortName": "dfly",
|
||||
"chainId": 78281,
|
||||
"networkId": 78281,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Dragonfly Blockscout",
|
||||
"url": "https://blockscout.dragonfly.hexapod.network",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifu5tpui7dk5cjoo54kde7pmuthvnl7sdykobuarsxgu7t2izurnq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "dragonfly-hexapod"
|
||||
} as const satisfies Chain;
|
||||
@@ -15,7 +15,8 @@ export default {
|
||||
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://matic-mumbai.chainstacklabs.com",
|
||||
"https://rpc-mumbai.maticvigil.com",
|
||||
"https://matic-testnet-archive-rpc.bwarelabs.com"
|
||||
"https://matic-testnet-archive-rpc.bwarelabs.com",
|
||||
"https://polygon-mumbai-bor.publicnode.com"
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.polygon.technology/"
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "SwissDLT",
|
||||
"chain": "SDLT",
|
||||
"rpc": [
|
||||
"https://swissdlt.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.swissdlt.ch"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "BCTS",
|
||||
"symbol": "BCTS",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"infoURL": "https://bcts.ch",
|
||||
"shortName": "sdlt",
|
||||
"chainId": 94,
|
||||
"networkId": 94,
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreig7x5z4j6vh2r3pugmjnob3tmlksaekhqcgsorqzvs55o6v7ehqd4",
|
||||
"width": 682,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "SwissDLT Explorer",
|
||||
"url": "https://explorer.swissdlt.ch",
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreig7x5z4j6vh2r3pugmjnob3tmlksaekhqcgsorqzvs55o6v7ehqd4",
|
||||
"width": 682,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "swissdlt"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,47 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "Mantis Testnet (Hexapod)",
|
||||
"chain": "Mantis",
|
||||
"icon": {
|
||||
"url": "ipfs://Qma8dDhxSSVUyzV8Pu5bo252WaZEEikYFndRh7LVktvQEy",
|
||||
"width": 512,
|
||||
"height": 330,
|
||||
"format": "png"
|
||||
},
|
||||
"rpc": [
|
||||
"https://mantis-testnet-hexapod.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://mantis-rpc.switch.ch",
|
||||
"https://mantis-rpc.kore-technologies.ch",
|
||||
"https://mantis-rpc.phoenix-systems.io"
|
||||
],
|
||||
"faucets": [
|
||||
"https://mantis.switch.ch/faucet",
|
||||
"https://mantis.kore-technologies.ch/faucet",
|
||||
"https://mantis.phoenix-systems.io/faucet",
|
||||
"https://mantis.block-spirit.ch/faucet"
|
||||
],
|
||||
"nativeCurrency": {
|
||||
"name": "Mantis",
|
||||
"symbol": "MANTIS",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://hexapod.network",
|
||||
"shortName": "mantis",
|
||||
"chainId": 96970,
|
||||
"networkId": 96970,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Mantis Blockscout",
|
||||
"url": "https://blockscout.mantis.hexapod.network",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifu5tpui7dk5cjoo54kde7pmuthvnl7sdykobuarsxgu7t2izurnq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"testnet": true,
|
||||
"slug": "mantis-testnet-hexapod"
|
||||
} as const satisfies Chain;
|
||||
@@ -4,6 +4,7 @@ export default {
|
||||
"chain": "BSC",
|
||||
"rpc": [
|
||||
"https://binance-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://bsc-testnet.publicnode.com",
|
||||
"https://data-seed-prebsc-2-s3.binance.org:8545",
|
||||
"https://data-seed-prebsc-1-s3.binance.org:8545",
|
||||
"https://data-seed-prebsc-2-s2.binance.org:8545",
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"name": "PepeNetwork Mainnet",
|
||||
"chain": "PepeNetwork",
|
||||
"rpc": [
|
||||
"https://pepenetwork.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-mainnet.pepenetwork.io"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Pepe",
|
||||
"symbol": "WPEPE",
|
||||
"decimals": 18
|
||||
},
|
||||
"infoURL": "https://pepenetwork.io",
|
||||
"shortName": "pn",
|
||||
"chainId": 9779,
|
||||
"networkId": 9779,
|
||||
"icon": {
|
||||
"url": "ipfs://QmPX3uipdwd195z1MJff7uj8hpZdSuVvM5z47eiz2o7Gz5",
|
||||
"width": 960,
|
||||
"height": 944,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Pepe Explorer",
|
||||
"url": "https://explorer.pepenetwork.io",
|
||||
"icon": {
|
||||
"url": "ipfs://QmPX3uipdwd195z1MJff7uj8hpZdSuVvM5z47eiz2o7Gz5",
|
||||
"width": 960,
|
||||
"height": 944,
|
||||
"format": "png"
|
||||
},
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "pepenetwork"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
// @ts-check
|
||||
/** @typedef { import("../../src/types").Chain } Chain */
|
||||
|
||||
/** @type {Omit<Chain, "slug">} */
|
||||
export default {
|
||||
name: "XRP Ledger EVM Devnet Sidechain",
|
||||
chain: "XRPL",
|
||||
shortName: "XRPL-EVM-Devnet-Sidechain",
|
||||
chainId: 1440001,
|
||||
testnet: true,
|
||||
icon: {
|
||||
format: "png",
|
||||
url: "ipfs://bafkreidmgxjwjircegjkvysgz25b2ukw6h7axoirkxv6idupzzqsdrljgy",
|
||||
width: 780,
|
||||
height: 680,
|
||||
},
|
||||
rpc: ["https://rpc-evm-sidechain.xrpl.org"],
|
||||
nativeCurrency: {
|
||||
decimals: 18,
|
||||
name: "XRP",
|
||||
symbol: "XRP",
|
||||
},
|
||||
explorers: [
|
||||
{
|
||||
url: "https://evm-sidechain.xrpl.org/",
|
||||
name: "XRP Ledger Explorer",
|
||||
standard: "EIP3091",
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -13,4 +13,5 @@ export default {
|
||||
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||
],
|
||||
faucets: ["https://coinbase.com/faucets/optimism-goerli-faucet"],
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.16",
|
||||
"version": "0.1.19",
|
||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -81,6 +81,7 @@ chains = chains
|
||||
const imports = [];
|
||||
const exports = [];
|
||||
const exportNames = [];
|
||||
const exportNameToChain = {};
|
||||
|
||||
const takenSlugs = {};
|
||||
|
||||
@@ -216,9 +217,13 @@ export default ${JSON.stringify(chain, null, 2)} as const satisfies Chain;`,
|
||||
|
||||
imports.push(`import c${chain.chainId} from "../chains/${chain.chainId}";`);
|
||||
|
||||
exports.push(`export const ${exportName} = c${chain.chainId};`);
|
||||
exports.push(
|
||||
`export { default as ${exportName} } from "../chains/${chain.chainId}"`,
|
||||
);
|
||||
|
||||
exportNames.push(exportName);
|
||||
const key = `c${chain.chainId}`;
|
||||
exportNames.push(key);
|
||||
exportNameToChain[key] = chain;
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
@@ -229,22 +234,58 @@ import type { Chain } from "./types";
|
||||
${exports.join("\n")}
|
||||
export * from "./types";
|
||||
export * from "./utils";
|
||||
export const defaultChains = [Ethereum, Goerli, Polygon, Mumbai, Arbitrum, ArbitrumGoerli, Optimism, OptimismGoerli, Binance, BinanceTestnet, Fantom, FantomTestnet, Avalanche, AvalancheFuji, Localhost];
|
||||
export const allChains = [${exportNames.join(", ")}];
|
||||
export const defaultChains = [c1, c5, c84531, c137, c80001, c42161, c421613, c10, c420, c56, c97, c250, c4002, c43114, c43113, c1337];
|
||||
export const allChains: Chain[] = [${exportNames.join(", ")}];
|
||||
|
||||
const chainsById = {
|
||||
${exportNames.map((n) => `[${n}.chainId]: ${n}`).join(",\n")}
|
||||
} as const;
|
||||
type ChainsById = {
|
||||
${exportNames
|
||||
.map((n) => `${exportNameToChain[n].chainId}: typeof ${n}`)
|
||||
.join(",\n")}
|
||||
};
|
||||
|
||||
const chainIdsBySlug = {
|
||||
${exportNames.map((n) => `[${n}.slug]: ${n}.chainId`).join(",\n")}
|
||||
} as const;
|
||||
type ChainIdsBySlug = {
|
||||
${exportNames
|
||||
.map(
|
||||
(n) => `"${exportNameToChain[n].slug}": ${exportNameToChain[n].chainId}`,
|
||||
)
|
||||
.join(",\n")}
|
||||
};
|
||||
|
||||
let _chainsById: Record<number, Chain>;
|
||||
let _chainIdsBySlug: Record<string, number>;
|
||||
|
||||
function getChainsById() {
|
||||
if (_chainsById) {
|
||||
return _chainsById;
|
||||
}
|
||||
_chainsById = {};
|
||||
allChains.forEach((chain) => {
|
||||
_chainsById[chain.chainId] = chain;
|
||||
});
|
||||
return _chainsById;
|
||||
}
|
||||
|
||||
export function getChainIdsBySlug() {
|
||||
if (_chainIdsBySlug) {
|
||||
return _chainIdsBySlug;
|
||||
}
|
||||
_chainIdsBySlug = {};
|
||||
allChains.forEach((chain) => {
|
||||
_chainIdsBySlug[chain.slug] = chain.chainId;
|
||||
});
|
||||
return _chainIdsBySlug;
|
||||
}
|
||||
|
||||
export type ChainSlug = keyof ChainIdsBySlug;
|
||||
export type ChainId = keyof ChainsById;
|
||||
|
||||
function isValidChainId(chainId: number): chainId is ChainId {
|
||||
const chainsById = getChainsById();
|
||||
return chainId in chainsById;
|
||||
}
|
||||
|
||||
function isValidChainSlug(slug: string): slug is ChainSlug {
|
||||
const chainIdsBySlug = getChainIdsBySlug();
|
||||
return slug in chainIdsBySlug;
|
||||
}
|
||||
|
||||
@@ -252,7 +293,8 @@ export function getChainByChainId<TChainId extends ChainId>(
|
||||
chainId: TChainId | (number & {}),
|
||||
) {
|
||||
if (isValidChainId(chainId)) {
|
||||
return chainsById[chainId] as (typeof chainsById)[TChainId];
|
||||
const chainsById = getChainsById();
|
||||
return chainsById[chainId] as ChainsById[TChainId];
|
||||
}
|
||||
throw new Error(\`Chain with chainId "\${chainId}" not found\`);
|
||||
}
|
||||
@@ -261,13 +303,13 @@ export function getChainBySlug<TSlug extends ChainSlug>(
|
||||
slug: TSlug | (string & {}),
|
||||
) {
|
||||
if (isValidChainSlug(slug)) {
|
||||
return chainsById[chainIdsBySlug[slug]] as (typeof chainsById)[
|
||||
(typeof chainIdsBySlug)[TSlug]
|
||||
];
|
||||
const chainIdsBySlug = getChainIdsBySlug();
|
||||
const chainsById = getChainsById();
|
||||
return chainsById[
|
||||
chainIdsBySlug[slug]
|
||||
] as ChainsById[ChainIdsBySlug[TSlug]];
|
||||
}
|
||||
throw new Error(\`Chain with slug "\${slug}" not found\`);
|
||||
}
|
||||
|
||||
export type ChainSlug = keyof typeof chainIdsBySlug;
|
||||
export type ChainId = keyof typeof chainsById;`,
|
||||
`,
|
||||
);
|
||||
|
||||
+2779
-2625
File diff suppressed because one or more lines are too long
@@ -1,5 +1,44 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.10.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`23d90b3e`](https://github.com/thirdweb-dev/js/commit/23d90b3e779a5bfdb7058b8c51349d9c278fcbce), [`cc56037e`](https://github.com/thirdweb-dev/js/commit/cc56037e64560b9e0fc16eb0ac7cc2e47e2c9fdf), [`67450789`](https://github.com/thirdweb-dev/js/commit/67450789473b6008b86453ee4f4c7b99461223a6)]:
|
||||
- @thirdweb-dev/sdk@3.10.19
|
||||
- @thirdweb-dev/storage@1.1.4
|
||||
|
||||
## 0.10.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1003](https://github.com/thirdweb-dev/js/pull/1003) [`d24a6146`](https://github.com/thirdweb-dev/js/commit/d24a6146d8a1c623c39687baf6f579e721ef99c6) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Add support for ZKSync
|
||||
|
||||
- [#1066](https://github.com/thirdweb-dev/js/pull/1066) [`32cc5442`](https://github.com/thirdweb-dev/js/commit/32cc54423e51b22cb665bf6106c484dfb45206b3) Thanks [@adam-maj](https://github.com/adam-maj)! - Deduplicate addresses when running thirdweb generate
|
||||
|
||||
- Updated dependencies [[`2f1df0b5`](https://github.com/thirdweb-dev/js/commit/2f1df0b5354a8ee55089b2c1e61c058788d890f1), [`189daf02`](https://github.com/thirdweb-dev/js/commit/189daf0280a90ed730200088948526a594da3408), [`afae0873`](https://github.com/thirdweb-dev/js/commit/afae0873b0e3f9741f5a9c44c5d255f38c6a9111), [`c6e74ef0`](https://github.com/thirdweb-dev/js/commit/c6e74ef0b00210f52e6778c548061376d3ba7001), [`ee4c7de2`](https://github.com/thirdweb-dev/js/commit/ee4c7de25cb63f99f33b90da8e26293bbfbe6f3e), [`f7b352a5`](https://github.com/thirdweb-dev/js/commit/f7b352a585a23726eaa3be116f65db56b005f4d8), [`4a1d7581`](https://github.com/thirdweb-dev/js/commit/4a1d75811058d6974616bdc12a6040cea5444e40), [`bdabbef7`](https://github.com/thirdweb-dev/js/commit/bdabbef71a2421a2dceb384f93bb6a59a3ddf007), [`59206233`](https://github.com/thirdweb-dev/js/commit/59206233e15ccfe3dc32047060055219d35938f2), [`98efd090`](https://github.com/thirdweb-dev/js/commit/98efd090f63cfd9dfed7b89b20b6e43db88cf75c), [`8eecf4c2`](https://github.com/thirdweb-dev/js/commit/8eecf4c2d5b0d6447ad5b9cdbf0269818bbb3498), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`d5651006`](https://github.com/thirdweb-dev/js/commit/d565100614d7d4e256554f998b8ce978a566051c), [`da576108`](https://github.com/thirdweb-dev/js/commit/da5761080288c3b325f54fb56c80f96405a1cb5d), [`c85810ee`](https://github.com/thirdweb-dev/js/commit/c85810eee318b10eee4ada61828adaa51f94ea6c), [`6fd10f94`](https://github.com/thirdweb-dev/js/commit/6fd10f94b469dc5659e2ff4ce92a5aff86f3c89d), [`5f1e6abb`](https://github.com/thirdweb-dev/js/commit/5f1e6abb391f5c58dbdb207f569b3dd0b5d4729c), [`a034b032`](https://github.com/thirdweb-dev/js/commit/a034b0321fd0113ed51d95d538b5c3020615c227)]:
|
||||
- @thirdweb-dev/sdk@3.10.18
|
||||
- @thirdweb-dev/chains@0.1.19
|
||||
|
||||
## 0.10.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||
- @thirdweb-dev/chains@0.1.18
|
||||
- @thirdweb-dev/sdk@3.10.17
|
||||
|
||||
## 0.10.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1037](https://github.com/thirdweb-dev/js/pull/1037) [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa) Thanks [@jnsdls](https://github.com/jnsdls)! - update ipfs gateways - add more fallbacks
|
||||
|
||||
- Updated dependencies [[`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||
- @thirdweb-dev/storage@1.1.3
|
||||
- @thirdweb-dev/chains@0.1.17
|
||||
- @thirdweb-dev/sdk@3.10.16
|
||||
|
||||
## 0.10.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.10.16",
|
||||
"version": "0.10.20",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -294,6 +294,7 @@ const main = async () => {
|
||||
"--dynamic",
|
||||
"Deploy a dynamic smart contract made up of extensions to blockchains",
|
||||
)
|
||||
.option("--zksync", "Deploy on ZKSync")
|
||||
.action(async (options) => {
|
||||
const url = await deploy(options);
|
||||
if (url) {
|
||||
|
||||
@@ -52,7 +52,9 @@ export async function processProject(
|
||||
|
||||
logger.debug("Processing project at path " + projectPath);
|
||||
|
||||
const projectType = await detect(projectPath, options);
|
||||
const projectType = options.zksync
|
||||
? "hardhat"
|
||||
: await detect(projectPath, options);
|
||||
|
||||
if (projectType === "none") {
|
||||
if (command === "deploy") {
|
||||
@@ -220,13 +222,13 @@ export async function processProject(
|
||||
const soliditySDKPackage = "@thirdweb-dev/contracts";
|
||||
let usesSoliditySDK = false;
|
||||
|
||||
if(options.dynamic) {
|
||||
if (options.dynamic) {
|
||||
if (selectedRouter.name === "thirdweb-router") {
|
||||
const deployArgs: TWRouterParams = {
|
||||
extensionRegistry: EXTENSION_REGISTRY_ADDRESS,
|
||||
extensionNames: selectedContracts.map((c) => c.name),
|
||||
};
|
||||
|
||||
|
||||
const outputDeployArgs = JSON.stringify(deployArgs, undefined, 2);
|
||||
writeFileSync("./deployArgs.json", outputDeployArgs, "utf-8");
|
||||
info(
|
||||
@@ -236,7 +238,7 @@ export async function processProject(
|
||||
const deployArgs: RouterParams = await formatToExtensions(
|
||||
selectedContracts,
|
||||
);
|
||||
|
||||
|
||||
const outputDeployArgs = JSON.stringify(deployArgs, undefined, 2);
|
||||
writeFileSync("./deployArgs.json", outputDeployArgs, "utf-8");
|
||||
info(
|
||||
|
||||
@@ -1,18 +1,3 @@
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const DEFAULT_IPFS_GATEWAY = "https://ipfs.thirdwebcdn.com/ipfs/";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const TW_IPFS_SERVER_URL = "https://upload.nftlabs.co";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const PINATA_IPFS_URL = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ import { TruffleBuilder } from "./truffle";
|
||||
export default async function build(
|
||||
path: string,
|
||||
projectType: ProjectType,
|
||||
options: { clean: boolean },
|
||||
options: any,
|
||||
): Promise<{
|
||||
contracts: ContractPayload[];
|
||||
}> {
|
||||
@@ -40,5 +40,6 @@ export default async function build(
|
||||
name: "",
|
||||
projectPath: path,
|
||||
clean: options.clean,
|
||||
zksync: options.zksync,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ export abstract class BaseBuilder implements IBuilder {
|
||||
abi: any[],
|
||||
bytecode: string,
|
||||
name: string,
|
||||
ignoreIpfsHash?: boolean,
|
||||
): boolean {
|
||||
if (
|
||||
!bytecode ||
|
||||
@@ -31,19 +32,21 @@ export abstract class BaseBuilder implements IBuilder {
|
||||
logger.debug(`Skipping '${name}'.`);
|
||||
return false;
|
||||
}
|
||||
// ensure that we can extract IPFS hashes from the bytecode
|
||||
let ipfsHash;
|
||||
try {
|
||||
ipfsHash = extractIPFSHashFromBytecode(bytecode);
|
||||
} catch (e) {
|
||||
logger.debug(`Error extracting IPFS hash from '${name}': ${e}`);
|
||||
}
|
||||
if (!ignoreIpfsHash) {
|
||||
// ensure that we can extract IPFS hashes from the bytecode
|
||||
let ipfsHash;
|
||||
try {
|
||||
ipfsHash = extractIPFSHashFromBytecode(bytecode);
|
||||
} catch (e) {
|
||||
logger.debug(`Error extracting IPFS hash from '${name}': ${e}`);
|
||||
}
|
||||
|
||||
if (!ipfsHash) {
|
||||
logger.debug(
|
||||
`Cannot resolve build metadata IPFS hash for contract '${name}'. Skipping.`,
|
||||
);
|
||||
return false;
|
||||
if (!ipfsHash) {
|
||||
logger.debug(
|
||||
`Cannot resolve build metadata IPFS hash for contract '${name}'. Skipping.`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { findFiles } from "../../common/file-helper";
|
||||
import { execute } from "../helpers/exec";
|
||||
import { logger } from "../helpers/logger";
|
||||
import { CompileOptions } from "../interfaces/Builder";
|
||||
import { ContractPayload } from "../interfaces/ContractPayload";
|
||||
import { BaseBuilder } from "./builder-base";
|
||||
import { existsSync, readFileSync } from "fs";
|
||||
@@ -9,13 +8,9 @@ import { HardhatConfig } from "hardhat/types";
|
||||
import { join, resolve } from "path";
|
||||
|
||||
export class HardhatBuilder extends BaseBuilder {
|
||||
public async compile(options: CompileOptions): Promise<{
|
||||
public async compile(options: any): Promise<{
|
||||
contracts: ContractPayload[];
|
||||
}> {
|
||||
if (options.clean) {
|
||||
await execute("npx hardhat clean", options.projectPath);
|
||||
}
|
||||
await execute("npx hardhat compile", options.projectPath);
|
||||
//we get our very own extractor script from the dir that we're in during execution
|
||||
// this is `./dist/cli` (for all purposes of the CLI)
|
||||
// then we look up the hardhat config extractor file path from there
|
||||
@@ -39,6 +34,24 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
|
||||
logger.debug("successfully extracted hardhat config", actualHardhatConfig);
|
||||
|
||||
await execute("npx hardhat clean", options.projectPath);
|
||||
|
||||
let ignoreIpfsHash = false;
|
||||
if (options.zksync) {
|
||||
const zkNetwork = Object.entries(actualHardhatConfig.networks).find(
|
||||
(network) => {
|
||||
return (network[1] as any).zksync;
|
||||
},
|
||||
);
|
||||
ignoreIpfsHash = (zkNetwork?.[1] as any).zksync; // IPFS hash can't be recovered from ZKSync bytecode
|
||||
await execute(
|
||||
`npx hardhat compile --network ${zkNetwork?.[0]}`,
|
||||
options.projectPath,
|
||||
);
|
||||
} else {
|
||||
await execute(`npx hardhat compile`, options.projectPath);
|
||||
}
|
||||
|
||||
const solcConfigs = actualHardhatConfig.solidity.compilers;
|
||||
if (solcConfigs) {
|
||||
for (const solcConfig of solcConfigs) {
|
||||
@@ -80,7 +93,6 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
logger.debug("Skipping", contractPath, "(not a source target)");
|
||||
continue;
|
||||
}
|
||||
|
||||
for (const [contractName, contractInfo] of Object.entries(
|
||||
contractInfos as any,
|
||||
)) {
|
||||
@@ -98,10 +110,13 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
}
|
||||
|
||||
const bytecode = info.evm.bytecode.object;
|
||||
const deployedBytecode = info.evm.deployedBytecode.object;
|
||||
const deployedBytecode =
|
||||
info.evm.deployedBytecode?.object || bytecode;
|
||||
const { metadata, abi } = info;
|
||||
|
||||
const meta = JSON.parse(metadata);
|
||||
const meta = metadata.solc_metadata
|
||||
? JSON.parse(metadata.solc_metadata)
|
||||
: JSON.parse(metadata);
|
||||
const sources = Object.keys(meta.sources)
|
||||
.map((path) => {
|
||||
const directPath = join(options.projectPath, path);
|
||||
@@ -129,9 +144,16 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
);
|
||||
const fileName = fileNames.length > 0 ? fileNames[0] : "";
|
||||
|
||||
if (this.shouldProcessContract(abi, deployedBytecode, contractName)) {
|
||||
if (
|
||||
this.shouldProcessContract(
|
||||
abi,
|
||||
deployedBytecode,
|
||||
contractName,
|
||||
ignoreIpfsHash,
|
||||
)
|
||||
) {
|
||||
contracts.push({
|
||||
metadata,
|
||||
metadata: JSON.stringify(meta),
|
||||
bytecode,
|
||||
name: contractName,
|
||||
fileName,
|
||||
|
||||
@@ -8,6 +8,7 @@ import { basename, join } from "path";
|
||||
import solc from "solc";
|
||||
|
||||
export class SolcBuilder extends BaseBuilder {
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
public async compile(options: CompileOptions): Promise<{
|
||||
contracts: ContractPayload[];
|
||||
}> {
|
||||
|
||||
@@ -4,6 +4,7 @@ export type CompileOptions = {
|
||||
clean: boolean;
|
||||
projectPath: string;
|
||||
name: string;
|
||||
zksync?: boolean;
|
||||
};
|
||||
|
||||
export interface IBuilder {
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function generate(options: GenerateOptions) {
|
||||
const configAddresses = thirdwebConfig.contracts.map((contract) =>
|
||||
contract.address.toLowerCase(),
|
||||
);
|
||||
const newAddresses = addresses.filter(
|
||||
const newAddresses = Array.from(new Set(addresses)).filter(
|
||||
(address) => !configAddresses.includes(address.toLowerCase()),
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,72 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.12.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`23d90b3e`](https://github.com/thirdweb-dev/js/commit/23d90b3e779a5bfdb7058b8c51349d9c278fcbce), [`cc56037e`](https://github.com/thirdweb-dev/js/commit/cc56037e64560b9e0fc16eb0ac7cc2e47e2c9fdf), [`67450789`](https://github.com/thirdweb-dev/js/commit/67450789473b6008b86453ee4f4c7b99461223a6)]:
|
||||
- @thirdweb-dev/sdk@3.10.19
|
||||
- @thirdweb-dev/storage@1.1.4
|
||||
- @thirdweb-dev/wallets@0.2.24
|
||||
|
||||
## 3.12.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1068](https://github.com/thirdweb-dev/js/pull/1068) [`fd7111d5`](https://github.com/thirdweb-dev/js/commit/fd7111d5449b8315d326c308a021eed335446e19) Thanks [@MananTank](https://github.com/MananTank)! - add `theme` in `WalletConfig.selectUI` to allow creating selection UI that follows the theme of the wallet Modal
|
||||
|
||||
- [#1065](https://github.com/thirdweb-dev/js/pull/1065) [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Add support for signing in with email/phone using magic sdk
|
||||
|
||||
Devs can now add a new supportedWallet:
|
||||
|
||||
```javascript
|
||||
import { Goerli } from '@thirdweb-dev/chains';
|
||||
import { ThirdwebProvider, magicWallet } from '@thirdweb-dev/react-native';
|
||||
|
||||
<ThirdwebProvider
|
||||
activeChain={Goerli}
|
||||
supportedWallets={[
|
||||
magicWallet({
|
||||
apiKey: 'magic_api_key',
|
||||
}),
|
||||
]}>
|
||||
```
|
||||
|
||||
- [#1067](https://github.com/thirdweb-dev/js/pull/1067) [`e21bdd03`](https://github.com/thirdweb-dev/js/commit/e21bdd0328d9c52d58295aa4012fc11cde83b60a) Thanks [@MananTank](https://github.com/MananTank)! - Return wallet instance from `useConnect` hook instead of returning nothing
|
||||
|
||||
```diff
|
||||
const connect = useConnect();
|
||||
|
||||
- await connect(walletConfig)
|
||||
+ const walletInstance = await connect(walletConfig)
|
||||
```
|
||||
|
||||
- Updated dependencies [[`2f1df0b5`](https://github.com/thirdweb-dev/js/commit/2f1df0b5354a8ee55089b2c1e61c058788d890f1), [`189daf02`](https://github.com/thirdweb-dev/js/commit/189daf0280a90ed730200088948526a594da3408), [`afae0873`](https://github.com/thirdweb-dev/js/commit/afae0873b0e3f9741f5a9c44c5d255f38c6a9111), [`bba9767a`](https://github.com/thirdweb-dev/js/commit/bba9767adfe20e41055450b86e4448fcb2119855), [`c6e74ef0`](https://github.com/thirdweb-dev/js/commit/c6e74ef0b00210f52e6778c548061376d3ba7001), [`ee4c7de2`](https://github.com/thirdweb-dev/js/commit/ee4c7de25cb63f99f33b90da8e26293bbfbe6f3e), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`68fa1896`](https://github.com/thirdweb-dev/js/commit/68fa1896f75d3514e00cc380924fd8bc623064f0), [`f7b352a5`](https://github.com/thirdweb-dev/js/commit/f7b352a585a23726eaa3be116f65db56b005f4d8), [`4a1d7581`](https://github.com/thirdweb-dev/js/commit/4a1d75811058d6974616bdc12a6040cea5444e40), [`bdabbef7`](https://github.com/thirdweb-dev/js/commit/bdabbef71a2421a2dceb384f93bb6a59a3ddf007), [`59206233`](https://github.com/thirdweb-dev/js/commit/59206233e15ccfe3dc32047060055219d35938f2), [`292a321a`](https://github.com/thirdweb-dev/js/commit/292a321a95ed2d847097eed205353dd69eeb8d54), [`98efd090`](https://github.com/thirdweb-dev/js/commit/98efd090f63cfd9dfed7b89b20b6e43db88cf75c), [`8eecf4c2`](https://github.com/thirdweb-dev/js/commit/8eecf4c2d5b0d6447ad5b9cdbf0269818bbb3498), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`f3b2ae3f`](https://github.com/thirdweb-dev/js/commit/f3b2ae3f6d9c66356c521d3b9c2a6c096dbb4b57), [`d5651006`](https://github.com/thirdweb-dev/js/commit/d565100614d7d4e256554f998b8ce978a566051c), [`4f99ccb4`](https://github.com/thirdweb-dev/js/commit/4f99ccb49c584946de709fbc01017611d2828b76), [`da576108`](https://github.com/thirdweb-dev/js/commit/da5761080288c3b325f54fb56c80f96405a1cb5d), [`c85810ee`](https://github.com/thirdweb-dev/js/commit/c85810eee318b10eee4ada61828adaa51f94ea6c), [`6fd10f94`](https://github.com/thirdweb-dev/js/commit/6fd10f94b469dc5659e2ff4ce92a5aff86f3c89d), [`5f1e6abb`](https://github.com/thirdweb-dev/js/commit/5f1e6abb391f5c58dbdb207f569b3dd0b5d4729c), [`a034b032`](https://github.com/thirdweb-dev/js/commit/a034b0321fd0113ed51d95d538b5c3020615c227), [`35984362`](https://github.com/thirdweb-dev/js/commit/35984362b0a60e5b9c3d3c9731450a8f47deb1c4)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 3.12.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c), [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 3.12.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1037](https://github.com/thirdweb-dev/js/pull/1037) [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa) Thanks [@jnsdls](https://github.com/jnsdls)! - update ipfs gateways - add more fallbacks
|
||||
|
||||
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 3.12.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.12.0",
|
||||
"version": "3.12.4",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
export const DEFAULT_IPFS_GATEWAY = "https://ipfs.thirdwebcdn.com/ipfs/";
|
||||
|
||||
export interface IPFSResolverOptions {
|
||||
gatewayUrl: string;
|
||||
}
|
||||
|
||||
export const DEFAULT_IPFS_RESOLVER_OPTIONS: IPFSResolverOptions = {
|
||||
gatewayUrl: DEFAULT_IPFS_GATEWAY,
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
AsyncStorage,
|
||||
ConnectParams,
|
||||
CreateAsyncStorage,
|
||||
walletIds,
|
||||
} from "@thirdweb-dev/wallets";
|
||||
import { Signer } from "ethers";
|
||||
import {
|
||||
@@ -73,7 +74,7 @@ type ThirdwebWalletContextData = {
|
||||
Config extends Record<string, any> | undefined = undefined,
|
||||
>(
|
||||
...args: ConnectFnArgs<I, Config>
|
||||
) => Promise<void>;
|
||||
) => Promise<I>;
|
||||
disconnect: () => Promise<void>;
|
||||
connectionStatus: ConnectionStatus;
|
||||
setConnectionStatus: (status: ConnectionStatus) => void;
|
||||
@@ -83,6 +84,7 @@ type ThirdwebWalletContextData = {
|
||||
>(
|
||||
Wallet: WalletConfig<I, Config>,
|
||||
) => I;
|
||||
createdWalletInstance?: WalletInstance;
|
||||
createWalletStorage: CreateAsyncStorage;
|
||||
switchChain: (chain: number) => Promise<void>;
|
||||
chainToConnect?: Chain;
|
||||
@@ -120,6 +122,10 @@ export function ThirdwebWalletProvider(
|
||||
WalletInstance | undefined
|
||||
>();
|
||||
|
||||
const [createdWalletInstance, setCreatedWalletInstance] = useState<
|
||||
WalletInstance | undefined
|
||||
>();
|
||||
|
||||
const [activeWalletConfig, setActiveWalletConfig] = useState<
|
||||
WalletConfig | undefined
|
||||
>();
|
||||
@@ -153,6 +159,14 @@ export function ThirdwebWalletProvider(
|
||||
walletConfig: WalletConfig<I, Config>,
|
||||
): I => {
|
||||
const walletInstance = walletConfig.create(walletParams);
|
||||
if (walletInstance.walletId === walletIds.magicLink) {
|
||||
// NOTE: removing this if statement causes the component to re-render
|
||||
// Patch for magic link wallet in react native
|
||||
// needed because we need to add a component to the view tree
|
||||
// from the instance, right before calling connect.
|
||||
// Check it out in RN's DappContextProvider.
|
||||
setCreatedWalletInstance(walletInstance);
|
||||
}
|
||||
walletInstanceToConfig.set(walletInstance, walletConfig);
|
||||
return walletInstance;
|
||||
},
|
||||
@@ -346,11 +360,11 @@ export function ThirdwebWalletProvider(
|
||||
await wallet.autoConnect(walletInfo.connectParams);
|
||||
setConnectedWallet(wallet, walletInfo.connectParams, true);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
lastConnectedWalletStorage.removeItem(
|
||||
LAST_CONNECTED_WALLET_STORAGE_KEY,
|
||||
);
|
||||
setConnectionStatus("disconnected");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,7 +384,7 @@ export function ThirdwebWalletProvider(
|
||||
Config extends Record<string, any> | undefined = undefined,
|
||||
>(
|
||||
...args: ConnectFnArgs<I, Config>
|
||||
) => {
|
||||
): Promise<I> => {
|
||||
const [WalletObj, connectParams] = args;
|
||||
|
||||
const _connectedParams = {
|
||||
@@ -388,6 +402,8 @@ export function ThirdwebWalletProvider(
|
||||
setConnectionStatus("disconnected");
|
||||
throw e;
|
||||
}
|
||||
|
||||
return wallet;
|
||||
},
|
||||
[createWalletInstance, setConnectedWallet, chainToConnect],
|
||||
);
|
||||
@@ -456,6 +472,7 @@ export function ThirdwebWalletProvider(
|
||||
connectionStatus,
|
||||
setConnectionStatus,
|
||||
createWalletInstance: createWalletInstance,
|
||||
createdWalletInstance: createdWalletInstance,
|
||||
createWalletStorage: props.createWalletStorage,
|
||||
switchChain,
|
||||
setConnectedWallet: setConnectedWallet,
|
||||
|
||||
@@ -161,4 +161,9 @@ export type SelectUIProps<
|
||||
* For example: You can render a larger UI if only one wallet (your wallet) is supported.
|
||||
*/
|
||||
supportedWallets: WalletConfig[];
|
||||
|
||||
/**
|
||||
* theme of the connect wallet modal
|
||||
*/
|
||||
theme: "dark" | "light";
|
||||
};
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
import { DEFAULT_IPFS_RESOLVER_OPTIONS } from "../constants/ipfs";
|
||||
import mime from "mime/lite.js";
|
||||
import {
|
||||
parseGatewayUrls,
|
||||
prepareGatewayUrls,
|
||||
replaceSchemeWithGatewayUrl,
|
||||
} from "@thirdweb-dev/storage";
|
||||
|
||||
export function resolveIpfsUri(
|
||||
uri?: string,
|
||||
options = DEFAULT_IPFS_RESOLVER_OPTIONS,
|
||||
) {
|
||||
// TODO legacy remove this when possible
|
||||
export interface IPFSResolverOptions {
|
||||
gatewayUrl: string;
|
||||
}
|
||||
|
||||
export function resolveIpfsUri(uri?: string, options?: IPFSResolverOptions) {
|
||||
if (!uri) {
|
||||
return undefined;
|
||||
}
|
||||
if (uri.startsWith("ipfs://")) {
|
||||
return uri.replace("ipfs://", options.gatewayUrl);
|
||||
}
|
||||
return uri;
|
||||
const gatewayUrls = prepareGatewayUrls(
|
||||
parseGatewayUrls(options?.gatewayUrl ? [options?.gatewayUrl] : undefined),
|
||||
);
|
||||
return replaceSchemeWithGatewayUrl(uri, gatewayUrls);
|
||||
}
|
||||
|
||||
export async function resolveMimeType(url?: string) {
|
||||
|
||||
@@ -64,6 +64,7 @@ export const ThirdwebConnectedWalletProvider: React.FC<
|
||||
});
|
||||
} catch (e) {
|
||||
// failed to get a viable rpc url, nothing we can do
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.2.16
|
||||
|
||||
## 0.2.15
|
||||
|
||||
## 0.2.14
|
||||
|
||||
## 0.2.13
|
||||
|
||||
## 0.2.12
|
||||
|
||||
## 0.2.11
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.2.12",
|
||||
"version": "0.2.16",
|
||||
"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,107 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.2.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1103](https://github.com/thirdweb-dev/js/pull/1103) [`89102b0c`](https://github.com/thirdweb-dev/js/commit/89102b0c895011bb6528d2b9bc4289173b351c8d) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Fix bug where the wc uri is not being copied in the textinput after scanning it
|
||||
|
||||
- Updated dependencies [[`23d90b3e`](https://github.com/thirdweb-dev/js/commit/23d90b3e779a5bfdb7058b8c51349d9c278fcbce), [`cc56037e`](https://github.com/thirdweb-dev/js/commit/cc56037e64560b9e0fc16eb0ac7cc2e47e2c9fdf), [`67450789`](https://github.com/thirdweb-dev/js/commit/67450789473b6008b86453ee4f4c7b99461223a6)]:
|
||||
- @thirdweb-dev/sdk@3.10.19
|
||||
- @thirdweb-dev/storage@1.1.4
|
||||
- @thirdweb-dev/react-core@3.12.4
|
||||
- @thirdweb-dev/wallets@0.2.24
|
||||
|
||||
## 0.2.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1059](https://github.com/thirdweb-dev/js/pull/1059) [`56ad0867`](https://github.com/thirdweb-dev/js/commit/56ad0867bd28da2c8ddaaca5ed5a26599c4e0ed6) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Use walletConfig's selectUI to render the wallet item in the Choose your Wallet dialog
|
||||
|
||||
- [#1010](https://github.com/thirdweb-dev/js/pull/1010) [`bba9767a`](https://github.com/thirdweb-dev/js/commit/bba9767adfe20e41055450b86e4448fcb2119855) Thanks [@iketw](https://github.com/iketw)! - [ReactNative-Wallets] Enables SmartWallet to connect to an app, with implementation in React Native
|
||||
|
||||
- Wallets package
|
||||
|
||||
1. Smart Wallet now supports connecting an external app to it. It acts as an actual wallet implementing the WC protocol
|
||||
2. There are two WalletConnect handlers to manage V1 and V2 WC connections
|
||||
3. Creates a synchronous storage interface used in WCV1
|
||||
4. To have your connector support WC, you need to implement the interface: IWalletConnectReceiver.
|
||||
5. You can now pass the flag enableConnectApp to the smart wallet config to enable a new field in our modal to connect an app to your smart wallet
|
||||
|
||||
```
|
||||
smartWallet({
|
||||
factoryAddress: "..."
|
||||
thirdwebApiKey: "apiKey"
|
||||
gasless: true,
|
||||
personalWallets: [localWallet()],
|
||||
enableConnectApp: true,
|
||||
}),
|
||||
```
|
||||
|
||||
- React Native
|
||||
|
||||
1. Creates new modals for WC SessionRequests and SessionApprovals
|
||||
2. Implements SyncStorage using MMKV
|
||||
|
||||
- [#1068](https://github.com/thirdweb-dev/js/pull/1068) [`fd7111d5`](https://github.com/thirdweb-dev/js/commit/fd7111d5449b8315d326c308a021eed335446e19) Thanks [@MananTank](https://github.com/MananTank)! - add `theme` in `WalletConfig.selectUI` to allow creating selection UI that follows the theme of the wallet Modal
|
||||
|
||||
- [#1065](https://github.com/thirdweb-dev/js/pull/1065) [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Add support for signing in with email/phone using magic sdk
|
||||
|
||||
Devs can now add a new supportedWallet:
|
||||
|
||||
```javascript
|
||||
import { Goerli } from '@thirdweb-dev/chains';
|
||||
import { ThirdwebProvider, magicWallet } from '@thirdweb-dev/react-native';
|
||||
|
||||
<ThirdwebProvider
|
||||
activeChain={Goerli}
|
||||
supportedWallets={[
|
||||
magicWallet({
|
||||
apiKey: 'magic_api_key',
|
||||
}),
|
||||
]}>
|
||||
```
|
||||
|
||||
- [#1088](https://github.com/thirdweb-dev/js/pull/1088) [`4f99ccb4`](https://github.com/thirdweb-dev/js/commit/4f99ccb49c584946de709fbc01017611d2828b76) Thanks [@iketw](https://github.com/iketw)! - [RN/Wallets] Adds send_transaction support for wcv1 Connect to App feature
|
||||
|
||||
- [#1052](https://github.com/thirdweb-dev/js/pull/1052) [`77123a9a`](https://github.com/thirdweb-dev/js/commit/77123a9a5a29d8a1d7c6bf4be40f463e721a0412) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Adds support for WC QRCode scanning
|
||||
|
||||
Breaking change:
|
||||
|
||||
- Users will need to add the dependency `react-native-camera` to be able to use this version of the SDK.
|
||||
|
||||
- Updated dependencies [[`2f1df0b5`](https://github.com/thirdweb-dev/js/commit/2f1df0b5354a8ee55089b2c1e61c058788d890f1), [`189daf02`](https://github.com/thirdweb-dev/js/commit/189daf0280a90ed730200088948526a594da3408), [`afae0873`](https://github.com/thirdweb-dev/js/commit/afae0873b0e3f9741f5a9c44c5d255f38c6a9111), [`bba9767a`](https://github.com/thirdweb-dev/js/commit/bba9767adfe20e41055450b86e4448fcb2119855), [`c6e74ef0`](https://github.com/thirdweb-dev/js/commit/c6e74ef0b00210f52e6778c548061376d3ba7001), [`fd7111d5`](https://github.com/thirdweb-dev/js/commit/fd7111d5449b8315d326c308a021eed335446e19), [`ee4c7de2`](https://github.com/thirdweb-dev/js/commit/ee4c7de25cb63f99f33b90da8e26293bbfbe6f3e), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`68fa1896`](https://github.com/thirdweb-dev/js/commit/68fa1896f75d3514e00cc380924fd8bc623064f0), [`e21bdd03`](https://github.com/thirdweb-dev/js/commit/e21bdd0328d9c52d58295aa4012fc11cde83b60a), [`f7b352a5`](https://github.com/thirdweb-dev/js/commit/f7b352a585a23726eaa3be116f65db56b005f4d8), [`4a1d7581`](https://github.com/thirdweb-dev/js/commit/4a1d75811058d6974616bdc12a6040cea5444e40), [`bdabbef7`](https://github.com/thirdweb-dev/js/commit/bdabbef71a2421a2dceb384f93bb6a59a3ddf007), [`59206233`](https://github.com/thirdweb-dev/js/commit/59206233e15ccfe3dc32047060055219d35938f2), [`292a321a`](https://github.com/thirdweb-dev/js/commit/292a321a95ed2d847097eed205353dd69eeb8d54), [`98efd090`](https://github.com/thirdweb-dev/js/commit/98efd090f63cfd9dfed7b89b20b6e43db88cf75c), [`8eecf4c2`](https://github.com/thirdweb-dev/js/commit/8eecf4c2d5b0d6447ad5b9cdbf0269818bbb3498), [`bd86661f`](https://github.com/thirdweb-dev/js/commit/bd86661f54ca2f1eb09cbae35c704dc79be1b63a), [`f3b2ae3f`](https://github.com/thirdweb-dev/js/commit/f3b2ae3f6d9c66356c521d3b9c2a6c096dbb4b57), [`d5651006`](https://github.com/thirdweb-dev/js/commit/d565100614d7d4e256554f998b8ce978a566051c), [`4f99ccb4`](https://github.com/thirdweb-dev/js/commit/4f99ccb49c584946de709fbc01017611d2828b76), [`da576108`](https://github.com/thirdweb-dev/js/commit/da5761080288c3b325f54fb56c80f96405a1cb5d), [`c85810ee`](https://github.com/thirdweb-dev/js/commit/c85810eee318b10eee4ada61828adaa51f94ea6c), [`6fd10f94`](https://github.com/thirdweb-dev/js/commit/6fd10f94b469dc5659e2ff4ce92a5aff86f3c89d), [`5f1e6abb`](https://github.com/thirdweb-dev/js/commit/5f1e6abb391f5c58dbdb207f569b3dd0b5d4729c), [`a034b032`](https://github.com/thirdweb-dev/js/commit/a034b0321fd0113ed51d95d538b5c3020615c227), [`35984362`](https://github.com/thirdweb-dev/js/commit/35984362b0a60e5b9c3d3c9731450a8f47deb1c4)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c), [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1025](https://github.com/thirdweb-dev/js/pull/1025) [`99ffa8ce`](https://github.com/thirdweb-dev/js/commit/99ffa8ce3b47948f0b6aa3809e734d449a8377bb) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Single global modal. No API changes
|
||||
|
||||
Added the capability of using our theme outside the SDK.
|
||||
ThirdwebProvider's children component are now wrapped in a ThemeProvider.
|
||||
|
||||
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
- @thirdweb-dev/[email protected]
|
||||
|
||||
## 0.2.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.2.12",
|
||||
"version": "0.2.16",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -25,6 +25,8 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@coinbase/wallet-mobile-sdk": "^1.0.4",
|
||||
"@magic-sdk/provider": "17.2.0",
|
||||
"@magic-sdk/react-native-bare": "^18.3.0",
|
||||
"@shopify/restyle": "^2.4.1",
|
||||
"@tanstack/react-query": "^4.0.10",
|
||||
"@thirdweb-dev/chains": "workspace:*",
|
||||
@@ -43,7 +45,8 @@
|
||||
"tiny-invariant": "^1.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"react-native-mmkv": "2.5.1"
|
||||
"react-native-mmkv": "2.5.1",
|
||||
"@magic-sdk/provider": "17.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.19.3",
|
||||
@@ -69,8 +72,18 @@
|
||||
"prettier": "^2.7.1",
|
||||
"react": "^18.2.0",
|
||||
"react-native": "^0.71.0",
|
||||
"react-native-camera": "^4.2.1",
|
||||
"react-native-device-info": "10.6.0",
|
||||
"react-native-safe-area-context": "4.5.3",
|
||||
"react-native-webview": "12.1.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"react-native-camera": "^4.2.1",
|
||||
"react-native-device-info": "10.6.0",
|
||||
"react-native-safe-area-context": "4.5.3",
|
||||
"react-native-webview": "12.1.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"ethers": ">=5.5.1 <6",
|
||||
"expo": "^47.0.0",
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { AsyncStorage as IAsyncStorage } from "@thirdweb-dev/wallets";
|
||||
import {
|
||||
AsyncStorage as IAsyncStorage,
|
||||
SyncStorage,
|
||||
} from "@thirdweb-dev/wallets";
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
|
||||
const PREFIX = "__TW__";
|
||||
@@ -31,6 +34,28 @@ export class AsyncLocalStorage implements IAsyncStorage {
|
||||
}
|
||||
}
|
||||
|
||||
export class LocalStorage implements SyncStorage {
|
||||
name: string;
|
||||
asyncStorage: MMKV;
|
||||
|
||||
constructor(name: string) {
|
||||
this.name = name;
|
||||
this.asyncStorage = new MMKV();
|
||||
}
|
||||
|
||||
getItem(key: string) {
|
||||
return this.asyncStorage.getString(`${PREFIX}/${this.name}/${key}`) || null;
|
||||
}
|
||||
|
||||
setItem(key: string, value: string) {
|
||||
return this.asyncStorage.set(`${PREFIX}/${this.name}/${key}`, value);
|
||||
}
|
||||
|
||||
removeItem(key: string) {
|
||||
return this.asyncStorage.delete(`${PREFIX}/${this.name}/${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
export class noopStorage implements IAsyncStorage {
|
||||
getItem(key: string): Promise<string | null> {
|
||||
return Promise.resolve(key);
|
||||
@@ -54,3 +79,13 @@ export class noopStorage implements IAsyncStorage {
|
||||
export function createAsyncLocalStorage(name: string) {
|
||||
return new AsyncLocalStorage(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new instance of LocalStorage
|
||||
*
|
||||
* @param name Name to namespace the storage with
|
||||
* @returns A new instance of LocalStorage
|
||||
*/
|
||||
export function createSyncStorage(name: string) {
|
||||
return new LocalStorage(name);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
import { IconStyleProp } from "./types";
|
||||
import Svg, { Path } from "react-native-svg";
|
||||
|
||||
const QrCodeIcon = ({ width, height, color }: IconStyleProp) => {
|
||||
return (
|
||||
<Svg width={width} height={height} viewBox="0 0 24 24" fill="none">
|
||||
<Path
|
||||
d="M9 2H3C2.44772 2 2 2.44772 2 3V9C2 9.55228 2.44772 10 3 10H9C9.55228 10 10 9.55228 10 9V3C10 2.44772 9.55228 2 9 2Z"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M9 13.9999H3C2.44772 13.9999 2 14.4476 2 14.9999V20.9999C2 21.5522 2.44772 21.9999 3 21.9999H9C9.55228 21.9999 10 21.5522 10 20.9999V14.9999C10 14.4476 9.55228 13.9999 9 13.9999Z"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M21 2H15C14.4477 2 14 2.44772 14 3V9C14 9.55228 14.4477 10 15 10H21C21.5523 10 22 9.55228 22 9V3C22 2.44772 21.5523 2 21 2Z"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M14 13.9999V17.9999"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M14 21.9999H18V13.9999"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M18 16H22"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
<Path
|
||||
d="M22 20.0001V22.0001"
|
||||
stroke={color}
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
/>
|
||||
</Svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default QrCodeIcon;
|
||||
@@ -0,0 +1,25 @@
|
||||
import { IconStyleProp } from "./types";
|
||||
import Svg, { G, Path } from "react-native-svg";
|
||||
|
||||
const WalletConnectIcon = ({ width, height }: IconStyleProp) => {
|
||||
return (
|
||||
<Svg width={width} height={height} viewBox="0 0 300 185">
|
||||
<G
|
||||
id="Page-1"
|
||||
stroke="none"
|
||||
stroke-width="1"
|
||||
fill="none"
|
||||
fill-rule="evenodd"
|
||||
>
|
||||
<G id="walletconnect-logo-alt" fill="#3B99FC" fill-rule="nonzero">
|
||||
<Path
|
||||
d="M61.4385429,36.2562612 C110.349767,-11.6319051 189.65053,-11.6319051 238.561752,36.2562612 L244.448297,42.0196786 C246.893858,44.4140867 246.893858,48.2961898 244.448297,50.690599 L224.311602,70.406102 C223.088821,71.6033071 221.106302,71.6033071 219.883521,70.406102 L211.782937,62.4749541 C177.661245,29.0669724 122.339051,29.0669724 88.2173582,62.4749541 L79.542302,70.9685592 C78.3195204,72.1657633 76.337001,72.1657633 75.1142214,70.9685592 L54.9775265,51.2530561 C52.5319653,48.8586469 52.5319653,44.9765439 54.9775265,42.5821357 L61.4385429,36.2562612 Z M280.206339,77.0300061 L298.128036,94.5769031 C300.573585,96.9713 300.573599,100.85338 298.128067,103.247793 L217.317896,182.368927 C214.872352,184.763353 210.907314,184.76338 208.461736,182.368989 C208.461726,182.368979 208.461714,182.368967 208.461704,182.368957 L151.107561,126.214385 C150.496171,125.615783 149.504911,125.615783 148.893521,126.214385 C148.893517,126.214389 148.893514,126.214393 148.89351,126.214396 L91.5405888,182.368927 C89.095052,184.763359 85.1300133,184.763399 82.6844276,182.369014 C82.6844133,182.369 82.684398,182.368986 82.6843827,182.36897 L1.87196327,103.246785 C-0.573596939,100.852377 -0.573596939,96.9702735 1.87196327,94.5758653 L19.7936929,77.028998 C22.2392531,74.6345898 26.2042918,74.6345898 28.6498531,77.028998 L86.0048306,133.184355 C86.6162214,133.782957 87.6074796,133.782957 88.2188704,133.184355 C88.2188796,133.184346 88.2188878,133.184338 88.2188969,133.184331 L145.571,77.028998 C148.016505,74.6345347 151.981544,74.6344449 154.427161,77.028798 C154.427195,77.0288316 154.427229,77.0288653 154.427262,77.028899 L211.782164,133.184331 C212.393554,133.782932 213.384814,133.782932 213.996204,133.184331 L271.350179,77.0300061 C273.79574,74.6355969 277.760778,74.6355969 280.206339,77.0300061 Z"
|
||||
id="WalletConnect"
|
||||
></Path>
|
||||
</G>
|
||||
</G>
|
||||
</Svg>
|
||||
);
|
||||
};
|
||||
|
||||
export default WalletConnectIcon;
|
||||
@@ -1,9 +1,15 @@
|
||||
import { ThemeProvider, ThemeProviderProps } from "../styles/ThemeProvider";
|
||||
import { ConnectWalletDetails } from "./ConnectWalletDetails/ConnectWalletDetails";
|
||||
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
||||
import { useAddress } from "@thirdweb-dev/react-core";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { Animated } from "react-native";
|
||||
import {
|
||||
useAddress,
|
||||
useConnectionStatus,
|
||||
useWallets,
|
||||
} from "@thirdweb-dev/react-core";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { ActivityIndicator, Animated, StyleSheet } from "react-native";
|
||||
import BaseButton from "./base/BaseButton";
|
||||
import Text from "./base/Text";
|
||||
import { useModalState } from "../providers/ui-context-provider";
|
||||
|
||||
export type ConnectWalletProps = {
|
||||
theme?: ThemeProviderProps["theme"];
|
||||
@@ -30,8 +36,33 @@ export const ConnectWallet = ({
|
||||
theme,
|
||||
}: ConnectWalletProps) => {
|
||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||
|
||||
const address = useAddress();
|
||||
const connectionStatus = useConnectionStatus();
|
||||
const supportedWallets = useWallets();
|
||||
const isWalletConnecting = connectionStatus === "connecting";
|
||||
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
|
||||
const { setModalState } = useModalState();
|
||||
|
||||
useEffect(() => {
|
||||
setShowButtonSpinner(isWalletConnecting);
|
||||
|
||||
if (!isWalletConnecting) {
|
||||
setShowButtonSpinner(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
if (isWalletConnecting) {
|
||||
setShowButtonSpinner(false);
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
return () => {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
};
|
||||
}, [isWalletConnecting]);
|
||||
|
||||
useEffect(() => {
|
||||
Animated.timing(fadeAnim, {
|
||||
@@ -41,6 +72,20 @@ export const ConnectWallet = ({
|
||||
}).start();
|
||||
}, [fadeAnim]);
|
||||
|
||||
const onConnectWalletPress = () => {
|
||||
setModalState({
|
||||
isOpen: true,
|
||||
isSheet: true,
|
||||
view: "ConnectWalletFlow",
|
||||
data: {
|
||||
modalTitle,
|
||||
walletConfig:
|
||||
supportedWallets.length === 1 ? supportedWallets[0] : undefined,
|
||||
},
|
||||
caller: "ConnectWallet",
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<Animated.View style={{ opacity: fadeAnim }}>
|
||||
@@ -50,12 +95,37 @@ export const ConnectWallet = ({
|
||||
detailsButton={detailsButton}
|
||||
/>
|
||||
) : (
|
||||
<ConnectWalletFlow
|
||||
buttonTitle={buttonTitle}
|
||||
modalTitle={modalTitle}
|
||||
/>
|
||||
<BaseButton
|
||||
backgroundColor="buttonBackgroundColor"
|
||||
onPress={onConnectWalletPress}
|
||||
style={styles.connectWalletButton}
|
||||
>
|
||||
<Text variant="bodyLarge" color="buttonTextColor">
|
||||
{showButtonSpinner ? (
|
||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
||||
) : buttonTitle ? (
|
||||
buttonTitle
|
||||
) : (
|
||||
"Connect Wallet"
|
||||
)}
|
||||
</Text>
|
||||
</BaseButton>
|
||||
)}
|
||||
</Animated.View>
|
||||
</ThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
connectWalletButton: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
borderRadius: 8,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 10,
|
||||
minWidth: 150,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
import { useWallet } from "@thirdweb-dev/react-core";
|
||||
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import Box from "../base/Box";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import DisconnectIcon from "../../assets/disconnect";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
import { TextInput } from "../base/TextInput";
|
||||
import RightArrowIcon from "../../assets/right-arrow";
|
||||
import { StyleSheet, View } from "react-native";
|
||||
import Text from "../base/Text";
|
||||
import { WalletIcon } from "../base/WalletIcon";
|
||||
import WalletConnectIcon from "../../assets/wallet-connect";
|
||||
import QrCodeIcon from "../../assets/qr-code";
|
||||
import { QRCodeScan } from "./QRCodeScan";
|
||||
|
||||
const ConnectAppField = () => {
|
||||
const theme = useTheme();
|
||||
const [showWCInput, setShowWCInput] = useState(false);
|
||||
const [wcUri, setWCUri] = useState<string | undefined>();
|
||||
const [appMeta, setAppMeta] = useState<{ name: string; iconUrl: string }>();
|
||||
const wallet = useWallet();
|
||||
const [showQRCodeScan, setShowQRCodeScan] = useState(false);
|
||||
|
||||
const getAppMeta = useCallback(() => {
|
||||
if (wallet && "isWCReceiverEnabled" in wallet) {
|
||||
const sessions = (
|
||||
wallet as unknown as IWalletConnectReceiver
|
||||
).getActiveSessions();
|
||||
if (Object.keys(sessions).length > 0) {
|
||||
setAppMeta({
|
||||
name: sessions[0].peer.metadata.name,
|
||||
iconUrl: sessions[0].peer.metadata.icons[0],
|
||||
});
|
||||
}
|
||||
}
|
||||
}, [wallet]);
|
||||
|
||||
const onSmartWalletWCMessage = useCallback(
|
||||
({ type }: { type: string }) => {
|
||||
if (type === "session_approved") {
|
||||
getAppMeta();
|
||||
} else if (type === "session_delete") {
|
||||
reset();
|
||||
}
|
||||
},
|
||||
[getAppMeta],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (wallet) {
|
||||
wallet.addListener("message", onSmartWalletWCMessage);
|
||||
|
||||
getAppMeta();
|
||||
}
|
||||
|
||||
return () => {
|
||||
if (wallet) {
|
||||
wallet.removeListener("message", onSmartWalletWCMessage);
|
||||
}
|
||||
};
|
||||
}, [getAppMeta, onSmartWalletWCMessage, wallet]);
|
||||
|
||||
const onConnectDappPress = () => {
|
||||
if (appMeta) {
|
||||
reset();
|
||||
(wallet as unknown as IWalletConnectReceiver).disconnectSession();
|
||||
} else {
|
||||
setShowWCInput(true);
|
||||
}
|
||||
};
|
||||
|
||||
const reset = () => {
|
||||
setAppMeta(undefined);
|
||||
setShowWCInput(false);
|
||||
};
|
||||
|
||||
const onAddressChangeText = (text: string) => {
|
||||
setWCUri(text);
|
||||
};
|
||||
|
||||
const onQRCodeScan = (data: string) => {
|
||||
if (wcUri !== data && data.startsWith("wc:")) {
|
||||
setWCUri(data);
|
||||
setShowQRCodeScan(false);
|
||||
|
||||
onWCPress(data);
|
||||
}
|
||||
};
|
||||
|
||||
const onQRClose = () => {
|
||||
setShowQRCodeScan(false);
|
||||
};
|
||||
|
||||
const onWCPress = (uri?: string) => {
|
||||
if (!(wcUri || uri) || !wallet) {
|
||||
return;
|
||||
}
|
||||
|
||||
const uriToUse = uri || wcUri;
|
||||
|
||||
if (uriToUse?.startsWith("wc:")) {
|
||||
(wallet as unknown as IWalletConnectReceiver).connectApp(uriToUse);
|
||||
}
|
||||
};
|
||||
|
||||
const onScanQRPress = () => {
|
||||
setShowQRCodeScan(true);
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
{!appMeta && showWCInput ? (
|
||||
<Box
|
||||
flexDirection="row"
|
||||
mb="sm"
|
||||
borderColor="border"
|
||||
borderWidth={1}
|
||||
borderRadius="md"
|
||||
>
|
||||
<TextInput
|
||||
onChangeText={onAddressChangeText}
|
||||
flex={1}
|
||||
value={wcUri}
|
||||
placeholder={"wc://..."}
|
||||
placeholderTextColor={theme.colors.textSecondary}
|
||||
/>
|
||||
<BaseButton
|
||||
onPress={() => onWCPress()}
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
>
|
||||
<RightArrowIcon
|
||||
height={20}
|
||||
width={30}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
onPress={onScanQRPress}
|
||||
justifyContent="center"
|
||||
alignItems="center"
|
||||
marginHorizontal="xs"
|
||||
>
|
||||
<QrCodeIcon
|
||||
height={30}
|
||||
width={30}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
</BaseButton>
|
||||
</Box>
|
||||
) : (
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
mb="sm"
|
||||
justifyContent="space-between"
|
||||
style={styles.exportWallet}
|
||||
onPress={onConnectDappPress}
|
||||
>
|
||||
<>
|
||||
{appMeta ? (
|
||||
<WalletIcon size={32} iconUri={appMeta.iconUrl} />
|
||||
) : (
|
||||
<WalletConnectIcon width={16} height={16} />
|
||||
)}
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">
|
||||
{appMeta ? appMeta.name : "Connect app"}
|
||||
</Text>
|
||||
</View>
|
||||
</>
|
||||
{appMeta ? (
|
||||
<DisconnectIcon
|
||||
height={10}
|
||||
width={10}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
) : (
|
||||
<RightArrowIcon
|
||||
height={10}
|
||||
width={10}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
)}
|
||||
</BaseButton>
|
||||
)}
|
||||
|
||||
<QRCodeScan
|
||||
isVisible={showQRCodeScan}
|
||||
onQRCodeScan={onQRCodeScan}
|
||||
onClose={onQRClose}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConnectAppField;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
walletInfo: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
alignContent: "center",
|
||||
flexDirection: "column",
|
||||
marginLeft: 15,
|
||||
},
|
||||
exportWalletInfo: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
alignContent: "center",
|
||||
flexDirection: "column",
|
||||
marginLeft: 8,
|
||||
},
|
||||
exportWallet: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
borderRadius: 12,
|
||||
borderWidth: 0.5,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 12,
|
||||
minWidth: 200,
|
||||
},
|
||||
walletDetails: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
borderRadius: 12,
|
||||
borderWidth: 0.5,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 12,
|
||||
minWidth: 200,
|
||||
},
|
||||
currentNetwork: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
justifyContent: "flex-start",
|
||||
marginTop: 24,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
||||
+18
-197
@@ -1,24 +1,14 @@
|
||||
import { NetworkSelectorModal } from "../NetworkSelector/NetworkSelectorModal";
|
||||
import { Address } from "../base/Address";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import { ChainIcon } from "../base/ChainIcon";
|
||||
import PocketWalletIcon from "../../assets/wallet";
|
||||
import Text from "../base/Text";
|
||||
import { WalletIcon } from "../base/WalletIcon";
|
||||
import { TWModal } from "../base/modal/TWModal";
|
||||
import { NetworkButton } from "./NetworkButton";
|
||||
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
|
||||
import { useWallet, useBalance, useDisconnect } from "@thirdweb-dev/react-core";
|
||||
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
|
||||
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { StyleSheet, View } from "react-native";
|
||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||
import { Toast } from "../base/Toast";
|
||||
import { LocalWallet, SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
||||
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
|
||||
import { useSmartWallet } from "../../providers/context-provider";
|
||||
import RightArrowIcon from "../../assets/right-arrow";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
import { StyleSheet } from "react-native";
|
||||
import { LocalWallet } from "@thirdweb-dev/wallets";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
import Box from "../base/Box";
|
||||
|
||||
export type ConnectWalletDetailsProps = {
|
||||
address: string;
|
||||
@@ -29,157 +19,25 @@ export const ConnectWalletDetails = ({
|
||||
address,
|
||||
detailsButton,
|
||||
}: ConnectWalletDetailsProps) => {
|
||||
const theme = useTheme();
|
||||
const [isDetailsModalVisible, setIsDetailsModalVisible] = useState(false);
|
||||
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
||||
const [isNetworkSelectorModalVisible, setIsNetworkSelectorModalVisible] =
|
||||
useState(false);
|
||||
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
||||
const [addressCopied, setAddressCopied] = useState(false);
|
||||
const activeWallet = useWallet();
|
||||
const disconnect = useDisconnect();
|
||||
const [smartWallet, setSmartWallet] = useSmartWallet();
|
||||
const chain = useActiveChain();
|
||||
const balanceQuery = useBalance();
|
||||
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
if (addressCopied) {
|
||||
setAddressCopied(false);
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
return () => clearTimeout(timeout);
|
||||
}, [addressCopied]);
|
||||
const { setModalState } = useModalState();
|
||||
|
||||
const onPress = () => {
|
||||
setIsDetailsModalVisible(true);
|
||||
};
|
||||
|
||||
const onDisconnectPress = () => {
|
||||
setIsDisconnecting(true);
|
||||
disconnect().finally(() => {
|
||||
setIsDisconnecting(false);
|
||||
setSmartWallet?.(undefined);
|
||||
setModalState({
|
||||
view: "WalletDetails",
|
||||
data: {
|
||||
address: address,
|
||||
},
|
||||
isOpen: true,
|
||||
isSheet: true,
|
||||
caller: "ConnectWalletDetails",
|
||||
});
|
||||
};
|
||||
|
||||
const onChangeNetworkPress = () => {
|
||||
// TODO: implement this
|
||||
// setIsDetailsModalVisible(false);
|
||||
// setIsNetworkSelectorModalVisible(true);
|
||||
};
|
||||
|
||||
const onSelectorModalClose = () => {
|
||||
setIsNetworkSelectorModalVisible(false);
|
||||
};
|
||||
|
||||
const onBackdropPress = () => {
|
||||
setIsDetailsModalVisible(false);
|
||||
setIsExportModalVisible(false);
|
||||
};
|
||||
|
||||
const onExportLocalWalletPress = useCallback(() => {
|
||||
setIsExportModalVisible(true);
|
||||
}, []);
|
||||
|
||||
const onExportModalClose = () => {
|
||||
setIsExportModalVisible(false);
|
||||
};
|
||||
|
||||
const onAddressCopied = () => {
|
||||
setAddressCopied(true);
|
||||
};
|
||||
|
||||
const getAdditionalActions = useCallback(() => {
|
||||
if (activeWallet?.walletId === SmartWallet.id || smartWallet) {
|
||||
return (
|
||||
<SmartWalletAdditionalActions
|
||||
onExportPress={onExportLocalWalletPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (activeWallet?.walletId === walletIds.localWallet) {
|
||||
return (
|
||||
<>
|
||||
<View style={styles.currentNetwork}>
|
||||
<Text variant="bodySmallSecondary">Additional Actions</Text>
|
||||
</View>
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
mb="sm"
|
||||
justifyContent="space-between"
|
||||
style={styles.exportWallet}
|
||||
onPress={onExportLocalWalletPress}
|
||||
>
|
||||
<>
|
||||
<PocketWalletIcon size={16} />
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">Backup wallet</Text>
|
||||
</View>
|
||||
</>
|
||||
<RightArrowIcon
|
||||
height={10}
|
||||
width={10}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
</BaseButton>
|
||||
|
||||
{activeWallet?.walletId === LocalWallet.id ? (
|
||||
<Text variant="error">
|
||||
{
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
|
||||
}
|
||||
</Text>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}, [
|
||||
activeWallet?.walletId,
|
||||
onExportLocalWalletPress,
|
||||
smartWallet,
|
||||
theme.colors.iconPrimary,
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<TWModal
|
||||
isVisible={isDetailsModalVisible}
|
||||
onBackdropPress={onBackdropPress}
|
||||
>
|
||||
<ExportLocalWalletModal
|
||||
isVisible={isExportModalVisible}
|
||||
onClose={onExportModalClose}
|
||||
/>
|
||||
<WalletDetailsModalHeader
|
||||
address={address}
|
||||
onDisconnectPress={onDisconnectPress}
|
||||
onAddressCopied={onAddressCopied}
|
||||
loading={isDisconnecting}
|
||||
/>
|
||||
<View style={styles.currentNetwork}>
|
||||
<Text variant="bodySmallSecondary">Current Network</Text>
|
||||
</View>
|
||||
<NetworkButton
|
||||
chainIconUrl={chain?.icon?.url || ""}
|
||||
chainName={chain?.name || "Unknown Network"}
|
||||
onPress={onChangeNetworkPress}
|
||||
/>
|
||||
{getAdditionalActions()}
|
||||
{addressCopied === true ? (
|
||||
<Toast text={"Address copied to clipboard"} />
|
||||
) : null}
|
||||
</TWModal>
|
||||
|
||||
<NetworkSelectorModal
|
||||
isVisible={isNetworkSelectorModalVisible}
|
||||
onClose={onSelectorModalClose}
|
||||
/>
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
@@ -189,9 +47,9 @@ export const ConnectWalletDetails = ({
|
||||
{detailsButton ? (
|
||||
detailsButton
|
||||
) : (
|
||||
<>
|
||||
<Box flex={1} flexDirection="row" justifyContent="space-between">
|
||||
<ChainIcon size={32} chainIconUrl={chain?.icon?.url} />
|
||||
<View style={styles.walletInfo}>
|
||||
<Box justifyContent="center" alignItems="flex-start">
|
||||
<Text variant="bodySmall">
|
||||
{balanceQuery.data?.displayValue.slice(0, 5)}{" "}
|
||||
{balanceQuery.data?.symbol}
|
||||
@@ -201,12 +59,12 @@ export const ConnectWalletDetails = ({
|
||||
) : (
|
||||
<Address variant="bodySmallSecondary" address={address} />
|
||||
)}
|
||||
</View>
|
||||
</Box>
|
||||
<WalletIcon
|
||||
size={32}
|
||||
iconUri={activeWallet?.getMeta().iconURL || ""}
|
||||
/>
|
||||
</>
|
||||
</Box>
|
||||
)}
|
||||
</BaseButton>
|
||||
</>
|
||||
@@ -214,34 +72,6 @@ export const ConnectWalletDetails = ({
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
walletInfo: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
alignContent: "center",
|
||||
flexDirection: "column",
|
||||
marginLeft: 5,
|
||||
},
|
||||
exportWalletInfo: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
alignContent: "center",
|
||||
flexDirection: "column",
|
||||
marginLeft: 8,
|
||||
},
|
||||
exportWallet: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
borderRadius: 12,
|
||||
borderWidth: 0.5,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 12,
|
||||
minWidth: 200,
|
||||
},
|
||||
walletDetails: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
@@ -254,13 +84,4 @@ const styles = StyleSheet.create({
|
||||
paddingVertical: 12,
|
||||
minWidth: 200,
|
||||
},
|
||||
currentNetwork: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
justifyContent: "flex-start",
|
||||
marginTop: 24,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
||||
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
import { StyleSheet, View } from "react-native";
|
||||
import Box from "../base/Box";
|
||||
import { Toast } from "../base/Toast";
|
||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||
import { NetworkButton } from "./NetworkButton";
|
||||
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
|
||||
import {
|
||||
useActiveChain,
|
||||
useDisconnect,
|
||||
useWallet,
|
||||
} from "@thirdweb-dev/react-core";
|
||||
import { SmartWallet, walletIds, LocalWallet } from "@thirdweb-dev/wallets";
|
||||
import { useState, useCallback, useEffect } from "react";
|
||||
import RightArrowIcon from "../../assets/right-arrow";
|
||||
import PocketWalletIcon from "../../assets/wallet";
|
||||
import { useSmartWallet } from "../../providers/context-provider";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
|
||||
import Text from "../base/Text";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
|
||||
import { useAppTheme } from "../../styles/hooks";
|
||||
|
||||
export const ConnectWalletDetailsModal = () => {
|
||||
const theme = useAppTheme();
|
||||
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
||||
const activeWallet = useWallet();
|
||||
const chain = useActiveChain();
|
||||
const disconnect = useDisconnect();
|
||||
const [smartWallet, setSmartWallet] = useSmartWallet();
|
||||
const [addressCopied, setAddressCopied] = useState(false);
|
||||
const { modalState, setModalState } = useModalState();
|
||||
const { address } = (modalState as WalletDetailsModal).data;
|
||||
|
||||
useEffect(() => {
|
||||
const timeout = setTimeout(() => {
|
||||
if (addressCopied) {
|
||||
setAddressCopied(false);
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
return () => clearTimeout(timeout);
|
||||
}, [addressCopied]);
|
||||
|
||||
const onDisconnectPress = () => {
|
||||
disconnect().finally(() => {
|
||||
setModalState(CLOSE_MODAL_STATE("ConnectWalletDetailsModal"));
|
||||
setSmartWallet?.(undefined);
|
||||
});
|
||||
};
|
||||
|
||||
const onChangeNetworkPress = () => {
|
||||
// TODO: implement this
|
||||
// setIsDetailsModalVisible(false);
|
||||
// setIsNetworkSelectorModalVisible(true);
|
||||
};
|
||||
|
||||
const onExportLocalWalletPress = useCallback(() => {
|
||||
setIsExportModalVisible(true);
|
||||
}, []);
|
||||
|
||||
const onExportModalClose = () => {
|
||||
setIsExportModalVisible(false);
|
||||
};
|
||||
|
||||
const onAddressCopied = () => {
|
||||
setAddressCopied(true);
|
||||
};
|
||||
|
||||
const getAdditionalActions = useCallback(() => {
|
||||
if (activeWallet?.walletId === SmartWallet.id || smartWallet) {
|
||||
return (
|
||||
<SmartWalletAdditionalActions
|
||||
onExportPress={onExportLocalWalletPress}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (activeWallet?.walletId === walletIds.localWallet) {
|
||||
return (
|
||||
<>
|
||||
<View style={styles.currentNetwork}>
|
||||
<Text variant="bodySmallSecondary">Additional Actions</Text>
|
||||
</View>
|
||||
<BaseButton
|
||||
backgroundColor="background"
|
||||
borderColor="border"
|
||||
mb="sm"
|
||||
justifyContent="space-between"
|
||||
style={styles.exportWallet}
|
||||
onPress={onExportLocalWalletPress}
|
||||
>
|
||||
<>
|
||||
<PocketWalletIcon size={16} />
|
||||
<View style={styles.exportWalletInfo}>
|
||||
<Text variant="bodySmall">Backup wallet</Text>
|
||||
</View>
|
||||
</>
|
||||
<RightArrowIcon
|
||||
height={10}
|
||||
width={10}
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
</BaseButton>
|
||||
|
||||
{activeWallet?.walletId === LocalWallet.id ? (
|
||||
<Text variant="error">
|
||||
{
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
|
||||
}
|
||||
</Text>
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
return null;
|
||||
}, [
|
||||
activeWallet?.walletId,
|
||||
onExportLocalWalletPress,
|
||||
smartWallet,
|
||||
theme.colors.iconPrimary,
|
||||
]);
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<ExportLocalWalletModal
|
||||
isVisible={isExportModalVisible}
|
||||
onClose={onExportModalClose}
|
||||
/>
|
||||
<WalletDetailsModalHeader
|
||||
address={address}
|
||||
onDisconnectPress={onDisconnectPress}
|
||||
onAddressCopied={onAddressCopied}
|
||||
/>
|
||||
<View style={styles.currentNetwork}>
|
||||
<Text variant="bodySmallSecondary">Current Network</Text>
|
||||
</View>
|
||||
<NetworkButton
|
||||
chainIconUrl={chain?.icon?.url || ""}
|
||||
chainName={chain?.name || "Unknown Network"}
|
||||
onPress={onChangeNetworkPress}
|
||||
/>
|
||||
{getAdditionalActions()}
|
||||
{addressCopied === true ? (
|
||||
<Toast text={"Address copied to clipboard"} />
|
||||
) : null}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
exportWalletInfo: {
|
||||
flex: 1,
|
||||
justifyContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
alignContent: "center",
|
||||
flexDirection: "column",
|
||||
marginLeft: 8,
|
||||
},
|
||||
exportWallet: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "flex-start",
|
||||
borderRadius: 12,
|
||||
borderWidth: 0.5,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 12,
|
||||
minWidth: 200,
|
||||
},
|
||||
currentNetwork: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignContent: "flex-start",
|
||||
alignItems: "flex-start",
|
||||
justifyContent: "flex-start",
|
||||
marginTop: 24,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
||||
+3
-3
@@ -6,7 +6,6 @@ import {
|
||||
Share,
|
||||
StyleSheet,
|
||||
} from "react-native";
|
||||
import Modal from "react-native-modal";
|
||||
import { useState } from "react";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import Box from "../base/Box";
|
||||
@@ -19,6 +18,7 @@ import { usePersonalWalletAddress } from "../../wallets/hooks/usePersonalWalletA
|
||||
import { shortenWalletAddress } from "../../utils/addresses";
|
||||
import { WalletIcon } from "../base/WalletIcon";
|
||||
import { LocalWallet } from "../../wallets/wallets/LocalWallet";
|
||||
import { TWModal } from "../base/modal/TWModal";
|
||||
|
||||
export type ExportLocalWalletModalProps = {
|
||||
isVisible: boolean;
|
||||
@@ -142,7 +142,7 @@ export const ExportLocalWalletModal = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isVisible={isVisible} backdropOpacity={0.7}>
|
||||
<TWModal isVisible={isVisible} backdropOpacity={0.7}>
|
||||
<KeyboardAvoidingView behavior="padding">
|
||||
<Box
|
||||
flexDirection="column"
|
||||
@@ -194,7 +194,7 @@ export const ExportLocalWalletModal = ({
|
||||
</Box>
|
||||
</Box>
|
||||
</KeyboardAvoidingView>
|
||||
</Modal>
|
||||
</TWModal>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { RNCamera } from "react-native-camera";
|
||||
import { TWModal } from "../base/modal/TWModal";
|
||||
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
||||
|
||||
export const QRCodeScan = ({
|
||||
isVisible,
|
||||
onQRCodeScan,
|
||||
onClose,
|
||||
}: {
|
||||
isVisible: boolean;
|
||||
onQRCodeScan: (data: string) => void;
|
||||
onClose: () => void;
|
||||
}) => {
|
||||
return (
|
||||
<TWModal isVisible={isVisible} backdropOpacity={1}>
|
||||
<ModalHeaderTextClose headerText={"Scan to Connect"} onClose={onClose} />
|
||||
<RNCamera
|
||||
style={{ flex: 1 }}
|
||||
type={RNCamera.Constants.Type.back}
|
||||
captureAudio={false}
|
||||
androidCameraPermissionOptions={{
|
||||
title: "Permission to use camera",
|
||||
message: "We need your permission to use your camera",
|
||||
buttonPositive: "Ok",
|
||||
buttonNegative: "Cancel",
|
||||
}}
|
||||
onBarCodeRead={({ data }) => {
|
||||
onQRCodeScan(data);
|
||||
}}
|
||||
/>
|
||||
</TWModal>
|
||||
);
|
||||
};
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
import { useWallet } from "@thirdweb-dev/react-core";
|
||||
import Box from "../base/Box";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import Text from "../base/Text";
|
||||
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
||||
import {
|
||||
CLOSE_MODAL_STATE,
|
||||
WalletConnectSessionProposalModal,
|
||||
} from "../../utils/modalTypes";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
|
||||
export const SessionProposalModal = () => {
|
||||
const { modalState, setModalState } = useModalState();
|
||||
const { data: proposalData } =
|
||||
modalState as WalletConnectSessionProposalModal;
|
||||
|
||||
const wallet = useWallet();
|
||||
|
||||
const onClose = () => {
|
||||
setModalState(CLOSE_MODAL_STATE("SessionProposalModal"));
|
||||
};
|
||||
|
||||
return (
|
||||
<Box
|
||||
flexDirection="column"
|
||||
backgroundColor="background"
|
||||
borderRadius="md"
|
||||
p="lg"
|
||||
>
|
||||
<Text variant="bodyLarge">Connect to App</Text>
|
||||
<Text variant="bodyLarge">{proposalData.proposer.metadata.name}</Text>
|
||||
<Box flexDirection="row" justifyContent="space-evenly" mt="lg">
|
||||
<BaseButton
|
||||
alignContent="center"
|
||||
alignItems="center"
|
||||
borderRadius="sm"
|
||||
borderWidth={0.5}
|
||||
paddingHorizontal="sm"
|
||||
paddingVertical="md"
|
||||
minWidth={100}
|
||||
borderColor="border"
|
||||
onPress={async () => {
|
||||
(wallet as unknown as IWalletConnectReceiver).rejectSession();
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Text variant="bodySmall">Reject</Text>
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
alignContent="center"
|
||||
alignItems="center"
|
||||
borderRadius="sm"
|
||||
borderWidth={0.5}
|
||||
paddingHorizontal="sm"
|
||||
paddingVertical="md"
|
||||
minWidth={100}
|
||||
backgroundColor="white"
|
||||
borderColor="border"
|
||||
onPress={async () => {
|
||||
if (!wallet) {
|
||||
throw new Error("Wallet not connected.");
|
||||
}
|
||||
await (
|
||||
wallet as unknown as IWalletConnectReceiver
|
||||
).approveSession();
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Text variant="bodySmall" color="black">
|
||||
Approve
|
||||
</Text>
|
||||
</BaseButton>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
import { useChain, useWallet } from "@thirdweb-dev/react-core";
|
||||
import Box from "../base/Box";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import Text from "../base/Text";
|
||||
import {
|
||||
EIP155_SIGNING_METHODS,
|
||||
IWalletConnectReceiver,
|
||||
} from "@thirdweb-dev/wallets";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
import {
|
||||
CLOSE_MODAL_STATE,
|
||||
WalletConnectSessionRequestModal,
|
||||
} from "../../utils/modalTypes";
|
||||
import { ActivityIndicator, Dimensions } from "react-native";
|
||||
import { shortenWalletAddress } from "../../utils/addresses";
|
||||
import { useCallback, useState } from "react";
|
||||
|
||||
const getTitle = (method: string) => {
|
||||
switch (method) {
|
||||
case EIP155_SIGNING_METHODS.SWITCH_CHAIN:
|
||||
return "Switch Chain";
|
||||
case EIP155_SIGNING_METHODS.ETH_SIGN:
|
||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||
return "Sign this message?";
|
||||
default:
|
||||
return "Send / Sign Transaction";
|
||||
}
|
||||
};
|
||||
|
||||
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||
|
||||
export const SessionRequestModal = () => {
|
||||
const { modalState, setModalState } = useModalState();
|
||||
const { data: requestData } = modalState as WalletConnectSessionRequestModal;
|
||||
const [approvingRequest, setApprovingRequest] = useState(false);
|
||||
|
||||
const wallet = useWallet();
|
||||
const chain = useChain();
|
||||
|
||||
const onClose = () => {
|
||||
setModalState(CLOSE_MODAL_STATE("SessionRequestModal"));
|
||||
};
|
||||
|
||||
const onApprove = async () => {
|
||||
if (!wallet) {
|
||||
throw new Error("Wallet not connected.");
|
||||
}
|
||||
|
||||
setApprovingRequest(true);
|
||||
(wallet as unknown as IWalletConnectReceiver)
|
||||
.approveRequest()
|
||||
.finally(() => {
|
||||
setApprovingRequest(false);
|
||||
onClose();
|
||||
});
|
||||
};
|
||||
|
||||
const getContent = useCallback(() => {
|
||||
switch (requestData.method) {
|
||||
case EIP155_SIGNING_METHODS.SWITCH_CHAIN:
|
||||
return (
|
||||
<Text variant="bodySmall" textAlign="left">
|
||||
{`Switch to ${
|
||||
requestData.params[0].chainId === chain?.chainId
|
||||
? chain?.slug
|
||||
: requestData.params[0].chainId
|
||||
}`}
|
||||
</Text>
|
||||
);
|
||||
case EIP155_SIGNING_METHODS.ETH_SIGN:
|
||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||
return (
|
||||
<Text variant="bodySmall" textAlign="left">
|
||||
{requestData.params[0]}
|
||||
</Text>
|
||||
);
|
||||
case EIP155_SIGNING_METHODS.ETH_SEND_TRANSACTION:
|
||||
case EIP155_SIGNING_METHODS.ETH_SIGN_TRANSACTION:
|
||||
const { params } = requestData;
|
||||
const transaction = params[0];
|
||||
|
||||
const from = transaction.from;
|
||||
const to = transaction.to;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<Text variant="bodySmall" textAlign="left">
|
||||
{`from: ${shortenWalletAddress(from)}`}
|
||||
</Text>
|
||||
<Text variant="bodySmall" textAlign="left" mt="sm">
|
||||
{`to: ${shortenWalletAddress(to)}`}
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
default:
|
||||
throw new Error(`Method not implemented: ${requestData.method}`);
|
||||
}
|
||||
}, [requestData]);
|
||||
|
||||
return (
|
||||
<Box
|
||||
flexDirection="column"
|
||||
backgroundColor="background"
|
||||
borderRadius="md"
|
||||
p="lg"
|
||||
>
|
||||
<Text variant="bodyLarge" mb="md">
|
||||
{requestData.peer.metadata.name}
|
||||
</Text>
|
||||
<Text variant="bodySmallSecondary" textAlign="center" fontSize={15}>
|
||||
{getTitle(requestData.method)}
|
||||
</Text>
|
||||
<Box maxHeight={MODAL_HEIGHT} mt="md">
|
||||
{getContent()}
|
||||
</Box>
|
||||
<Box flexDirection="row" justifyContent="space-evenly" mt="lg">
|
||||
<BaseButton
|
||||
alignContent="center"
|
||||
alignItems="center"
|
||||
borderRadius="sm"
|
||||
borderWidth={0.5}
|
||||
disabled={approvingRequest}
|
||||
paddingHorizontal="sm"
|
||||
paddingVertical="md"
|
||||
minWidth={100}
|
||||
borderColor="border"
|
||||
onPress={async () => {
|
||||
(wallet as unknown as IWalletConnectReceiver).rejectRequest();
|
||||
onClose();
|
||||
}}
|
||||
>
|
||||
<Text variant="bodySmall">Reject</Text>
|
||||
</BaseButton>
|
||||
<BaseButton
|
||||
alignContent="center"
|
||||
alignItems="center"
|
||||
borderRadius="sm"
|
||||
borderWidth={0.5}
|
||||
disabled={approvingRequest}
|
||||
paddingHorizontal="sm"
|
||||
paddingVertical="md"
|
||||
minWidth={100}
|
||||
backgroundColor="white"
|
||||
borderColor="border"
|
||||
onPress={onApprove}
|
||||
>
|
||||
{approvingRequest ? (
|
||||
<ActivityIndicator size="small" />
|
||||
) : (
|
||||
<Text variant="bodySmall" color="black">
|
||||
Approve
|
||||
</Text>
|
||||
)}
|
||||
</BaseButton>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
+7
-3
@@ -14,7 +14,8 @@ import { useWalletContext, useWallet } from "@thirdweb-dev/react-core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useSmartWallet } from "../../providers/context-provider";
|
||||
import RightArrowIcon from "../../assets/right-arrow";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
import ConnectAppField from "./ConnectAppField";
|
||||
import { useAppTheme } from "../../styles/hooks";
|
||||
|
||||
export const SmartWalletAdditionalActions = ({
|
||||
onExportPress,
|
||||
@@ -27,7 +28,7 @@ export const SmartWalletAdditionalActions = ({
|
||||
const [smartWalletAddress, setSmartWalletAddress] = useState<string>("");
|
||||
const [showSmartWallet, setShowSmartWallet] = useState(false);
|
||||
const activeWallet = useWallet();
|
||||
const theme = useTheme();
|
||||
const theme = useAppTheme();
|
||||
|
||||
const wallet = showSmartWallet
|
||||
? smartWallet
|
||||
@@ -93,6 +94,9 @@ export const SmartWalletAdditionalActions = ({
|
||||
color={theme.colors.iconPrimary}
|
||||
/>
|
||||
</BaseButton>
|
||||
{!showSmartWallet && smartWallet?.enableConnectApp ? (
|
||||
<ConnectAppField />
|
||||
) : null}
|
||||
{wallet?.walletId === walletIds.localWallet ||
|
||||
activeWallet?.walletId === walletIds.localWallet ? (
|
||||
<>
|
||||
@@ -122,7 +126,7 @@ export const SmartWalletAdditionalActions = ({
|
||||
</BaseButton>
|
||||
<Text variant="error">
|
||||
{
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to loose access to it."
|
||||
}
|
||||
</Text>
|
||||
</>
|
||||
|
||||
+10
-4
@@ -9,6 +9,7 @@ import { ActivityIndicator, StyleSheet, View } from "react-native";
|
||||
import * as Clipboard from "expo-clipboard";
|
||||
import Box from "../base/Box";
|
||||
import CopyIcon from "../../assets/copy";
|
||||
import { useState } from "react";
|
||||
|
||||
interface WalletDetailsModalHeaderProps {
|
||||
address: string;
|
||||
@@ -21,17 +22,22 @@ export const WalletDetailsModalHeader = ({
|
||||
address,
|
||||
onDisconnectPress,
|
||||
onAddressCopied,
|
||||
loading,
|
||||
}: WalletDetailsModalHeaderProps) => {
|
||||
const theme = useAppTheme();
|
||||
const balanceQuery = useBalance();
|
||||
const activeWallet = useWallet();
|
||||
const [showLoading, setShowLoading] = useState(false);
|
||||
|
||||
const onAddressPress = async () => {
|
||||
await Clipboard.setStringAsync(address);
|
||||
onAddressCopied?.();
|
||||
};
|
||||
|
||||
const onDisconnectPressInternal = () => {
|
||||
setShowLoading(true);
|
||||
onDisconnectPress();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<View style={styles.header}>
|
||||
@@ -61,14 +67,14 @@ export const WalletDetailsModalHeader = ({
|
||||
{balanceQuery.data?.symbol}
|
||||
</Text>
|
||||
</BaseButton>
|
||||
{loading ? (
|
||||
<ActivityIndicator size={18} color={theme.colors.iconHighlight} />
|
||||
{showLoading ? (
|
||||
<ActivityIndicator size="small" color={theme.colors.iconHighlight} />
|
||||
) : (
|
||||
<Icon
|
||||
type="disconnect"
|
||||
width={18}
|
||||
height={18}
|
||||
onPress={onDisconnectPress}
|
||||
onPress={onDisconnectPressInternal}
|
||||
color={theme.colors.iconHighlight}
|
||||
/>
|
||||
)}
|
||||
|
||||
+2
-2
@@ -10,9 +10,9 @@ import { View } from "react-native";
|
||||
export type ChooseWalletProps = {
|
||||
headerText?: ReactNode | string;
|
||||
subHeaderText?: ReactNode | string;
|
||||
onChooseWallet: (wallet: WalletConfig<any, any>) => void;
|
||||
onChooseWallet: (wallet: WalletConfig<any, any>, data?: any) => void;
|
||||
onClose: () => void;
|
||||
wallets: WalletConfig[];
|
||||
wallets: WalletConfig<any, any>[];
|
||||
excludeWalletIds?: string[];
|
||||
showGuestWalletAsButton?: boolean;
|
||||
};
|
||||
|
||||
+34
-9
@@ -2,23 +2,26 @@ import { useMemo } from "react";
|
||||
import type { WalletConfig } from "@thirdweb-dev/react-core";
|
||||
import { StyleSheet, View, FlatList } from "react-native";
|
||||
import { WalletButton } from "../../base/WalletButton";
|
||||
import Box from "../../base/Box";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
|
||||
interface InitialExplorerContentProps {
|
||||
interface ChooseWalletContentProps {
|
||||
wallets: WalletConfig[];
|
||||
excludeWalletIds?: string[];
|
||||
onChooseWallet: (wallet: WalletConfig) => void;
|
||||
onChooseWallet: (wallet: WalletConfig, data?: any) => void;
|
||||
}
|
||||
|
||||
export const ChooseWalletContent = ({
|
||||
wallets,
|
||||
excludeWalletIds,
|
||||
onChooseWallet,
|
||||
}: InitialExplorerContentProps) => {
|
||||
}: ChooseWalletContentProps) => {
|
||||
const walletsToDisplay = useMemo(() => {
|
||||
return wallets.filter(
|
||||
(w) => !!!excludeWalletIds?.find((ewId) => ewId === w.id),
|
||||
);
|
||||
}, [wallets, excludeWalletIds]);
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<View style={styles.explorerContainer}>
|
||||
@@ -28,13 +31,35 @@ export const ChooseWalletContent = ({
|
||||
renderItem={({ item, index }) => {
|
||||
const marginBottom =
|
||||
index === walletsToDisplay.length - 1 ? "none" : "xxs";
|
||||
|
||||
return (
|
||||
<WalletButton
|
||||
walletIconUrl={item.meta.iconURL}
|
||||
name={item.meta.name}
|
||||
onPress={() => onChooseWallet(item)}
|
||||
mb={marginBottom}
|
||||
/>
|
||||
<>
|
||||
{item.selectUI ? (
|
||||
<Box
|
||||
mb={marginBottom}
|
||||
flexDirection="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
borderRadius="sm"
|
||||
>
|
||||
<item.selectUI
|
||||
theme={theme}
|
||||
supportedWallets={wallets}
|
||||
onSelect={(data) => {
|
||||
onChooseWallet(item, data);
|
||||
}}
|
||||
walletConfig={item}
|
||||
/>
|
||||
</Box>
|
||||
) : (
|
||||
<WalletButton
|
||||
walletIconUrl={item.meta.iconURL}
|
||||
name={item.meta.name}
|
||||
onPress={() => onChooseWallet(item)}
|
||||
mb={marginBottom}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
+105
-137
@@ -1,185 +1,153 @@
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import Text from "../base/Text";
|
||||
import { TWModal } from "../base/modal/TWModal";
|
||||
import { ChooseWallet } from "./ChooseWallet/ChooseWallet";
|
||||
import { ConnectingWallet } from "./ConnectingWallet/ConnectingWallet";
|
||||
import {
|
||||
WalletConfig,
|
||||
useConnect,
|
||||
useConnectionStatus,
|
||||
useWallets,
|
||||
} from "@thirdweb-dev/react-core";
|
||||
import { useEffect, useState } from "react";
|
||||
import { ActivityIndicator, StyleSheet } from "react-native";
|
||||
import { WalletConfig, useConnect, useWallets } from "@thirdweb-dev/react-core";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
||||
import { SmartWalletFlow } from "./SmartWallet/SmartWalletFlow";
|
||||
import { useColorScheme } from "react-native";
|
||||
import { useModalState } from "../../providers/ui-context-provider";
|
||||
import {
|
||||
CLOSE_MODAL_STATE,
|
||||
ConnectWalletFlowModal,
|
||||
} from "../../utils/modalTypes";
|
||||
|
||||
export const ConnectWalletFlow = () => {
|
||||
const { modalState, setModalState } = useModalState();
|
||||
const { modalTitle, walletConfig } = (modalState as ConnectWalletFlowModal)
|
||||
.data;
|
||||
|
||||
export const ConnectWalletFlow = ({
|
||||
buttonTitle,
|
||||
modalTitle,
|
||||
}: {
|
||||
buttonTitle?: string;
|
||||
modalTitle?: string;
|
||||
}) => {
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [activeWallet, setActiveWallet] = useState<WalletConfig | undefined>();
|
||||
const [isConnecting, setIsConnecting] = useState(false);
|
||||
const [selectionData, setSelectionData] = useState<any>();
|
||||
const supportedWallets = useWallets();
|
||||
const connectionStatus = useConnectionStatus();
|
||||
const isWalletConnecting = connectionStatus === "connecting";
|
||||
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
|
||||
const theme = useColorScheme();
|
||||
|
||||
useEffect(() => {
|
||||
setShowButtonSpinner(isWalletConnecting);
|
||||
|
||||
if (!isWalletConnecting) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
if (isWalletConnecting) {
|
||||
setShowButtonSpinner(false);
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
return () => {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
};
|
||||
}, [isWalletConnecting]);
|
||||
|
||||
const connect = useConnect();
|
||||
|
||||
const onConnectPress = () => {
|
||||
if (supportedWallets.length === 1) {
|
||||
onChooseWallet(supportedWallets[0]);
|
||||
const onClose = useCallback(
|
||||
(reset?: boolean) => {
|
||||
setModalState(CLOSE_MODAL_STATE("ConnectWalletFlow"));
|
||||
|
||||
if (reset) {
|
||||
resetModal();
|
||||
}
|
||||
},
|
||||
[setModalState],
|
||||
);
|
||||
|
||||
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);
|
||||
});
|
||||
},
|
||||
[connect, onClose],
|
||||
);
|
||||
|
||||
const onChooseWallet = useCallback(
|
||||
(wallet: WalletConfig, data?: any) => {
|
||||
setActiveWallet(() => wallet);
|
||||
setSelectionData(data);
|
||||
|
||||
// If not smart wallet (sw has it's own flow, need to migrate it to connectUI)
|
||||
// &&
|
||||
// If the wallet has no custom connect UI, then connect it
|
||||
if (wallet.id !== SmartWallet.id && !wallet.connectUI) {
|
||||
connectActiveWallet(wallet, data);
|
||||
}
|
||||
},
|
||||
[connectActiveWallet],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// case when only one wallet is passed in supportedWallets
|
||||
if (walletConfig) {
|
||||
onChooseWallet(walletConfig);
|
||||
}
|
||||
|
||||
setModalVisible(true);
|
||||
};
|
||||
|
||||
const onClose = (reset?: boolean) => {
|
||||
setModalVisible(false);
|
||||
|
||||
if (reset) {
|
||||
resetModal();
|
||||
}
|
||||
};
|
||||
}, [onChooseWallet, walletConfig]);
|
||||
|
||||
const onOpenModal = () => {
|
||||
setModalVisible(true);
|
||||
};
|
||||
|
||||
const connectActiveWallet = async (wallet: WalletConfig) => {
|
||||
setIsConnecting(true);
|
||||
connect(wallet, {}).catch((error) => {
|
||||
console.error("Error connecting to the wallet", error);
|
||||
onBackPress();
|
||||
});
|
||||
};
|
||||
|
||||
const onChooseWallet = (wallet: WalletConfig) => {
|
||||
setActiveWallet(() => wallet);
|
||||
|
||||
if (wallet.id !== SmartWallet.id) {
|
||||
connectActiveWallet(wallet);
|
||||
}
|
||||
};
|
||||
|
||||
const onBackPress = () => {
|
||||
const onBackPress = useCallback(() => {
|
||||
resetModal();
|
||||
};
|
||||
}, []);
|
||||
|
||||
const onConnected = useCallback(() => {
|
||||
onClose(true);
|
||||
}, [onClose]);
|
||||
|
||||
const resetModal = () => {
|
||||
setActiveWallet(undefined);
|
||||
setIsConnecting(false);
|
||||
};
|
||||
|
||||
function getComponentForWallet(activeWalletP: WalletConfig) {
|
||||
switch (activeWalletP.id) {
|
||||
const getComponentForWallet = useCallback(() => {
|
||||
switch (activeWallet?.id) {
|
||||
case SmartWallet.id:
|
||||
return <SmartWalletFlow onClose={onClose} onConnect={onBackPress} />;
|
||||
return <SmartWalletFlow onClose={onClose} onConnect={onConnected} />;
|
||||
}
|
||||
|
||||
if (activeWalletP.connectUI) {
|
||||
if (activeWallet?.connectUI) {
|
||||
return (
|
||||
<activeWalletP.connectUI
|
||||
<activeWallet.connectUI
|
||||
theme={theme || "dark"}
|
||||
goBack={onBackPress}
|
||||
close={onClose}
|
||||
close={() => onClose(true)}
|
||||
isOpen={modalVisible}
|
||||
open={onOpenModal}
|
||||
walletConfig={activeWalletP}
|
||||
walletConfig={activeWallet}
|
||||
supportedWallets={supportedWallets}
|
||||
selectionData={undefined} // TODO
|
||||
selectionData={selectionData}
|
||||
setSelectionData={() => {}} // TODO
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
activeWallet,
|
||||
modalVisible,
|
||||
onBackPress,
|
||||
onClose,
|
||||
onConnected,
|
||||
selectionData,
|
||||
supportedWallets,
|
||||
theme,
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<TWModal isVisible={modalVisible}>
|
||||
{activeWallet ? (
|
||||
isConnecting ? (
|
||||
<ConnectingWallet
|
||||
content={
|
||||
activeWallet.id === walletIds.localWallet ? (
|
||||
<Text variant="bodySmallSecondary" mt="md">
|
||||
Creating, encrypting and securing your device wallet.
|
||||
</Text>
|
||||
) : undefined
|
||||
}
|
||||
wallet={activeWallet}
|
||||
onClose={onClose}
|
||||
onBackPress={onBackPress}
|
||||
/>
|
||||
) : (
|
||||
getComponentForWallet(activeWallet)
|
||||
)
|
||||
) : (
|
||||
<ChooseWallet
|
||||
headerText={modalTitle}
|
||||
wallets={supportedWallets}
|
||||
onChooseWallet={onChooseWallet}
|
||||
{activeWallet ? (
|
||||
isConnecting ? (
|
||||
<ConnectingWallet
|
||||
content={
|
||||
activeWallet.id === walletIds.localWallet ? (
|
||||
<Text variant="bodySmallSecondary" mt="md">
|
||||
Creating, encrypting and securing your device wallet.
|
||||
</Text>
|
||||
) : undefined
|
||||
}
|
||||
wallet={activeWallet}
|
||||
onClose={onClose}
|
||||
onBackPress={onBackPress}
|
||||
/>
|
||||
)}
|
||||
</TWModal>
|
||||
|
||||
<BaseButton
|
||||
backgroundColor="buttonBackgroundColor"
|
||||
onPress={onConnectPress}
|
||||
style={styles.connectWalletButton}
|
||||
>
|
||||
<Text variant="bodyLarge" color="buttonTextColor">
|
||||
{showButtonSpinner ? (
|
||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
||||
) : buttonTitle ? (
|
||||
buttonTitle
|
||||
) : (
|
||||
"Connect Wallet"
|
||||
)}
|
||||
</Text>
|
||||
</BaseButton>
|
||||
) : (
|
||||
getComponentForWallet()
|
||||
)
|
||||
) : (
|
||||
<ChooseWallet
|
||||
headerText={modalTitle}
|
||||
wallets={supportedWallets}
|
||||
onChooseWallet={onChooseWallet}
|
||||
onClose={onClose}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
connectWalletButton: {
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignContent: "center",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
borderRadius: 8,
|
||||
paddingHorizontal: 10,
|
||||
paddingVertical: 10,
|
||||
minWidth: 150,
|
||||
},
|
||||
});
|
||||
|
||||
+3
-3
@@ -4,7 +4,6 @@ import {
|
||||
KeyboardAvoidingView,
|
||||
StyleSheet,
|
||||
} from "react-native";
|
||||
import Modal from "react-native-modal";
|
||||
import { useState } from "react";
|
||||
import BaseButton from "../base/BaseButton";
|
||||
import Box from "../base/Box";
|
||||
@@ -17,6 +16,7 @@ import type {
|
||||
} from "../../wallets/types/local-wallet";
|
||||
import * as DocumentPicker from "expo-document-picker";
|
||||
import * as FileSystem from "expo-file-system";
|
||||
import { TWModal } from "../base/modal/TWModal";
|
||||
|
||||
export type LocalWalletImportModalProps = {
|
||||
isVisible: boolean;
|
||||
@@ -110,7 +110,7 @@ export const LocalWalletImportModal = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal isVisible={isVisible} backdropOpacity={0.7}>
|
||||
<TWModal isVisible={isVisible} backdropOpacity={0.7}>
|
||||
<KeyboardAvoidingView behavior="padding">
|
||||
<Box
|
||||
flexDirection="column"
|
||||
@@ -168,7 +168,7 @@ export const LocalWalletImportModal = ({
|
||||
</Box>
|
||||
</Box>
|
||||
</KeyboardAvoidingView>
|
||||
</Modal>
|
||||
</TWModal>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
+32
-25
@@ -14,10 +14,11 @@ import { ChooseWallet } from "../ChooseWallet/ChooseWallet";
|
||||
import { LocalWalletFlow } from "../LocalWalletFlow";
|
||||
import { ModalHeaderTextClose } from "../../base/modal/ModalHeaderTextClose";
|
||||
import { ActivityIndicator, Linking, useColorScheme } from "react-native";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
import BaseButton from "../../base/BaseButton";
|
||||
import Text from "../../base/Text";
|
||||
import { walletIds } from "@thirdweb-dev/wallets";
|
||||
import { useAppTheme } from "../../../styles/hooks";
|
||||
import { DEFAULT_WALLETS } from "../../../constants/wallets";
|
||||
|
||||
export const SmartWalletFlow = ({
|
||||
onClose,
|
||||
@@ -33,7 +34,7 @@ export const SmartWalletFlow = ({
|
||||
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
|
||||
number | undefined
|
||||
>();
|
||||
const theme = useTheme();
|
||||
const theme = useAppTheme();
|
||||
const createWalletInstance = useCreateWalletInstance();
|
||||
const walletObj = useSupportedWallet(walletIds.smartWallet) as SmartWalletObj;
|
||||
const connect = useConnect();
|
||||
@@ -45,6 +46,34 @@ export const SmartWalletFlow = ({
|
||||
? personalWalletChainId !== targetChain.chainId
|
||||
: false;
|
||||
|
||||
const connectPersonalWallet = useCallback(
|
||||
async (wallet: WalletConfig) => {
|
||||
setIsConnecting(true);
|
||||
const walletInstance = createWalletInstance(wallet);
|
||||
await walletInstance.connect();
|
||||
|
||||
setConnectedPersonalWallet(walletInstance);
|
||||
},
|
||||
[createWalletInstance],
|
||||
);
|
||||
|
||||
const onChoosePersonalWallet = useCallback(
|
||||
async (wallet: WalletConfig) => {
|
||||
// if (wallet.id === LocalWallet.id) {
|
||||
// setShowLocalWalletFlow(true);
|
||||
// } else {
|
||||
connectPersonalWallet(wallet);
|
||||
// }
|
||||
},
|
||||
[connectPersonalWallet],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (walletObj.config.personalWallets?.length === 1) {
|
||||
onChoosePersonalWallet(walletObj.config.personalWallets[0]);
|
||||
}
|
||||
}, [onChoosePersonalWallet, walletObj.config.personalWallets]);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
if (connectedPersonalWallet) {
|
||||
@@ -74,34 +103,12 @@ export const SmartWalletFlow = ({
|
||||
}
|
||||
}, [connectSmartWallet, connectedPersonalWallet, mismatch]);
|
||||
|
||||
const connectPersonalWallet = useCallback(
|
||||
async (wallet: WalletConfig) => {
|
||||
setIsConnecting(true);
|
||||
const walletInstance = createWalletInstance(wallet);
|
||||
await walletInstance.connect();
|
||||
|
||||
setConnectedPersonalWallet(walletInstance);
|
||||
},
|
||||
[createWalletInstance],
|
||||
);
|
||||
|
||||
const onConnectedLocalWallet = async (wallet: WalletInstance) => {
|
||||
setIsConnecting(true);
|
||||
|
||||
connectSmartWallet(wallet);
|
||||
};
|
||||
|
||||
const onChoosePersonalWallet = useCallback(
|
||||
async (wallet: WalletConfig) => {
|
||||
// if (wallet.id === LocalWallet.id) {
|
||||
// setShowLocalWalletFlow(true);
|
||||
// } else {
|
||||
connectPersonalWallet(wallet);
|
||||
// }
|
||||
},
|
||||
[connectPersonalWallet],
|
||||
);
|
||||
|
||||
const onLocalWalletBackPress = () => {
|
||||
setShowLocalWalletFlow(false);
|
||||
};
|
||||
@@ -196,7 +203,7 @@ export const SmartWalletFlow = ({
|
||||
</Text>
|
||||
</Text>
|
||||
}
|
||||
wallets={walletObj.config.personalWallets}
|
||||
wallets={walletObj.config.personalWallets || DEFAULT_WALLETS}
|
||||
onChooseWallet={onChoosePersonalWallet}
|
||||
onClose={onClose}
|
||||
/>
|
||||
|
||||
+2
-31
@@ -1,6 +1,4 @@
|
||||
import { StyleSheet, TextInput } from "react-native";
|
||||
import { useTheme } from "@shopify/restyle";
|
||||
import Box from "../../base/Box";
|
||||
import { TextInput } from "react-native";
|
||||
import Text from "../../base/Text";
|
||||
|
||||
export const UsernameInput = ({
|
||||
@@ -8,39 +6,12 @@ export const UsernameInput = ({
|
||||
}: {
|
||||
onChangeText: TextInput["props"]["onChangeText"];
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Text variant="bodySmall" textAlign="left" mt="lg" mb="xxs">
|
||||
Username
|
||||
</Text>
|
||||
<Box
|
||||
flexDirection="row"
|
||||
alignItems="center"
|
||||
borderColor="border"
|
||||
borderWidth={1}
|
||||
borderRadius="md"
|
||||
pr="xs"
|
||||
>
|
||||
<TextInput
|
||||
style={{ ...styles.textInput, color: theme.colors.textPrimary }}
|
||||
returnKeyType={"done"}
|
||||
clearTextOnFocus={false}
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
onChangeText={onChangeText}
|
||||
/>
|
||||
</Box>
|
||||
<TextInput onChangeText={onChangeText} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
textInput: {
|
||||
textAlign: "left",
|
||||
flex: 1,
|
||||
height: 40,
|
||||
paddingLeft: 5,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { useModalState } from "../providers/ui-context-provider";
|
||||
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
||||
import { Dimensions, StyleSheet, View } from "react-native";
|
||||
import { useMemo } from "react";
|
||||
import { ConnectWalletDetailsModal } from "./ConnectWalletDetails/ConnectWalletDetailsModal";
|
||||
import { CLOSE_MODAL_STATE } from "../utils/modalTypes";
|
||||
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||
import { useAppTheme } from "../styles/hooks";
|
||||
import { SessionRequestModal } from "./ConnectWalletDetails/SessionRequestModal";
|
||||
import { SessionProposalModal } from "./ConnectWalletDetails/SessionProposalModal";
|
||||
import { TWModal } from "./base/modal/TWModal";
|
||||
|
||||
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||
const DEVICE_WIDTH = Dimensions.get("window").width;
|
||||
|
||||
export const MainModal = () => {
|
||||
const theme = useAppTheme();
|
||||
|
||||
const { modalState, setModalState } = useModalState();
|
||||
|
||||
const { isOpen, isSheet } = modalState;
|
||||
|
||||
const view = useMemo(() => {
|
||||
switch (modalState?.view) {
|
||||
case "ConnectWalletFlow":
|
||||
return <ConnectWalletFlow />;
|
||||
case "WalletDetails":
|
||||
return <ConnectWalletDetailsModal />;
|
||||
case "WalletConnectSessionRequestModal":
|
||||
return <SessionRequestModal />;
|
||||
case "WalletConnectSessionProposalModal":
|
||||
return <SessionProposalModal />;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}, [modalState.view]);
|
||||
|
||||
const onBackdropPress = () => {
|
||||
setModalState(CLOSE_MODAL_STATE("MainModal"));
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeProvider theme={theme}>
|
||||
<TWModal isVisible={isOpen} onBackdropPress={onBackdropPress}>
|
||||
{isSheet ? (
|
||||
<View
|
||||
style={[styles.modal, { backgroundColor: theme.colors.background }]}
|
||||
>
|
||||
<View style={styles.contentContainer}>{view}</View>
|
||||
</View>
|
||||
) : (
|
||||
view
|
||||
)}
|
||||
</TWModal>
|
||||
</ThemeProvider>
|
||||
);
|
||||
};
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
modal: {
|
||||
position: "absolute",
|
||||
bottom: -20,
|
||||
left: -20,
|
||||
width: DEVICE_WIDTH,
|
||||
borderTopLeftRadius: 24,
|
||||
borderTopRightRadius: 24,
|
||||
padding: 24,
|
||||
},
|
||||
contentContainer: {
|
||||
maxHeight: MODAL_HEIGHT,
|
||||
display: "flex",
|
||||
},
|
||||
});
|
||||
@@ -1,22 +1,17 @@
|
||||
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
||||
import { TWModal, TWModalProps } from "../base/modal/TWModal";
|
||||
|
||||
export type NetworkSelectorModalProps = {
|
||||
onClose: () => void;
|
||||
} & TWModalProps;
|
||||
};
|
||||
|
||||
export const NetworkSelectorModal = ({
|
||||
isVisible,
|
||||
onClose,
|
||||
...props
|
||||
}: NetworkSelectorModalProps) => {
|
||||
return (
|
||||
<TWModal isVisible={isVisible} {...props}>
|
||||
<ModalHeaderTextClose
|
||||
headerText={"Select Network"}
|
||||
subHeaderText={"Choose a new network to connect to thirdweb"}
|
||||
onClose={onClose}
|
||||
/>
|
||||
</TWModal>
|
||||
<ModalHeaderTextClose
|
||||
headerText={"Select Network"}
|
||||
subHeaderText={"Choose a new network to connect to thirdweb"}
|
||||
onClose={onClose}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user