Node API
Description on interact directly with node api
Submit new order.
// Code not tested yet, and provided for explanation reason
import fetch from 'node-fetch'
import { Api, JsonRpc, RpcError, JsSignatureProvider } from 'eosjs'
const rpc = new JsonRpc('https://wax.greymass.com', { fetch })
const signatureProvider = new JsSignatureProvider(['private key of order owner'])
const api = new Api({ rpc, signatureProvider, textDecoder: new TextDecoder(), textEncoder: new TextEncoder() });
// Place buy limit order, buying 1000 TLM for 10 WAX
const objTrans = [{
account: 'eosio', // token contract
name: 'transfer',
authorization: [{
actor: 'useraaaaaaaa', // account placing order (owner)
permission: 'active',
}],
data: {
from: 'useraaaaaaaa',
to: 'alcordexmain',
quantity: `10.0000 WAX`,
memo: `1000.0000 [email protected]`
}
}]
// Result of transaction
const r = await api.transact(objTrans, { blocksBehind: 3, expireSeconds: 30})Get order from contract table.
Last updated