toXDRObject() {
    if (this.isNative()) {
      return xdr.Asset.assetTypeNative();
    }

    let xdrType;
    let xdrTypeString;
    if (this.code.length <= 4) {
      xdrType = xdr.AssetAlphaNum4;
      xdrTypeString = 'assetTypeCreditAlphanum4';
    } else {
      xdrType = xdr.AssetAlphaNum12;
      xdrTypeString = 'assetTypeCreditAlphanum12';
    }

    // pad code with null bytes if necessary
    const padLength = this.code.length <= 4 ? 4 : 12;
    const paddedCode = padEnd(this.code, padLength, '\0');

    // eslint-disable-next-line new-cap
    const assetType = new xdrType({
      assetCode: paddedCode,
      issuer: Keypair.fromPublicKey(this.issuer).xdrAccountId()
    });

    return new xdr.Asset(xdrTypeString, assetType);
  }
/**
   * Returns the xdr object for this asset.
   * @returns {xdr.Asset} XDR Asset object
   */
Returns the xdr object for this asset.
@returns {xdr.Asset} XDR Asset object
Returns the xdr object for this asset . @returns { xdr . Asset } XDR Asset object
toXDRObject() {
    if (this.isNative()) {
      return xdr.Asset.assetTypeNative();
    }
    let xdrType;
    let xdrTypeString;
    if (this.code.length <= 4) {
      xdrType = xdr.AssetAlphaNum4;
      xdrTypeString = 'assetTypeCreditAlphanum4';
    } else {
      xdrType = xdr.AssetAlphaNum12;
      xdrTypeString = 'assetTypeCreditAlphanum12';
    }
    const padLength = this.code.length <= 4 ? 4 : 12;
    const paddedCode = padEnd(this.code, padLength, '\0');
    const assetType = new xdrType({
      assetCode: paddedCode,
      issuer: Keypair.fromPublicKey(this.issuer).xdrAccountId()
    });
    return new xdr.Asset(xdrTypeString, assetType);
  }
toXDRObject ( ) { if ( this . isNative ( ) ) { return xdr . Asset . assetTypeNative ( ) ; } let xdrType ; let xdrTypeString ; if ( this . code . length <= 4 ) { xdrType = xdr . AssetAlphaNum4 ; xdrTypeString = 'assetTypeCreditAlphanum4' ; } else { xdrType = xdr . AssetAlphaNum12 ; xdrTypeString = 'assetTypeCreditAlphanum12' ; } const padLength = this . code . length <= 4 ? 4 : 12 ; const paddedCode = padEnd ( this . code , padLength , '\0' ) ; const assetType = new xdrType ( { assetCode : paddedCode , issuer : Keypair . fromPublicKey ( this . issuer ) . xdrAccountId ( ) } ) ; return new xdr . Asset ( xdrTypeString , assetType ) ; }
Returns the xdr object for this asset.
Returns the xdr object for this asset .
// pad code with null bytes if necessary // eslint-disable-next-line new-cap