import Big from "big.js" ; import { BaseMsg , Msg , SignMsg } from "../" ; import * as crypto from "../../../crypto" ; import { AminoPrefix } from "../../tx" ; export interface SignedMintTokenMsg extends SignMsg { from : string ; symbol : string ; amount : number ; } export interface MintTokenData extends Msg { from : Buffer ; symbol : string ; amount : number ; aminoPrefix : AminoPrefix ; } export class MintTokenMsg extends BaseMsg { private from : string ; private symbol : string ; private amount : number ; constructor ( { address , sybmol , amount , } ) { super ( ) ; this . from = address ; this . symbol = sybmol ; this . amount = amount ; } getSignMsg ( ) { const signMsg = { from : this . from , amount : Number ( new Big ( this . amount ) . mul ( Math . pow ( 10 , 8 ) ) . toString ( ) ) , symbol : this . symbol , } ; return signMsg ; } getMsg ( ) { const data = { from : crypto . decodeAddress ( this . from ) , symbol : this . symbol , amount : Number ( new Big ( this . amount ) . mul ( Math . pow ( 10 , 8 ) ) . toString ( ) ) , aminoPrefix : AminoPrefix . MintMsg , } ; return data ; } static defaultMsg ( ) { return { from : Buffer . from ( "" ) , symbol : "" , amount : 0 , aminoPrefix : AminoPrefix . MintMsg , } ; } }