Skip to main content

3.11.9

  • Fixes

    • Fix balance calculation after applying transaction.
    • Remove applyTx call from Balance.calculate.
    • fix getVersion parsing.
    • Fix typings for buildMultiSig.
    • Fix ScriptBuilder's integer not emitted as two's complement.
    • Lock dependencies to specific versions.
    • Adjust ScriptBuilder for dnagling instructions.

    3.11.0

  • Wallet

    • Add multi-sig support through Account.createMultiSig.
  • Transaction

    • Add multi-sig support through Witness.buildMultiSig.

3.10.1

  • Fixes

    • Adjust default timeout for rpc calls to 30s from 5s.

    3.10.0

  • API

    • getTokenBalances to retrieve multiple token balances for a single address within a single HTTP call.
    • setupVote is a new method that allows you to setup your voting status for your neo.
    const config = {
    net: "TestNet",
    account: new wallet.Account(privateKey),
    candidateKeys: [key1, key2], // Keys retrieved from a getValidators call.
    };
    Neon.api.setupVote(config);
  • RPC

    • getvalidators call added. This call returns the list of possible candidates as well as their current vote tally.
  • Wallet

    • verifySignature as the counterpart to generateSignature. This makes it possible to verify signatures of pure hexstrings.
    • State Transaction support is added.
  • Website

    • Redirect static package to use unpkg. This will serve the latest browser.js that is published.

    3.9.2

  • Fixes

    • Change default return value of contract in deployContract to ff00
    • Fix bug in getRPCEndpoint where we drop the list when finding a new best height
    • Fix bug in getRPCEndpoint where a rejected promise was ending the Promise.race
    • Remove neonDB tests

    3.9.1

  • Fixes

    • Added sendingFromSmartContract for claimGas.

    3.9.0

  • Smart Contract

    • Add Runtime.Deserialize logic. This is the deserialization logic found in the VM.
    import { sc } from "@cityofzion/neon-js";
    sc.deserialize("800200126d65737361676520746f206d7973656c66210204438ffc5a");
  • Fixes

    • All class constructors now accept optional parameters. This means that all classes should be easily instantiated with defaults if required.
    • Update dump logic for managed methods to dump fees.

    3.8.1

  • Fixes

    • Typings update

    3.8.0

  • Transactions

    • Transactions now support attaching fees
  • API

    • Neoscan getTransactionHistory is updated to use a paginated endpoint. It currently only supports a single page but it should speed up loading by a significant amount. The downside is that it will not return the full history.
  • Fixes

    • getRPCEndpoint is adjusted to also return RPCs that are only 1 block behind the best height. This reduces the load on a single RPC on the chance that only 1 endpoint has the best height. This should increase RPC reliability while not sacrificing too much in terms of information.

    3.7.3

  • Fixes

    • Fix scriptBuilder to ScriptParams error parsing nonce
    • Use generateRandomArray in attachAttributes
    • Fix timeout setting for api calls
    • Correct semantic API for verify
    • Typings update

    3.7.0

  • RPC

    • RPC Client now has the fields latency and lastSeenHeight and method ping().
    import {rpc} from '@cityofzion/neon-js

    var client = new rpc.RPCClient(url)
    client.ping()
    .then(ms => {
    console.log(ms) // latency in milliseconds. Max of 2000 (default timeout for ping)
    console.log(client.latency) // This is an average of last 5 values retrieved using ping()
    console.log(client.lastSeenHeight) // This is filled whenever getBlockCount is called
    })
    • RPC Client now takes an extra argument config which exposes the underlying axios instance, allowing users to customize the axios configuration.
  • API

    • Add attribute and remark for signing empty transactions. Now if you use doInvoke for your token transfers, it will automatically setup your transaction to be accepted by the NEO node without the need for any asset inputs.
    • claimGas now accepts a claims property as an override for claims. This behavior is inline with sendAsset and doInvoke accepting balance overrides.
    • getRPCEndpoint now ensures that the returned endpoint is callable by doing a ping check internally. It will also cache the endpoint to return next time instead of repeatedly pinging every single healthy node.
  • Settings

    • Settings now contain timeout which setups the timeouts for ping and all rpc calls
  • Fixes

    • Fix faulty url in networks config file
    • Fix typings for strategy
    • Update neoscan.getMaxClaimAmount to use get_unclaimed endpoint

    3.6.2

  • Fixes

    • wallet.decryptAsync to properly reject all errors
    • fix balancedApproach calculation strategy to consider bigger coins when insufficient small coins
    • Fix typo in typings

    3.6.0

  • Transaction

    • Add calculation strategies to modify how inputs are selected. Current available strategies are smallestFirst, biggestFirst and balancedApproach. Currently only available as a global setting.
    import { tx, settings } from "@cityofzion/neon-js";

    // Change the strategy to use the biggest valued output available.
    settings.defaultCalculationStrategy = tx.calculationStrategy.biggestFirst;
    // See all available strategies
    console.log(tx.calculationStrategy);

    3.5.0

  • Wallet

    • Add scripthash support. Account now accepts scripthash as a constructor and isScriptHash is available as a verification method.
  • SC

    • Add arguments for handling specific ContractParam transformation. The first one to do this is Fixed8 which takes a decimals argument which adjusts the number to the number of decimals given. This is useful for contracts that use decimals places other than 8.

    3.4.5

  • Docs

    • Add 2 new guides around doInvoke
  • Fixes

    • Fix script ordering for mintTokens
    • Remove new for Coin
    • Revert upgrade for bignumber.js
    • Fix typings and add typings check
    • Fix ScriptBuilder._emitString for large strings

    3.4.0

  • Settings

    • There is now global settings that control how neon-js works. The first settings available are httpsOnly and networks.

      • httpsOnly is a boolean which will force neonDB and neoscan to return only https RPC nodes. Do note that an error will be thrown if no suitable nodes are found.
      • networks is an object containing every network configuration available for consumption. It comes default with MainNet, TestNet and CozNet. For now, these configurations only determine the neonDB/neoscan urls used for each network but they will serve more purposes in the future.
  • RPC

    • Network class representing a NEO network. This can be created by importing a protocol file or just manually entering the parameters. This is the new way which we can link neon-js to a private net that comes with a neoscan or neonDB setup.
  • Smart Contract

    • ScriptBuilder.toScriptParams allows you to reverse engineer a VM script back to its arguments. Due to the varied nature of the arguments, it is not possible to reverse it completely. More work has to be done on the user side to parse it in a meaningful manner.
    const sb = new sb.ScriptBuilder(
    "00c1046e616d65675f0e5a86edd8e1f62b68d2b3f7c0a761fc5a67dc"
    );
    const params = sb.toScriptParams();
    params = [
    {
    scriptHash: "dc675afc61a7c0f7b3d2682bf6e1d8ed865a0e5f",
    args: [
    "6e616d65", // 'name' in hexstring
    [],
    ],
    useTailCall: false,
    },
    ];
  • Wallet

    • New methods added for signing and verifying messages: signMessage, verifyMessage
  • Docs

    • Docs migrated to Docusaurus! This will make it easier to customize docs and also allow us to support Chinese as the alternative language.
  • Development

    • Upgraded dependencies to use webpack v4 and the new babel exports from its monorepo.
  • Fixes

    • Fix neonDB and neoscan getTransactionHistory. Do note that this can be considered a breaking change for some as the return structure has changed. However, this is considered a fix as the original return structure was not intended.
    • new Wallet to use default scrypt params when not provided.
    • Typescript typings refactored and cleaned up. Introduces the object-like interfaces which are the neon-js classes exported as plain javascript objects.

    3.3.2

  • Fixes

    • Update typescript typings
    • Use user provided parameters when given for api core methods
    • Fix ScriptBuilder to accept empty string and zero value
    • neonDB to use get_all_nodes endpoint instead of best_node endpoint
    • Fix neoscan getMaxClaimAmount, getBalance and getClaims for invalid addresses

    3.3.0

  • API

    • Add support for manpulating smart contracts. This means that you can send assets from smart contracts. This support is currently enabled only in the core API methods sendAsset and doInvoke. This is currently experimental and is subject to breaking changes without notice (no minor version bump for changes to these).
    • Add support for config.account. You can now use Account in place of address and private key.
    • Add support for config.balance. You can use an old Balance object instead of retrieving a new one. Attaching a Balance object will cause the function to skip over the retrieval process.
  • Wallet

    • Add confirm to Balance object.
  • SC

    • Add ContractParam.hash160
  • Util

    • Add isHex and ensureHex as ways to conveniently check format of hexstrings.
  • Fixes

    • Add more logging messages throughout.
    • api.signTx now checks and converts the return value from external function to a Transaction object.
    • Fix regex string for rpc.getVersion.

    3.2.1

  • Update typescript typings

    3.2.0

  • Wallet

    • Implement encryptAsync and decryptAsync using a new scrypt library. Further work will be done to convert the existing encrypt/decrypt to use the new library.
    • Claims object is now slicable, allowing users to break up the Claims object into smaller Claims.
  • Util

    • Override more methods in Fixed8 to return Fixed8s.
    • Update util functions to use Fixed8 internally.
  • API

    • Mark api.nep5.doTransferToken for deprecation.
  • Sc

    • createScript now accepts an array of scripts to parse and concatenate.
  • Docs

    • Start to overhaul docs to favor examples and integrating the reference into the main docs instead of having it as a standalone section.
  • Others

    • NPM packages updated to latest.
  • Fixes

    • Fix scryptParams to use n,r,p
    • Update default RPC endpoints to use https
    • Fix Account defaults
    • Fix _emitNum emitting trimmed hex numbers

    3.1.0

  • API

    • Expose the loadBalance method. This method allows the use of the dynamic API switch within neon-js for the external providers.
    • Implement the full set of APIs on neoscan. Neoscan is now complete and up to par with neonDB in terms of features.
    • Expose getXFrom set of methods which follow the API config convention and is usable with the loadBalance function.

    3.0.0

  • Logging

    • Setup logging directed at stdout and stderr. Logging package is loglevel.
    • Defaults to silent.
    • Not exposed through semantic style currently.
    • All deprecation messages are set to 'warn' level.
    • See logging for more details.
  • Utils

    • Fixed8: A new class extending bignumber.js that replaces all value storage in neon-js
    • This class is now used for all classes that involves coin values with decimal places.
    • Comes with helper methods such as toHex and fromHex.
