Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8febea4db0 | ||
|
|
30e5593dd1 | ||
|
|
f253909710 | ||
|
|
99ffa8ce3b | ||
|
|
61212d27d7 | ||
|
|
58df84f8ba | ||
|
|
b6f48e1088 | ||
|
|
d51230441a | ||
|
|
01e83b6f13 | ||
|
|
907d97bede | ||
|
|
3c8c5d56f2 |
+1
-1
@@ -46,7 +46,7 @@
|
|||||||
"eslint": "^8.37.0",
|
"eslint": "^8.37.0",
|
||||||
"mocha": "^10.2.0",
|
"mocha": "^10.2.0",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"turbo": "^1.8.8",
|
"turbo": "^1.9.8",
|
||||||
"yalc": "1.0.0-pre.53"
|
"yalc": "1.0.0-pre.53"
|
||||||
},
|
},
|
||||||
"manypkg": {
|
"manypkg": {
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 3.0.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.22
|
||||||
|
|
||||||
|
## 3.0.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.21
|
||||||
|
|
||||||
## 3.0.19
|
## 3.0.19
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "3.0.19",
|
"version": "3.0.21",
|
||||||
"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,19 @@
|
|||||||
# @thirdweb-dev/chains
|
# @thirdweb-dev/chains
|
||||||
|
|
||||||
|
## 0.1.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1040](https://github.com/thirdweb-dev/js/pull/1040) [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Update chains
|
||||||
|
|
||||||
|
## 0.1.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1031](https://github.com/thirdweb-dev/js/pull/1031) [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains
|
||||||
|
|
||||||
|
- [#1033](https://github.com/thirdweb-dev/js/pull/1033) [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added faucet for optimism goerli
|
||||||
|
|
||||||
## 0.1.16
|
## 0.1.16
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -10,9 +10,24 @@ export default {
|
|||||||
},
|
},
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://fibonacci.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://fibonacci.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://node1.fibo-api.asia"
|
"https://node1.fibo-api.asia",
|
||||||
|
"https://node2.fibo-api.asia",
|
||||||
|
"https://node3.fibo-api.asia",
|
||||||
|
"https://node4.fibo-api.asia",
|
||||||
|
"https://node5.fibo-api.asia",
|
||||||
|
"https://node6.fibo-api.asia",
|
||||||
|
"https://node7.fibo-api.asia",
|
||||||
|
"https://node1.fibo-rpc.asia",
|
||||||
|
"https://node2.fibo-rpc.asia",
|
||||||
|
"https://node3.fibo-rpc.asia",
|
||||||
|
"https://node4.fibo-rpc.asia",
|
||||||
|
"https://node5.fibo-rpc.asia",
|
||||||
|
"https://node6.fibo-rpc.asia",
|
||||||
|
"https://node7.fibo-rpc.asia"
|
||||||
|
],
|
||||||
|
"faucets": [
|
||||||
|
"https://test.fibochain.org/faucets"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "FIBONACCI UTILITY TOKEN",
|
"name": "FIBONACCI UTILITY TOKEN",
|
||||||
"symbol": "FIBO",
|
"symbol": "FIBO",
|
||||||
@@ -29,6 +44,6 @@ export default {
|
|||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testnet": false,
|
"testnet": true,
|
||||||
"slug": "fibonacci"
|
"slug": "fibonacci"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "XRP Ledger EVM Devnet Sidechain",
|
||||||
|
"chain": "XRPL",
|
||||||
|
"shortName": "XRPL-EVM-Devnet-Sidechain",
|
||||||
|
"chainId": 1440001,
|
||||||
|
"testnet": true,
|
||||||
|
"icon": {
|
||||||
|
"format": "png",
|
||||||
|
"url": "ipfs://bafkreidmgxjwjircegjkvysgz25b2ukw6h7axoirkxv6idupzzqsdrljgy",
|
||||||
|
"width": 780,
|
||||||
|
"height": 680
|
||||||
|
},
|
||||||
|
"rpc": [
|
||||||
|
"https://xrp-ledger-evm-devnet-sidechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc-evm-sidechain.xrpl.org"
|
||||||
|
],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"decimals": 18,
|
||||||
|
"name": "XRP",
|
||||||
|
"symbol": "XRP"
|
||||||
|
},
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"url": "https://evm-sidechain.xrpl.org/",
|
||||||
|
"name": "XRP Ledger Explorer",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"slug": "xrp-ledger-evm-devnet-sidechain"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -11,8 +11,8 @@ export default {
|
|||||||
"rpc": [
|
"rpc": [
|
||||||
"https://dogechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://dogechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc.dogechain.dog",
|
"https://rpc.dogechain.dog",
|
||||||
"https://rpc-us.dogechain.dog",
|
"https://rpc01-sg.dogechain.dog",
|
||||||
"https://rpc01.dogechain.dog"
|
"https://rpc.ankr.com/dogechain"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"name": "Metaplayerone Network",
|
"name": "Metaplayerone Dubai Testnet",
|
||||||
"chain": "MP1 Dubai-Testnet",
|
"chain": "MP1 Dubai-Testnet",
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
|
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
|
||||||
@@ -9,7 +9,7 @@ export default {
|
|||||||
"format": "svg"
|
"format": "svg"
|
||||||
},
|
},
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://metaplayerone-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://metaplayerone-dubai-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc-dubai.mp1network.com/"
|
"https://rpc-dubai.mp1network.com/"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
@@ -36,5 +36,5 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testnet": true,
|
"testnet": true,
|
||||||
"slug": "metaplayerone-network"
|
"slug": "metaplayerone-dubai-testnet"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -5,7 +5,7 @@ export default {
|
|||||||
"chain": "Kanazawa",
|
"chain": "Kanazawa",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://kanazawa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://kanazawa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc-kanazawa.meldlabs.dev/ext/bc/2Ci7VYrUd4fTBqGA5D2HA6UPHzQ4LQyr8rZQww9MGSv9rNkRzn/rpc"
|
"https://subnets.avax.network/meld/testnet/rpc"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
@@ -24,7 +24,19 @@ export default {
|
|||||||
"shortName": "kanazawa",
|
"shortName": "kanazawa",
|
||||||
"chainId": 222000222,
|
"chainId": 222000222,
|
||||||
"networkId": 222000222,
|
"networkId": 222000222,
|
||||||
"explorers": [],
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "explorer",
|
||||||
|
"url": "https://subnets-test.avax.network/meld",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
|
||||||
|
"width": 4000,
|
||||||
|
"height": 4000,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
"testnet": true,
|
"testnet": true,
|
||||||
"slug": "kanazawa"
|
"slug": "kanazawa"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "SOMA Network Mainnet",
|
||||||
|
"chain": "SOMA",
|
||||||
|
"rpc": [
|
||||||
|
"https://soma-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://data-mainnet-v1.somanetwork.io/"
|
||||||
|
],
|
||||||
|
"faucets": [
|
||||||
|
"https://airdrop.somanetwork.io"
|
||||||
|
],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Soma Native Token",
|
||||||
|
"symbol": "SMA",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"infoURL": "https://somanetwork.io",
|
||||||
|
"shortName": "smam",
|
||||||
|
"chainId": 2332,
|
||||||
|
"networkId": 2332,
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmadSU2tcyvuzssDYGJ4rVLag43QLnKwcBerZR2zKLVU2N",
|
||||||
|
"width": 500,
|
||||||
|
"height": 500,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"status": "incubating",
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "SOMA Explorer Mainnet",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmadSU2tcyvuzssDYGJ4rVLag43QLnKwcBerZR2zKLVU2N",
|
||||||
|
"width": 500,
|
||||||
|
"height": 500,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"url": "https://somascan.io",
|
||||||
|
"standard": "none"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testnet": false,
|
||||||
|
"slug": "soma-network"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -2,6 +2,12 @@ import type { Chain } from "../src/types";
|
|||||||
export default {
|
export default {
|
||||||
"name": "LaChain",
|
"name": "LaChain",
|
||||||
"chain": "LaChain",
|
"chain": "LaChain",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreiecoqvit2mikpbpbtzy2zrn6e7fvqdegm72sdcathdwmgiyuzey7u",
|
||||||
|
"width": 104,
|
||||||
|
"height": 114,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://lachain-lachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://lachain-lachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc1.mainnet.lachain.network",
|
"https://rpc1.mainnet.lachain.network",
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "Neurochain Testnet",
|
||||||
|
"chain": "NCN",
|
||||||
|
"rpc": [
|
||||||
|
"https://neurochain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://nc-rpc-test1.neurochain.io"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Neurochain",
|
||||||
|
"symbol": "tNCN",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"infoURL": "https://www.neurochain.ai",
|
||||||
|
"shortName": "ncnt",
|
||||||
|
"chainId": 303,
|
||||||
|
"networkId": 303,
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||||
|
"width": 62,
|
||||||
|
"height": 59,
|
||||||
|
"format": "svg"
|
||||||
|
},
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "neuroscan",
|
||||||
|
"url": "https://testnet.ncnscan.com",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||||
|
"width": 62,
|
||||||
|
"height": 59,
|
||||||
|
"format": "svg"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testnet": true,
|
||||||
|
"slug": "neurochain-testnet"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "Neurochain Mainnet",
|
||||||
|
"chain": "NCN",
|
||||||
|
"rpc": [
|
||||||
|
"https://neurochain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://nc-rpc-prd1.neurochain.io",
|
||||||
|
"https://nc-rpc-prd2.neurochain.io"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Neurochain",
|
||||||
|
"symbol": "NCN",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"infoURL": "https://www.neurochain.ai",
|
||||||
|
"shortName": "ncn",
|
||||||
|
"chainId": 313,
|
||||||
|
"networkId": 313,
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||||
|
"width": 62,
|
||||||
|
"height": 59,
|
||||||
|
"format": "svg"
|
||||||
|
},
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "neuroscan",
|
||||||
|
"url": "https://ncnscan.com",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmc9zDWXar67cMUodp28mbN5pnwbVibxGXhwa8YCDvxmTR",
|
||||||
|
"width": 62,
|
||||||
|
"height": 59,
|
||||||
|
"format": "svg"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testnet": false,
|
||||||
|
"slug": "neurochain"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -5,7 +5,7 @@ export default {
|
|||||||
"chain": "MELD",
|
"chain": "MELD",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://meld.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://meld.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://network-rpc.meld.com"
|
"https://subnets.avax.network/meld/mainnet/rpc"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
"features": [],
|
"features": [],
|
||||||
@@ -24,7 +24,19 @@ export default {
|
|||||||
"shortName": "meld",
|
"shortName": "meld",
|
||||||
"chainId": 333000333,
|
"chainId": 333000333,
|
||||||
"networkId": 333000333,
|
"networkId": 333000333,
|
||||||
"explorers": [],
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "explorer",
|
||||||
|
"url": "https://subnets.avax.network/meld",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
|
||||||
|
"width": 4000,
|
||||||
|
"height": 4000,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
"testnet": false,
|
"testnet": false,
|
||||||
"slug": "meld"
|
"slug": "meld"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"name": "PulseChain Mainnet",
|
"name": "PulseChain",
|
||||||
"shortName": "pls",
|
"shortName": "pls",
|
||||||
"chain": "PLS",
|
"chain": "PLS",
|
||||||
"chainId": 369,
|
"chainId": 369,
|
||||||
@@ -8,10 +8,22 @@ export default {
|
|||||||
"infoURL": "https://pulsechain.com/",
|
"infoURL": "https://pulsechain.com/",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://pulsechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://pulsechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc.mainnet.pulsechain.com/",
|
"https://rpc.pulsechain.com/",
|
||||||
"wss://rpc.mainnet.pulsechain.com/"
|
"wss://rpc.pulsechain.com/"
|
||||||
|
],
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [],
|
||||||
|
"ens": {
|
||||||
|
"registry": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
|
||||||
|
},
|
||||||
|
"status": "incubating",
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Pulse",
|
"name": "Pulse",
|
||||||
"symbol": "PLS",
|
"symbol": "PLS",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ export default {
|
|||||||
"chain": "FTM",
|
"chain": "FTM",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://fantom-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://fantom-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://fantom-testnet.publicnode.com",
|
||||||
"https://rpc.testnet.fantom.network"
|
"https://rpc.testnet.fantom.network"
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
|
|||||||
@@ -18,6 +18,13 @@ export default {
|
|||||||
"shortName": "TelosEVMTestnet",
|
"shortName": "TelosEVMTestnet",
|
||||||
"chainId": 41,
|
"chainId": 41,
|
||||||
"networkId": 41,
|
"networkId": 41,
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "teloscan",
|
||||||
|
"url": "https://testnet.teloscan.io",
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
"testnet": true,
|
"testnet": true,
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
|
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"name": "LA Testnet",
|
"name": "LaTestnet",
|
||||||
"chain": "LATestnet",
|
"chain": "LaTestnet",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreiecoqvit2mikpbpbtzy2zrn6e7fvqdegm72sdcathdwmgiyuzey7u",
|
||||||
|
"width": 104,
|
||||||
|
"height": 114,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://la-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://latestnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc.testnet.lachain.network"
|
"https://rpc.testnet.lachain.network"
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
"https://faucet.lachain.network"
|
"https://faucet.lachain.network"
|
||||||
],
|
],
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Test La Coin",
|
"name": "Test LaCoin",
|
||||||
"symbol": "TLA",
|
"symbol": "TLA",
|
||||||
"decimals": 18
|
"decimals": 18
|
||||||
},
|
},
|
||||||
@@ -25,11 +31,11 @@ export default {
|
|||||||
"networkId": 418,
|
"networkId": 418,
|
||||||
"explorers": [
|
"explorers": [
|
||||||
{
|
{
|
||||||
"name": "LA Testnet Explorer",
|
"name": "LaTestnet Explorer",
|
||||||
"url": "https://testexplorer.lachain.network",
|
"url": "https://testexplorer.lachain.network",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testnet": true,
|
"testnet": true,
|
||||||
"slug": "la-testnet"
|
"slug": "latestnet"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -8,7 +8,9 @@ export default {
|
|||||||
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"https://goerli.optimism.io/"
|
"https://goerli.optimism.io/"
|
||||||
],
|
],
|
||||||
"faucets": [],
|
"faucets": [
|
||||||
|
"https://coinbase.com/faucets/optimism-goerli-faucet"
|
||||||
|
],
|
||||||
"nativeCurrency": {
|
"nativeCurrency": {
|
||||||
"name": "Goerli Ether",
|
"name": "Goerli Ether",
|
||||||
"symbol": "ETH",
|
"symbol": "ETH",
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ export default {
|
|||||||
"rpc": [
|
"rpc": [
|
||||||
"https://avalanche-fuji.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://avalanche-fuji.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}",
|
"https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"https://api.avax-test.network/ext/bc/C/rpc"
|
"https://api.avax-test.network/ext/bc/C/rpc",
|
||||||
|
"https://avalanche-fuji-c-chain.publicnode.com"
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
"https://faucet.avax.network/",
|
"https://faucet.avax.network/",
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ export default {
|
|||||||
"https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
"https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||||
"https://goerli.infura.io/v3/${INFURA_API_KEY}",
|
"https://goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"wss://goerli.infura.io/v3/${INFURA_API_KEY}",
|
"wss://goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"https://rpc.goerli.mudit.blog/"
|
"https://rpc.goerli.mudit.blog/",
|
||||||
|
"https://ethereum-goerli.publicnode.com"
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
"https://faucet.paradigm.xyz/",
|
"https://faucet.paradigm.xyz/",
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { Chain } from "../src/types";
|
import type { Chain } from "../src/types";
|
||||||
export default {
|
export default {
|
||||||
"name": "Sahara",
|
"name": "Fastex Chain (Bahamut)",
|
||||||
"title": "Bahamut mainnet Sahara",
|
"title": "Bahamut mainnet Sahara",
|
||||||
"chain": "Bahamut",
|
"chain": "Fastex Chain (Bahamut)",
|
||||||
"icon": {
|
"icon": {
|
||||||
"url": "ipfs://QmSemioP83RXnDWwTZbet8VpwJxcFRboX4B3pcdhLZGodP",
|
"url": "ipfs://QmSemioP83RXnDWwTZbet8VpwJxcFRboX4B3pcdhLZGodP",
|
||||||
"width": 200,
|
"width": 200,
|
||||||
@@ -10,7 +10,7 @@ export default {
|
|||||||
"format": "png"
|
"format": "png"
|
||||||
},
|
},
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://sahara.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://fastex-chain-bahamut.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
"https://rpc1.sahara.bahamutchain.com",
|
"https://rpc1.sahara.bahamutchain.com",
|
||||||
"https://rpc2.sahara.bahamutchain.com"
|
"https://rpc2.sahara.bahamutchain.com"
|
||||||
],
|
],
|
||||||
@@ -40,5 +40,5 @@ export default {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"testnet": false,
|
"testnet": false,
|
||||||
"slug": "sahara"
|
"slug": "fastex-chain-bahamut"
|
||||||
} as const satisfies Chain;
|
} as const satisfies Chain;
|
||||||
@@ -22,6 +22,11 @@ export default {
|
|||||||
"name": "Scroll Alpha Testnet Block Explorer",
|
"name": "Scroll Alpha Testnet Block Explorer",
|
||||||
"url": "https://blockscout.scroll.io",
|
"url": "https://blockscout.scroll.io",
|
||||||
"standard": "EIP3091"
|
"standard": "EIP3091"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Scroll Alpha Testnet Block Explorer",
|
||||||
|
"url": "https://scrollexplorer.unifra.io",
|
||||||
|
"standard": "EIP3091"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"parent": {
|
"parent": {
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ export default {
|
|||||||
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
|
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"https://matic-mumbai.chainstacklabs.com",
|
"https://matic-mumbai.chainstacklabs.com",
|
||||||
"https://rpc-mumbai.maticvigil.com",
|
"https://rpc-mumbai.maticvigil.com",
|
||||||
"https://matic-testnet-archive-rpc.bwarelabs.com"
|
"https://matic-testnet-archive-rpc.bwarelabs.com",
|
||||||
|
"https://polygon-mumbai-bor.publicnode.com"
|
||||||
],
|
],
|
||||||
"faucets": [
|
"faucets": [
|
||||||
"https://faucet.polygon.technology/"
|
"https://faucet.polygon.technology/"
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "SwissDLT",
|
||||||
|
"chain": "SDLT",
|
||||||
|
"rpc": [
|
||||||
|
"https://swissdlt.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc.swissdlt.ch"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "BCTS",
|
||||||
|
"symbol": "BCTS",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"features": [
|
||||||
|
{
|
||||||
|
"name": "EIP155"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "EIP1559"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"infoURL": "https://bcts.ch",
|
||||||
|
"shortName": "sdlt",
|
||||||
|
"chainId": 94,
|
||||||
|
"networkId": 94,
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreig7x5z4j6vh2r3pugmjnob3tmlksaekhqcgsorqzvs55o6v7ehqd4",
|
||||||
|
"width": 682,
|
||||||
|
"height": 512,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "SwissDLT Explorer",
|
||||||
|
"url": "https://explorer.swissdlt.ch",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://bafkreig7x5z4j6vh2r3pugmjnob3tmlksaekhqcgsorqzvs55o6v7ehqd4",
|
||||||
|
"width": 682,
|
||||||
|
"height": 512,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testnet": false,
|
||||||
|
"slug": "swissdlt"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -4,6 +4,7 @@ export default {
|
|||||||
"chain": "BSC",
|
"chain": "BSC",
|
||||||
"rpc": [
|
"rpc": [
|
||||||
"https://binance-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
"https://binance-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://bsc-testnet.publicnode.com",
|
||||||
"https://data-seed-prebsc-2-s3.binance.org:8545",
|
"https://data-seed-prebsc-2-s3.binance.org:8545",
|
||||||
"https://data-seed-prebsc-1-s3.binance.org:8545",
|
"https://data-seed-prebsc-1-s3.binance.org:8545",
|
||||||
"https://data-seed-prebsc-2-s2.binance.org:8545",
|
"https://data-seed-prebsc-2-s2.binance.org:8545",
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// @ts-check
|
||||||
|
/** @typedef { import("../../src/types").Chain } Chain */
|
||||||
|
|
||||||
|
/** @type {Omit<Chain, "slug">} */
|
||||||
|
export default {
|
||||||
|
name: "XRP Ledger EVM Devnet Sidechain",
|
||||||
|
chain: "XRPL",
|
||||||
|
shortName: "XRPL-EVM-Devnet-Sidechain",
|
||||||
|
chainId: 1440001,
|
||||||
|
testnet: true,
|
||||||
|
icon: {
|
||||||
|
format: "png",
|
||||||
|
url: "ipfs://bafkreidmgxjwjircegjkvysgz25b2ukw6h7axoirkxv6idupzzqsdrljgy",
|
||||||
|
width: 780,
|
||||||
|
height: 680,
|
||||||
|
},
|
||||||
|
rpc: ["https://rpc-evm-sidechain.xrpl.org"],
|
||||||
|
nativeCurrency: {
|
||||||
|
decimals: 18,
|
||||||
|
name: "XRP",
|
||||||
|
symbol: "XRP",
|
||||||
|
},
|
||||||
|
explorers: [
|
||||||
|
{
|
||||||
|
url: "https://evm-sidechain.xrpl.org/",
|
||||||
|
name: "XRP Ledger Explorer",
|
||||||
|
standard: "EIP3091",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
@@ -13,4 +13,5 @@ export default {
|
|||||||
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
|
||||||
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
|
||||||
],
|
],
|
||||||
|
faucets: ["https://coinbase.com/faucets/optimism-goerli-faucet"],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/chains",
|
"name": "@thirdweb-dev/chains",
|
||||||
"version": "0.1.16",
|
"version": "0.1.18",
|
||||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,24 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.10.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 0.10.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1037](https://github.com/thirdweb-dev/js/pull/1037) [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa) Thanks [@jnsdls](https://github.com/jnsdls)! - update ipfs gateways - add more fallbacks
|
||||||
|
|
||||||
|
- Updated dependencies [[`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/storage@1.1.3
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 0.10.16
|
## 0.10.16
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "thirdweb",
|
"name": "thirdweb",
|
||||||
"main": "dist/cli/index.js",
|
"main": "dist/cli/index.js",
|
||||||
"version": "0.10.16",
|
"version": "0.10.18",
|
||||||
"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,18 +1,3 @@
|
|||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export const DEFAULT_IPFS_GATEWAY = "https://ipfs.thirdwebcdn.com/ipfs/";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export const TW_IPFS_SERVER_URL = "https://upload.nftlabs.co";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export const PINATA_IPFS_URL = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 3.12.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c), [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.22
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 3.12.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1037](https://github.com/thirdweb-dev/js/pull/1037) [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa) Thanks [@jnsdls](https://github.com/jnsdls)! - update ipfs gateways - add more fallbacks
|
||||||
|
|
||||||
|
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.21
|
||||||
|
- @thirdweb-dev/storage@1.1.3
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 3.12.0
|
## 3.12.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "3.12.0",
|
"version": "3.12.2",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
export const DEFAULT_IPFS_GATEWAY = "https://ipfs.thirdwebcdn.com/ipfs/";
|
|
||||||
|
|
||||||
export interface IPFSResolverOptions {
|
|
||||||
gatewayUrl: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const DEFAULT_IPFS_RESOLVER_OPTIONS: IPFSResolverOptions = {
|
|
||||||
gatewayUrl: DEFAULT_IPFS_GATEWAY,
|
|
||||||
};
|
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
import { DEFAULT_IPFS_RESOLVER_OPTIONS } from "../constants/ipfs";
|
|
||||||
import mime from "mime/lite.js";
|
import mime from "mime/lite.js";
|
||||||
|
import {
|
||||||
|
parseGatewayUrls,
|
||||||
|
prepareGatewayUrls,
|
||||||
|
replaceSchemeWithGatewayUrl,
|
||||||
|
} from "@thirdweb-dev/storage";
|
||||||
|
|
||||||
export function resolveIpfsUri(
|
// TODO legacy remove this when possible
|
||||||
uri?: string,
|
export interface IPFSResolverOptions {
|
||||||
options = DEFAULT_IPFS_RESOLVER_OPTIONS,
|
gatewayUrl: string;
|
||||||
) {
|
}
|
||||||
|
|
||||||
|
export function resolveIpfsUri(uri?: string, options?: IPFSResolverOptions) {
|
||||||
if (!uri) {
|
if (!uri) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
if (uri.startsWith("ipfs://")) {
|
const gatewayUrls = prepareGatewayUrls(
|
||||||
return uri.replace("ipfs://", options.gatewayUrl);
|
parseGatewayUrls(options?.gatewayUrl ? [options?.gatewayUrl] : undefined),
|
||||||
}
|
);
|
||||||
return uri;
|
return replaceSchemeWithGatewayUrl(uri, gatewayUrls);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveMimeType(url?: string) {
|
export async function resolveMimeType(url?: string) {
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.2.14
|
||||||
|
|
||||||
|
## 0.2.13
|
||||||
|
|
||||||
## 0.2.12
|
## 0.2.12
|
||||||
|
|
||||||
## 0.2.11
|
## 0.2.11
|
||||||
|
|||||||
@@ -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.2.12",
|
"version": "0.2.14",
|
||||||
"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,31 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.2.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c), [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.22
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
- @thirdweb-dev/react-core@3.12.2
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 0.2.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1025](https://github.com/thirdweb-dev/js/pull/1025) [`99ffa8ce`](https://github.com/thirdweb-dev/js/commit/99ffa8ce3b47948f0b6aa3809e734d449a8377bb) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Single global modal. No API changes
|
||||||
|
|
||||||
|
Added the capability of using our theme outside the SDK.
|
||||||
|
ThirdwebProvider's children component are now wrapped in a ThemeProvider.
|
||||||
|
|
||||||
|
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.21
|
||||||
|
- @thirdweb-dev/react-core@3.12.1
|
||||||
|
- @thirdweb-dev/storage@1.1.3
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 0.2.12
|
## 0.2.12
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.2.12",
|
"version": "0.2.14",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,9 +1,15 @@
|
|||||||
import { ThemeProvider, ThemeProviderProps } from "../styles/ThemeProvider";
|
import { ThemeProvider, ThemeProviderProps } from "../styles/ThemeProvider";
|
||||||
import { ConnectWalletDetails } from "./ConnectWalletDetails/ConnectWalletDetails";
|
import { ConnectWalletDetails } from "./ConnectWalletDetails/ConnectWalletDetails";
|
||||||
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
import {
|
||||||
import { useAddress } from "@thirdweb-dev/react-core";
|
useAddress,
|
||||||
import React, { useEffect, useRef } from "react";
|
useConnectionStatus,
|
||||||
import { Animated } from "react-native";
|
useWallets,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
import { ActivityIndicator, Animated, StyleSheet } from "react-native";
|
||||||
|
import BaseButton from "./base/BaseButton";
|
||||||
|
import Text from "./base/Text";
|
||||||
|
import { useModalState } from "../providers/ui-context-provider";
|
||||||
|
|
||||||
export type ConnectWalletProps = {
|
export type ConnectWalletProps = {
|
||||||
theme?: ThemeProviderProps["theme"];
|
theme?: ThemeProviderProps["theme"];
|
||||||
@@ -30,8 +36,32 @@ export const ConnectWallet = ({
|
|||||||
theme,
|
theme,
|
||||||
}: ConnectWalletProps) => {
|
}: ConnectWalletProps) => {
|
||||||
const fadeAnim = useRef(new Animated.Value(0)).current;
|
const fadeAnim = useRef(new Animated.Value(0)).current;
|
||||||
|
|
||||||
const address = useAddress();
|
const address = useAddress();
|
||||||
|
const connectionStatus = useConnectionStatus();
|
||||||
|
const supportedWallets = useWallets();
|
||||||
|
const isWalletConnecting = connectionStatus === "connecting";
|
||||||
|
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
|
||||||
|
const { setModalState } = useModalState();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setShowButtonSpinner(isWalletConnecting);
|
||||||
|
|
||||||
|
if (!isWalletConnecting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
if (isWalletConnecting) {
|
||||||
|
setShowButtonSpinner(false);
|
||||||
|
}
|
||||||
|
}, 3000);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (timeout) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [isWalletConnecting]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Animated.timing(fadeAnim, {
|
Animated.timing(fadeAnim, {
|
||||||
@@ -41,6 +71,20 @@ export const ConnectWallet = ({
|
|||||||
}).start();
|
}).start();
|
||||||
}, [fadeAnim]);
|
}, [fadeAnim]);
|
||||||
|
|
||||||
|
const onConnectWalletPress = () => {
|
||||||
|
setModalState({
|
||||||
|
isOpen: true,
|
||||||
|
isSheet: true,
|
||||||
|
view: "ConnectWalletFlow",
|
||||||
|
data: {
|
||||||
|
modalTitle,
|
||||||
|
walletConfig:
|
||||||
|
supportedWallets.length === 1 ? supportedWallets[0] : undefined,
|
||||||
|
},
|
||||||
|
caller: "ConnectWallet",
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={theme}>
|
<ThemeProvider theme={theme}>
|
||||||
<Animated.View style={{ opacity: fadeAnim }}>
|
<Animated.View style={{ opacity: fadeAnim }}>
|
||||||
@@ -50,12 +94,37 @@ export const ConnectWallet = ({
|
|||||||
detailsButton={detailsButton}
|
detailsButton={detailsButton}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ConnectWalletFlow
|
<BaseButton
|
||||||
buttonTitle={buttonTitle}
|
backgroundColor="buttonBackgroundColor"
|
||||||
modalTitle={modalTitle}
|
onPress={onConnectWalletPress}
|
||||||
/>
|
style={styles.connectWalletButton}
|
||||||
|
>
|
||||||
|
<Text variant="bodyLarge" color="buttonTextColor">
|
||||||
|
{showButtonSpinner ? (
|
||||||
|
<ActivityIndicator size="small" color="buttonTextColor" />
|
||||||
|
) : buttonTitle ? (
|
||||||
|
buttonTitle
|
||||||
|
) : (
|
||||||
|
"Connect Wallet"
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</BaseButton>
|
||||||
)}
|
)}
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
connectWalletButton: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
borderRadius: 8,
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
paddingVertical: 10,
|
||||||
|
minWidth: 150,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
+12
-184
@@ -1,24 +1,13 @@
|
|||||||
import { NetworkSelectorModal } from "../NetworkSelector/NetworkSelectorModal";
|
|
||||||
import { Address } from "../base/Address";
|
import { Address } from "../base/Address";
|
||||||
import BaseButton from "../base/BaseButton";
|
import BaseButton from "../base/BaseButton";
|
||||||
import { ChainIcon } from "../base/ChainIcon";
|
import { ChainIcon } from "../base/ChainIcon";
|
||||||
import PocketWalletIcon from "../../assets/wallet";
|
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { WalletIcon } from "../base/WalletIcon";
|
import { WalletIcon } from "../base/WalletIcon";
|
||||||
import { TWModal } from "../base/modal/TWModal";
|
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
|
||||||
import { NetworkButton } from "./NetworkButton";
|
|
||||||
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
|
|
||||||
import { useWallet, useBalance, useDisconnect } from "@thirdweb-dev/react-core";
|
|
||||||
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
|
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
|
||||||
import { StyleSheet, View } from "react-native";
|
import { StyleSheet, View } from "react-native";
|
||||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
import { LocalWallet } from "@thirdweb-dev/wallets";
|
||||||
import { Toast } from "../base/Toast";
|
import { useModalState } from "../../providers/ui-context-provider";
|
||||||
import { LocalWallet, SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
|
||||||
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
|
|
||||||
import { useSmartWallet } from "../../providers/context-provider";
|
|
||||||
import RightArrowIcon from "../../assets/right-arrow";
|
|
||||||
import { useTheme } from "@shopify/restyle";
|
|
||||||
|
|
||||||
export type ConnectWalletDetailsProps = {
|
export type ConnectWalletDetailsProps = {
|
||||||
address: string;
|
address: string;
|
||||||
@@ -29,157 +18,25 @@ export const ConnectWalletDetails = ({
|
|||||||
address,
|
address,
|
||||||
detailsButton,
|
detailsButton,
|
||||||
}: ConnectWalletDetailsProps) => {
|
}: ConnectWalletDetailsProps) => {
|
||||||
const theme = useTheme();
|
|
||||||
const [isDetailsModalVisible, setIsDetailsModalVisible] = useState(false);
|
|
||||||
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
|
||||||
const [isNetworkSelectorModalVisible, setIsNetworkSelectorModalVisible] =
|
|
||||||
useState(false);
|
|
||||||
const [isDisconnecting, setIsDisconnecting] = useState(false);
|
|
||||||
const [addressCopied, setAddressCopied] = useState(false);
|
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const disconnect = useDisconnect();
|
|
||||||
const [smartWallet, setSmartWallet] = useSmartWallet();
|
|
||||||
const chain = useActiveChain();
|
const chain = useActiveChain();
|
||||||
const balanceQuery = useBalance();
|
const balanceQuery = useBalance();
|
||||||
|
const { setModalState } = useModalState();
|
||||||
useEffect(() => {
|
|
||||||
const timeout = setTimeout(() => {
|
|
||||||
if (addressCopied) {
|
|
||||||
setAddressCopied(false);
|
|
||||||
}
|
|
||||||
}, 2000);
|
|
||||||
|
|
||||||
return () => clearTimeout(timeout);
|
|
||||||
}, [addressCopied]);
|
|
||||||
|
|
||||||
const onPress = () => {
|
const onPress = () => {
|
||||||
setIsDetailsModalVisible(true);
|
setModalState({
|
||||||
};
|
view: "WalletDetails",
|
||||||
|
data: {
|
||||||
const onDisconnectPress = () => {
|
address: address,
|
||||||
setIsDisconnecting(true);
|
},
|
||||||
disconnect().finally(() => {
|
isOpen: true,
|
||||||
setIsDisconnecting(false);
|
isSheet: true,
|
||||||
setSmartWallet?.(undefined);
|
caller: "ConnectWalletDetails",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChangeNetworkPress = () => {
|
|
||||||
// TODO: implement this
|
|
||||||
// setIsDetailsModalVisible(false);
|
|
||||||
// setIsNetworkSelectorModalVisible(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onSelectorModalClose = () => {
|
|
||||||
setIsNetworkSelectorModalVisible(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onBackdropPress = () => {
|
|
||||||
setIsDetailsModalVisible(false);
|
|
||||||
setIsExportModalVisible(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onExportLocalWalletPress = useCallback(() => {
|
|
||||||
setIsExportModalVisible(true);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const onExportModalClose = () => {
|
|
||||||
setIsExportModalVisible(false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onAddressCopied = () => {
|
|
||||||
setAddressCopied(true);
|
|
||||||
};
|
|
||||||
|
|
||||||
const getAdditionalActions = useCallback(() => {
|
|
||||||
if (activeWallet?.walletId === SmartWallet.id || smartWallet) {
|
|
||||||
return (
|
|
||||||
<SmartWalletAdditionalActions
|
|
||||||
onExportPress={onExportLocalWalletPress}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeWallet?.walletId === walletIds.localWallet) {
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<View style={styles.currentNetwork}>
|
|
||||||
<Text variant="bodySmallSecondary">Additional Actions</Text>
|
|
||||||
</View>
|
|
||||||
<BaseButton
|
|
||||||
backgroundColor="background"
|
|
||||||
borderColor="border"
|
|
||||||
mb="sm"
|
|
||||||
justifyContent="space-between"
|
|
||||||
style={styles.exportWallet}
|
|
||||||
onPress={onExportLocalWalletPress}
|
|
||||||
>
|
|
||||||
<>
|
|
||||||
<PocketWalletIcon size={16} />
|
|
||||||
<View style={styles.exportWalletInfo}>
|
|
||||||
<Text variant="bodySmall">Backup wallet</Text>
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
<RightArrowIcon
|
|
||||||
height={10}
|
|
||||||
width={10}
|
|
||||||
color={theme.colors.iconPrimary}
|
|
||||||
/>
|
|
||||||
</BaseButton>
|
|
||||||
|
|
||||||
{activeWallet?.walletId === LocalWallet.id ? (
|
|
||||||
<Text variant="error">
|
|
||||||
{
|
|
||||||
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
|
|
||||||
}
|
|
||||||
</Text>
|
|
||||||
) : null}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}, [
|
|
||||||
activeWallet?.walletId,
|
|
||||||
onExportLocalWalletPress,
|
|
||||||
smartWallet,
|
|
||||||
theme.colors.iconPrimary,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<TWModal
|
|
||||||
isVisible={isDetailsModalVisible}
|
|
||||||
onBackdropPress={onBackdropPress}
|
|
||||||
>
|
|
||||||
<ExportLocalWalletModal
|
|
||||||
isVisible={isExportModalVisible}
|
|
||||||
onClose={onExportModalClose}
|
|
||||||
/>
|
|
||||||
<WalletDetailsModalHeader
|
|
||||||
address={address}
|
|
||||||
onDisconnectPress={onDisconnectPress}
|
|
||||||
onAddressCopied={onAddressCopied}
|
|
||||||
loading={isDisconnecting}
|
|
||||||
/>
|
|
||||||
<View style={styles.currentNetwork}>
|
|
||||||
<Text variant="bodySmallSecondary">Current Network</Text>
|
|
||||||
</View>
|
|
||||||
<NetworkButton
|
|
||||||
chainIconUrl={chain?.icon?.url || ""}
|
|
||||||
chainName={chain?.name || "Unknown Network"}
|
|
||||||
onPress={onChangeNetworkPress}
|
|
||||||
/>
|
|
||||||
{getAdditionalActions()}
|
|
||||||
{addressCopied === true ? (
|
|
||||||
<Toast text={"Address copied to clipboard"} />
|
|
||||||
) : null}
|
|
||||||
</TWModal>
|
|
||||||
|
|
||||||
<NetworkSelectorModal
|
|
||||||
isVisible={isNetworkSelectorModalVisible}
|
|
||||||
onClose={onSelectorModalClose}
|
|
||||||
/>
|
|
||||||
<BaseButton
|
<BaseButton
|
||||||
backgroundColor="background"
|
backgroundColor="background"
|
||||||
borderColor="border"
|
borderColor="border"
|
||||||
@@ -222,26 +79,6 @@ const styles = StyleSheet.create({
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
},
|
},
|
||||||
exportWalletInfo: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: "flex-start",
|
|
||||||
alignItems: "flex-start",
|
|
||||||
alignContent: "center",
|
|
||||||
flexDirection: "column",
|
|
||||||
marginLeft: 8,
|
|
||||||
},
|
|
||||||
exportWallet: {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "row",
|
|
||||||
alignContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "flex-start",
|
|
||||||
borderRadius: 12,
|
|
||||||
borderWidth: 0.5,
|
|
||||||
paddingHorizontal: 10,
|
|
||||||
paddingVertical: 12,
|
|
||||||
minWidth: 200,
|
|
||||||
},
|
|
||||||
walletDetails: {
|
walletDetails: {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
@@ -254,13 +91,4 @@ const styles = StyleSheet.create({
|
|||||||
paddingVertical: 12,
|
paddingVertical: 12,
|
||||||
minWidth: 200,
|
minWidth: 200,
|
||||||
},
|
},
|
||||||
currentNetwork: {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignContent: "flex-start",
|
|
||||||
alignItems: "flex-start",
|
|
||||||
justifyContent: "flex-start",
|
|
||||||
marginTop: 24,
|
|
||||||
marginBottom: 8,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|||||||
+182
@@ -0,0 +1,182 @@
|
|||||||
|
import { StyleSheet, View } from "react-native";
|
||||||
|
import Box from "../base/Box";
|
||||||
|
import { Toast } from "../base/Toast";
|
||||||
|
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||||
|
import { NetworkButton } from "./NetworkButton";
|
||||||
|
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
|
||||||
|
import {
|
||||||
|
useActiveChain,
|
||||||
|
useDisconnect,
|
||||||
|
useWallet,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { SmartWallet, walletIds, LocalWallet } from "@thirdweb-dev/wallets";
|
||||||
|
import { useState, useCallback, useEffect } from "react";
|
||||||
|
import RightArrowIcon from "../../assets/right-arrow";
|
||||||
|
import PocketWalletIcon from "../../assets/wallet";
|
||||||
|
import { useSmartWallet } from "../../providers/context-provider";
|
||||||
|
import BaseButton from "../base/BaseButton";
|
||||||
|
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
|
||||||
|
import Text from "../base/Text";
|
||||||
|
import { useModalState } from "../../providers/ui-context-provider";
|
||||||
|
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
|
||||||
|
import { useAppTheme } from "../../styles/hooks";
|
||||||
|
|
||||||
|
export const ConnectWalletDetailsModal = () => {
|
||||||
|
const theme = useAppTheme();
|
||||||
|
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
|
||||||
|
const activeWallet = useWallet();
|
||||||
|
const chain = useActiveChain();
|
||||||
|
const disconnect = useDisconnect();
|
||||||
|
const [smartWallet, setSmartWallet] = useSmartWallet();
|
||||||
|
const [addressCopied, setAddressCopied] = useState(false);
|
||||||
|
const { modalState, setModalState } = useModalState();
|
||||||
|
const { address } = (modalState as WalletDetailsModal).data;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
if (addressCopied) {
|
||||||
|
setAddressCopied(false);
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
return () => clearTimeout(timeout);
|
||||||
|
}, [addressCopied]);
|
||||||
|
|
||||||
|
const onDisconnectPress = () => {
|
||||||
|
disconnect().finally(() => {
|
||||||
|
setModalState(CLOSE_MODAL_STATE("ConnectWalletDetailsModal"));
|
||||||
|
setSmartWallet?.(undefined);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onChangeNetworkPress = () => {
|
||||||
|
// TODO: implement this
|
||||||
|
// setIsDetailsModalVisible(false);
|
||||||
|
// setIsNetworkSelectorModalVisible(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onExportLocalWalletPress = useCallback(() => {
|
||||||
|
setIsExportModalVisible(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const onExportModalClose = () => {
|
||||||
|
setIsExportModalVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onAddressCopied = () => {
|
||||||
|
setAddressCopied(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getAdditionalActions = useCallback(() => {
|
||||||
|
if (activeWallet?.walletId === SmartWallet.id || smartWallet) {
|
||||||
|
return (
|
||||||
|
<SmartWalletAdditionalActions
|
||||||
|
onExportPress={onExportLocalWalletPress}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (activeWallet?.walletId === walletIds.localWallet) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<View style={styles.currentNetwork}>
|
||||||
|
<Text variant="bodySmallSecondary">Additional Actions</Text>
|
||||||
|
</View>
|
||||||
|
<BaseButton
|
||||||
|
backgroundColor="background"
|
||||||
|
borderColor="border"
|
||||||
|
mb="sm"
|
||||||
|
justifyContent="space-between"
|
||||||
|
style={styles.exportWallet}
|
||||||
|
onPress={onExportLocalWalletPress}
|
||||||
|
>
|
||||||
|
<>
|
||||||
|
<PocketWalletIcon size={16} />
|
||||||
|
<View style={styles.exportWalletInfo}>
|
||||||
|
<Text variant="bodySmall">Backup wallet</Text>
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
|
<RightArrowIcon
|
||||||
|
height={10}
|
||||||
|
width={10}
|
||||||
|
color={theme.colors.iconPrimary}
|
||||||
|
/>
|
||||||
|
</BaseButton>
|
||||||
|
|
||||||
|
{activeWallet?.walletId === LocalWallet.id ? (
|
||||||
|
<Text variant="error">
|
||||||
|
{
|
||||||
|
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
|
||||||
|
}
|
||||||
|
</Text>
|
||||||
|
) : null}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}, [
|
||||||
|
activeWallet?.walletId,
|
||||||
|
onExportLocalWalletPress,
|
||||||
|
smartWallet,
|
||||||
|
theme.colors.iconPrimary,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Box>
|
||||||
|
<ExportLocalWalletModal
|
||||||
|
isVisible={isExportModalVisible}
|
||||||
|
onClose={onExportModalClose}
|
||||||
|
/>
|
||||||
|
<WalletDetailsModalHeader
|
||||||
|
address={address}
|
||||||
|
onDisconnectPress={onDisconnectPress}
|
||||||
|
onAddressCopied={onAddressCopied}
|
||||||
|
/>
|
||||||
|
<View style={styles.currentNetwork}>
|
||||||
|
<Text variant="bodySmallSecondary">Current Network</Text>
|
||||||
|
</View>
|
||||||
|
<NetworkButton
|
||||||
|
chainIconUrl={chain?.icon?.url || ""}
|
||||||
|
chainName={chain?.name || "Unknown Network"}
|
||||||
|
onPress={onChangeNetworkPress}
|
||||||
|
/>
|
||||||
|
{getAdditionalActions()}
|
||||||
|
{addressCopied === true ? (
|
||||||
|
<Toast text={"Address copied to clipboard"} />
|
||||||
|
) : null}
|
||||||
|
</Box>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
exportWalletInfo: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
alignContent: "center",
|
||||||
|
flexDirection: "column",
|
||||||
|
marginLeft: 8,
|
||||||
|
},
|
||||||
|
exportWallet: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
borderRadius: 12,
|
||||||
|
borderWidth: 0.5,
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
paddingVertical: 12,
|
||||||
|
minWidth: 200,
|
||||||
|
},
|
||||||
|
currentNetwork: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
alignContent: "flex-start",
|
||||||
|
alignItems: "flex-start",
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
marginTop: 24,
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
});
|
||||||
+2
-2
@@ -14,7 +14,7 @@ import { useWalletContext, useWallet } from "@thirdweb-dev/react-core";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useSmartWallet } from "../../providers/context-provider";
|
import { useSmartWallet } from "../../providers/context-provider";
|
||||||
import RightArrowIcon from "../../assets/right-arrow";
|
import RightArrowIcon from "../../assets/right-arrow";
|
||||||
import { useTheme } from "@shopify/restyle";
|
import { useAppTheme } from "../../styles/hooks";
|
||||||
|
|
||||||
export const SmartWalletAdditionalActions = ({
|
export const SmartWalletAdditionalActions = ({
|
||||||
onExportPress,
|
onExportPress,
|
||||||
@@ -27,7 +27,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 = useTheme();
|
const theme = useAppTheme();
|
||||||
|
|
||||||
const wallet = showSmartWallet
|
const wallet = showSmartWallet
|
||||||
? smartWallet
|
? smartWallet
|
||||||
|
|||||||
+1
-6
@@ -5,7 +5,7 @@ import BaseButton from "../base/BaseButton";
|
|||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { WalletIcon } from "../base/WalletIcon";
|
import { WalletIcon } from "../base/WalletIcon";
|
||||||
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
|
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
|
||||||
import { ActivityIndicator, StyleSheet, View } from "react-native";
|
import { StyleSheet, View } from "react-native";
|
||||||
import * as Clipboard from "expo-clipboard";
|
import * as Clipboard from "expo-clipboard";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import CopyIcon from "../../assets/copy";
|
import CopyIcon from "../../assets/copy";
|
||||||
@@ -21,7 +21,6 @@ export const WalletDetailsModalHeader = ({
|
|||||||
address,
|
address,
|
||||||
onDisconnectPress,
|
onDisconnectPress,
|
||||||
onAddressCopied,
|
onAddressCopied,
|
||||||
loading,
|
|
||||||
}: WalletDetailsModalHeaderProps) => {
|
}: WalletDetailsModalHeaderProps) => {
|
||||||
const theme = useAppTheme();
|
const theme = useAppTheme();
|
||||||
const balanceQuery = useBalance();
|
const balanceQuery = useBalance();
|
||||||
@@ -61,9 +60,6 @@ export const WalletDetailsModalHeader = ({
|
|||||||
{balanceQuery.data?.symbol}
|
{balanceQuery.data?.symbol}
|
||||||
</Text>
|
</Text>
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
{loading ? (
|
|
||||||
<ActivityIndicator size={18} color={theme.colors.iconHighlight} />
|
|
||||||
) : (
|
|
||||||
<Icon
|
<Icon
|
||||||
type="disconnect"
|
type="disconnect"
|
||||||
width={18}
|
width={18}
|
||||||
@@ -71,7 +67,6 @@ export const WalletDetailsModalHeader = ({
|
|||||||
onPress={onDisconnectPress}
|
onPress={onDisconnectPress}
|
||||||
color={theme.colors.iconHighlight}
|
color={theme.colors.iconHighlight}
|
||||||
/>
|
/>
|
||||||
)}
|
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -3,7 +3,7 @@ import type { WalletConfig } from "@thirdweb-dev/react-core";
|
|||||||
import { StyleSheet, View, FlatList } from "react-native";
|
import { StyleSheet, View, FlatList } from "react-native";
|
||||||
import { WalletButton } from "../../base/WalletButton";
|
import { WalletButton } from "../../base/WalletButton";
|
||||||
|
|
||||||
interface InitialExplorerContentProps {
|
interface ChooseWalletContentProps {
|
||||||
wallets: WalletConfig[];
|
wallets: WalletConfig[];
|
||||||
excludeWalletIds?: string[];
|
excludeWalletIds?: string[];
|
||||||
onChooseWallet: (wallet: WalletConfig) => void;
|
onChooseWallet: (wallet: WalletConfig) => void;
|
||||||
@@ -13,7 +13,7 @@ export const ChooseWalletContent = ({
|
|||||||
wallets,
|
wallets,
|
||||||
excludeWalletIds,
|
excludeWalletIds,
|
||||||
onChooseWallet,
|
onChooseWallet,
|
||||||
}: InitialExplorerContentProps) => {
|
}: ChooseWalletContentProps) => {
|
||||||
const walletsToDisplay = useMemo(() => {
|
const walletsToDisplay = useMemo(() => {
|
||||||
return wallets.filter(
|
return wallets.filter(
|
||||||
(w) => !!!excludeWalletIds?.find((ewId) => ewId === w.id),
|
(w) => !!!excludeWalletIds?.find((ewId) => ewId === w.id),
|
||||||
|
|||||||
@@ -1,68 +1,46 @@
|
|||||||
import BaseButton from "../base/BaseButton";
|
|
||||||
import Text from "../base/Text";
|
import Text from "../base/Text";
|
||||||
import { TWModal } from "../base/modal/TWModal";
|
|
||||||
import { ChooseWallet } from "./ChooseWallet/ChooseWallet";
|
import { ChooseWallet } from "./ChooseWallet/ChooseWallet";
|
||||||
import { ConnectingWallet } from "./ConnectingWallet/ConnectingWallet";
|
import { ConnectingWallet } from "./ConnectingWallet/ConnectingWallet";
|
||||||
import {
|
import { WalletConfig, useConnect, useWallets } from "@thirdweb-dev/react-core";
|
||||||
WalletConfig,
|
import { useCallback, useEffect, useState } from "react";
|
||||||
useConnect,
|
|
||||||
useConnectionStatus,
|
|
||||||
useWallets,
|
|
||||||
} from "@thirdweb-dev/react-core";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import { ActivityIndicator, StyleSheet } from "react-native";
|
|
||||||
import { SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
import { SmartWallet, walletIds } from "@thirdweb-dev/wallets";
|
||||||
import { SmartWalletFlow } from "./SmartWallet/SmartWalletFlow";
|
import { SmartWalletFlow } from "./SmartWallet/SmartWalletFlow";
|
||||||
import { useColorScheme } from "react-native";
|
import { useColorScheme } from "react-native";
|
||||||
|
import { useModalState } from "../../providers/ui-context-provider";
|
||||||
|
import {
|
||||||
|
CLOSE_MODAL_STATE,
|
||||||
|
ConnectWalletFlowModal,
|
||||||
|
} from "../../utils/modalTypes";
|
||||||
|
|
||||||
|
export const ConnectWalletFlow = () => {
|
||||||
|
const { modalState, setModalState } = useModalState();
|
||||||
|
const { modalTitle, walletConfig } = (modalState as ConnectWalletFlowModal)
|
||||||
|
.data;
|
||||||
|
|
||||||
export const ConnectWalletFlow = ({
|
|
||||||
buttonTitle,
|
|
||||||
modalTitle,
|
|
||||||
}: {
|
|
||||||
buttonTitle?: string;
|
|
||||||
modalTitle?: string;
|
|
||||||
}) => {
|
|
||||||
const [modalVisible, setModalVisible] = useState(false);
|
const [modalVisible, setModalVisible] = useState(false);
|
||||||
const [activeWallet, setActiveWallet] = useState<WalletConfig | undefined>();
|
const [activeWallet, setActiveWallet] = useState<WalletConfig | undefined>();
|
||||||
const [isConnecting, setIsConnecting] = useState(false);
|
const [isConnecting, setIsConnecting] = useState(false);
|
||||||
const supportedWallets = useWallets();
|
const supportedWallets = useWallets();
|
||||||
const connectionStatus = useConnectionStatus();
|
|
||||||
const isWalletConnecting = connectionStatus === "connecting";
|
|
||||||
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
|
|
||||||
const theme = useColorScheme();
|
const theme = useColorScheme();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setShowButtonSpinner(isWalletConnecting);
|
|
||||||
|
|
||||||
if (!isWalletConnecting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeout = setTimeout(() => {
|
|
||||||
if (isWalletConnecting) {
|
|
||||||
setShowButtonSpinner(false);
|
|
||||||
}
|
|
||||||
}, 3000);
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (timeout) {
|
|
||||||
clearTimeout(timeout);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}, [isWalletConnecting]);
|
|
||||||
|
|
||||||
const connect = useConnect();
|
const connect = useConnect();
|
||||||
|
|
||||||
const onConnectPress = () => {
|
const onChooseWallet = useCallback((wallet: WalletConfig) => {
|
||||||
if (supportedWallets.length === 1) {
|
setActiveWallet(() => wallet);
|
||||||
onChooseWallet(supportedWallets[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
setModalVisible(true);
|
// TODO: Change for !wallet.connectUI
|
||||||
};
|
if (wallet.id !== SmartWallet.id) {
|
||||||
|
connectActiveWallet(wallet);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (walletConfig) {
|
||||||
|
onChooseWallet(walletConfig);
|
||||||
|
}
|
||||||
|
}, [onChooseWallet, walletConfig]);
|
||||||
|
|
||||||
const onClose = (reset?: boolean) => {
|
const onClose = (reset?: boolean) => {
|
||||||
setModalVisible(false);
|
setModalState(CLOSE_MODAL_STATE("ConnectWalletFlow"));
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
resetModal();
|
resetModal();
|
||||||
@@ -75,44 +53,43 @@ export const ConnectWalletFlow = ({
|
|||||||
|
|
||||||
const connectActiveWallet = async (wallet: WalletConfig) => {
|
const connectActiveWallet = async (wallet: WalletConfig) => {
|
||||||
setIsConnecting(true);
|
setIsConnecting(true);
|
||||||
connect(wallet, {}).catch((error) => {
|
connect(wallet, {})
|
||||||
|
.catch((error) => {
|
||||||
console.error("Error connecting to the wallet", error);
|
console.error("Error connecting to the wallet", error);
|
||||||
onBackPress();
|
})
|
||||||
|
.finally(() => {
|
||||||
|
onClose(true);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChooseWallet = (wallet: WalletConfig) => {
|
|
||||||
setActiveWallet(() => wallet);
|
|
||||||
|
|
||||||
if (wallet.id !== SmartWallet.id) {
|
|
||||||
connectActiveWallet(wallet);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const onBackPress = () => {
|
const onBackPress = () => {
|
||||||
resetModal();
|
resetModal();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onConnected = () => {
|
||||||
|
onClose(true);
|
||||||
|
};
|
||||||
|
|
||||||
const resetModal = () => {
|
const resetModal = () => {
|
||||||
setActiveWallet(undefined);
|
setActiveWallet(undefined);
|
||||||
setIsConnecting(false);
|
setIsConnecting(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
function getComponentForWallet(activeWalletP: WalletConfig) {
|
function getComponentForWallet() {
|
||||||
switch (activeWalletP.id) {
|
switch (activeWallet?.id) {
|
||||||
case SmartWallet.id:
|
case SmartWallet.id:
|
||||||
return <SmartWalletFlow onClose={onClose} onConnect={onBackPress} />;
|
return <SmartWalletFlow onClose={onClose} onConnect={onConnected} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (activeWalletP.connectUI) {
|
if (activeWallet?.connectUI) {
|
||||||
return (
|
return (
|
||||||
<activeWalletP.connectUI
|
<activeWallet.connectUI
|
||||||
theme={theme || "dark"}
|
theme={theme || "dark"}
|
||||||
goBack={onBackPress}
|
goBack={onBackPress}
|
||||||
close={onClose}
|
close={onClose}
|
||||||
isOpen={modalVisible}
|
isOpen={modalVisible}
|
||||||
open={onOpenModal}
|
open={onOpenModal}
|
||||||
walletConfig={activeWalletP}
|
walletConfig={activeWallet}
|
||||||
supportedWallets={supportedWallets}
|
supportedWallets={supportedWallets}
|
||||||
selectionData={undefined} // TODO
|
selectionData={undefined} // TODO
|
||||||
setSelectionData={() => {}} // TODO
|
setSelectionData={() => {}} // TODO
|
||||||
@@ -123,7 +100,6 @@ export const ConnectWalletFlow = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<TWModal isVisible={modalVisible}>
|
|
||||||
{activeWallet ? (
|
{activeWallet ? (
|
||||||
isConnecting ? (
|
isConnecting ? (
|
||||||
<ConnectingWallet
|
<ConnectingWallet
|
||||||
@@ -139,7 +115,7 @@ export const ConnectWalletFlow = ({
|
|||||||
onBackPress={onBackPress}
|
onBackPress={onBackPress}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
getComponentForWallet(activeWallet)
|
getComponentForWallet()
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<ChooseWallet
|
<ChooseWallet
|
||||||
@@ -149,37 +125,6 @@ export const ConnectWalletFlow = ({
|
|||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</TWModal>
|
|
||||||
|
|
||||||
<BaseButton
|
|
||||||
backgroundColor="buttonBackgroundColor"
|
|
||||||
onPress={onConnectPress}
|
|
||||||
style={styles.connectWalletButton}
|
|
||||||
>
|
|
||||||
<Text variant="bodyLarge" color="buttonTextColor">
|
|
||||||
{showButtonSpinner ? (
|
|
||||||
<ActivityIndicator size="small" color="buttonTextColor" />
|
|
||||||
) : buttonTitle ? (
|
|
||||||
buttonTitle
|
|
||||||
) : (
|
|
||||||
"Connect Wallet"
|
|
||||||
)}
|
|
||||||
</Text>
|
|
||||||
</BaseButton>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
connectWalletButton: {
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "row",
|
|
||||||
alignContent: "center",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
borderRadius: 8,
|
|
||||||
paddingHorizontal: 10,
|
|
||||||
paddingVertical: 10,
|
|
||||||
minWidth: 150,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|||||||
+2
-2
@@ -14,10 +14,10 @@ import { ChooseWallet } from "../ChooseWallet/ChooseWallet";
|
|||||||
import { LocalWalletFlow } from "../LocalWalletFlow";
|
import { LocalWalletFlow } from "../LocalWalletFlow";
|
||||||
import { ModalHeaderTextClose } from "../../base/modal/ModalHeaderTextClose";
|
import { ModalHeaderTextClose } from "../../base/modal/ModalHeaderTextClose";
|
||||||
import { ActivityIndicator, Linking, useColorScheme } from "react-native";
|
import { ActivityIndicator, Linking, useColorScheme } from "react-native";
|
||||||
import { useTheme } from "@shopify/restyle";
|
|
||||||
import BaseButton from "../../base/BaseButton";
|
import BaseButton from "../../base/BaseButton";
|
||||||
import Text from "../../base/Text";
|
import Text from "../../base/Text";
|
||||||
import { walletIds } from "@thirdweb-dev/wallets";
|
import { walletIds } from "@thirdweb-dev/wallets";
|
||||||
|
import { useAppTheme } from "../../../styles/hooks";
|
||||||
|
|
||||||
export const SmartWalletFlow = ({
|
export const SmartWalletFlow = ({
|
||||||
onClose,
|
onClose,
|
||||||
@@ -33,7 +33,7 @@ export const SmartWalletFlow = ({
|
|||||||
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
|
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
|
||||||
number | undefined
|
number | undefined
|
||||||
>();
|
>();
|
||||||
const theme = useTheme();
|
const theme = useAppTheme();
|
||||||
const createWalletInstance = useCreateWalletInstance();
|
const createWalletInstance = useCreateWalletInstance();
|
||||||
const walletObj = useSupportedWallet(walletIds.smartWallet) as SmartWalletObj;
|
const walletObj = useSupportedWallet(walletIds.smartWallet) as SmartWalletObj;
|
||||||
const connect = useConnect();
|
const connect = useConnect();
|
||||||
|
|||||||
+2
-2
@@ -1,14 +1,14 @@
|
|||||||
import { StyleSheet, TextInput } from "react-native";
|
import { StyleSheet, TextInput } from "react-native";
|
||||||
import { useTheme } from "@shopify/restyle";
|
|
||||||
import Box from "../../base/Box";
|
import Box from "../../base/Box";
|
||||||
import Text from "../../base/Text";
|
import Text from "../../base/Text";
|
||||||
|
import { useAppTheme } from "../../../styles/hooks";
|
||||||
|
|
||||||
export const UsernameInput = ({
|
export const UsernameInput = ({
|
||||||
onChangeText,
|
onChangeText,
|
||||||
}: {
|
}: {
|
||||||
onChangeText: TextInput["props"]["onChangeText"];
|
onChangeText: TextInput["props"]["onChangeText"];
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useAppTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
import Modal from "react-native-modal";
|
||||||
|
import { useModalState } from "../providers/ui-context-provider";
|
||||||
|
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
|
||||||
|
import { Dimensions, StyleSheet, View } from "react-native";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
import { ConnectWalletDetailsModal } from "./ConnectWalletDetails/ConnectWalletDetailsModal";
|
||||||
|
import { CLOSE_MODAL_STATE } from "../utils/modalTypes";
|
||||||
|
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||||
|
import { useAppTheme } from "../styles/hooks";
|
||||||
|
|
||||||
|
const MODAL_HEIGHT = Dimensions.get("window").height * 0.7;
|
||||||
|
const DEVICE_WIDTH = Dimensions.get("window").width;
|
||||||
|
|
||||||
|
export const MainModal = () => {
|
||||||
|
const theme = useAppTheme();
|
||||||
|
|
||||||
|
const { modalState, setModalState } = useModalState();
|
||||||
|
|
||||||
|
const { isOpen, isSheet } = modalState;
|
||||||
|
|
||||||
|
const view = useMemo(() => {
|
||||||
|
switch (modalState?.view) {
|
||||||
|
case "ConnectWalletFlow":
|
||||||
|
return <ConnectWalletFlow />;
|
||||||
|
case "WalletDetails":
|
||||||
|
return <ConnectWalletDetailsModal />;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, [modalState.view]);
|
||||||
|
|
||||||
|
const onBackdropPress = () => {
|
||||||
|
setModalState(CLOSE_MODAL_STATE("MainModal"));
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
|
<Modal
|
||||||
|
useNativeDriver
|
||||||
|
hideModalContentWhileAnimating={true}
|
||||||
|
isVisible={isOpen}
|
||||||
|
onBackdropPress={onBackdropPress}
|
||||||
|
>
|
||||||
|
{isSheet ? (
|
||||||
|
<View
|
||||||
|
style={[styles.modal, { backgroundColor: theme.colors.background }]}
|
||||||
|
>
|
||||||
|
<View style={styles.contentContainer}>{view}</View>
|
||||||
|
</View>
|
||||||
|
) : (
|
||||||
|
view
|
||||||
|
)}
|
||||||
|
</Modal>
|
||||||
|
</ThemeProvider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
modal: {
|
||||||
|
position: "absolute",
|
||||||
|
bottom: -20,
|
||||||
|
left: -20,
|
||||||
|
width: DEVICE_WIDTH,
|
||||||
|
borderTopLeftRadius: 24,
|
||||||
|
borderTopRightRadius: 24,
|
||||||
|
padding: 24,
|
||||||
|
},
|
||||||
|
contentContainer: {
|
||||||
|
maxHeight: MODAL_HEIGHT,
|
||||||
|
display: "flex",
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,22 +1,17 @@
|
|||||||
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
import { ModalHeaderTextClose } from "../base/modal/ModalHeaderTextClose";
|
||||||
import { TWModal, TWModalProps } from "../base/modal/TWModal";
|
|
||||||
|
|
||||||
export type NetworkSelectorModalProps = {
|
export type NetworkSelectorModalProps = {
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
} & TWModalProps;
|
};
|
||||||
|
|
||||||
export const NetworkSelectorModal = ({
|
export const NetworkSelectorModal = ({
|
||||||
isVisible,
|
|
||||||
onClose,
|
onClose,
|
||||||
...props
|
|
||||||
}: NetworkSelectorModalProps) => {
|
}: NetworkSelectorModalProps) => {
|
||||||
return (
|
return (
|
||||||
<TWModal isVisible={isVisible} {...props}>
|
|
||||||
<ModalHeaderTextClose
|
<ModalHeaderTextClose
|
||||||
headerText={"Select Network"}
|
headerText={"Select Network"}
|
||||||
subHeaderText={"Choose a new network to connect to thirdweb"}
|
subHeaderText={"Choose a new network to connect to thirdweb"}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
/>
|
/>
|
||||||
</TWModal>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,15 +2,15 @@ import { StyleSheet, TextInput, TouchableOpacity } from "react-native";
|
|||||||
import Box from "./base/Box";
|
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 { useTheme } from "@shopify/restyle";
|
|
||||||
import EyeOpened from "../assets/eye-opened";
|
import EyeOpened from "../assets/eye-opened";
|
||||||
|
import { useAppTheme } from "../styles/hooks";
|
||||||
|
|
||||||
export const PasswordInput = ({
|
export const PasswordInput = ({
|
||||||
onChangeText,
|
onChangeText,
|
||||||
}: {
|
}: {
|
||||||
onChangeText: TextInput["props"]["onChangeText"];
|
onChangeText: TextInput["props"]["onChangeText"];
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useAppTheme();
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
|
||||||
const onPressEyeIcon = () => {
|
const onPressEyeIcon = () => {
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ const ImageSvgUri = ({
|
|||||||
const isSvg = imageUrl.toLowerCase().endsWith(".svg");
|
const isSvg = imageUrl.toLowerCase().endsWith(".svg");
|
||||||
const resolvedImageUrl = resolveIpfsUri(imageUrl) || "";
|
const resolvedImageUrl = resolveIpfsUri(imageUrl) || "";
|
||||||
|
|
||||||
|
if (!resolvedImageUrl || resolvedImageUrl === "") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (isSvg) {
|
if (isSvg) {
|
||||||
return <SvgUri width={width} height={height} uri={resolvedImageUrl} />;
|
return <SvgUri width={width} height={height} uri={resolvedImageUrl} />;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -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 { useTheme } from "@shopify/restyle";
|
import { useAppTheme } from "../../styles/hooks";
|
||||||
|
|
||||||
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 = useTheme();
|
const theme = useAppTheme();
|
||||||
|
|
||||||
const translateYRef = useRef(new Animated.Value(translateY)).current;
|
const translateYRef = useRef(new Animated.Value(translateY)).current;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useTheme } from "@shopify/restyle";
|
|
||||||
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 = useTheme();
|
const theme = useAppTheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={styles.footer} onPress={onPress}>
|
<TouchableOpacity style={styles.footer} onPress={onPress}>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export { darkTheme, lightTheme } from "./styles/theme";
|
export { darkTheme, lightTheme } from "./styles/theme";
|
||||||
export type { Theme, ButtonTheme } from "./styles/theme";
|
export type { Theme, ButtonTheme } from "./styles/theme";
|
||||||
|
export { useAppTheme } from "./styles/hooks";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
CoinbaseWallet,
|
CoinbaseWallet,
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import { SecureStorage } from "../../core/SecureStorage";
|
|||||||
import { useCoinbaseWalletListener } from "../wallets/hooks/useCoinbaseWalletListener";
|
import { useCoinbaseWalletListener } from "../wallets/hooks/useCoinbaseWalletListener";
|
||||||
import { DEFAULT_WALLETS } from "../constants/wallets";
|
import { DEFAULT_WALLETS } from "../constants/wallets";
|
||||||
import { DappContextProvider } from "./context-provider";
|
import { DappContextProvider } from "./context-provider";
|
||||||
|
import { UIContextProvider } from "./ui-context-provider";
|
||||||
|
import { MainModal } from "../components/MainModal";
|
||||||
|
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||||
|
|
||||||
interface ThirdwebProviderProps<TChains extends Chain[]>
|
interface ThirdwebProviderProps<TChains extends Chain[]>
|
||||||
extends Omit<ThirdwebProviderCoreProps<TChains>, "supportedWallets"> {
|
extends Omit<ThirdwebProviderCoreProps<TChains>, "supportedWallets"> {
|
||||||
@@ -57,12 +60,12 @@ export const ThirdwebProvider = <
|
|||||||
thirdwebApiKey = DEFAULT_API_KEY,
|
thirdwebApiKey = DEFAULT_API_KEY,
|
||||||
supportedWallets = DEFAULT_WALLETS,
|
supportedWallets = DEFAULT_WALLETS,
|
||||||
authConfig,
|
authConfig,
|
||||||
|
theme,
|
||||||
...restProps
|
...restProps
|
||||||
}: PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
|
}: PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
|
||||||
useCoinbaseWalletListener();
|
useCoinbaseWalletListener();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DappContextProvider>
|
|
||||||
<ThirdwebProviderCore
|
<ThirdwebProviderCore
|
||||||
thirdwebApiKey={thirdwebApiKey}
|
thirdwebApiKey={thirdwebApiKey}
|
||||||
supportedWallets={supportedWallets}
|
supportedWallets={supportedWallets}
|
||||||
@@ -76,8 +79,14 @@ export const ThirdwebProvider = <
|
|||||||
createWalletStorage={createWalletStorage}
|
createWalletStorage={createWalletStorage}
|
||||||
{...restProps}
|
{...restProps}
|
||||||
>
|
>
|
||||||
|
<DappContextProvider>
|
||||||
|
<ThemeProvider theme={theme}>
|
||||||
|
<UIContextProvider>
|
||||||
{children}
|
{children}
|
||||||
</ThirdwebProviderCore>
|
<MainModal />
|
||||||
|
</UIContextProvider>
|
||||||
|
</ThemeProvider>
|
||||||
</DappContextProvider>
|
</DappContextProvider>
|
||||||
|
</ThirdwebProviderCore>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
import { createContext, useContext, useMemo, useState } from "react";
|
||||||
|
import { ModalState } from "../utils/modalTypes";
|
||||||
|
import { ThemeProviderProps } from "../styles/ThemeProvider";
|
||||||
|
import { Theme, darkTheme, lightTheme } from "../styles/theme";
|
||||||
|
import { useAppTheme } from "../styles/hooks";
|
||||||
|
import { useTheme } from "@shopify/restyle";
|
||||||
|
|
||||||
|
type UIContextType = {
|
||||||
|
modalState: ModalState;
|
||||||
|
setModalState: (modalState: ModalState) => void;
|
||||||
|
theme: ThemeProviderProps["theme"];
|
||||||
|
setTheme: (theme: ThemeProviderProps["theme"]) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
const UIContext = createContext<UIContextType>({
|
||||||
|
modalState: {
|
||||||
|
view: "Closed",
|
||||||
|
data: {},
|
||||||
|
isOpen: false,
|
||||||
|
isSheet: true,
|
||||||
|
caller: "init",
|
||||||
|
},
|
||||||
|
setModalState: () => {},
|
||||||
|
theme: darkTheme(),
|
||||||
|
setTheme: () => {},
|
||||||
|
});
|
||||||
|
|
||||||
|
export const UIContextProvider = (props: React.PropsWithChildren<{}>) => {
|
||||||
|
const [modalState, setModalState] = useState<ModalState>({
|
||||||
|
view: "Closed",
|
||||||
|
data: {},
|
||||||
|
isOpen: false,
|
||||||
|
isSheet: true,
|
||||||
|
caller: "init",
|
||||||
|
});
|
||||||
|
|
||||||
|
const providerTheme = useAppTheme();
|
||||||
|
|
||||||
|
const [theme, setTheme] =
|
||||||
|
useState<ThemeProviderProps["theme"]>(providerTheme);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<UIContext.Provider value={{ modalState, setModalState, theme, setTheme }}>
|
||||||
|
{props.children}
|
||||||
|
</UIContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useUIContext = () => {
|
||||||
|
return useContext(UIContext);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useModalState = (): {
|
||||||
|
modalState: ModalState;
|
||||||
|
setModalState: UIContextType["setModalState"];
|
||||||
|
} => {
|
||||||
|
const context = useContext(UIContext);
|
||||||
|
|
||||||
|
return {
|
||||||
|
modalState: context.modalState,
|
||||||
|
setModalState: context.setModalState,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const getThemeObj = (theme?: ThemeProviderProps["theme"]) => {
|
||||||
|
if (theme === "dark" || !theme) {
|
||||||
|
return darkTheme();
|
||||||
|
} else if (theme === "light") {
|
||||||
|
return lightTheme();
|
||||||
|
} else {
|
||||||
|
return theme;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const useGlobalTheme = (theme?: ThemeProviderProps["theme"]): Theme => {
|
||||||
|
const context = useContext(UIContext);
|
||||||
|
const appTheme = useTheme();
|
||||||
|
|
||||||
|
const resultTheme = useMemo(() => {
|
||||||
|
const resp = getThemeObj(theme) || getThemeObj(context.theme) || appTheme;
|
||||||
|
return resp;
|
||||||
|
}, [theme, context, appTheme]);
|
||||||
|
|
||||||
|
return resultTheme;
|
||||||
|
};
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import { WalletConfig } from "@thirdweb-dev/react-core";
|
||||||
|
|
||||||
|
export const CLOSE_MODAL_STATE = (caller: Caller): ModalState => {
|
||||||
|
return {
|
||||||
|
view: "Closed",
|
||||||
|
data: {},
|
||||||
|
isOpen: false,
|
||||||
|
isSheet: true,
|
||||||
|
caller: caller,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ModalView =
|
||||||
|
| "Closed"
|
||||||
|
| "ConnectWalletFlow"
|
||||||
|
| "ChooseWallet"
|
||||||
|
| "WalletUI"
|
||||||
|
| "WalletDetails"
|
||||||
|
| "WCSessionRequest"
|
||||||
|
| "WCSessionProposal";
|
||||||
|
|
||||||
|
export type Caller =
|
||||||
|
| "init"
|
||||||
|
| "ConnectWallet"
|
||||||
|
| "ConnectWalletDetails"
|
||||||
|
| "ConnectWalletDetailsModal"
|
||||||
|
| "ConnectWalletFlow"
|
||||||
|
| "MainModal";
|
||||||
|
|
||||||
|
export type SheetModal = {
|
||||||
|
isOpen: boolean;
|
||||||
|
isSheet: true;
|
||||||
|
caller: Caller;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DialogModal = {
|
||||||
|
isOpen: boolean;
|
||||||
|
isSheet: false;
|
||||||
|
caller: Caller;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ClosedModal = {
|
||||||
|
view: "Closed";
|
||||||
|
data: {};
|
||||||
|
} & SheetModal;
|
||||||
|
|
||||||
|
// connect wallet flow
|
||||||
|
export type ConnectWalletFlowData = {
|
||||||
|
modalTitle?: string;
|
||||||
|
walletConfig?: WalletConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ConnectWalletFlowModal = {
|
||||||
|
view: "ConnectWalletFlow";
|
||||||
|
data: ConnectWalletFlowData;
|
||||||
|
} & SheetModal;
|
||||||
|
|
||||||
|
// wallet details
|
||||||
|
export type WalletDetailsData = {
|
||||||
|
address: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type WalletDetailsModal = {
|
||||||
|
view: "WalletDetails";
|
||||||
|
data: WalletDetailsData;
|
||||||
|
} & SheetModal;
|
||||||
|
|
||||||
|
export type ModalState =
|
||||||
|
| ClosedModal
|
||||||
|
| ConnectWalletFlowModal
|
||||||
|
| WalletDetailsModal;
|
||||||
@@ -1,5 +1,27 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 3.12.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c), [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.22
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
- @thirdweb-dev/react-core@3.12.2
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 3.12.1
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1030](https://github.com/thirdweb-dev/js/pull/1030) [`61212d27`](https://github.com/thirdweb-dev/js/commit/61212d27d7203112a0278893cb67ec94a20408c7) Thanks [@adam-maj](https://github.com/adam-maj)! - Add ability to configure gatewayUrl and pull gatewayUrl from storage in MediaRenderer
|
||||||
|
|
||||||
|
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.21
|
||||||
|
- @thirdweb-dev/react-core@3.12.1
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 3.12.0
|
## 3.12.0
|
||||||
|
|
||||||
### Minor Changes
|
### Minor Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "3.12.0",
|
"version": "3.12.2",
|
||||||
"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",
|
||||||
|
|||||||
@@ -7,7 +7,11 @@ import {
|
|||||||
CarbonPlayFilledAlt,
|
CarbonPlayFilledAlt,
|
||||||
} from "./Icons";
|
} from "./Icons";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
import { resolveIpfsUri, resolveMimeType } from "@thirdweb-dev/react-core";
|
import {
|
||||||
|
resolveIpfsUri,
|
||||||
|
resolveMimeType,
|
||||||
|
useStorage,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
import React, {
|
import React, {
|
||||||
ReactNode,
|
ReactNode,
|
||||||
useEffect,
|
useEffect,
|
||||||
@@ -57,6 +61,10 @@ export interface MediaRendererProps extends SharedMediaProps {
|
|||||||
* The media poster image uri. (if applicable)
|
* The media poster image uri. (if applicable)
|
||||||
*/
|
*/
|
||||||
poster?: string | null;
|
poster?: string | null;
|
||||||
|
/**
|
||||||
|
* The IPFS gateway URL to use
|
||||||
|
*/
|
||||||
|
gatewayUrl?: string;
|
||||||
width?: string;
|
width?: string;
|
||||||
height?: string;
|
height?: string;
|
||||||
}
|
}
|
||||||
@@ -426,6 +434,7 @@ export const MediaRenderer = React.forwardRef<
|
|||||||
src,
|
src,
|
||||||
poster,
|
poster,
|
||||||
alt,
|
alt,
|
||||||
|
gatewayUrl,
|
||||||
requireInteraction = false,
|
requireInteraction = false,
|
||||||
width = "300px",
|
width = "300px",
|
||||||
height = "300px",
|
height = "300px",
|
||||||
@@ -441,8 +450,16 @@ export const MediaRenderer = React.forwardRef<
|
|||||||
height,
|
height,
|
||||||
...style,
|
...style,
|
||||||
};
|
};
|
||||||
const videoOrImageSrc = useResolvedMediaType(src ?? undefined, mimeType);
|
const videoOrImageSrc = useResolvedMediaType(
|
||||||
const possiblePosterSrc = useResolvedMediaType(poster ?? undefined);
|
src ?? undefined,
|
||||||
|
mimeType,
|
||||||
|
gatewayUrl,
|
||||||
|
);
|
||||||
|
const possiblePosterSrc = useResolvedMediaType(
|
||||||
|
poster ?? undefined,
|
||||||
|
undefined,
|
||||||
|
gatewayUrl,
|
||||||
|
);
|
||||||
|
|
||||||
if (!videoOrImageSrc.mimeType) {
|
if (!videoOrImageSrc.mimeType) {
|
||||||
return (
|
return (
|
||||||
@@ -562,8 +579,25 @@ export interface MediaType {
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export function useResolvedMediaType(uri?: string, mimeType?: string) {
|
export function useResolvedMediaType(
|
||||||
const resolvedUrl = useMemo(() => resolveIpfsUri(uri), [uri]);
|
uri?: string,
|
||||||
|
mimeType?: string,
|
||||||
|
gatewayUrl?: string,
|
||||||
|
) {
|
||||||
|
const storage = useStorage();
|
||||||
|
|
||||||
|
const resolvedUrl = useMemo(
|
||||||
|
() =>
|
||||||
|
resolveIpfsUri(
|
||||||
|
uri,
|
||||||
|
gatewayUrl
|
||||||
|
? { gatewayUrl }
|
||||||
|
: storage
|
||||||
|
? { gatewayUrl: storage.gatewayUrls["ipfs://"][0] }
|
||||||
|
: undefined,
|
||||||
|
),
|
||||||
|
[uri, storage, gatewayUrl],
|
||||||
|
);
|
||||||
const resolvedMimType = useQuery(
|
const resolvedMimType = useQuery(
|
||||||
["mime-type", resolvedUrl],
|
["mime-type", resolvedUrl],
|
||||||
() => resolveMimeType(resolvedUrl),
|
() => resolveMimeType(resolvedUrl),
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 3.10.17
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
|
||||||
|
## 3.10.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa), [`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/storage@1.1.3
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
|
||||||
## 3.10.15
|
## 3.10.15
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "3.10.15",
|
"version": "3.10.17",
|
||||||
"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",
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const NATIVE_TOKENS: Record<number, NativeToken> = {
|
|||||||
symbol: "SEP",
|
symbol: "SEP",
|
||||||
decimals: 18,
|
decimals: 18,
|
||||||
wrapped: {
|
wrapped: {
|
||||||
address: "0xD0dF82dE051244f04BfF3A8bB1f62E1cD39eED92",
|
address: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
|
||||||
name: "Wrapped Ether",
|
name: "Wrapped Ether",
|
||||||
symbol: "WETH",
|
symbol: "WETH",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/storage
|
# @thirdweb-dev/storage
|
||||||
|
|
||||||
|
## 1.1.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1037](https://github.com/thirdweb-dev/js/pull/1037) [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa) Thanks [@jnsdls](https://github.com/jnsdls)! - update ipfs gateways - add more fallbacks
|
||||||
|
|
||||||
## 1.1.2
|
## 1.1.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/storage",
|
"name": "@thirdweb-dev/storage",
|
||||||
"version": "1.1.2",
|
"version": "1.1.3",
|
||||||
"main": "dist/thirdweb-dev-storage.cjs.js",
|
"main": "dist/thirdweb-dev-storage.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-storage.esm.js",
|
"module": "dist/thirdweb-dev-storage.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -6,9 +6,14 @@ import { GatewayUrls } from "../types";
|
|||||||
export const DEFAULT_GATEWAY_URLS: GatewayUrls = {
|
export const DEFAULT_GATEWAY_URLS: GatewayUrls = {
|
||||||
// Note: Gateway URLs should have trailing slashes (we clean this on user input)
|
// Note: Gateway URLs should have trailing slashes (we clean this on user input)
|
||||||
"ipfs://": [
|
"ipfs://": [
|
||||||
"https://ipfs.thirdwebcdn.com/ipfs/",
|
"https://ipfs-2.thirdwebcdn.com/ipfs/",
|
||||||
|
"https://ipfs-3.thirdwebcdn.com/ipfs/",
|
||||||
|
"https://ipfs-4.thirdwebcdn.com/ipfs/",
|
||||||
|
"https://ipfs-5.thirdwebcdn.com/ipfs/",
|
||||||
"https://cloudflare-ipfs.com/ipfs/",
|
"https://cloudflare-ipfs.com/ipfs/",
|
||||||
"https://ipfs.io/ipfs/",
|
"https://ipfs.io/ipfs/",
|
||||||
|
// TODO this one can become the default again once it's stable (no more VT issues)
|
||||||
|
"https://ipfs.thirdwebcdn.com/ipfs/",
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,26 @@
|
|||||||
# @thirdweb-dev/unity-js-bridge
|
# @thirdweb-dev/unity-js-bridge
|
||||||
|
|
||||||
|
## 0.2.32
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.22
|
||||||
|
- @thirdweb-dev/auth@3.0.21
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 0.2.31
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1038](https://github.com/thirdweb-dev/js/pull/1038) [`58df84f8`](https://github.com/thirdweb-dev/js/commit/58df84f8baff1b1c15b834326b305be68ad1f402) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - Added MagicLink and passing email to Connect
|
||||||
|
|
||||||
|
- Updated dependencies [[`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf), [`d5123044`](https://github.com/thirdweb-dev/js/commit/d51230441a097734be092c42b45dea07629e65fa)]:
|
||||||
|
- @thirdweb-dev/wallets@0.2.21
|
||||||
|
- @thirdweb-dev/storage@1.1.3
|
||||||
|
- @thirdweb-dev/auth@3.0.20
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 0.2.30
|
## 0.2.30
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/unity-js-bridge",
|
"name": "@thirdweb-dev/unity-js-bridge",
|
||||||
"version": "0.2.30",
|
"version": "0.2.32",
|
||||||
"main": "dist/thirdweb-unity-bridge.js",
|
"main": "dist/thirdweb-unity-bridge.js",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { LocalWallet } from "@thirdweb-dev/wallets/evm/wallets/local-wallet";
|
|||||||
import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers";
|
import { EthersWallet } from "@thirdweb-dev/wallets/evm/wallets/ethers";
|
||||||
import { InjectedWallet } from "@thirdweb-dev/wallets/evm/wallets/injected";
|
import { InjectedWallet } from "@thirdweb-dev/wallets/evm/wallets/injected";
|
||||||
import { MetaMaskWallet } from "@thirdweb-dev/wallets/evm/wallets/metamask";
|
import { MetaMaskWallet } from "@thirdweb-dev/wallets/evm/wallets/metamask";
|
||||||
|
import { MagicLink } from "@thirdweb-dev/wallets/evm/wallets/magic";
|
||||||
import { BigNumber } from "ethers";
|
import { BigNumber } from "ethers";
|
||||||
import type { ContractInterface, Signer } from "ethers";
|
import type { ContractInterface, Signer } from "ethers";
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ const WALLETS = [
|
|||||||
WalletConnectV1,
|
WalletConnectV1,
|
||||||
CoinbaseWallet,
|
CoinbaseWallet,
|
||||||
LocalWallet,
|
LocalWallet,
|
||||||
|
MagicLink,
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
type PossibleWallet = (typeof WALLETS)[number]["id"];
|
type PossibleWallet = (typeof WALLETS)[number]["id"];
|
||||||
@@ -59,7 +61,12 @@ type FundWalletInput = FundWalletOptions & {
|
|||||||
|
|
||||||
interface TWBridge {
|
interface TWBridge {
|
||||||
initialize: (chain: ChainIdOrName, options: string) => void;
|
initialize: (chain: ChainIdOrName, options: string) => void;
|
||||||
connect: (wallet: PossibleWallet, chainId?: number) => Promise<string>;
|
connect: (
|
||||||
|
wallet: PossibleWallet,
|
||||||
|
chainId?: number,
|
||||||
|
password?: string,
|
||||||
|
email?: string,
|
||||||
|
) => Promise<string>;
|
||||||
disconnect: () => Promise<void>;
|
disconnect: () => Promise<void>;
|
||||||
switchNetwork: (chainId: number) => Promise<void>;
|
switchNetwork: (chainId: number) => Promise<void>;
|
||||||
invoke: (route: string, payload: string) => Promise<string | undefined>;
|
invoke: (route: string, payload: string) => Promise<string | undefined>;
|
||||||
@@ -152,6 +159,12 @@ class ThirdwebBridge implements TWBridge {
|
|||||||
dappMetadata,
|
dappMetadata,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case walletIds.magicLink:
|
||||||
|
walletInstance = new MagicLink({
|
||||||
|
apiKey: sdkOptions.wallet?.magicLinkApiKey,
|
||||||
|
emailLogin: true,
|
||||||
|
});
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error(`Unknown wallet type: ${possibleWallet.id}`);
|
throw new Error(`Unknown wallet type: ${possibleWallet.id}`);
|
||||||
}
|
}
|
||||||
@@ -173,6 +186,7 @@ class ThirdwebBridge implements TWBridge {
|
|||||||
wallet: PossibleWallet = "injected",
|
wallet: PossibleWallet = "injected",
|
||||||
chainId?: number | undefined,
|
chainId?: number | undefined,
|
||||||
password?: string,
|
password?: string,
|
||||||
|
email?: string,
|
||||||
) {
|
) {
|
||||||
if (!this.activeSDK) {
|
if (!this.activeSDK) {
|
||||||
throw new Error("SDK not initialized");
|
throw new Error("SDK not initialized");
|
||||||
@@ -209,7 +223,15 @@ class ThirdwebBridge implements TWBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (walletInstance.walletId === walletIds.magicLink) {
|
||||||
|
const magicLinkWallet = walletInstance as MagicLink;
|
||||||
|
if (!email) {
|
||||||
|
throw new Error("Email is required for Magic Link Wallet");
|
||||||
|
}
|
||||||
|
await magicLinkWallet.connect({ chainId, email });
|
||||||
|
} else {
|
||||||
await walletInstance.connect({ chainId });
|
await walletInstance.connect({ chainId });
|
||||||
|
}
|
||||||
this.activeWallet = walletInstance;
|
this.activeWallet = walletInstance;
|
||||||
this.updateSDKSigner(await walletInstance.getSigner());
|
this.updateSDKSigner(await walletInstance.getSigner());
|
||||||
return await this.activeSDK.wallet.getAddress();
|
return await this.activeSDK.wallet.getAddress();
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# @thirdweb-dev/wallets
|
# @thirdweb-dev/wallets
|
||||||
|
|
||||||
|
## 0.2.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1040](https://github.com/thirdweb-dev/js/pull/1040) [`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Deploy SmartWallet before signing messages
|
||||||
|
|
||||||
|
- Updated dependencies [[`30e5593d`](https://github.com/thirdweb-dev/js/commit/30e5593dd1ce9abd809ad216a1cfce77b897093c)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.18
|
||||||
|
- @thirdweb-dev/sdk@3.10.17
|
||||||
|
|
||||||
|
## 0.2.21
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1034](https://github.com/thirdweb-dev/js/pull/1034) [`b6f48e10`](https://github.com/thirdweb-dev/js/commit/b6f48e1088b5d36a51103de4afda53179029faaf) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Expose overrideable paymasterAPI in SmartWalletConfig
|
||||||
|
|
||||||
|
- Updated dependencies [[`3c8c5d56`](https://github.com/thirdweb-dev/js/commit/3c8c5d56f2a21c0918fede71061c6745f2956f83), [`907d97be`](https://github.com/thirdweb-dev/js/commit/907d97bedef7331148bdfe8b9bf1e19459282e4c)]:
|
||||||
|
- @thirdweb-dev/chains@0.1.17
|
||||||
|
- @thirdweb-dev/sdk@3.10.16
|
||||||
|
|
||||||
## 0.2.20
|
## 0.2.20
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/wallets",
|
"name": "@thirdweb-dev/wallets",
|
||||||
"version": "0.2.20",
|
"version": "0.2.22",
|
||||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||||
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
|
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
|||||||
entryPointAddress,
|
entryPointAddress,
|
||||||
bundlerUrl,
|
bundlerUrl,
|
||||||
paymasterAPI: this.config.gasless
|
paymasterAPI: this.config.gasless
|
||||||
? getVerifyingPaymaster(
|
? this.config.paymasterAPI
|
||||||
|
? this.config.paymasterAPI
|
||||||
|
: getVerifyingPaymaster(
|
||||||
paymasterUrl,
|
paymasterUrl,
|
||||||
entryPointAddress,
|
entryPointAddress,
|
||||||
this.config.thirdwebApiKey,
|
this.config.thirdwebApiKey,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
} from "@account-abstraction/sdk";
|
} from "@account-abstraction/sdk";
|
||||||
import { TransactionDetailsForUserOp } from "./transaction-details";
|
import { TransactionDetailsForUserOp } from "./transaction-details";
|
||||||
import { getUserOpHashV06 } from "./utils";
|
import { getUserOpHashV06 } from "./utils";
|
||||||
|
import { DUMMY_PAYMASTER_AND_DATA, SIG_SIZE } from "./paymaster";
|
||||||
|
|
||||||
export interface BaseApiParams {
|
export interface BaseApiParams {
|
||||||
provider: providers.Provider;
|
provider: providers.Provider;
|
||||||
@@ -121,10 +122,7 @@ export abstract class BaseAccountAPI {
|
|||||||
this.getAccountAddress(),
|
this.getAccountAddress(),
|
||||||
);
|
);
|
||||||
if (senderAddressCode.length > 2) {
|
if (senderAddressCode.length > 2) {
|
||||||
// console.log(`SimpleAccount Contract already deployed at ${this.senderAddress}`)
|
|
||||||
this.isPhantom = false;
|
this.isPhantom = false;
|
||||||
} else {
|
|
||||||
// console.log(`SimpleAccount Contract is NOT YET deployed at ${this.senderAddress} - working in "phantom account" mode.`)
|
|
||||||
}
|
}
|
||||||
return this.isPhantom;
|
return this.isPhantom;
|
||||||
}
|
}
|
||||||
@@ -303,24 +301,45 @@ export abstract class BaseAccountAPI {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let paymasterAndData: string | undefined;
|
let paymasterAndData: string | undefined;
|
||||||
|
let userOp = partialUserOp;
|
||||||
if (this.paymasterAPI) {
|
if (this.paymasterAPI) {
|
||||||
// fill (partial) preVerificationGas (all except the cost of the generated paymasterAndData)
|
// fill (partial) preVerificationGas (all except the cost of the generated paymasterAndData)
|
||||||
paymasterAndData = await this.paymasterAPI.getPaymasterAndData(
|
try {
|
||||||
partialUserOp,
|
// userOp.preVerificationGas contains a promise that will resolve to an error.
|
||||||
);
|
await ethers.utils.resolveProperties(userOp);
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
} catch (_) {}
|
||||||
|
const pmOp: Partial<UserOperationStruct> = {
|
||||||
|
sender: userOp.sender,
|
||||||
|
nonce: userOp.nonce,
|
||||||
|
initCode: userOp.initCode,
|
||||||
|
callData: userOp.callData,
|
||||||
|
callGasLimit: userOp.callGasLimit,
|
||||||
|
verificationGasLimit: userOp.verificationGasLimit,
|
||||||
|
maxFeePerGas: userOp.maxFeePerGas,
|
||||||
|
maxPriorityFeePerGas: userOp.maxPriorityFeePerGas,
|
||||||
|
// A dummy value here is required in order to calculate a correct preVerificationGas value.
|
||||||
|
paymasterAndData: DUMMY_PAYMASTER_AND_DATA,
|
||||||
|
signature: ethers.utils.hexlify(Buffer.alloc(SIG_SIZE, 1)),
|
||||||
|
};
|
||||||
|
userOp = await ethers.utils.resolveProperties(pmOp);
|
||||||
|
const preVerificationGas = calcPreVerificationGas(userOp);
|
||||||
|
userOp.preVerificationGas = preVerificationGas;
|
||||||
|
paymasterAndData = await this.paymasterAPI.getPaymasterAndData(userOp);
|
||||||
if (paymasterAndData === "0x") {
|
if (paymasterAndData === "0x") {
|
||||||
paymasterAndData = undefined;
|
paymasterAndData = undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (paymasterAndData) {
|
if (paymasterAndData) {
|
||||||
partialUserOp.paymasterAndData = paymasterAndData;
|
userOp.paymasterAndData = paymasterAndData;
|
||||||
return {
|
return {
|
||||||
...partialUserOp,
|
...userOp,
|
||||||
signature: "",
|
signature: "",
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
const modifiedOp = {
|
const modifiedOp = {
|
||||||
...partialUserOp,
|
...userOp,
|
||||||
paymasterAndData: "0x",
|
paymasterAndData: "0x",
|
||||||
};
|
};
|
||||||
modifiedOp.preVerificationGas = await this.getPreVerificationGas(
|
modifiedOp.preVerificationGas = await this.getPreVerificationGas(
|
||||||
|
|||||||
@@ -122,6 +122,17 @@ export class ERC4337EthersSigner extends Signer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async signMessage(message: Bytes | string): Promise<string> {
|
async signMessage(message: Bytes | string): Promise<string> {
|
||||||
|
const isNotDeployed = await this.smartAccountAPI.checkAccountPhantom();
|
||||||
|
if (isNotDeployed) {
|
||||||
|
console.log(
|
||||||
|
"Account contract not deployed yet. Deploying account before signing message",
|
||||||
|
);
|
||||||
|
const tx = await this.sendTransaction({
|
||||||
|
to: await this.getAddress(),
|
||||||
|
data: "0x",
|
||||||
|
});
|
||||||
|
await tx.wait();
|
||||||
|
}
|
||||||
return await this.originalSigner.signMessage(message);
|
return await this.originalSigner.signMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { ethers } from "ethers";
|
import { PaymasterAPI } from "@account-abstraction/sdk";
|
||||||
import { PaymasterAPI, calcPreVerificationGas } from "@account-abstraction/sdk";
|
|
||||||
import { UserOperationStruct } from "@account-abstraction/contracts";
|
import { UserOperationStruct } from "@account-abstraction/contracts";
|
||||||
import { toJSON } from "./utils";
|
import { toJSON } from "./utils";
|
||||||
import fetch from "cross-fetch";
|
import fetch from "cross-fetch";
|
||||||
|
|
||||||
const SIG_SIZE = 65;
|
export const SIG_SIZE = 65;
|
||||||
const DUMMY_PAYMASTER_AND_DATA =
|
export const DUMMY_PAYMASTER_AND_DATA =
|
||||||
"0x0101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000001010101010100000000000000000000000000000000000000000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";
|
"0x0101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000001010101010100000000000000000000000000000000000000000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";
|
||||||
|
|
||||||
class VerifyingPaymasterAPI extends PaymasterAPI {
|
class VerifyingPaymasterAPI extends PaymasterAPI {
|
||||||
@@ -22,32 +21,6 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
|
|||||||
async getPaymasterAndData(
|
async getPaymasterAndData(
|
||||||
userOp: Partial<UserOperationStruct>,
|
userOp: Partial<UserOperationStruct>,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
// Hack: userOp includes empty paymasterAndData which calcPreVerificationGas requires.
|
|
||||||
try {
|
|
||||||
// userOp.preVerificationGas contains a promise that will resolve to an error.
|
|
||||||
await ethers.utils.resolveProperties(userOp);
|
|
||||||
// eslint-disable-next-line no-empty
|
|
||||||
} catch (_) {}
|
|
||||||
const pmOp: Partial<UserOperationStruct> = {
|
|
||||||
sender: userOp.sender,
|
|
||||||
nonce: userOp.nonce,
|
|
||||||
initCode: userOp.initCode,
|
|
||||||
callData: userOp.callData,
|
|
||||||
callGasLimit: userOp.callGasLimit,
|
|
||||||
verificationGasLimit: userOp.verificationGasLimit,
|
|
||||||
maxFeePerGas: userOp.maxFeePerGas,
|
|
||||||
maxPriorityFeePerGas: userOp.maxPriorityFeePerGas,
|
|
||||||
// A dummy value here is required in order to calculate a correct preVerificationGas value.
|
|
||||||
paymasterAndData: DUMMY_PAYMASTER_AND_DATA,
|
|
||||||
signature: ethers.utils.hexlify(Buffer.alloc(SIG_SIZE, 1)),
|
|
||||||
};
|
|
||||||
const op = await ethers.utils.resolveProperties(pmOp);
|
|
||||||
|
|
||||||
const preVerificationGas = calcPreVerificationGas(op);
|
|
||||||
op.preVerificationGas = preVerificationGas;
|
|
||||||
// TODO refactor this code out instead of modifying the passed-in userOp in place
|
|
||||||
userOp.preVerificationGas = preVerificationGas;
|
|
||||||
|
|
||||||
// Ask the paymaster to sign the transaction and return a valid paymasterAndData value.
|
// Ask the paymaster to sign the transaction and return a valid paymasterAndData value.
|
||||||
try {
|
try {
|
||||||
const response = await fetch(this.paymasterUrl, {
|
const response = await fetch(this.paymasterUrl, {
|
||||||
@@ -60,7 +33,7 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
|
|||||||
jsonrpc: "2.0",
|
jsonrpc: "2.0",
|
||||||
id: 1,
|
id: 1,
|
||||||
method: "pm_sponsorUserOperation",
|
method: "pm_sponsorUserOperation",
|
||||||
params: [await toJSON(op), { entryPoint: this.entryPoint }],
|
params: [await toJSON(userOp), { entryPoint: this.entryPoint }],
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const res = await response.json();
|
const res = await response.json();
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export type SmartWalletConfig = {
|
|||||||
gasless: boolean;
|
gasless: boolean;
|
||||||
bundlerUrl?: string;
|
bundlerUrl?: string;
|
||||||
paymasterUrl?: string;
|
paymasterUrl?: string;
|
||||||
|
paymasterAPI?: PaymasterAPI;
|
||||||
entryPointAddress?: string;
|
entryPointAddress?: string;
|
||||||
} & ContractInfoInput;
|
} & ContractInfoInput;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { walletIds } from "../constants/walletIds";
|
|||||||
// export types and utils for convenience
|
// export types and utils for convenience
|
||||||
export * from "../connectors/smart-wallet/types";
|
export * from "../connectors/smart-wallet/types";
|
||||||
export * from "../connectors/smart-wallet/utils";
|
export * from "../connectors/smart-wallet/utils";
|
||||||
|
export type { PaymasterAPI } from "@account-abstraction/sdk";
|
||||||
|
|
||||||
export class SmartWallet extends AbstractClientWallet<
|
export class SmartWallet extends AbstractClientWallet<
|
||||||
SmartWalletConfig,
|
SmartWalletConfig,
|
||||||
|
|||||||
Generated
+22
-22
@@ -44,8 +44,8 @@ importers:
|
|||||||
specifier: ^2.8.7
|
specifier: ^2.8.7
|
||||||
version: 2.8.7
|
version: 2.8.7
|
||||||
turbo:
|
turbo:
|
||||||
specifier: ^1.8.8
|
specifier: ^1.9.8
|
||||||
version: 1.8.8
|
version: 1.9.8
|
||||||
yalc:
|
yalc:
|
||||||
specifier: 1.0.0-pre.53
|
specifier: 1.0.0-pre.53
|
||||||
version: 1.0.0-pre.53
|
version: 1.0.0-pre.53
|
||||||
@@ -26962,65 +26962,65 @@ packages:
|
|||||||
yargs: 17.7.1
|
yargs: 17.7.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/turbo-darwin-64@1.8.8:
|
/turbo-darwin-64@1.9.8:
|
||||||
resolution: {integrity: sha512-18cSeIm7aeEvIxGyq7PVoFyEnPpWDM/0CpZvXKHpQ6qMTkfNt517qVqUTAwsIYqNS8xazcKAqkNbvU1V49n65Q==}
|
resolution: {integrity: sha512-PkTdBjPfgpj/Dob/6SjkzP0BBP80/KmFjLEocXVEECCLJE6tHKbWLRdvc79B0N6SufdYdZ1uvvoU3KPtBokSPw==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo-darwin-arm64@1.8.8:
|
/turbo-darwin-arm64@1.9.8:
|
||||||
resolution: {integrity: sha512-ruGRI9nHxojIGLQv1TPgN7ud4HO4V8mFBwSgO6oDoZTNuk5ybWybItGR+yu6fni5vJoyMHXOYA2srnxvOc7hjQ==}
|
resolution: {integrity: sha512-sLwqOx3XV57QCEoJM9GnDDnnqidG8wf29ytxssBaWHBdeJTjupyrmzTUrX+tyKo3Q+CjWvbPLyqVqxT4g5NuXQ==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo-linux-64@1.8.8:
|
/turbo-linux-64@1.9.8:
|
||||||
resolution: {integrity: sha512-N/GkHTHeIQogXB1/6ZWfxHx+ubYeb8Jlq3b/3jnU4zLucpZzTQ8XkXIAfJG/TL3Q7ON7xQ8yGOyGLhHL7MpFRg==}
|
resolution: {integrity: sha512-AMg6VT6sW7aOD1uOs5suxglXfTYz9T0uVyKGKokDweGOYTWmuTMGU5afUT1tYRUwQ+kVPJI+83Atl5Ob0oBsgw==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo-linux-arm64@1.8.8:
|
/turbo-linux-arm64@1.9.8:
|
||||||
resolution: {integrity: sha512-hKqLbBHgUkYf2Ww8uBL9UYdBFQ5677a7QXdsFhONXoACbDUPvpK4BKlz3NN7G4NZ+g9dGju+OJJjQP0VXRHb5w==}
|
resolution: {integrity: sha512-tLnxFv+OIklwTjiOZ8XMeEeRDAf150Ry4BCivNwgTVFAqQGEqkFP6KGBy56hb5RRF1frPQpoPGipJNVm7c8m1w==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo-windows-64@1.8.8:
|
/turbo-windows-64@1.9.8:
|
||||||
resolution: {integrity: sha512-2ndjDJyzkNslXxLt+PQuU21AHJWc8f6MnLypXy3KsN4EyX/uKKGZS0QJWz27PeHg0JS75PVvhfFV+L9t9i+Yyg==}
|
resolution: {integrity: sha512-r3pCjvXTMR7kq2E3iqwFlN1R7pFO/TOsuUjMhOSPP7HwuuUIinAckU4I9foM3q7ZCQd1XXScBUt3niDyHijAqQ==}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo-windows-arm64@1.8.8:
|
/turbo-windows-arm64@1.9.8:
|
||||||
resolution: {integrity: sha512-xCA3oxgmW9OMqpI34AAmKfOVsfDljhD5YBwgs0ZDsn5h3kCHhC4x9W5dDk1oyQ4F5EXSH3xVym5/xl1J6WRpUg==}
|
resolution: {integrity: sha512-CWzRbX2TM5IfHBC6uWM659qUOEDC4h0nn16ocG8yIq1IF3uZMzKRBHgGOT5m1BHom+R08V0NcjTmPRoqpiI0dg==}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/turbo@1.8.8:
|
/turbo@1.9.8:
|
||||||
resolution: {integrity: sha512-qYJ5NjoTX+591/x09KgsDOPVDUJfU9GoS+6jszQQlLp1AHrf1wRFA3Yps8U+/HTG03q0M4qouOfOLtRQP4QypA==}
|
resolution: {integrity: sha512-dTouGZBm4a2fE0OPafcTQERCp4i3ZOow0Pr0JlOyxKmzJy0JRwXypH013kbZoK6k1ET5tS/g9rwUXIM/AmWXXQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
requiresBuild: true
|
requiresBuild: true
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
turbo-darwin-64: 1.8.8
|
turbo-darwin-64: 1.9.8
|
||||||
turbo-darwin-arm64: 1.8.8
|
turbo-darwin-arm64: 1.9.8
|
||||||
turbo-linux-64: 1.8.8
|
turbo-linux-64: 1.9.8
|
||||||
turbo-linux-arm64: 1.8.8
|
turbo-linux-arm64: 1.9.8
|
||||||
turbo-windows-64: 1.8.8
|
turbo-windows-64: 1.9.8
|
||||||
turbo-windows-arm64: 1.8.8
|
turbo-windows-arm64: 1.9.8
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/[email protected]:
|
/[email protected]:
|
||||||
|
|||||||
Reference in New Issue
Block a user