import axios from 'axios' ; import { Address } from './../crypto/address' ; export class NeoRpc { static sendRawTransaction ( url , data ) { const req = this . makeRequest ( 'sendrawtransaction' , data ) ; return axios . post ( url , req ) . then ( ( res ) => { return res . data ; } ) ; } static makeRequest ( method , ... params ) { const request = { jsonrpc : '2.0' , method , params , id : 1 } ; return request ; } static getBalance ( url , contractAddr , address ) { const req = this . makeRequest ( 'getstorage' , contractAddr . toHexString ( ) , address . serialize ( ) ) ; return axios . post ( url , req ) . then ( ( res ) => { return res . data ; } ) ; } }