import { u } from "@cityofzion/neon-js";
// accepts numbers or string
const num1 = new u.Fixed8(123.4567);
const num2 = u.Fixed8.fromHex("0000000005f5e100"); // 1

const num3 = num1.add(num2); // immutable
console.log(num3.toString()); // '124.4567'
  • Wallet

    • Claims is now a ES6 class. While it does not have any spceial methods for it now, it is one of the high level objects that we will be working with in neon-js. This allows easy creation of Claims using the constructor by passing in a CLaims-like javascript object.
    • components have been created for the minor sub-components found in Claims and Balance. These methods are useful for us to rapidly create components that are usable with neon-js methods. Refer to the wallet section for more information.
    • BREAKING Excess NEP2 functions are now fully deprecated. The list is encryptWifAccount, generateENcryptedWif, encryptWIF, decryptWIF.
  • Transaction

    • Update all methods to conform with the new Fixed8 classes. This also means that neon-js will not be compatible with just normal javascript objects anymore.
  • API

    • BREAKING Update external API libraries (neonDB and neoscan) to return Balance and Claims objects. Fixed8 will be used in the new models, making arithmetic operations very different from normal javascript numbers.
    • A bug has been discovered in getPrice. While it works for NEO and GAS, it will not work for any of the NEP5 tokens. getPrices has been fixed for this bug. However, there is no easy fix for getPrice and thus, we will move forward with deprecating getPrice in favor of getPrices.
  • Fixes

    • fix getPrices by adding a limit=0 to the query.
    • fix default Account.contract field not having the required shape.
    • fix transaction attribute being deserialized wrongly.