MultiversX (EGLD)
MultiversX (formerly Elrond) is a highly scalable, fast, and secure blockchain platform for distributed apps, enterprise use cases, and the new internet economy.
Creating the SDK instance
To interact with the MultiversX blockchain, you first need to create an instance of the SDK. Here's how you can do it:
The instance is now connected to the MultiversX testnet and ready to be used.
Connecting your wallet
You can connect your wallet using a private key (keyFile) and password as shown below:
Note: In a web environment, if you don't provide a keyFile and password, the SDK will attempt to connect using the MultiversX DeFi Wallet browser extension.
Getting your address
You can get your address using the getAddress
method:
Preparing a transaction
You can prepare a transaction using the preparePay
method:
The preparePay
method returns a signed transaction ready to be sent to a DEMOS node.
Preparing multiple transactions
You can prepare multiple transactions using the preparePays
method:
The preparePays
method returns an array of signed transactions. These transactions are signed with increasing nonces derived from the account's current nonce on the network.
Signing messages
Cleaning up
When you're done with the SDK instance, you can disconnect your wallet:
Hacking
The DEMOS MultiversX SDK provides a limited set of methods to interact with the blockchain. For more advanced usage, you can access the underlying objects:
instance.provider
Provides access to network data
instance.wallet
Manages wallet operations
Example
To get all the tokens owned by an address (a feature not directly implemented in the SDK):
This example uses the getAllEsdtTokens
method from the underlying INetworkProvider
, which is not directly exposed in the DEMOS SDK.
For more advanced operations, refer to the following documentation:
API Reference
Last updated