Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b734f05525 | ||
|
|
30ea9c6bf7 | ||
|
|
6de3a19b86 | ||
|
|
06e59cf916 | ||
|
|
3f3a484a3a | ||
|
|
05e52114bf | ||
|
|
1a421d3b5d | ||
|
|
97fdbc8f64 | ||
|
|
ebf4025718 | ||
|
|
a81a5285b7 | ||
|
|
95c9d56ea4 | ||
|
|
18552f3a22 | ||
|
|
9187e0f2cf | ||
|
|
20d0f53b46 | ||
|
|
0dcb15b7e6 | ||
|
|
ba49a82463 | ||
|
|
8d1b8a47e6 | ||
|
|
b90d3af5b8 | ||
|
|
c34ac468fb | ||
|
|
fefeaeef18 | ||
|
|
91c2352b03 | ||
|
|
9f454d1e08 | ||
|
|
59e5541094 | ||
|
|
8e104b443e |
@@ -1,5 +1,21 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 4.1.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1927](https://github.com/thirdweb-dev/js/pull/1927) [`05e52114`](https://github.com/thirdweb-dev/js/commit/05e52114bf4f0ee352f393ed20115a904a18c310) Thanks [@alecananian](https://github.com/alecananian)! - Update Fastify login route response to match Express/Next
|
||||||
|
|
||||||
|
- Updated dependencies [[`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b), [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e), [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3), [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.2
|
||||||
|
|
||||||
|
## 4.1.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.1
|
||||||
|
|
||||||
## 4.1.3
|
## 4.1.3
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "4.1.3",
|
"version": "4.1.5",
|
||||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ export const loginHandler = (
|
|||||||
schema: {
|
schema: {
|
||||||
body: LoginPayloadBodySchema,
|
body: LoginPayloadBodySchema,
|
||||||
response: {
|
response: {
|
||||||
200: z.any(),
|
200: z.object({
|
||||||
|
token: z.string(),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
handler: async (req, res) => {
|
handler: async (req, res) => {
|
||||||
@@ -104,7 +106,8 @@ export const loginHandler = (
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
return res.status(200).send({ success: true });
|
// Send token in body and as cookie for frontend and backend use cases
|
||||||
|
return res.status(200).send({ token });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/chains
|
# @thirdweb-dev/chains
|
||||||
|
|
||||||
|
## 0.1.58
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1911](https://github.com/thirdweb-dev/js/pull/1911) [`0dcb15b7`](https://github.com/thirdweb-dev/js/commit/0dcb15b7e647acd038b0ec8b1a2b200808aae00e) Thanks [@iketw](https://github.com/iketw)! - Syncs Chains
|
||||||
|
|
||||||
## 0.1.57
|
## 0.1.57
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,7 +2,19 @@ import type { Chain } from "../src/types";
|
|||||||
export default {
|
export default {
|
||||||
"chain": "FUSE",
|
"chain": "FUSE",
|
||||||
"chainId": 122,
|
"chainId": 122,
|
||||||
"explorers": [],
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://explorer.fuse.io",
|
||||||
|
"standard": "EIP3091",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
|
||||||
|
"width": 551,
|
||||||
|
"height": 540,
|
||||||
|
"format": "png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
|
|||||||
@@ -9,7 +9,10 @@ export default {
|
|||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [
|
||||||
|
"https://faucet.avax.network/?subnet=beam",
|
||||||
|
"https://faucet.onbeam.com"
|
||||||
|
],
|
||||||
"features": [
|
"features": [
|
||||||
{
|
{
|
||||||
"name": "EIP1559"
|
"name": "EIP1559"
|
||||||
@@ -24,15 +27,16 @@ export default {
|
|||||||
"infoURL": "https://www.onbeam.com",
|
"infoURL": "https://www.onbeam.com",
|
||||||
"name": "Beam Testnet",
|
"name": "Beam Testnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Merit Circle",
|
"name": "Beam",
|
||||||
"symbol": "MC",
|
"symbol": "BEAM",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"networkId": 13337,
|
"networkId": 13337,
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://beam-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://beam-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://13337.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://13337.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://subnets.avax.network/beam/testnet/rpc"
|
"https://subnets.avax.network/beam/testnet/rpc",
|
||||||
|
"wss://subnets.avax.network/beam/testnet/ws"
|
||||||
],
|
],
|
||||||
"shortName": "beam-testnet",
|
"shortName": "beam-testnet",
|
||||||
"slug": "beam-testnet",
|
"slug": "beam-testnet",
|
||||||
|
|||||||
@@ -26,5 +26,6 @@ export default {
|
|||||||
"shortName": "hmy-s2",
|
"shortName": "hmy-s2",
|
||||||
"slip44": 1023,
|
"slip44": 1023,
|
||||||
"slug": "harmony-shard-2",
|
"slug": "harmony-shard-2",
|
||||||
|
"status": "deprecated",
|
||||||
"testnet": false
|
"testnet": false
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -26,5 +26,6 @@ export default {
|
|||||||
"shortName": "hmy-s3",
|
"shortName": "hmy-s3",
|
||||||
"slip44": 1023,
|
"slip44": 1023,
|
||||||
"slug": "harmony-shard-3",
|
"slug": "harmony-shard-3",
|
||||||
|
"status": "deprecated",
|
||||||
"testnet": false
|
"testnet": false
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "Roll",
|
||||||
|
"chainId": 1748,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "Blockscout",
|
||||||
|
"url": "https://roll.calderaexplorer.xyz/",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"features": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmSNKW3HsFekHrTdgt7aAukExwYeYzHZEbG49ZDLYRfkKV/roll_logo%20-%20Ellie%20Li.png",
|
||||||
|
"width": 3600,
|
||||||
|
"height": 3600,
|
||||||
|
"format": ".png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://tryroll.com/",
|
||||||
|
"name": "Roll Testnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Ether",
|
||||||
|
"symbol": "ETH",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 1748,
|
||||||
|
"redFlags": [],
|
||||||
|
"rpc": [],
|
||||||
|
"shortName": "Roll",
|
||||||
|
"slug": "roll-testnet",
|
||||||
|
"testnet": true,
|
||||||
|
"title": "Roll Testnet"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"chain": "okbchain",
|
"chain": "xgon",
|
||||||
"chainId": 195,
|
"chainId": 195,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
@@ -14,20 +14,20 @@ export default {
|
|||||||
],
|
],
|
||||||
"features": [],
|
"features": [],
|
||||||
"infoURL": "https://www.okx.com/okbc/docs/dev/quick-start/introduction/introduction-to-okbchain",
|
"infoURL": "https://www.okx.com/okbc/docs/dev/quick-start/introduction/introduction-to-okbchain",
|
||||||
"name": "OKBChain Testnet",
|
"name": "Xgon Testnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "OKBChain Global Utility Token in testnet",
|
"name": "Xgon Global Utility Token in testnet",
|
||||||
"symbol": "OKB",
|
"symbol": "OKB",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"networkId": 195,
|
"networkId": 195,
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://okbchain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://xgon-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://195.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://195.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://okbtestrpc.okbchain.org"
|
"https://testrpc.xgon.io"
|
||||||
],
|
],
|
||||||
"shortName": "tokb",
|
"shortName": "tokb",
|
||||||
"slug": "okbchain-testnet",
|
"slug": "xgon-testnet",
|
||||||
"status": "active",
|
"status": "active",
|
||||||
"testnet": true
|
"testnet": true
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"chain": "okbchain",
|
"chain": "xgon",
|
||||||
"chainId": 196,
|
"chainId": 196,
|
||||||
"explorers": [],
|
"explorers": [],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
"infoURL": "https://www.okex.com/okc",
|
"infoURL": "https://www.okx.com/okbc/docs/dev/quick-start/introduction/introduction-to-okbchain",
|
||||||
"name": "OKBChain Mainnet",
|
"name": "Xgon Mainnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "OKBChain Global Utility Token",
|
"name": "Xgon Global Utility Token",
|
||||||
"symbol": "OKB",
|
"symbol": "OKB",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"networkId": 196,
|
"networkId": 196,
|
||||||
"rpc": [],
|
"rpc": [],
|
||||||
"shortName": "okb",
|
"shortName": "okb",
|
||||||
"slug": "okbchain",
|
"slug": "xgon",
|
||||||
"status": "incubating",
|
"status": "incubating",
|
||||||
"testnet": false
|
"testnet": false
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "VinuChain Testnet",
|
||||||
|
"chainId": 206,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "VinuScan Testnet",
|
||||||
|
"url": "https://testnet.vinuscan.com",
|
||||||
|
"standard": "none",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreiayq7a5qncxzlilfnvpgzt4pwfxbof2qrqr2nyd2suztfummpty4i",
|
||||||
|
"width": 2000,
|
||||||
|
"height": 2000,
|
||||||
|
"format": "jpg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreidtie4srt52ry67wd3dpxhklmug2ozrawvf3jdlljveinp3frutra",
|
||||||
|
"width": 2000,
|
||||||
|
"height": 392,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://vitainu.org",
|
||||||
|
"name": "VinuChain Testnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "VinuChain",
|
||||||
|
"symbol": "VС",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 206,
|
||||||
|
"rpc": [
|
||||||
|
"https://vinuchain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://206.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://vinufoundation-rpc.com"
|
||||||
|
],
|
||||||
|
"shortName": "VCTEST",
|
||||||
|
"slug": "vinuchain-testnet",
|
||||||
|
"testnet": true
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -17,9 +17,9 @@ export default {
|
|||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://bafkreidtie4srt52ry67wd3dpxhklmug2ozrawvf3jdlljveinp3frutra",
|
"url": "ipfs://bafybeiderli6uaaxk7eboyf7g4abnybgrkbglmqbkmf25z57ode7zdzmvy",
|
||||||
"width": 2000,
|
"width": 613,
|
||||||
"height": 392,
|
"height": 613,
|
||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"infoURL": "https://vitainu.org",
|
"infoURL": "https://vitainu.org",
|
||||||
|
|||||||
@@ -34,10 +34,8 @@ export default {
|
|||||||
"https://kava.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://kava.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://2222.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://2222.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://evm.kava.io",
|
"https://evm.kava.io",
|
||||||
"https://evm2.kava.io",
|
|
||||||
"https://kava-rpc.gateway.pokt.network",
|
"https://kava-rpc.gateway.pokt.network",
|
||||||
"wss://wevm.kava.io",
|
"wss://wevm.kava.io",
|
||||||
"wss://wevm2.kava.io",
|
|
||||||
"https://kava-evm.publicnode.com",
|
"https://kava-evm.publicnode.com",
|
||||||
"wss://kava-evm.publicnode.com"
|
"wss://kava-evm.publicnode.com"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -10,11 +10,12 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
"features": [],
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://QmT84suD2ZmTSraJBfeHhTNst2vXctQijNCztok9XiVcUR",
|
"url": "ipfs://QmYcGHTPheBwLv9zoJfQAJ7NB6MCtXe2zV7XqPyiTJg3WP/Oasys_Large%20Logo%20Black.png",
|
||||||
"width": 3600,
|
"width": 1250,
|
||||||
"height": 3600,
|
"height": 1250,
|
||||||
"format": "png"
|
"format": ".png"
|
||||||
},
|
},
|
||||||
"infoURL": "https://oasys.games",
|
"infoURL": "https://oasys.games",
|
||||||
"name": "Oasys Mainnet",
|
"name": "Oasys Mainnet",
|
||||||
@@ -24,6 +25,7 @@ export default {
|
|||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"networkId": 248,
|
"networkId": 248,
|
||||||
|
"redFlags": [],
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://oasys.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://oasys.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://248.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://248.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "MCH Verse",
|
||||||
|
"chainId": 29548,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "MCH Verse Explorer",
|
||||||
|
"url": "https://explorer.oasys.mycryptoheroes.net",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmZZnwR1y6cU1sare2TQmwqkNDLXQxD4GdPrmHLmUoPtbU",
|
||||||
|
"width": 4000,
|
||||||
|
"height": 4000,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://www.mycryptoheroes.net/verse",
|
||||||
|
"name": "MCH Verse Mainnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "OAS",
|
||||||
|
"symbol": "OAS",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 29548,
|
||||||
|
"parent": {
|
||||||
|
"type": "L2",
|
||||||
|
"chain": "eip155-248"
|
||||||
|
},
|
||||||
|
"rpc": [
|
||||||
|
"https://mch-verse.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://29548.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc.oasys.mycryptoheroes.net"
|
||||||
|
],
|
||||||
|
"shortName": "MCHV",
|
||||||
|
"slug": "mch-verse",
|
||||||
|
"testnet": false
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "N3-Test",
|
||||||
|
"chainId": 333333,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "Nativ3 Test Explorer",
|
||||||
|
"url": "https://scantest.nativ3.network",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVzJDndPui6qBSeJWe5kMLA56C3KpVhqqqk9xvVKE1DGb",
|
||||||
|
"width": 256,
|
||||||
|
"height": 256,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://nativ3.network",
|
||||||
|
"name": "Nativ3 Testnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "USNT",
|
||||||
|
"symbol": "USNT",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 333333,
|
||||||
|
"parent": {
|
||||||
|
"type": "L2",
|
||||||
|
"chain": "eip155-421613",
|
||||||
|
"bridges": [
|
||||||
|
{
|
||||||
|
"url": "https://bridgetest.nativ3.network"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rpc": [
|
||||||
|
"https://nativ3-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://333333.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpctest.nativ3.network",
|
||||||
|
"wss://wstest.nativ3.network"
|
||||||
|
],
|
||||||
|
"shortName": "N3-Test",
|
||||||
|
"slug": "nativ3-testnet",
|
||||||
|
"testnet": true
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -1,24 +1,24 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"chain": "BTC",
|
"chain": "BOTANIX",
|
||||||
"chainId": 3636,
|
"chainId": 3636,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Botanix",
|
"name": "3xpl",
|
||||||
"url": "https://testnet.btxtestchain.com",
|
"url": "https://3xpl.com/botanix",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
"https://faucet.btxtestchain.com"
|
"https://faucet.botanixlabs.dev"
|
||||||
],
|
],
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://Qmf2iSjcrZwUDKhCVY9ZzfbSV2He2HSssbcG2yMz1mDerm",
|
"url": "ipfs://QmVE5s2pXiqdMnAcxhAmWkZYhpFB5CysypeLyPKzT4rGYe",
|
||||||
"width": 32,
|
"width": 512,
|
||||||
"height": 32,
|
"height": 512,
|
||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"infoURL": "https://btxtestchain.com",
|
"infoURL": "https://botanixlabs.xyz",
|
||||||
"name": "Botanix Testnet",
|
"name": "Botanix Testnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Botanix",
|
"name": "Botanix",
|
||||||
@@ -29,9 +29,9 @@ export default {
|
|||||||
"rpc": [
|
"rpc": [
|
||||||
"https://botanix-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://botanix-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://3636.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://3636.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://testnet-rpc.btxtestchain.com"
|
"https://node.botanixlabs.dev"
|
||||||
],
|
],
|
||||||
"shortName": "BTCt",
|
"shortName": "BTNX",
|
||||||
"slug": "botanix-testnet",
|
"slug": "botanix-testnet",
|
||||||
"testnet": true
|
"testnet": true
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -13,9 +13,9 @@ export default {
|
|||||||
"https://faucet.btxtestchain.com"
|
"https://faucet.btxtestchain.com"
|
||||||
],
|
],
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://Qmf2iSjcrZwUDKhCVY9ZzfbSV2He2HSssbcG2yMz1mDerm",
|
"url": "ipfs://QmVE5s2pXiqdMnAcxhAmWkZYhpFB5CysypeLyPKzT4rGYe",
|
||||||
"width": 32,
|
"width": 512,
|
||||||
"height": 32,
|
"height": 512,
|
||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"infoURL": "https://btxtestchain.com",
|
"infoURL": "https://btxtestchain.com",
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "Nativ3",
|
||||||
|
"chainId": 399,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "N3scan",
|
||||||
|
"url": "https://scan.nativ3.network",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVzJDndPui6qBSeJWe5kMLA56C3KpVhqqqk9xvVKE1DGb",
|
||||||
|
"width": 256,
|
||||||
|
"height": 256,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://nativ3.network",
|
||||||
|
"name": "Nativ3 Mainnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "USNT",
|
||||||
|
"symbol": "USNT",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 399,
|
||||||
|
"parent": {
|
||||||
|
"type": "L2",
|
||||||
|
"chain": "eip155-42161",
|
||||||
|
"bridges": [
|
||||||
|
{
|
||||||
|
"url": "https://bridge.nativ3.network"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rpc": [
|
||||||
|
"https://nativ3.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://399.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc.nativ3.network",
|
||||||
|
"wss://ws.nativ3.network"
|
||||||
|
],
|
||||||
|
"shortName": "N3",
|
||||||
|
"slug": "nativ3",
|
||||||
|
"testnet": false
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -9,7 +9,9 @@ export default {
|
|||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [
|
||||||
|
"https://faucet.onbeam.com"
|
||||||
|
],
|
||||||
"features": [
|
"features": [
|
||||||
{
|
{
|
||||||
"name": "EIP1559"
|
"name": "EIP1559"
|
||||||
@@ -24,15 +26,16 @@ export default {
|
|||||||
"infoURL": "https://www.onbeam.com",
|
"infoURL": "https://www.onbeam.com",
|
||||||
"name": "Beam",
|
"name": "Beam",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Merit Circle",
|
"name": "Beam",
|
||||||
"symbol": "MC",
|
"symbol": "BEAM",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
"networkId": 4337,
|
"networkId": 4337,
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://beam.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://beam.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://4337.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://4337.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://subnets.avax.network/beam/mainnet/rpc"
|
"https://subnets.avax.network/beam/mainnet/rpc",
|
||||||
|
"wss://subnets.avax.network/beam/mainnet/ws"
|
||||||
],
|
],
|
||||||
"shortName": "beam",
|
"shortName": "beam",
|
||||||
"slug": "beam",
|
"slug": "beam",
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "ETH",
|
||||||
|
"chainId": 5003,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://explorer.sepolia.mantle.xyz",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [
|
||||||
|
"https://faucet.sepolia.mantle.xyz"
|
||||||
|
],
|
||||||
|
"infoURL": "https://mantle.xyz",
|
||||||
|
"name": "Mantle Sepolia Testnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Sepolia Mantle",
|
||||||
|
"symbol": "MNT",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 5003,
|
||||||
|
"rpc": [
|
||||||
|
"https://mantle-sepolia-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://5003.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc.sepolia.mantle.xyz"
|
||||||
|
],
|
||||||
|
"shortName": "mnt-sep",
|
||||||
|
"slug": "mantle-sepolia-testnet",
|
||||||
|
"testnet": true
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "Electroneum",
|
||||||
|
"chainId": 52014,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://blockexplorer.electroneum.com",
|
||||||
|
"standard": "EIP3091",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVgFqXA3kkCrVYGcWFF7Mhx8JUSe9vSCauNamuKWSvCym",
|
||||||
|
"width": 1000,
|
||||||
|
"height": 1000,
|
||||||
|
"format": "png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVgFqXA3kkCrVYGcWFF7Mhx8JUSe9vSCauNamuKWSvCym",
|
||||||
|
"width": 1000,
|
||||||
|
"height": 1000,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://electroneum.com",
|
||||||
|
"name": "Electroneum Mainnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Electroneum",
|
||||||
|
"symbol": "ETN",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 52014,
|
||||||
|
"rpc": [
|
||||||
|
"https://electroneum.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://52014.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://api.electroneum.com"
|
||||||
|
],
|
||||||
|
"shortName": "etn-mainnet",
|
||||||
|
"slug": "electroneum",
|
||||||
|
"testnet": false
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "Electroneum",
|
||||||
|
"chainId": 5201420,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://blockexplorer.thesecurityteam.rocks",
|
||||||
|
"standard": "EIP3091",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVgFqXA3kkCrVYGcWFF7Mhx8JUSe9vSCauNamuKWSvCym",
|
||||||
|
"width": 1000,
|
||||||
|
"height": 1000,
|
||||||
|
"format": "png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmVgFqXA3kkCrVYGcWFF7Mhx8JUSe9vSCauNamuKWSvCym",
|
||||||
|
"width": 1000,
|
||||||
|
"height": 1000,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://electroneum.com",
|
||||||
|
"name": "Electroneum Testnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Electroneum",
|
||||||
|
"symbol": "ETN",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 5201420,
|
||||||
|
"rpc": [
|
||||||
|
"https://electroneum-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://5201420.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://api.electroneum.com"
|
||||||
|
],
|
||||||
|
"shortName": "etn-testnet",
|
||||||
|
"slug": "electroneum-testnet",
|
||||||
|
"testnet": true
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -25,8 +25,7 @@ export default {
|
|||||||
"https://570.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://570.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc.rollux.com",
|
"https://rpc.rollux.com",
|
||||||
"https://rollux.public-rpc.com",
|
"https://rollux.public-rpc.com",
|
||||||
"wss://rpc.rollux.com/wss",
|
"wss://rpc.rollux.com/wss"
|
||||||
"https://rpc.ankr.com/rollux/${ANKR_API_KEY}"
|
|
||||||
],
|
],
|
||||||
"shortName": "sys-rollux",
|
"shortName": "sys-rollux",
|
||||||
"slug": "rollux",
|
"slug": "rollux",
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ export default {
|
|||||||
"https://faucet.triangleplatform.com/frame"
|
"https://faucet.triangleplatform.com/frame"
|
||||||
],
|
],
|
||||||
"features": [],
|
"features": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmTS1P9sh49zg5xL5BUsRLWDz3vVoJCtCNf9yN1TTnsuQ3",
|
||||||
|
"width": 321,
|
||||||
|
"height": 320,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
"infoURL": "https://frame.xyz",
|
"infoURL": "https://frame.xyz",
|
||||||
"name": "Frame Testnet",
|
"name": "Frame Testnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "TWT",
|
||||||
|
"chainId": 894538,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "explorer",
|
||||||
|
"url": "https://subnets-test.avax.network/thirdweb",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"features": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmXDGoJKuuwQKzY1Y7ZhgULg8hcmveu6PVaDaYQzEjKwkQ/Thirdweb-Icon-Black-BG.png",
|
||||||
|
"width": 512,
|
||||||
|
"height": 512,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"name": "thirdweb test subnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "TWT",
|
||||||
|
"symbol": "TWT",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 894538,
|
||||||
|
"redFlags": [],
|
||||||
|
"rpc": [
|
||||||
|
"https://thirdweb-test-subnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://894538.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://subnets.avax.network/thirdweb/testnet/rpc"
|
||||||
|
],
|
||||||
|
"shortName": "twt",
|
||||||
|
"slug": "thirdweb-test-subnet",
|
||||||
|
"testnet": true
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "XCAP",
|
||||||
|
"chainId": 9322252,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://xcap-mainnet.explorer.xcap.network",
|
||||||
|
"standard": "EIP3091",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
|
||||||
|
"width": 551,
|
||||||
|
"height": 540,
|
||||||
|
"format": "png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmeTj6tfaw9qf9wnEUQh7PnCpNWyvm56e7kY35kANRWNxj",
|
||||||
|
"width": 1600,
|
||||||
|
"height": 1600,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://xcap.network/",
|
||||||
|
"name": "XCAP",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Gas",
|
||||||
|
"symbol": "GAS",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 9322252,
|
||||||
|
"rpc": [
|
||||||
|
"https://xcap.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://9322252.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://xcap-mainnet.relay.xcap.network/znzvh2ueyvm2yts5fv5gnul395jbkfb2/rpc1"
|
||||||
|
],
|
||||||
|
"shortName": "xcap",
|
||||||
|
"slug": "xcap",
|
||||||
|
"testnet": false,
|
||||||
|
"title": "XCAP Mainnet"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "XCAP",
|
||||||
|
"chainId": 9322253,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "blockscout",
|
||||||
|
"url": "https://xcap-milvine.explorer.xcap.network",
|
||||||
|
"standard": "EIP3091",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
|
||||||
|
"width": 551,
|
||||||
|
"height": 540,
|
||||||
|
"format": "png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmeTj6tfaw9qf9wnEUQh7PnCpNWyvm56e7kY35kANRWNxj",
|
||||||
|
"width": 1600,
|
||||||
|
"height": 1600,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://xcap.network/",
|
||||||
|
"name": "Milvine",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Gas",
|
||||||
|
"symbol": "GAS",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 9322253,
|
||||||
|
"rpc": [
|
||||||
|
"https://milvine.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://9322253.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://xcap-milvine.relay.xcap.network/zj5l55ftsgi027kz4nf14vs8d89inego/rpc1"
|
||||||
|
],
|
||||||
|
"shortName": "milv",
|
||||||
|
"slug": "milvine",
|
||||||
|
"testnet": true,
|
||||||
|
"title": "XCAP Testnet Milvine"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"chain": "Ecrox Chain",
|
||||||
|
"chainId": 988207,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "Ecrox Chain Explorer",
|
||||||
|
"url": "https://ecroxscan.com",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreibnqdlwgotu4hwx6oeu4ye3huobr3eaiuvv55n5tolyxya2q7edmq",
|
||||||
|
"width": 300,
|
||||||
|
"height": 300,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"infoURL": "https://ecroxcoin.io/",
|
||||||
|
"name": "Ecrox Chain Mainnet",
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "ECROX COIN",
|
||||||
|
"symbol": "ECROX",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"networkId": 988207,
|
||||||
|
"rpc": [
|
||||||
|
"https://ecrox-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://988207.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://mainnet-rpc.ecroxscan.com/"
|
||||||
|
],
|
||||||
|
"shortName": "ecrox",
|
||||||
|
"slug": "ecrox-chain",
|
||||||
|
"testnet": false
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/chains",
|
"name": "@thirdweb-dev/chains",
|
||||||
"version": "0.1.57",
|
"version": "0.1.58",
|
||||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,27 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.13.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1918](https://github.com/thirdweb-dev/js/pull/1918) [`95c9d56e`](https://github.com/thirdweb-dev/js/commit/95c9d56ea47ef57113679196efe8f9114c6fbb21) Thanks [@saminacodes](https://github.com/saminacodes)! - Fix url redirect for pre-built deploy command
|
||||||
|
|
||||||
|
- Updated dependencies [[`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b), [`05e52114`](https://github.com/thirdweb-dev/js/commit/05e52114bf4f0ee352f393ed20115a904a18c310), [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e), [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3), [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8), [`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.2
|
||||||
|
- @thirdweb-dev/auth@4.1.5
|
||||||
|
- @thirdweb-dev/storage@2.0.3
|
||||||
|
- @thirdweb-dev/sdk@4.0.12
|
||||||
|
|
||||||
|
## 0.13.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`0dcb15b7`](https://github.com/thirdweb-dev/js/commit/0dcb15b7e647acd038b0ec8b1a2b200808aae00e), [`fefeaeef`](https://github.com/thirdweb-dev/js/commit/fefeaeef18f52a75462c43da8b85a77975d32e01), [`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db), [`91c2352b`](https://github.com/thirdweb-dev/js/commit/91c2352b03d7cf1c3cbbbc98846f248b0f707ea7)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.58
|
||||||
|
- @thirdweb-dev/sdk@4.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.1.1
|
||||||
|
- @thirdweb-dev/auth@4.1.4
|
||||||
|
|
||||||
## 0.13.11
|
## 0.13.11
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "thirdweb",
|
"name": "thirdweb",
|
||||||
"main": "dist/cli/index.js",
|
"main": "dist/cli/index.js",
|
||||||
"version": "0.13.11",
|
"version": "0.13.13",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function generateDashboardUrl(
|
|||||||
const foundMapping = mapping[name as keyof typeof mapping];
|
const foundMapping = mapping[name as keyof typeof mapping];
|
||||||
|
|
||||||
return foundMapping
|
return foundMapping
|
||||||
? `https://thirdweb.com/dashboard/${foundMapping}`
|
? `https://thirdweb.com/thirdweb.eth/${foundMapping}`
|
||||||
: undefined;
|
: undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ["thirdweb"],
|
extends: ["thirdweb"],
|
||||||
plugins: ["better-tree-shaking"],
|
plugins: ["better-tree-shaking", "eslint-plugin-tsdoc"],
|
||||||
rules: {
|
rules: {
|
||||||
|
"tsdoc/syntax": "warn",
|
||||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 4.1.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1943](https://github.com/thirdweb-dev/js/pull/1943) [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3) Thanks [@iketw](https://github.com/iketw)! - Adds tsdoc warnings to enforce a common comments format
|
||||||
|
|
||||||
|
- [#1929](https://github.com/thirdweb-dev/js/pull/1929) [`06e59cf9`](https://github.com/thirdweb-dev/js/commit/06e59cf91647e4080829d49f8cb91a4d8fdc87f7) Thanks [@iketw](https://github.com/iketw)! - Move addresses' utils to the core package
|
||||||
|
|
||||||
|
- Updated dependencies [[`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b), [`05e52114`](https://github.com/thirdweb-dev/js/commit/05e52114bf4f0ee352f393ed20115a904a18c310), [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e), [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3), [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8), [`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.2
|
||||||
|
- @thirdweb-dev/auth@4.1.5
|
||||||
|
- @thirdweb-dev/storage@2.0.3
|
||||||
|
- @thirdweb-dev/sdk@4.0.12
|
||||||
|
|
||||||
|
## 4.1.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`0dcb15b7`](https://github.com/thirdweb-dev/js/commit/0dcb15b7e647acd038b0ec8b1a2b200808aae00e), [`fefeaeef`](https://github.com/thirdweb-dev/js/commit/fefeaeef18f52a75462c43da8b85a77975d32e01), [`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db), [`91c2352b`](https://github.com/thirdweb-dev/js/commit/91c2352b03d7cf1c3cbbbc98846f248b0f707ea7)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.58
|
||||||
|
- @thirdweb-dev/sdk@4.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.1.1
|
||||||
|
- @thirdweb-dev/auth@4.1.4
|
||||||
|
|
||||||
## 4.1.1
|
## 4.1.1
|
||||||
|
|
||||||
## 4.1.0
|
## 4.1.0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "4.1.1",
|
"version": "4.1.3",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import invariant from "tiny-invariant";
|
|||||||
import type {
|
import type {
|
||||||
BloctoWallet,
|
BloctoWallet,
|
||||||
CoinbaseWallet,
|
CoinbaseWallet,
|
||||||
|
CoreWallet,
|
||||||
EmbeddedWallet,
|
EmbeddedWallet,
|
||||||
FrameWallet,
|
FrameWallet,
|
||||||
LocalWallet,
|
LocalWallet,
|
||||||
@@ -26,6 +27,7 @@ export type WalletId = (typeof walletIds)[keyof typeof walletIds];
|
|||||||
type WalletIdToWalletTypeMap = {
|
type WalletIdToWalletTypeMap = {
|
||||||
metamask: MetaMaskWallet;
|
metamask: MetaMaskWallet;
|
||||||
coinbase: CoinbaseWallet;
|
coinbase: CoinbaseWallet;
|
||||||
|
coreWallet: CoreWallet;
|
||||||
rainbowWallet: RainbowWallet;
|
rainbowWallet: RainbowWallet;
|
||||||
blocto: BloctoWallet;
|
blocto: BloctoWallet;
|
||||||
frame: FrameWallet;
|
frame: FrameWallet;
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ export type WalletConfig<I extends WalletInstance = WalletInstance> = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* If true, this wallet will be tagged as "recommended" in ConnectWallet Modal and will be shown at the top of the list
|
* If true, this wallet will be tagged as "recommended" in ConnectWallet Modal and will be shown at the top of the list
|
||||||
* @default false
|
* @defaultValue false
|
||||||
*/
|
*/
|
||||||
recommended?: boolean;
|
recommended?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the wallet can sign transactions without user interaction, set this to true.
|
* If the wallet can sign transactions without user interaction, set this to true.
|
||||||
* @default false
|
* @defaultValue false
|
||||||
*/
|
*/
|
||||||
isHeadless?: boolean;
|
isHeadless?: boolean;
|
||||||
};
|
};
|
||||||
@@ -154,7 +154,7 @@ export type ConnectUIProps<I extends WalletInstance = WalletInstance> = {
|
|||||||
/**
|
/**
|
||||||
* Called when the wallet is connected but it's
|
* Called when the wallet is connected but it's
|
||||||
* part of another wallet's connection flow.
|
* part of another wallet's connection flow.
|
||||||
* @param walleInstance the instance of the connected wallet
|
* @param walleInstance - the instance of the connected wallet
|
||||||
*/
|
*/
|
||||||
onLocallyConnected?: (walleInstance: WalletInstance) => void;
|
onLocallyConnected?: (walleInstance: WalletInstance) => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import { constants, utils } from "ethers";
|
|||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The options to be passed as the second parameter to the {@link useClaimIneligibilityReasons}` hook.
|
* The options to be passed as the second parameter to the {@link useClaimIneligibilityReasons} hook.
|
||||||
*
|
*
|
||||||
* @beta
|
* @beta
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -718,7 +718,7 @@ export function useBurnNFT<TContract extends NFTContract>(
|
|||||||
/**
|
/**
|
||||||
* Set shared metadata
|
* Set shared metadata
|
||||||
* TODO add docs
|
* TODO add docs
|
||||||
* @private
|
* @internal
|
||||||
*/
|
*/
|
||||||
export function useSetSharedMetadata<TContract extends NFTContract>(
|
export function useSetSharedMetadata<TContract extends NFTContract>(
|
||||||
contract: RequiredParam<TContract>,
|
contract: RequiredParam<TContract>,
|
||||||
|
|||||||
@@ -257,6 +257,13 @@ export type { ThirdwebSDKProviderProps } from "./providers/types";
|
|||||||
|
|
||||||
// utils
|
// utils
|
||||||
export { invalidateContractAndBalances } from "./utils/cache-keys";
|
export { invalidateContractAndBalances } from "./utils/cache-keys";
|
||||||
|
export {
|
||||||
|
isEnsName,
|
||||||
|
isPossibleEVMAddress,
|
||||||
|
shortenAddress,
|
||||||
|
shortenIfAddress,
|
||||||
|
shortenString,
|
||||||
|
} from "./utils/addresses";
|
||||||
|
|
||||||
// types
|
// types
|
||||||
export type {
|
export type {
|
||||||
|
|||||||
@@ -1,12 +1,33 @@
|
|||||||
import { utils } from "ethers";
|
import { utils } from "ethers";
|
||||||
|
|
||||||
export function shortenString(str: string, extraShort?: true) {
|
export function shortenString(str: string, extraShort: boolean = true) {
|
||||||
return `${str.substring(0, extraShort ? 4 : 6)}...${str.substring(
|
return `${str.substring(0, extraShort ? 4 : 6)}...${str.substring(
|
||||||
str.length - (extraShort ? 3 : 4),
|
str.length - (extraShort ? 3 : 4),
|
||||||
)}`;
|
)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function shortenAddress(address: string, extraShort?: true): string {
|
/**
|
||||||
|
* This function shortens an address if it is a valid EVM address.
|
||||||
|
*
|
||||||
|
* @param address - The address to shorten
|
||||||
|
* @param extraShort - If true, show the first 4 and last 3 characters
|
||||||
|
* @returns The shortened address
|
||||||
|
*
|
||||||
|
* @remarks
|
||||||
|
* Note that this function will not check if the address is an ENS.
|
||||||
|
*
|
||||||
|
* @example Calling shortenAddress with extraShort set to true
|
||||||
|
* ```ts
|
||||||
|
* const address = shortenIfAddress("0x1234567890123456789012345678901234567890", true); // result will be "0x1234...890"
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
export function shortenAddress(
|
||||||
|
address?: string,
|
||||||
|
extraShort: boolean = true,
|
||||||
|
): string {
|
||||||
|
if (!address) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const formattedAddress = utils.getAddress(address);
|
const formattedAddress = utils.getAddress(address);
|
||||||
return shortenString(formattedAddress, extraShort);
|
return shortenString(formattedAddress, extraShort);
|
||||||
@@ -17,10 +38,24 @@ export function shortenAddress(address: string, extraShort?: true): string {
|
|||||||
|
|
||||||
export function shortenIfAddress(
|
export function shortenIfAddress(
|
||||||
address?: string | null | false,
|
address?: string | null | false,
|
||||||
extraShort?: true,
|
extraShort: boolean = true,
|
||||||
): string {
|
): string {
|
||||||
if (typeof address === "string" && address.length > 0) {
|
if (address && utils.isAddress(address)) {
|
||||||
return shortenAddress(address, extraShort);
|
return shortenAddress(address, extraShort);
|
||||||
}
|
}
|
||||||
return address || "";
|
return address || "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isEnsName(name: string): boolean {
|
||||||
|
return name?.endsWith(".eth");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isPossibleEVMAddress(address?: string, ignoreEns?: boolean) {
|
||||||
|
if (!address) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (isEnsName(address) && !ignoreEns) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return utils.isAddress(address);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.4.3
|
||||||
|
|
||||||
|
## 0.4.2
|
||||||
|
|
||||||
## 0.4.1
|
## 0.4.1
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native-compat",
|
"name": "@thirdweb-dev/react-native-compat",
|
||||||
"description": "Shims for Thirdweb in React Native Projects",
|
"description": "Shims for Thirdweb in React Native Projects",
|
||||||
"version": "0.4.1",
|
"version": "0.4.3",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ["thirdweb"],
|
extends: ["thirdweb"],
|
||||||
plugins: ["i18next"],
|
plugins: ["i18next", "eslint-plugin-tsdoc"],
|
||||||
rules: {
|
rules: {
|
||||||
|
"tsdoc/syntax": "warn",
|
||||||
"i18next/no-literal-string": 2,
|
"i18next/no-literal-string": 2,
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
|
|||||||
@@ -1,5 +1,112 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.4.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1908](https://github.com/thirdweb-dev/js/pull/1908) [`18552f3a`](https://github.com/thirdweb-dev/js/commit/18552f3a225d1c46f0ff19c2b1c9cc44f84e33ac) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add `hideSwitchToPersonalWallet` prop on `ConnectWallet` component to hide the "Switch to Personal wallet" option in the ConnectWallet modal which is shown when wallet is connected as a Smart Wallet
|
||||||
|
|
||||||
|
- [#1912](https://github.com/thirdweb-dev/js/pull/1912) [`1a421d3b`](https://github.com/thirdweb-dev/js/commit/1a421d3b5d837eade5b7344118a7148ddea35517) Thanks [@iketw](https://github.com/iketw)! - Adds Apple as a social sign in option for EmbeddedWallet
|
||||||
|
|
||||||
|
You can now do:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
embeddedWallet({
|
||||||
|
auth: {
|
||||||
|
options: ['apple'],
|
||||||
|
redirectUrl: 'your-apps-redirect-url://',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1943](https://github.com/thirdweb-dev/js/pull/1943) [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3) Thanks [@iketw](https://github.com/iketw)! - Adds tsdoc warnings to enforce a common comments format
|
||||||
|
|
||||||
|
- [#1929](https://github.com/thirdweb-dev/js/pull/1929) [`06e59cf9`](https://github.com/thirdweb-dev/js/commit/06e59cf91647e4080829d49f8cb91a4d8fdc87f7) Thanks [@iketw](https://github.com/iketw)! - Move addresses' utils to the core package
|
||||||
|
|
||||||
|
- [#1925](https://github.com/thirdweb-dev/js/pull/1925) [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8) Thanks [@iketw](https://github.com/iketw)! - [RN] Adds walletConnectReceiver prop to EmbeddedWallet and SmartWallet
|
||||||
|
|
||||||
|
You can pass your own WalletConnect projectId and metadata (highly recommended):
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
embeddedWallet({
|
||||||
|
auth: {
|
||||||
|
options: ['email', 'google'],
|
||||||
|
redirectUrl: 'redirect-url',
|
||||||
|
},
|
||||||
|
walletConnectReceiver: {
|
||||||
|
walletConnectWalletMetadata?: WCMetadata;
|
||||||
|
walletConnectV2ProjectId?: string;
|
||||||
|
walletConnectV2RelayUrl?: string;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
|
smartWallet(localWallet(), {
|
||||||
|
factoryAddress: 'factory-address',
|
||||||
|
gasless: true,
|
||||||
|
walletConnectReceiver: {
|
||||||
|
walletConnectWalletMetadata?: WCMetadata;
|
||||||
|
walletConnectV2ProjectId?: string;
|
||||||
|
walletConnectV2RelayUrl?: string;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
```
|
||||||
|
|
||||||
|
You can just pass `true` to the prop and these props will default to our internal WalletConnect projectId and metadata.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
embeddedWallet({
|
||||||
|
auth: {
|
||||||
|
options: ['email', 'google'],
|
||||||
|
redirectUrl: 'redirect-url',
|
||||||
|
},
|
||||||
|
walletConnectReceiver: true
|
||||||
|
}),
|
||||||
|
|
||||||
|
smartWallet(localWallet(), {
|
||||||
|
factoryAddress: 'factory-address',
|
||||||
|
gasless: true,
|
||||||
|
walletConnectReceiver: true
|
||||||
|
}),
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1942](https://github.com/thirdweb-dev/js/pull/1942) [`6de3a19b`](https://github.com/thirdweb-dev/js/commit/6de3a19b86476cf5f7d67223a366379c4fdb9b74) Thanks [@iketw](https://github.com/iketw)! - Updated react-native-safe-area-context to 4.74
|
||||||
|
|
||||||
|
- Updated dependencies [[`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b), [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e), [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3), [`06e59cf9`](https://github.com/thirdweb-dev/js/commit/06e59cf91647e4080829d49f8cb91a4d8fdc87f7), [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8), [`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b)]:
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
|
||||||
|
## 0.4.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1893](https://github.com/thirdweb-dev/js/pull/1893) [`8e104b44`](https://github.com/thirdweb-dev/js/commit/8e104b443e4a11908be660656c525ad237115835) Thanks [@iketw](https://github.com/iketw)! - Updates Japanese translations
|
||||||
|
|
||||||
|
- [#1893](https://github.com/thirdweb-dev/js/pull/1893) [`8e104b44`](https://github.com/thirdweb-dev/js/commit/8e104b443e4a11908be660656c525ad237115835) Thanks [@iketw](https://github.com/iketw)! - Adds support for Japanese and Spanish
|
||||||
|
|
||||||
|
You can now pass 'ja' or 'es' to our ThirdwebProvider:
|
||||||
|
|
||||||
|
```
|
||||||
|
import { ThirdwebProvider } from '@thirdweb-dev/react-native';
|
||||||
|
|
||||||
|
<ThirdwebProvider locale={'ja'}>
|
||||||
|
<App />
|
||||||
|
</ ThirdwebProvider>
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1892](https://github.com/thirdweb-dev/js/pull/1892) [`59e55410`](https://github.com/thirdweb-dev/js/commit/59e55410942f3cb08570623f990487868aaed107) Thanks [@iketw](https://github.com/iketw)! - Deprecates magicLink in favor of embedded wallet
|
||||||
|
|
||||||
|
- [#1900](https://github.com/thirdweb-dev/js/pull/1900) [`9f454d1e`](https://github.com/thirdweb-dev/js/commit/9f454d1e08ebf5280a3266791d1843ddd7e24242) Thanks [@iketw](https://github.com/iketw)! - Export Locale types and improve modal title customization
|
||||||
|
|
||||||
|
- [#1909](https://github.com/thirdweb-dev/js/pull/1909) [`ba49a824`](https://github.com/thirdweb-dev/js/commit/ba49a82463487735dc19bf33ab2f7a3e9cce08ac) Thanks [@iketw](https://github.com/iketw)! - UI improvements
|
||||||
|
|
||||||
|
- Updated dependencies [[`0dcb15b7`](https://github.com/thirdweb-dev/js/commit/0dcb15b7e647acd038b0ec8b1a2b200808aae00e), [`fefeaeef`](https://github.com/thirdweb-dev/js/commit/fefeaeef18f52a75462c43da8b85a77975d32e01), [`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db), [`91c2352b`](https://github.com/thirdweb-dev/js/commit/91c2352b03d7cf1c3cbbbc98846f248b0f707ea7)]:
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
|
||||||
## 0.4.1
|
## 0.4.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.4.1",
|
"version": "0.4.3",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
@@ -70,6 +70,7 @@
|
|||||||
"eslint-plugin-import": "^2.26.0",
|
"eslint-plugin-import": "^2.26.0",
|
||||||
"eslint-plugin-inclusive-language": "^2.2.0",
|
"eslint-plugin-inclusive-language": "^2.2.0",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
|
"eslint-plugin-tsdoc": "^0.2.16",
|
||||||
"ethers": "^5.7.2",
|
"ethers": "^5.7.2",
|
||||||
"expo": "^47.0.14",
|
"expo": "^47.0.14",
|
||||||
"jest": "^29.6.2",
|
"jest": "^29.6.2",
|
||||||
@@ -79,7 +80,7 @@
|
|||||||
"react-native-camera": "^4.2.1",
|
"react-native-camera": "^4.2.1",
|
||||||
"react-native-device-info": "10.6.0",
|
"react-native-device-info": "10.6.0",
|
||||||
"react-native-mmkv": "2.5.1",
|
"react-native-mmkv": "2.5.1",
|
||||||
"react-native-safe-area-context": "4.5.3",
|
"react-native-safe-area-context": "4.7.4",
|
||||||
"react-native-webview": "12.1.0",
|
"react-native-webview": "12.1.0",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"typedoc": "^0.25.2",
|
"typedoc": "^0.25.2",
|
||||||
@@ -93,7 +94,7 @@
|
|||||||
"react-native-inappbrowser-reborn": "^3.7.0",
|
"react-native-inappbrowser-reborn": "^3.7.0",
|
||||||
"react-native-quick-base64": "^2.0.7",
|
"react-native-quick-base64": "^2.0.7",
|
||||||
"react-native-quick-crypto": "^0.6.1",
|
"react-native-quick-crypto": "^0.6.1",
|
||||||
"react-native-safe-area-context": "4.5.3",
|
"react-native-safe-area-context": "4.7.4",
|
||||||
"react-native-webview": "12.1.0"
|
"react-native-webview": "12.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export class noopStorage implements IAsyncStorage {
|
|||||||
/**
|
/**
|
||||||
* Returns a new instance of AsyncLocalStorage
|
* Returns a new instance of AsyncLocalStorage
|
||||||
*
|
*
|
||||||
* @param name Name to namespace the storage with
|
* @param name - Name to namespace the storage with
|
||||||
* @returns A new instance of AsyncLocalStorage
|
* @returns A new instance of AsyncLocalStorage
|
||||||
*/
|
*/
|
||||||
export function createAsyncLocalStorage(name: string) {
|
export function createAsyncLocalStorage(name: string) {
|
||||||
@@ -83,7 +83,7 @@ export function createAsyncLocalStorage(name: string) {
|
|||||||
/**
|
/**
|
||||||
* Returns a new instance of LocalStorage
|
* Returns a new instance of LocalStorage
|
||||||
*
|
*
|
||||||
* @param name Name to namespace the storage with
|
* @param name - Name to namespace the storage with
|
||||||
* @returns A new instance of LocalStorage
|
* @returns A new instance of LocalStorage
|
||||||
*/
|
*/
|
||||||
export function createSyncStorage(name: string) {
|
export function createSyncStorage(name: string) {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export class SecureStorage implements ISecureStorage {
|
|||||||
/**
|
/**
|
||||||
* Returns a new instance of SecureStorage implemented by Expo SecureStore
|
* Returns a new instance of SecureStorage implemented by Expo SecureStore
|
||||||
*
|
*
|
||||||
* @param name Name to namespace the storage with
|
* @param name - Name to namespace the storage with
|
||||||
* @returns A new instance of SecureStorage
|
* @returns A new instance of SecureStorage
|
||||||
*/
|
*/
|
||||||
export function createSecureStorage(name: string) {
|
export function createSecureStorage(name: string) {
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
export const APPLE_ICON = `<svg fill="#959CA0" height="40px" width="40px" version="1.1" id="Capa_1" viewBox="0 0 24 24" xml:space="preserve" stroke="#959CA0"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <path d="M15.769,0c0.053,0,0.106,0,0.162,0c0.13,1.606-0.483,2.806-1.228,3.675c-0.731,0.863-1.732,1.7-3.351,1.573 c-0.108-1.583,0.506-2.694,1.25-3.561C13.292,0.879,14.557,0.16,15.769,0z"></path> <path d="M20.67,16.716c0,0.016,0,0.03,0,0.045c-0.455,1.378-1.104,2.559-1.896,3.655c-0.723,0.995-1.609,2.334-3.191,2.334 c-1.367,0-2.275-0.879-3.676-0.903c-1.482-0.024-2.297,0.735-3.652,0.926c-0.155,0-0.31,0-0.462,0 c-0.995-0.144-1.798-0.932-2.383-1.642c-1.725-2.098-3.058-4.808-3.306-8.276c0-0.34,0-0.679,0-1.019 c0.105-2.482,1.311-4.5,2.914-5.478c0.846-0.52,2.009-0.963,3.304-0.765c0.555,0.086,1.122,0.276,1.619,0.464 c0.471,0.181,1.06,0.502,1.618,0.485c0.378-0.011,0.754-0.208,1.135-0.347c1.116-0.403,2.21-0.865,3.652-0.648 c1.733,0.262,2.963,1.032,3.723,2.22c-1.466,0.933-2.625,2.339-2.427,4.74C17.818,14.688,19.086,15.964,20.67,16.716z"></path> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </g> </g></svg>`;
|
||||||
|
|
||||||
|
export const FACEBOOK_ICON = `<svg xml:space="preserve" viewBox="0 0 40 40">
|
||||||
|
<linearGradient id="a" x1="-277.375" x2="-277.375" y1="406.6018" y2="407.5726" gradientTransform="matrix(40 0 0 -39.7778 11115.001 16212.334)" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" stop-color="#0062e0"/>
|
||||||
|
<stop offset="1" stop-color="#19afff"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path fill="url(#a)" d="M16.7 39.8C7.2 38.1 0 29.9 0 20 0 9 9 0 20 0s20 9 20 20c0 9.9-7.2 18.1-16.7 19.8l-1.1-.9h-4.4l-1.1.9z"/>
|
||||||
|
<path fill="#fff" d="m27.8 25.6.9-5.6h-5.3v-3.9c0-1.6.6-2.8 3-2.8H29V8.2c-1.4-.2-3-.4-4.4-.4-4.6 0-7.8 2.8-7.8 7.8V20h-5v5.6h5v14.1c1.1.2 2.2.3 3.3.3 1.1 0 2.2-.1 3.3-.3V25.6h4.4z"/>
|
||||||
|
</svg>`;
|
||||||
|
|
||||||
export const GOOGLE_ICON = `<svg height={height} viewBox="0 0 24 24" width={width}>
|
export const GOOGLE_ICON = `<svg height={height} viewBox="0 0 24 24" width={width}>
|
||||||
<path
|
<path
|
||||||
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import { ConnectWalletButton } from "./ConnectWalletFlow/ConnectWalletButton";
|
|||||||
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
|
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
|
||||||
import BaseButton from "./base/BaseButton";
|
import BaseButton from "./base/BaseButton";
|
||||||
import Text from "./base/Text";
|
import Text from "./base/Text";
|
||||||
import { useLocale, useUIContext } from "../providers/ui-context-provider";
|
import {
|
||||||
|
useGlobalTheme,
|
||||||
|
useLocale,
|
||||||
|
useUIContext,
|
||||||
|
} from "../providers/ui-context-provider";
|
||||||
import { ThemeProvider } from "../styles/ThemeProvider";
|
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||||
import { SupportedTokens, defaultTokens } from "./SendFunds/defaultTokens";
|
import { SupportedTokens, defaultTokens } from "./SendFunds/defaultTokens";
|
||||||
|
|
||||||
@@ -32,7 +36,7 @@ export type ConnectWalletProps = {
|
|||||||
/**
|
/**
|
||||||
* Hide option to request testnet funds for testnets in dropdown
|
* Hide option to request testnet funds for testnets in dropdown
|
||||||
*
|
*
|
||||||
* @default false
|
* @defaultValue false
|
||||||
*/
|
*/
|
||||||
hideTestnetFaucet?: boolean;
|
hideTestnetFaucet?: boolean;
|
||||||
|
|
||||||
@@ -43,7 +47,7 @@ export type ConnectWalletProps = {
|
|||||||
* Please, note that if you support multiple networks in your app this prop should
|
* Please, note that if you support multiple networks in your app this prop should
|
||||||
* be set to `false` to allow users to switch between networks.
|
* be set to `false` to allow users to switch between networks.
|
||||||
*
|
*
|
||||||
* @default false
|
* @defaultValue false
|
||||||
*/
|
*/
|
||||||
switchToActiveChain?: boolean;
|
switchToActiveChain?: boolean;
|
||||||
|
|
||||||
@@ -65,6 +69,13 @@ export type ConnectWalletProps = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
displayBalanceToken?: Record<number, string>;
|
displayBalanceToken?: Record<number, string>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hide the "switch to Personal wallet" option in the wallet modal which is shown when wallet is connected to a Smart Wallet
|
||||||
|
*
|
||||||
|
* @defaultValue false
|
||||||
|
*/
|
||||||
|
hideSwitchToPersonalWallet?: boolean;
|
||||||
} & ConnectWalletButtonProps;
|
} & ConnectWalletButtonProps;
|
||||||
|
|
||||||
export const ConnectWallet = ({
|
export const ConnectWallet = ({
|
||||||
@@ -80,7 +91,9 @@ export const ConnectWallet = ({
|
|||||||
termsOfServiceUrl,
|
termsOfServiceUrl,
|
||||||
privacyPolicyUrl,
|
privacyPolicyUrl,
|
||||||
supportedTokens,
|
supportedTokens,
|
||||||
|
hideSwitchToPersonalWallet,
|
||||||
}: ConnectWalletProps) => {
|
}: ConnectWalletProps) => {
|
||||||
|
const globalTheme = useGlobalTheme();
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||||
const address = useAddress();
|
const address = useAddress();
|
||||||
@@ -140,7 +153,10 @@ export const ConnectWallet = ({
|
|||||||
style={styles.connectWalletButton}
|
style={styles.connectWalletButton}
|
||||||
>
|
>
|
||||||
{switching ? (
|
{switching ? (
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
<ActivityIndicator
|
||||||
|
size="small"
|
||||||
|
color={globalTheme.colors.buttonTextColor}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodyLarge" color="buttonTextColor">
|
<Text variant="bodyLarge" color="buttonTextColor">
|
||||||
{l.common.switch_network}
|
{l.common.switch_network}
|
||||||
@@ -155,6 +171,7 @@ export const ConnectWallet = ({
|
|||||||
hideTestnetFaucet={hideTestnetFaucet}
|
hideTestnetFaucet={hideTestnetFaucet}
|
||||||
supportedTokens={supportedTokensMemo}
|
supportedTokens={supportedTokensMemo}
|
||||||
displayBalanceToken={displayBalanceToken}
|
displayBalanceToken={displayBalanceToken}
|
||||||
|
hideSwitchToPersonalWallet={hideSwitchToPersonalWallet}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { useWallet } from "@thirdweb-dev/react-core";
|
import { useWallet } from "@thirdweb-dev/react-core";
|
||||||
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
@@ -14,8 +13,13 @@ import WalletConnectIcon from "../../assets/wallet-connect";
|
|||||||
import QrCodeIcon from "../../assets/qr-code";
|
import QrCodeIcon from "../../assets/qr-code";
|
||||||
import { QRCodeScan } from "./QRCodeScan";
|
import { QRCodeScan } from "./QRCodeScan";
|
||||||
import { useLocale } from "../../providers/ui-context-provider";
|
import { useLocale } from "../../providers/ui-context-provider";
|
||||||
|
import { useWalletConnectHandler } from "../../providers/context-provider";
|
||||||
|
|
||||||
const ConnectAppField = () => {
|
const ConnectAppField = ({
|
||||||
|
onConnectAppTriggered,
|
||||||
|
}: {
|
||||||
|
onConnectAppTriggered?: () => void;
|
||||||
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const [showWCInput, setShowWCInput] = useState(false);
|
const [showWCInput, setShowWCInput] = useState(false);
|
||||||
@@ -24,22 +28,19 @@ const ConnectAppField = () => {
|
|||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const [showQRCodeScan, setShowQRCodeScan] = useState(false);
|
const [showQRCodeScan, setShowQRCodeScan] = useState(false);
|
||||||
const wcUriRef = useRef<string | undefined>();
|
const wcUriRef = useRef<string | undefined>();
|
||||||
|
const walletConnectHandler = useWalletConnectHandler();
|
||||||
|
|
||||||
const getAppMeta = useCallback(() => {
|
const getAppMeta = useCallback(() => {
|
||||||
if (wallet && "isWCReceiverEnabled" in wallet) {
|
const sessions = walletConnectHandler?.getActiveSessions();
|
||||||
const sessions = (
|
if (sessions && Object.keys(sessions).length > 0) {
|
||||||
wallet as unknown as IWalletConnectReceiver
|
setAppMeta({
|
||||||
).getActiveSessions();
|
name: sessions[0].peer.metadata.name,
|
||||||
if (Object.keys(sessions).length > 0) {
|
iconUrl: sessions[0].peer.metadata.icons[0],
|
||||||
setAppMeta({
|
});
|
||||||
name: sessions[0].peer.metadata.name,
|
|
||||||
iconUrl: sessions[0].peer.metadata.icons[0],
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, [wallet]);
|
}, [walletConnectHandler]);
|
||||||
|
|
||||||
const onSmartWalletWCMessage = useCallback(
|
const onWalletConnectMessage = useCallback(
|
||||||
({ type }: { type: string }) => {
|
({ type }: { type: string }) => {
|
||||||
if (type === "session_approved") {
|
if (type === "session_approved") {
|
||||||
getAppMeta();
|
getAppMeta();
|
||||||
@@ -52,22 +53,22 @@ const ConnectAppField = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
wallet.addListener("message", onSmartWalletWCMessage);
|
wallet.addListener("message", onWalletConnectMessage);
|
||||||
|
|
||||||
getAppMeta();
|
getAppMeta();
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (wallet) {
|
if (wallet) {
|
||||||
wallet.removeListener("message", onSmartWalletWCMessage);
|
wallet.removeListener("message", onWalletConnectMessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [getAppMeta, onSmartWalletWCMessage, wallet]);
|
}, [getAppMeta, onWalletConnectMessage, wallet]);
|
||||||
|
|
||||||
const onConnectDappPress = () => {
|
const onConnectDappPress = () => {
|
||||||
if (appMeta) {
|
if (appMeta) {
|
||||||
reset();
|
reset();
|
||||||
(wallet as unknown as IWalletConnectReceiver).disconnectSession();
|
walletConnectHandler?.disconnectSession();
|
||||||
} else {
|
} else {
|
||||||
setShowWCInput(true);
|
setShowWCInput(true);
|
||||||
}
|
}
|
||||||
@@ -84,9 +85,9 @@ const ConnectAppField = () => {
|
|||||||
|
|
||||||
const onQRCodeScan = (data: string) => {
|
const onQRCodeScan = (data: string) => {
|
||||||
if (wcUriRef.current !== data && data.startsWith("wc:")) {
|
if (wcUriRef.current !== data && data.startsWith("wc:")) {
|
||||||
|
wcUriRef.current = data;
|
||||||
setWCUri(data);
|
setWCUri(data);
|
||||||
setShowQRCodeScan(false);
|
setShowQRCodeScan(false);
|
||||||
wcUriRef.current = data;
|
|
||||||
|
|
||||||
onWCPress(data);
|
onWCPress(data);
|
||||||
}
|
}
|
||||||
@@ -103,10 +104,14 @@ const ConnectAppField = () => {
|
|||||||
|
|
||||||
const uriToUse = uri || wcUri;
|
const uriToUse = uri || wcUri;
|
||||||
|
|
||||||
if (uriToUse?.startsWith("wc:")) {
|
if (!uriToUse?.startsWith("wc:")) {
|
||||||
(wallet as unknown as IWalletConnectReceiver).connectApp(uriToUse);
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onConnectAppTriggered?.();
|
||||||
|
|
||||||
|
walletConnectHandler?.connectApp(uriToUse);
|
||||||
|
|
||||||
setWCUri(undefined);
|
setWCUri(undefined);
|
||||||
wcUriRef.current = undefined;
|
wcUriRef.current = undefined;
|
||||||
};
|
};
|
||||||
@@ -135,6 +140,7 @@ const ConnectAppField = () => {
|
|||||||
style: {
|
style: {
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
fontFamily: theme.textVariants.defaults.fontFamily,
|
fontFamily: theme.textVariants.defaults.fontFamily,
|
||||||
|
flex: 1,
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
containerProps={{
|
containerProps={{
|
||||||
|
|||||||
+16
-4
@@ -30,6 +30,8 @@ import { SupportedTokens } from "../SendFunds/defaultTokens";
|
|||||||
import { ActiveDot } from "../base";
|
import { ActiveDot } from "../base";
|
||||||
import { EmbeddedWallet } from "../../wallets/wallets/embedded/EmbeddedWallet";
|
import { EmbeddedWallet } from "../../wallets/wallets/embedded/EmbeddedWallet";
|
||||||
import { useLocale } from "../../providers/ui-context-provider";
|
import { useLocale } from "../../providers/ui-context-provider";
|
||||||
|
import { isWalletConnectReceiverEnabled } from "../../wallets/utils";
|
||||||
|
import ConnectAppField from "./ConnectAppField";
|
||||||
|
|
||||||
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||||
const DEVICE_WIDTH = Dimensions.get("window").width;
|
const DEVICE_WIDTH = Dimensions.get("window").width;
|
||||||
@@ -42,6 +44,7 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
hideTestnetFaucet,
|
hideTestnetFaucet,
|
||||||
supportedTokens,
|
supportedTokens,
|
||||||
displayBalanceToken,
|
displayBalanceToken,
|
||||||
|
hideSwitchToPersonalWallet,
|
||||||
}: {
|
}: {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
onClosePress: () => void;
|
onClosePress: () => void;
|
||||||
@@ -50,6 +53,7 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
hideTestnetFaucet?: boolean;
|
hideTestnetFaucet?: boolean;
|
||||||
supportedTokens: SupportedTokens;
|
supportedTokens: SupportedTokens;
|
||||||
displayBalanceToken?: Record<number, string>;
|
displayBalanceToken?: Record<number, string>;
|
||||||
|
hideSwitchToPersonalWallet?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
||||||
@@ -131,6 +135,7 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
return (
|
return (
|
||||||
<SmartWalletAdditionalActions
|
<SmartWalletAdditionalActions
|
||||||
onExportPress={onExportLocalWalletPress}
|
onExportPress={onExportLocalWalletPress}
|
||||||
|
hideSwitchToPersonalWallet={hideSwitchToPersonalWallet}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -203,11 +208,15 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
return null;
|
return null;
|
||||||
}, [
|
}, [
|
||||||
activeWallet?.walletId,
|
activeWallet?.walletId,
|
||||||
isImportModalVisible,
|
|
||||||
onExportLocalWalletPress,
|
|
||||||
onWalletImported,
|
|
||||||
smartWallet,
|
smartWallet,
|
||||||
l,
|
onExportLocalWalletPress,
|
||||||
|
l.connect_wallet_details.additional_actions,
|
||||||
|
l.connect_wallet_details.backup_wallet,
|
||||||
|
l.connect_wallet_details.import_wallet,
|
||||||
|
l.local_wallet.this_is_a_temporary_wallet,
|
||||||
|
isImportModalVisible,
|
||||||
|
onWalletImported,
|
||||||
|
hideSwitchToPersonalWallet,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -296,6 +305,9 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{isWalletConnectReceiverEnabled(activeWallet) ? (
|
||||||
|
<ConnectAppField onConnectAppTriggered={onClosePress} />
|
||||||
|
) : null}
|
||||||
{getAdditionalActions()}
|
{getAdditionalActions()}
|
||||||
{extraRows ? extraRows({}) : null}
|
{extraRows ? extraRows({}) : null}
|
||||||
{addressCopied === true ? (
|
{addressCopied === true ? (
|
||||||
|
|||||||
+7
-4
@@ -10,12 +10,15 @@ import { useState } from "react";
|
|||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
||||||
import { useAddress, useWallet } from "@thirdweb-dev/react-core";
|
import {
|
||||||
|
shortenAddress,
|
||||||
|
useAddress,
|
||||||
|
useWallet,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
import { PasswordInput } from "../PasswordInput";
|
import { PasswordInput } from "../PasswordInput";
|
||||||
import * as FileSystem from "expo-file-system";
|
import * as FileSystem from "expo-file-system";
|
||||||
import { SmartWallet } from "@thirdweb-dev/wallets";
|
import { SmartWallet } from "@thirdweb-dev/wallets";
|
||||||
import { usePersonalWalletAddress } from "../../wallets/hooks/usePersonalWalletAddress";
|
import { usePersonalWalletAddress } from "../../wallets/hooks/usePersonalWalletAddress";
|
||||||
import { shortenWalletAddress } from "../../utils/addresses";
|
|
||||||
import { LocalWallet } from "../../wallets/wallets/LocalWallet";
|
import { LocalWallet } from "../../wallets/wallets/LocalWallet";
|
||||||
import { TWModal } from "../base/modal/TWModal";
|
import { TWModal } from "../base/modal/TWModal";
|
||||||
import { useLocale } from "../../providers/ui-context-provider";
|
import { useLocale } from "../../providers/ui-context-provider";
|
||||||
@@ -162,7 +165,7 @@ export const ExportLocalWalletModal = ({
|
|||||||
{l.local_wallet.wallet_address}
|
{l.local_wallet.wallet_address}
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant="bodySmallSecondary">
|
<Text variant="bodySmallSecondary">
|
||||||
{shortenWalletAddress(
|
{shortenAddress(
|
||||||
personalWalletAddress ? personalWalletAddress : address,
|
personalWalletAddress ? personalWalletAddress : address,
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
@@ -180,7 +183,7 @@ export const ExportLocalWalletModal = ({
|
|||||||
onPress={onContinuePress}
|
onPress={onContinuePress}
|
||||||
>
|
>
|
||||||
{isExporting ? (
|
{isExporting ? (
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
<ActivityIndicator size="small" color="black" />
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodySmall" color="black">
|
<Text variant="bodySmall" color="black">
|
||||||
{l.connect_wallet_details.backup}
|
{l.connect_wallet_details.backup}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { RNCamera } from "react-native-camera";
|
import { RNCamera } from "react-native-camera";
|
||||||
import { TWModal } from "../base/modal/TWModal";
|
import { TWModal } from "../base/modal/TWModal";
|
||||||
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
||||||
|
import { SafeAreaView } from "react-native";
|
||||||
|
|
||||||
export const QRCodeScan = ({
|
export const QRCodeScan = ({
|
||||||
isVisible,
|
isVisible,
|
||||||
@@ -13,21 +14,26 @@ export const QRCodeScan = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<TWModal isVisible={isVisible} backdropOpacity={1}>
|
<TWModal isVisible={isVisible} backdropOpacity={1}>
|
||||||
<ModalHeaderTextClose headerText={"Scan to Connect"} onClose={onClose} />
|
<SafeAreaView style={{ flex: 1, backgroundColor: "transparent" }}>
|
||||||
<RNCamera
|
<ModalHeaderTextClose
|
||||||
style={{ flex: 1 }}
|
headerText={"Scan to Connect"}
|
||||||
type={RNCamera.Constants.Type.back}
|
onClose={onClose}
|
||||||
captureAudio={false}
|
/>
|
||||||
androidCameraPermissionOptions={{
|
<RNCamera
|
||||||
title: "Permission to use camera",
|
style={{ flex: 1 }}
|
||||||
message: "We need your permission to use your camera",
|
type={RNCamera.Constants.Type.back}
|
||||||
buttonPositive: "Ok",
|
captureAudio={false}
|
||||||
buttonNegative: "Cancel",
|
androidCameraPermissionOptions={{
|
||||||
}}
|
title: "Permission to use camera",
|
||||||
onBarCodeRead={({ data }) => {
|
message: "We need your permission to use your camera",
|
||||||
onQRCodeScan(data);
|
buttonPositive: "Ok",
|
||||||
}}
|
buttonNegative: "Cancel",
|
||||||
/>
|
}}
|
||||||
|
onBarCodeRead={({ data }) => {
|
||||||
|
onQRCodeScan(data);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</SafeAreaView>
|
||||||
</TWModal>
|
</TWModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
+4
-5
@@ -2,18 +2,19 @@ import { useWallet } from "@thirdweb-dev/react-core";
|
|||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
|
||||||
import {
|
import {
|
||||||
CLOSE_MODAL_STATE,
|
CLOSE_MODAL_STATE,
|
||||||
WalletConnectSessionProposalModal,
|
WalletConnectSessionProposalModal,
|
||||||
} from "../../utils/modalTypes";
|
} from "../../utils/modalTypes";
|
||||||
import { useLocale, useModalState } from "../../providers/ui-context-provider";
|
import { useLocale, useModalState } from "../../providers/ui-context-provider";
|
||||||
|
import { useWalletConnectHandler } from "../../providers/context-provider";
|
||||||
|
|
||||||
export const SessionProposalModal = () => {
|
export const SessionProposalModal = () => {
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const { modalState, setModalState } = useModalState();
|
const { modalState, setModalState } = useModalState();
|
||||||
const { data: proposalData } =
|
const { data: proposalData } =
|
||||||
modalState as WalletConnectSessionProposalModal;
|
modalState as WalletConnectSessionProposalModal;
|
||||||
|
const walletConnectHandler = useWalletConnectHandler();
|
||||||
|
|
||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ export const SessionProposalModal = () => {
|
|||||||
minWidth={100}
|
minWidth={100}
|
||||||
borderColor="border"
|
borderColor="border"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
(wallet as unknown as IWalletConnectReceiver).rejectSession();
|
walletConnectHandler?.rejectSession();
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -61,9 +62,7 @@ export const SessionProposalModal = () => {
|
|||||||
if (!wallet) {
|
if (!wallet) {
|
||||||
throw new Error("Wallet not connected.");
|
throw new Error("Wallet not connected.");
|
||||||
}
|
}
|
||||||
await (
|
await walletConnectHandler?.approveSession();
|
||||||
wallet as unknown as IWalletConnectReceiver
|
|
||||||
).approveSession();
|
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
+11
-15
@@ -1,19 +1,16 @@
|
|||||||
import { useChain, useWallet } from "@thirdweb-dev/react-core";
|
import { shortenAddress, useChain, useWallet } from "@thirdweb-dev/react-core";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import {
|
import { EIP155_SIGNING_METHODS } from "@thirdweb-dev/wallets";
|
||||||
EIP155_SIGNING_METHODS,
|
|
||||||
IWalletConnectReceiver,
|
|
||||||
} from "@thirdweb-dev/wallets";
|
|
||||||
import { useLocale, useModalState } from "../../providers/ui-context-provider";
|
import { useLocale, useModalState } from "../../providers/ui-context-provider";
|
||||||
import {
|
import {
|
||||||
CLOSE_MODAL_STATE,
|
CLOSE_MODAL_STATE,
|
||||||
WalletConnectSessionRequestModal,
|
WalletConnectSessionRequestModal,
|
||||||
} from "../../utils/modalTypes";
|
} from "../../utils/modalTypes";
|
||||||
import { ActivityIndicator, Dimensions } from "react-native";
|
import { ActivityIndicator, Dimensions } from "react-native";
|
||||||
import { shortenWalletAddress } from "../../utils/addresses";
|
|
||||||
import { useCallback, useState } from "react";
|
import { useCallback, useState } from "react";
|
||||||
|
import { useWalletConnectHandler } from "../../providers/context-provider";
|
||||||
|
|
||||||
const getTitle = (method: string) => {
|
const getTitle = (method: string) => {
|
||||||
switch (method) {
|
switch (method) {
|
||||||
@@ -34,6 +31,7 @@ export const SessionRequestModal = () => {
|
|||||||
const { modalState, setModalState } = useModalState();
|
const { modalState, setModalState } = useModalState();
|
||||||
const { data: requestData } = modalState as WalletConnectSessionRequestModal;
|
const { data: requestData } = modalState as WalletConnectSessionRequestModal;
|
||||||
const [approvingRequest, setApprovingRequest] = useState(false);
|
const [approvingRequest, setApprovingRequest] = useState(false);
|
||||||
|
const walletConnectHandler = useWalletConnectHandler();
|
||||||
|
|
||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const chain = useChain();
|
const chain = useChain();
|
||||||
@@ -48,12 +46,10 @@ export const SessionRequestModal = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setApprovingRequest(true);
|
setApprovingRequest(true);
|
||||||
(wallet as unknown as IWalletConnectReceiver)
|
walletConnectHandler?.approveEIP155Request().finally(() => {
|
||||||
.approveRequest()
|
setApprovingRequest(false);
|
||||||
.finally(() => {
|
onClose();
|
||||||
setApprovingRequest(false);
|
});
|
||||||
onClose();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getContent = useCallback(() => {
|
const getContent = useCallback(() => {
|
||||||
@@ -86,10 +82,10 @@ export const SessionRequestModal = () => {
|
|||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<Text variant="bodySmall" textAlign="left">
|
<Text variant="bodySmall" textAlign="left">
|
||||||
{`${l.common.from}: ${shortenWalletAddress(from)}`}
|
{`${l.common.from}: ${shortenAddress(from)}`}
|
||||||
</Text>
|
</Text>
|
||||||
<Text variant="bodySmall" textAlign="left" mt="sm">
|
<Text variant="bodySmall" textAlign="left" mt="sm">
|
||||||
{`${l.common.to}: ${shortenWalletAddress(to)}`}
|
{`${l.common.to}: ${shortenAddress(to)}`}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
@@ -126,7 +122,7 @@ export const SessionRequestModal = () => {
|
|||||||
minWidth={100}
|
minWidth={100}
|
||||||
borderColor="border"
|
borderColor="border"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
(wallet as unknown as IWalletConnectReceiver).rejectRequest();
|
walletConnectHandler?.rejectEIP155Request();
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
+20
-20
@@ -11,15 +11,16 @@ import { useWalletContext, useWallet } from "@thirdweb-dev/react-core";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useSmartWallet } from "../../providers/context-provider";
|
import { useSmartWallet } from "../../providers/context-provider";
|
||||||
import RightArrowIcon from "../../assets/right-arrow";
|
import RightArrowIcon from "../../assets/right-arrow";
|
||||||
import ConnectAppField from "./ConnectAppField";
|
|
||||||
import DisconnectIcon from "../../assets/disconnect";
|
import DisconnectIcon from "../../assets/disconnect";
|
||||||
import { IconTextButton } from "../base/IconTextButton";
|
import { IconTextButton } from "../base/IconTextButton";
|
||||||
import { useGlobalTheme, useLocale } from "../../providers/ui-context-provider";
|
import { useGlobalTheme, useLocale } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const SmartWalletAdditionalActions = ({
|
export const SmartWalletAdditionalActions = ({
|
||||||
onExportPress,
|
onExportPress,
|
||||||
|
hideSwitchToPersonalWallet,
|
||||||
}: {
|
}: {
|
||||||
onExportPress: () => void;
|
onExportPress: () => void;
|
||||||
|
hideSwitchToPersonalWallet?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const { setConnectedWallet } = useWalletContext();
|
const { setConnectedWallet } = useWalletContext();
|
||||||
@@ -61,25 +62,24 @@ export const SmartWalletAdditionalActions = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<IconTextButton
|
{(showSmartWallet || !hideSwitchToPersonalWallet) && (
|
||||||
mt="xs"
|
<IconTextButton
|
||||||
text={
|
mt="xs"
|
||||||
showSmartWallet
|
text={
|
||||||
? l.smart_wallet.switch_to_smart
|
showSmartWallet
|
||||||
: l.smart_wallet.switch_to_personal
|
? l.smart_wallet.switch_to_smart
|
||||||
}
|
: l.smart_wallet.switch_to_personal
|
||||||
icon={
|
}
|
||||||
<DisconnectIcon
|
icon={
|
||||||
width={14}
|
<DisconnectIcon
|
||||||
height={14}
|
width={14}
|
||||||
color={theme.colors.iconPrimary}
|
height={14}
|
||||||
/>
|
color={theme.colors.iconPrimary}
|
||||||
}
|
/>
|
||||||
onPress={onWalletPress}
|
}
|
||||||
/>
|
onPress={onWalletPress}
|
||||||
{!showSmartWallet && smartWallet?.enableConnectApp ? (
|
/>
|
||||||
<ConnectAppField />
|
)}
|
||||||
) : null}
|
|
||||||
{wallet?.walletId === walletIds.localWallet ||
|
{wallet?.walletId === walletIds.localWallet ||
|
||||||
activeWallet?.walletId === walletIds.localWallet ? (
|
activeWallet?.walletId === walletIds.localWallet ? (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ export type ConnectWalletDetailsProps = {
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
displayBalanceToken?: Record<number, string>;
|
displayBalanceToken?: Record<number, string>;
|
||||||
|
/**
|
||||||
|
* Hide the "switch to Personal wallet" option in the dropdown which is shown when wallet is connected to a Smart Wallet
|
||||||
|
*
|
||||||
|
* @defaultValue false
|
||||||
|
*/
|
||||||
|
hideSwitchToPersonalWallet?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WalletDetailsButton = ({
|
export const WalletDetailsButton = ({
|
||||||
@@ -45,6 +51,7 @@ export const WalletDetailsButton = ({
|
|||||||
hideTestnetFaucet,
|
hideTestnetFaucet,
|
||||||
supportedTokens,
|
supportedTokens,
|
||||||
displayBalanceToken,
|
displayBalanceToken,
|
||||||
|
hideSwitchToPersonalWallet,
|
||||||
}: ConnectWalletDetailsProps) => {
|
}: ConnectWalletDetailsProps) => {
|
||||||
const l = useLocale();
|
const l = useLocale();
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
@@ -76,6 +83,7 @@ export const WalletDetailsButton = ({
|
|||||||
hideTestnetFaucet={hideTestnetFaucet}
|
hideTestnetFaucet={hideTestnetFaucet}
|
||||||
supportedTokens={supportedTokens}
|
supportedTokens={supportedTokens}
|
||||||
displayBalanceToken={displayBalanceToken}
|
displayBalanceToken={displayBalanceToken}
|
||||||
|
hideSwitchToPersonalWallet={hideSwitchToPersonalWallet}
|
||||||
/>
|
/>
|
||||||
{detailsButton ? (
|
{detailsButton ? (
|
||||||
detailsButton({ onPress })
|
detailsButton({ onPress })
|
||||||
|
|||||||
+22
-26
@@ -104,35 +104,31 @@ export function ChooseWallet({
|
|||||||
onBackPress={isConnectAWalletEnabled ? onBackPress : undefined}
|
onBackPress={isConnectAWalletEnabled ? onBackPress : undefined}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
headerText={
|
headerText={
|
||||||
headerText ? (
|
<Box
|
||||||
headerText
|
flexDirection="row"
|
||||||
) : (
|
alignItems="center"
|
||||||
<Box
|
alignContent="center"
|
||||||
flexDirection="row"
|
justifyContent="center"
|
||||||
alignItems="center"
|
>
|
||||||
alignContent="center"
|
{modalTitleIconUrl !== undefined ? (
|
||||||
justifyContent="center"
|
modalTitleIconUrl.length === 0 ? null : (
|
||||||
>
|
<ImageSvgUri
|
||||||
{modalTitleIconUrl !== undefined ? (
|
|
||||||
modalTitleIconUrl.length === 0 ? null : (
|
|
||||||
<ImageSvgUri
|
|
||||||
width={26}
|
|
||||||
height={15}
|
|
||||||
imageUrl={modalTitleIconUrl}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
) : (
|
|
||||||
<ThirdwebLogo
|
|
||||||
width={26}
|
width={26}
|
||||||
height={15}
|
height={15}
|
||||||
color={theme.colors.backgroundInverted}
|
imageUrl={modalTitleIconUrl}
|
||||||
/>
|
/>
|
||||||
)}
|
)
|
||||||
<Text variant="headerBold" ml="xxs" fontSize={20} lineHeight={24}>
|
) : (
|
||||||
{l.connect_wallet_details.connect}
|
<ThirdwebLogo
|
||||||
</Text>
|
width={26}
|
||||||
</Box>
|
height={15}
|
||||||
)
|
color={theme.colors.backgroundInverted}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Text variant="headerBold" ml="xxs" fontSize={20} lineHeight={24}>
|
||||||
|
{headerText ? headerText : l.connect_wallet_details.connect}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
}
|
}
|
||||||
subHeaderText={subHeaderText}
|
subHeaderText={subHeaderText}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ export type ConnectWalletButtonProps = {
|
|||||||
theme?: ThemeProviderProps["theme"];
|
theme?: ThemeProviderProps["theme"];
|
||||||
/**
|
/**
|
||||||
* Set a custom title for the button
|
* Set a custom title for the button
|
||||||
* @default "Connect Wallet"
|
* @defaultValue "Connect Wallet"
|
||||||
*/
|
*/
|
||||||
buttonTitle?: string;
|
buttonTitle?: string;
|
||||||
/**
|
/**
|
||||||
* Set a custom title for the Connect Wallet modal
|
* Set a custom title for the Connect Wallet modal
|
||||||
* @default "Choose your wallet"
|
* @defaultValue "Choose your wallet"
|
||||||
*/
|
*/
|
||||||
modalTitle?: string;
|
modalTitle?: string;
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +104,10 @@ export const ConnectWalletButton = ({
|
|||||||
>
|
>
|
||||||
<Text variant="bodyLargeBold" color="buttonTextColor">
|
<Text variant="bodyLargeBold" color="buttonTextColor">
|
||||||
{showButtonSpinner ? (
|
{showButtonSpinner ? (
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
<ActivityIndicator
|
||||||
|
size="small"
|
||||||
|
color={appTheme.colors.buttonTextColor}
|
||||||
|
/>
|
||||||
) : buttonTitle ? (
|
) : buttonTitle ? (
|
||||||
buttonTitle
|
buttonTitle
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export function LocalWalletFlow({
|
|||||||
data-test="create-new-wallet-button"
|
data-test="create-new-wallet-button"
|
||||||
>
|
>
|
||||||
{isCreatingWallet ? (
|
{isCreatingWallet ? (
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
<ActivityIndicator size="small" color="black" />
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodyLarge" color="black">
|
<Text variant="bodyLarge" color="black">
|
||||||
{l.local_wallet.create_new_wallet}
|
{l.local_wallet.create_new_wallet}
|
||||||
|
|||||||
+1
-1
@@ -228,7 +228,7 @@ export const LocalWalletImportModal = ({
|
|||||||
onPress={onImportPress}
|
onPress={onImportPress}
|
||||||
>
|
>
|
||||||
{isImporting ? (
|
{isImporting ? (
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
<ActivityIndicator size="small" color="black" />
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodySmall" color="black">
|
<Text variant="bodySmall" color="black">
|
||||||
{l.common.import}
|
{l.common.import}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import type { CallOverrides, ContractInterface } from "ethers";
|
|||||||
import { PropsWithChildren, useEffect } from "react";
|
import { PropsWithChildren, useEffect } from "react";
|
||||||
import { ActivityIndicator, StyleSheet } from "react-native";
|
import { ActivityIndicator, StyleSheet } from "react-native";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
import { useUIContext } from "../providers/ui-context-provider";
|
import { useGlobalTheme, useUIContext } from "../providers/ui-context-provider";
|
||||||
|
|
||||||
type ActionFn = (contract: SmartContract) => Promise<any>;
|
type ActionFn = (contract: SmartContract) => Promise<any>;
|
||||||
|
|
||||||
@@ -74,6 +74,7 @@ export const Web3Button = <TAction extends ActionFn>({
|
|||||||
theme,
|
theme,
|
||||||
connectWalletProps,
|
connectWalletProps,
|
||||||
}: PropsWithChildren<Web3ButtonProps<TAction>>) => {
|
}: PropsWithChildren<Web3ButtonProps<TAction>>) => {
|
||||||
|
const globalTheme = useGlobalTheme();
|
||||||
const address = useAddress();
|
const address = useAddress();
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const walletChainId = useChainId();
|
const walletChainId = useChainId();
|
||||||
@@ -155,7 +156,12 @@ export const Web3Button = <TAction extends ActionFn>({
|
|||||||
connectionStatus === "connecting" ||
|
connectionStatus === "connecting" ||
|
||||||
connectionStatus === "unknown"
|
connectionStatus === "unknown"
|
||||||
) {
|
) {
|
||||||
content = <ActivityIndicator size="small" color="buttonTextColor" />;
|
content = (
|
||||||
|
<ActivityIndicator
|
||||||
|
size="small"
|
||||||
|
color={globalTheme.colors.buttonTextColor}
|
||||||
|
/>
|
||||||
|
);
|
||||||
buttonLoading = true;
|
buttonLoading = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { shortenAddress } from "@thirdweb-dev/react-core";
|
||||||
import { Theme } from "../../styles/theme";
|
import { Theme } from "../../styles/theme";
|
||||||
import { shortenWalletAddress } from "../../utils/addresses";
|
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
|
|
||||||
type AddressProps = {
|
type AddressProps = {
|
||||||
@@ -16,7 +16,7 @@ export const AddressDisplay = ({
|
|||||||
}: AddressProps) => {
|
}: AddressProps) => {
|
||||||
return (
|
return (
|
||||||
<Text variant={variant} {...props}>
|
<Text variant={variant} {...props}>
|
||||||
{shortenWalletAddress(address, extraShort)}
|
{shortenAddress(address, extraShort)}
|
||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import BaseButton from "./BaseButton";
|
||||||
|
import Box from "./Box";
|
||||||
|
import ImageSvgUri from "./ImageSvgUri";
|
||||||
|
import Text from "./Text";
|
||||||
|
|
||||||
|
type SquareButtonProps = {
|
||||||
|
onPress: () => void;
|
||||||
|
iconUrl: string;
|
||||||
|
size: number;
|
||||||
|
name?: string;
|
||||||
|
} & (typeof BaseButton)["arguments"];
|
||||||
|
|
||||||
|
export const SquareButton = ({
|
||||||
|
onPress,
|
||||||
|
iconUrl,
|
||||||
|
name,
|
||||||
|
size,
|
||||||
|
...props
|
||||||
|
}: SquareButtonProps) => {
|
||||||
|
return (
|
||||||
|
<BaseButton
|
||||||
|
flexDirection="column"
|
||||||
|
alignItems="center"
|
||||||
|
justifyContent="center"
|
||||||
|
borderWidth={0}
|
||||||
|
borderRadius="sm"
|
||||||
|
width={size}
|
||||||
|
height={size}
|
||||||
|
onPress={onPress}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
|
<Box borderWidth={0} borderRadius="lg">
|
||||||
|
<ImageSvgUri imageUrl={iconUrl} width={size} height={size} />
|
||||||
|
</Box>
|
||||||
|
{name ? (
|
||||||
|
<Text
|
||||||
|
variant="bodySmallSecondary"
|
||||||
|
numberOfLines={1}
|
||||||
|
mt="xs"
|
||||||
|
fontSize={14}
|
||||||
|
lineHeight={16}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
</BaseButton>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
|
||||||
import BaseButton from "./BaseButton";
|
|
||||||
import Box from "./Box";
|
|
||||||
import ImageSvgUri from "./ImageSvgUri";
|
|
||||||
import Text from "./Text";
|
|
||||||
|
|
||||||
type WalletButtonSquareProps = {
|
|
||||||
onPress: () => void;
|
|
||||||
walletIconUrl: string;
|
|
||||||
size: number;
|
|
||||||
name: string;
|
|
||||||
} & (typeof BaseButton)["arguments"];
|
|
||||||
|
|
||||||
export const WalletButtonSquare = ({
|
|
||||||
onPress,
|
|
||||||
walletIconUrl,
|
|
||||||
name,
|
|
||||||
size,
|
|
||||||
}: WalletButtonSquareProps) => {
|
|
||||||
const theme = useGlobalTheme();
|
|
||||||
|
|
||||||
const marginVertical = theme.spacing.xs;
|
|
||||||
return (
|
|
||||||
<BaseButton
|
|
||||||
flexDirection="column"
|
|
||||||
alignItems="center"
|
|
||||||
justifyContent="center"
|
|
||||||
marginVertical="xxs"
|
|
||||||
borderWidth={0}
|
|
||||||
borderRadius="sm"
|
|
||||||
width={size - marginVertical * 2}
|
|
||||||
height={size - marginVertical * 2}
|
|
||||||
onPress={onPress}
|
|
||||||
>
|
|
||||||
<Box borderWidth={0} borderRadius="lg">
|
|
||||||
<ImageSvgUri
|
|
||||||
imageUrl={walletIconUrl}
|
|
||||||
width={size * 0.6}
|
|
||||||
height={size * 0.6}
|
|
||||||
/>
|
|
||||||
</Box>
|
|
||||||
<Text
|
|
||||||
variant="bodySmallSecondary"
|
|
||||||
numberOfLines={1}
|
|
||||||
mt="xs"
|
|
||||||
fontSize={14}
|
|
||||||
lineHeight={16}
|
|
||||||
>
|
|
||||||
{name}
|
|
||||||
</Text>
|
|
||||||
</BaseButton>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -74,6 +74,9 @@ export const _en = {
|
|||||||
request_new_code: "Request new code",
|
request_new_code: "Request new code",
|
||||||
sign_in: "Sign In",
|
sign_in: "Sign In",
|
||||||
sign_in_google: "Sign in with Google",
|
sign_in_google: "Sign in with Google",
|
||||||
|
sign_in_facebook: "Sign in with Facebook",
|
||||||
|
sign_in_apple: "Sign in with Apple",
|
||||||
|
sign_in_email: "Sign in with Email",
|
||||||
enter_your_email: "Enter your email address",
|
enter_your_email: "Enter your email address",
|
||||||
forgot_password: "Forgot password",
|
forgot_password: "Forgot password",
|
||||||
enter_account_recovery_code: "Enter account recovery code",
|
enter_account_recovery_code: "Enter account recovery code",
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ export const _es = {
|
|||||||
request_new_code: "Solicitar nuevo código",
|
request_new_code: "Solicitar nuevo código",
|
||||||
sign_in: "Iniciar Sesión",
|
sign_in: "Iniciar Sesión",
|
||||||
sign_in_google: "Iniciar sesión con Google",
|
sign_in_google: "Iniciar sesión con Google",
|
||||||
|
sign_in_facebook: "Iniciar sesión con Facebook",
|
||||||
|
sign_in_apple: "Iniciar sesión con Apple",
|
||||||
|
sign_in_email: "Iniciar sesión con Email",
|
||||||
enter_your_email: "Ingresa tu dirección de correo electrónico",
|
enter_your_email: "Ingresa tu dirección de correo electrónico",
|
||||||
forgot_password: "Olvidé mi contraseña",
|
forgot_password: "Olvidé mi contraseña",
|
||||||
enter_account_recovery_code: "Ingresa el código de recuperación de cuenta",
|
enter_account_recovery_code: "Ingresa el código de recuperación de cuenta",
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ export const _ja = {
|
|||||||
},
|
},
|
||||||
connect_wallet_details: {
|
connect_wallet_details: {
|
||||||
additional_actions: "追加のアクション",
|
additional_actions: "追加のアクション",
|
||||||
address_copied_clipboard: "アドレスがクリップボードにコピーされました",
|
address_copied_clipboard: "アドレスがクリップボードにコピーされました。",
|
||||||
backup_wallet: "ウォレットのバックアップ",
|
backup_wallet: "ウォレットのバックアップ",
|
||||||
backup_personal_wallet: "個人のウォレットのバックアップ",
|
backup_personal_wallet: "個人のウォレットのバックアップ",
|
||||||
import_wallet: "ウォレットのインポート",
|
import_wallet: "ウォレットのインポート",
|
||||||
connected_to_smart_wallet: "スマートウォレットに接続されています",
|
connected_to_smart_wallet: "スマートウォレットに接続されています。",
|
||||||
current_network: "現在のネットワーク",
|
current_network: "現在のネットワーク",
|
||||||
backup: "バックアップ",
|
backup: "バックアップ",
|
||||||
connect_to_app: "アプリに接続",
|
connect_to_app: "アプリに接続",
|
||||||
@@ -23,30 +23,30 @@ export const _ja = {
|
|||||||
continue_as_guest: "ゲストとして続行",
|
continue_as_guest: "ゲストとして続行",
|
||||||
tos: "利用規約",
|
tos: "利用規約",
|
||||||
privacy_policy: "プライバシーポリシー",
|
privacy_policy: "プライバシーポリシー",
|
||||||
by_connecting_you_agree: "接続することで、あなたは以下に同意します",
|
by_connecting_you_agree: "同意の上、接続してください。",
|
||||||
copy_address_or_scan:
|
copy_address_or_scan:
|
||||||
"ウォレットのアドレスをコピーするか、QRコードをスキャンして資金をこのウォレットに送信します",
|
"ウォレットのアドレスをコピーするか、QRコードをスキャンして資金をこのウォレットに送信します。",
|
||||||
request_testnet_funds: "テストネットの資金をリクエスト",
|
request_testnet_funds: "テストネットの資金をリクエスト",
|
||||||
your_address: "あなたのアドレス",
|
your_address: "あなたのアドレス",
|
||||||
qr_code: "QRコード",
|
qr_code: "QRコード",
|
||||||
select_token: "トークンを選択",
|
select_token: "トークンを選択",
|
||||||
send_to: "送信先",
|
send_to: "送信先",
|
||||||
send_funds: "資金を送る",
|
send_funds: "資金を送る",
|
||||||
no_tokens_found: "トークンが見つかりません",
|
no_tokens_found: "トークンが見つかりません。",
|
||||||
confirm_in_wallet: "ウォレットで確認",
|
confirm_in_wallet: "ウォレットで確認",
|
||||||
select_network: "ネットワークを選択",
|
select_network: "ネットワークを選択",
|
||||||
switch_to: "に切り替える",
|
switch_to: "切り替え先",
|
||||||
no_supported_chains_detected:
|
no_supported_chains_detected:
|
||||||
"サポートされているチェーンが検出されませんでした",
|
"サポートされているチェーンが検出されませんでした。",
|
||||||
recommended: "推奨",
|
recommended: "推奨",
|
||||||
network_mismatch:
|
network_mismatch:
|
||||||
"あなたのコントラクトとウォレットの間にネットワークの不一致があります",
|
"あなたのコントラクトとウォレットの間にネットワークの不一致があります。",
|
||||||
},
|
},
|
||||||
connecting_wallet: {
|
connecting_wallet: {
|
||||||
creating_encrypting: "デバイスのウォレットを作成、暗号化、保護しています",
|
creating_encrypting: "デバイスのウォレットを作成、暗号化、保護しています。",
|
||||||
connecting_your_wallet: "ウォレットを接続しています",
|
connecting_your_wallet: "ウォレットを接続しています。",
|
||||||
connecting_through_pop_up:
|
connecting_through_pop_up:
|
||||||
"ウォレットのポップアップを通じてアプリにログインして接続します",
|
"ウォレットのポップアップを通じてアプリにログインして接続します。",
|
||||||
},
|
},
|
||||||
local_wallet: {
|
local_wallet: {
|
||||||
guest_wallet: "ゲストウォレット",
|
guest_wallet: "ゲストウォレット",
|
||||||
@@ -55,15 +55,15 @@ export const _ja = {
|
|||||||
private_key_mnemonic: "または、秘密鍵またはニーモニック",
|
private_key_mnemonic: "または、秘密鍵またはニーモニック",
|
||||||
private_key_mnemonic_placeholder: "秘密鍵 / ニーモニック",
|
private_key_mnemonic_placeholder: "秘密鍵 / ニーモニック",
|
||||||
application_can_authorize_transactions:
|
application_can_authorize_transactions:
|
||||||
"アプリケーションは、承認なしにウォレットを代わりにトランザクションを許可することができます 信頼できるアプリケーションのみに接続することをおすすめします",
|
"アプリケーションは、承認なしにウォレットを代わりにトランザクションを許可することができます。信頼できるアプリケーションのみに接続することをおすすめします。",
|
||||||
double_check_password: "パスワードまたは秘密鍵を再度確認してください",
|
double_check_password: "パスワードまたは秘密鍵を再度確認してください。",
|
||||||
error_accessing_file:
|
error_accessing_file:
|
||||||
"ファイルにアクセスできませんでしたもう一度試してください",
|
"ファイルにアクセスできませんでしたもう一度試してください。",
|
||||||
wallet_address: "ウォレットのアドレス",
|
wallet_address: "ウォレットのアドレス",
|
||||||
this_will_download_json:
|
this_will_download_json:
|
||||||
"これにより、パスワードで暗号化されたウォレット情報を含むJSONファイルがデバイスにダウンロードされます",
|
"これにより、パスワードで暗号化されたウォレット情報を含むJSONファイルがデバイスにダウンロードされます。",
|
||||||
this_is_a_temporary_wallet:
|
this_is_a_temporary_wallet:
|
||||||
"これは一時的なゲストウォレットです アクセスを失わないようにバックアップをダウンロードしてください",
|
"これは一時的なゲストウォレットです。アクセスを失わないようにバックアップをダウンロードしてください。",
|
||||||
},
|
},
|
||||||
smart_wallet: {
|
smart_wallet: {
|
||||||
switch_to_smart: "スマートウォレットに切り替え",
|
switch_to_smart: "スマートウォレットに切り替え",
|
||||||
@@ -75,18 +75,21 @@ export const _ja = {
|
|||||||
request_new_code: "新しいコードをリクエスト",
|
request_new_code: "新しいコードをリクエスト",
|
||||||
sign_in: "サインイン",
|
sign_in: "サインイン",
|
||||||
sign_in_google: "Googleでサインイン",
|
sign_in_google: "Googleでサインイン",
|
||||||
|
sign_in_facebook: "Facebookでサインイン",
|
||||||
|
sign_in_apple: "Appleでサインイン",
|
||||||
|
sign_in_email: "メールアドレスでサインイン",
|
||||||
enter_your_email: "メールアドレスを入力",
|
enter_your_email: "メールアドレスを入力",
|
||||||
forgot_password: "パスワードを忘れた",
|
forgot_password: "パスワードを忘れた場合",
|
||||||
enter_account_recovery_code: "アカウント回復コードを入力",
|
enter_account_recovery_code: "アカウント回復コードを入力",
|
||||||
backup_your_account: "アカウントのバックアップ",
|
backup_your_account: "アカウントのバックアップ",
|
||||||
create_password: "パスワードを作成する",
|
create_password: "パスワードを作成",
|
||||||
enter_password: "パスワードを入力",
|
enter_password: "パスワードを入力",
|
||||||
set_password_message: "アカウントの保護のためパスワードを設定してください",
|
set_password_message: "パスワードを設定してアカウントを保護",
|
||||||
enter_password_for_email: "メールのためのパスワードを入力",
|
enter_password_for_email: "メールアドレスに対するパスワードを入力",
|
||||||
make_sure_you_save_it: "必ず保存してください",
|
make_sure_you_save_it: "必ず保存してください。",
|
||||||
},
|
},
|
||||||
wallet_connect: {
|
wallet_connect: {
|
||||||
no_results_found: "結果が見つかりません",
|
no_results_found: "結果が見つかりません。",
|
||||||
search_wallets: "ウォレットを検索",
|
search_wallets: "ウォレットを検索",
|
||||||
},
|
},
|
||||||
common: {
|
common: {
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ export { Web3Button } from "./components/Web3Button";
|
|||||||
|
|
||||||
// utilities
|
// utilities
|
||||||
export * from "./utils/uri";
|
export * from "./utils/uri";
|
||||||
export * from "./utils/addresses";
|
|
||||||
export { createSyncStorage as createLocalStorage } from "../core/AsyncStorage";
|
export { createSyncStorage as createLocalStorage } from "../core/AsyncStorage";
|
||||||
export { createAsyncLocalStorage } from "../core/AsyncStorage";
|
export { createAsyncLocalStorage } from "../core/AsyncStorage";
|
||||||
export { createSecureStorage } from "../core/SecureStorage";
|
export { createSecureStorage } from "../core/SecureStorage";
|
||||||
export { ThirdwebStorage } from "../core/storage/storage";
|
export { ThirdwebStorage } from "../core/storage/storage";
|
||||||
|
|
||||||
export * from "./i18n/strings";
|
export * from "./i18n/strings";
|
||||||
|
export * from "./i18n/types";
|
||||||
|
|
||||||
// ui components
|
// ui components
|
||||||
export * from "./components/base";
|
export * from "./components/base";
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import { SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
import {
|
||||||
|
SmartWallet,
|
||||||
|
WalletConnectHandler,
|
||||||
|
WalletConnectReceiverConfig,
|
||||||
|
WalletConnectV2Handler,
|
||||||
|
walletIds,
|
||||||
|
} from "@thirdweb-dev/wallets";
|
||||||
import {
|
import {
|
||||||
createContext,
|
createContext,
|
||||||
useCallback,
|
useCallback,
|
||||||
@@ -8,13 +14,15 @@ import {
|
|||||||
} from "react";
|
} from "react";
|
||||||
import { useWalletConnectListener } from "../wallets/hooks/useWalletConnectListener";
|
import { useWalletConnectListener } from "../wallets/hooks/useWalletConnectListener";
|
||||||
import { MagicLink } from "../wallets/wallets/MagicLink";
|
import { MagicLink } from "../wallets/wallets/MagicLink";
|
||||||
import { useWalletContext } from "@thirdweb-dev/react-core";
|
import { useWallet, useWalletContext } from "@thirdweb-dev/react-core";
|
||||||
|
import { isWalletConnectReceiverEnabled } from "../wallets/utils";
|
||||||
|
|
||||||
type DappContextType = {
|
type DappContextType = {
|
||||||
smartWallet?: SmartWallet;
|
smartWallet?: SmartWallet;
|
||||||
setSmartWallet?: (value?: SmartWallet) => void;
|
setSmartWallet?: (value?: SmartWallet) => void;
|
||||||
magicLink?: MagicLink;
|
magicLink?: MagicLink;
|
||||||
setMagicLink?: (value?: MagicLink) => void;
|
setMagicLink?: (value?: MagicLink) => void;
|
||||||
|
walletConnectHandler?: WalletConnectHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DappContext = createContext<DappContextType>({});
|
const DappContext = createContext<DappContextType>({});
|
||||||
@@ -22,15 +30,50 @@ const DappContext = createContext<DappContextType>({});
|
|||||||
export const DappContextProvider = (props: React.PropsWithChildren) => {
|
export const DappContextProvider = (props: React.PropsWithChildren) => {
|
||||||
const [smartWallet, setSmartWallet] = useState<SmartWallet | undefined>();
|
const [smartWallet, setSmartWallet] = useState<SmartWallet | undefined>();
|
||||||
const [magicLink, setMagicLink] = useState<MagicLink | undefined>();
|
const [magicLink, setMagicLink] = useState<MagicLink | undefined>();
|
||||||
|
const [walletConnectHandler, setWalletConnectHandler] =
|
||||||
|
useState<WalletConnectHandler>();
|
||||||
const createdWalletInstance = useWalletContext().createdWalletInstance;
|
const createdWalletInstance = useWalletContext().createdWalletInstance;
|
||||||
|
const activeWallet = useWallet();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (createdWalletInstance?.walletId === walletIds.magicLink) {
|
if (!createdWalletInstance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (createdWalletInstance.walletId === walletIds.magicLink) {
|
||||||
setMagicLink(createdWalletInstance as MagicLink);
|
setMagicLink(createdWalletInstance as MagicLink);
|
||||||
}
|
}
|
||||||
}, [createdWalletInstance, setMagicLink]);
|
}, [createdWalletInstance, setMagicLink]);
|
||||||
|
|
||||||
useWalletConnectListener();
|
useEffect(() => {
|
||||||
|
if (!activeWallet) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const initWCHandler = async () => {
|
||||||
|
const wcReceiverOptions =
|
||||||
|
activeWallet?.getOptions() as WalletConnectReceiverConfig;
|
||||||
|
|
||||||
|
const handler = new WalletConnectV2Handler(
|
||||||
|
{
|
||||||
|
walletConnectReceiver: {
|
||||||
|
...(wcReceiverOptions?.walletConnectReceiver === true
|
||||||
|
? {}
|
||||||
|
: wcReceiverOptions?.walletConnectReceiver),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
activeWallet,
|
||||||
|
);
|
||||||
|
await handler.init();
|
||||||
|
setWalletConnectHandler(handler);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isWalletConnectReceiverEnabled(activeWallet)) {
|
||||||
|
initWCHandler();
|
||||||
|
}
|
||||||
|
}, [activeWallet]);
|
||||||
|
|
||||||
|
useWalletConnectListener(walletConnectHandler);
|
||||||
|
|
||||||
const magicSDK = useCallback(() => {
|
const magicSDK = useCallback(() => {
|
||||||
if (magicLink) {
|
if (magicLink) {
|
||||||
@@ -48,6 +91,7 @@ export const DappContextProvider = (props: React.PropsWithChildren) => {
|
|||||||
setSmartWallet,
|
setSmartWallet,
|
||||||
magicLink: magicLink,
|
magicLink: magicLink,
|
||||||
setMagicLink: setMagicLink,
|
setMagicLink: setMagicLink,
|
||||||
|
walletConnectHandler: walletConnectHandler,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
@@ -74,3 +118,9 @@ export const useMagicLink = () => {
|
|||||||
setMagicLink: context.setMagicLink,
|
setMagicLink: context.setMagicLink,
|
||||||
} as const;
|
} as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const useWalletConnectHandler = () => {
|
||||||
|
const context = useContext(DappContext);
|
||||||
|
|
||||||
|
return context.walletConnectHandler;
|
||||||
|
};
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
|||||||
* />
|
* />
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* * ```jsx
|
* ```jsx
|
||||||
* import { en } from "@thirdweb-dev/react-native";
|
* import { en } from "@thirdweb-dev/react-native";
|
||||||
*
|
*
|
||||||
* <ThirdwebProvider
|
* <ThirdwebProvider
|
||||||
@@ -86,6 +86,7 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
|||||||
* @example
|
* @example
|
||||||
* You can wrap your application with the provider as follows:
|
* You can wrap your application with the provider as follows:
|
||||||
*
|
*
|
||||||
|
* ```jsx
|
||||||
* import { ThirdwebProvider } from "@thirdweb-dev/react-native";
|
* import { ThirdwebProvider } from "@thirdweb-dev/react-native";
|
||||||
*
|
*
|
||||||
* const App = () => {
|
* const App = () => {
|
||||||
@@ -95,7 +96,7 @@ interface ThirdwebProviderProps<TChains extends Chain[]>
|
|||||||
* </ThirdwebProvider>
|
* </ThirdwebProvider>
|
||||||
* );
|
* );
|
||||||
* };
|
* };
|
||||||
*
|
* ```
|
||||||
*/
|
*/
|
||||||
export const ThirdwebProvider = <
|
export const ThirdwebProvider = <
|
||||||
TChains extends Chain[] = typeof defaultChains,
|
TChains extends Chain[] = typeof defaultChains,
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
import { utils } from "ethers";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shortens an EVM compatible address to show the first 6 and last 4 characters
|
|
||||||
*
|
|
||||||
* @param str The address to shorten
|
|
||||||
* @param extraShort If true, show the first 4 and last 3 characters
|
|
||||||
* @returns The shortened address
|
|
||||||
*/
|
|
||||||
export function shortenWalletAddress(str?: string, extraShort = true) {
|
|
||||||
if (!str) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${str.substring(0, extraShort ? 4 : 6)}...${str.substring(
|
|
||||||
str.length - (extraShort ? 3 : 4),
|
|
||||||
)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function shortens an address if it is a valid EVM address.
|
|
||||||
*
|
|
||||||
* @param address The address to shorten
|
|
||||||
* @param extraShort If true, show the first 4 and last 3 characters
|
|
||||||
* @returns The shortened address
|
|
||||||
* @example
|
|
||||||
* ```ts
|
|
||||||
* const address = shortenIfAddress("0x1234567890123456789012345678901234567890", true); // result will be "0x1234...890"
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
export function shortenIfAddress(address?: string, extraShort?: true): string {
|
|
||||||
if (!address) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
if (isPossibleEVMAddress(address, true)) {
|
|
||||||
return shortenWalletAddress(address, extraShort) || "";
|
|
||||||
}
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isEnsName(name: string): boolean {
|
|
||||||
return name?.endsWith(".eth");
|
|
||||||
}
|
|
||||||
|
|
||||||
// if a string is a valid address or ens name
|
|
||||||
export function isPossibleEVMAddress(address?: string, ignoreEns?: boolean) {
|
|
||||||
if (!address) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (isEnsName(address) && !ignoreEns) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return utils.isAddress(address);
|
|
||||||
}
|
|
||||||
@@ -4,8 +4,8 @@ import { WCMeta } from "../wallets/types/wc";
|
|||||||
/**
|
/**
|
||||||
* Build a WalletConnect display URI from a wc:// uri + a wallet specific link
|
* Build a WalletConnect display URI from a wc:// uri + a wallet specific link
|
||||||
*
|
*
|
||||||
* @param uri The wc:// uri
|
* @param uri - The wc:// uri
|
||||||
* @param links The wallet specific links
|
* @param links - The wallet specific links
|
||||||
* @returns The WalletConnect display URI
|
* @returns The WalletConnect display URI
|
||||||
*/
|
*/
|
||||||
export function formatWalletConnectDisplayUri(
|
export function formatWalletConnectDisplayUri(
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ export type CoinbaseWalletConnectorOptions = WalletMobileSDKProviderOptions &
|
|||||||
ConfigurationParams & {
|
ConfigurationParams & {
|
||||||
/**
|
/**
|
||||||
* Fallback Ethereum JSON RPC URL
|
* Fallback Ethereum JSON RPC URL
|
||||||
* @default ""
|
* @defaultValue ""
|
||||||
*/
|
*/
|
||||||
jsonRpcUrl?: string;
|
jsonRpcUrl?: string;
|
||||||
/**
|
/**
|
||||||
* Fallback Ethereum Chain ID
|
* Fallback Ethereum Chain ID
|
||||||
* @default 1
|
* @defaultValue 1
|
||||||
*/
|
*/
|
||||||
chainId?: number;
|
chainId?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
+14
-2
@@ -81,6 +81,18 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
redirectUrl: params.redirectUrl,
|
redirectUrl: params.redirectUrl,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
case "facebook": {
|
||||||
|
return this.socialLogin({
|
||||||
|
provider: AuthProvider.FACEBOOK,
|
||||||
|
redirectUrl: params.redirectUrl,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
case "apple": {
|
||||||
|
return this.socialLogin({
|
||||||
|
provider: AuthProvider.APPLE,
|
||||||
|
redirectUrl: params.redirectUrl,
|
||||||
|
});
|
||||||
|
}
|
||||||
case "jwt": {
|
case "jwt": {
|
||||||
return this.customJwt({
|
return this.customJwt({
|
||||||
jwt: params.jwt,
|
jwt: params.jwt,
|
||||||
@@ -179,11 +191,11 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
);
|
);
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Error logging in with ${oauthOption.provider}: ${error.message}`,
|
`Error signing in with ${oauthOption.provider}: ${error.message}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`An unknown error occurred logging in with ${oauthOption.provider}`,
|
`An unknown error occurred signing in with ${oauthOption.provider}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { isDeviceSharePresentForUser } from "./helpers/storage/local";
|
|||||||
import { Auth } from "aws-amplify";
|
import { Auth } from "aws-amplify";
|
||||||
import {
|
import {
|
||||||
ROUTE_AUTH_JWT_CALLBACK,
|
ROUTE_AUTH_JWT_CALLBACK,
|
||||||
ROUTE_HEADLESS_GOOGLE_LOGIN,
|
ROUTE_HEADLESS_OAUTH_LOGIN,
|
||||||
} from "./helpers/constants";
|
} from "./helpers/constants";
|
||||||
import { AuthOptions, OauthOption, VerifiedTokenResponse } from "../types";
|
import { AuthOptions, OauthOption, VerifiedTokenResponse } from "../types";
|
||||||
import { InAppBrowser } from "react-native-inappbrowser-reborn";
|
import { InAppBrowser } from "react-native-inappbrowser-reborn";
|
||||||
@@ -171,17 +171,16 @@ export async function validateEmailOTP(options: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
||||||
const headlessLoginLinkWithParams = `${ROUTE_HEADLESS_GOOGLE_LOGIN}?authProvider=${encodeURIComponent(
|
const encodedProvider = encodeURIComponent(oauthOptions.provider);
|
||||||
oauthOptions.provider,
|
const headlessLoginLinkWithParams = `${ROUTE_HEADLESS_OAUTH_LOGIN}?authProvider=${encodedProvider}&baseUrl=${encodeURIComponent(
|
||||||
)}&baseUrl=${encodeURIComponent(
|
`https://embedded-wallet.thirdweb.com`,
|
||||||
"https://embedded-wallet.thirdweb.com",
|
|
||||||
)}&platform=${encodeURIComponent("mobile")}`;
|
)}&platform=${encodeURIComponent("mobile")}`;
|
||||||
|
|
||||||
const resp = await fetch(headlessLoginLinkWithParams);
|
const resp = await fetch(headlessLoginLinkWithParams);
|
||||||
|
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
const error = await resp.json();
|
const error = await resp.json();
|
||||||
throw new Error(`Error getting headless login link: ${error.message}`);
|
throw new Error(`Error getting headless sign in link: ${error.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const json = await resp.json();
|
const json = await resp.json();
|
||||||
@@ -192,7 +191,7 @@ export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
|||||||
clientId || "",
|
clientId || "",
|
||||||
)}&platform=${encodeURIComponent("mobile")}&redirectUrl=${encodeURIComponent(
|
)}&platform=${encodeURIComponent("mobile")}&redirectUrl=${encodeURIComponent(
|
||||||
oauthOptions.redirectUrl,
|
oauthOptions.redirectUrl,
|
||||||
)}`;
|
)}&authOption=${encodedProvider}`;
|
||||||
|
|
||||||
const result = await InAppBrowser.openAuth(
|
const result = await InAppBrowser.openAuth(
|
||||||
completeLoginUrl,
|
completeLoginUrl,
|
||||||
@@ -207,16 +206,23 @@ export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (result.type === "cancel") {
|
||||||
|
throw new Error(`Sign in cancelled`);
|
||||||
|
}
|
||||||
|
|
||||||
if (result.type !== "success") {
|
if (result.type !== "success") {
|
||||||
throw new Error("Error signing in. Please try again later.");
|
throw new Error(`Can't sign in with ${oauthOptions.provider}: ${result}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const decodedUrl = decodeURIComponent(result.url);
|
const decodedUrl = decodeURIComponent(result.url);
|
||||||
|
|
||||||
const parts = decodedUrl.split("?authResult=");
|
const parts = decodedUrl.split("?authResult=");
|
||||||
if (parts.length < 2) {
|
if (parts.length < 2) {
|
||||||
throw new Error("Malformed response from the login redirect");
|
// assume error
|
||||||
|
const error = decodedUrl.split("?error=")?.[1];
|
||||||
|
throw new Error(`Something went wrong. Please, try again later: ${error}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const authResult = parts[1];
|
const authResult = parts[1];
|
||||||
const { storedToken } = JSON.parse(authResult);
|
const { storedToken } = JSON.parse(authResult);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -35,6 +35,6 @@ export const ROUTE_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedde
|
|||||||
export const ROUTE_VALIDATE_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-thirdweb-email-otp`;
|
export const ROUTE_VALIDATE_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/validate-thirdweb-email-otp`;
|
||||||
export const ROUTE_IS_VALID_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/is-thirdweb-email-otp-valid`;
|
export const ROUTE_IS_VALID_USER_MANAGED_OTP = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/is-thirdweb-email-otp-valid`;
|
||||||
|
|
||||||
export const ROUTE_HEADLESS_GOOGLE_LOGIN = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/headless-oauth-login-link`;
|
export const ROUTE_HEADLESS_OAUTH_LOGIN = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/headless-oauth-login-link`;
|
||||||
|
|
||||||
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2023_10_20_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
||||||
|
|||||||
+3
-3
@@ -91,9 +91,9 @@ function createWalletShares(): {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Store user's wallet shares. Encrypts authShare and recoveryShare as given clientSide as well.
|
* Store user's wallet shares. Encrypts authShare and recoveryShare as given clientSide as well.
|
||||||
* @param {string} walletAddress the user's wallet address. Note that for each logged in user and clientId, we have a single walletAddress. This will error if we attempt to store shares for user's with an existing wallet different from the walletAddress
|
* @param walletAddress - the user's wallet address. Note that for each logged in user and clientId, we have a single walletAddress. This will error if we attempt to store shares for user's with an existing wallet different from the walletAddress
|
||||||
* @param {string} authShare the *unencrypted* authShare for the user
|
* @param authShare - the *unencrypted* authShare for the user
|
||||||
* @param {string} recoveryShare the *unencrypted* recovery share for the user
|
* @param recoveryShare - the *unencrypted* recovery share for the user
|
||||||
* @throws if another walletAddress already exists
|
* @throws if another walletAddress already exists
|
||||||
*/
|
*/
|
||||||
export async function storeShares<R extends string | undefined>({
|
export async function storeShares<R extends string | undefined>({
|
||||||
|
|||||||
+2
-2
@@ -46,9 +46,9 @@ export async function getExistingUserEtherJsWallet(clientId: string) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param deviceShare retrieves the current share associated with the user's device.
|
* @param deviceShare - retrieves the current share associated with the user's device.
|
||||||
* @returns the requested shares
|
* @returns the requested shares
|
||||||
* @throws if attempting to get {@param deviceShare} when it's not present
|
* @throws if attempting to get deviceShare when it's not present
|
||||||
*/
|
*/
|
||||||
export async function getShares<
|
export async function getShares<
|
||||||
A extends boolean,
|
A extends boolean,
|
||||||
|
|||||||
@@ -62,8 +62,8 @@ type EmailVerificationAuthParams = {
|
|||||||
recoveryCode?: string;
|
recoveryCode?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
type GoogleAuthParams = {
|
type SocialAuthParams = {
|
||||||
strategy: "google";
|
strategy: "google" | "facebook" | "apple";
|
||||||
redirectUrl: string;
|
redirectUrl: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ type JwtAuthParams = {
|
|||||||
// this is the input to 'authenticate'
|
// this is the input to 'authenticate'
|
||||||
export type AuthParams =
|
export type AuthParams =
|
||||||
| EmailVerificationAuthParams
|
| EmailVerificationAuthParams
|
||||||
| GoogleAuthParams
|
| SocialAuthParams
|
||||||
| JwtAuthParams;
|
| JwtAuthParams;
|
||||||
|
|
||||||
// TODO typed based off AuthParams["strategy"]
|
// TODO typed based off AuthParams["strategy"]
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { useCoinbaseWalletListener } from "./useCoinbaseWalletListener";
|
|||||||
* const connect = useCoinbaseWallet('org.reactjs.native.example.test15://');
|
* const connect = useCoinbaseWallet('org.reactjs.native.example.test15://');
|
||||||
* connect();
|
* connect();
|
||||||
*
|
*
|
||||||
* @param callbackURL The Universal Link used by Coinbase Wallet to return responses to your application.
|
* @param callbackURL - The Universal Link used by Coinbase Wallet to return responses to your application.
|
||||||
* @returns connect function to connect to the Coinbase wallet
|
* @returns connect function to connect to the Coinbase wallet
|
||||||
*/
|
*/
|
||||||
export function useCoinbaseWallet(callbackURL: URL) {
|
export function useCoinbaseWallet(callbackURL: URL) {
|
||||||
|
|||||||
@@ -2,63 +2,79 @@ import { useWallet } from "@thirdweb-dev/react-core";
|
|||||||
import { useCallback, useEffect } from "react";
|
import { useCallback, useEffect } from "react";
|
||||||
import { useModalState } from "../../providers/ui-context-provider";
|
import { useModalState } from "../../providers/ui-context-provider";
|
||||||
import {
|
import {
|
||||||
IWalletConnectReceiver,
|
|
||||||
WCProposal,
|
WCProposal,
|
||||||
WCRequest,
|
WCRequest,
|
||||||
|
WalletConnectHandler,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers listeners for wallet connect if the active wallet
|
* Registers listeners for wallet connect if the active wallet
|
||||||
* is a smart wallet and has connect to app enabled
|
* is also a WalletConnectReceiver
|
||||||
*/
|
*/
|
||||||
export function useWalletConnectListener() {
|
export function useWalletConnectListener(
|
||||||
|
walletConnectHandler?: WalletConnectHandler,
|
||||||
|
) {
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const { setModalState } = useModalState();
|
const { setModalState } = useModalState();
|
||||||
|
|
||||||
const onSmartWalletWCMessage = useCallback(
|
const onSessionProposal = useCallback(
|
||||||
({ type, data }: { type: string; data?: unknown }) => {
|
(proposal: WCProposal) => {
|
||||||
switch (type) {
|
setModalState({
|
||||||
case "session_proposal":
|
view: "WalletConnectSessionProposalModal",
|
||||||
setModalState({
|
caller: "WCSessionProposalListener",
|
||||||
view: "WalletConnectSessionProposalModal",
|
data: proposal,
|
||||||
caller: "WCSessionProposalListener",
|
isOpen: true,
|
||||||
data: data as WCProposal,
|
isSheet: false,
|
||||||
isOpen: true,
|
});
|
||||||
isSheet: false,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
case "session_delete":
|
|
||||||
// reset();
|
|
||||||
break;
|
|
||||||
case "session_request":
|
|
||||||
setModalState({
|
|
||||||
view: "WalletConnectSessionRequestModal",
|
|
||||||
caller: "WCSessionRequestListener",
|
|
||||||
data: data as WCRequest,
|
|
||||||
isOpen: true,
|
|
||||||
isSheet: false,
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// method not implemented
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
[setModalState],
|
[setModalState],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onSessionRequest = useCallback(
|
||||||
|
(proposal: WCRequest) => {
|
||||||
|
setModalState({
|
||||||
|
view: "WalletConnectSessionRequestModal",
|
||||||
|
caller: "WCSessionRequestListener",
|
||||||
|
data: proposal,
|
||||||
|
isOpen: true,
|
||||||
|
isSheet: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[setModalState],
|
||||||
|
);
|
||||||
|
|
||||||
|
const onSessionDelete = useCallback(() => {
|
||||||
|
// consider clearing local storage
|
||||||
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (!walletConnectHandler) {
|
||||||
activeWallet &&
|
return;
|
||||||
"isWCReceiverEnabled" in activeWallet &&
|
|
||||||
(activeWallet as unknown as IWalletConnectReceiver).isWCReceiverEnabled()
|
|
||||||
) {
|
|
||||||
activeWallet.addListener("message", onSmartWalletWCMessage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
walletConnectHandler.addListener("session_proposal", onSessionProposal);
|
||||||
|
walletConnectHandler.addListener("session_delete", onSessionDelete);
|
||||||
|
walletConnectHandler.addListener("session_request", onSessionRequest);
|
||||||
|
// consider adding switch_chain as well
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (activeWallet) {
|
if (walletConnectHandler) {
|
||||||
activeWallet.removeListener("message", onSmartWalletWCMessage);
|
walletConnectHandler.removeListener(
|
||||||
|
"session_proposal",
|
||||||
|
onSessionProposal,
|
||||||
|
);
|
||||||
|
walletConnectHandler.removeListener("session_delete", onSessionDelete);
|
||||||
|
walletConnectHandler.removeListener(
|
||||||
|
"session_request",
|
||||||
|
onSessionRequest,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [activeWallet, onSmartWalletWCMessage]);
|
}, [
|
||||||
|
activeWallet,
|
||||||
|
onSessionDelete,
|
||||||
|
onSessionProposal,
|
||||||
|
onSessionRequest,
|
||||||
|
walletConnectHandler,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { APPLE_ICON, EMAIL_WALLET_ICON, GOOGLE_ICON } from "../../assets";
|
||||||
|
import { LocaleType } from "../../i18n/types";
|
||||||
|
|
||||||
|
export type AuthOption = "email" | SocialLogin;
|
||||||
|
|
||||||
|
export type SocialLogin = "google" | "apple";
|
||||||
|
|
||||||
|
export type AuthOptionDictionary = Record<AuthOption, string>;
|
||||||
|
|
||||||
|
export const AUTH_OPTIONS_ICONS: AuthOptionDictionary = {
|
||||||
|
google: GOOGLE_ICON,
|
||||||
|
email: EMAIL_WALLET_ICON,
|
||||||
|
apple: APPLE_ICON,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AUTH_OPTIONS_TEXT: Record<
|
||||||
|
AuthOption,
|
||||||
|
keyof LocaleType["embedded_wallet"]
|
||||||
|
> = {
|
||||||
|
google: "sign_in_google",
|
||||||
|
email: "sign_in_email",
|
||||||
|
apple: "sign_in_apple",
|
||||||
|
};
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { WalletInstance } from "@thirdweb-dev/react-core";
|
||||||
|
|
||||||
|
export const isWalletConnectReceiverEnabled = (wallet?: WalletInstance) => {
|
||||||
|
const options = wallet?.getOptions();
|
||||||
|
return options && "walletConnectReceiver" in options;
|
||||||
|
};
|
||||||
@@ -6,6 +6,14 @@ import {
|
|||||||
import type { MagicConnector as MagicConnectorType } from "../connectors/magic/magic-connector";
|
import type { MagicConnector as MagicConnectorType } from "../connectors/magic/magic-connector";
|
||||||
import { MagicConnector } from "../connectors/magic/magic-connector";
|
import { MagicConnector } from "../connectors/magic/magic-connector";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated We have deprecated magicLink in favor of our embeddedWallet which adds support for more sign in methods.
|
||||||
|
* To learn more, please see:
|
||||||
|
*
|
||||||
|
* Our release notes: https://portal.thirdweb.com/embedded-wallet
|
||||||
|
*
|
||||||
|
* Our documentation: https://portal.thirdweb.com/react-native/react-native.embeddedwallet
|
||||||
|
*/
|
||||||
export class MagicLink extends AbstractClientWallet<
|
export class MagicLink extends AbstractClientWallet<
|
||||||
MagicLinkOptions,
|
MagicLinkOptions,
|
||||||
MagicConnectorOptions
|
MagicConnectorOptions
|
||||||
|
|||||||
@@ -4,19 +4,24 @@ import { ActivityIndicator, Keyboard } from "react-native";
|
|||||||
import {
|
import {
|
||||||
SelectUIProps,
|
SelectUIProps,
|
||||||
useCreateWalletInstance,
|
useCreateWalletInstance,
|
||||||
|
useWallets,
|
||||||
} from "@thirdweb-dev/react-core";
|
} from "@thirdweb-dev/react-core";
|
||||||
import Box from "../../../components/base/Box";
|
import Box from "../../../components/base/Box";
|
||||||
import Text from "../../../components/base/Text";
|
import Text from "../../../components/base/Text";
|
||||||
import BaseButton from "../../../components/base/BaseButton";
|
import BaseButton from "../../../components/base/BaseButton";
|
||||||
import { TextInput } from "../../../components/base/TextInput";
|
import { TextInput } from "../../../components/base/TextInput";
|
||||||
import { GOOGLE_ICON } from "../../../assets/svgs";
|
|
||||||
import { WalletButton } from "../../../components/base/WalletButton";
|
import { WalletButton } from "../../../components/base/WalletButton";
|
||||||
import {
|
import {
|
||||||
useGlobalTheme,
|
useGlobalTheme,
|
||||||
useLocale,
|
useLocale,
|
||||||
} from "../../../providers/ui-context-provider";
|
} from "../../../providers/ui-context-provider";
|
||||||
import { EmbeddedWalletConfig } from "./embedded-wallet";
|
import { EmbeddedWalletConfig } from "./embedded-wallet";
|
||||||
import { AuthProvider } from "@thirdweb-dev/wallets";
|
import {
|
||||||
|
AUTH_OPTIONS_ICONS,
|
||||||
|
AUTH_OPTIONS_TEXT,
|
||||||
|
AuthOption,
|
||||||
|
} from "../../types/embedded-wallet";
|
||||||
|
import { SquareButton } from "../../../components/base/SquareButton";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UI for selecting wallet - this UI is rendered in the wallet selection screen
|
* UI for selecting wallet - this UI is rendered in the wallet selection screen
|
||||||
@@ -33,9 +38,11 @@ export const EmailSelectionUI: React.FC<
|
|||||||
const [isFetching, setIsFetching] = useState<boolean>(false);
|
const [isFetching, setIsFetching] = useState<boolean>(false);
|
||||||
const createWalletInstance = useCreateWalletInstance();
|
const createWalletInstance = useCreateWalletInstance();
|
||||||
const [emailWallet, setEmailWallet] = useState<EmbeddedWallet | null>(null);
|
const [emailWallet, setEmailWallet] = useState<EmbeddedWallet | null>(null);
|
||||||
|
const supportedWallets = useWallets();
|
||||||
|
|
||||||
const isEmailEnabled = auth?.options.includes("email");
|
const isEmailEnabled = auth?.options.includes("email");
|
||||||
const isGoogleEnabled = auth?.options.includes("google");
|
const socialLogins = auth?.options.filter((o) => o !== "email");
|
||||||
|
const isSocialLoginsEnabled = socialLogins && socialLogins.length > 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const emailWalletInstance = createWalletInstance(
|
const emailWalletInstance = createWalletInstance(
|
||||||
@@ -79,12 +86,12 @@ export const EmailSelectionUI: React.FC<
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onGoogleSignInPress = () => {
|
const onProviderPress = (authOption: Omit<AuthOption, "email">) => {
|
||||||
onSelect({
|
onSelect({
|
||||||
email: emailInput,
|
email: emailInput,
|
||||||
emailWallet,
|
emailWallet,
|
||||||
oauthOptions: {
|
oauthOptions: {
|
||||||
provider: AuthProvider.GOOGLE,
|
provider: authOption,
|
||||||
redirectUrl: auth?.redirectUrl,
|
redirectUrl: auth?.redirectUrl,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -92,22 +99,37 @@ export const EmailSelectionUI: React.FC<
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box paddingHorizontal="xl" mt="lg">
|
<Box paddingHorizontal="xl" mt="lg">
|
||||||
{isGoogleEnabled ? (
|
{isSocialLoginsEnabled ? (
|
||||||
<Box justifyContent="center">
|
<Box justifyContent="center">
|
||||||
<WalletButton
|
<Box justifyContent="center" flexDirection="row">
|
||||||
iconHeight={28}
|
{socialLogins.length === 1 ? (
|
||||||
iconWidth={28}
|
<WalletButton
|
||||||
borderRadius="lg"
|
iconHeight={28}
|
||||||
borderWidth={1}
|
iconWidth={28}
|
||||||
borderColor="buttonBackgroundColor"
|
borderRadius="lg"
|
||||||
backgroundColor="buttonBackgroundColor"
|
borderWidth={1}
|
||||||
nameColor="buttonTextColor"
|
borderColor="buttonBackgroundColor"
|
||||||
justifyContent="center"
|
backgroundColor="buttonBackgroundColor"
|
||||||
name={l.embedded_wallet.sign_in_google}
|
nameColor="buttonTextColor"
|
||||||
walletIconUrl={GOOGLE_ICON}
|
flex={1}
|
||||||
onPress={onGoogleSignInPress}
|
justifyContent="center"
|
||||||
/>
|
name={l.embedded_wallet[AUTH_OPTIONS_TEXT[socialLogins[0]]]}
|
||||||
{isEmailEnabled ? (
|
walletIconUrl={AUTH_OPTIONS_ICONS[socialLogins[0]]}
|
||||||
|
onPress={() => onProviderPress(socialLogins[0])}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
socialLogins.map((provider, index) => (
|
||||||
|
<SquareButton
|
||||||
|
key={provider}
|
||||||
|
ml={index === 0 ? 0 : "md"}
|
||||||
|
onPress={() => onProviderPress(provider)}
|
||||||
|
iconUrl={AUTH_OPTIONS_ICONS[provider]}
|
||||||
|
size={40}
|
||||||
|
/>
|
||||||
|
))
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
{isEmailEnabled && supportedWallets.length === 1 ? (
|
||||||
<Box
|
<Box
|
||||||
mb="md"
|
mb="md"
|
||||||
mt="md"
|
mt="md"
|
||||||
@@ -125,7 +147,9 @@ export const EmailSelectionUI: React.FC<
|
|||||||
</Text>
|
</Text>
|
||||||
<Box height={1} flex={1} backgroundColor="border" />
|
<Box height={1} flex={1} backgroundColor="border" />
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) : (
|
||||||
|
<Box mt="md" />
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) : null}
|
||||||
{isEmailEnabled ? (
|
{isEmailEnabled ? (
|
||||||
|
|||||||
+19
-12
@@ -7,9 +7,9 @@ import {
|
|||||||
useSetConnectedWallet,
|
useSetConnectedWallet,
|
||||||
useSetConnectionStatus,
|
useSetConnectionStatus,
|
||||||
} from "@thirdweb-dev/react-core";
|
} from "@thirdweb-dev/react-core";
|
||||||
import { GOOGLE_ICON } from "../../../assets";
|
|
||||||
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
||||||
import { Box, Text, WalletButton } from "../../../components/base";
|
import { Box, Text, WalletButton } from "../../../components/base";
|
||||||
|
import { AUTH_OPTIONS_ICONS, SocialLogin } from "../../types/embedded-wallet";
|
||||||
|
|
||||||
export const EmbeddedSocialConnection: React.FC<
|
export const EmbeddedSocialConnection: React.FC<
|
||||||
ConnectUIProps<EmbeddedWallet>
|
ConnectUIProps<EmbeddedWallet>
|
||||||
@@ -18,19 +18,19 @@ export const EmbeddedSocialConnection: React.FC<
|
|||||||
const setConnectionStatus = useSetConnectionStatus();
|
const setConnectionStatus = useSetConnectionStatus();
|
||||||
const [errorMessage, setErrorMessage] = useState<string>();
|
const [errorMessage, setErrorMessage] = useState<string>();
|
||||||
|
|
||||||
const handleGoogleLogin = useCallback(() => {
|
const handleSocialLogin = useCallback(() => {
|
||||||
setErrorMessage("");
|
setErrorMessage("");
|
||||||
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
const emailWallet = selectionData.emailWallet as EmbeddedWallet;
|
const embeddedWallet = selectionData.emailWallet as EmbeddedWallet;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const authResult = await emailWallet.authenticate({
|
const authResult = await embeddedWallet.authenticate({
|
||||||
strategy: "google",
|
strategy: selectionData.oauthOptions?.provider as SocialLogin,
|
||||||
redirectUrl: selectionData.oauthOptions?.redirectUrl,
|
redirectUrl: selectionData.oauthOptions?.redirectUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = await emailWallet.connect({ authResult });
|
const response = await embeddedWallet.connect({ authResult });
|
||||||
|
|
||||||
if (response) {
|
if (response) {
|
||||||
if (onLocallyConnected) {
|
if (onLocallyConnected) {
|
||||||
@@ -41,12 +41,15 @@ export const EmbeddedSocialConnection: React.FC<
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setErrorMessage(
|
setErrorMessage(
|
||||||
response || "Error login in. Please try again later.",
|
response || "Error signing in. Please try again later.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error logging in with google: ", error);
|
console.error(
|
||||||
setErrorMessage(`Error login in. ${error}`);
|
`Error signing in with ${selectionData.oauthOptions?.provider}: `,
|
||||||
|
error,
|
||||||
|
);
|
||||||
|
setErrorMessage(`${error}`);
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}, [
|
}, [
|
||||||
@@ -58,8 +61,8 @@ export const EmbeddedSocialConnection: React.FC<
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
handleGoogleLogin();
|
handleSocialLogin();
|
||||||
}, [handleGoogleLogin]);
|
}, [handleSocialLogin]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box marginHorizontal="xl" height={200}>
|
<Box marginHorizontal="xl" height={200}>
|
||||||
@@ -71,7 +74,11 @@ export const EmbeddedSocialConnection: React.FC<
|
|||||||
borderRadius="lg"
|
borderRadius="lg"
|
||||||
justifyContent="center"
|
justifyContent="center"
|
||||||
name="Sign In"
|
name="Sign In"
|
||||||
walletIconUrl={GOOGLE_ICON}
|
walletIconUrl={
|
||||||
|
AUTH_OPTIONS_ICONS[
|
||||||
|
selectionData.oauthOptions?.provider as SocialLogin
|
||||||
|
]
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
subHeaderText={""}
|
subHeaderText={""}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {
|
|||||||
AbstractClientWallet,
|
AbstractClientWallet,
|
||||||
EmbeddedWalletAdditionalOptions,
|
EmbeddedWalletAdditionalOptions,
|
||||||
walletIds,
|
walletIds,
|
||||||
|
WalletConnectReceiverConfig,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
import type { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
import type { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
||||||
import {
|
import {
|
||||||
@@ -11,8 +12,9 @@ import {
|
|||||||
} from "../../connectors/embedded-wallet/types";
|
} from "../../connectors/embedded-wallet/types";
|
||||||
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
||||||
|
|
||||||
export type EmbeddedWalletOptions =
|
export type EmbeddedWalletOptions = WalletOptions<
|
||||||
WalletOptions<EmbeddedWalletAdditionalOptions>;
|
EmbeddedWalletAdditionalOptions & WalletConnectReceiverConfig
|
||||||
|
>;
|
||||||
|
|
||||||
export class EmbeddedWallet extends AbstractClientWallet<
|
export class EmbeddedWallet extends AbstractClientWallet<
|
||||||
EmbeddedWalletOptions,
|
EmbeddedWalletOptions,
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const EnterPassword = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onForgotPress = () => {
|
const onForgotPress = () => {
|
||||||
// console.log("[TODO] Implement", setErrorMessage);
|
// [TODO] Forgot password
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import {
|
|||||||
} from "@thirdweb-dev/react-core";
|
} from "@thirdweb-dev/react-core";
|
||||||
import { EmbeddedConnectionUI } from "./EmbeddedConnectionUI";
|
import { EmbeddedConnectionUI } from "./EmbeddedConnectionUI";
|
||||||
import { EmailSelectionUI } from "./EmbeddedSelectionUI";
|
import { EmailSelectionUI } from "./EmbeddedSelectionUI";
|
||||||
|
import { AuthOption } from "../../types/embedded-wallet";
|
||||||
type AuthOption = "email" | "google";
|
import { WalletConnectReceiverConfig } from "@thirdweb-dev/wallets";
|
||||||
|
|
||||||
export type EmbeddedWalletConfig = {
|
export type EmbeddedWalletConfig = {
|
||||||
auth?: {
|
auth?: {
|
||||||
options: AuthOption[];
|
options: AuthOption[];
|
||||||
redirectUrl?: string;
|
redirectUrl?: string;
|
||||||
};
|
};
|
||||||
};
|
} & WalletConnectReceiverConfig;
|
||||||
|
|
||||||
export const embeddedWallet = (
|
export const embeddedWallet = (
|
||||||
config?: EmbeddedWalletConfig,
|
config?: EmbeddedWalletConfig,
|
||||||
@@ -36,6 +36,7 @@ export const embeddedWallet = (
|
|||||||
create(options: WalletOptions) {
|
create(options: WalletOptions) {
|
||||||
return new EmbeddedWallet({
|
return new EmbeddedWallet({
|
||||||
...options,
|
...options,
|
||||||
|
...config,
|
||||||
clientId: options.clientId || "",
|
clientId: options.clientId || "",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -21,6 +21,18 @@ import React from "react";
|
|||||||
import { ConnectingWallet } from "../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWallet";
|
import { ConnectingWallet } from "../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWallet";
|
||||||
import { useGlobalTheme, useLocale } from "../../providers/ui-context-provider";
|
import { useGlobalTheme, useLocale } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param magicLinkOptions - Options available to create a magic link wallet
|
||||||
|
* @returns A WalletConfig<MagicLink> object
|
||||||
|
*
|
||||||
|
* @deprecated We have deprecated magicLink in favor of our embeddedWallet which adds support for more sign in methods.
|
||||||
|
* To learn more, please see:
|
||||||
|
*
|
||||||
|
* Our release notes: https://portal.thirdweb.com/embedded-wallet
|
||||||
|
*
|
||||||
|
* Our documentation: https://portal.thirdweb.com/react-native/react-native.embeddedwallet
|
||||||
|
*/
|
||||||
export const magicLink = (
|
export const magicLink = (
|
||||||
magicLinkOptions: MagicLinkOptions & { recommended?: boolean },
|
magicLinkOptions: MagicLinkOptions & { recommended?: boolean },
|
||||||
): WalletConfig<MagicLink> => {
|
): WalletConfig<MagicLink> => {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import type { WalletConfig, WalletOptions } from "@thirdweb-dev/react-core";
|
import type { WalletConfig, WalletOptions } from "@thirdweb-dev/react-core";
|
||||||
import { SmartWallet, createAsyncLocalStorage } from "@thirdweb-dev/wallets";
|
import { SmartWallet, createAsyncLocalStorage } from "@thirdweb-dev/wallets";
|
||||||
import { createSyncStorage } from "../../../core/AsyncStorage";
|
|
||||||
import { SmartWalletConfig } from "../types/smart-wallet";
|
import { SmartWalletConfig } from "../types/smart-wallet";
|
||||||
import { SmartWalletFlow } from "../../components/ConnectWalletFlow/SmartWallet/SmartWalletFlow";
|
import { SmartWalletFlow } from "../../components/ConnectWalletFlow/SmartWallet/SmartWalletFlow";
|
||||||
|
|
||||||
@@ -17,7 +16,6 @@ export const smartWallet = (
|
|||||||
...options,
|
...options,
|
||||||
...config,
|
...config,
|
||||||
walletStorage: createAsyncLocalStorage("smart-wallet"),
|
walletStorage: createAsyncLocalStorage("smart-wallet"),
|
||||||
wcStorage: createSyncStorage("smart-wallet"),
|
|
||||||
}),
|
}),
|
||||||
connectUI(props) {
|
connectUI(props) {
|
||||||
return <SmartWalletFlow {...props} personalWalletConfig={wallet} />;
|
return <SmartWalletFlow {...props} personalWalletConfig={wallet} />;
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ["thirdweb"],
|
extends: ["thirdweb", "plugin:i18next/recommended"],
|
||||||
plugins: ["better-tree-shaking"],
|
plugins: ["better-tree-shaking", "eslint-plugin-tsdoc"],
|
||||||
rules: {
|
rules: {
|
||||||
|
"tsdoc/syntax": "warn",
|
||||||
"@next/next/no-img-element": "off",
|
"@next/next/no-img-element": "off",
|
||||||
"better-tree-shaking/no-top-level-side-effects": "error",
|
"better-tree-shaking/no-top-level-side-effects": "error",
|
||||||
|
"i18next/no-literal-string": 2,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,113 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 4.1.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1943](https://github.com/thirdweb-dev/js/pull/1943) [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3) Thanks [@iketw](https://github.com/iketw)! - Adds tsdoc warnings to enforce a common comments format
|
||||||
|
|
||||||
|
- [#1929](https://github.com/thirdweb-dev/js/pull/1929) [`06e59cf9`](https://github.com/thirdweb-dev/js/commit/06e59cf91647e4080829d49f8cb91a4d8fdc87f7) Thanks [@iketw](https://github.com/iketw)! - Move addresses' utils to the core package
|
||||||
|
|
||||||
|
- [#1920](https://github.com/thirdweb-dev/js/pull/1920) [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e) Thanks [@ElasticBottle](https://github.com/ElasticBottle)! - feat: add apple auth to embedded wallet
|
||||||
|
|
||||||
|
```
|
||||||
|
<ThirdwebProvider
|
||||||
|
supportedWallets={[
|
||||||
|
embeddedWallet({
|
||||||
|
auth: {
|
||||||
|
options: ["google", "email", "apple"], // <- new apple option!
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b), [`a81a5285`](https://github.com/thirdweb-dev/js/commit/a81a5285b7ef4ddf47fd2779ab80ebbef4bd9e0e), [`30ea9c6b`](https://github.com/thirdweb-dev/js/commit/30ea9c6bf74b483a98592a1d8d64589b7f1b22a3), [`06e59cf9`](https://github.com/thirdweb-dev/js/commit/06e59cf91647e4080829d49f8cb91a4d8fdc87f7), [`97fdbc8f`](https://github.com/thirdweb-dev/js/commit/97fdbc8f6443dcd08a7610e4437bd4c9d6b0e8c8), [`3f3a484a`](https://github.com/thirdweb-dev/js/commit/3f3a484a3aa6e9f784e4d44458461bac0d3d4c6b)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.2
|
||||||
|
- @thirdweb-dev/react-core@4.1.3
|
||||||
|
- @thirdweb-dev/sdk@4.0.12
|
||||||
|
|
||||||
|
## 4.1.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1906](https://github.com/thirdweb-dev/js/pull/1906) [`b90d3af5`](https://github.com/thirdweb-dev/js/commit/b90d3af5b8cfb762b38a88d7997879be9b5744bf) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add `hideSwitchToPersonalWallet` prop on `ConnectWallet` component to hide the "switch to Personal wallet" option in the ConnectWallet dropdown which is shown when wallet is connected to either Smart Wallet or Safe
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
<ConnectWallet hideSwitchToPersonalWallet={true} > // default: false
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1891](https://github.com/thirdweb-dev/js/pull/1891) [`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add Core wallet (Avalanche)
|
||||||
|
|
||||||
|
- [#1847](https://github.com/thirdweb-dev/js/pull/1847) [`c34ac468`](https://github.com/thirdweb-dev/js/commit/c34ac468fbf983a6806cd88828c77eb6d7231e78) Thanks [@MananTank](https://github.com/MananTank)! - Add Localization API to change language used in components `ConnectWallet` and `Web3Button` and/or override the default texts
|
||||||
|
|
||||||
|
### Japanese
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { ja } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const japanese = ja();
|
||||||
|
|
||||||
|
<ThirdwebProvider locale={japanese}>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Spanish
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { es } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const spanish = es();
|
||||||
|
|
||||||
|
<ThirdwebProvider locale={spanish}>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
### English ( default )
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { en } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const english = en();
|
||||||
|
|
||||||
|
<ThirdwebProvider locale={english}>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
This API also allows overriding the default texts in the locale object. You can override all the texts or just some parts
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
import { en } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
// override some texts
|
||||||
|
const english = en({
|
||||||
|
connectWallet: {
|
||||||
|
confirmInWallet: "Confirm in your wallet",
|
||||||
|
},
|
||||||
|
wallets: {
|
||||||
|
metamaskWallet: {
|
||||||
|
connectionScreen: {
|
||||||
|
inProgress: "Awaiting Confirmation",
|
||||||
|
instruction: "Accept connection request in your MetaMask wallet",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
<ThirdwebProvider locale={english}>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`0dcb15b7`](https://github.com/thirdweb-dev/js/commit/0dcb15b7e647acd038b0ec8b1a2b200808aae00e), [`fefeaeef`](https://github.com/thirdweb-dev/js/commit/fefeaeef18f52a75462c43da8b85a77975d32e01), [`20d0f53b`](https://github.com/thirdweb-dev/js/commit/20d0f53b46a2975a0a14ddaa4a377f2f758804db), [`91c2352b`](https://github.com/thirdweb-dev/js/commit/91c2352b03d7cf1c3cbbbc98846f248b0f707ea7)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.58
|
||||||
|
- @thirdweb-dev/sdk@4.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.1.1
|
||||||
|
- @thirdweb-dev/react-core@4.1.2
|
||||||
|
|
||||||
## 4.1.1
|
## 4.1.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "4.1.1",
|
"version": "4.1.3",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export const DragNDrop: React.FC<{
|
|||||||
extension: string;
|
extension: string;
|
||||||
accept: string;
|
accept: string;
|
||||||
onUpload: (file: File) => void;
|
onUpload: (file: File) => void;
|
||||||
|
locale: {
|
||||||
|
wrongFileError: string;
|
||||||
|
uploadedSuccessfully: string;
|
||||||
|
};
|
||||||
}> = (props) => {
|
}> = (props) => {
|
||||||
const [error, setError] = useState(false);
|
const [error, setError] = useState(false);
|
||||||
const [uploaded, setUploaded] = useState<File | undefined>();
|
const [uploaded, setUploaded] = useState<File | undefined>();
|
||||||
@@ -105,8 +109,7 @@ export const DragNDrop: React.FC<{
|
|||||||
<Spacer y="lg" />
|
<Spacer y="lg" />
|
||||||
{error ? (
|
{error ? (
|
||||||
<Text color="danger" size="sm">
|
<Text color="danger" size="sm">
|
||||||
{" "}
|
{props.locale.wrongFileError}
|
||||||
Please upload a {props.extension} file{" "}
|
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<Text size="sm"> {props.extension} </Text>
|
<Text size="sm"> {props.extension} </Text>
|
||||||
@@ -115,7 +118,7 @@ export const DragNDrop: React.FC<{
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Text weight={600} color="primaryText" center multiline>
|
<Text weight={600} color="primaryText" center multiline>
|
||||||
{uploaded.name} uploaded successfully
|
{uploaded.name} {props.locale.uploadedSuccessfully}
|
||||||
</Text>
|
</Text>
|
||||||
<Spacer y="md" />
|
<Spacer y="md" />
|
||||||
<Container color="success">
|
<Container color="success">
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user