src/client/index.js
/**
   * Prepare a serialized raw transaction for sending to the blockchain.
   * @param {Object} msg the msg object
   * @param {Object} stdSignMsg the sign doc object used to generate a signature
   * @param {String} address
   * @param {Number} sequence optional sequence
   * @param {String} memo optional memo
   * @return {Transaction} signed transaction
   */
Prepare a serialized raw transaction for sending to the blockchain.
Prepare a serialized raw transaction for sending to the blockchain .
async _prepareTransaction(msg, stdSignMsg, address, sequence=null, memo="") {
    if ((!this.account_number || !sequence) && address) {
      const data = await this._httpClient.request("get", `${api.getAccount}/${address}`)
      sequence = data.result.sequence
      this.account_number = data.result.account_number
    } else if (this._setPkPromise) {
      await this._setPkPromise
    }
    const options = {
      account_number: parseInt(this.account_number),
      chain_id: this.chainId,
      memo: memo,
      msg,
      sequence: parseInt(sequence),
      type: msg.msgType,
    }
    const tx = new Transaction(options)
    return this._signingDelegate.call(this, tx, stdSignMsg)
  }
async _prepareTransaction ( msg , stdSignMsg , address , sequence = null , memo = "" ) { if ( ( ! this . account_number || ! sequence ) && address ) { const data = await this . _httpClient . request ( "get" , ` ${ api . getAccount } ${ address } ` ) sequence = data . result . sequence this . account_number = data . result . account_number } else if ( this . _setPkPromise ) { await this . _setPkPromise } const options = { account_number : parseInt ( this . account_number ) , chain_id : this . chainId , memo : memo , msg , sequence : parseInt ( sequence ) , type : msg . msgType , } const tx = new Transaction ( options ) return this . _signingDelegate . call ( this , tx , stdSignMsg ) }
Prepare a serialized raw transaction for sending to the blockchain.
Prepare a serialized raw transaction for sending to the blockchain .
// if user has not used `await` in its call to setPrivateKey (old API), we should wait for the promise here