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 2dc19988f..34d22e3f2 100644
--- a/apps/playground/src/pages/react/ui-components/connect-wallet.tsx
+++ b/apps/playground/src/pages/react/ui-components/connect-wallet.tsx
@@ -136,7 +136,7 @@ function Right() {
example += ` <>\n`;
example += ` \n`;
diff --git a/apps/playground/src/pages/svelte/getting-started/index.tsx b/apps/playground/src/pages/svelte/getting-started/index.tsx
index 350123688..0ad04c7ea 100644
--- a/apps/playground/src/pages/svelte/getting-started/index.tsx
+++ b/apps/playground/src/pages/svelte/getting-started/index.tsx
@@ -6,11 +6,13 @@ import Metatags from "~/components/site/metatags";
import { metaSvelteGettingstarted } from "~/data/links-svelte";
import SvelteConnectWallet from "../ui-components/connect-wallet";
import SvelteInstall from "./install";
+import SvelteState from "./state";
const SveltePage: NextPage = () => {
const sidebarItems = [
{ label: "Install", to: "SvelteInstall" },
{ label: "Connect Wallet", to: "connectWallet" },
+ { label: "Get Wallet State", to: "svelteState" },
];
return (
@@ -34,6 +36,7 @@ const SveltePage: NextPage = () => {
+
>
);
diff --git a/apps/playground/src/pages/svelte/getting-started/state.tsx b/apps/playground/src/pages/svelte/getting-started/state.tsx
new file mode 100644
index 000000000..3f456d61c
--- /dev/null
+++ b/apps/playground/src/pages/svelte/getting-started/state.tsx
@@ -0,0 +1,90 @@
+import Link from "~/components/link";
+import LiveCodeDemo from "~/components/sections/live-code-demo";
+import TwoColumnsScroll from "~/components/sections/two-columns-scroll";
+import Codeblock from "~/components/text/codeblock";
+
+export default function SvelteState() {
+ return (
+
+ );
+}
+
+function Left() {
+ let code = ``;
+ code += ``;
+
+ return (
+ <>
+
+ Provide information on the current wallet's state, and functions for
+ connecting and disconnecting user wallet.
+
+
+
+ wallet is a{" "}
+ Browser Wallet instance,
+ which expose all CIP wallets functions from getting assets to signing
+ tranasction.
+
+
+ connected, a boolean, true if user's wallet is
+ connected.
+
+
+ name, a string, the name of the connect wallet.
+
+
+ connecting, a boolean, true if the wallet is
+ connecting and initializing.
+
+
+ connect(walletName: string), a function, provide the wallet
+ name to connect wallet. Retrive a list of available wallets with{" "}
+ useWalletList().
+
+
+ disconnect(), a function, to disconnect the connected
+ wallet.
+
+ >
+ );
+}
+
+function Right() {
+ let example = ``;
+ example += `\n`;
+ example += `\n`;
+ example += `\n`;
+ example += ` \n`;
+ example += ` \n`;
+ example += `\n`;
+
+ return (
+
+ );
+}
\ No newline at end of file
diff --git a/apps/playground/src/pages/svelte/ui-components/connect-wallet.tsx b/apps/playground/src/pages/svelte/ui-components/connect-wallet.tsx
index 4a3dd43fb..87a2c5874 100644
--- a/apps/playground/src/pages/svelte/ui-components/connect-wallet.tsx
+++ b/apps/playground/src/pages/svelte/ui-components/connect-wallet.tsx
@@ -16,8 +16,6 @@ export default function SvelteConnectWallet() {
}
function Left() {
- const isDark = useDarkmode((state) => state.isDark);
-
let codeSignature = ``;
codeSignature += `{\n`;
codeSignature += ` label?: string;\n`;
@@ -65,7 +63,7 @@ function Left() {
Customization
For dark mode style, add isDark.
- `} />
+ `} />
For a custom label, add the label prop.
`} />
@@ -120,18 +118,11 @@ function Left() {
function Right() {
let example = ``;
example += `\n`;
example += `\n`;
example += `\n`;
example += ` \n`;
- example += ` \n`;
example += `\n`;
return (
diff --git a/packages/mesh-svelte/src/lib/cardano-wallet/component/connect-wallet-button.svelte b/packages/mesh-svelte/src/lib/cardano-wallet/component/connect-wallet-button.svelte
index f501c06c1..0da8657b7 100644
--- a/packages/mesh-svelte/src/lib/cardano-wallet/component/connect-wallet-button.svelte
+++ b/packages/mesh-svelte/src/lib/cardano-wallet/component/connect-wallet-button.svelte
@@ -9,7 +9,7 @@
connect,
disconnect,
} from "../state/browser-wallet-state.svelte.js";
- import { type ConnectWalletButtonProps } from "./";
+ import { type CardanoWalletButtonProps } from "./";
const {
label = "Connect Wallet",
@@ -17,7 +17,7 @@
isDark = true,
metamask = undefined,
extensions = [],
- }: ConnectWalletButtonProps = $props();
+ }: CardanoWalletButtonProps = $props();
let availableWallets: Wallet[] = $state([]);
diff --git a/packages/mesh-svelte/src/lib/cardano-wallet/component/index.ts b/packages/mesh-svelte/src/lib/cardano-wallet/component/index.ts
index 457ec9a56..9e6efd29e 100644
--- a/packages/mesh-svelte/src/lib/cardano-wallet/component/index.ts
+++ b/packages/mesh-svelte/src/lib/cardano-wallet/component/index.ts
@@ -1,4 +1,4 @@
import Root from "./connect-wallet-button.svelte";
-import { type ConnectWalletButtonProps } from "./types";
+import { type CardanoWalletButtonProps } from "./types";
-export { Root as ConnectWallet, type ConnectWalletButtonProps };
+export { Root as CardanoWallet, type CardanoWalletButtonProps };
diff --git a/packages/mesh-svelte/src/lib/cardano-wallet/component/types.ts b/packages/mesh-svelte/src/lib/cardano-wallet/component/types.ts
index c72b80cc5..60b369e51 100644
--- a/packages/mesh-svelte/src/lib/cardano-wallet/component/types.ts
+++ b/packages/mesh-svelte/src/lib/cardano-wallet/component/types.ts
@@ -1,4 +1,4 @@
-export type ConnectWalletButtonProps = {
+export type CardanoWalletButtonProps = {
label?: string;
onConnected?: Function;
isDark?: boolean;
diff --git a/packages/mesh-svelte/src/lib/cardano-wallet/state/browser-wallet-state.svelte.ts b/packages/mesh-svelte/src/lib/cardano-wallet/state/browser-wallet-state.svelte.ts
index cce5b7d1e..82c5729a2 100644
--- a/packages/mesh-svelte/src/lib/cardano-wallet/state/browser-wallet-state.svelte.ts
+++ b/packages/mesh-svelte/src/lib/cardano-wallet/state/browser-wallet-state.svelte.ts
@@ -23,6 +23,12 @@ export const BrowserWalletState = {
get connecting() {
return connecting;
},
+ get connect() {
+ return connect;
+ },
+ get disconnect() {
+ return disconnect;
+ },
};
export async function connect(w: Wallet) {
@@ -47,9 +53,3 @@ export function disconnect() {
icon = undefined;
connected = false;
}
-
-// todo: export the following:
-// import {
-// BrowserWalletState,
-// } from "@meshsdk/svelte";
-// const { wallet, connected, name, connecting, connect, disconnect, error } = BrowserWalletState;