github.com/algorand/go-algorand-sdk@v1.24.0/auction/auction.go (about)

     1  package auction
     2  
     3  import (
     4  	"github.com/algorand/go-algorand-sdk/types"
     5  )
     6  
     7  // MakeBid constructs a bid using the passed parameters. `bidderAddress` and
     8  // `auctionAddress` should be checksummed, human-readable addresses
     9  func MakeBid(bidderAddress string, bidAmount, maxPrice, bidID uint64, auctionAddress string, auctionID uint64) (bid types.Bid, err error) {
    10  	// Decode from address
    11  	bidderAddr, err := types.DecodeAddress(bidderAddress)
    12  	if err != nil {
    13  		return
    14  	}
    15  
    16  	// Decode to address
    17  	auctionAddr, err := types.DecodeAddress(auctionAddress)
    18  	if err != nil {
    19  		return
    20  	}
    21  
    22  	bid = types.Bid{
    23  		BidderKey:   bidderAddr,
    24  		BidCurrency: bidAmount,
    25  		MaxPrice:    maxPrice,
    26  		BidID:       bidID,
    27  		AuctionKey:  auctionAddr,
    28  		AuctionID:   auctionID,
    29  	}
    30  	return
    31  }