Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HIP-904: Max Auto Associations of value -1 #980

Merged
merged 12 commits into from
Jul 10, 2024
10 changes: 5 additions & 5 deletions account_create_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type AccountCreateTransaction struct {
autoRenewPeriod *time.Duration
memo string
receiverSignatureRequired bool
maxAutomaticTokenAssociations uint32
maxAutomaticTokenAssociations int32
stakedAccountID *AccountID
stakedNodeID *int64
declineReward bool
Expand Down Expand Up @@ -85,7 +85,7 @@ func _AccountCreateTransactionFromProtobuf(tx Transaction, pb *services.Transact
autoRenewPeriod: &renew,
memo: pb.GetCryptoCreateAccount().GetMemo(),
receiverSignatureRequired: pb.GetCryptoCreateAccount().ReceiverSigRequired,
maxAutomaticTokenAssociations: uint32(pb.GetCryptoCreateAccount().MaxAutomaticTokenAssociations),
maxAutomaticTokenAssociations: pb.GetCryptoCreateAccount().MaxAutomaticTokenAssociations,
stakedAccountID: stakeAccountID,
stakedNodeID: stakedNodeID,
declineReward: pb.GetCryptoCreateAccount().GetDeclineReward(),
Expand Down Expand Up @@ -126,14 +126,14 @@ func (tx *AccountCreateTransaction) GetInitialBalance() Hbar {
// SetMaxAutomaticTokenAssociations
// Set the maximum number of tokens that an Account can be implicitly associated with. Defaults to 0
// and up to a maximum value of 1000.
func (tx *AccountCreateTransaction) SetMaxAutomaticTokenAssociations(max uint32) *AccountCreateTransaction {
func (tx *AccountCreateTransaction) SetMaxAutomaticTokenAssociations(max int32) *AccountCreateTransaction {
tx._RequireNotFrozen()
tx.maxAutomaticTokenAssociations = max
return tx
}

// GetMaxAutomaticTokenAssociations returns the maximum number of tokens that an Account can be implicitly associated with.
func (tx *AccountCreateTransaction) GetMaxAutomaticTokenAssociations() uint32 {
func (tx *AccountCreateTransaction) GetMaxAutomaticTokenAssociations() int32 {
return tx.maxAutomaticTokenAssociations
}

Expand Down Expand Up @@ -446,7 +446,7 @@ func (tx *AccountCreateTransaction) buildProtoBody() *services.CryptoCreateTrans
InitialBalance: tx.initialBalance,
ReceiverSigRequired: tx.receiverSignatureRequired,
Memo: tx.memo,
MaxAutomaticTokenAssociations: int32(tx.maxAutomaticTokenAssociations),
MaxAutomaticTokenAssociations: tx.maxAutomaticTokenAssociations,
DeclineReward: tx.declineReward,
Alias: tx.alias,
}
Expand Down
12 changes: 6 additions & 6 deletions account_update_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type AccountUpdateTransaction struct {
memo string
receiverSignatureRequired bool
expirationTime *time.Time
maxAutomaticTokenAssociations uint32
maxAutomaticTokenAssociations int32
aliasKey *PublicKey
stakedAccountID *AccountID
stakedNodeID *int64
Expand Down Expand Up @@ -96,7 +96,7 @@ func _AccountUpdateTransactionFromProtobuf(tx Transaction, pb *services.Transact
memo: pb.GetCryptoUpdateAccount().GetMemo().Value,
receiverSignatureRequired: receiverSignatureRequired,
expirationTime: &expiration,
maxAutomaticTokenAssociations: uint32(pb.GetCryptoUpdateAccount().MaxAutomaticTokenAssociations.GetValue()),
maxAutomaticTokenAssociations: pb.GetCryptoUpdateAccount().MaxAutomaticTokenAssociations.GetValue(),
stakedAccountID: stakeNodeAccountID,
stakedNodeID: &stakedNodeID,
declineReward: pb.GetCryptoUpdateAccount().GetDeclineReward().GetValue(),
Expand Down Expand Up @@ -198,13 +198,13 @@ func (tx *AccountUpdateTransaction) GetDeclineStakingReward() bool {
// SetMaxAutomaticTokenAssociations
// Sets the maximum number of tokens that an Account can be implicitly associated with. Up to a 1000
// including implicit and explicit associations.
func (tx *AccountUpdateTransaction) SetMaxAutomaticTokenAssociations(max uint32) *AccountUpdateTransaction {
func (tx *AccountUpdateTransaction) SetMaxAutomaticTokenAssociations(max int32) *AccountUpdateTransaction {
tx._RequireNotFrozen()
tx.maxAutomaticTokenAssociations = max
return tx
}

func (tx *AccountUpdateTransaction) GetMaxAutomaticTokenAssociations() uint32 {
func (tx *AccountUpdateTransaction) GetMaxAutomaticTokenAssociations() int32 {
return tx.maxAutomaticTokenAssociations
}

Expand Down Expand Up @@ -456,7 +456,7 @@ func (tx *AccountUpdateTransaction) build() *services.TransactionBody {
},
}

body.MaxAutomaticTokenAssociations = &wrapperspb.Int32Value{Value: int32(tx.maxAutomaticTokenAssociations)}
body.MaxAutomaticTokenAssociations = &wrapperspb.Int32Value{Value: tx.maxAutomaticTokenAssociations}

return &pb
}
Expand All @@ -476,7 +476,7 @@ func (tx *AccountUpdateTransaction) buildProtoBody() *services.CryptoUpdateTrans
},
Memo: &wrapperspb.StringValue{Value: tx.memo},
DeclineReward: &wrapperspb.BoolValue{Value: tx.declineReward},
MaxAutomaticTokenAssociations: &wrapperspb.Int32Value{Value: int32(tx.maxAutomaticTokenAssociations)},
MaxAutomaticTokenAssociations: &wrapperspb.Int32Value{Value: tx.maxAutomaticTokenAssociations},
}

if tx.autoRenewPeriod != nil {
Expand Down
Loading
Loading