import { Bip32Path } from "@iota/crypto.js" ; import type { IBip44GeneratorState } from "../models/IBip44GeneratorState" ; export const IOTA_BIP44_BASE_PATH = "m/44'/4218'" ; param accountIndex param addressIndex param isInternal returns export function generateBip44Path ( accountIndex , addressIndex , isInternal ) { const bip32Path = new Bip32Path ( IOTA_BIP44_BASE_PATH ) ; bip32Path . pushHardened ( accountIndex ) ; bip32Path . pushHardened ( isInternal ? 1 : 0 ) ; bip32Path . pushHardened ( addressIndex ) ; return bip32Path ; } param generatorState param generatorState . accountIndex param generatorState . addressIndex param generatorState . isInternal returns export function generateBip44Address ( generatorState ) { const path = new Bip32Path ( IOTA_BIP44_BASE_PATH ) ; path . pushHardened ( generatorState . accountIndex ) ; path . pushHardened ( generatorState . isInternal ? 1 : 0 ) ; path . pushHardened ( generatorState . addressIndex ) ; if ( ! generatorState . isInternal ) { generatorState . isInternal = true ; } else { generatorState . isInternal = false ; generatorState . addressIndex ++ ; } return path . toString ( ) ; }