1.3.5 • Published 3 years ago
hashswap-sdk v1.3.5
Zilswap Typescript SDK
Setup
Install from npm:
npm install zilswap-sdk
SDK Usage
Initialize the sdk based on the required network, then call the required methods which will automatically map and call the corresponding smart contract correct transitions.
import { Zilswap } from 'zilswap-sdk'
(async () => {
const zilswap = new Zilswap(Network.TestNet)
await zilswap.initialize()
await zilswap.setHello('asdf')
await zilswap.getHello()
})()
Methods
All public methods can be found on the Zilswap
SDK object. Full typescript definitions can also be found in the doc folder.
The following is a list of methods to quickly get you started:
Swap & Liquidity
setHello
- swaps a token for another token, specifying the exact amount that should be given.getHello
- swaps a token for another token, specifying the exact amount that should be received.
Test Usage
- Ensure enough tokens minted to your address on testnet
- Run
PRIVATE_KEY=xxx yarn run test
Developing
Generate documentation with typedoc. Install with:
npm i typedoc typedoc-plugin-markdown --global
then run:
typedoc --out ./doc ./src --excludePrivate --excludeNotExported --plugin typedoc-plugin-markdown
Contributing
Please review the contribution guidelines before contributing or opening pull requests.
1.3.5
3 years ago