Open Lzggno1 opened 2 years ago
Can the team show examples how to use it
xd
same
same
import { SigningClient } from '@sei-js/core';
import { DirectSecp256k1HdWallet } from '@sei-js/proto/node_modules/@cosmjs/proto-signing';
import {
calculateFee,
GasPrice,
coin
} from "@sei-js/proto/node_modules/@cosmjs/stargate";
(async () => {
// Setup wallet
const wallet = await DirectSecp256k1HdWallet.fromMnemonic("your mnemonic", {
prefix: "sei",
})
const [{ address: signerAddress }] = await wallet.getAccounts();
// Network config
const rpcEndpoint = "https://sei-chain-incentivized.com/sei-chain-tm/";
// Setup client
const client = await SigningClient.getSigningClient(rpcEndpoint,wallet);
// Setup fee
const gasPrice = GasPrice.fromString("0.025usei");
const executeFee = calculateFee(200_000, gasPrice);
// Send some token
const result = await client.sendTokens(signerAddress,signerAddress,[coin("1000","factory/sei1466nf3zuxpya8q9emxukd7vftaf6h4psr0a07srl5zw74zh84yjqpeheyc/uust2")],executeFee)
console.log(result)
// Sign and broadcast custom message
const msg = {
typeUrl: "/seiprotocol.seichain.....", //need custom your typeUrl on seiprotocol and body
value: {
// your body msg
}
}
const result2 = await client.signAndBroadcast(signerAddress,[msg],executeFee)
console.log(result2)
})()
Here is my example using this sdk, If you need any help ask me.
Can the team update the sdk? I haven't been exposed to cosmos, so I came straight to the sdk. I don't know how to use it.