Anchor.js
The Anchor.js JS SDK allows applications with JavaScript runtimes to interact with Anchor Protocol. It supports easy fabrication of messages relevant to Terra-side Anchor smart contracts, used to make contract calls or query contract states.
For those wishing to build applications that are centered around Anchor's earn/savings functionality, using Anchor Earn is recommended.
This section only provides a brief overview of Anchor.js. For additional information, please refer to the Anchor.js repository.
Installation
Anchor.js is developed to be used in tandem with Terra.js, required to interact with the Terra blockchain. Developers must install both:
@terra-money/terra.js
@anchor-protocol/anchor.js
Anchor.js is available as a package on NPM.
Usage
Anchor.js can be utilized to either query the state of Anchor smart contracts or fabricate MsgExecuteContract
objects to be included in Terra transactions. Both functionalities are accessible through MessageFabricators
.
Using MessageFabricators
:
Executing
A message fabricator contains functions for generating proper MsgExecuteContract
messages to be included in a transaction and broadcasted via the specified LCDClient
.
Last updated