How to use the @cityofzion/neon-core.CONST.ASSET_ID function in @cityofzion/neon-core

To help you get started, we’ve selected a few @cityofzion/neon-core 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 CityOfZion / neon-js / packages / neon-api / src / funcs / main.ts View on Github external
return Object.keys(assetAmts).map(key => {
    return new tx.TransactionOutput({
      assetId: CONST.ASSET_ID[key],
      value: assetAmts[key],
      scriptHash: acct.scriptHash
    });
  });
}
github CityOfZion / neon-js / packages / neon-api / src / provider / neoscan / core.ts View on Github external
return rawTxs.map(tx => {
    const vin = tx.vin
      .filter(i => i.address_hash === address)
      .map(i => ({ asset: i.asset, value: i.value }));
    const vout = tx.vouts
      .filter(o => o.address_hash === address)
      .map(i => ({ asset: i.asset, value: i.value }));
    const change = {
      NEO: getChange(vin, vout, CONST.ASSET_ID.NEO),
      GAS: getChange(vin, vout, CONST.ASSET_ID.GAS)
    };
    return {
      txid: tx.txid,
      blockHeight: tx.block_height,
      change
    };
  });
}
github CityOfZion / neon-js / packages / neon-api / src / provider / neoscan / core.ts View on Github external
return rawTxs.map(tx => {
    const vin = tx.vin
      .filter(i => i.address_hash === address)
      .map(i => ({ asset: i.asset, value: i.value }));
    const vout = tx.vouts
      .filter(o => o.address_hash === address)
      .map(i => ({ asset: i.asset, value: i.value }));
    const change = {
      NEO: getChange(vin, vout, CONST.ASSET_ID.NEO),
      GAS: getChange(vin, vout, CONST.ASSET_ID.GAS)
    };
    return {
      txid: tx.txid,
      blockHeight: tx.block_height,
      change
    };
  });
}
github CityOfZion / neon-js / packages / neon-nep9 / src / extract.ts View on Github external
export function extractAsset(params: {
  [key: string]: string;
}): string | undefined {
  if (!params.asset) {
    return undefined;
  }
  switch (params.asset) {
    case "neo":
      return CONST.ASSET_ID.NEO;
    case "gas":
      return CONST.ASSET_ID.GAS;
    default:
      return params.asset;
  }
}