Secret Network Developer Tutorial: How to build a Keplr Staking App

Step 1: Set up your REST API endpoint

Step 2: Install Keplr

Step 3: Get familiar with the Secret Network Testnet (Holodeck-2).

Step 4: Install your dependencies

Step 5: Building the Staking App

if (!window.getOfflineSigner || !window.keplr) {  
alert("Keplr Wallet not detected, please install extension" );
} else {
await window.keplr.enable(CHAIN_ID);
this.keplrOfflineSigner = await
window.getOfflineSigner(CHAIN_ID);
const accounts = await this.keplrOfflineSigner.getAccounts();
}
const accounts = await this.keplrOfflineSigner.getAccounts();  this.walletAddress = accounts[0].address
this.cosmJS = new SigningCosmWasmClient(       
SECRET_REST_URL,
this.walletAddress,
this.keplrOfflineSigner,
window.getEnigmaUtils(CHAIN_ID),
{
init: {
amount: [{ amount: "300000", denom: "uscrt" }],
gas: "300000",
},
exec: {
amount: [{ amount: "300000", denom: "uscrt" }],
gas: "300000",
},
});
  • sendMsg
  • fee
  • Chain ID
  • Memo
  • accountNumber
  • sequence

sendMsg

const sendMsg = {        
type: "cosmos-sdk/MsgDelegate",
value: {
delegator_address: this.walletAddress,
validator_address: this.validatorAddress,
amount: {
denom: "uscrt",
amount: amount.toString(),
},
},
};

fee

const fee = {
amount: [
{
amount: "50000",
denom: "uscrt",
},
],
gas: "270000",
};

chain ID

memo

accountNumber and sequence

const { accountNumber, sequence } = await this.cosmJS         
.getNonce(this.walletAddress)
const result = await this.cosmJS.postTx(signedTx)

Thanks for Reading!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Secure Secrets

Secure Secrets

Privacy Focused Validator and software development company. Secure Secrets also is a core contributor to Shade Protocol. Website: https://www.securesecrets.org/