Updated cookbook
Guardians are coming to Mainnet
And to this regards we've added support for guarded transactions. See the new fields transaction.guardian
, transaction.guardianSignature
and the function transaction.applyGuardianSignature()
.
Creating a guarded transaction looks as follows:
Passing the sender
is now required
Passing the sender
is now required on most transaction builders (not only on the Transaction
constructor). For example, you are required to pass the caller
when using smartContract.call()
or the deployer
when using smartContract.deploy()
. When using the interactions API, make sure to call interaction.withSender()
. transaction.setSender()
is also supported (if needed).
Developers of wallet/wallet-like applications, please read!
For developers of wallet / wallet-like applications: sdk-core v12
supports both sdk-wallet v3
and sdk-wallet v4
. Though, we recommend migrating to sdk-wallet v4
. Then, signing transactions would look as follows:
Loading ABI got easier
We've slightly simplified the loading of an ABI and feeding it to a SmartContract
object. See #281. In v12, this is done as follows:
Breaking changes
Not one, not two, but quite a few. Here's an entire list of them:
transaction.getSignature()
now returns aBuffer
, instead of aISignature
object.TransfersFactory
has been renamed toTransferTransactionsFactory
;tokenPayment.toRationalNumber()
has been renamed totoAmount()
- and, actually, it became private, you cannot use (should not use) it anymore.toPrettyString()
is still available, but it may be deprecated in a future release, in favor of a separate, more customizable formatter;- We've removed the static function
TransactionOptions.withTxHashSignOptions
. Use the constructor instead, and pass it the necessary flags (options); - We've slightly altered the constructor of
TransactionWatcher
;
- The constant
TRANSACTION_VERSION_TX_HASH_SIGN
has been renamed toTRANSACTION_VERSION_WITH_OPTIONS
; - We've removed
SmartContractAbi
andContractInterface
- they were over-engineered, designed to handle multiple sets of contract endpoints (namespaces / separate interfaces etc.). We've keptAbiRegistry
, which is sufficient; abiRegistry.getAllEndpoints
has been renamed togetEndpoints();
SmartContract.setAbi()
has been removed. The ABI is passed in constructor only;SmartContract.getAbi()
is not exposed anymore. When an ABI definition is needed (e.g. endpoint, type), it should be found in theAbiRegistry
;- Removed
ContractFunction.equals()
- was already deprecated for some time.
Deprecations
TokenPayment
has been deprecated (renamed). Use the new name:TokenTransfer
, instead.ITokenPayment
becameITokenTransfer
, as well. The old names will be removed in the next major version.- Deprecated the parameter
sender
ofinteraction.withSingleESDTNFTTransfer()
andinteraction.withMultiESDTNFTTransfer()
. Useinteraction.withSender()
instead. - Directly reading or setting the fields
transaction.options
,transaction.version
is now deprecated. Use theget*
andset*
functions, instead.
Full Github Release Notes: mx-sdk-js-core - v12.0.1
We'd like to invite you joining us on Discord, where you can connect with other builders and developers, stay up-to-date on all things happening behind the scenes, and receive support from the community.