From 37f8c41c9bfa0699ab0860464fbbcd4e4811e925 Mon Sep 17 00:00:00 2001 From: ivaylogarnev Date: Wed, 15 Jan 2025 14:56:11 +0200 Subject: [PATCH] fix(TCK): Changed account transaction int64 params to string (#1216) Signed-off-by: ivaylogarnev-limechain --- tck/go.mod | 8 ++++---- tck/go.sum | 16 ++++++++-------- tck/methods/account.go | 26 ++++++++++++++++++++++---- tck/param/account.go | 8 ++++---- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/tck/go.mod b/tck/go.mod index a0a8d5e6..8f314e9e 100644 --- a/tck/go.mod +++ b/tck/go.mod @@ -28,13 +28,13 @@ require ( github.com/rs/zerolog v1.33.0 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/net v0.25.0 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/net v0.33.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect + golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.36.1 // indirect + google.golang.org/protobuf v1.36.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/tck/go.sum b/tck/go.sum index 72e3ed0e..efd2ae9c 100644 --- a/tck/go.sum +++ b/tck/go.sum @@ -62,11 +62,11 @@ github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= +golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -74,8 +74,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= @@ -83,8 +83,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1: google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v1.36.1 h1:yBPeRvTftaleIgM3PZ/WBIZ7XM/eEYAaEyCwvyjq/gk= -google.golang.org/protobuf v1.36.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.2 h1:R8FeyR1/eLmkutZOM5CWghmo5itiG9z0ktFlTVLuTmU= +google.golang.org/protobuf v1.36.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/tck/methods/account.go b/tck/methods/account.go index a393ea5c..607e1516 100644 --- a/tck/methods/account.go +++ b/tck/methods/account.go @@ -4,6 +4,7 @@ package methods import ( "context" + "strconv" "time" "github.com/hiero-ledger/hiero-sdk-go/tck/param" @@ -37,7 +38,11 @@ func (a *AccountService) CreateAccount(_ context.Context, params param.CreateAcc transaction.SetKey(key) } if params.InitialBalance != nil { - transaction.SetInitialBalance(hiero.HbarFromTinybar(*params.InitialBalance)) + initialBalance, err := strconv.ParseInt(*params.InitialBalance, 10, 64) + if err != nil { + return nil, err + } + transaction.SetInitialBalance(hiero.HbarFromTinybar(initialBalance)) } if params.ReceiverSignatureRequired != nil { transaction.SetReceiverSignatureRequired(*params.ReceiverSignatureRequired) @@ -66,7 +71,12 @@ func (a *AccountService) CreateAccount(_ context.Context, params param.CreateAcc transaction.SetAccountMemo(*params.Memo) } if params.AutoRenewPeriod != nil { - transaction.SetAutoRenewPeriod(time.Duration(*params.AutoRenewPeriod) * time.Second) + autoRenewPeriodSeconds, err := strconv.ParseInt(*params.AutoRenewPeriod, 10, 64) + if err != nil { + return nil, err + } + + transaction.SetAutoRenewPeriod(time.Duration(autoRenewPeriodSeconds) * time.Second) } if params.Alias != nil { transaction.SetAlias(*params.Alias) @@ -106,7 +116,11 @@ func (a *AccountService) UpdateAccount(_ context.Context, params param.UpdateAcc } if params.ExpirationTime != nil { - transaction.SetExpirationTime(time.Unix(*params.ExpirationTime, 0)) + expirationTime, err := strconv.ParseInt(*params.ExpirationTime, 10, 64) + if err != nil { + return nil, err + } + transaction.SetExpirationTime(time.Unix(expirationTime, 0)) } if params.ReceiverSignatureRequired != nil { @@ -142,7 +156,11 @@ func (a *AccountService) UpdateAccount(_ context.Context, params param.UpdateAcc } if params.AutoRenewPeriod != nil { - transaction.SetAutoRenewPeriod(time.Duration(*params.AutoRenewPeriod) * time.Second) + autoRenewPeriodSeconds, err := strconv.ParseInt(*params.AutoRenewPeriod, 10, 64) + if err != nil { + return nil, err + } + transaction.SetAutoRenewPeriod(time.Duration(autoRenewPeriodSeconds) * time.Second) } if params.CommonTransactionParams != nil { diff --git a/tck/param/account.go b/tck/param/account.go index f6ffee84..d1aa3d7e 100644 --- a/tck/param/account.go +++ b/tck/param/account.go @@ -8,9 +8,9 @@ import ( type CreateAccountParams struct { Key *string `json:"key"` - InitialBalance *int64 `json:"initialBalance"` + InitialBalance *string `json:"initialBalance"` ReceiverSignatureRequired *bool `json:"receiverSignatureRequired"` - AutoRenewPeriod *int64 `json:"autoRenewPeriod"` + AutoRenewPeriod *string `json:"autoRenewPeriod"` Memo *string `json:"memo"` MaxAutomaticTokenAssociations *int32 `json:"maxAutoTokenAssociations"` StakedAccountId *string `json:"stakedAccountId"` @@ -24,8 +24,8 @@ type UpdateAccountParams struct { AccountId *string `json:"accountId"` Key *string `json:"key"` ReceiverSignatureRequired *bool `json:"receiverSignatureRequired"` - AutoRenewPeriod *int64 `json:"autoRenewPeriod"` - ExpirationTime *int64 `json:"expirationTime"` + AutoRenewPeriod *string `json:"autoRenewPeriod"` + ExpirationTime *string `json:"expirationTime"` Memo *string `json:"memo"` MaxAutomaticTokenAssociations *int32 `json:"maxAutoTokenAssociations"` StakedAccountId *string `json:"stakedAccountId"`