File tree Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Expand file tree Collapse file tree 1 file changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import '@builders-of-stuff/svelte-sui-wallet-adapter/styles.css';
3636@import ' @builders-of-stuff/svelte-sui-wallet-adapter/styles.css' ;
3737```
3838
39- ### Usage
39+ ### Usage examples
4040
4141``` svelte
4242<!-- +page.svelte -->
@@ -45,9 +45,38 @@ import '@builders-of-stuff/svelte-sui-wallet-adapter/styles.css';
4545 ConnectButton,
4646 walletAdapter
4747 } from '@builders-of-stuff/svelte-sui-wallet-adapter';
48+ </script>
49+
50+ <ConnectButton {walletAdapter} />
51+ ```
52+
53+ ``` svelte
54+ <!-- +page.svelte -->
55+ <script lang="ts">
56+ import {
57+ ConnectButton,
58+ walletAdapter
59+ } from '@builders-of-stuff/svelte-sui-wallet-adapter';
60+
61+ // Access properties from walletAdapter
62+ $effect(() => {
63+ console.log(walletAdapter.currentAccount);
64+ console.log(walletAdapter.isConnected);
65+ });
4866
49- // Example call
50- let example = await walletAdapter.signAndExecuteTransaction({
67+ // Invoke methods from walletAdapter
68+ let response1 = walletAdapter.suiClient
69+ .getOwnedObjects({
70+ owner: walletAdapter.currentAccount ? walletAdapter.currentAccount.address : ''
71+ // filter: {
72+ // StructType: `${MY_FIRST_PACKAGE_ID}::my_module::Counter`
73+ // }
74+ })
75+ .then((res) => {
76+ console.log('res: ', res);
77+ });
78+
79+ let response2 = await walletAdapter.signAndExecuteTransaction({
5180 transaction: tx as any,
5281 account: walletAdapter.currentAccount as any,
5382 chain: walletAdapter!.currentAccount!.chains[0],
You can’t perform that action at this time.
0 commit comments