Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c578a437cc | ||
|
|
0c5b03b8d6 | ||
|
|
9af346eead | ||
|
|
d9fb134ad4 | ||
|
|
1c7264b403 | ||
|
|
a140ee99b2 | ||
|
|
6e1fe6e582 | ||
|
|
536b0f1240 | ||
|
|
b626782b0e | ||
|
|
1d76334dd3 | ||
|
|
d498c79a91 |
@@ -1,5 +1,12 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 3.2.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f)]:
|
||||||
|
- @thirdweb-dev/wallets@0.3.3
|
||||||
|
|
||||||
## 3.2.2
|
## 3.2.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "3.2.2",
|
"version": "3.2.3",
|
||||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/chains
|
# @thirdweb-dev/chains
|
||||||
|
|
||||||
|
## 0.1.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||||
|
|
||||||
## 0.1.23
|
## 0.1.23
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,51 +0,0 @@
|
|||||||
import type { Chain } from "../src/types";
|
|
||||||
export default {
|
|
||||||
"name": "Horizen Yuma Testnet",
|
|
||||||
"shortName": "Yuma",
|
|
||||||
"chain": "Yuma",
|
|
||||||
"icon": {
|
|
||||||
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
|
|
||||||
"width": 1213,
|
|
||||||
"height": 1213,
|
|
||||||
"format": "png"
|
|
||||||
},
|
|
||||||
"rpc": [
|
|
||||||
"https://horizen-yuma-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
|
||||||
"https://yuma-testnet.horizenlabs.io/ethv1"
|
|
||||||
],
|
|
||||||
"features": [
|
|
||||||
{
|
|
||||||
"name": "EIP155"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "EIP1559"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"faucets": [
|
|
||||||
"https://yuma-testnet-faucet.horizen.io"
|
|
||||||
],
|
|
||||||
"nativeCurrency": {
|
|
||||||
"name": "Testnet Zen",
|
|
||||||
"symbol": "tZEN",
|
|
||||||
"decimals": 18
|
|
||||||
},
|
|
||||||
"infoURL": "https://horizen.io/",
|
|
||||||
"chainId": 1662,
|
|
||||||
"networkId": 1662,
|
|
||||||
"slip44": 121,
|
|
||||||
"explorers": [
|
|
||||||
{
|
|
||||||
"name": "Yuma Testnet Block Explorer",
|
|
||||||
"url": "https://yuma-explorer.horizen.io",
|
|
||||||
"icon": {
|
|
||||||
"url": "ipfs://QmSFMBk3rMyu45Sy9KQHjgArFj4HdywANNYrSosLMUdcti",
|
|
||||||
"width": 1213,
|
|
||||||
"height": 1213,
|
|
||||||
"format": "png"
|
|
||||||
},
|
|
||||||
"standard": "EIP3091"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"testnet": true,
|
|
||||||
"slug": "horizen-yuma-testnet"
|
|
||||||
} as const satisfies Chain;
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import type { Chain } from "../src/types";
|
||||||
|
export default {
|
||||||
|
"name": "Peperium Chain Testnet",
|
||||||
|
"chain": "PERIUM",
|
||||||
|
"rpc": [
|
||||||
|
"https://peperium-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||||
|
"https://rpc-testnet.peperium.io"
|
||||||
|
],
|
||||||
|
"faucets": [],
|
||||||
|
"nativeCurrency": {
|
||||||
|
"name": "Peperium Chain Testnet",
|
||||||
|
"symbol": "PERIUM",
|
||||||
|
"decimals": 18
|
||||||
|
},
|
||||||
|
"infoURL": "https://peperium.io",
|
||||||
|
"shortName": "PERIUM",
|
||||||
|
"chainId": 4001,
|
||||||
|
"networkId": 4001,
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
|
||||||
|
"width": 160,
|
||||||
|
"height": 160,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"explorers": [
|
||||||
|
{
|
||||||
|
"name": "Peperium Chain Explorer",
|
||||||
|
"url": "https://scan-testnet.peperium.io",
|
||||||
|
"icon": {
|
||||||
|
"url": "ipfs://Qmag2hr5DQghRzKPN3oUFBkjWzqd5CndQzZeb5LfoiMCXf",
|
||||||
|
"width": 160,
|
||||||
|
"height": 160,
|
||||||
|
"format": "png"
|
||||||
|
},
|
||||||
|
"standard": "EIP3091"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testnet": true,
|
||||||
|
"slug": "peperium-chain-testnet"
|
||||||
|
} as const satisfies Chain;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/chains",
|
"name": "@thirdweb-dev/chains",
|
||||||
"version": "0.1.23",
|
"version": "0.1.24",
|
||||||
"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,16 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.10.26
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1240](https://github.com/thirdweb-dev/js/pull/1240) [`1c7264b4`](https://github.com/thirdweb-dev/js/commit/1c7264b40330d068ece67df537a0f5db0f6aedca) Thanks [@Marfuen](https://github.com/Marfuen)! - Small bug fix for updating packages using --nightly
|
||||||
|
|
||||||
|
- Updated dependencies [[`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/sdk@3.10.25
|
||||||
|
- @thirdweb-dev/storage@1.1.5
|
||||||
|
- @thirdweb-dev/chains@0.1.24
|
||||||
|
|
||||||
## 0.10.25
|
## 0.10.25
|
||||||
|
|
||||||
### 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.25",
|
"version": "0.10.26",
|
||||||
"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,8 +1,8 @@
|
|||||||
import * as toml from "@iarna/toml";
|
import * as toml from "@iarna/toml";
|
||||||
import { PackageManagerType } from "../core/types/ProjectType";
|
|
||||||
import { existsSync, readFileSync } from "fs";
|
import { existsSync, readFileSync } from "fs";
|
||||||
import { runCommand } from "../create/helpers/run-command";
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import { PackageManagerType } from "../core/types/ProjectType";
|
||||||
|
import { runCommand } from "../create/helpers/run-command";
|
||||||
import { IProcessAppTypeArgs, IProcessContractAppTypeArgs } from "./types";
|
import { IProcessAppTypeArgs, IProcessContractAppTypeArgs } from "./types";
|
||||||
|
|
||||||
export function convertDependenciesToStringFormat(dependenciesObject: object) {
|
export function convertDependenciesToStringFormat(dependenciesObject: object) {
|
||||||
@@ -174,7 +174,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
|||||||
case "npm":
|
case "npm":
|
||||||
runner = "npm";
|
runner = "npm";
|
||||||
installCommand = ["install"];
|
installCommand = ["install"];
|
||||||
updateCommand = ["update"]
|
updateCommand = ["install", "--legacy-peer-deps"]
|
||||||
break;
|
break;
|
||||||
case "yarn":
|
case "yarn":
|
||||||
runner = "yarn";
|
runner = "yarn";
|
||||||
@@ -223,7 +223,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeOfAction === "install") {
|
if (typeOfAction === "install") {
|
||||||
if (!dependenciesToAdd.length) {return;}
|
if (!dependenciesToAdd.length) { return; }
|
||||||
const commands = [...installCommand, ...dependenciesToAdd];
|
const commands = [...installCommand, ...dependenciesToAdd];
|
||||||
|
|
||||||
await runCommand(runner, commands, printLogs);
|
await runCommand(runner, commands, printLogs);
|
||||||
@@ -233,7 +233,7 @@ export const installOrUpdate = async (packageManager: PackageManagerType, depend
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (typeOfAction === "update") {
|
if (typeOfAction === "update") {
|
||||||
if (!dependenciesToUpdate.length) {return;}
|
if (!dependenciesToUpdate.length) { return; }
|
||||||
const commands = [...updateCommand, ...dependenciesToUpdate];
|
const commands = [...updateCommand, ...dependenciesToUpdate];
|
||||||
await runCommand(runner, commands, printLogs);
|
await runCommand(runner, commands, printLogs);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/contracts-js
|
# @thirdweb-dev/contracts-js
|
||||||
|
|
||||||
|
## 1.3.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||||
|
|
||||||
## 1.3.6
|
## 1.3.6
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/contracts-js",
|
"name": "@thirdweb-dev/contracts-js",
|
||||||
"version": "1.3.6",
|
"version": "1.3.7",
|
||||||
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
"main": "dist/thirdweb-dev-contracts-js.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
"module": "dist/thirdweb-dev-contracts-js.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/contracts-js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@thirdweb-dev/contracts": "3.5.8"
|
"@thirdweb-dev/contracts": "3.5.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-env": "^7.18.10",
|
"@babel/preset-env": "^7.18.10",
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 3.14.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1235](https://github.com/thirdweb-dev/js/pull/1235) [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix required type for address on useSmartWalletsForAddress
|
||||||
|
|
||||||
|
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||||
|
|
||||||
|
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/wallets@0.3.3
|
||||||
|
- @thirdweb-dev/sdk@3.10.25
|
||||||
|
- @thirdweb-dev/storage@1.1.5
|
||||||
|
- @thirdweb-dev/chains@0.1.24
|
||||||
|
|
||||||
## 3.14.2
|
## 3.14.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "3.14.2",
|
"version": "3.14.3",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -14,14 +14,10 @@ import {
|
|||||||
useQueryClient,
|
useQueryClient,
|
||||||
UseQueryResult,
|
UseQueryResult,
|
||||||
} from "@tanstack/react-query";
|
} from "@tanstack/react-query";
|
||||||
import type {
|
import type { AccountEvent, SmartContract } from "@thirdweb-dev/sdk";
|
||||||
AccountEvent, AddressOrEns, SmartContract,
|
|
||||||
} from "@thirdweb-dev/sdk";
|
|
||||||
import type { BytesLike } from "ethers";
|
import type { BytesLike } from "ethers";
|
||||||
import invariant from "tiny-invariant";
|
import invariant from "tiny-invariant";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** **********************/
|
/** **********************/
|
||||||
/** READ HOOKS **/
|
/** READ HOOKS **/
|
||||||
/** **********************/
|
/** **********************/
|
||||||
@@ -41,7 +37,7 @@ import invariant from "tiny-invariant";
|
|||||||
* @beta
|
* @beta
|
||||||
*/
|
*/
|
||||||
export function useSmartWallets(
|
export function useSmartWallets(
|
||||||
contract: RequiredParam<SmartContract>
|
contract: RequiredParam<SmartContract>,
|
||||||
): UseQueryResult<AccountEvent[]> {
|
): UseQueryResult<AccountEvent[]> {
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
return useQueryWithNetwork(
|
return useQueryWithNetwork(
|
||||||
@@ -49,10 +45,10 @@ export function useSmartWallets(
|
|||||||
() => {
|
() => {
|
||||||
requiredParamInvariant(contract, "No Contract instance provided");
|
requiredParamInvariant(contract, "No Contract instance provided");
|
||||||
invariant(
|
invariant(
|
||||||
contract.smartWalletFactory.getAllWallets,
|
contract.smartWalletFactory.getAllAccounts,
|
||||||
"Contract instance does not support contract.smartWalletFactory.getAllWallets",
|
"Contract instance does not support contract.smartWalletFactory.getAllAccounts",
|
||||||
);
|
);
|
||||||
return contract.smartWalletFactory.getAllWallets();
|
return contract.smartWalletFactory.getAllAccounts();
|
||||||
},
|
},
|
||||||
{ enabled: !!contract },
|
{ enabled: !!contract },
|
||||||
);
|
);
|
||||||
@@ -74,18 +70,21 @@ export function useSmartWallets(
|
|||||||
*/
|
*/
|
||||||
export function useSmartWalletsForAddress(
|
export function useSmartWalletsForAddress(
|
||||||
contract: RequiredParam<SmartContract>,
|
contract: RequiredParam<SmartContract>,
|
||||||
address: AddressOrEns,
|
address: RequiredParam<WalletAddress>,
|
||||||
): UseQueryResult<string[]> {
|
): UseQueryResult<string[]> {
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
return useQueryWithNetwork(
|
return useQueryWithNetwork(
|
||||||
cacheKeys.contract.smartWalletFactory.getAllForAddress(contractAddress, address),
|
cacheKeys.contract.smartWalletFactory.getAllForAddress(
|
||||||
|
contractAddress,
|
||||||
|
address,
|
||||||
|
),
|
||||||
() => {
|
() => {
|
||||||
requiredParamInvariant(contract, "No Contract instance provided");
|
requiredParamInvariant(contract, "No Contract instance provided");
|
||||||
invariant(
|
invariant(
|
||||||
contract.smartWalletFactory.getAssociatedWallets,
|
contract.smartWalletFactory.getAssociatedWallets,
|
||||||
"Contract instance does not support contract.smartWalletFactory.getAssociatedWallets",
|
"Contract instance does not support contract.smartWalletFactory.getAssociatedWallets",
|
||||||
);
|
);
|
||||||
return contract.smartWalletFactory.getAssociatedWallets(address);
|
return contract.smartWalletFactory.getAssociatedWallets(address || "");
|
||||||
},
|
},
|
||||||
{ enabled: !!contract },
|
{ enabled: !!contract },
|
||||||
);
|
);
|
||||||
@@ -112,7 +111,10 @@ export function useIsSmartWalletDeployed(
|
|||||||
): UseQueryResult<boolean> {
|
): UseQueryResult<boolean> {
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
return useQueryWithNetwork(
|
return useQueryWithNetwork(
|
||||||
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(contractAddress, admin),
|
cacheKeys.contract.smartWalletFactory.isSmartWalletDeployed(
|
||||||
|
contractAddress,
|
||||||
|
admin,
|
||||||
|
),
|
||||||
() => {
|
() => {
|
||||||
requiredParamInvariant(contract, "No Contract instance provided");
|
requiredParamInvariant(contract, "No Contract instance provided");
|
||||||
invariant(
|
invariant(
|
||||||
@@ -163,9 +165,7 @@ export function useIsSmartWalletDeployed(
|
|||||||
* @see {@link https://portal.thirdweb.com/react/react.usecreatesmartwallet?utm_source=sdk | Documentation}
|
* @see {@link https://portal.thirdweb.com/react/react.usecreatesmartwallet?utm_source=sdk | Documentation}
|
||||||
* @beta
|
* @beta
|
||||||
*/
|
*/
|
||||||
export function useCreateSmartWallet(
|
export function useCreateSmartWallet(contract: RequiredParam<SmartContract>) {
|
||||||
contract: RequiredParam<SmartContract>,
|
|
||||||
) {
|
|
||||||
const activeChainId = useSDKChainId();
|
const activeChainId = useSDKChainId();
|
||||||
const contractAddress = contract?.getAddress();
|
const contractAddress = contract?.getAddress();
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -174,10 +174,7 @@ export function useCreateSmartWallet(
|
|||||||
async (admin: string, extraData?: BytesLike) => {
|
async (admin: string, extraData?: BytesLike) => {
|
||||||
requiredParamInvariant(contract, "contract is undefined");
|
requiredParamInvariant(contract, "contract is undefined");
|
||||||
|
|
||||||
return contract.smartWalletFactory.createWallet(
|
return contract.smartWalletFactory.createWallet(admin, extraData);
|
||||||
admin,
|
|
||||||
extraData,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
onSettled: () =>
|
onSettled: () =>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.2.22
|
||||||
|
|
||||||
## 0.2.21
|
## 0.2.21
|
||||||
|
|
||||||
## 0.2.20
|
## 0.2.20
|
||||||
|
|||||||
@@ -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.21",
|
"version": "0.2.22",
|
||||||
"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,48 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.2.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [RN]
|
||||||
|
|
||||||
|
- Added the option to import a new wallet in guest mode
|
||||||
|
|
||||||
|
- Added a "Request Testnet Funds" option when on testnets
|
||||||
|
|
||||||
|
- [#1245](https://github.com/thirdweb-dev/js/pull/1245) [`d9fb134a`](https://github.com/thirdweb-dev/js/commit/d9fb134ad40ae067416625eb43cf3708f87db7b5) Thanks [@iketw](https://github.com/iketw)! - [ReactNative] Export more components for easy development
|
||||||
|
|
||||||
|
- IconTextButton
|
||||||
|
Component that renders an icon and a text inside a button with border:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
<IconTextButton
|
||||||
|
mt="xs"
|
||||||
|
text="Switch Accounts"
|
||||||
|
icon={<SwitchIcon height={10} width={10} />}
|
||||||
|
onPress={() => {}}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
- NetworkButton: Used to render a Network
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
<NetworkButton
|
||||||
|
chainIconUrl={chain?.icon?.url || ""}
|
||||||
|
chainName={chain?.name || "Unknown Network"}
|
||||||
|
onPress={onChangeNetworkPress}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Exported all icons from the assets folder for external use
|
||||||
|
|
||||||
|
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
|
||||||
## 0.2.21
|
## 0.2.21
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.2.21",
|
"version": "0.2.22",
|
||||||
"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,7 +1,10 @@
|
|||||||
import { ThemeProvider } from "../styles/ThemeProvider";
|
import { ThemeProvider } from "../styles/ThemeProvider";
|
||||||
import { WalletDetailsButton } from "./ConnectWalletDetails/WalletDetailsButton";
|
import {
|
||||||
|
ConnectWalletDetailsProps,
|
||||||
|
WalletDetailsButton,
|
||||||
|
} from "./ConnectWalletDetails/WalletDetailsButton";
|
||||||
import { useAddress } from "@thirdweb-dev/react-core";
|
import { useAddress } from "@thirdweb-dev/react-core";
|
||||||
import React, { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { Animated } from "react-native";
|
import { Animated } from "react-native";
|
||||||
import { ConnectWalletButton } from "./ConnectWalletFlow/ConnectWalletButton";
|
import { ConnectWalletButton } from "./ConnectWalletFlow/ConnectWalletButton";
|
||||||
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
|
import { ConnectWalletButtonProps } from "./ConnectWalletFlow/ConnectWalletButton";
|
||||||
@@ -10,7 +13,7 @@ export type ConnectWalletProps = {
|
|||||||
/**
|
/**
|
||||||
* render a custom button to display the connected wallet details instead of the default button
|
* render a custom button to display the connected wallet details instead of the default button
|
||||||
*/
|
*/
|
||||||
detailsButton?: React.ReactElement;
|
detailsButton?: ConnectWalletDetailsProps["detailsButton"];
|
||||||
} & ConnectWalletButtonProps;
|
} & ConnectWalletButtonProps;
|
||||||
|
|
||||||
export const ConnectWallet = ({
|
export const ConnectWallet = ({
|
||||||
|
|||||||
+15
-1
@@ -1,4 +1,4 @@
|
|||||||
import { StyleSheet, View } from "react-native";
|
import { Linking, StyleSheet, View } from "react-native";
|
||||||
import Box from "../base/Box";
|
import Box from "../base/Box";
|
||||||
import { Toast } from "../base/Toast";
|
import { Toast } from "../base/Toast";
|
||||||
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
import { ExportLocalWalletModal } from "./ExportLocalWalletModal";
|
||||||
@@ -22,6 +22,8 @@ import { useModalState } from "../../providers/ui-context-provider";
|
|||||||
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
|
import { CLOSE_MODAL_STATE, WalletDetailsModal } from "../../utils/modalTypes";
|
||||||
import { useAppTheme } from "../../styles/hooks";
|
import { useAppTheme } from "../../styles/hooks";
|
||||||
import { LocalWalletImportModal } from "../ConnectWalletFlow/LocalWalletImportModal";
|
import { LocalWalletImportModal } from "../ConnectWalletFlow/LocalWalletImportModal";
|
||||||
|
import { IconTextButton } from "../base/IconTextButton";
|
||||||
|
import MoneyIcon from "../../assets/money";
|
||||||
|
|
||||||
export const ConnectWalletDetailsModal = () => {
|
export const ConnectWalletDetailsModal = () => {
|
||||||
const theme = useAppTheme();
|
const theme = useAppTheme();
|
||||||
@@ -192,6 +194,18 @@ export const ConnectWalletDetailsModal = () => {
|
|||||||
chainName={chain?.name || "Unknown Network"}
|
chainName={chain?.name || "Unknown Network"}
|
||||||
onPress={onChangeNetworkPress}
|
onPress={onChangeNetworkPress}
|
||||||
/>
|
/>
|
||||||
|
{chain?.testnet && chain?.faucets?.length ? (
|
||||||
|
<IconTextButton
|
||||||
|
mt="xs"
|
||||||
|
text="Request Testnet Funds"
|
||||||
|
icon={<MoneyIcon height={10} width={10} />}
|
||||||
|
onPress={() => {
|
||||||
|
if (chain?.faucets?.[0]) {
|
||||||
|
Linking.openURL(chain.faucets[0]);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
{getAdditionalActions()}
|
{getAdditionalActions()}
|
||||||
{addressCopied === true ? (
|
{addressCopied === true ? (
|
||||||
<Toast text={"Address copied to clipboard"} />
|
<Toast text={"Address copied to clipboard"} />
|
||||||
|
|||||||
+14
-15
@@ -3,8 +3,7 @@ import BaseButton from "../base/BaseButton";
|
|||||||
import { ChainIcon } from "../base/ChainIcon";
|
import { ChainIcon } from "../base/ChainIcon";
|
||||||
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, useChain } from "@thirdweb-dev/react-core";
|
||||||
import { useActiveChain } from "@thirdweb-dev/react-core/evm";
|
|
||||||
import { StyleSheet } from "react-native";
|
import { StyleSheet } from "react-native";
|
||||||
import { LocalWallet } from "@thirdweb-dev/wallets";
|
import { LocalWallet } from "@thirdweb-dev/wallets";
|
||||||
import { useModalState } from "../../providers/ui-context-provider";
|
import { useModalState } from "../../providers/ui-context-provider";
|
||||||
@@ -12,7 +11,7 @@ import Box from "../base/Box";
|
|||||||
|
|
||||||
export type ConnectWalletDetailsProps = {
|
export type ConnectWalletDetailsProps = {
|
||||||
address: string;
|
address: string;
|
||||||
detailsButton?: React.ReactElement;
|
detailsButton?: React.FC<{ onPress: () => void }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WalletDetailsButton = ({
|
export const WalletDetailsButton = ({
|
||||||
@@ -20,7 +19,7 @@ export const WalletDetailsButton = ({
|
|||||||
detailsButton,
|
detailsButton,
|
||||||
}: ConnectWalletDetailsProps) => {
|
}: ConnectWalletDetailsProps) => {
|
||||||
const activeWallet = useWallet();
|
const activeWallet = useWallet();
|
||||||
const chain = useActiveChain();
|
const chain = useChain();
|
||||||
const balanceQuery = useBalance();
|
const balanceQuery = useBalance();
|
||||||
const { setModalState } = useModalState();
|
const { setModalState } = useModalState();
|
||||||
|
|
||||||
@@ -38,15 +37,15 @@ export const WalletDetailsButton = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<BaseButton
|
{detailsButton ? (
|
||||||
backgroundColor="background"
|
detailsButton({ onPress })
|
||||||
borderColor="border"
|
) : (
|
||||||
style={styles.walletDetails}
|
<BaseButton
|
||||||
onPress={onPress}
|
backgroundColor="background"
|
||||||
>
|
borderColor="border"
|
||||||
{detailsButton ? (
|
style={styles.walletDetails}
|
||||||
detailsButton
|
onPress={onPress}
|
||||||
) : (
|
>
|
||||||
<Box flex={1} flexDirection="row" justifyContent="space-between">
|
<Box flex={1} flexDirection="row" justifyContent="space-between">
|
||||||
<ChainIcon size={32} chainIconUrl={chain?.icon?.url} />
|
<ChainIcon size={32} chainIconUrl={chain?.icon?.url} />
|
||||||
<Box justifyContent="center" alignItems="flex-start">
|
<Box justifyContent="center" alignItems="flex-start">
|
||||||
@@ -70,8 +69,8 @@ export const WalletDetailsButton = ({
|
|||||||
iconUri={activeWallet?.getMeta().iconURL || ""}
|
iconUri={activeWallet?.getMeta().iconURL || ""}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
</BaseButton>
|
||||||
</BaseButton>
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,56 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 3.14.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1238](https://github.com/thirdweb-dev/js/pull/1238) [`6e1fe6e5`](https://github.com/thirdweb-dev/js/commit/6e1fe6e582d4178884fc1793b330a9e477df5b4d) Thanks [@iketw](https://github.com/iketw)! - '[React] Adds Rainbow and Trust wallets hooks'
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { useRainbowWallet, useTrustWallet } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const connectWithRainbow = useRainbowWallet();
|
||||||
|
|
||||||
|
const connectWithTrust = useTrustWallet();
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1237](https://github.com/thirdweb-dev/js/pull/1237) [`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b) Thanks [@iketw](https://github.com/iketw)! - [React] Add Rainbow Wallet (implementing the WalletConnect wallet)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const activeChain = "ethereum";
|
||||||
|
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
supportedWallets={[rainbowWallet()]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1236](https://github.com/thirdweb-dev/js/pull/1236) [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f) Thanks [@iketw](https://github.com/iketw)! - [Wallets/React] Add Trust Wallet
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const activeChain = "mumbai";
|
||||||
|
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
autoSwitch={true}
|
||||||
|
supportedWallets={[trustWallet()]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`1d76334d`](https://github.com/thirdweb-dev/js/commit/1d76334dd3884703629835422f241d2825128f6f), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
- @thirdweb-dev/[email protected]
|
||||||
|
|
||||||
## 3.14.2
|
## 3.14.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "3.14.2",
|
"version": "3.14.3",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { useConnect } from "@thirdweb-dev/react-core";
|
||||||
|
import { useCallback } from "react";
|
||||||
|
|
||||||
|
export function useRainbowWallet() {
|
||||||
|
const connect = useConnect();
|
||||||
|
return useCallback(
|
||||||
|
async (connectOptions?: { chainId?: number }) => {
|
||||||
|
const { rainbowWallet } = await import(
|
||||||
|
"../../../wallet/wallets/rainbow/RainbowWallet"
|
||||||
|
);
|
||||||
|
return connect(rainbowWallet(), connectOptions);
|
||||||
|
},
|
||||||
|
[connect],
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { useConnect } from "@thirdweb-dev/react-core";
|
||||||
|
import { useCallback } from "react";
|
||||||
|
|
||||||
|
export function useTrustWallet() {
|
||||||
|
const connect = useConnect();
|
||||||
|
return useCallback(
|
||||||
|
async (connectOptions?: { chainId?: number }) => {
|
||||||
|
const { trustWallet } = await import(
|
||||||
|
"../../../wallet/wallets/trustWallet/TrustWallet"
|
||||||
|
);
|
||||||
|
return connect(trustWallet(), connectOptions);
|
||||||
|
},
|
||||||
|
[connect],
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -20,6 +20,8 @@ export { ThirdwebProvider } from "./providers/thirdweb-provider";
|
|||||||
export { useInstalledWallets } from "../wallet/hooks/useInstalledWallets";
|
export { useInstalledWallets } from "../wallet/hooks/useInstalledWallets";
|
||||||
|
|
||||||
// wallet connection hooks
|
// wallet connection hooks
|
||||||
|
export { useRainbowWallet } from "./hooks/wallets/useRainbowWallet";
|
||||||
|
export { useTrustWallet } from "./hooks/wallets/useTrustWallet";
|
||||||
export { useMetamask } from "./hooks/wallets/useMetamask";
|
export { useMetamask } from "./hooks/wallets/useMetamask";
|
||||||
export { useCoinbaseWallet } from "./hooks/wallets/useCoinbaseWallet";
|
export { useCoinbaseWallet } from "./hooks/wallets/useCoinbaseWallet";
|
||||||
export { useFrameWallet } from "./hooks/wallets/useFrame";
|
export { useFrameWallet } from "./hooks/wallets/useFrame";
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ export { coinbaseWallet } from "./wallet/wallets/coinbase/coinbaseWallet";
|
|||||||
export { frameWallet } from "./wallet/wallets/frame/frameWallet";
|
export { frameWallet } from "./wallet/wallets/frame/frameWallet";
|
||||||
export { metamaskWallet } from "./wallet/wallets/metamask/metamaskWallet";
|
export { metamaskWallet } from "./wallet/wallets/metamask/metamaskWallet";
|
||||||
export { paperWallet } from "./wallet/wallets/paperWallet";
|
export { paperWallet } from "./wallet/wallets/paperWallet";
|
||||||
|
export { rainbowWallet } from "./wallet/wallets/rainbow/RainbowWallet";
|
||||||
export { safeWallet } from "./wallet/wallets/safe/safeWallet";
|
export { safeWallet } from "./wallet/wallets/safe/safeWallet";
|
||||||
|
export { trustWallet } from "./wallet/wallets/trustWallet/TrustWallet";
|
||||||
export { walletConnect } from "./wallet/wallets/walletConnect";
|
export { walletConnect } from "./wallet/wallets/walletConnect";
|
||||||
export { walletConnectV1 } from "./wallet/wallets/walletConnectV1";
|
export { walletConnectV1 } from "./wallet/wallets/walletConnectV1";
|
||||||
export { smartWallet } from "./wallet/wallets/smartWallet/smartWallet";
|
export { smartWallet } from "./wallet/wallets/smartWallet/smartWallet";
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { assertWindowEthereum } from "@thirdweb-dev/wallets";
|
|||||||
export function useInstalledWallets() {
|
export function useInstalledWallets() {
|
||||||
let isMetamaskInstalled = false;
|
let isMetamaskInstalled = false;
|
||||||
let isCoinbaseWalletInstalled = false;
|
let isCoinbaseWalletInstalled = false;
|
||||||
|
let isTrustWalletInstalled: boolean | undefined = false;
|
||||||
|
|
||||||
if (assertWindowEthereum(globalThis.window)) {
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
isMetamaskInstalled = globalThis.window.ethereum?.isMetaMask;
|
isMetamaskInstalled = globalThis.window.ethereum?.isMetaMask;
|
||||||
@@ -10,11 +11,13 @@ export function useInstalledWallets() {
|
|||||||
globalThis.window.ethereum?.isCoinbaseWallet ||
|
globalThis.window.ethereum?.isCoinbaseWallet ||
|
||||||
globalThis.window.ethereum?.providers?.some((p) => p.isCoinbaseWallet) ||
|
globalThis.window.ethereum?.providers?.some((p) => p.isCoinbaseWallet) ||
|
||||||
false;
|
false;
|
||||||
|
isTrustWalletInstalled = globalThis.window.ethereum?.isTrust;
|
||||||
}
|
}
|
||||||
|
|
||||||
const installedWallets = {
|
const installedWallets = {
|
||||||
metamask: !!isMetamaskInstalled,
|
metamask: !!isMetamaskInstalled,
|
||||||
coinbaseWallet: !!isCoinbaseWalletInstalled,
|
coinbaseWallet: !!isCoinbaseWalletInstalled,
|
||||||
|
trustWallet: !!isTrustWalletInstalled,
|
||||||
};
|
};
|
||||||
|
|
||||||
return installedWallets;
|
return installedWallets;
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import { ConnectUIProps, useConnect } from "@thirdweb-dev/react-core";
|
||||||
|
import { WalletConnect } from "@thirdweb-dev/wallets";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { isMobile } from "../../../evm/utils/isMobile";
|
||||||
|
import { ConnectingScreen } from "../../ConnectWallet/screens/ConnectingScreen";
|
||||||
|
import { GetStartedScreen } from "../../ConnectWallet/screens/GetStartedScreen";
|
||||||
|
import { RainbowScan } from "./RainbowScan";
|
||||||
|
|
||||||
|
export const RainbowConnectUI = (props: ConnectUIProps<WalletConnect>) => {
|
||||||
|
const [screen, setScreen] = useState<
|
||||||
|
"connecting" | "scanning" | "get-started"
|
||||||
|
>("connecting");
|
||||||
|
const { walletConfig, close } = props;
|
||||||
|
const connect = useConnect();
|
||||||
|
|
||||||
|
const { goBack } = props;
|
||||||
|
|
||||||
|
const connectPrompted = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (connectPrompted.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if loading
|
||||||
|
(async () => {
|
||||||
|
// on mobile, open rainbow app link
|
||||||
|
if (isMobile()) {
|
||||||
|
window.open("https://rnbwapp.com");
|
||||||
|
} else {
|
||||||
|
// on desktop, show the rainbow scan qr code
|
||||||
|
setScreen("scanning");
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}, [walletConfig, close, connect, goBack]);
|
||||||
|
|
||||||
|
if (screen === "connecting") {
|
||||||
|
return (
|
||||||
|
<ConnectingScreen
|
||||||
|
onBack={props.goBack}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
supportLink="https://rainbow.me/"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen === "get-started") {
|
||||||
|
return (
|
||||||
|
<GetStartedScreen
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
chromeExtensionLink={walletConfig.meta.urls?.chrome}
|
||||||
|
googlePlayStoreLink={walletConfig.meta.urls?.android}
|
||||||
|
appleStoreLink={walletConfig.meta.urls?.ios}
|
||||||
|
onBack={props.goBack}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen === "scanning") {
|
||||||
|
return (
|
||||||
|
<RainbowScan
|
||||||
|
onBack={props.goBack}
|
||||||
|
onConnected={close}
|
||||||
|
onGetStarted={() => {
|
||||||
|
setScreen("get-started");
|
||||||
|
}}
|
||||||
|
walletConfig={walletConfig}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import { ScanScreen } from "../../ConnectWallet/screens/ScanScreen";
|
||||||
|
import {
|
||||||
|
useCreateWalletInstance,
|
||||||
|
useWalletContext,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import type { WalletConnect } from "@thirdweb-dev/wallets";
|
||||||
|
import type { WalletConfig } from "@thirdweb-dev/react-core";
|
||||||
|
|
||||||
|
export const RainbowScan: React.FC<{
|
||||||
|
onBack: () => void;
|
||||||
|
onGetStarted: () => void;
|
||||||
|
onConnected: () => void;
|
||||||
|
walletConfig: WalletConfig<WalletConnect>;
|
||||||
|
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
|
||||||
|
const createInstance = useCreateWalletInstance();
|
||||||
|
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
|
||||||
|
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
|
||||||
|
useWalletContext();
|
||||||
|
|
||||||
|
const scanStarted = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (scanStarted.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scanStarted.current = true;
|
||||||
|
|
||||||
|
const rainbow = createInstance(walletConfig);
|
||||||
|
|
||||||
|
setConnectionStatus("connecting");
|
||||||
|
rainbow.connectWithQrCode({
|
||||||
|
chainId: chainToConnect?.chainId,
|
||||||
|
onQrCodeUri(uri) {
|
||||||
|
setQrCodeUri(uri);
|
||||||
|
},
|
||||||
|
onConnected() {
|
||||||
|
setConnectedWallet(rainbow);
|
||||||
|
onConnected();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, [
|
||||||
|
createInstance,
|
||||||
|
setConnectedWallet,
|
||||||
|
chainToConnect,
|
||||||
|
onConnected,
|
||||||
|
walletConfig,
|
||||||
|
setConnectionStatus,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScanScreen
|
||||||
|
onBack={onBack}
|
||||||
|
onGetStarted={onGetStarted}
|
||||||
|
qrCodeUri={qrCodeUri}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import type { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
|
||||||
|
import { WalletConnect } from "@thirdweb-dev/wallets";
|
||||||
|
import { RainbowConnectUI } from "./RainbowConnectUI";
|
||||||
|
|
||||||
|
type RainbowWalletOptions = {
|
||||||
|
/**
|
||||||
|
* When connecting Rainbow using the QR Code - Wallet Connect connector is used which requires a project id.
|
||||||
|
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
|
||||||
|
*
|
||||||
|
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
|
||||||
|
*/
|
||||||
|
projectId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const rainbowWallet = (
|
||||||
|
options?: RainbowWalletOptions,
|
||||||
|
): WalletConfig<WalletConnect> => {
|
||||||
|
return {
|
||||||
|
id: "rainbow",
|
||||||
|
meta: {
|
||||||
|
name: "Rainbow Wallet",
|
||||||
|
iconURL:
|
||||||
|
"ipfs://QmSZn47p4DVVBfzvg9BAX2EqwnPxkT1YAE7rUnrtd9CybQ/rainbow-logo.png",
|
||||||
|
},
|
||||||
|
create: (walletOptions: WalletOptions) => {
|
||||||
|
return new WalletConnect({
|
||||||
|
...walletOptions,
|
||||||
|
walletId: "rainbow",
|
||||||
|
projectId: options?.projectId,
|
||||||
|
qrcode: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
connectUI: RainbowConnectUI,
|
||||||
|
isInstalled() {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
import { ConnectUIProps, useConnect } from "@thirdweb-dev/react-core";
|
||||||
|
import { TrustWallet } from "@thirdweb-dev/wallets";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import { isMobile } from "../../../evm/utils/isMobile";
|
||||||
|
import { ConnectingScreen } from "../../ConnectWallet/screens/ConnectingScreen";
|
||||||
|
import { GetStartedScreen } from "../../ConnectWallet/screens/GetStartedScreen";
|
||||||
|
import { TrustScan } from "./TrustScan";
|
||||||
|
|
||||||
|
export const TrustConnectUI = (props: ConnectUIProps<TrustWallet>) => {
|
||||||
|
const [screen, setScreen] = useState<
|
||||||
|
"connecting" | "scanning" | "get-started"
|
||||||
|
>("connecting");
|
||||||
|
const { walletConfig, close } = props;
|
||||||
|
const connect = useConnect();
|
||||||
|
|
||||||
|
const { goBack } = props;
|
||||||
|
|
||||||
|
const connectPrompted = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (connectPrompted.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isInstalled = walletConfig.isInstalled
|
||||||
|
? walletConfig.isInstalled()
|
||||||
|
: false;
|
||||||
|
|
||||||
|
// if loading
|
||||||
|
(async () => {
|
||||||
|
if (isInstalled) {
|
||||||
|
try {
|
||||||
|
connectPrompted.current = true;
|
||||||
|
setScreen("connecting");
|
||||||
|
await connect(walletConfig);
|
||||||
|
close();
|
||||||
|
} catch (e) {
|
||||||
|
goBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if trust is not injected
|
||||||
|
else {
|
||||||
|
// on mobile, open trust app link
|
||||||
|
if (isMobile()) {
|
||||||
|
window.open("https://link.trustwallet.com");
|
||||||
|
} else {
|
||||||
|
// on desktop, show the trust scan qr code
|
||||||
|
setScreen("scanning");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
}, [walletConfig, close, connect, goBack]);
|
||||||
|
|
||||||
|
if (screen === "connecting") {
|
||||||
|
return (
|
||||||
|
<ConnectingScreen
|
||||||
|
onBack={props.goBack}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
supportLink="https://community.trustwallet.com/c/helpcenter/8"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen === "get-started") {
|
||||||
|
return (
|
||||||
|
<GetStartedScreen
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
chromeExtensionLink={walletConfig.meta.urls?.chrome}
|
||||||
|
googlePlayStoreLink={walletConfig.meta.urls?.android}
|
||||||
|
appleStoreLink={walletConfig.meta.urls?.ios}
|
||||||
|
onBack={props.goBack}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (screen === "scanning") {
|
||||||
|
return (
|
||||||
|
<TrustScan
|
||||||
|
onBack={props.goBack}
|
||||||
|
onConnected={close}
|
||||||
|
onGetStarted={() => {
|
||||||
|
setScreen("get-started");
|
||||||
|
}}
|
||||||
|
walletConfig={walletConfig}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
import { ScanScreen } from "../../ConnectWallet/screens/ScanScreen";
|
||||||
|
import {
|
||||||
|
useCreateWalletInstance,
|
||||||
|
useWalletContext,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
import type { TrustWallet } from "@thirdweb-dev/wallets";
|
||||||
|
import type { WalletConfig } from "@thirdweb-dev/react-core";
|
||||||
|
|
||||||
|
export const TrustScan: React.FC<{
|
||||||
|
onBack: () => void;
|
||||||
|
onGetStarted: () => void;
|
||||||
|
onConnected: () => void;
|
||||||
|
walletConfig: WalletConfig<TrustWallet>;
|
||||||
|
}> = ({ onBack, onConnected, onGetStarted, walletConfig }) => {
|
||||||
|
const createInstance = useCreateWalletInstance();
|
||||||
|
const [qrCodeUri, setQrCodeUri] = useState<string | undefined>();
|
||||||
|
const { setConnectedWallet, chainToConnect, setConnectionStatus } =
|
||||||
|
useWalletContext();
|
||||||
|
|
||||||
|
const scanStarted = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (scanStarted.current) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
scanStarted.current = true;
|
||||||
|
|
||||||
|
const trust = createInstance(walletConfig);
|
||||||
|
|
||||||
|
setConnectionStatus("connecting");
|
||||||
|
trust.connectWithQrCode({
|
||||||
|
chainId: chainToConnect?.chainId,
|
||||||
|
onQrCodeUri(uri) {
|
||||||
|
setQrCodeUri(uri);
|
||||||
|
},
|
||||||
|
onConnected() {
|
||||||
|
setConnectedWallet(trust);
|
||||||
|
onConnected();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}, [
|
||||||
|
createInstance,
|
||||||
|
setConnectedWallet,
|
||||||
|
chainToConnect,
|
||||||
|
onConnected,
|
||||||
|
walletConfig,
|
||||||
|
setConnectionStatus,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ScanScreen
|
||||||
|
onBack={onBack}
|
||||||
|
onGetStarted={onGetStarted}
|
||||||
|
qrCodeUri={qrCodeUri}
|
||||||
|
walletName={walletConfig.meta.name}
|
||||||
|
walletIconURL={walletConfig.meta.iconURL}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import type { WalletOptions, WalletConfig } from "@thirdweb-dev/react-core";
|
||||||
|
import { TrustWallet, assertWindowEthereum } from "@thirdweb-dev/wallets";
|
||||||
|
import { TrustConnectUI } from "./TrustConnectUI";
|
||||||
|
|
||||||
|
type TrustWalletOptions = {
|
||||||
|
/**
|
||||||
|
* When connecting Trust using the QR Code - Wallet Connect connector is used which requires a project id.
|
||||||
|
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
|
||||||
|
*
|
||||||
|
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
|
||||||
|
*/
|
||||||
|
projectId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const trustWallet = (
|
||||||
|
options?: TrustWalletOptions,
|
||||||
|
): WalletConfig<TrustWallet> => {
|
||||||
|
return {
|
||||||
|
id: TrustWallet.id,
|
||||||
|
meta: TrustWallet.meta,
|
||||||
|
create: (walletOptions: WalletOptions) => {
|
||||||
|
return new TrustWallet({
|
||||||
|
...walletOptions,
|
||||||
|
projectId: options?.projectId,
|
||||||
|
qrcode: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
connectUI: TrustConnectUI,
|
||||||
|
isInstalled() {
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
return !!globalThis.window.ethereum.isTrust;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,5 +1,18 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 3.10.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1233](https://github.com/thirdweb-dev/js/pull/1233) [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186) Thanks [@nkrishang](https://github.com/nkrishang)! - Fix smartWalletFactory.getAllEvents
|
||||||
|
|
||||||
|
- [#1241](https://github.com/thirdweb-dev/js/pull/1241) [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea) Thanks [@nkrishang](https://github.com/nkrishang)! - Use fn getAllAccounts instead of event logs AccountCreated
|
||||||
|
|
||||||
|
- Updated dependencies [[`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/storage@1.1.5
|
||||||
|
- @thirdweb-dev/contracts-js@1.3.7
|
||||||
|
- @thirdweb-dev/chains@0.1.24
|
||||||
|
|
||||||
## 3.10.24
|
## 3.10.24
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "3.10.24",
|
"version": "3.10.25",
|
||||||
"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",
|
||||||
|
|||||||
@@ -669,7 +669,7 @@ export class Erc721<
|
|||||||
* @param quantity - Quantity of the tokens you want to claim
|
* @param quantity - Quantity of the tokens you want to claim
|
||||||
*
|
*
|
||||||
* @returns - an array of results containing the id of the token claimed, the transaction receipt and a promise to optionally fetch the nft metadata
|
* @returns - an array of results containing the id of the token claimed, the transaction receipt and a promise to optionally fetch the nft metadata
|
||||||
* @twfeature ERC721ClaimCustom | ERC721ClaimPhasesV2 | ERC721ClaimPhasesV1 | ERC721ClaimConditionsV2 | ERC721ClaimConditionsV1
|
* @twfeature ERC721ClaimCustom | ERC721ClaimPhasesV2 | ERC721ClaimPhasesV1 | ERC721ClaimConditionsV2 | ERC721ClaimConditionsV1 | ERC721ClaimZora
|
||||||
*/
|
*/
|
||||||
claim = /* @__PURE__ */ buildTransactionFunction(
|
claim = /* @__PURE__ */ buildTransactionFunction(
|
||||||
async (quantity: BigNumberish, options?: ClaimOptions) => {
|
async (quantity: BigNumberish, options?: ClaimOptions) => {
|
||||||
@@ -701,7 +701,7 @@ export class Erc721<
|
|||||||
* @param quantity - Quantity of the tokens you want to claim
|
* @param quantity - Quantity of the tokens you want to claim
|
||||||
* @param options
|
* @param options
|
||||||
* @returns - an array of results containing the id of the token claimed, the transaction receipt and a promise to optionally fetch the nft metadata
|
* @returns - an array of results containing the id of the token claimed, the transaction receipt and a promise to optionally fetch the nft metadata
|
||||||
* @twfeature ERC721ClaimCustom | ERC721ClaimPhasesV2 | ERC721ClaimPhasesV1 | ERC721ClaimConditionsV2 | ERC721ClaimConditionsV1
|
* @twfeature ERC721ClaimCustom | ERC721ClaimPhasesV2 | ERC721ClaimPhasesV1 | ERC721ClaimConditionsV2 | ERC721ClaimConditionsV1 | ERC721ClaimZora
|
||||||
*/
|
*/
|
||||||
claimTo = /* @__PURE__ */ buildTransactionFunction(
|
claimTo = /* @__PURE__ */ buildTransactionFunction(
|
||||||
async (
|
async (
|
||||||
|
|||||||
@@ -103,17 +103,22 @@ export class SmartWalletFactory<TContract extends IAccountFactory>
|
|||||||
*
|
*
|
||||||
* @twfeature SmartWalletFactory
|
* @twfeature SmartWalletFactory
|
||||||
*/
|
*/
|
||||||
public async getAllWallets(): Promise<AccountEvent[]> {
|
public async getAllAccounts(): Promise<AccountEvent[]> {
|
||||||
const filter = {
|
const allAccounts =
|
||||||
fromBlock: 0,
|
await this.contractWrapper.readContract.getAllAccounts();
|
||||||
toBlock: "latest",
|
|
||||||
};
|
|
||||||
|
|
||||||
const events = await this.events.getEvents("AccountCreated", filter);
|
/**
|
||||||
|
* Note: an account can have multiple admins. In this function, we only return the first signer associated with
|
||||||
|
* the account. This should be the admin that created the account, unless this admin has lost their admin status.
|
||||||
|
*/
|
||||||
|
return await Promise.all(
|
||||||
|
allAccounts.map(async (account) => {
|
||||||
|
const assosiatedSigners = await this.getAssociatedSigners(account);
|
||||||
|
const admin = assosiatedSigners[0];
|
||||||
|
|
||||||
return events.map((event) => {
|
return { account, admin };
|
||||||
return { account: event.data.account, admin: event.data.accountAdmin };
|
}),
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/storage
|
# @thirdweb-dev/storage
|
||||||
|
|
||||||
|
## 1.1.5
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1246](https://github.com/thirdweb-dev/js/pull/1246) [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c) Thanks [@nessup](https://github.com/nessup)! - Remove the ipfs-2 gateway due to connectivity errors that seem to happen with certain ISPs
|
||||||
|
|
||||||
## 1.1.4
|
## 1.1.4
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/storage",
|
"name": "@thirdweb-dev/storage",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"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,7 +6,6 @@ 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-2.thirdwebcdn.com/ipfs/",
|
|
||||||
"https://ipfs-3.thirdwebcdn.com/ipfs/",
|
"https://ipfs-3.thirdwebcdn.com/ipfs/",
|
||||||
"https://ipfs-4.thirdwebcdn.com/ipfs/",
|
"https://ipfs-4.thirdwebcdn.com/ipfs/",
|
||||||
"https://ipfs-5.thirdwebcdn.com/ipfs/",
|
"https://ipfs-5.thirdwebcdn.com/ipfs/",
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
# @thirdweb-dev/unity-js-bridge
|
# @thirdweb-dev/unity-js-bridge
|
||||||
|
|
||||||
|
## 0.2.40
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b), [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f), [`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`0c5b03b8`](https://github.com/thirdweb-dev/js/commit/0c5b03b8d6cc6a4e69bb2a4647d3626e69f1283c), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/wallets@0.3.3
|
||||||
|
- @thirdweb-dev/sdk@3.10.25
|
||||||
|
- @thirdweb-dev/storage@1.1.5
|
||||||
|
- @thirdweb-dev/chains@0.1.24
|
||||||
|
- @thirdweb-dev/auth@3.2.3
|
||||||
|
|
||||||
## 0.2.39
|
## 0.2.39
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/unity-js-bridge",
|
"name": "@thirdweb-dev/unity-js-bridge",
|
||||||
"version": "0.2.39",
|
"version": "0.2.40",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,44 @@
|
|||||||
# @thirdweb-dev/wallets
|
# @thirdweb-dev/wallets
|
||||||
|
|
||||||
|
## 0.3.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1237](https://github.com/thirdweb-dev/js/pull/1237) [`536b0f12`](https://github.com/thirdweb-dev/js/commit/536b0f1240ab446aac22cf547a4e09e73ee6bf7b) Thanks [@iketw](https://github.com/iketw)! - [React] Add Rainbow Wallet (implementing the WalletConnect wallet)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { ThirdwebProvider, rainbowWallet } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const activeChain = "ethereum";
|
||||||
|
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
supportedWallets={[rainbowWallet()]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
- [#1236](https://github.com/thirdweb-dev/js/pull/1236) [`b626782b`](https://github.com/thirdweb-dev/js/commit/b626782b0e8c6b76673472d3aee1c802dfb11b5f) Thanks [@iketw](https://github.com/iketw)! - [Wallets/React] Add Trust Wallet
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { ThirdwebProvider, trustWallet } from "@thirdweb-dev/react";
|
||||||
|
|
||||||
|
const activeChain = "mumbai";
|
||||||
|
|
||||||
|
<ThirdwebProvider
|
||||||
|
activeChain={activeChain}
|
||||||
|
autoSwitch={true}
|
||||||
|
supportedWallets={[trustWallet()]}
|
||||||
|
>
|
||||||
|
<App />
|
||||||
|
</ThirdwebProvider>;
|
||||||
|
```
|
||||||
|
|
||||||
|
- Updated dependencies [[`d498c79a`](https://github.com/thirdweb-dev/js/commit/d498c79a911d478077dfb8a2490eb1bf91523186), [`9af346ee`](https://github.com/thirdweb-dev/js/commit/9af346eeada1037be27c8d3c9e1777f7be11a8ea)]:
|
||||||
|
- @thirdweb-dev/sdk@3.10.25
|
||||||
|
- @thirdweb-dev/chains@0.1.24
|
||||||
|
|
||||||
## 0.3.2
|
## 0.3.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main": "dist/thirdweb-dev-wallets-evm-connectors-trust.cjs.js",
|
||||||
|
"module": "dist/thirdweb-dev-wallets-evm-connectors-trust.esm.js",
|
||||||
|
"browser": {
|
||||||
|
"./dist/thirdweb-dev-wallets-evm-connectors-trust.esm.js": "./dist/thirdweb-dev-wallets-evm-connectors-trust.browser.esm.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main": "dist/thirdweb-dev-wallets-evm-wallets-trust.cjs.js",
|
||||||
|
"module": "dist/thirdweb-dev-wallets-evm-wallets-trust.esm.js",
|
||||||
|
"browser": {
|
||||||
|
"./dist/thirdweb-dev-wallets-evm-wallets-trust.esm.js": "./dist/thirdweb-dev-wallets-evm-wallets-trust.browser.esm.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/wallets",
|
"name": "@thirdweb-dev/wallets",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"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",
|
||||||
@@ -57,6 +57,13 @@
|
|||||||
},
|
},
|
||||||
"default": "./evm/wallets/magic/dist/thirdweb-dev-wallets-evm-wallets-magic.cjs.js"
|
"default": "./evm/wallets/magic/dist/thirdweb-dev-wallets-evm-wallets-magic.cjs.js"
|
||||||
},
|
},
|
||||||
|
"./evm/wallets/trust": {
|
||||||
|
"module": {
|
||||||
|
"browser": "./evm/wallets/trust/dist/thirdweb-dev-wallets-evm-wallets-trust.browser.esm.js",
|
||||||
|
"default": "./evm/wallets/trust/dist/thirdweb-dev-wallets-evm-wallets-trust.esm.js"
|
||||||
|
},
|
||||||
|
"default": "./evm/wallets/trust/dist/thirdweb-dev-wallets-evm-wallets-trust.cjs.js"
|
||||||
|
},
|
||||||
"./evm/wallets/ethers": {
|
"./evm/wallets/ethers": {
|
||||||
"module": {
|
"module": {
|
||||||
"browser": "./evm/wallets/ethers/dist/thirdweb-dev-wallets-evm-wallets-ethers.browser.esm.js",
|
"browser": "./evm/wallets/ethers/dist/thirdweb-dev-wallets-evm-wallets-ethers.browser.esm.js",
|
||||||
@@ -176,6 +183,13 @@
|
|||||||
},
|
},
|
||||||
"default": "./evm/connectors/paper/dist/thirdweb-dev-wallets-evm-connectors-paper.cjs.js"
|
"default": "./evm/connectors/paper/dist/thirdweb-dev-wallets-evm-connectors-paper.cjs.js"
|
||||||
},
|
},
|
||||||
|
"./evm/connectors/trust": {
|
||||||
|
"module": {
|
||||||
|
"browser": "./evm/connectors/trust/dist/thirdweb-dev-wallets-evm-connectors-trust.browser.esm.js",
|
||||||
|
"default": "./evm/connectors/trust/dist/thirdweb-dev-wallets-evm-connectors-trust.esm.js"
|
||||||
|
},
|
||||||
|
"default": "./evm/connectors/trust/dist/thirdweb-dev-wallets-evm-connectors-trust.cjs.js"
|
||||||
|
},
|
||||||
"./evm/wallets/wallet-connect": {
|
"./evm/wallets/wallet-connect": {
|
||||||
"module": {
|
"module": {
|
||||||
"browser": "./evm/wallets/wallet-connect/dist/thirdweb-dev-wallets-evm-wallets-wallet-connect.browser.esm.js",
|
"browser": "./evm/wallets/wallet-connect/dist/thirdweb-dev-wallets-evm-wallets-wallet-connect.browser.esm.js",
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { InjectedConnector, InjectedConnectorOptions } from "../injected";
|
||||||
|
import { assertWindowEthereum } from "../../utils/assertWindowEthereum";
|
||||||
|
import { Ethereum } from "../injected/types";
|
||||||
|
import type { Chain } from "@thirdweb-dev/chains";
|
||||||
|
import { AsyncStorage } from "../../../core/AsyncStorage";
|
||||||
|
|
||||||
|
type TrustConnectorConstructorArg = {
|
||||||
|
chains?: Chain[];
|
||||||
|
connectorStorage: AsyncStorage;
|
||||||
|
options?: InjectedConnectorOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class TrustConnector extends InjectedConnector {
|
||||||
|
constructor(arg: TrustConnectorConstructorArg) {
|
||||||
|
const defaultOptions = {
|
||||||
|
name: "Trust",
|
||||||
|
getProvider() {
|
||||||
|
function getReady(ethereum?: Ethereum) {
|
||||||
|
const isTrust = !!ethereum?.isTrust;
|
||||||
|
if (!isTrust) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return ethereum;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
if (globalThis.window.ethereum?.providers) {
|
||||||
|
return globalThis.window.ethereum.providers.find(getReady);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getReady(globalThis.window.ethereum);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
...defaultOptions,
|
||||||
|
...arg.options,
|
||||||
|
};
|
||||||
|
super({
|
||||||
|
chains: arg.chains,
|
||||||
|
options,
|
||||||
|
connectorStorage: arg.connectorStorage,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ export const walletIds = {
|
|||||||
localWallet: "localWallet",
|
localWallet: "localWallet",
|
||||||
smartWallet: "smartWallet",
|
smartWallet: "smartWallet",
|
||||||
safe: "safe",
|
safe: "safe",
|
||||||
|
trust: "trust",
|
||||||
walletConnectV1: "walletConnectV1",
|
walletConnectV1: "walletConnectV1",
|
||||||
walletConnect: "walletConnect",
|
walletConnect: "walletConnect",
|
||||||
magicLink: "magicLink",
|
magicLink: "magicLink",
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ export * from "./wallets/smart-wallet";
|
|||||||
export * from "./wallets/ethers";
|
export * from "./wallets/ethers";
|
||||||
export * from "./wallets/private-key";
|
export * from "./wallets/private-key";
|
||||||
export * from "./wallets/zerion";
|
export * from "./wallets/zerion";
|
||||||
|
export * from "./wallets/trust";
|
||||||
|
|
||||||
export type { Chain } from "@thirdweb-dev/chains";
|
export type { Chain } from "@thirdweb-dev/chains";
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,153 @@
|
|||||||
|
import type { WalletConnectConnector as WalletConnectConnectorType } from "../connectors/wallet-connect";
|
||||||
|
import type { QRModalOptions } from "../connectors/wallet-connect/qrModalOptions";
|
||||||
|
import { Connector, WagmiAdapter } from "../interfaces/connector";
|
||||||
|
import { assertWindowEthereum } from "../utils/assertWindowEthereum";
|
||||||
|
import { AbstractClientWallet, WalletOptions } from "./base";
|
||||||
|
import type { TrustConnector as TrustConnectorType } from "../connectors/trust";
|
||||||
|
import { walletIds } from "../constants/walletIds";
|
||||||
|
import { TW_WC_PROJECT_ID } from "../constants/wc";
|
||||||
|
|
||||||
|
type TrustAdditionalOptions = {
|
||||||
|
/**
|
||||||
|
* Whether to open the default Wallet Connect QR code Modal for connecting to Trust Wallet on mobile if Trust is not injected when calling connect().
|
||||||
|
*/
|
||||||
|
qrcode?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When connecting Trust using the QR Code - Wallet Connect connector is used which requires a project id.
|
||||||
|
* This project id is Your project’s unique identifier for wallet connect that can be obtained at cloud.walletconnect.com.
|
||||||
|
*
|
||||||
|
* https://docs.walletconnect.com/2.0/web3modal/options#projectid-required
|
||||||
|
*/
|
||||||
|
projectId?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* options to customize the Wallet Connect QR Code Modal ( only relevant when qrcode is true )
|
||||||
|
*
|
||||||
|
* https://docs.walletconnect.com/2.0/web3modal/options
|
||||||
|
*/
|
||||||
|
qrModalOptions?: QRModalOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TrustWalletOptions = WalletOptions<TrustAdditionalOptions>;
|
||||||
|
|
||||||
|
type ConnectWithQrCodeArgs = {
|
||||||
|
chainId?: number;
|
||||||
|
onQrCodeUri: (uri: string) => void;
|
||||||
|
onConnected: (accountAddress: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class TrustWallet extends AbstractClientWallet<TrustAdditionalOptions> {
|
||||||
|
connector?: Connector;
|
||||||
|
walletConnectConnector?: WalletConnectConnectorType;
|
||||||
|
trustConnector?: TrustConnectorType;
|
||||||
|
isInjected: boolean;
|
||||||
|
|
||||||
|
static meta = {
|
||||||
|
name: "Trust Wallet",
|
||||||
|
iconURL:
|
||||||
|
"ipfs://QmNigQbXk7wKZwDcgN38Znj1ZZQ3JEG3DD6fUKLBU8SUTP/trust%20wallet.svg",
|
||||||
|
urls: {
|
||||||
|
chrome:
|
||||||
|
"https://chrome.google.com/webstore/detail/trust-wallet/egjidjbpglichdcondbcbdnbeeppgdph",
|
||||||
|
android:
|
||||||
|
"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
|
||||||
|
ios: "https://apps.apple.com/us/app/trust-crypto-bitcoin-wallet/id1288339409",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static id = walletIds.trust;
|
||||||
|
|
||||||
|
public get walletName() {
|
||||||
|
return "Trust Wallet" as const;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(options: TrustWalletOptions) {
|
||||||
|
super(TrustWallet.id, options);
|
||||||
|
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
this.isInjected = !!globalThis.window.ethereum?.isTrust;
|
||||||
|
} else {
|
||||||
|
this.isInjected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async getConnector(): Promise<Connector> {
|
||||||
|
if (!this.connector) {
|
||||||
|
// if trust is injected, use the injected connector
|
||||||
|
// otherwise, use the wallet connect connector for using the trust app on mobile via QR code scan
|
||||||
|
|
||||||
|
if (this.isInjected) {
|
||||||
|
// import the connector dynamically
|
||||||
|
const { TrustConnector } = await import("../connectors/trust");
|
||||||
|
const trustConnector = new TrustConnector({
|
||||||
|
chains: this.chains,
|
||||||
|
connectorStorage: this.walletStorage,
|
||||||
|
options: {
|
||||||
|
shimDisconnect: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.trustConnector = trustConnector;
|
||||||
|
|
||||||
|
this.connector = new WagmiAdapter(trustConnector);
|
||||||
|
} else {
|
||||||
|
const { WalletConnectConnector } = await import(
|
||||||
|
"../connectors/wallet-connect"
|
||||||
|
);
|
||||||
|
|
||||||
|
const walletConnectConnector = new WalletConnectConnector({
|
||||||
|
chains: this.chains,
|
||||||
|
options: {
|
||||||
|
projectId: this.options?.projectId || TW_WC_PROJECT_ID, // TODO,
|
||||||
|
storage: this.walletStorage,
|
||||||
|
qrcode: this.options?.qrcode,
|
||||||
|
dappMetadata: this.dappMetadata,
|
||||||
|
qrModalOptions: this.options?.qrModalOptions,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// need to save this for getting the QR code URI
|
||||||
|
this.walletConnectConnector = walletConnectConnector;
|
||||||
|
this.connector = new WagmiAdapter(walletConnectConnector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.connector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* connect to wallet with QR code
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* trust.connectWithQrCode({
|
||||||
|
* chainId: 1,
|
||||||
|
* onQrCodeUri(qrCodeUri) {
|
||||||
|
* // render the QR code with `qrCodeUri`
|
||||||
|
* },
|
||||||
|
* onConnected(accountAddress) {
|
||||||
|
* // update UI to show connected state
|
||||||
|
* },
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
async connectWithQrCode(options: ConnectWithQrCodeArgs) {
|
||||||
|
await this.getConnector();
|
||||||
|
const wcConnector = this.walletConnectConnector;
|
||||||
|
|
||||||
|
if (!wcConnector) {
|
||||||
|
throw new Error("WalletConnect connector not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const wcProvider = await wcConnector.getProvider();
|
||||||
|
|
||||||
|
// set a listener for display_uri event
|
||||||
|
wcProvider.on("display_uri", (uri) => {
|
||||||
|
options.onQrCodeUri(uri);
|
||||||
|
});
|
||||||
|
|
||||||
|
// trigger connect flow
|
||||||
|
this.connect({ chainId: options.chainId }).then(options.onConnected);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,6 +9,12 @@ import { walletIds } from "../constants/walletIds";
|
|||||||
|
|
||||||
export type WC2_QRModalOptions = QRModalOptions;
|
export type WC2_QRModalOptions = QRModalOptions;
|
||||||
|
|
||||||
|
type ConnectWithQrCodeArgs = {
|
||||||
|
chainId?: number;
|
||||||
|
onQrCodeUri: (uri: string) => void;
|
||||||
|
onConnected: (accountAddress: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
export type WalletConnectOptions = {
|
export type WalletConnectOptions = {
|
||||||
/**
|
/**
|
||||||
* Your project’s unique identifier that can be obtained at cloud.walletconnect.com. Enables following functionalities within Web3Modal: wallet and chain logos, optional WalletConnect RPC, support for all wallets from our Explorer and WalletConnect v2 support. Defaults to undefined.
|
* Your project’s unique identifier that can be obtained at cloud.walletconnect.com. Enables following functionalities within Web3Modal: wallet and chain logos, optional WalletConnect RPC, support for all wallets from our Explorer and WalletConnect v2 support. Defaults to undefined.
|
||||||
@@ -152,4 +158,22 @@ export class WalletConnect extends AbstractClientWallet<WalletConnectOptions> {
|
|||||||
this.#onSessionRequestSent,
|
this.#onSessionRequestSent,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async connectWithQrCode(options: ConnectWithQrCodeArgs) {
|
||||||
|
await this.getConnector();
|
||||||
|
const wcConnector = this.#walletConnectConnector;
|
||||||
|
|
||||||
|
if (!wcConnector) {
|
||||||
|
throw new Error("WalletConnect connector not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const wcProvider = await wcConnector.getProvider();
|
||||||
|
|
||||||
|
wcProvider.on("display_uri", (uri) => {
|
||||||
|
options.onQrCodeUri(uri);
|
||||||
|
});
|
||||||
|
|
||||||
|
// trigger connect flow
|
||||||
|
this.connect({ chainId: options.chainId }).then(options.onConnected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+320
-2245
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user