Releases: CityOfZion/neon-js
Releases · CityOfZion/neon-js
Dandylion
-
RPC
- RPC Client now has the fields
latency
andlastSeenHeight
and methodping()
.
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.
- RPC Client now has the fields
-
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 aclaims
property as an override for claims. This behavior is inline withsendAsset
anddoInvoke
acceptingbalance
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.
- Add attribute and remark for signing empty transactions. Now if you use
-
Settings
- Settings now contain
timeout
which setups the timeouts forping
and all rpc calls
- Settings now contain
-
Fixes
- Fix faulty url in networks config file
- Fix typings for strategy
- Update
neoscan.getMaxClaimAmount
to useget_unclaimed
endpoint
Heat Wave
-
Fixes
wallet.decryptAsync
to properly reject all errors- fix
balancedApproach
calculation strategy to consider bigger coins when insufficient small coins - Fix typo in typings
Cold Wave
-
Transaction
- Add calculation strategies to modify how inputs are selected. Current available strategies are
smallestFirst
,biggestFirst
andbalancedApproach
. 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)
- Add calculation strategies to modify how inputs are selected. Current available strategies are
Change Of Heart
-
Wallet
- Add scripthash support.
Account
now accepts scripthash as a constructor andisScriptHash
is available as a verification method.
- Add scripthash support.
-
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.
Return From Different Dimension
-
Docs
- Add 2 new guides around
doInvoke
- Add 2 new guides around
-
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
Patch signature ordering
3.3.3 3.3.3
Macro Cosmos
3.4.0
-
Settings
-
There is now global settings that control how
neon-js
works. The first settings available arehttpsOnly
andnetworks
.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 withMainNet
,TestNet
andCozNet
. 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.
- 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
-
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
- New methods added for signing and verifying messages:
-
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.
- Fix neonDB and neoscan
Mind Crush
- Fix neoscan
getMaxClaimAmount
,getBalance
andgetClaims
for invalid addresses - typings update for
api.fillUrl
- minor toString customizations
Brain Control
-
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 ofbest_node
endpoint
Mind Control
-
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
anddoInvoke
. 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.
- 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
-
Wallet
- Add
confirm
to Balance object.
- Add
-
SC
- Add ContractParam.hash160
-
Util
- Add
isHex
andensureHex
as ways to conveniently check format of hexstrings.
- Add
-
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
.