How to use the stellar-base.Asset.native function in stellar-base

To help you get started, we’ve selected a few stellar-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapPathPayment(): IPathPaymentOperation {
    const destinationAsset =
      this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
    const sourceAsset =
      this.data.source_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.source_asset_code, this.data.source_asset_issuer);

    return {
      ...this.baseData,
      ...{
        sendMax: this.data.source_max,
        amountSent: this.data.source_amount,
        amountReceived: this.data.amount,
        destinationAccount: this.data.to,
        destinationAsset,
        sourceAccount: this.data.from,
        sourceAsset
      }
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapPayment(): IPaymentOperation {
    const asset =
      this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);

    return {
      ...this.baseData,
      ...{
        destination: this.data.to,
        source: this.data.from,
        amount: this.data.amount,
        asset
      }
    };
  }
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapManageOffer(): IManageSellOfferOperation | IManageBuyOfferOperation {
    const assetBuying =
      this.data.buying_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);

    const assetSelling =
      this.data.selling_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);

    return {
      ...this.baseData,
      ...{
        offerId: this.data.offer_id.toString(),
        amount: this.data.amount,
        price: this.data.price,
        priceComponents: {
          n: this.data.price_r.n,
          d: this.data.price_r.d
        },
        assetBuying,
        assetSelling
      }
    };
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapManageOffer(): IManageSellOfferOperation | IManageBuyOfferOperation {
    const assetBuying =
      this.data.buying_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);

    const assetSelling =
      this.data.selling_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);

    return {
      ...this.baseData,
      ...{
        offerId: this.data.offer_id.toString(),
        amount: this.data.amount,
        price: this.data.price,
        priceComponents: {
          n: this.data.price_r.n,
          d: this.data.price_r.d
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapPathPayment(): IPathPaymentOperation {
    const destinationAsset =
      this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
    const sourceAsset =
      this.data.source_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.source_asset_code, this.data.source_asset_issuer);

    return {
      ...this.baseData,
      ...{
        sendMax: this.data.source_max,
        amountSent: this.data.source_amount,
        amountReceived: this.data.amount,
        destinationAccount: this.data.to,
        destinationAsset,
        sourceAccount: this.data.from,
        sourceAsset
      }
    };
  }
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapPathPaymentStrictSend(): IPathPaymentStrictSendOperation {
    const destinationAsset =
      this.data.asset_type === "native" ? Asset.native() : new Asset(this.data.asset_code, this.data.asset_issuer);
    const sourceAsset =
      this.data.source_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.source_asset_code, this.data.source_asset_issuer);

    return {
      ...this.baseData,
      ...{
        destinationMin: this.data.destination_min,
        amountSent: this.data.source_amount,
        amountReceived: this.data.amount,
        destinationAccount: this.data.to,
        destinationAsset,
        sourceAccount: this.data.from,
        sourceAsset
      }
github astroband / astrograph / src / model / factories / operation_data_mapper / horizon.ts View on Github external
private mapCreatePassiveOffer(): ICreatePassiveSellOfferOperation {
    const assetBuying =
      this.data.buying_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.buying_asset_code, this.data.buying_asset_issuer);

    const assetSelling =
      this.data.selling_asset_type === "native"
        ? Asset.native()
        : new Asset(this.data.selling_asset_code, this.data.selling_asset_issuer);

    return {
      ...this.baseData,
      ...{
        amount: this.data.amount,
        price: this.data.price,
        priceComponents: {
          n: this.data.price_r.n,
          d: this.data.price_r.d
        },
        assetBuying,
        assetSelling
      }
    };
  }