+ // ELA - Elastos functions - begin
+ function displayBip44InfoForELA() {
+ if (!isELA()) {
+ return;
+ }
+
+ var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
+ var account = parseIntNoNaN(DOM.bip44account.val(), 0);
+
+ // Calculate the account extended keys
+ var accountXprv = elastosjs.getAccountExtendedPrivateKey(seed, coin, account);
+ var accountXpub = elastosjs.getAccountExtendedPublicKey(seed, coin, account);
+
+ // Display the extended keys
+ DOM.bip44accountXprv.val(accountXprv);
+ DOM.bip44accountXpub.val(accountXpub);
+ }
+
+ function displayBip32InfoForELA() {
+ if (!isELA()) {
+ return;
+ }
+
+ var coin = parseIntNoNaN(DOM.bip44coin.val(), 0);
+ var account = parseIntNoNaN(DOM.bip44account.val(), 0);
+ var change = parseIntNoNaN(DOM.bip44change.val(), 0);
+
+ DOM.extendedPrivKey.val(elastosjs.getBip32ExtendedPrivateKey(seed, coin, account, change));
+ DOM.extendedPubKey.val(elastosjs.getBip32ExtendedPublicKey(seed, coin, account, change));
+
+ // Display the addresses and privkeys
+ clearAddressesList();
+ var initialAddressCount = parseInt(DOM.rowsToAdd.val());
+ displayAddresses(0, initialAddressCount);
+ }
+
+ function calcAddressForELA(seed, coin, account, change, index) {
+ if (!isELA()) {
+ return;
+ }
+
+ var publicKey = elastosjs.getDerivedPublicKey(elastosjs.getMasterPublicKey(seed), change, index);
+ return {
+ privateKey: elastosjs.getDerivedPrivateKey(seed, coin, account, change, index),
+ publicKey: publicKey,
+ address: elastosjs.getAddress(publicKey.toString('hex'))
+ };
+ }
+ // ELA - Elastos functions - end
+