From 6fd8fe52d311563e8b0765c259e92e8d7c9007d5 Mon Sep 17 00:00:00 2001 From: algochoi <86622919+algochoi@users.noreply.github.com> Date: Wed, 17 May 2023 17:14:13 -0400 Subject: [PATCH 1/3] Change query template generation based on linter --- go_templates/query.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go_templates/query.vm b/go_templates/query.vm index 0eab2fa..5a1fb18 100644 --- a/go_templates/query.vm +++ b/go_templates/query.vm @@ -220,7 +220,7 @@ func (s *SendRawTransaction) Do(ctx context.Context, headers ...*common.Header) } } if addContentType { - headers = append(headers, &common.Header{"Content-Type", "application/x-binary"}) + headers = append(headers, &common.Header{Key: "Content-Type", Value: "application/x-binary"}) } err = s.c.post(ctx, &response, "/v2/transactions", nil, headers, s.rawtxn) txid = response.Txid From f81a1779c50ca5bbb594d57b3fd24e6629a6f29f Mon Sep 17 00:00:00 2001 From: algochoi <86622919+algochoi@users.noreply.github.com> Date: Wed, 17 May 2023 17:29:09 -0400 Subject: [PATCH 2/3] Change txn delta generation in go sdk --- go_templates/query.vm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/go_templates/query.vm b/go_templates/query.vm index 5a1fb18..cda2476 100644 --- a/go_templates/query.vm +++ b/go_templates/query.vm @@ -34,10 +34,10 @@ import ( #end "github.com/algorand/go-algorand-sdk/v2/client/v2/common" -#if ( $returnType.contains("model") && $queryType != "GetLedgerStateDelta" ) +#if ( $returnType.contains("model") && $queryType != "GetLedgerStateDelta" && $queryType != "GetLedgerStateDeltaForTransactionGroup" && $queryType != "GetTransactionGroupLedgerStateDeltasForRound" ) "github.com/algorand/go-algorand-sdk/v2/client/v2/common/models" #end -#if ( $queryType == "PendingTransactionsByAddress" || $queryType == "PendingTransactionInformationByAddress" || $queryType == "PendingTransactionInformation" || $queryType == "PendingTransactions" || $queryType == "Block" || $queryType == "SuggestedParams" || $queryType == "GetLedgerStateDelta" ) +#if ( $queryType == "PendingTransactionsByAddress" || $queryType == "PendingTransactionInformationByAddress" || $queryType == "PendingTransactionInformation" || $queryType == "PendingTransactions" || $queryType == "Block" || $queryType == "SuggestedParams" || $queryType == "GetLedgerStateDelta" || $queryType == "GetLedgerStateDeltaForTransactionGroup" || $queryType == "GetTransactionGroupLedgerStateDeltasForRound" ) "github.com/algorand/go-algorand-sdk/v2/types" #end #foreach( $qp in $q.bodyParameters) @@ -271,6 +271,16 @@ func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (respo err = s.c.get(ctx, &response, $processedPath, $queryArg, headers) return } +#elseif( $queryType == "GetLedgerStateDeltaForTransactionGroup" ) +func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (response types.LedgerStateDelta, err error) { + err = s.c.get(ctx, &response, $processedPath, $queryArg, headers) + return +} +#elseif( $queryType == "GetTransactionGroupLedgerStateDeltasForRound" ) +func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (response types.LedgerStateDelta, err error) { + err = s.c.get(ctx, &response, $processedPath, $queryArg, headers) + return +} #elseif( $queryType == "SetBlockTimeStampOffset" )## TODO: "post" can be generated, there is nothing special here. func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (response $returnType, err error) { err = s.c.post(ctx, &response, $processedPath, nil, headers, nil) From 9f0ec32542ec2583e9862249971895c4e1832251 Mon Sep 17 00:00:00 2001 From: algochoi <86622919+algochoi@users.noreply.github.com> Date: Mon, 22 May 2023 12:52:18 -0400 Subject: [PATCH 3/3] Update generator to remove custom query for state deltas for round --- go_templates/query.vm | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/go_templates/query.vm b/go_templates/query.vm index cda2476..cb9ee13 100644 --- a/go_templates/query.vm +++ b/go_templates/query.vm @@ -34,10 +34,10 @@ import ( #end "github.com/algorand/go-algorand-sdk/v2/client/v2/common" -#if ( $returnType.contains("model") && $queryType != "GetLedgerStateDelta" && $queryType != "GetLedgerStateDeltaForTransactionGroup" && $queryType != "GetTransactionGroupLedgerStateDeltasForRound" ) +#if ( $returnType.contains("model") && $queryType != "GetLedgerStateDelta" && $queryType != "GetLedgerStateDeltaForTransactionGroup" ) "github.com/algorand/go-algorand-sdk/v2/client/v2/common/models" #end -#if ( $queryType == "PendingTransactionsByAddress" || $queryType == "PendingTransactionInformationByAddress" || $queryType == "PendingTransactionInformation" || $queryType == "PendingTransactions" || $queryType == "Block" || $queryType == "SuggestedParams" || $queryType == "GetLedgerStateDelta" || $queryType == "GetLedgerStateDeltaForTransactionGroup" || $queryType == "GetTransactionGroupLedgerStateDeltasForRound" ) +#if ( $queryType == "PendingTransactionsByAddress" || $queryType == "PendingTransactionInformationByAddress" || $queryType == "PendingTransactionInformation" || $queryType == "PendingTransactions" || $queryType == "Block" || $queryType == "SuggestedParams" || $queryType == "GetLedgerStateDelta" || $queryType == "GetLedgerStateDeltaForTransactionGroup" ) "github.com/algorand/go-algorand-sdk/v2/types" #end #foreach( $qp in $q.bodyParameters) @@ -276,11 +276,6 @@ func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (respo err = s.c.get(ctx, &response, $processedPath, $queryArg, headers) return } -#elseif( $queryType == "GetTransactionGroupLedgerStateDeltasForRound" ) -func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (response types.LedgerStateDelta, err error) { - err = s.c.get(ctx, &response, $processedPath, $queryArg, headers) - return -} #elseif( $queryType == "SetBlockTimeStampOffset" )## TODO: "post" can be generated, there is nothing special here. func (s *${queryType}) Do(ctx context.Context, headers ...*common.Header) (response $returnType, err error) { err = s.c.post(ctx, &response, $processedPath, nil, headers, nil)