import algosdk from 'algosdk'
const algodClient = new algosdk.Algodv2('', 'https://mainnet-api.algonode.cloud', '')
const indexerClient = new algosdk.Indexer('', 'https://mainnet-idx.algonode.cloud', '')
// An account for Algorand should keep cost for maintaining the account.
const balanceInfo = await algodClient.accountInformation(walletAddress).do()
const blanace = balanceInfo.amount.toString()
const maintenance = balaceInfo['min-balance'].toString()
// Make a transaction
const suggestedParams = await algodClient.getTransactionParams().do()
const tx = algosdk.makePaymentTxnWithSuggestedParamsFromObject({
suggestedParams,
from: walletAddress,
to: someWhere,
amount: value, // Unit is microAlgos
memo: new Uint8Array(Buffer.from('Something what you want', 'hex')) || undefined
})
// Create JSON-formatted data for getting a signature
const unsignedRawData = Uint8ArrayToHex(tx.bytesToSign())
const sigHash = rawData
const transactionJson = {
coinType: DcentWebConnector.coinType.ALGORAND,
sigHash: unsignedRawData,
path: `m/44'/283'/0'/0/0`,
decimals: 6, // for ALGORAND
fee: tx.fee,
symbol: 'ALGO',
optionParams: '00'
}
var result
try {
result = await DcentWebConnector.getAlgorandSignedTransaction(transactionJson);
} catch (e) {
console.log(e)
result = e
}