Skip to main content

Changelog (v2)

2.3.4

  • Docs moved to docs folder

  • Fixes

    • push instead of unshift for api.attachInvokedContractForMintToken.

    • getPrices patch.

    • update export name for TxAttrUsage.

    • Fix transaction attribute deserialization.

    • Fix _emitNum emitting trimmed hex numbers.

    • clean neonDB input numbers

    • Fix TxAttrUsage not being imported properly.

      2.3.0


  • Smart Contract

    • Add OpCodes APPEND and REVERSE.
  • API

    • Add getPrices to get multiple token prices with a single API call.

    • Update parsing of api/getToken to include case of empty string for parsing the decimals field.

    • Update doMintToken to include extra information required for future invokes.

      • This is in preparation of the upcoming changes for minting NEP5 tokens.
    • Implement the API switch.

      • This internal switch allows control over priority of API server.
      • Set to 0 for neoscan priority, 1 for neonDB priority. Setting it in the middle results in a random choice.
      • Switch will dynamically choose whichever server that respond better. A failure will start tilting the switch towards the other server. Freezing the switch will prevent this dynamic behavior.
      • This is currently not fully exposed but will be in the future.
      import { api } from "@cityofzion/neon-js";
      api.setApiSwitch(0);
      api.sendAsset(config); // sendAsset, claimGas and doInvoke will default to use neoscan first
      api.setApiSwitch(1);
      api.doInvoke(config); // This call will default to use neonDB first

      // This freezes the switch, preventing it from changing dynamically.
      // You still can change it with setApiSwitch.
      api.setSwitchFreeze(true);
  • Fixes

    • Fix core.signTransaction to check if input is a HEX private key.
    • Fix NEP5 tokens to parse by decimals field.
    • Fix default values for invocation exclusive component.
  • Others

    • Add docs build information to readme.

      2.2.2


  • Fix nep5/doTransferToken

    2.2.1


-Fix fixed82num not accepting empty string

2.2.0

  • Wallet

    • Implementation of NEP-6 standard as wallet.Wallet
    • Move NEP2 constants to CONST
    • encrypt/decrypt has an extra optional scrypt argument
    • Deprecate wallet.encryptWifAccount, wallet.generateEncryptedWif, wallet.encryptWIF, wallet.decryptWIF
    import Neon, { wallet } from "@cityofzion/neon-js";
    const w1 = Neon.create.wallet();
    const w2 = new wallet.Wallet();
  • Account

    • Add label and extra to Account
    • Add functions encrypt and decrypt to Account
  • Transaction

    • Transaction creation will now move coins used from unspent to spent and add the new coins in unconfirmed.
    • api.sendTx now moves coins from unconfirmed to unspent.
    • This means that we can create 2 transactions in a single block without blocking each other. Previously, the 2 transactions will attempt to use the same coins.
  • API

    • Add api.getToken which is a combination of api.getTokenInfo and api.getTokenBalance, allowing for simple info retrieval within a single call. This is exposed semantically as Neon.get.token.
    • Bugfix CoinMarketCap truncating prices to integers.
    • Bugfix doTransferToken sending gas to wrong address and appending wrong item to txid when successful (was appending the full tx instead).
    • Catch getTokenBalance error when using an address with no balance.
  • RPC

    • Add VMZip method. This allows for individual parsing of VM results. Do note that this method produces a parsing function. It is not to be used directly.
import { rpc, u } from "@cityofzion/neon-js";
const parsingFunc = rpc.VMZip(u.hexstring2ab, u.fixed82num);
rpc.Query.invoke(script).parseWith(parsingFunc);
  • Utils

    • Add hexstring2str method.

      2.1.0


  • Balance as an ES6 class.

    • verifyAssets to validate unspent coins against a given NEO node. Used to check if balance is fully synced and usable.
    • applyTx to apply a spending of a Transaction to the Balance. Allows a Balance to be used to build another Transaction without waiting for sync.
    • Data structure reworked. AssetBalances are now tucked under assets. Use assetSymbols to discover the keys for lookup.
    // This array contains all the symbols of the assets available in this Balance
    balance.assetSymbols = ['NEO', 'GAS']
    // Lookup assets using their symbols
    balance.assets = {
    NEO: {balance: 1, unspent: [ Object ], spent: [], unconfirmed: []}
    GAS: {balance: 25.1, unspent: [ Object ], spent: [], unconfirmed: []}
    }
  • Added doTransferToken to api/nep5

  • Unit tests for utils

  • Typescript typings fixed

    2.0.0


  • Package exports semantic style

    • Default export is now a semantic object that follows the convention of Verb-Noun.
    • Verbs available are : get, create, serialize, deserialize, is. Read the index.js file of each module to know what they export.
    • Modules are individually available as named exports. If you just need account methods, import { wallet } from '@cityofzion/neon-js'
  • Constants and util methods are now exported as

    import Neon from "@cityofzion/neon-js";
    Neon.CONST.DEFAULT_RPC;
    Neon.u.reverseHex;

    import { CONST, u } from "@cityofzion/neon-js";
    CONST.DEFAULT_RPC;
    u.reverseHex;
  • Wallet

    • Account is now available as a class instead of a JS object. Account is now the recommended way to manage keys.
    • Removed getAccountFromWIFKey and getAccountFromPrivateKey
    • Key manipulation methods streamlined to the minimum. No more getAddressFromPrivateKey. Methods now only transform the key one level.
    • Key verification methods fully implemented for every possible key format. Follows convention of isKeyFormat.
  • Transaction

    • Transaction is now an ES6 class instead of a JS object. Transaction is now the recommended way to construct and manipulate transactions.
    • Refactor methods to utilise the new Transaction class.
    • Removed publicKey argument from create Transaction methods as address is sufficient for generating scriptHash.
    • Add human-friendly method for creating TransactionOutput.
    • Ability to add a remark to Transaction through addRemark
  • RPC

    • RPCClient class models a NEO Node. Instantiate with Neon.create.rpcClient(url). Comes with built-in methods for RPC calls.
    • Query class models a RPC call. Instantiate with Neon.create.query(). Comes with built-in methods for RPC calls.
  • API

    • neon-wallet-db API is shifted to api folder.
    • Added coinmarketcap query support for easy price queries.
    • Token query (NEP5) is shifted here.
    • Neoscan support added.
    • Hardware support integrated as external signingFunction provided as argument.
    • New core api methods: sendAsset, claimGas and doInvoke.
  • SC

    • generateDeployScript in sc is a wrapper for generating a deploy script.
    • ContractParam added to support invoke and invokefunction RPC calls.