@kadena/kadena-cli
Version:
Kadena CLI tool to interact with the Kadena blockchain (manage keys, transactions, etc.)
27 lines • 937 B
JavaScript
import { getPactErrorCode } from '@kadena/client';
import { details } from '@kadena/client-utils/coin';
export async function getAccountDetailsFromChain({ accountName, chainId, networkId, networkHost, fungible, }) {
try {
const accountDetails = await details(accountName, networkId, chainId, networkHost, fungible);
if (accountDetails === undefined) {
throw new Error(`Account ${accountName}: row not found.`);
}
return accountDetails;
}
catch (error) {
throw new Error(error.message);
}
}
export const getAccountDetails = async (config) => {
try {
const accountDetails = await getAccountDetailsFromChain(config);
return accountDetails;
}
catch (error) {
if (getPactErrorCode(error) === 'RECORD_NOT_FOUND') {
return;
}
throw new Error(error.message);
}
};
//# sourceMappingURL=getAccountDetails.js.map