Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
8febea4db0 Version Packages (#1041)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-21 13:45:57 -07:00
Joaquim VergesandGitHub 30e5593dd1 [Wallets] deploy smart wallet contract before signing messages (#1040) 2023-05-20 21:01:38 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
f253909710 Version Packages (#1032)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-19 14:39:22 -07:00
iketwandGitHub 99ffa8ce3b [RN] Single global modal (#1025) 2023-05-19 18:09:49 +00:00
Adam MajmudarandGitHub 61212d27d7 [React] Add ability to configure gatewayUrl on MediaRenderer (#1030) 2023-05-19 18:09:28 +00:00
FirekeeperandGitHub 58df84f8ba [unity-js-bridge] MagicLink bridge integration (#1038) 2023-05-19 17:49:18 +00:00
Joaquim VergesandGitHub b6f48e1088 [Wallets] Expose overrideable paymasterAPI in SmartWalletConfig (#1034) 2023-05-19 17:48:51 +00:00
Jonas DanielsandGitHub d51230441a [storage] - update ipfs gateway and add additional fallbacks (#1037) 2023-05-19 16:54:40 +00:00
MykandGitHub 01e83b6f13 update sepolia weth to an address that does not have a mint function (#1036) 2023-05-19 16:43:04 +00:00
Joaquim VergesandGitHub 907d97bede [Chains] Added faucet for optimism goerli (#1033) 2023-05-19 03:52:48 +00:00
Jonas DanielsandGitHub 3c8c5d56f2 Jd/add xrp ledger (#1031) 2023-05-19 03:19:26 +00:00
81 changed files with 1432 additions and 528 deletions
+1 -1
View File
@@ -46,7 +46,7 @@
"eslint": "^8.37.0",
"mocha": "^10.2.0",
"prettier": "^2.8.7",
"turbo": "^1.8.8",
"turbo": "^1.9.8",
"yalc": "1.0.0-pre.53"
},
"manypkg": {
+14
View File
@@ -1,5 +1,19 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.19",
"version": "3.0.21",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+14
View File
@@ -1,5 +1,19 @@
# @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
### Patch Changes
+18 -3
View File
@@ -10,9 +10,24 @@ export default {
},
"rpc": [
"https://fibonacci.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://node1.fibo-api.asia"
"https://node1.fibo-api.asia",
"https://node2.fibo-api.asia",
"https://node3.fibo-api.asia",
"https://node4.fibo-api.asia",
"https://node5.fibo-api.asia",
"https://node6.fibo-api.asia",
"https://node7.fibo-api.asia",
"https://node1.fibo-rpc.asia",
"https://node2.fibo-rpc.asia",
"https://node3.fibo-rpc.asia",
"https://node4.fibo-rpc.asia",
"https://node5.fibo-rpc.asia",
"https://node6.fibo-rpc.asia",
"https://node7.fibo-rpc.asia"
],
"faucets": [
"https://test.fibochain.org/faucets"
],
"faucets": [],
"nativeCurrency": {
"name": "FIBONACCI UTILITY TOKEN",
"symbol": "FIBO",
@@ -29,6 +44,6 @@ export default {
"standard": "EIP3091"
}
],
"testnet": false,
"testnet": true,
"slug": "fibonacci"
} as const satisfies Chain;
+31
View File
@@ -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;
+2 -2
View File
@@ -11,8 +11,8 @@ export default {
"rpc": [
"https://dogechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.dogechain.dog",
"https://rpc-us.dogechain.dog",
"https://rpc01.dogechain.dog"
"https://rpc01-sg.dogechain.dog",
"https://rpc.ankr.com/dogechain"
],
"faucets": [],
"nativeCurrency": {
+3 -3
View File
@@ -1,6 +1,6 @@
import type { Chain } from "../src/types";
export default {
"name": "Metaplayerone Network",
"name": "Metaplayerone Dubai Testnet",
"chain": "MP1 Dubai-Testnet",
"icon": {
"url": "ipfs://QmfJKxmubJrqYWDcR2PnPvmpukxPz4fYDu3hqTaSnpJDxC",
@@ -9,7 +9,7 @@ export default {
"format": "svg"
},
"rpc": [
"https://metaplayerone-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://metaplayerone-dubai-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-dubai.mp1network.com/"
],
"faucets": [],
@@ -36,5 +36,5 @@ export default {
}
],
"testnet": true,
"slug": "metaplayerone-network"
"slug": "metaplayerone-dubai-testnet"
} as const satisfies Chain;
+14 -2
View File
@@ -5,7 +5,7 @@ export default {
"chain": "Kanazawa",
"rpc": [
"https://kanazawa.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-kanazawa.meldlabs.dev/ext/bc/2Ci7VYrUd4fTBqGA5D2HA6UPHzQ4LQyr8rZQww9MGSv9rNkRzn/rpc"
"https://subnets.avax.network/meld/testnet/rpc"
],
"faucets": [],
"features": [],
@@ -24,7 +24,19 @@ export default {
"shortName": "kanazawa",
"chainId": 222000222,
"networkId": 222000222,
"explorers": [],
"explorers": [
{
"name": "explorer",
"url": "https://subnets-test.avax.network/meld",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "kanazawa"
} as const satisfies Chain;
+43
View File
@@ -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;
+6
View File
@@ -2,6 +2,12 @@ import type { Chain } from "../src/types";
export default {
"name": "LaChain",
"chain": "LaChain",
"icon": {
"url": "ipfs://bafkreiecoqvit2mikpbpbtzy2zrn6e7fvqdegm72sdcathdwmgiyuzey7u",
"width": 104,
"height": 114,
"format": "png"
},
"rpc": [
"https://lachain-lachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc1.mainnet.lachain.network",
+48
View File
@@ -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;
+49
View File
@@ -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;
+14 -2
View File
@@ -5,7 +5,7 @@ export default {
"chain": "MELD",
"rpc": [
"https://meld.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://network-rpc.meld.com"
"https://subnets.avax.network/meld/mainnet/rpc"
],
"faucets": [],
"features": [],
@@ -24,7 +24,19 @@ export default {
"shortName": "meld",
"chainId": 333000333,
"networkId": 333000333,
"explorers": [],
"explorers": [
{
"name": "explorer",
"url": "https://subnets.avax.network/meld",
"icon": {
"url": "ipfs://QmRhB4AbjDrhvwfSAQi2JvKirFiDWxzJvKEvG8S8AdDdED",
"width": 4000,
"height": 4000,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "meld"
} as const satisfies Chain;
+15 -3
View File
@@ -1,6 +1,6 @@
import type { Chain } from "../src/types";
export default {
"name": "PulseChain Mainnet",
"name": "PulseChain",
"shortName": "pls",
"chain": "PLS",
"chainId": 369,
@@ -8,10 +8,22 @@ export default {
"infoURL": "https://pulsechain.com/",
"rpc": [
"https://pulsechain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.mainnet.pulsechain.com/",
"wss://rpc.mainnet.pulsechain.com/"
"https://rpc.pulsechain.com/",
"wss://rpc.pulsechain.com/"
],
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"faucets": [],
"ens": {
"registry": "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
},
"status": "incubating",
"nativeCurrency": {
"name": "Pulse",
"symbol": "PLS",
+1
View File
@@ -4,6 +4,7 @@ export default {
"chain": "FTM",
"rpc": [
"https://fantom-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://fantom-testnet.publicnode.com",
"https://rpc.testnet.fantom.network"
],
"faucets": [
+7
View File
@@ -18,6 +18,13 @@ export default {
"shortName": "TelosEVMTestnet",
"chainId": 41,
"networkId": 41,
"explorers": [
{
"name": "teloscan",
"url": "https://testnet.teloscan.io",
"standard": "EIP3091"
}
],
"testnet": true,
"icon": {
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
+12 -6
View File
@@ -1,16 +1,22 @@
import type { Chain } from "../src/types";
export default {
"name": "LA Testnet",
"chain": "LATestnet",
"name": "LaTestnet",
"chain": "LaTestnet",
"icon": {
"url": "ipfs://bafkreiecoqvit2mikpbpbtzy2zrn6e7fvqdegm72sdcathdwmgiyuzey7u",
"width": 104,
"height": 114,
"format": "png"
},
"rpc": [
"https://la-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://latestnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.testnet.lachain.network"
],
"faucets": [
"https://faucet.lachain.network"
],
"nativeCurrency": {
"name": "Test La Coin",
"name": "Test LaCoin",
"symbol": "TLA",
"decimals": 18
},
@@ -25,11 +31,11 @@ export default {
"networkId": 418,
"explorers": [
{
"name": "LA Testnet Explorer",
"name": "LaTestnet Explorer",
"url": "https://testexplorer.lachain.network",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "la-testnet"
"slug": "latestnet"
} as const satisfies Chain;
+3 -1
View File
@@ -8,7 +8,9 @@ export default {
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://goerli.optimism.io/"
],
"faucets": [],
"faucets": [
"https://coinbase.com/faucets/optimism-goerli-faucet"
],
"nativeCurrency": {
"name": "Goerli Ether",
"symbol": "ETH",
+2 -1
View File
@@ -11,7 +11,8 @@ export default {
"rpc": [
"https://avalanche-fuji.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}",
"https://api.avax-test.network/ext/bc/C/rpc"
"https://api.avax-test.network/ext/bc/C/rpc",
"https://avalanche-fuji-c-chain.publicnode.com"
],
"faucets": [
"https://faucet.avax.network/",
+2 -1
View File
@@ -8,7 +8,8 @@ export default {
"https://eth-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
"https://goerli.infura.io/v3/${INFURA_API_KEY}",
"wss://goerli.infura.io/v3/${INFURA_API_KEY}",
"https://rpc.goerli.mudit.blog/"
"https://rpc.goerli.mudit.blog/",
"https://ethereum-goerli.publicnode.com"
],
"faucets": [
"https://faucet.paradigm.xyz/",
+4 -4
View File
@@ -1,8 +1,8 @@
import type { Chain } from "../src/types";
export default {
"name": "Sahara",
"name": "Fastex Chain (Bahamut)",
"title": "Bahamut mainnet Sahara",
"chain": "Bahamut",
"chain": "Fastex Chain (Bahamut)",
"icon": {
"url": "ipfs://QmSemioP83RXnDWwTZbet8VpwJxcFRboX4B3pcdhLZGodP",
"width": 200,
@@ -10,7 +10,7 @@ export default {
"format": "png"
},
"rpc": [
"https://sahara.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://fastex-chain-bahamut.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc1.sahara.bahamutchain.com",
"https://rpc2.sahara.bahamutchain.com"
],
@@ -40,5 +40,5 @@ export default {
}
],
"testnet": false,
"slug": "sahara"
"slug": "fastex-chain-bahamut"
} as const satisfies Chain;
+5
View File
@@ -22,6 +22,11 @@ export default {
"name": "Scroll Alpha Testnet Block Explorer",
"url": "https://blockscout.scroll.io",
"standard": "EIP3091"
},
{
"name": "Scroll Alpha Testnet Block Explorer",
"url": "https://scrollexplorer.unifra.io",
"standard": "EIP3091"
}
],
"parent": {
+2 -1
View File
@@ -15,7 +15,8 @@ export default {
"https://polygon-mumbai.infura.io/v3/${INFURA_API_KEY}",
"https://matic-mumbai.chainstacklabs.com",
"https://rpc-mumbai.maticvigil.com",
"https://matic-testnet-archive-rpc.bwarelabs.com"
"https://matic-testnet-archive-rpc.bwarelabs.com",
"https://polygon-mumbai-bor.publicnode.com"
],
"faucets": [
"https://faucet.polygon.technology/"
+48
View File
@@ -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;
+1
View File
@@ -4,6 +4,7 @@ export default {
"chain": "BSC",
"rpc": [
"https://binance-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://bsc-testnet.publicnode.com",
"https://data-seed-prebsc-2-s3.binance.org:8545",
"https://data-seed-prebsc-1-s3.binance.org:8545",
"https://data-seed-prebsc-2-s2.binance.org:8545",
@@ -0,0 +1,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",
},
],
};
+1
View File
@@ -13,4 +13,5 @@ export default {
"https://optimism-goerli.infura.io/v3/${INFURA_API_KEY}",
"https://opt-goerli.g.alchemy.com/v2/${ALCHEMY_API_KEY}",
],
faucets: ["https://coinbase.com/faucets/optimism-goerli-faucet"],
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.16",
"version": "0.1.18",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
File diff suppressed because one or more lines are too long
+19
View File
@@ -1,5 +1,24 @@
# 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
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.10.16",
"version": "0.10.18",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
-15
View File
@@ -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
*/
+21
View File
@@ -1,5 +1,26 @@
# @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
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"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",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,9 +0,0 @@
export const DEFAULT_IPFS_GATEWAY = "https://ipfs.thirdwebcdn.com/ipfs/";
export interface IPFSResolverOptions {
gatewayUrl: string;
}
export const DEFAULT_IPFS_RESOLVER_OPTIONS: IPFSResolverOptions = {
gatewayUrl: DEFAULT_IPFS_GATEWAY,
};
+15 -9
View File
@@ -1,17 +1,23 @@
import { DEFAULT_IPFS_RESOLVER_OPTIONS } from "../constants/ipfs";
import mime from "mime/lite.js";
import {
parseGatewayUrls,
prepareGatewayUrls,
replaceSchemeWithGatewayUrl,
} from "@thirdweb-dev/storage";
export function resolveIpfsUri(
uri?: string,
options = DEFAULT_IPFS_RESOLVER_OPTIONS,
) {
// TODO legacy remove this when possible
export interface IPFSResolverOptions {
gatewayUrl: string;
}
export function resolveIpfsUri(uri?: string, options?: IPFSResolverOptions) {
if (!uri) {
return undefined;
}
if (uri.startsWith("ipfs://")) {
return uri.replace("ipfs://", options.gatewayUrl);
}
return uri;
const gatewayUrls = prepareGatewayUrls(
parseGatewayUrls(options?.gatewayUrl ? [options?.gatewayUrl] : undefined),
);
return replaceSchemeWithGatewayUrl(uri, gatewayUrls);
}
export async function resolveMimeType(url?: string) {
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.2.14
## 0.2.13
## 0.2.12
## 0.2.11
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.12",
"version": "0.2.14",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+26
View File
@@ -1,5 +1,31 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"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",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,9 +1,15 @@
import { ThemeProvider, ThemeProviderProps } from "../styles/ThemeProvider";
import { ConnectWalletDetails } from "./ConnectWalletDetails/ConnectWalletDetails";
import { ConnectWalletFlow } from "./ConnectWalletFlow/ConnectWalletFlow";
import { useAddress } from "@thirdweb-dev/react-core";
import React, { useEffect, useRef } from "react";
import { Animated } from "react-native";
import {
useAddress,
useConnectionStatus,
useWallets,
} from "@thirdweb-dev/react-core";
import React, { useEffect, useRef, useState } from "react";
import { ActivityIndicator, Animated, StyleSheet } from "react-native";
import BaseButton from "./base/BaseButton";
import Text from "./base/Text";
import { useModalState } from "../providers/ui-context-provider";
export type ConnectWalletProps = {
theme?: ThemeProviderProps["theme"];
@@ -30,8 +36,32 @@ export const ConnectWallet = ({
theme,
}: ConnectWalletProps) => {
const fadeAnim = useRef(new Animated.Value(0)).current;
const address = useAddress();
const connectionStatus = useConnectionStatus();
const supportedWallets = useWallets();
const isWalletConnecting = connectionStatus === "connecting";
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
const { setModalState } = useModalState();
useEffect(() => {
setShowButtonSpinner(isWalletConnecting);
if (!isWalletConnecting) {
return;
}
const timeout = setTimeout(() => {
if (isWalletConnecting) {
setShowButtonSpinner(false);
}
}, 3000);
return () => {
if (timeout) {
clearTimeout(timeout);
}
};
}, [isWalletConnecting]);
useEffect(() => {
Animated.timing(fadeAnim, {
@@ -41,6 +71,20 @@ export const ConnectWallet = ({
}).start();
}, [fadeAnim]);
const onConnectWalletPress = () => {
setModalState({
isOpen: true,
isSheet: true,
view: "ConnectWalletFlow",
data: {
modalTitle,
walletConfig:
supportedWallets.length === 1 ? supportedWallets[0] : undefined,
},
caller: "ConnectWallet",
});
};
return (
<ThemeProvider theme={theme}>
<Animated.View style={{ opacity: fadeAnim }}>
@@ -50,12 +94,37 @@ export const ConnectWallet = ({
detailsButton={detailsButton}
/>
) : (
<ConnectWalletFlow
buttonTitle={buttonTitle}
modalTitle={modalTitle}
/>
<BaseButton
backgroundColor="buttonBackgroundColor"
onPress={onConnectWalletPress}
style={styles.connectWalletButton}
>
<Text variant="bodyLarge" color="buttonTextColor">
{showButtonSpinner ? (
<ActivityIndicator size="small" color="buttonTextColor" />
) : buttonTitle ? (
buttonTitle
) : (
"Connect Wallet"
)}
</Text>
</BaseButton>
)}
</Animated.View>
</ThemeProvider>
);
};
const styles = StyleSheet.create({
connectWalletButton: {
display: "flex",
flexDirection: "row",
alignContent: "center",
alignItems: "center",
justifyContent: "center",
borderRadius: 8,
paddingHorizontal: 10,
paddingVertical: 10,
minWidth: 150,
},
});
@@ -1,24 +1,13 @@
import { NetworkSelectorModal } from "../NetworkSelector/NetworkSelectorModal";
import { Address } from "../base/Address";
import BaseButton from "../base/BaseButton";
import { ChainIcon } from "../base/ChainIcon";
import PocketWalletIcon from "../../assets/wallet";
import Text from "../base/Text";
import { WalletIcon } from "../base/WalletIcon";
import { TWModal } from "../base/modal/TWModal";
import { NetworkButton } from "./NetworkButton";
import { WalletDetailsModalHeader } from "./WalletDetailsModalHeader";
import { useWallet, useBalance, useDisconnect } from "@thirdweb-dev/react-core";
import { useWallet, useBalance } from "@thirdweb-dev/react-core";
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
import { useCallback, useEffect, useState } from "react";
import { StyleSheet, View } from "react-native";
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
import { Toast } from "../base/Toast";
import { LocalWallet, SmartWallet, walletIds } from "@thirdweb-dev/wallets";
import { SmartWalletAdditionalActions } from "./SmartWalletAdditionalActions";
import { useSmartWallet } from "../../providers/context-provider";
import RightArrowIcon from "../../assets/right-arrow";
import { useTheme } from "@shopify/restyle";
import { LocalWallet } from "@thirdweb-dev/wallets";
import { useModalState } from "../../providers/ui-context-provider";
export type ConnectWalletDetailsProps = {
address: string;
@@ -29,157 +18,25 @@ export const ConnectWalletDetails = ({
address,
detailsButton,
}: ConnectWalletDetailsProps) => {
const theme = useTheme();
const [isDetailsModalVisible, setIsDetailsModalVisible] = useState(false);
const [isExportModalVisible, setIsExportModalVisible] = useState(false);
const [isNetworkSelectorModalVisible, setIsNetworkSelectorModalVisible] =
useState(false);
const [isDisconnecting, setIsDisconnecting] = useState(false);
const [addressCopied, setAddressCopied] = useState(false);
const activeWallet = useWallet();
const disconnect = useDisconnect();
const [smartWallet, setSmartWallet] = useSmartWallet();
const chain = useActiveChain();
const balanceQuery = useBalance();
useEffect(() => {
const timeout = setTimeout(() => {
if (addressCopied) {
setAddressCopied(false);
}
}, 2000);
return () => clearTimeout(timeout);
}, [addressCopied]);
const { setModalState } = useModalState();
const onPress = () => {
setIsDetailsModalVisible(true);
};
const onDisconnectPress = () => {
setIsDisconnecting(true);
disconnect().finally(() => {
setIsDisconnecting(false);
setSmartWallet?.(undefined);
setModalState({
view: "WalletDetails",
data: {
address: address,
},
isOpen: true,
isSheet: true,
caller: "ConnectWalletDetails",
});
};
const onChangeNetworkPress = () => {
// TODO: implement this
// setIsDetailsModalVisible(false);
// setIsNetworkSelectorModalVisible(true);
};
const onSelectorModalClose = () => {
setIsNetworkSelectorModalVisible(false);
};
const onBackdropPress = () => {
setIsDetailsModalVisible(false);
setIsExportModalVisible(false);
};
const onExportLocalWalletPress = useCallback(() => {
setIsExportModalVisible(true);
}, []);
const onExportModalClose = () => {
setIsExportModalVisible(false);
};
const onAddressCopied = () => {
setAddressCopied(true);
};
const getAdditionalActions = useCallback(() => {
if (activeWallet?.walletId === SmartWallet.id || smartWallet) {
return (
<SmartWalletAdditionalActions
onExportPress={onExportLocalWalletPress}
/>
);
}
if (activeWallet?.walletId === walletIds.localWallet) {
return (
<>
<View style={styles.currentNetwork}>
<Text variant="bodySmallSecondary">Additional Actions</Text>
</View>
<BaseButton
backgroundColor="background"
borderColor="border"
mb="sm"
justifyContent="space-between"
style={styles.exportWallet}
onPress={onExportLocalWalletPress}
>
<>
<PocketWalletIcon size={16} />
<View style={styles.exportWalletInfo}>
<Text variant="bodySmall">Backup wallet</Text>
</View>
</>
<RightArrowIcon
height={10}
width={10}
color={theme.colors.iconPrimary}
/>
</BaseButton>
{activeWallet?.walletId === LocalWallet.id ? (
<Text variant="error">
{
"This is a temporary guest wallet. Download a backup if you don't want to lose access to it."
}
</Text>
) : null}
</>
);
}
return null;
}, [
activeWallet?.walletId,
onExportLocalWalletPress,
smartWallet,
theme.colors.iconPrimary,
]);
return (
<>
<TWModal
isVisible={isDetailsModalVisible}
onBackdropPress={onBackdropPress}
>
<ExportLocalWalletModal
isVisible={isExportModalVisible}
onClose={onExportModalClose}
/>
<WalletDetailsModalHeader
address={address}
onDisconnectPress={onDisconnectPress}
onAddressCopied={onAddressCopied}
loading={isDisconnecting}
/>
<View style={styles.currentNetwork}>
<Text variant="bodySmallSecondary">Current Network</Text>
</View>
<NetworkButton
chainIconUrl={chain?.icon?.url || ""}
chainName={chain?.name || "Unknown Network"}
onPress={onChangeNetworkPress}
/>
{getAdditionalActions()}
{addressCopied === true ? (
<Toast text={"Address copied to clipboard"} />
) : null}
</TWModal>
<NetworkSelectorModal
isVisible={isNetworkSelectorModalVisible}
onClose={onSelectorModalClose}
/>
<BaseButton
backgroundColor="background"
borderColor="border"
@@ -222,26 +79,6 @@ const styles = StyleSheet.create({
flexDirection: "column",
marginLeft: 5,
},
exportWalletInfo: {
flex: 1,
justifyContent: "flex-start",
alignItems: "flex-start",
alignContent: "center",
flexDirection: "column",
marginLeft: 8,
},
exportWallet: {
display: "flex",
flexDirection: "row",
alignContent: "center",
alignItems: "center",
justifyContent: "flex-start",
borderRadius: 12,
borderWidth: 0.5,
paddingHorizontal: 10,
paddingVertical: 12,
minWidth: 200,
},
walletDetails: {
display: "flex",
flexDirection: "row",
@@ -254,13 +91,4 @@ const styles = StyleSheet.create({
paddingVertical: 12,
minWidth: 200,
},
currentNetwork: {
display: "flex",
flexDirection: "column",
alignContent: "flex-start",
alignItems: "flex-start",
justifyContent: "flex-start",
marginTop: 24,
marginBottom: 8,
},
});
@@ -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,
},
});
@@ -14,7 +14,7 @@ import { useWalletContext, useWallet } from "@thirdweb-dev/react-core";
import { useEffect, useState } from "react";
import { useSmartWallet } from "../../providers/context-provider";
import RightArrowIcon from "../../assets/right-arrow";
import { useTheme } from "@shopify/restyle";
import { useAppTheme } from "../../styles/hooks";
export const SmartWalletAdditionalActions = ({
onExportPress,
@@ -27,7 +27,7 @@ export const SmartWalletAdditionalActions = ({
const [smartWalletAddress, setSmartWalletAddress] = useState<string>("");
const [showSmartWallet, setShowSmartWallet] = useState(false);
const activeWallet = useWallet();
const theme = useTheme();
const theme = useAppTheme();
const wallet = showSmartWallet
? smartWallet
@@ -5,7 +5,7 @@ import BaseButton from "../base/BaseButton";
import Text from "../base/Text";
import { WalletIcon } from "../base/WalletIcon";
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 Box from "../base/Box";
import CopyIcon from "../../assets/copy";
@@ -21,7 +21,6 @@ export const WalletDetailsModalHeader = ({
address,
onDisconnectPress,
onAddressCopied,
loading,
}: WalletDetailsModalHeaderProps) => {
const theme = useAppTheme();
const balanceQuery = useBalance();
@@ -61,17 +60,13 @@ export const WalletDetailsModalHeader = ({
{balanceQuery.data?.symbol}
</Text>
</BaseButton>
{loading ? (
<ActivityIndicator size={18} color={theme.colors.iconHighlight} />
) : (
<Icon
type="disconnect"
width={18}
height={18}
onPress={onDisconnectPress}
color={theme.colors.iconHighlight}
/>
)}
<Icon
type="disconnect"
width={18}
height={18}
onPress={onDisconnectPress}
color={theme.colors.iconHighlight}
/>
</View>
</>
);
@@ -3,7 +3,7 @@ import type { WalletConfig } from "@thirdweb-dev/react-core";
import { StyleSheet, View, FlatList } from "react-native";
import { WalletButton } from "../../base/WalletButton";
interface InitialExplorerContentProps {
interface ChooseWalletContentProps {
wallets: WalletConfig[];
excludeWalletIds?: string[];
onChooseWallet: (wallet: WalletConfig) => void;
@@ -13,7 +13,7 @@ export const ChooseWalletContent = ({
wallets,
excludeWalletIds,
onChooseWallet,
}: InitialExplorerContentProps) => {
}: ChooseWalletContentProps) => {
const walletsToDisplay = useMemo(() => {
return wallets.filter(
(w) => !!!excludeWalletIds?.find((ewId) => ewId === w.id),
@@ -1,68 +1,46 @@
import BaseButton from "../base/BaseButton";
import Text from "../base/Text";
import { TWModal } from "../base/modal/TWModal";
import { ChooseWallet } from "./ChooseWallet/ChooseWallet";
import { ConnectingWallet } from "./ConnectingWallet/ConnectingWallet";
import {
WalletConfig,
useConnect,
useConnectionStatus,
useWallets,
} from "@thirdweb-dev/react-core";
import { useEffect, useState } from "react";
import { ActivityIndicator, StyleSheet } from "react-native";
import { WalletConfig, useConnect, useWallets } from "@thirdweb-dev/react-core";
import { useCallback, useEffect, useState } from "react";
import { SmartWallet, walletIds } from "@thirdweb-dev/wallets";
import { SmartWalletFlow } from "./SmartWallet/SmartWalletFlow";
import { useColorScheme } from "react-native";
import { useModalState } from "../../providers/ui-context-provider";
import {
CLOSE_MODAL_STATE,
ConnectWalletFlowModal,
} from "../../utils/modalTypes";
export const ConnectWalletFlow = () => {
const { modalState, setModalState } = useModalState();
const { modalTitle, walletConfig } = (modalState as ConnectWalletFlowModal)
.data;
export const ConnectWalletFlow = ({
buttonTitle,
modalTitle,
}: {
buttonTitle?: string;
modalTitle?: string;
}) => {
const [modalVisible, setModalVisible] = useState(false);
const [activeWallet, setActiveWallet] = useState<WalletConfig | undefined>();
const [isConnecting, setIsConnecting] = useState(false);
const supportedWallets = useWallets();
const connectionStatus = useConnectionStatus();
const isWalletConnecting = connectionStatus === "connecting";
const [showButtonSpinner, setShowButtonSpinner] = useState(false);
const theme = useColorScheme();
useEffect(() => {
setShowButtonSpinner(isWalletConnecting);
if (!isWalletConnecting) {
return;
}
const timeout = setTimeout(() => {
if (isWalletConnecting) {
setShowButtonSpinner(false);
}
}, 3000);
return () => {
if (timeout) {
clearTimeout(timeout);
}
};
}, [isWalletConnecting]);
const connect = useConnect();
const onConnectPress = () => {
if (supportedWallets.length === 1) {
onChooseWallet(supportedWallets[0]);
}
const onChooseWallet = useCallback((wallet: WalletConfig) => {
setActiveWallet(() => wallet);
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) => {
setModalVisible(false);
setModalState(CLOSE_MODAL_STATE("ConnectWalletFlow"));
if (reset) {
resetModal();
@@ -75,44 +53,43 @@ export const ConnectWalletFlow = ({
const connectActiveWallet = async (wallet: WalletConfig) => {
setIsConnecting(true);
connect(wallet, {}).catch((error) => {
console.error("Error connecting to the wallet", error);
onBackPress();
});
};
const onChooseWallet = (wallet: WalletConfig) => {
setActiveWallet(() => wallet);
if (wallet.id !== SmartWallet.id) {
connectActiveWallet(wallet);
}
connect(wallet, {})
.catch((error) => {
console.error("Error connecting to the wallet", error);
})
.finally(() => {
onClose(true);
});
};
const onBackPress = () => {
resetModal();
};
const onConnected = () => {
onClose(true);
};
const resetModal = () => {
setActiveWallet(undefined);
setIsConnecting(false);
};
function getComponentForWallet(activeWalletP: WalletConfig) {
switch (activeWalletP.id) {
function getComponentForWallet() {
switch (activeWallet?.id) {
case SmartWallet.id:
return <SmartWalletFlow onClose={onClose} onConnect={onBackPress} />;
return <SmartWalletFlow onClose={onClose} onConnect={onConnected} />;
}
if (activeWalletP.connectUI) {
if (activeWallet?.connectUI) {
return (
<activeWalletP.connectUI
<activeWallet.connectUI
theme={theme || "dark"}
goBack={onBackPress}
close={onClose}
isOpen={modalVisible}
open={onOpenModal}
walletConfig={activeWalletP}
walletConfig={activeWallet}
supportedWallets={supportedWallets}
selectionData={undefined} // TODO
setSelectionData={() => {}} // TODO
@@ -123,63 +100,31 @@ export const ConnectWalletFlow = ({
return (
<>
<TWModal isVisible={modalVisible}>
{activeWallet ? (
isConnecting ? (
<ConnectingWallet
content={
activeWallet.id === walletIds.localWallet ? (
<Text variant="bodySmallSecondary" mt="md">
Creating, encrypting and securing your device wallet.
</Text>
) : undefined
}
wallet={activeWallet}
onClose={onClose}
onBackPress={onBackPress}
/>
) : (
getComponentForWallet(activeWallet)
)
) : (
<ChooseWallet
headerText={modalTitle}
wallets={supportedWallets}
onChooseWallet={onChooseWallet}
{activeWallet ? (
isConnecting ? (
<ConnectingWallet
content={
activeWallet.id === walletIds.localWallet ? (
<Text variant="bodySmallSecondary" mt="md">
Creating, encrypting and securing your device wallet.
</Text>
) : undefined
}
wallet={activeWallet}
onClose={onClose}
onBackPress={onBackPress}
/>
)}
</TWModal>
<BaseButton
backgroundColor="buttonBackgroundColor"
onPress={onConnectPress}
style={styles.connectWalletButton}
>
<Text variant="bodyLarge" color="buttonTextColor">
{showButtonSpinner ? (
<ActivityIndicator size="small" color="buttonTextColor" />
) : buttonTitle ? (
buttonTitle
) : (
"Connect Wallet"
)}
</Text>
</BaseButton>
) : (
getComponentForWallet()
)
) : (
<ChooseWallet
headerText={modalTitle}
wallets={supportedWallets}
onChooseWallet={onChooseWallet}
onClose={onClose}
/>
)}
</>
);
};
const styles = StyleSheet.create({
connectWalletButton: {
display: "flex",
flexDirection: "row",
alignContent: "center",
alignItems: "center",
justifyContent: "center",
borderRadius: 8,
paddingHorizontal: 10,
paddingVertical: 10,
minWidth: 150,
},
});
@@ -14,10 +14,10 @@ import { ChooseWallet } from "../ChooseWallet/ChooseWallet";
import { LocalWalletFlow } from "../LocalWalletFlow";
import { ModalHeaderTextClose } from "../../base/modal/ModalHeaderTextClose";
import { ActivityIndicator, Linking, useColorScheme } from "react-native";
import { useTheme } from "@shopify/restyle";
import BaseButton from "../../base/BaseButton";
import Text from "../../base/Text";
import { walletIds } from "@thirdweb-dev/wallets";
import { useAppTheme } from "../../../styles/hooks";
export const SmartWalletFlow = ({
onClose,
@@ -33,7 +33,7 @@ export const SmartWalletFlow = ({
const [personalWalletChainId, setPersonalWalletChaindId] = useState<
number | undefined
>();
const theme = useTheme();
const theme = useAppTheme();
const createWalletInstance = useCreateWalletInstance();
const walletObj = useSupportedWallet(walletIds.smartWallet) as SmartWalletObj;
const connect = useConnect();
@@ -1,14 +1,14 @@
import { StyleSheet, TextInput } from "react-native";
import { useTheme } from "@shopify/restyle";
import Box from "../../base/Box";
import Text from "../../base/Text";
import { useAppTheme } from "../../../styles/hooks";
export const UsernameInput = ({
onChangeText,
}: {
onChangeText: TextInput["props"]["onChangeText"];
}) => {
const theme = useTheme();
const theme = useAppTheme();
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 { TWModal, TWModalProps } from "../base/modal/TWModal";
export type NetworkSelectorModalProps = {
onClose: () => void;
} & TWModalProps;
};
export const NetworkSelectorModal = ({
isVisible,
onClose,
...props
}: NetworkSelectorModalProps) => {
return (
<TWModal isVisible={isVisible} {...props}>
<ModalHeaderTextClose
headerText={"Select Network"}
subHeaderText={"Choose a new network to connect to thirdweb"}
onClose={onClose}
/>
</TWModal>
<ModalHeaderTextClose
headerText={"Select Network"}
subHeaderText={"Choose a new network to connect to thirdweb"}
onClose={onClose}
/>
);
};
@@ -2,15 +2,15 @@ import { StyleSheet, TextInput, TouchableOpacity } from "react-native";
import Box from "./base/Box";
import { useState } from "react";
import EyeClosed from "../assets/eye-closed";
import { useTheme } from "@shopify/restyle";
import EyeOpened from "../assets/eye-opened";
import { useAppTheme } from "../styles/hooks";
export const PasswordInput = ({
onChangeText,
}: {
onChangeText: TextInput["props"]["onChangeText"];
}) => {
const theme = useTheme();
const theme = useAppTheme();
const [showPassword, setShowPassword] = useState(false);
const onPressEyeIcon = () => {
@@ -16,6 +16,10 @@ const ImageSvgUri = ({
const isSvg = imageUrl.toLowerCase().endsWith(".svg");
const resolvedImageUrl = resolveIpfsUri(imageUrl) || "";
if (!resolvedImageUrl || resolvedImageUrl === "") {
return null;
}
if (isSvg) {
return <SvgUri width={width} height={height} uri={resolvedImageUrl} />;
} else {
@@ -2,7 +2,7 @@ import { ReactElement, useEffect, useRef } from "react";
import { Theme } from "../../styles/theme";
import Text from "./Text";
import { Animated, StyleSheet } from "react-native";
import { useTheme } from "@shopify/restyle";
import { useAppTheme } from "../../styles/hooks";
export const TOAST_HEIGHT = 45;
@@ -19,7 +19,7 @@ export function Toast({
backgroundColor,
translateY = TOAST_HEIGHT,
}: ToastProps) {
const theme = useTheme();
const theme = useAppTheme();
const translateYRef = useRef(new Animated.Value(translateY)).current;
@@ -1,6 +1,6 @@
import { useTheme } from "@shopify/restyle";
import Text from "../Text";
import { TouchableOpacity, StyleSheet, ActivityIndicator } from "react-native";
import { useAppTheme } from "../../../styles/hooks";
export const ModalFooter = ({
footer,
@@ -11,7 +11,7 @@ export const ModalFooter = ({
isLoading?: boolean;
onPress?: () => void;
}) => {
const theme = useTheme();
const theme = useAppTheme();
return (
<TouchableOpacity style={styles.footer} onPress={onPress}>
+1
View File
@@ -1,5 +1,6 @@
export { darkTheme, lightTheme } from "./styles/theme";
export type { Theme, ButtonTheme } from "./styles/theme";
export { useAppTheme } from "./styles/hooks";
export {
CoinbaseWallet,
@@ -11,6 +11,9 @@ import { SecureStorage } from "../../core/SecureStorage";
import { useCoinbaseWalletListener } from "../wallets/hooks/useCoinbaseWalletListener";
import { DEFAULT_WALLETS } from "../constants/wallets";
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[]>
extends Omit<ThirdwebProviderCoreProps<TChains>, "supportedWallets"> {
@@ -57,27 +60,33 @@ export const ThirdwebProvider = <
thirdwebApiKey = DEFAULT_API_KEY,
supportedWallets = DEFAULT_WALLETS,
authConfig,
theme,
...restProps
}: PropsWithChildren<ThirdwebProviderProps<TChains>>) => {
useCoinbaseWalletListener();
return (
<DappContextProvider>
<ThirdwebProviderCore
thirdwebApiKey={thirdwebApiKey}
supportedWallets={supportedWallets}
authConfig={
authConfig
? authConfig.secureStorage
? authConfig
: { ...authConfig, secureStorage: new SecureStorage("auth") }
: undefined
}
createWalletStorage={createWalletStorage}
{...restProps}
>
{children}
</ThirdwebProviderCore>
</DappContextProvider>
<ThirdwebProviderCore
thirdwebApiKey={thirdwebApiKey}
supportedWallets={supportedWallets}
authConfig={
authConfig
? authConfig.secureStorage
? authConfig
: { ...authConfig, secureStorage: new SecureStorage("auth") }
: undefined
}
createWalletStorage={createWalletStorage}
{...restProps}
>
<DappContextProvider>
<ThemeProvider theme={theme}>
<UIContextProvider>
{children}
<MainModal />
</UIContextProvider>
</ThemeProvider>
</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;
+22
View File
@@ -1,5 +1,27 @@
# @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
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.12.0",
"version": "3.12.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -7,7 +7,11 @@ import {
CarbonPlayFilledAlt,
} from "./Icons";
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, {
ReactNode,
useEffect,
@@ -57,6 +61,10 @@ export interface MediaRendererProps extends SharedMediaProps {
* The media poster image uri. (if applicable)
*/
poster?: string | null;
/**
* The IPFS gateway URL to use
*/
gatewayUrl?: string;
width?: string;
height?: string;
}
@@ -426,6 +434,7 @@ export const MediaRenderer = React.forwardRef<
src,
poster,
alt,
gatewayUrl,
requireInteraction = false,
width = "300px",
height = "300px",
@@ -441,8 +450,16 @@ export const MediaRenderer = React.forwardRef<
height,
...style,
};
const videoOrImageSrc = useResolvedMediaType(src ?? undefined, mimeType);
const possiblePosterSrc = useResolvedMediaType(poster ?? undefined);
const videoOrImageSrc = useResolvedMediaType(
src ?? undefined,
mimeType,
gatewayUrl,
);
const possiblePosterSrc = useResolvedMediaType(
poster ?? undefined,
undefined,
gatewayUrl,
);
if (!videoOrImageSrc.mimeType) {
return (
@@ -562,8 +579,25 @@ export interface MediaType {
* }
* ```
*/
export function useResolvedMediaType(uri?: string, mimeType?: string) {
const resolvedUrl = useMemo(() => resolveIpfsUri(uri), [uri]);
export function useResolvedMediaType(
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(
["mime-type", resolvedUrl],
() => resolveMimeType(resolvedUrl),
+15
View File
@@ -1,5 +1,20 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.15",
"version": "3.10.17",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
+1 -1
View File
@@ -37,7 +37,7 @@ export const NATIVE_TOKENS: Record<number, NativeToken> = {
symbol: "SEP",
decimals: 18,
wrapped: {
address: "0xD0dF82dE051244f04BfF3A8bB1f62E1cD39eED92",
address: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
name: "Wrapped Ether",
symbol: "WETH",
},
+6
View File
@@ -1,5 +1,11 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.1.2",
"version": "1.1.3",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
+6 -1
View File
@@ -6,9 +6,14 @@ import { GatewayUrls } from "../types";
export const DEFAULT_GATEWAY_URLS: GatewayUrls = {
// Note: Gateway URLs should have trailing slashes (we clean this on user input)
"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://ipfs.io/ipfs/",
// TODO this one can become the default again once it's stable (no more VT issues)
"https://ipfs.thirdwebcdn.com/ipfs/",
],
};
+21
View File
@@ -1,5 +1,26 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.30",
"version": "0.2.32",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"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 { InjectedWallet } from "@thirdweb-dev/wallets/evm/wallets/injected";
import { MetaMaskWallet } from "@thirdweb-dev/wallets/evm/wallets/metamask";
import { MagicLink } from "@thirdweb-dev/wallets/evm/wallets/magic";
import { BigNumber } from "ethers";
import type { ContractInterface, Signer } from "ethers";
@@ -49,6 +50,7 @@ const WALLETS = [
WalletConnectV1,
CoinbaseWallet,
LocalWallet,
MagicLink,
] as const;
type PossibleWallet = (typeof WALLETS)[number]["id"];
@@ -59,7 +61,12 @@ type FundWalletInput = FundWalletOptions & {
interface TWBridge {
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>;
switchNetwork: (chainId: number) => Promise<void>;
invoke: (route: string, payload: string) => Promise<string | undefined>;
@@ -152,6 +159,12 @@ class ThirdwebBridge implements TWBridge {
dappMetadata,
});
break;
case walletIds.magicLink:
walletInstance = new MagicLink({
apiKey: sdkOptions.wallet?.magicLinkApiKey,
emailLogin: true,
});
break;
default:
throw new Error(`Unknown wallet type: ${possibleWallet.id}`);
}
@@ -173,6 +186,7 @@ class ThirdwebBridge implements TWBridge {
wallet: PossibleWallet = "injected",
chainId?: number | undefined,
password?: string,
email?: string,
) {
if (!this.activeSDK) {
throw new Error("SDK not initialized");
@@ -209,7 +223,15 @@ class ThirdwebBridge implements TWBridge {
}
}
await walletInstance.connect({ chainId });
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 });
}
this.activeWallet = walletInstance;
this.updateSDKSigner(await walletInstance.getSigner());
return await this.activeSDK.wallet.getAddress();
+20
View File
@@ -1,5 +1,25 @@
# @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
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "0.2.20",
"version": "0.2.22",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
@@ -52,11 +52,13 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
entryPointAddress,
bundlerUrl,
paymasterAPI: this.config.gasless
? getVerifyingPaymaster(
paymasterUrl,
entryPointAddress,
this.config.thirdwebApiKey,
)
? this.config.paymasterAPI
? this.config.paymasterAPI
: getVerifyingPaymaster(
paymasterUrl,
entryPointAddress,
this.config.thirdwebApiKey,
)
: undefined,
factoryAddress: config.factoryAddress,
factoryInfo: config.factoryInfo || this.defaultFactoryInfo(),
@@ -14,6 +14,7 @@ import {
} from "@account-abstraction/sdk";
import { TransactionDetailsForUserOp } from "./transaction-details";
import { getUserOpHashV06 } from "./utils";
import { DUMMY_PAYMASTER_AND_DATA, SIG_SIZE } from "./paymaster";
export interface BaseApiParams {
provider: providers.Provider;
@@ -121,10 +122,7 @@ export abstract class BaseAccountAPI {
this.getAccountAddress(),
);
if (senderAddressCode.length > 2) {
// console.log(`SimpleAccount Contract already deployed at ${this.senderAddress}`)
this.isPhantom = false;
} else {
// console.log(`SimpleAccount Contract is NOT YET deployed at ${this.senderAddress} - working in "phantom account" mode.`)
}
return this.isPhantom;
}
@@ -303,24 +301,45 @@ export abstract class BaseAccountAPI {
};
let paymasterAndData: string | undefined;
let userOp = partialUserOp;
if (this.paymasterAPI) {
// fill (partial) preVerificationGas (all except the cost of the generated paymasterAndData)
paymasterAndData = await this.paymasterAPI.getPaymasterAndData(
partialUserOp,
);
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)),
};
userOp = await ethers.utils.resolveProperties(pmOp);
const preVerificationGas = calcPreVerificationGas(userOp);
userOp.preVerificationGas = preVerificationGas;
paymasterAndData = await this.paymasterAPI.getPaymasterAndData(userOp);
if (paymasterAndData === "0x") {
paymasterAndData = undefined;
}
}
if (paymasterAndData) {
partialUserOp.paymasterAndData = paymasterAndData;
userOp.paymasterAndData = paymasterAndData;
return {
...partialUserOp,
...userOp,
signature: "",
};
} else {
const modifiedOp = {
...partialUserOp,
...userOp,
paymasterAndData: "0x",
};
modifiedOp.preVerificationGas = await this.getPreVerificationGas(
@@ -122,6 +122,17 @@ export class ERC4337EthersSigner extends Signer {
}
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);
}
@@ -1,11 +1,10 @@
import { ethers } from "ethers";
import { PaymasterAPI, calcPreVerificationGas } from "@account-abstraction/sdk";
import { PaymasterAPI } from "@account-abstraction/sdk";
import { UserOperationStruct } from "@account-abstraction/contracts";
import { toJSON } from "./utils";
import fetch from "cross-fetch";
const SIG_SIZE = 65;
const DUMMY_PAYMASTER_AND_DATA =
export const SIG_SIZE = 65;
export const DUMMY_PAYMASTER_AND_DATA =
"0x0101010101010101010101010101010101010101000000000000000000000000000000000000000000000000000001010101010100000000000000000000000000000000000000000000000000000000000000000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101";
class VerifyingPaymasterAPI extends PaymasterAPI {
@@ -22,32 +21,6 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
async getPaymasterAndData(
userOp: Partial<UserOperationStruct>,
): 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.
try {
const response = await fetch(this.paymasterUrl, {
@@ -60,7 +33,7 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
jsonrpc: "2.0",
id: 1,
method: "pm_sponsorUserOperation",
params: [await toJSON(op), { entryPoint: this.entryPoint }],
params: [await toJSON(userOp), { entryPoint: this.entryPoint }],
}),
});
const res = await response.json();
@@ -21,6 +21,7 @@ export type SmartWalletConfig = {
gasless: boolean;
bundlerUrl?: string;
paymasterUrl?: string;
paymasterAPI?: PaymasterAPI;
entryPointAddress?: string;
} & ContractInfoInput;
@@ -11,6 +11,7 @@ import { walletIds } from "../constants/walletIds";
// export types and utils for convenience
export * from "../connectors/smart-wallet/types";
export * from "../connectors/smart-wallet/utils";
export type { PaymasterAPI } from "@account-abstraction/sdk";
export class SmartWallet extends AbstractClientWallet<
SmartWalletConfig,
+22 -22
View File
@@ -44,8 +44,8 @@ importers:
specifier: ^2.8.7
version: 2.8.7
turbo:
specifier: ^1.8.8
version: 1.8.8
specifier: ^1.9.8
version: 1.9.8
yalc:
specifier: 1.0.0-pre.53
version: 1.0.0-pre.53
@@ -26962,65 +26962,65 @@ packages:
yargs: 17.7.1
dev: false
/turbo-darwin-64@1.8.8:
resolution: {integrity: sha512-18cSeIm7aeEvIxGyq7PVoFyEnPpWDM/0CpZvXKHpQ6qMTkfNt517qVqUTAwsIYqNS8xazcKAqkNbvU1V49n65Q==}
/turbo-darwin-64@1.9.8:
resolution: {integrity: sha512-PkTdBjPfgpj/Dob/6SjkzP0BBP80/KmFjLEocXVEECCLJE6tHKbWLRdvc79B0N6SufdYdZ1uvvoU3KPtBokSPw==}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/turbo-darwin-arm64@1.8.8:
resolution: {integrity: sha512-ruGRI9nHxojIGLQv1TPgN7ud4HO4V8mFBwSgO6oDoZTNuk5ybWybItGR+yu6fni5vJoyMHXOYA2srnxvOc7hjQ==}
/turbo-darwin-arm64@1.9.8:
resolution: {integrity: sha512-sLwqOx3XV57QCEoJM9GnDDnnqidG8wf29ytxssBaWHBdeJTjupyrmzTUrX+tyKo3Q+CjWvbPLyqVqxT4g5NuXQ==}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/turbo-linux-64@1.8.8:
resolution: {integrity: sha512-N/GkHTHeIQogXB1/6ZWfxHx+ubYeb8Jlq3b/3jnU4zLucpZzTQ8XkXIAfJG/TL3Q7ON7xQ8yGOyGLhHL7MpFRg==}
/turbo-linux-64@1.9.8:
resolution: {integrity: sha512-AMg6VT6sW7aOD1uOs5suxglXfTYz9T0uVyKGKokDweGOYTWmuTMGU5afUT1tYRUwQ+kVPJI+83Atl5Ob0oBsgw==}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/turbo-linux-arm64@1.8.8:
resolution: {integrity: sha512-hKqLbBHgUkYf2Ww8uBL9UYdBFQ5677a7QXdsFhONXoACbDUPvpK4BKlz3NN7G4NZ+g9dGju+OJJjQP0VXRHb5w==}
/turbo-linux-arm64@1.9.8:
resolution: {integrity: sha512-tLnxFv+OIklwTjiOZ8XMeEeRDAf150Ry4BCivNwgTVFAqQGEqkFP6KGBy56hb5RRF1frPQpoPGipJNVm7c8m1w==}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/turbo-windows-64@1.8.8:
resolution: {integrity: sha512-2ndjDJyzkNslXxLt+PQuU21AHJWc8f6MnLypXy3KsN4EyX/uKKGZS0QJWz27PeHg0JS75PVvhfFV+L9t9i+Yyg==}
/turbo-windows-64@1.9.8:
resolution: {integrity: sha512-r3pCjvXTMR7kq2E3iqwFlN1R7pFO/TOsuUjMhOSPP7HwuuUIinAckU4I9foM3q7ZCQd1XXScBUt3niDyHijAqQ==}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/turbo-windows-arm64@1.8.8:
resolution: {integrity: sha512-xCA3oxgmW9OMqpI34AAmKfOVsfDljhD5YBwgs0ZDsn5h3kCHhC4x9W5dDk1oyQ4F5EXSH3xVym5/xl1J6WRpUg==}
/turbo-windows-arm64@1.9.8:
resolution: {integrity: sha512-CWzRbX2TM5IfHBC6uWM659qUOEDC4h0nn16ocG8yIq1IF3uZMzKRBHgGOT5m1BHom+R08V0NcjTmPRoqpiI0dg==}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/turbo@1.8.8:
resolution: {integrity: sha512-qYJ5NjoTX+591/x09KgsDOPVDUJfU9GoS+6jszQQlLp1AHrf1wRFA3Yps8U+/HTG03q0M4qouOfOLtRQP4QypA==}
/turbo@1.9.8:
resolution: {integrity: sha512-dTouGZBm4a2fE0OPafcTQERCp4i3ZOow0Pr0JlOyxKmzJy0JRwXypH013kbZoK6k1ET5tS/g9rwUXIM/AmWXXQ==}
hasBin: true
requiresBuild: true
optionalDependencies:
turbo-darwin-64: 1.8.8
turbo-darwin-arm64: 1.8.8
turbo-linux-64: 1.8.8
turbo-linux-arm64: 1.8.8
turbo-windows-64: 1.8.8
turbo-windows-arm64: 1.8.8
turbo-darwin-64: 1.9.8
turbo-darwin-arm64: 1.9.8
turbo-linux-64: 1.9.8
turbo-linux-arm64: 1.9.8
turbo-windows-64: 1.9.8
turbo-windows-arm64: 1.9.8
dev: false
/[email protected]: