code: func (api *API) AttachToTangle(trunkTxHash Hash, branchTxHash Hash, mwm uint64, trytes []Trytes) ([]Trytes, error) {
  	if api.localProofOfWorkFunc != nil {
  		return pow.DoPoW(trunkTxHash, branchTxHash, trytes, mwm, api.localProofOfWorkFunc)
  	}
  
  	if err := Validate(ValidateTransactionTrytes(trytes...)); err != nil {
  		return nil, err
  	}
  
  	if !IsTransactionHash(trunkTxHash) {
  		return nil, ErrInvalidTrunkTransaction
  	}
  
  	if !IsTransactionHash(branchTxHash) {
  		return nil, ErrInvalidBranchTransaction
  	}
  
  	cmd := &AttachToTangleCommand{
  		TrunkTransaction: trunkTxHash, BranchTransaction: branchTxHash,
  		Command: Command{AttachToTangleCmd}, Trytes: trytes, MinWeightMagnitude: mwm,
  	}
  	rsp := &AttachToTangleResponse{}
  	if err := api.provider.Send(cmd, rsp); err != nil {
  		return nil, err
  	}
  
  	return rsp.Trytes, nil
  }
docs: // AttachToTangle performs the Proof-of-Work required to attach a transaction to the Tangle by
  // calling the attachToTangle IRI API command. Returns a list of transaction trytes and overwrites the following
  // fields: Hash, Nonce, AttachmentTimestamp, AttachmentTimestampLowerBound, AttachmentTimestampUpperBound.
  //
  // If a Proof-of-Work function is supplied when composing the API, then that function is used
  // instead of using the connected node.