import { JSONRPC } from "./types" ; import { Buffer } from "buffer/" ; import bigInteger from "big-integer" ; export class ResultBroadcastTx { public static fromJSON ( obj , mode ) { const result = obj . result ; return new ResultBroadcastTx ( mode , result . code , Buffer . from ( result . data , "hex" ) , result . log , Buffer . from ( result . hash , "hex" ) ) ; } constructor ( public readonly mode , public readonly code , public readonly data , public readonly log , public readonly hash ) { } } export class ResultBroadcastTxCommit { public static fromJSON ( obj ) { const result = obj . result ; return new ResultBroadcastTxCommit ( "commit" , ResponseCheckTx . fromJSON ( result . check_tx ) , ResponseDeliverTx . fromJSON ( result . deliver_tx ) , Buffer . from ( result . hash , "hex" ) , bigInteger ( result . height ) ) ; } constructor ( public readonly mode , public readonly checkTx , public readonly deliverTx , public readonly hash , public readonly height ) { } } export class ResponseCheckTx { public static fromJSON ( obj ) { const tags = [ ] ; if ( obj . tags ) { for ( const tag of obj . tags ) { tags . push ( { key : Buffer . from ( tag . key , "base64" ) , value : Buffer . from ( tag . value , "base64" ) } ) ; } } return new ResponseCheckTx ( obj . code , obj . data ? Buffer . from ( obj . data , "base64" ) : Buffer . from ( [ ] ) , obj . log , obj . info , bigInteger ( obj . gas_wanted ) , bigInteger ( obj . gas_used ) , tags , obj . codespace ) ; } constructor ( public readonly code , public readonly data , public readonly log , public readonly info , public readonly gasWanted , public readonly gasUsed , public readonly tags , public readonly codespace ) { } } export class ResponseDeliverTx { public static fromJSON ( obj ) { const tags = [ ] ; if ( obj . tags ) { for ( const tag of obj . tags ) { tags . push ( { key : Buffer . from ( tag . key , "base64" ) , value : Buffer . from ( tag . value , "base64" ) } ) ; } } return new ResponseDeliverTx ( obj . code , obj . data ? Buffer . from ( obj . data , "base64" ) : Buffer . from ( [ ] ) , obj . log , obj . info , bigInteger ( obj . gas_wanted ) , bigInteger ( obj . gas_used ) , tags , obj . codespace ) ; } constructor ( public readonly code , public readonly data , public readonly log , public readonly info , public readonly gasWanted , public readonly gasUsed , public readonly tags , public readonly codespace ) { } }