All Projects → Switcheo → zilswap-sdk

Switcheo / zilswap-sdk

Licence: MIT license
Zilswap Typescript SDK

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to zilswap-sdk

zilswap-webapp
Zilswap Web UI. The AMM-protocol for ZIlliqa.
Stars: ✭ 21 (+10.53%)
Mutual labels:  zilliqa, zilswap
ZILMiner
Mining software for Zilliqa
Stars: ✭ 32 (+68.42%)
Mutual labels:  zilliqa
binance-node-docker
Docker image for Binance full and light nodes
Stars: ✭ 24 (+26.32%)
Mutual labels:  dex
BarterDEX
DEPRECATED/OUTDATED!!! Do not use!
Stars: ✭ 189 (+894.74%)
Mutual labels:  dex
dex
docker executables - run applications without installing them or their dependencies
Stars: ✭ 31 (+63.16%)
Mutual labels:  dex
idex-sdk-js
IDEX v3 SDK built with TypeScript, supporting both web and Node environments.
Stars: ✭ 35 (+84.21%)
Mutual labels:  dex
tomox-sdk-ui
SDK UI to build a Decentralized Exchange on TomoX protocol
Stars: ✭ 24 (+26.32%)
Mutual labels:  dex
k8s-ldap
Kubernetes - LDAP authentication with Dex
Stars: ✭ 59 (+210.53%)
Mutual labels:  dex
exchange
simple decentralized exchange using eos smart contract
Stars: ✭ 24 (+26.32%)
Mutual labels:  dex
defi
Tools for use in DeFi. Impermanent Loss calculations, staking and farming strategies, coingecko and pancakeswap API queries, liquidity pools and more
Stars: ✭ 464 (+2342.11%)
Mutual labels:  dex
osprey
Kubernetes OIDC CLI login
Stars: ✭ 49 (+157.89%)
Mutual labels:  dex
NinjaDroid
Ninja Reverse Engineering on Android APK packages
Stars: ✭ 224 (+1078.95%)
Mutual labels:  dex
dex2jar
Tools to work with android .dex and java .class files
Stars: ✭ 102 (+436.84%)
Mutual labels:  dex
dex-parser
Rust parser for Android's dex format
Stars: ✭ 26 (+36.84%)
Mutual labels:  dex
uniswap-arbitrage-flash-swap
Uniswap flash swap arbitrage solidity contracts
Stars: ✭ 341 (+1694.74%)
Mutual labels:  dex
rainbow
DeFi options comparator to detect market opportunities with CLI (Go) and web (Vue3).
Stars: ✭ 40 (+110.53%)
Mutual labels:  dex
dalvikgate
Lightweight dex / odex / apk to jar converter
Stars: ✭ 32 (+68.42%)
Mutual labels:  dex
dalvik
Dalvik parser in pure Rust.
Stars: ✭ 28 (+47.37%)
Mutual labels:  dex
atomic-swap-kit-android
Atomic Swap Android library for Bitcoin (BTC) and Bitcoin Cash (BCH) swaps in decentralized manner. Implemented on Kotlin.
Stars: ✭ 17 (-10.53%)
Mutual labels:  dex
jitana
A graph-based static-dynamic hybrid DEX code analysis tool
Stars: ✭ 35 (+84.21%)
Mutual labels:  dex

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.addLiquidity('SWTH', '42', '42')
    await zilswap.teardown()
  })()

Methods

All public Zilswap methods can be found on the Zilswap SDK object.

All public Zilo methods can be found on the Zilo SDK object.

Full typescript definitions can also be found in the Modules.

The following is a list of methods to quickly get you started:

Swap & Liquidity

  • approveTokenTransferIfRequired - approves transfers to zilswap for the given token contract, if the current approval amount is insufficient.
  • addLiquidity - adds liquidity to the pool
  • removeLiquidity - removes liquidity to the pool
  • swapWithExactInput - swaps a token for another token, specifying the exact amount that should be given.
  • swapWithExactOutput - swaps a token for another token, specifying the exact amount that should be received.

Getters

  • getAppState - gets the current dApp state
  • getPool - gets the reserve values for a pool
  • getObservedTxs - gets the txs that the SDK is observing

Configuration

  • addToken - adds a token that is not in the pre-built list
  • observeTx - observe a zilliqa blockchain tx
  • setDeadlineBlocks - set the number of blocks before a transition sent by the SDK to expires

Helpers

  • toUnitless - converts a human amount into a unitless integer that is used by Scilla.
  • toUnit - converts a unitless integer used by scilla into a human readable amount.
  • getRatesForInput - get the current exchange rates for a pool by giving an input amount.
  • getRatesForOutput - get the current exchange rates for a pool by giving an output amount.

Test Usage

  1. Ensure enough tokens minted to your address on testnet
  2. 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].