Skip to content

Latest commit

 

History

History
109 lines (93 loc) · 3.44 KB

CONNECT_KEPLR.md

File metadata and controls

109 lines (93 loc) · 3.44 KB

I. Connect Keplr Wallet to Aura Testnet

  1. Add Network to Keplr
  • Aura Devnet: Use this jsfiddle to add the aura-testnet chain to your Keplr browser extension.
  1. Detech Keplr
	if (!window.keplr) {
        alert("Please install keplr extension");
    } else {
        const chainId = "aura-testnet";

        // Enabling before using the Keplr is recommended.
        // This method will ask the user whether to allow access if they haven't visited this website.
        // Also, it will request that the user unlock the wallet if the wallet is locked.
        await window.keplr.enable(chainId);
    
        const offlineSigner = window.keplr.getOfflineSigner(chainId);
    
        // You can get the address/public keys by `getAccounts` method.
        // It can return the array of address/public key.
        // But, currently, Keplr extension manages only one address/public key pair.
        // XXX: This line is needed to set the sender address for SigningCosmosClient.
        const accounts = await offlineSigner.getAccounts();
		console.log(accounts)
    }
  1. Unlock Keplr
	window.keplr.enable(chainId);
  1. Get current address / Public key
	await offlineSigner.getAccounts();
	//or
	await offlineSigner.getAccounts(chainid);
  1. Sign transaction
  • Require: @cosmjs/stargate
	npm install @cosmjs/stargate
  • Use SigningStargateClient
	const chainId = "aura-testnet";
	await window.keplr.enable(chainId);
	const offlineSigner = window.getOfflineSigner(chainId);

	const client = await SigningStargateClient.connectWithSigner(tendermintUrl, offlineSigner);
	const tx = {
        chainId: "aura-testnet",
        // accountNumber: "0",
        // sequence: "0",
        // fee: {
        //     amount: [{
        //         amount: "0",
        //         denom: "uatom",
        //     }],
        //     gas: "200000",
        // },
        msgs: [
            {
                type: "cosmos-sdk/MsgSend",
                value: {
                    from_address: sender.address,
                    to_address: "auraxxxxxxxxxxxxxxxxxxx",
                    amount: [{
                        amount: "1",
                        denom: "uaura",
                    }],
                },
            },
        ],
        memo: "",
    };
	// sign transaction
    const signedTx = await client.sign(tx);
    console.log(signedTx);
    // broadcast transaction
    const res = await client.broadcast(signedTx);
    console.log(res);

Reference: https://docs.keplr.app/api/

II. Connect Keplr Wallet to other testnet

  1. Vega Testnet (ATOM)

Deprecated since March 2022 in favor of v7-Theta Testnet

Use this jsfiddle to add the vega-testnet chain to your Keplr browser extension.

  1. Theta Testnet (ATOM)
    Use this jsfiddle to add the theta-testnet-001 chain to your Keplr browser extension.

  2. Juno Testnet (JUNO)
    Access JunoTools website: https://test.juno.tools/ Click on Connect Wallet and approve request add chain.

    Approve request connect network.

  3. Osmosis Testnet (OSMO)
    Use this jsfiddle to add the osmo-test-4 chain to your Keplr browser extension.