Open sundayonah opened 1 month ago
Hey, the owner
field is missing in your code for MsgCreateSubspace
:
const createSubspaceMsg: MsgCreateSubspaceEncodeObject = {
typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace",
value: MsgCreateSubspace.fromPartial({
creator: account.address,
name: "Test Subspace",
description: "This is a test subspace",
owner: account.address, // this field must be included
}),
};
owner: account.address,
@dadamu thank you very much, i have successfully create post. it works
owner: account.address,
@dadamu thank you very much, i have successfully create post. it works
since you are here i would like to share this,
trying to connectWallet, after clicking the conectWallet button the qrcode pop-up i scanned it with trust wallet mobile app
i got this pop-up on my mobile
Dapp uses unSupported version of(1) walletConnect
below is the snippet code `"use client";
import { useCallback, useEffect, useState } from "react"; import { AppBar, Button, Toolbar, Typography } from "@mui/material"; import { SignerStatus } from "@desmoslabs/desmjs"; import { useDesmosContext } from "../context/desmos"; import { useWalletConnectContext } from "../context/walletconnect"; import useSignerStatus from "../hooks/useSignerStatus"; import { WalletConnectConnector } from "@web3-react/walletconnect-connector";
export default function Header() {
const [address, setAddress] = useState(""); const { connect, disconnect, signer } = useDesmosContext(); const { signClient } = useWalletConnectContext(); const signerStatus = useSignerStatus();
useEffect(() => { if (signer !== undefined && signerStatus === SignerStatus.Connected) { signer.getAccounts().then((accounts) => { setAddress(accounts[0].address); }); } else { setAddress(""); } }, [signer, signerStatus]);
const connectDisabled = signClient === undefined || (signerStatus !== SignerStatus.Connected && signerStatus !== SignerStatus.NotConnected);
// Configure WalletConnect connector
const walletConnect = new WalletConnectConnector({ rpc: { 1: "https://mainnet.infura.io/v3/........" }, bridge: "https://bridge.walletconnect.org", qrcode: true, // pollingInterval: 12000, });
// Function to connect to MetaMask async function connectWallet() { try { // Attempt to activate the WalletConnect connector await walletConnect.activate(); console.log("Connected to MetaMask"); } catch (error) { console.error("Failed to connect to MetaMask", error); } }`
@sundayonah Please use walletconnectv2 please. https://github.com/desmos-labs/desmjs/tree/main/packages/walletconnect-v2
@sundayonah Please use walletconnectv2 please. https://github.com/desmos-labs/desmjs/tree/main/packages/walletconnect-v2
I am running desmos node locally, and i have been able to create several posts successfully. is their way i can display all the posts. during my research i found this
desmos query posts post [subspace-id] [post-id] [flags]
i run it in terminal, it successfully display the post, how do i do the same UI, so i can see the posts created.
You can use desmos query posts posts [subspace-id] --limit [total-count]
So basically while going through the desmjs docs, i found that i have to create subspaceId,
creating subspaceId
useEffect(() => { const initializeClient = async () => { const mnemonic = "" const rpcEndpoint = "http://127.0.0.1:26657"; const gasPrice = GasPrice.fromString("0.025stake"); const signer = await OfflineSignerAdapter.fromMnemonic(SigningMode.DIRECT, mnemonic); const [account] = await signer.getAccounts();
}, []);
the error i have been getting
VM41549 page.tsx:206 Failed to create subspace: Error: Query failed with (6): rpc error: code = Unknown desc = invalid owner address: invalid address [desmos-labs/desmos/v7/x/subspaces/types/msgs.go:95] With gas wanted: '0' and gas used: '1168' : unknown request at QueryClient.queryAbci (queryclient.js:118:19) at async Object.request (utils.js:35:30) at async Object.simulate (queries.js:50:34) at async DesmosClient.simulate (signingcosmwasmclient.js:90:29) at async DesmosClient.signAndBroadcast (desmosclient.js:74:35) at async initializeClient (VM41549 page.tsx:182:40)
The function below is for creating post
const handleSubmit = async (event: React.FormEvent) => {
event.preventDefault();
};