APTOS
Aptos Cross-Chain SDK
The Aptos blockchain uses the Move programming language and provides a powerful environment for smart contracts and decentralized applications. The Demos Network SDK provides seamless integration with Aptos through our XM (Cross-chain Messaging) architecture.Key Concepts
Demos Network Architecture: Payment and contract operations go through Demos, ensuring network participation and cross-chain compatibility. This relay-first approach provides enhanced security and enables true cross-chain functionality. Move Language: Aptos uses Move, a resource-oriented programming language where smart contracts are organized as modules deployed at specific addresses. Type Arguments: Many Move functions require explicit type arguments, especially when working with generic types like coins.Installation
Quick Start
Balance Queries
You can get the coin balance as shown below:Token Transfer
You can make payments on Aptos via Demos as shown below. Please check out the authentication docs on how to interact with the Demos network using theDemos object.
- Petra: Connect to Petra wallet and sign a transaction
- Martian: Detecting the provider and sign a transaction
Uint8Array, convert it into hex and use that to create the XMScript from the previous code sample:
For Martian wallet, that would look like this:
Smart Contract Interactions
Reading from Contracts
You can read from a contract on Aptos via Demos as shown:Writing to Contracts
You can write to a contract on Aptos via Demos as shown:Signing and Verifying Messages
You can sign and verify messages using the connected Aptos wallet as shown:- Martian: https://docs.martianwallet.xyz/docs/methods/sign-message
- Petra: https://petra.app/docs/signing-a-message
signMessage method provided by the injected provider returns an object with a fullMessage property which you can use to verify the message as follows:
For Martian wallet, that looks like this: