For the complete documentation index, see llms.txt. This page is also available as Markdown.

Getting Started with SecretJS

Learn how to install and use SecretJS.

Overview

In this tutorial you will learn how to use Secret.js to connect a web3 wallet, upload a contract, instantiate a contract, execute a contract, and query a contract, amongst other use cases! For the complete Secret.js docs, see here.

All of the following examples use the pulsar-3 testnet with LCD endpoint https://pulsar.lcd.secretnodes.com.

Public LCD endpoints can be found here for both mainnet and testnet.

Installation

Create a package.json file:

npm init -y

Then install secretJS:

npm install secretjs

Set up Secret Network Client

import { SecretNetworkClient, Wallet } from "secretjs";

const wallet = new Wallet("Your mnemonic words go here");

const secretjs = new SecretNetworkClient({
  chainId: "pulsar-3",
  url: "https://pulsar.lcd.secretnodes.com",
  wallet: wallet,
  walletAddress: wallet.address,
});

Upload a Contract

Instantiate a Contract

Last updated

Was this helpful?