Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.52 KB

LEGACY.md

File metadata and controls

41 lines (28 loc) · 1.52 KB

SiennaJS v0.2 docs

Legacy setup: install from NPM

Latest version:

npm i --save siennajs

Usage

All smart contract interfaces are created with the following parameters.

  • The address of the contract.
  • An instance of SigningCosmWasmClient from secretjs (Optional).
  • An instance of CosmWasmClient from secretjs (Optional).

At least one type of client is required. Depending on the type of client provided you will get access to different functionalities:

  • SigningCosmWasmClient - both executing transactions and queries
  • CosmWasmClient - queries only

If both instances are passed it will use SigningCosmWasmClient for executing and CosmWasmClient for queries.

Example - Query SIENNA token info:

const query_client = new CosmWasmClient('API_URL_HERE')
const sienna_token = new Snip20Contract(
    'secret1rgm2m5t530tdzyd99775n6vzumxa5luxcllml4',
    undefined, // We don't pass a SigningCosmWasmClient as we don't need it for queries
    query_client
)

const token_info = await sienna_token.query().get_token_info()

Querying with permits

SiennaJS exposes the Signer interface which must implement an offline signing method. See the SNIP-24 spec for more info.

An implementation for the Keplr wallet is provided by the library - KeplrSigner