async generateAddress(walletInfo, index, limit) {
    // console.log(`walletInfo: ${JSON.stringify(walletInfo, null, 2)}`)

    if (!walletInfo.mnemonic) throw new Error(`mnemonic is undefined!`)

    // root seed buffer
    let rootSeed
    if (config.RESTAPI === "bitcoin.com")
      rootSeed = this.BITBOX.Mnemonic.toSeed(walletInfo.mnemonic)
    else rootSeed = await this.BITBOX.Mnemonic.toSeed(walletInfo.mnemonic)

    // master HDNode
    if (walletInfo.network === "testnet")
      var masterHDNode = this.BITBOX.HDNode.fromSeed(rootSeed, "testnet")
    else var masterHDNode = this.BITBOX.HDNode.fromSeed(rootSeed)

    // HDNode of BIP44 account
    const account = this.BITBOX.HDNode.derivePath(
      masterHDNode,
      `m/44'/${walletInfo.derivation}'/0'`
    )

    // Empty array for collecting generated addresses
    const bulkAddresses = []

    // Generate the addresses.
    for (let i = index; i < index + limit; i++) {
      // derive an external change address HDNode
      const change = this.BITBOX.HDNode.derivePath(account, `0/${i}`)

      // get the cash address
      const newAddress = this.BITBOX.HDNode.toCashAddress(change)
      //const legacy = this.BITBOX.HDNode.toLegacyAddress(change)

      //push address into array
      bulkAddresses.push(newAddress)
    }

    return bulkAddresses
  }
// will generate a 20-element array of addresses from index 20 to 29
will generate a 20-element array of addresses from index 20 to 29
will generate a 20 - element array of addresses from index 20 to 29
async generateAddress(walletInfo, index, limit) {
    if (!walletInfo.mnemonic) throw new Error(`mnemonic is undefined!`)
    let rootSeed
    if (config.RESTAPI === "bitcoin.com")
      rootSeed = this.BITBOX.Mnemonic.toSeed(walletInfo.mnemonic)
    else rootSeed = await this.BITBOX.Mnemonic.toSeed(walletInfo.mnemonic)
    if (walletInfo.network === "testnet")
      var masterHDNode = this.BITBOX.HDNode.fromSeed(rootSeed, "testnet")
    else var masterHDNode = this.BITBOX.HDNode.fromSeed(rootSeed)
    const account = this.BITBOX.HDNode.derivePath(
      masterHDNode,
      `m/44'/${walletInfo.derivation}'/0'`
    )
    const bulkAddresses = []
    for (let i = index; i < index + limit; i++) {
      const change = this.BITBOX.HDNode.derivePath(account, `0/${i}`)
      const newAddress = this.BITBOX.HDNode.toCashAddress(change)
      bulkAddresses.push(newAddress)
    }
    return bulkAddresses
  }
async generateAddress ( walletInfo , index , limit ) { if ( ! walletInfo . mnemonic ) throw new Error ( ` ` ) let rootSeed if ( config . RESTAPI === "bitcoin.com" ) rootSeed = this . BITBOX . Mnemonic . toSeed ( walletInfo . mnemonic ) else rootSeed = await this . BITBOX . Mnemonic . toSeed ( walletInfo . mnemonic ) if ( walletInfo . network === "testnet" ) var masterHDNode = this . BITBOX . HDNode . fromSeed ( rootSeed , "testnet" ) else var masterHDNode = this . BITBOX . HDNode . fromSeed ( rootSeed ) const account = this . BITBOX . HDNode . derivePath ( masterHDNode , ` ${ walletInfo . derivation } ` ) const bulkAddresses = [ ] for ( let i = index ; i < index + limit ; i ++ ) { const change = this . BITBOX . HDNode . derivePath ( account , ` ${ i } ` ) const newAddress = this . BITBOX . HDNode . toCashAddress ( change ) bulkAddresses . push ( newAddress ) } return bulkAddresses }
will generate a 20-element array of addresses from index 20 to 29
will generate a 20 - element array of addresses from index 20 to 29
// console.log(`walletInfo: ${JSON.stringify(walletInfo, null, 2)}`) // root seed buffer // master HDNode // HDNode of BIP44 account // Empty array for collecting generated addresses // Generate the addresses. // derive an external change address HDNode // get the cash address //const legacy = this.BITBOX.HDNode.toLegacyAddress(change) //push address into array