From ecd9e38e6dce73a466912d468b49a949b1540930 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Tue, 6 Aug 2024 15:00:29 -0700 Subject: [PATCH 01/11] chore: update protobufs Signed-off-by: Ricky Saechao --- .../Services/basic_types.pb.swift | 281 +++++++++++++++++- .../Services/consensus_topic_info.pb.swift | 4 +- .../Services/contract_call_local.pb.swift | 46 +-- .../Services/contract_create.pb.swift | 8 +- .../Services/contract_delete.pb.swift | 6 +- .../Services/contract_get_info.pb.swift | 8 +- .../Services/contract_update.pb.swift | 6 +- .../Services/crypto_add_live_hash.pb.swift | 2 +- .../crypto_approve_allowance.pb.swift | 2 +- .../Services/crypto_create.pb.swift | 4 +- .../crypto_get_account_balance.pb.swift | 6 +- .../Services/crypto_get_info.pb.swift | 8 +- .../Services/crypto_transfer.pb.swift | 2 +- .../Services/crypto_update.pb.swift | 4 +- .../Services/custom_fees.pb.swift | 26 +- .../Services/ethereum_transaction.pb.swift | 18 +- .../Services/exchange_rate.pb.swift | 2 +- .../Services/file_append.pb.swift | 2 +- .../Services/file_create.pb.swift | 4 +- .../Services/file_get_info.pb.swift | 2 +- .../Services/file_update.pb.swift | 2 +- .../Services/freeze_type.pb.swift | 26 +- .../network_get_execution_time.pb.swift | 6 +- .../Services/node_stake_update.pb.swift | 30 +- .../Services/query_header.pb.swift | 4 +- .../Services/response_code.pb.swift | 51 ++++ .../schedulable_transaction_body.pb.swift | 105 +++++++ .../Services/schedule_create.pb.swift | 20 +- .../Services/schedule_delete.pb.swift | 2 +- .../Services/schedule_get_info.pb.swift | 4 +- .../Services/schedule_sign.pb.swift | 6 +- .../Services/state_consensus_topic.pb.swift | 16 +- .../state_contract_storage_slot.pb.swift | 8 +- .../Services/state_token_account.pb.swift | 25 ++ ...ate_token_account_pending_airdrop.pb.swift | 192 ++++++++++++ .../Services/state_token_nft.pb.swift | 4 +- .../Services/system_delete.pb.swift | 2 +- .../Services/system_undelete.pb.swift | 2 +- .../Services/throttle_definitions.pb.swift | 4 +- .../Services/token_airdrop.pb.swift | 142 +++++++++ .../Services/token_burn.pb.swift | 2 +- .../Services/token_cancel_airdrop.pb.swift | 101 +++++++ .../Services/token_claim_airdrop.pb.swift | 105 +++++++ .../Services/token_create.pb.swift | 24 +- .../token_fee_schedule_update.pb.swift | 10 +- .../Services/token_get_info.pb.swift | 2 +- .../Services/token_get_nft_info.pb.swift | 2 +- .../Services/token_update.pb.swift | 10 +- .../Services/token_wipe_account.pb.swift | 4 +- .../Services/transaction.pb.swift | 2 +- .../Services/transaction_body.pb.swift | 105 +++++++ .../Services/transaction_get_receipt.pb.swift | 6 +- .../Services/transaction_get_record.pb.swift | 6 +- .../Services/transaction_record.pb.swift | 112 ++++++- .../Services/unchecked_submit.pb.swift | 2 +- protobufs | 2 +- 56 files changed, 1400 insertions(+), 187 deletions(-) create mode 100644 Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift create mode 100644 Sources/HederaProtobufs/Services/token_airdrop.pb.swift create mode 100644 Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift create mode 100644 Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift diff --git a/Sources/HederaProtobufs/Services/basic_types.pb.swift b/Sources/HederaProtobufs/Services/basic_types.pb.swift index 8bd42b87..242d78e5 100644 --- a/Sources/HederaProtobufs/Services/basic_types.pb.swift +++ b/Sources/HederaProtobufs/Services/basic_types.pb.swift @@ -744,6 +744,18 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { ///* /// Transfer one or more token balances held by the requesting account to the treasury for each token type. case tokenReject // = 92 + + ///* + /// Airdrop one or more tokens to one or more accounts. + case tokenAirdrop // = 93 + + ///* + /// Remove one or more pending airdrops from state on behalf of the sender(s) for each airdrop. + case tokenCancelAirdrop // = 94 + + ///* + /// Claim one or more pending airdrops + case tokenClaimAirdrop // = 95 case UNRECOGNIZED(Int) public init() { @@ -831,6 +843,9 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { case 90: self = .nodeUpdate case 91: self = .nodeDelete case 92: self = .tokenReject + case 93: self = .tokenAirdrop + case 94: self = .tokenCancelAirdrop + case 95: self = .tokenClaimAirdrop default: self = .UNRECOGNIZED(rawValue) } } @@ -916,6 +931,9 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { case .nodeUpdate: return 90 case .nodeDelete: return 91 case .tokenReject: return 92 + case .tokenAirdrop: return 93 + case .tokenCancelAirdrop: return 94 + case .tokenClaimAirdrop: return 95 case .UNRECOGNIZED(let i): return i } } @@ -1006,6 +1024,9 @@ extension Proto_HederaFunctionality: CaseIterable { .nodeUpdate, .nodeDelete, .tokenReject, + .tokenAirdrop, + .tokenCancelAirdrop, + .tokenClaimAirdrop, ] } @@ -2757,7 +2778,7 @@ public struct Proto_TokenBalances { public init() {} } -/// A token - account association +/// A token - account association public struct Proto_TokenAssociation { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -2884,6 +2905,144 @@ public struct Proto_StakingInfo { fileprivate var _stakePeriodStart: Proto_Timestamp? = nil } +///* +/// A unique, composite, identifier for a pending airdrop. +/// +/// Each pending airdrop SHALL be uniquely identified by a PendingAirdropId. +/// A PendingAirdropId SHALL be recorded when created and MUST be provided in any transaction +/// that would modify that pending airdrop (such as a `claimAirdrop` or `cancelAirdrop`). +public struct Proto_PendingAirdropId { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// A sending account.
+ /// This is the account that initiated, and SHALL fund, this pending airdrop.
+ /// This field is REQUIRED. + public var senderID: Proto_AccountID { + get {return _senderID ?? Proto_AccountID()} + set {_senderID = newValue} + } + /// Returns true if `senderID` has been explicitly set. + public var hasSenderID: Bool {return self._senderID != nil} + /// Clears the value of `senderID`. Subsequent reads from it will return its default value. + public mutating func clearSenderID() {self._senderID = nil} + + ///* + /// A receiving account.
+ /// This is the ID of the account that SHALL receive the airdrop.
+ /// This field is REQUIRED. + public var receiverID: Proto_AccountID { + get {return _receiverID ?? Proto_AccountID()} + set {_receiverID = newValue} + } + /// Returns true if `receiverID` has been explicitly set. + public var hasReceiverID: Bool {return self._receiverID != nil} + /// Clears the value of `receiverID`. Subsequent reads from it will return its default value. + public mutating func clearReceiverID() {self._receiverID = nil} + + public var tokenReference: Proto_PendingAirdropId.OneOf_TokenReference? = nil + + ///* + /// A token ID.
+ /// This is the type of token for a fungible/common token airdrop.
+ /// This field is REQUIRED for a fungible/common token and MUST NOT be used for a + /// non-fungible/unique token. + public var fungibleTokenType: Proto_TokenID { + get { + if case .fungibleTokenType(let v)? = tokenReference {return v} + return Proto_TokenID() + } + set {tokenReference = .fungibleTokenType(newValue)} + } + + ///* + /// The id of a single NFT, consisting of a Token ID and serial number.
+ /// This is the type of token for a non-fungible/unique token airdrop.
+ /// This field is REQUIRED for a non-fungible/unique token and MUST NOT be used for a + /// fungible/common token. + public var nonFungibleToken: Proto_NftID { + get { + if case .nonFungibleToken(let v)? = tokenReference {return v} + return Proto_NftID() + } + set {tokenReference = .nonFungibleToken(newValue)} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public enum OneOf_TokenReference: Equatable { + ///* + /// A token ID.
+ /// This is the type of token for a fungible/common token airdrop.
+ /// This field is REQUIRED for a fungible/common token and MUST NOT be used for a + /// non-fungible/unique token. + case fungibleTokenType(Proto_TokenID) + ///* + /// The id of a single NFT, consisting of a Token ID and serial number.
+ /// This is the type of token for a non-fungible/unique token airdrop.
+ /// This field is REQUIRED for a non-fungible/unique token and MUST NOT be used for a + /// fungible/common token. + case nonFungibleToken(Proto_NftID) + + #if !swift(>=4.1) + public static func ==(lhs: Proto_PendingAirdropId.OneOf_TokenReference, rhs: Proto_PendingAirdropId.OneOf_TokenReference) -> Bool { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch (lhs, rhs) { + case (.fungibleTokenType, .fungibleTokenType): return { + guard case .fungibleTokenType(let l) = lhs, case .fungibleTokenType(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.nonFungibleToken, .nonFungibleToken): return { + guard case .nonFungibleToken(let l) = lhs, case .nonFungibleToken(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + public init() {} + + fileprivate var _senderID: Proto_AccountID? = nil + fileprivate var _receiverID: Proto_AccountID? = nil +} + +///* +/// A single pending airdrop value. +/// +/// This message SHALL record the airdrop amount for a fungible/common token.
+/// This message SHOULD be null for a non-fungible/unique token.
+/// If a non-null `PendingAirdropValue` is set for a non-fungible/unique token, the amount +/// field MUST be `0`. +/// +/// It is RECOMMENDED that implementations store pending airdrop information as a key-value map +/// from `PendingAirdropId` to `PendingAirdropValue`, with a `null` value used for non-fungible +/// pending airdrops. +public struct Proto_PendingAirdropValue { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// An amount to transfer for fungible/common tokens.
+ /// This is expressed in the smallest available units for that token + /// (i.e. 10-`decimals` whole tokens).
+ /// This amount SHALL be transferred from the sender to the receiver, if claimed.
+ /// If the token is a fungible/common token, this value MUST be strictly greater than `0`. + /// If the token is a non-fungible/unique token, this message SHOULD NOT be set, and if + /// set, this field MUST be `0`. + public var amount: UInt64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + #if swift(>=5.5) && canImport(_Concurrency) extension Proto_TokenType: @unchecked Sendable {} extension Proto_SubType: @unchecked Sendable {} @@ -2938,6 +3097,9 @@ extension Proto_TokenBalances: @unchecked Sendable {} extension Proto_TokenAssociation: @unchecked Sendable {} extension Proto_StakingInfo: @unchecked Sendable {} extension Proto_StakingInfo.OneOf_StakedID: @unchecked Sendable {} +extension Proto_PendingAirdropId: @unchecked Sendable {} +extension Proto_PendingAirdropId.OneOf_TokenReference: @unchecked Sendable {} +extension Proto_PendingAirdropValue: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -3081,6 +3243,9 @@ extension Proto_HederaFunctionality: SwiftProtobuf._ProtoNameProviding { 90: .same(proto: "NodeUpdate"), 91: .same(proto: "NodeDelete"), 92: .same(proto: "TokenReject"), + 93: .same(proto: "TokenAirdrop"), + 94: .same(proto: "TokenCancelAirdrop"), + 95: .same(proto: "TokenClaimAirdrop"), ] } @@ -5259,3 +5424,117 @@ extension Proto_StakingInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplem return true } } + +extension Proto_PendingAirdropId: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".PendingAirdropId" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "sender_id"), + 2: .standard(proto: "receiver_id"), + 3: .standard(proto: "fungible_token_type"), + 4: .standard(proto: "non_fungible_token"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._senderID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._receiverID) }() + case 3: try { + var v: Proto_TokenID? + var hadOneofValue = false + if let current = self.tokenReference { + hadOneofValue = true + if case .fungibleTokenType(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.tokenReference = .fungibleTokenType(v) + } + }() + case 4: try { + var v: Proto_NftID? + var hadOneofValue = false + if let current = self.tokenReference { + hadOneofValue = true + if case .nonFungibleToken(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + self.tokenReference = .nonFungibleToken(v) + } + }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._senderID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._receiverID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + switch self.tokenReference { + case .fungibleTokenType?: try { + guard case .fungibleTokenType(let v)? = self.tokenReference else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + }() + case .nonFungibleToken?: try { + guard case .nonFungibleToken(let v)? = self.tokenReference else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + }() + case nil: break + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_PendingAirdropId, rhs: Proto_PendingAirdropId) -> Bool { + if lhs._senderID != rhs._senderID {return false} + if lhs._receiverID != rhs._receiverID {return false} + if lhs.tokenReference != rhs.tokenReference {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_PendingAirdropValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".PendingAirdropValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "amount"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt64Field(value: &self.amount) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.amount != 0 { + try visitor.visitSingularUInt64Field(value: self.amount, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_PendingAirdropValue, rhs: Proto_PendingAirdropValue) -> Bool { + if lhs.amount != rhs.amount {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift index 242d2db5..97ea29ce 100644 --- a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift @@ -35,7 +35,7 @@ public struct Proto_ConsensusTopicInfo { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data = Data() @@ -103,7 +103,7 @@ public struct Proto_ConsensusTopicInfo { public mutating func clearAutoRenewAccount() {self._autoRenewAccount = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() diff --git a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift index a4ead51e..9db33ecd 100644 --- a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift @@ -116,11 +116,11 @@ public struct Proto_ContractFunctionResult { ///* /// [DEPRECATED] the list of smart contracts that were created by the function call. - /// - /// The created ids will now _also_ be externalized through internal transaction - /// records, where each record has its alias field populated with the new contract's - /// EVM address. (This is needed for contracts created with CREATE2, since - /// there is no longer a simple relationship between the new contract's 0.0.X id + /// + /// The created ids will now _also_ be externalized through internal transaction + /// records, where each record has its alias field populated with the new contract's + /// EVM address. (This is needed for contracts created with CREATE2, since + /// there is no longer a simple relationship between the new contract's 0.0.X id /// and its Solidity address.) public var createdContractIds: [Proto_ContractID] { get {return _storage._createdContractIds} @@ -128,24 +128,24 @@ public struct Proto_ContractFunctionResult { } ///* - /// The new contract's 20-byte EVM address. Only populated after release 0.23, - /// where each created contract will have its own record. (This is an important - /// point--the field is not repeated because there will be a separate + /// The new contract's 20-byte EVM address. Only populated after release 0.23, + /// where each created contract will have its own record. (This is an important + /// point--the field is not repeated because there will be a separate /// child record for each created contract.) - /// + /// /// Every contract has an EVM address determined by its shard.realm.num id. /// This address is as follows: ///
    ///
  1. The first 4 bytes are the big-endian representation of the shard.
  2. ///
  3. The next 8 bytes are the big-endian representation of the realm.
  4. ///
  5. The final 8 bytes are the big-endian representation of the number.
  6. - ///
- /// - /// Contracts created via CREATE2 have an additional, primary address that is - /// derived from the EIP-1014 - /// specification, and does not have a simple relation to a shard.realm.num id. - /// - /// (Please do note that CREATE2 contracts can also be referenced by the three-part + /// + /// + /// Contracts created via CREATE2 have an additional, primary address that is + /// derived from the EIP-1014 + /// specification, and does not have a simple relation to a shard.realm.num id. + /// + /// (Please do note that CREATE2 contracts can also be referenced by the three-part /// EVM address described above.) public var evmAddress: SwiftProtobuf.Google_Protobuf_BytesValue { get {return _storage._evmAddress ?? SwiftProtobuf.Google_Protobuf_BytesValue()} @@ -157,10 +157,10 @@ public struct Proto_ContractFunctionResult { public mutating func clearEvmAddress() {_uniqueStorage()._evmAddress = nil} ///* - /// The amount of gas available for the call, aka the gasLimit. + /// The amount of gas available for the call, aka the gasLimit. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var gas: Int64 { get {return _storage._gas} set {_uniqueStorage()._gas = newValue} @@ -170,7 +170,7 @@ public struct Proto_ContractFunctionResult { /// Number of tinybars sent (the function must be payable if this is nonzero). /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var amount: Int64 { get {return _storage._amount} set {_uniqueStorage()._amount = newValue} @@ -180,7 +180,7 @@ public struct Proto_ContractFunctionResult { /// The parameters passed into the contract call. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var functionParameters: Data { get {return _storage._functionParameters} set {_uniqueStorage()._functionParameters = newValue} @@ -190,7 +190,7 @@ public struct Proto_ContractFunctionResult { /// The account that is the "sender." If not present it is the accountId from the transactionId. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var senderID: Proto_AccountID { get {return _storage._senderID ?? Proto_AccountID()} set {_uniqueStorage()._senderID = newValue} @@ -234,7 +234,7 @@ public struct Proto_ContractFunctionResult { /// It will not have a consensus timestamp. It cannot generate a record or a receipt. The response will contain the output /// returned by the function call. This is useful for calling getter functions, which purely read the state and don't change it. /// It is faster and cheaper than a normal call, because it is purely local to a single node. -/// +/// /// Unlike a ContractCall transaction, the node will consume the entire amount of provided gas in determining /// the fee for this query. public struct Proto_ContractCallLocalQuery { @@ -278,7 +278,7 @@ public struct Proto_ContractCallLocalQuery { ///* /// The account that is the "sender." If not present it is the accountId from the transactionId. - /// Typically a different value than specified in the transactionId requires a valid signature + /// Typically a different value than specified in the transactionId requires a valid signature /// over either the hedera transaction or foreign transaction data. public var senderID: Proto_AccountID { get {return _senderID ?? Proto_AccountID()} diff --git a/Sources/HederaProtobufs/Services/contract_create.pb.swift b/Sources/HederaProtobufs/Services/contract_create.pb.swift index 3f6ed9c4..3075d550 100644 --- a/Sources/HederaProtobufs/Services/contract_create.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_create.pb.swift @@ -23,10 +23,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Start a new smart contract instance. After the instance is created, the ContractID for it is in /// the receipt, and can be retrieved by the Record or with a GetByKey query. The instance will run -/// the bytecode, either stored in a previously created file or in the transaction body itself for +/// the bytecode, either stored in a previously created file or in the transaction body itself for /// small contracts. -/// -/// +/// +/// /// The constructor will be executed using the given amount of gas, and any unspent gas will be /// refunded to the paying account. Constructor inputs come from the given constructorParameters. /// - The instance will exist for autoRenewPeriod seconds. When that is reached, it will renew @@ -73,7 +73,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// to the smart contract in the future. The memo field can only be changed using the admin keys. /// If there are no admin keys, then it cannot be changed after the smart contract is created. /// -/// Signing requirements: If an admin key is set, it must sign the transaction. If an +/// Signing requirements: If an admin key is set, it must sign the transaction. If an /// auto-renew account is set, its key must sign the transaction. public struct Proto_ContractCreateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/contract_delete.pb.swift b/Sources/HederaProtobufs/Services/contract_delete.pb.swift index 43d56b6b..b4009de0 100644 --- a/Sources/HederaProtobufs/Services/contract_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_delete.pb.swift @@ -23,10 +23,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, marks a contract as deleted and transfers its remaining hBars, if any, to a /// designated receiver. After a contract is deleted, it can no longer be called. -/// +/// /// If the target contract is immutable (that is, was created without an admin key), then this /// transaction resolves to MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. The admin key of the target contract must sign. /// 2. If the transfer account or contract has receiverSigRequired, its associated key must also sign @@ -69,7 +69,7 @@ public struct Proto_ContractDeleteTransactionBody { } ///* - /// If set to true, means this is a "synthetic" system transaction being used to + /// If set to true, means this is a "synthetic" system transaction being used to /// alert mirror nodes that the contract is being permanently removed from the ledger. /// IMPORTANT: User transactions cannot set this field to true, as permanent /// removal is always managed by the ledger itself. Any ContractDeleteTransactionBody diff --git a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift index 2def1dc8..9674023a 100644 --- a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift @@ -197,9 +197,9 @@ public struct Proto_ContractGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} @@ -207,7 +207,7 @@ public struct Proto_ContractGetInfoResponse { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/contract_update.pb.swift b/Sources/HederaProtobufs/Services/contract_update.pb.swift index 18688d29..a6e22508 100644 --- a/Sources/HederaProtobufs/Services/contract_update.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_update.pb.swift @@ -22,12 +22,12 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates the fields of a smart contract to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged on the contract. For an immutable /// smart contract (that is, a contract created without an adminKey), only the expirationTime may be /// updated; setting any other field in this case will cause the transaction status to resolve to /// MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a contract has an admin key, its expiry can be extended with only the /// transaction payer's signature. @@ -155,7 +155,7 @@ public struct Proto_ContractUpdateTransactionBody { public mutating func clearMaxAutomaticTokenAssociations() {_uniqueStorage()._maxAutomaticTokenAssociations = nil} ///* - /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew + /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew /// account. Otherwise it updates the contract's auto-renew account to the referenced account. public var autoRenewAccountID: Proto_AccountID { get {return _storage._autoRenewAccountID ?? Proto_AccountID()} diff --git a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift index 8207921e..8f252223 100644 --- a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A hash---presumably of some kind of credential or certificate---along with a list of keys, each -/// of which may be either a primitive or a threshold key. +/// of which may be either a primitive or a threshold key. public struct Proto_LiveHash { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift index 3e4a4a20..f3e0e600 100644 --- a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbar/token to any other account of the spender's choice. If the owner is not specified in any allowance, the payer /// of transaction is considered to be the owner for that particular allowance. /// Setting the amount to zero in CryptoAllowance or TokenAllowance will remove the respective allowance for the spender. -/// +/// /// (So if account 0.0.X pays for this transaction and owner is not specified in the allowance, /// then at consensus each spender account will have new allowances to spend hbar or tokens from 0.0.X). public struct Proto_CryptoApproveAllowanceTransactionBody { diff --git a/Sources/HederaProtobufs/Services/crypto_create.pb.swift b/Sources/HederaProtobufs/Services/crypto_create.pb.swift index 416fe152..a65d7ae8 100644 --- a/Sources/HederaProtobufs/Services/crypto_create.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_create.pb.swift @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// used to extend its expiration as long as possible. If it is has a zero balance when it expires, /// then it is deleted. This transaction must be signed by the payer account. If receiverSigRequired /// is false, then the transaction does not have to be signed by the keys in the keys field. If it is -/// true, then it must be signed by them, in addition to the keys of the payer account. If the +/// true, then it must be signed by them, in addition to the keys of the payer account. If the /// auto_renew_account field is set, the key of the referenced account must sign. /// /// An entity (account, file, or smart contract instance) must be created in a particular realm. If @@ -224,7 +224,7 @@ public struct Proto_CryptoCreateTransactionBody { /// A given alias can map to at most one account on the network at a time. This uniqueness will be enforced /// relative to aliases currently on the network at alias assignment. /// - /// If a transaction creates an account using an alias, any further crypto transfers to that alias will + /// If a transaction creates an account using an alias, any further crypto transfers to that alias will /// simply be deposited in that account, without creating anything, and with no creation fee being charged. public var alias: Data { get {return _storage._alias} diff --git a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift index 97173ea4..9c5b1e31 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift @@ -133,9 +133,9 @@ public struct Proto_CryptoGetAccountBalanceResponse { public var balance: UInt64 = 0 ///* - /// [DEPRECATED] The balances of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The balances of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token balances. public var tokenBalances: [Proto_TokenBalance] = [] diff --git a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift index d9f75f80..4ee97725 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift @@ -220,9 +220,9 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} @@ -258,7 +258,7 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift index bce0152d..79ee3a7e 100644 --- a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift @@ -29,7 +29,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbars, then the entire transaction fails, and none of those transfers occur, though the /// transaction fee is still charged. This transaction must be signed by the keys for all the sending /// accounts, and for any receiving accounts that have receiverSigRequired == true. The signatures -/// are in the same order as the accounts, skipping those accounts that don't need a signature. +/// are in the same order as the accounts, skipping those accounts that don't need a signature. public struct Proto_CryptoTransferTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/crypto_update.pb.swift b/Sources/HederaProtobufs/Services/crypto_update.pb.swift index 65db6742..8ae87b2b 100644 --- a/Sources/HederaProtobufs/Services/crypto_update.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_update.pb.swift @@ -25,8 +25,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// transaction must be signed by the existing key for this account. If the transaction is changing /// the key field, then the transaction must be signed by both the old key (from before the change) /// and the new key. The old key must sign for security. The new key must sign as a safeguard to -/// avoid accidentally changing to an invalid key, and then having no way to recover. -/// If the update transaction sets the auto_renew_account field to anything other +/// avoid accidentally changing to an invalid key, and then having no way to recover. +/// If the update transaction sets the auto_renew_account field to anything other /// than the sentinel 0.0.0, the key of the referenced account must sign. public struct Proto_CryptoUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/custom_fees.pb.swift b/Sources/HederaProtobufs/Services/custom_fees.pb.swift index bb4d1dd4..aada1fc1 100644 --- a/Sources/HederaProtobufs/Services/custom_fees.pb.swift +++ b/Sources/HederaProtobufs/Services/custom_fees.pb.swift @@ -99,20 +99,20 @@ public struct Proto_FixedFee { /// any fungible value, the ledger will assess the fallback fee, if present, to the new NFT owner. /// Royalty fees can only be added to tokens of type type NON_FUNGIBLE_UNIQUE. /// -/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, -/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. -/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate -/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart +/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, +/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. +/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate +/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart /// contract to make this split transaction atomic if they do not trust each other.) -/// -/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network -/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits +/// +/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network +/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits /// the sender with all the fungible value the receiver is exchanging for the NFT. -/// -/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit -/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying -/// account. -/// +/// +/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit +/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying +/// account. +/// /// There is an [open HIP discussion](https://github.com/hashgraph/hedera-improvement-proposal/discussions/578) /// that proposes to broaden the class of transactions for which the network automatically collects /// royalties. If this interests or concerns you, please add your voice to that discussion. @@ -207,7 +207,7 @@ public struct Proto_CustomFee { ///* /// If true, exempts all the token's fee collection accounts from this fee. /// (The token's treasury and the above fee_collector_account_id will always - /// be exempt. Please see HIP-573 + /// be exempt. Please see HIP-573 /// for details.) public var allCollectorsAreExempt: Bool = false diff --git a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift index cdab40a1..a0c17257 100644 --- a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift @@ -26,15 +26,15 @@ public struct Proto_EthereumTransactionBody { // methods supported on all messages. ///* - /// The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete + /// The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete /// unless the callData field is set. public var ethereumData: Data = Data() ///* /// For large transactions (for example contract create) this is the callData - /// of the ethereumData. The data in the ethereumData will be re-written with - /// the callData element as a zero length string with the original contents in - /// the referenced file at time of execution. The ethereumData will need to be + /// of the ethereumData. The data in the ethereumData will be re-written with + /// the callData element as a zero length string with the original contents in + /// the referenced file at time of execution. The ethereumData will need to be /// "rehydrated" with the callData for signature validation to pass. public var callData: Proto_FileID { get {return _callData ?? Proto_FileID()} @@ -46,17 +46,17 @@ public struct Proto_EthereumTransactionBody { public mutating func clearCallData() {self._callData = nil} ///* - /// The maximum amount, in tinybars, that the payer of the hedera transaction + /// The maximum amount, in tinybars, that the payer of the hedera transaction /// is willing to pay to complete the transaction. /// - /// Ordinarily the account with the ECDSA alias corresponding to the public + /// Ordinarily the account with the ECDSA alias corresponding to the public /// key that is extracted from the ethereum_data signature is responsible for /// fees that result from the execution of the transaction. If that amount of /// authorized fees is not sufficient then the payer of the transaction can be - /// charged, up to but not exceeding this amount. If the ethereum_data + /// charged, up to but not exceeding this amount. If the ethereum_data /// transaction authorized an amount that was insufficient then the payer will - /// only be charged the amount needed to make up the difference. If the gas - /// price in the transaction was set to zero then the payer will be assessed + /// only be charged the amount needed to make up the difference. If the gas + /// price in the transaction was set to zero then the payer will be assessed /// the entire fee. public var maxGasAllowance: Int64 = 0 diff --git a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift index cc4291c9..56390969 100644 --- a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift +++ b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// An exchange rate between hbar and cents (USD) and the time at which the exchange rate will -/// expire, and be superseded by a new exchange rate. +/// expire, and be superseded by a new exchange rate. public struct Proto_ExchangeRate { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/file_append.pb.swift b/Sources/HederaProtobufs/Services/file_append.pb.swift index 3a2490c1..6534dc25 100644 --- a/Sources/HederaProtobufs/Services/file_append.pb.swift +++ b/Sources/HederaProtobufs/Services/file_append.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// single FileCreateTransaction, then it can be created with the first part of its contents, and /// then appended as many times as necessary to create the entire file. This transaction must be /// signed by all initial M-of-M KeyList keys. If keys contains additional KeyList or ThresholdKey -/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. +/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. public struct Proto_FileAppendTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/file_create.pb.swift b/Sources/HederaProtobufs/Services/file_create.pb.swift index 955c3c29..cbe7b292 100644 --- a/Sources/HederaProtobufs/Services/file_create.pb.swift +++ b/Sources/HederaProtobufs/Services/file_create.pb.swift @@ -29,14 +29,14 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// at the expirationTime, unless its expiration is extended by another transaction before that time. /// If the file is deleted, then its contents will become empty and it will be marked as deleted /// until it expires, and then it will cease to exist. -/// +/// /// The keys field is a list of keys. All keys within the top-level key list must sign (M-M) to /// create or modify a file. However, to delete the file, only one key (1-M) is required to sign from /// the top-level key list. Each of those "keys" may itself be threshold key containing other keys /// (including other threshold keys). In other words, the behavior is an AND for create/modify, OR /// for delete. This is useful for acting as a revocation server. If it is desired to have the /// behavior be AND for all 3 operations (or OR for all 3), then the list should have only a single -/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field +/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field /// is set, the key of the referenced account must sign. /// /// If a file is created without ANY keys in the keys field, the file is immutable and ONLY the diff --git a/Sources/HederaProtobufs/Services/file_get_info.pb.swift b/Sources/HederaProtobufs/Services/file_get_info.pb.swift index 440e5bc3..9adafd66 100644 --- a/Sources/HederaProtobufs/Services/file_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/file_get_info.pb.swift @@ -145,7 +145,7 @@ public struct Proto_FileGetInfoResponse { public var memo: String = String() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() diff --git a/Sources/HederaProtobufs/Services/file_update.pb.swift b/Sources/HederaProtobufs/Services/file_update.pb.swift index 40a27f8d..f16ae24f 100644 --- a/Sources/HederaProtobufs/Services/file_update.pb.swift +++ b/Sources/HederaProtobufs/Services/file_update.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// in the top level of a key list (M-of-M) of the file being updated. If the keys themselves are /// being updated, then the transaction must also be signed by all the new keys. If the keys contain /// additional KeyList or ThresholdKey then M-of-M secondary KeyList or ThresholdKey signing -/// requirements must be meet If the update transaction sets the auto_renew_account_id field +/// requirements must be meet If the update transaction sets the auto_renew_account_id field /// to anything other than the sentinel 0.0.0, the key of the referenced account must sign. public struct Proto_FileUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/freeze_type.pb.swift b/Sources/HederaProtobufs/Services/freeze_type.pb.swift index 21ec2f2b..b177ff32 100644 --- a/Sources/HederaProtobufs/Services/freeze_type.pb.swift +++ b/Sources/HederaProtobufs/Services/freeze_type.pb.swift @@ -21,32 +21,32 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// The type of network freeze or upgrade operation to be performed. This type dictates which -/// fields are required. +/// The type of network freeze or upgrade operation to be performed. This type dictates which +/// fields are required. public enum Proto_FreezeType: SwiftProtobuf.Enum { public typealias RawValue = Int ///* - /// An (invalid) default value for this enum, to ensure the client explicitly sets + /// An (invalid) default value for this enum, to ensure the client explicitly sets /// the intended type of freeze transaction. case unknownFreezeType // = 0 ///* - /// Freezes the network at the specified time. The start_time field must be provided and - /// must reference a future time. Any values specified for the update_file and file_hash - /// fields will be ignored. This transaction does not perform any network changes or - /// upgrades and requires manual intervention to restart the network. + /// Freezes the network at the specified time. The start_time field must be provided and + /// must reference a future time. Any values specified for the update_file and file_hash + /// fields will be ignored. This transaction does not perform any network changes or + /// upgrades and requires manual intervention to restart the network. case freezeOnly // = 1 ///* - /// A non-freezing operation that initiates network wide preparation in advance of a - /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and + /// A non-freezing operation that initiates network wide preparation in advance of a + /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and /// valid. The start_time field may be omitted and any value present will be ignored. case prepareUpgrade // = 2 ///* - /// Freezes the network at the specified time and performs the previously prepared - /// automatic upgrade across the entire network. + /// Freezes the network at the specified time and performs the previously prepared + /// automatic upgrade across the entire network. case freezeUpgrade // = 3 ///* @@ -54,8 +54,8 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { case freezeAbort // = 4 ///* - /// Performs an immediate upgrade on auxilary services and containers providing - /// telemetry/metrics. Does not impact network operations. + /// Performs an immediate upgrade on auxilary services and containers providing + /// telemetry/metrics. Does not impact network operations. case telemetryUpgrade // = 5 case UNRECOGNIZED(Int) diff --git a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift index 22384a8f..7a1845a5 100644 --- a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift +++ b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift @@ -21,9 +21,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// Gets the time in nanoseconds spent in handleTransaction for one or more -/// TransactionIDs (assuming they have reached consensus "recently", since only a limited -/// number of execution times are kept in-memory, depending on the value of the node-local +/// Gets the time in nanoseconds spent in handleTransaction for one or more +/// TransactionIDs (assuming they have reached consensus "recently", since only a limited +/// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). public struct Proto_NetworkGetExecutionTimeQuery { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift index 30555a09..764a8227 100644 --- a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift +++ b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift @@ -74,7 +74,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are + /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are /// treated as UTC calendar days, rather than repeating 1440 minute periods left-aligned at the epoch. public var stakingPeriod: Int64 { get {return _storage._stakingPeriod} @@ -100,7 +100,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the + /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the /// ending period. Please consult the max_total_reward field instead. public var stakingRewardRate: Int64 { get {return _storage._stakingRewardRate} @@ -108,7 +108,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that + /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that /// have been earned but not collected. public var reservedStakingRewards: Int64 { get {return _storage._reservedStakingRewards} @@ -116,7 +116,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is + /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is /// used to compute the HIP-782 balance ratio. public var unreservedStakingRewardBalance: Int64 { get {return _storage._unreservedStakingRewardBalance} @@ -124,7 +124,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward + /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward /// rate in any period; please see HIP-782 for details. public var rewardBalanceThreshold: Int64 { get {return _storage._rewardBalanceThreshold} @@ -132,7 +132,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum + /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum /// per-hbar reward rate in any period; please see HIP-782 for details. public var maxStakeRewarded: Int64 { get {return _storage._maxStakeRewarded} @@ -140,10 +140,10 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum total tinybars that could be paid as staking rewards in the ending period, after + /// The maximum total tinybars that could be paid as staking rewards in the ending period, after /// applying the settings for the 0.0.800 balance threshold and the maximum stake rewarded. This - /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a - /// mirror node could also calculate its value by iterating the node_stake list and summing + /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a + /// mirror node could also calculate its value by iterating the node_stake list and summing /// stake_rewarded fields; then multiplying this sum by the max_staking_reward_rate_per_hbar. public var maxTotalReward: Int64 { get {return _storage._maxTotalReward} @@ -166,13 +166,13 @@ public struct Proto_NodeStake { ///* /// The maximum stake (rewarded or not rewarded) this node can have as consensus weight. If its stake to - /// reward is above this maximum at the start of a period, then accounts staking to the node in that + /// reward is above this maximum at the start of a period, then accounts staking to the node in that /// period will be rewarded at a lower rate scaled by (maxStake / stakeRewardStart). public var maxStake: Int64 = 0 ///* /// The minimum stake (rewarded or not rewarded) this node must reach before having non-zero consensus weight. - /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in + /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in /// that period will receive no rewards. public var minStake: Int64 = 0 @@ -181,8 +181,8 @@ public struct Proto_NodeStake { public var nodeID: Int64 = 0 ///* - /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of - /// the staking period that is ending. + /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of + /// the staking period that is ending. public var rewardRate: Int64 = 0 ///* @@ -190,12 +190,12 @@ public struct Proto_NodeStake { public var stake: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the /// beginning of the new staking period. public var stakeNotRewarded: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the /// beginning of the new staking period. public var stakeRewarded: Int64 = 0 diff --git a/Sources/HederaProtobufs/Services/query_header.pb.swift b/Sources/HederaProtobufs/Services/query_header.pb.swift index 4763d7e9..b82559f3 100644 --- a/Sources/HederaProtobufs/Services/query_header.pb.swift +++ b/Sources/HederaProtobufs/Services/query_header.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// (allowing it to tailor the payment transaction accordingly). If the payment in the query fails /// the precheck, then the response may have some fields blank. The state proof is only available for /// some types of information. It is available for a Record, but not a receipt. It is available for -/// the information in each kind of *GetInfo request. +/// the information in each kind of *GetInfo request. public enum Proto_ResponseType: SwiftProtobuf.Enum { public typealias RawValue = Int @@ -90,7 +90,7 @@ extension Proto_ResponseType: CaseIterable { ///* /// Each query from the client to the node will contain the QueryHeader, which gives the requested /// response type, and includes a payment transaction that will compensate the node for responding to -/// the query. The payment can be blank if the query is free. +/// the query. The payment can be blank if the query is free. public struct Proto_QueryHeader { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/response_code.pb.swift b/Sources/HederaProtobufs/Services/response_code.pb.swift index 1585fd77..ba2d1ad6 100644 --- a/Sources/HederaProtobufs/Services/response_code.pb.swift +++ b/Sources/HederaProtobufs/Services/response_code.pb.swift @@ -1324,6 +1324,33 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { /// /// The node account is not allowed to be updated case updateNodeAccountNotAllowed // = 359 + + /// + /// The token has no metadata or supply key + case tokenHasNoMetadataOrSupplyKey // = 360 + + ///* + /// The transaction attempted to the use an empty List of `PendingAirdropId`. + case emptyPendingAirdropIDList // = 361 + + ///* + /// The transaction attempted to the same `PendingAirdropId` twice. + case pendingAirdropIDRepeated // = 362 + + ///* + /// The transaction attempted to use more than the allowed number of `PendingAirdropId`. + case maxPendingAirdropIDExceeded // = 363 + + /// + /// A pending airdrop already exists for the specified NFT. + case pendingNftAirdropAlreadyExists // = 364 + + /// + /// The identified account is sender for one or more pending airdrop(s) + /// and cannot be deleted.
+ /// Requester should cancel all pending airdrops before resending + /// this transaction. + case accountHasPendingAirdrops // = 365 case UNRECOGNIZED(Int) public init() { @@ -1650,6 +1677,12 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case 357: self = .invalidIpv4Address case 358: self = .emptyTokenReferenceList case 359: self = .updateNodeAccountNotAllowed + case 360: self = .tokenHasNoMetadataOrSupplyKey + case 361: self = .emptyPendingAirdropIDList + case 362: self = .pendingAirdropIDRepeated + case 363: self = .maxPendingAirdropIDExceeded + case 364: self = .pendingNftAirdropAlreadyExists + case 365: self = .accountHasPendingAirdrops default: self = .UNRECOGNIZED(rawValue) } } @@ -1974,6 +2007,12 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case .invalidIpv4Address: return 357 case .emptyTokenReferenceList: return 358 case .updateNodeAccountNotAllowed: return 359 + case .tokenHasNoMetadataOrSupplyKey: return 360 + case .emptyPendingAirdropIDList: return 361 + case .pendingAirdropIDRepeated: return 362 + case .maxPendingAirdropIDExceeded: return 363 + case .pendingNftAirdropAlreadyExists: return 364 + case .accountHasPendingAirdrops: return 365 case .UNRECOGNIZED(let i): return i } } @@ -2303,6 +2342,12 @@ extension Proto_ResponseCodeEnum: CaseIterable { .invalidIpv4Address, .emptyTokenReferenceList, .updateNodeAccountNotAllowed, + .tokenHasNoMetadataOrSupplyKey, + .emptyPendingAirdropIDList, + .pendingAirdropIDRepeated, + .maxPendingAirdropIDExceeded, + .pendingNftAirdropAlreadyExists, + .accountHasPendingAirdrops, ] } @@ -2634,5 +2679,11 @@ extension Proto_ResponseCodeEnum: SwiftProtobuf._ProtoNameProviding { 357: .same(proto: "INVALID_IPV4_ADDRESS"), 358: .same(proto: "EMPTY_TOKEN_REFERENCE_LIST"), 359: .same(proto: "UPDATE_NODE_ACCOUNT_NOT_ALLOWED"), + 360: .same(proto: "TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY"), + 361: .same(proto: "EMPTY_PENDING_AIRDROP_ID_LIST"), + 362: .same(proto: "PENDING_AIRDROP_ID_REPEATED"), + 363: .same(proto: "MAX_PENDING_AIRDROP_ID_EXCEEDED"), + 364: .same(proto: "PENDING_NFT_AIRDROP_ALREADY_EXISTS"), + 365: .same(proto: "ACCOUNT_HAS_PENDING_AIRDROPS"), ] } diff --git a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift index 6c153361..6c87c9bc 100644 --- a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift @@ -496,6 +496,36 @@ public struct Proto_SchedulableTransactionBody { set {_uniqueStorage()._data = .tokenReject(newValue)} } + ///* + /// Transaction body for a scheduled transaction to cancel an airdrop. + public var tokenCancelAirdrop: Proto_TokenCancelAirdropTransactionBody { + get { + if case .tokenCancelAirdrop(let v)? = _storage._data {return v} + return Proto_TokenCancelAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenCancelAirdrop(newValue)} + } + + ///* + /// Transaction body for a scheduled transaction to claim an airdrop. + public var tokenClaimAirdrop: Proto_TokenClaimAirdropTransactionBody { + get { + if case .tokenClaimAirdrop(let v)? = _storage._data {return v} + return Proto_TokenClaimAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenClaimAirdrop(newValue)} + } + + ///* + /// Transaction body for a scheduled transaction to airdrop tokens. + public var tokenAirdrop: Proto_TokenAirdropTransactionBody { + get { + if case .tokenAirdrop(let v)? = _storage._data {return v} + return Proto_TokenAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenAirdrop(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* @@ -644,6 +674,15 @@ public struct Proto_SchedulableTransactionBody { /// Custom fees and royalties defined for the tokens rejected /// SHALL NOT be charged for this transaction. case tokenReject(Proto_TokenRejectTransactionBody) + ///* + /// Transaction body for a scheduled transaction to cancel an airdrop. + case tokenCancelAirdrop(Proto_TokenCancelAirdropTransactionBody) + ///* + /// Transaction body for a scheduled transaction to claim an airdrop. + case tokenClaimAirdrop(Proto_TokenClaimAirdropTransactionBody) + ///* + /// Transaction body for a scheduled transaction to airdrop tokens. + case tokenAirdrop(Proto_TokenAirdropTransactionBody) #if !swift(>=4.1) public static func ==(lhs: Proto_SchedulableTransactionBody.OneOf_Data, rhs: Proto_SchedulableTransactionBody.OneOf_Data) -> Bool { @@ -823,6 +862,18 @@ public struct Proto_SchedulableTransactionBody { guard case .tokenReject(let l) = lhs, case .tokenReject(let r) = rhs else { preconditionFailure() } return l == r }() + case (.tokenCancelAirdrop, .tokenCancelAirdrop): return { + guard case .tokenCancelAirdrop(let l) = lhs, case .tokenCancelAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.tokenClaimAirdrop, .tokenClaimAirdrop): return { + guard case .tokenClaimAirdrop(let l) = lhs, case .tokenClaimAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.tokenAirdrop, .tokenAirdrop): return { + guard case .tokenAirdrop(let l) = lhs, case .tokenAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -891,6 +942,9 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf 43: .same(proto: "nodeUpdate"), 44: .same(proto: "nodeDelete"), 45: .same(proto: "tokenReject"), + 46: .same(proto: "tokenCancelAirdrop"), + 47: .same(proto: "tokenClaimAirdrop"), + 48: .same(proto: "tokenAirdrop"), ] fileprivate class _StorageClass { @@ -1493,6 +1547,45 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf _storage._data = .tokenReject(v) } }() + case 46: try { + var v: Proto_TokenCancelAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenCancelAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenCancelAirdrop(v) + } + }() + case 47: try { + var v: Proto_TokenClaimAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenClaimAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenClaimAirdrop(v) + } + }() + case 48: try { + var v: Proto_TokenAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenAirdrop(v) + } + }() default: break } } @@ -1684,6 +1777,18 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf guard case .tokenReject(let v)? = _storage._data else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 45) }() + case .tokenCancelAirdrop?: try { + guard case .tokenCancelAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 46) + }() + case .tokenClaimAirdrop?: try { + guard case .tokenClaimAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 47) + }() + case .tokenAirdrop?: try { + guard case .tokenAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 48) + }() case nil: break } } diff --git a/Sources/HederaProtobufs/Services/schedule_create.pb.swift b/Sources/HederaProtobufs/Services/schedule_create.pb.swift index bfe9c7d1..a8f221ea 100644 --- a/Sources/HederaProtobufs/Services/schedule_create.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_create.pb.swift @@ -34,40 +34,40 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// or ScheduleSign. /// /// Upon `SUCCESS`, the receipt also includes the scheduledTransactionID to -/// use to query for the record of the scheduled transaction's execution (if it occurs). -/// +/// use to query for the record of the scheduled transaction's execution (if it occurs). +/// /// The expiration time of a schedule is controlled by it's expiration_time. It remains in state and can be queried /// using GetScheduleInfo until expiration, no matter if the scheduled transaction has /// executed or marked deleted. If Long Term Scheduled Transactions are disabled, the expiration_time is always /// 30 minutes in the future. -/// +/// /// If the adminKey field is omitted, the resulting schedule is immutable. If the /// adminKey is set, the ScheduleDelete transaction can be used to mark it as /// deleted. The creator may also specify an optional memo whose UTF-8 encoding is at most /// 100 bytes and does not include the zero byte is also supported. -/// +/// /// When a scheduledTransactionBody is executed, the /// network only charges its payer the service fee, and not the node and network fees. If the /// optional payerAccountID is set, the network charges this account. Otherwise it charges -/// the payer of the originating ScheduleCreate. -/// +/// the payer of the originating ScheduleCreate. +/// /// Two ScheduleCreate transactions are identical if they are equal in all their /// fields other than payerAccountID. (For the scheduledTransactionBody field, /// "equal" should be understood in the sense of /// gRPC object equality in the network software runtime. In particular, a gRPC object with unknown fields is -/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) -/// +/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) +/// /// A ScheduleCreate transaction that attempts to re-create an identical schedule already in /// state will receive a receipt with status IDENTICAL_SCHEDULE_ALREADY_CREATED; the receipt /// will include the ScheduleID of the extant schedule, which may be used in a subsequent /// ScheduleSign transaction. (The receipt will also include the TransactionID to /// use in querying for the receipt or record of the scheduled transaction.) -/// +/// /// Other notable response codes include, INVALID_ACCOUNT_ID, /// UNSCHEDULABLE_TRANSACTION, UNRESOLVABLE_REQUIRED_SIGNERS, /// INVALID_SIGNATURE. For more information please see the section of this documentation on -/// the ResponseCode enum. +/// the ResponseCode enum. public struct Proto_ScheduleCreateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift index 4e1cd626..c274b790 100644 --- a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Other notable response codes include, INVALID_SCHEDULE_ID, SCHEDULE_PENDING_EXPIRATION, /// SCHEDULE_ALREADY_DELETED, SCHEDULE_ALREADY_EXECUTED, SCHEDULE_IS_IMMUTABLE. /// For more information please see the section of this documentation on the ResponseCode -/// enum. +/// enum. public struct Proto_ScheduleDeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift index 040e7e08..657bb86d 100644 --- a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Gets information about a schedule in the network's action queue. -/// +/// /// Responds with INVALID_SCHEDULE_ID if the requested schedule doesn't exist. public struct Proto_ScheduleGetInfoQuery { // SwiftProtobuf.Message conformance is added in an extension below. See the @@ -193,7 +193,7 @@ public struct Proto_ScheduleInfo { public mutating func clearScheduledTransactionID() {_uniqueStorage()._scheduledTransactionID = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift index 58366ed5..4533bf8b 100644 --- a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift @@ -29,10 +29,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Otherwise, if the resulting set of signing keys satisfy the /// scheduled transaction's signing requirements, it will be executed immediately after the /// triggering ScheduleSign. -/// +/// /// Upon SUCCESS, the receipt includes the scheduledTransactionID to use to query -/// for the record of the scheduled transaction's execution (if it occurs). -/// +/// for the record of the scheduled transaction's execution (if it occurs). +/// /// Other notable response codes include INVALID_SCHEDULE_ID, SCHEDULE_ALREADY_DELETED, /// SCHEDULE_PENDING_EXPIRATION, SCHEDULE_ALREADY_EXPIRED, /// INVALID_ACCOUNT_ID, UNRESOLVABLE_REQUIRED_SIGNERS, diff --git a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift index 15cf4092..207045a0 100644 --- a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift @@ -22,19 +22,19 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Representation of a Hedera Consensus Service topic in the network Merkle tree. -/// -/// As with all network entities, a topic has a unique entity number, which is usually given along +/// +/// As with all network entities, a topic has a unique entity number, which is usually given along /// with the network's shard and realm in the form of a shard.realm.number id. -/// +/// /// A topic consists of just two pieces of data: /// 1. The total number of messages sent to the topic; and, /// 2. The running hash of all those messages. /// It also has several metadata elements: /// 1. A consensus expiration time in seconds since the epoch. -/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that -/// has signed a transaction allowing the network to use its balance to automatically extend the topic's +/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that +/// has signed a transaction allowing the network to use its balance to automatically extend the topic's /// expiration time when it passes. -/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the +/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the /// topic has a valid auto-renew account, and is not deleted upon expiration. /// 4. A boolean marking if the topic has been deleted. /// 5. A memo string whose UTF-8 encoding is at most 100 bytes. @@ -71,7 +71,7 @@ public struct Proto_Topic { } ///* - /// The number of seconds for which the topic will be automatically renewed + /// The number of seconds for which the topic will be automatically renewed /// upon expiring (if it has a valid auto-renew account). public var autoRenewPeriod: Int64 { get {return _storage._autoRenewPeriod} @@ -101,7 +101,7 @@ public struct Proto_Topic { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data { diff --git a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift index c05916da..7602f77e 100644 --- a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift +++ b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The key of a storage slot. A slot is scoped to a specific contract number. -/// -/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. +/// +/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. public struct Proto_SlotKey { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -53,10 +53,10 @@ public struct Proto_SlotKey { ///* /// The value of a contract storage slot. For the EVM, this is a single word. -/// +/// /// Because we iterate through all the storage slots for an expired contract /// when purging it from state, our slot values also include the words -/// of the previous and next keys in this contract's storage "list". +/// of the previous and next keys in this contract's storage "list". public struct Proto_SlotValue { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/state_token_account.pb.swift b/Sources/HederaProtobufs/Services/state_token_account.pb.swift index b875a020..7e8895a1 100644 --- a/Sources/HederaProtobufs/Services/state_token_account.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_account.pb.swift @@ -315,6 +315,23 @@ public struct Proto_Account { set {_uniqueStorage()._firstContractStorageKey = newValue} } + ///* + /// A pending airdrop ID at the head of the linked list for this account + /// from the account airdrops map.
+ /// The account airdrops are connected by including the "next" and "previous" + /// `PendingAirdropID` in each `AccountAirdrop` message. + ///

+ /// This value SHALL NOT be empty if this account is "sender" for any + /// pending airdrop, and SHALL be empty otherwise. + public var headPendingAirdropID: Proto_PendingAirdropId { + get {return _storage._headPendingAirdropID ?? Proto_PendingAirdropId()} + set {_uniqueStorage()._headPendingAirdropID = newValue} + } + /// Returns true if `headPendingAirdropID` has been explicitly set. + public var hasHeadPendingAirdropID: Bool {return _storage._headPendingAirdropID != nil} + /// Clears the value of `headPendingAirdropID`. Subsequent reads from it will return its default value. + public mutating func clearHeadPendingAirdropID() {_uniqueStorage()._headPendingAirdropID = nil} + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* @@ -500,6 +517,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa 31: .standard(proto: "number_treasury_titles"), 32: .standard(proto: "expired_and_pending_removal"), 33: .standard(proto: "first_contract_storage_key"), + 34: .standard(proto: "head_pending_airdrop_id"), ] fileprivate class _StorageClass { @@ -535,6 +553,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa var _numberTreasuryTitles: UInt32 = 0 var _expiredAndPendingRemoval: Bool = false var _firstContractStorageKey: Data = Data() + var _headPendingAirdropID: Proto_PendingAirdropId? = nil #if swift(>=5.10) // This property is used as the initial default value for new instances of the type. @@ -581,6 +600,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa _numberTreasuryTitles = source._numberTreasuryTitles _expiredAndPendingRemoval = source._expiredAndPendingRemoval _firstContractStorageKey = source._firstContractStorageKey + _headPendingAirdropID = source._headPendingAirdropID } } @@ -651,6 +671,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa case 31: try { try decoder.decodeSingularUInt32Field(value: &_storage._numberTreasuryTitles) }() case 32: try { try decoder.decodeSingularBoolField(value: &_storage._expiredAndPendingRemoval) }() case 33: try { try decoder.decodeSingularBytesField(value: &_storage._firstContractStorageKey) }() + case 34: try { try decoder.decodeSingularMessageField(value: &_storage._headPendingAirdropID) }() default: break } } @@ -767,6 +788,9 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa if !_storage._firstContractStorageKey.isEmpty { try visitor.visitSingularBytesField(value: _storage._firstContractStorageKey, fieldNumber: 33) } + try { if let v = _storage._headPendingAirdropID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 34) + } }() } try unknownFields.traverse(visitor: &visitor) } @@ -808,6 +832,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa if _storage._numberTreasuryTitles != rhs_storage._numberTreasuryTitles {return false} if _storage._expiredAndPendingRemoval != rhs_storage._expiredAndPendingRemoval {return false} if _storage._firstContractStorageKey != rhs_storage._firstContractStorageKey {return false} + if _storage._headPendingAirdropID != rhs_storage._headPendingAirdropID {return false} return true } if !storagesAreEqual {return false} diff --git a/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift b/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift new file mode 100644 index 00000000..00a9d1e9 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift @@ -0,0 +1,192 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/account_pending_airdrop.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +///* +/// A node within a doubly linked list of pending airdrop references.
+/// This internal state message forms the entries in a doubly-linked list +/// of references to pending airdrop entries that are "owed" by a particular +/// account as "sender". +/// +/// Each entry in this list MUST refer to an existing pending airdrop.
+/// The pending airdrop MUST NOT be claimed.
+/// The pending airdrop MUST NOT be canceled.
+/// The pending airdrop `sender` account's `head_pending_airdrop_id` field +/// MUST match the `pending_airdrop_id` field in this message. +/// +/// ### Record Stream Effects +/// This value is not currently published in the record stream. +public struct Proto_AccountPendingAirdrop { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// The value of the current airdrop id. SHALL NOT be set for non fungible tokens + public var pendingAirdropValue: Proto_PendingAirdropValue { + get {return _storage._pendingAirdropValue ?? Proto_PendingAirdropValue()} + set {_uniqueStorage()._pendingAirdropValue = newValue} + } + /// Returns true if `pendingAirdropValue` has been explicitly set. + public var hasPendingAirdropValue: Bool {return _storage._pendingAirdropValue != nil} + /// Clears the value of `pendingAirdropValue`. Subsequent reads from it will return its default value. + public mutating func clearPendingAirdropValue() {_uniqueStorage()._pendingAirdropValue = nil} + + ///* + /// A pending airdrop identifier.
+ /// This identifies the specific pending airdrop that precedes this position + /// within the doubly linked list of pending airdrops "owed" by the sending + /// account associated with this account airdrop "list". + ///

+ /// This SHALL match `pending_airdrop_id` if this is the only entry + /// in the "list". + public var previousAirdrop: Proto_PendingAirdropId { + get {return _storage._previousAirdrop ?? Proto_PendingAirdropId()} + set {_uniqueStorage()._previousAirdrop = newValue} + } + /// Returns true if `previousAirdrop` has been explicitly set. + public var hasPreviousAirdrop: Bool {return _storage._previousAirdrop != nil} + /// Clears the value of `previousAirdrop`. Subsequent reads from it will return its default value. + public mutating func clearPreviousAirdrop() {_uniqueStorage()._previousAirdrop = nil} + + ///* + /// A pending airdrop identifier.
+ /// This identifies the specific pending airdrop that follows this position + /// within the doubly linked list of pending airdrops "owed" by the sending + /// account associated with this account airdrop "list". + ///

+ /// This SHALL match `pending_airdrop_id` if this is the only entry + /// in the "list". + public var nextAirdrop: Proto_PendingAirdropId { + get {return _storage._nextAirdrop ?? Proto_PendingAirdropId()} + set {_uniqueStorage()._nextAirdrop = newValue} + } + /// Returns true if `nextAirdrop` has been explicitly set. + public var hasNextAirdrop: Bool {return _storage._nextAirdrop != nil} + /// Clears the value of `nextAirdrop`. Subsequent reads from it will return its default value. + public mutating func clearNextAirdrop() {_uniqueStorage()._nextAirdrop = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_AccountPendingAirdrop: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "proto" + +extension Proto_AccountPendingAirdrop: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".AccountPendingAirdrop" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_airdrop_value"), + 2: .standard(proto: "previous_airdrop"), + 3: .standard(proto: "next_airdrop"), + ] + + fileprivate class _StorageClass { + var _pendingAirdropValue: Proto_PendingAirdropValue? = nil + var _previousAirdrop: Proto_PendingAirdropId? = nil + var _nextAirdrop: Proto_PendingAirdropId? = nil + + #if swift(>=5.10) + // This property is used as the initial default value for new instances of the type. + // The type itself is protecting the reference to its storage via CoW semantics. + // This will force a copy to be made of this reference when the first mutation occurs; + // hence, it is safe to mark this as `nonisolated(unsafe)`. + static nonisolated(unsafe) let defaultInstance = _StorageClass() + #else + static let defaultInstance = _StorageClass() + #endif + + private init() {} + + init(copying source: _StorageClass) { + _pendingAirdropValue = source._pendingAirdropValue + _previousAirdrop = source._previousAirdrop + _nextAirdrop = source._nextAirdrop + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + + public mutating func decodeMessage(decoder: inout D) throws { + _ = _uniqueStorage() + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &_storage._pendingAirdropValue) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._previousAirdrop) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._nextAirdrop) }() + default: break + } + } + } + } + + public func traverse(visitor: inout V) throws { + try withExtendedLifetime(_storage) { (_storage: _StorageClass) in + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = _storage._pendingAirdropValue { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._previousAirdrop { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._nextAirdrop { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_AccountPendingAirdrop, rhs: Proto_AccountPendingAirdrop) -> Bool { + if lhs._storage !== rhs._storage { + let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in + let _storage = _args.0 + let rhs_storage = _args.1 + if _storage._pendingAirdropValue != rhs_storage._pendingAirdropValue {return false} + if _storage._previousAirdrop != rhs_storage._previousAirdrop {return false} + if _storage._nextAirdrop != rhs_storage._nextAirdrop {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift index dfe86c91..2ed2b106 100644 --- a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift @@ -83,7 +83,7 @@ public struct Proto_Nft { } ///* - /// If the owner of this NFT is not its token treasury, the id of the previous NFT + /// If the owner of this NFT is not its token treasury, the id of the previous NFT /// in the owner's "doubly-linked list" of owned NFTs (if any). public var ownerPreviousNftID: Proto_NftID { get {return _storage._ownerPreviousNftID ?? Proto_NftID()} @@ -95,7 +95,7 @@ public struct Proto_Nft { public mutating func clearOwnerPreviousNftID() {_uniqueStorage()._ownerPreviousNftID = nil} ///* - /// If the owner of this NFT is not its token treasury, the id of the next NFT in + /// If the owner of this NFT is not its token treasury, the id of the next NFT in /// the owner's "doubly-linked list" of owned NFTs (if any). public var ownerNextNftID: Proto_NftID { get {return _storage._ownerNextNftID ?? Proto_NftID()} diff --git a/Sources/HederaProtobufs/Services/system_delete.pb.swift b/Sources/HederaProtobufs/Services/system_delete.pb.swift index 51e72d28..b975ae1c 100644 --- a/Sources/HederaProtobufs/Services/system_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_delete.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// stored internally until the expiration time, at which time it is truly and permanently deleted. /// Until that time, it can be undeleted by the Hedera administrative multisignature. When a smart /// contract is deleted, the cryptocurrency account within it continues to exist, and is not affected -/// by the expiration time here. +/// by the expiration time here. public struct Proto_SystemDeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/system_undelete.pb.swift b/Sources/HederaProtobufs/Services/system_undelete.pb.swift index a2eccb79..efc3516f 100644 --- a/Sources/HederaProtobufs/Services/system_undelete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_undelete.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Undelete a file or smart contract that was deleted by SystemDelete; requires a Hedera -/// administrative multisignature. +/// administrative multisignature. public struct Proto_SystemUndeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift index 7d38b3c4..15747be9 100644 --- a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift +++ b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift @@ -73,9 +73,9 @@ public struct Proto_ThrottleBucket { /// A list of throttle buckets which, simultaneously enforced, define the system's throttling policy. ///

    ///
  1. When an operation appears in more than one throttling bucket, all its buckets must have room -/// or it will be throttled.
  2. +/// or it will be throttled. ///
  3. An operation assigned to no buckets is always throttled.
  4. -///
+/// public struct Proto_ThrottleDefinitions { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/token_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_airdrop.pb.swift new file mode 100644 index 00000000..92d0e1de --- /dev/null +++ b/Sources/HederaProtobufs/Services/token_airdrop.pb.swift @@ -0,0 +1,142 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: token_airdrop.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +///* +/// # Token Airdrop +/// Messages used to implement a transaction to "airdrop" tokens.
+/// An "airdrop" is a distribution of tokens from a funding account +/// to one or more recipient accounts, ideally with no action required +/// by the recipient account(s). +/// +/// ### Keywords +/// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", +/// "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this +/// document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119). + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +///* +/// Airdrop one or more tokens to one or more accounts. +/// +/// ### Effects +/// This distributes tokens from the balance of one or more sending account(s) to the balance +/// of one or more recipient accounts. Accounts MAY receive the tokens in one of four ways. +/// +/// - An account already associated to the token to be distributed SHALL receive the +/// airdropped tokens immediately to the recipient account balance.
+/// The fee for this transfer SHALL include the transfer, the airdrop fee, and any custom fees. +/// - An account with available automatic association slots SHALL be automatically +/// associated to the token, and SHALL immediately receive the airdropped tokens to the +/// recipient account balance.
+/// The fee for this transfer SHALL include the transfer, the association, the cost to renew +/// that association once, the airdrop fee, and any custom fees. +/// - An account with "receiver signature required" set SHALL have a "Pending Airdrop" created +/// and must claim that airdrop with a `claimAirdrop` transaction.
+/// The fee for this transfer SHALL include the transfer, the association, the cost to renew +/// that association once, the airdrop fee, and any custom fees. If the pending airdrop is not +/// claimed immediately, the `sender` SHALL pay the cost to renew the token association, and +/// the cost to maintain the pending airdrop, until the pending airdrop is claimed or cancelled. +/// - An account with no available automatic association slots SHALL have a "Pending Airdrop" +/// created and must claim that airdrop with a `claimAirdrop` transaction.
+/// The fee for this transfer SHALL include the transfer, the association, the cost to renew +/// that association once, the airdrop fee, and any custom fees. If the pending airdrop is not +/// claimed immediately, the `sender` SHALL pay the cost to renew the token association, and +/// the cost to maintain the pending airdrop, until the pending airdrop is claimed or cancelled. +/// +/// If an airdrop would create a pending airdrop for a fungible/common token, and a pending airdrop +/// for the same sender, receiver, and token already exists, the existing pending airdrop +/// SHALL be updated to add the new amount to the existing airdrop, rather than creating a new +/// pending airdrop. +/// +/// Any airdrop that completes immediately SHALL be irreversible. Any airdrop that results in a +/// "Pending Airdrop" MAY be canceled via a `cancelAirdrop` transaction. +/// +/// All transfer fees (including custom fees and royalties), as well as the rent cost for the +/// first auto-renewal period for any automatic-association slot occupied by the airdropped +/// tokens, SHALL be charged to the account paying for this transaction. +/// +/// ### Record Stream Effects +/// - Each successful transfer SHALL be recorded in `token_transfer_list` for the transaction record. +/// - Each successful transfer that consumes an automatic association slot SHALL populate the +/// `automatic_association` field for the record. +/// - Each pending transfer _created_ SHALL be added to the `pending_airdrops` field for the record. +/// - Each pending transfer _updated_ SHALL be added to the `pending_airdrops` field for the record. +public struct Proto_TokenAirdropTransactionBody { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// A list of token transfers representing one or more airdrops. + /// The sender for each transfer MUST have sufficient balance to complete the transfers. + /// + /// All token transfers MUST successfully transfer tokens or create a pending airdrop + /// for this transaction to succeed. + /// This list MUST contain between 1 and 10 transfers, inclusive. + /// + /// Note that each transfer of fungible/common tokens requires both a debit and + /// a credit, so each _fungible_ token transfer MUST have _balanced_ entries in the + /// TokenTransferList for that transfer. + public var tokenTransfers: [Proto_TokenTransferList] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TokenAirdropTransactionBody: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "proto" + +extension Proto_TokenAirdropTransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TokenAirdropTransactionBody" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_transfers"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.tokenTransfers) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.tokenTransfers.isEmpty { + try visitor.visitRepeatedMessageField(value: self.tokenTransfers, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TokenAirdropTransactionBody, rhs: Proto_TokenAirdropTransactionBody) -> Bool { + if lhs.tokenTransfers != rhs.tokenTransfers {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/token_burn.pb.swift b/Sources/HederaProtobufs/Services/token_burn.pb.swift index 93f136be..cbed3afa 100644 --- a/Sources/HederaProtobufs/Services/token_burn.pb.swift +++ b/Sources/HederaProtobufs/Services/token_burn.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Token A has 2 decimals. In order to burn 100 tokens, one must provide amount of 10000. In order /// to burn 100.55 tokens, one must provide amount of 10055. /// For non fungible tokens the transaction body accepts serialNumbers list of integers as a parameter. -/// +/// /// If the serialNumbers don't get filled for non-fungible token type, a INVALID_TOKEN_BURN_AMOUNT response /// code will be returned. /// If a zero amount is provided for a fungible token type, it will be treated as a regular transaction. diff --git a/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift new file mode 100644 index 00000000..928780ab --- /dev/null +++ b/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift @@ -0,0 +1,101 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: token_cancel_airdrop.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +///* +/// # Token Cancel Airdrop +/// Messages used to implement a transaction to cancel a pending airdrop. +/// +/// ### Keywords +/// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", +/// "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this +/// document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119). + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +///* +/// Token cancel airdrop
+/// Remove one or more pending airdrops from state on behalf of the sender(s) +/// for each airdrop. +/// +/// Each pending airdrop canceled SHALL be removed from state and SHALL NOT be available to claim.
+/// Each cancellation SHALL be represented in the transaction body and SHALL NOT be restated +/// in the record file.
+/// All cancellations MUST succeed for this transaction to succeed. +public struct Proto_TokenCancelAirdropTransactionBody { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// A list of one or more pending airdrop identifiers.
+ /// This list declares the set of pending airdrop entries that the client + /// wishes to cancel; on success all listed pending airdrop entries + /// will be removed. + ///

+ /// This transaction MUST be signed by the account referenced by a `sender_id` for + /// each entry in this list.
+ /// This list MUST NOT have any duplicate entries.
+ /// This list MUST contain between 1 and 10 entries, inclusive. + public var pendingAirdrops: [Proto_PendingAirdropId] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TokenCancelAirdropTransactionBody: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "proto" + +extension Proto_TokenCancelAirdropTransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TokenCancelAirdropTransactionBody" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_airdrops"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.pendingAirdrops) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.pendingAirdrops.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingAirdrops, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TokenCancelAirdropTransactionBody, rhs: Proto_TokenCancelAirdropTransactionBody) -> Bool { + if lhs.pendingAirdrops != rhs.pendingAirdrops {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift new file mode 100644 index 00000000..d1cd47bb --- /dev/null +++ b/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift @@ -0,0 +1,105 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: token_claim_airdrop.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +///* +/// # Token Claim Airdrop +/// Messages used to implement a transaction to claim a pending airdrop. +/// +/// ### Keywords +/// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", +/// "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this +/// document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119). + +import Foundation +import SwiftProtobuf + +// If the compiler emits an error on this type, it is because this file +// was generated by a version of the `protoc` Swift plug-in that is +// incompatible with the version of SwiftProtobuf to which you are linking. +// Please ensure that you are building against the same version of the API +// that was used to generate this file. +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} + typealias Version = _2 +} + +///* +/// Token claim airdrop
+/// Complete one or more pending transfers on behalf of the +/// recipient(s) for an airdrop. +/// +/// The sender MUST have sufficient balance to fulfill the airdrop at the +/// time of claim. If the sender does not have sufficient balance, the +/// claim SHALL fail.
+/// Each pending airdrop successfully claimed SHALL be removed from state and +/// SHALL NOT be available to claim again.
+/// Each claim SHALL be represented in the transaction body and +/// SHALL NOT be restated in the record file.
+/// All claims MUST succeed for this transaction to succeed. +/// +/// ### Record Stream Effects +/// The completed transfers SHALL be present in the transfer list. +public struct Proto_TokenClaimAirdropTransactionBody { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// A list of one or more pending airdrop identifiers. + ///

+ /// This transaction MUST be signed by the account identified by + /// the `receiver_id` for each entry in this list.
+ /// This list MUST contain between 1 and 10 entries, inclusive.
+ /// This list MUST NOT have any duplicate entries. + public var pendingAirdrops: [Proto_PendingAirdropId] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TokenClaimAirdropTransactionBody: @unchecked Sendable {} +#endif // swift(>=5.5) && canImport(_Concurrency) + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "proto" + +extension Proto_TokenClaimAirdropTransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TokenClaimAirdropTransactionBody" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_airdrops"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeRepeatedMessageField(value: &self.pendingAirdrops) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.pendingAirdrops.isEmpty { + try visitor.visitRepeatedMessageField(value: self.pendingAirdrops, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TokenClaimAirdropTransactionBody, rhs: Proto_TokenClaimAirdropTransactionBody) -> Bool { + if lhs.pendingAirdrops != rhs.pendingAirdrops {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/token_create.pb.swift b/Sources/HederaProtobufs/Services/token_create.pb.swift index 8ec305b6..3ad7c18d 100644 --- a/Sources/HederaProtobufs/Services/token_create.pb.swift +++ b/Sources/HederaProtobufs/Services/token_create.pb.swift @@ -25,39 +25,39 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The specified Treasury Account is receiving the initial supply of tokens as-well as the tokens /// from the Token Mint operation once executed. The balance of the treasury account is decreased /// when the Token Burn operation is executed. -/// +/// /// The initialSupply is the initial supply of the smallest parts of a token (like a /// tinybar, not an hbar). These are the smallest units of the token which may be transferred. -/// +/// /// The supply can change over time. If the total supply at some moment is S parts of tokens, /// and the token is using D decimals, then S must be less than or equal to /// 263-1, which is 9,223,372,036,854,775,807. The number of whole tokens (not parts) will /// be S / 10D. -/// +/// /// If decimals is 8 or 11, then the number of whole tokens can be at most a few billions or /// millions, respectively. For example, it could match Bitcoin (21 million whole tokens with 8 /// decimals) or hbars (50 billion whole tokens with 8 decimals). It could even match Bitcoin with /// milli-satoshis (21 million whole tokens with 11 decimals). -/// +/// /// Note that a created token is immutable if the adminKey is omitted. No property of /// an immutable token can ever change, with the sole exception of its expiry. Anyone can pay to /// extend the expiry time of an immutable token. -/// +/// /// A token can be either FUNGIBLE_COMMON or NON_FUNGIBLE_UNIQUE, based on its /// TokenType. If it has been omitted, FUNGIBLE_COMMON type is used. -/// +/// /// A token can have either INFINITE or FINITE supply type, based on its /// TokenType. If it has been omitted, INFINITE type is used. -/// +/// /// If a FUNGIBLE TokenType is used, initialSupply should explicitly be set to a /// non-negative. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If a NON_FUNGIBLE_UNIQUE TokenType is used, initialSupply should explicitly be set /// to 0. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If an INFINITE TokenSupplyType is used, maxSupply should explicitly be set to 0. If /// it is not 0, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. -/// +/// /// If a FINITE TokenSupplyType is used, maxSupply should be explicitly set to a /// non-negative value. If it is not, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. public struct Proto_TokenCreateTransactionBody { @@ -66,7 +66,7 @@ public struct Proto_TokenCreateTransactionBody { // methods supported on all messages. ///* - /// The publicly visible name of the token. The token name is specified as a Unicode string. + /// The publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} @@ -74,7 +74,7 @@ public struct Proto_TokenCreateTransactionBody { } ///* - /// The publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} diff --git a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift index 3ea00134..b3af176d 100644 --- a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift @@ -21,13 +21,13 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// At consensus, updates a token type's fee schedule to the given list of custom fees. -/// +/// At consensus, updates a token type's fee schedule to the given list of custom fees. +/// /// If the target token type has no fee_schedule_key, resolves to TOKEN_HAS_NO_FEE_SCHEDULE_KEY. -/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will +/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will /// resolve to INVALID_SIGNATURE. -/// -/// If the custom_fees list is empty, clears the fee schedule or resolves to +/// +/// If the custom_fees list is empty, clears the fee schedule or resolves to /// CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES if the fee schedule was already empty. public struct Proto_TokenFeeScheduleUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/token_get_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_info.pb.swift index 6eddd75b..c57cebd9 100644 --- a/Sources/HederaProtobufs/Services/token_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_info.pb.swift @@ -305,7 +305,7 @@ public struct Proto_TokenInfo { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift index 5162e836..e1ebfe93 100644 --- a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift @@ -104,7 +104,7 @@ public struct Proto_TokenNftInfo { public var metadata: Data = Data() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() ///* diff --git a/Sources/HederaProtobufs/Services/token_update.pb.swift b/Sources/HederaProtobufs/Services/token_update.pb.swift index 41bbd503..e5101514 100644 --- a/Sources/HederaProtobufs/Services/token_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_update.pb.swift @@ -22,11 +22,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates an already created token to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged. For an immutable tokens (that is, /// a token without an admin key), only the expiry may be updated. Setting any other field in that /// case will cause the transaction status to resolve to TOKEN_IS_IMMUTABLE. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a token has an admin key, its expiry can be extended with only the transaction /// payer's signature. @@ -36,7 +36,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// token to become immutable. (Other Key structures without a constituent /// Ed25519 key will be rejected with INVALID_ADMIN_KEY.) /// 4. If a new treasury is set, the new treasury account's key must sign the transaction. -/// +/// /// --- Nft Requirements --- /// 1. If a non fungible token has a positive treasury balance, the operation will abort with /// CURRENT_TREASURY_STILL_OWNS_NFTS. @@ -57,7 +57,7 @@ public struct Proto_TokenUpdateTransactionBody { public mutating func clearToken() {_uniqueStorage()._token = nil} ///* - /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} @@ -65,7 +65,7 @@ public struct Proto_TokenUpdateTransactionBody { } ///* - /// The new publicly visible name of the token. The token name is specified as a Unicode string. + /// The new publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} diff --git a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift index c030639c..a232dbad 100644 --- a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift +++ b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift @@ -34,7 +34,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT /// On success, tokens are removed from the account and the total supply of the token is decreased by /// the wiped amount. -/// +/// /// If both amount and serialNumbers get filled, a INVALID_TRANSACTION_BODY response code will be /// returned. /// If the serialNumbers don't get filled for a non-fungible token type, a INVALID_WIPING_AMOUNT response @@ -44,7 +44,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// response code will be returned. /// If the serialNumbers' list count is greater than the batch size limit global dynamic property, a /// BATCH_SIZE_LIMIT_EXCEEDED response code will be returned. -/// +/// /// The amount provided is in the lowest denomination possible. Example: /// Token A has 2 decimals. In order to wipe 100 tokens from account, one must provide amount of /// 10000. In order to wipe 100.55 tokens, one must provide amount of 10055. diff --git a/Sources/HederaProtobufs/Services/transaction.pb.swift b/Sources/HederaProtobufs/Services/transaction.pb.swift index 9eac5db6..6c8d4ba4 100644 --- a/Sources/HederaProtobufs/Services/transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// appear in the transaction. For example, a CryptoTransfer will first have a Signature /// corresponding to the Key for the paying account, followed by a Signature corresponding to the Key /// for each account that is sending or receiving cryptocurrency in the transfer. Each Transaction -/// should not have more than 50 levels. +/// should not have more than 50 levels. /// The SignatureList field is deprecated and succeeded by SignatureMap. public struct Proto_Transaction { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/transaction_body.pb.swift b/Sources/HederaProtobufs/Services/transaction_body.pb.swift index 2586b6b0..a16e53b5 100644 --- a/Sources/HederaProtobufs/Services/transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_body.pb.swift @@ -615,6 +615,36 @@ public struct Proto_TransactionBody { set {_uniqueStorage()._data = .tokenReject(newValue)} } + ///* + /// A transaction body for a `tokenAirdrop` request. + public var tokenAirdrop: Proto_TokenAirdropTransactionBody { + get { + if case .tokenAirdrop(let v)? = _storage._data {return v} + return Proto_TokenAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenAirdrop(newValue)} + } + + ///* + /// A transaction body for a `cancelAirdrop` request. + public var tokenCancelAirdrop: Proto_TokenCancelAirdropTransactionBody { + get { + if case .tokenCancelAirdrop(let v)? = _storage._data {return v} + return Proto_TokenCancelAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenCancelAirdrop(newValue)} + } + + ///* + /// A transaction body for a `claimAirdrop` request. + public var tokenClaimAirdrop: Proto_TokenClaimAirdropTransactionBody { + get { + if case .tokenClaimAirdrop(let v)? = _storage._data {return v} + return Proto_TokenClaimAirdropTransactionBody() + } + set {_uniqueStorage()._data = .tokenClaimAirdrop(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* @@ -793,6 +823,15 @@ public struct Proto_TransactionBody { /// Custom fees and royalties defined for the tokens rejected /// SHALL NOT be charged for this transaction. case tokenReject(Proto_TokenRejectTransactionBody) + ///* + /// A transaction body for a `tokenAirdrop` request. + case tokenAirdrop(Proto_TokenAirdropTransactionBody) + ///* + /// A transaction body for a `cancelAirdrop` request. + case tokenCancelAirdrop(Proto_TokenCancelAirdropTransactionBody) + ///* + /// A transaction body for a `claimAirdrop` request. + case tokenClaimAirdrop(Proto_TokenClaimAirdropTransactionBody) #if !swift(>=4.1) public static func ==(lhs: Proto_TransactionBody.OneOf_Data, rhs: Proto_TransactionBody.OneOf_Data) -> Bool { @@ -1000,6 +1039,18 @@ public struct Proto_TransactionBody { guard case .tokenReject(let l) = lhs, case .tokenReject(let r) = rhs else { preconditionFailure() } return l == r }() + case (.tokenAirdrop, .tokenAirdrop): return { + guard case .tokenAirdrop(let l) = lhs, case .tokenAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.tokenCancelAirdrop, .tokenCancelAirdrop): return { + guard case .tokenCancelAirdrop(let l) = lhs, case .tokenCancelAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.tokenClaimAirdrop, .tokenClaimAirdrop): return { + guard case .tokenClaimAirdrop(let l) = lhs, case .tokenClaimAirdrop(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -1079,6 +1130,9 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm 55: .same(proto: "nodeUpdate"), 56: .same(proto: "nodeDelete"), 57: .same(proto: "tokenReject"), + 58: .same(proto: "tokenAirdrop"), + 59: .same(proto: "tokenCancelAirdrop"), + 60: .same(proto: "tokenClaimAirdrop"), ] fileprivate class _StorageClass { @@ -1784,6 +1838,45 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm _storage._data = .tokenReject(v) } }() + case 58: try { + var v: Proto_TokenAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenAirdrop(v) + } + }() + case 59: try { + var v: Proto_TokenCancelAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenCancelAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenCancelAirdrop(v) + } + }() + case 60: try { + var v: Proto_TokenClaimAirdropTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenClaimAirdrop(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenClaimAirdrop(v) + } + }() default: break } } @@ -2015,6 +2108,18 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm guard case .tokenReject(let v)? = _storage._data else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 57) }() + case .tokenAirdrop?: try { + guard case .tokenAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 58) + }() + case .tokenCancelAirdrop?: try { + guard case .tokenCancelAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 59) + }() + case .tokenClaimAirdrop?: try { + guard case .tokenClaimAirdrop(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 60) + }() case nil: break } } diff --git a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift index 38339db5..06634402 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift @@ -63,8 +63,8 @@ public struct Proto_TransactionGetReceiptQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the receipts of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the receipts of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildReceipts: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -117,7 +117,7 @@ public struct Proto_TransactionGetReceiptResponse { public var duplicateTransactionReceipts: [Proto_TransactionReceipt] = [] ///* - /// The receipts (if any) of all child transactions spawned by the transaction with the + /// The receipts (if any) of all child transactions spawned by the transaction with the /// given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionReceipts: [Proto_TransactionReceipt] = [] diff --git a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift index d0d3a46f..53c1eddc 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift @@ -65,8 +65,8 @@ public struct Proto_TransactionGetRecordQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the records of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the records of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildRecords: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -116,7 +116,7 @@ public struct Proto_TransactionGetRecordResponse { public var duplicateTransactionRecords: [Proto_TransactionRecord] = [] ///* - /// The records of processing all child transaction spawned by the transaction with the given + /// The records of processing all child transaction spawned by the transaction with the given /// top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionRecords: [Proto_TransactionRecord] = [] diff --git a/Sources/HederaProtobufs/Services/transaction_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_record.pb.swift index 4c42bdce..84f367e1 100644 --- a/Sources/HederaProtobufs/Services/transaction_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_record.pb.swift @@ -171,14 +171,14 @@ public struct Proto_TransactionRecord { ///* /// In the record of a CryptoCreate transaction triggered by a user transaction with a - /// (previously unused) alias, the new account's alias. + /// (previously unused) alias, the new account's alias. public var alias: Data { get {return _storage._alias} set {_uniqueStorage()._alias = newValue} } ///* - /// The keccak256 hash of the ethereumData. This field will only be populated for + /// The keccak256 hash of the ethereumData. This field will only be populated for /// EthereumTransaction. public var ethereumHash: Data { get {return _storage._ethereumHash} @@ -225,6 +225,21 @@ public struct Proto_TransactionRecord { set {_uniqueStorage()._evmAddress = newValue} } + ///* + /// A list of pending token airdrops. + /// Each pending airdrop represents a single requested transfer from a + /// sending account to a recipient account. These pending transfers are + /// issued unilaterally by the sending account, and MUST be claimed by the + /// recipient account before the transfer MAY complete. + /// A sender MAY cancel a pending airdrop before it is claimed. + /// An airdrop transaction SHALL emit a pending airdrop when the recipient has no + /// available automatic association slots available or when the recipient + /// has set `receiver_sig_required`. + public var newPendingAirdrops: [Proto_PendingAirdropRecord] { + get {return _storage._newPendingAirdrops} + set {_uniqueStorage()._newPendingAirdrops = newValue} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() public enum OneOf_Body: Equatable { @@ -290,10 +305,53 @@ public struct Proto_TransactionRecord { fileprivate var _storage = _StorageClass.defaultInstance } +///* +/// A record of a new pending airdrop. +public struct Proto_PendingAirdropRecord { + // SwiftProtobuf.Message conformance is added in an extension below. See the + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for + // methods supported on all messages. + + ///* + /// A unique, composite, identifier for a pending airdrop. + /// This field is REQUIRED. + public var pendingAirdropID: Proto_PendingAirdropId { + get {return _pendingAirdropID ?? Proto_PendingAirdropId()} + set {_pendingAirdropID = newValue} + } + /// Returns true if `pendingAirdropID` has been explicitly set. + public var hasPendingAirdropID: Bool {return self._pendingAirdropID != nil} + /// Clears the value of `pendingAirdropID`. Subsequent reads from it will return its default value. + public mutating func clearPendingAirdropID() {self._pendingAirdropID = nil} + + ///* + /// A single pending airdrop amount. + /// If the pending airdrop is for a fungible/common token this field is REQUIRED + /// and SHALL be the current amount of tokens offered. + /// If the pending airdrop is for a non-fungible/unique token, this field SHALL NOT + /// be set. + public var pendingAirdropValue: Proto_PendingAirdropValue { + get {return _pendingAirdropValue ?? Proto_PendingAirdropValue()} + set {_pendingAirdropValue = newValue} + } + /// Returns true if `pendingAirdropValue` has been explicitly set. + public var hasPendingAirdropValue: Bool {return self._pendingAirdropValue != nil} + /// Clears the value of `pendingAirdropValue`. Subsequent reads from it will return its default value. + public mutating func clearPendingAirdropValue() {self._pendingAirdropValue = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _pendingAirdropID: Proto_PendingAirdropId? = nil + fileprivate var _pendingAirdropValue: Proto_PendingAirdropValue? = nil +} + #if swift(>=5.5) && canImport(_Concurrency) extension Proto_TransactionRecord: @unchecked Sendable {} extension Proto_TransactionRecord.OneOf_Body: @unchecked Sendable {} extension Proto_TransactionRecord.OneOf_Entropy: @unchecked Sendable {} +extension Proto_PendingAirdropRecord: @unchecked Sendable {} #endif // swift(>=5.5) && canImport(_Concurrency) // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -323,6 +381,7 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message 19: .standard(proto: "prng_bytes"), 20: .standard(proto: "prng_number"), 21: .standard(proto: "evm_address"), + 22: .standard(proto: "new_pending_airdrops"), ] fileprivate class _StorageClass { @@ -344,6 +403,7 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message var _paidStakingRewards: [Proto_AccountAmount] = [] var _entropy: Proto_TransactionRecord.OneOf_Entropy? var _evmAddress: Data = Data() + var _newPendingAirdrops: [Proto_PendingAirdropRecord] = [] #if swift(>=5.10) // This property is used as the initial default value for new instances of the type. @@ -376,6 +436,7 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message _paidStakingRewards = source._paidStakingRewards _entropy = source._entropy _evmAddress = source._evmAddress + _newPendingAirdrops = source._newPendingAirdrops } } @@ -452,6 +513,7 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message } }() case 21: try { try decoder.decodeSingularBytesField(value: &_storage._evmAddress) }() + case 22: try { try decoder.decodeRepeatedMessageField(value: &_storage._newPendingAirdrops) }() default: break } } @@ -534,6 +596,9 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message if !_storage._evmAddress.isEmpty { try visitor.visitSingularBytesField(value: _storage._evmAddress, fieldNumber: 21) } + if !_storage._newPendingAirdrops.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._newPendingAirdrops, fieldNumber: 22) + } } try unknownFields.traverse(visitor: &visitor) } @@ -561,6 +626,7 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message if _storage._paidStakingRewards != rhs_storage._paidStakingRewards {return false} if _storage._entropy != rhs_storage._entropy {return false} if _storage._evmAddress != rhs_storage._evmAddress {return false} + if _storage._newPendingAirdrops != rhs_storage._newPendingAirdrops {return false} return true } if !storagesAreEqual {return false} @@ -569,3 +635,45 @@ extension Proto_TransactionRecord: SwiftProtobuf.Message, SwiftProtobuf._Message return true } } + +extension Proto_PendingAirdropRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".PendingAirdropRecord" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "pending_airdrop_id"), + 2: .standard(proto: "pending_airdrop_value"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularMessageField(value: &self._pendingAirdropID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._pendingAirdropValue) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every if/case branch local when no optimizations + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and + // https://github.com/apple/swift-protobuf/issues/1182 + try { if let v = self._pendingAirdropID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._pendingAirdropValue { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_PendingAirdropRecord, rhs: Proto_PendingAirdropRecord) -> Bool { + if lhs._pendingAirdropID != rhs._pendingAirdropID {return false} + if lhs._pendingAirdropValue != rhs._pendingAirdropValue {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift index 88153db3..d0c0918d 100644 --- a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift +++ b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Submit an arbitrary (serialized) Transaction to the network without prechecks. Requires superuser -/// privileges. +/// privileges. public struct Proto_UncheckedSubmitBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/protobufs b/protobufs index f3ebaed1..d88484a3 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit f3ebaed10173a074931650a546dd89dbc3d87cd8 +Subproject commit d88484a3b2e2100b1b9a7ed77d476baf80a58303 From 5e1e3261a91f4076eda47517dd03022b1eaca4b7 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Mon, 12 Aug 2024 15:32:40 -0700 Subject: [PATCH 02/11] chore: add new proto defintions Signed-off-by: Ricky Saechao --- Sources/Hedera/AnyTransaction.swift | 3 + Sources/Hedera/FeeSchedule/RequestType.swift | 16 + Sources/Hedera/Schedule/ScheduleInfo.swift | 3 + .../Services/address_book_service.grpc.swift | 944 ++++++++++++++++++ .../Services/basic_types.pb.swift | 2 +- .../Services/consensus_topic_info.pb.swift | 4 +- .../Services/contract_call_local.pb.swift | 46 +- .../Services/contract_create.pb.swift | 8 +- .../Services/contract_delete.pb.swift | 6 +- .../Services/contract_get_info.pb.swift | 8 +- .../Services/contract_update.pb.swift | 6 +- .../Services/crypto_add_live_hash.pb.swift | 2 +- .../crypto_approve_allowance.pb.swift | 2 +- .../Services/crypto_create.pb.swift | 4 +- .../crypto_get_account_balance.pb.swift | 6 +- .../Services/crypto_get_info.pb.swift | 8 +- .../Services/crypto_transfer.pb.swift | 2 +- .../Services/crypto_update.pb.swift | 4 +- .../Services/custom_fees.pb.swift | 26 +- .../Services/ethereum_transaction.pb.swift | 18 +- .../Services/exchange_rate.pb.swift | 2 +- .../Services/file_append.pb.swift | 2 +- .../Services/file_create.pb.swift | 4 +- .../Services/file_get_info.pb.swift | 2 +- .../Services/file_update.pb.swift | 2 +- .../Services/freeze_type.pb.swift | 26 +- .../network_get_execution_time.pb.swift | 6 +- .../Services/node_stake_update.pb.swift | 30 +- .../Services/query_header.pb.swift | 4 +- .../Services/schedule_create.pb.swift | 20 +- .../Services/schedule_delete.pb.swift | 2 +- .../Services/schedule_get_info.pb.swift | 4 +- .../Services/schedule_sign.pb.swift | 6 +- .../Services/state_consensus_topic.pb.swift | 16 +- .../state_contract_storage_slot.pb.swift | 8 +- .../Services/state_token_nft.pb.swift | 4 +- .../Services/system_delete.pb.swift | 2 +- .../Services/system_undelete.pb.swift | 2 +- .../Services/throttle_definitions.pb.swift | 4 +- .../Services/token_burn.pb.swift | 2 +- .../Services/token_create.pb.swift | 24 +- .../token_fee_schedule_update.pb.swift | 10 +- .../Services/token_get_info.pb.swift | 2 +- .../Services/token_get_nft_info.pb.swift | 2 +- .../Services/token_update.pb.swift | 10 +- .../Services/token_wipe_account.pb.swift | 4 +- .../Services/transaction.pb.swift | 2 +- .../Services/transaction_get_receipt.pb.swift | 6 +- .../Services/transaction_get_record.pb.swift | 6 +- .../Services/transaction_record.pb.swift | 4 +- .../Services/unchecked_submit.pb.swift | 2 +- 51 files changed, 1152 insertions(+), 186 deletions(-) create mode 100644 Sources/HederaProtobufs/Services/address_book_service.grpc.swift diff --git a/Sources/Hedera/AnyTransaction.swift b/Sources/Hedera/AnyTransaction.swift index 5e9c617d..9d4c2110 100644 --- a/Sources/Hedera/AnyTransaction.swift +++ b/Sources/Hedera/AnyTransaction.swift @@ -308,6 +308,9 @@ extension ServicesTransactionDataList: TryFromProtobuf { case .nodeCreate: throw HError.fromProtobuf("Unsupported transaction `NodeCreateTransaction`") case .nodeUpdate: throw HError.fromProtobuf("Unsupported transaction `NodeUpdateTransaction`") case .tokenReject(let data): value = .tokenReject([data]) + case .tokenAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenAirdropTransaction`") + case .tokenCancelAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenCancelAirdropTransaction`") + case .tokenClaimAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenClaimAirdropTransaction`") } for transaction in iter { diff --git a/Sources/Hedera/FeeSchedule/RequestType.swift b/Sources/Hedera/FeeSchedule/RequestType.swift index d6373c97..b94c88a3 100644 --- a/Sources/Hedera/FeeSchedule/RequestType.swift +++ b/Sources/Hedera/FeeSchedule/RequestType.swift @@ -259,6 +259,16 @@ public enum RequestType { /// Reject a Token case tokenReject + /// Airdrop one or more tokens to one or more accounts. + case tokenAirdrop + + /// Remove one or more pending airdrops from state on + /// behalf of the sender(s) for each airdrop. + case tokenCancelAirdrop + + /// Claim one or more pending airdrops + case tokenClaimAirdrop + // this literally can't be smaller. // swiftlint:disable:next function_body_length internal init?(protobuf proto: Proto_HederaFunctionality) throws { @@ -342,6 +352,9 @@ public enum RequestType { case .nodeDelete: self = .nodeDelete case .nodeUpdate: self = .nodeUpdate case .tokenReject: self = .tokenReject + case .tokenAirdrop: self = .tokenAirdrop + case .tokenCancelAirdrop: self = .tokenCancelAirdrop + case .tokenClaimAirdrop: self = .tokenClaimAirdrop case .UNRECOGNIZED(let code): throw HError.fromProtobuf("unrecognized RequestType: `\(code)`") @@ -428,6 +441,9 @@ public enum RequestType { case .nodeUpdate: return .nodeUpdate case .nodeDelete: return .nodeDelete case .tokenReject: return .tokenReject + case .tokenAirdrop: return .tokenAirdrop + case .tokenCancelAirdrop: return .tokenCancelAirdrop + case .tokenClaimAirdrop: return .tokenClaimAirdrop } } } diff --git a/Sources/Hedera/Schedule/ScheduleInfo.swift b/Sources/Hedera/Schedule/ScheduleInfo.swift index 5278ceb8..e9c361bd 100644 --- a/Sources/Hedera/Schedule/ScheduleInfo.swift +++ b/Sources/Hedera/Schedule/ScheduleInfo.swift @@ -116,6 +116,9 @@ public struct ScheduleInfo: Sendable { case .nodeUpdate(let data): proto.data = .nodeUpdate(data) case .nodeDelete(let data): proto.data = .nodeDelete(data) case .tokenReject(let data): proto.data = .tokenReject(data) + case .tokenAirdrop(let data): proto.data = .tokenAirdrop(data) + case .tokenCancelAirdrop(let data): proto.data = .tokenCancelAirdrop(data) + case .tokenClaimAirdrop(let data): proto.data = .tokenClaimAirdrop(data) case nil: break } diff --git a/Sources/HederaProtobufs/Services/address_book_service.grpc.swift b/Sources/HederaProtobufs/Services/address_book_service.grpc.swift new file mode 100644 index 00000000..cf693bc5 --- /dev/null +++ b/Sources/HederaProtobufs/Services/address_book_service.grpc.swift @@ -0,0 +1,944 @@ +// +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the protocol buffer compiler. +// Source: address_book_service.proto +// +import GRPC +import NIO +import NIOConcurrencyHelpers +import SwiftProtobuf + + +///* +/// The Address Book service provides the ability for Hedera network node +/// administrators to add, update, and remove consensus nodes. This addition, +/// update, or removal of a consensus node requires governing council approval, +/// but each node operator may update their own operational attributes without +/// additional approval, reducing overhead for routine operations. +/// +/// Most operations are `privileged operations` and require governing council +/// approval. +/// +/// ### For a node creation transaction. +/// - The node operator SHALL create a `createNode` transaction. +/// - The node operator SHALL sign this transaction with the active `key` for +/// the account to be assigned as the "node account". +/// - The node operator MUST deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node creation transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Validate the signature of the active `key` for the account to be +/// assigned as the "node account". +/// - Create the new node in state, this new node SHALL NOT be active in the +/// network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and bring the +/// new node to an active status within the network. The node to be added +/// SHALL be active in the network following this upgrade. +/// +/// ### For a node deletion transaction. +/// - The node operator or Hedera council representative SHALL create a +/// `deleteNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the "node account". +/// - The node operator SHALL deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node deletion transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Remove the existing node from network state. The node SHALL still +/// be active in the network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and remove the +/// node to be deleted from the network. The node to be deleted SHALL NOT +/// be active in the network following this upgrade. +/// +/// ### For a node update transaction. +/// - The node operator or Hedera council representative SHALL create an +/// `updateNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the current "node account". +/// - If the transaction changes the value of the "node account" the +/// node operator MUST _also_ sign this transaction with the active `key` +/// for the account to be assigned as the new "node account". +/// - The node operator SHALL submit the transaction to the +/// network. Hedera council approval SHALL NOT be sought for this +/// transaction +/// - If the Hedera council representative creates the transaction +/// - The Hedera council representative SHALL arrange for council members +/// to review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node update transaction the network +/// software SHALL +/// - If the transaction is signed by the Hedera governing council +/// - Validate the threshold signature for the Hedera governing council +/// - If the transaction is signed by the active `key` for the node account +/// - Validate the signature of the active `key` for the account assigned +/// as the "node account". +/// - If the transaction modifies the value of the "node account", +/// - Validate the signature of the _new_ `key` for the account to be +/// assigned as the new "node account". +/// - Modify the node information held in network state with the changes +/// requested in the update transaction. The node changes SHALL NOT be +/// applied to network configuration, and SHALL NOT affect network +/// operation at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration according to the +/// modified information in network state. The requested changes SHALL +/// affect network operation following this upgrade. +/// +/// Usage: instantiate `Proto_AddressBookServiceClient`, then call methods of this protocol to make API calls. +public protocol Proto_AddressBookServiceClientProtocol: GRPCClient { + var serviceName: String { get } + var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? { get } + + func createNode( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func deleteNode( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func updateNode( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall +} + +extension Proto_AddressBookServiceClientProtocol { + public var serviceName: String { + return "proto.AddressBookService" + } + + ///* + /// A transaction to create a new consensus node in the network. + /// address book. + ///

+ /// This transaction, once complete, SHALL add a new consensus node to the + /// network state.
+ /// The new consensus node SHALL remain in state, but SHALL NOT participate + /// in network consensus until the network updates the network configuration. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + /// + /// - Parameters: + /// - request: Request to send to createNode. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func createNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.createNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [] + ) + } + + ///* + /// A transaction to remove a consensus node from the network address + /// book. + ///

+ /// This transaction, once complete, SHALL remove the identified consensus + /// node from the network state. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + /// + /// - Parameters: + /// - request: Request to send to deleteNode. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func deleteNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.deleteNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [] + ) + } + + ///* + /// A transaction to update an existing consensus node from the network + /// address book. + ///

+ /// This transaction, once complete, SHALL modify the identified consensus + /// node state as requested. + ///

+ /// This transaction MAY be authorized by either the node operator OR the + /// Hedera governing council. + /// + /// - Parameters: + /// - request: Request to send to updateNode. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func updateNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.updateNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [] + ) + } +} + +@available(*, deprecated) +extension Proto_AddressBookServiceClient: @unchecked Sendable {} + +@available(*, deprecated, renamed: "Proto_AddressBookServiceNIOClient") +public final class Proto_AddressBookServiceClient: Proto_AddressBookServiceClientProtocol { + private let lock = Lock() + private var _defaultCallOptions: CallOptions + private var _interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? + public let channel: GRPCChannel + public var defaultCallOptions: CallOptions { + get { self.lock.withLock { return self._defaultCallOptions } } + set { self.lock.withLockVoid { self._defaultCallOptions = newValue } } + } + public var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? { + get { self.lock.withLock { return self._interceptors } } + set { self.lock.withLockVoid { self._interceptors = newValue } } + } + + /// Creates a client for the proto.AddressBookService service. + /// + /// - Parameters: + /// - channel: `GRPCChannel` to the service host. + /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. + /// - interceptors: A factory providing interceptors for each RPC. + public init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self._defaultCallOptions = defaultCallOptions + self._interceptors = interceptors + } +} + +public struct Proto_AddressBookServiceNIOClient: Proto_AddressBookServiceClientProtocol { + public var channel: GRPCChannel + public var defaultCallOptions: CallOptions + public var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? + + /// Creates a client for the proto.AddressBookService service. + /// + /// - Parameters: + /// - channel: `GRPCChannel` to the service host. + /// - defaultCallOptions: Options to use for each service call if the user doesn't provide them. + /// - interceptors: A factory providing interceptors for each RPC. + public init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self.defaultCallOptions = defaultCallOptions + self.interceptors = interceptors + } +} + +///* +/// The Address Book service provides the ability for Hedera network node +/// administrators to add, update, and remove consensus nodes. This addition, +/// update, or removal of a consensus node requires governing council approval, +/// but each node operator may update their own operational attributes without +/// additional approval, reducing overhead for routine operations. +/// +/// Most operations are `privileged operations` and require governing council +/// approval. +/// +/// ### For a node creation transaction. +/// - The node operator SHALL create a `createNode` transaction. +/// - The node operator SHALL sign this transaction with the active `key` for +/// the account to be assigned as the "node account". +/// - The node operator MUST deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node creation transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Validate the signature of the active `key` for the account to be +/// assigned as the "node account". +/// - Create the new node in state, this new node SHALL NOT be active in the +/// network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and bring the +/// new node to an active status within the network. The node to be added +/// SHALL be active in the network following this upgrade. +/// +/// ### For a node deletion transaction. +/// - The node operator or Hedera council representative SHALL create a +/// `deleteNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the "node account". +/// - The node operator SHALL deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node deletion transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Remove the existing node from network state. The node SHALL still +/// be active in the network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and remove the +/// node to be deleted from the network. The node to be deleted SHALL NOT +/// be active in the network following this upgrade. +/// +/// ### For a node update transaction. +/// - The node operator or Hedera council representative SHALL create an +/// `updateNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the current "node account". +/// - If the transaction changes the value of the "node account" the +/// node operator MUST _also_ sign this transaction with the active `key` +/// for the account to be assigned as the new "node account". +/// - The node operator SHALL submit the transaction to the +/// network. Hedera council approval SHALL NOT be sought for this +/// transaction +/// - If the Hedera council representative creates the transaction +/// - The Hedera council representative SHALL arrange for council members +/// to review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node update transaction the network +/// software SHALL +/// - If the transaction is signed by the Hedera governing council +/// - Validate the threshold signature for the Hedera governing council +/// - If the transaction is signed by the active `key` for the node account +/// - Validate the signature of the active `key` for the account assigned +/// as the "node account". +/// - If the transaction modifies the value of the "node account", +/// - Validate the signature of the _new_ `key` for the account to be +/// assigned as the new "node account". +/// - Modify the node information held in network state with the changes +/// requested in the update transaction. The node changes SHALL NOT be +/// applied to network configuration, and SHALL NOT affect network +/// operation at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration according to the +/// modified information in network state. The requested changes SHALL +/// affect network operation following this upgrade. +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +public protocol Proto_AddressBookServiceAsyncClientProtocol: GRPCClient { + static var serviceDescriptor: GRPCServiceDescriptor { get } + var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? { get } + + func makeCreateNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeDeleteNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeUpdateNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Proto_AddressBookServiceAsyncClientProtocol { + public static var serviceDescriptor: GRPCServiceDescriptor { + return Proto_AddressBookServiceClientMetadata.serviceDescriptor + } + + public var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? { + return nil + } + + public func makeCreateNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.createNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [] + ) + } + + public func makeDeleteNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.deleteNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [] + ) + } + + public func makeUpdateNodeCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.updateNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [] + ) + } +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Proto_AddressBookServiceAsyncClientProtocol { + public func createNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.createNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [] + ) + } + + public func deleteNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.deleteNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [] + ) + } + + public func updateNode( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_AddressBookServiceClientMetadata.Methods.updateNode.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [] + ) + } +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +public struct Proto_AddressBookServiceAsyncClient: Proto_AddressBookServiceAsyncClientProtocol { + public var channel: GRPCChannel + public var defaultCallOptions: CallOptions + public var interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? + + public init( + channel: GRPCChannel, + defaultCallOptions: CallOptions = CallOptions(), + interceptors: Proto_AddressBookServiceClientInterceptorFactoryProtocol? = nil + ) { + self.channel = channel + self.defaultCallOptions = defaultCallOptions + self.interceptors = interceptors + } +} + +public protocol Proto_AddressBookServiceClientInterceptorFactoryProtocol: Sendable { + + /// - Returns: Interceptors to use when invoking 'createNode'. + func makecreateNodeInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'deleteNode'. + func makedeleteNodeInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'updateNode'. + func makeupdateNodeInterceptors() -> [ClientInterceptor] +} + +public enum Proto_AddressBookServiceClientMetadata { + public static let serviceDescriptor = GRPCServiceDescriptor( + name: "AddressBookService", + fullName: "proto.AddressBookService", + methods: [ + Proto_AddressBookServiceClientMetadata.Methods.createNode, + Proto_AddressBookServiceClientMetadata.Methods.deleteNode, + Proto_AddressBookServiceClientMetadata.Methods.updateNode, + ] + ) + + public enum Methods { + public static let createNode = GRPCMethodDescriptor( + name: "createNode", + path: "/proto.AddressBookService/createNode", + type: GRPCCallType.unary + ) + + public static let deleteNode = GRPCMethodDescriptor( + name: "deleteNode", + path: "/proto.AddressBookService/deleteNode", + type: GRPCCallType.unary + ) + + public static let updateNode = GRPCMethodDescriptor( + name: "updateNode", + path: "/proto.AddressBookService/updateNode", + type: GRPCCallType.unary + ) + } +} + +///* +/// The Address Book service provides the ability for Hedera network node +/// administrators to add, update, and remove consensus nodes. This addition, +/// update, or removal of a consensus node requires governing council approval, +/// but each node operator may update their own operational attributes without +/// additional approval, reducing overhead for routine operations. +/// +/// Most operations are `privileged operations` and require governing council +/// approval. +/// +/// ### For a node creation transaction. +/// - The node operator SHALL create a `createNode` transaction. +/// - The node operator SHALL sign this transaction with the active `key` for +/// the account to be assigned as the "node account". +/// - The node operator MUST deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node creation transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Validate the signature of the active `key` for the account to be +/// assigned as the "node account". +/// - Create the new node in state, this new node SHALL NOT be active in the +/// network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and bring the +/// new node to an active status within the network. The node to be added +/// SHALL be active in the network following this upgrade. +/// +/// ### For a node deletion transaction. +/// - The node operator or Hedera council representative SHALL create a +/// `deleteNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the "node account". +/// - The node operator SHALL deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node deletion transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Remove the existing node from network state. The node SHALL still +/// be active in the network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and remove the +/// node to be deleted from the network. The node to be deleted SHALL NOT +/// be active in the network following this upgrade. +/// +/// ### For a node update transaction. +/// - The node operator or Hedera council representative SHALL create an +/// `updateNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the current "node account". +/// - If the transaction changes the value of the "node account" the +/// node operator MUST _also_ sign this transaction with the active `key` +/// for the account to be assigned as the new "node account". +/// - The node operator SHALL submit the transaction to the +/// network. Hedera council approval SHALL NOT be sought for this +/// transaction +/// - If the Hedera council representative creates the transaction +/// - The Hedera council representative SHALL arrange for council members +/// to review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node update transaction the network +/// software SHALL +/// - If the transaction is signed by the Hedera governing council +/// - Validate the threshold signature for the Hedera governing council +/// - If the transaction is signed by the active `key` for the node account +/// - Validate the signature of the active `key` for the account assigned +/// as the "node account". +/// - If the transaction modifies the value of the "node account", +/// - Validate the signature of the _new_ `key` for the account to be +/// assigned as the new "node account". +/// - Modify the node information held in network state with the changes +/// requested in the update transaction. The node changes SHALL NOT be +/// applied to network configuration, and SHALL NOT affect network +/// operation at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration according to the +/// modified information in network state. The requested changes SHALL +/// affect network operation following this upgrade. +/// +/// To build a server, implement a class that conforms to this protocol. +public protocol Proto_AddressBookServiceProvider: CallHandlerProvider { + var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { get } + + ///* + /// A transaction to create a new consensus node in the network. + /// address book. + ///

+ /// This transaction, once complete, SHALL add a new consensus node to the + /// network state.
+ /// The new consensus node SHALL remain in state, but SHALL NOT participate + /// in network consensus until the network updates the network configuration. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + func createNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture + + ///* + /// A transaction to remove a consensus node from the network address + /// book. + ///

+ /// This transaction, once complete, SHALL remove the identified consensus + /// node from the network state. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + func deleteNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture + + ///* + /// A transaction to update an existing consensus node from the network + /// address book. + ///

+ /// This transaction, once complete, SHALL modify the identified consensus + /// node state as requested. + ///

+ /// This transaction MAY be authorized by either the node operator OR the + /// Hedera governing council. + func updateNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture +} + +extension Proto_AddressBookServiceProvider { + public var serviceName: Substring { + return Proto_AddressBookServiceServerMetadata.serviceDescriptor.fullName[...] + } + + /// Determines, calls and returns the appropriate request handler, depending on the request's method. + /// Returns nil for methods not handled by this service. + public func handle( + method name: Substring, + context: CallHandlerContext + ) -> GRPCServerHandlerProtocol? { + switch name { + case "createNode": + return UnaryServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [], + userFunction: self.createNode(request:context:) + ) + + case "deleteNode": + return UnaryServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [], + userFunction: self.deleteNode(request:context:) + ) + + case "updateNode": + return UnaryServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [], + userFunction: self.updateNode(request:context:) + ) + + default: + return nil + } + } +} + +///* +/// The Address Book service provides the ability for Hedera network node +/// administrators to add, update, and remove consensus nodes. This addition, +/// update, or removal of a consensus node requires governing council approval, +/// but each node operator may update their own operational attributes without +/// additional approval, reducing overhead for routine operations. +/// +/// Most operations are `privileged operations` and require governing council +/// approval. +/// +/// ### For a node creation transaction. +/// - The node operator SHALL create a `createNode` transaction. +/// - The node operator SHALL sign this transaction with the active `key` for +/// the account to be assigned as the "node account". +/// - The node operator MUST deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node creation transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Validate the signature of the active `key` for the account to be +/// assigned as the "node account". +/// - Create the new node in state, this new node SHALL NOT be active in the +/// network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and bring the +/// new node to an active status within the network. The node to be added +/// SHALL be active in the network following this upgrade. +/// +/// ### For a node deletion transaction. +/// - The node operator or Hedera council representative SHALL create a +/// `deleteNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the "node account". +/// - The node operator SHALL deliver the signed transaction to the Hedera +/// council representative. +/// - The Hedera council representative SHALL arrange for council members to +/// review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node deletion transaction the network +/// software SHALL +/// - Validate the threshold signature for the Hedera governing council +/// - Remove the existing node from network state. The node SHALL still +/// be active in the network at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration and remove the +/// node to be deleted from the network. The node to be deleted SHALL NOT +/// be active in the network following this upgrade. +/// +/// ### For a node update transaction. +/// - The node operator or Hedera council representative SHALL create an +/// `updateNode` transaction. +/// - If the node operator creates the transaction +/// - The node operator MUST sign this transaction with the active `key` +/// for the account assigned as the current "node account". +/// - If the transaction changes the value of the "node account" the +/// node operator MUST _also_ sign this transaction with the active `key` +/// for the account to be assigned as the new "node account". +/// - The node operator SHALL submit the transaction to the +/// network. Hedera council approval SHALL NOT be sought for this +/// transaction +/// - If the Hedera council representative creates the transaction +/// - The Hedera council representative SHALL arrange for council members +/// to review and sign the transaction. +/// - Once sufficient council members have signed the transaction, the +/// Hedera council representative SHALL submit the transaction to the +/// network. +/// - Upon receipt of a valid and signed node update transaction the network +/// software SHALL +/// - If the transaction is signed by the Hedera governing council +/// - Validate the threshold signature for the Hedera governing council +/// - If the transaction is signed by the active `key` for the node account +/// - Validate the signature of the active `key` for the account assigned +/// as the "node account". +/// - If the transaction modifies the value of the "node account", +/// - Validate the signature of the _new_ `key` for the account to be +/// assigned as the new "node account". +/// - Modify the node information held in network state with the changes +/// requested in the update transaction. The node changes SHALL NOT be +/// applied to network configuration, and SHALL NOT affect network +/// operation at this time. +/// - When executing the next `freeze` transaction with `freeze_type` set to +/// `PREPARE_UPGRADE`, update network configuration according to the +/// modified information in network state. The requested changes SHALL +/// affect network operation following this upgrade. +/// +/// To implement a server, implement an object which conforms to this protocol. +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +public protocol Proto_AddressBookServiceAsyncProvider: CallHandlerProvider, Sendable { + static var serviceDescriptor: GRPCServiceDescriptor { get } + var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { get } + + ///* + /// A transaction to create a new consensus node in the network. + /// address book. + ///

+ /// This transaction, once complete, SHALL add a new consensus node to the + /// network state.
+ /// The new consensus node SHALL remain in state, but SHALL NOT participate + /// in network consensus until the network updates the network configuration. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + func createNode( + request: Proto_Transaction, + context: GRPCAsyncServerCallContext + ) async throws -> Proto_TransactionResponse + + ///* + /// A transaction to remove a consensus node from the network address + /// book. + ///

+ /// This transaction, once complete, SHALL remove the identified consensus + /// node from the network state. + ///

+ /// Hedera governing council authorization is REQUIRED for this transaction. + func deleteNode( + request: Proto_Transaction, + context: GRPCAsyncServerCallContext + ) async throws -> Proto_TransactionResponse + + ///* + /// A transaction to update an existing consensus node from the network + /// address book. + ///

+ /// This transaction, once complete, SHALL modify the identified consensus + /// node state as requested. + ///

+ /// This transaction MAY be authorized by either the node operator OR the + /// Hedera governing council. + func updateNode( + request: Proto_Transaction, + context: GRPCAsyncServerCallContext + ) async throws -> Proto_TransactionResponse +} + +@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) +extension Proto_AddressBookServiceAsyncProvider { + public static var serviceDescriptor: GRPCServiceDescriptor { + return Proto_AddressBookServiceServerMetadata.serviceDescriptor + } + + public var serviceName: Substring { + return Proto_AddressBookServiceServerMetadata.serviceDescriptor.fullName[...] + } + + public var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { + return nil + } + + public func handle( + method name: Substring, + context: CallHandlerContext + ) -> GRPCServerHandlerProtocol? { + switch name { + case "createNode": + return GRPCAsyncServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [], + wrapping: { try await self.createNode(request: $0, context: $1) } + ) + + case "deleteNode": + return GRPCAsyncServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [], + wrapping: { try await self.deleteNode(request: $0, context: $1) } + ) + + case "updateNode": + return GRPCAsyncServerHandler( + context: context, + requestDeserializer: ProtobufDeserializer(), + responseSerializer: ProtobufSerializer(), + interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [], + wrapping: { try await self.updateNode(request: $0, context: $1) } + ) + + default: + return nil + } + } +} + +public protocol Proto_AddressBookServiceServerInterceptorFactoryProtocol: Sendable { + + /// - Returns: Interceptors to use when handling 'createNode'. + /// Defaults to calling `self.makeInterceptors()`. + func makecreateNodeInterceptors() -> [ServerInterceptor] + + /// - Returns: Interceptors to use when handling 'deleteNode'. + /// Defaults to calling `self.makeInterceptors()`. + func makedeleteNodeInterceptors() -> [ServerInterceptor] + + /// - Returns: Interceptors to use when handling 'updateNode'. + /// Defaults to calling `self.makeInterceptors()`. + func makeupdateNodeInterceptors() -> [ServerInterceptor] +} + +public enum Proto_AddressBookServiceServerMetadata { + public static let serviceDescriptor = GRPCServiceDescriptor( + name: "AddressBookService", + fullName: "proto.AddressBookService", + methods: [ + Proto_AddressBookServiceServerMetadata.Methods.createNode, + Proto_AddressBookServiceServerMetadata.Methods.deleteNode, + Proto_AddressBookServiceServerMetadata.Methods.updateNode, + ] + ) + + public enum Methods { + public static let createNode = GRPCMethodDescriptor( + name: "createNode", + path: "/proto.AddressBookService/createNode", + type: GRPCCallType.unary + ) + + public static let deleteNode = GRPCMethodDescriptor( + name: "deleteNode", + path: "/proto.AddressBookService/deleteNode", + type: GRPCCallType.unary + ) + + public static let updateNode = GRPCMethodDescriptor( + name: "updateNode", + path: "/proto.AddressBookService/updateNode", + type: GRPCCallType.unary + ) + } +} diff --git a/Sources/HederaProtobufs/Services/basic_types.pb.swift b/Sources/HederaProtobufs/Services/basic_types.pb.swift index 242d78e5..5d0c428f 100644 --- a/Sources/HederaProtobufs/Services/basic_types.pb.swift +++ b/Sources/HederaProtobufs/Services/basic_types.pb.swift @@ -2778,7 +2778,7 @@ public struct Proto_TokenBalances { public init() {} } -/// A token - account association +/// A token - account association public struct Proto_TokenAssociation { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift index 97ea29ce..242d2db5 100644 --- a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift @@ -35,7 +35,7 @@ public struct Proto_ConsensusTopicInfo { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data = Data() @@ -103,7 +103,7 @@ public struct Proto_ConsensusTopicInfo { public mutating func clearAutoRenewAccount() {self._autoRenewAccount = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() diff --git a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift index 9db33ecd..a4ead51e 100644 --- a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift @@ -116,11 +116,11 @@ public struct Proto_ContractFunctionResult { ///* /// [DEPRECATED] the list of smart contracts that were created by the function call. - /// - /// The created ids will now _also_ be externalized through internal transaction - /// records, where each record has its alias field populated with the new contract's - /// EVM address. (This is needed for contracts created with CREATE2, since - /// there is no longer a simple relationship between the new contract's 0.0.X id + /// + /// The created ids will now _also_ be externalized through internal transaction + /// records, where each record has its alias field populated with the new contract's + /// EVM address. (This is needed for contracts created with CREATE2, since + /// there is no longer a simple relationship between the new contract's 0.0.X id /// and its Solidity address.) public var createdContractIds: [Proto_ContractID] { get {return _storage._createdContractIds} @@ -128,24 +128,24 @@ public struct Proto_ContractFunctionResult { } ///* - /// The new contract's 20-byte EVM address. Only populated after release 0.23, - /// where each created contract will have its own record. (This is an important - /// point--the field is not repeated because there will be a separate + /// The new contract's 20-byte EVM address. Only populated after release 0.23, + /// where each created contract will have its own record. (This is an important + /// point--the field is not repeated because there will be a separate /// child record for each created contract.) - /// + /// /// Every contract has an EVM address determined by its shard.realm.num id. /// This address is as follows: ///

    ///
  1. The first 4 bytes are the big-endian representation of the shard.
  2. ///
  3. The next 8 bytes are the big-endian representation of the realm.
  4. ///
  5. The final 8 bytes are the big-endian representation of the number.
  6. - ///
- /// - /// Contracts created via CREATE2 have an additional, primary address that is - /// derived from the EIP-1014 - /// specification, and does not have a simple relation to a shard.realm.num id. - /// - /// (Please do note that CREATE2 contracts can also be referenced by the three-part + /// + /// + /// Contracts created via CREATE2 have an additional, primary address that is + /// derived from the EIP-1014 + /// specification, and does not have a simple relation to a shard.realm.num id. + /// + /// (Please do note that CREATE2 contracts can also be referenced by the three-part /// EVM address described above.) public var evmAddress: SwiftProtobuf.Google_Protobuf_BytesValue { get {return _storage._evmAddress ?? SwiftProtobuf.Google_Protobuf_BytesValue()} @@ -157,10 +157,10 @@ public struct Proto_ContractFunctionResult { public mutating func clearEvmAddress() {_uniqueStorage()._evmAddress = nil} ///* - /// The amount of gas available for the call, aka the gasLimit. + /// The amount of gas available for the call, aka the gasLimit. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var gas: Int64 { get {return _storage._gas} set {_uniqueStorage()._gas = newValue} @@ -170,7 +170,7 @@ public struct Proto_ContractFunctionResult { /// Number of tinybars sent (the function must be payable if this is nonzero). /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var amount: Int64 { get {return _storage._amount} set {_uniqueStorage()._amount = newValue} @@ -180,7 +180,7 @@ public struct Proto_ContractFunctionResult { /// The parameters passed into the contract call. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var functionParameters: Data { get {return _storage._functionParameters} set {_uniqueStorage()._functionParameters = newValue} @@ -190,7 +190,7 @@ public struct Proto_ContractFunctionResult { /// The account that is the "sender." If not present it is the accountId from the transactionId. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var senderID: Proto_AccountID { get {return _storage._senderID ?? Proto_AccountID()} set {_uniqueStorage()._senderID = newValue} @@ -234,7 +234,7 @@ public struct Proto_ContractFunctionResult { /// It will not have a consensus timestamp. It cannot generate a record or a receipt. The response will contain the output /// returned by the function call. This is useful for calling getter functions, which purely read the state and don't change it. /// It is faster and cheaper than a normal call, because it is purely local to a single node. -/// +/// /// Unlike a ContractCall transaction, the node will consume the entire amount of provided gas in determining /// the fee for this query. public struct Proto_ContractCallLocalQuery { @@ -278,7 +278,7 @@ public struct Proto_ContractCallLocalQuery { ///* /// The account that is the "sender." If not present it is the accountId from the transactionId. - /// Typically a different value than specified in the transactionId requires a valid signature + /// Typically a different value than specified in the transactionId requires a valid signature /// over either the hedera transaction or foreign transaction data. public var senderID: Proto_AccountID { get {return _senderID ?? Proto_AccountID()} diff --git a/Sources/HederaProtobufs/Services/contract_create.pb.swift b/Sources/HederaProtobufs/Services/contract_create.pb.swift index 3075d550..3f6ed9c4 100644 --- a/Sources/HederaProtobufs/Services/contract_create.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_create.pb.swift @@ -23,10 +23,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Start a new smart contract instance. After the instance is created, the ContractID for it is in /// the receipt, and can be retrieved by the Record or with a GetByKey query. The instance will run -/// the bytecode, either stored in a previously created file or in the transaction body itself for +/// the bytecode, either stored in a previously created file or in the transaction body itself for /// small contracts. -/// -/// +/// +/// /// The constructor will be executed using the given amount of gas, and any unspent gas will be /// refunded to the paying account. Constructor inputs come from the given constructorParameters. /// - The instance will exist for autoRenewPeriod seconds. When that is reached, it will renew @@ -73,7 +73,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// to the smart contract in the future. The memo field can only be changed using the admin keys. /// If there are no admin keys, then it cannot be changed after the smart contract is created. /// -/// Signing requirements: If an admin key is set, it must sign the transaction. If an +/// Signing requirements: If an admin key is set, it must sign the transaction. If an /// auto-renew account is set, its key must sign the transaction. public struct Proto_ContractCreateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/contract_delete.pb.swift b/Sources/HederaProtobufs/Services/contract_delete.pb.swift index b4009de0..43d56b6b 100644 --- a/Sources/HederaProtobufs/Services/contract_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_delete.pb.swift @@ -23,10 +23,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, marks a contract as deleted and transfers its remaining hBars, if any, to a /// designated receiver. After a contract is deleted, it can no longer be called. -/// +/// /// If the target contract is immutable (that is, was created without an admin key), then this /// transaction resolves to MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. The admin key of the target contract must sign. /// 2. If the transfer account or contract has receiverSigRequired, its associated key must also sign @@ -69,7 +69,7 @@ public struct Proto_ContractDeleteTransactionBody { } ///* - /// If set to true, means this is a "synthetic" system transaction being used to + /// If set to true, means this is a "synthetic" system transaction being used to /// alert mirror nodes that the contract is being permanently removed from the ledger. /// IMPORTANT: User transactions cannot set this field to true, as permanent /// removal is always managed by the ledger itself. Any ContractDeleteTransactionBody diff --git a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift index 9674023a..2def1dc8 100644 --- a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift @@ -197,9 +197,9 @@ public struct Proto_ContractGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} @@ -207,7 +207,7 @@ public struct Proto_ContractGetInfoResponse { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/contract_update.pb.swift b/Sources/HederaProtobufs/Services/contract_update.pb.swift index a6e22508..18688d29 100644 --- a/Sources/HederaProtobufs/Services/contract_update.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_update.pb.swift @@ -22,12 +22,12 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates the fields of a smart contract to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged on the contract. For an immutable /// smart contract (that is, a contract created without an adminKey), only the expirationTime may be /// updated; setting any other field in this case will cause the transaction status to resolve to /// MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a contract has an admin key, its expiry can be extended with only the /// transaction payer's signature. @@ -155,7 +155,7 @@ public struct Proto_ContractUpdateTransactionBody { public mutating func clearMaxAutomaticTokenAssociations() {_uniqueStorage()._maxAutomaticTokenAssociations = nil} ///* - /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew + /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew /// account. Otherwise it updates the contract's auto-renew account to the referenced account. public var autoRenewAccountID: Proto_AccountID { get {return _storage._autoRenewAccountID ?? Proto_AccountID()} diff --git a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift index 8f252223..8207921e 100644 --- a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A hash---presumably of some kind of credential or certificate---along with a list of keys, each -/// of which may be either a primitive or a threshold key. +/// of which may be either a primitive or a threshold key. public struct Proto_LiveHash { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift index f3e0e600..3e4a4a20 100644 --- a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbar/token to any other account of the spender's choice. If the owner is not specified in any allowance, the payer /// of transaction is considered to be the owner for that particular allowance. /// Setting the amount to zero in CryptoAllowance or TokenAllowance will remove the respective allowance for the spender. -/// +/// /// (So if account 0.0.X pays for this transaction and owner is not specified in the allowance, /// then at consensus each spender account will have new allowances to spend hbar or tokens from 0.0.X). public struct Proto_CryptoApproveAllowanceTransactionBody { diff --git a/Sources/HederaProtobufs/Services/crypto_create.pb.swift b/Sources/HederaProtobufs/Services/crypto_create.pb.swift index a65d7ae8..416fe152 100644 --- a/Sources/HederaProtobufs/Services/crypto_create.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_create.pb.swift @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// used to extend its expiration as long as possible. If it is has a zero balance when it expires, /// then it is deleted. This transaction must be signed by the payer account. If receiverSigRequired /// is false, then the transaction does not have to be signed by the keys in the keys field. If it is -/// true, then it must be signed by them, in addition to the keys of the payer account. If the +/// true, then it must be signed by them, in addition to the keys of the payer account. If the /// auto_renew_account field is set, the key of the referenced account must sign. /// /// An entity (account, file, or smart contract instance) must be created in a particular realm. If @@ -224,7 +224,7 @@ public struct Proto_CryptoCreateTransactionBody { /// A given alias can map to at most one account on the network at a time. This uniqueness will be enforced /// relative to aliases currently on the network at alias assignment. /// - /// If a transaction creates an account using an alias, any further crypto transfers to that alias will + /// If a transaction creates an account using an alias, any further crypto transfers to that alias will /// simply be deposited in that account, without creating anything, and with no creation fee being charged. public var alias: Data { get {return _storage._alias} diff --git a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift index 9c5b1e31..97173ea4 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift @@ -133,9 +133,9 @@ public struct Proto_CryptoGetAccountBalanceResponse { public var balance: UInt64 = 0 ///* - /// [DEPRECATED] The balances of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The balances of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token balances. public var tokenBalances: [Proto_TokenBalance] = [] diff --git a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift index 4ee97725..d9f75f80 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift @@ -220,9 +220,9 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} @@ -258,7 +258,7 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift index 79ee3a7e..bce0152d 100644 --- a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift @@ -29,7 +29,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbars, then the entire transaction fails, and none of those transfers occur, though the /// transaction fee is still charged. This transaction must be signed by the keys for all the sending /// accounts, and for any receiving accounts that have receiverSigRequired == true. The signatures -/// are in the same order as the accounts, skipping those accounts that don't need a signature. +/// are in the same order as the accounts, skipping those accounts that don't need a signature. public struct Proto_CryptoTransferTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/crypto_update.pb.swift b/Sources/HederaProtobufs/Services/crypto_update.pb.swift index 8ae87b2b..65db6742 100644 --- a/Sources/HederaProtobufs/Services/crypto_update.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_update.pb.swift @@ -25,8 +25,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// transaction must be signed by the existing key for this account. If the transaction is changing /// the key field, then the transaction must be signed by both the old key (from before the change) /// and the new key. The old key must sign for security. The new key must sign as a safeguard to -/// avoid accidentally changing to an invalid key, and then having no way to recover. -/// If the update transaction sets the auto_renew_account field to anything other +/// avoid accidentally changing to an invalid key, and then having no way to recover. +/// If the update transaction sets the auto_renew_account field to anything other /// than the sentinel 0.0.0, the key of the referenced account must sign. public struct Proto_CryptoUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/custom_fees.pb.swift b/Sources/HederaProtobufs/Services/custom_fees.pb.swift index aada1fc1..bb4d1dd4 100644 --- a/Sources/HederaProtobufs/Services/custom_fees.pb.swift +++ b/Sources/HederaProtobufs/Services/custom_fees.pb.swift @@ -99,20 +99,20 @@ public struct Proto_FixedFee { /// any fungible value, the ledger will assess the fallback fee, if present, to the new NFT owner. /// Royalty fees can only be added to tokens of type type NON_FUNGIBLE_UNIQUE. /// -/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, -/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. -/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate -/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart +/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, +/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. +/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate +/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart /// contract to make this split transaction atomic if they do not trust each other.) -/// -/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network -/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits +/// +/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network +/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits /// the sender with all the fungible value the receiver is exchanging for the NFT. -/// -/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit -/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying -/// account. -/// +/// +/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit +/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying +/// account. +/// /// There is an [open HIP discussion](https://github.com/hashgraph/hedera-improvement-proposal/discussions/578) /// that proposes to broaden the class of transactions for which the network automatically collects /// royalties. If this interests or concerns you, please add your voice to that discussion. @@ -207,7 +207,7 @@ public struct Proto_CustomFee { ///* /// If true, exempts all the token's fee collection accounts from this fee. /// (The token's treasury and the above fee_collector_account_id will always - /// be exempt. Please see HIP-573 + /// be exempt. Please see HIP-573 /// for details.) public var allCollectorsAreExempt: Bool = false diff --git a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift index a0c17257..cdab40a1 100644 --- a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift @@ -26,15 +26,15 @@ public struct Proto_EthereumTransactionBody { // methods supported on all messages. ///* - /// The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete + /// The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete /// unless the callData field is set. public var ethereumData: Data = Data() ///* /// For large transactions (for example contract create) this is the callData - /// of the ethereumData. The data in the ethereumData will be re-written with - /// the callData element as a zero length string with the original contents in - /// the referenced file at time of execution. The ethereumData will need to be + /// of the ethereumData. The data in the ethereumData will be re-written with + /// the callData element as a zero length string with the original contents in + /// the referenced file at time of execution. The ethereumData will need to be /// "rehydrated" with the callData for signature validation to pass. public var callData: Proto_FileID { get {return _callData ?? Proto_FileID()} @@ -46,17 +46,17 @@ public struct Proto_EthereumTransactionBody { public mutating func clearCallData() {self._callData = nil} ///* - /// The maximum amount, in tinybars, that the payer of the hedera transaction + /// The maximum amount, in tinybars, that the payer of the hedera transaction /// is willing to pay to complete the transaction. /// - /// Ordinarily the account with the ECDSA alias corresponding to the public + /// Ordinarily the account with the ECDSA alias corresponding to the public /// key that is extracted from the ethereum_data signature is responsible for /// fees that result from the execution of the transaction. If that amount of /// authorized fees is not sufficient then the payer of the transaction can be - /// charged, up to but not exceeding this amount. If the ethereum_data + /// charged, up to but not exceeding this amount. If the ethereum_data /// transaction authorized an amount that was insufficient then the payer will - /// only be charged the amount needed to make up the difference. If the gas - /// price in the transaction was set to zero then the payer will be assessed + /// only be charged the amount needed to make up the difference. If the gas + /// price in the transaction was set to zero then the payer will be assessed /// the entire fee. public var maxGasAllowance: Int64 = 0 diff --git a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift index 56390969..cc4291c9 100644 --- a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift +++ b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// An exchange rate between hbar and cents (USD) and the time at which the exchange rate will -/// expire, and be superseded by a new exchange rate. +/// expire, and be superseded by a new exchange rate. public struct Proto_ExchangeRate { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/file_append.pb.swift b/Sources/HederaProtobufs/Services/file_append.pb.swift index 6534dc25..3a2490c1 100644 --- a/Sources/HederaProtobufs/Services/file_append.pb.swift +++ b/Sources/HederaProtobufs/Services/file_append.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// single FileCreateTransaction, then it can be created with the first part of its contents, and /// then appended as many times as necessary to create the entire file. This transaction must be /// signed by all initial M-of-M KeyList keys. If keys contains additional KeyList or ThresholdKey -/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. +/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. public struct Proto_FileAppendTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/file_create.pb.swift b/Sources/HederaProtobufs/Services/file_create.pb.swift index cbe7b292..955c3c29 100644 --- a/Sources/HederaProtobufs/Services/file_create.pb.swift +++ b/Sources/HederaProtobufs/Services/file_create.pb.swift @@ -29,14 +29,14 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// at the expirationTime, unless its expiration is extended by another transaction before that time. /// If the file is deleted, then its contents will become empty and it will be marked as deleted /// until it expires, and then it will cease to exist. -/// +/// /// The keys field is a list of keys. All keys within the top-level key list must sign (M-M) to /// create or modify a file. However, to delete the file, only one key (1-M) is required to sign from /// the top-level key list. Each of those "keys" may itself be threshold key containing other keys /// (including other threshold keys). In other words, the behavior is an AND for create/modify, OR /// for delete. This is useful for acting as a revocation server. If it is desired to have the /// behavior be AND for all 3 operations (or OR for all 3), then the list should have only a single -/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field +/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field /// is set, the key of the referenced account must sign. /// /// If a file is created without ANY keys in the keys field, the file is immutable and ONLY the diff --git a/Sources/HederaProtobufs/Services/file_get_info.pb.swift b/Sources/HederaProtobufs/Services/file_get_info.pb.swift index 9adafd66..440e5bc3 100644 --- a/Sources/HederaProtobufs/Services/file_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/file_get_info.pb.swift @@ -145,7 +145,7 @@ public struct Proto_FileGetInfoResponse { public var memo: String = String() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() diff --git a/Sources/HederaProtobufs/Services/file_update.pb.swift b/Sources/HederaProtobufs/Services/file_update.pb.swift index f16ae24f..40a27f8d 100644 --- a/Sources/HederaProtobufs/Services/file_update.pb.swift +++ b/Sources/HederaProtobufs/Services/file_update.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// in the top level of a key list (M-of-M) of the file being updated. If the keys themselves are /// being updated, then the transaction must also be signed by all the new keys. If the keys contain /// additional KeyList or ThresholdKey then M-of-M secondary KeyList or ThresholdKey signing -/// requirements must be meet If the update transaction sets the auto_renew_account_id field +/// requirements must be meet If the update transaction sets the auto_renew_account_id field /// to anything other than the sentinel 0.0.0, the key of the referenced account must sign. public struct Proto_FileUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/freeze_type.pb.swift b/Sources/HederaProtobufs/Services/freeze_type.pb.swift index b177ff32..21ec2f2b 100644 --- a/Sources/HederaProtobufs/Services/freeze_type.pb.swift +++ b/Sources/HederaProtobufs/Services/freeze_type.pb.swift @@ -21,32 +21,32 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// The type of network freeze or upgrade operation to be performed. This type dictates which -/// fields are required. +/// The type of network freeze or upgrade operation to be performed. This type dictates which +/// fields are required. public enum Proto_FreezeType: SwiftProtobuf.Enum { public typealias RawValue = Int ///* - /// An (invalid) default value for this enum, to ensure the client explicitly sets + /// An (invalid) default value for this enum, to ensure the client explicitly sets /// the intended type of freeze transaction. case unknownFreezeType // = 0 ///* - /// Freezes the network at the specified time. The start_time field must be provided and - /// must reference a future time. Any values specified for the update_file and file_hash - /// fields will be ignored. This transaction does not perform any network changes or - /// upgrades and requires manual intervention to restart the network. + /// Freezes the network at the specified time. The start_time field must be provided and + /// must reference a future time. Any values specified for the update_file and file_hash + /// fields will be ignored. This transaction does not perform any network changes or + /// upgrades and requires manual intervention to restart the network. case freezeOnly // = 1 ///* - /// A non-freezing operation that initiates network wide preparation in advance of a - /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and + /// A non-freezing operation that initiates network wide preparation in advance of a + /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and /// valid. The start_time field may be omitted and any value present will be ignored. case prepareUpgrade // = 2 ///* - /// Freezes the network at the specified time and performs the previously prepared - /// automatic upgrade across the entire network. + /// Freezes the network at the specified time and performs the previously prepared + /// automatic upgrade across the entire network. case freezeUpgrade // = 3 ///* @@ -54,8 +54,8 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { case freezeAbort // = 4 ///* - /// Performs an immediate upgrade on auxilary services and containers providing - /// telemetry/metrics. Does not impact network operations. + /// Performs an immediate upgrade on auxilary services and containers providing + /// telemetry/metrics. Does not impact network operations. case telemetryUpgrade // = 5 case UNRECOGNIZED(Int) diff --git a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift index 7a1845a5..22384a8f 100644 --- a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift +++ b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift @@ -21,9 +21,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// Gets the time in nanoseconds spent in handleTransaction for one or more -/// TransactionIDs (assuming they have reached consensus "recently", since only a limited -/// number of execution times are kept in-memory, depending on the value of the node-local +/// Gets the time in nanoseconds spent in handleTransaction for one or more +/// TransactionIDs (assuming they have reached consensus "recently", since only a limited +/// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). public struct Proto_NetworkGetExecutionTimeQuery { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift index 764a8227..30555a09 100644 --- a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift +++ b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift @@ -74,7 +74,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are + /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are /// treated as UTC calendar days, rather than repeating 1440 minute periods left-aligned at the epoch. public var stakingPeriod: Int64 { get {return _storage._stakingPeriod} @@ -100,7 +100,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the + /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the /// ending period. Please consult the max_total_reward field instead. public var stakingRewardRate: Int64 { get {return _storage._stakingRewardRate} @@ -108,7 +108,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that + /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that /// have been earned but not collected. public var reservedStakingRewards: Int64 { get {return _storage._reservedStakingRewards} @@ -116,7 +116,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is + /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is /// used to compute the HIP-782 balance ratio. public var unreservedStakingRewardBalance: Int64 { get {return _storage._unreservedStakingRewardBalance} @@ -124,7 +124,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward + /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward /// rate in any period; please see HIP-782 for details. public var rewardBalanceThreshold: Int64 { get {return _storage._rewardBalanceThreshold} @@ -132,7 +132,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum + /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum /// per-hbar reward rate in any period; please see HIP-782 for details. public var maxStakeRewarded: Int64 { get {return _storage._maxStakeRewarded} @@ -140,10 +140,10 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum total tinybars that could be paid as staking rewards in the ending period, after + /// The maximum total tinybars that could be paid as staking rewards in the ending period, after /// applying the settings for the 0.0.800 balance threshold and the maximum stake rewarded. This - /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a - /// mirror node could also calculate its value by iterating the node_stake list and summing + /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a + /// mirror node could also calculate its value by iterating the node_stake list and summing /// stake_rewarded fields; then multiplying this sum by the max_staking_reward_rate_per_hbar. public var maxTotalReward: Int64 { get {return _storage._maxTotalReward} @@ -166,13 +166,13 @@ public struct Proto_NodeStake { ///* /// The maximum stake (rewarded or not rewarded) this node can have as consensus weight. If its stake to - /// reward is above this maximum at the start of a period, then accounts staking to the node in that + /// reward is above this maximum at the start of a period, then accounts staking to the node in that /// period will be rewarded at a lower rate scaled by (maxStake / stakeRewardStart). public var maxStake: Int64 = 0 ///* /// The minimum stake (rewarded or not rewarded) this node must reach before having non-zero consensus weight. - /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in + /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in /// that period will receive no rewards. public var minStake: Int64 = 0 @@ -181,8 +181,8 @@ public struct Proto_NodeStake { public var nodeID: Int64 = 0 ///* - /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of - /// the staking period that is ending. + /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of + /// the staking period that is ending. public var rewardRate: Int64 = 0 ///* @@ -190,12 +190,12 @@ public struct Proto_NodeStake { public var stake: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the /// beginning of the new staking period. public var stakeNotRewarded: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the /// beginning of the new staking period. public var stakeRewarded: Int64 = 0 diff --git a/Sources/HederaProtobufs/Services/query_header.pb.swift b/Sources/HederaProtobufs/Services/query_header.pb.swift index b82559f3..4763d7e9 100644 --- a/Sources/HederaProtobufs/Services/query_header.pb.swift +++ b/Sources/HederaProtobufs/Services/query_header.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// (allowing it to tailor the payment transaction accordingly). If the payment in the query fails /// the precheck, then the response may have some fields blank. The state proof is only available for /// some types of information. It is available for a Record, but not a receipt. It is available for -/// the information in each kind of *GetInfo request. +/// the information in each kind of *GetInfo request. public enum Proto_ResponseType: SwiftProtobuf.Enum { public typealias RawValue = Int @@ -90,7 +90,7 @@ extension Proto_ResponseType: CaseIterable { ///* /// Each query from the client to the node will contain the QueryHeader, which gives the requested /// response type, and includes a payment transaction that will compensate the node for responding to -/// the query. The payment can be blank if the query is free. +/// the query. The payment can be blank if the query is free. public struct Proto_QueryHeader { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/schedule_create.pb.swift b/Sources/HederaProtobufs/Services/schedule_create.pb.swift index a8f221ea..bfe9c7d1 100644 --- a/Sources/HederaProtobufs/Services/schedule_create.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_create.pb.swift @@ -34,40 +34,40 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// or ScheduleSign. /// /// Upon `SUCCESS`, the receipt also includes the scheduledTransactionID to -/// use to query for the record of the scheduled transaction's execution (if it occurs). -/// +/// use to query for the record of the scheduled transaction's execution (if it occurs). +/// /// The expiration time of a schedule is controlled by it's expiration_time. It remains in state and can be queried /// using GetScheduleInfo until expiration, no matter if the scheduled transaction has /// executed or marked deleted. If Long Term Scheduled Transactions are disabled, the expiration_time is always /// 30 minutes in the future. -/// +/// /// If the adminKey field is omitted, the resulting schedule is immutable. If the /// adminKey is set, the ScheduleDelete transaction can be used to mark it as /// deleted. The creator may also specify an optional memo whose UTF-8 encoding is at most /// 100 bytes and does not include the zero byte is also supported. -/// +/// /// When a scheduledTransactionBody is executed, the /// network only charges its payer the service fee, and not the node and network fees. If the /// optional payerAccountID is set, the network charges this account. Otherwise it charges -/// the payer of the originating ScheduleCreate. -/// +/// the payer of the originating ScheduleCreate. +/// /// Two ScheduleCreate transactions are identical if they are equal in all their /// fields other than payerAccountID. (For the scheduledTransactionBody field, /// "equal" should be understood in the sense of /// gRPC object equality in the network software runtime. In particular, a gRPC object with unknown fields is -/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) -/// +/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) +/// /// A ScheduleCreate transaction that attempts to re-create an identical schedule already in /// state will receive a receipt with status IDENTICAL_SCHEDULE_ALREADY_CREATED; the receipt /// will include the ScheduleID of the extant schedule, which may be used in a subsequent /// ScheduleSign transaction. (The receipt will also include the TransactionID to /// use in querying for the receipt or record of the scheduled transaction.) -/// +/// /// Other notable response codes include, INVALID_ACCOUNT_ID, /// UNSCHEDULABLE_TRANSACTION, UNRESOLVABLE_REQUIRED_SIGNERS, /// INVALID_SIGNATURE. For more information please see the section of this documentation on -/// the ResponseCode enum. +/// the ResponseCode enum. public struct Proto_ScheduleCreateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift index c274b790..4e1cd626 100644 --- a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Other notable response codes include, INVALID_SCHEDULE_ID, SCHEDULE_PENDING_EXPIRATION, /// SCHEDULE_ALREADY_DELETED, SCHEDULE_ALREADY_EXECUTED, SCHEDULE_IS_IMMUTABLE. /// For more information please see the section of this documentation on the ResponseCode -/// enum. +/// enum. public struct Proto_ScheduleDeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift index 657bb86d..040e7e08 100644 --- a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Gets information about a schedule in the network's action queue. -/// +/// /// Responds with INVALID_SCHEDULE_ID if the requested schedule doesn't exist. public struct Proto_ScheduleGetInfoQuery { // SwiftProtobuf.Message conformance is added in an extension below. See the @@ -193,7 +193,7 @@ public struct Proto_ScheduleInfo { public mutating func clearScheduledTransactionID() {_uniqueStorage()._scheduledTransactionID = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift index 4533bf8b..58366ed5 100644 --- a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift @@ -29,10 +29,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Otherwise, if the resulting set of signing keys satisfy the /// scheduled transaction's signing requirements, it will be executed immediately after the /// triggering ScheduleSign. -/// +/// /// Upon SUCCESS, the receipt includes the scheduledTransactionID to use to query -/// for the record of the scheduled transaction's execution (if it occurs). -/// +/// for the record of the scheduled transaction's execution (if it occurs). +/// /// Other notable response codes include INVALID_SCHEDULE_ID, SCHEDULE_ALREADY_DELETED, /// SCHEDULE_PENDING_EXPIRATION, SCHEDULE_ALREADY_EXPIRED, /// INVALID_ACCOUNT_ID, UNRESOLVABLE_REQUIRED_SIGNERS, diff --git a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift index 207045a0..15cf4092 100644 --- a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift @@ -22,19 +22,19 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Representation of a Hedera Consensus Service topic in the network Merkle tree. -/// -/// As with all network entities, a topic has a unique entity number, which is usually given along +/// +/// As with all network entities, a topic has a unique entity number, which is usually given along /// with the network's shard and realm in the form of a shard.realm.number id. -/// +/// /// A topic consists of just two pieces of data: /// 1. The total number of messages sent to the topic; and, /// 2. The running hash of all those messages. /// It also has several metadata elements: /// 1. A consensus expiration time in seconds since the epoch. -/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that -/// has signed a transaction allowing the network to use its balance to automatically extend the topic's +/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that +/// has signed a transaction allowing the network to use its balance to automatically extend the topic's /// expiration time when it passes. -/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the +/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the /// topic has a valid auto-renew account, and is not deleted upon expiration. /// 4. A boolean marking if the topic has been deleted. /// 5. A memo string whose UTF-8 encoding is at most 100 bytes. @@ -71,7 +71,7 @@ public struct Proto_Topic { } ///* - /// The number of seconds for which the topic will be automatically renewed + /// The number of seconds for which the topic will be automatically renewed /// upon expiring (if it has a valid auto-renew account). public var autoRenewPeriod: Int64 { get {return _storage._autoRenewPeriod} @@ -101,7 +101,7 @@ public struct Proto_Topic { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data { diff --git a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift index 7602f77e..c05916da 100644 --- a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift +++ b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The key of a storage slot. A slot is scoped to a specific contract number. -/// -/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. +/// +/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. public struct Proto_SlotKey { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for @@ -53,10 +53,10 @@ public struct Proto_SlotKey { ///* /// The value of a contract storage slot. For the EVM, this is a single word. -/// +/// /// Because we iterate through all the storage slots for an expired contract /// when purging it from state, our slot values also include the words -/// of the previous and next keys in this contract's storage "list". +/// of the previous and next keys in this contract's storage "list". public struct Proto_SlotValue { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift index 2ed2b106..dfe86c91 100644 --- a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift @@ -83,7 +83,7 @@ public struct Proto_Nft { } ///* - /// If the owner of this NFT is not its token treasury, the id of the previous NFT + /// If the owner of this NFT is not its token treasury, the id of the previous NFT /// in the owner's "doubly-linked list" of owned NFTs (if any). public var ownerPreviousNftID: Proto_NftID { get {return _storage._ownerPreviousNftID ?? Proto_NftID()} @@ -95,7 +95,7 @@ public struct Proto_Nft { public mutating func clearOwnerPreviousNftID() {_uniqueStorage()._ownerPreviousNftID = nil} ///* - /// If the owner of this NFT is not its token treasury, the id of the next NFT in + /// If the owner of this NFT is not its token treasury, the id of the next NFT in /// the owner's "doubly-linked list" of owned NFTs (if any). public var ownerNextNftID: Proto_NftID { get {return _storage._ownerNextNftID ?? Proto_NftID()} diff --git a/Sources/HederaProtobufs/Services/system_delete.pb.swift b/Sources/HederaProtobufs/Services/system_delete.pb.swift index b975ae1c..51e72d28 100644 --- a/Sources/HederaProtobufs/Services/system_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_delete.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// stored internally until the expiration time, at which time it is truly and permanently deleted. /// Until that time, it can be undeleted by the Hedera administrative multisignature. When a smart /// contract is deleted, the cryptocurrency account within it continues to exist, and is not affected -/// by the expiration time here. +/// by the expiration time here. public struct Proto_SystemDeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/system_undelete.pb.swift b/Sources/HederaProtobufs/Services/system_undelete.pb.swift index efc3516f..a2eccb79 100644 --- a/Sources/HederaProtobufs/Services/system_undelete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_undelete.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Undelete a file or smart contract that was deleted by SystemDelete; requires a Hedera -/// administrative multisignature. +/// administrative multisignature. public struct Proto_SystemUndeleteTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift index 15747be9..7d38b3c4 100644 --- a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift +++ b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift @@ -73,9 +73,9 @@ public struct Proto_ThrottleBucket { /// A list of throttle buckets which, simultaneously enforced, define the system's throttling policy. ///
    ///
  1. When an operation appears in more than one throttling bucket, all its buckets must have room -/// or it will be throttled.
  2. +/// or it will be throttled. ///
  3. An operation assigned to no buckets is always throttled.
  4. -///
+/// public struct Proto_ThrottleDefinitions { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for diff --git a/Sources/HederaProtobufs/Services/token_burn.pb.swift b/Sources/HederaProtobufs/Services/token_burn.pb.swift index cbed3afa..93f136be 100644 --- a/Sources/HederaProtobufs/Services/token_burn.pb.swift +++ b/Sources/HederaProtobufs/Services/token_burn.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Token A has 2 decimals. In order to burn 100 tokens, one must provide amount of 10000. In order /// to burn 100.55 tokens, one must provide amount of 10055. /// For non fungible tokens the transaction body accepts serialNumbers list of integers as a parameter. -/// +/// /// If the serialNumbers don't get filled for non-fungible token type, a INVALID_TOKEN_BURN_AMOUNT response /// code will be returned. /// If a zero amount is provided for a fungible token type, it will be treated as a regular transaction. diff --git a/Sources/HederaProtobufs/Services/token_create.pb.swift b/Sources/HederaProtobufs/Services/token_create.pb.swift index 3ad7c18d..8ec305b6 100644 --- a/Sources/HederaProtobufs/Services/token_create.pb.swift +++ b/Sources/HederaProtobufs/Services/token_create.pb.swift @@ -25,39 +25,39 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The specified Treasury Account is receiving the initial supply of tokens as-well as the tokens /// from the Token Mint operation once executed. The balance of the treasury account is decreased /// when the Token Burn operation is executed. -/// +/// /// The initialSupply is the initial supply of the smallest parts of a token (like a /// tinybar, not an hbar). These are the smallest units of the token which may be transferred. -/// +/// /// The supply can change over time. If the total supply at some moment is S parts of tokens, /// and the token is using D decimals, then S must be less than or equal to /// 263-1, which is 9,223,372,036,854,775,807. The number of whole tokens (not parts) will /// be S / 10D. -/// +/// /// If decimals is 8 or 11, then the number of whole tokens can be at most a few billions or /// millions, respectively. For example, it could match Bitcoin (21 million whole tokens with 8 /// decimals) or hbars (50 billion whole tokens with 8 decimals). It could even match Bitcoin with /// milli-satoshis (21 million whole tokens with 11 decimals). -/// +/// /// Note that a created token is immutable if the adminKey is omitted. No property of /// an immutable token can ever change, with the sole exception of its expiry. Anyone can pay to /// extend the expiry time of an immutable token. -/// +/// /// A token can be either FUNGIBLE_COMMON or NON_FUNGIBLE_UNIQUE, based on its /// TokenType. If it has been omitted, FUNGIBLE_COMMON type is used. -/// +/// /// A token can have either INFINITE or FINITE supply type, based on its /// TokenType. If it has been omitted, INFINITE type is used. -/// +/// /// If a FUNGIBLE TokenType is used, initialSupply should explicitly be set to a /// non-negative. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If a NON_FUNGIBLE_UNIQUE TokenType is used, initialSupply should explicitly be set /// to 0. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If an INFINITE TokenSupplyType is used, maxSupply should explicitly be set to 0. If /// it is not 0, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. -/// +/// /// If a FINITE TokenSupplyType is used, maxSupply should be explicitly set to a /// non-negative value. If it is not, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. public struct Proto_TokenCreateTransactionBody { @@ -66,7 +66,7 @@ public struct Proto_TokenCreateTransactionBody { // methods supported on all messages. ///* - /// The publicly visible name of the token. The token name is specified as a Unicode string. + /// The publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} @@ -74,7 +74,7 @@ public struct Proto_TokenCreateTransactionBody { } ///* - /// The publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} diff --git a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift index b3af176d..3ea00134 100644 --- a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift @@ -21,13 +21,13 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// At consensus, updates a token type's fee schedule to the given list of custom fees. -/// +/// At consensus, updates a token type's fee schedule to the given list of custom fees. +/// /// If the target token type has no fee_schedule_key, resolves to TOKEN_HAS_NO_FEE_SCHEDULE_KEY. -/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will +/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will /// resolve to INVALID_SIGNATURE. -/// -/// If the custom_fees list is empty, clears the fee schedule or resolves to +/// +/// If the custom_fees list is empty, clears the fee schedule or resolves to /// CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES if the fee schedule was already empty. public struct Proto_TokenFeeScheduleUpdateTransactionBody { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/token_get_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_info.pb.swift index c57cebd9..6eddd75b 100644 --- a/Sources/HederaProtobufs/Services/token_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_info.pb.swift @@ -305,7 +305,7 @@ public struct Proto_TokenInfo { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} diff --git a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift index e1ebfe93..5162e836 100644 --- a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift @@ -104,7 +104,7 @@ public struct Proto_TokenNftInfo { public var metadata: Data = Data() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() ///* diff --git a/Sources/HederaProtobufs/Services/token_update.pb.swift b/Sources/HederaProtobufs/Services/token_update.pb.swift index e5101514..41bbd503 100644 --- a/Sources/HederaProtobufs/Services/token_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_update.pb.swift @@ -22,11 +22,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates an already created token to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged. For an immutable tokens (that is, /// a token without an admin key), only the expiry may be updated. Setting any other field in that /// case will cause the transaction status to resolve to TOKEN_IS_IMMUTABLE. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a token has an admin key, its expiry can be extended with only the transaction /// payer's signature. @@ -36,7 +36,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// token to become immutable. (Other Key structures without a constituent /// Ed25519 key will be rejected with INVALID_ADMIN_KEY.) /// 4. If a new treasury is set, the new treasury account's key must sign the transaction. -/// +/// /// --- Nft Requirements --- /// 1. If a non fungible token has a positive treasury balance, the operation will abort with /// CURRENT_TREASURY_STILL_OWNS_NFTS. @@ -57,7 +57,7 @@ public struct Proto_TokenUpdateTransactionBody { public mutating func clearToken() {_uniqueStorage()._token = nil} ///* - /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} @@ -65,7 +65,7 @@ public struct Proto_TokenUpdateTransactionBody { } ///* - /// The new publicly visible name of the token. The token name is specified as a Unicode string. + /// The new publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} diff --git a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift index a232dbad..c030639c 100644 --- a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift +++ b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift @@ -34,7 +34,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT /// On success, tokens are removed from the account and the total supply of the token is decreased by /// the wiped amount. -/// +/// /// If both amount and serialNumbers get filled, a INVALID_TRANSACTION_BODY response code will be /// returned. /// If the serialNumbers don't get filled for a non-fungible token type, a INVALID_WIPING_AMOUNT response @@ -44,7 +44,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// response code will be returned. /// If the serialNumbers' list count is greater than the batch size limit global dynamic property, a /// BATCH_SIZE_LIMIT_EXCEEDED response code will be returned. -/// +/// /// The amount provided is in the lowest denomination possible. Example: /// Token A has 2 decimals. In order to wipe 100 tokens from account, one must provide amount of /// 10000. In order to wipe 100.55 tokens, one must provide amount of 10055. diff --git a/Sources/HederaProtobufs/Services/transaction.pb.swift b/Sources/HederaProtobufs/Services/transaction.pb.swift index 6c8d4ba4..9eac5db6 100644 --- a/Sources/HederaProtobufs/Services/transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// appear in the transaction. For example, a CryptoTransfer will first have a Signature /// corresponding to the Key for the paying account, followed by a Signature corresponding to the Key /// for each account that is sending or receiving cryptocurrency in the transfer. Each Transaction -/// should not have more than 50 levels. +/// should not have more than 50 levels. /// The SignatureList field is deprecated and succeeded by SignatureMap. public struct Proto_Transaction { // SwiftProtobuf.Message conformance is added in an extension below. See the diff --git a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift index 06634402..38339db5 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift @@ -63,8 +63,8 @@ public struct Proto_TransactionGetReceiptQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the receipts of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the receipts of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildReceipts: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -117,7 +117,7 @@ public struct Proto_TransactionGetReceiptResponse { public var duplicateTransactionReceipts: [Proto_TransactionReceipt] = [] ///* - /// The receipts (if any) of all child transactions spawned by the transaction with the + /// The receipts (if any) of all child transactions spawned by the transaction with the /// given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionReceipts: [Proto_TransactionReceipt] = [] diff --git a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift index 53c1eddc..d0d3a46f 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift @@ -65,8 +65,8 @@ public struct Proto_TransactionGetRecordQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the records of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the records of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildRecords: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -116,7 +116,7 @@ public struct Proto_TransactionGetRecordResponse { public var duplicateTransactionRecords: [Proto_TransactionRecord] = [] ///* - /// The records of processing all child transaction spawned by the transaction with the given + /// The records of processing all child transaction spawned by the transaction with the given /// top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionRecords: [Proto_TransactionRecord] = [] diff --git a/Sources/HederaProtobufs/Services/transaction_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_record.pb.swift index 84f367e1..838240ae 100644 --- a/Sources/HederaProtobufs/Services/transaction_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_record.pb.swift @@ -171,14 +171,14 @@ public struct Proto_TransactionRecord { ///* /// In the record of a CryptoCreate transaction triggered by a user transaction with a - /// (previously unused) alias, the new account's alias. + /// (previously unused) alias, the new account's alias. public var alias: Data { get {return _storage._alias} set {_uniqueStorage()._alias = newValue} } ///* - /// The keccak256 hash of the ethereumData. This field will only be populated for + /// The keccak256 hash of the ethereumData. This field will only be populated for /// EthereumTransaction. public var ethereumHash: Data { get {return _storage._ethereumHash} diff --git a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift index d0c0918d..88153db3 100644 --- a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift +++ b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Submit an arbitrary (serialized) Transaction to the network without prechecks. Requires superuser -/// privileges. +/// privileges. public struct Proto_UncheckedSubmitBody { // SwiftProtobuf.Message conformance is added in an extension below. See the // `Message` and `Message+*Additions` files in the SwiftProtobuf library for From 186313ebb9c16a35e6b405bbef64b502cef63c54 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Tue, 20 Aug 2024 12:39:34 -0700 Subject: [PATCH 03/11] feat(hip-869): add NodeCreate, NodeDelete, NodeUpdate transactions Signed-off-by: Ricky Saechao --- .../AddressBook/NodeCreateTransaction.swift | 242 ++++++++++++++++ .../AddressBook/NodeDeleteTransaction.swift | 98 +++++++ .../AddressBook/NodeUpdateTransaction.swift | 259 ++++++++++++++++++ Sources/Hedera/AnyTransaction.swift | 21 +- Sources/Hedera/FeeSchedule/RequestType.swift | 2 +- Sources/Hedera/NodeAddress.swift | 4 + .../Transaction+FromProtobuf.swift | 14 + 7 files changed, 636 insertions(+), 4 deletions(-) create mode 100644 Sources/Hedera/AddressBook/NodeCreateTransaction.swift create mode 100644 Sources/Hedera/AddressBook/NodeDeleteTransaction.swift create mode 100644 Sources/Hedera/AddressBook/NodeUpdateTransaction.swift diff --git a/Sources/Hedera/AddressBook/NodeCreateTransaction.swift b/Sources/Hedera/AddressBook/NodeCreateTransaction.swift new file mode 100644 index 00000000..66be932d --- /dev/null +++ b/Sources/Hedera/AddressBook/NodeCreateTransaction.swift @@ -0,0 +1,242 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2022 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import Foundation +import GRPC +import HederaProtobufs +import SwiftProtobuf + +/// A transaction body to add a new consensus node to the network address book. +/// +/// This transaction body SHALL be considered a "privileged transaction". +/// +/// This message supports a transaction to create a new node in the network +/// address book. The transaction, once complete, enables a new consensus node +/// to join the network, and requires governing council authorization. +/// +/// - A `NodeCreateTransactionBody` MUST be signed by the governing council. +/// - A `NodeCreateTransactionBody` MUST be signed by the `Key` assigned to the +/// `admin_key` field. +/// - The newly created node information SHALL be added to the network address +/// book information in the network state. +/// - The new entry SHALL be created in "state" but SHALL NOT participate in +/// network consensus and SHALL NOT be present in network "configuration" +/// until the next "upgrade" transaction (as noted below). +/// - All new address book entries SHALL be added to the active network +/// configuration during the next `freeze` transaction with the field +/// `freeze_type` set to `PREPARE_UPGRADE`. +/// +public final class NodeCreateTransaction: Transaction { + public init( + accountId: AccountId? = nil, + description: String = "", + gossipEndpoints: [SocketAddressV4] = [], + serviceEndpoints: [SocketAddressV4] = [], + gossipCaCertificate: Data? = nil, + grpcCertificateHash: Data? = nil, + adminKey: Key? = nil + ) { + self.accountId = accountId + self.description = description + self.gossipEndpoints = gossipEndpoints + self.serviceEndpoints = serviceEndpoints + self.gossipCaCertificate = gossipCaCertificate + self.grpcCertificateHash = grpcCertificateHash + self.adminKey = adminKey + + super.init() + } + + internal init( + protobuf proto: Proto_TransactionBody, _ data: Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody + ) throws { + self.accountId = data.hasAccountID ? try .fromProtobuf(data.accountID) : nil + self.description = data.description_p + self.gossipEndpoints = try data.gossipEndpoint.map(SocketAddressV4.init) + self.serviceEndpoints = try data.serviceEndpoint.map(SocketAddressV4.init) + self.gossipCaCertificate = data.gossipCaCertificate + self.grpcCertificateHash = data.grpcCertificateHash + self.adminKey = data.hasAdminKey ? try .fromProtobuf(data.adminKey) : nil + + try super.init(protobuf: proto) + } + + /// Node account ID. + public var accountId: AccountId? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node account + @discardableResult + public func accountId(_ accountId: AccountId?) -> Self { + self.accountId = accountId + + return self + } + + /// Returns the nodes description. + public var description: String { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node's description. + @discardableResult + public func description(_ description: String) -> Self { + self.description = description + + return self + } + + /// A list of service endpoints for gossip. + public var gossipEndpoints: [SocketAddressV4] { + willSet { + ensureNotFrozen() + } + } + + /// Assign the list of service endpoints for gossip. + @discardableResult + public func gossipEndpoints(_ gossipEndpoints: [SocketAddressV4]) -> Self { + self.gossipEndpoints = gossipEndpoints + + return self + } + + /// Add an endpoint for gossip to the list of service endpoints for gossip. + @discardableResult + public func addGossipEndpoint(_ gossipEndpoint: SocketAddressV4) -> Self { + self.gossipEndpoints.append(gossipEndpoint) + + return self + } + + /// Extract the list of service endpoints for gRPC calls. + public var serviceEndpoints: [SocketAddressV4] { + willSet { + ensureNotFrozen() + } + } + + /// Assign the list of service endpoints for gRPC calls. + @discardableResult + public func serviceEndpoints(_ serviceEndpoints: [SocketAddressV4]) -> Self { + self.serviceEndpoints = serviceEndpoints + + return self + } + + /// Add an endpoint for gRPC calls to the list of service endpoints for gRPC calls. + @discardableResult + public func addServiceEndpoint(_ serviceEndpoint: SocketAddressV4) -> Self { + self.serviceEndpoints.append(serviceEndpoint) + + return self + } + + /// Extract the certificate used to sign gossip events. + public var gossipCaCertificate: Data? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the certificate used to sign gossip events. + @discardableResult + public func gossipCaCertificate(_ gossipCaCertificate: Data) -> Self { + self.gossipCaCertificate = gossipCaCertificate + + return self + } + + /// Extract the hash of the node gRPC TLS certificate. + public var grpcCertificateHash: Data? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the hash of the node gRPC TLS certificate. + @discardableResult + public func grpcCertificateHash(_ grpcCertificateHash: Data) -> Self { + self.grpcCertificateHash = grpcCertificateHash + + return self + } + + /// Get an administrative key controlled by the node operator. + public var adminKey: Key? { + willSet { + ensureNotFrozen() + } + } + + /// Sets an administrative key controlled by the node operator. + @discardableResult + public func adminKey(_ adminKey: Key) -> Self { + self.adminKey = adminKey + + return self + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws { + try accountId?.validateChecksums(on: ledgerId) + try super.validateChecksums(on: ledgerId) + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_AddressBookServiceAsyncClient(channel: channel).createNode(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .nodeCreate(toProtobuf()) + } +} + +extension NodeCreateTransaction: ToProtobuf { + internal typealias Protobuf = Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + accountId?.toProtobufInto(&proto.accountID) + proto.description_p = description + proto.gossipEndpoint = gossipEndpoints.map { $0.toProtobuf() } + proto.serviceEndpoint = serviceEndpoints.map { $0.toProtobuf() } + proto.gossipCaCertificate = gossipCaCertificate ?? Data() + proto.grpcCertificateHash = grpcCertificateHash ?? Data() + if let adminKey = adminKey { + proto.adminKey = adminKey.toProtobuf() + } + } + } +} + +extension NodeCreateTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .nodeCreate(toProtobuf()) + } +} diff --git a/Sources/Hedera/AddressBook/NodeDeleteTransaction.swift b/Sources/Hedera/AddressBook/NodeDeleteTransaction.swift new file mode 100644 index 00000000..c26a85a4 --- /dev/null +++ b/Sources/Hedera/AddressBook/NodeDeleteTransaction.swift @@ -0,0 +1,98 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2022 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import Foundation +import GRPC +import HederaProtobufs +import SwiftProtobuf + +/// A transaction body to delete a node from the network address book. +/// +/// This transaction body SHALL be considered a "privileged transaction". +/// +/// - A `NodeDeleteTransactionBody` MUST be signed by the governing council. +/// - Upon success, the address book entry SHALL enter a "pending delete" +/// state. +/// - All address book entries pending deletion SHALL be removed from the +/// active network configuration during the next `freeze` transaction with +/// the field `freeze_type` set to `PREPARE_UPGRADE`.
+/// - A deleted address book node SHALL be removed entirely from network state. +/// - A deleted address book node identifier SHALL NOT be reused. +public final class NodeDeleteTransaction: Transaction { + public init( + nodeId: UInt64 = 0 + ) { + self.nodeId = nodeId + super.init() + } + + internal init( + protobuf proto: Proto_TransactionBody, _ data: Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody + ) throws { + self.nodeId = data.nodeID + + try super.init(protobuf: proto) + } + + /// Node index to delete. + public var nodeId: UInt64 { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node index to delete. + @discardableResult + public func nodeId(_ nodeId: UInt64) -> Self { + self.nodeId = nodeId + + return self + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws {} + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_AddressBookServiceAsyncClient(channel: channel).deleteNode(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .nodeDelete(toProtobuf()) + } +} + +extension NodeDeleteTransaction: ToProtobuf { + internal typealias Protobuf = Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.nodeID = nodeId + } + } +} + +extension NodeDeleteTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .nodeDelete(toProtobuf()) + } +} diff --git a/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift b/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift new file mode 100644 index 00000000..3faee168 --- /dev/null +++ b/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift @@ -0,0 +1,259 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2022 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import Foundation +import GRPC +import HederaProtobufs +import SwiftProtobuf + +/// Transaction body to modify address book node attributes. +/// +/// - This transaction SHALL enable the node operator, as identified by the +/// `admin_key`, to modify operational attributes of the node. +/// - This transaction MUST be signed by the active `admin_key` for the node. +/// - If this transaction sets a new value for the `admin_key`, then both the +/// current `admin_key`, and the new `admin_key` MUST sign this transaction. +/// - This transaction SHALL NOT change any field that is not set (is null) in +/// this transaction body. +/// - This SHALL create a pending update to the node, but the change SHALL NOT +/// be immediately applied to the active configuration. +/// - All pending node updates SHALL be applied to the active network +/// configuration during the next `freeze` transaction with the field +/// `freeze_type` set to `PREPARE_UPGRADE`. +public final class NodeUpdateTransaction: Transaction { + public init( + nodeId: UInt64 = 0, + accountId: AccountId? = nil, + description: String? = nil, + gossipEndpoints: [SocketAddressV4] = [], + serviceEndpoints: [SocketAddressV4] = [], + gossipCaCertificate: Data? = nil, + grpcCertificateHash: Data? = nil, + adminKey: Key? = nil + ) { + self.nodeId = nodeId + self.accountId = accountId + self.description = description + self.gossipEndpoints = gossipEndpoints + self.serviceEndpoints = serviceEndpoints + self.gossipCaCertificate = gossipCaCertificate + self.grpcCertificateHash = grpcCertificateHash + self.adminKey = adminKey + + super.init() + } + + internal init( + protobuf proto: Proto_TransactionBody, _ data: Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody + ) throws { + self.nodeId = data.nodeID + self.accountId = data.hasAccountID ? try .fromProtobuf(data.accountID) : nil + self.description = data.hasDescription_p ? data.description_p.value : nil + self.gossipEndpoints = try data.gossipEndpoint.map(SocketAddressV4.init) + self.serviceEndpoints = try data.serviceEndpoint.map(SocketAddressV4.init) + self.gossipCaCertificate = data.hasGossipCaCertificate ? data.gossipCaCertificate.value : nil + self.grpcCertificateHash = data.hasGrpcCertificateHash ? data.grpcCertificateHash.value : nil + self.adminKey = data.hasAdminKey ? try .fromProtobuf(data.adminKey) : nil + + try super.init(protobuf: proto) + } + + /// Node index to update. + public var nodeId: UInt64? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node index to update. + @discardableResult + public func nodeId(_ nodeId: UInt64) -> Self { + self.nodeId = nodeId + + return self + } + + /// Node account ID. + public var accountId: AccountId? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node account Id. + @discardableResult + public func accountId(_ accountId: AccountId) -> Self { + self.accountId = accountId + + return self + } + + /// Returns the updated node description. + public var description: String? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the node's description. + @discardableResult + public func description(_ description: String) -> Self { + self.description = description + + return self + } + + /// A list of service endpoints for gossip. + public var gossipEndpoints: [SocketAddressV4] { + willSet { + ensureNotFrozen() + } + } + + /// Assign the list of service endpoints for gossip. + @discardableResult + public func gossipEndpoints(_ gossipEndpoints: [SocketAddressV4]) -> Self { + self.gossipEndpoints = gossipEndpoints + + return self + } + + /// Add an endpoint for gossip to the list of service endpoints for gossip. + @discardableResult + public func addGossipEndpoint(_ gossipEndpoint: SocketAddressV4) -> Self { + self.gossipEndpoints.append(gossipEndpoint) + + return self + } + + /// Extract the list of service endpoints for gRPC calls. + public var serviceEndpoints: [SocketAddressV4] { + willSet { + ensureNotFrozen() + } + } + + /// Assign the list of service endpoints for gRPC calls. + @discardableResult + public func serviceEndpoints(_ serviceEndpoints: [SocketAddressV4]) -> Self { + self.serviceEndpoints = serviceEndpoints + + return self + } + + /// Add an endpoint for gRPC calls to the list of service endpoints for gRPC calls. + @discardableResult + public func addServiceEndpoint(_ serviceEndpoint: SocketAddressV4) -> Self { + self.serviceEndpoints.append(serviceEndpoint) + + return self + } + + /// Extract the certificate used to sign gossip events. + public var gossipCaCertificate: Data? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the certificate used to sign gossip events. + @discardableResult + public func gossipCaCertificate(_ gossipCaCertificate: Data) -> Self { + self.gossipCaCertificate = gossipCaCertificate + + return self + } + + /// Extract the hash of the node gRPC TLS certificate. + public var grpcCertificateHash: Data? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the hash of the node gRPC TLS certificate. + @discardableResult + public func grpcCertificateHash(_ grpcCertificateHash: Data) -> Self { + self.grpcCertificateHash = grpcCertificateHash + + return self + } + + /// Get an administrative key controlled by the node operator. + public var adminKey: Key? { + willSet { + ensureNotFrozen() + } + } + + /// Sets an administrative key controlled by the node operator. + @discardableResult + public func adminKey(_ adminKey: Key) -> Self { + self.adminKey = adminKey + + return self + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws { + try accountId?.validateChecksums(on: ledgerId) + try super.validateChecksums(on: ledgerId) + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_AddressBookServiceAsyncClient(channel: channel).updateNode(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .nodeUpdate(toProtobuf()) + } +} + +extension NodeUpdateTransaction: ToProtobuf { + internal typealias Protobuf = Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.nodeID = nodeId ?? 0 + accountId?.toProtobufInto(&proto.accountID) + proto.gossipEndpoint = gossipEndpoints.map { $0.toProtobuf() } + proto.serviceEndpoint = serviceEndpoints.map { $0.toProtobuf() } + proto.gossipCaCertificate = Google_Protobuf_BytesValue(gossipCaCertificate ?? Data()) + proto.grpcCertificateHash = Google_Protobuf_BytesValue(grpcCertificateHash ?? Data()) + + if let description = description { + proto.description_p = Google_Protobuf_StringValue(description) + } + + if let adminKey = adminKey { + proto.adminKey = adminKey.toProtobuf() + } + } + } +} + +extension NodeUpdateTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .nodeUpdate(toProtobuf()) + } +} diff --git a/Sources/Hedera/AnyTransaction.swift b/Sources/Hedera/AnyTransaction.swift index 9d4c2110..78f80ab5 100644 --- a/Sources/Hedera/AnyTransaction.swift +++ b/Sources/Hedera/AnyTransaction.swift @@ -65,6 +65,9 @@ internal enum ServicesTransactionDataList { case ethereum([Proto_EthereumTransactionBody]) case prng([Proto_UtilPrngTransactionBody]) case tokenUpdateNfts([Proto_TokenUpdateNftsTransactionBody]) + case nodeCreate([Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody]) + case nodeUpdate([Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody]) + case nodeDelete([Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody]) internal mutating func append(_ transaction: Proto_TransactionBody.OneOf_Data) throws { switch (self, transaction) { @@ -240,6 +243,18 @@ internal enum ServicesTransactionDataList { array.append(data) self = .tokenReject(array) + case (.nodeCreate(var array), .nodeCreate(let data)): + array.append(data) + self = .nodeCreate(array) + + case (.nodeUpdate(var array), .nodeUpdate(let data)): + array.append(data) + self = .nodeUpdate(array) + + case (.nodeDelete(var array), .nodeDelete(let data)): + array.append(data) + self = .nodeDelete(array) + default: throw HError.fromProtobuf("mismatched transaction types") } @@ -304,9 +319,9 @@ extension ServicesTransactionDataList: TryFromProtobuf { case .cryptoDeleteLiveHash: throw HError.fromProtobuf("Unsupported transaction `DeleteLiveHashTransaction`") case .uncheckedSubmit: throw HError.fromProtobuf("Unsupported transaction `UncheckedSubmitTransaction`") case .nodeStakeUpdate: throw HError.fromProtobuf("Unsupported transaction `NodeStakeUpdateTransaction`") - case .nodeDelete: throw HError.fromProtobuf("Unsupported transaction `NodeDeleteTransaction`") - case .nodeCreate: throw HError.fromProtobuf("Unsupported transaction `NodeCreateTransaction`") - case .nodeUpdate: throw HError.fromProtobuf("Unsupported transaction `NodeUpdateTransaction`") + case .nodeCreate(let data): value = .nodeCreate([data]) + case .nodeUpdate(let data): value = .nodeUpdate([data]) + case .nodeDelete(let data): value = .nodeDelete([data]) case .tokenReject(let data): value = .tokenReject([data]) case .tokenAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenAirdropTransaction`") case .tokenCancelAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenCancelAirdropTransaction`") diff --git a/Sources/Hedera/FeeSchedule/RequestType.swift b/Sources/Hedera/FeeSchedule/RequestType.swift index b94c88a3..f254c04d 100644 --- a/Sources/Hedera/FeeSchedule/RequestType.swift +++ b/Sources/Hedera/FeeSchedule/RequestType.swift @@ -262,7 +262,7 @@ public enum RequestType { /// Airdrop one or more tokens to one or more accounts. case tokenAirdrop - /// Remove one or more pending airdrops from state on + /// Remove one or more pending airdrops from state on /// behalf of the sender(s) for each airdrop. case tokenCancelAirdrop diff --git a/Sources/Hedera/NodeAddress.swift b/Sources/Hedera/NodeAddress.swift index e099d59c..bb95d7bb 100644 --- a/Sources/Hedera/NodeAddress.swift +++ b/Sources/Hedera/NodeAddress.swift @@ -27,6 +27,7 @@ public struct SocketAddressV4: LosslessStringConvertible { // swiftlint:disable:next identifier_name public var ip: IPv4Address public var port: UInt16 + public var domainName: String fileprivate init(ipBytes: Data, port: Int32) throws { guard let ipAddress = IPv4Address(ipBytes) else { @@ -41,6 +42,7 @@ public struct SocketAddressV4: LosslessStringConvertible { self.ip = ipAddress self.port = port + self.domainName = "" } fileprivate init(parsing description: S) throws { @@ -58,6 +60,7 @@ public struct SocketAddressV4: LosslessStringConvertible { self.ip = ipAddress self.port = port + self.domainName = "" } public init?(_ description: String) { @@ -80,6 +83,7 @@ extension SocketAddressV4: TryProtobufCodable { .with { proto in proto.ipAddressV4 = ip.rawValue proto.port = Int32(port) + proto.domainName = domainName } } } diff --git a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift index 1eaee783..622f979e 100644 --- a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift +++ b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift @@ -205,6 +205,20 @@ extension Transaction { case .tokenReject(let value): let value = try intoOnlyValue(value) return try TokenRejectTransaction(protobuf: firstBody, value) + + case .nodeCreate(let value): + let value = try intoOnlyValue(value) + return try NodeCreateTransaction(protobuf: firstBody, value) + + case .nodeUpdate(let value): + let value = try intoOnlyValue(value) + return try NodeUpdateTransaction(protobuf: firstBody, value) + + case .nodeDelete(let value): + let value = try intoOnlyValue(value) + return try NodeDeleteTransaction(protobuf: firstBody, value) + } + } } From 9846084068a8ff1909ed831138902925da0dc84b Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Tue, 20 Aug 2024 12:40:32 -0700 Subject: [PATCH 04/11] tests: unit tests for Node Transactions Signed-off-by: Ricky Saechao --- .../NodeCreateTransactionTests.swift | 166 +++++++++++++++++ .../NodeDeleteTransactionTests.swift | 75 ++++++++ .../NodeUpdateTransactionTests.swift | 176 ++++++++++++++++++ .../testSerialize.1.txt | 43 +++++ .../testSerialize.1.txt | 19 ++ .../testSerialize.1.txt | 50 +++++ 6 files changed, 529 insertions(+) create mode 100644 Tests/HederaTests/NodeCreateTransactionTests.swift create mode 100644 Tests/HederaTests/NodeDeleteTransactionTests.swift create mode 100644 Tests/HederaTests/NodeUpdateTransactionTests.swift create mode 100644 Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt create mode 100644 Tests/HederaTests/__Snapshots__/NodeDeleteTransactionTests/testSerialize.1.txt create mode 100644 Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt diff --git a/Tests/HederaTests/NodeCreateTransactionTests.swift b/Tests/HederaTests/NodeCreateTransactionTests.swift new file mode 100644 index 00000000..40ca3c77 --- /dev/null +++ b/Tests/HederaTests/NodeCreateTransactionTests.swift @@ -0,0 +1,166 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import XCTest + +@testable import Hedera + +internal final class NodeCreateTransactionTests: XCTestCase { + internal static let testDescription = "test description" + internal static let testGossipCertificate = Data([0x01, 0x02, 0x03, 0x04]) + internal static let testGrpcCertificateHash = Data([0x05, 0x06, 0x07, 0x08]) + + private static func makeIpv4AddressList() throws -> [SocketAddressV4] { + [SocketAddressV4("127.0.0.1:50222")!, SocketAddressV4("127.0.0.1:50212")!] + } + + private static func makeTransaction() throws -> NodeCreateTransaction { + try NodeCreateTransaction() + .nodeAccountIds([AccountId("0.0.5005"), AccountId("0.0.5006")]) + .transactionId( + TransactionId( + accountId: 5005, validStart: Timestamp(seconds: 1_554_158_542, subSecondNanos: 0), scheduled: false) + ) + .accountId(AccountId.fromString("0.0.5007")) + .description(testDescription) + .gossipEndpoints(try Self.makeIpv4AddressList()) + .serviceEndpoints(try Self.makeIpv4AddressList()) + .gossipCaCertificate(Self.testGossipCertificate) + .grpcCertificateHash(Self.testGrpcCertificateHash) + .adminKey(Key.single(Resources.privateKey.publicKey)) + .freeze() + .sign(Resources.privateKey) + } + + internal func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + + assertSnapshot(matching: tx, as: .description) + } + + internal func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + internal func testFromProtoBody() throws { + let protoData = try Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody.with { proto in + proto.accountID = Resources.accountId.toProtobuf() + proto.description_p = Self.testDescription + proto.gossipEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.serviceEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.gossipCaCertificate = Self.testGossipCertificate + proto.grpcCertificateHash = Self.testGrpcCertificateHash + proto.adminKey = Key.single(Resources.publicKey).toProtobuf() + } + + let endpoints = try Self.makeIpv4AddressList() + + let protoBody = Proto_TransactionBody.with { proto in + proto.nodeCreate = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try NodeCreateTransaction(protobuf: protoBody, protoData) + + XCTAssertEqual(tx.accountId, Resources.accountId) + XCTAssertEqual(tx.adminKey, Key.single(Resources.publicKey)) + XCTAssertEqual(tx.description, Self.testDescription) + XCTAssertEqual(tx.gossipCaCertificate, Self.testGossipCertificate) + XCTAssertEqual(tx.grpcCertificateHash, Self.testGrpcCertificateHash) + XCTAssertEqual(tx.gossipEndpoints.count, 2) + XCTAssertEqual(tx.serviceEndpoints.count, 2) + + for (index, endpoint) in tx.gossipEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + + for (index, endpoint) in tx.serviceEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetAccountId() throws { + let tx = NodeCreateTransaction() + tx.accountId(Resources.accountId) + + XCTAssertEqual(tx.accountId, Resources.accountId) + } + + internal func testGetSetAdminKey() throws { + let tx = NodeCreateTransaction() + tx.adminKey(.single(Resources.publicKey)) + + XCTAssertEqual(tx.adminKey, .single(Resources.publicKey)) + } + + internal func testGetSetDescription() throws { + let tx = NodeCreateTransaction() + tx.description(Self.testDescription) + + XCTAssertEqual(tx.description, Self.testDescription) + } + + internal func testGetSetGossipEndpoints() throws { + let tx = NodeCreateTransaction() + let endpoints = try Self.makeIpv4AddressList() + tx.gossipEndpoints(endpoints) + + for (index, endpoint) in tx.gossipEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetServiceEndpoints() throws { + let tx = NodeCreateTransaction() + let endpoints = try Self.makeIpv4AddressList() + tx.serviceEndpoints(endpoints) + + for (index, endpoint) in tx.serviceEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetGossipCaCertificate() throws { + let tx = NodeCreateTransaction() + tx.gossipCaCertificate(Self.testGossipCertificate) + + XCTAssertEqual(tx.gossipCaCertificate, Self.testGossipCertificate) + } + + internal func testGetSetGrpcCertificateHash() throws { + let tx = NodeCreateTransaction() + tx.grpcCertificateHash(Self.testGrpcCertificateHash) + + XCTAssertEqual(tx.grpcCertificateHash, Self.testGrpcCertificateHash) + } +} diff --git a/Tests/HederaTests/NodeDeleteTransactionTests.swift b/Tests/HederaTests/NodeDeleteTransactionTests.swift new file mode 100644 index 00000000..c573e9fc --- /dev/null +++ b/Tests/HederaTests/NodeDeleteTransactionTests.swift @@ -0,0 +1,75 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import SwiftProtobuf +import XCTest + +@testable import Hedera + +internal final class NodeDeleteTransactionTests: XCTestCase { + private static func makeTransaction() throws -> NodeDeleteTransaction { + try NodeDeleteTransaction() + .nodeAccountIds([AccountId("0.0.5005"), AccountId("0.0.5006")]) + .transactionId( + TransactionId( + accountId: 5005, validStart: Timestamp(seconds: 1_554_158_542, subSecondNanos: 0), scheduled: false) + ) + .nodeId(2) + .freeze() + .sign(Resources.privateKey) + } + + internal func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + + assertSnapshot(matching: tx, as: .description) + } + + internal func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + internal func testFromProtoBody() throws { + let protoData = Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody.with { proto in + proto.nodeID = 2 + } + + let protoBody = Proto_TransactionBody.with { proto in + proto.nodeDelete = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try NodeDeleteTransaction(protobuf: protoBody, protoData) + + XCTAssertEqual(tx.nodeId, 2) + } + + internal func testGetSetNodeId() throws { + let tx = NodeDeleteTransaction() + tx.nodeId(2) + + XCTAssertEqual(tx.nodeId, 2) + } +} diff --git a/Tests/HederaTests/NodeUpdateTransactionTests.swift b/Tests/HederaTests/NodeUpdateTransactionTests.swift new file mode 100644 index 00000000..477bd9f2 --- /dev/null +++ b/Tests/HederaTests/NodeUpdateTransactionTests.swift @@ -0,0 +1,176 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import SwiftProtobuf +import XCTest + +@testable import Hedera + +internal final class NodeUpdateTransactionTests: XCTestCase { + internal static let testDescription = "test description" + internal static let testGossipCertificate = Data([0x01, 0x02, 0x03, 0x04]) + internal static let testGrpcCertificateHash = Data([0x05, 0x06, 0x07, 0x08]) + + private static func makeIpv4AddressList() throws -> [SocketAddressV4] { + [SocketAddressV4("127.0.0.1:50222")!, SocketAddressV4("127.0.0.1:50212")!] + } + + private static func makeTransaction() throws -> NodeUpdateTransaction { + try NodeUpdateTransaction() + .nodeId(1) + .nodeAccountIds([AccountId("0.0.5005"), AccountId("0.0.5006")]) + .transactionId( + TransactionId( + accountId: 5005, validStart: Timestamp(seconds: 1_554_158_542, subSecondNanos: 0), scheduled: false) + ) + .accountId(AccountId.fromString("0.0.5007")) + .description(testDescription) + .gossipEndpoints(try Self.makeIpv4AddressList()) + .serviceEndpoints(try Self.makeIpv4AddressList()) + .gossipCaCertificate(Self.testGossipCertificate) + .grpcCertificateHash(Self.testGrpcCertificateHash) + .adminKey(Key.single(Resources.privateKey.publicKey)) + .freeze() + .sign(Resources.privateKey) + } + + internal func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + + assertSnapshot(matching: tx, as: .description) + } + + internal func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + internal func testFromProtoBody() throws { + let protoData = try Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody.with { proto in + proto.accountID = Resources.accountId.toProtobuf() + proto.description_p = Google_Protobuf_StringValue(Self.testDescription) + proto.gossipEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.serviceEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.gossipCaCertificate = Google_Protobuf_BytesValue(Self.testGossipCertificate) + proto.grpcCertificateHash = Google_Protobuf_BytesValue(Self.testGrpcCertificateHash) + proto.adminKey = Key.single(Resources.publicKey).toProtobuf() + } + + let endpoints = try Self.makeIpv4AddressList() + + let protoBody = Proto_TransactionBody.with { proto in + proto.nodeUpdate = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try NodeUpdateTransaction(protobuf: protoBody, protoData) + + XCTAssertEqual(tx.nodeId, 1) + XCTAssertEqual(tx.accountId, Resources.accountId) + XCTAssertEqual(tx.adminKey, Key.single(Resources.publicKey)) + XCTAssertEqual(tx.description, Self.testDescription) + XCTAssertEqual(tx.gossipCaCertificate, Self.testGossipCertificate) + XCTAssertEqual(tx.grpcCertificateHash, Self.testGrpcCertificateHash) + XCTAssertEqual(tx.gossipEndpoints.count, 2) + XCTAssertEqual(tx.serviceEndpoints.count, 2) + + for (index, endpoint) in tx.gossipEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + + for (index, endpoint) in tx.serviceEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetNodeId() throws { + let tx = NodeUpdateTransaction() + tx.nodeId(1) + + XCTAssertEqual(tx.nodeId, 1) + } + + internal func testGetSetAccountId() throws { + let tx = NodeUpdateTransaction() + tx.accountId(Resources.accountId) + + XCTAssertEqual(tx.accountId, Resources.accountId) + } + + internal func testGetSetAdminKey() throws { + let tx = NodeUpdateTransaction() + tx.adminKey(.single(Resources.publicKey)) + + XCTAssertEqual(tx.adminKey, .single(Resources.publicKey)) + } + + internal func testGetSetDescription() throws { + let tx = NodeUpdateTransaction() + tx.description(Self.testDescription) + + XCTAssertEqual(tx.description, Self.testDescription) + } + + internal func testGetSetGossipEndpoints() throws { + let tx = NodeUpdateTransaction() + let endpoints = try Self.makeIpv4AddressList() + tx.gossipEndpoints(endpoints) + + for (index, endpoint) in tx.gossipEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetServiceEndpoints() throws { + let tx = NodeUpdateTransaction() + let endpoints = try Self.makeIpv4AddressList() + tx.serviceEndpoints(endpoints) + + for (index, endpoint) in tx.serviceEndpoints.enumerated() { + XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.port, endpoints[index].port) + XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + } + } + + internal func testGetSetGossipCaCertificate() throws { + let tx = NodeUpdateTransaction() + tx.gossipCaCertificate(Self.testGossipCertificate) + + XCTAssertEqual(tx.gossipCaCertificate, Self.testGossipCertificate) + } + + internal func testGetSetGrpcCertificateHash() throws { + let tx = NodeUpdateTransaction() + tx.grpcCertificateHash(Self.testGrpcCertificateHash) + + XCTAssertEqual(tx.grpcCertificateHash, Self.testGrpcCertificateHash) + } +} diff --git a/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..2479c4bb --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt @@ -0,0 +1,43 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5005 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +nodeCreate { + account_id { + accountNum: 5007 + } + description: "test description" + gossip_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50222 + } + gossip_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50212 + } + service_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50222 + } + service_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50212 + } + gossip_ca_certificate: "\001\002\003\004" + grpc_certificate_hash: "\005\006\007\b" + admin_key { + ed25519: "\340\310\354'X\245\207\237\372\302&\241<\fQky\236r\343QA\240\335\202\217\224\323y\210\244\267" + } +} diff --git a/Tests/HederaTests/__Snapshots__/NodeDeleteTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/NodeDeleteTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..b94fc04d --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/NodeDeleteTransactionTests/testSerialize.1.txt @@ -0,0 +1,19 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5005 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +nodeDelete { + node_id: 2 +} diff --git a/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..41747beb --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt @@ -0,0 +1,50 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5005 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +nodeUpdate { + node_id: 1 + account_id { + accountNum: 5007 + } + description { + value: "test description" + } + gossip_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50222 + } + gossip_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50212 + } + service_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50222 + } + service_endpoint { + ipAddressV4: "\177\000\000\001" + port: 50212 + } + gossip_ca_certificate { + value: "\001\002\003\004" + } + grpc_certificate_hash { + value: "\005\006\007\b" + } + admin_key { + ed25519: "\340\310\354'X\245\207\237\372\302&\241<\fQky\236r\343QA\240\335\202\217\224\323y\210\244\267" + } +} From 48f812383828c0e88b969e056d2286c38e22c31d Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Tue, 20 Aug 2024 12:42:25 -0700 Subject: [PATCH 05/11] chore: upgrade swift-protobuf package 1.6.0 -> 1.26.0 Signed-off-by: Ricky Saechao --- Package.resolved | 4 ++-- Package.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Package.resolved b/Package.resolved index 1c1a80f0..68f9ccfa 100644 --- a/Package.resolved +++ b/Package.resolved @@ -239,8 +239,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-protobuf.git", "state" : { - "revision" : "3c54ab05249f59f2c6641dd2920b8358ea9ed127", - "version" : "1.24.0" + "revision" : "e17d61f26df0f0e06f58f6977ba05a097a720106", + "version" : "1.27.1" } }, { diff --git a/Package.swift b/Package.swift index 4e5ccdfd..ae22bc09 100644 --- a/Package.swift +++ b/Package.swift @@ -88,7 +88,7 @@ let package = Package( .package(url: "https://github.com/objecthub/swift-numberkit.git", from: "2.4.1"), .package(url: "https://github.com/thebarndog/swift-dotenv.git", from: "1.0.0"), .package(url: "https://github.com/grpc/grpc-swift.git", from: "1.23.0"), - .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.6.0"), + .package(url: "https://github.com/apple/swift-protobuf.git", from: "1.26.0"), .package(url: "https://github.com/vsanthanam/AnyAsyncSequence.git", from: "1.0.0"), .package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"), // swift-asn1 wants swift 5.7+ past 0.4 From a1cc558b8054ffdabac9cd374dc4dfc1047e2390 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Wed, 21 Aug 2024 11:45:23 -0700 Subject: [PATCH 06/11] chore: resolve Transaction deprecated init warnings Signed-off-by: Ricky Saechao --- Sources/Hedera/Transaction.swift | 8 ++++---- Sources/Hedera/Transaction/TransactionSources.swift | 4 ++-- Sources/HederaTCK/main.swift | 6 +++--- Tests/HederaTests/FileAppendTransactionTests.swift | 6 +++--- Tests/HederaTests/Transaction+Extensions.swift | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Sources/Hedera/Transaction.swift b/Sources/Hedera/Transaction.swift index d5cb5102..25083d7e 100644 --- a/Sources/Hedera/Transaction.swift +++ b/Sources/Hedera/Transaction.swift @@ -360,10 +360,10 @@ public class Transaction: ValidateChecksums { public static func fromBytes(_ bytes: Data) throws -> Transaction { let list: [Proto_Transaction] do { - let tmp = try Proto_TransactionList(contiguousBytes: bytes) + let tmp = try Proto_TransactionList(serializedBytes: bytes) if tmp.transactionList.isEmpty { - list = [try Proto_Transaction(contiguousBytes: bytes)] + list = [try Proto_Transaction(serializedBytes: bytes)] } else { list = tmp.transactionList } @@ -375,7 +375,7 @@ public class Transaction: ValidateChecksums { let transactionBodies = try sources.signedTransactions.map { signed -> Proto_TransactionBody in do { - return try Proto_TransactionBody(contiguousBytes: signed.bodyBytes) + return try Proto_TransactionBody(serializedBytes: signed.bodyBytes) } catch { throw HError.fromProtobuf(String(describing: error)) } @@ -399,7 +399,7 @@ public class Transaction: ValidateChecksums { .lazy .map { signed -> Proto_TransactionBody in do { - return try Proto_TransactionBody(contiguousBytes: signed.bodyBytes) + return try Proto_TransactionBody(serializedBytes: signed.bodyBytes) } catch { throw HError.fromProtobuf(String(describing: error)) } diff --git a/Sources/Hedera/Transaction/TransactionSources.swift b/Sources/Hedera/Transaction/TransactionSources.swift index ad864028..f20aff92 100644 --- a/Sources/Hedera/Transaction/TransactionSources.swift +++ b/Sources/Hedera/Transaction/TransactionSources.swift @@ -153,7 +153,7 @@ extension TransactionSources { throw HError.fromProtobuf("Transaction had no signed transaction bytes") } - return try Proto_SignedTransaction(contiguousBytes: transaction.signedTransactionBytes) + return try Proto_SignedTransaction(serializedBytes: transaction.signedTransactionBytes) } // ensure all signers (if any) are consistent for all signed transactions. @@ -182,7 +182,7 @@ extension TransactionSources { signedTx -> (transactionId: TransactionId, nodeAccountId: AccountId) in let transactionBody: Proto_TransactionBody do { - transactionBody = try Proto_TransactionBody(contiguousBytes: signedTx.bodyBytes) + transactionBody = try Proto_TransactionBody(serializedBytes: signedTx.bodyBytes) } catch { throw HError.fromProtobuf(String(describing: error)) } diff --git a/Sources/HederaTCK/main.swift b/Sources/HederaTCK/main.swift index a4d83bf8..ee0ffcb3 100644 --- a/Sources/HederaTCK/main.swift +++ b/Sources/HederaTCK/main.swift @@ -97,9 +97,9 @@ private struct TCKServer { return JSONResponse(id: request.id, error: error) } catch let error as HError { switch error.kind { - case .transactionPreCheckStatus(let status, let _), - .queryPreCheckStatus(let status, let _), - .receiptStatus(let status, let _): + case .transactionPreCheckStatus(let status, _), + .queryPreCheckStatus(let status, _), + .receiptStatus(let status, _): return JSONResponse( id: request.id, error: JSONError.hederaError( diff --git a/Tests/HederaTests/FileAppendTransactionTests.swift b/Tests/HederaTests/FileAppendTransactionTests.swift index 7c148a50..23a63290 100644 --- a/Tests/HederaTests/FileAppendTransactionTests.swift +++ b/Tests/HederaTests/FileAppendTransactionTests.swift @@ -45,7 +45,7 @@ internal final class FileAppendTransactionTests: XCTestCase { // Unlike most transactions, this iteration makes sure the chunked data is properly handled. // NOTE: Without a client, dealing with chunked data is cumbersome. let bodyBytes = try tx.makeSources().signedTransactions.makeIterator().map { signed in - try Proto_TransactionBody.init(contiguousBytes: signed.bodyBytes) + try Proto_TransactionBody.init(serializedBytes: signed.bodyBytes) } let txes = try bodyBytes.makeIterator().map { bytes in @@ -62,11 +62,11 @@ internal final class FileAppendTransactionTests: XCTestCase { // As stated above, this assignment properly handles the possibilty of the data being chunked. let txBody = try tx.makeSources().signedTransactions.makeIterator().map { signed in - try Proto_TransactionBody.init(contiguousBytes: signed.bodyBytes) + try Proto_TransactionBody.init(serializedBytes: signed.bodyBytes) } let txBody2 = try tx2.makeSources().signedTransactions.makeIterator().map { signed in - try Proto_TransactionBody.init(contiguousBytes: signed.bodyBytes) + try Proto_TransactionBody.init(serializedBytes: signed.bodyBytes) } XCTAssertEqual(txBody, txBody2) diff --git a/Tests/HederaTests/Transaction+Extensions.swift b/Tests/HederaTests/Transaction+Extensions.swift index 0f9da2d9..fc1623fa 100644 --- a/Tests/HederaTests/Transaction+Extensions.swift +++ b/Tests/HederaTests/Transaction+Extensions.swift @@ -26,6 +26,6 @@ import XCTest extension Transaction { internal func makeProtoBody() throws -> Proto_TransactionBody { - try Proto_TransactionBody(contiguousBytes: makeSources().signedTransactions[0].bodyBytes) + try Proto_TransactionBody(serializedBytes: makeSources().signedTransactions[0].bodyBytes) } } From a020b698533b4b2e25c554e8589a62199947a8a7 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Wed, 21 Aug 2024 11:48:54 -0700 Subject: [PATCH 07/11] fix: update grpc services Signed-off-by: Ricky Saechao --- .../Hedera/Token/TokenRejectTransaction.swift | 2 +- .../Services/address_book_service.grpc.swift | 416 ------------------ .../Services/file_service.grpc.swift | 4 +- .../Services/network_service.grpc.swift | 6 +- .../smart_contract_service.grpc.swift | 4 +- .../Services/token_service.grpc.swift | 353 +++++++++++++++ 6 files changed, 361 insertions(+), 424 deletions(-) diff --git a/Sources/Hedera/Token/TokenRejectTransaction.swift b/Sources/Hedera/Token/TokenRejectTransaction.swift index 641e31b0..a3cd2bcc 100644 --- a/Sources/Hedera/Token/TokenRejectTransaction.swift +++ b/Sources/Hedera/Token/TokenRejectTransaction.swift @@ -120,7 +120,7 @@ public final class TokenRejectTransaction: Transaction { internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws -> Proto_TransactionResponse { - try await Proto_TokenServiceAsyncClient(channel: channel).deleteToken(request) + try await Proto_TokenServiceAsyncClient(channel: channel).rejectToken(request) } internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { diff --git a/Sources/HederaProtobufs/Services/address_book_service.grpc.swift b/Sources/HederaProtobufs/Services/address_book_service.grpc.swift index cf693bc5..26bfff14 100644 --- a/Sources/HederaProtobufs/Services/address_book_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/address_book_service.grpc.swift @@ -526,419 +526,3 @@ public enum Proto_AddressBookServiceClientMetadata { } } -///* -/// The Address Book service provides the ability for Hedera network node -/// administrators to add, update, and remove consensus nodes. This addition, -/// update, or removal of a consensus node requires governing council approval, -/// but each node operator may update their own operational attributes without -/// additional approval, reducing overhead for routine operations. -/// -/// Most operations are `privileged operations` and require governing council -/// approval. -/// -/// ### For a node creation transaction. -/// - The node operator SHALL create a `createNode` transaction. -/// - The node operator SHALL sign this transaction with the active `key` for -/// the account to be assigned as the "node account". -/// - The node operator MUST deliver the signed transaction to the Hedera -/// council representative. -/// - The Hedera council representative SHALL arrange for council members to -/// review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node creation transaction the network -/// software SHALL -/// - Validate the threshold signature for the Hedera governing council -/// - Validate the signature of the active `key` for the account to be -/// assigned as the "node account". -/// - Create the new node in state, this new node SHALL NOT be active in the -/// network at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration and bring the -/// new node to an active status within the network. The node to be added -/// SHALL be active in the network following this upgrade. -/// -/// ### For a node deletion transaction. -/// - The node operator or Hedera council representative SHALL create a -/// `deleteNode` transaction. -/// - If the node operator creates the transaction -/// - The node operator MUST sign this transaction with the active `key` -/// for the account assigned as the "node account". -/// - The node operator SHALL deliver the signed transaction to the Hedera -/// council representative. -/// - The Hedera council representative SHALL arrange for council members to -/// review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node deletion transaction the network -/// software SHALL -/// - Validate the threshold signature for the Hedera governing council -/// - Remove the existing node from network state. The node SHALL still -/// be active in the network at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration and remove the -/// node to be deleted from the network. The node to be deleted SHALL NOT -/// be active in the network following this upgrade. -/// -/// ### For a node update transaction. -/// - The node operator or Hedera council representative SHALL create an -/// `updateNode` transaction. -/// - If the node operator creates the transaction -/// - The node operator MUST sign this transaction with the active `key` -/// for the account assigned as the current "node account". -/// - If the transaction changes the value of the "node account" the -/// node operator MUST _also_ sign this transaction with the active `key` -/// for the account to be assigned as the new "node account". -/// - The node operator SHALL submit the transaction to the -/// network. Hedera council approval SHALL NOT be sought for this -/// transaction -/// - If the Hedera council representative creates the transaction -/// - The Hedera council representative SHALL arrange for council members -/// to review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node update transaction the network -/// software SHALL -/// - If the transaction is signed by the Hedera governing council -/// - Validate the threshold signature for the Hedera governing council -/// - If the transaction is signed by the active `key` for the node account -/// - Validate the signature of the active `key` for the account assigned -/// as the "node account". -/// - If the transaction modifies the value of the "node account", -/// - Validate the signature of the _new_ `key` for the account to be -/// assigned as the new "node account". -/// - Modify the node information held in network state with the changes -/// requested in the update transaction. The node changes SHALL NOT be -/// applied to network configuration, and SHALL NOT affect network -/// operation at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration according to the -/// modified information in network state. The requested changes SHALL -/// affect network operation following this upgrade. -/// -/// To build a server, implement a class that conforms to this protocol. -public protocol Proto_AddressBookServiceProvider: CallHandlerProvider { - var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { get } - - ///* - /// A transaction to create a new consensus node in the network. - /// address book. - ///

- /// This transaction, once complete, SHALL add a new consensus node to the - /// network state.
- /// The new consensus node SHALL remain in state, but SHALL NOT participate - /// in network consensus until the network updates the network configuration. - ///

- /// Hedera governing council authorization is REQUIRED for this transaction. - func createNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture - - ///* - /// A transaction to remove a consensus node from the network address - /// book. - ///

- /// This transaction, once complete, SHALL remove the identified consensus - /// node from the network state. - ///

- /// Hedera governing council authorization is REQUIRED for this transaction. - func deleteNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture - - ///* - /// A transaction to update an existing consensus node from the network - /// address book. - ///

- /// This transaction, once complete, SHALL modify the identified consensus - /// node state as requested. - ///

- /// This transaction MAY be authorized by either the node operator OR the - /// Hedera governing council. - func updateNode(request: Proto_Transaction, context: StatusOnlyCallContext) -> EventLoopFuture -} - -extension Proto_AddressBookServiceProvider { - public var serviceName: Substring { - return Proto_AddressBookServiceServerMetadata.serviceDescriptor.fullName[...] - } - - /// Determines, calls and returns the appropriate request handler, depending on the request's method. - /// Returns nil for methods not handled by this service. - public func handle( - method name: Substring, - context: CallHandlerContext - ) -> GRPCServerHandlerProtocol? { - switch name { - case "createNode": - return UnaryServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [], - userFunction: self.createNode(request:context:) - ) - - case "deleteNode": - return UnaryServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [], - userFunction: self.deleteNode(request:context:) - ) - - case "updateNode": - return UnaryServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [], - userFunction: self.updateNode(request:context:) - ) - - default: - return nil - } - } -} - -///* -/// The Address Book service provides the ability for Hedera network node -/// administrators to add, update, and remove consensus nodes. This addition, -/// update, or removal of a consensus node requires governing council approval, -/// but each node operator may update their own operational attributes without -/// additional approval, reducing overhead for routine operations. -/// -/// Most operations are `privileged operations` and require governing council -/// approval. -/// -/// ### For a node creation transaction. -/// - The node operator SHALL create a `createNode` transaction. -/// - The node operator SHALL sign this transaction with the active `key` for -/// the account to be assigned as the "node account". -/// - The node operator MUST deliver the signed transaction to the Hedera -/// council representative. -/// - The Hedera council representative SHALL arrange for council members to -/// review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node creation transaction the network -/// software SHALL -/// - Validate the threshold signature for the Hedera governing council -/// - Validate the signature of the active `key` for the account to be -/// assigned as the "node account". -/// - Create the new node in state, this new node SHALL NOT be active in the -/// network at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration and bring the -/// new node to an active status within the network. The node to be added -/// SHALL be active in the network following this upgrade. -/// -/// ### For a node deletion transaction. -/// - The node operator or Hedera council representative SHALL create a -/// `deleteNode` transaction. -/// - If the node operator creates the transaction -/// - The node operator MUST sign this transaction with the active `key` -/// for the account assigned as the "node account". -/// - The node operator SHALL deliver the signed transaction to the Hedera -/// council representative. -/// - The Hedera council representative SHALL arrange for council members to -/// review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node deletion transaction the network -/// software SHALL -/// - Validate the threshold signature for the Hedera governing council -/// - Remove the existing node from network state. The node SHALL still -/// be active in the network at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration and remove the -/// node to be deleted from the network. The node to be deleted SHALL NOT -/// be active in the network following this upgrade. -/// -/// ### For a node update transaction. -/// - The node operator or Hedera council representative SHALL create an -/// `updateNode` transaction. -/// - If the node operator creates the transaction -/// - The node operator MUST sign this transaction with the active `key` -/// for the account assigned as the current "node account". -/// - If the transaction changes the value of the "node account" the -/// node operator MUST _also_ sign this transaction with the active `key` -/// for the account to be assigned as the new "node account". -/// - The node operator SHALL submit the transaction to the -/// network. Hedera council approval SHALL NOT be sought for this -/// transaction -/// - If the Hedera council representative creates the transaction -/// - The Hedera council representative SHALL arrange for council members -/// to review and sign the transaction. -/// - Once sufficient council members have signed the transaction, the -/// Hedera council representative SHALL submit the transaction to the -/// network. -/// - Upon receipt of a valid and signed node update transaction the network -/// software SHALL -/// - If the transaction is signed by the Hedera governing council -/// - Validate the threshold signature for the Hedera governing council -/// - If the transaction is signed by the active `key` for the node account -/// - Validate the signature of the active `key` for the account assigned -/// as the "node account". -/// - If the transaction modifies the value of the "node account", -/// - Validate the signature of the _new_ `key` for the account to be -/// assigned as the new "node account". -/// - Modify the node information held in network state with the changes -/// requested in the update transaction. The node changes SHALL NOT be -/// applied to network configuration, and SHALL NOT affect network -/// operation at this time. -/// - When executing the next `freeze` transaction with `freeze_type` set to -/// `PREPARE_UPGRADE`, update network configuration according to the -/// modified information in network state. The requested changes SHALL -/// affect network operation following this upgrade. -/// -/// To implement a server, implement an object which conforms to this protocol. -@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) -public protocol Proto_AddressBookServiceAsyncProvider: CallHandlerProvider, Sendable { - static var serviceDescriptor: GRPCServiceDescriptor { get } - var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { get } - - ///* - /// A transaction to create a new consensus node in the network. - /// address book. - ///

- /// This transaction, once complete, SHALL add a new consensus node to the - /// network state.
- /// The new consensus node SHALL remain in state, but SHALL NOT participate - /// in network consensus until the network updates the network configuration. - ///

- /// Hedera governing council authorization is REQUIRED for this transaction. - func createNode( - request: Proto_Transaction, - context: GRPCAsyncServerCallContext - ) async throws -> Proto_TransactionResponse - - ///* - /// A transaction to remove a consensus node from the network address - /// book. - ///

- /// This transaction, once complete, SHALL remove the identified consensus - /// node from the network state. - ///

- /// Hedera governing council authorization is REQUIRED for this transaction. - func deleteNode( - request: Proto_Transaction, - context: GRPCAsyncServerCallContext - ) async throws -> Proto_TransactionResponse - - ///* - /// A transaction to update an existing consensus node from the network - /// address book. - ///

- /// This transaction, once complete, SHALL modify the identified consensus - /// node state as requested. - ///

- /// This transaction MAY be authorized by either the node operator OR the - /// Hedera governing council. - func updateNode( - request: Proto_Transaction, - context: GRPCAsyncServerCallContext - ) async throws -> Proto_TransactionResponse -} - -@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) -extension Proto_AddressBookServiceAsyncProvider { - public static var serviceDescriptor: GRPCServiceDescriptor { - return Proto_AddressBookServiceServerMetadata.serviceDescriptor - } - - public var serviceName: Substring { - return Proto_AddressBookServiceServerMetadata.serviceDescriptor.fullName[...] - } - - public var interceptors: Proto_AddressBookServiceServerInterceptorFactoryProtocol? { - return nil - } - - public func handle( - method name: Substring, - context: CallHandlerContext - ) -> GRPCServerHandlerProtocol? { - switch name { - case "createNode": - return GRPCAsyncServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makecreateNodeInterceptors() ?? [], - wrapping: { try await self.createNode(request: $0, context: $1) } - ) - - case "deleteNode": - return GRPCAsyncServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makedeleteNodeInterceptors() ?? [], - wrapping: { try await self.deleteNode(request: $0, context: $1) } - ) - - case "updateNode": - return GRPCAsyncServerHandler( - context: context, - requestDeserializer: ProtobufDeserializer(), - responseSerializer: ProtobufSerializer(), - interceptors: self.interceptors?.makeupdateNodeInterceptors() ?? [], - wrapping: { try await self.updateNode(request: $0, context: $1) } - ) - - default: - return nil - } - } -} - -public protocol Proto_AddressBookServiceServerInterceptorFactoryProtocol: Sendable { - - /// - Returns: Interceptors to use when handling 'createNode'. - /// Defaults to calling `self.makeInterceptors()`. - func makecreateNodeInterceptors() -> [ServerInterceptor] - - /// - Returns: Interceptors to use when handling 'deleteNode'. - /// Defaults to calling `self.makeInterceptors()`. - func makedeleteNodeInterceptors() -> [ServerInterceptor] - - /// - Returns: Interceptors to use when handling 'updateNode'. - /// Defaults to calling `self.makeInterceptors()`. - func makeupdateNodeInterceptors() -> [ServerInterceptor] -} - -public enum Proto_AddressBookServiceServerMetadata { - public static let serviceDescriptor = GRPCServiceDescriptor( - name: "AddressBookService", - fullName: "proto.AddressBookService", - methods: [ - Proto_AddressBookServiceServerMetadata.Methods.createNode, - Proto_AddressBookServiceServerMetadata.Methods.deleteNode, - Proto_AddressBookServiceServerMetadata.Methods.updateNode, - ] - ) - - public enum Methods { - public static let createNode = GRPCMethodDescriptor( - name: "createNode", - path: "/proto.AddressBookService/createNode", - type: GRPCCallType.unary - ) - - public static let deleteNode = GRPCMethodDescriptor( - name: "deleteNode", - path: "/proto.AddressBookService/deleteNode", - type: GRPCCallType.unary - ) - - public static let updateNode = GRPCMethodDescriptor( - name: "updateNode", - path: "/proto.AddressBookService/updateNode", - type: GRPCCallType.unary - ) - } -} diff --git a/Sources/HederaProtobufs/Services/file_service.grpc.swift b/Sources/HederaProtobufs/Services/file_service.grpc.swift index 1051194e..052e3cf8 100644 --- a/Sources/HederaProtobufs/Services/file_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/file_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_FileServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_FileServiceClientProtocol: GRPCClient { @@ -276,7 +276,7 @@ public struct Proto_FileServiceNIOClient: Proto_FileServiceClientProtocol { } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_FileServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Sources/HederaProtobufs/Services/network_service.grpc.swift b/Sources/HederaProtobufs/Services/network_service.grpc.swift index 6d8e092a..75fa571a 100644 --- a/Sources/HederaProtobufs/Services/network_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/network_service.grpc.swift @@ -65,9 +65,9 @@ extension Proto_NetworkServiceClientProtocol { } ///* - /// Retrieves the time in nanoseconds spent in handleTransaction for one or more - /// TransactionIDs (assuming they have reached consensus "recently", since only a limited - /// number of execution times are kept in-memory, depending on the value of the node-local + /// Retrieves the time in nanoseconds spent in handleTransaction for one or more + /// TransactionIDs (assuming they have reached consensus "recently", since only a limited + /// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). /// /// - Parameters: diff --git a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift index 9b5453e3..6ca3f73c 100644 --- a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_SmartContractServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_SmartContractServiceClientProtocol: GRPCClient { @@ -373,7 +373,7 @@ public struct Proto_SmartContractServiceNIOClient: Proto_SmartContractServiceCli } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_SmartContractServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Sources/HederaProtobufs/Services/token_service.grpc.swift b/Sources/HederaProtobufs/Services/token_service.grpc.swift index 602086af..5c3c0315 100644 --- a/Sources/HederaProtobufs/Services/token_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/token_service.grpc.swift @@ -113,6 +113,31 @@ public protocol Proto_TokenServiceClientProtocol: GRPCClient { _ request: Proto_Transaction, callOptions: CallOptions? ) -> UnaryCall + + func updateNfts( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func rejectToken( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func airdropTokens( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func cancelAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall + + func claimAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> UnaryCall } extension Proto_TokenServiceClientProtocol { @@ -478,6 +503,139 @@ extension Proto_TokenServiceClientProtocol { interceptors: self.interceptors?.makeunpauseTokenInterceptors() ?? [] ) } + + ///* + /// Updates the NFTs in a collection by TokenID and serial number + /// + /// - Parameters: + /// - request: Request to send to updateNfts. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func updateNfts( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.updateNfts.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNftsInterceptors() ?? [] + ) + } + + ///* + /// Reject one or more tokens.
+ /// This transaction SHALL transfer the full balance of one or more tokens from the requesting + /// account to the treasury for each token. This transfer SHALL NOT charge any custom fee or + /// royalty defined for the token(s) to be rejected.
+ ///

Effects on success

+ ///
    + ///
  • If the rejected token is fungible/common, the requesting account SHALL have a balance + /// of 0 for the rejected token. The treasury balance SHALL increase by the amount that + /// the requesting account decreased.
  • + ///
  • If the rejected token is non-fungible/unique the requesting account SHALL NOT hold + /// the specific serialized token that is rejected. The treasury account SHALL hold each + /// specific serialized token that was rejected.
  • + /// + /// + /// - Parameters: + /// - request: Request to send to rejectToken. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func rejectToken( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.rejectToken.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makerejectTokenInterceptors() ?? [] + ) + } + + ///* + /// Airdrop one or more tokens to one or more accounts.
    + /// This distributes tokens from the balance of one or more sending account(s) to the balance + /// of one or more recipient accounts. Accounts will receive the tokens in one of four ways. + ///
      + ///
    • An account already associated to the token to be distributed SHALL receive the + /// airdropped tokens immediately to the recipient account balance.
    • + ///
    • An account with available automatic association slots SHALL be automatically + /// associated to the token, and SHALL immediately receive the airdropped tokens to the + /// recipient account balance.
    • + ///
    • An account with "receiver signature required" set SHALL have a "Pending Airdrop" + /// created and MUST claim that airdrop with a `claimAirdrop` transaction.
    • + ///
    • An account with no available automatic association slots SHALL have a + /// "Pending Airdrop" created and MUST claim that airdrop with a `claimAirdrop` + /// transaction.
    • + ///
    + /// Any airdrop that completes immediately SHALL be irreversible. Any airdrop that results in a + /// "Pending Airdrop" MAY be canceled via a `cancelAirdrop` transaction.
    + /// All transfer fees (including custom fees and royalties), as well as the rent cost for the + /// first auto-renewal period for any automatic-association slot occupied by the airdropped + /// tokens, SHALL be charged to the account submitting this transaction. + /// + /// - Parameters: + /// - request: Request to send to airdropTokens. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func airdropTokens( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.airdropTokens.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeairdropTokensInterceptors() ?? [] + ) + } + + ///* + /// Cancel one or more pending airdrops. + ///

    + /// This transaction MUST be signed by _each_ account *sending* an airdrop to be canceled. + /// + /// - Parameters: + /// - request: Request to send to cancelAirdrop. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func cancelAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.cancelAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecancelAirdropInterceptors() ?? [] + ) + } + + ///* + /// Claim one or more pending airdrops. + ///

    + /// This transaction MUST be signed by _each_ account **receiving** an + /// airdrop to be claimed.
    + /// If a "Sender" lacks sufficient balance to fulfill the airdrop at the + /// time the claim is made, that claim SHALL fail. + /// + /// - Parameters: + /// - request: Request to send to claimAirdrop. + /// - callOptions: Call options. + /// - Returns: A `UnaryCall` with futures for the metadata, status and response. + public func claimAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> UnaryCall { + return self.makeUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.claimAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeclaimAirdropInterceptors() ?? [] + ) + } } @available(*, deprecated) @@ -638,6 +796,31 @@ public protocol Proto_TokenServiceAsyncClientProtocol: GRPCClient { _ request: Proto_Transaction, callOptions: CallOptions? ) -> GRPCAsyncUnaryCall + + func makeUpdateNftsCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeRejectTokenCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeAirdropTokensCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeCancelAirdropCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall + + func makeClaimAirdropCall( + _ request: Proto_Transaction, + callOptions: CallOptions? + ) -> GRPCAsyncUnaryCall } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -877,6 +1060,66 @@ extension Proto_TokenServiceAsyncClientProtocol { interceptors: self.interceptors?.makeunpauseTokenInterceptors() ?? [] ) } + + public func makeUpdateNftsCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.updateNfts.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNftsInterceptors() ?? [] + ) + } + + public func makeRejectTokenCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.rejectToken.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makerejectTokenInterceptors() ?? [] + ) + } + + public func makeAirdropTokensCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.airdropTokens.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeairdropTokensInterceptors() ?? [] + ) + } + + public func makeCancelAirdropCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.cancelAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecancelAirdropInterceptors() ?? [] + ) + } + + public func makeClaimAirdropCall( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) -> GRPCAsyncUnaryCall { + return self.makeAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.claimAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeclaimAirdropInterceptors() ?? [] + ) + } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -1108,6 +1351,66 @@ extension Proto_TokenServiceAsyncClientProtocol { interceptors: self.interceptors?.makeunpauseTokenInterceptors() ?? [] ) } + + public func updateNfts( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.updateNfts.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeupdateNftsInterceptors() ?? [] + ) + } + + public func rejectToken( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.rejectToken.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makerejectTokenInterceptors() ?? [] + ) + } + + public func airdropTokens( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.airdropTokens.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeairdropTokensInterceptors() ?? [] + ) + } + + public func cancelAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.cancelAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makecancelAirdropInterceptors() ?? [] + ) + } + + public func claimAirdrop( + _ request: Proto_Transaction, + callOptions: CallOptions? = nil + ) async throws -> Proto_TransactionResponse { + return try await self.performAsyncUnaryCall( + path: Proto_TokenServiceClientMetadata.Methods.claimAirdrop.path, + request: request, + callOptions: callOptions ?? self.defaultCallOptions, + interceptors: self.interceptors?.makeclaimAirdropInterceptors() ?? [] + ) + } } @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) @@ -1185,6 +1488,21 @@ public protocol Proto_TokenServiceClientInterceptorFactoryProtocol: Sendable { /// - Returns: Interceptors to use when invoking 'unpauseToken'. func makeunpauseTokenInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'updateNfts'. + func makeupdateNftsInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'rejectToken'. + func makerejectTokenInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'airdropTokens'. + func makeairdropTokensInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'cancelAirdrop'. + func makecancelAirdropInterceptors() -> [ClientInterceptor] + + /// - Returns: Interceptors to use when invoking 'claimAirdrop'. + func makeclaimAirdropInterceptors() -> [ClientInterceptor] } public enum Proto_TokenServiceClientMetadata { @@ -1211,6 +1529,11 @@ public enum Proto_TokenServiceClientMetadata { Proto_TokenServiceClientMetadata.Methods.getTokenNftInfos, Proto_TokenServiceClientMetadata.Methods.pauseToken, Proto_TokenServiceClientMetadata.Methods.unpauseToken, + Proto_TokenServiceClientMetadata.Methods.updateNfts, + Proto_TokenServiceClientMetadata.Methods.rejectToken, + Proto_TokenServiceClientMetadata.Methods.airdropTokens, + Proto_TokenServiceClientMetadata.Methods.cancelAirdrop, + Proto_TokenServiceClientMetadata.Methods.claimAirdrop, ] ) @@ -1328,6 +1651,36 @@ public enum Proto_TokenServiceClientMetadata { path: "/proto.TokenService/unpauseToken", type: GRPCCallType.unary ) + + public static let updateNfts = GRPCMethodDescriptor( + name: "updateNfts", + path: "/proto.TokenService/updateNfts", + type: GRPCCallType.unary + ) + + public static let rejectToken = GRPCMethodDescriptor( + name: "rejectToken", + path: "/proto.TokenService/rejectToken", + type: GRPCCallType.unary + ) + + public static let airdropTokens = GRPCMethodDescriptor( + name: "airdropTokens", + path: "/proto.TokenService/airdropTokens", + type: GRPCCallType.unary + ) + + public static let cancelAirdrop = GRPCMethodDescriptor( + name: "cancelAirdrop", + path: "/proto.TokenService/cancelAirdrop", + type: GRPCCallType.unary + ) + + public static let claimAirdrop = GRPCMethodDescriptor( + name: "claimAirdrop", + path: "/proto.TokenService/claimAirdrop", + type: GRPCCallType.unary + ) } } From a59bd77c40e0184306acc3cb3ed29da1e8036f4f Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Wed, 21 Aug 2024 13:49:04 -0700 Subject: [PATCH 08/11] feat: add nodeId to TransactionReceipt Signed-off-by: Ricky Saechao --- Sources/Hedera/TransactionReceipt.swift | 9 ++++++++- .../TransactionReceiptTests/testSerialize.1.txt | 2 +- .../TransactionRecordTests/testSerialize.1.txt | 2 +- .../TransactionRecordTests/testSerialize2.1.txt | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/Hedera/TransactionReceipt.swift b/Sources/Hedera/TransactionReceipt.swift index 1bd3b700..62d7a060 100644 --- a/Sources/Hedera/TransactionReceipt.swift +++ b/Sources/Hedera/TransactionReceipt.swift @@ -40,7 +40,8 @@ public struct TransactionReceipt { scheduledTransactionId: TransactionId? = nil, serials: [UInt64]? = nil, duplicates: [TransactionReceipt], - children: [TransactionReceipt] + children: [TransactionReceipt], + nodeId: UInt64 = 0 ) { self.transactionId = transactionId self.status = status @@ -59,6 +60,7 @@ public struct TransactionReceipt { self.serials = serials self.duplicates = duplicates self.children = children + self.nodeId = nodeId } /// The ID of the transaction that this is a receipt for. @@ -133,6 +135,10 @@ public struct TransactionReceipt { /// given top-level id, in consensus order. public let children: [TransactionReceipt] + /// In the receipt of a NodeCreate, NodeUpdate, NodeDelete, the id of the newly created node. + /// An affected node identifier. + public let nodeId: UInt64 + internal init( protobuf proto: Proto_TransactionReceipt, duplicates: [TransactionReceipt], @@ -220,6 +226,7 @@ extension TransactionReceipt: TryProtobufCodable { exchangeRates?.toProtobufInto(&proto.exchangeRate) scheduledTransactionId?.toProtobufInto(&proto.scheduledTransactionID) proto.serialNumbers = serials?.map(Int64.init) ?? [] + proto.nodeID = nodeId } } } diff --git a/Tests/HederaTests/__Snapshots__/TransactionReceiptTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TransactionReceiptTests/testSerialize.1.txt index ae725585..51c91f8f 100644 --- a/Tests/HederaTests/__Snapshots__/TransactionReceiptTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TransactionReceiptTests/testSerialize.1.txt @@ -1 +1 @@ -TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: []) \ No newline at end of file +TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0) \ No newline at end of file diff --git a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt index 04c68c8d..cc679f92 100644 --- a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt @@ -1 +1 @@ -TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: []), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: Optional(17 bytes), prngNumber: nil) \ No newline at end of file +TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: Optional(17 bytes), prngNumber: nil) \ No newline at end of file diff --git a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt index 19077efd..578d36fc 100644 --- a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt +++ b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt @@ -1 +1 @@ -TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: []), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: nil, prngNumber: Optional(4)) \ No newline at end of file +TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: nil, prngNumber: Optional(4)) \ No newline at end of file From 3b1dfb567bd4c31f87fa441cb912d30a5899e3c4 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Fri, 23 Aug 2024 15:24:38 -0700 Subject: [PATCH 09/11] fix: reolve more deprecated warnings Signed-off-by: Ricky Saechao --- Sources/Hedera/Protobufs/FromProtobuf.swift | 2 +- Sources/HederaTCK/SDKClient.swift | 2 +- Tests/HederaTests/KeyTests.swift | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Hedera/Protobufs/FromProtobuf.swift b/Sources/Hedera/Protobufs/FromProtobuf.swift index 48a6d124..e19bb214 100644 --- a/Sources/Hedera/Protobufs/FromProtobuf.swift +++ b/Sources/Hedera/Protobufs/FromProtobuf.swift @@ -16,7 +16,7 @@ extension TryFromProtobuf { internal init(protobufBytes bytes: Data) throws where Protobuf: SwiftProtobuf.Message { let protobuf: Protobuf do { - protobuf = try Protobuf(contiguousBytes: bytes) + protobuf = try Protobuf(serializedBytes: bytes) } catch { throw HError.fromProtobuf("error decoding protobuf bytes: \(error)") } diff --git a/Sources/HederaTCK/SDKClient.swift b/Sources/HederaTCK/SDKClient.swift index 95cc4511..410c08c2 100644 --- a/Sources/HederaTCK/SDKClient.swift +++ b/Sources/HederaTCK/SDKClient.swift @@ -46,7 +46,7 @@ internal class SDKClient { do { return Key.single(try PublicKey.fromStringDer(key)) } catch { - return try Key(protobuf: try Proto_Key(serializedData: Data(hex: key))) + return try Key(protobuf: try Proto_Key(serializedBytes: Data(hex: key))) } } } diff --git a/Tests/HederaTests/KeyTests.swift b/Tests/HederaTests/KeyTests.swift index 662e2637..7012ead0 100644 --- a/Tests/HederaTests/KeyTests.swift +++ b/Tests/HederaTests/KeyTests.swift @@ -40,7 +40,7 @@ internal final class KeyTests: XCTestCase { internal func testFromProtoKeyEcdsa() throws { let keyBytes = Data(hex: "3a21034e0441201f2bf9c7d9873c2a9dc3fd451f64b7c05e17e4d781d916e3a11dfd99") - let keyProto = try Proto_Key.init(serializedData: keyBytes) + let keyProto = try Proto_Key.init(serializedBytes: keyBytes) let key = try PublicKey.fromProtobuf(keyProto) From 5c212986ff5bb6f3a32a79e5d6c420620660e173 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Mon, 26 Aug 2024 11:33:58 -0700 Subject: [PATCH 10/11] refactor: use ServiceEndpoint instead SocketAddressV4 for Node Signed-off-by: Ricky Saechao --- .../AddressBook/NodeCreateTransaction.swift | 20 ++--- .../AddressBook/NodeUpdateTransaction.swift | 20 ++--- Sources/Hedera/Endpoint.swift | 85 +++++++++++++++++++ .../Services/file_service.grpc.swift | 4 +- .../Services/network_service.grpc.swift | 6 +- .../smart_contract_service.grpc.swift | 4 +- .../NodeCreateTransactionTests.swift | 43 +++++----- .../NodeUpdateTransactionTests.swift | 45 +++++----- .../testSerialize.1.txt | 16 ++-- .../testSerialize.1.txt | 16 ++-- 10 files changed, 177 insertions(+), 82 deletions(-) create mode 100644 Sources/Hedera/Endpoint.swift diff --git a/Sources/Hedera/AddressBook/NodeCreateTransaction.swift b/Sources/Hedera/AddressBook/NodeCreateTransaction.swift index 66be932d..b01f7ba9 100644 --- a/Sources/Hedera/AddressBook/NodeCreateTransaction.swift +++ b/Sources/Hedera/AddressBook/NodeCreateTransaction.swift @@ -47,8 +47,8 @@ public final class NodeCreateTransaction: Transaction { public init( accountId: AccountId? = nil, description: String = "", - gossipEndpoints: [SocketAddressV4] = [], - serviceEndpoints: [SocketAddressV4] = [], + gossipEndpoints: [Endpoint] = [], + serviceEndpoints: [Endpoint] = [], gossipCaCertificate: Data? = nil, grpcCertificateHash: Data? = nil, adminKey: Key? = nil @@ -69,8 +69,8 @@ public final class NodeCreateTransaction: Transaction { ) throws { self.accountId = data.hasAccountID ? try .fromProtobuf(data.accountID) : nil self.description = data.description_p - self.gossipEndpoints = try data.gossipEndpoint.map(SocketAddressV4.init) - self.serviceEndpoints = try data.serviceEndpoint.map(SocketAddressV4.init) + self.gossipEndpoints = try data.gossipEndpoint.map(Endpoint.init) + self.serviceEndpoints = try data.serviceEndpoint.map(Endpoint.init) self.gossipCaCertificate = data.gossipCaCertificate self.grpcCertificateHash = data.grpcCertificateHash self.adminKey = data.hasAdminKey ? try .fromProtobuf(data.adminKey) : nil @@ -109,7 +109,7 @@ public final class NodeCreateTransaction: Transaction { } /// A list of service endpoints for gossip. - public var gossipEndpoints: [SocketAddressV4] { + public var gossipEndpoints: [Endpoint] { willSet { ensureNotFrozen() } @@ -117,7 +117,7 @@ public final class NodeCreateTransaction: Transaction { /// Assign the list of service endpoints for gossip. @discardableResult - public func gossipEndpoints(_ gossipEndpoints: [SocketAddressV4]) -> Self { + public func gossipEndpoints(_ gossipEndpoints: [Endpoint]) -> Self { self.gossipEndpoints = gossipEndpoints return self @@ -125,14 +125,14 @@ public final class NodeCreateTransaction: Transaction { /// Add an endpoint for gossip to the list of service endpoints for gossip. @discardableResult - public func addGossipEndpoint(_ gossipEndpoint: SocketAddressV4) -> Self { + public func addGossipEndpoint(_ gossipEndpoint: Endpoint) -> Self { self.gossipEndpoints.append(gossipEndpoint) return self } /// Extract the list of service endpoints for gRPC calls. - public var serviceEndpoints: [SocketAddressV4] { + public var serviceEndpoints: [Endpoint] { willSet { ensureNotFrozen() } @@ -140,7 +140,7 @@ public final class NodeCreateTransaction: Transaction { /// Assign the list of service endpoints for gRPC calls. @discardableResult - public func serviceEndpoints(_ serviceEndpoints: [SocketAddressV4]) -> Self { + public func serviceEndpoints(_ serviceEndpoints: [Endpoint]) -> Self { self.serviceEndpoints = serviceEndpoints return self @@ -148,7 +148,7 @@ public final class NodeCreateTransaction: Transaction { /// Add an endpoint for gRPC calls to the list of service endpoints for gRPC calls. @discardableResult - public func addServiceEndpoint(_ serviceEndpoint: SocketAddressV4) -> Self { + public func addServiceEndpoint(_ serviceEndpoint: Endpoint) -> Self { self.serviceEndpoints.append(serviceEndpoint) return self diff --git a/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift b/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift index 3faee168..0c7e2a9f 100644 --- a/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift +++ b/Sources/Hedera/AddressBook/NodeUpdateTransaction.swift @@ -42,8 +42,8 @@ public final class NodeUpdateTransaction: Transaction { nodeId: UInt64 = 0, accountId: AccountId? = nil, description: String? = nil, - gossipEndpoints: [SocketAddressV4] = [], - serviceEndpoints: [SocketAddressV4] = [], + gossipEndpoints: [Endpoint] = [], + serviceEndpoints: [Endpoint] = [], gossipCaCertificate: Data? = nil, grpcCertificateHash: Data? = nil, adminKey: Key? = nil @@ -66,8 +66,8 @@ public final class NodeUpdateTransaction: Transaction { self.nodeId = data.nodeID self.accountId = data.hasAccountID ? try .fromProtobuf(data.accountID) : nil self.description = data.hasDescription_p ? data.description_p.value : nil - self.gossipEndpoints = try data.gossipEndpoint.map(SocketAddressV4.init) - self.serviceEndpoints = try data.serviceEndpoint.map(SocketAddressV4.init) + self.gossipEndpoints = try data.gossipEndpoint.map(Endpoint.init) + self.serviceEndpoints = try data.serviceEndpoint.map(Endpoint.init) self.gossipCaCertificate = data.hasGossipCaCertificate ? data.gossipCaCertificate.value : nil self.grpcCertificateHash = data.hasGrpcCertificateHash ? data.grpcCertificateHash.value : nil self.adminKey = data.hasAdminKey ? try .fromProtobuf(data.adminKey) : nil @@ -121,7 +121,7 @@ public final class NodeUpdateTransaction: Transaction { } /// A list of service endpoints for gossip. - public var gossipEndpoints: [SocketAddressV4] { + public var gossipEndpoints: [Endpoint] { willSet { ensureNotFrozen() } @@ -129,7 +129,7 @@ public final class NodeUpdateTransaction: Transaction { /// Assign the list of service endpoints for gossip. @discardableResult - public func gossipEndpoints(_ gossipEndpoints: [SocketAddressV4]) -> Self { + public func gossipEndpoints(_ gossipEndpoints: [Endpoint]) -> Self { self.gossipEndpoints = gossipEndpoints return self @@ -137,14 +137,14 @@ public final class NodeUpdateTransaction: Transaction { /// Add an endpoint for gossip to the list of service endpoints for gossip. @discardableResult - public func addGossipEndpoint(_ gossipEndpoint: SocketAddressV4) -> Self { + public func addGossipEndpoint(_ gossipEndpoint: Endpoint) -> Self { self.gossipEndpoints.append(gossipEndpoint) return self } /// Extract the list of service endpoints for gRPC calls. - public var serviceEndpoints: [SocketAddressV4] { + public var serviceEndpoints: [Endpoint] { willSet { ensureNotFrozen() } @@ -152,7 +152,7 @@ public final class NodeUpdateTransaction: Transaction { /// Assign the list of service endpoints for gRPC calls. @discardableResult - public func serviceEndpoints(_ serviceEndpoints: [SocketAddressV4]) -> Self { + public func serviceEndpoints(_ serviceEndpoints: [Endpoint]) -> Self { self.serviceEndpoints = serviceEndpoints return self @@ -160,7 +160,7 @@ public final class NodeUpdateTransaction: Transaction { /// Add an endpoint for gRPC calls to the list of service endpoints for gRPC calls. @discardableResult - public func addServiceEndpoint(_ serviceEndpoint: SocketAddressV4) -> Self { + public func addServiceEndpoint(_ serviceEndpoint: Endpoint) -> Self { self.serviceEndpoints.append(serviceEndpoint) return self diff --git a/Sources/Hedera/Endpoint.swift b/Sources/Hedera/Endpoint.swift new file mode 100644 index 00000000..bde4387b --- /dev/null +++ b/Sources/Hedera/Endpoint.swift @@ -0,0 +1,85 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2022 - 2024 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import Foundation +import HederaProtobufs +import Network + +public struct Endpoint { + public var ipAddress: IPv4Address? = nil + + public var port: Int32 = 0 + + public var domainName: String = "" + + public init(ipAddress: IPv4Address? = nil, port: Int32 = 0, domainName: String = "") { + self.ipAddress = ipAddress + self.port = port + self.domainName = domainName + } + + @discardableResult + public mutating func address(_ ipAddress: IPv4Address) -> Self { + self.ipAddress = ipAddress + return self + } + + @discardableResult + public mutating func port(_ port: Int32) -> Self { + self.port = port + return self + } + + @discardableResult + public mutating func domainName(_ domainName: String) -> Self { + self.domainName = domainName + return self + } + + public var description: String { + guard !domainName.isEmpty else { + return "\(ipAddress.debugDescription):\(port)" + } + return "\(domainName):\(port)" + } +} +extension Endpoint: TryProtobufCodable { + internal typealias Protobuf = Proto_ServiceEndpoint + + internal init(protobuf proto: Protobuf) throws { + let ipAddress = IPv4Address(proto.ipAddressV4) + + var port = proto.port + + if proto.port == 0 || proto.port == 50111 { + port = 50211 + } + + self.init(ipAddress: ipAddress, port: port, domainName: proto.domainName) + } + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.ipAddressV4 = ipAddress?.rawValue ?? Data() + proto.port = port + proto.domainName = domainName + } + } +} diff --git a/Sources/HederaProtobufs/Services/file_service.grpc.swift b/Sources/HederaProtobufs/Services/file_service.grpc.swift index 052e3cf8..1051194e 100644 --- a/Sources/HederaProtobufs/Services/file_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/file_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_FileServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_FileServiceClientProtocol: GRPCClient { @@ -276,7 +276,7 @@ public struct Proto_FileServiceNIOClient: Proto_FileServiceClientProtocol { } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_FileServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Sources/HederaProtobufs/Services/network_service.grpc.swift b/Sources/HederaProtobufs/Services/network_service.grpc.swift index 75fa571a..6d8e092a 100644 --- a/Sources/HederaProtobufs/Services/network_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/network_service.grpc.swift @@ -65,9 +65,9 @@ extension Proto_NetworkServiceClientProtocol { } ///* - /// Retrieves the time in nanoseconds spent in handleTransaction for one or more - /// TransactionIDs (assuming they have reached consensus "recently", since only a limited - /// number of execution times are kept in-memory, depending on the value of the node-local + /// Retrieves the time in nanoseconds spent in handleTransaction for one or more + /// TransactionIDs (assuming they have reached consensus "recently", since only a limited + /// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). /// /// - Parameters: diff --git a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift index 6ca3f73c..9b5453e3 100644 --- a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_SmartContractServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_SmartContractServiceClientProtocol: GRPCClient { @@ -373,7 +373,7 @@ public struct Proto_SmartContractServiceNIOClient: Proto_SmartContractServiceCli } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_SmartContractServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Tests/HederaTests/NodeCreateTransactionTests.swift b/Tests/HederaTests/NodeCreateTransactionTests.swift index 40ca3c77..e3a342c0 100644 --- a/Tests/HederaTests/NodeCreateTransactionTests.swift +++ b/Tests/HederaTests/NodeCreateTransactionTests.swift @@ -19,6 +19,7 @@ */ import HederaProtobufs +import Network import SnapshotTesting import XCTest @@ -29,8 +30,12 @@ internal final class NodeCreateTransactionTests: XCTestCase { internal static let testGossipCertificate = Data([0x01, 0x02, 0x03, 0x04]) internal static let testGrpcCertificateHash = Data([0x05, 0x06, 0x07, 0x08]) - private static func makeIpv4AddressList() throws -> [SocketAddressV4] { - [SocketAddressV4("127.0.0.1:50222")!, SocketAddressV4("127.0.0.1:50212")!] + private static func spawnTestEndpoint(offset: Int32) -> Endpoint { + Endpoint(ipAddress: IPv4Address("127.0.0.1:50222"), port: 42 + offset, domainName: "unit.test.com") + } + + private static func spawnTestEndpointList(offset: Int32) -> [Endpoint] { + [Self.spawnTestEndpoint(offset: offset), Self.spawnTestEndpoint(offset: offset + 1)] } private static func makeTransaction() throws -> NodeCreateTransaction { @@ -42,8 +47,8 @@ internal final class NodeCreateTransactionTests: XCTestCase { ) .accountId(AccountId.fromString("0.0.5007")) .description(testDescription) - .gossipEndpoints(try Self.makeIpv4AddressList()) - .serviceEndpoints(try Self.makeIpv4AddressList()) + .gossipEndpoints(spawnTestEndpointList(offset: 0)) + .serviceEndpoints(spawnTestEndpointList(offset: 2)) .gossipCaCertificate(Self.testGossipCertificate) .grpcCertificateHash(Self.testGrpcCertificateHash) .adminKey(Key.single(Resources.privateKey.publicKey)) @@ -65,18 +70,18 @@ internal final class NodeCreateTransactionTests: XCTestCase { } internal func testFromProtoBody() throws { - let protoData = try Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody.with { proto in + let gossipEndpoints = Self.spawnTestEndpointList(offset: 0) + let serviceEndpoints = Self.spawnTestEndpointList(offset: 2) + let protoData = Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody.with { proto in proto.accountID = Resources.accountId.toProtobuf() proto.description_p = Self.testDescription - proto.gossipEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } - proto.serviceEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.gossipEndpoint = gossipEndpoints.map { $0.toProtobuf() } + proto.serviceEndpoint = serviceEndpoints.map { $0.toProtobuf() } proto.gossipCaCertificate = Self.testGossipCertificate proto.grpcCertificateHash = Self.testGrpcCertificateHash proto.adminKey = Key.single(Resources.publicKey).toProtobuf() } - let endpoints = try Self.makeIpv4AddressList() - let protoBody = Proto_TransactionBody.with { proto in proto.nodeCreate = protoData proto.transactionID = Resources.txId.toProtobuf() @@ -93,15 +98,15 @@ internal final class NodeCreateTransactionTests: XCTestCase { XCTAssertEqual(tx.serviceEndpoints.count, 2) for (index, endpoint) in tx.gossipEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) - XCTAssertEqual(endpoint.port, endpoints[index].port) - XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + XCTAssertEqual(endpoint.ipAddress, gossipEndpoints[index].ipAddress) + XCTAssertEqual(endpoint.port, gossipEndpoints[index].port) + XCTAssertEqual(endpoint.domainName, gossipEndpoints[index].domainName) } for (index, endpoint) in tx.serviceEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) - XCTAssertEqual(endpoint.port, endpoints[index].port) - XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + XCTAssertEqual(endpoint.ipAddress, serviceEndpoints[index].ipAddress) + XCTAssertEqual(endpoint.port, serviceEndpoints[index].port) + XCTAssertEqual(endpoint.domainName, serviceEndpoints[index].domainName) } } @@ -128,11 +133,11 @@ internal final class NodeCreateTransactionTests: XCTestCase { internal func testGetSetGossipEndpoints() throws { let tx = NodeCreateTransaction() - let endpoints = try Self.makeIpv4AddressList() + let endpoints = Self.spawnTestEndpointList(offset: Int32(0)) tx.gossipEndpoints(endpoints) for (index, endpoint) in tx.gossipEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.ipAddress, endpoints[index].ipAddress) XCTAssertEqual(endpoint.port, endpoints[index].port) XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) } @@ -140,11 +145,11 @@ internal final class NodeCreateTransactionTests: XCTestCase { internal func testGetSetServiceEndpoints() throws { let tx = NodeCreateTransaction() - let endpoints = try Self.makeIpv4AddressList() + let endpoints = Self.spawnTestEndpointList(offset: Int32(2)) tx.serviceEndpoints(endpoints) for (index, endpoint) in tx.serviceEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.ipAddress, endpoints[index].ipAddress) XCTAssertEqual(endpoint.port, endpoints[index].port) XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) } diff --git a/Tests/HederaTests/NodeUpdateTransactionTests.swift b/Tests/HederaTests/NodeUpdateTransactionTests.swift index 477bd9f2..a7669a5b 100644 --- a/Tests/HederaTests/NodeUpdateTransactionTests.swift +++ b/Tests/HederaTests/NodeUpdateTransactionTests.swift @@ -19,6 +19,7 @@ */ import HederaProtobufs +import Network import SnapshotTesting import SwiftProtobuf import XCTest @@ -30,8 +31,12 @@ internal final class NodeUpdateTransactionTests: XCTestCase { internal static let testGossipCertificate = Data([0x01, 0x02, 0x03, 0x04]) internal static let testGrpcCertificateHash = Data([0x05, 0x06, 0x07, 0x08]) - private static func makeIpv4AddressList() throws -> [SocketAddressV4] { - [SocketAddressV4("127.0.0.1:50222")!, SocketAddressV4("127.0.0.1:50212")!] + private static func spawnTestEndpoint(offset: Int32) -> Endpoint { + Endpoint(ipAddress: IPv4Address("127.0.0.1:50211"), port: 20 + offset, domainName: "unit.test.com") + } + + private static func spawnTestEndpointList(offset: Int32) -> [Endpoint] { + [Self.spawnTestEndpoint(offset: offset), Self.spawnTestEndpoint(offset: offset + 1)] } private static func makeTransaction() throws -> NodeUpdateTransaction { @@ -44,8 +49,8 @@ internal final class NodeUpdateTransactionTests: XCTestCase { ) .accountId(AccountId.fromString("0.0.5007")) .description(testDescription) - .gossipEndpoints(try Self.makeIpv4AddressList()) - .serviceEndpoints(try Self.makeIpv4AddressList()) + .gossipEndpoints(Self.spawnTestEndpointList(offset: 1)) + .serviceEndpoints(Self.spawnTestEndpointList(offset: 3)) .gossipCaCertificate(Self.testGossipCertificate) .grpcCertificateHash(Self.testGrpcCertificateHash) .adminKey(Key.single(Resources.privateKey.publicKey)) @@ -67,18 +72,18 @@ internal final class NodeUpdateTransactionTests: XCTestCase { } internal func testFromProtoBody() throws { - let protoData = try Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody.with { proto in + let gossipEndpoints = Self.spawnTestEndpointList(offset: 1) + let serviceEndpoints = Self.spawnTestEndpointList(offset: 3) + let protoData = Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody.with { proto in proto.accountID = Resources.accountId.toProtobuf() proto.description_p = Google_Protobuf_StringValue(Self.testDescription) - proto.gossipEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } - proto.serviceEndpoint = try Self.makeIpv4AddressList().map { $0.toProtobuf() } + proto.gossipEndpoint = gossipEndpoints.map { $0.toProtobuf() } + proto.serviceEndpoint = serviceEndpoints.map { $0.toProtobuf() } proto.gossipCaCertificate = Google_Protobuf_BytesValue(Self.testGossipCertificate) proto.grpcCertificateHash = Google_Protobuf_BytesValue(Self.testGrpcCertificateHash) proto.adminKey = Key.single(Resources.publicKey).toProtobuf() } - let endpoints = try Self.makeIpv4AddressList() - let protoBody = Proto_TransactionBody.with { proto in proto.nodeUpdate = protoData proto.transactionID = Resources.txId.toProtobuf() @@ -86,7 +91,7 @@ internal final class NodeUpdateTransactionTests: XCTestCase { let tx = try NodeUpdateTransaction(protobuf: protoBody, protoData) - XCTAssertEqual(tx.nodeId, 1) + XCTAssertEqual(tx.nodeId, 0) XCTAssertEqual(tx.accountId, Resources.accountId) XCTAssertEqual(tx.adminKey, Key.single(Resources.publicKey)) XCTAssertEqual(tx.description, Self.testDescription) @@ -96,15 +101,15 @@ internal final class NodeUpdateTransactionTests: XCTestCase { XCTAssertEqual(tx.serviceEndpoints.count, 2) for (index, endpoint) in tx.gossipEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) - XCTAssertEqual(endpoint.port, endpoints[index].port) - XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + XCTAssertEqual(endpoint.ipAddress, gossipEndpoints[index].ipAddress) + XCTAssertEqual(endpoint.port, gossipEndpoints[index].port) + XCTAssertEqual(endpoint.domainName, gossipEndpoints[index].domainName) } for (index, endpoint) in tx.serviceEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) - XCTAssertEqual(endpoint.port, endpoints[index].port) - XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) + XCTAssertEqual(endpoint.ipAddress, serviceEndpoints[index].ipAddress) + XCTAssertEqual(endpoint.port, serviceEndpoints[index].port) + XCTAssertEqual(endpoint.domainName, serviceEndpoints[index].domainName) } } @@ -138,11 +143,11 @@ internal final class NodeUpdateTransactionTests: XCTestCase { internal func testGetSetGossipEndpoints() throws { let tx = NodeUpdateTransaction() - let endpoints = try Self.makeIpv4AddressList() + let endpoints = Self.spawnTestEndpointList(offset: Int32(4)) tx.gossipEndpoints(endpoints) for (index, endpoint) in tx.gossipEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.ipAddress, endpoints[index].ipAddress) XCTAssertEqual(endpoint.port, endpoints[index].port) XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) } @@ -150,11 +155,11 @@ internal final class NodeUpdateTransactionTests: XCTestCase { internal func testGetSetServiceEndpoints() throws { let tx = NodeUpdateTransaction() - let endpoints = try Self.makeIpv4AddressList() + let endpoints = Self.spawnTestEndpointList(offset: Int32(4)) tx.serviceEndpoints(endpoints) for (index, endpoint) in tx.serviceEndpoints.enumerated() { - XCTAssertEqual(endpoint.ip, endpoints[index].ip) + XCTAssertEqual(endpoint.ipAddress, endpoints[index].ipAddress) XCTAssertEqual(endpoint.port, endpoints[index].port) XCTAssertEqual(endpoint.domainName, endpoints[index].domainName) } diff --git a/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt index 2479c4bb..5c49d95a 100644 --- a/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/NodeCreateTransactionTests/testSerialize.1.txt @@ -20,20 +20,20 @@ nodeCreate { } description: "test description" gossip_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50222 + port: 42 + domain_name: "unit.test.com" } gossip_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50212 + port: 43 + domain_name: "unit.test.com" } service_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50222 + port: 44 + domain_name: "unit.test.com" } service_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50212 + port: 45 + domain_name: "unit.test.com" } gossip_ca_certificate: "\001\002\003\004" grpc_certificate_hash: "\005\006\007\b" diff --git a/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt index 41747beb..1978d25a 100644 --- a/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/NodeUpdateTransactionTests/testSerialize.1.txt @@ -23,20 +23,20 @@ nodeUpdate { value: "test description" } gossip_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50222 + port: 21 + domain_name: "unit.test.com" } gossip_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50212 + port: 22 + domain_name: "unit.test.com" } service_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50222 + port: 23 + domain_name: "unit.test.com" } service_endpoint { - ipAddressV4: "\177\000\000\001" - port: 50212 + port: 24 + domain_name: "unit.test.com" } gossip_ca_certificate { value: "\001\002\003\004" From ec51ad108a8a47c7890ec82a590c84692fa425c0 Mon Sep 17 00:00:00 2001 From: Ricky Saechao Date: Mon, 26 Aug 2024 16:47:21 -0700 Subject: [PATCH 11/11] fix: validate domain name in Endpoint Signed-off-by: Ricky Saechao --- Sources/Hedera/Endpoint.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Sources/Hedera/Endpoint.swift b/Sources/Hedera/Endpoint.swift index bde4387b..f47422e8 100644 --- a/Sources/Hedera/Endpoint.swift +++ b/Sources/Hedera/Endpoint.swift @@ -72,6 +72,10 @@ extension Endpoint: TryProtobufCodable { port = 50211 } + guard isValidDomainName(proto.domainName) else { + throw HError(kind: .basicParse, description: "Invalid domain name format") + } + self.init(ipAddress: ipAddress, port: port, domainName: proto.domainName) } @@ -83,3 +87,10 @@ extension Endpoint: TryProtobufCodable { } } } + +private func isValidDomainName(_ domainName: String) -> Bool { + let pattern = "^((?!-)[A-Za-z0-9-]{1,63}(?