Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cbfd445ae7 | ||
|
|
137f46a547 | ||
|
|
1b8accde30 | ||
|
|
07544252b4 | ||
|
|
8708519cad | ||
|
|
6c30b7efc7 | ||
|
|
8b5e344f72 | ||
|
|
010955ff5c | ||
|
|
956b5645e4 | ||
|
|
068db44603 | ||
|
|
dd7d0fca2d | ||
|
|
526176c471 | ||
|
|
09120c923c | ||
|
|
d1f8e95162 | ||
|
|
6573556d0e | ||
|
|
fc62b91ee5 | ||
|
|
08e9cd206b | ||
|
|
fb0f12ae28 | ||
|
|
c710fc1c62 | ||
|
|
f41ee6fb1c | ||
|
|
513c332ed0 | ||
|
|
693f349db2 | ||
|
|
63ad0050f0 | ||
|
|
dcdb0dcb83 | ||
|
|
b3b9edca29 | ||
|
|
1fbbc2d27d | ||
|
|
4b98e487d4 | ||
|
|
95380eaed4 | ||
|
|
1f3c64d361 | ||
|
|
bb1666b92b | ||
|
|
0f12d1f903 | ||
|
|
74941603a9 |
@@ -1,5 +1,47 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 4.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.7
|
||||||
|
|
||||||
|
## 4.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.6
|
||||||
|
|
||||||
|
## 4.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.5
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`74941603`](https://github.com/thirdweb-dev/js/commit/74941603a96456da46a47147f67c98235ac55022), [`4b98e487`](https://github.com/thirdweb-dev/js/commit/4b98e487d4b47225d7095e5444dc5e7608db48a3), [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9), [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e)]:
|
||||||
|
- @thirdweb-dev/wallets@2.0.2
|
||||||
|
|
||||||
## 4.0.1
|
## 4.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "4.0.1",
|
"version": "4.0.7",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/chains
|
# @thirdweb-dev/chains
|
||||||
|
|
||||||
|
## 0.1.55
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1783](https://github.com/thirdweb-dev/js/pull/1783) [`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64) Thanks [@jnsdls](https://github.com/jnsdls)! - sync chains
|
||||||
|
|
||||||
## 0.1.54
|
## 0.1.54
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 100,
|
"chainId": 100,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "gnosisscan",
|
"name": "blockscout",
|
||||||
"url": "https://gnosisscan.io",
|
"url": "https://gnosis.blockscout.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blockscout",
|
"name": "gnosisscan",
|
||||||
"url": "https://gnosis.blockscout.com",
|
"url": "https://gnosisscan.io",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 11110,
|
"chainId": 11110,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Astra PingPub Explorer",
|
"name": "Astra EVM Explorer (Blockscout)",
|
||||||
"url": "https://ping.astranaut.io/astra",
|
"url": "https://explorer.astranaut.io",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Astra EVM Explorer (Blockscout)",
|
"name": "Astra PingPub Explorer",
|
||||||
"url": "https://explorer.astranaut.io",
|
"url": "https://ping.astranaut.io/astra",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "Astra",
|
"chain": "Astra",
|
||||||
"chainId": 11115,
|
"chainId": 11115,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "Astra PingPub Explorer",
|
|
||||||
"url": "https://ping.astranaut.dev/astra",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Astra EVM Explorer",
|
"name": "Astra EVM Explorer",
|
||||||
"url": "https://explorer.astranaut.dev",
|
"url": "https://explorer.astranaut.dev",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Astra PingPub Explorer",
|
||||||
|
"url": "https://ping.astranaut.dev/astra",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export default {
|
|||||||
},
|
},
|
||||||
"redFlags": [],
|
"redFlags": [],
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://localhost.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
|
||||||
"http://localhost:8545"
|
"http://localhost:8545"
|
||||||
],
|
],
|
||||||
"shortName": "local",
|
"shortName": "local",
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 2023,
|
"chainId": 2023,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Taycan Cosmos Explorer",
|
"name": "Taycan Explorer(Blockscout)",
|
||||||
"url": "https://cosmoscan-test.hupayx.io",
|
"url": "https://evmscan-test.hupayx.io",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Taycan Explorer(Blockscout)",
|
"name": "Taycan Cosmos Explorer",
|
||||||
"url": "https://evmscan-test.hupayx.io",
|
"url": "https://cosmoscan-test.hupayx.io",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default {
|
|||||||
"rpc": [
|
"rpc": [
|
||||||
"https://kava-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://kava-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://evm.testnet.kava.io",
|
"https://evm.testnet.kava.io",
|
||||||
"https://kava-evm-testnet.rpc.thirdweb.com",
|
|
||||||
"wss://wevm.testnet.kava.io"
|
"wss://wevm.testnet.kava.io"
|
||||||
],
|
],
|
||||||
"shortName": "tkava",
|
"shortName": "tkava",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export default {
|
|||||||
"https://evm.kava.io",
|
"https://evm.kava.io",
|
||||||
"https://evm2.kava.io",
|
"https://evm2.kava.io",
|
||||||
"https://kava-rpc.gateway.pokt.network",
|
"https://kava-rpc.gateway.pokt.network",
|
||||||
"https://kava-evm.rpc.thirdweb.com",
|
|
||||||
"wss://wevm.kava.io",
|
"wss://wevm.kava.io",
|
||||||
"wss://wevm2.kava.io",
|
"wss://wevm2.kava.io",
|
||||||
"https://kava-evm.publicnode.com",
|
"https://kava-evm.publicnode.com",
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 30,
|
"chainId": 30,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Rootstock Explorer",
|
"name": "blockscout",
|
||||||
"url": "https://explorer.rsk.co",
|
"url": "https://rootstock.blockscout.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blockscout",
|
"name": "Rootstock Explorer",
|
||||||
"url": "https://rootstock.blockscout.com",
|
"url": "https://explorer.rsk.co",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "SDN",
|
"chain": "SDN",
|
||||||
"chainId": 336,
|
"chainId": 336,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "subscan",
|
|
||||||
"url": "https://shiden.subscan.io",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "blockscout",
|
"name": "blockscout",
|
||||||
"url": "https://blockscout.com/shiden",
|
"url": "https://blockscout.com/shiden",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "subscan",
|
||||||
|
"url": "https://shiden.subscan.io",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 369,
|
"chainId": 369,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "otterscan",
|
"name": "blockscout",
|
||||||
"url": "https://otter.pulsechain.com",
|
"url": "https://scan.pulsechain.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "blockscout",
|
"name": "otterscan",
|
||||||
"url": "https://scan.pulsechain.com",
|
"url": "https://otter.pulsechain.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export default {
|
|||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"infoURL": "http://doschain.io/",
|
"infoURL": "http://doschain.io/",
|
||||||
"name": "DOS Tesnet",
|
"name": "DOS Testnet",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "DOS",
|
"name": "DOS",
|
||||||
"symbol": "DOS",
|
"symbol": "DOS",
|
||||||
@@ -26,10 +26,10 @@ export default {
|
|||||||
},
|
},
|
||||||
"redFlags": [],
|
"redFlags": [],
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://dos-tesnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://dos-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://test.doschain.com"
|
"https://test.doschain.com"
|
||||||
],
|
],
|
||||||
"shortName": "dost",
|
"shortName": "dost",
|
||||||
"slug": "dos-tesnet",
|
"slug": "dos-testnet",
|
||||||
"testnet": true
|
"testnet": true
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -27,8 +27,7 @@ export default {
|
|||||||
"redFlags": [],
|
"redFlags": [],
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://wireshape-floripa-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://wireshape-floripa-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc-floripa.wireshape.org",
|
"https://rpc-floripa.wireshape.org"
|
||||||
"https://wireshape-floripa-testnet.rpc.thirdweb.com"
|
|
||||||
],
|
],
|
||||||
"shortName": "floripa",
|
"shortName": "floripa",
|
||||||
"slug": "wireshape-floripa-testnet",
|
"slug": "wireshape-floripa-testnet",
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 50,
|
"chainId": 50,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "blocksscan",
|
"name": "xdcscan",
|
||||||
"url": "https://xdc.blocksscan.io",
|
"url": "https://xdcscan.io",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xdcscan",
|
"name": "blocksscan",
|
||||||
"url": "https://xdcscan.io",
|
"url": "https://xdc.blocksscan.io",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 51,
|
"chainId": 51,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "blocksscan",
|
"name": "xdcscan",
|
||||||
"url": "https://apothem.blocksscan.io",
|
"url": "https://apothem.xinfinscan.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "xdcscan",
|
"name": "blocksscan",
|
||||||
"url": "https://apothem.xinfinscan.com",
|
"url": "https://apothem.blocksscan.io",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "Imversed",
|
"chain": "Imversed",
|
||||||
"chainId": 5555555,
|
"chainId": 5555555,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "Imversed Cosmos Explorer (Big Dipper)",
|
|
||||||
"url": "https://tex-c.imversed.com",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Imversed EVM explorer (Blockscout)",
|
"name": "Imversed EVM explorer (Blockscout)",
|
||||||
"url": "https://txe.imversed.network",
|
"url": "https://txe.imversed.network",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Imversed Cosmos Explorer (Big Dipper)",
|
||||||
|
"url": "https://tex-c.imversed.com",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "Imversed",
|
"chain": "Imversed",
|
||||||
"chainId": 5555558,
|
"chainId": 5555558,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "Imversed Cosmos Explorer (Big Dipper)",
|
|
||||||
"url": "https://tex-t.imversed.com",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "Imversed EVM Explorer (Blockscout)",
|
"name": "Imversed EVM Explorer (Blockscout)",
|
||||||
"url": "https://txe-test.imversed.network",
|
"url": "https://txe-test.imversed.network",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Imversed Cosmos Explorer (Big Dipper)",
|
||||||
|
"url": "https://tex-t.imversed.com",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 59140,
|
"chainId": 59140,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Blockscout",
|
"name": "Etherscan",
|
||||||
"url": "https://explorer.goerli.linea.build",
|
"url": "https://goerli.lineascan.build",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Etherscan",
|
"name": "Blockscout",
|
||||||
"url": "https://goerli.lineascan.build",
|
"url": "https://explorer.goerli.linea.build",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ export default {
|
|||||||
"name": "lineascan",
|
"name": "lineascan",
|
||||||
"url": "https://lineascan.build",
|
"url": "https://lineascan.build",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Linea Scan",
|
|
||||||
"url": "https://lineascan.build",
|
|
||||||
"standard": ""
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "ASTR",
|
"chain": "ASTR",
|
||||||
"chainId": 592,
|
"chainId": 592,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "subscan",
|
|
||||||
"url": "https://astar.subscan.io",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "blockscout",
|
"name": "blockscout",
|
||||||
"url": "https://blockscout.com/astar",
|
"url": "https://blockscout.com/astar",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "subscan",
|
||||||
|
"url": "https://astar.subscan.io",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 8000,
|
"chainId": 8000,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Teleport Cosmos Explorer (Big Dipper)",
|
"name": "Teleport EVM Explorer (Blockscout)",
|
||||||
"url": "https://explorer.teleport.network",
|
"url": "https://evm-explorer.teleport.network",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Teleport EVM Explorer (Blockscout)",
|
"name": "Teleport Cosmos Explorer (Big Dipper)",
|
||||||
"url": "https://evm-explorer.teleport.network",
|
"url": "https://explorer.teleport.network",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ export default {
|
|||||||
"chainId": 8001,
|
"chainId": 8001,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "Teleport Cosmos Explorer (Big Dipper)",
|
"name": "Teleport EVM Explorer (Blockscout)",
|
||||||
"url": "https://explorer.testnet.teleport.network",
|
"url": "https://evm-explorer.testnet.teleport.network",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Teleport EVM Explorer (Blockscout)",
|
"name": "Teleport Cosmos Explorer (Big Dipper)",
|
||||||
"url": "https://evm-explorer.testnet.teleport.network",
|
"url": "https://explorer.testnet.teleport.network",
|
||||||
"standard": "none"
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "ETH",
|
"chain": "ETH",
|
||||||
"chainId": 8453,
|
"chainId": 8453,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "basescan",
|
|
||||||
"url": "https://basescan.org",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "basescout",
|
"name": "basescout",
|
||||||
"url": "https://base.blockscout.com",
|
"url": "https://base.blockscout.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "basescan",
|
||||||
|
"url": "https://basescan.org",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
|||||||
@@ -3,15 +3,15 @@ export default {
|
|||||||
"chain": "ETH",
|
"chain": "ETH",
|
||||||
"chainId": 84531,
|
"chainId": 84531,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
|
||||||
"name": "basescan",
|
|
||||||
"url": "https://goerli.basescan.org",
|
|
||||||
"standard": "none"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "basescout",
|
"name": "basescout",
|
||||||
"url": "https://base-goerli.blockscout.com",
|
"url": "https://base-goerli.blockscout.com",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "basescan",
|
||||||
|
"url": "https://goerli.basescan.org",
|
||||||
|
"standard": "none"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/chains",
|
"name": "@thirdweb-dev/chains",
|
||||||
"version": "0.1.54",
|
"version": "0.1.55",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const BASE_URI = (process.env.BASE_URI as string) || "https://api.thirdweb.com";
|
|||||||
|
|
||||||
async function getAllPaginatedChains(
|
async function getAllPaginatedChains(
|
||||||
chains: any[] = [],
|
chains: any[] = [],
|
||||||
pathname = "/v1/chains",
|
pathname = "/v1/chains?limit=100",
|
||||||
) {
|
) {
|
||||||
const url = new URL(BASE_URI);
|
const url = new URL(BASE_URI);
|
||||||
url.pathname = pathname;
|
url.pathname = pathname;
|
||||||
@@ -33,31 +33,37 @@ async function sync() {
|
|||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
allChainsInDB.map(async (chain) => {
|
allChainsInDB.map(async (chain) => {
|
||||||
|
let chainId = chain.chainId;
|
||||||
|
// try to convert to number for legacy reasons
|
||||||
|
try {
|
||||||
|
chainId = Number(chainId);
|
||||||
|
} catch {
|
||||||
|
// if we fail here then we cannot use this chain in the chains package for now, so we skip it
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const pkgChain: Chain = {
|
const pkgChain: Chain = {
|
||||||
...chain,
|
...chain,
|
||||||
chainId: Number(chain.chainId),
|
// assing back the chainId
|
||||||
|
chainId,
|
||||||
|
// map the features to the legacy format
|
||||||
features: chain.features?.map((feature) => ({ name: feature })),
|
features: chain.features?.map((feature) => ({ name: feature })),
|
||||||
};
|
};
|
||||||
// remove all null values
|
// remove all null values
|
||||||
Object.keys(pkgChain).forEach((key) => {
|
Object.keys(pkgChain).forEach((key) => {
|
||||||
// @ts-ignore
|
|
||||||
if (pkgChain[key] === null || pkgChain[key] === undefined) {
|
if (pkgChain[key] === null || pkgChain[key] === undefined) {
|
||||||
// @ts-ignore
|
|
||||||
delete pkgChain[key];
|
delete pkgChain[key];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// sort top level keys alphabetically
|
// sort top level keys alphabetically
|
||||||
// @ts-ignore
|
const sortedChain = {} as Chain;
|
||||||
const sortedChain: Chain = {};
|
|
||||||
Object.keys(pkgChain)
|
Object.keys(pkgChain)
|
||||||
.sort()
|
.sort()
|
||||||
.forEach((key) => {
|
.forEach((key) => {
|
||||||
// @ts-ignore
|
|
||||||
sortedChain[key] = pkgChain[key];
|
sortedChain[key] = pkgChain[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
// @ts-ignore
|
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
`${chainsDir}/${sortedChain.chainId}.ts`,
|
`${chainsDir}/${sortedChain.chainId}.ts`,
|
||||||
`import type { Chain } from "../src/types";
|
`import type { Chain } from "../src/types";
|
||||||
@@ -78,17 +84,8 @@ export default ${JSON.stringify(
|
|||||||
exportName = `_${exportName}`;
|
exportName = `_${exportName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// imports.push(`import c${chain.chainId} from "../chains/${chain.chainId}";`);
|
|
||||||
|
|
||||||
// exports.push(
|
|
||||||
// `export { default as ${exportName} } from "../chains/${chain.chainId}"`,
|
|
||||||
// );
|
|
||||||
|
|
||||||
const key = `c${sortedChain.chainId}`;
|
const key = `c${sortedChain.chainId}`;
|
||||||
|
|
||||||
// exportNames.push(key);
|
|
||||||
// exportNameToChain[key] = chain;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
imp: `import c${sortedChain.chainId} from "../chains/${sortedChain.chainId}";`,
|
imp: `import c${sortedChain.chainId} from "../chains/${sortedChain.chainId}";`,
|
||||||
exp: `export { default as ${exportName} } from "../chains/${sortedChain.chainId}"`,
|
exp: `export { default as ${exportName} } from "../chains/${sortedChain.chainId}"`,
|
||||||
@@ -101,20 +98,21 @@ export default ${JSON.stringify(
|
|||||||
|
|
||||||
const { imports, exports, exportNames, exportNameToChain } = results.reduce(
|
const { imports, exports, exportNames, exportNameToChain } = results.reduce(
|
||||||
(acc, result) => {
|
(acc, result) => {
|
||||||
// @ts-ignore
|
// if it's a null result skip it (can happen when we skip chains above because their chainID is out of bounds)
|
||||||
|
if (result === null) {
|
||||||
|
return acc;
|
||||||
|
}
|
||||||
acc.imports.push(result.imp);
|
acc.imports.push(result.imp);
|
||||||
// @ts-ignore
|
|
||||||
acc.exports.push(result.exp);
|
acc.exports.push(result.exp);
|
||||||
// @ts-ignore
|
|
||||||
acc.exportNames.push(result.key);
|
acc.exportNames.push(result.key);
|
||||||
acc.exportNameToChain[result.key] = result.chain;
|
acc.exportNameToChain[result.key] = result.chain;
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
imports: [],
|
imports: [] as string[],
|
||||||
exports: [],
|
exports: [] as string[],
|
||||||
exportNames: [],
|
exportNames: [] as string[],
|
||||||
exportNameToChain: {},
|
exportNameToChain: {} as Record<string, Chain>,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1587,7 +1587,7 @@ export { default as Alveychain } from "../chains/3797"
|
|||||||
export { default as Kalychain } from "../chains/3888"
|
export { default as Kalychain } from "../chains/3888"
|
||||||
export { default as KalychainTestnet } from "../chains/3889"
|
export { default as KalychainTestnet } from "../chains/3889"
|
||||||
export { default as DracNetwork } from "../chains/3912"
|
export { default as DracNetwork } from "../chains/3912"
|
||||||
export { default as DosTesnet } from "../chains/3939"
|
export { default as DosTestnet } from "../chains/3939"
|
||||||
export { default as Dyno } from "../chains/3966"
|
export { default as Dyno } from "../chains/3966"
|
||||||
export { default as DynoTestnet } from "../chains/3967"
|
export { default as DynoTestnet } from "../chains/3967"
|
||||||
export { default as Yuanchain } from "../chains/3999"
|
export { default as Yuanchain } from "../chains/3999"
|
||||||
@@ -3727,7 +3727,7 @@ type ChainIdsBySlug = {
|
|||||||
"kalychain": 3888,
|
"kalychain": 3888,
|
||||||
"kalychain-testnet": 3889,
|
"kalychain-testnet": 3889,
|
||||||
"drac-network": 3912,
|
"drac-network": 3912,
|
||||||
"dos-tesnet": 3939,
|
"dos-testnet": 3939,
|
||||||
"dyno": 3966,
|
"dyno": 3966,
|
||||||
"dyno-testnet": 3967,
|
"dyno-testnet": 3967,
|
||||||
"yuanchain": 3999,
|
"yuanchain": 3999,
|
||||||
|
|||||||
@@ -1,5 +1,60 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.13.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.55
|
||||||
|
- @thirdweb-dev/sdk@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.7
|
||||||
|
- @thirdweb-dev/auth@4.0.7
|
||||||
|
|
||||||
|
## 0.13.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.5
|
||||||
|
- @thirdweb-dev/wallets@2.0.6
|
||||||
|
- @thirdweb-dev/auth@4.0.6
|
||||||
|
|
||||||
|
## 0.13.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.4
|
||||||
|
- @thirdweb-dev/wallets@2.0.5
|
||||||
|
- @thirdweb-dev/auth@4.0.5
|
||||||
|
|
||||||
|
## 0.13.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/auth@4.0.4
|
||||||
|
|
||||||
|
## 0.13.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
- @thirdweb-dev/auth@4.0.3
|
||||||
|
|
||||||
|
## 0.13.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`1f3c64d3`](https://github.com/thirdweb-dev/js/commit/1f3c64d3618903b9008cc7b633ea890b508e7800), [`74941603`](https://github.com/thirdweb-dev/js/commit/74941603a96456da46a47147f67c98235ac55022), [`4b98e487`](https://github.com/thirdweb-dev/js/commit/4b98e487d4b47225d7095e5444dc5e7608db48a3), [`693f349d`](https://github.com/thirdweb-dev/js/commit/693f349db2478e1cd0fc82a9ef9882f46832b125), [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9), [`0f12d1f9`](https://github.com/thirdweb-dev/js/commit/0f12d1f90320923309f085c372d3a5ed01dd4606), [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e), [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.1
|
||||||
|
- @thirdweb-dev/wallets@2.0.2
|
||||||
|
- @thirdweb-dev/auth@4.0.2
|
||||||
|
|
||||||
## 0.13.1
|
## 0.13.1
|
||||||
|
|
||||||
### 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.1",
|
"version": "0.13.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# @thirdweb-dev/contracts-js
|
# @thirdweb-dev/contracts-js
|
||||||
|
|
||||||
|
## 1.3.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1771](https://github.com/thirdweb-dev/js/pull/1771) [`6c30b7ef`](https://github.com/thirdweb-dev/js/commit/6c30b7efc708e1244f3be3e10eac8f3b8b14a8c3) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Updated to latest contracts package
|
||||||
|
|
||||||
|
## 1.3.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1756](https://github.com/thirdweb-dev/js/pull/1756) [`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Enable adding smart wallet admins via bundler for new account contracts
|
||||||
|
|
||||||
|
## 1.3.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1757](https://github.com/thirdweb-dev/js/pull/1757) [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Update deployment and tests for MarketplaceV3 latest
|
||||||
|
|
||||||
## 1.3.13
|
## 1.3.13
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/contracts-js",
|
"name": "@thirdweb-dev/contracts-js",
|
||||||
"version": "1.3.13",
|
"version": "1.3.16",
|
||||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@thirdweb-dev/contracts": "3.10.1-0"
|
"@thirdweb-dev/contracts": "3.10.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.22.9",
|
"@babel/preset-env": "^7.22.9",
|
||||||
|
|||||||
@@ -1,5 +1,62 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 4.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.55
|
||||||
|
- @thirdweb-dev/sdk@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.7
|
||||||
|
- @thirdweb-dev/auth@4.0.7
|
||||||
|
|
||||||
|
## 4.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.5
|
||||||
|
- @thirdweb-dev/wallets@2.0.6
|
||||||
|
- @thirdweb-dev/auth@4.0.6
|
||||||
|
|
||||||
|
## 4.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.4
|
||||||
|
- @thirdweb-dev/wallets@2.0.5
|
||||||
|
- @thirdweb-dev/auth@4.0.5
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/auth@4.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1758](https://github.com/thirdweb-dev/js/pull/1758) [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add pagination to useOwnedNFTs
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
- @thirdweb-dev/auth@4.0.3
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`1f3c64d3`](https://github.com/thirdweb-dev/js/commit/1f3c64d3618903b9008cc7b633ea890b508e7800), [`74941603`](https://github.com/thirdweb-dev/js/commit/74941603a96456da46a47147f67c98235ac55022), [`4b98e487`](https://github.com/thirdweb-dev/js/commit/4b98e487d4b47225d7095e5444dc5e7608db48a3), [`693f349d`](https://github.com/thirdweb-dev/js/commit/693f349db2478e1cd0fc82a9ef9882f46832b125), [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9), [`0f12d1f9`](https://github.com/thirdweb-dev/js/commit/0f12d1f90320923309f085c372d3a5ed01dd4606), [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e), [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.1
|
||||||
|
- @thirdweb-dev/wallets@2.0.2
|
||||||
|
- @thirdweb-dev/auth@4.0.2
|
||||||
|
|
||||||
## 4.0.1
|
## 4.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "4.0.1",
|
"version": "4.0.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -225,11 +225,12 @@ export function useTotalCirculatingSupply(
|
|||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```javascript
|
* ```javascript
|
||||||
* const { data: ownedNFTs, isLoading, error } = useOwnedNFTs(contract, "{{wallet_address}}");
|
* const { data: ownedNFTs, isLoading, error } = useOwnedNFTs(contract, "{{wallet_address}}", { start: 0, count: 100 });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @param contract - an instance of a {@link NFTContract}
|
* @param contract - an instance of a {@link NFTContract}
|
||||||
* @param ownerWalletAddress - the wallet address to get owned tokens for
|
* @param ownerWalletAddress - the wallet address to get owned tokens for
|
||||||
|
* @param queryParams - query params to pass to the query for pagination
|
||||||
* @returns a response object that includes the list of owned tokens
|
* @returns a response object that includes the list of owned tokens
|
||||||
* @beta
|
* @beta
|
||||||
* @twfeature ERC721Enumerable | ERC1155Enumerable | ERC721Supply
|
* @twfeature ERC721Enumerable | ERC1155Enumerable | ERC721Supply
|
||||||
@@ -238,6 +239,7 @@ export function useTotalCirculatingSupply(
|
|||||||
export function useOwnedNFTs<TContract extends NFTContract>(
|
export function useOwnedNFTs<TContract extends NFTContract>(
|
||||||
contract: RequiredParam<TContract>,
|
contract: RequiredParam<TContract>,
|
||||||
ownerWalletAddress: RequiredParam<WalletAddress>,
|
ownerWalletAddress: RequiredParam<WalletAddress>,
|
||||||
|
queryParams?: QueryAllParams,
|
||||||
) {
|
) {
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
const { erc721, erc1155 } = getErcs(contract);
|
const { erc721, erc1155 } = getErcs(contract);
|
||||||
@@ -248,10 +250,10 @@ export function useOwnedNFTs<TContract extends NFTContract>(
|
|||||||
requiredParamInvariant(contract, "No Contract instance provided");
|
requiredParamInvariant(contract, "No Contract instance provided");
|
||||||
invariant(ownerWalletAddress, "No wallet address provided");
|
invariant(ownerWalletAddress, "No wallet address provided");
|
||||||
if (erc721) {
|
if (erc721) {
|
||||||
return await erc721.getOwned(ownerWalletAddress);
|
return await erc721.getOwned(ownerWalletAddress, queryParams);
|
||||||
}
|
}
|
||||||
if (erc1155) {
|
if (erc1155) {
|
||||||
return await erc1155.getOwned(ownerWalletAddress);
|
return await erc1155.getOwned(ownerWalletAddress, queryParams);
|
||||||
}
|
}
|
||||||
invariant(false, "Unknown NFT type");
|
invariant(false, "Unknown NFT type");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.3.12
|
||||||
|
|
||||||
|
## 0.3.11
|
||||||
|
|
||||||
|
## 0.3.10
|
||||||
|
|
||||||
|
## 0.3.9
|
||||||
|
|
||||||
|
## 0.3.8
|
||||||
|
|
||||||
|
## 0.3.7
|
||||||
|
|
||||||
## 0.3.6
|
## 0.3.6
|
||||||
|
|
||||||
## 0.3.5
|
## 0.3.5
|
||||||
|
|||||||
@@ -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.3.6",
|
"version": "0.3.12",
|
||||||
"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,5 +1,92 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.3.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.55
|
||||||
|
- @thirdweb-dev/react-core@4.0.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.7
|
||||||
|
|
||||||
|
## 0.3.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.5
|
||||||
|
- @thirdweb-dev/react-core@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.6
|
||||||
|
|
||||||
|
## 0.3.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.4
|
||||||
|
- @thirdweb-dev/wallets@2.0.5
|
||||||
|
- @thirdweb-dev/react-core@4.0.5
|
||||||
|
|
||||||
|
## 0.3.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/react-core@4.0.4
|
||||||
|
|
||||||
|
## 0.3.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1724](https://github.com/thirdweb-dev/js/pull/1724) [`fc62b91e`](https://github.com/thirdweb-dev/js/commit/fc62b91ee55b0adba01298f33b21352004d1b71d) Thanks [@iketw](https://github.com/iketw)! - Adds Google sign in to embeddedWallet in React Native
|
||||||
|
|
||||||
|
You need to add the `react-native-inappbrowser-reborn` package to your app, then you can do:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
clientId={"your-client-id"}
|
||||||
|
supportedWallets={[
|
||||||
|
embeddedWallet({
|
||||||
|
// if this is true AND oauthOptions is not set we set it to false internally
|
||||||
|
email: true,
|
||||||
|
// if this is set we enable Sign in with Google
|
||||||
|
oauthOptions: {
|
||||||
|
redirectUrl: "test15app://",
|
||||||
|
providers: ["google"],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/react-core@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
|
||||||
|
## 0.3.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1754](https://github.com/thirdweb-dev/js/pull/1754) [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9) Thanks [@iketw](https://github.com/iketw)! - Fix typos in SmartWallet api
|
||||||
|
|
||||||
|
- [#1760](https://github.com/thirdweb-dev/js/pull/1760) [`f41ee6fb`](https://github.com/thirdweb-dev/js/commit/f41ee6fb1cc3b1e58cc273fa45087d4c92ff97d1) Thanks [@iketw](https://github.com/iketw)! - Correctly pass theme via ConnectWallet
|
||||||
|
|
||||||
|
- [#1753](https://github.com/thirdweb-dev/js/pull/1753) [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e) Thanks [@iketw](https://github.com/iketw)! - Minor bug and UI fix for connecting an external app to a smart wallet
|
||||||
|
|
||||||
|
- [#1759](https://github.com/thirdweb-dev/js/pull/1759) [`513c332e`](https://github.com/thirdweb-dev/js/commit/513c332ed02df4ac316076cc03178a4702b12110) Thanks [@iketw](https://github.com/iketw)! - Fixes bug when passing only one wallet as a supportedWallet. The selectUI component must be displayed.
|
||||||
|
|
||||||
|
- Updated dependencies [[`1f3c64d3`](https://github.com/thirdweb-dev/js/commit/1f3c64d3618903b9008cc7b633ea890b508e7800), [`74941603`](https://github.com/thirdweb-dev/js/commit/74941603a96456da46a47147f67c98235ac55022), [`4b98e487`](https://github.com/thirdweb-dev/js/commit/4b98e487d4b47225d7095e5444dc5e7608db48a3), [`693f349d`](https://github.com/thirdweb-dev/js/commit/693f349db2478e1cd0fc82a9ef9882f46832b125), [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9), [`0f12d1f9`](https://github.com/thirdweb-dev/js/commit/0f12d1f90320923309f085c372d3a5ed01dd4606), [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e), [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.1
|
||||||
|
- @thirdweb-dev/wallets@2.0.2
|
||||||
|
- @thirdweb-dev/react-core@4.0.2
|
||||||
|
|
||||||
## 0.3.6
|
## 0.3.6
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.3.6",
|
"version": "0.3.12",
|
||||||
"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",
|
||||||
@@ -89,7 +89,8 @@
|
|||||||
"amazon-cognito-identity-js": "^6.3.3",
|
"amazon-cognito-identity-js": "^6.3.3",
|
||||||
"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-aes-gcm-crypto": "^0.2.2"
|
"react-native-aes-gcm-crypto": "^0.2.2",
|
||||||
|
"react-native-inappbrowser-reborn": "^3.7.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"ethers": ">=5.5.1 <6",
|
"ethers": ">=5.5.1 <6",
|
||||||
|
|||||||
@@ -10,3 +10,4 @@ export * from "./right-arrow";
|
|||||||
export * from "./wallet";
|
export * from "./wallet";
|
||||||
export * from "./money";
|
export * from "./money";
|
||||||
export * from "./switch";
|
export * from "./switch";
|
||||||
|
export * from "./svgs";
|
||||||
|
|||||||
@@ -1,3 +1,23 @@
|
|||||||
|
export const GOOGLE_ICON = `<svg height={height} viewBox="0 0 24 24" width={width}>
|
||||||
|
<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"
|
||||||
|
fill="#4285F4"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
||||||
|
fill="#34A853"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
||||||
|
fill="#FBBC05"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
||||||
|
fill="#EA4335"
|
||||||
|
/>
|
||||||
|
<path d="M1 1h22v22H1z" fill="none" />
|
||||||
|
</svg>`;
|
||||||
|
|
||||||
export const EMAIL_WALLET_ICON = `<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
|
export const EMAIL_WALLET_ICON = `<svg width="48" height="48" viewBox="0 0 48 48" fill="none">
|
||||||
<g clip-path="url(#clip0_3589_8649)">
|
<g clip-path="url(#clip0_3589_8649)">
|
||||||
<rect width="48" height="48" rx="8" fill="url(#paint0_linear_3589_8649)"/>
|
<rect width="48" height="48" rx="8" fill="url(#paint0_linear_3589_8649)"/>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useWallet } from "@thirdweb-dev/react-core";
|
import { useWallet } from "@thirdweb-dev/react-core";
|
||||||
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
import { IWalletConnectReceiver } from "@thirdweb-dev/wallets";
|
||||||
import { useCallback, useEffect, 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";
|
||||||
import DisconnectIcon from "../../assets/disconnect";
|
import DisconnectIcon from "../../assets/disconnect";
|
||||||
@@ -21,6 +21,7 @@ const ConnectAppField = () => {
|
|||||||
const [appMeta, setAppMeta] = useState<{ name: string; iconUrl: string }>();
|
const [appMeta, setAppMeta] = useState<{ name: string; iconUrl: string }>();
|
||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const [showQRCodeScan, setShowQRCodeScan] = useState(false);
|
const [showQRCodeScan, setShowQRCodeScan] = useState(false);
|
||||||
|
const wcUriRef = useRef<string | undefined>();
|
||||||
|
|
||||||
const getAppMeta = useCallback(() => {
|
const getAppMeta = useCallback(() => {
|
||||||
if (wallet && "isWCReceiverEnabled" in wallet) {
|
if (wallet && "isWCReceiverEnabled" in wallet) {
|
||||||
@@ -80,9 +81,10 @@ const ConnectAppField = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onQRCodeScan = (data: string) => {
|
const onQRCodeScan = (data: string) => {
|
||||||
if (wcUri !== data && data.startsWith("wc:")) {
|
if (wcUriRef.current !== data && data.startsWith("wc:")) {
|
||||||
setWCUri(data);
|
setWCUri(data);
|
||||||
setShowQRCodeScan(false);
|
setShowQRCodeScan(false);
|
||||||
|
wcUriRef.current = data;
|
||||||
|
|
||||||
onWCPress(data);
|
onWCPress(data);
|
||||||
}
|
}
|
||||||
@@ -102,6 +104,9 @@ const ConnectAppField = () => {
|
|||||||
if (uriToUse?.startsWith("wc:")) {
|
if (uriToUse?.startsWith("wc:")) {
|
||||||
(wallet as unknown as IWalletConnectReceiver).connectApp(uriToUse);
|
(wallet as unknown as IWalletConnectReceiver).connectApp(uriToUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setWCUri(undefined);
|
||||||
|
wcUriRef.current = undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onScanQRPress = () => {
|
const onScanQRPress = () => {
|
||||||
@@ -124,9 +129,11 @@ const ConnectAppField = () => {
|
|||||||
value: wcUri,
|
value: wcUri,
|
||||||
placeholder: "wc://...",
|
placeholder: "wc://...",
|
||||||
placeholderTextColor: theme.colors.textSecondary,
|
placeholderTextColor: theme.colors.textSecondary,
|
||||||
|
numberOfLines: 1,
|
||||||
}}
|
}}
|
||||||
containerProps={{
|
containerProps={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
pl: "xxs",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
@@ -164,12 +171,12 @@ const ConnectAppField = () => {
|
|||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
{appMeta?.iconUrl ? (
|
{appMeta?.iconUrl ? (
|
||||||
<WalletIcon size={32} iconUri={appMeta.iconUrl} />
|
<WalletIcon size={24} iconUri={appMeta.iconUrl} />
|
||||||
) : (
|
) : (
|
||||||
<WalletConnectIcon width={16} height={16} />
|
<WalletConnectIcon width={24} height={24} />
|
||||||
)}
|
)}
|
||||||
<View style={styles.exportWalletInfo}>
|
<View style={styles.exportWalletInfo}>
|
||||||
<Text variant="bodySmall">
|
<Text variant="bodySmall" numberOfLines={1}>
|
||||||
{appMeta ? appMeta.name : "Connect app"}
|
{appMeta ? appMeta.name : "Connect app"}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -215,8 +222,9 @@ const styles = StyleSheet.create({
|
|||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
flexDirection: "column",
|
flexDirection: "row",
|
||||||
marginLeft: 8,
|
marginLeft: 8,
|
||||||
|
marginRight: 8,
|
||||||
},
|
},
|
||||||
exportWallet: {
|
exportWallet: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
+7
-3
@@ -238,7 +238,8 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
) : null}
|
) : null}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
) : null}
|
) : null}
|
||||||
{activeWallet?.walletId === EmbeddedWallet.id ? (
|
{activeWallet?.walletId === EmbeddedWallet.id &&
|
||||||
|
(activeWallet as EmbeddedWallet).getEmail() ? (
|
||||||
<Box flexDirection="row" alignItems="center" mt="md">
|
<Box flexDirection="row" alignItems="center" mt="md">
|
||||||
<ActiveDot width={10} height={10} />
|
<ActiveDot width={10} height={10} />
|
||||||
<Text variant="bodySmallSecondary" ml="xxs">
|
<Text variant="bodySmallSecondary" ml="xxs">
|
||||||
@@ -246,7 +247,11 @@ export const ConnectWalletDetailsModal = ({
|
|||||||
</Text>
|
</Text>
|
||||||
</Box>
|
</Box>
|
||||||
) : null}
|
) : null}
|
||||||
<Box flexDirection="row" justifyContent="space-evenly" mt="md">
|
<Box
|
||||||
|
flexDirection="row"
|
||||||
|
justifyContent="space-evenly"
|
||||||
|
marginVertical="md"
|
||||||
|
>
|
||||||
<SendButton supportedTokens={supportedTokens} />
|
<SendButton supportedTokens={supportedTokens} />
|
||||||
<ReceiveButton />
|
<ReceiveButton />
|
||||||
</Box>
|
</Box>
|
||||||
@@ -330,7 +335,6 @@ const styles = StyleSheet.create({
|
|||||||
alignContent: "flex-start",
|
alignContent: "flex-start",
|
||||||
alignItems: "flex-start",
|
alignItems: "flex-start",
|
||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
marginTop: 24,
|
|
||||||
marginBottom: 8,
|
marginBottom: 8,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -12,9 +12,9 @@ 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 ConnectAppField from "./ConnectAppField";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import DisconnectIcon from "../../assets/disconnect";
|
import DisconnectIcon from "../../assets/disconnect";
|
||||||
import { IconTextButton } from "../base/IconTextButton";
|
import { IconTextButton } from "../base/IconTextButton";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const SmartWalletAdditionalActions = ({
|
export const SmartWalletAdditionalActions = ({
|
||||||
onExportPress,
|
onExportPress,
|
||||||
@@ -26,7 +26,7 @@ export const SmartWalletAdditionalActions = ({
|
|||||||
const [smartWalletAddress, setSmartWalletAddress] = useState<string>("");
|
const [smartWalletAddress, setSmartWalletAddress] = useState<string>("");
|
||||||
const [showSmartWallet, setShowSmartWallet] = useState(false);
|
const [showSmartWallet, setShowSmartWallet] = useState(false);
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
const wallet = showSmartWallet
|
const wallet = showSmartWallet
|
||||||
? smartWallet
|
? smartWallet
|
||||||
|
|||||||
+8
-2
@@ -1,7 +1,6 @@
|
|||||||
import { AddressDisplay } from "../base/AddressDisplay";
|
import { AddressDisplay } from "../base/AddressDisplay";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { WalletIcon } from "../base/WalletIcon";
|
|
||||||
import { useENS, useWallet } from "@thirdweb-dev/react-core";
|
import { useENS, useWallet } from "@thirdweb-dev/react-core";
|
||||||
import { StyleSheet } from "react-native";
|
import { StyleSheet } from "react-native";
|
||||||
import { LocalWallet, walletIds } from "@thirdweb-dev/wallets";
|
import { LocalWallet, walletIds } from "@thirdweb-dev/wallets";
|
||||||
@@ -11,6 +10,7 @@ import { useMemo, useState } from "react";
|
|||||||
import { TextBalance } from "../base/TextBalance";
|
import { TextBalance } from "../base/TextBalance";
|
||||||
import { SupportedTokens } from "../SendFunds/defaultTokens";
|
import { SupportedTokens } from "../SendFunds/defaultTokens";
|
||||||
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
||||||
|
import { ImageSvgUri } from "../base";
|
||||||
|
|
||||||
export type ConnectWalletDetailsProps = {
|
export type ConnectWalletDetailsProps = {
|
||||||
address?: string;
|
address?: string;
|
||||||
@@ -90,7 +90,13 @@ export const WalletDetailsButton = ({
|
|||||||
alignContent="center"
|
alignContent="center"
|
||||||
justifyContent="flex-start"
|
justifyContent="flex-start"
|
||||||
>
|
>
|
||||||
<WalletIcon size={32} iconUri={avatarUrl || walletIconUrl} />
|
<Box borderRadius="lg" overflow="hidden">
|
||||||
|
<ImageSvgUri
|
||||||
|
width={32}
|
||||||
|
height={32}
|
||||||
|
imageUrl={avatarUrl || walletIconUrl}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
<Box ml="md" justifyContent="center" alignItems="flex-start">
|
<Box ml="md" justifyContent="center" alignItems="flex-start">
|
||||||
{activeWallet?.walletId === LocalWallet.id ? (
|
{activeWallet?.walletId === LocalWallet.id ? (
|
||||||
<Text variant="bodySmall" color="red">
|
<Text variant="bodySmall" color="red">
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,4 @@
|
|||||||
import { Icon } from "../../assets/icon";
|
import { Icon } from "../../assets/icon";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import { AddressDisplay } from "../base/AddressDisplay";
|
import { AddressDisplay } from "../base/AddressDisplay";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import { WalletIcon } from "../base/WalletIcon";
|
import { WalletIcon } from "../base/WalletIcon";
|
||||||
@@ -13,6 +12,7 @@ import { TextBalance } from "../base/TextBalance";
|
|||||||
import { walletIds } from "@thirdweb-dev/wallets";
|
import { walletIds } from "@thirdweb-dev/wallets";
|
||||||
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
interface WalletDetailsModalHeaderProps {
|
interface WalletDetailsModalHeaderProps {
|
||||||
address?: string;
|
address?: string;
|
||||||
@@ -28,7 +28,7 @@ export const WalletDetailsModalHeader = ({
|
|||||||
onAddressCopied,
|
onAddressCopied,
|
||||||
tokenAddress,
|
tokenAddress,
|
||||||
}: WalletDetailsModalHeaderProps) => {
|
}: WalletDetailsModalHeaderProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const [showLoading, setShowLoading] = useState(false);
|
const [showLoading, setShowLoading] = useState(false);
|
||||||
const ensQuery = useENS();
|
const ensQuery = useENS();
|
||||||
|
|||||||
+3
-5
@@ -5,11 +5,11 @@ import { ReactNode, useState } from "react";
|
|||||||
import Box from "../../base/Box";
|
import Box from "../../base/Box";
|
||||||
import Text from "../../base/Text";
|
import Text from "../../base/Text";
|
||||||
import ThirdwebLogo from "../../../assets/thirdweb-logo";
|
import ThirdwebLogo from "../../../assets/thirdweb-logo";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
import { ChooseWalletContent } from "./ChooseWalletContent";
|
import { ChooseWalletContent } from "./ChooseWalletContent";
|
||||||
import { BaseButton, ImageSvgUri, WalletButton } from "../../base";
|
import { BaseButton, ImageSvgUri, WalletButton } from "../../base";
|
||||||
import { ActivityIndicator, Linking } from "react-native";
|
import { ActivityIndicator, Linking } from "react-native";
|
||||||
import { useTheme } from "@shopify/restyle";
|
import { useTheme } from "@shopify/restyle";
|
||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
export type ChooseWalletProps = {
|
export type ChooseWalletProps = {
|
||||||
headerText?: ReactNode | string;
|
headerText?: ReactNode | string;
|
||||||
@@ -34,7 +34,7 @@ export function ChooseWallet({
|
|||||||
termsOfServiceUrl,
|
termsOfServiceUrl,
|
||||||
privacyPolicyUrl,
|
privacyPolicyUrl,
|
||||||
}: ChooseWalletProps) {
|
}: ChooseWalletProps) {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const themeLightDark = useTheme();
|
const themeLightDark = useTheme();
|
||||||
const [isConnecting, setIsConnecting] = useState(false);
|
const [isConnecting, setIsConnecting] = useState(false);
|
||||||
const [isConnectAWalletEnabled, setIsConnectAWalletEnabled] = useState(false);
|
const [isConnectAWalletEnabled, setIsConnectAWalletEnabled] = useState(false);
|
||||||
@@ -261,9 +261,7 @@ export function ChooseWallet({
|
|||||||
) : null}
|
) : null}
|
||||||
{showToSPrivacyPolicy ? (
|
{showToSPrivacyPolicy ? (
|
||||||
<Box
|
<Box
|
||||||
mt="md"
|
mt="sm"
|
||||||
pt="md"
|
|
||||||
height={50}
|
|
||||||
marginHorizontal={!isConnectAWalletEnabled ? "xl" : "none"}
|
marginHorizontal={!isConnectAWalletEnabled ? "xl" : "none"}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ import { ActivityIndicator, StyleSheet } from "react-native";
|
|||||||
import { BaseButton, Text } from "../base";
|
import { BaseButton, Text } from "../base";
|
||||||
import { useConnectionStatus, useWallets } from "@thirdweb-dev/react-core";
|
import { useConnectionStatus, useWallets } from "@thirdweb-dev/react-core";
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { useModalState } from "../../providers/ui-context-provider";
|
import {
|
||||||
|
useGlobalTheme,
|
||||||
|
useModalState,
|
||||||
|
} from "../../providers/ui-context-provider";
|
||||||
import { ThemeProvider, ThemeProviderProps } from "../../styles/ThemeProvider";
|
import { ThemeProvider, ThemeProviderProps } from "../../styles/ThemeProvider";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
|
|
||||||
export type ConnectWalletButtonProps = {
|
export type ConnectWalletButtonProps = {
|
||||||
theme?: ThemeProviderProps["theme"];
|
theme?: ThemeProviderProps["theme"];
|
||||||
@@ -43,7 +45,7 @@ export const ConnectWalletButton = ({
|
|||||||
buttonTitle,
|
buttonTitle,
|
||||||
theme,
|
theme,
|
||||||
}: ConnectWalletButtonProps) => {
|
}: ConnectWalletButtonProps) => {
|
||||||
const appTheme = useAppTheme();
|
const appTheme = useGlobalTheme();
|
||||||
const connectionStatus = useConnectionStatus();
|
const connectionStatus = useConnectionStatus();
|
||||||
const isWalletConnecting = connectionStatus === "connecting";
|
const isWalletConnecting = connectionStatus === "connecting";
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,16 @@ import { WalletConfig, useConnect, useWallets } from "@thirdweb-dev/react-core";
|
|||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { walletIds } from "@thirdweb-dev/wallets";
|
import { walletIds } from "@thirdweb-dev/wallets";
|
||||||
import { useColorScheme } from "react-native";
|
import { useColorScheme } from "react-native";
|
||||||
import { useModalState } from "../../providers/ui-context-provider";
|
import {
|
||||||
|
useGlobalTheme,
|
||||||
|
useModalState,
|
||||||
|
} from "../../providers/ui-context-provider";
|
||||||
import {
|
import {
|
||||||
CLOSE_MODAL_STATE,
|
CLOSE_MODAL_STATE,
|
||||||
ConnectWalletFlowModal,
|
ConnectWalletFlowModal,
|
||||||
} from "../../utils/modalTypes";
|
} from "../../utils/modalTypes";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import { ThemeProvider } from "../../styles/ThemeProvider";
|
import { ThemeProvider } from "../../styles/ThemeProvider";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
|
|
||||||
export const ConnectWalletFlow = () => {
|
export const ConnectWalletFlow = () => {
|
||||||
const { modalState, setModalState } = useModalState();
|
const { modalState, setModalState } = useModalState();
|
||||||
@@ -30,7 +32,7 @@ export const ConnectWalletFlow = () => {
|
|||||||
const [selectionData, setSelectionData] = useState<any>();
|
const [selectionData, setSelectionData] = useState<any>();
|
||||||
const supportedWallets = useWallets();
|
const supportedWallets = useWallets();
|
||||||
const theme = useColorScheme();
|
const theme = useColorScheme();
|
||||||
const appTheme = useAppTheme();
|
const appTheme = useGlobalTheme();
|
||||||
const connect = useConnect();
|
const connect = useConnect();
|
||||||
|
|
||||||
const onClose = useCallback(
|
const onClose = useCallback(
|
||||||
@@ -60,8 +62,8 @@ export const ConnectWalletFlow = () => {
|
|||||||
|
|
||||||
const onChooseWallet = useCallback(
|
const onChooseWallet = useCallback(
|
||||||
(wallet: WalletConfig, data?: any) => {
|
(wallet: WalletConfig, data?: any) => {
|
||||||
setActiveWallet(wallet);
|
|
||||||
setSelectionData(data);
|
setSelectionData(data);
|
||||||
|
setActiveWallet(wallet);
|
||||||
|
|
||||||
// If the wallet has no custom connect UI, then connect it
|
// If the wallet has no custom connect UI, then connect it
|
||||||
if (!wallet.connectUI) {
|
if (!wallet.connectUI) {
|
||||||
@@ -74,13 +76,19 @@ export const ConnectWalletFlow = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// case when only one wallet is passed in supportedWallets
|
// case when only one wallet is passed in supportedWallets
|
||||||
if (walletConfig) {
|
if (walletConfig) {
|
||||||
if (walletConfig.connectUI) {
|
// if there's a selection UI, then continue with the flow
|
||||||
// if there's a connection UI, then show it
|
if (walletConfig.selectUI) {
|
||||||
setActiveWallet(walletConfig);
|
return;
|
||||||
} else {
|
|
||||||
// if there's no connection UI, then connect the wallet
|
|
||||||
onChooseWallet(walletConfig);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (walletConfig.connectUI) {
|
||||||
|
// if there's a connection UI and no selection UI, then show it
|
||||||
|
setActiveWallet(walletConfig);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there's no connection UI or selectionUI, then automatically select it
|
||||||
|
onChooseWallet(walletConfig);
|
||||||
}
|
}
|
||||||
}, [onChooseWallet, walletConfig]);
|
}, [onChooseWallet, walletConfig]);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ export function ConnectingWallet({
|
|||||||
subHeaderText={subHeaderText}
|
subHeaderText={subHeaderText}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
<WalletLoadingThumbnail imageSize={100}>
|
<WalletLoadingThumbnail imageSize={85}>
|
||||||
<ImageSvgUri height={80} width={80} imageUrl={wallet.meta.iconURL} />
|
<ImageSvgUri height={80} width={80} imageUrl={wallet.meta.iconURL} />
|
||||||
</WalletLoadingThumbnail>
|
</WalletLoadingThumbnail>
|
||||||
<View style={styles.connectingContainer}>
|
<View style={styles.connectingContainer}>
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import { Icon } from "../../../assets/icon";
|
import { Icon } from "../../../assets/icon";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
import Text from "../../base/Text";
|
import Text from "../../base/Text";
|
||||||
import { FlexAlignType, StyleSheet, View } from "react-native";
|
import { FlexAlignType, StyleSheet, View } from "react-native";
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export const ConnectWalletHeader = ({
|
|||||||
onClose,
|
onClose,
|
||||||
onBackPress,
|
onBackPress,
|
||||||
}: ConnectWalletHeaderProps) => {
|
}: ConnectWalletHeaderProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
|
|||||||
+2
-2
@@ -16,7 +16,7 @@ import * as FileSystem from "expo-file-system";
|
|||||||
import { TWModal } from "../base/modal/TWModal";
|
import { TWModal } from "../base/modal/TWModal";
|
||||||
import { localWallet } from "../../wallets/wallets/local-wallet";
|
import { localWallet } from "../../wallets/wallets/local-wallet";
|
||||||
import { TextInput } from "../base";
|
import { TextInput } from "../base";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export type LocalWalletImportModalProps = {
|
export type LocalWalletImportModalProps = {
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
@@ -37,7 +37,7 @@ export const LocalWalletImportModal = ({
|
|||||||
const [error, setError] = useState<string | undefined>();
|
const [error, setError] = useState<string | undefined>();
|
||||||
const [isImporting, setIsImporting] = useState<boolean>(false);
|
const [isImporting, setIsImporting] = useState<boolean>(false);
|
||||||
const createWalletInstance = useCreateWalletInstance();
|
const createWalletInstance = useCreateWalletInstance();
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
const createLocalWalletFromJsonFile = async () => {
|
const createLocalWalletFromJsonFile = async () => {
|
||||||
if (!jsonFile || !password) {
|
if (!jsonFile || !password) {
|
||||||
|
|||||||
+3
-3
@@ -15,7 +15,7 @@ import WalletLoadingThumbnail from "../../../wallets/wallets/wallet-connect/Wall
|
|||||||
import ImageSvgUri from "../../base/ImageSvgUri";
|
import ImageSvgUri from "../../base/ImageSvgUri";
|
||||||
import Box from "../../base/Box";
|
import Box from "../../base/Box";
|
||||||
import { ConnectWalletHeader } from "../ConnectingWallet/ConnectingWalletHeader";
|
import { ConnectWalletHeader } from "../ConnectingWallet/ConnectingWalletHeader";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const SmartWalletFlow = ({
|
export const SmartWalletFlow = ({
|
||||||
connected,
|
connected,
|
||||||
@@ -24,7 +24,7 @@ export const SmartWalletFlow = ({
|
|||||||
personalWalletConfig,
|
personalWalletConfig,
|
||||||
...props
|
...props
|
||||||
}: ConnectUIProps<SmartWallet> & { personalWalletConfig: WalletConfig }) => {
|
}: ConnectUIProps<SmartWallet> & { personalWalletConfig: WalletConfig }) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [connectedPersonalWallet, setConnectedPersonalWallet] =
|
const [connectedPersonalWallet, setConnectedPersonalWallet] =
|
||||||
useState<WalletInstance>();
|
useState<WalletInstance>();
|
||||||
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
|
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
|
||||||
@@ -131,7 +131,7 @@ export const SmartWalletFlow = ({
|
|||||||
onBackPress={onConnectingBackPress}
|
onBackPress={onConnectingBackPress}
|
||||||
onClose={onConnectingClosePress}
|
onClose={onConnectingClosePress}
|
||||||
/>
|
/>
|
||||||
<WalletLoadingThumbnail imageSize={100}>
|
<WalletLoadingThumbnail imageSize={85}>
|
||||||
<ImageSvgUri
|
<ImageSvgUri
|
||||||
height={80}
|
height={80}
|
||||||
width={80}
|
width={80}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import { useModalState } from "../providers/ui-context-provider";
|
import {
|
||||||
|
useGlobalTheme,
|
||||||
|
useModalState,
|
||||||
|
} from "../providers/ui-context-provider";
|
||||||
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
||||||
import { Dimensions, StyleSheet, View } from "react-native";
|
import { Dimensions, StyleSheet, View } from "react-native";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
@@ -7,13 +10,13 @@ import { SessionRequestModal } from "./ConnectWalletDetails/SessionRequestModal"
|
|||||||
import { SessionProposalModal } from "./ConnectWalletDetails/SessionProposalModal";
|
import { SessionProposalModal } from "./ConnectWalletDetails/SessionProposalModal";
|
||||||
import { TWModal } from "./base/modal/TWModal";
|
import { TWModal } from "./base/modal/TWModal";
|
||||||
import Box from "./base/Box";
|
import Box from "./base/Box";
|
||||||
import { useAppTheme } from "../styles/hooks";
|
// import { useAppTheme } from "../styles/hooks";
|
||||||
|
|
||||||
const MODAL_HEIGHT = Dimensions.get("window").height * 0.6;
|
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||||
const DEVICE_WIDTH = Dimensions.get("window").width;
|
const DEVICE_WIDTH = Dimensions.get("window").width;
|
||||||
|
|
||||||
export const MainModal = () => {
|
export const MainModal = () => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const { modalState } = useModalState();
|
const { modalState } = useModalState();
|
||||||
|
|
||||||
const { isOpen, isSheet } = modalState;
|
const { isOpen, isSheet } = modalState;
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ import Box from "./base/Box";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import EyeClosed from "../assets/eye-closed";
|
import EyeClosed from "../assets/eye-closed";
|
||||||
import EyeOpened from "../assets/eye-opened";
|
import EyeOpened from "../assets/eye-opened";
|
||||||
import { useAppTheme } from "../styles/hooks";
|
import { useGlobalTheme } from "../providers/ui-context-provider";
|
||||||
|
|
||||||
export const PasswordInput = ({
|
export const PasswordInput = ({
|
||||||
onChangeText,
|
onChangeText,
|
||||||
}: {
|
}: {
|
||||||
onChangeText: TextInput["props"]["onChangeText"];
|
onChangeText: TextInput["props"]["onChangeText"];
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
|
||||||
const onPressEyeIcon = () => {
|
const onPressEyeIcon = () => {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
|
|||||||
import { IconTextButton } from "./base/IconTextButton";
|
import { IconTextButton } from "./base/IconTextButton";
|
||||||
import { useAddress } from "@thirdweb-dev/react-core";
|
import { useAddress } from "@thirdweb-dev/react-core";
|
||||||
import { Dimensions, KeyboardAvoidingView } from "react-native";
|
import { Dimensions, KeyboardAvoidingView } from "react-native";
|
||||||
import { useAppTheme } from "../styles/hooks";
|
|
||||||
import {
|
import {
|
||||||
TWModal,
|
TWModal,
|
||||||
Box,
|
Box,
|
||||||
@@ -15,9 +14,10 @@ import {
|
|||||||
import DownloadIcon from "../assets/download";
|
import DownloadIcon from "../assets/download";
|
||||||
import CopyIcon from "../assets/copy";
|
import CopyIcon from "../assets/copy";
|
||||||
import QRCode from "react-native-qrcode-svg";
|
import QRCode from "react-native-qrcode-svg";
|
||||||
|
import { useGlobalTheme } from "../providers/ui-context-provider";
|
||||||
|
|
||||||
export const ReceiveButton = () => {
|
export const ReceiveButton = () => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
@@ -60,7 +60,7 @@ export const ReceiveFundsModal = ({
|
|||||||
isVisible,
|
isVisible,
|
||||||
onClose,
|
onClose,
|
||||||
}: ReceiveFundsModalProps) => {
|
}: ReceiveFundsModalProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const address = useAddress();
|
const address = useAddress();
|
||||||
const [addressCopied, setAddressCopied] = useState(false);
|
const [addressCopied, setAddressCopied] = useState(false);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import React, { useEffect, useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import SendIcon from "../../assets/send";
|
import SendIcon from "../../assets/send";
|
||||||
import {
|
import {
|
||||||
@@ -30,13 +29,14 @@ import { utils } from "ethers";
|
|||||||
import LoadingTextAnimation from "../base/LoadingTextAnimation";
|
import LoadingTextAnimation from "../base/LoadingTextAnimation";
|
||||||
import CheckIcon from "../../assets/check";
|
import CheckIcon from "../../assets/check";
|
||||||
import { TokenSelector } from "./TokenSelector";
|
import { TokenSelector } from "./TokenSelector";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const SendButton = ({
|
export const SendButton = ({
|
||||||
supportedTokens,
|
supportedTokens,
|
||||||
}: {
|
}: {
|
||||||
supportedTokens: SupportedTokens;
|
supportedTokens: SupportedTokens;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
|
|
||||||
const onClose = () => {
|
const onClose = () => {
|
||||||
@@ -139,12 +139,12 @@ const SendFundsForm = ({
|
|||||||
onTokenSelectorPress: () => void;
|
onTokenSelectorPress: () => void;
|
||||||
token?: TokenInfo;
|
token?: TokenInfo;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const chain = useChain();
|
const chain = useChain();
|
||||||
const wallet = useWallet();
|
const wallet = useWallet();
|
||||||
const chainId = useChainId();
|
const chainId = useChainId();
|
||||||
const [receiverAddress, setReceiverAddress] = useState("");
|
const [receiverAddress, setReceiverAddress] = useState("");
|
||||||
const [amount, setAmount] = useState("");
|
const [amount, setAmount] = useState("0");
|
||||||
const [showIcon, setShowIcon] = useState(false);
|
const [showIcon, setShowIcon] = useState(false);
|
||||||
const tokenAddress = token?.address;
|
const tokenAddress = token?.address;
|
||||||
|
|
||||||
@@ -313,6 +313,7 @@ const SendFundsForm = ({
|
|||||||
editable={!sendTokenMutation.isLoading}
|
editable={!sendTokenMutation.isLoading}
|
||||||
returnKeyType={"done"}
|
returnKeyType={"done"}
|
||||||
keyboardType="numeric"
|
keyboardType="numeric"
|
||||||
|
value={amount}
|
||||||
clearTextOnFocus={false}
|
clearTextOnFocus={false}
|
||||||
style={{
|
style={{
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
@@ -322,8 +323,6 @@ const SendFundsForm = ({
|
|||||||
paddingHorizontal: 16,
|
paddingHorizontal: 16,
|
||||||
}}
|
}}
|
||||||
onChangeText={setAmount}
|
onChangeText={setAmount}
|
||||||
placeholder="0"
|
|
||||||
placeholderTextColor={theme.colors.textPrimary}
|
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
@@ -348,11 +347,18 @@ const SendFundsForm = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{sendTokenMutation.isLoading ? (
|
{sendTokenMutation.isLoading ? (
|
||||||
<ActivityIndicator size="small" color={theme.colors.textPrimary} />
|
<ActivityIndicator
|
||||||
|
size="small"
|
||||||
|
color={theme.colors.accentButtonTextColor}
|
||||||
|
/>
|
||||||
) : showIcon ? (
|
) : showIcon ? (
|
||||||
<CheckIcon width={20} height={13} color={theme.colors.textPrimary} />
|
<CheckIcon
|
||||||
|
width={20}
|
||||||
|
height={13}
|
||||||
|
color={theme.colors.accentButtonTextColor}
|
||||||
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Text variant="bodySmall" mr="sm">
|
<Text variant="bodySmall" color="accentButtonTextColor" mr="sm">
|
||||||
Send
|
Send
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import {
|
|||||||
ScrollView,
|
ScrollView,
|
||||||
TextInput,
|
TextInput,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import { SelectTokenButton } from "./SelectTokenButton";
|
import { SelectTokenButton } from "./SelectTokenButton";
|
||||||
import CloseIcon from "../../assets/close";
|
import CloseIcon from "../../assets/close";
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export function useToken(tokenAddress: string): {
|
export function useToken(tokenAddress: string): {
|
||||||
isLoading: boolean;
|
isLoading: boolean;
|
||||||
@@ -82,7 +82,7 @@ export function TokenSelector(props: {
|
|||||||
onBack: () => void;
|
onBack: () => void;
|
||||||
supportedTokens: SupportedTokens;
|
supportedTokens: SupportedTokens;
|
||||||
}) {
|
}) {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [input, setInput] = useState("");
|
const [input, setInput] = useState("");
|
||||||
const chainId = useChainId();
|
const chainId = useChainId();
|
||||||
const nativeTokenInfo = useNativeToken();
|
const nativeTokenInfo = useNativeToken();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const ImageSvgUri = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box style={{ width: width, height: height }}>
|
<Box width={width} height={height}>
|
||||||
{error ? (
|
{error ? (
|
||||||
<SvgUri width={width} height={height} uri={resolvedImageUrl} />
|
<SvgUri width={width} height={height} uri={resolvedImageUrl} />
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useCallback, useEffect, useRef } from "react";
|
import React, { useCallback, useEffect, useRef } from "react";
|
||||||
import { View, Animated, Easing, StyleSheet } from "react-native";
|
import { View, Animated, Easing, StyleSheet } from "react-native";
|
||||||
import { baseTheme } from "../../styles/theme";
|
import { baseTheme } from "../../styles/theme";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
type LoadingTextAnimationProps = {
|
type LoadingTextAnimationProps = {
|
||||||
text: string;
|
text: string;
|
||||||
@@ -13,7 +13,7 @@ const LoadingTextAnimation = ({
|
|||||||
textVariant,
|
textVariant,
|
||||||
}: LoadingTextAnimationProps) => {
|
}: LoadingTextAnimationProps) => {
|
||||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
const fadeInOut = useCallback(() => {
|
const fadeInOut = useCallback(() => {
|
||||||
Animated.loop(
|
Animated.loop(
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import { useSwitchChain, useSupportedChains } from "@thirdweb-dev/react-core";
|
|||||||
import Box from "./Box";
|
import Box from "./Box";
|
||||||
import { ModalHeaderTextClose } from "./modal/ModalHeaderTextClose";
|
import { ModalHeaderTextClose } from "./modal/ModalHeaderTextClose";
|
||||||
import { TWModal } from "./modal/TWModal";
|
import { TWModal } from "./modal/TWModal";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import { Chain } from "@thirdweb-dev/chains";
|
import { Chain } from "@thirdweb-dev/chains";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
type NetworkButtonProps = {
|
type NetworkButtonProps = {
|
||||||
chain?: Chain;
|
chain?: Chain;
|
||||||
@@ -35,7 +35,7 @@ export const NetworkButton = ({
|
|||||||
padding,
|
padding,
|
||||||
...props
|
...props
|
||||||
}: NetworkButtonProps) => {
|
}: NetworkButtonProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [isModalVisible, setIsModalVisible] = useState(false);
|
const [isModalVisible, setIsModalVisible] = useState(false);
|
||||||
const [switchError, setSwitchError] = useState<string | undefined>();
|
const [switchError, setSwitchError] = useState<string | undefined>();
|
||||||
const [isSwitching, setIsSwitching] = useState(false);
|
const [isSwitching, setIsSwitching] = useState(false);
|
||||||
@@ -72,6 +72,7 @@ export const NetworkButton = ({
|
|||||||
<>
|
<>
|
||||||
<BaseButton
|
<BaseButton
|
||||||
p={padding || "sm"}
|
p={padding || "sm"}
|
||||||
|
paddingVertical="xs"
|
||||||
borderRadius="md"
|
borderRadius="md"
|
||||||
borderWidth={0.5}
|
borderWidth={0.5}
|
||||||
flexDirection="row"
|
flexDirection="row"
|
||||||
@@ -82,13 +83,8 @@ export const NetworkButton = ({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<Box flexDirection="row" alignItems="center">
|
<Box flexDirection="row" alignItems="center">
|
||||||
<ChainIcon chainIconUrl={chain?.icon?.url} size={32} />
|
<ChainIcon chainIconUrl={chain?.icon?.url} size={28} />
|
||||||
<Box
|
<Box ml="md" alignItems="flex-start" justifyContent="center">
|
||||||
ml="md"
|
|
||||||
alignItems="flex-start"
|
|
||||||
justifyContent="center"
|
|
||||||
height={36}
|
|
||||||
>
|
|
||||||
<Text variant="bodyLarge">{chain?.name || "Unknown Network"}</Text>
|
<Text variant="bodyLarge">{chain?.name || "Unknown Network"}</Text>
|
||||||
{isSwitching ? (
|
{isSwitching ? (
|
||||||
<Box flexDirection="row" alignItems="center">
|
<Box flexDirection="row" alignItems="center">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ReactElement, useEffect, useRef } from "react";
|
|||||||
import { Theme } from "../../styles/theme";
|
import { Theme } from "../../styles/theme";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
import { Animated, StyleSheet } from "react-native";
|
import { Animated, StyleSheet } from "react-native";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const TOAST_HEIGHT = 45;
|
export const TOAST_HEIGHT = 45;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ export function Toast({
|
|||||||
backgroundColor,
|
backgroundColor,
|
||||||
translateY = TOAST_HEIGHT,
|
translateY = TOAST_HEIGHT,
|
||||||
}: ToastProps) {
|
}: ToastProps) {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
const translateYRef = useRef(new Animated.Value(translateY)).current;
|
const translateYRef = useRef(new Animated.Value(translateY)).current;
|
||||||
|
|
||||||
|
|||||||
@@ -4,20 +4,27 @@ import ImageSvgUri from "./ImageSvgUri";
|
|||||||
import { Label } from "./Label";
|
import { Label } from "./Label";
|
||||||
import Text from "./Text";
|
import Text from "./Text";
|
||||||
import Box from "./Box";
|
import Box from "./Box";
|
||||||
|
import { Palette } from "../../styles/colors";
|
||||||
|
|
||||||
type WalletButtonProps = {
|
type WalletButtonProps = {
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
walletIconUrl: string;
|
walletIconUrl: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
nameColor?: keyof Palette;
|
||||||
labelText?: string;
|
labelText?: string;
|
||||||
recommended?: boolean;
|
recommended?: boolean;
|
||||||
|
iconWidth?: number;
|
||||||
|
iconHeight?: number;
|
||||||
} & React.ComponentProps<typeof BaseButton>;
|
} & React.ComponentProps<typeof BaseButton>;
|
||||||
|
|
||||||
export const WalletButton = ({
|
export const WalletButton = ({
|
||||||
|
iconWidth = 48,
|
||||||
|
iconHeight = 48,
|
||||||
mb,
|
mb,
|
||||||
onPress,
|
onPress,
|
||||||
walletIconUrl,
|
walletIconUrl,
|
||||||
name,
|
name,
|
||||||
|
nameColor = "textPrimary",
|
||||||
labelText,
|
labelText,
|
||||||
recommended,
|
recommended,
|
||||||
...props
|
...props
|
||||||
@@ -36,9 +43,15 @@ export const WalletButton = ({
|
|||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
<Box flexDirection="row" justifyContent="flex-start" alignItems="center">
|
<Box flexDirection="row" justifyContent="flex-start" alignItems="center">
|
||||||
<ImageSvgUri imageUrl={walletIconUrl} width={48} height={48} />
|
<ImageSvgUri
|
||||||
|
imageUrl={walletIconUrl}
|
||||||
|
width={iconWidth}
|
||||||
|
height={iconHeight}
|
||||||
|
/>
|
||||||
<Box ml="sm" alignItems="flex-start">
|
<Box ml="sm" alignItems="flex-start">
|
||||||
<Text variant="bodyLarge">{name}</Text>
|
<Text variant="bodyLarge" color={nameColor}>
|
||||||
|
{name}
|
||||||
|
</Text>
|
||||||
{recommended ? <Text variant="link">Recommended</Text> : null}
|
{recommended ? <Text variant="link">Recommended</Text> : null}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useAppTheme } from "../../styles/hooks";
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
import BaseButton from "./BaseButton";
|
import BaseButton from "./BaseButton";
|
||||||
import Box from "./Box";
|
import Box from "./Box";
|
||||||
import ImageSvgUri from "./ImageSvgUri";
|
import ImageSvgUri from "./ImageSvgUri";
|
||||||
@@ -17,7 +17,7 @@ export const WalletButtonSquare = ({
|
|||||||
name,
|
name,
|
||||||
size,
|
size,
|
||||||
}: WalletButtonSquareProps) => {
|
}: WalletButtonSquareProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
const marginVertical = theme.spacing.xs;
|
const marginVertical = theme.spacing.xs;
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
import Text from "../Text";
|
import Text from "../Text";
|
||||||
import { TouchableOpacity, StyleSheet, ActivityIndicator } from "react-native";
|
import { TouchableOpacity, StyleSheet, ActivityIndicator } from "react-native";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
|
|
||||||
export const ModalFooter = ({
|
export const ModalFooter = ({
|
||||||
footer,
|
footer,
|
||||||
@@ -11,7 +11,7 @@ export const ModalFooter = ({
|
|||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
onPress?: () => void;
|
onPress?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={styles.footer} onPress={onPress}>
|
<TouchableOpacity style={styles.footer} onPress={onPress}>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { View } from "react-native";
|
import { View } from "react-native";
|
||||||
import { Icon } from "../../../assets/icon";
|
import { Icon } from "../../../assets/icon";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
import Box from "../Box";
|
import Box from "../Box";
|
||||||
import Text from "../Text";
|
import Text from "../Text";
|
||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
interface ModalHeaderTextCloseProps {
|
interface ModalHeaderTextCloseProps {
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
@@ -19,7 +19,7 @@ export const ModalHeaderTextClose = ({
|
|||||||
onBackPress,
|
onBackPress,
|
||||||
...props
|
...props
|
||||||
}: ModalHeaderTextCloseProps & React.ComponentProps<typeof Box>) => {
|
}: ModalHeaderTextCloseProps & React.ComponentProps<typeof Box>) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export const useGlobalTheme = (theme?: ThemeProviderProps["theme"]): Theme => {
|
|||||||
const appTheme = useTheme();
|
const appTheme = useTheme();
|
||||||
|
|
||||||
const resultTheme = useMemo(() => {
|
const resultTheme = useMemo(() => {
|
||||||
const resp = getThemeObj(theme) || getThemeObj(context.theme) || appTheme;
|
const resp = getThemeObj(context.theme) || getThemeObj(theme) || appTheme;
|
||||||
return resp;
|
return resp;
|
||||||
}, [theme, context, appTheme]);
|
}, [theme, context, appTheme]);
|
||||||
|
|
||||||
|
|||||||
+32
-1
@@ -1,12 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
EmbeddedWalletConnectionArgs,
|
EmbeddedWalletConnectionArgs,
|
||||||
EmbeddedWalletConnectorOptions,
|
EmbeddedWalletConnectorOptions,
|
||||||
|
OauthOption,
|
||||||
} from "./types";
|
} from "./types";
|
||||||
import type { Chain } from "@thirdweb-dev/chains";
|
import type { Chain } from "@thirdweb-dev/chains";
|
||||||
import { Connector, normalizeChainId } from "@thirdweb-dev/wallets";
|
import { Connector, normalizeChainId } from "@thirdweb-dev/wallets";
|
||||||
import { providers, Signer } from "ethers";
|
import { providers, Signer } from "ethers";
|
||||||
import { utils } from "ethers";
|
import { utils } from "ethers";
|
||||||
import { sendEmailOTP, validateEmailOTP } from "./embedded/auth";
|
import { sendEmailOTP, socialLogin, validateEmailOTP } from "./embedded/auth";
|
||||||
import { getEthersSigner } from "./embedded/signer";
|
import { getEthersSigner } from "./embedded/signer";
|
||||||
import { logoutUser } from "./embedded/helpers/auth/logout";
|
import { logoutUser } from "./embedded/helpers/auth/logout";
|
||||||
import {
|
import {
|
||||||
@@ -83,6 +84,36 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
return sendEmailOTP(email, this.options.clientId);
|
return sendEmailOTP(email, this.options.clientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async socialLogin(oauthOption: OauthOption) {
|
||||||
|
try {
|
||||||
|
const { email } = await socialLogin(oauthOption, this.options.clientId);
|
||||||
|
this.email = email;
|
||||||
|
saveConnectedEmail(email);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(
|
||||||
|
`Error while signing in with: ${oauthOption.provider}. ${error}`,
|
||||||
|
);
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return { error: error.message };
|
||||||
|
} else {
|
||||||
|
return { error: "An unknown error occurred" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.getSigner();
|
||||||
|
this.emit("connected");
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return { error: error.message };
|
||||||
|
} else {
|
||||||
|
return { error: "Error getting the signer" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true };
|
||||||
|
}
|
||||||
|
|
||||||
async disconnect(): Promise<void> {
|
async disconnect(): Promise<void> {
|
||||||
clearConnectedEmail();
|
clearConnectedEmail();
|
||||||
await logoutUser(this.options.clientId);
|
await logoutUser(this.options.clientId);
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import { postPaperAuth, prePaperAuth } from "./helpers/auth/middleware";
|
|||||||
import { isDeviceSharePresentForUser } from "./helpers/storage/local";
|
import { isDeviceSharePresentForUser } from "./helpers/storage/local";
|
||||||
import { getCognitoUser, setCognitoUser } from "./helpers/storage/state";
|
import { getCognitoUser, setCognitoUser } from "./helpers/storage/state";
|
||||||
import { SendEmailOtpReturnType } from "@thirdweb-dev/wallets";
|
import { SendEmailOtpReturnType } from "@thirdweb-dev/wallets";
|
||||||
|
import { InAppBrowser } from "react-native-inappbrowser-reborn";
|
||||||
|
import { OauthOption } from "../types";
|
||||||
|
import { ROUTE_HEADLESS_GOOGLE_LOGIN } from "./helpers/constants";
|
||||||
|
|
||||||
export async function sendEmailOTP(
|
export async function sendEmailOTP(
|
||||||
email: string,
|
email: string,
|
||||||
@@ -122,3 +125,74 @@ export async function validateEmailOTP({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function socialLogin(oauthOptions: OauthOption, clientId: string) {
|
||||||
|
const headlessLoginLinkWithParams = `${ROUTE_HEADLESS_GOOGLE_LOGIN}?authProvider=${encodeURIComponent(
|
||||||
|
"google",
|
||||||
|
)}&baseUrl=${encodeURIComponent(
|
||||||
|
"https://ews.thirdweb.com",
|
||||||
|
)}&platform=${encodeURIComponent("mobile")}`;
|
||||||
|
|
||||||
|
const resp = await fetch(headlessLoginLinkWithParams);
|
||||||
|
|
||||||
|
if (!resp.ok) {
|
||||||
|
throw new Error("Error getting headless login link");
|
||||||
|
}
|
||||||
|
|
||||||
|
const json = await resp.json();
|
||||||
|
|
||||||
|
const { platformLoginLink } = json;
|
||||||
|
|
||||||
|
const completeLoginUrl = `${platformLoginLink}?developerClientId=${encodeURIComponent(
|
||||||
|
clientId || "",
|
||||||
|
)}&platform=${encodeURIComponent("mobile")}&redirectUrl=${encodeURIComponent(
|
||||||
|
oauthOptions.redirectUrl,
|
||||||
|
)}`;
|
||||||
|
|
||||||
|
const result = await InAppBrowser.openAuth(
|
||||||
|
completeLoginUrl,
|
||||||
|
oauthOptions.redirectUrl,
|
||||||
|
{
|
||||||
|
// iOS Properties
|
||||||
|
ephemeralWebSession: false,
|
||||||
|
// Android Properties
|
||||||
|
showTitle: false,
|
||||||
|
enableUrlBarHiding: false,
|
||||||
|
enableDefaultShare: false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result.type !== "success") {
|
||||||
|
throw new Error("Error signing in. Please try again later.");
|
||||||
|
}
|
||||||
|
|
||||||
|
const decodedUrl = decodeURIComponent(result.url);
|
||||||
|
|
||||||
|
const parts = decodedUrl.split("?authResult=");
|
||||||
|
if (parts.length < 2) {
|
||||||
|
throw new Error("Malformed response from the login redirect");
|
||||||
|
}
|
||||||
|
const authResult = parts[1];
|
||||||
|
const { storedToken } = JSON.parse(authResult);
|
||||||
|
|
||||||
|
try {
|
||||||
|
const toStoreToken: AuthStoredTokenWithCookieReturnType["storedToken"] = {
|
||||||
|
jwtToken: storedToken.jwtToken,
|
||||||
|
authDetails: storedToken.authDetails,
|
||||||
|
authProvider: storedToken.authProvider,
|
||||||
|
developerClientId: storedToken.developerClientId,
|
||||||
|
cookieString: storedToken.cookieString,
|
||||||
|
// we should always store the jwt cookie since there's no concept of cookie in react native
|
||||||
|
shouldStoreCookieString: true,
|
||||||
|
isNewUser: storedToken.isNewUser,
|
||||||
|
};
|
||||||
|
|
||||||
|
await postPaperAuth(toStoreToken, clientId);
|
||||||
|
|
||||||
|
return { storedToken, email: storedToken.authDetails.email };
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(
|
||||||
|
`Malformed response from post authentication: ${JSON.stringify(e)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+2
@@ -30,4 +30,6 @@ export const ROUTE_STORE_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedd
|
|||||||
export const ROUTE_GET_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/get-shares`;
|
export const ROUTE_GET_USER_SHARES = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/get-shares`;
|
||||||
export const ROUTE_VERIFY_THIRDWEB_CLIENT_ID = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/verify-thirdweb-client-id`;
|
export const ROUTE_VERIFY_THIRDWEB_CLIENT_ID = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/verify-thirdweb-client-id`;
|
||||||
|
|
||||||
|
export const ROUTE_HEADLESS_GOOGLE_LOGIN = `${BASE_URL}/api/2022-08-12/embedded-wallet/headless-login-link`;
|
||||||
|
|
||||||
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
export const ROUTE_AUTH_COGNITO_ID_TOKEN = `${ROUTE_2022_08_12_API_BASE_PATH}/embedded-wallet/cognito-id-token`;
|
||||||
|
|||||||
@@ -1,11 +1,21 @@
|
|||||||
import { Chain } from "@thirdweb-dev/chains";
|
import { Chain } from "@thirdweb-dev/chains";
|
||||||
import { WalletOptions } from "@thirdweb-dev/wallets";
|
import { WalletOptions } from "@thirdweb-dev/wallets";
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
RecoveryShareManagement,
|
RecoveryShareManagement,
|
||||||
PaperConstructorType,
|
PaperConstructorType,
|
||||||
|
AuthProvider,
|
||||||
} from "@paperxyz/embedded-wallet-service-sdk";
|
} from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
|
||||||
|
export type OauthOptions = {
|
||||||
|
providers: AuthProvider[];
|
||||||
|
redirectUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type OauthOption = {
|
||||||
|
provider: AuthProvider;
|
||||||
|
redirectUrl: string;
|
||||||
|
};
|
||||||
|
|
||||||
export interface EmbeddedConnectorOptions {
|
export interface EmbeddedConnectorOptions {
|
||||||
chains?: Chain[];
|
chains?: Chain[];
|
||||||
chainId?: number;
|
chainId?: number;
|
||||||
|
|||||||
@@ -12,12 +12,14 @@ import {
|
|||||||
TextInput,
|
TextInput,
|
||||||
TextInputKeyPressEventData,
|
TextInputKeyPressEventData,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
||||||
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 * as Clipboard from "expo-clipboard";
|
import * as Clipboard from "expo-clipboard";
|
||||||
|
import { StyleSheet } from "react-native";
|
||||||
|
import { EmbeddedSocialConnection } from "./EmbeddedSocialConnection";
|
||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
const OTP_LENGTH = 6;
|
const OTP_LENGTH = 6;
|
||||||
|
|
||||||
@@ -26,8 +28,9 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
goBack,
|
goBack,
|
||||||
selectionData,
|
selectionData,
|
||||||
onLocallyConnected,
|
onLocallyConnected,
|
||||||
|
...props
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const inputRefs = useRef<(TextInput | null)[]>([]);
|
const inputRefs = useRef<(TextInput | null)[]>([]);
|
||||||
const [values, setValues] = useState<string[]>(
|
const [values, setValues] = useState<string[]>(
|
||||||
new Array(OTP_LENGTH).fill(""),
|
new Array(OTP_LENGTH).fill(""),
|
||||||
@@ -104,6 +107,7 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
inputRefs.current[i]?.setNativeProps({ text: newValues[i] });
|
inputRefs.current[i]?.setNativeProps({ text: newValues[i] });
|
||||||
}
|
}
|
||||||
setValues(newValues);
|
setValues(newValues);
|
||||||
|
Clipboard.setStringAsync("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,6 +161,18 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (selectionData?.oauthOptions) {
|
||||||
|
return (
|
||||||
|
<EmbeddedSocialConnection
|
||||||
|
connected={() => {}}
|
||||||
|
goBack={goBack}
|
||||||
|
onLocallyConnected={onLocallyConnected}
|
||||||
|
selectionData={selectionData}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box marginHorizontal="xl">
|
<Box marginHorizontal="xl">
|
||||||
<ConnectWalletHeader
|
<ConnectWalletHeader
|
||||||
@@ -198,10 +214,8 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
<TextInput
|
<TextInput
|
||||||
ref={(ref) => (inputRefs.current[index] = ref)}
|
ref={(ref) => (inputRefs.current[index] = ref)}
|
||||||
style={{
|
style={{
|
||||||
fontSize: 20,
|
...styles.textInput,
|
||||||
color: theme.colors.textPrimary,
|
color: theme.colors.textPrimary,
|
||||||
textAlign: "center",
|
|
||||||
height: 50,
|
|
||||||
}}
|
}}
|
||||||
keyboardType="number-pad"
|
keyboardType="number-pad"
|
||||||
editable={!checkingOtp}
|
editable={!checkingOtp}
|
||||||
@@ -246,3 +260,11 @@ export const EmbeddedConnectionUI: React.FC<ConnectUIProps<EmbeddedWallet>> = ({
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
textInput: {
|
||||||
|
fontSize: 20,
|
||||||
|
textAlign: "center",
|
||||||
|
height: 50,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { EmbeddedWallet } from "./EmbeddedWallet";
|
import { EmbeddedWallet } from "./EmbeddedWallet";
|
||||||
import { ActivityIndicator } from "react-native";
|
import { ActivityIndicator } from "react-native";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
import {
|
import {
|
||||||
SelectUIProps,
|
SelectUIProps,
|
||||||
useCreateWalletInstance,
|
useCreateWalletInstance,
|
||||||
@@ -10,21 +9,30 @@ 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 { AuthProvider } from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
import { OauthOptions } from "../../connectors/embedded-wallet/types";
|
||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*/
|
*/
|
||||||
export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
export const EmailSelectionUI: React.FC<
|
||||||
onSelect,
|
SelectUIProps<EmbeddedWallet> & {
|
||||||
walletConfig,
|
oauthOptions?: OauthOptions;
|
||||||
}) => {
|
email?: boolean;
|
||||||
const theme = useAppTheme();
|
}
|
||||||
const [email, setEmail] = useState<string>("");
|
> = ({ onSelect, walletConfig, oauthOptions, email }) => {
|
||||||
|
const theme = useGlobalTheme();
|
||||||
|
const [emailInput, setEmailInput] = useState<string>("");
|
||||||
const [errorMessage, setErrorMessage] = useState<string>("");
|
const [errorMessage, setErrorMessage] = useState<string>("");
|
||||||
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 isEmailEnabled = email === false ? false : true;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const emailWalletInstance = createWalletInstance(
|
const emailWalletInstance = createWalletInstance(
|
||||||
walletConfig,
|
walletConfig,
|
||||||
@@ -39,17 +47,18 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleNetworkCall = () => {
|
const handleNetworkCall = () => {
|
||||||
if (validateEmail(email)) {
|
if (validateEmail(emailInput)) {
|
||||||
setErrorMessage("");
|
setErrorMessage("");
|
||||||
setIsFetching(true);
|
setIsFetching(true);
|
||||||
|
|
||||||
emailWallet
|
emailWallet
|
||||||
?.sendEmailOTP(email)
|
?.sendEmailOTP(emailInput)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
onSelect({
|
onSelect({
|
||||||
...response,
|
...response,
|
||||||
email,
|
email: emailInput,
|
||||||
emailWallet,
|
emailWallet,
|
||||||
|
oauthOptions: undefined,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -65,58 +74,109 @@ export const EmailSelectionUI: React.FC<SelectUIProps<EmbeddedWallet>> = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onGoogleSignInPress = () => {
|
||||||
|
onSelect({
|
||||||
|
email: emailInput,
|
||||||
|
emailWallet,
|
||||||
|
oauthOptions: {
|
||||||
|
provider: oauthOptions?.providers[0],
|
||||||
|
redirectUrl: oauthOptions?.redirectUrl,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box paddingHorizontal="xl" mt="lg">
|
<Box paddingHorizontal="xl" mt="lg">
|
||||||
<TextInput
|
{oauthOptions?.providers.includes(AuthProvider.GOOGLE) ? (
|
||||||
textInputProps={{
|
<Box justifyContent="center">
|
||||||
placeholder: "Enter your email address",
|
<WalletButton
|
||||||
placeholderTextColor: theme.colors.textSecondary,
|
iconHeight={28}
|
||||||
onChangeText: setEmail,
|
iconWidth={28}
|
||||||
style: {
|
borderRadius="lg"
|
||||||
fontSize: 14,
|
borderWidth={1}
|
||||||
color: theme.colors.textPrimary,
|
borderColor="buttonBackgroundColor"
|
||||||
lineHeight: 16,
|
backgroundColor="buttonBackgroundColor"
|
||||||
padding: 0,
|
nameColor="buttonTextColor"
|
||||||
flex: 1,
|
justifyContent="center"
|
||||||
},
|
name="Sign in with Google"
|
||||||
value: email,
|
walletIconUrl={GOOGLE_ICON}
|
||||||
keyboardType: "email-address",
|
onPress={onGoogleSignInPress}
|
||||||
returnKeyType: "done",
|
|
||||||
autoCapitalize: "none",
|
|
||||||
autoCorrect: false,
|
|
||||||
autoComplete: "off",
|
|
||||||
clearTextOnFocus: false,
|
|
||||||
}}
|
|
||||||
containerProps={{
|
|
||||||
paddingHorizontal: "sm",
|
|
||||||
paddingVertical: "sm",
|
|
||||||
justifyContent: "flex-start",
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<BaseButton
|
|
||||||
mt="md"
|
|
||||||
paddingVertical="md"
|
|
||||||
borderRadius="lg"
|
|
||||||
borderWidth={1}
|
|
||||||
borderColor="border"
|
|
||||||
backgroundColor="accentButtonColor"
|
|
||||||
onPress={handleNetworkCall}
|
|
||||||
>
|
|
||||||
{isFetching ? (
|
|
||||||
<ActivityIndicator
|
|
||||||
size={"small"}
|
|
||||||
color={theme.colors.accentButtonTextColor}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
{isEmailEnabled ? (
|
||||||
<Text
|
<Box
|
||||||
variant="bodySmall"
|
mb="md"
|
||||||
color="accentButtonTextColor"
|
mt="md"
|
||||||
fontWeight="700"
|
flexDirection="row"
|
||||||
|
justifyContent="center"
|
||||||
|
alignItems="center"
|
||||||
|
>
|
||||||
|
<Box height={1} flex={1} backgroundColor="border" />
|
||||||
|
<Text
|
||||||
|
variant="subHeader"
|
||||||
|
textAlign="center"
|
||||||
|
marginHorizontal="xxs"
|
||||||
|
>
|
||||||
|
OR
|
||||||
|
</Text>
|
||||||
|
<Box height={1} flex={1} backgroundColor="border" />
|
||||||
|
</Box>
|
||||||
|
) : null}
|
||||||
|
</Box>
|
||||||
|
) : null}
|
||||||
|
{isEmailEnabled ? (
|
||||||
|
<>
|
||||||
|
<TextInput
|
||||||
|
textInputProps={{
|
||||||
|
placeholder: "Enter your email address",
|
||||||
|
placeholderTextColor: theme.colors.textSecondary,
|
||||||
|
onChangeText: setEmailInput,
|
||||||
|
style: {
|
||||||
|
fontSize: 14,
|
||||||
|
color: theme.colors.textPrimary,
|
||||||
|
lineHeight: 16,
|
||||||
|
padding: 0,
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
value: emailInput,
|
||||||
|
keyboardType: "email-address",
|
||||||
|
returnKeyType: "done",
|
||||||
|
autoCapitalize: "none",
|
||||||
|
autoCorrect: false,
|
||||||
|
autoComplete: "off",
|
||||||
|
clearTextOnFocus: false,
|
||||||
|
}}
|
||||||
|
containerProps={{
|
||||||
|
paddingHorizontal: "sm",
|
||||||
|
paddingVertical: "sm",
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<BaseButton
|
||||||
|
mt="md"
|
||||||
|
paddingVertical="md"
|
||||||
|
borderRadius="lg"
|
||||||
|
borderWidth={1}
|
||||||
|
borderColor="border"
|
||||||
|
backgroundColor="accentButtonColor"
|
||||||
|
onPress={handleNetworkCall}
|
||||||
>
|
>
|
||||||
Continue
|
{isFetching ? (
|
||||||
</Text>
|
<ActivityIndicator
|
||||||
)}
|
size={"small"}
|
||||||
</BaseButton>
|
color={theme.colors.accentButtonTextColor}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Text
|
||||||
|
variant="bodySmall"
|
||||||
|
color="accentButtonTextColor"
|
||||||
|
fontWeight="700"
|
||||||
|
>
|
||||||
|
Continue
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</BaseButton>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
{errorMessage ? (
|
{errorMessage ? (
|
||||||
<Text variant="error" mt="xxs">
|
<Text variant="error" mt="xxs">
|
||||||
{errorMessage}
|
{errorMessage}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
import { useCallback, useEffect, useState } from "react";
|
||||||
|
import React from "react";
|
||||||
|
import { ActivityIndicator } from "react-native";
|
||||||
|
import { EmbeddedWallet } from "./EmbeddedWallet";
|
||||||
|
import {
|
||||||
|
ConnectUIProps,
|
||||||
|
useSetConnectedWallet,
|
||||||
|
useSetConnectionStatus,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { GOOGLE_ICON } from "../../../assets";
|
||||||
|
import { ConnectWalletHeader } from "../../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWalletHeader";
|
||||||
|
import { Box, Text, WalletButton } from "../../../components/base";
|
||||||
|
|
||||||
|
export const EmbeddedSocialConnection: React.FC<
|
||||||
|
ConnectUIProps<EmbeddedWallet>
|
||||||
|
> = ({ goBack, selectionData, onLocallyConnected }) => {
|
||||||
|
const setConnectedWallet = useSetConnectedWallet();
|
||||||
|
const setConnectionStatus = useSetConnectionStatus();
|
||||||
|
const [errorMessage, setErrorMessage] = useState<string>();
|
||||||
|
|
||||||
|
const handleGoogleLogin = useCallback(() => {
|
||||||
|
setErrorMessage("");
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
(selectionData.emailWallet as EmbeddedWallet)
|
||||||
|
.socialLogin(selectionData?.oauthOptions)
|
||||||
|
.then(async (response) => {
|
||||||
|
if (response?.success) {
|
||||||
|
if (onLocallyConnected) {
|
||||||
|
onLocallyConnected(selectionData.emailWallet);
|
||||||
|
} else {
|
||||||
|
await setConnectedWallet(selectionData.emailWallet);
|
||||||
|
setConnectionStatus("connected");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setErrorMessage(
|
||||||
|
response?.error || "Error login in. Please try again later.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Error validating otp: ", error);
|
||||||
|
setErrorMessage("Error login in. Please try again later.");
|
||||||
|
});
|
||||||
|
}, 0);
|
||||||
|
}, [
|
||||||
|
onLocallyConnected,
|
||||||
|
selectionData.emailWallet,
|
||||||
|
selectionData.oauthOptions,
|
||||||
|
setConnectedWallet,
|
||||||
|
setConnectionStatus,
|
||||||
|
]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleGoogleLogin();
|
||||||
|
}, [handleGoogleLogin]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box marginHorizontal="xl" height={200}>
|
||||||
|
<ConnectWalletHeader
|
||||||
|
middleContent={
|
||||||
|
<WalletButton
|
||||||
|
iconHeight={28}
|
||||||
|
iconWidth={28}
|
||||||
|
borderRadius="lg"
|
||||||
|
justifyContent="center"
|
||||||
|
name="Sign In"
|
||||||
|
walletIconUrl={GOOGLE_ICON}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
subHeaderText={""}
|
||||||
|
onBackPress={goBack}
|
||||||
|
onClose={goBack}
|
||||||
|
/>
|
||||||
|
<Box flex={1} justifyContent="center" alignItems="center">
|
||||||
|
{!errorMessage ? (
|
||||||
|
<ActivityIndicator size="large" />
|
||||||
|
) : (
|
||||||
|
<Text variant="error" numberOfLines={1}>
|
||||||
|
{errorMessage}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -5,7 +5,10 @@ import {
|
|||||||
walletIds,
|
walletIds,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
import type { EmbeddedWalletConnector as EmbeddedConnectorType } from "../../connectors/embedded-wallet/embedded-connector";
|
import type { EmbeddedWalletConnector as EmbeddedConnectorType } from "../../connectors/embedded-wallet/embedded-connector";
|
||||||
import { EmbeddedWalletConnectionArgs } from "../../connectors/embedded-wallet/types";
|
import {
|
||||||
|
EmbeddedWalletConnectionArgs,
|
||||||
|
OauthOption,
|
||||||
|
} from "../../connectors/embedded-wallet/types";
|
||||||
import { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
import { EmbeddedWalletConnector } from "../../connectors/embedded-wallet/embedded-connector";
|
||||||
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
import { EMAIL_WALLET_ICON } from "../../../assets/svgs";
|
||||||
|
|
||||||
@@ -43,8 +46,6 @@ export class EmbeddedWallet extends AbstractClientWallet<
|
|||||||
return this.connector;
|
return this.connector;
|
||||||
}
|
}
|
||||||
|
|
||||||
// my methods
|
|
||||||
|
|
||||||
initializeConnector() {
|
initializeConnector() {
|
||||||
this.connector = new EmbeddedWalletConnector({
|
this.connector = new EmbeddedWalletConnector({
|
||||||
...this.options,
|
...this.options,
|
||||||
@@ -63,6 +64,10 @@ export class EmbeddedWallet extends AbstractClientWallet<
|
|||||||
return this.connector?.sendEmailOtp(email);
|
return this.connector?.sendEmailOtp(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async socialLogin(oauthOption: OauthOption) {
|
||||||
|
return this.connector?.socialLogin(oauthOption);
|
||||||
|
}
|
||||||
|
|
||||||
onConnected = () => {
|
onConnected = () => {
|
||||||
this.emit("message", { type: "connected" });
|
this.emit("message", { type: "connected" });
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,16 +6,40 @@ 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 { AuthProvider } from "@paperxyz/embedded-wallet-service-sdk";
|
||||||
|
|
||||||
|
type OAuthProvider = "google"; // currently we only have one
|
||||||
|
|
||||||
export type EmbeddedWalletConfig = {
|
export type EmbeddedWalletConfig = {
|
||||||
recommended?: boolean;
|
// @default true - set false to disable
|
||||||
|
email?: boolean;
|
||||||
|
|
||||||
|
// @default { providers: ['google'] } - set false to disable
|
||||||
|
oauthOptions?:
|
||||||
|
| {
|
||||||
|
providers: OAuthProvider[];
|
||||||
|
redirectUrl: string;
|
||||||
|
}
|
||||||
|
| false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const embeddedWallet = (
|
export const embeddedWallet = (
|
||||||
config?: EmbeddedWalletConfig,
|
config?: EmbeddedWalletConfig,
|
||||||
): WalletConfig<EmbeddedWallet> => {
|
): WalletConfig<EmbeddedWallet> => {
|
||||||
const selectUI = (props: SelectUIProps<EmbeddedWallet>) => (
|
const selectUI = (props: SelectUIProps<EmbeddedWallet>) => (
|
||||||
<EmailSelectionUI {...props} />
|
<EmailSelectionUI
|
||||||
|
{...props}
|
||||||
|
oauthOptions={
|
||||||
|
config?.oauthOptions
|
||||||
|
? {
|
||||||
|
providers: [AuthProvider.GOOGLE],
|
||||||
|
redirectUrl: config.oauthOptions.redirectUrl,
|
||||||
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
// you cannot disable both email and oauth
|
||||||
|
email={!config?.oauthOptions && !config?.email ? true : config?.email}
|
||||||
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -29,6 +53,5 @@ export const embeddedWallet = (
|
|||||||
},
|
},
|
||||||
selectUI: selectUI,
|
selectUI: selectUI,
|
||||||
connectUI: EmbeddedConnectionUI,
|
connectUI: EmbeddedConnectionUI,
|
||||||
recommended: config?.recommended,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ import { TextInput } from "../../components/base/TextInput";
|
|||||||
import Text from "../../components/base/Text";
|
import Text from "../../components/base/Text";
|
||||||
import { useMagicLink } from "../../providers/context-provider";
|
import { useMagicLink } from "../../providers/context-provider";
|
||||||
import BaseButton from "../../components/base/BaseButton";
|
import BaseButton from "../../components/base/BaseButton";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { ConnectingWallet } from "../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWallet";
|
import { ConnectingWallet } from "../../components/ConnectWalletFlow/ConnectingWallet/ConnectingWallet";
|
||||||
|
import { useGlobalTheme } from "../../providers/ui-context-provider";
|
||||||
|
|
||||||
export const magicLink = (
|
export const magicLink = (
|
||||||
magicLinkOptions: MagicLinkOptions & { recommended?: boolean },
|
magicLinkOptions: MagicLinkOptions & { recommended?: boolean },
|
||||||
@@ -54,7 +54,7 @@ export const magicLink = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const MagicSelectionUI: React.FC<SelectUIProps<MagicLink>> = (props) => {
|
const MagicSelectionUI: React.FC<SelectUIProps<MagicLink>> = (props) => {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [email, setEmail] = React.useState("");
|
const [email, setEmail] = React.useState("");
|
||||||
|
|
||||||
const onContinuePress = () => {
|
const onContinuePress = () => {
|
||||||
|
|||||||
@@ -19,9 +19,9 @@ import {
|
|||||||
useSetConnectionStatus,
|
useSetConnectionStatus,
|
||||||
} from "@thirdweb-dev/react-core";
|
} from "@thirdweb-dev/react-core";
|
||||||
import { WalletConnect } from "./WalletConnect";
|
import { WalletConnect } from "./WalletConnect";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
|
||||||
import { WalletConnectButton } from "./WalletConnectButton";
|
import { WalletConnectButton } from "./WalletConnectButton";
|
||||||
import { ModalHeaderTextClose } from "../../../components/base";
|
import { ModalHeaderTextClose } from "../../../components/base";
|
||||||
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
type WCWallet = {
|
type WCWallet = {
|
||||||
iconURL: string;
|
iconURL: string;
|
||||||
@@ -41,7 +41,7 @@ export function WalletConnectUI({
|
|||||||
goBack,
|
goBack,
|
||||||
projectId,
|
projectId,
|
||||||
}: ConnectUIProps<WalletConnect> & { projectId: string }) {
|
}: ConnectUIProps<WalletConnect> & { projectId: string }) {
|
||||||
const theme = useAppTheme();
|
const theme = useGlobalTheme();
|
||||||
const [wallets, setWallets] = useState<WCWallet[]>([]);
|
const [wallets, setWallets] = useState<WCWallet[]>([]);
|
||||||
const [error, setError] = useState<string | undefined>();
|
const [error, setError] = useState<string | undefined>();
|
||||||
const [loading, setLoading] = useState<boolean>(true);
|
const [loading, setLoading] = useState<boolean>(true);
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { Animated, Easing, StyleSheet, View } from "react-native";
|
import { Animated, Easing, StyleSheet, View } from "react-native";
|
||||||
import Svg, { Rect } from "react-native-svg";
|
import Svg, { Rect } from "react-native-svg";
|
||||||
import { useAppTheme } from "../../../styles/hooks";
|
import { useGlobalTheme } from "../../../providers/ui-context-provider";
|
||||||
|
|
||||||
const AnimatedRect = Animated.createAnimatedComponent(Rect);
|
const AnimatedRect = Animated.createAnimatedComponent(Rect);
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ function WalletLoadingThumbnail({
|
|||||||
showError,
|
showError,
|
||||||
imageSize = 50,
|
imageSize = 50,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const Theme = useAppTheme();
|
const Theme = useGlobalTheme();
|
||||||
const spinValue = useRef(new Animated.Value(0));
|
const spinValue = useRef(new Animated.Value(0));
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,5 +1,68 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 4.0.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.55
|
||||||
|
- @thirdweb-dev/react-core@4.0.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.7
|
||||||
|
|
||||||
|
## 4.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.5
|
||||||
|
- @thirdweb-dev/react-core@4.0.6
|
||||||
|
- @thirdweb-dev/wallets@2.0.6
|
||||||
|
|
||||||
|
## 4.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.4
|
||||||
|
- @thirdweb-dev/wallets@2.0.5
|
||||||
|
- @thirdweb-dev/react-core@4.0.5
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1769](https://github.com/thirdweb-dev/js/pull/1769) [`010955ff`](https://github.com/thirdweb-dev/js/commit/010955ff5cc35a975b54c25992b8e65b40e033a1) Thanks [@MananTank](https://github.com/MananTank)! - Fix OTP input not working well with Japanese keyboard
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.4
|
||||||
|
- @thirdweb-dev/react-core@4.0.4
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1766](https://github.com/thirdweb-dev/js/pull/1766) [`dd7d0fca`](https://github.com/thirdweb-dev/js/commit/dd7d0fca2d14a529343396a31939d49b1a074d3e) Thanks [@MananTank](https://github.com/MananTank)! - Fix Continue as Guest button missing when Social + Guest login is setup in ConnectWallet Modal
|
||||||
|
|
||||||
|
- [#1692](https://github.com/thirdweb-dev/js/pull/1692) [`fb0f12ae`](https://github.com/thirdweb-dev/js/commit/fb0f12ae2835f4eba60ba4a74b453151cab0d393) Thanks [@etnlbck](https://github.com/etnlbck)! - Refactored OTPInput component to be simpler to read
|
||||||
|
|
||||||
|
- Updated dependencies [[`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6), [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06), [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223), [`08e9cd20`](https://github.com/thirdweb-dev/js/commit/08e9cd206bcc37cf1e84a878dc78bc4f38e5092c), [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.2
|
||||||
|
- @thirdweb-dev/react-core@4.0.3
|
||||||
|
- @thirdweb-dev/wallets@2.0.3
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1750](https://github.com/thirdweb-dev/js/pull/1750) [`bb1666b9`](https://github.com/thirdweb-dev/js/commit/bb1666b92b5e151d78ea7dae6831297fb947d954) Thanks [@MananTank](https://github.com/MananTank)! - ConnectWallet UI tweaks/fixes
|
||||||
|
|
||||||
|
- Updated dependencies [[`1f3c64d3`](https://github.com/thirdweb-dev/js/commit/1f3c64d3618903b9008cc7b633ea890b508e7800), [`74941603`](https://github.com/thirdweb-dev/js/commit/74941603a96456da46a47147f67c98235ac55022), [`4b98e487`](https://github.com/thirdweb-dev/js/commit/4b98e487d4b47225d7095e5444dc5e7608db48a3), [`693f349d`](https://github.com/thirdweb-dev/js/commit/693f349db2478e1cd0fc82a9ef9882f46832b125), [`dcdb0dcb`](https://github.com/thirdweb-dev/js/commit/dcdb0dcb838168a22c8335738852316dfb6e6fc9), [`0f12d1f9`](https://github.com/thirdweb-dev/js/commit/0f12d1f90320923309f085c372d3a5ed01dd4606), [`b3b9edca`](https://github.com/thirdweb-dev/js/commit/b3b9edca29e7d4053b14270a61caa89c34fecf9e), [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.1
|
||||||
|
- @thirdweb-dev/wallets@2.0.2
|
||||||
|
- @thirdweb-dev/react-core@4.0.2
|
||||||
|
|
||||||
## 4.0.1
|
## 4.0.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "4.0.1",
|
"version": "4.0.7",
|
||||||
"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",
|
||||||
|
|||||||
@@ -36,15 +36,17 @@ export function OTPInput(props: {
|
|||||||
data-error={props.isInvalid}
|
data-error={props.isInvalid}
|
||||||
ref={(e) => (boxEls.current[i] = e)}
|
ref={(e) => (boxEls.current[i] = e)}
|
||||||
key={i}
|
key={i}
|
||||||
value={otp[i] === undefined ? "" : otp[i]}
|
value={otp[i] ?? ""}
|
||||||
type="number"
|
type="number"
|
||||||
|
pattern="[0-9]*"
|
||||||
variant="outline"
|
variant="outline"
|
||||||
|
inputMode="numeric"
|
||||||
onPaste={(e) => {
|
onPaste={(e) => {
|
||||||
const pastedData = e.clipboardData.getData("text/plain");
|
const pastedData = e.clipboardData.getData("text/plain");
|
||||||
const newOTP = pastedData
|
const newOTP = pastedData
|
||||||
.slice(0, props.digits)
|
.slice(0, props.digits)
|
||||||
.split("")
|
.split("")
|
||||||
.filter((n) => /[0-9]/.test(n))
|
.filter((n) => /\d/.test(n))
|
||||||
.map(Number);
|
.map(Number);
|
||||||
|
|
||||||
setOTP(newOTP);
|
setOTP(newOTP);
|
||||||
@@ -100,7 +102,7 @@ export function OTPInput(props: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!/[0-9]/.test(value) && value !== "") {
|
if (!/\d/.test(value) && value !== "") {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
import styled from "@emotion/styled";
|
import styled from "@emotion/styled";
|
||||||
import { fontSize, Theme } from "../design-system";
|
import { fontSize, spacing, Theme } from "../design-system";
|
||||||
|
|
||||||
export const TextDivider = styled.div<{ theme?: Theme }>`
|
export const TextDivider = (props: {
|
||||||
|
text: string;
|
||||||
|
py?: keyof typeof spacing;
|
||||||
|
}) => {
|
||||||
|
return (
|
||||||
|
<TextDividerEl
|
||||||
|
style={{
|
||||||
|
paddingBlock: props.py ? spacing[props.py] : 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span> {props.text}</span>
|
||||||
|
</TextDividerEl>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const TextDividerEl = styled.div<{ theme?: Theme }>`
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: ${(p) => p.theme.colors.secondaryText};
|
color: ${(p) => p.theme.colors.secondaryText};
|
||||||
|
|||||||
@@ -63,13 +63,13 @@ function createThemeObj(colors: typeof darkColors) {
|
|||||||
scrollbarBg: colors.base2,
|
scrollbarBg: colors.base2,
|
||||||
walletSelectorButtonHoverBg: colors.base2,
|
walletSelectorButtonHoverBg: colors.base2,
|
||||||
|
|
||||||
separatorLine: colors.base3,
|
separatorLine: colors.base4,
|
||||||
|
|
||||||
secondaryIconColor: colors.secondaryText,
|
secondaryIconColor: colors.secondaryText,
|
||||||
secondaryIconHoverBg: colors.base3,
|
secondaryIconHoverBg: colors.base3,
|
||||||
secondaryIconHoverColor: colors.primaryText,
|
secondaryIconHoverColor: colors.primaryText,
|
||||||
|
|
||||||
borderColor: colors.base3,
|
borderColor: colors.base4,
|
||||||
skeletonBg: colors.base3,
|
skeletonBg: colors.base3,
|
||||||
|
|
||||||
selectedTextColor: colors.base1,
|
selectedTextColor: colors.base1,
|
||||||
|
|||||||
@@ -62,4 +62,5 @@ export {
|
|||||||
MagicLink,
|
MagicLink,
|
||||||
SignerWallet,
|
SignerWallet,
|
||||||
InjectedWallet,
|
InjectedWallet,
|
||||||
|
setWalletAnalyticsEnabled,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ export function SendFundsForm(props: {
|
|||||||
</CurrencyBadge>
|
</CurrencyBadge>
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<Spacer y="xl" />
|
<Spacer y="xxl" />
|
||||||
|
|
||||||
{/* Submit */}
|
{/* Submit */}
|
||||||
<Button
|
<Button
|
||||||
@@ -307,6 +307,7 @@ export function SendFundsForm(props: {
|
|||||||
style={{
|
style={{
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
gap: spacing.sm,
|
gap: spacing.sm,
|
||||||
|
padding: spacing.md,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{sendTokenMutation.isLoading ? "Sending" : "Send"}
|
{sendTokenMutation.isLoading ? "Sending" : "Send"}
|
||||||
|
|||||||
@@ -56,20 +56,6 @@ export const WalletSelector: React.FC<{
|
|||||||
nonLocalWalletConfigs.filter((w) => w.category !== "socialLogin"),
|
nonLocalWalletConfigs.filter((w) => w.category !== "socialLogin"),
|
||||||
);
|
);
|
||||||
|
|
||||||
const showNewToWallets =
|
|
||||||
isCompact && (socialWallets.length === 0 || isWalletGroupExpanded);
|
|
||||||
|
|
||||||
// groups UI is showing a social login + grouping all eoa wallets together in a group
|
|
||||||
// do this if there is social login and more than 2 eoa wallets
|
|
||||||
const showGroupsUI =
|
|
||||||
isCompact && socialWallets.length >= 1 && eoaWallets.length >= 2;
|
|
||||||
|
|
||||||
const showTOS = isCompact && (termsOfServiceUrl || privacyPolicyUrl);
|
|
||||||
|
|
||||||
const showFooter = Boolean(
|
|
||||||
(!showGroupsUI && localWalletConfig) || showNewToWallets,
|
|
||||||
);
|
|
||||||
|
|
||||||
const continueAsGuest = localWalletConfig && (
|
const continueAsGuest = localWalletConfig && (
|
||||||
<Button
|
<Button
|
||||||
fullWidth
|
fullWidth
|
||||||
@@ -138,7 +124,218 @@ export const WalletSelector: React.FC<{
|
|||||||
props.selectWallet(wallet);
|
props.selectWallet(wallet);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showSeperatorLine = showNewToWallets && !continueAsGuest && showTOS;
|
const connectAWallet = (
|
||||||
|
<Button
|
||||||
|
fullWidth
|
||||||
|
variant="outline"
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
justifyContent: "center",
|
||||||
|
gap: spacing.sm,
|
||||||
|
padding: spacing.md,
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
setIsWalletGroupExpanded(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Container flex="row" gap="xxs">
|
||||||
|
{eoaWallets.slice(0, 2).map((w) => (
|
||||||
|
<Img
|
||||||
|
key={w.id}
|
||||||
|
width={iconSize.sm}
|
||||||
|
height={iconSize.sm}
|
||||||
|
src={w.meta.iconURL}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</Container>
|
||||||
|
Connect a wallet
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
|
||||||
|
const newToWallets = (
|
||||||
|
<Container
|
||||||
|
flex="row"
|
||||||
|
style={{
|
||||||
|
justifyContent: "space-between",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text color="secondaryText" size="sm" weight={500}>
|
||||||
|
New to wallets?
|
||||||
|
</Text>
|
||||||
|
<Link
|
||||||
|
weight={500}
|
||||||
|
size="sm"
|
||||||
|
target="_blank"
|
||||||
|
href="https://blog.thirdweb.com/web3-wallet/"
|
||||||
|
>
|
||||||
|
Get started
|
||||||
|
</Link>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
|
||||||
|
const tos =
|
||||||
|
termsOfServiceUrl || privacyPolicyUrl ? (
|
||||||
|
<TOS
|
||||||
|
termsOfServiceUrl={termsOfServiceUrl}
|
||||||
|
privacyPolicyUrl={privacyPolicyUrl}
|
||||||
|
/>
|
||||||
|
) : undefined;
|
||||||
|
|
||||||
|
let topSection: React.ReactNode;
|
||||||
|
let bottomSection: React.ReactNode;
|
||||||
|
|
||||||
|
// wide modal
|
||||||
|
if (!isCompact) {
|
||||||
|
topSection = (
|
||||||
|
<WalletSelection
|
||||||
|
walletConfigs={nonLocalWalletConfigs}
|
||||||
|
selectWallet={handleSelect}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
if (continueAsGuest) {
|
||||||
|
bottomSection = (
|
||||||
|
<ScreenBottomContainer>{continueAsGuest}</ScreenBottomContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// compact
|
||||||
|
else {
|
||||||
|
// no social logins
|
||||||
|
if (socialWallets.length === 0) {
|
||||||
|
topSection = (
|
||||||
|
<WalletSelection
|
||||||
|
walletConfigs={nonLocalWalletConfigs}
|
||||||
|
selectWallet={handleSelect}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
bottomSection = (
|
||||||
|
<>
|
||||||
|
<Line />
|
||||||
|
<Container flex="column" p="lg" gap="lg">
|
||||||
|
{newToWallets}
|
||||||
|
{continueAsGuest}
|
||||||
|
</Container>
|
||||||
|
{!continueAsGuest && <Line />}
|
||||||
|
{tos && (
|
||||||
|
<Container
|
||||||
|
px="md"
|
||||||
|
style={{
|
||||||
|
paddingBottom: spacing.md,
|
||||||
|
paddingTop: continueAsGuest ? 0 : spacing.md,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{tos}
|
||||||
|
</Container>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// social logins
|
||||||
|
else {
|
||||||
|
// not expanded state
|
||||||
|
if (!isWalletGroupExpanded) {
|
||||||
|
topSection = (
|
||||||
|
<Container px="xs">
|
||||||
|
<WalletSelection
|
||||||
|
walletConfigs={socialWallets}
|
||||||
|
selectWallet={handleSelect}
|
||||||
|
/>
|
||||||
|
{eoaWallets.length > 0 && (
|
||||||
|
<>
|
||||||
|
<TextDivider text="OR" />
|
||||||
|
<Spacer y="lg" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
|
||||||
|
// only social login - no eoa wallets
|
||||||
|
if (eoaWallets.length === 0) {
|
||||||
|
bottomSection =
|
||||||
|
tos || continueAsGuest ? (
|
||||||
|
<>
|
||||||
|
<Spacer y="md" />
|
||||||
|
<Line />
|
||||||
|
{continueAsGuest && (
|
||||||
|
<Container p="lg"> {continueAsGuest}</Container>
|
||||||
|
)}
|
||||||
|
{tos && <Container p="md"> {tos} </Container>}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<Spacer y="sm" />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// social login + eoa wallets
|
||||||
|
else {
|
||||||
|
// social login + More than 1 eoa wallets
|
||||||
|
if (eoaWallets.length > 1) {
|
||||||
|
bottomSection = (
|
||||||
|
<Container flex="column" gap="sm">
|
||||||
|
<Container px="lg" flex="column" gap="md">
|
||||||
|
{connectAWallet}
|
||||||
|
{continueAsGuest}
|
||||||
|
</Container>
|
||||||
|
|
||||||
|
{tos ? (
|
||||||
|
<Container p="md"> {tos} </Container>
|
||||||
|
) : (
|
||||||
|
<Spacer y="md" />
|
||||||
|
)}
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// social login + single eoa wallet
|
||||||
|
else {
|
||||||
|
bottomSection = (
|
||||||
|
<>
|
||||||
|
<Container px="lg">
|
||||||
|
<WalletSelection
|
||||||
|
walletConfigs={eoaWallets}
|
||||||
|
selectWallet={handleSelect}
|
||||||
|
/>
|
||||||
|
</Container>
|
||||||
|
|
||||||
|
{continueAsGuest && (
|
||||||
|
<Container flex="column" px="lg" gap="lg">
|
||||||
|
{continueAsGuest}
|
||||||
|
</Container>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{tos ? (
|
||||||
|
<>
|
||||||
|
{continueAsGuest ? <Spacer y="md" /> : <Line />}
|
||||||
|
<Container p="md"> {tos} </Container>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>{continueAsGuest && <Spacer y="xl" />}</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// expanded state
|
||||||
|
else {
|
||||||
|
topSection = (
|
||||||
|
<WalletSelection
|
||||||
|
walletConfigs={eoaWallets}
|
||||||
|
selectWallet={handleSelect}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
|
||||||
|
bottomSection = (
|
||||||
|
<ScreenBottomContainer>{newToWallets}</ScreenBottomContainer>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container scrollY flex="column" animate="fadein" fullHeight>
|
<Container scrollY flex="column" animate="fadein" fullHeight>
|
||||||
@@ -160,130 +357,15 @@ export const WalletSelector: React.FC<{
|
|||||||
<Container
|
<Container
|
||||||
expand
|
expand
|
||||||
scrollY
|
scrollY
|
||||||
px={nonLocalWalletConfigs.length === 1 ? "lg" : "md"}
|
px="md"
|
||||||
style={{
|
style={{
|
||||||
paddingTop: "2px",
|
paddingTop: "2px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{showGroupsUI ? (
|
{topSection}
|
||||||
<>
|
|
||||||
{/* list of EOA wallets */}
|
|
||||||
{isWalletGroupExpanded ? (
|
|
||||||
<WalletSelection
|
|
||||||
walletConfigs={eoaWallets}
|
|
||||||
selectWallet={handleSelect}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<Container px="xs">
|
|
||||||
<WalletSelection
|
|
||||||
walletConfigs={socialWallets}
|
|
||||||
selectWallet={handleSelect}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<TextDivider>
|
|
||||||
<span> OR </span>
|
|
||||||
</TextDivider>
|
|
||||||
|
|
||||||
<Spacer y="lg" />
|
|
||||||
|
|
||||||
{/* connect a wallet */}
|
|
||||||
<Button
|
|
||||||
fullWidth
|
|
||||||
variant="outline"
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
justifyContent: "center",
|
|
||||||
gap: spacing.sm,
|
|
||||||
padding: spacing.md,
|
|
||||||
}}
|
|
||||||
onClick={() => {
|
|
||||||
setIsWalletGroupExpanded(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Container flex="row" gap="xxs">
|
|
||||||
{eoaWallets.slice(0, 2).map((w) => (
|
|
||||||
<Img
|
|
||||||
key={w.id}
|
|
||||||
width={iconSize.sm}
|
|
||||||
height={iconSize.sm}
|
|
||||||
src={w.meta.iconURL}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Container>
|
|
||||||
Connect a wallet
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
{continueAsGuest ? (
|
|
||||||
<>
|
|
||||||
<Spacer y="md" />
|
|
||||||
{continueAsGuest}
|
|
||||||
<Spacer y="xl" />
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<Spacer y="xl" />
|
|
||||||
)}
|
|
||||||
</Container>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<WalletSelection
|
|
||||||
walletConfigs={nonLocalWalletConfigs}
|
|
||||||
selectWallet={handleSelect}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
{/* Footer */}
|
{bottomSection}
|
||||||
{showFooter && (
|
|
||||||
<ScreenBottomContainer>
|
|
||||||
{showNewToWallets && (
|
|
||||||
<Container
|
|
||||||
flex="row"
|
|
||||||
style={{
|
|
||||||
justifyContent: "space-between",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Text color="secondaryText" size="sm" weight={500}>
|
|
||||||
New to wallets?
|
|
||||||
</Text>
|
|
||||||
<Link
|
|
||||||
weight={500}
|
|
||||||
size="sm"
|
|
||||||
target="_blank"
|
|
||||||
href="https://blog.thirdweb.com/web3-wallet/"
|
|
||||||
>
|
|
||||||
Get started
|
|
||||||
</Link>
|
|
||||||
</Container>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!showGroupsUI && continueAsGuest}
|
|
||||||
</ScreenBottomContainer>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{showTOS && !isWalletGroupExpanded && (
|
|
||||||
<div>
|
|
||||||
{showSeperatorLine && <Line />}
|
|
||||||
|
|
||||||
<Container
|
|
||||||
p="md"
|
|
||||||
style={
|
|
||||||
!showSeperatorLine
|
|
||||||
? {
|
|
||||||
paddingTop: 0,
|
|
||||||
}
|
|
||||||
: undefined
|
|
||||||
}
|
|
||||||
>
|
|
||||||
{isCompact && (
|
|
||||||
<TOS
|
|
||||||
termsOfServiceUrl={termsOfServiceUrl}
|
|
||||||
privacyPolicyUrl={privacyPolicyUrl}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Container>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -383,7 +465,7 @@ const WalletList = styled.ul<{ theme?: Theme }>`
|
|||||||
margin: -2px;
|
margin: -2px;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
padding-bottom: ${spacing.xl};
|
padding-bottom: ${spacing.lg};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const WalletButton = styled.button<{ theme?: Theme }>`
|
const WalletButton = styled.button<{ theme?: Theme }>`
|
||||||
@@ -428,7 +510,7 @@ function sortWalletConfigs(walletConfigs: WalletConfig[]) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
})
|
})
|
||||||
// show the reccomended wallets even before that
|
// show the recommended wallets even before that
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
if (a.recommended && !b.recommended) {
|
if (a.recommended && !b.recommended) {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -64,15 +64,7 @@ export const EmbeddedWalletFormUI = (props: {
|
|||||||
<GoogleIcon size={iconSize.md} />
|
<GoogleIcon size={iconSize.md} />
|
||||||
Sign in with Google
|
Sign in with Google
|
||||||
</SocialButton>
|
</SocialButton>
|
||||||
|
<TextDivider text="OR" py="lg" />
|
||||||
<Spacer y="lg" />
|
|
||||||
|
|
||||||
<TextDivider>
|
|
||||||
<span>OR</span>
|
|
||||||
</TextDivider>
|
|
||||||
|
|
||||||
<Spacer y="lg" />
|
|
||||||
|
|
||||||
<InputSelectionUI
|
<InputSelectionUI
|
||||||
onSelect={(email) => props.onSelect({ email })}
|
onSelect={(email) => props.onSelect({ email })}
|
||||||
placeholder="Enter your email address"
|
placeholder="Enter your email address"
|
||||||
|
|||||||
@@ -114,10 +114,10 @@ export const EmbeddedWalletOTPLoginUI: React.FC<
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!isWideModal && <Spacer y="xl" />}
|
{!isWideModal && <Spacer y="xl" />}
|
||||||
<Text>Enter the OTP sent to</Text>
|
<Text>Enter the verification code sent to</Text>
|
||||||
<Spacer y="sm" />
|
<Spacer y="sm" />
|
||||||
<Text color="primaryText">{email}</Text>
|
<Text color="primaryText">{email}</Text>
|
||||||
<Spacer y="xxl" />
|
<Spacer y="xl" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<OTPInput
|
<OTPInput
|
||||||
@@ -138,12 +138,12 @@ export const EmbeddedWalletOTPLoginUI: React.FC<
|
|||||||
<FadeIn>
|
<FadeIn>
|
||||||
<Spacer y="md" />
|
<Spacer y="md" />
|
||||||
<Text size="sm" color="danger" center>
|
<Text size="sm" color="danger" center>
|
||||||
Invalid OTP
|
Invalid verification code
|
||||||
</Text>
|
</Text>
|
||||||
</FadeIn>
|
</FadeIn>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Spacer y="xxl" />
|
<Spacer y="xl" />
|
||||||
|
|
||||||
<Container px={isWideModal ? "xxl" : "lg"}>
|
<Container px={isWideModal ? "xxl" : "lg"}>
|
||||||
{verifyStatus === "verifying" ? (
|
{verifyStatus === "verifying" ? (
|
||||||
@@ -168,7 +168,7 @@ export const EmbeddedWalletOTPLoginUI: React.FC<
|
|||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<Spacer y="xxl" />
|
<Spacer y="xl" />
|
||||||
|
|
||||||
{!isWideModal && <Line />}
|
{!isWideModal && <Line />}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ export const EmbeddedWalletOTPLoginUI: React.FC<
|
|||||||
{sendEmailOtpStatus === "error" && (
|
{sendEmailOtpStatus === "error" && (
|
||||||
<>
|
<>
|
||||||
<Text size="sm" center color="danger">
|
<Text size="sm" center color="danger">
|
||||||
Failed to send OTP
|
Failed to send verification code
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -190,14 +190,14 @@ export const EmbeddedWalletOTPLoginUI: React.FC<
|
|||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text size="sm">Sending OTP</Text>
|
<Text size="sm">Sending verification code</Text>
|
||||||
<Spinner size="xs" color="secondaryText" />
|
<Spinner size="xs" color="secondaryText" />
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{sendEmailOtpStatus === "sent" && (
|
{sendEmailOtpStatus === "sent" && (
|
||||||
<LinkButton onClick={sendEmail} type="button">
|
<LinkButton onClick={sendEmail} type="button">
|
||||||
Resend OTP
|
Resend verification code
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -256,11 +256,7 @@ const MagicUI: React.FC<{
|
|||||||
|
|
||||||
{showInputUI && (
|
{showInputUI && (
|
||||||
<>
|
<>
|
||||||
{showSeparator && (
|
{showSeparator && <TextDivider text="OR" />}
|
||||||
<TextDivider>
|
|
||||||
<span> OR </span>
|
|
||||||
</TextDivider>
|
|
||||||
)}
|
|
||||||
<InputSelectionUI
|
<InputSelectionUI
|
||||||
onSelect={props.onSelect}
|
onSelect={props.onSelect}
|
||||||
placeholder={placeholder}
|
placeholder={placeholder}
|
||||||
|
|||||||
@@ -67,13 +67,7 @@ export const PaperFormUI = (props: {
|
|||||||
Sign in with Google
|
Sign in with Google
|
||||||
</SocialButton>
|
</SocialButton>
|
||||||
|
|
||||||
<Spacer y="lg" />
|
<TextDivider text="OR" py="lg" />
|
||||||
|
|
||||||
<TextDivider>
|
|
||||||
<span>OR</span>
|
|
||||||
</TextDivider>
|
|
||||||
|
|
||||||
<Spacer y="lg" />
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import styled from "@emotion/styled";
|
|||||||
import { ConnectUIProps, useWalletContext } from "@thirdweb-dev/react-core";
|
import { ConnectUIProps, useWalletContext } from "@thirdweb-dev/react-core";
|
||||||
import { PaperWallet } from "@thirdweb-dev/wallets";
|
import { PaperWallet } from "@thirdweb-dev/wallets";
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
import { FadeIn } from "../../../components/FadeIn";
|
|
||||||
import { OTPInput } from "../../../components/OTPInput";
|
import { OTPInput } from "../../../components/OTPInput";
|
||||||
import { Spacer } from "../../../components/Spacer";
|
import { Spacer } from "../../../components/Spacer";
|
||||||
import { Spinner } from "../../../components/Spinner";
|
import { Spinner } from "../../../components/Spinner";
|
||||||
@@ -135,7 +134,7 @@ export const PaperOTPLoginUI: React.FC<PaperOTPLoginUIProps> = (props) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!isWideModal && <Spacer y="lg" />}
|
{!isWideModal && <Spacer y="lg" />}
|
||||||
<Text>Enter the OTP sent to</Text>
|
<Text>Enter the verification code sent to</Text>
|
||||||
<Spacer y="sm" />
|
<Spacer y="sm" />
|
||||||
<Text color="primaryText">{email}</Text>
|
<Text color="primaryText">{email}</Text>
|
||||||
<Spacer y="xl" />
|
<Spacer y="xl" />
|
||||||
@@ -159,6 +158,7 @@ export const PaperOTPLoginUI: React.FC<PaperOTPLoginUIProps> = (props) => {
|
|||||||
|
|
||||||
{recoveryCodeRequired && (
|
{recoveryCodeRequired && (
|
||||||
<Container
|
<Container
|
||||||
|
animate="fadein"
|
||||||
px="lg"
|
px="lg"
|
||||||
style={{
|
style={{
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
@@ -197,15 +197,16 @@ export const PaperOTPLoginUI: React.FC<PaperOTPLoginUIProps> = (props) => {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{verifyStatus === "invalid" && (
|
{verifyStatus === "invalid" && (
|
||||||
<FadeIn>
|
<Container animate="fadein">
|
||||||
<Spacer y="md" />
|
<Spacer y="md" />
|
||||||
<Text size="sm" color="danger" center>
|
<Text size="sm" color="danger" center>
|
||||||
Invalid OTP {recoveryCodeRequired ? "or recovery code" : ""}
|
Invalid verification code{" "}
|
||||||
|
{recoveryCodeRequired ? "or recovery code" : ""}
|
||||||
</Text>
|
</Text>
|
||||||
</FadeIn>
|
</Container>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Spacer y={recoveryCodeRequired ? "xl" : "xxl"} />
|
<Spacer y="xl" />
|
||||||
|
|
||||||
<Container px={isWideModal ? "xxl" : "lg"}>
|
<Container px={isWideModal ? "xxl" : "lg"}>
|
||||||
{verifyStatus === "verifying" ? (
|
{verifyStatus === "verifying" ? (
|
||||||
@@ -230,15 +231,15 @@ export const PaperOTPLoginUI: React.FC<PaperOTPLoginUIProps> = (props) => {
|
|||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|
||||||
<Spacer y={recoveryCodeRequired ? "xl" : "xxl"} />
|
<Spacer y={"xl"} />
|
||||||
|
|
||||||
{!isWideModal && <Line />}
|
{!isWideModal && <Line />}
|
||||||
|
|
||||||
<Container p={isWideModal ? undefined : "lg"}>
|
<Container p={isWideModal ? undefined : "lg"} animate="fadein">
|
||||||
{sendEmailStatus === "error" && (
|
{sendEmailStatus === "error" && (
|
||||||
<>
|
<>
|
||||||
<Text size="sm" center color="danger">
|
<Text size="sm" center color="danger">
|
||||||
Failed to send OTP
|
Failed to send verification code
|
||||||
</Text>
|
</Text>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -252,14 +253,14 @@ export const PaperOTPLoginUI: React.FC<PaperOTPLoginUIProps> = (props) => {
|
|||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text size="sm">Sending OTP</Text>
|
<Text size="sm">Sending verification code</Text>
|
||||||
<Spinner size="xs" color="secondaryText" />
|
<Spinner size="xs" color="secondaryText" />
|
||||||
</Container>
|
</Container>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{typeof sendEmailStatus !== "string" && (
|
{typeof sendEmailStatus !== "string" && (
|
||||||
<LinkButton onClick={sendEmail} type="button">
|
<LinkButton onClick={sendEmail} type="button">
|
||||||
Resend OTP
|
Resend verification code
|
||||||
</LinkButton>
|
</LinkButton>
|
||||||
)}
|
)}
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -1,5 +1,61 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 4.0.6
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`137f46a5`](https://github.com/thirdweb-dev/js/commit/137f46a5470d2b5f9d7f9eda9b2d839a53ddeb64)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.55
|
||||||
|
|
||||||
|
## 4.0.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1781](https://github.com/thirdweb-dev/js/pull/1781) [`07544252`](https://github.com/thirdweb-dev/js/commit/07544252b49163e1ae84ba2cc76b99597a1c4553) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Expose utility functions for fetching ABI / sources
|
||||||
|
|
||||||
|
## 4.0.4
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6c30b7ef`](https://github.com/thirdweb-dev/js/commit/6c30b7efc708e1244f3be3e10eac8f3b8b14a8c3)]:
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.16
|
||||||
|
|
||||||
|
## 4.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1756](https://github.com/thirdweb-dev/js/pull/1756) [`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Enable adding smart wallet admins via bundler for new account contracts
|
||||||
|
|
||||||
|
- Updated dependencies [[`956b5645`](https://github.com/thirdweb-dev/js/commit/956b5645e4266cba536abd27ee250dab5aa9a177)]:
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.15
|
||||||
|
|
||||||
|
## 4.0.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1764](https://github.com/thirdweb-dev/js/pull/1764) [`526176c4`](https://github.com/thirdweb-dev/js/commit/526176c47108c91d83bcfc5f0ca556274e6462d6) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for marketplace methods
|
||||||
|
|
||||||
|
- [#1763](https://github.com/thirdweb-dev/js/pull/1763) [`d1f8e951`](https://github.com/thirdweb-dev/js/commit/d1f8e951623f1691fdfe3d1e8645970d0a52eb06) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Improve fetchPublishedContractFromPolygon
|
||||||
|
|
||||||
|
- [#1765](https://github.com/thirdweb-dev/js/pull/1765) [`09120c92`](https://github.com/thirdweb-dev/js/commit/09120c923cca804b9d4f5f779e5a53c97ecc8223) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for getting deployment info
|
||||||
|
|
||||||
|
- [#1762](https://github.com/thirdweb-dev/js/pull/1762) [`6573556d`](https://github.com/thirdweb-dev/js/commit/6573556d0e03efa0d6a157fccb0a1c08dd22d7cd) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Perf improvement for drop-claim-condition
|
||||||
|
|
||||||
|
## 4.0.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1747](https://github.com/thirdweb-dev/js/pull/1747) [`1f3c64d3`](https://github.com/thirdweb-dev/js/commit/1f3c64d3618903b9008cc7b633ea890b508e7800) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle upgradeable proxies and optimize proxy resolution
|
||||||
|
|
||||||
|
- [#1695](https://github.com/thirdweb-dev/js/pull/1695) [`693f349d`](https://github.com/thirdweb-dev/js/commit/693f349db2478e1cd0fc82a9ef9882f46832b125) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Add optional pagination to getOwned NFTs
|
||||||
|
|
||||||
|
- [#1746](https://github.com/thirdweb-dev/js/pull/1746) [`0f12d1f9`](https://github.com/thirdweb-dev/js/commit/0f12d1f90320923309f085c372d3a5ed01dd4606) Thanks [@farhanW3](https://github.com/farhanW3)! - Fix for RPC Override Implementation to get user provided Url and not default RPC Url for the chain
|
||||||
|
|
||||||
|
- [#1757](https://github.com/thirdweb-dev/js/pull/1757) [`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Update deployment and tests for MarketplaceV3 latest
|
||||||
|
|
||||||
|
- Updated dependencies [[`63ad0050`](https://github.com/thirdweb-dev/js/commit/63ad0050f0a24ec15b90933b5664d697618cf2d0)]:
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.14
|
||||||
|
|
||||||
## 4.0.0
|
## 4.0.0
|
||||||
|
|
||||||
### Major Changes
|
### Major Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "4.0.0",
|
"version": "4.0.6",
|
||||||
"description": "The main thirdweb SDK.",
|
"description": "The main thirdweb SDK.",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export async function encodeConstructorParamsForImplementation(
|
|||||||
compilerMetadata.abi,
|
compilerMetadata.abi,
|
||||||
);
|
);
|
||||||
const constructorParamTypes = constructorParams.map((p) => {
|
const constructorParamTypes = constructorParams.map((p) => {
|
||||||
if (p.type === "tuple[]") {
|
if (p.type === "tuple[]" || p.type === "tuple") {
|
||||||
return utils.ParamType.from(p);
|
return utils.ParamType.from(p);
|
||||||
} else {
|
} else {
|
||||||
return p.type;
|
return p.type;
|
||||||
@@ -156,31 +156,13 @@ export async function encodeConstructorParamsForImplementation(
|
|||||||
return constructorParamMap[p.name].value;
|
return constructorParamMap[p.name].value;
|
||||||
}
|
}
|
||||||
if (p.name && p.name.includes("nativeTokenWrapper")) {
|
if (p.name && p.name.includes("nativeTokenWrapper")) {
|
||||||
const chainId = (await provider.getNetwork()).chainId;
|
return await nativeTokenInputArg(
|
||||||
let nativeTokenWrapperAddress =
|
provider,
|
||||||
getNativeTokenByChainId(chainId).wrapped.address;
|
storage,
|
||||||
|
create2Factory,
|
||||||
if (nativeTokenWrapperAddress === constants.AddressZero) {
|
clientId,
|
||||||
const deploymentInfo = await computeDeploymentInfo(
|
secretKey,
|
||||||
"infra",
|
);
|
||||||
provider,
|
|
||||||
storage,
|
|
||||||
create2Factory,
|
|
||||||
{
|
|
||||||
contractName: "WETH9",
|
|
||||||
},
|
|
||||||
clientId,
|
|
||||||
secretKey,
|
|
||||||
);
|
|
||||||
if (!caches.deploymentPresets["WETH9"]) {
|
|
||||||
caches.deploymentPresets["WETH9"] = deploymentInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
nativeTokenWrapperAddress =
|
|
||||||
deploymentInfo.transaction.predictedAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nativeTokenWrapperAddress;
|
|
||||||
} else if (p.name && p.name.includes("trustedForwarder")) {
|
} else if (p.name && p.name.includes("trustedForwarder")) {
|
||||||
if (compilerMetadata.name === "Pack") {
|
if (compilerMetadata.name === "Pack") {
|
||||||
// EOAForwarder for Pack
|
// EOAForwarder for Pack
|
||||||
@@ -220,6 +202,27 @@ export async function encodeConstructorParamsForImplementation(
|
|||||||
} else if (p.name && p.name.includes("royaltyEngineAddress")) {
|
} else if (p.name && p.name.includes("royaltyEngineAddress")) {
|
||||||
const chainId = (await provider.getNetwork()).chainId;
|
const chainId = (await provider.getNetwork()).chainId;
|
||||||
return getRoyaltyEngineV1ByChainId(chainId);
|
return getRoyaltyEngineV1ByChainId(chainId);
|
||||||
|
} else if (p.name && p.name.includes("marketplaceV3Params")) {
|
||||||
|
const chainId = (await provider.getNetwork()).chainId;
|
||||||
|
const royaltyEngineAddress = getRoyaltyEngineV1ByChainId(chainId);
|
||||||
|
|
||||||
|
const nativeTokenWrapper = await nativeTokenInputArg(
|
||||||
|
provider,
|
||||||
|
storage,
|
||||||
|
create2Factory,
|
||||||
|
clientId,
|
||||||
|
secretKey,
|
||||||
|
);
|
||||||
|
|
||||||
|
const extensions = constructorParamMap
|
||||||
|
? constructorParamMap["_extensions"].value
|
||||||
|
: [];
|
||||||
|
|
||||||
|
return {
|
||||||
|
extensions: extensions,
|
||||||
|
royaltyEngineAddress: royaltyEngineAddress,
|
||||||
|
nativeTokenWrapper: nativeTokenWrapper,
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Can't resolve constructor arguments");
|
throw new Error("Can't resolve constructor arguments");
|
||||||
}
|
}
|
||||||
@@ -232,3 +235,36 @@ export async function encodeConstructorParamsForImplementation(
|
|||||||
);
|
);
|
||||||
return encodedArgs;
|
return encodedArgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function nativeTokenInputArg(
|
||||||
|
provider: providers.Provider,
|
||||||
|
storage: ThirdwebStorage,
|
||||||
|
create2Factory: string,
|
||||||
|
clientId?: string,
|
||||||
|
secretKey?: string,
|
||||||
|
): Promise<string> {
|
||||||
|
const chainId = (await provider.getNetwork()).chainId;
|
||||||
|
let nativeTokenWrapperAddress =
|
||||||
|
getNativeTokenByChainId(chainId).wrapped.address;
|
||||||
|
|
||||||
|
if (nativeTokenWrapperAddress === constants.AddressZero) {
|
||||||
|
const deploymentInfo = await computeDeploymentInfo(
|
||||||
|
"infra",
|
||||||
|
provider,
|
||||||
|
storage,
|
||||||
|
create2Factory,
|
||||||
|
{
|
||||||
|
contractName: "WETH9",
|
||||||
|
},
|
||||||
|
clientId,
|
||||||
|
secretKey,
|
||||||
|
);
|
||||||
|
if (!caches.deploymentPresets["WETH9"]) {
|
||||||
|
caches.deploymentPresets["WETH9"] = deploymentInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
nativeTokenWrapperAddress = deploymentInfo.transaction.predictedAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nativeTokenWrapperAddress;
|
||||||
|
}
|
||||||
|
|||||||
@@ -50,18 +50,18 @@ export async function fetchPublishedContractFromPolygon(
|
|||||||
});
|
});
|
||||||
|
|
||||||
// get the metadata for each version
|
// get the metadata for each version
|
||||||
const versionMetadata = await Promise.all(
|
const versionMetadata = (
|
||||||
allVersions.map(async (c) => {
|
await Promise.all(
|
||||||
return {
|
allVersions.map((c) =>
|
||||||
name: c.id,
|
fetchAndCacheDeployMetadata(c.metadataUri, storage),
|
||||||
publishedTimestamp: c.timestamp,
|
),
|
||||||
publishedMetadata: await fetchAndCacheDeployMetadata(
|
)
|
||||||
c.metadataUri,
|
).map((item, index) => ({
|
||||||
storage,
|
name: allVersions[index].id,
|
||||||
),
|
publishedTimestamp: allVersions[index].timestamp,
|
||||||
};
|
publishedMetadata: item,
|
||||||
}),
|
}));
|
||||||
);
|
|
||||||
// find the version that matches the version string
|
// find the version that matches the version string
|
||||||
const versionMatch = versionMetadata.find(
|
const versionMatch = versionMetadata.find(
|
||||||
(metadata) =>
|
(metadata) =>
|
||||||
|
|||||||
@@ -37,15 +37,13 @@ export async function getDeploymentInfo(
|
|||||||
secretKey?: string,
|
secretKey?: string,
|
||||||
): Promise<DeploymentPreset[]> {
|
): Promise<DeploymentPreset[]> {
|
||||||
caches.deploymentPresets = {};
|
caches.deploymentPresets = {};
|
||||||
|
const [create2FactoryAddress, { compilerMetadata, extendedMetadata }] =
|
||||||
const create2FactoryAddress = create2Factory
|
await Promise.all([
|
||||||
? create2Factory
|
create2Factory ? create2Factory : getCreate2FactoryAddress(provider),
|
||||||
: await getCreate2FactoryAddress(provider);
|
fetchAndCacheDeployMetadata(metadataUri, storage),
|
||||||
|
]);
|
||||||
const customParams: ConstructorParamMap = {};
|
const customParams: ConstructorParamMap = {};
|
||||||
const finalDeploymentInfo: DeploymentPreset[] = [];
|
const finalDeploymentInfo: DeploymentPreset[] = [];
|
||||||
const { compilerMetadata, extendedMetadata } =
|
|
||||||
await fetchAndCacheDeployMetadata(metadataUri, storage);
|
|
||||||
const defaultExtensions = extendedMetadata?.defaultExtensions;
|
const defaultExtensions = extendedMetadata?.defaultExtensions;
|
||||||
|
|
||||||
if (extendedMetadata?.routerType === "plugin" && defaultExtensions) {
|
if (extendedMetadata?.routerType === "plugin" && defaultExtensions) {
|
||||||
@@ -65,16 +63,16 @@ export async function getDeploymentInfo(
|
|||||||
|
|
||||||
const pluginMetadata = (
|
const pluginMetadata = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
publishedExtensions.map(async (c) => {
|
publishedExtensions.map((c) =>
|
||||||
return fetchAndCacheDeployMetadata(c.metadataUri, storage);
|
fetchAndCacheDeployMetadata(c.metadataUri, storage),
|
||||||
}),
|
),
|
||||||
)
|
)
|
||||||
).map((fetchedMetadata) => fetchedMetadata.compilerMetadata);
|
).map((fetchedMetadata) => fetchedMetadata.compilerMetadata);
|
||||||
|
|
||||||
// get deployment info for all plugins
|
// get deployment info for all plugins
|
||||||
const pluginDeploymentInfo = await Promise.all(
|
const pluginDeploymentInfo = await Promise.all(
|
||||||
pluginMetadata.map(async (metadata) => {
|
pluginMetadata.map((metadata) =>
|
||||||
const info = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"plugin",
|
"plugin",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -82,9 +80,8 @@ export async function getDeploymentInfo(
|
|||||||
{ metadata: metadata },
|
{ metadata: metadata },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
return info;
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// create constructor param input for PluginMap
|
// create constructor param input for PluginMap
|
||||||
@@ -142,8 +139,8 @@ export async function getDeploymentInfo(
|
|||||||
|
|
||||||
// get deployment info for all extensions
|
// get deployment info for all extensions
|
||||||
const extensionDeploymentInfo = await Promise.all(
|
const extensionDeploymentInfo = await Promise.all(
|
||||||
extensionMetadata.map(async (metadata) => {
|
extensionMetadata.map((metadata) =>
|
||||||
const info = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"extension",
|
"extension",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
@@ -151,9 +148,8 @@ export async function getDeploymentInfo(
|
|||||||
{ metadata: metadata },
|
{ metadata: metadata },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
return info;
|
),
|
||||||
}),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// create constructor param input for BaseRouter
|
// create constructor param input for BaseRouter
|
||||||
@@ -179,29 +175,30 @@ export async function getDeploymentInfo(
|
|||||||
finalDeploymentInfo.push(...extensionDeploymentInfo);
|
finalDeploymentInfo.push(...extensionDeploymentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
const implementationDeployInfo = await computeDeploymentInfo(
|
const [implementationDeployInfo, factoryInfo] = await Promise.all([
|
||||||
"implementation",
|
computeDeploymentInfo(
|
||||||
provider,
|
"implementation",
|
||||||
storage,
|
provider,
|
||||||
create2FactoryAddress,
|
storage,
|
||||||
{
|
create2FactoryAddress,
|
||||||
metadata: compilerMetadata,
|
{
|
||||||
constructorParams: customParams,
|
metadata: compilerMetadata,
|
||||||
},
|
constructorParams: customParams,
|
||||||
clientId,
|
},
|
||||||
secretKey,
|
clientId,
|
||||||
);
|
secretKey,
|
||||||
|
),
|
||||||
// get clone factory
|
// get clone factory
|
||||||
const factoryInfo = await computeDeploymentInfo(
|
computeDeploymentInfo(
|
||||||
"infra",
|
"infra",
|
||||||
provider,
|
provider,
|
||||||
storage,
|
storage,
|
||||||
create2FactoryAddress,
|
create2FactoryAddress,
|
||||||
{ contractName: "TWCloneFactory" },
|
{ contractName: "TWCloneFactory" },
|
||||||
clientId,
|
clientId,
|
||||||
secretKey,
|
secretKey,
|
||||||
);
|
),
|
||||||
|
]);
|
||||||
|
|
||||||
finalDeploymentInfo.push(factoryInfo);
|
finalDeploymentInfo.push(factoryInfo);
|
||||||
finalDeploymentInfo.push(...Object.values(caches.deploymentPresets));
|
finalDeploymentInfo.push(...Object.values(caches.deploymentPresets));
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { BigNumber, providers, constants, utils } from "ethers";
|
import { BigNumber, providers, constants, utils, Contract } from "ethers";
|
||||||
import { extractIPFSHashFromBytecode } from "./extractIPFSHashFromBytecode";
|
import { extractIPFSHashFromBytecode } from "./extractIPFSHashFromBytecode";
|
||||||
import { extractMinimalProxyImplementationAddress } from "./extractMinimalProxyImplementationAddress";
|
import { extractMinimalProxyImplementationAddress } from "./extractMinimalProxyImplementationAddress";
|
||||||
|
|
||||||
@@ -33,32 +33,65 @@ export async function resolveImplementation(
|
|||||||
address: string,
|
address: string,
|
||||||
provider: providers.Provider,
|
provider: providers.Provider,
|
||||||
): Promise<{ address: string; bytecode: string }> {
|
): Promise<{ address: string; bytecode: string }> {
|
||||||
let bytecode;
|
const bytecode = await fetchBytecode(address, provider);
|
||||||
|
|
||||||
|
// check minimal proxy first synchronously
|
||||||
|
const minimalProxyImplementationAddress =
|
||||||
|
extractMinimalProxyImplementationAddress(bytecode);
|
||||||
|
if (minimalProxyImplementationAddress) {
|
||||||
|
return {
|
||||||
|
address: minimalProxyImplementationAddress,
|
||||||
|
bytecode: await fetchBytecode(
|
||||||
|
minimalProxyImplementationAddress,
|
||||||
|
provider,
|
||||||
|
),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// check other proxy types
|
||||||
|
const impl = await Promise.all([
|
||||||
|
getImplementationFromStorageSlot(address, provider),
|
||||||
|
getImplementationFromContractCall(address, provider),
|
||||||
|
]);
|
||||||
|
|
||||||
|
for (const implementationAddress of impl) {
|
||||||
|
if (
|
||||||
|
implementationAddress &&
|
||||||
|
utils.isAddress(implementationAddress) &&
|
||||||
|
implementationAddress !== constants.AddressZero
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
address: implementationAddress,
|
||||||
|
bytecode: await fetchBytecode(implementationAddress, provider),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { address, bytecode };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchBytecode(
|
||||||
|
address: string,
|
||||||
|
provider: providers.Provider,
|
||||||
|
): Promise<string> {
|
||||||
try {
|
try {
|
||||||
bytecode = await provider.getCode(address);
|
const bytecode = await provider.getCode(address);
|
||||||
|
if (bytecode === "0x") {
|
||||||
|
const chain = await provider.getNetwork();
|
||||||
|
throw new Error(
|
||||||
|
`Contract at ${address} does not exist on chain '${chain.name}' (chainId: ${chain.chainId})`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return bytecode;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(`Failed to get bytecode for address ${address}: ${e}`);
|
throw new Error(`Failed to get bytecode for address ${address}: ${e}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bytecode === "0x") {
|
async function getImplementationFromStorageSlot(
|
||||||
const chain = await provider.getNetwork();
|
address: string,
|
||||||
throw new Error(
|
provider: providers.Provider,
|
||||||
`Contract at ${address} does not exist on chain '${chain.name}' (chainId: ${chain.chainId})`,
|
): Promise<string | undefined> {
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// TODO support other types of proxies
|
|
||||||
const implementationAddress =
|
|
||||||
extractMinimalProxyImplementationAddress(bytecode);
|
|
||||||
if (implementationAddress) {
|
|
||||||
return await resolveImplementation(implementationAddress, provider);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
|
|
||||||
// EIP-1967 proxy storage slots - https://eips.ethereum.org/EIPS/eip-1967
|
|
||||||
try {
|
try {
|
||||||
const proxyStorage = await provider.getStorageAt(
|
const proxyStorage = await provider.getStorageAt(
|
||||||
address,
|
address,
|
||||||
@@ -66,18 +99,36 @@ export async function resolveImplementation(
|
|||||||
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
|
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const implementationAddress = `0x${proxyStorage.slice(-40)}`;
|
return `0x${proxyStorage.slice(-40)}`;
|
||||||
if (
|
|
||||||
utils.isAddress(implementationAddress) &&
|
|
||||||
implementationAddress !== constants.AddressZero
|
|
||||||
) {
|
|
||||||
return await resolveImplementation(implementationAddress, provider);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore
|
return undefined;
|
||||||
}
|
}
|
||||||
if (!bytecode) {
|
|
||||||
throw new Error(`Error fetching bytecode for ${address}`);
|
|
||||||
}
|
|
||||||
return { address, bytecode };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getImplementationFromContractCall(
|
||||||
|
address: string,
|
||||||
|
provider: providers.Provider,
|
||||||
|
): Promise<string | undefined> {
|
||||||
|
try {
|
||||||
|
const proxy = new Contract(address, UPGRADEABLE_PROXY_ABI, provider);
|
||||||
|
return await proxy.implementation();
|
||||||
|
} catch (e) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const UPGRADEABLE_PROXY_ABI = [
|
||||||
|
{
|
||||||
|
type: "function",
|
||||||
|
name: "implementation",
|
||||||
|
inputs: [],
|
||||||
|
outputs: [
|
||||||
|
{
|
||||||
|
type: "address",
|
||||||
|
name: "",
|
||||||
|
internalType: "address",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
stateMutability: "view",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
@@ -46,8 +46,10 @@ export async function isTokenApprovedForTransfer(
|
|||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
const erc165 = new Contract(assetContract, ERC165Abi, provider) as IERC165;
|
const erc165 = new Contract(assetContract, ERC165Abi, provider) as IERC165;
|
||||||
const isERC721 = await erc165.supportsInterface(InterfaceId_IERC721);
|
const [isERC721, isERC1155] = await Promise.all([
|
||||||
const isERC1155 = await erc165.supportsInterface(InterfaceId_IERC1155);
|
erc165.supportsInterface(InterfaceId_IERC721),
|
||||||
|
erc165.supportsInterface(InterfaceId_IERC1155),
|
||||||
|
]);
|
||||||
if (isERC721) {
|
if (isERC721) {
|
||||||
const asset = new Contract(assetContract, ERC721Abi, provider) as IERC721;
|
const asset = new Contract(assetContract, ERC721Abi, provider) as IERC721;
|
||||||
|
|
||||||
@@ -108,11 +110,9 @@ export async function handleTokenApproval(
|
|||||||
contractWrapper.options,
|
contractWrapper.options,
|
||||||
contractWrapper.storage,
|
contractWrapper.storage,
|
||||||
);
|
);
|
||||||
const isERC721 = await erc165.read("supportsInterface", [
|
const [isERC721, isERC1155] = await Promise.all([
|
||||||
InterfaceId_IERC721,
|
erc165.read("supportsInterface", [InterfaceId_IERC721]),
|
||||||
]);
|
erc165.read("supportsInterface", [InterfaceId_IERC1155]),
|
||||||
const isERC1155 = await erc165.read("supportsInterface", [
|
|
||||||
InterfaceId_IERC1155,
|
|
||||||
]);
|
]);
|
||||||
// check for token approval
|
// check for token approval
|
||||||
if (isERC721) {
|
if (isERC721) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user