Comments (10)
ESDTTransferPayloadBuilder
, ESDTNFTTransferPayloadBuilder
etc. have been previously deprecated (in v11). Now, they aren't exported anymore - they will be removed in the next major release.
Make sure to use the TransferTransactionsFactory
instead:
https://docs.multiversx.com/sdk-and-tools/sdk-js/sdk-js-cookbook/#token-transfers
from mx-sdk-js-core.
Breaking change
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).
from mx-sdk-js-core.
Important change (wallet - signing & verifying)
See: https://docs.multiversx.com/sdk-and-tools/sdk-js/sdk-js-cookbook/#signing-objects
For developers of wallet / wallet-like applications, or for back-end applications or scripts that sign transactions and messages:
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:
const serialized: Buffer = transaction.serializeForSigning();
const signature: Buffer = await signer.sign(serialized);
transaction.applySignature(signature);
Breaking change (related)
transaction.getSignature()
now returns aBuffer
, instead of aISignature
object.signableMessage.getSignature()
now returns aBuffer
, instead of aISignature
object.
from mx-sdk-js-core.
Breaking changes (ABI)
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:
const abiRegistry = AbiRegistry.create({ ... });
const contract = new SmartContract({ address: existingAddress, abi: abiRegistry });
Related breaking changes
- 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.
from mx-sdk-js-core.
Breaking change (formatting, less important)
tokenPayment.toRationalNumber()
has been renamed to toAmount()
- 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.
from mx-sdk-js-core.
Deprecation(s) / changes on constructing transfers
TokenPayment
has been deprecated (renamed). Use the new name: TokenTransfer
, instead. ITokenPayment
became ITokenTransfer
, as well. The old names will be removed in the next major version.
Deprecated the parameter sender
of interaction.withSingleESDTNFTTransfer()
and interaction.withMultiESDTNFTTransfer()
. Use interaction.withSender()
instead, when setting up the interaction
object.
from mx-sdk-js-core.
Breaking change: transaction options and version
The following changes are a result of integrating the support for guarded transactions 🔒
- We've removed the static function
TransactionOptions.withTxHashSignOptions
. Use the constructor instead, and pass it the necessary flags (options). - The constant
TRANSACTION_VERSION_TX_HASH_SIGN
has been renamed toTRANSACTION_VERSION_WITH_OPTIONS
.
Directly reading or setting the fields transaction.options
, transaction.version
is now deprecated. Use the get*
and set*
functions, instead.
from mx-sdk-js-core.
Breaking change (minor) - transaction completion
- We've slightly altered the constructor of
TransactionWatcher
.
from mx-sdk-js-core.
Hello, why was the function toAmount
made private in TokenTransfer
? I find it quite useful since I do a lot of custom formatting, and toPrettyString
also has the tokenIdentifier in it which I don't want.
It is also useful when representing amounts without so many decimals, and want to compare agains the token transfer value.
Now I have to call the amountAsBigInteger
and do shiftBy myself which is more tedious...
If it exists as a getter it should be public IMO, there is no side effect it can cause.
from mx-sdk-js-core.
Hello, why was the function
toAmount
made private inTokenTransfer
? I find it quite useful since I do a lot of custom formatting, andtoPrettyString
also has the tokenIdentifier in it which I don't want. It is also useful when representing amounts without so many decimals, and want to compare agains the token transfer value.Now I have to call the
amountAsBigInteger
and do shiftBy myself which is more tedious... If it exists as a getter it should be public IMO, there is no side effect it can cause.
Hello @raress96,
We'd like to have as little as possible UI
logic in sdk-core
, thus this change. Indeed, you are now required to apply formatting logic on your side. That is, the logic in your front-end has to know to format numbers (this is intended).
We might include a customizable formatter in the future - but this is not yet decided.
Thank you for your understanding 🙏
from mx-sdk-js-core.
Related Issues (20)
- Proposal: re-consider required arguments for Transaction constructor HOT 1
- Adjust / improve ResultsParser to properly handle outcome of relayed transactions HOT 2
- Upgrade breaks Interaction serialization with native variadic arguments HOT 3
- Have "enum.valueOf()" return "fields" as an object (not as an array)
- Add support for `counted-variadic` type in ABI parsing HOT 1
- Setup eslint on sdk-js-* HOT 2
- Setup release.yml on sdk-js-* and sdk-py-* HOT 1
- By default, use TRANSACTION_VERSION_DEFAULT = 2 HOT 1
- On SmartContract.computeAddress(), do extra validation
- Rewrite "TypeExpressionParser" HOT 3
- When building a "relayedV2" transaction, make sure to inherit the version from the inner transaction (both JS and PY) HOT 2
- Use BigInt instead of BigNumber HOT 1
- SignableMessage: one does not simply decode a payload that was previously created using "toJSON()" HOT 1
- Send NFT Functionality Not Working in MultiversX SDK-Core HOT 2
- Migration support: "v12" to "v13" (April 2024) HOT 14
- TokenOperationsOutcomeParser: error when a transaction has multiple events HOT 3
- [v13] Problem with `checkArgumentsCardinality` HOT 9
- Missing `upgradeConstructor` in AbiRegistry HOT 3
- Problem with smart contracts ESDTTransfer in sdk-core 13.0.0-beta.9 and newer HOT 7
- When generating *.d.ts files, skip (ignore) private members
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mx-sdk-js-core.