How to use the @cityofzion/neon-core.u.reverseHex 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-nep5 / __tests__ / abi.ts View on Github external
test("balanceOf", () => {
  const resultFunction = abi.balanceOf(scriptHash, fromAddr);
  const resultScript = resultFunction().str;
  expect(resultScript).toBe(
    `14${u.reverseHex(
      wallet.getScriptHashFromAddress(fromAddr)
    )}51c10962616c616e63654f6667${u.reverseHex(scriptHash)}`
  );
});
github CityOfZion / neon-js / packages / neon-nep5 / __tests__ / abi.ts View on Github external
test("decimals", () => {
  const resultFunction = abi.decimals(scriptHash);
  const resultScript = resultFunction().str;
  expect(resultScript).toBe(
    `0008646563696d616c7367${u.reverseHex(scriptHash)}`
  );
});
github CityOfZion / neon-js / packages / neon-nep5 / src / main.ts View on Github external
scriptHashArray.forEach(scriptHash => {
      if (address) {
        const addrScriptHash = u.reverseHex(
          wallet.getScriptHashFromAddress(address)
        );
        sb.emitAppCall(scriptHash, "name")
          .emitAppCall(scriptHash, "symbol")
          .emitAppCall(scriptHash, "decimals")
          .emitAppCall(scriptHash, "totalSupply")
          .emitAppCall(scriptHash, "balanceOf", [addrScriptHash]);
      } else {
        sb.emitAppCall(scriptHash, "name")
          .emitAppCall(scriptHash, "symbol")
          .emitAppCall(scriptHash, "decimals")
          .emitAppCall(scriptHash, "totalSupply");
      }
    });
github CityOfZion / neon-js / packages / neon-api / src / funcs / smartcontract.ts View on Github external
export async function addAttributeIfExecutingAsSmartContract<
  T extends ManagedApiBasicConfig
>(config: T): Promise {
  if (!config.sendingFromSmartContract) {
    return config;
  }
  config.tx!.addAttribute(
    tx.TxAttrUsage.Script,
    u.reverseHex(config.sendingFromSmartContract)
  );
  return config;
}