diff --git a/apps/playground/src/pages/react/ui-components/connect-wallet.tsx b/apps/playground/src/pages/react/ui-components/connect-wallet.tsx
index 34d22e3f2..04c954bda 100644
--- a/apps/playground/src/pages/react/ui-components/connect-wallet.tsx
+++ b/apps/playground/src/pages/react/ui-components/connect-wallet.tsx
@@ -162,11 +162,6 @@ function Right() {
},
announce: [
"wss://dev.btt.cf-identity-wallet.metadata.dev.cf-deployments.org",
- "https://pro.passwordchaos.gimbalabs.io",
- "wss://tracker.files.fm:7073/announce",
- "wss://tracker.btorrent.xyz",
- "ws://tracker.files.fm:7072/announce",
- "wss://tracker.openwebtorrent.com:443/announce",
],
}}
/>
diff --git a/packages/mesh-common/package.json b/packages/mesh-common/package.json
index 6e4de9e98..6ec29a397 100644
--- a/packages/mesh-common/package.json
+++ b/packages/mesh-common/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/common",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Contains constants, types and interfaces used across the SDK and different serialization libraries",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
diff --git a/packages/mesh-contract/package.json b/packages/mesh-contract/package.json
index 3847e8fa0..5167da5a6 100644
--- a/packages/mesh-contract/package.json
+++ b/packages/mesh-contract/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/contract",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -34,9 +34,9 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
- "@meshsdk/core": "1.7.23",
- "@meshsdk/core-csl": "1.7.23"
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/core": "1.7.24",
+ "@meshsdk/core-csl": "1.7.24"
},
"prettier": "@meshsdk/configs/prettier",
"publishConfig": {
diff --git a/packages/mesh-core-csl/package.json b/packages/mesh-core-csl/package.json
index 0a0386ed9..c56a81319 100644
--- a/packages/mesh-core-csl/package.json
+++ b/packages/mesh-core-csl/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core-csl",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Types and utilities functions between Mesh and cardano-serialization-lib",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@meshsdk/configs": "*",
- "@meshsdk/provider": "1.7.23",
+ "@meshsdk/provider": "1.7.24",
"@types/json-bigint": "^1.0.4",
"eslint": "^8.57.0",
"ts-jest": "^29.1.4",
@@ -39,7 +39,7 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
+ "@meshsdk/common": "1.7.24",
"@sidan-lab/sidan-csl-rs-browser": "0.9.7",
"@sidan-lab/sidan-csl-rs-nodejs": "0.9.7",
"@types/base32-encoding": "^1.0.2",
diff --git a/packages/mesh-core-cst/package.json b/packages/mesh-core-cst/package.json
index ea34caf50..c30952a42 100644
--- a/packages/mesh-core-cst/package.json
+++ b/packages/mesh-core-cst/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core-cst",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Types and utilities functions between Mesh and cardano-js-sdk",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -42,7 +42,7 @@
"@harmoniclabs/cbor": "1.3.0",
"@harmoniclabs/plutus-data": "1.2.4",
"@harmoniclabs/uplc": "1.2.4",
- "@meshsdk/common": "1.7.23",
+ "@meshsdk/common": "1.7.24",
"@stricahq/bip32ed25519": "^1.1.0",
"@stricahq/cbors": "^1.0.3",
"pbkdf2": "^3.1.2"
diff --git a/packages/mesh-core/package.json b/packages/mesh-core/package.json
index dd5c419f4..e5cb26332 100644
--- a/packages/mesh-core/package.json
+++ b/packages/mesh-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/core",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Mesh SDK Core - https://meshjs.dev/",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -33,13 +33,13 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
- "@meshsdk/core-csl": "1.7.23",
- "@meshsdk/core-cst": "1.7.23",
- "@meshsdk/provider": "1.7.23",
- "@meshsdk/react": "1.7.23",
- "@meshsdk/transaction": "1.7.23",
- "@meshsdk/wallet": "1.7.23"
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/core-csl": "1.7.24",
+ "@meshsdk/core-cst": "1.7.24",
+ "@meshsdk/provider": "1.7.24",
+ "@meshsdk/react": "1.7.24",
+ "@meshsdk/transaction": "1.7.24",
+ "@meshsdk/wallet": "1.7.24"
},
"prettier": "@meshsdk/configs/prettier",
"publishConfig": {
diff --git a/packages/mesh-provider/package.json b/packages/mesh-provider/package.json
index c2f85deb6..cc57cc347 100644
--- a/packages/mesh-provider/package.json
+++ b/packages/mesh-provider/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/provider",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Blockchain data providers - https://meshjs.dev/providers",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -34,8 +34,8 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
- "@meshsdk/core-cst": "1.7.23",
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/core-cst": "1.7.24",
"@utxorpc/sdk": "0.6.2",
"@utxorpc/spec": "0.10.1",
"axios": "^1.7.2"
diff --git a/packages/mesh-react/package.json b/packages/mesh-react/package.json
index b57b47838..4025a66eb 100644
--- a/packages/mesh-react/package.json
+++ b/packages/mesh-react/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/react",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "React component library - https://meshjs.dev/react",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -29,9 +29,9 @@
},
"dependencies": {
"@fabianbormann/cardano-peer-connect": "^1.2.18",
- "@meshsdk/common": "1.7.23",
- "@meshsdk/transaction": "1.7.23",
- "@meshsdk/wallet": "1.7.23",
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/transaction": "1.7.24",
+ "@meshsdk/wallet": "1.7.24",
"@radix-ui/react-dialog": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-icons": "^1.3.2",
diff --git a/packages/mesh-react/src/cardano-wallet/connected-button.tsx b/packages/mesh-react/src/cardano-wallet/connected-button.tsx
new file mode 100644
index 000000000..e8e34be6c
--- /dev/null
+++ b/packages/mesh-react/src/cardano-wallet/connected-button.tsx
@@ -0,0 +1,56 @@
+import { useEffect, useState } from "react";
+
+import { Button } from "../common/button";
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "../common/dropdown-menu";
+import { useWallet } from "../hooks";
+
+export default function ConnectedButton() {
+ const { wallet, connected, disconnect } = useWallet();
+ const [address, setAddress] = useState("");
+
+ useEffect(() => {
+ if (connected && wallet) {
+ async function afterConnectedWallet() {
+ let address = (await wallet.getUnusedAddresses())[0];
+ if (!address) address = await wallet.getChangeAddress();
+ setAddress(address);
+ }
+ afterConnectedWallet();
+ }
+ }, [connected, wallet]);
+
+ return (
+
+
+
+
+
+ Wallet
+
+ {
+ navigator.clipboard.writeText(address);
+ }}
+ >
+ Copy Address
+
+ {
+ disconnect();
+ }}
+ >
+ Disconnect
+
+
+
+ );
+}
diff --git a/packages/mesh-react/src/cardano-wallet/index.tsx b/packages/mesh-react/src/cardano-wallet/index.tsx
index 2991c25ec..babe178af 100644
--- a/packages/mesh-react/src/cardano-wallet/index.tsx
+++ b/packages/mesh-react/src/cardano-wallet/index.tsx
@@ -1,10 +1,4 @@
-/**
- * todo:
- * - handle show when no wallet in device
- */
-import { useEffect, useRef, useState } from "react";
-// import { DAppPeerConnect } from "@fabianbormann/cardano-peer-connect";
-// import { IWalletInfo } from "@fabianbormann/cardano-peer-connect/dist/src/types";
+import { useEffect, useState } from "react";
import { Button } from "../common/button";
import {
@@ -16,19 +10,11 @@ import {
DialogTitle,
DialogTrigger,
} from "../common/dialog";
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuLabel,
- DropdownMenuSeparator,
- DropdownMenuTrigger,
-} from "../common/dropdown-menu";
import IconChevronRight from "../common/icons/icon-chevron-right";
-import IconDownload from "../common/icons/icon-download";
-import IconMonitorSmartphone from "../common/icons/icon-monitor-smartphone";
-import WalletIcon from "../common/icons/wallet-icon";
-import { useWallet, useWalletList } from "../hooks";
+import { useWallet } from "../hooks";
+import ConnectedButton from "./connected-button";
+import ScreenMain from "./screen-main";
+import ScreenP2P from "./screen-p2p";
interface ButtonProps {
label?: string;
@@ -57,7 +43,6 @@ export const CardanoWallet = ({
}: ButtonProps) => {
const [open, setOpen] = useState(false);
const [screen, setScreen] = useState("main");
-
const { wallet, connected } = useWallet();
useEffect(() => {
@@ -75,234 +60,82 @@ export const CardanoWallet = ({
) : (
-
+
)}
-
-
- {screen != "main" ? (
-
- ) : (
-
- )}
-
- {screen == "main" && "Connect Wallet"}
- {screen == "p2p" && "P2P Connect"}
-
-
-
-
- {screen == "p2p" &&
- "Use wallet that supports CIP-45, scan this QR code to connect."}
-
-
+
{screen == "main" && (
-
)}
- {/* {screen == "p2p" && (
-
- )} */}
+ {screen == "p2p" && (
+
+ )}
-
-
- Powered by
-
- Mesh SDK
-
-
+
);
};
-function ConnectedDropdown() {
- const { wallet, connected, disconnect } = useWallet();
- const [address, setAddress] = useState("");
-
- useEffect(() => {
- if (connected && wallet) {
- async function afterConnectedWallet() {
- let address = (await wallet.getUnusedAddresses())[0];
- if (!address) address = await wallet.getChangeAddress();
- setAddress(address);
- }
- afterConnectedWallet();
- }
- }, [connected, wallet]);
-
- return (
-
-
-
-
-
- Wallet
-
- {
- navigator.clipboard.writeText(address);
- }}
- >
- Copy Address
-
- {
- disconnect();
- }}
- >
- Disconnect
-
-
-
- );
-}
-
-function MainScreen({
- metamask,
- extensions,
- setOpen,
+function Header({
+ screen,
setScreen,
}: {
- metamask?: {
- network: string;
- };
- extensions: number[];
- setOpen: Function;
+ screen: string;
setScreen: Function;
}) {
- const wallets = useWalletList({ metamask });
- const { connect } = useWallet();
-
return (
-
- {wallets.map((wallet, index) => (
- {
- connect(wallet.id, extensions);
- setOpen(false);
- }}
- />
- ))}
- {
- setScreen("p2p");
- }}
- />
- {/* {
- window.open(
- "https://developers.cardano.org/showcase/?tags=wallet",
- "_blank",
- );
- }}
- /> */}
-
+
+
+ {screen != "main" ? (
+
+ ) : (
+
+ )}
+
+ {screen == "main" && "Connect Wallet"}
+ {screen == "p2p" && "P2P Connect"}
+
+
+
+
+ {screen == "p2p" &&
+ "Use wallet that supports CIP-45, scan this QR code to connect."}
+
+
);
}
-// function P2PScreen({
-// cardanoPeerConnect,
-// }: {
-// cardanoPeerConnect?: {
-// dAppInfo: {
-// name: string;
-// url: string;
-// };
-// announce: string[];
-// };
-// }) {
-// const dAppConnect = useRef(null);
-// const qrCodeField = useRef(null);
-// const [address, setAddress] = useState("");
-// const [copied, setCopied] = useState(false);
-// const [connected, setConnected] = useState(false);
-// console.log("address", address);
-
-// useEffect(() => {
-// if (cardanoPeerConnect) {
-// if (dAppConnect.current === null) {
-// dAppConnect.current = new DAppPeerConnect({
-// dAppInfo: {
-// name: cardanoPeerConnect.dAppInfo.name,
-// url: cardanoPeerConnect.dAppInfo.url,
-// },
-// announce: cardanoPeerConnect.announce,
-// onApiInject: (name: string, address: string) => {
-// console.log("onApiInject", name, address);
-// },
-// onApiEject: (name: string, address: string) => {
-// console.log("onApiEject", name, address);
-// },
-// onConnect: (address: string, walletInfo?: IWalletInfo) => {
-// console.log("Connected to wallet", address, walletInfo);
-// },
-// onDisconnect: () => {
-// console.log("Disconnected from wallet");
-// },
-// verifyConnection: (
-// walletInfo: IWalletInfo,
-// callback: (granted: boolean, autoconnect: boolean) => void,
-// ) => {
-// console.log("verifyConnection", walletInfo);
-// callback(true, true);
-// },
-// useWalletDiscovery: true,
-// });
-// console.log(1, dAppConnect.current);
-// if (dAppConnect.current) {
-// setAddress(dAppConnect.current.getAddress());
-
-// if (qrCodeField.current !== null) {
-// dAppConnect.current.generateQRCode(qrCodeField.current);
-// }
-// }
-// }
-// }
-// }, []);
-
-// return (
-//
-//
-//
-//
-// );
-// }
+function Footer() {
+ return (
+
+
+ Powered by
+
+ Mesh SDK
+
+
+ );
+}
diff --git a/packages/mesh-react/src/cardano-wallet/screen-main.tsx b/packages/mesh-react/src/cardano-wallet/screen-main.tsx
new file mode 100644
index 000000000..12b7c7dca
--- /dev/null
+++ b/packages/mesh-react/src/cardano-wallet/screen-main.tsx
@@ -0,0 +1,66 @@
+import IconDownload from "../common/icons/icon-download";
+import IconMonitorSmartphone from "../common/icons/icon-monitor-smartphone";
+import WalletIcon from "../common/icons/wallet-icon";
+import { useWallet, useWalletList } from "../hooks";
+
+export default function ScreenMain({
+ metamask,
+ extensions,
+ setOpen,
+ setScreen,
+ cardanoPeerConnect,
+}: {
+ metamask?: {
+ network: string;
+ };
+ extensions: number[];
+ setOpen: Function;
+ setScreen: Function;
+ cardanoPeerConnect?: {
+ dAppInfo: {
+ name: string;
+ url: string;
+ };
+ announce: string[];
+ };
+}) {
+ const wallets = useWalletList({ metamask });
+ const { connect } = useWallet();
+
+ return (
+
+ {wallets.map((wallet, index) => (
+ {
+ connect(wallet.id, extensions);
+ setOpen(false);
+ }}
+ />
+ ))}
+
+ {cardanoPeerConnect && (
+ {
+ setScreen("p2p");
+ }}
+ />
+ )}
+
+ {
+ window.open(
+ "https://developers.cardano.org/showcase/?tags=wallet",
+ "_blank",
+ );
+ }}
+ />
+
+ );
+}
diff --git a/packages/mesh-react/src/cardano-wallet/screen-p2p.tsx b/packages/mesh-react/src/cardano-wallet/screen-p2p.tsx
new file mode 100644
index 000000000..1eb748444
--- /dev/null
+++ b/packages/mesh-react/src/cardano-wallet/screen-p2p.tsx
@@ -0,0 +1,81 @@
+import { useEffect, useRef, useState } from "react";
+
+import { Button } from "../common/button";
+import { DAppPeerConnect, IWalletInfo } from "../common/cardano-peer-connect";
+
+export default function ScreenP2P({
+ cardanoPeerConnect,
+}: {
+ cardanoPeerConnect?: {
+ dAppInfo: {
+ name: string;
+ url: string;
+ };
+ announce: string[];
+ };
+}) {
+ const dAppConnect = useRef(null);
+ const qrCodeField = useRef(null);
+ const [address, setAddress] = useState("");
+ const [copied, setCopied] = useState(false);
+
+ useEffect(() => {
+ if (cardanoPeerConnect) {
+ if (dAppConnect.current === null) {
+ dAppConnect.current = new DAppPeerConnect({
+ dAppInfo: {
+ name: cardanoPeerConnect.dAppInfo.name,
+ url: cardanoPeerConnect.dAppInfo.url,
+ },
+ announce: cardanoPeerConnect.announce,
+ onApiInject: (name: string, address: string) => {
+ console.log("onApiInject", name, address);
+ },
+ onApiEject: (name: string, address: string) => {
+ console.log("onApiEject", name, address);
+ },
+ onConnect: (address: string, walletInfo?: IWalletInfo) => {
+ console.log("Connected to wallet", address, walletInfo);
+ },
+ onDisconnect: () => {
+ console.log("Disconnected from wallet");
+ },
+ verifyConnection: (
+ walletInfo: IWalletInfo,
+ callback: (granted: boolean, autoconnect: boolean) => void,
+ ) => {
+ console.log("verifyConnection", walletInfo);
+ callback(true, true);
+ },
+ useWalletDiscovery: true,
+ });
+
+ if (dAppConnect.current) {
+ const address = dAppConnect.current.getAddress();
+ setAddress(address);
+ console.log("address", address);
+
+ if (qrCodeField.current !== null) {
+ dAppConnect.current.generateQRCode(qrCodeField.current);
+ }
+ }
+ }
+ }
+ }, []);
+
+ return (
+
+
+
+
+ );
+}
diff --git a/packages/mesh-react/src/common/cardano-peer-connect/index.ts b/packages/mesh-react/src/common/cardano-peer-connect/index.ts
new file mode 100644
index 000000000..7470f3049
--- /dev/null
+++ b/packages/mesh-react/src/common/cardano-peer-connect/index.ts
@@ -0,0 +1,12 @@
+import * as cjsCardanopeerconnect from "@fabianbormann/cardano-peer-connect";
+import { IWalletInfo as iwalletinfo } from "@fabianbormann/cardano-peer-connect/dist/src/types";
+
+export const cardanopeerconnect: typeof cjsCardanopeerconnect & {
+ default?: typeof cjsCardanopeerconnect;
+} = cjsCardanopeerconnect;
+const exportedCardanopeerconnect =
+ cardanopeerconnect?.default || cardanopeerconnect;
+
+export const DAppPeerConnect = exportedCardanopeerconnect.DAppPeerConnect;
+export type DAppPeerConnect = cjsCardanopeerconnect.DAppPeerConnect;
+export type IWalletInfo = iwalletinfo;
diff --git a/packages/mesh-svelte/package.json b/packages/mesh-svelte/package.json
index cfbc62b54..96d714034 100644
--- a/packages/mesh-svelte/package.json
+++ b/packages/mesh-svelte/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/svelte",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Svelte component library - https://meshjs.dev/svelte",
"type": "module",
"exports": {
@@ -26,7 +26,7 @@
"dev": "vite dev"
},
"dependencies": {
- "@meshsdk/core": "1.7.23"
+ "@meshsdk/core": "1.7.24"
},
"devDependencies": {
"@meshsdk/configs": "*",
diff --git a/packages/mesh-transaction/package.json b/packages/mesh-transaction/package.json
index 046f2753b..f21c39621 100644
--- a/packages/mesh-transaction/package.json
+++ b/packages/mesh-transaction/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/transaction",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Transactions - https://meshjs.dev/apis/transaction",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -35,9 +35,9 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
- "@meshsdk/core-csl": "1.7.23",
- "@meshsdk/core-cst": "1.7.23",
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/core-csl": "1.7.24",
+ "@meshsdk/core-cst": "1.7.24",
"json-bigint": "^1.0.0"
},
"prettier": "@meshsdk/configs/prettier",
diff --git a/packages/mesh-wallet/package.json b/packages/mesh-wallet/package.json
index 2acbba732..c844697ed 100644
--- a/packages/mesh-wallet/package.json
+++ b/packages/mesh-wallet/package.json
@@ -1,6 +1,6 @@
{
"name": "@meshsdk/wallet",
- "version": "1.7.23",
+ "version": "1.7.24",
"description": "Wallets - https://meshjs.dev/apis/wallets",
"main": "./dist/index.cjs",
"browser": "./dist/index.js",
@@ -35,10 +35,10 @@
"typescript": "^5.3.3"
},
"dependencies": {
- "@meshsdk/common": "1.7.23",
- "@meshsdk/core-csl": "1.7.23",
- "@meshsdk/core-cst": "1.7.23",
- "@meshsdk/transaction": "1.7.23",
+ "@meshsdk/common": "1.7.24",
+ "@meshsdk/core-csl": "1.7.24",
+ "@meshsdk/core-cst": "1.7.24",
+ "@meshsdk/transaction": "1.7.24",
"@nufi/dapp-client-cardano": "0.3.5",
"@nufi/dapp-client-core": "0.3.5"
},
diff --git a/scripts/mesh-cli/package.json b/scripts/mesh-cli/package.json
index 4e118787c..e17f16f8c 100644
--- a/scripts/mesh-cli/package.json
+++ b/scripts/mesh-cli/package.json
@@ -3,7 +3,7 @@
"description": "A quick and easy way to bootstrap your dApps on Cardano using Mesh.",
"homepage": "https://meshjs.dev",
"author": "MeshJS",
- "version": "1.7.23",
+ "version": "1.7.24",
"license": "Apache-2.0",
"type": "module",
"main": "./dist/index.cjs",