Skip to content

Commit

Permalink
refactor: byron
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvolek committed Jan 25, 2022
1 parent 013f6c3 commit c11f961
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/utils/helpers.ts
Expand Up @@ -32,17 +32,11 @@ export const deriveAddress = (
? NetworkInfo.testnet().network_id()
: NetworkInfo.mainnet().network_id();

const protocolMagic = isTestnet
? NetworkInfo.testnet().protocol_magic()
: NetworkInfo.mainnet().protocol_magic();

const baseAddr = isByron
? ByronAddress.icarus_from_key(utxoPubKey, protocolMagic)
: BaseAddress.new(
networkId,
StakeCredential.from_keyhash(utxoPubKey.to_raw_key().hash()),
StakeCredential.from_keyhash(mainStakeKey.to_raw_key().hash()),
);
const baseAddr = BaseAddress.new(
networkId,
StakeCredential.from_keyhash(utxoPubKey.to_raw_key().hash()),
StakeCredential.from_keyhash(mainStakeKey.to_raw_key().hash()),
);

if (role === 2 && !isByron) {
const addressSpecificStakeKey = accountKey.derive(2).derive(addressIndex);
Expand All @@ -60,6 +54,10 @@ export const deriveAddress = (
}

if (isByron) {
const protocolMagic = isTestnet
? NetworkInfo.testnet().protocol_magic()
: NetworkInfo.mainnet().protocol_magic();

const byronAddress = ByronAddress.icarus_from_key(
utxoPubKey,
protocolMagic,
Expand Down

0 comments on commit c11f961

Please sign in to comment.