@fadroma/scrt
TypeScript icon, indicating that this package has built-in type declarations

11.0.0-rc.30 • Public • Published

Fadroma Agent for Secret Network

This package lets you use Fadroma Agent on Secret Network using the SecretJS client library.

See https://fadroma.tech for more info.


Quick start

import * as Scrt from '@fadroma/scrt'

// connect to mainnet:
const scrt = Scrt.mainnet()
const scrt = Scrt.mainnet({ url })
const scrt = Scrt.mainnet({ identity: { mnemonic } })
const scrt = Scrt.mainnet({ identity: { encryptionUtils } })

// connect to testnet:
const scrt = Scrt.testnet(/* same as above */)

// connect to custom endpoint:
const scrt = new Scrt.Connection({ chainId, url, identity })

// upload code:
const uploaded = await scrt.upload('./path/to.wasm')
const uploaded = await scrt.upload('file:///path/to.wasm')
const uploaded = await scrt.upload('https:///path/to.wasm')
const uploaded = await scrt.upload(new Uint8Array([/*raw waasm*/]))

// instantiate code:
const contract = await scrt.instantiate(codeId, { label, initMsg })
const contract = await scrt.instantiate(uploaded, { label, initMsg })
const contract = await scrt.instantiate({ codeId }, { label, initMsg })

// obtain handle to existing contract:
const contract = scrt.getContract('address')
const contract = scrt.getContract({ address })

// call contract methods:
const response = await contract.query(message)
const resultTx = await contract.execute(message)

Package Sidebar

Install

npm i @fadroma/scrt

Weekly Downloads

10

Version

11.0.0-rc.30

License

AGPL-3.0-only

Unpacked Size

290 kB

Total Files

73

Last publish

Collaborators

  • atanas-krondev
  • exactlywhoyouthinkitis