Skip to content

Commit

Permalink
refactor: token and topic setKeys from PublicKey to Key
Browse files Browse the repository at this point in the history
  • Loading branch information
andrix10 authored and janaakhterov committed Nov 10, 2020
1 parent 7878ea4 commit be8eba0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions token_create_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,35 @@ func (transaction *TokenCreateTransaction) SetTreasuryAccountID(treasury Account
}

// The account which will act as a treasury for the token. This account will receive the specified initial supply
func (transaction *TokenCreateTransaction) SetAdminKey(publicKey PublicKey) *TokenCreateTransaction {
func (transaction *TokenCreateTransaction) SetAdminKey(publicKey Key) *TokenCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.AdminKey = publicKey.toProtoKey()
return transaction
}

// The key which can perform update/delete operations on the token. If empty, the token can be perceived as immutable (not being able to be updated/deleted)
func (transaction *TokenCreateTransaction) SetKycKey(publicKey PublicKey) *TokenCreateTransaction {
func (transaction *TokenCreateTransaction) SetKycKey(publicKey Key) *TokenCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.KycKey = publicKey.toProtoKey()
return transaction
}

// The key which can grant or revoke KYC of an account for the token's transactions. If empty, KYC is not required, and KYC grant or revoke operations are not possible.
func (transaction *TokenCreateTransaction) SetFreezeKey(publicKey PublicKey) *TokenCreateTransaction {
func (transaction *TokenCreateTransaction) SetFreezeKey(publicKey Key) *TokenCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.FreezeKey = publicKey.toProtoKey()
return transaction
}

// The key which can sign to freeze or unfreeze an account for token transactions. If empty, freezing is not possible
func (transaction *TokenCreateTransaction) SetWipeKey(publicKey PublicKey) *TokenCreateTransaction {
func (transaction *TokenCreateTransaction) SetWipeKey(publicKey Key) *TokenCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.WipeKey = publicKey.toProtoKey()
return transaction
}

// The key which can wipe the token balance of an account. If empty, wipe is not possible
func (transaction *TokenCreateTransaction) SetSupplyKey(publicKey PublicKey) *TokenCreateTransaction {
func (transaction *TokenCreateTransaction) SetSupplyKey(publicKey Key) *TokenCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.SupplyKey = publicKey.toProtoKey()
return transaction
Expand Down
10 changes: 5 additions & 5 deletions token_update_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,39 +58,39 @@ func (transaction *TokenUpdateTransaction) SetTreasuryAccountID(treasury Account

// The new Admin key of the Token. If Token is immutable, transaction will resolve to
// TOKEN_IS_IMMUTABlE.
func (transaction *TokenUpdateTransaction) SetAdminKey(publicKey PublicKey) *TokenUpdateTransaction {
func (transaction *TokenUpdateTransaction) SetAdminKey(publicKey Key) *TokenUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.AdminKey = publicKey.toProtoKey()
return transaction
}

// The new KYC key of the Token. If Token does not have currently a KYC key, transaction will
// resolve to TOKEN_HAS_NO_KYC_KEY.
func (transaction *TokenUpdateTransaction) SetKycKey(publicKey PublicKey) *TokenUpdateTransaction {
func (transaction *TokenUpdateTransaction) SetKycKey(publicKey Key) *TokenUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.KycKey = publicKey.toProtoKey()
return transaction
}

// The new Freeze key of the Token. If the Token does not have currently a Freeze key, transaction
// will resolve to TOKEN_HAS_NO_FREEZE_KEY.
func (transaction *TokenUpdateTransaction) SetFreezeKey(publicKey PublicKey) *TokenUpdateTransaction {
func (transaction *TokenUpdateTransaction) SetFreezeKey(publicKey Key) *TokenUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.FreezeKey = publicKey.toProtoKey()
return transaction
}

// The new Wipe key of the Token. If the Token does not have currently a Wipe key, transaction
// will resolve to TOKEN_HAS_NO_WIPE_KEY.
func (transaction *TokenUpdateTransaction) SetWipeKey(publicKey PublicKey) *TokenUpdateTransaction {
func (transaction *TokenUpdateTransaction) SetWipeKey(publicKey Key) *TokenUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.WipeKey = publicKey.toProtoKey()
return transaction
}

// The new Supply key of the Token. If the Token does not have currently a Supply key, transaction
// will resolve to TOKEN_HAS_NO_SUPPLY_KEY.
func (transaction *TokenUpdateTransaction) SetSupplyKey(publicKey PublicKey) *TokenUpdateTransaction {
func (transaction *TokenUpdateTransaction) SetSupplyKey(publicKey Key) *TokenUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.SupplyKey = publicKey.toProtoKey()
return transaction
Expand Down
4 changes: 2 additions & 2 deletions topic_create_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func NewTopicCreateTransaction() *TopicCreateTransaction {

// SetAdminKey sets the key required to update or delete the topic. If unspecified, anyone can increase the topic's
// expirationTime.
func (transaction *TopicCreateTransaction) SetAdminKey(publicKey PublicKey) *TopicCreateTransaction {
func (transaction *TopicCreateTransaction) SetAdminKey(publicKey Key) *TopicCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.AdminKey = publicKey.toProtoKey()
return transaction
Expand All @@ -47,7 +47,7 @@ func (transaction *TopicCreateTransaction) GetAdminKey() (Key, error) {
}

// SetSubmitKey sets the key required for submitting messages to the topic. If unspecified, all submissions are allowed.
func (transaction *TopicCreateTransaction) SetSubmitKey(publicKey PublicKey) *TopicCreateTransaction {
func (transaction *TopicCreateTransaction) SetSubmitKey(publicKey Key) *TopicCreateTransaction {
transaction.requireNotFrozen()
transaction.pb.SubmitKey = publicKey.toProtoKey()
return transaction
Expand Down
4 changes: 2 additions & 2 deletions topic_update_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (transaction *TopicUpdateTransaction) GetTopicID() TopicID {
// SetAdminKey sets the key required to update/delete the topic. If unset, the key will not be changed.
//
// Setting the AdminKey to an empty KeyList will clear the adminKey.
func (transaction *TopicUpdateTransaction) SetAdminKey(publicKey PublicKey) *TopicUpdateTransaction {
func (transaction *TopicUpdateTransaction) SetAdminKey(publicKey Key) *TopicUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.AdminKey = publicKey.toProtoKey()
return transaction
Expand All @@ -54,7 +54,7 @@ func (transaction *TopicUpdateTransaction) GetAdminKey() (Key, error) {
// SetSubmitKey will set the key allowed to submit messages to the topic. If unset, the key will not be changed.
//
// Setting the submitKey to an empty KeyList will clear the submitKey.
func (transaction *TopicUpdateTransaction) SetSubmitKey(publicKey PublicKey) *TopicUpdateTransaction {
func (transaction *TopicUpdateTransaction) SetSubmitKey(publicKey Key) *TopicUpdateTransaction {
transaction.requireNotFrozen()
transaction.pb.SubmitKey = publicKey.toProtoKey()
return transaction
Expand Down

0 comments on commit be8eba0

Please sign in to comment.