code: func (api *API) GetNewAddress(seed Trytes, options GetNewAddressOptions) (Hashes, error) {
  	options = getNewAddressDefaultOptions(options)
  
  	if err := Validate(
  		ValidateSeed(seed),
  		ValidateSecurityLevel(options.Security),
  	); err != nil {
  		return nil, err
  	}
  
  	index := options.Index
  	securityLvl := options.Security
  
  	var addresses Hashes
  	var err error
  
  	if options.Total != nil {
  		if *options.Total == 0 {
  			return nil, ErrInvalidTotalOption
  		}
  		total := *options.Total
  		addresses, err = address.GenerateAddresses(seed, index, total, securityLvl, true)
  	} else {
  		addresses, err = getUntilFirstUnusedAddress(api.IsAddressUsed, seed, index, securityLvl, options.ReturnAll)
  	}
  
  	return addresses, err
  }
docs: // GetNewAddress generates and returns a new address by calling FindTransactions
  // and WereAddressesSpentFrom until the first unused address is detected. This stops working after a snapshot.
  //
  // If the "total" parameter is supplied in the options, then this function simply generates the specified address range
  // without doing any I/O.
  //
  // It is suggested that the library user keeps track of used addresses and directly generates addresses from the stored information
  // instead of relying on GetNewAddress.