The Autonomys Auto XDM SDK (@autonomys/auto-xdm
) provides functionalities for cross-domain transfer of native tokens.
- Cross-Domain Transfer: Transfer tokens between consensus and domain accounts.
- TypeScript Support: Fully typed for enhanced developer experience.
Install the package via npm or yarn:
# Using npm
npm install @autonomys/auto-xdm
# Using yarn
yarn add @autonomys/auto-xdm
- Node.js (version 14 or higher)
- TypeScript (optional, but recommended for development)
- Familiarity with async/await and promise handling in JavaScript/TypeScript.
- @autonomys/auto-utils package installed (as it provides utility functions and API activation).
Below are examples demonstrating how to use the functions provided by @autonomys/auto-xdm
.
import { activateWallet } from '@autonomys/auto-utils'
import { transferToDomainAccount20Type } from '@autonomys/auto-xdm'
const api = await activateWallet({ networkId: 'taurus', uri: '//alice' })
const tx = await transferToDomainAccount20Type(
api,
0, // Receiver domain (0 is Auto EVM on Taurus Testnet)
'0x1234567890abcdef', // Receiver domain account
'1000000000000000000',
)
import { activateWallet } from '@autonomys/auto-utils'
import { transferToDomainAccount32Type } from '@autonomys/auto-xdm'
const api = await activateWallet({ networkId: 'taurus', uri: '//alice' })
const tx = await transferToDomainAccount32Type(
api,
0, // Receiver domain (0 is Auto EVM on Taurus Testnet)
'su1234567890abcdef', // Receiver domain account
'1000000000000000000',
)
import { activateWallet } from '@autonomys/auto-utils'
import { transferToConsensus } from '@autonomys/auto-xdm'
const api = await activateWallet({ networkId: 'taurus', domainId: 0, uri: '//alice' })
const tx = await transferToConsensus(
api,
'su1234567890abcdef', // Receiver consensus account,
'1000000000000000000',
)