diff --git a/.env.example b/.env.example index 1a6be705..925be896 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,24 @@ +## +# Environment variables for sdk examples +## # Account that will pay query and transaction fees OPERATOR_ID= # Default private key to use to sign for all transactions and queries OPERATOR_KEY= +# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"` +NETWORK_NAME= + +## +# Environment variables for integration tests +## +# Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"` +TEST_OPERATOR_ID= + +# Default private key to use to sign for all transactions and queries +TEST_OPERATOR_KEY= + # Network names: `"localhost"`, `"testnet"`, `"previewnet"`, `"mainnet"` TEST_NETWORK_NAME= diff --git a/Examples/AccountAlias/main.swift b/Examples/AccountAlias/main.swift index e2dbd38e..cfe7621f 100644 --- a/Examples/AccountAlias/main.swift +++ b/Examples/AccountAlias/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/AccountAllowance/main.swift b/Examples/AccountAllowance/main.swift index 5d7dc6a6..770bd056 100644 --- a/Examples/AccountAllowance/main.swift +++ b/Examples/AccountAllowance/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ConsensusPubSub/main.swift b/Examples/ConsensusPubSub/main.swift index de490cfb..40b2f3f2 100644 --- a/Examples/ConsensusPubSub/main.swift +++ b/Examples/ConsensusPubSub/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ConsensusPubSubChunked/main.swift b/Examples/ConsensusPubSubChunked/main.swift index 78dd7e55..fe0a1fc5 100644 --- a/Examples/ConsensusPubSubChunked/main.swift +++ b/Examples/ConsensusPubSubChunked/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ConsensusPubSubWithSubmitKey/main.swift b/Examples/ConsensusPubSubWithSubmitKey/main.swift index 00500426..72e21f02 100644 --- a/Examples/ConsensusPubSubWithSubmitKey/main.swift +++ b/Examples/ConsensusPubSubWithSubmitKey/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateAccount/main.swift b/Examples/CreateAccount/main.swift index 17aa769b..6fdfba04 100644 --- a/Examples/CreateAccount/main.swift +++ b/Examples/CreateAccount/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateAccountThresholdKey/main.swift b/Examples/CreateAccountThresholdKey/main.swift index 96fe1dfd..d3e2a99d 100644 --- a/Examples/CreateAccountThresholdKey/main.swift +++ b/Examples/CreateAccountThresholdKey/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateFile/main.swift b/Examples/CreateFile/main.swift index dbf0f1f5..1aa02c17 100644 --- a/Examples/CreateFile/main.swift +++ b/Examples/CreateFile/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateSimpleContract/main.swift b/Examples/CreateSimpleContract/main.swift index 5fd5b4ec..eda3423f 100644 --- a/Examples/CreateSimpleContract/main.swift +++ b/Examples/CreateSimpleContract/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateStatefulContract/main.swift b/Examples/CreateStatefulContract/main.swift index 114b4909..1a6775f3 100644 --- a/Examples/CreateStatefulContract/main.swift +++ b/Examples/CreateStatefulContract/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/CreateTopic/main.swift b/Examples/CreateTopic/main.swift index ac1d300a..6cd4f933 100644 --- a/Examples/CreateTopic/main.swift +++ b/Examples/CreateTopic/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/DeleteAccount/main.swift b/Examples/DeleteAccount/main.swift index 6146c745..047ecb48 100644 --- a/Examples/DeleteAccount/main.swift +++ b/Examples/DeleteAccount/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/DeleteFile/main.swift b/Examples/DeleteFile/main.swift index f923d4a5..5e607ffa 100644 --- a/Examples/DeleteFile/main.swift +++ b/Examples/DeleteFile/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GenerateKey/main.swift b/Examples/GenerateKey/main.swift index 9b26fb33..bfbd45f4 100644 --- a/Examples/GenerateKey/main.swift +++ b/Examples/GenerateKey/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GenerateKeyWithMnemonic/main.swift b/Examples/GenerateKeyWithMnemonic/main.swift index 64a622aa..0191e5fb 100644 --- a/Examples/GenerateKeyWithMnemonic/main.swift +++ b/Examples/GenerateKeyWithMnemonic/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GetAccountBalance/main.swift b/Examples/GetAccountBalance/main.swift index 92d56cc8..f61931dd 100644 --- a/Examples/GetAccountBalance/main.swift +++ b/Examples/GetAccountBalance/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GetAccountInfo/main.swift b/Examples/GetAccountInfo/main.swift index dc32d6ba..e4b3b120 100644 --- a/Examples/GetAccountInfo/main.swift +++ b/Examples/GetAccountInfo/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GetAddressBook/main.swift b/Examples/GetAddressBook/main.swift index f6c409cb..a361344a 100644 --- a/Examples/GetAddressBook/main.swift +++ b/Examples/GetAddressBook/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GetExchangeRates/main.swift b/Examples/GetExchangeRates/main.swift index 1b1f837e..5f80b986 100644 --- a/Examples/GetExchangeRates/main.swift +++ b/Examples/GetExchangeRates/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/GetFileContents/main.swift b/Examples/GetFileContents/main.swift index ad13b675..aa0fc556 100644 --- a/Examples/GetFileContents/main.swift +++ b/Examples/GetFileContents/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/MultiAppTransfer/main.swift b/Examples/MultiAppTransfer/main.swift index b9693883..9ee8c50c 100644 --- a/Examples/MultiAppTransfer/main.swift +++ b/Examples/MultiAppTransfer/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/MultiSigOffline/main.swift b/Examples/MultiSigOffline/main.swift index 6de52ab8..1d8b3585 100644 --- a/Examples/MultiSigOffline/main.swift +++ b/Examples/MultiSigOffline/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/NftUpdateMetadata/main.swift b/Examples/NftUpdateMetadata/main.swift new file mode 100644 index 00000000..dd35f84e --- /dev/null +++ b/Examples/NftUpdateMetadata/main.swift @@ -0,0 +1,192 @@ +/* + * ‌ + * 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 Hedera +import SwiftDotenv + +@main +internal enum Program { + + private static let metadataKey: PrivateKey = PrivateKey.generateEd25519() + private static let initialMetadata: Data = Data([1]) + private static let newMetadata: Data = Data([1, 2]) + + internal static func main() async throws { + let env = try Dotenv.load() + let client = try Client.forName(env.networkName) + + // Defaults the operator account ID and key such that all generated transactions will be paid for + // by this account and be signed by this key + client.setOperator(env.operatorAccountId, env.operatorKey) + + // Demonstrate with an mutable token (with admin key) + try await updateNftsMetadata(client, env, try getMutableTokenCreateTransaction(client, env)) + + // Demonstrate with an immutable token (with metadata key) + try await updateNftsMetadata(client, env, try getImmutableTokenCreateTransaction(client, env)) + + } + + internal static func updateNftsMetadata( + _ client: Client, _ env: Environment, _ tokenCreateTransaction: TokenCreateTransaction + ) async throws { + let tokenCreateResponse = try await tokenCreateTransaction.sign(env.operatorKey).execute(client) + let tokenCreateReceipt = try await tokenCreateResponse.getReceipt(client) + + print("Status of token create transaction: \(tokenCreateReceipt.status)") + + let tokenId = tokenCreateReceipt.tokenId! + print("Token id: \(tokenId)") + + let tokenInfo = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(client) + + print("Token metadata key: \(tokenInfo.metadataKey!)") + + let tokenMintTransaction = TokenMintTransaction() + .tokenId(tokenId) + .metadata([initialMetadata]) + + _ = tokenMintTransaction.metadata.map { + print("Set metadata: \($0.bytes)") + } + + let tokenMintReceipt = try await tokenMintTransaction.execute(client).getReceipt(client) + + print("Status of token mint transaction: \(tokenMintReceipt.status)") + + let nftSerials = tokenMintReceipt.serials! + + let accountCreateTransaction = try await AccountCreateTransaction() + .key(.single(env.operatorKey.publicKey)) + .maxAutomaticTokenAssociations(10) + .execute(client) + + // Create an account to send the NFT to + let newAccountId = try await accountCreateTransaction.getReceipt(client).accountId! + + // Transfer the Nft to the new account + _ = try await TransferTransaction() + .nftTransfer(tokenId.nft(nftSerials.first!), env.operatorAccountId, newAccountId) + .execute(client) + + // Update metadata of Nft + let tokenUpdateNftsTransaction = try TokenUpdateNftsTransaction() + .tokenId(tokenId) + .serials(nftSerials) + .metadata(newMetadata) + .freezeWith(client) + + print("Updated metadata: \(tokenUpdateNftsTransaction.metadata.bytes)") + + // Get receipt for update nfts metadata transaction + let tokenUpdateNftsReceipt = try await tokenUpdateNftsTransaction.sign(metadataKey).execute(client).getReceipt( + client) + + print("Status of token update nfts metadata transaction: \(tokenUpdateNftsReceipt.status)") + + // Check that metadata for the NFT was updated correctly + let metadataList = try await getMetadataList(client, tokenId, nftSerials) + + _ = metadataList.map { + print("Metadata after update: \($0.bytes)") + } + } + + internal static func getMutableTokenCreateTransaction(_ client: Client, _ env: Environment) throws + -> TokenCreateTransaction + { + print("Creating a mutable token") + + return try TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.nonFungibleUnique) + .treasuryAccountId(env.operatorAccountId) + .adminKey(.single(env.operatorKey.publicKey)) + .supplyKey(.single(env.operatorKey.publicKey)) + .metadataKey(.single(metadataKey.publicKey)) + .expirationTime(Timestamp.now + .hours(2)) + .freezeWith(client) + } + + internal static func getImmutableTokenCreateTransaction(_ client: Client, _ env: Environment) throws + -> TokenCreateTransaction + { + print("Creating a immutable token") + + return try TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.nonFungibleUnique) + .treasuryAccountId(env.operatorAccountId) + .supplyKey(.single(env.operatorKey.publicKey)) + .metadataKey(.single(metadataKey.publicKey)) + .expirationTime(Timestamp.now + .hours(2)) + .freezeWith(client) + } +} + +func getMetadataList(_ client: Client, _ tokenId: TokenId, _ serials: [UInt64]) async throws -> [Data] { + let metadataList: [Data] = try await withThrowingTaskGroup( + of: Data.self, + body: { group in + var results = [Data]() + + // Iterate over serials, launching a new task for each + for serial in serials { + group.addTask { + let nftId = NftId(tokenId: tokenId, serial: UInt64(serial)) + // Execute the query and return the result + return try await TokenNftInfoQuery().nftId(nftId).execute(client).metadata + } + } + + // Collect results from all tasks + for try await result in group { + results.append(result) + } + + return results + }) + + return metadataList +} + +extension Environment { + /// Account ID for the operator to use in this example. + internal var operatorAccountId: AccountId { + AccountId(self["OPERATOR_ID"]!.stringValue)! + } + + /// Private key for the operator to use in this example. + internal var operatorKey: PrivateKey { + PrivateKey(self["OPERATOR_KEY"]!.stringValue)! + } + + /// The name of the hedera network this example should be ran against. + /// + /// Testnet by default. + internal var networkName: String { + self["HEDERA_NETWORK"]?.stringValue ?? "testnet" + } +} diff --git a/Examples/Prng/main.swift b/Examples/Prng/main.swift index a4c0e387..bf6d9ad7 100644 --- a/Examples/Prng/main.swift +++ b/Examples/Prng/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/Schedule/main.swift b/Examples/Schedule/main.swift index 69bc96c0..a5908904 100644 --- a/Examples/Schedule/main.swift +++ b/Examples/Schedule/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ScheduleIdenticalTransaction/main.swift b/Examples/ScheduleIdenticalTransaction/main.swift index 7ba10de3..2b214d3b 100644 --- a/Examples/ScheduleIdenticalTransaction/main.swift +++ b/Examples/ScheduleIdenticalTransaction/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ScheduleMultiSigTransaction/main.swift b/Examples/ScheduleMultiSigTransaction/main.swift index d2ea8add..5eebc6ed 100644 --- a/Examples/ScheduleMultiSigTransaction/main.swift +++ b/Examples/ScheduleMultiSigTransaction/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ScheduledTransactionMultiSigThreshold/main.swift b/Examples/ScheduledTransactionMultiSigThreshold/main.swift index 1251440b..471790cc 100644 --- a/Examples/ScheduledTransactionMultiSigThreshold/main.swift +++ b/Examples/ScheduledTransactionMultiSigThreshold/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ScheduledTransfer/main.swift b/Examples/ScheduledTransfer/main.swift index ff9c4cee..31dd6f8e 100644 --- a/Examples/ScheduledTransfer/main.swift +++ b/Examples/ScheduledTransfer/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/Staking/main.swift b/Examples/Staking/main.swift index 088de169..11e7d8b4 100644 --- a/Examples/Staking/main.swift +++ b/Examples/Staking/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/StakingWithUpdate/main.swift b/Examples/StakingWithUpdate/main.swift index 094e2b43..63afa304 100644 --- a/Examples/StakingWithUpdate/main.swift +++ b/Examples/StakingWithUpdate/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/TokenUpdateMetadata/main.swift b/Examples/TokenUpdateMetadata/main.swift new file mode 100644 index 00000000..52ee0e95 --- /dev/null +++ b/Examples/TokenUpdateMetadata/main.swift @@ -0,0 +1,155 @@ +/* + * ‌ + * 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 Hedera +import SwiftDotenv + +@main +internal enum Program { + + private static let metadataKey: PrivateKey = PrivateKey.generateEd25519() + private static let initialMetadata: Data = Data([1]) + private static let newMetadata: Data = Data([1, 2]) + + internal static func main() async throws { + let env = try Dotenv.load() + let client = try Client.forName(env.networkName) + + // Defaults the operator account ID and key such that all generated + // transactions will be paid for by this account and be signed by this key + client.setOperator(env.operatorAccountId, env.operatorKey) + + // Demonstrate with an mutable token (with admin key) + try await updateMutableTokenMetadata(client, env) + + // Demonstrate with an immutable token (with metadata key) + try await updateImmutableTokenMetadata(client, env) + + } + + internal static func updateMutableTokenMetadata(_ client: Client, _ env: Environment) async throws { + print("Creating a mutable token") + + // Note: The same flow can be executed with a TokenType.NON_FUNGIBLE_UNIQUE (i.e. HIP-765) + let tokenId = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.fungibleCommon) + .decimals(3) + .initialSupply(1_000_000) + .treasuryAccountId(env.operatorAccountId) + .adminKey(.single(env.operatorKey.publicKey)) + .metadata(initialMetadata) + .expirationTime(Timestamp.now + .hours(2)) + .execute(client) + .getReceipt(client) + .tokenId! + + print("Created a mutable token: \(tokenId)") + + let tokenInfoAfterCreation = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(client) + + print("Mutable token's metadata after creation: \(tokenInfoAfterCreation.metadata.bytes)") + + // Update token's metadata + _ = try await TokenUpdateTransaction() + .tokenId(tokenId) + .metadata(newMetadata) + .execute(client) + .getReceipt(client) + + let tokenInfoAfterMetadataUpdate = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(client) + + // check that metadata was updated correctly + print("Mutable token's metadata after update: \(tokenInfoAfterMetadataUpdate.metadata.bytes)") + } + + internal static func updateImmutableTokenMetadata(_ client: Client, _ env: Environment) async throws { + print("Creating a immutable token") + + let metadataKey: PrivateKey = PrivateKey.generateEd25519() + + // Note: The same flow can be executed with a TokenType.NON_FUNGIBLE_UNIQUE (i.e. HIP-765) + let tokenId = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.fungibleCommon) + .treasuryAccountId(env.operatorAccountId) + .decimals(3) + .initialSupply(100000) + .metadataKey(.single(metadataKey.publicKey)) + .expirationTime(Timestamp.now + .hours(2)) + .metadata(initialMetadata) + .execute(client) + .getReceipt(client) + .tokenId! + + print("Created a immutable token: \(tokenId)") + + let tokenInfoAfterCreation = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(client) + + print("tokenInfo metadatakey: \(tokenInfoAfterCreation.metadataKey!)") + + // check that metadata was set correctly + print("Immutable token's metadata after creation: \(tokenInfoAfterCreation.metadata.bytes)") + + // Update token's metadata + _ = try await TokenUpdateTransaction() + .tokenId(tokenId) + .metadata(newMetadata) + .freezeWith(client) + .sign(metadataKey) + .execute(client) + .getReceipt(client) + + let tokenInfoAfterMetadataUpdate = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(client) + + // check that metadata was updated correctly + print("Immutable token's metadata after update: \(tokenInfoAfterMetadataUpdate.metadata.bytes)") + } +} + +extension Environment { + /// Account ID for the operator to use in this example. + internal var operatorAccountId: AccountId { + AccountId(self["OPERATOR_ID"]!.stringValue)! + } + + /// Private key for the operator to use in this example. + internal var operatorKey: PrivateKey { + PrivateKey(self["OPERATOR_KEY"]!.stringValue)! + } + + /// The name of the hedera network this example should be ran against. + /// + /// Testnet by default. + internal var networkName: String { + self["HEDERA_NETWORK"]?.stringValue ?? "testnet" + } +} diff --git a/Examples/TopicWithAdminKey/main.swift b/Examples/TopicWithAdminKey/main.swift index a027b0f3..5c05ed72 100644 --- a/Examples/TopicWithAdminKey/main.swift +++ b/Examples/TopicWithAdminKey/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/TransferCrypto/main.swift b/Examples/TransferCrypto/main.swift index d31f406b..c6fd0903 100644 --- a/Examples/TransferCrypto/main.swift +++ b/Examples/TransferCrypto/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/TransferTokens/main.swift b/Examples/TransferTokens/main.swift index 02d6d15f..cdca5be1 100644 --- a/Examples/TransferTokens/main.swift +++ b/Examples/TransferTokens/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Examples/ValidateChecksum/main.swift b/Examples/ValidateChecksum/main.swift index f370b365..a8b44b33 100644 --- a/Examples/ValidateChecksum/main.swift +++ b/Examples/ValidateChecksum/main.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Package.resolved b/Package.resolved index 45ca9c75..8fb6fef4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -176,8 +176,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-syntax.git", "state" : { - "revision" : "74203046135342e4a4a627476dd6caf8b28fe11b", - "version" : "509.0.0" + "revision" : "64889f0c732f210a935a0ad7cda38f77f876262d", + "version" : "509.1.1" } } ], diff --git a/Package.swift b/Package.swift index 2b559647..00a763f9 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -59,6 +59,8 @@ let exampleTargets = [ "TransferTokens", "UpdateAccountPublicKey", "ValidateChecksum", + "TokenUpdateMetadata", + "NftUpdateMetadata", ].map { name in Target.executableTarget( name: "\(name)Example", diff --git a/Sources/Hedera/Account/AccountAllowanceApproveTransaction.swift b/Sources/Hedera/Account/AccountAllowanceApproveTransaction.swift index 72b8fca8..96ceea5c 100644 --- a/Sources/Hedera/Account/AccountAllowanceApproveTransaction.swift +++ b/Sources/Hedera/Account/AccountAllowanceApproveTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountAllowanceDeleteTransaction.swift b/Sources/Hedera/Account/AccountAllowanceDeleteTransaction.swift index 3727103e..793134ba 100644 --- a/Sources/Hedera/Account/AccountAllowanceDeleteTransaction.swift +++ b/Sources/Hedera/Account/AccountAllowanceDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountBalance.swift b/Sources/Hedera/Account/AccountBalance.swift index d0c0ecff..3e738d14 100644 --- a/Sources/Hedera/Account/AccountBalance.swift +++ b/Sources/Hedera/Account/AccountBalance.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountBalanceQuery.swift b/Sources/Hedera/Account/AccountBalanceQuery.swift index 5aa07485..c2ba5953 100644 --- a/Sources/Hedera/Account/AccountBalanceQuery.swift +++ b/Sources/Hedera/Account/AccountBalanceQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountCreateTransaction.swift b/Sources/Hedera/Account/AccountCreateTransaction.swift index 4683f2a0..ef5535c4 100644 --- a/Sources/Hedera/Account/AccountCreateTransaction.swift +++ b/Sources/Hedera/Account/AccountCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountDeleteTransaction.swift b/Sources/Hedera/Account/AccountDeleteTransaction.swift index 9019c115..3c006cb1 100644 --- a/Sources/Hedera/Account/AccountDeleteTransaction.swift +++ b/Sources/Hedera/Account/AccountDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountId.swift b/Sources/Hedera/Account/AccountId.swift index 22a77843..1bcedc83 100644 --- a/Sources/Hedera/Account/AccountId.swift +++ b/Sources/Hedera/Account/AccountId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountInfo.swift b/Sources/Hedera/Account/AccountInfo.swift index 952751fe..05165e18 100644 --- a/Sources/Hedera/Account/AccountInfo.swift +++ b/Sources/Hedera/Account/AccountInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountInfoFlow.swift b/Sources/Hedera/Account/AccountInfoFlow.swift index 3d240183..24f7e85e 100644 --- a/Sources/Hedera/Account/AccountInfoFlow.swift +++ b/Sources/Hedera/Account/AccountInfoFlow.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountInfoQuery.swift b/Sources/Hedera/Account/AccountInfoQuery.swift index e282d432..b1b91b16 100644 --- a/Sources/Hedera/Account/AccountInfoQuery.swift +++ b/Sources/Hedera/Account/AccountInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountRecordsQuery.swift b/Sources/Hedera/Account/AccountRecordsQuery.swift index 1a167ebb..39cc8e6e 100644 --- a/Sources/Hedera/Account/AccountRecordsQuery.swift +++ b/Sources/Hedera/Account/AccountRecordsQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountStakersQuery.swift b/Sources/Hedera/Account/AccountStakersQuery.swift index 556d475b..92ca7a45 100644 --- a/Sources/Hedera/Account/AccountStakersQuery.swift +++ b/Sources/Hedera/Account/AccountStakersQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Account/AccountUpdateTransaction.swift b/Sources/Hedera/Account/AccountUpdateTransaction.swift index 054abddd..0d8f2659 100644 --- a/Sources/Hedera/Account/AccountUpdateTransaction.swift +++ b/Sources/Hedera/Account/AccountUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/AnyTransaction.swift b/Sources/Hedera/AnyTransaction.swift index 89652d8f..a271e822 100644 --- a/Sources/Hedera/AnyTransaction.swift +++ b/Sources/Hedera/AnyTransaction.swift @@ -63,6 +63,7 @@ internal enum ServicesTransactionDataList { case scheduleDelete([Proto_ScheduleDeleteTransactionBody]) case ethereum([Proto_EthereumTransactionBody]) case prng([Proto_UtilPrngTransactionBody]) + case tokenUpdateNfts([Proto_TokenUpdateNftsTransactionBody]) internal mutating func append(_ transaction: Proto_TransactionBody.OneOf_Data) throws { switch (self, transaction) { @@ -230,6 +231,10 @@ internal enum ServicesTransactionDataList { array.append(data) self = .prng(array) + case (.tokenUpdateNfts(var array), .tokenUpdateNfts(let data)): + array.append(data) + self = .tokenUpdateNfts(array) + default: throw HError.fromProtobuf("mismatched transaction types") } @@ -289,6 +294,7 @@ extension ServicesTransactionDataList: TryFromProtobuf { case .scheduleDelete(let data): value = .scheduleDelete([data]) case .scheduleSign(let data): value = .scheduleSign([data]) case .utilPrng(let data): value = .prng([data]) + case .tokenUpdateNfts(let data): value = .tokenUpdateNfts([data]) case .cryptoAddLiveHash: throw HError.fromProtobuf("Unsupported transaction `AddLiveHashTransaction`") case .cryptoDeleteLiveHash: throw HError.fromProtobuf("Unsupported transaction `DeleteLiveHashTransaction`") diff --git a/Sources/Hedera/Checksum.swift b/Sources/Hedera/Checksum.swift index 0d035e0e..7ee48d65 100644 --- a/Sources/Hedera/Checksum.swift +++ b/Sources/Hedera/Checksum.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Client/Client+Config.swift b/Sources/Hedera/Client/Client+Config.swift index 726499ee..eb8f0e79 100644 --- a/Sources/Hedera/Client/Client+Config.swift +++ b/Sources/Hedera/Client/Client+Config.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Client/Client.swift b/Sources/Hedera/Client/Client.swift index 3133296c..049a2e53 100644 --- a/Sources/Hedera/Client/Client.swift +++ b/Sources/Hedera/Client/Client.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -200,6 +200,19 @@ public final class Client: Sendable { case "previewnet": return .forPreviewnet() + case "localhost": + let network: [String: AccountId] = ["127.0.0.1:50211": AccountId(num: 3)] + let eventLoop = PlatformSupport.makeEventLoopGroup(loopCount: 1) + + let client = try Client.forNetwork(network) + client.setMirrorNetwork(["127.0.0.1:5600"]) + + return Self( + network: client.networkInner, + ledgerId: nil, + eventLoop + ) + default: throw HError.basicParse("Unknown network name \(name)") } diff --git a/Sources/Hedera/Client/MirrorNetwork.swift b/Sources/Hedera/Client/MirrorNetwork.swift index 7d9b80d2..f5fcefa5 100644 --- a/Sources/Hedera/Client/MirrorNetwork.swift +++ b/Sources/Hedera/Client/MirrorNetwork.swift @@ -27,6 +27,7 @@ internal final class MirrorNetwork: AtomicReference, Sendable { static let mainnet: Set = [.init(host: "mainnet-public.mirrornode.hedera.com", port: 443)] static let testnet: Set = [.init(host: "testnet.mirrornode.hedera.com", port: 443)] static let previewnet: Set = [.init(host: "previewnet.mirrornode.hedera.com", port: 443)] + static let localhost: Set = [.init(host: "127.0.0.1", port: 5600)] } internal let channel: ChannelBalancer @@ -72,4 +73,8 @@ internal final class MirrorNetwork: AtomicReference, Sendable { internal static func previewnet(_ eventLoop: NIOCore.EventLoopGroup) -> Self { Self(targets: Targets.previewnet, eventLoop: eventLoop) } + + internal static func localhost(_ eventLoop: NIOCore.EventLoopGroup) -> Self { + Self(targets: Targets.localhost, eventLoop: eventLoop) + } } diff --git a/Sources/Hedera/Contract/ContractBytecodeQuery.swift b/Sources/Hedera/Contract/ContractBytecodeQuery.swift index 6c6e3eaf..7c4c4dc3 100644 --- a/Sources/Hedera/Contract/ContractBytecodeQuery.swift +++ b/Sources/Hedera/Contract/ContractBytecodeQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractCallQuery.swift b/Sources/Hedera/Contract/ContractCallQuery.swift index e95297a0..4d06a205 100644 --- a/Sources/Hedera/Contract/ContractCallQuery.swift +++ b/Sources/Hedera/Contract/ContractCallQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractCreateFlow.swift b/Sources/Hedera/Contract/ContractCreateFlow.swift index 5f1bfacf..ad309100 100644 --- a/Sources/Hedera/Contract/ContractCreateFlow.swift +++ b/Sources/Hedera/Contract/ContractCreateFlow.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractCreateTransaction.swift b/Sources/Hedera/Contract/ContractCreateTransaction.swift index 725a347f..e3bc54a2 100644 --- a/Sources/Hedera/Contract/ContractCreateTransaction.swift +++ b/Sources/Hedera/Contract/ContractCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractDeleteTransaction.swift b/Sources/Hedera/Contract/ContractDeleteTransaction.swift index 42337144..89128bac 100644 --- a/Sources/Hedera/Contract/ContractDeleteTransaction.swift +++ b/Sources/Hedera/Contract/ContractDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractExecuteTransaction.swift b/Sources/Hedera/Contract/ContractExecuteTransaction.swift index da1fac25..38b407aa 100644 --- a/Sources/Hedera/Contract/ContractExecuteTransaction.swift +++ b/Sources/Hedera/Contract/ContractExecuteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractFunctionResult.swift b/Sources/Hedera/Contract/ContractFunctionResult.swift index 39a3513d..8e51a230 100644 --- a/Sources/Hedera/Contract/ContractFunctionResult.swift +++ b/Sources/Hedera/Contract/ContractFunctionResult.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractInfo.swift b/Sources/Hedera/Contract/ContractInfo.swift index e47c54b6..b0393883 100644 --- a/Sources/Hedera/Contract/ContractInfo.swift +++ b/Sources/Hedera/Contract/ContractInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractInfoQuery.swift b/Sources/Hedera/Contract/ContractInfoQuery.swift index 43880e0f..b0f02441 100644 --- a/Sources/Hedera/Contract/ContractInfoQuery.swift +++ b/Sources/Hedera/Contract/ContractInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/ContractUpdateTransaction.swift b/Sources/Hedera/Contract/ContractUpdateTransaction.swift index c0add320..b27eec12 100644 --- a/Sources/Hedera/Contract/ContractUpdateTransaction.swift +++ b/Sources/Hedera/Contract/ContractUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Contract/DelegateContractId.swift b/Sources/Hedera/Contract/DelegateContractId.swift index 48663b31..e31454b8 100644 --- a/Sources/Hedera/Contract/DelegateContractId.swift +++ b/Sources/Hedera/Contract/DelegateContractId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Crypto+k256Digest.swift b/Sources/Hedera/Crypto/Crypto+k256Digest.swift index a363c5fa..60940c5c 100644 --- a/Sources/Hedera/Crypto/Crypto+k256Digest.swift +++ b/Sources/Hedera/Crypto/Crypto+k256Digest.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Crypto.swift b/Sources/Hedera/Crypto/Crypto.swift index f6212d95..da3060aa 100644 --- a/Sources/Hedera/Crypto/Crypto.swift +++ b/Sources/Hedera/Crypto/Crypto.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/CryptoAes.swift b/Sources/Hedera/Crypto/CryptoAes.swift index e08ab064..604f361a 100644 --- a/Sources/Hedera/Crypto/CryptoAes.swift +++ b/Sources/Hedera/Crypto/CryptoAes.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/CryptoSha2.swift b/Sources/Hedera/Crypto/CryptoSha2.swift index c62be9b7..250589a0 100644 --- a/Sources/Hedera/Crypto/CryptoSha2.swift +++ b/Sources/Hedera/Crypto/CryptoSha2.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/CryptoSha3.swift b/Sources/Hedera/Crypto/CryptoSha3.swift index 697de006..76068cb2 100644 --- a/Sources/Hedera/Crypto/CryptoSha3.swift +++ b/Sources/Hedera/Crypto/CryptoSha3.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Pkcs5.swift b/Sources/Hedera/Crypto/Pkcs5.swift index 0b2017d9..d87c1859 100644 --- a/Sources/Hedera/Crypto/Pkcs5.swift +++ b/Sources/Hedera/Crypto/Pkcs5.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Pkcs5AlgorithmIdentifier.swift b/Sources/Hedera/Crypto/Pkcs5AlgorithmIdentifier.swift index 789d8f18..d0a597ca 100644 --- a/Sources/Hedera/Crypto/Pkcs5AlgorithmIdentifier.swift +++ b/Sources/Hedera/Crypto/Pkcs5AlgorithmIdentifier.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Pkcs5Pbes2.swift b/Sources/Hedera/Crypto/Pkcs5Pbes2.swift index b51a01a9..93e5f60e 100644 --- a/Sources/Hedera/Crypto/Pkcs5Pbes2.swift +++ b/Sources/Hedera/Crypto/Pkcs5Pbes2.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Pkcs5Pbkdf2.swift b/Sources/Hedera/Crypto/Pkcs5Pbkdf2.swift index 0628e2e1..2c1ac475 100644 --- a/Sources/Hedera/Crypto/Pkcs5Pbkdf2.swift +++ b/Sources/Hedera/Crypto/Pkcs5Pbkdf2.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Crypto/Pkcs8.swift b/Sources/Hedera/Crypto/Pkcs8.swift index 918616d7..68f95974 100644 --- a/Sources/Hedera/Crypto/Pkcs8.swift +++ b/Sources/Hedera/Crypto/Pkcs8.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/CustomFee.swift b/Sources/Hedera/CustomFee.swift index 3a76af31..1aacc843 100644 --- a/Sources/Hedera/CustomFee.swift +++ b/Sources/Hedera/CustomFee.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Data+Extensions.swift b/Sources/Hedera/Data+Extensions.swift index 47d38fbb..736798b4 100644 --- a/Sources/Hedera/Data+Extensions.swift +++ b/Sources/Hedera/Data+Extensions.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/EntityId.swift b/Sources/Hedera/EntityId.swift index 581ec7b3..d04ac13c 100644 --- a/Sources/Hedera/EntityId.swift +++ b/Sources/Hedera/EntityId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Ethereum/EthereumData.swift b/Sources/Hedera/Ethereum/EthereumData.swift index 15150c5e..7c605536 100644 --- a/Sources/Hedera/Ethereum/EthereumData.swift +++ b/Sources/Hedera/Ethereum/EthereumData.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Ethereum/EthereumFlow.swift b/Sources/Hedera/Ethereum/EthereumFlow.swift index 98095589..d0e1f131 100644 --- a/Sources/Hedera/Ethereum/EthereumFlow.swift +++ b/Sources/Hedera/Ethereum/EthereumFlow.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Ethereum/EthereumTransaction.swift b/Sources/Hedera/Ethereum/EthereumTransaction.swift index fd5250e1..03644e57 100644 --- a/Sources/Hedera/Ethereum/EthereumTransaction.swift +++ b/Sources/Hedera/Ethereum/EthereumTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Ethereum/EvmAddress.swift b/Sources/Hedera/Ethereum/EvmAddress.swift index 0f7b3d72..8785a173 100644 --- a/Sources/Hedera/Ethereum/EvmAddress.swift +++ b/Sources/Hedera/Ethereum/EvmAddress.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/ExchangeRates.swift b/Sources/Hedera/ExchangeRates.swift index 4318b850..91e8b9b0 100644 --- a/Sources/Hedera/ExchangeRates.swift +++ b/Sources/Hedera/ExchangeRates.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Execute.swift b/Sources/Hedera/Execute.swift index 9f2c8959..7a7bddcd 100644 --- a/Sources/Hedera/Execute.swift +++ b/Sources/Hedera/Execute.swift @@ -241,7 +241,7 @@ private func executeAnyInner( ?? .generateFrom(ctx.operatorAccountId!) continue inner - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError( kind: .responseStatusUnrecognized, description: "response status \(value) unrecognized" diff --git a/Sources/Hedera/FeeSchedule/FeeComponents.swift b/Sources/Hedera/FeeSchedule/FeeComponents.swift index 67c8962a..c0d85861 100644 --- a/Sources/Hedera/FeeSchedule/FeeComponents.swift +++ b/Sources/Hedera/FeeSchedule/FeeComponents.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FeeSchedule/FeeData.swift b/Sources/Hedera/FeeSchedule/FeeData.swift index 55e45023..d147f65a 100644 --- a/Sources/Hedera/FeeSchedule/FeeData.swift +++ b/Sources/Hedera/FeeSchedule/FeeData.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FeeSchedule/FeeDataType.swift b/Sources/Hedera/FeeSchedule/FeeDataType.swift index 755b1f33..cbb24906 100644 --- a/Sources/Hedera/FeeSchedule/FeeDataType.swift +++ b/Sources/Hedera/FeeSchedule/FeeDataType.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -54,7 +54,7 @@ extension FeeDataType: TryProtobufCodable { case .tokenFungibleCommonWithCustomFees: self = .tokenFungibleCommonWithCustomFees case .tokenNonFungibleUniqueWithCustomFees: self = .tokenNonFungibleUniqueWithCustomFees case .scheduleCreateContractCall: self = .scheduleCreateContractCall - case .UNRECOGNIZED(let code): + case .unrecognized(let code): throw HError.fromProtobuf("unrecognized FeeDataType `\(code)`") } } diff --git a/Sources/Hedera/FeeSchedule/FeeSchedule.swift b/Sources/Hedera/FeeSchedule/FeeSchedule.swift index a6e28247..8d77b0ab 100644 --- a/Sources/Hedera/FeeSchedule/FeeSchedule.swift +++ b/Sources/Hedera/FeeSchedule/FeeSchedule.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FeeSchedule/FeeSchedules.swift b/Sources/Hedera/FeeSchedule/FeeSchedules.swift index 131b4a37..30b8f28f 100644 --- a/Sources/Hedera/FeeSchedule/FeeSchedules.swift +++ b/Sources/Hedera/FeeSchedule/FeeSchedules.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FeeSchedule/RequestType.swift b/Sources/Hedera/FeeSchedule/RequestType.swift index cd5d45b4..f8f823b2 100644 --- a/Sources/Hedera/FeeSchedule/RequestType.swift +++ b/Sources/Hedera/FeeSchedule/RequestType.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -241,6 +241,12 @@ public enum RequestType { /// Execute a PRNG transaction. case utilPrng + /// Get a record for a transaction. + case transactionGetFastRecord + + /// Update a Non-Fungible token. + case tokenUpdateNfts + // this literally can't be smaller. // swiftlint:disable:next function_body_length internal init?(protobuf proto: Proto_HederaFunctionality) throws { @@ -318,7 +324,10 @@ public enum RequestType { case .ethereumTransaction: self = .ethereumTransaction case .nodeStakeUpdate: self = .nodeStakeUpdate case .utilPrng: self = .utilPrng - case .UNRECOGNIZED(let code): + case .transactionGetFastRecord: self = .tokenUpdateNfts + + case .tokenUpdateNfts: self = .tokenUpdateNfts + case .unrecognized(let code): throw HError.fromProtobuf("unrecognized RequestType: `\(code)`") } } @@ -397,6 +406,8 @@ public enum RequestType { case .ethereumTransaction: return .ethereumTransaction case .nodeStakeUpdate: return .nodeStakeUpdate case .utilPrng: return .utilPrng + case .transactionGetFastRecord: return .transactionGetFastRecord + case .tokenUpdateNfts: return .tokenUpdateNfts } } } diff --git a/Sources/Hedera/FeeSchedule/TransactionFeeSchedule.swift b/Sources/Hedera/FeeSchedule/TransactionFeeSchedule.swift index 1cab53fe..0bf5c287 100644 --- a/Sources/Hedera/FeeSchedule/TransactionFeeSchedule.swift +++ b/Sources/Hedera/FeeSchedule/TransactionFeeSchedule.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileAppendTransaction.swift b/Sources/Hedera/File/FileAppendTransaction.swift index 932f1dbf..dd79e280 100644 --- a/Sources/Hedera/File/FileAppendTransaction.swift +++ b/Sources/Hedera/File/FileAppendTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileContentsQuery.swift b/Sources/Hedera/File/FileContentsQuery.swift index bba0e464..035c3c2f 100644 --- a/Sources/Hedera/File/FileContentsQuery.swift +++ b/Sources/Hedera/File/FileContentsQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileContentsResponse.swift b/Sources/Hedera/File/FileContentsResponse.swift index d207d559..eaae0e27 100644 --- a/Sources/Hedera/File/FileContentsResponse.swift +++ b/Sources/Hedera/File/FileContentsResponse.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileCreateTransaction.swift b/Sources/Hedera/File/FileCreateTransaction.swift index 62b9b60f..8c6a14e2 100644 --- a/Sources/Hedera/File/FileCreateTransaction.swift +++ b/Sources/Hedera/File/FileCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileDeleteTransaction.swift b/Sources/Hedera/File/FileDeleteTransaction.swift index aa7f46fb..ce0830cc 100644 --- a/Sources/Hedera/File/FileDeleteTransaction.swift +++ b/Sources/Hedera/File/FileDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileInfo.swift b/Sources/Hedera/File/FileInfo.swift index 967afa67..f8b9a8f5 100644 --- a/Sources/Hedera/File/FileInfo.swift +++ b/Sources/Hedera/File/FileInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileInfoQuery.swift b/Sources/Hedera/File/FileInfoQuery.swift index b22f1d9e..03cd25b5 100644 --- a/Sources/Hedera/File/FileInfoQuery.swift +++ b/Sources/Hedera/File/FileInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/File/FileUpdateTransaction.swift b/Sources/Hedera/File/FileUpdateTransaction.swift index 69b907d2..7bd062ee 100644 --- a/Sources/Hedera/File/FileUpdateTransaction.swift +++ b/Sources/Hedera/File/FileUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FreezeTransaction.swift b/Sources/Hedera/FreezeTransaction.swift index dbc1a8f5..01b7f4ab 100644 --- a/Sources/Hedera/FreezeTransaction.swift +++ b/Sources/Hedera/FreezeTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/FreezeType.swift b/Sources/Hedera/FreezeType.swift index 53df20b3..9386ee9a 100644 --- a/Sources/Hedera/FreezeType.swift +++ b/Sources/Hedera/FreezeType.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -61,7 +61,7 @@ extension FreezeType: TryProtobufCodable { case .freezeUpgrade: self = .freezeUpgrade case .freezeAbort: self = .freezeAbort case .telemetryUpgrade: self = .telemetryUpgrade - case .UNRECOGNIZED(let value): throw HError.fromProtobuf("unrecognized FreezeType: `\(value)`") + case .unrecognized(let value): throw HError.fromProtobuf("unrecognized FreezeType: `\(value)`") } } diff --git a/Sources/Hedera/HError.swift b/Sources/Hedera/HError.swift index 13a51211..e66aba50 100644 --- a/Sources/Hedera/HError.swift +++ b/Sources/Hedera/HError.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Hbar.swift b/Sources/Hedera/Hbar.swift index 717f2133..90e35b11 100644 --- a/Sources/Hedera/Hbar.swift +++ b/Sources/Hedera/Hbar.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Hedera.swift b/Sources/Hedera/Hedera.swift index 3a91ab9e..f6dcfb72 100644 --- a/Sources/Hedera/Hedera.swift +++ b/Sources/Hedera/Hedera.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Key.swift b/Sources/Hedera/Key.swift index 081d784e..44fe95d8 100644 --- a/Sources/Hedera/Key.swift +++ b/Sources/Hedera/Key.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/LedgerId.swift b/Sources/Hedera/LedgerId.swift index cb8e6835..eb3e4c73 100644 --- a/Sources/Hedera/LedgerId.swift +++ b/Sources/Hedera/LedgerId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/MirrorQuery.swift b/Sources/Hedera/MirrorQuery.swift index 26b0464e..3081e620 100644 --- a/Sources/Hedera/MirrorQuery.swift +++ b/Sources/Hedera/MirrorQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Mnemonic/Bip39WordList.swift b/Sources/Hedera/Mnemonic/Bip39WordList.swift index 538c3564..4d4b09b5 100644 --- a/Sources/Hedera/Mnemonic/Bip39WordList.swift +++ b/Sources/Hedera/Mnemonic/Bip39WordList.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Mnemonic/LegacyWordList.swift b/Sources/Hedera/Mnemonic/LegacyWordList.swift index 528a560c..72024240 100644 --- a/Sources/Hedera/Mnemonic/LegacyWordList.swift +++ b/Sources/Hedera/Mnemonic/LegacyWordList.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Mnemonic/Mnemonic.swift b/Sources/Hedera/Mnemonic/Mnemonic.swift index 444feb08..495c9a0a 100644 --- a/Sources/Hedera/Mnemonic/Mnemonic.swift +++ b/Sources/Hedera/Mnemonic/Mnemonic.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Mnemonic/MnemonicWordList.swift b/Sources/Hedera/Mnemonic/MnemonicWordList.swift index 82ecb0c5..fb38c184 100644 --- a/Sources/Hedera/Mnemonic/MnemonicWordList.swift +++ b/Sources/Hedera/Mnemonic/MnemonicWordList.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/NetworkVersionInfo.swift b/Sources/Hedera/NetworkVersionInfo.swift index c3706e01..c1e6bd5b 100644 --- a/Sources/Hedera/NetworkVersionInfo.swift +++ b/Sources/Hedera/NetworkVersionInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/NetworkVersionInfoQuery.swift b/Sources/Hedera/NetworkVersionInfoQuery.swift index 4bfec607..d234bffc 100644 --- a/Sources/Hedera/NetworkVersionInfoQuery.swift +++ b/Sources/Hedera/NetworkVersionInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/NodeAddress.swift b/Sources/Hedera/NodeAddress.swift index 881fce02..e099d59c 100644 --- a/Sources/Hedera/NodeAddress.swift +++ b/Sources/Hedera/NodeAddress.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/NodeAddressBook.swift b/Sources/Hedera/NodeAddressBook.swift index 80ce981e..9ee9b783 100644 --- a/Sources/Hedera/NodeAddressBook.swift +++ b/Sources/Hedera/NodeAddressBook.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/NodeAddressBookQuery.swift b/Sources/Hedera/NodeAddressBookQuery.swift index cee386d2..7bfa73f2 100644 --- a/Sources/Hedera/NodeAddressBookQuery.swift +++ b/Sources/Hedera/NodeAddressBookQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/PaymentTransaction.swift b/Sources/Hedera/PaymentTransaction.swift index 35f6cdfa..5955299e 100644 --- a/Sources/Hedera/PaymentTransaction.swift +++ b/Sources/Hedera/PaymentTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/PingQuery.swift b/Sources/Hedera/PingQuery.swift index af3b45b8..b6071451 100644 --- a/Sources/Hedera/PingQuery.swift +++ b/Sources/Hedera/PingQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/PrivateKey.swift b/Sources/Hedera/PrivateKey.swift index 9031fe0c..a5edaadc 100644 --- a/Sources/Hedera/PrivateKey.swift +++ b/Sources/Hedera/PrivateKey.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/PrngTransaction.swift b/Sources/Hedera/PrngTransaction.swift index 1e2bb6fb..2b11b492 100644 --- a/Sources/Hedera/PrngTransaction.swift +++ b/Sources/Hedera/PrngTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Proto_Response+Extensions.swift b/Sources/Hedera/Proto_Response+Extensions.swift index 103c3399..96afcee6 100644 --- a/Sources/Hedera/Proto_Response+Extensions.swift +++ b/Sources/Hedera/Proto_Response+Extensions.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/ProxyStaker.swift b/Sources/Hedera/ProxyStaker.swift index af9fb81b..4c357444 100644 --- a/Sources/Hedera/ProxyStaker.swift +++ b/Sources/Hedera/ProxyStaker.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/PublicKey.swift b/Sources/Hedera/PublicKey.swift index 7a6c0290..dd38e3cd 100644 --- a/Sources/Hedera/PublicKey.swift +++ b/Sources/Hedera/PublicKey.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Query.swift b/Sources/Hedera/Query.swift index f8af7dac..dbed79e5 100644 --- a/Sources/Hedera/Query.swift +++ b/Sources/Hedera/Query.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/QueryCost.swift b/Sources/Hedera/QueryCost.swift index dea796e8..e60a36be 100644 --- a/Sources/Hedera/QueryCost.swift +++ b/Sources/Hedera/QueryCost.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Request.swift b/Sources/Hedera/Request.swift index 548a2612..5bb0ec9e 100644 --- a/Sources/Hedera/Request.swift +++ b/Sources/Hedera/Request.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Rlp.swift b/Sources/Hedera/Rlp.swift index 3180a302..ede0c2e7 100644 --- a/Sources/Hedera/Rlp.swift +++ b/Sources/Hedera/Rlp.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/AnySchedulableTransaction.swift b/Sources/Hedera/Schedule/AnySchedulableTransaction.swift index f78bd63e..03e6cff9 100644 --- a/Sources/Hedera/Schedule/AnySchedulableTransaction.swift +++ b/Sources/Hedera/Schedule/AnySchedulableTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/ScheduleCreateTransaction.swift b/Sources/Hedera/Schedule/ScheduleCreateTransaction.swift index a312ca4f..cb412997 100644 --- a/Sources/Hedera/Schedule/ScheduleCreateTransaction.swift +++ b/Sources/Hedera/Schedule/ScheduleCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/ScheduleDeleteTransaction.swift b/Sources/Hedera/Schedule/ScheduleDeleteTransaction.swift index 9bfffb95..625defa2 100644 --- a/Sources/Hedera/Schedule/ScheduleDeleteTransaction.swift +++ b/Sources/Hedera/Schedule/ScheduleDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/ScheduleId.swift b/Sources/Hedera/Schedule/ScheduleId.swift index 9a01eba0..c8b84b91 100644 --- a/Sources/Hedera/Schedule/ScheduleId.swift +++ b/Sources/Hedera/Schedule/ScheduleId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/ScheduleInfo.swift b/Sources/Hedera/Schedule/ScheduleInfo.swift index 8ede9b4f..b2c129ce 100644 --- a/Sources/Hedera/Schedule/ScheduleInfo.swift +++ b/Sources/Hedera/Schedule/ScheduleInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -111,6 +111,7 @@ public struct ScheduleInfo: Sendable { case .tokenUnpause(let data): proto.data = .tokenUnpause(data) case .scheduleDelete(let data): proto.data = .scheduleDelete(data) case .utilPrng(let data): proto.data = .utilPrng(data) + case .tokenUpdateNfts(let data): proto.data = .tokenUpdateNfts(data) case nil: break } diff --git a/Sources/Hedera/Schedule/ScheduleInfoQuery.swift b/Sources/Hedera/Schedule/ScheduleInfoQuery.swift index 3fb28178..d1f121b6 100644 --- a/Sources/Hedera/Schedule/ScheduleInfoQuery.swift +++ b/Sources/Hedera/Schedule/ScheduleInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Schedule/ScheduleSignTransaction.swift b/Sources/Hedera/Schedule/ScheduleSignTransaction.swift index a973509c..c666ba5e 100644 --- a/Sources/Hedera/Schedule/ScheduleSignTransaction.swift +++ b/Sources/Hedera/Schedule/ScheduleSignTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/SemanticVersion.swift b/Sources/Hedera/SemanticVersion.swift index d032b10d..b0a0e7ac 100644 --- a/Sources/Hedera/SemanticVersion.swift +++ b/Sources/Hedera/SemanticVersion.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/StakingInfo.swift b/Sources/Hedera/StakingInfo.swift index 1a0ca904..7e93d96c 100644 --- a/Sources/Hedera/StakingInfo.swift +++ b/Sources/Hedera/StakingInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Status+Extensions.swift b/Sources/Hedera/Status+Extensions.swift index 7729b221..2cacaa3a 100644 --- a/Sources/Hedera/Status+Extensions.swift +++ b/Sources/Hedera/Status+Extensions.swift @@ -12,6 +12,6 @@ extension Status: LosslessStringConvertible, CustomStringConvertible, Expressibl } public var description: String { - Self.nameMap[rawValue] ?? "UNRECOGNIZED \(rawValue)" + Self.nameMap[rawValue] ?? "unrecognized \(rawValue)" } } diff --git a/Sources/Hedera/Status.swift b/Sources/Hedera/Status.swift index f03bf7e1..45f5514d 100644 --- a/Sources/Hedera/Status.swift +++ b/Sources/Hedera/Status.swift @@ -933,8 +933,22 @@ public enum Status: Equatable { /// An alias that is assigned to an account or contract cannot be assigned to another account or contract. case aliasAlreadyAssigned // = 332 - // swift-format-ignore: AlwaysUseLowerCamelCase - case UNRECOGNIZED(Int32) + + /// A provided metadata key was invalid. Verification includes, for example, checking the size of Ed25519 and ECDSA(secp256k1) + /// public keys. + case invalidMetadataKey // = 333 + + ///Metadata key is not set on token + case tokenHasNoMetadataKey // = 334 + + /// Token Metadata is not provided + case missingTokenMetadata // = 335 + + /// NFT serial numbers are missing in the TokenUpdateNftsTransactionBody + case missingSerialNumbers // = 336 + + /// swift-format-ignore: AlwaysUseLowerCamelCase + case unrecognized(Int32) // minimal edit from protoc generated: (changed from `init?`) // swiftlint:disable:next function_body_length @@ -1231,7 +1245,11 @@ public enum Status: Equatable { case 330: self = .transactionHasUnknownFields case 331: self = .accountIsImmutable case 332: self = .aliasAlreadyAssigned - default: self = .UNRECOGNIZED(rawValue) + case 333: self = .invalidMetadataKey + case 334: self = .tokenHasNoMetadataKey + case 335: self = .missingTokenMetadata + case 336: self = .missingSerialNumbers + default: self = .unrecognized(rawValue) } } @@ -1528,14 +1546,18 @@ public enum Status: Equatable { case .transactionHasUnknownFields: return 330 case .accountIsImmutable: return 331 case .aliasAlreadyAssigned: return 332 - case .UNRECOGNIZED(let i): return i + case .invalidMetadataKey: return 333 + case .tokenHasNoMetadataKey: return 334 + case .missingTokenMetadata: return 335 + case .missingSerialNumbers: return 336 + case .unrecognized(let i): return i } } } extension Status: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Status] = [ .ok, .invalidTransaction, @@ -1828,6 +1850,10 @@ extension Status: CaseIterable { .transactionHasUnknownFields, .accountIsImmutable, .aliasAlreadyAssigned, + .invalidMetadataKey, + .tokenHasNoMetadataKey, + .missingTokenMetadata, + .missingSerialNumbers, ] } @@ -2126,6 +2152,10 @@ extension Status { 330: "TRANSACTION_HAS_UNKNOWN_FIELDS", 331: "ACCOUNT_IS_IMMUTABLE", 332: "ALIAS_ALREADY_ASSIGNED", + 333: "INVALID_METADATA_KEY", + 334: "TOKEN_HAS_NO_METADATA_KEY", + 335: "MISSING_TOKEN_METADATA", + 336: "MISSING_SERIAL_NUMBERS", ] } diff --git a/Sources/Hedera/StringProtocol+Extensions.swift b/Sources/Hedera/StringProtocol+Extensions.swift index 467d28a4..e3847f6e 100644 --- a/Sources/Hedera/StringProtocol+Extensions.swift +++ b/Sources/Hedera/StringProtocol+Extensions.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/SystemDeleteTransaction.swift b/Sources/Hedera/SystemDeleteTransaction.swift index 16073859..0d2470f3 100644 --- a/Sources/Hedera/SystemDeleteTransaction.swift +++ b/Sources/Hedera/SystemDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/SystemUndeleteTransaction.swift b/Sources/Hedera/SystemUndeleteTransaction.swift index a9ca14fd..c9e67fac 100644 --- a/Sources/Hedera/SystemUndeleteTransaction.swift +++ b/Sources/Hedera/SystemUndeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/NftId.swift b/Sources/Hedera/Token/NftId.swift index c81c081f..9d43d822 100644 --- a/Sources/Hedera/Token/NftId.swift +++ b/Sources/Hedera/Token/NftId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenAssociateTransaction.swift b/Sources/Hedera/Token/TokenAssociateTransaction.swift index 6fecc41f..93b84a1d 100644 --- a/Sources/Hedera/Token/TokenAssociateTransaction.swift +++ b/Sources/Hedera/Token/TokenAssociateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenAssociation.swift b/Sources/Hedera/Token/TokenAssociation.swift index 315addc5..48fa2732 100644 --- a/Sources/Hedera/Token/TokenAssociation.swift +++ b/Sources/Hedera/Token/TokenAssociation.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenBurnTransaction.swift b/Sources/Hedera/Token/TokenBurnTransaction.swift index dedd4d28..c1101e95 100644 --- a/Sources/Hedera/Token/TokenBurnTransaction.swift +++ b/Sources/Hedera/Token/TokenBurnTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenCreateTransaction.swift b/Sources/Hedera/Token/TokenCreateTransaction.swift index 73eef03e..15117053 100644 --- a/Sources/Hedera/Token/TokenCreateTransaction.swift +++ b/Sources/Hedera/Token/TokenCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -49,7 +49,9 @@ public final class TokenCreateTransaction: Transaction { maxSupply: UInt64 = 0, feeScheduleKey: Key? = nil, customFees: [AnyCustomFee] = [], - pauseKey: Key? = nil + pauseKey: Key? = nil, + metadata: Data = .init(), + metadataKey: Key? = nil ) { self.name = name self.symbol = symbol @@ -72,6 +74,8 @@ public final class TokenCreateTransaction: Transaction { self.feeScheduleKey = feeScheduleKey self.customFees = customFees self.pauseKey = pauseKey + self.metadata = metadata + self.metadataKey = metadataKey super.init() } @@ -98,6 +102,8 @@ public final class TokenCreateTransaction: Transaction { feeScheduleKey = data.hasFeeScheduleKey ? try .fromProtobuf(data.feeScheduleKey) : nil customFees = try .fromProtobuf(data.customFees) pauseKey = data.hasPauseKey ? try .fromProtobuf(data.pauseKey) : nil + metadata = data.metadata + metadataKey = data.hasMetadataKey ? try .fromProtobuf(data.metadataKey) : nil try super.init(protobuf: proto) } @@ -418,6 +424,36 @@ public final class TokenCreateTransaction: Transaction { return self } + /// The metadata of the created token definition. + public var metadata: Data { + willSet { + ensureNotFrozen() + } + } + + /// Sets metadata of the created token definition. + @discardableResult + public func metadata(_ metadata: Data) -> Self { + self.metadata = metadata + + return self + } + + /// Returns the key which can change the metadata of a token. + public var metadataKey: Key? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the key which can change the metadata of a token. + @discardableResult + public func metadataKey(_ metadataKey: Key) -> Self { + self.metadataKey = metadataKey + + return self + } + internal override func validateChecksums(on ledgerId: LedgerId) throws { try treasuryAccountId?.validateChecksums(on: ledgerId) try autoRenewAccountId?.validateChecksums(on: ledgerId) @@ -465,6 +501,8 @@ extension TokenCreateTransaction: ToProtobuf { feeScheduleKey?.toProtobufInto(&proto.feeScheduleKey) proto.customFees = customFees.toProtobuf() pauseKey?.toProtobufInto(&proto.pauseKey) + proto.metadata = metadata + metadataKey?.toProtobufInto(&proto.metadataKey) } } } diff --git a/Sources/Hedera/Token/TokenDeleteTransaction.swift b/Sources/Hedera/Token/TokenDeleteTransaction.swift index 78c023b2..9d058615 100644 --- a/Sources/Hedera/Token/TokenDeleteTransaction.swift +++ b/Sources/Hedera/Token/TokenDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenDissociateTransaction.swift b/Sources/Hedera/Token/TokenDissociateTransaction.swift index 46de854a..34f8114e 100644 --- a/Sources/Hedera/Token/TokenDissociateTransaction.swift +++ b/Sources/Hedera/Token/TokenDissociateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenFeeScheduleUpdateTransaction.swift b/Sources/Hedera/Token/TokenFeeScheduleUpdateTransaction.swift index 4031373d..57564d53 100644 --- a/Sources/Hedera/Token/TokenFeeScheduleUpdateTransaction.swift +++ b/Sources/Hedera/Token/TokenFeeScheduleUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenFreezeTransaction.swift b/Sources/Hedera/Token/TokenFreezeTransaction.swift index 27d71981..17c1ee0f 100644 --- a/Sources/Hedera/Token/TokenFreezeTransaction.swift +++ b/Sources/Hedera/Token/TokenFreezeTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenGrantKycTransaction.swift b/Sources/Hedera/Token/TokenGrantKycTransaction.swift index 94291d2c..98fa814a 100644 --- a/Sources/Hedera/Token/TokenGrantKycTransaction.swift +++ b/Sources/Hedera/Token/TokenGrantKycTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenId.swift b/Sources/Hedera/Token/TokenId.swift index aa99500f..9797a4c5 100644 --- a/Sources/Hedera/Token/TokenId.swift +++ b/Sources/Hedera/Token/TokenId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenInfo.swift b/Sources/Hedera/Token/TokenInfo.swift index ea3d4a7a..41a29ebd 100644 --- a/Sources/Hedera/Token/TokenInfo.swift +++ b/Sources/Hedera/Token/TokenInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -102,6 +102,13 @@ public struct TokenInfo { /// The ledger ID the response was returned from public let ledgerId: LedgerId + /// Represents the metadata of the token definition. + public let metadata: Data + + /// The key which can change the metadata of a token + /// (token definition and individual NFTs). + public let metadataKey: Key? + /// Decode `Self` from protobuf-encoded `bytes`. /// /// - Throws: ``HError/ErrorKind/fromProtobuf`` if: @@ -128,6 +135,7 @@ extension TokenInfo: TryProtobufCodable { let wipeKey = proto.hasWipeKey ? proto.wipeKey : nil let supplyKey = proto.hasSupplyKey ? proto.supplyKey : nil let feeScheduleKey = proto.hasFeeScheduleKey ? proto.feeScheduleKey : nil + let metadataKey = proto.hasMetadataKey ? proto.metadataKey : nil let defaultFreezeStatus: Bool? switch proto.defaultFreezeStatus { @@ -137,7 +145,7 @@ extension TokenInfo: TryProtobufCodable { defaultFreezeStatus = true case .unfrozen: defaultFreezeStatus = false - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError.fromProtobuf("Unrecognized defaultFreezeStatus: `\(value)`") } @@ -149,7 +157,7 @@ extension TokenInfo: TryProtobufCodable { defaultKycStatus = true case .revoked: defaultKycStatus = false - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError.fromProtobuf("Unrecognized defaultKycStatus: `\(value)`") } @@ -167,7 +175,7 @@ extension TokenInfo: TryProtobufCodable { pauseStatus = true case .unpaused: pauseStatus = false - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError.fromProtobuf("Unrecognized pauseStatus: `\(value)`") } @@ -197,7 +205,9 @@ extension TokenInfo: TryProtobufCodable { customFees: try .fromProtobuf(proto.customFees), pauseKey: try .fromProtobuf(pauseKey), pauseStatus: pauseStatus, - ledgerId: LedgerId(proto.ledgerID) + ledgerId: LedgerId(proto.ledgerID), + metadata: proto.metadata, + metadataKey: try .fromProtobuf(metadataKey) ) } @@ -234,6 +244,10 @@ extension TokenInfo: TryProtobufCodable { proto.pauseStatus = pauseStatus.map { $0 ? .paused : .unpaused } ?? .pauseNotApplicable proto.ledgerID = ledgerId.bytes + + proto.metadata = metadata + + metadataKey?.toProtobufInto(&proto.metadataKey) } } } diff --git a/Sources/Hedera/Token/TokenInfoQuery.swift b/Sources/Hedera/Token/TokenInfoQuery.swift index 23e62132..c43bfc8b 100644 --- a/Sources/Hedera/Token/TokenInfoQuery.swift +++ b/Sources/Hedera/Token/TokenInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenMintTransaction.swift b/Sources/Hedera/Token/TokenMintTransaction.swift index 12701ac7..ea811ddd 100644 --- a/Sources/Hedera/Token/TokenMintTransaction.swift +++ b/Sources/Hedera/Token/TokenMintTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenNftInfo.swift b/Sources/Hedera/Token/TokenNftInfo.swift index 967eec3d..52525e7e 100644 --- a/Sources/Hedera/Token/TokenNftInfo.swift +++ b/Sources/Hedera/Token/TokenNftInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenNftInfoQuery.swift b/Sources/Hedera/Token/TokenNftInfoQuery.swift index 47a1d1ee..4f218668 100644 --- a/Sources/Hedera/Token/TokenNftInfoQuery.swift +++ b/Sources/Hedera/Token/TokenNftInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenPauseTransaction.swift b/Sources/Hedera/Token/TokenPauseTransaction.swift index 33e7585e..a53f791b 100644 --- a/Sources/Hedera/Token/TokenPauseTransaction.swift +++ b/Sources/Hedera/Token/TokenPauseTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenRevokeKycTransaction.swift b/Sources/Hedera/Token/TokenRevokeKycTransaction.swift index 4008b115..32572383 100644 --- a/Sources/Hedera/Token/TokenRevokeKycTransaction.swift +++ b/Sources/Hedera/Token/TokenRevokeKycTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenSupplyType.swift b/Sources/Hedera/Token/TokenSupplyType.swift index 5650994f..825ebed5 100644 --- a/Sources/Hedera/Token/TokenSupplyType.swift +++ b/Sources/Hedera/Token/TokenSupplyType.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -41,7 +41,7 @@ extension TokenSupplyType: TryProtobufCodable { self = .infinite case .finite: self = .finite - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError.fromProtobuf("unrecognized TokenSupplyType: `\(value)`") } } diff --git a/Sources/Hedera/Token/TokenType.swift b/Sources/Hedera/Token/TokenType.swift index 81b2cb82..ccbcbda6 100644 --- a/Sources/Hedera/Token/TokenType.swift +++ b/Sources/Hedera/Token/TokenType.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -49,7 +49,7 @@ extension TokenType: TryProtobufCodable { switch proto { case .fungibleCommon: self = .fungibleCommon case .nonFungibleUnique: self = .nonFungibleUnique - case .UNRECOGNIZED(let value): + case .unrecognized(let value): throw HError.fromProtobuf("unrecognized token type \(value)") } } diff --git a/Sources/Hedera/Token/TokenUnfreezeTransaction.swift b/Sources/Hedera/Token/TokenUnfreezeTransaction.swift index 1cf87e2e..197f91cf 100644 --- a/Sources/Hedera/Token/TokenUnfreezeTransaction.swift +++ b/Sources/Hedera/Token/TokenUnfreezeTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenUnpauseTransaction.swift b/Sources/Hedera/Token/TokenUnpauseTransaction.swift index 175dfff6..49e5be61 100644 --- a/Sources/Hedera/Token/TokenUnpauseTransaction.swift +++ b/Sources/Hedera/Token/TokenUnpauseTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Token/TokenUpdateNftTransaction.swift b/Sources/Hedera/Token/TokenUpdateNftTransaction.swift new file mode 100644 index 00000000..614ccf95 --- /dev/null +++ b/Sources/Hedera/Token/TokenUpdateNftTransaction.swift @@ -0,0 +1,127 @@ +/* + * ‌ + * 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 + +/// At consensus, updates an already created non-fungible token to the given values. +public final class TokenUpdateNftsTransaction: Transaction { + /// Create a new `TokenUpdateNftsTransaction`. + public init( + tokenId: TokenId? = nil, + serials: [UInt64] = [], + metadata: Data = .init() + ) { + self.tokenId = tokenId + self.serials = serials + self.metadata = metadata + + super.init() + } + + internal init(protobuf proto: Proto_TransactionBody, _ data: Proto_TokenUpdateNftsTransactionBody) throws { + self.tokenId = data.hasToken ? .fromProtobuf(data.token) : nil + self.serials = data.serialNumbers.map(UInt64.init) + self.metadata = data.hasMetadata ? data.metadata.value : nil ?? Data.init() + + try super.init(protobuf: proto) + } + + /// The token to be updated. + public var tokenId: TokenId? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the token to be updated. + @discardableResult + public func tokenId(_ tokenId: TokenId) -> Self { + self.tokenId = tokenId + + return self + } + + /// Returns the list of serial numbers to be updated. + public var serials: [UInt64] { + willSet { + ensureNotFrozen() + } + } + + /// Sets the list of serial numbers to be updated. + @discardableResult + public func serials(_ serials: [UInt64]) -> Self { + self.serials = serials + + return self + } + + /// Returns the new metadata of the created token definition. + public var metadata: Data { + willSet { + ensureNotFrozen() + } + } + + /// Sets the new metadata of the token definition. + @discardableResult + public func metadata(_ metadata: Data) -> Self { + self.metadata = metadata + + return self + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws { + try tokenId?.validateChecksums(on: ledgerId) + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_TokenServiceAsyncClient(channel: channel).updateToken(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .tokenUpdateNfts(toProtobuf()) + } +} + +extension TokenUpdateNftsTransaction: ToProtobuf { + internal typealias Protobuf = Proto_TokenUpdateNftsTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + tokenId?.toProtobufInto(&proto.token) + proto.serialNumbers = serials.map(Int64.init(bitPattern:)) + proto.metadata = Google_Protobuf_BytesValue(metadata) + } + } +} + +extension TokenUpdateNftsTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .tokenUpdateNfts(toProtobuf()) + } +} diff --git a/Sources/Hedera/Token/TokenUpdateTransaction.swift b/Sources/Hedera/Token/TokenUpdateTransaction.swift index 280cccf5..19ebecf8 100644 --- a/Sources/Hedera/Token/TokenUpdateTransaction.swift +++ b/Sources/Hedera/Token/TokenUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -39,9 +39,11 @@ public final class TokenUpdateTransaction: Transaction { autoRenewAccountId: AccountId? = nil, autoRenewPeriod: Duration? = nil, expirationTime: Timestamp? = nil, - tokenMemo: String = "", + tokenMemo: String? = nil, feeScheduleKey: Key? = nil, - pauseKey: Key? = nil + pauseKey: Key? = nil, + metadata: Data = .init(), + metadataKey: Key? = nil ) { self.tokenId = tokenId self.tokenName = tokenName @@ -58,6 +60,8 @@ public final class TokenUpdateTransaction: Transaction { self.tokenMemo = tokenMemo self.feeScheduleKey = feeScheduleKey self.pauseKey = pauseKey + self.metadata = metadata + self.metadataKey = metadataKey super.init() } @@ -78,6 +82,8 @@ public final class TokenUpdateTransaction: Transaction { self.tokenMemo = data.hasMemo ? data.memo.value : nil ?? "" self.feeScheduleKey = data.hasFeeScheduleKey ? try .fromProtobuf(data.feeScheduleKey) : nil self.pauseKey = data.hasPauseKey ? try .fromProtobuf(data.pauseKey) : nil + self.metadata = data.hasMetadata ? data.metadata.value : nil ?? Data.init() + self.metadataKey = data.hasMetadataKey ? try .fromProtobuf(data.metadataKey) : nil try super.init(protobuf: proto) } @@ -265,7 +271,7 @@ public final class TokenUpdateTransaction: Transaction { } /// The new memo associated with the token (UTF-8 encoding max 100 bytes). - public var tokenMemo: String { + public var tokenMemo: String? { willSet { ensureNotFrozen() } @@ -281,7 +287,7 @@ public final class TokenUpdateTransaction: Transaction { @discardableResult public func clearMemo() -> Self { - tokenMemo = "" + tokenMemo = nil return self } @@ -316,6 +322,36 @@ public final class TokenUpdateTransaction: Transaction { return self } + /// Returns the new metadata of the created token definition. + public var metadata: Data { + willSet { + ensureNotFrozen() + } + } + + /// Sets the new metadata of the token definition. + @discardableResult + public func metadata(_ metadata: Data) -> Self { + self.metadata = metadata + + return self + } + + /// Returns the new key which can change the metadata of a token. + public var metadataKey: Key? { + willSet { + ensureNotFrozen() + } + } + + /// Sets the new key which can change the metadata of a token. + @discardableResult + public func metadataKey(_ metadataKey: Key) -> Self { + self.metadataKey = metadataKey + + return self + } + internal override func validateChecksums(on ledgerId: LedgerId) throws { try tokenId?.validateChecksums(on: ledgerId) try treasuryAccountId?.validateChecksums(on: ledgerId) @@ -340,7 +376,7 @@ extension TokenUpdateTransaction: ToProtobuf { internal typealias Protobuf = Proto_TokenUpdateTransactionBody internal func toProtobuf() -> Protobuf { - .with { proto in + return .with { proto in tokenId?.toProtobufInto(&proto.token) proto.name = tokenName proto.symbol = tokenSymbol @@ -353,9 +389,13 @@ extension TokenUpdateTransaction: ToProtobuf { autoRenewAccountId?.toProtobufInto(&proto.autoRenewAccount) autoRenewPeriod?.toProtobufInto(&proto.autoRenewPeriod) expirationTime?.toProtobufInto(&proto.expiry) - proto.memo = Google_Protobuf_StringValue(tokenMemo) feeScheduleKey?.toProtobufInto(&proto.feeScheduleKey) pauseKey?.toProtobufInto(&proto.pauseKey) + proto.metadata = Google_Protobuf_BytesValue(metadata) + metadataKey?.toProtobufInto(&proto.metadataKey) + if let tokenMemo = tokenMemo { + proto.memo = .init(tokenMemo) + } } } } diff --git a/Sources/Hedera/Token/TokenWipeTransaction.swift b/Sources/Hedera/Token/TokenWipeTransaction.swift index ca65328d..00de0cef 100644 --- a/Sources/Hedera/Token/TokenWipeTransaction.swift +++ b/Sources/Hedera/Token/TokenWipeTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicCreateTransaction.swift b/Sources/Hedera/Topic/TopicCreateTransaction.swift index 2dbec9a9..ce5accf0 100644 --- a/Sources/Hedera/Topic/TopicCreateTransaction.swift +++ b/Sources/Hedera/Topic/TopicCreateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicDeleteTransaction.swift b/Sources/Hedera/Topic/TopicDeleteTransaction.swift index 50ed23cb..579b014e 100644 --- a/Sources/Hedera/Topic/TopicDeleteTransaction.swift +++ b/Sources/Hedera/Topic/TopicDeleteTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicId.swift b/Sources/Hedera/Topic/TopicId.swift index 69ef4ab5..d843059e 100644 --- a/Sources/Hedera/Topic/TopicId.swift +++ b/Sources/Hedera/Topic/TopicId.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicInfo.swift b/Sources/Hedera/Topic/TopicInfo.swift index fca262dd..21a4f217 100644 --- a/Sources/Hedera/Topic/TopicInfo.swift +++ b/Sources/Hedera/Topic/TopicInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicInfoQuery.swift b/Sources/Hedera/Topic/TopicInfoQuery.swift index 379a7af0..2d1320e7 100644 --- a/Sources/Hedera/Topic/TopicInfoQuery.swift +++ b/Sources/Hedera/Topic/TopicInfoQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicMessageSubmitTransaction.swift b/Sources/Hedera/Topic/TopicMessageSubmitTransaction.swift index 364ddc25..948146b8 100644 --- a/Sources/Hedera/Topic/TopicMessageSubmitTransaction.swift +++ b/Sources/Hedera/Topic/TopicMessageSubmitTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Topic/TopicUpdateTransaction.swift b/Sources/Hedera/Topic/TopicUpdateTransaction.swift index a2d97229..04949312 100644 --- a/Sources/Hedera/Topic/TopicUpdateTransaction.swift +++ b/Sources/Hedera/Topic/TopicUpdateTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Transaction.swift b/Sources/Hedera/Transaction.swift index f6f879c5..d5cb5102 100644 --- a/Sources/Hedera/Transaction.swift +++ b/Sources/Hedera/Transaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift index 646264aa..10e99e23 100644 --- a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift +++ b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -197,6 +197,10 @@ extension Transaction { case .prng(let value): let value = try intoOnlyValue(value) return try PrngTransaction(protobuf: firstBody, value) + + case .tokenUpdateNfts(let value): + let value = try intoOnlyValue(value) + return try TokenUpdateNftsTransaction(protobuf: firstBody, value) } } } diff --git a/Sources/Hedera/Transaction/TransactionChunkInfo.swift b/Sources/Hedera/Transaction/TransactionChunkInfo.swift index 5554aa4b..dcba97d6 100644 --- a/Sources/Hedera/Transaction/TransactionChunkInfo.swift +++ b/Sources/Hedera/Transaction/TransactionChunkInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Transaction/TransactionHash.swift b/Sources/Hedera/Transaction/TransactionHash.swift index 812308af..3febd3d3 100644 --- a/Sources/Hedera/Transaction/TransactionHash.swift +++ b/Sources/Hedera/Transaction/TransactionHash.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Transaction/TransactionSignaturePair.swift b/Sources/Hedera/Transaction/TransactionSignaturePair.swift index 00ade944..68ada76b 100644 --- a/Sources/Hedera/Transaction/TransactionSignaturePair.swift +++ b/Sources/Hedera/Transaction/TransactionSignaturePair.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/Transaction/TransactionSources.swift b/Sources/Hedera/Transaction/TransactionSources.swift index 4c8acdb7..ad864028 100644 --- a/Sources/Hedera/Transaction/TransactionSources.swift +++ b/Sources/Hedera/Transaction/TransactionSources.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransactionReceipt.swift b/Sources/Hedera/TransactionReceipt.swift index 7d7ca72a..1bd3b700 100644 --- a/Sources/Hedera/TransactionReceipt.swift +++ b/Sources/Hedera/TransactionReceipt.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransactionReceiptQuery.swift b/Sources/Hedera/TransactionReceiptQuery.swift index 1dc80045..bb5c1d47 100644 --- a/Sources/Hedera/TransactionReceiptQuery.swift +++ b/Sources/Hedera/TransactionReceiptQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransactionRecord.swift b/Sources/Hedera/TransactionRecord.swift index 7acee32a..1c512195 100644 --- a/Sources/Hedera/TransactionRecord.swift +++ b/Sources/Hedera/TransactionRecord.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransactionRecordQuery.swift b/Sources/Hedera/TransactionRecordQuery.swift index 09088913..d9765f92 100644 --- a/Sources/Hedera/TransactionRecordQuery.swift +++ b/Sources/Hedera/TransactionRecordQuery.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransactionResponse.swift b/Sources/Hedera/TransactionResponse.swift index 661f1f91..cd607ac1 100644 --- a/Sources/Hedera/TransactionResponse.swift +++ b/Sources/Hedera/TransactionResponse.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/Hedera/TransferTransaction.swift b/Sources/Hedera/TransferTransaction.swift index 2b882563..8d01aa65 100644 --- a/Sources/Hedera/TransferTransaction.swift +++ b/Sources/Hedera/TransferTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Sources/HederaProtobufs/Services/basic_types.pb.swift b/Sources/HederaProtobufs/Services/basic_types.pb.swift index 662d04bb..987e61a3 100644 --- a/Sources/HederaProtobufs/Services/basic_types.pb.swift +++ b/Sources/HederaProtobufs/Services/basic_types.pb.swift @@ -39,7 +39,7 @@ public enum Proto_TokenType: SwiftProtobuf.Enum { /// Unique, not interchangeable with other tokens of the same type as they typically have /// different values. Individually traced and can carry unique properties (e.g. serial number). case nonFungibleUnique // = 1 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .fungibleCommon @@ -49,7 +49,7 @@ public enum Proto_TokenType: SwiftProtobuf.Enum { switch rawValue { case 0: self = .fungibleCommon case 1: self = .nonFungibleUnique - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -57,7 +57,7 @@ public enum Proto_TokenType: SwiftProtobuf.Enum { switch self { case .fungibleCommon: return 0 case .nonFungibleUnique: return 1 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -66,7 +66,7 @@ public enum Proto_TokenType: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_TokenType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_TokenType] = [ .fungibleCommon, .nonFungibleUnique, @@ -113,7 +113,7 @@ public enum Proto_SubType: SwiftProtobuf.Enum { ///* /// The resource prices are scoped to a ScheduleCreate containing a ContractCall. case scheduleCreateContractCall // = 5 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .default @@ -127,7 +127,7 @@ public enum Proto_SubType: SwiftProtobuf.Enum { case 3: self = .tokenFungibleCommonWithCustomFees case 4: self = .tokenNonFungibleUniqueWithCustomFees case 5: self = .scheduleCreateContractCall - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -139,7 +139,7 @@ public enum Proto_SubType: SwiftProtobuf.Enum { case .tokenFungibleCommonWithCustomFees: return 3 case .tokenNonFungibleUniqueWithCustomFees: return 4 case .scheduleCreateContractCall: return 5 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -148,7 +148,7 @@ public enum Proto_SubType: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_SubType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_SubType] = [ .default, .tokenFungibleCommon, @@ -175,7 +175,7 @@ public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { /// Indicates that tokens of that type have an upper bound of maxSupply, /// provided on token creation. case finite // = 1 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .infinite @@ -185,7 +185,7 @@ public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { switch rawValue { case 0: self = .infinite case 1: self = .finite - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -193,7 +193,7 @@ public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { switch self { case .infinite: return 0 case .finite: return 1 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -202,7 +202,7 @@ public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_TokenSupplyType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_TokenSupplyType] = [ .infinite, .finite, @@ -228,7 +228,7 @@ public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { ///* /// UNDOCUMENTED case unfrozen // = 2 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .freezeNotApplicable @@ -239,7 +239,7 @@ public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { case 0: self = .freezeNotApplicable case 1: self = .frozen case 2: self = .unfrozen - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -248,7 +248,7 @@ public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { case .freezeNotApplicable: return 0 case .frozen: return 1 case .unfrozen: return 2 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -257,7 +257,7 @@ public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_TokenFreezeStatus: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_TokenFreezeStatus] = [ .freezeNotApplicable, .frozen, @@ -283,7 +283,7 @@ public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { ///* /// UNDOCUMENTED case revoked // = 2 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .kycNotApplicable @@ -294,7 +294,7 @@ public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { case 0: self = .kycNotApplicable case 1: self = .granted case 2: self = .revoked - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -303,7 +303,7 @@ public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { case .kycNotApplicable: return 0 case .granted: return 1 case .revoked: return 2 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -312,7 +312,7 @@ public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_TokenKycStatus: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_TokenKycStatus] = [ .kycNotApplicable, .granted, @@ -338,7 +338,7 @@ public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { ///* /// Indicates that a Token is Unpaused. case unpaused // = 2 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .pauseNotApplicable @@ -349,7 +349,7 @@ public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { case 0: self = .pauseNotApplicable case 1: self = .paused case 2: self = .unpaused - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -358,7 +358,7 @@ public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { case .pauseNotApplicable: return 0 case .paused: return 1 case .unpaused: return 2 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -367,7 +367,7 @@ public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_TokenPauseStatus: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_TokenPauseStatus] = [ .pauseNotApplicable, .paused, @@ -672,7 +672,15 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { ///* /// Generates a pseudorandom number. case utilPrng // = 86 - case UNRECOGNIZED(Int) + + ///* + /// Get a record for a transaction. + case transactionGetFastRecord // = 87 + + ///* + /// Update the metadata of one or more NFT's of a specific token type. + case tokenUpdateNfts // = 88 + case unrecognized(Int) public init() { self = .none @@ -753,7 +761,9 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { case 84: self = .ethereumTransaction case 85: self = .nodeStakeUpdate case 86: self = .utilPrng - default: self = .UNRECOGNIZED(rawValue) + case 87: self = .transactionGetFastRecord + case 88: self = .tokenUpdateNfts + default: self = .unrecognized(rawValue) } } @@ -832,7 +842,9 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { case .ethereumTransaction: return 84 case .nodeStakeUpdate: return 85 case .utilPrng: return 86 - case .UNRECOGNIZED(let i): return i + case .transactionGetFastRecord: return 87 + case .tokenUpdateNfts: return 88 + case .unrecognized(let i): return i } } @@ -841,7 +853,7 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_HederaFunctionality: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_HederaFunctionality] = [ .none, .cryptoTransfer, @@ -916,6 +928,8 @@ extension Proto_HederaFunctionality: CaseIterable { .ethereumTransaction, .nodeStakeUpdate, .utilPrng, + .transactionGetFastRecord, + .tokenUpdateNfts, ] } @@ -1077,6 +1091,36 @@ public struct Proto_AccountID { public init() {} } +///* +/// Identifier for a unique token (or "NFT"), used by both contract and token services. +public struct Proto_NftID { + // 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 (non-fungible) token of which this NFT is an instance; uppercase for "ID" + /// for backward compatibility with original definition of this field. + public var tokenID: Proto_TokenID { + get {return _tokenID ?? Proto_TokenID()} + set {_tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return self._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {self._tokenID = nil} + + ///* + /// The serial number of this NFT within its token type + public var serialNumber: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _tokenID: Proto_TokenID? = nil +} + ///* /// The ID for a file public struct Proto_FileID { @@ -2761,6 +2805,7 @@ extension Proto_ShardID: @unchecked Sendable {} extension Proto_RealmID: @unchecked Sendable {} extension Proto_AccountID: @unchecked Sendable {} extension Proto_AccountID.OneOf_Account: @unchecked Sendable {} +extension Proto_NftID: @unchecked Sendable {} extension Proto_FileID: @unchecked Sendable {} extension Proto_ContractID: @unchecked Sendable {} extension Proto_ContractID.OneOf_Contract: @unchecked Sendable {} @@ -2931,6 +2976,8 @@ extension Proto_HederaFunctionality: SwiftProtobuf._ProtoNameProviding { 84: .same(proto: "EthereumTransaction"), 85: .same(proto: "NodeStakeUpdate"), 86: .same(proto: "UtilPrng"), + 87: .same(proto: "TransactionGetFastRecord"), + 88: .same(proto: "TokenUpdateNfts"), ] } @@ -3076,6 +3123,48 @@ extension Proto_AccountID: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen } } +extension Proto_NftID: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".NftID" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_ID"), + 2: .standard(proto: "serial_number"), + ] + + 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._tokenID) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.serialNumber) }() + 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._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.serialNumber != 0 { + try visitor.visitSingularInt64Field(value: self.serialNumber, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_NftID, rhs: Proto_NftID) -> Bool { + if lhs._tokenID != rhs._tokenID {return false} + if lhs.serialNumber != rhs.serialNumber {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + extension Proto_FileID: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".FileID" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift index 498f7c1f..de574c0d 100644 --- a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift @@ -215,7 +215,6 @@ public struct Proto_ContractFunctionResult { get {return _storage._signerNonce ?? SwiftProtobuf.Google_Protobuf_Int64Value()} set {_uniqueStorage()._signerNonce = newValue} } - /// Returns true if `signerNonce` has been explicitly set. public var hasSignerNonce: Bool {return _storage._signerNonce != nil} /// Clears the value of `signerNonce`. Subsequent reads from it will return its default value. diff --git a/Sources/HederaProtobufs/Services/freeze_type.pb.swift b/Sources/HederaProtobufs/Services/freeze_type.pb.swift index 21ec2f2b..f8a969bd 100644 --- a/Sources/HederaProtobufs/Services/freeze_type.pb.swift +++ b/Sources/HederaProtobufs/Services/freeze_type.pb.swift @@ -57,7 +57,7 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { /// Performs an immediate upgrade on auxilary services and containers providing /// telemetry/metrics. Does not impact network operations. case telemetryUpgrade // = 5 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .unknownFreezeType @@ -71,7 +71,7 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { case 3: self = .freezeUpgrade case 4: self = .freezeAbort case 5: self = .telemetryUpgrade - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -83,7 +83,7 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { case .freezeUpgrade: return 3 case .freezeAbort: return 4 case .telemetryUpgrade: return 5 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -92,7 +92,7 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_FreezeType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_FreezeType] = [ .unknownFreezeType, .freezeOnly, diff --git a/Sources/HederaProtobufs/Services/query_header.pb.swift b/Sources/HederaProtobufs/Services/query_header.pb.swift index 4763d7e9..ac926fa0 100644 --- a/Sources/HederaProtobufs/Services/query_header.pb.swift +++ b/Sources/HederaProtobufs/Services/query_header.pb.swift @@ -45,7 +45,7 @@ public enum Proto_ResponseType: SwiftProtobuf.Enum { ///* /// (NOT YET SUPPORTED) Response returns the total cost of answer and state proof case costAnswerStateProof // = 3 - case UNRECOGNIZED(Int) + case unrecognized(Int) public init() { self = .answerOnly @@ -57,7 +57,7 @@ public enum Proto_ResponseType: SwiftProtobuf.Enum { case 1: self = .answerStateProof case 2: self = .costAnswer case 3: self = .costAnswerStateProof - default: self = .UNRECOGNIZED(rawValue) + default: self = .unrecognized(rawValue) } } @@ -67,7 +67,7 @@ public enum Proto_ResponseType: SwiftProtobuf.Enum { case .answerStateProof: return 1 case .costAnswer: return 2 case .costAnswerStateProof: return 3 - case .UNRECOGNIZED(let i): return i + case .unrecognized(let i): return i } } @@ -76,7 +76,7 @@ public enum Proto_ResponseType: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_ResponseType: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_ResponseType] = [ .answerOnly, .answerStateProof, diff --git a/Sources/HederaProtobufs/Services/response_code.pb.swift b/Sources/HederaProtobufs/Services/response_code.pb.swift index e9d81692..8f14471a 100644 --- a/Sources/HederaProtobufs/Services/response_code.pb.swift +++ b/Sources/HederaProtobufs/Services/response_code.pb.swift @@ -1190,7 +1190,23 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// An alias that is assigned to an account or contract cannot be assigned to another account or contract. case aliasAlreadyAssigned // = 332 - case UNRECOGNIZED(Int) + + ///* + /// A provided metadata key was invalid. Verification includes, for example, checking the size of Ed25519 and ECDSA(secp256k1) public keys. + case invalidMetadataKey // = 333 + + ///* + /// Metadata key is not set on token + case tokenHasNoMetadataKey // = 334 + + ///* + /// Token Metadata is not provided + case missingTokenMetadata // = 335 + + ///* + /// NFT serial numbers are missing in the TokenUpdateNftsTransactionBody + case missingSerialNumbers // = 336 + case unrecognized(Int) public init() { self = .ok @@ -1489,7 +1505,11 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case 330: self = .transactionHasUnknownFields case 331: self = .accountIsImmutable case 332: self = .aliasAlreadyAssigned - default: self = .UNRECOGNIZED(rawValue) + case 333: self = .invalidMetadataKey + case 334: self = .tokenHasNoMetadataKey + case 335: self = .missingTokenMetadata + case 336: self = .missingSerialNumbers + default: self = .unrecognized(rawValue) } } @@ -1786,7 +1806,11 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case .transactionHasUnknownFields: return 330 case .accountIsImmutable: return 331 case .aliasAlreadyAssigned: return 332 - case .UNRECOGNIZED(let i): return i + case .invalidMetadataKey: return 333 + case .tokenHasNoMetadataKey: return 334 + case .missingTokenMetadata: return 335 + case .missingSerialNumbers: return 336 + case .unrecognized(let i): return i } } @@ -1795,7 +1819,7 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { #if swift(>=4.2) extension Proto_ResponseCodeEnum: CaseIterable { - // The compiler won't synthesize support with the UNRECOGNIZED case. + // The compiler won't synthesize support with the unrecognized case. public static let allCases: [Proto_ResponseCodeEnum] = [ .ok, .invalidTransaction, @@ -2088,6 +2112,10 @@ extension Proto_ResponseCodeEnum: CaseIterable { .transactionHasUnknownFields, .accountIsImmutable, .aliasAlreadyAssigned, + .invalidMetadataKey, + .tokenHasNoMetadataKey, + .missingTokenMetadata, + .missingSerialNumbers, ] } @@ -2392,5 +2420,9 @@ extension Proto_ResponseCodeEnum: SwiftProtobuf._ProtoNameProviding { 330: .same(proto: "TRANSACTION_HAS_UNKNOWN_FIELDS"), 331: .same(proto: "ACCOUNT_IS_IMMUTABLE"), 332: .same(proto: "ALIAS_ALREADY_ASSIGNED"), + 333: .same(proto: "INVALID_METADATA_KEY"), + 334: .same(proto: "TOKEN_HAS_NO_METADATA_KEY"), + 335: .same(proto: "MISSING_TOKEN_METADATA"), + 336: .same(proto: "MISSING_SERIAL_NUMBERS"), ] } diff --git a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift index ef97a640..a07a8069 100644 --- a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift @@ -432,6 +432,16 @@ public struct Proto_SchedulableTransactionBody { set {_uniqueStorage()._data = .utilPrng(newValue)} } + ///* + /// Update the metadata of one or more NFT's of a specific token type. + public var tokenUpdateNfts: Proto_TokenUpdateNftsTransactionBody { + get { + if case .tokenUpdateNfts(let v)? = _storage._data {return v} + return Proto_TokenUpdateNftsTransactionBody() + } + set {_uniqueStorage()._data = .tokenUpdateNfts(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* @@ -551,6 +561,9 @@ public struct Proto_SchedulableTransactionBody { ///* /// Generates a pseudorandom number. case utilPrng(Proto_UtilPrngTransactionBody) + ///* + /// Update the metadata of one or more NFT's of a specific token type. + case tokenUpdateNfts(Proto_TokenUpdateNftsTransactionBody) #if !swift(>=4.1) public static func ==(lhs: Proto_SchedulableTransactionBody.OneOf_Data, rhs: Proto_SchedulableTransactionBody.OneOf_Data) -> Bool { @@ -710,6 +723,10 @@ public struct Proto_SchedulableTransactionBody { guard case .utilPrng(let l) = lhs, case .utilPrng(let r) = rhs else { preconditionFailure() } return l == r }() + case (.tokenUpdateNfts, .tokenUpdateNfts): return { + guard case .tokenUpdateNfts(let l) = lhs, case .tokenUpdateNfts(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -773,6 +790,7 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf 36: .standard(proto: "token_unpause"), 34: .same(proto: "scheduleDelete"), 40: .standard(proto: "util_prng"), + 41: .standard(proto: "token_update_nfts"), ] fileprivate class _StorageClass { @@ -1302,6 +1320,19 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf _storage._data = .utilPrng(v) } }() + case 41: try { + var v: Proto_TokenUpdateNftsTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenUpdateNfts(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenUpdateNfts(v) + } + }() default: break } } @@ -1473,6 +1504,10 @@ extension Proto_SchedulableTransactionBody: SwiftProtobuf.Message, SwiftProtobuf guard case .utilPrng(let v)? = _storage._data else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 40) }() + case .tokenUpdateNfts?: try { + guard case .tokenUpdateNfts(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 41) + }() case nil: break } } diff --git a/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift b/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift new file mode 100644 index 00000000..42d5fa6c --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift @@ -0,0 +1,164 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/blockrecords/block_info.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 +} + +///* +/// Information about ongoing, most recently completed, and last 256 blocks. +public struct Proto_BlockInfo { + // 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 last block number, this is the last completed immutable block. + public var lastBlockNumber: Int64 = 0 + + ///* + /// The consensus time of the first transaction of the last block, this is the last completed immutable block. + public var firstConsTimeOfLastBlock: Proto_Timestamp { + get {return _firstConsTimeOfLastBlock ?? Proto_Timestamp()} + set {_firstConsTimeOfLastBlock = newValue} + } + /// Returns true if `firstConsTimeOfLastBlock` has been explicitly set. + public var hasFirstConsTimeOfLastBlock: Bool {return self._firstConsTimeOfLastBlock != nil} + /// Clears the value of `firstConsTimeOfLastBlock`. Subsequent reads from it will return its default value. + public mutating func clearFirstConsTimeOfLastBlock() {self._firstConsTimeOfLastBlock = nil} + + ///* + /// SHA384 48 byte hashes of the last 256 blocks in single byte array. + /// First 48 bytes is the oldest block. + /// Last 48 bytes is the newest block, which is the last fully completed immutable block. + /// If we are shortly after genesis and there are less than 256 blocks then this could contain less than 256 hashes. + public var blockHashes: Data = Data() + + ///* + /// The consensus time of the last transaction that was handled by the node. This property is how we 'advance the + /// consensus clock', i.e. continually setting this property to the latest consensus timestamp (and thus transaction) + /// handled by the node. + public var consTimeOfLastHandledTxn: Proto_Timestamp { + get {return _consTimeOfLastHandledTxn ?? Proto_Timestamp()} + set {_consTimeOfLastHandledTxn = newValue} + } + /// Returns true if `consTimeOfLastHandledTxn` has been explicitly set. + public var hasConsTimeOfLastHandledTxn: Bool {return self._consTimeOfLastHandledTxn != nil} + /// Clears the value of `consTimeOfLastHandledTxn`. Subsequent reads from it will return its default value. + public mutating func clearConsTimeOfLastHandledTxn() {self._consTimeOfLastHandledTxn = nil} + + ///* + /// A flag indicating whether migration records have been published. This property should be marked 'false' + /// immediately following a node upgrade, and marked 'true' once the migration records (if any) are published, which + /// should happen during the first transaction handled by the node. + public var migrationRecordsStreamed: Bool = false + + ///* + /// The consensus time of the first transaction in the current block; necessary for reconnecting nodes to detect + /// when the current block is finished. + public var firstConsTimeOfCurrentBlock: Proto_Timestamp { + get {return _firstConsTimeOfCurrentBlock ?? Proto_Timestamp()} + set {_firstConsTimeOfCurrentBlock = newValue} + } + /// Returns true if `firstConsTimeOfCurrentBlock` has been explicitly set. + public var hasFirstConsTimeOfCurrentBlock: Bool {return self._firstConsTimeOfCurrentBlock != nil} + /// Clears the value of `firstConsTimeOfCurrentBlock`. Subsequent reads from it will return its default value. + public mutating func clearFirstConsTimeOfCurrentBlock() {self._firstConsTimeOfCurrentBlock = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _firstConsTimeOfLastBlock: Proto_Timestamp? = nil + fileprivate var _consTimeOfLastHandledTxn: Proto_Timestamp? = nil + fileprivate var _firstConsTimeOfCurrentBlock: Proto_Timestamp? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_BlockInfo: @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_BlockInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".BlockInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "last_block_number"), + 2: .standard(proto: "first_cons_time_of_last_block"), + 3: .standard(proto: "block_hashes"), + 4: .standard(proto: "cons_time_of_last_handled_txn"), + 5: .standard(proto: "migration_records_streamed"), + 6: .standard(proto: "first_cons_time_of_current_block"), + ] + + 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.decodeSingularInt64Field(value: &self.lastBlockNumber) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._firstConsTimeOfLastBlock) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.blockHashes) }() + case 4: try { try decoder.decodeSingularMessageField(value: &self._consTimeOfLastHandledTxn) }() + case 5: try { try decoder.decodeSingularBoolField(value: &self.migrationRecordsStreamed) }() + case 6: try { try decoder.decodeSingularMessageField(value: &self._firstConsTimeOfCurrentBlock) }() + 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 + if self.lastBlockNumber != 0 { + try visitor.visitSingularInt64Field(value: self.lastBlockNumber, fieldNumber: 1) + } + try { if let v = self._firstConsTimeOfLastBlock { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if !self.blockHashes.isEmpty { + try visitor.visitSingularBytesField(value: self.blockHashes, fieldNumber: 3) + } + try { if let v = self._consTimeOfLastHandledTxn { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + if self.migrationRecordsStreamed != false { + try visitor.visitSingularBoolField(value: self.migrationRecordsStreamed, fieldNumber: 5) + } + try { if let v = self._firstConsTimeOfCurrentBlock { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_BlockInfo, rhs: Proto_BlockInfo) -> Bool { + if lhs.lastBlockNumber != rhs.lastBlockNumber {return false} + if lhs._firstConsTimeOfLastBlock != rhs._firstConsTimeOfLastBlock {return false} + if lhs.blockHashes != rhs.blockHashes {return false} + if lhs._consTimeOfLastHandledTxn != rhs._consTimeOfLastHandledTxn {return false} + if lhs.migrationRecordsStreamed != rhs.migrationRecordsStreamed {return false} + if lhs._firstConsTimeOfCurrentBlock != rhs._firstConsTimeOfCurrentBlock {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift b/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift new file mode 100644 index 00000000..85691d67 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift @@ -0,0 +1,108 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/blockrecords/running_hashes.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 +} + +///* +/// The running hash of a transaction records and the previous 3 running hashes. All hashes are 48 bytes SHA384 hashes. If the +/// running hashes do not exist yet then they will be default values witch is empty bytes object or zero length byte array. +public struct Proto_RunningHashes { + // 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 running hash of all record stream items + public var runningHash: Data = Data() + + ///* + /// The previous running hash of all record stream items + public var nMinus1RunningHash: Data = Data() + + ///* + /// The previous, previous running hash of all record stream items + public var nMinus2RunningHash: Data = Data() + + ///* + /// The previous, previous, previous running hash of all record stream items + public var nMinus3RunningHash: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_RunningHashes: @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_RunningHashes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".RunningHashes" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "running_hash"), + 2: .standard(proto: "n_minus_1_running_hash"), + 3: .standard(proto: "n_minus_2_running_hash"), + 4: .standard(proto: "n_minus_3_running_hash"), + ] + + 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.decodeSingularBytesField(value: &self.runningHash) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.nMinus1RunningHash) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.nMinus2RunningHash) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self.nMinus3RunningHash) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.runningHash.isEmpty { + try visitor.visitSingularBytesField(value: self.runningHash, fieldNumber: 1) + } + if !self.nMinus1RunningHash.isEmpty { + try visitor.visitSingularBytesField(value: self.nMinus1RunningHash, fieldNumber: 2) + } + if !self.nMinus2RunningHash.isEmpty { + try visitor.visitSingularBytesField(value: self.nMinus2RunningHash, fieldNumber: 3) + } + if !self.nMinus3RunningHash.isEmpty { + try visitor.visitSingularBytesField(value: self.nMinus3RunningHash, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_RunningHashes, rhs: Proto_RunningHashes) -> Bool { + if lhs.runningHash != rhs.runningHash {return false} + if lhs.nMinus1RunningHash != rhs.nMinus1RunningHash {return false} + if lhs.nMinus2RunningHash != rhs.nMinus2RunningHash {return false} + if lhs.nMinus3RunningHash != rhs.nMinus3RunningHash {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_common.pb.swift b/Sources/HederaProtobufs/Services/state_common.pb.swift new file mode 100644 index 00000000..5bc1df59 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_common.pb.swift @@ -0,0 +1,151 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/common.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 single 64-bit number identifying a Hedera native entity. +public struct Proto_EntityNumber { + // 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. + + public var number: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// Pair of AccountID and TokenID to represent TokenRelation +public struct Proto_EntityIDPair { + // 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. + + public var accountID: Proto_AccountID { + get {return _accountID ?? Proto_AccountID()} + set {_accountID = newValue} + } + /// Returns true if `accountID` has been explicitly set. + public var hasAccountID: Bool {return self._accountID != nil} + /// Clears the value of `accountID`. Subsequent reads from it will return its default value. + public mutating func clearAccountID() {self._accountID = nil} + + public var tokenID: Proto_TokenID { + get {return _tokenID ?? Proto_TokenID()} + set {_tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return self._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {self._tokenID = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _accountID: Proto_AccountID? = nil + fileprivate var _tokenID: Proto_TokenID? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_EntityNumber: @unchecked Sendable {} +extension Proto_EntityIDPair: @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_EntityNumber: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EntityNumber" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "number"), + ] + + 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.decodeSingularInt64Field(value: &self.number) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.number != 0 { + try visitor.visitSingularInt64Field(value: self.number, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_EntityNumber, rhs: Proto_EntityNumber) -> Bool { + if lhs.number != rhs.number {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_EntityIDPair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".EntityIDPair" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "account_id"), + 2: .standard(proto: "token_id"), + ] + + 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._accountID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._tokenID) }() + 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._accountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_EntityIDPair, rhs: Proto_EntityIDPair) -> Bool { + if lhs._accountID != rhs._accountID {return false} + if lhs._tokenID != rhs._tokenID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift b/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift new file mode 100644 index 00000000..8c8efc37 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift @@ -0,0 +1,85 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/congestion/congestion_level_starts.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 +} + +public struct Proto_CongestionLevelStarts { + // 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. + + ///* + /// Timestamps defining generic congestion levels. + public var genericLevelStarts: [Proto_Timestamp] = [] + + ///* + /// Timestamps defining gas congestion levels. + public var gasLevelStarts: [Proto_Timestamp] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_CongestionLevelStarts: @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_CongestionLevelStarts: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".CongestionLevelStarts" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "generic_level_starts"), + 2: .standard(proto: "gas_level_starts"), + ] + + 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.genericLevelStarts) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.gasLevelStarts) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.genericLevelStarts.isEmpty { + try visitor.visitRepeatedMessageField(value: self.genericLevelStarts, fieldNumber: 1) + } + if !self.gasLevelStarts.isEmpty { + try visitor.visitRepeatedMessageField(value: self.gasLevelStarts, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_CongestionLevelStarts, rhs: Proto_CongestionLevelStarts) -> Bool { + if lhs.genericLevelStarts != rhs.genericLevelStarts {return false} + if lhs.gasLevelStarts != rhs.gasLevelStarts {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift index cb3c48fe..d70ce59d 100644 --- a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift @@ -21,7 +21,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// First-draft representation of a Hedera Consensus Service topic in the network Merkle tree. +/// 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 /// with the network's shard and realm in the form of a shard.realm.number id. @@ -46,30 +46,56 @@ public struct Proto_Topic { // methods supported on all messages. ///* - /// The topic's unique entity number in the Merkle state. - public var topicNumber: Int64 = 0 + /// The topic's unique id in the Merkle state. + public var topicID: Proto_TopicID { + get {return _storage._topicID ?? Proto_TopicID()} + set {_uniqueStorage()._topicID = newValue} + } + /// Returns true if `topicID` has been explicitly set. + public var hasTopicID: Bool {return _storage._topicID != nil} + /// Clears the value of `topicID`. Subsequent reads from it will return its default value. + public mutating func clearTopicID() {_uniqueStorage()._topicID = nil} ///* /// The number of messages sent to the topic. - public var sequenceNumber: Int64 = 0 + public var sequenceNumber: Int64 { + get {return _storage._sequenceNumber} + set {_uniqueStorage()._sequenceNumber = newValue} + } ///* /// The topic's consensus expiration time in seconds since the epoch. - public var expiry: Int64 = 0 + public var expirationSecond: Int64 { + get {return _storage._expirationSecond} + set {_uniqueStorage()._expirationSecond = newValue} + } ///* /// 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 = 0 + public var autoRenewPeriod: Int64 { + get {return _storage._autoRenewPeriod} + set {_uniqueStorage()._autoRenewPeriod = newValue} + } ///* - /// The number of the account (if any) that the network will attempt to charge for the + /// The id of the account (if any) that the network will attempt to charge for the /// topic's auto-renewal upon expiration. - public var autoRenewAccountNumber: Int64 = 0 + public var autoRenewAccountID: Proto_AccountID { + get {return _storage._autoRenewAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._autoRenewAccountID = newValue} + } + /// Returns true if `autoRenewAccountID` has been explicitly set. + public var hasAutoRenewAccountID: Bool {return _storage._autoRenewAccountID != nil} + /// Clears the value of `autoRenewAccountID`. Subsequent reads from it will return its default value. + public mutating func clearAutoRenewAccountID() {_uniqueStorage()._autoRenewAccountID = nil} ///* /// Whether this topic is deleted. - public var deleted: Bool = false + public var deleted: Bool { + get {return _storage._deleted} + set {_uniqueStorage()._deleted = newValue} + } ///* /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. @@ -78,41 +104,46 @@ public struct Proto_Topic { /// /// 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() + public var runningHash: Data { + get {return _storage._runningHash} + set {_uniqueStorage()._runningHash = newValue} + } ///* /// An optional description of the topic with UTF-8 encoding up to 100 bytes. - public var memo: String = String() + public var memo: String { + get {return _storage._memo} + set {_uniqueStorage()._memo = newValue} + } ///* /// If present, enforces access control for updating or deleting the topic. /// A topic without an admin key is immutable. public var adminKey: Proto_Key { - get {return _adminKey ?? Proto_Key()} - set {_adminKey = newValue} + get {return _storage._adminKey ?? Proto_Key()} + set {_uniqueStorage()._adminKey = newValue} } /// Returns true if `adminKey` has been explicitly set. - public var hasAdminKey: Bool {return self._adminKey != nil} + public var hasAdminKey: Bool {return _storage._adminKey != nil} /// Clears the value of `adminKey`. Subsequent reads from it will return its default value. - public mutating func clearAdminKey() {self._adminKey = nil} + public mutating func clearAdminKey() {_uniqueStorage()._adminKey = nil} ///* /// If present, enforces access control for message submission to the topic. public var submitKey: Proto_Key { - get {return _submitKey ?? Proto_Key()} - set {_submitKey = newValue} + get {return _storage._submitKey ?? Proto_Key()} + set {_uniqueStorage()._submitKey = newValue} } /// Returns true if `submitKey` has been explicitly set. - public var hasSubmitKey: Bool {return self._submitKey != nil} + public var hasSubmitKey: Bool {return _storage._submitKey != nil} /// Clears the value of `submitKey`. Subsequent reads from it will return its default value. - public mutating func clearSubmitKey() {self._submitKey = nil} + public mutating func clearSubmitKey() {_uniqueStorage()._submitKey = nil} public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} - fileprivate var _adminKey: Proto_Key? = nil - fileprivate var _submitKey: Proto_Key? = nil + fileprivate var _storage = _StorageClass.defaultInstance } #if swift(>=5.5) && canImport(_Concurrency) @@ -126,11 +157,11 @@ fileprivate let _protobuf_package = "proto" extension Proto_Topic: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".Topic" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .standard(proto: "topic_number"), + 1: .standard(proto: "topic_id"), 2: .standard(proto: "sequence_number"), - 3: .same(proto: "expiry"), + 3: .standard(proto: "expiration_second"), 4: .standard(proto: "auto_renew_period"), - 5: .standard(proto: "auto_renew_account_number"), + 5: .standard(proto: "auto_renew_account_id"), 6: .same(proto: "deleted"), 7: .standard(proto: "running_hash"), 8: .same(proto: "memo"), @@ -138,76 +169,126 @@ extension Proto_Topic: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementati 10: .standard(proto: "submit_key"), ] + fileprivate class _StorageClass { + var _topicID: Proto_TopicID? = nil + var _sequenceNumber: Int64 = 0 + var _expirationSecond: Int64 = 0 + var _autoRenewPeriod: Int64 = 0 + var _autoRenewAccountID: Proto_AccountID? = nil + var _deleted: Bool = false + var _runningHash: Data = Data() + var _memo: String = String() + var _adminKey: Proto_Key? = nil + var _submitKey: Proto_Key? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _topicID = source._topicID + _sequenceNumber = source._sequenceNumber + _expirationSecond = source._expirationSecond + _autoRenewPeriod = source._autoRenewPeriod + _autoRenewAccountID = source._autoRenewAccountID + _deleted = source._deleted + _runningHash = source._runningHash + _memo = source._memo + _adminKey = source._adminKey + _submitKey = source._submitKey + } + } + + fileprivate mutating func _uniqueStorage() -> _StorageClass { + if !isKnownUniquelyReferenced(&_storage) { + _storage = _StorageClass(copying: _storage) + } + return _storage + } + 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.decodeSingularInt64Field(value: &self.topicNumber) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.sequenceNumber) }() - case 3: try { try decoder.decodeSingularInt64Field(value: &self.expiry) }() - case 4: try { try decoder.decodeSingularInt64Field(value: &self.autoRenewPeriod) }() - case 5: try { try decoder.decodeSingularInt64Field(value: &self.autoRenewAccountNumber) }() - case 6: try { try decoder.decodeSingularBoolField(value: &self.deleted) }() - case 7: try { try decoder.decodeSingularBytesField(value: &self.runningHash) }() - case 8: try { try decoder.decodeSingularStringField(value: &self.memo) }() - case 9: try { try decoder.decodeSingularMessageField(value: &self._adminKey) }() - case 10: try { try decoder.decodeSingularMessageField(value: &self._submitKey) }() - default: break + _ = _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._topicID) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &_storage._sequenceNumber) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &_storage._expirationSecond) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &_storage._autoRenewPeriod) }() + case 5: try { try decoder.decodeSingularMessageField(value: &_storage._autoRenewAccountID) }() + case 6: try { try decoder.decodeSingularBoolField(value: &_storage._deleted) }() + case 7: try { try decoder.decodeSingularBytesField(value: &_storage._runningHash) }() + case 8: try { try decoder.decodeSingularStringField(value: &_storage._memo) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._adminKey) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._submitKey) }() + 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 - if self.topicNumber != 0 { - try visitor.visitSingularInt64Field(value: self.topicNumber, fieldNumber: 1) - } - if self.sequenceNumber != 0 { - try visitor.visitSingularInt64Field(value: self.sequenceNumber, fieldNumber: 2) - } - if self.expiry != 0 { - try visitor.visitSingularInt64Field(value: self.expiry, fieldNumber: 3) - } - if self.autoRenewPeriod != 0 { - try visitor.visitSingularInt64Field(value: self.autoRenewPeriod, fieldNumber: 4) - } - if self.autoRenewAccountNumber != 0 { - try visitor.visitSingularInt64Field(value: self.autoRenewAccountNumber, fieldNumber: 5) - } - if self.deleted != false { - try visitor.visitSingularBoolField(value: self.deleted, fieldNumber: 6) - } - if !self.runningHash.isEmpty { - try visitor.visitSingularBytesField(value: self.runningHash, fieldNumber: 7) - } - if !self.memo.isEmpty { - try visitor.visitSingularStringField(value: self.memo, fieldNumber: 8) + 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._topicID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if _storage._sequenceNumber != 0 { + try visitor.visitSingularInt64Field(value: _storage._sequenceNumber, fieldNumber: 2) + } + if _storage._expirationSecond != 0 { + try visitor.visitSingularInt64Field(value: _storage._expirationSecond, fieldNumber: 3) + } + if _storage._autoRenewPeriod != 0 { + try visitor.visitSingularInt64Field(value: _storage._autoRenewPeriod, fieldNumber: 4) + } + try { if let v = _storage._autoRenewAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 5) + } }() + if _storage._deleted != false { + try visitor.visitSingularBoolField(value: _storage._deleted, fieldNumber: 6) + } + if !_storage._runningHash.isEmpty { + try visitor.visitSingularBytesField(value: _storage._runningHash, fieldNumber: 7) + } + if !_storage._memo.isEmpty { + try visitor.visitSingularStringField(value: _storage._memo, fieldNumber: 8) + } + try { if let v = _storage._adminKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._submitKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() } - try { if let v = self._adminKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 9) - } }() - try { if let v = self._submitKey { - try visitor.visitSingularMessageField(value: v, fieldNumber: 10) - } }() try unknownFields.traverse(visitor: &visitor) } public static func ==(lhs: Proto_Topic, rhs: Proto_Topic) -> Bool { - if lhs.topicNumber != rhs.topicNumber {return false} - if lhs.sequenceNumber != rhs.sequenceNumber {return false} - if lhs.expiry != rhs.expiry {return false} - if lhs.autoRenewPeriod != rhs.autoRenewPeriod {return false} - if lhs.autoRenewAccountNumber != rhs.autoRenewAccountNumber {return false} - if lhs.deleted != rhs.deleted {return false} - if lhs.runningHash != rhs.runningHash {return false} - if lhs.memo != rhs.memo {return false} - if lhs._adminKey != rhs._adminKey {return false} - if lhs._submitKey != rhs._submitKey {return false} + 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._topicID != rhs_storage._topicID {return false} + if _storage._sequenceNumber != rhs_storage._sequenceNumber {return false} + if _storage._expirationSecond != rhs_storage._expirationSecond {return false} + if _storage._autoRenewPeriod != rhs_storage._autoRenewPeriod {return false} + if _storage._autoRenewAccountID != rhs_storage._autoRenewAccountID {return false} + if _storage._deleted != rhs_storage._deleted {return false} + if _storage._runningHash != rhs_storage._runningHash {return false} + if _storage._memo != rhs_storage._memo {return false} + if _storage._adminKey != rhs_storage._adminKey {return false} + if _storage._submitKey != rhs_storage._submitKey {return false} + return true + } + if !storagesAreEqual {return false} + } if lhs.unknownFields != rhs.unknownFields {return false} return true } diff --git a/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift b/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift new file mode 100644 index 00000000..33e4f2b3 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift @@ -0,0 +1,77 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/contract/bytecode.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 +} + +///* +/// The bytecode for a contract id. +public struct Proto_Bytecode { + // 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 raw bytes (not hex-encoded) of a contract's bytecode. + public var code: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_Bytecode: @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_Bytecode: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Bytecode" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "code"), + ] + + 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.decodeSingularBytesField(value: &self.code) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.code.isEmpty { + try visitor.visitSingularBytesField(value: self.code, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_Bytecode, rhs: Proto_Bytecode) -> Bool { + if lhs.code != rhs.code {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift new file mode 100644 index 00000000..c05916da --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift @@ -0,0 +1,175 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/contract/storage_slot.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 +} + +///* +/// 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. +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 + // methods supported on all messages. + + ///* + /// The number of the contract whose storage this slot belongs to. + public var contractID: Proto_ContractID { + get {return _contractID ?? Proto_ContractID()} + set {_contractID = newValue} + } + /// Returns true if `contractID` has been explicitly set. + public var hasContractID: Bool {return self._contractID != nil} + /// Clears the value of `contractID`. Subsequent reads from it will return its default value. + public mutating func clearContractID() {self._contractID = nil} + + ///* + /// The EVM key of this slot, when left-padded with zeros to form a 256-bit word. + public var key: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _contractID: Proto_ContractID? = nil +} + +///* +/// 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". +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 + // methods supported on all messages. + + ///* + /// The EVM value in this slot, when left-padded with zeros to form a 256-bit word. + public var value: Data = Data() + + ///* + /// The word of the previous key in this contract's storage list (if any). + public var previousKey: Data = Data() + + ///* + /// The word of the next key in this contract's storage list (if any). + public var nextKey: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_SlotKey: @unchecked Sendable {} +extension Proto_SlotValue: @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_SlotKey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SlotKey" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "contractID"), + 2: .same(proto: "key"), + ] + + 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._contractID) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.key) }() + 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._contractID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.key.isEmpty { + try visitor.visitSingularBytesField(value: self.key, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_SlotKey, rhs: Proto_SlotKey) -> Bool { + if lhs._contractID != rhs._contractID {return false} + if lhs.key != rhs.key {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_SlotValue: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".SlotValue" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "value"), + 2: .standard(proto: "previous_key"), + 3: .standard(proto: "next_key"), + ] + + 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.decodeSingularBytesField(value: &self.value) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.previousKey) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.nextKey) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.value.isEmpty { + try visitor.visitSingularBytesField(value: self.value, fieldNumber: 1) + } + if !self.previousKey.isEmpty { + try visitor.visitSingularBytesField(value: self.previousKey, fieldNumber: 2) + } + if !self.nextKey.isEmpty { + try visitor.visitSingularBytesField(value: self.nextKey, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_SlotValue, rhs: Proto_SlotValue) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.previousKey != rhs.previousKey {return false} + if lhs.nextKey != rhs.nextKey {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_file_file.pb.swift b/Sources/HederaProtobufs/Services/state_file_file.pb.swift new file mode 100644 index 00000000..f6c99df2 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_file_file.pb.swift @@ -0,0 +1,161 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/file/file.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 +} + +///* +/// Representation of a Hedera Token Service file in the network Merkle tree. +/// +/// As with all network entities, a file has a unique entity number, which is given along +/// with the network's shard and realm in the form of a shard.realm.number id. +public struct Proto_File { + // 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 file's unique file identifier in the Merkle state. + public var fileID: Proto_FileID { + get {return _fileID ?? Proto_FileID()} + set {_fileID = newValue} + } + /// Returns true if `fileID` has been explicitly set. + public var hasFileID: Bool {return self._fileID != nil} + /// Clears the value of `fileID`. Subsequent reads from it will return its default value. + public mutating func clearFileID() {self._fileID = nil} + + ///* + /// The file's consensus expiration time in seconds since the epoch. + public var expirationSecond: Int64 = 0 + + ///* + /// All keys at the top level of a key list must sign to create, modify and delete the file. + public var keys: Proto_KeyList { + get {return _keys ?? Proto_KeyList()} + set {_keys = newValue} + } + /// Returns true if `keys` has been explicitly set. + public var hasKeys: Bool {return self._keys != nil} + /// Clears the value of `keys`. Subsequent reads from it will return its default value. + public mutating func clearKeys() {self._keys = nil} + + ///* + /// The bytes that are the contents of the file + public var contents: Data = Data() + + ///* + /// The memo associated with the file (UTF-8 encoding max 100 bytes) + public var memo: String = String() + + ///* + /// Whether this file is deleted. + public var deleted: Bool = false + + ///* + /// The pre system delete expiration time in seconds + public var preSystemDeleteExpirationSecond: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _fileID: Proto_FileID? = nil + fileprivate var _keys: Proto_KeyList? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_File: @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_File: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".File" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "file_id"), + 2: .standard(proto: "expiration_second"), + 3: .same(proto: "keys"), + 4: .same(proto: "contents"), + 5: .same(proto: "memo"), + 6: .same(proto: "deleted"), + 7: .standard(proto: "pre_system_delete_expiration_second"), + ] + + 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._fileID) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.expirationSecond) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._keys) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self.contents) }() + case 5: try { try decoder.decodeSingularStringField(value: &self.memo) }() + case 6: try { try decoder.decodeSingularBoolField(value: &self.deleted) }() + case 7: try { try decoder.decodeSingularInt64Field(value: &self.preSystemDeleteExpirationSecond) }() + 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._fileID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.expirationSecond != 0 { + try visitor.visitSingularInt64Field(value: self.expirationSecond, fieldNumber: 2) + } + try { if let v = self._keys { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if !self.contents.isEmpty { + try visitor.visitSingularBytesField(value: self.contents, fieldNumber: 4) + } + if !self.memo.isEmpty { + try visitor.visitSingularStringField(value: self.memo, fieldNumber: 5) + } + if self.deleted != false { + try visitor.visitSingularBoolField(value: self.deleted, fieldNumber: 6) + } + if self.preSystemDeleteExpirationSecond != 0 { + try visitor.visitSingularInt64Field(value: self.preSystemDeleteExpirationSecond, fieldNumber: 7) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_File, rhs: Proto_File) -> Bool { + if lhs._fileID != rhs._fileID {return false} + if lhs.expirationSecond != rhs.expirationSecond {return false} + if lhs._keys != rhs._keys {return false} + if lhs.contents != rhs.contents {return false} + if lhs.memo != rhs.memo {return false} + if lhs.deleted != rhs.deleted {return false} + if lhs.preSystemDeleteExpirationSecond != rhs.preSystemDeleteExpirationSecond {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_primitives.pb.swift b/Sources/HederaProtobufs/Services/state_primitives.pb.swift new file mode 100644 index 00000000..cd474d2a --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_primitives.pb.swift @@ -0,0 +1,263 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/primitives.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 single 64-bit number with no particular meaning. +public struct Proto_ProtoLong { + // 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. + + public var value: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A single 32-bit number with no particular meaning. +public struct Proto_ProtoInteger { + // 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. + + public var value: Int32 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A single boolean with no particular meaning. +public struct Proto_ProtoBoolean { + // 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. + + public var value: Bool = false + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A single string with no particular meaning. +public struct Proto_ProtoString { + // 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. + + public var value: String = String() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A single byte array with no particular meaning. +public struct Proto_ProtoBytes { + // 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. + + public var value: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_ProtoLong: @unchecked Sendable {} +extension Proto_ProtoInteger: @unchecked Sendable {} +extension Proto_ProtoBoolean: @unchecked Sendable {} +extension Proto_ProtoString: @unchecked Sendable {} +extension Proto_ProtoBytes: @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_ProtoLong: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ProtoLong" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "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.decodeSingularInt64Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularInt64Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ProtoLong, rhs: Proto_ProtoLong) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ProtoInteger: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ProtoInteger" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "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.decodeSingularInt32Field(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != 0 { + try visitor.visitSingularInt32Field(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ProtoInteger, rhs: Proto_ProtoInteger) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ProtoBoolean: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ProtoBoolean" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "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.decodeSingularBoolField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.value != false { + try visitor.visitSingularBoolField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ProtoBoolean, rhs: Proto_ProtoBoolean) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ProtoString: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ProtoString" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "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.decodeSingularStringField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.value.isEmpty { + try visitor.visitSingularStringField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ProtoString, rhs: Proto_ProtoString) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ProtoBytes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ProtoBytes" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "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.decodeSingularBytesField(value: &self.value) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.value.isEmpty { + try visitor.visitSingularBytesField(value: self.value, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ProtoBytes, rhs: Proto_ProtoBytes) -> Bool { + if lhs.value != rhs.value {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift b/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift new file mode 100644 index 00000000..1e1a2848 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift @@ -0,0 +1,123 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/recordcache/recordcache.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 +} + +///* +/// As transactions are handled and records and receipts are created, they are stored in state for a configured time +/// limit (perhaps, for example, 3 minutes). During this time window, any client can query the node and get the record +/// or receipt for the transaction. The TransactionRecordEntry is the object stored in state with this information. +public struct Proto_TransactionRecordEntry { + // 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 ID of the node that submitted the transaction to consensus. The ID is the ID of the node as known by the + /// address book. Valid node IDs are in the range 0..2^63-1, inclusive. + public var nodeID: Int64 = 0 + + ///* + /// The AccountID of the payer of the transaction. This may be the same as the account ID within the Transaction ID + /// of the record, or it may be the account ID of the node that submitted the transaction to consensus if the account + /// ID in the Transaction ID is not able to pay. + public var payerAccountID: Proto_AccountID { + get {return _payerAccountID ?? Proto_AccountID()} + set {_payerAccountID = newValue} + } + /// Returns true if `payerAccountID` has been explicitly set. + public var hasPayerAccountID: Bool {return self._payerAccountID != nil} + /// Clears the value of `payerAccountID`. Subsequent reads from it will return its default value. + public mutating func clearPayerAccountID() {self._payerAccountID = nil} + + ///* + /// The transaction record for the transaction. + public var transactionRecord: Proto_TransactionRecord { + get {return _transactionRecord ?? Proto_TransactionRecord()} + set {_transactionRecord = newValue} + } + /// Returns true if `transactionRecord` has been explicitly set. + public var hasTransactionRecord: Bool {return self._transactionRecord != nil} + /// Clears the value of `transactionRecord`. Subsequent reads from it will return its default value. + public mutating func clearTransactionRecord() {self._transactionRecord = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _payerAccountID: Proto_AccountID? = nil + fileprivate var _transactionRecord: Proto_TransactionRecord? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TransactionRecordEntry: @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_TransactionRecordEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TransactionRecordEntry" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_id"), + 2: .standard(proto: "payer_account_id"), + 3: .standard(proto: "transaction_record"), + ] + + 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.decodeSingularInt64Field(value: &self.nodeID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._payerAccountID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._transactionRecord) }() + 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 + if self.nodeID != 0 { + try visitor.visitSingularInt64Field(value: self.nodeID, fieldNumber: 1) + } + try { if let v = self._payerAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = self._transactionRecord { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TransactionRecordEntry, rhs: Proto_TransactionRecordEntry) -> Bool { + if lhs.nodeID != rhs.nodeID {return false} + if lhs._payerAccountID != rhs._payerAccountID {return false} + if lhs._transactionRecord != rhs._transactionRecord {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_schedule_schedule.pb.swift b/Sources/HederaProtobufs/Services/state_schedule_schedule.pb.swift new file mode 100644 index 00000000..e1266398 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_schedule_schedule.pb.swift @@ -0,0 +1,435 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/schedule/schedule.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 +} + +///* +/// Representation of a Hedera Schedule entry in the network Merkle tree. +/// +/// As with all network entities, a schedule 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. +public struct Proto_Schedule { + // 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. + + ///* + /// This schedule's unique ID within the global network state. + public var scheduleID: Proto_ScheduleID { + get {return _storage._scheduleID ?? Proto_ScheduleID()} + set {_uniqueStorage()._scheduleID = newValue} + } + /// Returns true if `scheduleID` has been explicitly set. + public var hasScheduleID: Bool {return _storage._scheduleID != nil} + /// Clears the value of `scheduleID`. Subsequent reads from it will return its default value. + public mutating func clearScheduleID() {_uniqueStorage()._scheduleID = nil} + + ///* + /// The schedule deleted flag + /// A schedule will either be executed or deleted, but never both. + public var deleted: Bool { + get {return _storage._deleted} + set {_uniqueStorage()._deleted = newValue} + } + + ///* + /// The schedule executed flag + /// A schedule will either be executed or deleted, but never both. + public var executed: Bool { + get {return _storage._executed} + set {_uniqueStorage()._executed = newValue} + } + + ///* + /// The schedule flag to wait for expiration + /// A schedule will be executed immediately when all necessary signatures are gathered, unless + /// this flag is set. If this flag is set, the schedule will wait until the consensus time + /// reaches expiration_time_provided, when signatures will again be verified, and if all + /// required signatures are present at that time, the schedule will be executed. Otherwise + /// the schedule will expire without execution. + /// Note that a schedule is always removed from state when it expires, regardless of whether it + /// was executed or not. + public var waitForExpiry: Bool { + get {return _storage._waitForExpiry} + set {_uniqueStorage()._waitForExpiry = newValue} + } + + ///* + /// The memo associated with this schedule. + public var memo: String { + get {return _storage._memo} + set {_uniqueStorage()._memo = newValue} + } + + ///* + /// The schedule account for this schedule. This is the account that submitted the original + /// ScheduleCreate transaction. + public var schedulerAccountID: Proto_AccountID { + get {return _storage._schedulerAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._schedulerAccountID = newValue} + } + /// Returns true if `schedulerAccountID` has been explicitly set. + public var hasSchedulerAccountID: Bool {return _storage._schedulerAccountID != nil} + /// Clears the value of `schedulerAccountID`. Subsequent reads from it will return its default value. + public mutating func clearSchedulerAccountID() {_uniqueStorage()._schedulerAccountID = nil} + + ///* + /// The explicit payer account for the scheduled transaction. + /// This account is added to the accounts that must sign the schedule before it will execute. + public var payerAccountID: Proto_AccountID { + get {return _storage._payerAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._payerAccountID = newValue} + } + /// Returns true if `payerAccountID` has been explicitly set. + public var hasPayerAccountID: Bool {return _storage._payerAccountID != nil} + /// Clears the value of `payerAccountID`. Subsequent reads from it will return its default value. + public mutating func clearPayerAccountID() {_uniqueStorage()._payerAccountID = nil} + + ///* + /// The admin key for this schedule. + /// If this is not set, then the schedule cannot be deleted. + public var adminKey: Proto_Key { + get {return _storage._adminKey ?? Proto_Key()} + set {_uniqueStorage()._adminKey = newValue} + } + /// Returns true if `adminKey` has been explicitly set. + public var hasAdminKey: Bool {return _storage._adminKey != nil} + /// Clears the value of `adminKey`. Subsequent reads from it will return its default value. + public mutating func clearAdminKey() {_uniqueStorage()._adminKey = nil} + + ///* + /// The transaction valid start value from the transaction that created this schedule. + public var scheduleValidStart: Proto_Timestamp { + get {return _storage._scheduleValidStart ?? Proto_Timestamp()} + set {_uniqueStorage()._scheduleValidStart = newValue} + } + /// Returns true if `scheduleValidStart` has been explicitly set. + public var hasScheduleValidStart: Bool {return _storage._scheduleValidStart != nil} + /// Clears the value of `scheduleValidStart`. Subsequent reads from it will return its default value. + public mutating func clearScheduleValidStart() {_uniqueStorage()._scheduleValidStart = nil} + + ///* + /// The requested expiration time of the schedule as provided by the user. + /// The actual calculated expiration time may be "earlier" than this, but will not be later. + public var providedExpirationSecond: Int64 { + get {return _storage._providedExpirationSecond} + set {_uniqueStorage()._providedExpirationSecond = newValue} + } + + ///* + /// The calculated expiration time of the schedule. This is calculated based on the requested + /// expiration time from the create transaction, and the maximum expiration permitted by the + /// network. + /// The schedule will be removed from global network state after the network reaches a consensus + /// time greater than or equal to this value. + public var calculatedExpirationSecond: Int64 { + get {return _storage._calculatedExpirationSecond} + set {_uniqueStorage()._calculatedExpirationSecond = newValue} + } + + ///* + /// The consensus timestamp of the transaction that executed or deleted this schedule. + public var resolutionTime: Proto_Timestamp { + get {return _storage._resolutionTime ?? Proto_Timestamp()} + set {_uniqueStorage()._resolutionTime = newValue} + } + /// Returns true if `resolutionTime` has been explicitly set. + public var hasResolutionTime: Bool {return _storage._resolutionTime != nil} + /// Clears the value of `resolutionTime`. Subsequent reads from it will return its default value. + public mutating func clearResolutionTime() {_uniqueStorage()._resolutionTime = nil} + + ///* + /// The scheduled transaction to execute. + public var scheduledTransaction: Proto_SchedulableTransactionBody { + get {return _storage._scheduledTransaction ?? Proto_SchedulableTransactionBody()} + set {_uniqueStorage()._scheduledTransaction = newValue} + } + /// Returns true if `scheduledTransaction` has been explicitly set. + public var hasScheduledTransaction: Bool {return _storage._scheduledTransaction != nil} + /// Clears the value of `scheduledTransaction`. Subsequent reads from it will return its default value. + public mutating func clearScheduledTransaction() {_uniqueStorage()._scheduledTransaction = nil} + + ///* + /// The full transaction that created this schedule. This is primarily used for duplicate + /// schedule create detection. This is also the source of the parent transaction ID, from + /// which the child transaction ID is derived. + public var originalCreateTransaction: Proto_TransactionBody { + get {return _storage._originalCreateTransaction ?? Proto_TransactionBody()} + set {_uniqueStorage()._originalCreateTransaction = newValue} + } + /// Returns true if `originalCreateTransaction` has been explicitly set. + public var hasOriginalCreateTransaction: Bool {return _storage._originalCreateTransaction != nil} + /// Clears the value of `originalCreateTransaction`. Subsequent reads from it will return its default value. + public mutating func clearOriginalCreateTransaction() {_uniqueStorage()._originalCreateTransaction = nil} + + ///* + /// All the primitive keys that have already signed this schedule. + /// The scheduled transaction will not be executed before this list is + /// sufficient to "activate" the required keys for the scheduled transaction. + public var signatories: [Proto_Key] { + get {return _storage._signatories} + set {_uniqueStorage()._signatories = newValue} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +///* +/// A message for storing a list of schedules in state. +/// This is used to store lists of schedules that expire at a particular time or that have the same +/// simplified hash code. +public struct Proto_ScheduleList { + // 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 schedules, in no particular order. + public var schedules: [Proto_Schedule] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_Schedule: @unchecked Sendable {} +extension Proto_ScheduleList: @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_Schedule: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Schedule" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "schedule_id"), + 2: .same(proto: "deleted"), + 3: .same(proto: "executed"), + 4: .standard(proto: "wait_for_expiry"), + 5: .same(proto: "memo"), + 6: .standard(proto: "scheduler_account_id"), + 7: .standard(proto: "payer_account_id"), + 8: .standard(proto: "admin_key"), + 9: .standard(proto: "schedule_valid_start"), + 10: .standard(proto: "provided_expiration_second"), + 11: .standard(proto: "calculated_expiration_second"), + 12: .standard(proto: "resolution_time"), + 13: .standard(proto: "scheduled_transaction"), + 14: .standard(proto: "original_create_transaction"), + 15: .same(proto: "signatories"), + ] + + fileprivate class _StorageClass { + var _scheduleID: Proto_ScheduleID? = nil + var _deleted: Bool = false + var _executed: Bool = false + var _waitForExpiry: Bool = false + var _memo: String = String() + var _schedulerAccountID: Proto_AccountID? = nil + var _payerAccountID: Proto_AccountID? = nil + var _adminKey: Proto_Key? = nil + var _scheduleValidStart: Proto_Timestamp? = nil + var _providedExpirationSecond: Int64 = 0 + var _calculatedExpirationSecond: Int64 = 0 + var _resolutionTime: Proto_Timestamp? = nil + var _scheduledTransaction: Proto_SchedulableTransactionBody? = nil + var _originalCreateTransaction: Proto_TransactionBody? = nil + var _signatories: [Proto_Key] = [] + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _scheduleID = source._scheduleID + _deleted = source._deleted + _executed = source._executed + _waitForExpiry = source._waitForExpiry + _memo = source._memo + _schedulerAccountID = source._schedulerAccountID + _payerAccountID = source._payerAccountID + _adminKey = source._adminKey + _scheduleValidStart = source._scheduleValidStart + _providedExpirationSecond = source._providedExpirationSecond + _calculatedExpirationSecond = source._calculatedExpirationSecond + _resolutionTime = source._resolutionTime + _scheduledTransaction = source._scheduledTransaction + _originalCreateTransaction = source._originalCreateTransaction + _signatories = source._signatories + } + } + + 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._scheduleID) }() + case 2: try { try decoder.decodeSingularBoolField(value: &_storage._deleted) }() + case 3: try { try decoder.decodeSingularBoolField(value: &_storage._executed) }() + case 4: try { try decoder.decodeSingularBoolField(value: &_storage._waitForExpiry) }() + case 5: try { try decoder.decodeSingularStringField(value: &_storage._memo) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._schedulerAccountID) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._payerAccountID) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._adminKey) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._scheduleValidStart) }() + case 10: try { try decoder.decodeSingularInt64Field(value: &_storage._providedExpirationSecond) }() + case 11: try { try decoder.decodeSingularInt64Field(value: &_storage._calculatedExpirationSecond) }() + case 12: try { try decoder.decodeSingularMessageField(value: &_storage._resolutionTime) }() + case 13: try { try decoder.decodeSingularMessageField(value: &_storage._scheduledTransaction) }() + case 14: try { try decoder.decodeSingularMessageField(value: &_storage._originalCreateTransaction) }() + case 15: try { try decoder.decodeRepeatedMessageField(value: &_storage._signatories) }() + 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._scheduleID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if _storage._deleted != false { + try visitor.visitSingularBoolField(value: _storage._deleted, fieldNumber: 2) + } + if _storage._executed != false { + try visitor.visitSingularBoolField(value: _storage._executed, fieldNumber: 3) + } + if _storage._waitForExpiry != false { + try visitor.visitSingularBoolField(value: _storage._waitForExpiry, fieldNumber: 4) + } + if !_storage._memo.isEmpty { + try visitor.visitSingularStringField(value: _storage._memo, fieldNumber: 5) + } + try { if let v = _storage._schedulerAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._payerAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._adminKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._scheduleValidStart { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + if _storage._providedExpirationSecond != 0 { + try visitor.visitSingularInt64Field(value: _storage._providedExpirationSecond, fieldNumber: 10) + } + if _storage._calculatedExpirationSecond != 0 { + try visitor.visitSingularInt64Field(value: _storage._calculatedExpirationSecond, fieldNumber: 11) + } + try { if let v = _storage._resolutionTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + } }() + try { if let v = _storage._scheduledTransaction { + try visitor.visitSingularMessageField(value: v, fieldNumber: 13) + } }() + try { if let v = _storage._originalCreateTransaction { + try visitor.visitSingularMessageField(value: v, fieldNumber: 14) + } }() + if !_storage._signatories.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._signatories, fieldNumber: 15) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_Schedule, rhs: Proto_Schedule) -> 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._scheduleID != rhs_storage._scheduleID {return false} + if _storage._deleted != rhs_storage._deleted {return false} + if _storage._executed != rhs_storage._executed {return false} + if _storage._waitForExpiry != rhs_storage._waitForExpiry {return false} + if _storage._memo != rhs_storage._memo {return false} + if _storage._schedulerAccountID != rhs_storage._schedulerAccountID {return false} + if _storage._payerAccountID != rhs_storage._payerAccountID {return false} + if _storage._adminKey != rhs_storage._adminKey {return false} + if _storage._scheduleValidStart != rhs_storage._scheduleValidStart {return false} + if _storage._providedExpirationSecond != rhs_storage._providedExpirationSecond {return false} + if _storage._calculatedExpirationSecond != rhs_storage._calculatedExpirationSecond {return false} + if _storage._resolutionTime != rhs_storage._resolutionTime {return false} + if _storage._scheduledTransaction != rhs_storage._scheduledTransaction {return false} + if _storage._originalCreateTransaction != rhs_storage._originalCreateTransaction {return false} + if _storage._signatories != rhs_storage._signatories {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ScheduleList: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ScheduleList" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "schedules"), + ] + + 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.schedules) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.schedules.isEmpty { + try visitor.visitRepeatedMessageField(value: self.schedules, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ScheduleList, rhs: Proto_ScheduleList) -> Bool { + if lhs.schedules != rhs.schedules {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift b/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift new file mode 100644 index 00000000..5f952ff9 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift @@ -0,0 +1,168 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/throttles/throttle_usage_snapshots.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 +} + +public struct Proto_ThrottleUsageSnapshots { + // 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. + + ///* + /// Snapshots for TPS throttles. + public var tpsThrottles: [Proto_ThrottleUsageSnapshot] = [] + + ///* + /// Snapshots for gas throttle. + public var gasThrottle: Proto_ThrottleUsageSnapshot { + get {return _gasThrottle ?? Proto_ThrottleUsageSnapshot()} + set {_gasThrottle = newValue} + } + /// Returns true if `gasThrottle` has been explicitly set. + public var hasGasThrottle: Bool {return self._gasThrottle != nil} + /// Clears the value of `gasThrottle`. Subsequent reads from it will return its default value. + public mutating func clearGasThrottle() {self._gasThrottle = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _gasThrottle: Proto_ThrottleUsageSnapshot? = nil +} + +public struct Proto_ThrottleUsageSnapshot { + // 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. + + ///* + /// Used throttle capacity. + public var used: Int64 = 0 + + ///* + /// The last time at which the capacity was updated. + public var lastDecisionTime: Proto_Timestamp { + get {return _lastDecisionTime ?? Proto_Timestamp()} + set {_lastDecisionTime = newValue} + } + /// Returns true if `lastDecisionTime` has been explicitly set. + public var hasLastDecisionTime: Bool {return self._lastDecisionTime != nil} + /// Clears the value of `lastDecisionTime`. Subsequent reads from it will return its default value. + public mutating func clearLastDecisionTime() {self._lastDecisionTime = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _lastDecisionTime: Proto_Timestamp? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_ThrottleUsageSnapshots: @unchecked Sendable {} +extension Proto_ThrottleUsageSnapshot: @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_ThrottleUsageSnapshots: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ThrottleUsageSnapshots" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "tps_throttles"), + 2: .standard(proto: "gas_throttle"), + ] + + 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.tpsThrottles) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._gasThrottle) }() + 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 + if !self.tpsThrottles.isEmpty { + try visitor.visitRepeatedMessageField(value: self.tpsThrottles, fieldNumber: 1) + } + try { if let v = self._gasThrottle { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ThrottleUsageSnapshots, rhs: Proto_ThrottleUsageSnapshots) -> Bool { + if lhs.tpsThrottles != rhs.tpsThrottles {return false} + if lhs._gasThrottle != rhs._gasThrottle {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_ThrottleUsageSnapshot: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".ThrottleUsageSnapshot" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "used"), + 2: .standard(proto: "last_decision_time"), + ] + + 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.decodeSingularInt64Field(value: &self.used) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._lastDecisionTime) }() + 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 + if self.used != 0 { + try visitor.visitSingularInt64Field(value: self.used, fieldNumber: 1) + } + try { if let v = self._lastDecisionTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_ThrottleUsageSnapshot, rhs: Proto_ThrottleUsageSnapshot) -> Bool { + if lhs.used != rhs.used {return false} + if lhs._lastDecisionTime != rhs._lastDecisionTime {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_token_account.pb.swift b/Sources/HederaProtobufs/Services/state_token_account.pb.swift new file mode 100644 index 00000000..7e1fe935 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_account.pb.swift @@ -0,0 +1,942 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/account.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 +} + +public struct Proto_Account { + // 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 unique entity id of the account. + public var accountID: Proto_AccountID { + get {return _storage._accountID ?? Proto_AccountID()} + set {_uniqueStorage()._accountID = newValue} + } + /// Returns true if `accountID` has been explicitly set. + public var hasAccountID: Bool {return _storage._accountID != nil} + /// Clears the value of `accountID`. Subsequent reads from it will return its default value. + public mutating func clearAccountID() {_uniqueStorage()._accountID = nil} + + ///* + /// The alias to use for this account, if any. + public var alias: Data { + get {return _storage._alias} + set {_uniqueStorage()._alias = newValue} + } + + ///* + /// (Optional) The key to be used to sign transactions from the account, if any. + /// This key will not be set for hollow accounts until the account is finalized. + /// This key should be set on all the accounts, except for immutable accounts (0.0.800 and 0.0.801). + public var key: Proto_Key { + get {return _storage._key ?? Proto_Key()} + set {_uniqueStorage()._key = newValue} + } + /// Returns true if `key` has been explicitly set. + public var hasKey: Bool {return _storage._key != nil} + /// Clears the value of `key`. Subsequent reads from it will return its default value. + public mutating func clearKey() {_uniqueStorage()._key = nil} + + ///* + /// The expiration time of the account, in seconds since the epoch. + public var expirationSecond: Int64 { + get {return _storage._expirationSecond} + set {_uniqueStorage()._expirationSecond = newValue} + } + + ///* + /// The balance of the account, in tiny-bars. + public var tinybarBalance: Int64 { + get {return _storage._tinybarBalance} + set {_uniqueStorage()._tinybarBalance = newValue} + } + + ///* + /// An optional description of the account with UTF-8 encoding up to 100 bytes. + public var memo: String { + get {return _storage._memo} + set {_uniqueStorage()._memo = newValue} + } + + ///* + /// A boolean marking if the account has been deleted. + public var deleted: Bool { + get {return _storage._deleted} + set {_uniqueStorage()._deleted = newValue} + } + + ///* + /// The amount of hbars staked to the account. + public var stakedToMe: Int64 { + get {return _storage._stakedToMe} + set {_uniqueStorage()._stakedToMe = newValue} + } + + ///* + /// If this account stakes to another account, its value will be -1. It will + /// be set to the time when the account starts staking to a node. + public var stakePeriodStart: Int64 { + get {return _storage._stakePeriodStart} + set {_uniqueStorage()._stakePeriodStart = newValue} + } + + ///* + /// ID of the account or node to which this account is staking. + public var stakedID: OneOf_StakedID? { + get {return _storage._stakedID} + set {_uniqueStorage()._stakedID = newValue} + } + + ///* + /// ID of the new account to which this account is staking. If set to the sentinel 0.0.0 AccountID, + /// this field removes this account's staked account ID. + public var stakedAccountID: Proto_AccountID { + get { + if case .stakedAccountID(let v)? = _storage._stakedID {return v} + return Proto_AccountID() + } + set {_uniqueStorage()._stakedID = .stakedAccountID(newValue)} + } + + ///* + /// ID of the new node this account is staked to. If set to the sentinel -1, this field + /// removes this account's staked node ID. + public var stakedNodeID: Int64 { + get { + if case .stakedNodeID(let v)? = _storage._stakedID {return v} + return 0 + } + set {_uniqueStorage()._stakedID = .stakedNodeID(newValue)} + } + + ///* + /// A boolean marking if the account declines rewards. + public var declineReward: Bool { + get {return _storage._declineReward} + set {_uniqueStorage()._declineReward = newValue} + } + + ///* + /// A boolean marking if the account requires a receiver signature. + public var receiverSigRequired: Bool { + get {return _storage._receiverSigRequired} + set {_uniqueStorage()._receiverSigRequired = newValue} + } + + ///* + /// The token ID of the head of the linked list from token relations map for the account. + public var headTokenID: Proto_TokenID { + get {return _storage._headTokenID ?? Proto_TokenID()} + set {_uniqueStorage()._headTokenID = newValue} + } + /// Returns true if `headTokenID` has been explicitly set. + public var hasHeadTokenID: Bool {return _storage._headTokenID != nil} + /// Clears the value of `headTokenID`. Subsequent reads from it will return its default value. + public mutating func clearHeadTokenID() {_uniqueStorage()._headTokenID = nil} + + ///* + /// The NftID of the head of the linked list from unique tokens map for the account. + public var headNftID: Proto_NftID { + get {return _storage._headNftID ?? Proto_NftID()} + set {_uniqueStorage()._headNftID = newValue} + } + /// Returns true if `headNftID` has been explicitly set. + public var hasHeadNftID: Bool {return _storage._headNftID != nil} + /// Clears the value of `headNftID`. Subsequent reads from it will return its default value. + public mutating func clearHeadNftID() {_uniqueStorage()._headNftID = nil} + + ///* + /// The serial number of the head NftID of the linked list from unique tokens map for the account. + public var headNftSerialNumber: Int64 { + get {return _storage._headNftSerialNumber} + set {_uniqueStorage()._headNftSerialNumber = newValue} + } + + ///* + /// The number of NFTs owned by the account. + public var numberOwnedNfts: Int64 { + get {return _storage._numberOwnedNfts} + set {_uniqueStorage()._numberOwnedNfts = newValue} + } + + ///* + /// The maximum number of tokens that can be auto-associated with the account. + public var maxAutoAssociations: Int32 { + get {return _storage._maxAutoAssociations} + set {_uniqueStorage()._maxAutoAssociations = newValue} + } + + ///* + /// The number of used auto-association slots. + public var usedAutoAssociations: Int32 { + get {return _storage._usedAutoAssociations} + set {_uniqueStorage()._usedAutoAssociations = newValue} + } + + ///* + /// The number of tokens associated with the account. This number is used for + /// fee calculation during renewal of the account. + public var numberAssociations: Int32 { + get {return _storage._numberAssociations} + set {_uniqueStorage()._numberAssociations = newValue} + } + + ///* + /// A boolean marking if the account is a smart contract. + public var smartContract: Bool { + get {return _storage._smartContract} + set {_uniqueStorage()._smartContract = newValue} + } + + ///* + /// The number of tokens with a positive balance associated with the account. + /// If the account has positive balance in a token, it can not be deleted. + public var numberPositiveBalances: Int32 { + get {return _storage._numberPositiveBalances} + set {_uniqueStorage()._numberPositiveBalances = newValue} + } + + ///* + /// The nonce of the account, used for Ethereum interoperability. + public var ethereumNonce: Int64 { + get {return _storage._ethereumNonce} + set {_uniqueStorage()._ethereumNonce = newValue} + } + + ///* + /// The amount of hbars staked to the account at the start of the last rewarded period. + public var stakeAtStartOfLastRewardedPeriod: Int64 { + get {return _storage._stakeAtStartOfLastRewardedPeriod} + set {_uniqueStorage()._stakeAtStartOfLastRewardedPeriod = newValue} + } + + ///* + /// (Optional) The id of an auto-renew account, in the same shard and realm as the account, that + /// has signed a transaction allowing the network to use its balance to automatically extend the account's + /// expiration time when it passes. + public var autoRenewAccountID: Proto_AccountID { + get {return _storage._autoRenewAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._autoRenewAccountID = newValue} + } + /// Returns true if `autoRenewAccountID` has been explicitly set. + public var hasAutoRenewAccountID: Bool {return _storage._autoRenewAccountID != nil} + /// Clears the value of `autoRenewAccountID`. Subsequent reads from it will return its default value. + public mutating func clearAutoRenewAccountID() {_uniqueStorage()._autoRenewAccountID = nil} + + ///* + /// The number of seconds the network should automatically extend the account's expiration by, if the + /// account has a valid auto-renew account, and is not deleted upon expiration. + /// If this is not provided in an allowed range on account creation, the transaction will fail with INVALID_AUTO_RENEWAL_PERIOD. + /// The default values for the minimum period and maximum period are 30 days and 90 days, respectively. + public var autoRenewSeconds: Int64 { + get {return _storage._autoRenewSeconds} + set {_uniqueStorage()._autoRenewSeconds = newValue} + } + + ///* + /// If this account is a smart-contract, number of key-value pairs stored on the contract. + /// This is used to determine the storage rent for the contract. + public var contractKvPairsNumber: Int32 { + get {return _storage._contractKvPairsNumber} + set {_uniqueStorage()._contractKvPairsNumber = newValue} + } + + ///* + /// (Optional) List of crypto allowances approved by the account. + /// It contains account number for which the allowance is approved to and + /// the amount approved for that account. + public var cryptoAllowances: [Proto_AccountCryptoAllowance] { + get {return _storage._cryptoAllowances} + set {_uniqueStorage()._cryptoAllowances = newValue} + } + + ///* + /// (Optional) List of non-fungible token allowances approved for all by the account. + /// It contains account number approved for spending all serial numbers for the given + /// NFT token number using approved_for_all flag. + /// Allowances for a specific serial number is stored in the NFT itself in state. + public var approveForAllNftAllowances: [Proto_AccountApprovalForAllAllowance] { + get {return _storage._approveForAllNftAllowances} + set {_uniqueStorage()._approveForAllNftAllowances = newValue} + } + + ///* + /// (Optional) List of fungible token allowances approved by the account. + /// It contains account number for which the allowance is approved to and the token number. + /// It also contains and the amount approved for that account. + public var tokenAllowances: [Proto_AccountFungibleTokenAllowance] { + get {return _storage._tokenAllowances} + set {_uniqueStorage()._tokenAllowances = newValue} + } + + ///* + /// The number of tokens for which this account is treasury + public var numberTreasuryTitles: UInt32 { + get {return _storage._numberTreasuryTitles} + set {_uniqueStorage()._numberTreasuryTitles = newValue} + } + + ///* + /// A flag indicating if the account is expired and pending removal. + /// Only the entity expiration system task toggles this flag when it reaches this account + /// and finds it expired. Before setting the flag the system task checks if the account has + /// an auto-renew account with balance. This is done to prevent a zero-balance account with a funded + /// auto-renew account from being treated as expired in the interval between its expiration + /// and the time the system task actually auto-renews it. + public var expiredAndPendingRemoval: Bool { + get {return _storage._expiredAndPendingRemoval} + set {_uniqueStorage()._expiredAndPendingRemoval = newValue} + } + + ///* + /// The first key in the doubly-linked list of this contract's storage mappings; + /// It will be null if if the account is not a contract or the contract has no storage mappings. + public var firstContractStorageKey: Data { + get {return _storage._firstContractStorageKey} + set {_uniqueStorage()._firstContractStorageKey = newValue} + } + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + ///* + /// ID of the account or node to which this account is staking. + public enum OneOf_StakedID: Equatable { + ///* + /// ID of the new account to which this account is staking. If set to the sentinel 0.0.0 AccountID, + /// this field removes this account's staked account ID. + case stakedAccountID(Proto_AccountID) + ///* + /// ID of the new node this account is staked to. If set to the sentinel -1, this field + /// removes this account's staked node ID. + case stakedNodeID(Int64) + + #if !swift(>=4.1) + public static func ==(lhs: Proto_Account.OneOf_StakedID, rhs: Proto_Account.OneOf_StakedID) -> 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 (.stakedAccountID, .stakedAccountID): return { + guard case .stakedAccountID(let l) = lhs, case .stakedAccountID(let r) = rhs else { preconditionFailure() } + return l == r + }() + case (.stakedNodeID, .stakedNodeID): return { + guard case .stakedNodeID(let l) = lhs, case .stakedNodeID(let r) = rhs else { preconditionFailure() } + return l == r + }() + default: return false + } + } + #endif + } + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +///* +/// Allowance granted by this account to a spender for a specific non-fungible token +/// using ApproveForAll. This allows spender to spend all serial numbers for the given +/// non-fungible token id. +public struct Proto_AccountApprovalForAllAllowance { + // 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. + + public var tokenID: Proto_TokenID { + get {return _tokenID ?? Proto_TokenID()} + set {_tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return self._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {self._tokenID = nil} + + public var spenderID: Proto_AccountID { + get {return _spenderID ?? Proto_AccountID()} + set {_spenderID = newValue} + } + /// Returns true if `spenderID` has been explicitly set. + public var hasSpenderID: Bool {return self._spenderID != nil} + /// Clears the value of `spenderID`. Subsequent reads from it will return its default value. + public mutating func clearSpenderID() {self._spenderID = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _tokenID: Proto_TokenID? = nil + fileprivate var _spenderID: Proto_AccountID? = nil +} + +///* +/// Allowance granted by this account to another account for a specific fungible token. +/// This also contains the amount of the token that is approved for the account. +/// This allows spender to spend the amount of tokens approved for the account. +public struct Proto_AccountFungibleTokenAllowance { + // 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. + + public var tokenID: Proto_TokenID { + get {return _tokenID ?? Proto_TokenID()} + set {_tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return self._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {self._tokenID = nil} + + public var spenderID: Proto_AccountID { + get {return _spenderID ?? Proto_AccountID()} + set {_spenderID = newValue} + } + /// Returns true if `spenderID` has been explicitly set. + public var hasSpenderID: Bool {return self._spenderID != nil} + /// Clears the value of `spenderID`. Subsequent reads from it will return its default value. + public mutating func clearSpenderID() {self._spenderID = nil} + + public var amount: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _tokenID: Proto_TokenID? = nil + fileprivate var _spenderID: Proto_AccountID? = nil +} + +///* +/// Allowance granted by this account to another account for an amount of hbars. +/// This allows spender to spend the amount of hbars approved for the account. +public struct Proto_AccountCryptoAllowance { + // 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. + + public var spenderID: Proto_AccountID { + get {return _spenderID ?? Proto_AccountID()} + set {_spenderID = newValue} + } + /// Returns true if `spenderID` has been explicitly set. + public var hasSpenderID: Bool {return self._spenderID != nil} + /// Clears the value of `spenderID`. Subsequent reads from it will return its default value. + public mutating func clearSpenderID() {self._spenderID = nil} + + public var amount: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _spenderID: Proto_AccountID? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_Account: @unchecked Sendable {} +extension Proto_Account.OneOf_StakedID: @unchecked Sendable {} +extension Proto_AccountApprovalForAllAllowance: @unchecked Sendable {} +extension Proto_AccountFungibleTokenAllowance: @unchecked Sendable {} +extension Proto_AccountCryptoAllowance: @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_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Account" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "account_id"), + 2: .same(proto: "alias"), + 3: .same(proto: "key"), + 4: .standard(proto: "expiration_second"), + 5: .standard(proto: "tinybar_balance"), + 6: .same(proto: "memo"), + 7: .same(proto: "deleted"), + 8: .standard(proto: "staked_to_me"), + 9: .standard(proto: "stake_period_start"), + 10: .standard(proto: "staked_account_id"), + 11: .standard(proto: "staked_node_id"), + 12: .standard(proto: "decline_reward"), + 13: .standard(proto: "receiver_sig_required"), + 14: .standard(proto: "head_token_id"), + 15: .standard(proto: "head_nft_id"), + 16: .standard(proto: "head_nft_serial_number"), + 17: .standard(proto: "number_owned_nfts"), + 18: .standard(proto: "max_auto_associations"), + 19: .standard(proto: "used_auto_associations"), + 20: .standard(proto: "number_associations"), + 21: .standard(proto: "smart_contract"), + 22: .standard(proto: "number_positive_balances"), + 23: .standard(proto: "ethereum_nonce"), + 24: .standard(proto: "stake_at_start_of_last_rewarded_period"), + 25: .standard(proto: "auto_renew_account_id"), + 26: .standard(proto: "auto_renew_seconds"), + 27: .standard(proto: "contract_kv_pairs_number"), + 28: .standard(proto: "crypto_allowances"), + 29: .standard(proto: "approve_for_all_nft_allowances"), + 30: .standard(proto: "token_allowances"), + 31: .standard(proto: "number_treasury_titles"), + 32: .standard(proto: "expired_and_pending_removal"), + 33: .standard(proto: "first_contract_storage_key"), + ] + + fileprivate class _StorageClass { + var _accountID: Proto_AccountID? = nil + var _alias: Data = Data() + var _key: Proto_Key? = nil + var _expirationSecond: Int64 = 0 + var _tinybarBalance: Int64 = 0 + var _memo: String = String() + var _deleted: Bool = false + var _stakedToMe: Int64 = 0 + var _stakePeriodStart: Int64 = 0 + var _stakedID: Proto_Account.OneOf_StakedID? + var _declineReward: Bool = false + var _receiverSigRequired: Bool = false + var _headTokenID: Proto_TokenID? = nil + var _headNftID: Proto_NftID? = nil + var _headNftSerialNumber: Int64 = 0 + var _numberOwnedNfts: Int64 = 0 + var _maxAutoAssociations: Int32 = 0 + var _usedAutoAssociations: Int32 = 0 + var _numberAssociations: Int32 = 0 + var _smartContract: Bool = false + var _numberPositiveBalances: Int32 = 0 + var _ethereumNonce: Int64 = 0 + var _stakeAtStartOfLastRewardedPeriod: Int64 = 0 + var _autoRenewAccountID: Proto_AccountID? = nil + var _autoRenewSeconds: Int64 = 0 + var _contractKvPairsNumber: Int32 = 0 + var _cryptoAllowances: [Proto_AccountCryptoAllowance] = [] + var _approveForAllNftAllowances: [Proto_AccountApprovalForAllAllowance] = [] + var _tokenAllowances: [Proto_AccountFungibleTokenAllowance] = [] + var _numberTreasuryTitles: UInt32 = 0 + var _expiredAndPendingRemoval: Bool = false + var _firstContractStorageKey: Data = Data() + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _accountID = source._accountID + _alias = source._alias + _key = source._key + _expirationSecond = source._expirationSecond + _tinybarBalance = source._tinybarBalance + _memo = source._memo + _deleted = source._deleted + _stakedToMe = source._stakedToMe + _stakePeriodStart = source._stakePeriodStart + _stakedID = source._stakedID + _declineReward = source._declineReward + _receiverSigRequired = source._receiverSigRequired + _headTokenID = source._headTokenID + _headNftID = source._headNftID + _headNftSerialNumber = source._headNftSerialNumber + _numberOwnedNfts = source._numberOwnedNfts + _maxAutoAssociations = source._maxAutoAssociations + _usedAutoAssociations = source._usedAutoAssociations + _numberAssociations = source._numberAssociations + _smartContract = source._smartContract + _numberPositiveBalances = source._numberPositiveBalances + _ethereumNonce = source._ethereumNonce + _stakeAtStartOfLastRewardedPeriod = source._stakeAtStartOfLastRewardedPeriod + _autoRenewAccountID = source._autoRenewAccountID + _autoRenewSeconds = source._autoRenewSeconds + _contractKvPairsNumber = source._contractKvPairsNumber + _cryptoAllowances = source._cryptoAllowances + _approveForAllNftAllowances = source._approveForAllNftAllowances + _tokenAllowances = source._tokenAllowances + _numberTreasuryTitles = source._numberTreasuryTitles + _expiredAndPendingRemoval = source._expiredAndPendingRemoval + _firstContractStorageKey = source._firstContractStorageKey + } + } + + 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._accountID) }() + case 2: try { try decoder.decodeSingularBytesField(value: &_storage._alias) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._key) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &_storage._expirationSecond) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &_storage._tinybarBalance) }() + case 6: try { try decoder.decodeSingularStringField(value: &_storage._memo) }() + case 7: try { try decoder.decodeSingularBoolField(value: &_storage._deleted) }() + case 8: try { try decoder.decodeSingularInt64Field(value: &_storage._stakedToMe) }() + case 9: try { try decoder.decodeSingularInt64Field(value: &_storage._stakePeriodStart) }() + case 10: try { + var v: Proto_AccountID? + var hadOneofValue = false + if let current = _storage._stakedID { + hadOneofValue = true + if case .stakedAccountID(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._stakedID = .stakedAccountID(v) + } + }() + case 11: try { + var v: Int64? + try decoder.decodeSingularInt64Field(value: &v) + if let v = v { + if _storage._stakedID != nil {try decoder.handleConflictingOneOf()} + _storage._stakedID = .stakedNodeID(v) + } + }() + case 12: try { try decoder.decodeSingularBoolField(value: &_storage._declineReward) }() + case 13: try { try decoder.decodeSingularBoolField(value: &_storage._receiverSigRequired) }() + case 14: try { try decoder.decodeSingularMessageField(value: &_storage._headTokenID) }() + case 15: try { try decoder.decodeSingularMessageField(value: &_storage._headNftID) }() + case 16: try { try decoder.decodeSingularInt64Field(value: &_storage._headNftSerialNumber) }() + case 17: try { try decoder.decodeSingularInt64Field(value: &_storage._numberOwnedNfts) }() + case 18: try { try decoder.decodeSingularInt32Field(value: &_storage._maxAutoAssociations) }() + case 19: try { try decoder.decodeSingularInt32Field(value: &_storage._usedAutoAssociations) }() + case 20: try { try decoder.decodeSingularInt32Field(value: &_storage._numberAssociations) }() + case 21: try { try decoder.decodeSingularBoolField(value: &_storage._smartContract) }() + case 22: try { try decoder.decodeSingularInt32Field(value: &_storage._numberPositiveBalances) }() + case 23: try { try decoder.decodeSingularInt64Field(value: &_storage._ethereumNonce) }() + case 24: try { try decoder.decodeSingularInt64Field(value: &_storage._stakeAtStartOfLastRewardedPeriod) }() + case 25: try { try decoder.decodeSingularMessageField(value: &_storage._autoRenewAccountID) }() + case 26: try { try decoder.decodeSingularInt64Field(value: &_storage._autoRenewSeconds) }() + case 27: try { try decoder.decodeSingularInt32Field(value: &_storage._contractKvPairsNumber) }() + case 28: try { try decoder.decodeRepeatedMessageField(value: &_storage._cryptoAllowances) }() + case 29: try { try decoder.decodeRepeatedMessageField(value: &_storage._approveForAllNftAllowances) }() + case 30: try { try decoder.decodeRepeatedMessageField(value: &_storage._tokenAllowances) }() + 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) }() + 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._accountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !_storage._alias.isEmpty { + try visitor.visitSingularBytesField(value: _storage._alias, fieldNumber: 2) + } + try { if let v = _storage._key { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + if _storage._expirationSecond != 0 { + try visitor.visitSingularInt64Field(value: _storage._expirationSecond, fieldNumber: 4) + } + if _storage._tinybarBalance != 0 { + try visitor.visitSingularInt64Field(value: _storage._tinybarBalance, fieldNumber: 5) + } + if !_storage._memo.isEmpty { + try visitor.visitSingularStringField(value: _storage._memo, fieldNumber: 6) + } + if _storage._deleted != false { + try visitor.visitSingularBoolField(value: _storage._deleted, fieldNumber: 7) + } + if _storage._stakedToMe != 0 { + try visitor.visitSingularInt64Field(value: _storage._stakedToMe, fieldNumber: 8) + } + if _storage._stakePeriodStart != 0 { + try visitor.visitSingularInt64Field(value: _storage._stakePeriodStart, fieldNumber: 9) + } + switch _storage._stakedID { + case .stakedAccountID?: try { + guard case .stakedAccountID(let v)? = _storage._stakedID else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + }() + case .stakedNodeID?: try { + guard case .stakedNodeID(let v)? = _storage._stakedID else { preconditionFailure() } + try visitor.visitSingularInt64Field(value: v, fieldNumber: 11) + }() + case nil: break + } + if _storage._declineReward != false { + try visitor.visitSingularBoolField(value: _storage._declineReward, fieldNumber: 12) + } + if _storage._receiverSigRequired != false { + try visitor.visitSingularBoolField(value: _storage._receiverSigRequired, fieldNumber: 13) + } + try { if let v = _storage._headTokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 14) + } }() + try { if let v = _storage._headNftID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 15) + } }() + if _storage._headNftSerialNumber != 0 { + try visitor.visitSingularInt64Field(value: _storage._headNftSerialNumber, fieldNumber: 16) + } + if _storage._numberOwnedNfts != 0 { + try visitor.visitSingularInt64Field(value: _storage._numberOwnedNfts, fieldNumber: 17) + } + if _storage._maxAutoAssociations != 0 { + try visitor.visitSingularInt32Field(value: _storage._maxAutoAssociations, fieldNumber: 18) + } + if _storage._usedAutoAssociations != 0 { + try visitor.visitSingularInt32Field(value: _storage._usedAutoAssociations, fieldNumber: 19) + } + if _storage._numberAssociations != 0 { + try visitor.visitSingularInt32Field(value: _storage._numberAssociations, fieldNumber: 20) + } + if _storage._smartContract != false { + try visitor.visitSingularBoolField(value: _storage._smartContract, fieldNumber: 21) + } + if _storage._numberPositiveBalances != 0 { + try visitor.visitSingularInt32Field(value: _storage._numberPositiveBalances, fieldNumber: 22) + } + if _storage._ethereumNonce != 0 { + try visitor.visitSingularInt64Field(value: _storage._ethereumNonce, fieldNumber: 23) + } + if _storage._stakeAtStartOfLastRewardedPeriod != 0 { + try visitor.visitSingularInt64Field(value: _storage._stakeAtStartOfLastRewardedPeriod, fieldNumber: 24) + } + try { if let v = _storage._autoRenewAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 25) + } }() + if _storage._autoRenewSeconds != 0 { + try visitor.visitSingularInt64Field(value: _storage._autoRenewSeconds, fieldNumber: 26) + } + if _storage._contractKvPairsNumber != 0 { + try visitor.visitSingularInt32Field(value: _storage._contractKvPairsNumber, fieldNumber: 27) + } + if !_storage._cryptoAllowances.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._cryptoAllowances, fieldNumber: 28) + } + if !_storage._approveForAllNftAllowances.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._approveForAllNftAllowances, fieldNumber: 29) + } + if !_storage._tokenAllowances.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._tokenAllowances, fieldNumber: 30) + } + if _storage._numberTreasuryTitles != 0 { + try visitor.visitSingularUInt32Field(value: _storage._numberTreasuryTitles, fieldNumber: 31) + } + if _storage._expiredAndPendingRemoval != false { + try visitor.visitSingularBoolField(value: _storage._expiredAndPendingRemoval, fieldNumber: 32) + } + if !_storage._firstContractStorageKey.isEmpty { + try visitor.visitSingularBytesField(value: _storage._firstContractStorageKey, fieldNumber: 33) + } + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_Account, rhs: Proto_Account) -> 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._accountID != rhs_storage._accountID {return false} + if _storage._alias != rhs_storage._alias {return false} + if _storage._key != rhs_storage._key {return false} + if _storage._expirationSecond != rhs_storage._expirationSecond {return false} + if _storage._tinybarBalance != rhs_storage._tinybarBalance {return false} + if _storage._memo != rhs_storage._memo {return false} + if _storage._deleted != rhs_storage._deleted {return false} + if _storage._stakedToMe != rhs_storage._stakedToMe {return false} + if _storage._stakePeriodStart != rhs_storage._stakePeriodStart {return false} + if _storage._stakedID != rhs_storage._stakedID {return false} + if _storage._declineReward != rhs_storage._declineReward {return false} + if _storage._receiverSigRequired != rhs_storage._receiverSigRequired {return false} + if _storage._headTokenID != rhs_storage._headTokenID {return false} + if _storage._headNftID != rhs_storage._headNftID {return false} + if _storage._headNftSerialNumber != rhs_storage._headNftSerialNumber {return false} + if _storage._numberOwnedNfts != rhs_storage._numberOwnedNfts {return false} + if _storage._maxAutoAssociations != rhs_storage._maxAutoAssociations {return false} + if _storage._usedAutoAssociations != rhs_storage._usedAutoAssociations {return false} + if _storage._numberAssociations != rhs_storage._numberAssociations {return false} + if _storage._smartContract != rhs_storage._smartContract {return false} + if _storage._numberPositiveBalances != rhs_storage._numberPositiveBalances {return false} + if _storage._ethereumNonce != rhs_storage._ethereumNonce {return false} + if _storage._stakeAtStartOfLastRewardedPeriod != rhs_storage._stakeAtStartOfLastRewardedPeriod {return false} + if _storage._autoRenewAccountID != rhs_storage._autoRenewAccountID {return false} + if _storage._autoRenewSeconds != rhs_storage._autoRenewSeconds {return false} + if _storage._contractKvPairsNumber != rhs_storage._contractKvPairsNumber {return false} + if _storage._cryptoAllowances != rhs_storage._cryptoAllowances {return false} + if _storage._approveForAllNftAllowances != rhs_storage._approveForAllNftAllowances {return false} + if _storage._tokenAllowances != rhs_storage._tokenAllowances {return false} + if _storage._numberTreasuryTitles != rhs_storage._numberTreasuryTitles {return false} + if _storage._expiredAndPendingRemoval != rhs_storage._expiredAndPendingRemoval {return false} + if _storage._firstContractStorageKey != rhs_storage._firstContractStorageKey {return false} + return true + } + if !storagesAreEqual {return false} + } + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_AccountApprovalForAllAllowance: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".AccountApprovalForAllAllowance" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_id"), + 2: .standard(proto: "spender_id"), + ] + + 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._tokenID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._spenderID) }() + 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._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._spenderID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_AccountApprovalForAllAllowance, rhs: Proto_AccountApprovalForAllAllowance) -> Bool { + if lhs._tokenID != rhs._tokenID {return false} + if lhs._spenderID != rhs._spenderID {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_AccountFungibleTokenAllowance: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".AccountFungibleTokenAllowance" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_id"), + 2: .standard(proto: "spender_id"), + 3: .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.decodeSingularMessageField(value: &self._tokenID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._spenderID) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self.amount) }() + 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._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = self._spenderID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_AccountFungibleTokenAllowance, rhs: Proto_AccountFungibleTokenAllowance) -> Bool { + if lhs._tokenID != rhs._tokenID {return false} + if lhs._spenderID != rhs._spenderID {return false} + if lhs.amount != rhs.amount {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_AccountCryptoAllowance: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".AccountCryptoAllowance" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "spender_id"), + 2: .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.decodeSingularMessageField(value: &self._spenderID) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.amount) }() + 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._spenderID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if self.amount != 0 { + try visitor.visitSingularInt64Field(value: self.amount, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_AccountCryptoAllowance, rhs: Proto_AccountCryptoAllowance) -> Bool { + if lhs._spenderID != rhs._spenderID {return false} + if lhs.amount != rhs.amount {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift b/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift new file mode 100644 index 00000000..b67a0eb6 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift @@ -0,0 +1,116 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/network_staking_rewards.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 +} + +///* +/// Representation of a Hedera Token Service staking reward entity in the network Merkle tree. +/// This consists of all the information needed to calculate the staking rewards for all nodes in the network. It is +/// calculated at the beginning of each staking period for all nodes and is needed to have same values +/// for reconnect. +/// +/// As with all network entities, staking info is per node and has a unique entity number represented as shard.realm.X. +public struct Proto_NetworkStakingRewards { + // 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. + + ///* + /// Whether staking rewards are activated on the network. This is set to true when the balance of 0.0.800 + /// reaches minimum required balance. + public var stakingRewardsActivated: Bool = false + + ///* + /// Total of (balance + stakedToMe) for all accounts staked to all nodes in the network with declineReward=false, at the + /// beginning of the new staking period. + public var totalStakedRewardStart: Int64 = 0 + + ///* + /// Total of (balance + stakedToMe) for all accounts staked to all nodes in the network, at the beginning of the new + /// staking period. + public var totalStakedStart: Int64 = 0 + + ///* + /// The total staking rewards in tinybars that COULD be collected by all accounts staking to all nodes after the end + /// of this staking period; assuming that no account "renounces" its rewards by, for example, setting declineReward=true. + public var pendingRewards: Int64 = 0 + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_NetworkStakingRewards: @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_NetworkStakingRewards: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".NetworkStakingRewards" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "staking_rewards_activated"), + 2: .standard(proto: "total_staked_reward_start"), + 3: .standard(proto: "total_staked_start"), + 4: .standard(proto: "pending_rewards"), + ] + + 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.decodeSingularBoolField(value: &self.stakingRewardsActivated) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.totalStakedRewardStart) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self.totalStakedStart) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self.pendingRewards) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.stakingRewardsActivated != false { + try visitor.visitSingularBoolField(value: self.stakingRewardsActivated, fieldNumber: 1) + } + if self.totalStakedRewardStart != 0 { + try visitor.visitSingularInt64Field(value: self.totalStakedRewardStart, fieldNumber: 2) + } + if self.totalStakedStart != 0 { + try visitor.visitSingularInt64Field(value: self.totalStakedStart, fieldNumber: 3) + } + if self.pendingRewards != 0 { + try visitor.visitSingularInt64Field(value: self.pendingRewards, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_NetworkStakingRewards, rhs: Proto_NetworkStakingRewards) -> Bool { + if lhs.stakingRewardsActivated != rhs.stakingRewardsActivated {return false} + if lhs.totalStakedRewardStart != rhs.totalStakedRewardStart {return false} + if lhs.totalStakedStart != rhs.totalStakedStart {return false} + if lhs.pendingRewards != rhs.pendingRewards {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 new file mode 100644 index 00000000..3196b08d --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift @@ -0,0 +1,238 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/nft.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 +} + +///* +/// Representation of a Hedera Token Service NFT in the network Merkle tree. +public struct Proto_Nft { + // 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 id of this NFT. + public var nftID: Proto_NftID { + get {return _storage._nftID ?? Proto_NftID()} + set {_uniqueStorage()._nftID = newValue} + } + /// Returns true if `nftID` has been explicitly set. + public var hasNftID: Bool {return _storage._nftID != nil} + /// Clears the value of `nftID`. Subsequent reads from it will return its default value. + public mutating func clearNftID() {_uniqueStorage()._nftID = nil} + + ///* + /// The account or contract id that owns this NFT. + /// + /// If this number is zero in state, the NFT is owned by its token type's current treasury. + public var ownerID: Proto_AccountID { + get {return _storage._ownerID ?? Proto_AccountID()} + set {_uniqueStorage()._ownerID = newValue} + } + /// Returns true if `ownerID` has been explicitly set. + public var hasOwnerID: Bool {return _storage._ownerID != nil} + /// Clears the value of `ownerID`. Subsequent reads from it will return its default value. + public mutating func clearOwnerID() {_uniqueStorage()._ownerID = nil} + + ///* + /// The account or contract id approved to spend this NFT. + /// + /// If this number is zero, there is no approved spender. + public var spenderID: Proto_AccountID { + get {return _storage._spenderID ?? Proto_AccountID()} + set {_uniqueStorage()._spenderID = newValue} + } + /// Returns true if `spenderID` has been explicitly set. + public var hasSpenderID: Bool {return _storage._spenderID != nil} + /// Clears the value of `spenderID`. Subsequent reads from it will return its default value. + public mutating func clearSpenderID() {_uniqueStorage()._spenderID = nil} + + ///* + /// The consensus time of the TokenMint that created this NFT. + public var mintTime: Proto_Timestamp { + get {return _storage._mintTime ?? Proto_Timestamp()} + set {_uniqueStorage()._mintTime = newValue} + } + /// Returns true if `mintTime` has been explicitly set. + public var hasMintTime: Bool {return _storage._mintTime != nil} + /// Clears the value of `mintTime`. Subsequent reads from it will return its default value. + public mutating func clearMintTime() {_uniqueStorage()._mintTime = nil} + + ///* + /// The metadata of this NFT, up to 100 bytes; usually the UTF-8 encoding of a URI. + public var metadata: Data { + get {return _storage._metadata} + set {_uniqueStorage()._metadata = newValue} + } + + ///* + /// 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()} + set {_uniqueStorage()._ownerPreviousNftID = newValue} + } + /// Returns true if `ownerPreviousNftID` has been explicitly set. + public var hasOwnerPreviousNftID: Bool {return _storage._ownerPreviousNftID != nil} + /// Clears the value of `ownerPreviousNftID`. Subsequent reads from it will return its default value. + 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 + /// the owner's "doubly-linked list" of owned NFTs (if any). + public var ownerNextNftID: Proto_NftID { + get {return _storage._ownerNextNftID ?? Proto_NftID()} + set {_uniqueStorage()._ownerNextNftID = newValue} + } + /// Returns true if `ownerNextNftID` has been explicitly set. + public var hasOwnerNextNftID: Bool {return _storage._ownerNextNftID != nil} + /// Clears the value of `ownerNextNftID`. Subsequent reads from it will return its default value. + public mutating func clearOwnerNextNftID() {_uniqueStorage()._ownerNextNftID = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_Nft: @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_Nft: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Nft" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "nft_id"), + 2: .standard(proto: "owner_id"), + 3: .standard(proto: "spender_id"), + 4: .standard(proto: "mint_time"), + 5: .same(proto: "metadata"), + 6: .standard(proto: "owner_previous_nft_id"), + 7: .standard(proto: "owner_next_nft_id"), + ] + + fileprivate class _StorageClass { + var _nftID: Proto_NftID? = nil + var _ownerID: Proto_AccountID? = nil + var _spenderID: Proto_AccountID? = nil + var _mintTime: Proto_Timestamp? = nil + var _metadata: Data = Data() + var _ownerPreviousNftID: Proto_NftID? = nil + var _ownerNextNftID: Proto_NftID? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _nftID = source._nftID + _ownerID = source._ownerID + _spenderID = source._spenderID + _mintTime = source._mintTime + _metadata = source._metadata + _ownerPreviousNftID = source._ownerPreviousNftID + _ownerNextNftID = source._ownerNextNftID + } + } + + 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._nftID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._ownerID) }() + case 3: try { try decoder.decodeSingularMessageField(value: &_storage._spenderID) }() + case 4: try { try decoder.decodeSingularMessageField(value: &_storage._mintTime) }() + case 5: try { try decoder.decodeSingularBytesField(value: &_storage._metadata) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._ownerPreviousNftID) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._ownerNextNftID) }() + 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._nftID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._ownerID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + try { if let v = _storage._spenderID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try { if let v = _storage._mintTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 4) + } }() + if !_storage._metadata.isEmpty { + try visitor.visitSingularBytesField(value: _storage._metadata, fieldNumber: 5) + } + try { if let v = _storage._ownerPreviousNftID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._ownerNextNftID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_Nft, rhs: Proto_Nft) -> 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._nftID != rhs_storage._nftID {return false} + if _storage._ownerID != rhs_storage._ownerID {return false} + if _storage._spenderID != rhs_storage._spenderID {return false} + if _storage._mintTime != rhs_storage._mintTime {return false} + if _storage._metadata != rhs_storage._metadata {return false} + if _storage._ownerPreviousNftID != rhs_storage._ownerPreviousNftID {return false} + if _storage._ownerNextNftID != rhs_storage._ownerNextNftID {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_staking_node_info.pb.swift b/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift new file mode 100644 index 00000000..09002012 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift @@ -0,0 +1,205 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/staking_node_info.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 +} + +///* +/// Representation of a Hedera Token Service staking info entity in the network Merkle tree. +/// +/// As with all network entities, staking info is per node and has a unique entity number represented as shard.realm.X. +public struct Proto_StakingNodeInfo { + // 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 unique entity number of the node. The shard and realm numbers are implied, based on the network + /// this entity came from. + public var nodeNumber: Int64 = 0 + + ///* + /// The minimum stake on this node that is required for this node to have a non-zero weight to + /// participate in the network consensus. + public var minStake: Int64 = 0 + + ///* + /// The maximum stake on this node that is considered to calculate its weight to participate in the network consensus. + public var maxStake: Int64 = 0 + + ///* + /// The sum of balances of all accounts staked to this node who have opted to receive rewards. + public var stakeToReward: Int64 = 0 + + ///* + /// The sum of balances of all accounts staked to this node who have opted to decline rewards. + public var stakeToNotReward: Int64 = 0 + + ///* + /// The snapshot of stake_to_reward value at the beginning of the current staking period. + /// This is needed for calculating rewards for current staking period without considering changes to + /// stake_to_reward in the current staking period. It is reset at the beginning of every period. + public var stakeRewardStart: Int64 = 0 + + ///* + /// Tracks how much stake from stakeRewardStart will have unclaimed rewards due to accounts changing their staking + /// metadata in a way that disqualifies them for the current period; It is reset at the beginning of every period + public var unclaimedStakeRewardStart: Int64 = 0 + + ///* + /// The total amount of effective hbar staked to this node. This is sum of stake_to_reward and stake_to_not_reward. + /// If the sum is greater than max_stake, then the effective stake is max_stake. + /// If the sum is less than min_stake, then the effective stake is 0. + public var stake: Int64 = 0 + + ///* + /// An running sum of reward rates per hbar for the last 365+1 staking periods. The first element is the + /// is the reward up to and including the last full period that finished before the present. Second element is + /// the reward up to and including the period before that + public var rewardSumHistory: [Int64] = [] + + ///* + /// The consensus weight of this node in the network. This is computed based on the stake of this node + /// at midnight UTC of the current day. If the stake of this node is less than minStake, then the weight is 0. + /// Sum of all weights of nodes in the network should be less than 500. + /// If the stake of this node A is greater than minStake, then the weight of this node A is calculated as: + /// (node A stake * 500/ total stake of all nodes) + public var weight: Int32 = 0 + + ///* + /// The total staking rewards in tinybars that COULD be collected by all accounts staking to the current node after the end + /// of this staking period; assuming that no account "renounces" its rewards by, for example, setting declineReward=true. + /// When the current node is deleted, this amount will be subtracted from the total pending rewards of all accounts staking + /// to all nodes in the network in NetworkStakingRewards. + public var pendingRewards: Int64 = 0 + + ///* + /// True if this node has been deleted from network. + public var deleted: Bool = false + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_StakingNodeInfo: @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_StakingNodeInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".StakingNodeInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_number"), + 2: .standard(proto: "min_stake"), + 3: .standard(proto: "max_stake"), + 4: .standard(proto: "stake_to_reward"), + 5: .standard(proto: "stake_to_not_reward"), + 6: .standard(proto: "stake_reward_start"), + 7: .standard(proto: "unclaimed_stake_reward_start"), + 8: .same(proto: "stake"), + 9: .standard(proto: "reward_sum_history"), + 10: .same(proto: "weight"), + 11: .standard(proto: "pending_rewards"), + 12: .same(proto: "deleted"), + ] + + 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.decodeSingularInt64Field(value: &self.nodeNumber) }() + case 2: try { try decoder.decodeSingularInt64Field(value: &self.minStake) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &self.maxStake) }() + case 4: try { try decoder.decodeSingularInt64Field(value: &self.stakeToReward) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &self.stakeToNotReward) }() + case 6: try { try decoder.decodeSingularInt64Field(value: &self.stakeRewardStart) }() + case 7: try { try decoder.decodeSingularInt64Field(value: &self.unclaimedStakeRewardStart) }() + case 8: try { try decoder.decodeSingularInt64Field(value: &self.stake) }() + case 9: try { try decoder.decodeRepeatedInt64Field(value: &self.rewardSumHistory) }() + case 10: try { try decoder.decodeSingularInt32Field(value: &self.weight) }() + case 11: try { try decoder.decodeSingularInt64Field(value: &self.pendingRewards) }() + case 12: try { try decoder.decodeSingularBoolField(value: &self.deleted) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.nodeNumber != 0 { + try visitor.visitSingularInt64Field(value: self.nodeNumber, fieldNumber: 1) + } + if self.minStake != 0 { + try visitor.visitSingularInt64Field(value: self.minStake, fieldNumber: 2) + } + if self.maxStake != 0 { + try visitor.visitSingularInt64Field(value: self.maxStake, fieldNumber: 3) + } + if self.stakeToReward != 0 { + try visitor.visitSingularInt64Field(value: self.stakeToReward, fieldNumber: 4) + } + if self.stakeToNotReward != 0 { + try visitor.visitSingularInt64Field(value: self.stakeToNotReward, fieldNumber: 5) + } + if self.stakeRewardStart != 0 { + try visitor.visitSingularInt64Field(value: self.stakeRewardStart, fieldNumber: 6) + } + if self.unclaimedStakeRewardStart != 0 { + try visitor.visitSingularInt64Field(value: self.unclaimedStakeRewardStart, fieldNumber: 7) + } + if self.stake != 0 { + try visitor.visitSingularInt64Field(value: self.stake, fieldNumber: 8) + } + if !self.rewardSumHistory.isEmpty { + try visitor.visitPackedInt64Field(value: self.rewardSumHistory, fieldNumber: 9) + } + if self.weight != 0 { + try visitor.visitSingularInt32Field(value: self.weight, fieldNumber: 10) + } + if self.pendingRewards != 0 { + try visitor.visitSingularInt64Field(value: self.pendingRewards, fieldNumber: 11) + } + if self.deleted != false { + try visitor.visitSingularBoolField(value: self.deleted, fieldNumber: 12) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_StakingNodeInfo, rhs: Proto_StakingNodeInfo) -> Bool { + if lhs.nodeNumber != rhs.nodeNumber {return false} + if lhs.minStake != rhs.minStake {return false} + if lhs.maxStake != rhs.maxStake {return false} + if lhs.stakeToReward != rhs.stakeToReward {return false} + if lhs.stakeToNotReward != rhs.stakeToNotReward {return false} + if lhs.stakeRewardStart != rhs.stakeRewardStart {return false} + if lhs.unclaimedStakeRewardStart != rhs.unclaimedStakeRewardStart {return false} + if lhs.stake != rhs.stake {return false} + if lhs.rewardSumHistory != rhs.rewardSumHistory {return false} + if lhs.weight != rhs.weight {return false} + if lhs.pendingRewards != rhs.pendingRewards {return false} + if lhs.deleted != rhs.deleted {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_token_token.pb.swift b/Sources/HederaProtobufs/Services/state_token_token.pb.swift new file mode 100644 index 00000000..05d42036 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_token.pb.swift @@ -0,0 +1,586 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/token.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 +} + +public struct Proto_Token { + // 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 unique entity id of this token. + public var tokenID: Proto_TokenID { + get {return _storage._tokenID ?? Proto_TokenID()} + set {_uniqueStorage()._tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return _storage._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {_uniqueStorage()._tokenID = nil} + + ///* + /// The human-readable name of this token. Need not be unique. Maximum length allowed is 100 bytes. + public var name: String { + get {return _storage._name} + set {_uniqueStorage()._name = newValue} + } + + ///* + /// The human-readable symbol for the token. It is not necessarily unique. Maximum length allowed is 100 bytes. + public var symbol: String { + get {return _storage._symbol} + set {_uniqueStorage()._symbol = newValue} + } + + ///* + /// The number of decimal places of this token. If decimals are 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). + public var decimals: Int32 { + get {return _storage._decimals} + set {_uniqueStorage()._decimals = newValue} + } + + ///* + /// The total supply of this token. + public var totalSupply: Int64 { + get {return _storage._totalSupply} + set {_uniqueStorage()._totalSupply = newValue} + } + + ///* + /// The treasury account id of this token. This account receives 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. + public var treasuryAccountID: Proto_AccountID { + get {return _storage._treasuryAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._treasuryAccountID = newValue} + } + /// Returns true if `treasuryAccountID` has been explicitly set. + public var hasTreasuryAccountID: Bool {return _storage._treasuryAccountID != nil} + /// Clears the value of `treasuryAccountID`. Subsequent reads from it will return its default value. + public mutating func clearTreasuryAccountID() {_uniqueStorage()._treasuryAccountID = nil} + + ///* + /// (Optional) The admin key of this token. If this key is set, the token is mutable. + /// A mutable token can be modified. + /// If this key is not set on token creation, it cannot be modified. + public var adminKey: Proto_Key { + get {return _storage._adminKey ?? Proto_Key()} + set {_uniqueStorage()._adminKey = newValue} + } + /// Returns true if `adminKey` has been explicitly set. + public var hasAdminKey: Bool {return _storage._adminKey != nil} + /// Clears the value of `adminKey`. Subsequent reads from it will return its default value. + public mutating func clearAdminKey() {_uniqueStorage()._adminKey = nil} + + ///* + /// (Optional) The kyc key of this token. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var kycKey: Proto_Key { + get {return _storage._kycKey ?? Proto_Key()} + set {_uniqueStorage()._kycKey = newValue} + } + /// Returns true if `kycKey` has been explicitly set. + public var hasKycKey: Bool {return _storage._kycKey != nil} + /// Clears the value of `kycKey`. Subsequent reads from it will return its default value. + public mutating func clearKycKey() {_uniqueStorage()._kycKey = nil} + + ///* + /// (Optional) The freeze key of this token. This key is needed for freezing the token. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var freezeKey: Proto_Key { + get {return _storage._freezeKey ?? Proto_Key()} + set {_uniqueStorage()._freezeKey = newValue} + } + /// Returns true if `freezeKey` has been explicitly set. + public var hasFreezeKey: Bool {return _storage._freezeKey != nil} + /// Clears the value of `freezeKey`. Subsequent reads from it will return its default value. + public mutating func clearFreezeKey() {_uniqueStorage()._freezeKey = nil} + + ///* + /// (Optional) The wipe key of this token. This key is needed for wiping the token. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var wipeKey: Proto_Key { + get {return _storage._wipeKey ?? Proto_Key()} + set {_uniqueStorage()._wipeKey = newValue} + } + /// Returns true if `wipeKey` has been explicitly set. + public var hasWipeKey: Bool {return _storage._wipeKey != nil} + /// Clears the value of `wipeKey`. Subsequent reads from it will return its default value. + public mutating func clearWipeKey() {_uniqueStorage()._wipeKey = nil} + + ///* + /// (Optional) The supply key of this token. This key is needed for minting or burning token. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var supplyKey: Proto_Key { + get {return _storage._supplyKey ?? Proto_Key()} + set {_uniqueStorage()._supplyKey = newValue} + } + /// Returns true if `supplyKey` has been explicitly set. + public var hasSupplyKey: Bool {return _storage._supplyKey != nil} + /// Clears the value of `supplyKey`. Subsequent reads from it will return its default value. + public mutating func clearSupplyKey() {_uniqueStorage()._supplyKey = nil} + + ///* + /// (Optional) The fee schedule key of this token. This key should be set, in order to make any + /// changes to the custom fee schedule. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var feeScheduleKey: Proto_Key { + get {return _storage._feeScheduleKey ?? Proto_Key()} + set {_uniqueStorage()._feeScheduleKey = newValue} + } + /// Returns true if `feeScheduleKey` has been explicitly set. + public var hasFeeScheduleKey: Bool {return _storage._feeScheduleKey != nil} + /// Clears the value of `feeScheduleKey`. Subsequent reads from it will return its default value. + public mutating func clearFeeScheduleKey() {_uniqueStorage()._feeScheduleKey = nil} + + ///* + /// (Optional) The pause key of this token. This key is needed for pausing the token. + /// If this key is not set on token creation, it can only be set if the token has admin key set. + public var pauseKey: Proto_Key { + get {return _storage._pauseKey ?? Proto_Key()} + set {_uniqueStorage()._pauseKey = newValue} + } + /// Returns true if `pauseKey` has been explicitly set. + public var hasPauseKey: Bool {return _storage._pauseKey != nil} + /// Clears the value of `pauseKey`. Subsequent reads from it will return its default value. + public mutating func clearPauseKey() {_uniqueStorage()._pauseKey = nil} + + ///* + /// The last used serial number of this token. + public var lastUsedSerialNumber: Int64 { + get {return _storage._lastUsedSerialNumber} + set {_uniqueStorage()._lastUsedSerialNumber = newValue} + } + + ///* + /// The flag indicating if this token is deleted. + public var deleted: Bool { + get {return _storage._deleted} + set {_uniqueStorage()._deleted = newValue} + } + + ///* + /// The type of this token. A token can be either FUNGIBLE_COMMON or NON_FUNGIBLE_UNIQUE. + /// If it has been omitted during token creation, FUNGIBLE_COMMON type is used. + public var tokenType: Proto_TokenType { + get {return _storage._tokenType} + set {_uniqueStorage()._tokenType = newValue} + } + + ///* + /// The supply type of this token.A token can have either INFINITE or FINITE supply type. + /// If it has been omitted during token creation, INFINITE type is used. + public var supplyType: Proto_TokenSupplyType { + get {return _storage._supplyType} + set {_uniqueStorage()._supplyType = newValue} + } + + ///* + /// The id of the account (if any) that the network will attempt to charge for the + /// token's auto-renewal upon expiration. + public var autoRenewAccountID: Proto_AccountID { + get {return _storage._autoRenewAccountID ?? Proto_AccountID()} + set {_uniqueStorage()._autoRenewAccountID = newValue} + } + /// Returns true if `autoRenewAccountID` has been explicitly set. + public var hasAutoRenewAccountID: Bool {return _storage._autoRenewAccountID != nil} + /// Clears the value of `autoRenewAccountID`. Subsequent reads from it will return its default value. + public mutating func clearAutoRenewAccountID() {_uniqueStorage()._autoRenewAccountID = nil} + + ///* + /// The number of seconds the network should automatically extend the token's expiration by, if the + /// token has a valid auto-renew account, and is not deleted upon expiration. + /// If this is not provided in a allowed range on token creation, the transaction will fail with INVALID_AUTO_RENEWAL_PERIOD. + /// The default values for the minimum period and maximum period are 30 days and 90 days, respectively. + public var autoRenewSeconds: Int64 { + get {return _storage._autoRenewSeconds} + set {_uniqueStorage()._autoRenewSeconds = newValue} + } + + ///* + /// The expiration time of the token, in seconds since the epoch. + public var expirationSecond: Int64 { + get {return _storage._expirationSecond} + set {_uniqueStorage()._expirationSecond = newValue} + } + + ///* + /// An optional description of the token with UTF-8 encoding up to 100 bytes. + public var memo: String { + get {return _storage._memo} + set {_uniqueStorage()._memo = newValue} + } + + ///* + /// The maximum supply of this token. + public var maxSupply: Int64 { + get {return _storage._maxSupply} + set {_uniqueStorage()._maxSupply = newValue} + } + + ///* + /// The flag indicating if this token is paused. + public var paused: Bool { + get {return _storage._paused} + set {_uniqueStorage()._paused = newValue} + } + + ///* + /// The flag indicating if this token has accounts associated to it that are frozen by default. + public var accountsFrozenByDefault: Bool { + get {return _storage._accountsFrozenByDefault} + set {_uniqueStorage()._accountsFrozenByDefault = newValue} + } + + ///* + /// The flag indicating if this token has accounts associated with it that are KYC granted by default. + public var accountsKycGrantedByDefault: Bool { + get {return _storage._accountsKycGrantedByDefault} + set {_uniqueStorage()._accountsKycGrantedByDefault = newValue} + } + + ///* + /// (Optional) The custom fees of this token. + public var customFees: [Proto_CustomFee] { + get {return _storage._customFees} + set {_uniqueStorage()._customFees = newValue} + } + + ///* + /// Metadata of the created token definition + public var metadata: Data { + get {return _storage._metadata} + set {_uniqueStorage()._metadata = newValue} + } + + ///* + /// The key which can change the metadata of a token + /// (token definition and individual NFTs). + public var metadataKey: Proto_Key { + get {return _storage._metadataKey ?? Proto_Key()} + set {_uniqueStorage()._metadataKey = newValue} + } + /// Returns true if `metadataKey` has been explicitly set. + public var hasMetadataKey: Bool {return _storage._metadataKey != nil} + /// Clears the value of `metadataKey`. Subsequent reads from it will return its default value. + public mutating func clearMetadataKey() {_uniqueStorage()._metadataKey = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_Token: @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_Token: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Token" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_id"), + 2: .same(proto: "name"), + 3: .same(proto: "symbol"), + 4: .same(proto: "decimals"), + 5: .standard(proto: "total_supply"), + 6: .standard(proto: "treasury_account_id"), + 7: .standard(proto: "admin_key"), + 8: .standard(proto: "kyc_key"), + 9: .standard(proto: "freeze_key"), + 10: .standard(proto: "wipe_key"), + 11: .standard(proto: "supply_key"), + 12: .standard(proto: "fee_schedule_key"), + 13: .standard(proto: "pause_key"), + 14: .standard(proto: "last_used_serial_number"), + 15: .same(proto: "deleted"), + 16: .standard(proto: "token_type"), + 17: .standard(proto: "supply_type"), + 18: .standard(proto: "auto_renew_account_id"), + 19: .standard(proto: "auto_renew_seconds"), + 20: .standard(proto: "expiration_second"), + 21: .same(proto: "memo"), + 22: .standard(proto: "max_supply"), + 23: .same(proto: "paused"), + 24: .standard(proto: "accounts_frozen_by_default"), + 25: .standard(proto: "accounts_kyc_granted_by_default"), + 26: .standard(proto: "custom_fees"), + 27: .same(proto: "metadata"), + 28: .standard(proto: "metadata_key"), + ] + + fileprivate class _StorageClass { + var _tokenID: Proto_TokenID? = nil + var _name: String = String() + var _symbol: String = String() + var _decimals: Int32 = 0 + var _totalSupply: Int64 = 0 + var _treasuryAccountID: Proto_AccountID? = nil + var _adminKey: Proto_Key? = nil + var _kycKey: Proto_Key? = nil + var _freezeKey: Proto_Key? = nil + var _wipeKey: Proto_Key? = nil + var _supplyKey: Proto_Key? = nil + var _feeScheduleKey: Proto_Key? = nil + var _pauseKey: Proto_Key? = nil + var _lastUsedSerialNumber: Int64 = 0 + var _deleted: Bool = false + var _tokenType: Proto_TokenType = .fungibleCommon + var _supplyType: Proto_TokenSupplyType = .infinite + var _autoRenewAccountID: Proto_AccountID? = nil + var _autoRenewSeconds: Int64 = 0 + var _expirationSecond: Int64 = 0 + var _memo: String = String() + var _maxSupply: Int64 = 0 + var _paused: Bool = false + var _accountsFrozenByDefault: Bool = false + var _accountsKycGrantedByDefault: Bool = false + var _customFees: [Proto_CustomFee] = [] + var _metadata: Data = Data() + var _metadataKey: Proto_Key? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _tokenID = source._tokenID + _name = source._name + _symbol = source._symbol + _decimals = source._decimals + _totalSupply = source._totalSupply + _treasuryAccountID = source._treasuryAccountID + _adminKey = source._adminKey + _kycKey = source._kycKey + _freezeKey = source._freezeKey + _wipeKey = source._wipeKey + _supplyKey = source._supplyKey + _feeScheduleKey = source._feeScheduleKey + _pauseKey = source._pauseKey + _lastUsedSerialNumber = source._lastUsedSerialNumber + _deleted = source._deleted + _tokenType = source._tokenType + _supplyType = source._supplyType + _autoRenewAccountID = source._autoRenewAccountID + _autoRenewSeconds = source._autoRenewSeconds + _expirationSecond = source._expirationSecond + _memo = source._memo + _maxSupply = source._maxSupply + _paused = source._paused + _accountsFrozenByDefault = source._accountsFrozenByDefault + _accountsKycGrantedByDefault = source._accountsKycGrantedByDefault + _customFees = source._customFees + _metadata = source._metadata + _metadataKey = source._metadataKey + } + } + + 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._tokenID) }() + case 2: try { try decoder.decodeSingularStringField(value: &_storage._name) }() + case 3: try { try decoder.decodeSingularStringField(value: &_storage._symbol) }() + case 4: try { try decoder.decodeSingularInt32Field(value: &_storage._decimals) }() + case 5: try { try decoder.decodeSingularInt64Field(value: &_storage._totalSupply) }() + case 6: try { try decoder.decodeSingularMessageField(value: &_storage._treasuryAccountID) }() + case 7: try { try decoder.decodeSingularMessageField(value: &_storage._adminKey) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._kycKey) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._freezeKey) }() + case 10: try { try decoder.decodeSingularMessageField(value: &_storage._wipeKey) }() + case 11: try { try decoder.decodeSingularMessageField(value: &_storage._supplyKey) }() + case 12: try { try decoder.decodeSingularMessageField(value: &_storage._feeScheduleKey) }() + case 13: try { try decoder.decodeSingularMessageField(value: &_storage._pauseKey) }() + case 14: try { try decoder.decodeSingularInt64Field(value: &_storage._lastUsedSerialNumber) }() + case 15: try { try decoder.decodeSingularBoolField(value: &_storage._deleted) }() + case 16: try { try decoder.decodeSingularEnumField(value: &_storage._tokenType) }() + case 17: try { try decoder.decodeSingularEnumField(value: &_storage._supplyType) }() + case 18: try { try decoder.decodeSingularMessageField(value: &_storage._autoRenewAccountID) }() + case 19: try { try decoder.decodeSingularInt64Field(value: &_storage._autoRenewSeconds) }() + case 20: try { try decoder.decodeSingularInt64Field(value: &_storage._expirationSecond) }() + case 21: try { try decoder.decodeSingularStringField(value: &_storage._memo) }() + case 22: try { try decoder.decodeSingularInt64Field(value: &_storage._maxSupply) }() + case 23: try { try decoder.decodeSingularBoolField(value: &_storage._paused) }() + case 24: try { try decoder.decodeSingularBoolField(value: &_storage._accountsFrozenByDefault) }() + case 25: try { try decoder.decodeSingularBoolField(value: &_storage._accountsKycGrantedByDefault) }() + case 26: try { try decoder.decodeRepeatedMessageField(value: &_storage._customFees) }() + case 27: try { try decoder.decodeSingularBytesField(value: &_storage._metadata) }() + case 28: try { try decoder.decodeSingularMessageField(value: &_storage._metadataKey) }() + 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._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !_storage._name.isEmpty { + try visitor.visitSingularStringField(value: _storage._name, fieldNumber: 2) + } + if !_storage._symbol.isEmpty { + try visitor.visitSingularStringField(value: _storage._symbol, fieldNumber: 3) + } + if _storage._decimals != 0 { + try visitor.visitSingularInt32Field(value: _storage._decimals, fieldNumber: 4) + } + if _storage._totalSupply != 0 { + try visitor.visitSingularInt64Field(value: _storage._totalSupply, fieldNumber: 5) + } + try { if let v = _storage._treasuryAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 6) + } }() + try { if let v = _storage._adminKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 7) + } }() + try { if let v = _storage._kycKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._freezeKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + try { if let v = _storage._wipeKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 10) + } }() + try { if let v = _storage._supplyKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 11) + } }() + try { if let v = _storage._feeScheduleKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 12) + } }() + try { if let v = _storage._pauseKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 13) + } }() + if _storage._lastUsedSerialNumber != 0 { + try visitor.visitSingularInt64Field(value: _storage._lastUsedSerialNumber, fieldNumber: 14) + } + if _storage._deleted != false { + try visitor.visitSingularBoolField(value: _storage._deleted, fieldNumber: 15) + } + if _storage._tokenType != .fungibleCommon { + try visitor.visitSingularEnumField(value: _storage._tokenType, fieldNumber: 16) + } + if _storage._supplyType != .infinite { + try visitor.visitSingularEnumField(value: _storage._supplyType, fieldNumber: 17) + } + try { if let v = _storage._autoRenewAccountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 18) + } }() + if _storage._autoRenewSeconds != 0 { + try visitor.visitSingularInt64Field(value: _storage._autoRenewSeconds, fieldNumber: 19) + } + if _storage._expirationSecond != 0 { + try visitor.visitSingularInt64Field(value: _storage._expirationSecond, fieldNumber: 20) + } + if !_storage._memo.isEmpty { + try visitor.visitSingularStringField(value: _storage._memo, fieldNumber: 21) + } + if _storage._maxSupply != 0 { + try visitor.visitSingularInt64Field(value: _storage._maxSupply, fieldNumber: 22) + } + if _storage._paused != false { + try visitor.visitSingularBoolField(value: _storage._paused, fieldNumber: 23) + } + if _storage._accountsFrozenByDefault != false { + try visitor.visitSingularBoolField(value: _storage._accountsFrozenByDefault, fieldNumber: 24) + } + if _storage._accountsKycGrantedByDefault != false { + try visitor.visitSingularBoolField(value: _storage._accountsKycGrantedByDefault, fieldNumber: 25) + } + if !_storage._customFees.isEmpty { + try visitor.visitRepeatedMessageField(value: _storage._customFees, fieldNumber: 26) + } + if !_storage._metadata.isEmpty { + try visitor.visitSingularBytesField(value: _storage._metadata, fieldNumber: 27) + } + try { if let v = _storage._metadataKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 28) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_Token, rhs: Proto_Token) -> 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._tokenID != rhs_storage._tokenID {return false} + if _storage._name != rhs_storage._name {return false} + if _storage._symbol != rhs_storage._symbol {return false} + if _storage._decimals != rhs_storage._decimals {return false} + if _storage._totalSupply != rhs_storage._totalSupply {return false} + if _storage._treasuryAccountID != rhs_storage._treasuryAccountID {return false} + if _storage._adminKey != rhs_storage._adminKey {return false} + if _storage._kycKey != rhs_storage._kycKey {return false} + if _storage._freezeKey != rhs_storage._freezeKey {return false} + if _storage._wipeKey != rhs_storage._wipeKey {return false} + if _storage._supplyKey != rhs_storage._supplyKey {return false} + if _storage._feeScheduleKey != rhs_storage._feeScheduleKey {return false} + if _storage._pauseKey != rhs_storage._pauseKey {return false} + if _storage._lastUsedSerialNumber != rhs_storage._lastUsedSerialNumber {return false} + if _storage._deleted != rhs_storage._deleted {return false} + if _storage._tokenType != rhs_storage._tokenType {return false} + if _storage._supplyType != rhs_storage._supplyType {return false} + if _storage._autoRenewAccountID != rhs_storage._autoRenewAccountID {return false} + if _storage._autoRenewSeconds != rhs_storage._autoRenewSeconds {return false} + if _storage._expirationSecond != rhs_storage._expirationSecond {return false} + if _storage._memo != rhs_storage._memo {return false} + if _storage._maxSupply != rhs_storage._maxSupply {return false} + if _storage._paused != rhs_storage._paused {return false} + if _storage._accountsFrozenByDefault != rhs_storage._accountsFrozenByDefault {return false} + if _storage._accountsKycGrantedByDefault != rhs_storage._accountsKycGrantedByDefault {return false} + if _storage._customFees != rhs_storage._customFees {return false} + if _storage._metadata != rhs_storage._metadata {return false} + if _storage._metadataKey != rhs_storage._metadataKey {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_token_relation.pb.swift b/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift new file mode 100644 index 00000000..62a62d88 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift @@ -0,0 +1,257 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/token/token_relation.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 +} + +///* +/// Representation of a Hedera Token Service token relationship entity in the network Merkle tree. +/// +/// As with all network entities, a token relationship has a unique entity number pair, which is represented +/// with the account and the token involved in the relationship. +public struct Proto_TokenRelation { + // 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 token involved in this relation.It takes only positive + public var tokenID: Proto_TokenID { + get {return _storage._tokenID ?? Proto_TokenID()} + set {_uniqueStorage()._tokenID = newValue} + } + /// Returns true if `tokenID` has been explicitly set. + public var hasTokenID: Bool {return _storage._tokenID != nil} + /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. + public mutating func clearTokenID() {_uniqueStorage()._tokenID = nil} + + ///* + /// The account involved in this association. + public var accountID: Proto_AccountID { + get {return _storage._accountID ?? Proto_AccountID()} + set {_uniqueStorage()._accountID = newValue} + } + /// Returns true if `accountID` has been explicitly set. + public var hasAccountID: Bool {return _storage._accountID != nil} + /// Clears the value of `accountID`. Subsequent reads from it will return its default value. + public mutating func clearAccountID() {_uniqueStorage()._accountID = nil} + + ///* + /// The balance of the token relationship. + public var balance: Int64 { + get {return _storage._balance} + set {_uniqueStorage()._balance = newValue} + } + + ///* + /// The flags specifying the token relationship is frozen or not. + public var frozen: Bool { + get {return _storage._frozen} + set {_uniqueStorage()._frozen = newValue} + } + + ///* + /// The flag indicating if the token relationship has been granted KYC. + public var kycGranted: Bool { + get {return _storage._kycGranted} + set {_uniqueStorage()._kycGranted = newValue} + } + + ///* + /// The flag indicating if the token relationship was deleted. + public var deleted: Bool { + get {return _storage._deleted} + set {_uniqueStorage()._deleted = newValue} + } + + ///* + /// The flag indicating if the token relationship was created using automatic association. + public var automaticAssociation: Bool { + get {return _storage._automaticAssociation} + set {_uniqueStorage()._automaticAssociation = newValue} + } + + ///* + /// The previous token id of account's association linked list + public var previousToken: Proto_TokenID { + get {return _storage._previousToken ?? Proto_TokenID()} + set {_uniqueStorage()._previousToken = newValue} + } + /// Returns true if `previousToken` has been explicitly set. + public var hasPreviousToken: Bool {return _storage._previousToken != nil} + /// Clears the value of `previousToken`. Subsequent reads from it will return its default value. + public mutating func clearPreviousToken() {_uniqueStorage()._previousToken = nil} + + ///* + /// The next token id of account's association linked list + public var nextToken: Proto_TokenID { + get {return _storage._nextToken ?? Proto_TokenID()} + set {_uniqueStorage()._nextToken = newValue} + } + /// Returns true if `nextToken` has been explicitly set. + public var hasNextToken: Bool {return _storage._nextToken != nil} + /// Clears the value of `nextToken`. Subsequent reads from it will return its default value. + public mutating func clearNextToken() {_uniqueStorage()._nextToken = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _storage = _StorageClass.defaultInstance +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TokenRelation: @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_TokenRelation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TokenRelation" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "token_id"), + 2: .standard(proto: "account_id"), + 3: .same(proto: "balance"), + 4: .same(proto: "frozen"), + 5: .standard(proto: "kyc_granted"), + 6: .same(proto: "deleted"), + 7: .standard(proto: "automatic_association"), + 8: .standard(proto: "previous_token"), + 9: .standard(proto: "next_token"), + ] + + fileprivate class _StorageClass { + var _tokenID: Proto_TokenID? = nil + var _accountID: Proto_AccountID? = nil + var _balance: Int64 = 0 + var _frozen: Bool = false + var _kycGranted: Bool = false + var _deleted: Bool = false + var _automaticAssociation: Bool = false + var _previousToken: Proto_TokenID? = nil + var _nextToken: Proto_TokenID? = nil + + static let defaultInstance = _StorageClass() + + private init() {} + + init(copying source: _StorageClass) { + _tokenID = source._tokenID + _accountID = source._accountID + _balance = source._balance + _frozen = source._frozen + _kycGranted = source._kycGranted + _deleted = source._deleted + _automaticAssociation = source._automaticAssociation + _previousToken = source._previousToken + _nextToken = source._nextToken + } + } + + 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._tokenID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &_storage._accountID) }() + case 3: try { try decoder.decodeSingularInt64Field(value: &_storage._balance) }() + case 4: try { try decoder.decodeSingularBoolField(value: &_storage._frozen) }() + case 5: try { try decoder.decodeSingularBoolField(value: &_storage._kycGranted) }() + case 6: try { try decoder.decodeSingularBoolField(value: &_storage._deleted) }() + case 7: try { try decoder.decodeSingularBoolField(value: &_storage._automaticAssociation) }() + case 8: try { try decoder.decodeSingularMessageField(value: &_storage._previousToken) }() + case 9: try { try decoder.decodeSingularMessageField(value: &_storage._nextToken) }() + 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._tokenID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + try { if let v = _storage._accountID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if _storage._balance != 0 { + try visitor.visitSingularInt64Field(value: _storage._balance, fieldNumber: 3) + } + if _storage._frozen != false { + try visitor.visitSingularBoolField(value: _storage._frozen, fieldNumber: 4) + } + if _storage._kycGranted != false { + try visitor.visitSingularBoolField(value: _storage._kycGranted, fieldNumber: 5) + } + if _storage._deleted != false { + try visitor.visitSingularBoolField(value: _storage._deleted, fieldNumber: 6) + } + if _storage._automaticAssociation != false { + try visitor.visitSingularBoolField(value: _storage._automaticAssociation, fieldNumber: 7) + } + try { if let v = _storage._previousToken { + try visitor.visitSingularMessageField(value: v, fieldNumber: 8) + } }() + try { if let v = _storage._nextToken { + try visitor.visitSingularMessageField(value: v, fieldNumber: 9) + } }() + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TokenRelation, rhs: Proto_TokenRelation) -> 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._tokenID != rhs_storage._tokenID {return false} + if _storage._accountID != rhs_storage._accountID {return false} + if _storage._balance != rhs_storage._balance {return false} + if _storage._frozen != rhs_storage._frozen {return false} + if _storage._kycGranted != rhs_storage._kycGranted {return false} + if _storage._deleted != rhs_storage._deleted {return false} + if _storage._automaticAssociation != rhs_storage._automaticAssociation {return false} + if _storage._previousToken != rhs_storage._previousToken {return false} + if _storage._nextToken != rhs_storage._nextToken {return false} + return true + } + if !storagesAreEqual {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 aba9b2cf..1201fba3 100644 --- a/Sources/HederaProtobufs/Services/token_create.pb.swift +++ b/Sources/HederaProtobufs/Services/token_create.pb.swift @@ -277,6 +277,25 @@ public struct Proto_TokenCreateTransactionBody { /// Clears the value of `pauseKey`. Subsequent reads from it will return its default value. public mutating func clearPauseKey() {_uniqueStorage()._pauseKey = nil} + ///* + /// Metadata of the created token definition. + public var metadata: Data { + get {return _storage._metadata} + set {_uniqueStorage()._metadata = newValue} + } + + ///* + /// The key which can change the metadata of a token + /// (token definition, partition definition, and individual NFTs). + public var metadataKey: Proto_Key { + get {return _storage._metadataKey ?? Proto_Key()} + set {_uniqueStorage()._metadataKey = newValue} + } + /// Returns true if `metadataKey` has been explicitly set. + public var hasMetadataKey: Bool {return _storage._metadataKey != nil} + /// Clears the value of `metadataKey`. Subsequent reads from it will return its default value. + public mutating func clearMetadataKey() {_uniqueStorage()._metadataKey = nil} + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -316,6 +335,8 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf 20: .standard(proto: "fee_schedule_key"), 21: .standard(proto: "custom_fees"), 22: .standard(proto: "pause_key"), + 23: .same(proto: "metadata"), + 24: .standard(proto: "metadata_key"), ] fileprivate class _StorageClass { @@ -340,6 +361,8 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf var _feeScheduleKey: Proto_Key? = nil var _customFees: [Proto_CustomFee] = [] var _pauseKey: Proto_Key? = nil + var _metadata: Data = Data() + var _metadataKey: Proto_Key? = nil static let defaultInstance = _StorageClass() @@ -367,6 +390,8 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf _feeScheduleKey = source._feeScheduleKey _customFees = source._customFees _pauseKey = source._pauseKey + _metadata = source._metadata + _metadataKey = source._metadataKey } } @@ -406,6 +431,8 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf case 20: try { try decoder.decodeSingularMessageField(value: &_storage._feeScheduleKey) }() case 21: try { try decoder.decodeRepeatedMessageField(value: &_storage._customFees) }() case 22: try { try decoder.decodeSingularMessageField(value: &_storage._pauseKey) }() + case 23: try { try decoder.decodeSingularBytesField(value: &_storage._metadata) }() + case 24: try { try decoder.decodeSingularMessageField(value: &_storage._metadataKey) }() default: break } } @@ -481,6 +508,12 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf try { if let v = _storage._pauseKey { try visitor.visitSingularMessageField(value: v, fieldNumber: 22) } }() + if !_storage._metadata.isEmpty { + try visitor.visitSingularBytesField(value: _storage._metadata, fieldNumber: 23) + } + try { if let v = _storage._metadataKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 24) + } }() } try unknownFields.traverse(visitor: &visitor) } @@ -511,6 +544,8 @@ extension Proto_TokenCreateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf if _storage._feeScheduleKey != rhs_storage._feeScheduleKey {return false} if _storage._customFees != rhs_storage._customFees {return false} if _storage._pauseKey != rhs_storage._pauseKey {return false} + if _storage._metadata != rhs_storage._metadata {return false} + if _storage._metadataKey != rhs_storage._metadataKey {return false} return true } if !storagesAreEqual {return false} diff --git a/Sources/HederaProtobufs/Services/token_get_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_info.pb.swift index ce7dd169..18fb642a 100644 --- a/Sources/HederaProtobufs/Services/token_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_info.pb.swift @@ -311,6 +311,25 @@ public struct Proto_TokenInfo { set {_uniqueStorage()._ledgerID = newValue} } + ///* + /// Represents the metadata of the token definition. + public var metadata: Data { + get {return _storage._metadata} + set {_uniqueStorage()._metadata = newValue} + } + + ///* + /// The key which can change the metadata of a token + /// (token definition and individual NFTs). + public var metadataKey: Proto_Key { + get {return _storage._metadataKey ?? Proto_Key()} + set {_uniqueStorage()._metadataKey = newValue} + } + /// Returns true if `metadataKey` has been explicitly set. + public var hasMetadataKey: Bool {return _storage._metadataKey != nil} + /// Clears the value of `metadataKey`. Subsequent reads from it will return its default value. + public mutating func clearMetadataKey() {_uniqueStorage()._metadataKey = nil} + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -437,6 +456,8 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen 24: .standard(proto: "pause_key"), 25: .standard(proto: "pause_status"), 26: .standard(proto: "ledger_id"), + 27: .same(proto: "metadata"), + 28: .standard(proto: "metadata_key"), ] fileprivate class _StorageClass { @@ -466,6 +487,8 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen var _pauseKey: Proto_Key? = nil var _pauseStatus: Proto_TokenPauseStatus = .pauseNotApplicable var _ledgerID: Data = Data() + var _metadata: Data = Data() + var _metadataKey: Proto_Key? = nil static let defaultInstance = _StorageClass() @@ -498,6 +521,8 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen _pauseKey = source._pauseKey _pauseStatus = source._pauseStatus _ledgerID = source._ledgerID + _metadata = source._metadata + _metadataKey = source._metadataKey } } @@ -542,6 +567,8 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen case 24: try { try decoder.decodeSingularMessageField(value: &_storage._pauseKey) }() case 25: try { try decoder.decodeSingularEnumField(value: &_storage._pauseStatus) }() case 26: try { try decoder.decodeSingularBytesField(value: &_storage._ledgerID) }() + case 27: try { try decoder.decodeSingularBytesField(value: &_storage._metadata) }() + case 28: try { try decoder.decodeSingularMessageField(value: &_storage._metadataKey) }() default: break } } @@ -632,6 +659,12 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen if !_storage._ledgerID.isEmpty { try visitor.visitSingularBytesField(value: _storage._ledgerID, fieldNumber: 26) } + if !_storage._metadata.isEmpty { + try visitor.visitSingularBytesField(value: _storage._metadata, fieldNumber: 27) + } + try { if let v = _storage._metadataKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 28) + } }() } try unknownFields.traverse(visitor: &visitor) } @@ -667,6 +700,8 @@ extension Proto_TokenInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplemen if _storage._pauseKey != rhs_storage._pauseKey {return false} if _storage._pauseStatus != rhs_storage._pauseStatus {return false} if _storage._ledgerID != rhs_storage._ledgerID {return false} + if _storage._metadata != rhs_storage._metadata {return false} + if _storage._metadataKey != rhs_storage._metadataKey {return false} return true } if !storagesAreEqual {return false} diff --git a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift index 891c3644..d513a250 100644 --- a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift @@ -20,35 +20,6 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -///* -/// Represents an NFT on the Ledger -public struct Proto_NftID { - // 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 (non-fungible) token of which this NFT is an instance - public var tokenID: Proto_TokenID { - get {return _tokenID ?? Proto_TokenID()} - set {_tokenID = newValue} - } - /// Returns true if `tokenID` has been explicitly set. - public var hasTokenID: Bool {return self._tokenID != nil} - /// Clears the value of `tokenID`. Subsequent reads from it will return its default value. - public mutating func clearTokenID() {self._tokenID = nil} - - ///* - /// The unique identifier of this instance - public var serialNumber: Int64 = 0 - - public var unknownFields = SwiftProtobuf.UnknownStorage() - - public init() {} - - fileprivate var _tokenID: Proto_TokenID? = nil -} - ///* /// Applicable only to tokens of type NON_FUNGIBLE_UNIQUE. Gets info on a NFT for a given TokenID (of /// type NON_FUNGIBLE_UNIQUE) and serial number @@ -195,7 +166,6 @@ public struct Proto_TokenGetNftInfoResponse { } #if swift(>=5.5) && canImport(_Concurrency) -extension Proto_NftID: @unchecked Sendable {} extension Proto_TokenGetNftInfoQuery: @unchecked Sendable {} extension Proto_TokenNftInfo: @unchecked Sendable {} extension Proto_TokenGetNftInfoResponse: @unchecked Sendable {} @@ -205,48 +175,6 @@ extension Proto_TokenGetNftInfoResponse: @unchecked Sendable {} fileprivate let _protobuf_package = "proto" -extension Proto_NftID: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { - public static let protoMessageName: String = _protobuf_package + ".NftID" - public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ - 1: .same(proto: "tokenID"), - 2: .same(proto: "serialNumber"), - ] - - 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._tokenID) }() - case 2: try { try decoder.decodeSingularInt64Field(value: &self.serialNumber) }() - 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._tokenID { - try visitor.visitSingularMessageField(value: v, fieldNumber: 1) - } }() - if self.serialNumber != 0 { - try visitor.visitSingularInt64Field(value: self.serialNumber, fieldNumber: 2) - } - try unknownFields.traverse(visitor: &visitor) - } - - public static func ==(lhs: Proto_NftID, rhs: Proto_NftID) -> Bool { - if lhs._tokenID != rhs._tokenID {return false} - if lhs.serialNumber != rhs.serialNumber {return false} - if lhs.unknownFields != rhs.unknownFields {return false} - return true - } -} - extension Proto_TokenGetNftInfoQuery: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { public static let protoMessageName: String = _protobuf_package + ".TokenGetNftInfoQuery" public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ diff --git a/Sources/HederaProtobufs/Services/token_update.pb.swift b/Sources/HederaProtobufs/Services/token_update.pb.swift index e7327350..344f61f7 100644 --- a/Sources/HederaProtobufs/Services/token_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_update.pb.swift @@ -217,6 +217,31 @@ public struct Proto_TokenUpdateTransactionBody { /// Clears the value of `pauseKey`. Subsequent reads from it will return its default value. public mutating func clearPauseKey() {_uniqueStorage()._pauseKey = nil} + ///* + /// Metadata of the created token definition + public var metadata: SwiftProtobuf.Google_Protobuf_BytesValue { + get {return _storage._metadata ?? SwiftProtobuf.Google_Protobuf_BytesValue()} + set {_uniqueStorage()._metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + public var hasMetadata: Bool {return _storage._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + public mutating func clearMetadata() {_uniqueStorage()._metadata = nil} + + ///* + /// The key which can change the metadata of a token + /// (token definition, partition definition, and individual NFTs). + /// If the Token does not have currently a Metadata key, + /// transaction will resolve to TOKEN_HAS_NO_METADATA_KEY + public var metadataKey: Proto_Key { + get {return _storage._metadataKey ?? Proto_Key()} + set {_uniqueStorage()._metadataKey = newValue} + } + /// Returns true if `metadataKey` has been explicitly set. + public var hasMetadataKey: Bool {return _storage._metadataKey != nil} + /// Clears the value of `metadataKey`. Subsequent reads from it will return its default value. + public mutating func clearMetadataKey() {_uniqueStorage()._metadataKey = nil} + public var unknownFields = SwiftProtobuf.UnknownStorage() public init() {} @@ -250,6 +275,8 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf 13: .same(proto: "memo"), 14: .standard(proto: "fee_schedule_key"), 15: .standard(proto: "pause_key"), + 16: .same(proto: "metadata"), + 17: .standard(proto: "metadata_key"), ] fileprivate class _StorageClass { @@ -268,6 +295,8 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf var _memo: SwiftProtobuf.Google_Protobuf_StringValue? = nil var _feeScheduleKey: Proto_Key? = nil var _pauseKey: Proto_Key? = nil + var _metadata: SwiftProtobuf.Google_Protobuf_BytesValue? = nil + var _metadataKey: Proto_Key? = nil static let defaultInstance = _StorageClass() @@ -289,6 +318,8 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf _memo = source._memo _feeScheduleKey = source._feeScheduleKey _pauseKey = source._pauseKey + _metadata = source._metadata + _metadataKey = source._metadataKey } } @@ -322,6 +353,8 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf case 13: try { try decoder.decodeSingularMessageField(value: &_storage._memo) }() case 14: try { try decoder.decodeSingularMessageField(value: &_storage._feeScheduleKey) }() case 15: try { try decoder.decodeSingularMessageField(value: &_storage._pauseKey) }() + case 16: try { try decoder.decodeSingularMessageField(value: &_storage._metadata) }() + case 17: try { try decoder.decodeSingularMessageField(value: &_storage._metadataKey) }() default: break } } @@ -379,6 +412,12 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf try { if let v = _storage._pauseKey { try visitor.visitSingularMessageField(value: v, fieldNumber: 15) } }() + try { if let v = _storage._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 16) + } }() + try { if let v = _storage._metadataKey { + try visitor.visitSingularMessageField(value: v, fieldNumber: 17) + } }() } try unknownFields.traverse(visitor: &visitor) } @@ -403,6 +442,8 @@ extension Proto_TokenUpdateTransactionBody: SwiftProtobuf.Message, SwiftProtobuf if _storage._memo != rhs_storage._memo {return false} if _storage._feeScheduleKey != rhs_storage._feeScheduleKey {return false} if _storage._pauseKey != rhs_storage._pauseKey {return false} + if _storage._metadata != rhs_storage._metadata {return false} + if _storage._metadataKey != rhs_storage._metadataKey {return false} return true } if !storagesAreEqual {return false} diff --git a/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift b/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift new file mode 100644 index 00000000..f8b39bb9 --- /dev/null +++ b/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift @@ -0,0 +1,127 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: token_update_nfts.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 +} + +///* +/// At consensus, updates an already created Non Fungible Token to the given values. +/// +/// If no value is given for a field, that field is left unchanged. +/// Only certain fields such as metadata can be updated. +/// +/// Updating the metadata of an NFT does not affect its ownership or transferability. +/// This operation is intended for updating attributes of individual NFTs in a collection. +/// +/// --- Signing Requirements --- +/// 1. To update metadata of an NFT, the metadata_key of the token should sign the transaction. +public struct Proto_TokenUpdateNftsTransactionBody { + // 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 token for which to update NFTs. + public var token: Proto_TokenID { + get {return _token ?? Proto_TokenID()} + set {_token = newValue} + } + /// Returns true if `token` has been explicitly set. + public var hasToken: Bool {return self._token != nil} + /// Clears the value of `token`. Subsequent reads from it will return its default value. + public mutating func clearToken() {self._token = nil} + + ///* + /// The list of serial numbers to be updated. + public var serialNumbers: [Int64] = [] + + ///* + /// The new metadata of the NFT(s) + public var metadata: SwiftProtobuf.Google_Protobuf_BytesValue { + get {return _metadata ?? SwiftProtobuf.Google_Protobuf_BytesValue()} + set {_metadata = newValue} + } + /// Returns true if `metadata` has been explicitly set. + public var hasMetadata: Bool {return self._metadata != nil} + /// Clears the value of `metadata`. Subsequent reads from it will return its default value. + public mutating func clearMetadata() {self._metadata = nil} + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _token: Proto_TokenID? = nil + fileprivate var _metadata: SwiftProtobuf.Google_Protobuf_BytesValue? = nil +} + +#if swift(>=5.5) && canImport(_Concurrency) +extension Proto_TokenUpdateNftsTransactionBody: @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_TokenUpdateNftsTransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TokenUpdateNftsTransactionBody" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "token"), + 2: .standard(proto: "serial_numbers"), + 3: .same(proto: "metadata"), + ] + + 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._token) }() + case 2: try { try decoder.decodeRepeatedInt64Field(value: &self.serialNumbers) }() + case 3: try { try decoder.decodeSingularMessageField(value: &self._metadata) }() + 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._token { + try visitor.visitSingularMessageField(value: v, fieldNumber: 1) + } }() + if !self.serialNumbers.isEmpty { + try visitor.visitPackedInt64Field(value: self.serialNumbers, fieldNumber: 2) + } + try { if let v = self._metadata { + try visitor.visitSingularMessageField(value: v, fieldNumber: 3) + } }() + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TokenUpdateNftsTransactionBody, rhs: Proto_TokenUpdateNftsTransactionBody) -> Bool { + if lhs._token != rhs._token {return false} + if lhs.serialNumbers != rhs.serialNumbers {return false} + if lhs._metadata != rhs._metadata {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/transaction.pb.swift b/Sources/HederaProtobufs/Services/transaction.pb.swift index 4bcfc428..9eac5db6 100644 --- a/Sources/HederaProtobufs/Services/transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction.pb.swift @@ -34,7 +34,7 @@ public struct Proto_Transaction { // methods supported on all messages. ///* - /// the body of the transaction, which needs to be signed + /// The body of the transaction, which needs to be signed public var body: Proto_TransactionBody { get {return _body ?? Proto_TransactionBody()} set {_body = newValue} diff --git a/Sources/HederaProtobufs/Services/transaction_body.pb.swift b/Sources/HederaProtobufs/Services/transaction_body.pb.swift index edbad809..2826709c 100644 --- a/Sources/HederaProtobufs/Services/transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_body.pb.swift @@ -542,6 +542,16 @@ public struct Proto_TransactionBody { set {_uniqueStorage()._data = .utilPrng(newValue)} } + ///* + /// Update the metadata of one or more NFT's of a specific token type. + public var tokenUpdateNfts: Proto_TokenUpdateNftsTransactionBody { + get { + if case .tokenUpdateNfts(let v)? = _storage._data {return v} + return Proto_TokenUpdateNftsTransactionBody() + } + set {_uniqueStorage()._data = .tokenUpdateNfts(newValue)} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* @@ -682,6 +692,9 @@ public struct Proto_TransactionBody { ///* /// Generates a pseudorandom number. case utilPrng(Proto_UtilPrngTransactionBody) + ///* + /// Update the metadata of one or more NFT's of a specific token type. + case tokenUpdateNfts(Proto_TokenUpdateNftsTransactionBody) #if !swift(>=4.1) public static func ==(lhs: Proto_TransactionBody.OneOf_Data, rhs: Proto_TransactionBody.OneOf_Data) -> Bool { @@ -869,6 +882,10 @@ public struct Proto_TransactionBody { guard case .utilPrng(let l) = lhs, case .utilPrng(let r) = rhs else { preconditionFailure() } return l == r }() + case (.tokenUpdateNfts, .tokenUpdateNfts): return { + guard case .tokenUpdateNfts(let l) = lhs, case .tokenUpdateNfts(let r) = rhs else { preconditionFailure() } + return l == r + }() default: return false } } @@ -943,6 +960,7 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm 44: .same(proto: "scheduleSign"), 51: .standard(proto: "node_stake_update"), 52: .standard(proto: "util_prng"), + 53: .standard(proto: "token_update_nfts"), ] fileprivate class _StorageClass { @@ -1575,6 +1593,19 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm _storage._data = .utilPrng(v) } }() + case 53: try { + var v: Proto_TokenUpdateNftsTransactionBody? + var hadOneofValue = false + if let current = _storage._data { + hadOneofValue = true + if case .tokenUpdateNfts(let m) = current {v = m} + } + try decoder.decodeSingularMessageField(value: &v) + if let v = v { + if hadOneofValue {try decoder.handleConflictingOneOf()} + _storage._data = .tokenUpdateNfts(v) + } + }() default: break } } @@ -1786,6 +1817,10 @@ extension Proto_TransactionBody: SwiftProtobuf.Message, SwiftProtobuf._MessageIm guard case .utilPrng(let v)? = _storage._data else { preconditionFailure() } try visitor.visitSingularMessageField(value: v, fieldNumber: 52) }() + case .tokenUpdateNfts?: try { + guard case .tokenUpdateNfts(let v)? = _storage._data else { preconditionFailure() } + try visitor.visitSingularMessageField(value: v, fieldNumber: 53) + }() case nil: break } } diff --git a/Tests/HederaE2ETests/Account/Account.swift b/Tests/HederaE2ETests/Account/Account.swift index 1a0b0268..a5f41a7e 100644 --- a/Tests/HederaE2ETests/Account/Account.swift +++ b/Tests/HederaE2ETests/Account/Account.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountAllowanceApprove.swift b/Tests/HederaE2ETests/Account/AccountAllowanceApprove.swift index 534dd94a..6beab669 100644 --- a/Tests/HederaE2ETests/Account/AccountAllowanceApprove.swift +++ b/Tests/HederaE2ETests/Account/AccountAllowanceApprove.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountBalance.swift b/Tests/HederaE2ETests/Account/AccountBalance.swift index 22edb6fe..14906cad 100644 --- a/Tests/HederaE2ETests/Account/AccountBalance.swift +++ b/Tests/HederaE2ETests/Account/AccountBalance.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountCreate.swift b/Tests/HederaE2ETests/Account/AccountCreate.swift index e25b0b83..496359e3 100644 --- a/Tests/HederaE2ETests/Account/AccountCreate.swift +++ b/Tests/HederaE2ETests/Account/AccountCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountDelete.swift b/Tests/HederaE2ETests/Account/AccountDelete.swift index b6ca23c4..7811728f 100644 --- a/Tests/HederaE2ETests/Account/AccountDelete.swift +++ b/Tests/HederaE2ETests/Account/AccountDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountInfo.swift b/Tests/HederaE2ETests/Account/AccountInfo.swift index 316a16b9..88729bf5 100644 --- a/Tests/HederaE2ETests/Account/AccountInfo.swift +++ b/Tests/HederaE2ETests/Account/AccountInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Account/AccountUpdate.swift b/Tests/HederaE2ETests/Account/AccountUpdate.swift index 6014fc1b..1ed07182 100644 --- a/Tests/HederaE2ETests/Account/AccountUpdate.swift +++ b/Tests/HederaE2ETests/Account/AccountUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -78,10 +78,10 @@ internal final class AccountUpdate: XCTestCase { let testEnv = try TestEnvironment.nonFree await assertThrowsHErrorAsync( - try await AccountUpdateTransaction().execute(testEnv.client).getReceipt(testEnv.client) + try await AccountUpdateTransaction().execute(testEnv.client) ) { error in - guard case .receiptStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.receiptStatus`") + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") return } diff --git a/Tests/HederaE2ETests/Config.swift b/Tests/HederaE2ETests/Config.swift index 85b151e9..6e8e3852 100644 --- a/Tests/HederaE2ETests/Config.swift +++ b/Tests/HederaE2ETests/Config.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/Contract.swift b/Tests/HederaE2ETests/Contract/Contract.swift index c3df87ea..6b808f05 100644 --- a/Tests/HederaE2ETests/Contract/Contract.swift +++ b/Tests/HederaE2ETests/Contract/Contract.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/ContractBytecode.swift b/Tests/HederaE2ETests/Contract/ContractBytecode.swift new file mode 100644 index 00000000..869bcf57 --- /dev/null +++ b/Tests/HederaE2ETests/Contract/ContractBytecode.swift @@ -0,0 +1,157 @@ +/* + * ‌ + * 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 Hedera +import XCTest + +internal final class ContractBytecode: XCTestCase { + internal func testQuery() async throws { + let testEnv = try TestEnvironment.nonFree + + let fileCreateReceipt = try await FileCreateTransaction() + .keys([.single(testEnv.operator.privateKey.publicKey)]) + .contents(ContractHelpers.bytecode) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let fileId = try XCTUnwrap(fileCreateReceipt.fileId) + + let receipt = try await ContractCreateTransaction() + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .gas(200000) + .constructorParameters(ContractFunctionParameters().addString("Hello from Hedera.")) + .bytecodeFileId(fileId) + .contractMemo("[e2e::ContractCreateTransaction]") + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let contractId = try XCTUnwrap(receipt.contractId) + + let bytecode = try await ContractBytecodeQuery() + .contractId(contractId) + .execute(testEnv.client) + + XCTAssertEqual(bytecode.count, 798) + + addTeardownBlock { + _ = try await ContractDeleteTransaction(contractId: contractId) + .transferAccountId(testEnv.operator.accountId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await FileDeleteTransaction(fileId: fileId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + } + } + + internal func testGetCostBigMaxQuery() async throws { + let testEnv = try TestEnvironment.nonFree + + let fileCreateReceipt = try await FileCreateTransaction() + .keys([.single(testEnv.operator.privateKey.publicKey)]) + .contents(ContractHelpers.bytecode) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let fileId = try XCTUnwrap(fileCreateReceipt.fileId) + + let receipt = try await ContractCreateTransaction() + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .gas(200000) + .constructorParameters(ContractFunctionParameters().addString("Hello from Hedera.")) + .bytecodeFileId(fileId) + .contractMemo("[e2e::ContractCreateTransaction]") + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let contractId = try XCTUnwrap(receipt.contractId) + + let bytecodeQuery = ContractBytecodeQuery() + .contractId(contractId) + .maxPaymentAmount(Hbar(1000)) + + let cost = try await bytecodeQuery.getCost(testEnv.client) + + let bytecode = try await bytecodeQuery.paymentAmount(cost).execute(testEnv.client) + + XCTAssertEqual(bytecode.count, 798) + + addTeardownBlock { + _ = try await ContractDeleteTransaction(contractId: contractId) + .transferAccountId(testEnv.operator.accountId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await FileDeleteTransaction(fileId: fileId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + } + } + + internal func testGetCostSmallMaxQuery() async throws { + let testEnv = try TestEnvironment.nonFree + + let fileCreateReceipt = try await FileCreateTransaction() + .keys([.single(testEnv.operator.privateKey.publicKey)]) + .contents(ContractHelpers.bytecode) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let fileId = try XCTUnwrap(fileCreateReceipt.fileId) + + let receipt = try await ContractCreateTransaction() + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .gas(200000) + .constructorParameters(ContractFunctionParameters().addString("Hello from Hedera.")) + .bytecodeFileId(fileId) + .contractMemo("[e2e::ContractCreateTransaction]") + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let contractId = try XCTUnwrap(receipt.contractId) + + let bytecodeQuery = ContractBytecodeQuery() + .contractId(contractId) + .maxPaymentAmount(Hbar.fromTinybars(1)) + + let cost = try await bytecodeQuery.getCost(testEnv.client) + + await assertThrowsHErrorAsync( + try await bytecodeQuery.execute(testEnv.client), + "expected error querying contract bytecode" + ) { error in + // note: there's a very small chance this fails if the cost of a AccountInfoQuery changes right when we execute it. + XCTAssertEqual(error.kind, .maxQueryPaymentExceeded(queryCost: cost, maxQueryPayment: .fromTinybars(1))) + } + + addTeardownBlock { + _ = try await ContractDeleteTransaction(contractId: contractId) + .transferAccountId(testEnv.operator.accountId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await FileDeleteTransaction(fileId: fileId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + } + } + +} diff --git a/Tests/HederaE2ETests/Contract/ContractCreate.swift b/Tests/HederaE2ETests/Contract/ContractCreate.swift index 26bf3c0f..1f32ce5b 100644 --- a/Tests/HederaE2ETests/Contract/ContractCreate.swift +++ b/Tests/HederaE2ETests/Contract/ContractCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -60,7 +60,7 @@ internal final class ContractCreate: XCTestCase { let bytecode = try await File.forContent(ContractHelpers.bytecode, testEnv) let receipt = try await ContractCreateTransaction() - .gas(100000) + .gas(200000) .constructorParameters(ContractFunctionParameters().addString("Hello from Hedera.")) .bytecodeFileId(bytecode.fileId) .contractMemo("[e2e::ContractCreateTransaction]") @@ -80,7 +80,6 @@ internal final class ContractCreate: XCTestCase { XCTAssertNotNil(info.adminKey) XCTAssertEqual(info.storage, 128) XCTAssertEqual(info.contractMemo, "[e2e::ContractCreateTransaction]") - } internal func testUnsetGasFails() async throws { diff --git a/Tests/HederaE2ETests/Contract/ContractCreateFlow.swift b/Tests/HederaE2ETests/Contract/ContractCreateFlow.swift index ad9f100c..dbc401fb 100644 --- a/Tests/HederaE2ETests/Contract/ContractCreateFlow.swift +++ b/Tests/HederaE2ETests/Contract/ContractCreateFlow.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/ContractDelete.swift b/Tests/HederaE2ETests/Contract/ContractDelete.swift index c0905c2c..75d304a8 100644 --- a/Tests/HederaE2ETests/Contract/ContractDelete.swift +++ b/Tests/HederaE2ETests/Contract/ContractDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/ContractExecute.swift b/Tests/HederaE2ETests/Contract/ContractExecute.swift index 73f56c20..b6601781 100644 --- a/Tests/HederaE2ETests/Contract/ContractExecute.swift +++ b/Tests/HederaE2ETests/Contract/ContractExecute.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -47,12 +47,11 @@ internal final class ContractExecute: XCTestCase { await assertThrowsHErrorAsync( try await ContractExecuteTransaction(gas: 200000) .function("setMessage", ContractFunctionParameters().addString("new message")) - .execute(testEnv.client) - .getReceipt(testEnv.client), + .execute(testEnv.client), "expected error executing contract" ) { error in - guard case .receiptStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.receiptStatus`") + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") return } diff --git a/Tests/HederaE2ETests/Contract/ContractInfo.swift b/Tests/HederaE2ETests/Contract/ContractInfo.swift index da265974..6f37b56c 100644 --- a/Tests/HederaE2ETests/Contract/ContractInfo.swift +++ b/Tests/HederaE2ETests/Contract/ContractInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/ContractNonceInfo.swift b/Tests/HederaE2ETests/Contract/ContractNonceInfo.swift index d9b100ae..df279108 100644 --- a/Tests/HederaE2ETests/Contract/ContractNonceInfo.swift +++ b/Tests/HederaE2ETests/Contract/ContractNonceInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Contract/ContractUpdate.swift b/Tests/HederaE2ETests/Contract/ContractUpdate.swift index 0bb328e5..ae4aa5a0 100644 --- a/Tests/HederaE2ETests/Contract/ContractUpdate.swift +++ b/Tests/HederaE2ETests/Contract/ContractUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/EthereumTransaction.swift b/Tests/HederaE2ETests/EthereumTransaction.swift index 8344f469..080490d8 100644 --- a/Tests/HederaE2ETests/EthereumTransaction.swift +++ b/Tests/HederaE2ETests/EthereumTransaction.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/FeeSchedules.swift b/Tests/HederaE2ETests/FeeSchedules.swift new file mode 100644 index 00000000..726bfde4 --- /dev/null +++ b/Tests/HederaE2ETests/FeeSchedules.swift @@ -0,0 +1,35 @@ +/* + * ‌ + * 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 Hedera +import XCTest + +internal class FeeSchedulesQuery: XCTestCase { + internal func testBasic() async throws { + let testEnv = try TestEnvironment.nonFree + + let feeScheduleBytes = + try await FileContentsQuery().fileId(FileId.fromString("0.0.111")).execute(testEnv.client) + + let feeSchedules = try FeeSchedules.fromBytes(feeScheduleBytes.contents) + + XCTAssertNotNil(feeSchedules.current) + } +} diff --git a/Tests/HederaE2ETests/File/File.swift b/Tests/HederaE2ETests/File/File.swift index d147b2f4..2508e98f 100644 --- a/Tests/HederaE2ETests/File/File.swift +++ b/Tests/HederaE2ETests/File/File.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/File/FileAppend.swift b/Tests/HederaE2ETests/File/FileAppend.swift index 194b7b48..a111dcf1 100644 --- a/Tests/HederaE2ETests/File/FileAppend.swift +++ b/Tests/HederaE2ETests/File/FileAppend.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/File/FileContents.swift b/Tests/HederaE2ETests/File/FileContents.swift index c26b3954..efab9b2c 100644 --- a/Tests/HederaE2ETests/File/FileContents.swift +++ b/Tests/HederaE2ETests/File/FileContents.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/File/FileCreate.swift b/Tests/HederaE2ETests/File/FileCreate.swift index 01ec8393..38d6259e 100644 --- a/Tests/HederaE2ETests/File/FileCreate.swift +++ b/Tests/HederaE2ETests/File/FileCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/File/FileDelete.swift b/Tests/HederaE2ETests/File/FileDelete.swift index 820048cc..8347d629 100644 --- a/Tests/HederaE2ETests/File/FileDelete.swift +++ b/Tests/HederaE2ETests/File/FileDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -40,18 +40,26 @@ internal final class FileDelete: XCTestCase { let testEnv = try TestEnvironment.nonFree let receipt = try await FileCreateTransaction() - .contents("[swift::e2e::fileDelete::2]".data(using: .utf8)!) + .contents("[e2e::FileCreateTransaction]".data(using: .utf8)!) .execute(testEnv.client) .getReceipt(testEnv.client) let fileId = try XCTUnwrap(receipt.fileId) + let info = try await FileInfoQuery() + .fileId(fileId) + .execute(testEnv.client) + + XCTAssertEqual(info.fileId, fileId) + XCTAssertEqual(info.size, 28) + XCTAssertEqual(info.isDeleted, false) + XCTAssertEqual(info.keys, KeyList.init(keys: [])) + let file = File(fileId: fileId) await assertThrowsHErrorAsync( - try await FileUpdateTransaction() + try await FileDeleteTransaction() .fileId(file.fileId) - .contents(Data([0])) .execute(testEnv.client) .getReceipt(testEnv.client), "expected file update to fail" diff --git a/Tests/HederaE2ETests/File/FileInfo.swift b/Tests/HederaE2ETests/File/FileInfo.swift index b55c6fb8..e54a856e 100644 --- a/Tests/HederaE2ETests/File/FileInfo.swift +++ b/Tests/HederaE2ETests/File/FileInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/File/FileUpdate.swift b/Tests/HederaE2ETests/File/FileUpdate.swift index f4a19433..43502c6a 100644 --- a/Tests/HederaE2ETests/File/FileUpdate.swift +++ b/Tests/HederaE2ETests/File/FileUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -80,12 +80,11 @@ internal final class FileUpdate: XCTestCase { await assertThrowsHErrorAsync( try await FileUpdateTransaction() .contents("contents".data(using: .utf8)!) - .execute(testEnv.client) - .getReceipt(testEnv.client), + .execute(testEnv.client), "expected file update to fail" ) { error in - guard case .receiptStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.receiptStatus`") + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") return } diff --git a/Tests/HederaE2ETests/NetworkVersionInfo.swift b/Tests/HederaE2ETests/NetworkVersionInfo.swift index 4e17f330..05f6c4e3 100644 --- a/Tests/HederaE2ETests/NetworkVersionInfo.swift +++ b/Tests/HederaE2ETests/NetworkVersionInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/NodeAddressBook.swift b/Tests/HederaE2ETests/NodeAddressBook.swift index 7ed6dd2b..61395a76 100644 --- a/Tests/HederaE2ETests/NodeAddressBook.swift +++ b/Tests/HederaE2ETests/NodeAddressBook.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Prng.swift b/Tests/HederaE2ETests/Prng.swift index 48f6b6cd..97a0a40b 100644 --- a/Tests/HederaE2ETests/Prng.swift +++ b/Tests/HederaE2ETests/Prng.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Schedule/ScheduleCreate.swift b/Tests/HederaE2ETests/Schedule/ScheduleCreate.swift index bf5cf560..b8542308 100644 --- a/Tests/HederaE2ETests/Schedule/ScheduleCreate.swift +++ b/Tests/HederaE2ETests/Schedule/ScheduleCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Schedule/ScheduleDelete.swift b/Tests/HederaE2ETests/Schedule/ScheduleDelete.swift index 0b1f110d..e160bdc0 100644 --- a/Tests/HederaE2ETests/Schedule/ScheduleDelete.swift +++ b/Tests/HederaE2ETests/Schedule/ScheduleDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Schedule/ScheduleInfo.swift b/Tests/HederaE2ETests/Schedule/ScheduleInfo.swift index 38a39a79..259ed8d0 100644 --- a/Tests/HederaE2ETests/Schedule/ScheduleInfo.swift +++ b/Tests/HederaE2ETests/Schedule/ScheduleInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Schedule/ScheduleSign.swift b/Tests/HederaE2ETests/Schedule/ScheduleSign.swift index d42f52b1..d9e360f5 100644 --- a/Tests/HederaE2ETests/Schedule/ScheduleSign.swift +++ b/Tests/HederaE2ETests/Schedule/ScheduleSign.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -73,7 +73,7 @@ internal final class ScheduleSign: XCTestCase { _ = try XCTUnwrap(info.executedAt) // Check if signatures in schedule info - XCTAssertEqual(info.signatories, [.single(key1.publicKey), .single(key2.publicKey)]) + XCTAssertEqual(info.signatories.count, 2) } diff --git a/Tests/HederaE2ETests/Token/FungibleToken.swift b/Tests/HederaE2ETests/Token/FungibleToken.swift index e1d8058f..0465989f 100644 --- a/Tests/HederaE2ETests/Token/FungibleToken.swift +++ b/Tests/HederaE2ETests/Token/FungibleToken.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -30,6 +30,7 @@ internal struct FungibleToken { owner: Account, initialSupply: UInt64 = 0 ) async throws -> Self { + let metadataKey = PrivateKey.generateEd25519() let ownerKey = Key.single(owner.key.publicKey) let receipt = try await TokenCreateTransaction( name: "ffff", @@ -44,7 +45,9 @@ internal struct FungibleToken { supplyKey: ownerKey, freezeDefault: false, expirationTime: .now + .minutes(5), - feeScheduleKey: ownerKey + feeScheduleKey: ownerKey, + pauseKey: ownerKey, + metadataKey: Key.single(metadataKey.publicKey) ) .sign(owner.key) .execute(testEnv.client) diff --git a/Tests/HederaE2ETests/Token/Nft.swift b/Tests/HederaE2ETests/Token/Nft.swift index c0f7b8bf..4efe68af 100644 --- a/Tests/HederaE2ETests/Token/Nft.swift +++ b/Tests/HederaE2ETests/Token/Nft.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenAssociate.swift b/Tests/HederaE2ETests/Token/TokenAssociate.swift index a6add442..9721ac58 100644 --- a/Tests/HederaE2ETests/Token/TokenAssociate.swift +++ b/Tests/HederaE2ETests/Token/TokenAssociate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenBurn.swift b/Tests/HederaE2ETests/Token/TokenBurn.swift index c354fc7d..04a488a8 100644 --- a/Tests/HederaE2ETests/Token/TokenBurn.swift +++ b/Tests/HederaE2ETests/Token/TokenBurn.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenCreate.swift b/Tests/HederaE2ETests/Token/TokenCreate.swift index 3035dcc4..2414e01c 100644 --- a/Tests/HederaE2ETests/Token/TokenCreate.swift +++ b/Tests/HederaE2ETests/Token/TokenCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -79,11 +79,11 @@ internal final class TokenCreate: XCTestCase { .symbol("F") .treasuryAccountId(account.id) .expirationTime(.now + .minutes(5)) - .sign(account.key).execute(testEnv.client), + .sign(account.key).execute(testEnv.client).getReceipt(testEnv.client), "expected error creating token" ) { error in - guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.missingTokenName`") + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") return } @@ -101,11 +101,11 @@ internal final class TokenCreate: XCTestCase { .name("ffff") .treasuryAccountId(account.id) .expirationTime(.now + .minutes(5)) - .sign(account.key).execute(testEnv.client), + .sign(account.key).execute(testEnv.client).getReceipt(testEnv.client), "expected error creating token" ) { error in - guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `transactionPreCheckStatus`") + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `receiptStatus`") return } diff --git a/Tests/HederaE2ETests/Token/TokenDelete.swift b/Tests/HederaE2ETests/Token/TokenDelete.swift index d7f542b3..706c0472 100644 --- a/Tests/HederaE2ETests/Token/TokenDelete.swift +++ b/Tests/HederaE2ETests/Token/TokenDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenDissociate.swift b/Tests/HederaE2ETests/Token/TokenDissociate.swift index 1510f49d..2c5ad835 100644 --- a/Tests/HederaE2ETests/Token/TokenDissociate.swift +++ b/Tests/HederaE2ETests/Token/TokenDissociate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenFeeScheduleUpdate.swift b/Tests/HederaE2ETests/Token/TokenFeeScheduleUpdate.swift index b8b2ec2e..930d511e 100644 --- a/Tests/HederaE2ETests/Token/TokenFeeScheduleUpdate.swift +++ b/Tests/HederaE2ETests/Token/TokenFeeScheduleUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenFreeze.swift b/Tests/HederaE2ETests/Token/TokenFreeze.swift index 13eed2b3..024d7e63 100644 --- a/Tests/HederaE2ETests/Token/TokenFreeze.swift +++ b/Tests/HederaE2ETests/Token/TokenFreeze.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenGrantKyc.swift b/Tests/HederaE2ETests/Token/TokenGrantKyc.swift index 2154a305..da57b961 100644 --- a/Tests/HederaE2ETests/Token/TokenGrantKyc.swift +++ b/Tests/HederaE2ETests/Token/TokenGrantKyc.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenInfo.swift b/Tests/HederaE2ETests/Token/TokenInfo.swift index 9321346f..e2f67336 100644 --- a/Tests/HederaE2ETests/Token/TokenInfo.swift +++ b/Tests/HederaE2ETests/Token/TokenInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenMint.swift b/Tests/HederaE2ETests/Token/TokenMint.swift index aa738f5a..9e9391a8 100644 --- a/Tests/HederaE2ETests/Token/TokenMint.swift +++ b/Tests/HederaE2ETests/Token/TokenMint.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -230,8 +230,8 @@ internal class TokenMint: XCTestCase { .getReceipt(testEnv.client), "expected error minting token" ) { error in - guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") return } diff --git a/Tests/HederaE2ETests/Token/TokenNftInfo.swift b/Tests/HederaE2ETests/Token/TokenNftInfo.swift index 18ce576b..2252404a 100644 --- a/Tests/HederaE2ETests/Token/TokenNftInfo.swift +++ b/Tests/HederaE2ETests/Token/TokenNftInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenNftTransfer.swift b/Tests/HederaE2ETests/Token/TokenNftTransfer.swift index 87e6cad4..a4e87cc4 100644 --- a/Tests/HederaE2ETests/Token/TokenNftTransfer.swift +++ b/Tests/HederaE2ETests/Token/TokenNftTransfer.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenPause.swift b/Tests/HederaE2ETests/Token/TokenPause.swift index 99ef9ff9..133214c2 100644 --- a/Tests/HederaE2ETests/Token/TokenPause.swift +++ b/Tests/HederaE2ETests/Token/TokenPause.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenRevokeKyc.swift b/Tests/HederaE2ETests/Token/TokenRevokeKyc.swift index bf0ae30b..b9ce21f8 100644 --- a/Tests/HederaE2ETests/Token/TokenRevokeKyc.swift +++ b/Tests/HederaE2ETests/Token/TokenRevokeKyc.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenTransfer.swift b/Tests/HederaE2ETests/Token/TokenTransfer.swift index 5da6bf45..b768e242 100644 --- a/Tests/HederaE2ETests/Token/TokenTransfer.swift +++ b/Tests/HederaE2ETests/Token/TokenTransfer.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenUnfreeze.swift b/Tests/HederaE2ETests/Token/TokenUnfreeze.swift index 7545536b..7454c42e 100644 --- a/Tests/HederaE2ETests/Token/TokenUnfreeze.swift +++ b/Tests/HederaE2ETests/Token/TokenUnfreeze.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenUnpause.swift b/Tests/HederaE2ETests/Token/TokenUnpause.swift index 5d795d50..91acf565 100644 --- a/Tests/HederaE2ETests/Token/TokenUnpause.swift +++ b/Tests/HederaE2ETests/Token/TokenUnpause.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Token/TokenUpdate.swift b/Tests/HederaE2ETests/Token/TokenUpdate.swift index 40d3fac7..fd8ccd22 100644 --- a/Tests/HederaE2ETests/Token/TokenUpdate.swift +++ b/Tests/HederaE2ETests/Token/TokenUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -52,12 +52,14 @@ internal final class TokenUpdate: XCTestCase { XCTAssertEqual(info.supplyKey, .single(account.key.publicKey)) XCTAssertEqual(info.defaultFreezeStatus, false) XCTAssertEqual(info.defaultKycStatus, false) + } internal func testImmutableTokenFails() async throws { let testEnv = try TestEnvironment.nonFree - // can't delete the account because the token still exists, can't delete the token because there's no admin key. + // can't delete the account because the token still exists, + // can't delete the token because there's no admin key. let account = try await Account.create(testEnv) let receipt = try await TokenCreateTransaction( @@ -86,4 +88,51 @@ internal final class TokenUpdate: XCTestCase { XCTAssertEqual(status, .tokenIsImmutable) } } + + internal func testUpdateImmutableTokenMetadata() async throws { + let testEnv = try TestEnvironment.nonFree + + let initialMetadata = Data([1]) + let updatedMetadata = Data([1, 2]) + let metadataKey = PrivateKey.generateEd25519() + + // Create fungible token with metadata and metadata key. + // Note: The same flow can be executed with a + // TokenType.NON_FUNGIBLE_UNIQUE (i.e. HIP-765) + let tokenId = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.fungibleCommon) + .treasuryAccountId(testEnv.operator.accountId) + .decimals(3) + .initialSupply(100000) + .expirationTime(Timestamp.now + .hours(2)) + .metadata(initialMetadata) + .metadataKey(.single(metadataKey.publicKey)) + .execute(testEnv.client) + .getReceipt(testEnv.client) + .tokenId! + + let tokenInfoAfterCreation = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(testEnv.client) + + XCTAssertEqual(tokenInfoAfterCreation.metadata, initialMetadata) + XCTAssertEqual(tokenInfoAfterCreation.metadataKey, .single(metadataKey.publicKey)) + + // Update token's metadata + _ = try await TokenUpdateTransaction() + .tokenId(tokenId) + .metadata(updatedMetadata) + .freezeWith(testEnv.client) + .sign(metadataKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let tokenInfoAfterMetadataUpdate = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(testEnv.client) + + XCTAssertEqual(tokenInfoAfterMetadataUpdate.metadata, updatedMetadata) + } } diff --git a/Tests/HederaE2ETests/Token/TokenUpdateNfts.swift b/Tests/HederaE2ETests/Token/TokenUpdateNfts.swift new file mode 100644 index 00000000..0beaf7c8 --- /dev/null +++ b/Tests/HederaE2ETests/Token/TokenUpdateNfts.swift @@ -0,0 +1,220 @@ +/* + * ‌ + * 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 Hedera +import XCTest + +internal final class TokenUpdateNfts: XCTestCase { + internal func testUpdateNftMetadata() async throws { + let testEnv = try TestEnvironment.nonFree + + let metadataKey = PrivateKey.generateEd25519() + let nftCount = 4 + let initialMetadataList = + Array(repeating: Data([9, 1, 6]), count: nftCount) + let updatedMetadata = Data([3, 4]) + let updatedMetadataList = + Array(repeating: updatedMetadata, count: nftCount) + + // Create Token with metadata key included + let tokenCreateTxReceipt = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.nonFungibleUnique) + .treasuryAccountId(testEnv.operator.accountId) + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .supplyKey(.single(testEnv.operator.privateKey.publicKey)) + .metadataKey(.single(metadataKey.publicKey)) + .expirationTime(.now + .minutes(5)) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let tokenId = try XCTUnwrap(tokenCreateTxReceipt.tokenId) + + // Mint token + let tokenMintTxReceipt = try await TokenMintTransaction() + .metadata(initialMetadataList) + .tokenId(tokenId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(tokenMintTxReceipt.serials) + let metadataList = try await getMetadataList(testEnv.client, tokenId, nftSerials) + + XCTAssertEqual(metadataList, initialMetadataList) + + // Apply new serials & metadata Nft token + _ = try await TokenUpdateNftsTransaction() + .tokenId(tokenId) + .serials(nftSerials) + .metadata(updatedMetadata) + .freezeWith(testEnv.client) + .sign(metadataKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let newMetadataList = try await getMetadataList(testEnv.client, tokenId, nftSerials) + + XCTAssertEqual(newMetadataList, updatedMetadataList) + } + + internal func testCantUpdateMetadataNoSignedMetadataKey() async throws { + let testEnv = try TestEnvironment.nonFree + + let metadataKey = PrivateKey.generateEd25519() + let nftCount = 4 + let initialMetadataList = + Array(repeating: Data([9, 1, 6]), count: nftCount) + + let updatedMetadata = Data([3, 4]) + + // Create Token with metadata key + let tokenCreateTxReceipt = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.nonFungibleUnique) + .treasuryAccountId(testEnv.operator.accountId) + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .supplyKey(.single(testEnv.operator.privateKey.publicKey)) + .metadataKey(.single(metadataKey.publicKey)) + .expirationTime(.now + .minutes(5)) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let tokenId = try XCTUnwrap(tokenCreateTxReceipt.tokenId) + + let tokenInfo = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(testEnv.client) + + let setMetadataKey = try XCTUnwrap(tokenInfo.metadataKey) + + XCTAssertEqual(setMetadataKey, .single(metadataKey.publicKey)) + + // Mint token + let tokenMintTxReceipt = try await TokenMintTransaction() + .metadata(initialMetadataList) + .tokenId(tokenId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(tokenMintTxReceipt.serials) + + await assertThrowsHErrorAsync( + // Should fail without signature of metadata key + try await TokenUpdateNftsTransaction() + .tokenId(tokenId) + .serials(nftSerials) + .metadata(updatedMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("\(error.kind) is not `.receiptStatus(status: _)`") + return + } + + XCTAssertEqual(status, .invalidSignature) + } + } + + internal func testCantUpdateMetadataNoSetMetadataKey() async throws { + let testEnv = try TestEnvironment.nonFree + + let nftCount = 4 + let initialMetadataList = [ + Data(Array(repeating: [9, 1, 6], count: (nftCount / [9, 1, 6].count) + 1).flatMap { $0 }.prefix(nftCount)) + ] + let updatedMetadata = Data([3, 4]) + + // Create token with no set metadata key + let tokenCreateTxReceipt = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .tokenType(TokenType.nonFungibleUnique) + .treasuryAccountId(testEnv.operator.accountId) + .adminKey(.single(testEnv.operator.privateKey.publicKey)) + .supplyKey(.single(testEnv.operator.privateKey.publicKey)) + .expirationTime(.now + .minutes(5)) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let tokenId = try XCTUnwrap(tokenCreateTxReceipt.tokenId) + + let tokenInfo = try await TokenInfoQuery() + .tokenId(tokenId) + .execute(testEnv.client) + + XCTAssertEqual(tokenInfo.metadataKey, nil) + + // Mint token + let tokenMintTxReceipt = try await TokenMintTransaction() + .metadata(initialMetadataList) + .tokenId(tokenId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(tokenMintTxReceipt.serials) + + await assertThrowsHErrorAsync( + // Should fail without setting metadata key when updating Nft + try await TokenUpdateNftsTransaction() + .tokenId(tokenId) + .serials(nftSerials) + .metadata(updatedMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("\(error.kind) is not `.receiptStatus(status: _)`") + return + } + + XCTAssertEqual(status, .tokenHasNoMetadataKey) + } + } +} + +func getMetadataList(_ client: Client, _ tokenId: TokenId, _ serials: [UInt64]) async throws -> [Data] { + let metadataList: [Data] = try await withThrowingTaskGroup( + of: Data.self, + body: { group in + var results = [Data]() + + // Iterate over serials, launching a new task for each + for serial in serials { + group.addTask { + let nftId = NftId(tokenId: tokenId, serial: UInt64(serial)) + // Execute the query and return the result + return try await TokenNftInfoQuery().nftId(nftId).execute(client).metadata + } + } + + // Collect results from all tasks + for try await result in group { + results.append(result) + } + + return results + }) + + return metadataList +} diff --git a/Tests/HederaE2ETests/Token/TokenWipe.swift b/Tests/HederaE2ETests/Token/TokenWipe.swift index f7ba9ac7..fe1ef79a 100644 --- a/Tests/HederaE2ETests/Token/TokenWipe.swift +++ b/Tests/HederaE2ETests/Token/TokenWipe.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/Topic.swift b/Tests/HederaE2ETests/Topic/Topic.swift index c7974aef..4188850d 100644 --- a/Tests/HederaE2ETests/Topic/Topic.swift +++ b/Tests/HederaE2ETests/Topic/Topic.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/TopicCreate.swift b/Tests/HederaE2ETests/Topic/TopicCreate.swift index 89877002..e8db9fa6 100644 --- a/Tests/HederaE2ETests/Topic/TopicCreate.swift +++ b/Tests/HederaE2ETests/Topic/TopicCreate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/TopicDelete.swift b/Tests/HederaE2ETests/Topic/TopicDelete.swift index c17c56bb..ab3049a3 100644 --- a/Tests/HederaE2ETests/Topic/TopicDelete.swift +++ b/Tests/HederaE2ETests/Topic/TopicDelete.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/TopicInfo.swift b/Tests/HederaE2ETests/Topic/TopicInfo.swift index a439ca65..b178a2fe 100644 --- a/Tests/HederaE2ETests/Topic/TopicInfo.swift +++ b/Tests/HederaE2ETests/Topic/TopicInfo.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/TopicMessage.swift b/Tests/HederaE2ETests/Topic/TopicMessage.swift index 4f14533a..dda87fac 100644 --- a/Tests/HederaE2ETests/Topic/TopicMessage.swift +++ b/Tests/HederaE2ETests/Topic/TopicMessage.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Topic/TopicMessageSubmit.swift b/Tests/HederaE2ETests/Topic/TopicMessageSubmit.swift index c3e68e6c..f6873bd5 100644 --- a/Tests/HederaE2ETests/Topic/TopicMessageSubmit.swift +++ b/Tests/HederaE2ETests/Topic/TopicMessageSubmit.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -82,8 +82,8 @@ internal class TopicMessageSubmit: XCTestCase { .getReceipt(testEnv.client), "expected topic delete to fail" ) { error in - guard case .receiptStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.receiptStatus`") + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") return } @@ -103,12 +103,11 @@ internal class TopicMessageSubmit: XCTestCase { await assertThrowsHErrorAsync( try await TopicMessageSubmitTransaction() .topicId(topic.id) - .execute(testEnv.client) - .getReceipt(testEnv.client), + .execute(testEnv.client), "expected topic delete to fail" ) { error in - guard case .receiptStatus(let status, transactionId: _) = error.kind else { - XCTFail("`\(error.kind)` is not `.receiptStatus`") + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") return } diff --git a/Tests/HederaE2ETests/Topic/TopicUpdate.swift b/Tests/HederaE2ETests/Topic/TopicUpdate.swift index 72b5ab15..f17473f6 100644 --- a/Tests/HederaE2ETests/Topic/TopicUpdate.swift +++ b/Tests/HederaE2ETests/Topic/TopicUpdate.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Transaction/TransactionReceipt.swift b/Tests/HederaE2ETests/Transaction/TransactionReceipt.swift index bb74453c..b9d5bdbf 100644 --- a/Tests/HederaE2ETests/Transaction/TransactionReceipt.swift +++ b/Tests/HederaE2ETests/Transaction/TransactionReceipt.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaE2ETests/Transaction/TransactionRecord.swift b/Tests/HederaE2ETests/Transaction/TransactionRecord.swift index 20266db2..938b7a34 100644 --- a/Tests/HederaE2ETests/Transaction/TransactionRecord.swift +++ b/Tests/HederaE2ETests/Transaction/TransactionRecord.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -53,7 +53,7 @@ internal class TransactionRecord: XCTestCase { XCTAssertEqual(txId, query.transactionId) } - internal func testQueryInvalidAccountIdFails() async throws { + internal func testQueryInvalidTxIdFails() async throws { let testEnv = try TestEnvironment.nonFree let account = try await Account.create(testEnv) @@ -74,7 +74,7 @@ internal class TransactionRecord: XCTestCase { return } - XCTAssertEqual(status, .invalidAccountID) + XCTAssertEqual(status, .invalidTransactionID) } } } diff --git a/Tests/HederaE2ETests/XCTestCase+Extensions.swift b/Tests/HederaE2ETests/XCTestCase+Extensions.swift index bb5f05e2..5e6cc50d 100644 --- a/Tests/HederaE2ETests/XCTestCase+Extensions.swift +++ b/Tests/HederaE2ETests/XCTestCase+Extensions.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountAllowanceApproveTransactionTests.swift b/Tests/HederaTests/AccountAllowanceApproveTransactionTests.swift index b4551de8..da82693e 100644 --- a/Tests/HederaTests/AccountAllowanceApproveTransactionTests.swift +++ b/Tests/HederaTests/AccountAllowanceApproveTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountAllowanceDeleteTransactionTests.swift b/Tests/HederaTests/AccountAllowanceDeleteTransactionTests.swift index df409f69..d1022215 100644 --- a/Tests/HederaTests/AccountAllowanceDeleteTransactionTests.swift +++ b/Tests/HederaTests/AccountAllowanceDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountCreateTransactionTests.swift b/Tests/HederaTests/AccountCreateTransactionTests.swift index 6a08273f..cd6666a3 100644 --- a/Tests/HederaTests/AccountCreateTransactionTests.swift +++ b/Tests/HederaTests/AccountCreateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountDeleteTransactionTests.swift b/Tests/HederaTests/AccountDeleteTransactionTests.swift index 5a0c394f..806a76c7 100644 --- a/Tests/HederaTests/AccountDeleteTransactionTests.swift +++ b/Tests/HederaTests/AccountDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountInfoQueryTests.swift b/Tests/HederaTests/AccountInfoQueryTests.swift index ef28ffad..40a7c7bc 100644 --- a/Tests/HederaTests/AccountInfoQueryTests.swift +++ b/Tests/HederaTests/AccountInfoQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountRecordsQueryTests.swift b/Tests/HederaTests/AccountRecordsQueryTests.swift index 99853a89..ebf3ac40 100644 --- a/Tests/HederaTests/AccountRecordsQueryTests.swift +++ b/Tests/HederaTests/AccountRecordsQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -28,7 +28,7 @@ import XCTest * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountStakersQueryTests.swift b/Tests/HederaTests/AccountStakersQueryTests.swift index 0310a7b9..f15c16aa 100644 --- a/Tests/HederaTests/AccountStakersQueryTests.swift +++ b/Tests/HederaTests/AccountStakersQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AccountUpdateTransactionTests.swift b/Tests/HederaTests/AccountUpdateTransactionTests.swift index 7ce56f80..36d0fd48 100644 --- a/Tests/HederaTests/AccountUpdateTransactionTests.swift +++ b/Tests/HederaTests/AccountUpdateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/AssessedCustomFeeTests.swift b/Tests/HederaTests/AssessedCustomFeeTests.swift index eee91440..bb6e923d 100644 --- a/Tests/HederaTests/AssessedCustomFeeTests.swift +++ b/Tests/HederaTests/AssessedCustomFeeTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractBytecodeQueryTests.swift b/Tests/HederaTests/ContractBytecodeQueryTests.swift index 027d5727..fba0533f 100644 --- a/Tests/HederaTests/ContractBytecodeQueryTests.swift +++ b/Tests/HederaTests/ContractBytecodeQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -28,7 +28,7 @@ import XCTest * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractCallQueryTests.swift b/Tests/HederaTests/ContractCallQueryTests.swift index 10b66664..2c9a18ec 100644 --- a/Tests/HederaTests/ContractCallQueryTests.swift +++ b/Tests/HederaTests/ContractCallQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractCreateTransactionTests.swift b/Tests/HederaTests/ContractCreateTransactionTests.swift index 0de34d6a..1d744c96 100644 --- a/Tests/HederaTests/ContractCreateTransactionTests.swift +++ b/Tests/HederaTests/ContractCreateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractDeleteTransactionTests.swift b/Tests/HederaTests/ContractDeleteTransactionTests.swift index 399c4be4..244bfe70 100644 --- a/Tests/HederaTests/ContractDeleteTransactionTests.swift +++ b/Tests/HederaTests/ContractDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractExecuteTransactionTests.swift b/Tests/HederaTests/ContractExecuteTransactionTests.swift index 2ca549cb..c58c94f6 100644 --- a/Tests/HederaTests/ContractExecuteTransactionTests.swift +++ b/Tests/HederaTests/ContractExecuteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ContractFunctionSelectorTests.swift b/Tests/HederaTests/ContractFunctionSelectorTests.swift index df244dd4..775d33fa 100644 --- a/Tests/HederaTests/ContractFunctionSelectorTests.swift +++ b/Tests/HederaTests/ContractFunctionSelectorTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/CryptoAesTests.swift b/Tests/HederaTests/CryptoAesTests.swift index 37a59632..cc27a952 100644 --- a/Tests/HederaTests/CryptoAesTests.swift +++ b/Tests/HederaTests/CryptoAesTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/CryptoSha2Tests.swift b/Tests/HederaTests/CryptoSha2Tests.swift index 6f55bc9c..5edce05b 100644 --- a/Tests/HederaTests/CryptoSha2Tests.swift +++ b/Tests/HederaTests/CryptoSha2Tests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/CryptoSha3Tests.swift b/Tests/HederaTests/CryptoSha3Tests.swift index b5155409..174ba4a5 100644 --- a/Tests/HederaTests/CryptoSha3Tests.swift +++ b/Tests/HederaTests/CryptoSha3Tests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ExchangeRatesTests.swift b/Tests/HederaTests/ExchangeRatesTests.swift index 01baf0bd..f7fe2c6b 100644 --- a/Tests/HederaTests/ExchangeRatesTests.swift +++ b/Tests/HederaTests/ExchangeRatesTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/FileIdTests.swift b/Tests/HederaTests/FileIdTests.swift index b3a475a6..38c4c868 100644 --- a/Tests/HederaTests/FileIdTests.swift +++ b/Tests/HederaTests/FileIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/FileInfoQueryTests.swift b/Tests/HederaTests/FileInfoQueryTests.swift index d6e7b0e9..fb57ff43 100644 --- a/Tests/HederaTests/FileInfoQueryTests.swift +++ b/Tests/HederaTests/FileInfoQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/FreezeTransactionTests.swift b/Tests/HederaTests/FreezeTransactionTests.swift index 7b62d600..2454c480 100644 --- a/Tests/HederaTests/FreezeTransactionTests.swift +++ b/Tests/HederaTests/FreezeTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/HbarTests.swift b/Tests/HederaTests/HbarTests.swift index 72583f79..d15e6469 100644 --- a/Tests/HederaTests/HbarTests.swift +++ b/Tests/HederaTests/HbarTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/KeyListTests.swift b/Tests/HederaTests/KeyListTests.swift index d43f2147..f1909c76 100644 --- a/Tests/HederaTests/KeyListTests.swift +++ b/Tests/HederaTests/KeyListTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/LedgerIdTests.swift b/Tests/HederaTests/LedgerIdTests.swift index 82ccd456..26f22640 100644 --- a/Tests/HederaTests/LedgerIdTests.swift +++ b/Tests/HederaTests/LedgerIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/MnemonicTests.swift b/Tests/HederaTests/MnemonicTests.swift index 7e5a913e..dfa5d35d 100644 --- a/Tests/HederaTests/MnemonicTests.swift +++ b/Tests/HederaTests/MnemonicTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/NetworkVersionInfoTests.swift b/Tests/HederaTests/NetworkVersionInfoTests.swift index af5c96c1..def5123c 100644 --- a/Tests/HederaTests/NetworkVersionInfoTests.swift +++ b/Tests/HederaTests/NetworkVersionInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/NftIdTests.swift b/Tests/HederaTests/NftIdTests.swift index c863d8f6..2967a10f 100644 --- a/Tests/HederaTests/NftIdTests.swift +++ b/Tests/HederaTests/NftIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/PrivateKeyTests.swift b/Tests/HederaTests/PrivateKeyTests.swift index 6caa2372..f53c37fb 100644 --- a/Tests/HederaTests/PrivateKeyTests.swift +++ b/Tests/HederaTests/PrivateKeyTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/PrngTransactionTests.swift b/Tests/HederaTests/PrngTransactionTests.swift index 387994b2..cbfb921c 100644 --- a/Tests/HederaTests/PrngTransactionTests.swift +++ b/Tests/HederaTests/PrngTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/Resources.swift b/Tests/HederaTests/Resources.swift index 59bf1e6c..9dcaff92 100644 --- a/Tests/HederaTests/Resources.swift +++ b/Tests/HederaTests/Resources.swift @@ -33,6 +33,7 @@ internal enum Resources { internal static let fileId = FileId("1.2.3") internal static let tokenId = TokenId("0.3.5") internal static let topicId = TopicId("4.4.4") + internal static let metadata = Data([3, 4]) // some unused private key internal static let privateKey: PrivateKey = diff --git a/Tests/HederaTests/ScheduleIdTests.swift b/Tests/HederaTests/ScheduleIdTests.swift index ad38b0fa..20fa4bb5 100644 --- a/Tests/HederaTests/ScheduleIdTests.swift +++ b/Tests/HederaTests/ScheduleIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ScheduleInfoQueryTests.swift b/Tests/HederaTests/ScheduleInfoQueryTests.swift index f128a1ce..62d601db 100644 --- a/Tests/HederaTests/ScheduleInfoQueryTests.swift +++ b/Tests/HederaTests/ScheduleInfoQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/ScheduleInfoTests.swift b/Tests/HederaTests/ScheduleInfoTests.swift index 01225aa8..6744822d 100644 --- a/Tests/HederaTests/ScheduleInfoTests.swift +++ b/Tests/HederaTests/ScheduleInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/SemanticVersionTests.swift b/Tests/HederaTests/SemanticVersionTests.swift index c118c0f8..3a0ec671 100644 --- a/Tests/HederaTests/SemanticVersionTests.swift +++ b/Tests/HederaTests/SemanticVersionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/SignatureTests.swift b/Tests/HederaTests/SignatureTests.swift index e4fc6de4..cfe77d22 100644 --- a/Tests/HederaTests/SignatureTests.swift +++ b/Tests/HederaTests/SignatureTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/StakingInfoTests.swift b/Tests/HederaTests/StakingInfoTests.swift index a7beec2a..463e8977 100644 --- a/Tests/HederaTests/StakingInfoTests.swift +++ b/Tests/HederaTests/StakingInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/StatusTests.swift b/Tests/HederaTests/StatusTests.swift index 9914aeda..4f699bcb 100644 --- a/Tests/HederaTests/StatusTests.swift +++ b/Tests/HederaTests/StatusTests.swift @@ -26,7 +26,7 @@ import XCTest internal final class StatusTests: XCTestCase { internal func testToResponseCode() { for code in Proto_ResponseCodeEnum.allCases { - if code == Proto_ResponseCodeEnum.UNRECOGNIZED(-1) { + if code == Proto_ResponseCodeEnum.unrecognized(-1) { continue } diff --git a/Tests/HederaTests/SystemDeleteTransactionTests.swift b/Tests/HederaTests/SystemDeleteTransactionTests.swift index 7416a221..71aaa98e 100644 --- a/Tests/HederaTests/SystemDeleteTransactionTests.swift +++ b/Tests/HederaTests/SystemDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/SystemUndeleteTransactionTests.swift b/Tests/HederaTests/SystemUndeleteTransactionTests.swift index ccefd405..d904da8a 100644 --- a/Tests/HederaTests/SystemUndeleteTransactionTests.swift +++ b/Tests/HederaTests/SystemUndeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenAllowanceTests.swift b/Tests/HederaTests/TokenAllowanceTests.swift index 8eac9712..10d66296 100644 --- a/Tests/HederaTests/TokenAllowanceTests.swift +++ b/Tests/HederaTests/TokenAllowanceTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenAssociationTests.swift b/Tests/HederaTests/TokenAssociationTests.swift index f682262d..d6006cc0 100644 --- a/Tests/HederaTests/TokenAssociationTests.swift +++ b/Tests/HederaTests/TokenAssociationTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenCreateTransactionTests.swift b/Tests/HederaTests/TokenCreateTransactionTests.swift index 3ef512a8..df2c5b56 100644 --- a/Tests/HederaTests/TokenCreateTransactionTests.swift +++ b/Tests/HederaTests/TokenCreateTransactionTests.swift @@ -57,6 +57,8 @@ internal final class TokenCreateTransactionTests: XCTestCase { feeCollectorAccountId: try AccountId.fromString("0.0.54") )) ]) + .metadata(Resources.metadata) + .metadataKey(.single(Resources.publicKey)) .freeze() .sign(Resources.privateKey) } @@ -85,6 +87,8 @@ internal final class TokenCreateTransactionTests: XCTestCase { .treasuryAccountId(AccountId.fromString("0.0.456")) .name("flook") .tokenMemo("flook memo") + .metadata(Resources.metadata) + .metadataKey(.single(Resources.publicKey)) .freeze() .sign(Resources.privateKey) } @@ -136,5 +140,7 @@ internal final class TokenCreateTransactionTests: XCTestCase { XCTAssertEqual(tx.tokenType, TokenType.fungibleCommon) XCTAssertEqual(tx.tokenSupplyType, TokenSupplyType.infinite) XCTAssertEqual(tx.maxSupply, 0) + XCTAssertEqual(tx.metadata, Data([3, 4])) + XCTAssertEqual(tx.metadataKey, .single(Resources.publicKey)) } } diff --git a/Tests/HederaTests/TokenDeleteTransactionTests.swift b/Tests/HederaTests/TokenDeleteTransactionTests.swift index 6840f05d..1e1dc6ac 100644 --- a/Tests/HederaTests/TokenDeleteTransactionTests.swift +++ b/Tests/HederaTests/TokenDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenDissociateTransactionTests.swift b/Tests/HederaTests/TokenDissociateTransactionTests.swift index 73bd1bc3..96aadf35 100644 --- a/Tests/HederaTests/TokenDissociateTransactionTests.swift +++ b/Tests/HederaTests/TokenDissociateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenFeeScheduleUpdateTransactionTests.swift b/Tests/HederaTests/TokenFeeScheduleUpdateTransactionTests.swift index 38b2c7be..3cc12c16 100644 --- a/Tests/HederaTests/TokenFeeScheduleUpdateTransactionTests.swift +++ b/Tests/HederaTests/TokenFeeScheduleUpdateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenFreezeTransactionTests.swift b/Tests/HederaTests/TokenFreezeTransactionTests.swift index 69679d07..d0f4b4e6 100644 --- a/Tests/HederaTests/TokenFreezeTransactionTests.swift +++ b/Tests/HederaTests/TokenFreezeTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenGrantKycTransactionTests.swift b/Tests/HederaTests/TokenGrantKycTransactionTests.swift index f0069efc..8e78f45d 100644 --- a/Tests/HederaTests/TokenGrantKycTransactionTests.swift +++ b/Tests/HederaTests/TokenGrantKycTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenIdTests.swift b/Tests/HederaTests/TokenIdTests.swift index 82a06ca7..33baf848 100644 --- a/Tests/HederaTests/TokenIdTests.swift +++ b/Tests/HederaTests/TokenIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenInfoTests.swift b/Tests/HederaTests/TokenInfoTests.swift index cf24650a..7a9476a1 100644 --- a/Tests/HederaTests/TokenInfoTests.swift +++ b/Tests/HederaTests/TokenInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -39,6 +39,8 @@ internal final class TokenInfoTests: XCTestCase { "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e16" private static let pauseKey: PrivateKey = "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e17" + private static let metadataKey: PrivateKey = + "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e18" private static let tokenInfo: TokenInfo = TokenInfo( tokenId: "0.6.9", @@ -72,7 +74,9 @@ internal final class TokenInfoTests: XCTestCase { ], pauseKey: .single(pauseKey.publicKey), pauseStatus: true, - ledgerId: .mainnet + ledgerId: .mainnet, + metadata: Resources.metadata, + metadataKey: .single(metadataKey.publicKey) ) internal func testSerialize() throws { diff --git a/Tests/HederaTests/TokenMintTransactionTests.swift b/Tests/HederaTests/TokenMintTransactionTests.swift index 02ecb917..fc510957 100644 --- a/Tests/HederaTests/TokenMintTransactionTests.swift +++ b/Tests/HederaTests/TokenMintTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenNftInfoTests.swift b/Tests/HederaTests/TokenNftInfoTests.swift index 1bc01657..53366125 100644 --- a/Tests/HederaTests/TokenNftInfoTests.swift +++ b/Tests/HederaTests/TokenNftInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenNftTransferTests.swift b/Tests/HederaTests/TokenNftTransferTests.swift index da5cde99..d11b2cb4 100644 --- a/Tests/HederaTests/TokenNftTransferTests.swift +++ b/Tests/HederaTests/TokenNftTransferTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenPauseTransactionTests.swift b/Tests/HederaTests/TokenPauseTransactionTests.swift index 9e8a0c90..8198afca 100644 --- a/Tests/HederaTests/TokenPauseTransactionTests.swift +++ b/Tests/HederaTests/TokenPauseTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenRevokeKycTransactionTests.swift b/Tests/HederaTests/TokenRevokeKycTransactionTests.swift index 2997db26..c2c441e1 100644 --- a/Tests/HederaTests/TokenRevokeKycTransactionTests.swift +++ b/Tests/HederaTests/TokenRevokeKycTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenTypeTests.swift b/Tests/HederaTests/TokenTypeTests.swift index d33f87ea..af9f96a2 100644 --- a/Tests/HederaTests/TokenTypeTests.swift +++ b/Tests/HederaTests/TokenTypeTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenUnfreezeTransactionTests.swift b/Tests/HederaTests/TokenUnfreezeTransactionTests.swift index 5fc6e1ac..6122e162 100644 --- a/Tests/HederaTests/TokenUnfreezeTransactionTests.swift +++ b/Tests/HederaTests/TokenUnfreezeTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenUnpauseTransactionTests.swift b/Tests/HederaTests/TokenUnpauseTransactionTests.swift index 481d896a..210f614f 100644 --- a/Tests/HederaTests/TokenUnpauseTransactionTests.swift +++ b/Tests/HederaTests/TokenUnpauseTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TokenUpdateTransactionTests.swift b/Tests/HederaTests/TokenUpdateTransactionTests.swift index 5bba3c7b..abfaaeb3 100644 --- a/Tests/HederaTests/TokenUpdateTransactionTests.swift +++ b/Tests/HederaTests/TokenUpdateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. @@ -20,6 +20,7 @@ import HederaProtobufs import SnapshotTesting +import SwiftProtobuf import XCTest @testable import Hedera @@ -39,6 +40,8 @@ internal final class TokenUpdateTransactionTests: XCTestCase { "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e11" private static let testPauseKey: PrivateKey = "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e11" + private static let testMetadataKey: PrivateKey = + "302e020100300506032b657004220420db484b828e64b2d8f12ce3c0a0e93a0b8cce7af1bb8f39c97732394482538e18" private static let testTreasuryAccountId: AccountId = "7.7.7" private static let testAutoRenewAccountId: AccountId = "8.8.8" @@ -68,6 +71,8 @@ internal final class TokenUpdateTransactionTests: XCTestCase { .treasuryAccountId(testTreasuryAccountId) .tokenName(testTokenName) .tokenMemo(testTokenMemo) + .metadata(Resources.metadata) + .metadataKey(.single(Resources.publicKey)) .freeze() } @@ -102,6 +107,8 @@ internal final class TokenUpdateTransactionTests: XCTestCase { proto.memo = .with { $0.value = Self.testTokenMemo } proto.feeScheduleKey = Self.testFeeScheduleKey.publicKey.toProtobuf() proto.pauseKey = Self.testPauseKey.publicKey.toProtobuf() + proto.metadata = Google_Protobuf_BytesValue(Resources.metadata) + proto.metadataKey = Self.testMetadataKey.publicKey.toProtobuf() } let protoBody = Proto_TransactionBody.with { proto in @@ -126,6 +133,8 @@ internal final class TokenUpdateTransactionTests: XCTestCase { XCTAssertEqual(tx.tokenMemo, Self.testTokenMemo) XCTAssertEqual(tx.feeScheduleKey, .single(Self.testFeeScheduleKey.publicKey)) XCTAssertEqual(tx.pauseKey, .single(Self.testPauseKey.publicKey)) + XCTAssertEqual(tx.metadata, Data([3, 4])) + XCTAssertEqual(tx.metadataKey, .single(Self.testMetadataKey.publicKey)) } internal func testGetSetTokenId() { @@ -218,4 +227,16 @@ internal final class TokenUpdateTransactionTests: XCTestCase { tx.pauseKey(.single(Self.testPauseKey.publicKey)) XCTAssertEqual(tx.pauseKey, .single(Self.testPauseKey.publicKey)) } + + internal func testGetSetMetadata() { + let tx = TokenUpdateTransaction() + tx.metadata(Resources.metadata) + XCTAssertEqual(tx.metadata, Resources.metadata) + } + + internal func testGetSetMetadataKey() { + let tx = TokenUpdateTransaction() + tx.metadataKey(.single(Self.testMetadataKey.publicKey)) + XCTAssertEqual(tx.metadataKey, .single(Self.testMetadataKey.publicKey)) + } } diff --git a/Tests/HederaTests/TokenWipeTransactionTests.swift b/Tests/HederaTests/TokenWipeTransactionTests.swift index 3fdc9a8c..103e6be0 100644 --- a/Tests/HederaTests/TokenWipeTransactionTests.swift +++ b/Tests/HederaTests/TokenWipeTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicCreateTransactionTests.swift b/Tests/HederaTests/TopicCreateTransactionTests.swift index ad9ae0d4..87d19cc8 100644 --- a/Tests/HederaTests/TopicCreateTransactionTests.swift +++ b/Tests/HederaTests/TopicCreateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicDeleteTransactionTests.swift b/Tests/HederaTests/TopicDeleteTransactionTests.swift index 881d0f54..e0add227 100644 --- a/Tests/HederaTests/TopicDeleteTransactionTests.swift +++ b/Tests/HederaTests/TopicDeleteTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicIdTests.swift b/Tests/HederaTests/TopicIdTests.swift index 84c3045d..872cb7b0 100644 --- a/Tests/HederaTests/TopicIdTests.swift +++ b/Tests/HederaTests/TopicIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicInfoTests.swift b/Tests/HederaTests/TopicInfoTests.swift index bb7bc523..35bded2d 100644 --- a/Tests/HederaTests/TopicInfoTests.swift +++ b/Tests/HederaTests/TopicInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicMessageQueryTests.swift b/Tests/HederaTests/TopicMessageQueryTests.swift index 6ff18495..f87cbf13 100644 --- a/Tests/HederaTests/TopicMessageQueryTests.swift +++ b/Tests/HederaTests/TopicMessageQueryTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicMessageSubmitTransactionTests.swift b/Tests/HederaTests/TopicMessageSubmitTransactionTests.swift index 700e3a69..fa53b75e 100644 --- a/Tests/HederaTests/TopicMessageSubmitTransactionTests.swift +++ b/Tests/HederaTests/TopicMessageSubmitTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicMessageTests.swift b/Tests/HederaTests/TopicMessageTests.swift index 59019a47..b97eefa9 100644 --- a/Tests/HederaTests/TopicMessageTests.swift +++ b/Tests/HederaTests/TopicMessageTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TopicUpdateTransactionTests.swift b/Tests/HederaTests/TopicUpdateTransactionTests.swift index 1ece0283..8ffbd5ad 100644 --- a/Tests/HederaTests/TopicUpdateTransactionTests.swift +++ b/Tests/HederaTests/TopicUpdateTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/Transaction+Extensions.swift b/Tests/HederaTests/Transaction+Extensions.swift index 23a27bf6..0f9da2d9 100644 --- a/Tests/HederaTests/Transaction+Extensions.swift +++ b/Tests/HederaTests/Transaction+Extensions.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TransactionChunkInfoTests.swift b/Tests/HederaTests/TransactionChunkInfoTests.swift index d9a2acac..9e73fffe 100644 --- a/Tests/HederaTests/TransactionChunkInfoTests.swift +++ b/Tests/HederaTests/TransactionChunkInfoTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TransactionFeeScheduleTests.swift b/Tests/HederaTests/TransactionFeeScheduleTests.swift index 5125d17f..7b8012d8 100644 --- a/Tests/HederaTests/TransactionFeeScheduleTests.swift +++ b/Tests/HederaTests/TransactionFeeScheduleTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TransactionIdTests.swift b/Tests/HederaTests/TransactionIdTests.swift index 42c6e56e..1b957ec1 100644 --- a/Tests/HederaTests/TransactionIdTests.swift +++ b/Tests/HederaTests/TransactionIdTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TransactionTests.swift b/Tests/HederaTests/TransactionTests.swift index bcb5f3fd..707e020e 100644 --- a/Tests/HederaTests/TransactionTests.swift +++ b/Tests/HederaTests/TransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/TransferTransactionTests.swift b/Tests/HederaTests/TransferTransactionTests.swift index 742b3699..6c7642be 100644 --- a/Tests/HederaTests/TransferTransactionTests.swift +++ b/Tests/HederaTests/TransferTransactionTests.swift @@ -2,7 +2,7 @@ * ‌ * Hedera Swift SDK * ​ - * Copyright (C) 2022 - 2023 Hedera Hashgraph, LLC + * 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. diff --git a/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerialize.1.txt index 1cd4b69e..ab160454 100644 --- a/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerialize.1.txt @@ -67,4 +67,8 @@ tokenCreation { pause_key { ed25519: "\340\310\354'X\245\207\237\372\302&\241<\fQky\236r\343QA\240\335\202\217\224\323y\210\244\267" } + metadata: "\003\004" + metadata_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__/TokenCreateTransactionTests/testSerializeNft.1.txt b/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerializeNft.1.txt index f0b106e1..2b28187b 100644 --- a/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerializeNft.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenCreateTransactionTests/testSerializeNft.1.txt @@ -54,4 +54,8 @@ tokenCreation { pause_key { ed25519: "\340\310\354'X\245\207\237\372\302&\241<\fQky\236r\343QA\240\335\202\217\224\323y\210\244\267" } + metadata: "\003\004" + metadata_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__/TokenInfoTests/testFromProtobuf.1.txt b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testFromProtobuf.1.txt index ea840662..7cb88737 100644 --- a/Tests/HederaTests/__Snapshots__/TokenInfoTests/testFromProtobuf.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testFromProtobuf.1.txt @@ -1 +1 @@ -TokenInfo(tokenId: 0.6.9, name: "test token name", symbol: "TTN", decimals: 3, totalSupply: 1000, treasuryAccountId: 7.7.7, adminKey: Optional(Hedera.Key.single(302a300506032b6570032100da87701097866e73f0dd942cbb3e97063329f905588621b178d21759688d47fc)), kycKey: nil, freezeKey: Optional(Hedera.Key.single(302a300506032b65700321003ded53e32233532f3d8462324cd113abbe4f73216df06d54a11cb691c15b27cd)), wipeKey: Optional(Hedera.Key.single(302a300506032b6570032100525b9c155f902b912dbd81bea6d43a077d7a62dd1fefcfc77de96144d5fac3ee)), supplyKey: Optional(Hedera.Key.single(302a300506032b65700321003b913853afa59b55abc581c2ac0d36580ac2eca4bd101c02173fef02e677ddd5)), feeScheduleKey: Optional(Hedera.Key.single(302a300506032b65700321004bbe95a86d24f8f96773b12826fcbe009688cb0dca88cff117a3a8af50c37113)), defaultFreezeStatus: Optional(true), defaultKycStatus: Optional(true), isDeleted: false, autoRenewAccount: Optional(8.9.0), autoRenewPeriod: Optional(Hedera.Duration(seconds: 36000)), expirationTime: Optional(1554158542000000000), tokenMemo: "memo", tokenType: Hedera.TokenType.fungibleCommon, supplyType: Hedera.TokenSupplyType.finite, maxSupply: 1000000, customFees: [Hedera.AnyCustomFee.fixed(Hedera.FixedFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, amount: 10, denominatingTokenId: Optional(0.0.483902))), Hedera.AnyCustomFee.fractional(Hedera.FractionalFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, denominator: 7, numerator: 3, minimumAmount: 3, maximumAmount: 100, assessmentMethod: Hedera.FractionalFee.FeeAssessmentMethod.inclusive))], pauseKey: Optional(Hedera.Key.single(302a300506032b6570032100d16865a98cf8b0b7f8fa3776b20dafc5be04ffeb9a2497720783ce991e2b1974)), pauseStatus: Optional(true), ledgerId: mainnet) \ No newline at end of file +TokenInfo(tokenId: 0.6.9, name: "test token name", symbol: "TTN", decimals: 3, totalSupply: 1000, treasuryAccountId: 7.7.7, adminKey: Optional(Hedera.Key.single(302a300506032b6570032100da87701097866e73f0dd942cbb3e97063329f905588621b178d21759688d47fc)), kycKey: nil, freezeKey: Optional(Hedera.Key.single(302a300506032b65700321003ded53e32233532f3d8462324cd113abbe4f73216df06d54a11cb691c15b27cd)), wipeKey: Optional(Hedera.Key.single(302a300506032b6570032100525b9c155f902b912dbd81bea6d43a077d7a62dd1fefcfc77de96144d5fac3ee)), supplyKey: Optional(Hedera.Key.single(302a300506032b65700321003b913853afa59b55abc581c2ac0d36580ac2eca4bd101c02173fef02e677ddd5)), feeScheduleKey: Optional(Hedera.Key.single(302a300506032b65700321004bbe95a86d24f8f96773b12826fcbe009688cb0dca88cff117a3a8af50c37113)), defaultFreezeStatus: Optional(true), defaultKycStatus: Optional(true), isDeleted: false, autoRenewAccount: Optional(8.9.0), autoRenewPeriod: Optional(Hedera.Duration(seconds: 36000)), expirationTime: Optional(1554158542000000000), tokenMemo: "memo", tokenType: Hedera.TokenType.fungibleCommon, supplyType: Hedera.TokenSupplyType.finite, maxSupply: 1000000, customFees: [Hedera.AnyCustomFee.fixed(Hedera.FixedFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, amount: 10, denominatingTokenId: Optional(0.0.483902))), Hedera.AnyCustomFee.fractional(Hedera.FractionalFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, denominator: 7, numerator: 3, minimumAmount: 3, maximumAmount: 100, assessmentMethod: Hedera.FractionalFee.FeeAssessmentMethod.inclusive))], pauseKey: Optional(Hedera.Key.single(302a300506032b6570032100d16865a98cf8b0b7f8fa3776b20dafc5be04ffeb9a2497720783ce991e2b1974)), pauseStatus: Optional(true), ledgerId: mainnet, metadata: 2 bytes, metadataKey: Optional(Hedera.Key.single(302a300506032b6570032100146dec92320a6e46eb1a43767bb1ec95a2e6c0251ab0dd780fe37474d4bac415))) \ No newline at end of file diff --git a/Tests/HederaTests/__Snapshots__/TokenInfoTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testSerialize.1.txt index ea840662..7cb88737 100644 --- a/Tests/HederaTests/__Snapshots__/TokenInfoTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testSerialize.1.txt @@ -1 +1 @@ -TokenInfo(tokenId: 0.6.9, name: "test token name", symbol: "TTN", decimals: 3, totalSupply: 1000, treasuryAccountId: 7.7.7, adminKey: Optional(Hedera.Key.single(302a300506032b6570032100da87701097866e73f0dd942cbb3e97063329f905588621b178d21759688d47fc)), kycKey: nil, freezeKey: Optional(Hedera.Key.single(302a300506032b65700321003ded53e32233532f3d8462324cd113abbe4f73216df06d54a11cb691c15b27cd)), wipeKey: Optional(Hedera.Key.single(302a300506032b6570032100525b9c155f902b912dbd81bea6d43a077d7a62dd1fefcfc77de96144d5fac3ee)), supplyKey: Optional(Hedera.Key.single(302a300506032b65700321003b913853afa59b55abc581c2ac0d36580ac2eca4bd101c02173fef02e677ddd5)), feeScheduleKey: Optional(Hedera.Key.single(302a300506032b65700321004bbe95a86d24f8f96773b12826fcbe009688cb0dca88cff117a3a8af50c37113)), defaultFreezeStatus: Optional(true), defaultKycStatus: Optional(true), isDeleted: false, autoRenewAccount: Optional(8.9.0), autoRenewPeriod: Optional(Hedera.Duration(seconds: 36000)), expirationTime: Optional(1554158542000000000), tokenMemo: "memo", tokenType: Hedera.TokenType.fungibleCommon, supplyType: Hedera.TokenSupplyType.finite, maxSupply: 1000000, customFees: [Hedera.AnyCustomFee.fixed(Hedera.FixedFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, amount: 10, denominatingTokenId: Optional(0.0.483902))), Hedera.AnyCustomFee.fractional(Hedera.FractionalFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, denominator: 7, numerator: 3, minimumAmount: 3, maximumAmount: 100, assessmentMethod: Hedera.FractionalFee.FeeAssessmentMethod.inclusive))], pauseKey: Optional(Hedera.Key.single(302a300506032b6570032100d16865a98cf8b0b7f8fa3776b20dafc5be04ffeb9a2497720783ce991e2b1974)), pauseStatus: Optional(true), ledgerId: mainnet) \ No newline at end of file +TokenInfo(tokenId: 0.6.9, name: "test token name", symbol: "TTN", decimals: 3, totalSupply: 1000, treasuryAccountId: 7.7.7, adminKey: Optional(Hedera.Key.single(302a300506032b6570032100da87701097866e73f0dd942cbb3e97063329f905588621b178d21759688d47fc)), kycKey: nil, freezeKey: Optional(Hedera.Key.single(302a300506032b65700321003ded53e32233532f3d8462324cd113abbe4f73216df06d54a11cb691c15b27cd)), wipeKey: Optional(Hedera.Key.single(302a300506032b6570032100525b9c155f902b912dbd81bea6d43a077d7a62dd1fefcfc77de96144d5fac3ee)), supplyKey: Optional(Hedera.Key.single(302a300506032b65700321003b913853afa59b55abc581c2ac0d36580ac2eca4bd101c02173fef02e677ddd5)), feeScheduleKey: Optional(Hedera.Key.single(302a300506032b65700321004bbe95a86d24f8f96773b12826fcbe009688cb0dca88cff117a3a8af50c37113)), defaultFreezeStatus: Optional(true), defaultKycStatus: Optional(true), isDeleted: false, autoRenewAccount: Optional(8.9.0), autoRenewPeriod: Optional(Hedera.Duration(seconds: 36000)), expirationTime: Optional(1554158542000000000), tokenMemo: "memo", tokenType: Hedera.TokenType.fungibleCommon, supplyType: Hedera.TokenSupplyType.finite, maxSupply: 1000000, customFees: [Hedera.AnyCustomFee.fixed(Hedera.FixedFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, amount: 10, denominatingTokenId: Optional(0.0.483902))), Hedera.AnyCustomFee.fractional(Hedera.FractionalFee(feeCollectorAccountId: Optional(0.0.4322), allCollectorsAreExempt: false, denominator: 7, numerator: 3, minimumAmount: 3, maximumAmount: 100, assessmentMethod: Hedera.FractionalFee.FeeAssessmentMethod.inclusive))], pauseKey: Optional(Hedera.Key.single(302a300506032b6570032100d16865a98cf8b0b7f8fa3776b20dafc5be04ffeb9a2497720783ce991e2b1974)), pauseStatus: Optional(true), ledgerId: mainnet, metadata: 2 bytes, metadataKey: Optional(Hedera.Key.single(302a300506032b6570032100146dec92320a6e46eb1a43767bb1ec95a2e6c0251ab0dd780fe37474d4bac415))) \ No newline at end of file diff --git a/Tests/HederaTests/__Snapshots__/TokenInfoTests/testToProtobuf.1.txt b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testToProtobuf.1.txt index 6de6a04d..d51ddb24 100644 --- a/Tests/HederaTests/__Snapshots__/TokenInfoTests/testToProtobuf.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenInfoTests/testToProtobuf.1.txt @@ -72,3 +72,7 @@ pause_key { } pause_status: Paused ledger_id: "\000" +metadata: "\003\004" +metadata_key { + ed25519: "\024m\354\2222\nnF\353\032Cv{\261\354\225\242\346\300%\032\260\335x\017\343tt\324\272\304\025" +} diff --git a/Tests/HederaTests/__Snapshots__/TokenNftInfoQueryTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenNftInfoQueryTests/testSerialize.1.txt index fa4fe4ee..cdde2e31 100644 --- a/Tests/HederaTests/__Snapshots__/TokenNftInfoQueryTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenNftInfoQueryTests/testSerialize.1.txt @@ -3,9 +3,9 @@ tokenGetNftInfo { header { } nftID { - tokenID { + token_ID { tokenNum: 5005 } - serialNumber: 101 + serial_number: 101 } } diff --git a/Tests/HederaTests/__Snapshots__/TokenUpdateTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenUpdateTransactionTests/testSerialize.1.txt index 522bd826..a73d638c 100644 --- a/Tests/HederaTests/__Snapshots__/TokenUpdateTransactionTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TokenUpdateTransactionTests/testSerialize.1.txt @@ -58,4 +58,10 @@ tokenUpdate { pause_key { ed25519: "\332\207p\020\227\206ns\360\335\224,\273>\227\0063)\371\005X\206!\261x\322\027Yh\215G\374" } + metadata { + value: "\003\004" + } + metadata_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/protobufs b/protobufs index 0b4d91e5..e650477f 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit 0b4d91e59c3b340183c5a5dd523f868ef08848e4 +Subproject commit e650477fc5f061fb9229db67944a7911fa5c65bc