Auto XDM
Note: Cross-domain messaging (XDM) is not yet enabled on the Taurus testnet or Autonomys Network mainnet.
Available functions
Cross-domain transfers
Note: The
transfer
function returns aPromise
that resolves to aSubmittableExtrinsic
, which can be signed and submitted to the blockchain.
transfer(api: ApiPromise, destination: ChainOrDomain, receiver: string, amount: Amount): Promise<SubmittableExtrinsic>
: Creates a transaction to transfer a specified amount to a receiver at a given destination (can be either on the consensus chain or a specific domain).
Types
-
Amount:
BigInt | number | string
Represents the amount to be transferred. -
ChainOrDomain:
Consensus | Domain
A union type representing either the consensus chain or a domain. -
Consensus:
{ type: 'consensus' }
Specifies the consensus chain as the destination. -
Domain:
{ type: 'domain'; domainId: number }
Specifies a domain as the destination, identified by adomainId
.
Usage example
// For transferring to the consensus chain
await transfer(api, { type: 'consensus' }, 'receiverAddress', amount)
// For transferring to a specific domain
await transfer(api, { type: 'domain', domainId: 1 }, 'receiverAddress', amount)