Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 1.57 KB

README.md

File metadata and controls

56 lines (43 loc) · 1.57 KB


NPM

Introduction

This library provides e-Money specific features on top of the @cosmjs/stargate library.

Market Module (DEX)

See https://github.com/e-money/em-ledger/tree/master/x/market/spec for a general introduction to the market module.

Queries

  • getInstruments()
  • getInstrumentOrders()
  • getActiveOrders()

Orders

  • addLimitOrder()
  • addMarketOrder()
  • cancelOrder()
  • cancelReplaceLimitOrder()
  • cancelReplaceMarketOrder()

Example

const mnemonic = 'surround miss nominee dream gap cross assault thank captain prosper drop duty group candy wealth weather scale put'
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic)
const [firstAccount] = await wallet.getAccounts()

const rpcEndpoint = 'https://lilmermaid.validator.network'
const client = await SigningEmoneyClient.connectWithSigner(rpcEndpoint, wallet)

const recipient = 'emoney1fd04q4fy30vm4vyx9t4c376zz9gg9wql04gx3g'
const amount = {
  denom: 'eeur',
  amount: '123'
}

const fee = {
  amount: [
    {
      denom: 'eeur',
      amount: '2000'
    }
  ],
  gas: '180000'
}

const result = await client.sendTokens(firstAccount.address, recipient, [amount], fee, 'Have fun with your new coins')
assertIsBroadcastTxSuccess(result)