Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a template for Juno localnet #66

Open
lumtis opened this issue Jan 27, 2023 · 1 comment
Open

Add a template for Juno localnet #66

lumtis opened this issue Jan 27, 2023 · 1 comment

Comments

@lumtis
Copy link

lumtis commented Jan 27, 2023

This issue proposes to add a template --template juno-localnet that allows creating the app configured to use a Juno localnet exposed with the command:

docker run -it \
  --name juno_node_1 \
  -p 1317:1317 \
  -p 26656:26656 \
  -p 26657:26657 \
  -e STAKE_TOKEN=ujunox \
  -e UNSAFE_CORS=true \
  ghcr.io/cosmoscontracts/juno:v11.0.0 \
  ./setup_and_run.sh juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y

Proposed solution

The template would contain under config/localnet.ts the configuration of the chain:

import { Chain } from "@chain-registry/types";

export const localnet: Chain = {
  chain_name: "localnet",
  status: "live",
  network_type: "testnet",
  pretty_name: "Localnet",
  chain_id: "testing",
  bech32_prefix: "juno",
  slip44: 118,
  fees: {
    fee_tokens: [
      {
        denom: "ujunox",
        fixed_min_gas_price: 0.0025,
        low_gas_price: 0.03,
        average_gas_price: 0.04,
        high_gas_price: 0.05,
      },
    ],
  },
  staking: {
    staking_tokens: [
      {
        denom: "ujunox",
      },
    ],
  },
};

_app.tsx includes the localnet:

function CreateCosmosApp({ Component, pageProps }: AppProps) {
  const signerOptions: SignerOptions = {
    signingCosmwasm: (chain: Chain) => {
      switch (chain.chain_name) {
        case "localnet":
          return {
            gasPrice: GasPrice.fromString("0.025ujunox"),
          };
      }
    },
  };

  return (
    <ChainProvider
      chains={[...chains, localnet]}
      assetLists={assets}
      wallets={[...keplrWallets, ...cosmostationWallets, ...leapWallets]}
      signerOptions={signerOptions}
      walletModal={TailwindModal}
      endpointOptions={{
        localnet: {
          rpc: ["http://localhost:26657"],
        },
      }}
@lumtis
Copy link
Author

lumtis commented Jan 27, 2023

Another solution could be to publish localnet regular configs (local Osmos, Juno, etc...) in a package, same as chain-registry so they can be used by adding two lines of code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant