Releases: EOSIO/eosjs
EOSJS v22.1.0 Release Notes
This release is the stable release of EOSJS v22.1.0 and contains features, security, stability and miscellaneous fixes.
Support for Read Only Transactions
This release introduces support for the new feature of read only transactions within smart contracts. This feature provides a contract-supported method of read-only queries from external clients via HTTP-RPC. Prior to this release, access was limited to data stored in a single table in DB or KV tables via the get_table_rows
or get_kv_table_rows
API, a mechanism which is exacting and inefficient. Read-only queries enable developers to perform more complex, cross-table queries natively via contract code with the assurance that table data is from the same block height. It can also be used to understand the consequences of a transaction before it is sent. More information can be found here in the documentation for cleos and here in the documentation specific to eosjs.
The transaction_trace
has been modified with the addition of a bill_to_accounts
field, so that it is clear which account paid for cpu/net for the transaction. Additionally, in the case of a failed transaction, available traces are returned to assist in the understanding of why the transaction failed. You can find the failure traces by using the new details
field in the RPCError object.
An example transaction using eosjs might look like:
await api.transact({
actions: [{
account: 'readonly',
name: 'get',
authorization: [{
actor: 'readonly',
permission: 'active',
}],
data: {},
}],
}, {
useLastIrreversible: true,
expireSeconds: 30,
readOnlyTrx: true,
returnFailureTraces: true,
});
The above transaction calls this action that is able to retrieve entries in two tables instead of needing to run get_kv_table_rows
multiple times:
[[eosio::action, eosio::read_only]]
std::vector<my_struct> get() {
my_table_m tm{get_self()};
my_table_f tf{get_self()};
std::vector<my_struct> ret;
auto itm = tm.id.begin();
auto itm_e = tm.id.end();
eosio::cout << "Males: \n";
while(itm != itm_e){
auto row = itm.value();
eosio::cout << "id=" << row.id << ", name=" << row.name << ",gender=" << row.gender << ", age=" << row.age << "\n";
my_struct s;
s.id = row.id;
s.name = row.name;
s.gender = row.gender;
s.age = row.age;
ret.push_back(s);
++itm;
}
eosio::cout << "Females: \n";
auto itf = tf.id.begin();
auto itf_e = tf.id.end();
while(itf != itf_e){
auto row = itf.value();
eosio::cout << "id=" << row.id << ", name=" << row.name << ",gender=" << row.gender << ", age=" << row.age << "\n";
my_struct s;
s.id = row.id;
s.name = row.name;
s.gender = row.gender;
s.age = row.age;
ret.push_back(s);
++itf;
}
return ret;
}
Support for Resource Payer
This release introduces support for the new resource payer feature. Currently the resource costs for transactions on EOSIO-based public networks are paid by the end user of the application, which can make attracting and onboarding new users very difficult. There is a workaround available, but it’s not a straightforward process for either app developers or their end users. If configured per our reference, the additional transaction extension allows a third party to pay for a transactions net and cpu usage. The transaction must be signed by the payer. There is also the ability to limit the amount of cpu and net that the payer is willing to pay. This feature requires that the RESOURCE_PAYER
protocol feature is activated. More information can be found here in the documentation for eosio.cdt and here in the documentation specific to eosjs.
Due to difference in the format of transaction_extensions in the transaction compared to other formats, transaction.abi.json
has been removed and added directly into the code of eosjs-serialize.ts
.
An example transaction using eosjs might look like:
await api.transact({
resource_payer: {
payer: 'alice',
max_net_bytes: 4096,
max_cpu_us: 400,
max_memory_bytes: 0
},
actions: [{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: 'bob',
permission: 'active',
}, {
actor: 'alice',
permission: 'active',
}],
data: {
from: 'bob',
to: 'alice',
quantity: '0.0001 SYS',
memo: 'resource payer',
},
}]
}, {
useLastIrreversible: true,
expireSeconds: 30
});
Other Changes
- (#829) CI/CD to use new bios/boot systems
- (#827) Webpack separating external packages and cross-platform building
- (#826) Additional types for JsonRPC endpoints
- (#835) New CI/CD workflows to automate docker builds/integration tests
- (#839) Adjusting scheduled workflows cron (develop branch)
- (#840) Adding two pipelines for release branch for ci/cd
- (#843) Updating dependencies of eosjs to latest possible versions
- (#848) Updating first example to use indexValue in key value documentation
- (#846) Switching to eosio/eosio docker image in CI/CD
- (#855) Adding first_block_num to GetInfoResult type
- (#862) Bump docker/setup-buildx-action from 154c24e1f33dbb5865a021c99f1318cfebf27b32 to 1.1.2
- (#868) Bump actions/checkout from f90c7b395dac7c5a277c1a6d93d5057c1cddb74e to 2.3.4
- (#871) Bump actions/setup-node from c6fd00ceb9747fb23ffdf72987450a2664414867 to 2.1.5
- (#874) Bump docker/setup-qemu-action from 6520a2d2cb6db42c90c297c8025839c98e531268 to 1.0.2
- (#875) Bump cypress-io/github-action from 6e9b583c9652e99b72b042a3957980fc6166efae to 2.9.11
- (#888) Bump cypress from 6.9.1 to 7.1.0
- (#905) Bump webpack from 5.33.2 to 5.34.0
- (#908) Bump ts-loader from 8.1.0 to 9.0.2
- (#899) Bump cypress-io/github-action from 89161930792c0050baeba2737caa058c395ecfcb to 2.9.12
- (#893) Bump docker/build-push-action from 4a531fa5a603bab87dfa56578bd82b28508c9547 to 2.4.0
- (#922) Bump docker/setup-qemu-action from 25f0500ff22e406f7191a2a8ba8cda16901ca018 to 1.1.0
- (#923) Bump docker/setup-buildx-action from 2a4b53665e15ce7d7049afb11ff1f70ff1610609 to 1.2.0
- (#924) Adjusting types to not require data in action from nodeos response
- (#930) Bump docker/setup-buildx-action from 012185ccbeb554a7f5f987bea0f1a73519b3cdf5 to 1.3.0
- (#931) Bump docker/login-action from f3364599c6aa293cdc2b8391b1b56d0c30e45c8a to 1.9.0
- (#932) Bump cypress-io/github-action from 62779d1ffd6210d6f246a8f708cf937d2beac1e9 to 2.10.1
- (#936) Adjusting the eosjs key value documentation
- (#941) Bumping version to v22.1.0
- (#943) Bump cypress-io/github-action from 2.10.1 to 2.10.2
- (#956) Bump cypress-io/github-action from 2.10.2 to 2.11.0
- (#955) Bump docker/setup-qemu-action from 1.1.0 to 1.2.0
- (#954) Bump docker/build-push-action from 2.4.0 to 2.5.0
- (#970) Adding new
bill_to_accounts
variable to some endpoint responses - (#965) CI/CD changes for PRs #937/#963/#964
- (#963) Support for Read Only Transactions
- (#968) Bump docker/login-action from 1.9.0 to 1.10.0
- (#960) Bump cypress-io/github-action from 2.11.0 to 2.11.5
- (#964) Support for transaction sponsorship/resource payer
- (#972) Feature adjustments to resource payer and read only
- (#986) Separates the web tests to separate tests and adds conditionals
- (#973) Bump cypress-io/github-action from 2.11.5 to 2.11.6
- (#974) Bump docker/build-push-action from 2.5.0 to ...
EOSJS v22.0.0 Release Notes
This release is the stable release of EOSJS v22.0.0 and contains features, security, stability and miscellaneous fixes. Please note that since this release promotes EOSJS v22.0.0-rc2 to v22.0.0 (stable), using the @latest tag will now automatically cause an upgrade from v21.0.x to v22.0.0.
Support for Action Return Values
This release introduces support for the new feature of return values from actions within smart contracts. More information can be found here in the documentation for eosio.cdt and here in the documentation specific to eosjs.
Additionally, an example application has been created to demonstrate how to use this new feature with nodeos and eosjs.
Support for Key Value Databases
This release introduces support for the new key value database feature. More information can be found here in the documentation for eosio.cdt and here in the documentation specific to eosjs.
Due to differences in the format of key value databases in smart contract ABIs, abi.abi.json
has been removed and added directly into the code of eosjs-serialize.ts
.
A new data type in EOSIO.CDT v1.8.0 called eosio::kv::map
provides the underlying functionality and should be used in contracts over the type called eosio::kv::table
that is currently in a developer preview state.
Additionally, an example application has been created to demonstrate how to use this new feature with nodeos and eosjs.
New Method for Constructing Actions and Transactions
A concise new method for constructing actions has been added to improve the developer experience. It is now possible to either construct an action in either a shorter syntax or construct both actions and transactions by creating a stateful TransactionBuilder
object that can be passed through an application before sending when ready. The details for this concise method can be found here in the eosjs documentation.
BREAKING CHANGE: New Endpoints and Typescript Types for Nodeos API Plugins
New endpoints have been added to eosjs to match the latest versions of the api plugins. New Typescript types have been added to assist developers in better understanding what to expect from certain features or responses from the nodeos api plugins. The goal of these new types is to facilitate accurate typescript support and additional documentation for eosjs but there is the possibility of backwards incompatibility. In these situations, it is advised to override the affected types with any
or a user-defined type.
Other Changes
- (#742) Removing RC1 from develop version
- (#776) Merging changes from master or release/21.0.x that were not on develop
- (#777) add bn.js as explicit dependency
- (#778) Adding testing for Action return values
- (#779) Documentation for action return values
- (#780) Updating
abi.abi.json
to eosio::abi/1.2 - (#789) Bumping develop version to 21.1.0
- (#784) Additional types for documentation/development
- (#792) Context Free Tests/Fixes
- (#791) Allowing a name to be an empty string (develop branch)
- (#796) Fixing an issue with response from fetch in the query method
- (#803) Code to support KV Tables
- (#804) updating how-to-get-table-information with kv example
- (#805) Adjusting bios contracts and adding kv_bios
- (#812) New chain_api endpoints and more efficient Tapos fields
- (#813) Documentation for new transaction shorthand design
- (#831) Adjusting CI/CD to use new bios/boot systems (release/22.0.x)
- (#832) Webpack separating external packages and cross-platform building (release/22.0.x)
- (#834) Additional types for JsonRPC endpoints (release/22.0.x)
- (#841) Adding two pipelines for release branch for ci/cd (release 22.0.x)
- (#849) Updating dependencies of eosjs to latest possible versions (release/22.0.x)
- (#847) Switching to eosio/eosio docker image in CI/CD (release/22.0.x)
- (#860) Bump docker/setup-qemu-action from 6520a2d2cb6db42c90c297c8025839c98e531268 to 1.0.2
- (#863) Bump actions/setup-node from c6fd00ceb9747fb23ffdf72987450a2664414867 to 2.1.5
- (#866) Bump docker/setup-buildx-action from 154c24e1f33dbb5865a021c99f1318cfebf27b32 to 1.1.2
- (#869) Bump cypress-io/github-action from 6e9b583c9652e99b72b042a3957980fc6166efae to 2.9.11
- (#873) Bump actions/checkout from f90c7b395dac7c5a277c1a6d93d5057c1cddb74e to 2.3.4
- (#907) Bump webpack from 5.33.2 to 5.34.0
- (#895) Bump cypress from 6.9.1 to 7.1.0
- (#892) Bump docker/build-push-action from 4a531fa5a603bab87dfa56578bd82b28508c9547 to 2.4.0
- (#897) Bump cypress-io/github-action from 89161930792c0050baeba2737caa058c395ecfcb to 2.9.12
- (#900) Bump ts-loader from 8.1.0 to 9.0.0
- (#920) Bump docker/setup-qemu-action from 25f0500ff22e406f7191a2a8ba8cda16901ca018 to 1.1.0
- (#921) Bump docker/setup-buildx-action from 2a4b53665e15ce7d7049afb11ff1f70ff1610609 to 1.2.0
- (#928) Bump docker/setup-buildx-action from 012185ccbeb554a7f5f987bea0f1a73519b3cdf5 to 1.3.0
- (#929) Bump docker/login-action from f3364599c6aa293cdc2b8391b1b56d0c30e45c8a to 1.9.0
- (#933) Bump cypress-io/github-action from 62779d1ffd6210d6f246a8f708cf937d2beac1e9 to 2.10.1
- (#935) Adjusting the eosjs key value documentation (release/22.0.x branch)
- (#938) Bumping version to v22.0.0
- (#940) Merging master into release/22.0.x
Thanks!
Special thanks to the community contributors that submitted patches for this release:
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v21.0.4 Release Notes
This release contains security, stability, and miscellaneous fixes.
Other Changes
- (#856) Allowing a name to be an empty string
- (#857) Addressing identified security vulnerabilities (y18n, elliptic, node-notifier, ini, node-fetch)
- (#858) Bumping version to 21.0.4
Thanks!
Special thanks to the community contributors that submitted patches for this release:
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v22.0.0-rc2 Release Notes
This is a RELEASE CANDIDATE for version 22.0.0. The latest STABLE release is v21.0.3.
This Release Candidate can be accessed by running yarn add eosjs@RC.
BREAKING CHANGE: New Endpoints and Typescript Types for Nodeos API Plugins
More endpoints and types have been added to eosjs to match the latest versions of the api plugins. The goal of these types is to facilitate accurate typescript support and additional documentation for eosjs but there is the possibility of backwards incompatibility. In these situations, it is advised to override the affected types with any
or a user-defined type at this time.
Other Changes
- (#831) Adjusting CI/CD to use new bios/boot systems (release/22.0.x)
- (#832) Webpack separating external packages and cross-platform building (release/22.0.x)
- (#834) Additional types for JsonRPC endpoints (release/22.0.x)
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v22.0.0-rc1 Release Notes
This is a RELEASE CANDIDATE for version 22.0.0. The latest STABLE release is v21.0.3.
This Release Candidate can be accessed by running yarn add eosjs@RC.
Support for Action Return Values
This release candidate introduces support for the new feature of return values from actions within smart contracts. More information can be found here in the documentation for eosio.cdt and here in the documentation specific to eosjs.
Additionally, an example application has been created to demonstrate how to use this new feature with nodeos and eosjs.
Support for Key Value Databases
This release candidate introduces support for the new key value database feature. More information can be found here in the documentation for eosio.cdt and here in the documentation specific to eosjs.
Due to difference in the format of key value databases in smart contract ABIs, abi.abi.json
has been removed and added directly into the code of eosjs-serialize.ts
.
Additionally, an example application has been created to demonstrate how to use this new feature with nodeos and eosjs.
New Method for Constructing Actions and Transactions
A concise new method for constructing actions has been added to improve the developer experience. It is now possible to either construct an action in either a shorter syntax or construct both actions and transactions by creating a stateful TransactionBuilder
object that can be passed through an application before sending when ready. The details for this concise method can be found here in the eosjs documentation.
BREAKING CHANGE: Additional Typescript Types/Nodeos API Plugin Responses
New Typescript types have been added to assist developers in better understanding what to expect from certain features or responses from the nodeos api plugins. These types are defined for the latest versions of the api plugins which have changed, specifically the response for submitting a transaction.
Other Changes
- (#742) Removing RC1 from develop version
- (#776) Merging changes from master or release/21.0.x that were not on develop
- (#777) add bn.js as explicit dependency
- (#778) Adding testing for Action return values
- (#779) Documentation for action return values
- (#780) Updating
abi.abi.json
to eosio::abi/1.2 - (#789) Bumping develop version to 21.1.0
- (#784) Additional types for documentation/development
- (#792) Context Free Tests/Fixes
- (#791) Allowing a name to be an empty string (develop branch)
- (#796) Fixing an issue with response from fetch in the query method
- (#803) Code to support KV Tables
- (#804) updating how-to-get-table-information with kv example
- (#805) Adjusting bios contracts and adding kv_bios
- (#812) New chain_api endpoints and more efficient Tapos fields
- (#813) Documentation for new transaction shorthand design
Thanks!
Special thanks to the community contributors that submitted patches for this release:
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v21.0.3 Release Notes
This release contains security, stability, and miscellaneous fixes.
Sign/Recover/Verify Encoding Argument and Hashing
There was an issue using the new sign/recover/verify methods within eosjs due to the encoding argument during the hashing functionality. Utilizing these functions with the shouldHash
argument set to false and sending hashed data was not affected.
Other Changes
- (#783) [docs] 21.0.x update docs.json for remove_extension filter
- (#786) Resolving issue with encoding argument (release/21.0.x)
- (#787) Bumping version to 21.0.3
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v21.0.2 Release Notes
Note: Since this release promotes EOSJS v21.0.2-rc3 to v21.0.2 (stable), using the @latest tag will now automatically cause an upgrade from v20.0.x to v21.0.2.
Switch to elliptic cryptography library
eosjs-ecc
has been replaced with the elliptic
cryptographic library. The eosjs
public API has been maintained; this is only a change to the internals.
Conversion Helpers To/From elliptic lib's Format
elliptic
stores keys and signatures differently than eosjs-ecc
. For ease of use, conversion functions have been added. These are primarily located in src/eosjs-key-conversions.ts
as well as re-exported in src/eosjs-jssig.ts
. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts
. A glimpse of the functions follows:
// Private Key from EOSIO PUB_K1_ string format to `elliptic` and back
const privEllipticKey = PrivateKey.fromString(eosioK1PrivateKeyAsString).toElliptic();
const finalEosioKeyAsK1String = PrivateKey.fromElliptic(privEllipticKey).toString();
// Public Key from EOSIO PUB_K1_ string format to Elliptic and back
const ellipticPubKey = PublicKey.fromString(eosioK1PubKeyAsString).toElliptic();
const finalEosioKeyAsK1String = PublicKey.fromElliptic(ellipticPubKey).toString();
// Signature from EOS string format to `elliptic` and back
const ellipticSig = Signature.fromString(eosioSignatureAsString).toElliptic();
const finalEosioSignatureAsString = Signature.fromElliptic(ellipticSig).toString();
// Perform digest of data
digestFromSerializedData() // wraps the construction of a digest from the data being digested
Additional Helpers with elliptic
elliptic
has methods to sign, verify, and recover keys and signatures. For ease of use, helper functions that perform the conversion and operation of those methods have been added. These are added to PublicKey, PrivateKey, and Signature classes located in src/eosjs-key-conversions.ts
as well as re-exported in src/eosjs-jssig.ts
. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts
. Additionally, sha256
and generateKeyPair
are available in src/eosjs-key-conversions.ts
. A glimpse of the functions follows:
// Create a message digest with sha256
const digest = sha256(message);
// Generate a Key Pair with specified curve key type. Intended for non-browser environments or development
const { publicKey, privateKey } = generateKeyPair(KeyType.k1);
// Export private key as Legacy EOSIO-format private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const legacyPrivateKey = privateKey.getLegacyString();
// Export public key as Legacy EOSIO-format public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const legacyPublicKey = publicKey.getLegacyString();
// Retrieve the public key from a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const publicKey = privateKey.getPublicKey();
// Sign a message digest with private key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const signature = privateKey.sign(digest, false);
// Validate a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const valid = publicKey.isValid();
// Validate a public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const valid = publicKey.isValid();
// Verify a signature with a message digest and public key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const signature = Signature.fromString(eosioSignatureAsString);
const verified = signature.verify(digest, publicKey, false);
// Recover a public key from a message digest and signature
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const signature = Signature.fromString(eosioSignatureAsString);
const publicKey = signature.recover(digest, false);
eosjs-ecc
Migration Guide
In an effort to make migration easier from eosjs-ecc
, a new module from eosjs-ecc-migration.ts
is available that provides many of the eosjs-ecc
methods. These methods are available to be used for easy migration to this new version but additionally as guides to how to convert code to use the new elliptic helper methods and new key formats. This module will be removed at a later release.
React Native Support
There was a problem using EOSJS v20 with React Native that stemmed from an eosjs-ecc
dependency only being compatible with IE11, Chrome, and Safari. Now that eosjs-ecc
has been removed, React Native is now fully supported in eosjs
.
Context-free Actions Support
Context-free actions are now supported in eosjs
.
WebAuthn Support
Read more about WebAuthn support in the EOSIO 2.0 Medium article. For technical details, see the PR.
We have updated the Tropical Example app to demonstrate a use of Webauthn.
BREAKING CHANGE: /v1/chain/get_table_rows table_key
parameter deprecated
table_key
has been deprecated on the chain_plugin. Replace usages of table_key
with index_position
and use the position of the index where 1 is your primary (first), 2 is your secondary index (in order defined by multi_index), 3 is third index, etc
BREAKING CHANGE: Minified file convention
yarn build-web
command will create both debug and minified files in the dist-web
location. Please use the minified *.min.js
files in production and only use the debug files for development as they are over 10 times as large as the minified versions, and importing the debug versions will increase loading times for the end user.
Transaction compression and useLastIrreversible
Adding the compression
argument to transaction methods will use compression for the transaction. Adding the useLastIrreversible
argument to transaciton methods will use the last irreversible block number for the transaction TAPOS headers.
Other Changes
- (#534) Add
get_scheduled_transactions
to jsonrpc - (#535) Handle context-free data
- (#536) Support context-free actions
- (#545) Add support for send_transaction JSON RPC
- (#552) Update README.md
- (#556) Fix tapos check
- (#562) trimmed off final slash from endpoint with regex
- (#566) adds webhook for metrics collection
- (#568) Update README.md
- (#569) Minor bugfix for invalid example json in documentation
- (#577) web-authn support
- (#579) Replace eosjs-ecc with elliptic
- (#582) replace get_block with get_block_header_state
- (#586) Bump mixin-deep from 1.3.1 to 1.3.2
- (#587) Get block header fallback
- (#588) Missing how-to guides + docs setup
- (#591) Fix Issue #390
- (#597) Add conversion helpers for to/from elliptic lib
- (#600) Fix Issue #450: Removing babel-cli removes need for babel-polyfill
- (#601) Fix #372: Added license, version, and build passing badges
- (#605) Fixing sign() method
- (#606) * fix hash() misuse
- (#609) bugfix. Changing wasmFilePath to wasmHexString in full code example
- (#621) Merging issues fixed on V20.0 branch into develop for eventual release as part of v21
- (#622) Merging V20.0 fixes into develop in prep for next release
- (#626) Cleanup for release
- (#627) bump version
- (#628) bump
- (#629) Accept number equal to 1 or 0 while checking data type of bool.
- (#634) Elliptic p256 compatibility support
- (#639) Fix security issues
- (#641) JsonToRawAbi, inverse of rawAbiToJson
- (#645) V20 merge
- (#647) Bump version to 21-rc1
- (#648) Merge pull request #648 from EOSIO/lock-versions
- (#654) Sign, recover, verify, and validate functions (release/21.0.x branch)
- (#655) Remove warnings
- (#657) Removing the latest deploy from .travis.yml (release/21.0.x branch)
- (#667) Release 21.0.x validate symbol
- (#668) Zero padding Signatur...
EOSJS v21.0.0-rc2 Release Notes
EOSJS v21.0.0-rc2 Release Notes
This is a RELEASE CANDIDATE for version 21.0.0. The latest STABLE release is v20.0.0.
This Release Candidate can be accessed by running yarn add eosjs@RC
.
Additional Helpers with elliptic
elliptic
has methods to sign, verify, and recover keys and signatures. For ease of use, helper functions that perform the conversion and operation of those methods have been added. These are added to PublicKey, PrivateKey, and Signature classes located in src/eosjs-key-conversions.ts
as well as re-exported in src/eosjs-jssig.ts
. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts
. A glimpse of the functions follows:
// Retrieve the public key from a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const publicKey = privateKey.getPublicKey();
// Sign a message digest with private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const signature = privateKey.sign(digest);
// Validate a public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const valid = publicKey.validate();
// Verify a signature with a message digest and public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const signature = Signature.fromString(eosioSignatureAsString);
const verified = signature.verify(digest, publicKey);
// Recover a public key from a message digest and signature
const signature = Signature.fromString(eosioSignatureAsString);
const publicKey = signature.recover(digest);
/v1/chain/get_table_rows table_key
parameter deprecated
table_key
has been deprecated on the chain_plugin. Replace usages of table_key
with index_position
and use the position of the index where 1 is your primary (first), 2 is your secondary index (in order defined by multi_index), 3 is third index, etc
Minified file convention
yarn build-web
command will create both debug and minified files in the dist-web
location. Please use the minified *.min.js
files in production and only use the debug files for development as they are over 10 times as large as the minified versions, and importing the debug versions will increase loading times for the end user.
Other Changes
- (#649) Merge pull request #649 from EOSIO/develop-version-bump
- (#653) Sign, recover, verify, and validate functions
- (#656) Removing latest npm deploy from Travis CI configuration
- (#664) Zero padding Signature r-value/s-value to 32 bytes
- (#666) Fix invalid symbol issue
- (#670) Remove warnings
- (#672) Readme Changes
- (#676) Minified file convention
- (#675) Removing usages of deprecated table_key
- (#671) Rename of basic-usage was missed in doc
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v21.0.2-rc3 Release Notes
This is a RELEASE CANDIDATE for version 21.0.0. The latest STABLE release is v20.0.0.
This Release Candidate can be accessed by running yarn add eosjs@RC.
Switch to elliptic cryptography library
Additional Helpers with elliptic
elliptic
has methods to sign, verify, and recover keys and signatures. For ease of use, helper functions that perform the conversion and operation of those methods have been added. These are added to PublicKey, PrivateKey, and Signature classes located in src/eosjs-key-conversions.ts
as well as re-exported in src/eosjs-jssig.ts
. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts
. Additionally, sha256
and generateKeyPair
are available in src/eosjs-key-conversions.ts
. A glimpse of the functions follows:
// Create a message digest with sha256
const digest = sha256(message);
// Generate a Key Pair with specified curve key type. Intended for non-browser environments or development
const { publicKey, privateKey } = generateKeyPair(KeyType.k1);
// Export private key as Legacy EOSIO-format private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const legacyPrivateKey = privateKey.getLegacyString();
// Export public key as Legacy EOSIO-format public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const legacyPublicKey = publicKey.getLegacyString();
// Retrieve the public key from a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const publicKey = privateKey.getPublicKey();
// Sign a message digest with private key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const signature = privateKey.sign(digest, false);
// Validate a private key
const privateKey = PrivateKey.fromString(eosioK1PrivateKeyAsString);
const valid = publicKey.isValid();
// Validate a public key
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const valid = publicKey.isValid();
// Verify a signature with a message digest and public key
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const publicKey = PublicKey.fromString(eosioK1PubKeyAsString);
const signature = Signature.fromString(eosioSignatureAsString);
const verified = signature.verify(digest, publicKey, false);
// Recover a public key from a message digest and signature
const digest = sha256(message); // optional, setting shouldHash to true will hash the message
const signature = Signature.fromString(eosioSignatureAsString);
const publicKey = signature.recover(digest, false);
eosjs-ecc
Migration Guide
In an effort to make migration easier from eosjs-ecc
, a new module from eosjs-ecc-migration.ts
is available that provides many of the eosjs-ecc
methods. These methods are available to be used for easy migration to this new version but additionally as guides to how to convert code to use the new elliptic helper methods and new key formats. This module will be removed at a later release.
Transaction compression and useLastIrreversible
Adding the compression
argument to transaction methods will use compression for the transaction. Adding the useLastIrreversible
argument to transaciton methods will use the last irreversible block number for the transaction TAPOS headers.
Other Changes
- (#687) Backwards/currently compatible fetch
- (#692) Switching to browser compatible .toArrayLike (release/21.0.x branch)
- (#695) Fix broken link to intro page
- (#709) eosjs-ecc methods and migration (release/21.0.x branch)
- (#715) Added false for shouldHash to sign() usages (release/21.0.x branch)
- (#730) 2020 License
- (#744) Resolving deprecation of new Buffer() (release/21.0.x branch)
- (#745) Adds functionality to use the last irreversible block for transactions (release/21.0.x branch)
- (#746) Supporting transaction compression (release/21.0.x branch)
- (#747) Remove unnecessary call to get_block_header_state (release/21.0.x branch)
- (#748) Adding regex to validate name during serialization (release/21.0.x branch)
- (#749) Adding an alternative option for browser to generate key pairs (release/21.0.x branch)
- (#750) New CI/CD Utilizing GitHub Actions (release/21.0.x branch)
- (#751) Fix R1 Signatures (release/21.0.x branch)
- (#752) Migrating from tslint to eslint (release/21.0.x branch)
- (#753) Bumping versions or removing unused dependencies (release/21.0.x branch)
- (#754) Resolves differences missed in merging
- (#756) Updating CI/CD to check for protected branch and use token so workflow re-runs (release/21.0.x branch)
- (#768) Bump elliptic - v21
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.
EOSJS v21.0.0-RC1 Release Notes
EOSJS v21.0.0-rc1 Release Notes
This is a RELEASE CANDIDATE for version 21.0.0. The latest STABLE release is v20.0.0.
This Release Candidate can be accessed by running yarn add eosjs@RC
.
Switch to elliptic cryptography library
eosjs-ecc
has been replaced with the elliptic
cryptographic library. The eosjs
public API has been maintained; this is only a change to the internals.
Context-free Actions Support
Context-free actions are now supported in eosjs
.
WebAuthn Support
Read more about WebAuthn support in the EOSIO 2.0 Medium article. For technical details, see the PR.
We have updated the Tropical Example app to demonstrate a use of Webauthn.
Conversion Helpers To/From elliptic lib's Format
elliptic
stores keys and signatures differently than eosjs-ecc
. For ease of use, conversion functions have been added. These are primarily located in src/eosjs-key-conversions.ts
as well as re-exported in src/eosjs-jssig.ts
. Usage examples of each can be found in src/tests/eosjs-jssig.test.ts
. A glimpse of the functions follows:
// Private Key from EOSIO PUB_K1_ string format to `elliptic` and back
const privEllipticKey = PrivateKey.fromString(eosioK1PrivateKeyAsString).toElliptic();
const finalEosioKeyAsK1String = PrivateKey.fromElliptic(privEllipticKey).toString();
// Public Key from EOSIO PUB_K1_ string format to Elliptic and back
const ellipticPubKey = PublicKey.fromString(eosioK1PubKeyAsString).toElliptic();
const finalEosioKeyAsK1String = PublicKey.fromElliptic(ellipticPubKey).toString();
// Signature from EOS string format to `elliptic` and back
const ellipticSig = Signature.fromString(eosioSignatureAsString).toElliptic();
const finalEosioSignatureAsString = Signature.fromElliptic(ellipticSig).toString();
// Perform digest of data
digestFromSerializedData() // wraps the construction of a digest from the data being digested
Other Changes
- (#534) Add
get_scheduled_transactions
to jsonrpc - (#535) Handle context-free data
- (#536) Support context-free actions
- (#552) Update README.md
- (#556) Fix tapos check
- (#545) Add support for send_transaction JSON RPC
- (#562) trimmed off final slash from endpoint with regex
- (#566) adds webhook for metrics collection
- (#577) web-authn support
- (#579) Replace eosjs-ecc with elliptic
- (#569) Minor bugfix for invalid example json in documentation
- (#568) Update README.md
- (#582) replace get_block with get_block_header_state
- (#586) Bump mixin-deep from 1.3.1 to 1.3.2
- (#587) Get block header fallback
- (#597) Add conversion helpers for to/from elliptic lib
Disclaimer: All repositories and other materials are provided subject to this IMPORTANT notice and you must familiarize yourself with its terms. The notice contains important information, limitations and restrictions relating to our software, publications, trademarks, third-party resources, and forward-looking statements. By accessing any of our repositories and other materials, you accept and agree to the terms of the notice.