You can visit the xchain-mayachain package repository to get the updated peer dependencies by looking at the "peerDependencies" object in the "package.json" file.
Testing
yarn install
yarn test
Examples
Connect Wallet to New Maya Client
Create new mayachain client
The client has two different sets of parameters XchainClientParams & MayachainClientParams
MayachainClient includes chainIds. getChainIds() returns all chain id's for default Client Url.
The network default is Mainnet
// Imports
import { Client, getChainIds, getDefaultClientUrl} from '@xchainjs/xchain-mayachain'
import { assetToBase, baseToAsset, assetAmount } from "@xchainjs/xchain-util"
// Create new instance of the client and query chain for balances.
const connectWallet = async () => {
let phrase = "phrase"
const mayaClient = new Client({phrase})
let address = mayaClient.getAddress()
console.log(`Address: ${address}`)
try {
const balance = await mayaClient.getBalance(address)
let assetAmount = (baseToAsset(balance[0].amount)).amount()
console.log(`With balance: ${assetAmount}`)
} catch (error) {
console.log(`Caught ${error}`)
}
}
Transfer CACAO using Maya Client
Create a new Mayachain client instance
Convert amount to transfer to base amount
Build transaction.