github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/algod/tealCompile.go (about) 1 package algod 2 3 import ( 4 "context" 5 6 "github.com/algorand/go-algorand-sdk/client/v2/common" 7 "github.com/algorand/go-algorand-sdk/client/v2/common/models" 8 ) 9 10 // TealCompileParams contains all of the query parameters for url serialization. 11 type TealCompileParams struct { 12 13 // Sourcemap when set to `true`, returns the source map of the program as a JSON. 14 // Defaults to `false`. 15 Sourcemap bool `url:"sourcemap,omitempty"` 16 } 17 18 // TealCompile given TEAL source code in plain text, return base64 encoded program 19 // bytes and base32 SHA512_256 hash of program bytes (Address style). This endpoint 20 // is only enabled when a node's configuration file sets EnableDeveloperAPI to 21 // true. 22 type TealCompile struct { 23 c *Client 24 25 source []byte 26 27 p TealCompileParams 28 } 29 30 // Sourcemap when set to `true`, returns the source map of the program as a JSON. 31 // Defaults to `false`. 32 func (s *TealCompile) Sourcemap(Sourcemap bool) *TealCompile { 33 s.p.Sourcemap = Sourcemap 34 35 return s 36 } 37 38 // Do performs the HTTP request 39 func (s *TealCompile) Do(ctx context.Context, headers ...*common.Header) (response models.CompileResponse, err error) { 40 err = s.c.post(ctx, &response, "/v2/teal/compile", s.p, headers, s.source) 41 return 42 }