Skip to content

Commit a8f09aa

Browse files
authored
Merge pull request #332 from hashgraph/sr/token-update-transaction-field-names
refactor: use correct `TokenUpdateTransaction` field names
2 parents fe8a824 + dc9d56a commit a8f09aa

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

sdk/rust/src/token/token_update_transaction.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ pub struct TokenUpdateTransactionData {
7171
token_id: Option<TokenId>,
7272

7373
/// The publicly visible name of the token.
74-
name: String,
74+
token_name: String,
7575

7676
/// The publicly visible token symbol.
77-
symbol: String,
77+
token_symbol: String,
7878

7979
/// The account which will act as a treasury for the token.
8080
treasury_account_id: Option<AccountId>,
@@ -133,15 +133,15 @@ impl TokenUpdateTransaction {
133133

134134
/// Sets the new publicly visible name of the token.
135135
/// Maximum 100 characters.
136-
pub fn name(&mut self, name: impl Into<String>) -> &mut Self {
137-
self.body.data.name = name.into();
136+
pub fn token_name(&mut self, token_name: impl Into<String>) -> &mut Self {
137+
self.body.data.token_name = token_name.into();
138138
self
139139
}
140140

141141
/// Sets the new publicly visible token symbol.
142142
/// Maximum 100 characters.
143-
pub fn symbol(&mut self, symbol: impl Into<String>) -> &mut Self {
144-
self.body.data.symbol = symbol.into();
143+
pub fn token_symbol(&mut self, token_symbol: impl Into<String>) -> &mut Self {
144+
self.body.data.token_symbol = token_symbol.into();
145145
self
146146
}
147147

@@ -264,8 +264,8 @@ impl ToTransactionDataProtobuf for TokenUpdateTransactionData {
264264
) -> services::transaction_body::Data {
265265
services::transaction_body::Data::TokenUpdate(services::TokenUpdateTransactionBody {
266266
token: self.token_id.to_protobuf(),
267-
name: self.name.clone(),
268-
symbol: self.symbol.clone(),
267+
name: self.token_name.clone(),
268+
symbol: self.token_symbol.clone(),
269269
treasury: self.treasury_account_id.to_protobuf(),
270270
admin_key: self.admin_key.to_protobuf(),
271271
kyc_key: self.kyc_key.to_protobuf(),
@@ -316,8 +316,8 @@ mod tests {
316316
const TOKEN_UPDATE_TRANSACTION_JSON: &str = r#"{
317317
"$type": "tokenUpdate",
318318
"tokenId": "0.0.1001",
319-
"name": "Pound",
320-
"symbol": "LB",
319+
"tokenName": "Pound",
320+
"tokenSymbol": "LB",
321321
"treasuryAccountId": "0.0.1002",
322322
"adminKey": {
323323
"single": "302a300506032b6570032100d1ad76ed9b057a3d3f2ea2d03b41bcd79aeafd611f941924f0f6da528ab066fd"
@@ -367,8 +367,8 @@ mod tests {
367367

368368
transaction
369369
.token_id(TokenId::from(1001))
370-
.name("Pound")
371-
.symbol("LB")
370+
.token_name("Pound")
371+
.token_symbol("LB")
372372
.treasury_account_id(AccountId::from(1002))
373373
.admin_key(PublicKey::from_str(ADMIN_KEY)?)
374374
.kyc_key(PublicKey::from_str(KYC_KEY)?)
@@ -396,8 +396,8 @@ mod tests {
396396
let data = assert_matches!(transaction.body.data, AnyTransactionData::TokenUpdate(transaction) => transaction);
397397

398398
assert_eq!(data.token_id.unwrap(), TokenId::from(1001));
399-
assert_eq!(data.name, "Pound");
400-
assert_eq!(data.symbol, "LB");
399+
assert_eq!(data.token_name, "Pound");
400+
assert_eq!(data.token_symbol, "LB");
401401
assert_eq!(data.auto_renew_period.unwrap(), Duration::days(90));
402402
assert_eq!(data.token_memo, "A new memo");
403403
assert_eq!(

sdk/swift/Sources/Hedera/Token/TokenUpdateTransaction.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public final class TokenUpdateTransaction: Transaction {
2525
/// Create a new `TokenUpdateTransaction`.
2626
public init(
2727
tokenId: TokenId? = nil,
28-
name: String = "",
29-
symbol: String = "",
28+
tokenName: String = "",
29+
tokenSymbol: String = "",
3030
treasuryAccountId: AccountId? = nil,
3131
adminKey: Key? = nil,
3232
kycKey: Key? = nil,
@@ -41,8 +41,8 @@ public final class TokenUpdateTransaction: Transaction {
4141
pauseKey: Key? = nil
4242
) {
4343
self.tokenId = tokenId
44-
self.name = name
45-
self.symbol = symbol
44+
self.tokenName = tokenName
45+
self.tokenSymbol = tokenSymbol
4646
self.treasuryAccountId = treasuryAccountId
4747
self.adminKey = adminKey
4848
self.kycKey = kycKey
@@ -69,23 +69,23 @@ public final class TokenUpdateTransaction: Transaction {
6969
}
7070

7171
/// The publicly visible name of the token.
72-
public var name: String
72+
public var tokenName: String
7373

7474
/// Sets the publicly visible name of the token.
7575
@discardableResult
76-
public func name(_ name: String) -> Self {
77-
self.name = name
76+
public func tokenName(_ tokenName: String) -> Self {
77+
self.tokenName = tokenName
7878

7979
return self
8080
}
8181

8282
/// The publicly visible token symbol.
83-
public var symbol: String
83+
public var tokenSymbol: String
8484

8585
/// Sets the publicly visible token symbol.
8686
@discardableResult
87-
public func symbol(_ symbol: String) -> Self {
88-
self.symbol = symbol
87+
public func tokenSymbol(_ tokenSymbol: String) -> Self {
88+
self.tokenSymbol = tokenSymbol
8989

9090
return self
9191
}
@@ -233,8 +233,8 @@ public final class TokenUpdateTransaction: Transaction {
233233

234234
private enum CodingKeys: String, CodingKey {
235235
case tokenId
236-
case name
237-
case symbol
236+
case tokenName
237+
case tokenSymbol
238238
case treasuryAccountId
239239
case adminKey
240240
case kycKey
@@ -253,8 +253,8 @@ public final class TokenUpdateTransaction: Transaction {
253253
var container = encoder.container(keyedBy: CodingKeys.self)
254254

255255
try container.encodeIfPresent(tokenId, forKey: .tokenId)
256-
try container.encode(name, forKey: .name)
257-
try container.encode(symbol, forKey: .symbol)
256+
try container.encode(tokenName, forKey: .tokenName)
257+
try container.encode(tokenSymbol, forKey: .tokenSymbol)
258258
try container.encodeIfPresent(treasuryAccountId, forKey: .treasuryAccountId)
259259
try container.encodeIfPresent(adminKey, forKey: .adminKey)
260260
try container.encodeIfPresent(kycKey, forKey: .kycKey)

0 commit comments

Comments
 (0)