From 89d96b51004df42947a0637785e81afb4c229eec Mon Sep 17 00:00:00 2001 From: Ricky Saechao <76449893+RickyLB@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:19:26 -0700 Subject: [PATCH] Airdrop functionality --- .github/workflows/swift-ci.yml | 2 +- Examples/TokenAirdrop/main.swift | 294 +++++++++++ Package.swift | 1 + Sources/Hedera/AnyTransaction.swift | 21 +- Sources/Hedera/PendingAirdropId.swift | 118 +++++ Sources/Hedera/PendingAirdropRecord.swift | 53 ++ Sources/Hedera/Status.swift | 71 +++ .../AbstractTokenTransferTransaction.swift | 429 ++++++++++++++++ Sources/Hedera/Token/NftId.swift | 2 +- .../Token/TokenAirdropTransaction.swift | 65 +++ .../Token/TokenCancelAirdropTransaction.swift | 106 ++++ .../Token/TokenClaimAirdropTransaction.swift | 114 ++++ Sources/Hedera/Token/TokenId.swift | 12 +- .../Transaction+FromProtobuf.swift | 12 + Sources/Hedera/TransactionRecord.swift | 12 +- Sources/Hedera/TransferTransaction.swift | 301 +---------- .../Services/basic_types.pb.swift | 485 +++++------------- .../Services/consensus_create_topic.pb.swift | 6 +- .../Services/consensus_delete_topic.pb.swift | 6 +- .../consensus_get_topic_info.pb.swift | 9 +- .../consensus_submit_message.pb.swift | 9 +- .../Services/consensus_topic_info.pb.swift | 10 +- .../Services/consensus_update_topic.pb.swift | 6 +- .../Services/contract_call.pb.swift | 6 +- .../Services/contract_call_local.pb.swift | 65 ++- .../Services/contract_create.pb.swift | 58 +-- .../Services/contract_delete.pb.swift | 33 +- .../Services/contract_get_bytecode.pb.swift | 9 +- .../Services/contract_get_info.pb.swift | 22 +- .../Services/contract_get_records.pb.swift | 13 +- .../Services/contract_types.pb.swift | 6 +- .../Services/contract_update.pb.swift | 62 +-- .../Services/crypto_add_live_hash.pb.swift | 11 +- .../crypto_approve_allowance.pb.swift | 17 +- .../Services/crypto_create.pb.swift | 37 +- .../Services/crypto_delete.pb.swift | 6 +- .../Services/crypto_delete_allowance.pb.swift | 9 +- .../Services/crypto_delete_live_hash.pb.swift | 6 +- .../crypto_get_account_balance.pb.swift | 38 +- .../crypto_get_account_records.pb.swift | 9 +- .../Services/crypto_get_info.pb.swift | 28 +- .../Services/crypto_get_live_hash.pb.swift | 9 +- .../Services/crypto_get_stakers.pb.swift | 15 +- .../Services/crypto_transfer.pb.swift | 8 +- .../Services/crypto_update.pb.swift | 118 ++--- .../Services/custom_fees.pb.swift | 69 +-- .../Services/duration.pb.swift | 6 +- .../Services/ethereum_transaction.pb.swift | 24 +- .../Services/exchange_rate.pb.swift | 11 +- .../Services/file_append.pb.swift | 8 +- .../Services/file_create.pb.swift | 10 +- .../Services/file_delete.pb.swift | 6 +- .../Services/file_get_contents.pb.swift | 12 +- .../Services/file_get_info.pb.swift | 14 +- .../Services/file_service.grpc.swift | 4 +- .../Services/file_update.pb.swift | 8 +- .../HederaProtobufs/Services/freeze.pb.swift | 14 +- .../Services/freeze_type.pb.swift | 40 +- .../Services/get_account_details.pb.swift | 23 +- .../Services/get_by_key.pb.swift | 41 +- .../Services/get_by_solidity_id.pb.swift | 9 +- .../network_get_execution_time.pb.swift | 15 +- .../network_get_version_info.pb.swift | 9 +- .../Services/network_service.grpc.swift | 6 +- .../Services/node_create.pb.swift | 6 +- .../Services/node_delete.pb.swift | 6 +- .../Services/node_stake_update.pb.swift | 41 +- .../Services/node_update.pb.swift | 6 +- .../HederaProtobufs/Services/query.pb.swift | 119 +---- .../Services/query_header.pb.swift | 21 +- .../Services/response.pb.swift | 119 +---- .../Services/response_code.pb.swift | 83 ++- .../Services/response_header.pb.swift | 6 +- .../schedulable_transaction_body.pb.swift | 203 +------- .../Services/schedule_create.pb.swift | 26 +- .../Services/schedule_delete.pb.swift | 8 +- .../Services/schedule_get_info.pb.swift | 37 +- .../Services/schedule_sign.pb.swift | 12 +- .../smart_contract_service.grpc.swift | 4 +- .../Services/state_addressbook_node.pb.swift | 6 +- .../state_blockrecords_block_info.pb.swift | 6 +- ...state_blockrecords_running_hashes.pb.swift | 6 +- ...ate_blockstream_block_stream_info.pb.swift | 154 ++++++ .../Services/state_common.pb.swift | 9 +- ...ongestion_congestion_level_starts.pb.swift | 6 +- .../Services/state_consensus_topic.pb.swift | 22 +- .../Services/state_contract_bytecode.pb.swift | 6 +- .../state_contract_storage_slot.pb.swift | 17 +- .../Services/state_file_file.pb.swift | 6 +- .../Services/state_primitives.pb.swift | 18 +- .../state_recordcache_recordcache.pb.swift | 137 ++++- .../Services/state_roster_roster.pb.swift | 201 ++++++++ .../state_roster_roster_state.pb.swift | 161 ++++++ .../Services/state_schedule_schedule.pb.swift | 9 +- ...hrottles_throttle_usage_snapshots.pb.swift | 9 +- .../Services/state_token_account.pb.swift | 52 +- ...ate_token_account_pending_airdrop.pb.swift | 6 +- ...ate_token_network_staking_rewards.pb.swift | 6 +- .../Services/state_token_nft.pb.swift | 10 +- .../state_token_staking_node_info.pb.swift | 6 +- .../Services/state_token_token.pb.swift | 6 +- .../state_token_token_relation.pb.swift | 6 +- .../Services/system_delete.pb.swift | 29 +- .../Services/system_undelete.pb.swift | 29 +- .../Services/throttle_definitions.pb.swift | 16 +- .../Services/timestamp.pb.swift | 9 +- .../Services/token_airdrop.pb.swift | 6 +- .../Services/token_associate.pb.swift | 6 +- .../Services/token_burn.pb.swift | 8 +- .../Services/token_cancel_airdrop.pb.swift | 6 +- .../Services/token_claim_airdrop.pb.swift | 6 +- .../Services/token_create.pb.swift | 30 +- .../Services/token_delete.pb.swift | 6 +- .../Services/token_dissociate.pb.swift | 6 +- .../token_fee_schedule_update.pb.swift | 16 +- .../Services/token_freeze_account.pb.swift | 6 +- .../token_get_account_nft_infos.pb.swift | 9 +- .../Services/token_get_info.pb.swift | 14 +- .../Services/token_get_nft_info.pb.swift | 14 +- .../Services/token_get_nft_infos.pb.swift | 9 +- .../Services/token_grant_kyc.pb.swift | 6 +- .../Services/token_mint.pb.swift | 6 +- .../Services/token_pause.pb.swift | 6 +- .../Services/token_reject.pb.swift | 30 +- .../Services/token_revoke_kyc.pb.swift | 6 +- .../Services/token_unfreeze_account.pb.swift | 6 +- .../Services/token_unpause.pb.swift | 6 +- .../Services/token_update.pb.swift | 16 +- .../Services/token_update_nfts.pb.swift | 6 +- .../Services/token_wipe_account.pb.swift | 10 +- .../Services/transaction.pb.swift | 16 +- .../Services/transaction_body.pb.swift | 233 +-------- .../Services/transaction_contents.pb.swift | 6 +- .../transaction_get_fast_record.pb.swift | 9 +- .../Services/transaction_get_receipt.pb.swift | 15 +- .../Services/transaction_get_record.pb.swift | 15 +- .../Services/transaction_receipt.pb.swift | 6 +- .../Services/transaction_record.pb.swift | 55 +- .../Services/transaction_response.pb.swift | 6 +- .../Services/unchecked_submit.pb.swift | 8 +- .../Services/util_prng.pb.swift | 6 +- .../HederaE2ETests/Token/FungibleToken.swift | 4 + Tests/HederaE2ETests/Token/Nft.swift | 2 + Tests/HederaE2ETests/Token/TokenAirdrop.swift | 465 +++++++++++++++++ .../Token/TokenCancelAirdrop.swift | 460 +++++++++++++++++ .../Token/TokenClaimAirdrop.swift | 423 +++++++++++++++ Tests/HederaE2ETests/Token/TokenReject.swift | 6 +- .../TokenAirdropTransactionTests.swift | 184 +++++++ .../TokenCancelAirdropTransactionTests.swift | 133 +++++ .../TokenClaimAirdropTransactionTests.swift | 133 +++++ .../HederaTests/TransactionRecordTests.swift | 8 +- .../testSerialize.1.txt | 138 +++++ .../testSerialize.1.txt | 47 ++ .../testSerialize.1.txt | 47 ++ .../testSerialize.1.txt | 2 +- .../testSerialize2.1.txt | 2 +- protobufs | 2 +- 157 files changed, 4719 insertions(+), 2655 deletions(-) create mode 100644 Examples/TokenAirdrop/main.swift create mode 100644 Sources/Hedera/PendingAirdropId.swift create mode 100644 Sources/Hedera/PendingAirdropRecord.swift create mode 100644 Sources/Hedera/Token/AbstractTokenTransferTransaction.swift create mode 100644 Sources/Hedera/Token/TokenAirdropTransaction.swift create mode 100644 Sources/Hedera/Token/TokenCancelAirdropTransaction.swift create mode 100644 Sources/Hedera/Token/TokenClaimAirdropTransaction.swift create mode 100644 Sources/HederaProtobufs/Services/state_blockstream_block_stream_info.pb.swift create mode 100644 Sources/HederaProtobufs/Services/state_roster_roster.pb.swift create mode 100644 Sources/HederaProtobufs/Services/state_roster_roster_state.pb.swift create mode 100644 Tests/HederaE2ETests/Token/TokenAirdrop.swift create mode 100644 Tests/HederaE2ETests/Token/TokenCancelAirdrop.swift create mode 100644 Tests/HederaE2ETests/Token/TokenClaimAirdrop.swift create mode 100644 Tests/HederaTests/TokenAirdropTransactionTests.swift create mode 100644 Tests/HederaTests/TokenCancelAirdropTransactionTests.swift create mode 100644 Tests/HederaTests/TokenClaimAirdropTransactionTests.swift create mode 100644 Tests/HederaTests/__Snapshots__/TokenAirdropTransactionTests/testSerialize.1.txt create mode 100644 Tests/HederaTests/__Snapshots__/TokenCancelAirdropTransactionTests/testSerialize.1.txt create mode 100644 Tests/HederaTests/__Snapshots__/TokenClaimAirdropTransactionTests/testSerialize.1.txt diff --git a/.github/workflows/swift-ci.yml b/.github/workflows/swift-ci.yml index 0862c5e6..a0629eeb 100644 --- a/.github/workflows/swift-ci.yml +++ b/.github/workflows/swift-ci.yml @@ -13,7 +13,7 @@ permissions: jobs: format: - runs-on: macos-12 + runs-on: macos-latest steps: - name: Harden Runner uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 diff --git a/Examples/TokenAirdrop/main.swift b/Examples/TokenAirdrop/main.swift new file mode 100644 index 00000000..e6bd3e84 --- /dev/null +++ b/Examples/TokenAirdrop/main.swift @@ -0,0 +1,294 @@ +/* + * ‌ + * 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 { + internal static func main() async throws { + let env = try Dotenv.load() + let client = try Client.forName(env.networkName) + + client.setOperator(env.operatorAccountId, env.operatorKey) + + let privateKey1 = PrivateKey.generateEcdsa() + let aliceId = try await AccountCreateTransaction() + .key(.single(privateKey1.publicKey)) + .initialBalance(Hbar(10)) + .maxAutomaticTokenAssociations(-1) + .execute(client) + .getReceipt(client) + .accountId! + + let privateKey2 = PrivateKey.generateEcdsa() + let bobId = try await AccountCreateTransaction() + .key(.single(privateKey2.publicKey)) + .maxAutomaticTokenAssociations(1) + .execute(client) + .getReceipt(client) + .accountId! + + let privateKey3 = PrivateKey.generateEcdsa() + let carolId = try await AccountCreateTransaction() + .key(.single(privateKey3.publicKey)) + .maxAutomaticTokenAssociations(0) + .execute(client) + .getReceipt(client) + .accountId! + + let treasuryKey = PrivateKey.generateEcdsa() + let treasuryAccountId = try await AccountCreateTransaction() + .key(.single(treasuryKey.publicKey)) + .initialBalance(Hbar(10)) + .execute(client) + .getReceipt(client) + .accountId! + + // Create FT and NFT and mint + let tokenId = try await TokenCreateTransaction() + .name("ffff") + .symbol("F") + .decimals(3) + .initialSupply(100) + .maxSupply(100) + .treasuryAccountId(treasuryAccountId) + .tokenSupplyType(.finite) + .adminKey(.single(env.operatorKey.publicKey)) + .freezeKey(.single(env.operatorKey.publicKey)) + .supplyKey(.single(env.operatorKey.publicKey)) + .pauseKey(.single(env.operatorKey.publicKey)) + .expirationTime(.now + .hours(2)) + .freezeWith(client) + .sign(treasuryKey) + .execute(client) + .getReceipt(client) + .tokenId! + + let nftId = try await TokenCreateTransaction() + .name("example NFT") + .symbol("F") + .maxSupply(10) + .treasuryAccountId(treasuryAccountId) + .tokenSupplyType(.finite) + .tokenType(.nonFungibleUnique) + .adminKey(.single(env.operatorKey.publicKey)) + .freezeKey(.single(env.operatorKey.publicKey)) + .supplyKey(.single(env.operatorKey.publicKey)) + .pauseKey(.single(env.operatorKey.publicKey)) + .expirationTime(.now + .hours(2)) + .freezeWith(client) + .sign(treasuryKey) + .execute(client) + .getReceipt(client) + .tokenId! + + _ = try await TokenMintTransaction() + .tokenId(nftId) + .metadata(Array(repeating: Data([9, 1, 6]), count: 4)) + .execute(client) + .getReceipt(client) + + // Airdrop fungible tokens to all 3 accounts + print("Airdropping tokens to all accounts") + + let txRecord = try await TokenAirdropTransaction() + .tokenTransfer(tokenId, aliceId, 10) + .tokenTransfer(tokenId, treasuryAccountId, -10) + .tokenTransfer(tokenId, bobId, 10) + .tokenTransfer(tokenId, treasuryAccountId, -10) + .tokenTransfer(tokenId, carolId, 10) + .tokenTransfer(tokenId, treasuryAccountId, -10) + .freezeWith(client) + .sign(treasuryKey) + .execute(client) + .getRecord(client) + + // Get the transaction record and see one pending airdrop (for carol) + print("Pending airdrop length: \(txRecord.pendingAirdropRecords.count)") + print("Pending airdrops: \(txRecord.pendingAirdropRecords.first!)") + + // Query to verify alice and bob received the airdrops and carol did not + let aliceBalance = try await AccountBalanceQuery() + .accountId(aliceId) + .execute(client) + + let bobBalance = try await AccountBalanceQuery() + .accountId(bobId) + .execute(client) + + let carolBalance = try await AccountBalanceQuery() + .accountId(carolId) + .execute(client) + + print("Alice ft balance after airdrop: \(aliceBalance.tokenBalances[tokenId]!)") + print("Bob ft balance after airdrop: \(bobBalance.tokenBalances[tokenId]!)") + print("Carol ft balance after airdrop: \(String(describing:carolBalance.tokenBalances[tokenId]))") + + // Claim the airdrop for carol + print("Claiming ft with Carol") + + _ = try await TokenClaimAirdropTransaction() + .addPendingAirdropId(txRecord.pendingAirdropRecords[0].pendingAirdropId) + .freezeWith(client) + .sign(privateKey3) + .execute(client) + .getReceipt(client) + + let carolBalanceAfterClaim = try await AccountBalanceQuery() + .accountId(carolId) + .execute(client) + + print("Carol ft balance after airdrop: \(carolBalanceAfterClaim.tokenBalances[tokenId]!)") + + // Airdrop the NFTs to all three accounts + print("Airdropping nfts") + let nftTxRecord = try await TokenAirdropTransaction() + .nftTransfer(nftId.nft(1), treasuryAccountId, aliceId) + .nftTransfer(nftId.nft(2), treasuryAccountId, bobId) + .nftTransfer(nftId.nft(3), treasuryAccountId, carolId) + .freezeWith(client) + .sign(treasuryKey) + .execute(client) + .getRecord(client) + + // Get the transaction record and verify two pending airdrops (for bob & carol) + print("Pending airdrops length: \(nftTxRecord.pendingAirdropRecords.count)") + print("Pending airdrops for Bob: \(nftTxRecord.pendingAirdropRecords[0])") + print("Pending airdrops for Carol: \(nftTxRecord.pendingAirdropRecords[1])") + + // Query to verify alice received the airdrop and bob and carol did not + let aliceNftBalance = try await AccountBalanceQuery() + .accountId(aliceId) + .execute(client) + + let bobNftBalance = try await AccountBalanceQuery() + .accountId(bobId) + .execute(client) + + let carolNftBalance = try await AccountBalanceQuery() + .accountId(carolId) + .execute(client) + + print("Alice nft balance after airdrop: \(aliceNftBalance.tokenBalances[nftId]!)") + print("Bob nft balance after airdrop: \(String(describing:bobNftBalance.tokenBalances[nftId]))") + print("Carol nft balance after airdrop: \(String(describing:carolNftBalance.tokenBalances[nftId]))") + + // Claim the airdrop for bob + print("Claiming nft with Bob") + _ = try await TokenClaimAirdropTransaction() + .addPendingAirdropId(nftTxRecord.pendingAirdropRecords[0].pendingAirdropId) + .freezeWith(client) + .sign(privateKey2) + .execute(client) + .getReceipt(client) + + let bobNftBalanceAfterClaim = try await AccountBalanceQuery() + .accountId(bobId) + .execute(client) + + print("Bob nft balance after claim: \(bobNftBalanceAfterClaim.tokenBalances[nftId]!)") + + // Cancel the airdrop for carol + print("Cancelling nft for Carol") + _ = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(nftTxRecord.pendingAirdropRecords[1].pendingAirdropId) + .freezeWith(client) + .sign(treasuryKey) + .execute(client) + .getReceipt(client) + + let carolNftBalanceAfterCancel = try await AccountBalanceQuery() + .accountId(carolId) + .execute(client) + + print("Carol nft balance after cancel: \(String(describing:carolNftBalanceAfterCancel.tokenBalances[nftId]))") + + // Reject the NFT for bob + print("Rejecting nft with Bob") + _ = try await TokenRejectTransaction() + .owner(bobId) + .addNftId(nftId.nft(2)) + .freezeWith(client) + .sign(privateKey2) + .execute(client) + .getReceipt(client) + + // Query to verify bob no longer has the NFT + let bobNftBalanceAfterReject = try await AccountBalanceQuery() + .accountId(bobId) + .execute(client) + + print("Bob nft balance after reject: \(bobNftBalanceAfterReject.tokenBalances[nftId]!)") + + // Query to verify the NFT was returned to the Treasury + let treasuryNftBalance = try await AccountBalanceQuery() + .accountId(treasuryAccountId) + .execute(client) + + print("Treasury nft balance after reject: \(treasuryNftBalance.tokenBalances[nftId]!)") + + // Reject the Fungible token for carol + print("Rejecting ft with Carol") + _ = try await TokenRejectTransaction() + .owner(carolId) + .addTokenId(tokenId) + .freezeWith(client) + .sign(privateKey3) + .execute(client) + .getReceipt(client) + + // Query to verify Carol no longer has the fungible tokens + let carolFtBalanceAfterReject = try await AccountBalanceQuery() + .accountId(carolId) + .execute(client) + + print("Carol ft balance after reject: \(carolFtBalanceAfterReject.tokenBalances[tokenId]!)") + + // Query to verify Treasury received the rejected fungible tokens + let treasuryFtBalance = try await AccountBalanceQuery() + .accountId(treasuryAccountId) + .execute(client) + + print("Treasury ft balance after reject: \(treasuryFtBalance.tokenBalances[tokenId]!)") + + print("Token airdrop example completed successfully") + } +} + +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/Package.swift b/Package.swift index 16249694..af0309a1 100644 --- a/Package.swift +++ b/Package.swift @@ -62,6 +62,7 @@ let exampleTargets = [ "ValidateChecksum", "TokenUpdateMetadata", "NftUpdateMetadata", + "TokenAirdrop", ].map { name in Target.executableTarget( name: "\(name)Example", diff --git a/Sources/Hedera/AnyTransaction.swift b/Sources/Hedera/AnyTransaction.swift index 78f80ab5..e0be9718 100644 --- a/Sources/Hedera/AnyTransaction.swift +++ b/Sources/Hedera/AnyTransaction.swift @@ -68,6 +68,9 @@ internal enum ServicesTransactionDataList { case nodeCreate([Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody]) case nodeUpdate([Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody]) case nodeDelete([Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody]) + case tokenAirdrop([Proto_TokenAirdropTransactionBody]) + case tokenClaimAirdrop([Proto_TokenClaimAirdropTransactionBody]) + case tokenCancelAirdrop([Proto_TokenCancelAirdropTransactionBody]) internal mutating func append(_ transaction: Proto_TransactionBody.OneOf_Data) throws { switch (self, transaction) { @@ -255,6 +258,18 @@ internal enum ServicesTransactionDataList { array.append(data) self = .nodeDelete(array) + case (.tokenAirdrop(var array), .tokenAirdrop(let data)): + array.append(data) + self = .tokenAirdrop(array) + + case (.tokenClaimAirdrop(var array), .tokenClaimAirdrop(let data)): + array.append(data) + self = .tokenClaimAirdrop(array) + + case (.tokenCancelAirdrop(var array), .tokenCancelAirdrop(let data)): + array.append(data) + self = .tokenCancelAirdrop(array) + default: throw HError.fromProtobuf("mismatched transaction types") } @@ -323,9 +338,9 @@ extension ServicesTransactionDataList: TryFromProtobuf { case .nodeUpdate(let data): value = .nodeUpdate([data]) case .nodeDelete(let data): value = .nodeDelete([data]) case .tokenReject(let data): value = .tokenReject([data]) - case .tokenAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenAirdropTransaction`") - case .tokenCancelAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenCancelAirdropTransaction`") - case .tokenClaimAirdrop: throw HError.fromProtobuf("Unsupported transaction `TokenClaimAirdropTransaction`") + case .tokenAirdrop(let data): value = .tokenAirdrop([data]) + case .tokenCancelAirdrop(let data): value = .tokenCancelAirdrop([data]) + case .tokenClaimAirdrop(let data): value = .tokenClaimAirdrop([data]) } for transaction in iter { diff --git a/Sources/Hedera/PendingAirdropId.swift b/Sources/Hedera/PendingAirdropId.swift new file mode 100644 index 00000000..21ff8f9e --- /dev/null +++ b/Sources/Hedera/PendingAirdropId.swift @@ -0,0 +1,118 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2023 Hedera 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 + +public struct PendingAirdropId: Sendable, Equatable { + /// A sending account. + /// + /// This is the account that initiated, and SHALL fund, this pending airdrop. + /// This field is REQUIRED. + public let senderId: AccountId + + /// A receiving account. + /// + /// This is the ID of the account that SHALL receive the airdrop. + /// This field is REQUIRED. + public let receiverId: AccountId + + /// The token to be airdropped. + public let tokenId: TokenId? + + /// The NFT to be airdropped. + public let nftId: NftId? + + public init(senderId: AccountId, receiverId: AccountId, tokenId: TokenId) { + self.senderId = senderId + self.receiverId = receiverId + self.tokenId = tokenId + self.nftId = nil + } + + public init(senderId: AccountId, receiverId: AccountId, nftId: NftId) { + self.senderId = senderId + self.receiverId = receiverId + self.tokenId = nil + self.nftId = nftId + } + + private init(senderId: AccountId, receiverId: AccountId, tokenId: TokenId?, nftId: NftId?) { + self.senderId = senderId + self.receiverId = receiverId + self.tokenId = tokenId + self.nftId = nftId + } + + /// Decode `Self` from protobuf-encoded `bytes`. + /// + /// - Throws: ``HError/ErrorKind/fromProtobuf`` if: + /// decoding the bytes fails to produce a valid protobuf, or + /// decoding the protobuf fails. + public static func fromBytes(_ bytes: Data) throws -> Self { + try Self(protobufBytes: bytes) + } + + /// Convert `self` to protobuf encoded data. + public func toBytes() -> Data { + toProtobufBytes() + } +} + +extension PendingAirdropId: TryProtobufCodable { + internal typealias Protobuf = Proto_PendingAirdropId + + internal init(protobuf proto: Protobuf) throws { + var tokenId: TokenId? + var nftId: NftId? + + if let ref = proto.tokenReference { + switch ref { + case .fungibleTokenType(let tokenProto): + tokenId = TokenId.fromProtobuf(tokenProto) + case .nonFungibleToken(let nftProto): + nftId = NftId.fromProtobuf(nftProto) + } + } + + self.init( + senderId: try AccountId(protobuf: proto.senderID), + receiverId: try AccountId(protobuf: proto.receiverID), + tokenId: tokenId, + nftId: nftId + ) + } + + internal func toProtobuf() -> Protobuf { + var proto = Protobuf() + proto.senderID = senderId.toProtobuf() + proto.receiverID = receiverId.toProtobuf() + + if let tokenId = tokenId { + proto.tokenReference = .fungibleTokenType(tokenId.toProtobuf()) + } else if let nftId = nftId { + proto.tokenReference = .nonFungibleToken(nftId.toProtobuf()) + } + + return proto + } +} diff --git a/Sources/Hedera/PendingAirdropRecord.swift b/Sources/Hedera/PendingAirdropRecord.swift new file mode 100644 index 00000000..e3cd1288 --- /dev/null +++ b/Sources/Hedera/PendingAirdropRecord.swift @@ -0,0 +1,53 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import Foundation +import HederaProtobufs + +/// A record of a new pending airdrop. +public struct PendingAirdropRecord { + /// The pending airdrop ID. + public let pendingAirdropId: PendingAirdropId + /// The amount to be airdropped. + public let amount: UInt64 +} + +extension PendingAirdropRecord: TryProtobufCodable { + internal typealias Protobuf = Proto_PendingAirdropRecord + + internal init(protobuf proto: Protobuf) throws { + self.pendingAirdropId = try PendingAirdropId(protobuf: proto.pendingAirdropID) + self.amount = proto.pendingAirdropValue.amount + } + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.pendingAirdropID = pendingAirdropId.toProtobuf() + proto.pendingAirdropValue.amount = amount + } + } +} + +#if compiler(<5.7) + // Swift 5.7 added the conformance to data, despite to the best of my knowledge, not changing anything in the underlying type. + extension PendingAirdropRecord: @unchecked Sendable {} +#else + extension PendingAirdropRecord: Sendable {} +#endif diff --git a/Sources/Hedera/Status.swift b/Sources/Hedera/Status.swift index 4a3a3b18..258d2eca 100644 --- a/Sources/Hedera/Status.swift +++ b/Sources/Hedera/Status.swift @@ -1028,6 +1028,37 @@ public enum Status: Equatable { /// The node account is not allowed to be updated case updateNodeAccountNotAllowed // = 359 + /// The token has no metadata key or supply key + case tokenHasNoMetadataOrSupplyKey // = 360 + + /// The transaction attempted to the use an empty List of `PendingAirdropId`. + case emptyPendingAirdropIdList // = 361 + + /// The transaction attempted to the same `PendingAirdropId` twice. + case pendingAirdropIdRepeated // = 362 + + /// The transaction attempted to use more than the allowed number of `PendingAirdropId`. + case pendingAirdropIdListTooLong // = 363 + + /// A pending airdrop already exists for the specified NFT. + case pendingNftAirdropAlreadyExists // = 364 + + /// The identified account is sender for one or more pending airdrop(s) and cannot be deleted. + case accountHasPendingAirdrops // = 365 + + /// Consensus throttle did not allow execution of this transaction. + case throttledAtConsensus // = 366 + + /// The provided pending airdrop id is invalid. + case invalidPendingAirdropId // = 367 + + /// The token to be airdropped has a fallback royalty fee and cannot be + /// sent or claimed via an airdrop transaction. + case tokenAirdropWithFallbackRoyalty // = 368 + + /// This airdrop claim is for a pending airdrop with an invalid token. + case invalidTokenInPendingAirdrop // = 369 + /// swift-format-ignore: AlwaysUseLowerCamelCase case unrecognized(Int32) @@ -1353,6 +1384,16 @@ public enum Status: Equatable { case 357: self = .invalidIpv4Address case 358: self = .emptyTokenReferenceList case 359: self = .updateNodeAccountNotAllowed + case 360: self = .tokenHasNoMetadataOrSupplyKey + case 361: self = .emptyPendingAirdropIdList + case 362: self = .pendingAirdropIdRepeated + case 363: self = .pendingAirdropIdListTooLong + case 364: self = .pendingNftAirdropAlreadyExists + case 365: self = .accountHasPendingAirdrops + case 366: self = .throttledAtConsensus + case 367: self = .invalidPendingAirdropId + case 368: self = .tokenAirdropWithFallbackRoyalty + case 369: self = .invalidTokenInPendingAirdrop default: self = .unrecognized(rawValue) } } @@ -1677,6 +1718,16 @@ public enum Status: Equatable { case .invalidIpv4Address: return 357 case .emptyTokenReferenceList: return 358 case .updateNodeAccountNotAllowed: return 359 + case .tokenHasNoMetadataOrSupplyKey: return 360 + case .emptyPendingAirdropIdList: return 361 + case .pendingAirdropIdRepeated: return 362 + case .pendingAirdropIdListTooLong: return 363 + case .pendingNftAirdropAlreadyExists: return 364 + case .accountHasPendingAirdrops: return 365 + case .throttledAtConsensus: return 366 + case .invalidPendingAirdropId: return 367 + case .tokenAirdropWithFallbackRoyalty: return 368 + case .invalidTokenInPendingAirdrop: return 369 case .unrecognized(let i): return i } } @@ -2004,6 +2055,16 @@ extension Status: CaseIterable { .invalidIpv4Address, .emptyTokenReferenceList, .updateNodeAccountNotAllowed, + .tokenHasNoMetadataOrSupplyKey, + .emptyPendingAirdropIdList, + .pendingAirdropIdRepeated, + .pendingAirdropIdListTooLong, + .pendingNftAirdropAlreadyExists, + .accountHasPendingAirdrops, + .throttledAtConsensus, + .invalidPendingAirdropId, + .tokenAirdropWithFallbackRoyalty, + .invalidTokenInPendingAirdrop, ] } @@ -2329,6 +2390,16 @@ extension Status { 357: "INVALID_IPV4_ADDRESS", 358: "EMPTY_TOKEN_REFERENCE_LIST", 359: "UPDATE_NODE_ACCOUNT_NOT_ALLOWED", + 360: "TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY", + 361: "EMPTY_PENDING_AIRDROP_ID_LIST", + 362: "PENDING_AIRDROP_ID_REPEATED", + 363: "PENDING_AIRDROP_ID_LIST_TOO_LONG", + 364: "PENDING_NFT_AIRDROP_ALREADY_EXISTS", + 365: "ACCOUNT_HAS_PENDING_AIRDROPS", + 366: "THROTTLED_AT_CONSENSUS", + 367: "INVALID_PENDING_AIRDROP_ID", + 368: "TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY", + 369: "INVALID_TOKEN_IN_PENDING_AIRDROP", ] } diff --git a/Sources/Hedera/Token/AbstractTokenTransferTransaction.swift b/Sources/Hedera/Token/AbstractTokenTransferTransaction.swift new file mode 100644 index 00000000..1efba50f --- /dev/null +++ b/Sources/Hedera/Token/AbstractTokenTransferTransaction.swift @@ -0,0 +1,429 @@ +/* + * ‌ + * 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. + * ‍ + */ + +/* + * ‌ + * 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 GRPC +import HederaProtobufs +import SwiftProtobuf + +public class AbstractTokenTransferTransaction: Transaction { + // avoid scope collisions by nesting :/ + struct Transfer: ValidateChecksums { + let accountId: AccountId + var amount: Int64 + let isApproval: Bool + + internal func validateChecksums(on ledgerId: LedgerId) throws { + try accountId.validateChecksums(on: ledgerId) + } + } + + struct TokenTransfer: ValidateChecksums { + let tokenId: TokenId + var transfers: [AbstractTokenTransferTransaction.Transfer] + var nftTransfers: [AbstractTokenTransferTransaction.NftTransfer] + var expectedDecimals: UInt32? + + internal func validateChecksums(on ledgerId: LedgerId) throws { + try tokenId.validateChecksums(on: ledgerId) + try transfers.validateChecksums(on: ledgerId) + try nftTransfers.validateChecksums(on: ledgerId) + } + } + + struct NftTransfer: ValidateChecksums { + let senderAccountId: AccountId + let receiverAccountId: AccountId + let serial: UInt64 + let isApproval: Bool + + internal func validateChecksums(on ledgerId: LedgerId) throws { + try senderAccountId.validateChecksums(on: ledgerId) + try receiverAccountId.validateChecksums(on: ledgerId) + } + } + + var transfers: [AbstractTokenTransferTransaction.Transfer] = [] { + willSet { + ensureNotFrozen(fieldName: "transfers") + } + } + + public var tokenTransfers: [TokenId: [AccountId: Int64]] { + Dictionary( + tokenTransfersInner.lazy.map { item in + ( + item.tokenId, + Dictionary( + item.transfers.lazy.map { ($0.accountId, $0.amount) }, + uniquingKeysWith: { first, _ in first } + ) + ) + }, + uniquingKeysWith: { (first, _) in first } + ) + } + + public var tokenNftTransfers: [TokenId: [TokenNftTransfer]] { + Dictionary( + tokenTransfersInner.lazy.map { item in + ( + item.tokenId, + item.nftTransfers.map { + TokenNftTransfer( + tokenId: item.tokenId, + sender: $0.senderAccountId, + receiver: $0.receiverAccountId, + serial: $0.serial, + isApproved: $0.isApproval + ) + } + ) + }, + uniquingKeysWith: { (first, _) in first } + ) + } + + internal var tokenTransfersInner: [AbstractTokenTransferTransaction.TokenTransfer] = [] { + willSet { + ensureNotFrozen(fieldName: "tokenTransfers") + } + } + + /// Extract the list of token id decimals. + public var tokenDecimals: [TokenId: UInt32] { + Dictionary( + tokenTransfersInner.lazy.compactMap { elem in + guard let decimals = elem.expectedDecimals else { + return nil + } + + return (elem.tokenId, decimals) + }, + uniquingKeysWith: { first, _ in first } + ) + } + + // /// Create a new `AbstractTokenTransferTransaction`. + // public override init() { + // super.init() + // } + + /// Add a non-approved token transfer to the transaction. + /// + /// `amount` is in the lowest denomination for the token (if the token has `2` decimals this would be `0.01` tokens). + @discardableResult + public func tokenTransfer(_ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64) -> Self { + doTokenTransfer(tokenId, accountId, amount, false) + } + + /// Add an approved token transfer to the transaction. + /// + /// `amount` is in the lowest denomination for the token (if the token has `2` decimals this would be `0.01` tokens). + @discardableResult + public func approvedTokenTransfer(_ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64) -> Self { + doTokenTransfer(tokenId, accountId, amount, true) + } + + /// Add a non-approved token transfer with decimals to the transaction, ensuring that the token has `expectedDecimals` decimals. + /// + /// `amount` is _still_ in the lowest denomination, however, + /// you will get an error if the token has a different amount of decimals than `expectedDecimals`. + @discardableResult + public func tokenTransferWithDecimals( + _ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64, _ expectedDecimals: UInt32 + ) -> Self { + doTokenTransferWithDecimals(tokenId, accountId, amount, false, expectedDecimals) + } + + /// Add an approved token transfer with decimals to the transaction, ensuring that the token has `expectedDecimals` decimals. + /// + /// `amount` is _still_ in the lowest denomination, however, + /// you will get an error if the token has a different amount of decimals than `expectedDecimals`. + @discardableResult + public func approvedTokenTransferWithDecimals( + _ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64, _ expectedDecimals: UInt32 + ) -> Self { + doTokenTransferWithDecimals(tokenId, accountId, amount, false, expectedDecimals) + } + + /// Add a non-approved nft transfer to the transaction. + @discardableResult + public func nftTransfer(_ nftId: NftId, _ senderAccountId: AccountId, _ receiverAccountId: AccountId) + -> Self + { + doNftTransfer(nftId, senderAccountId, receiverAccountId, false) + } + + /// Add an approved nft transfer to the transaction. + @discardableResult + public func approvedNftTransfer( + _ nftId: NftId, _ senderAccountId: AccountId, _ receiverAccountId: AccountId + ) -> Self { + doNftTransfer(nftId, senderAccountId, receiverAccountId, true) + } + + private func doTokenTransfer( + _ tokenId: TokenId, + _ accountId: AccountId, + _ amount: Int64, + _ approved: Bool + ) -> Self { + let transfer = Transfer(accountId: accountId, amount: amount, isApproval: approved) + + if let firstIndex = tokenTransfersInner.firstIndex(where: { (tokenTransfer) in tokenTransfer.tokenId == tokenId + }) { + let existingTransfers = tokenTransfersInner[firstIndex].transfers + + if let existingTransferIndex = existingTransfers.firstIndex(where: { + $0.accountId == accountId && $0.isApproval == approved + }) { + tokenTransfersInner[firstIndex].transfers[existingTransferIndex].amount += amount + } else { + tokenTransfersInner[firstIndex].expectedDecimals = nil + tokenTransfersInner[firstIndex].transfers.append(transfer) + } + } else { + tokenTransfersInner.append( + TokenTransfer( + tokenId: tokenId, + transfers: [transfer], + nftTransfers: [], + expectedDecimals: nil + )) + } + + return self + } + + private func doTokenTransferWithDecimals( + _ tokenId: TokenId, + _ accountId: AccountId, + _ amount: Int64, + _ approved: Bool, + _ expectedDecimals: UInt32 + ) -> Self { + let transfer = Transfer(accountId: accountId, amount: amount, isApproval: approved) + + if let firstIndex = tokenTransfersInner.firstIndex(where: { (tokenTransfer) in tokenTransfer.tokenId == tokenId + }) { + if tokenTransfersInner[firstIndex].expectedDecimals != nil + && tokenTransfersInner[firstIndex].expectedDecimals != expectedDecimals + { + print( + "Token \(tokenId) has a different amount of decimals than expected. Expected \(expectedDecimals) but got \(tokenTransfersInner[firstIndex].expectedDecimals!)" + ) + return self + } + + let existingTransfers = tokenTransfersInner[firstIndex].transfers + + if let existingTransferIndex = existingTransfers.firstIndex(where: { + $0.accountId == accountId && $0.isApproval == approved + }) { + tokenTransfersInner[firstIndex].transfers[existingTransferIndex].amount += amount + } else { + tokenTransfersInner[firstIndex].expectedDecimals = expectedDecimals + tokenTransfersInner[firstIndex].transfers.append(transfer) + } + } else { + tokenTransfersInner.append( + TokenTransfer( + tokenId: tokenId, + transfers: [transfer], + nftTransfers: [], + expectedDecimals: expectedDecimals + )) + } + + return self + } + + private func doNftTransfer( + _ nftId: NftId, + _ senderAccountId: AccountId, + _ receiverAccountId: AccountId, + _ approved: Bool + ) -> Self { + let transfer = NftTransfer( + senderAccountId: senderAccountId, + receiverAccountId: receiverAccountId, + serial: nftId.serial, + isApproval: approved + ) + + if let index = tokenTransfersInner.firstIndex(where: { transfer in transfer.tokenId == nftId.tokenId }) { + var tmp = tokenTransfersInner[index] + tmp.nftTransfers.append(transfer) + tokenTransfersInner[index] = tmp + } else { + tokenTransfersInner.append( + TokenTransfer( + tokenId: nftId.tokenId, + transfers: [], + nftTransfers: [transfer], + expectedDecimals: nil + ) + ) + } + + return self + } + + internal func sortTransfers() -> [TokenTransfer] { + var transferLists = tokenTransfersInner + + // Sort token transfers by token ID + transferLists.sort { a, b in + if a.tokenId.shard != b.tokenId.shard { + return a.tokenId.shard < b.tokenId.shard + } + if a.tokenId.realm != b.tokenId.realm { + return a.tokenId.realm < b.tokenId.realm + } + return a.tokenId.num < b.tokenId.num + } + + // Sort transfers within each TokenTransfer + for index in transferLists.indices { + transferLists[index].transfers.sort { (a: Transfer, b: Transfer) in + if a.accountId.shard != b.accountId.shard { + return a.accountId.shard < b.accountId.shard + } + if a.accountId.realm != b.accountId.realm { + return a.accountId.realm < b.accountId.realm + } + if a.accountId.num != b.accountId.num { + return a.accountId.num < b.accountId.num + } + return a.isApproval && !b.isApproval + } + + transferLists[index].nftTransfers.sort { $0.serial < $1.serial } + } + + return transferLists + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws { + try transfers.validateChecksums(on: ledgerId) + try tokenTransfersInner.validateChecksums(on: ledgerId) + try super.validateChecksums(on: ledgerId) + } +} + +extension AbstractTokenTransferTransaction.Transfer: TryProtobufCodable { + internal typealias Protobuf = Proto_AccountAmount + + internal init(protobuf proto: Protobuf) throws { + self.init( + accountId: try .fromProtobuf(proto.accountID), + amount: proto.amount, + isApproval: proto.isApproval + ) + } + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.accountID = accountId.toProtobuf() + proto.amount = amount + proto.isApproval = isApproval + } + } +} + +extension AbstractTokenTransferTransaction.TokenTransfer: TryProtobufCodable { + internal typealias Protobuf = Proto_TokenTransferList + + internal init(protobuf proto: Protobuf) throws { + self.init( + tokenId: .fromProtobuf(proto.token), + transfers: try .fromProtobuf(proto.transfers), + nftTransfers: try .fromProtobuf(proto.nftTransfers), + expectedDecimals: proto.hasExpectedDecimals ? proto.expectedDecimals.value : nil + ) + transfers = try .fromProtobuf(proto.transfers) + + } + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.token = tokenId.toProtobuf() + proto.transfers = transfers.toProtobuf() + proto.nftTransfers = nftTransfers.toProtobuf() + if let expectedDecimals = expectedDecimals { + proto.expectedDecimals = Google_Protobuf_UInt32Value(expectedDecimals) + } + } + } +} + +extension AbstractTokenTransferTransaction.NftTransfer: TryProtobufCodable { + internal typealias Protobuf = Proto_NftTransfer + + internal init(protobuf proto: Protobuf) throws { + self.init( + senderAccountId: try .fromProtobuf(proto.senderAccountID), + receiverAccountId: try .fromProtobuf(proto.receiverAccountID), + serial: UInt64(proto.serialNumber), + isApproval: proto.isApproval + ) + } + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.senderAccountID = senderAccountId.toProtobuf() + proto.receiverAccountID = receiverAccountId.toProtobuf() + proto.serialNumber = Int64(bitPattern: serial) + proto.isApproval = isApproval + } + } +} + +extension TokenNftTransfer { + fileprivate init(nftTransfer: TransferTransaction.NftTransfer, withTokenId tokenId: TokenId) { + self.init( + tokenId: tokenId, + sender: nftTransfer.senderAccountId, + receiver: nftTransfer.receiverAccountId, + serial: nftTransfer.serial, + isApproved: nftTransfer.isApproval + ) + } +} diff --git a/Sources/Hedera/Token/NftId.swift b/Sources/Hedera/Token/NftId.swift index 9d43d822..6c60e3d9 100644 --- a/Sources/Hedera/Token/NftId.swift +++ b/Sources/Hedera/Token/NftId.swift @@ -22,7 +22,7 @@ import Foundation import HederaProtobufs /// The unique identifier for a non-fungible token (NFT) instance on Hedera. -public struct NftId: LosslessStringConvertible, ExpressibleByStringLiteral, Equatable, ValidateChecksums { +public struct NftId: Sendable, LosslessStringConvertible, ExpressibleByStringLiteral, Equatable, ValidateChecksums { /// The (non-fungible) token of which this NFT is an instance. public let tokenId: TokenId diff --git a/Sources/Hedera/Token/TokenAirdropTransaction.swift b/Sources/Hedera/Token/TokenAirdropTransaction.swift new file mode 100644 index 00000000..e650ec2d --- /dev/null +++ b/Sources/Hedera/Token/TokenAirdropTransaction.swift @@ -0,0 +1,65 @@ +/* + * ‌ + * 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 GRPC +import HederaProtobufs +import SwiftProtobuf + +public final class TokenAirdropTransaction: AbstractTokenTransferTransaction { + /// Create a new `TokenAirdropTransaction`. + public override init() { + super.init() + } + + internal init(protobuf proto: Proto_TransactionBody, _ data: Proto_TokenAirdropTransactionBody) throws { + try super.init(protobuf: proto) + + tokenTransfersInner = try .fromProtobuf(data.tokenTransfers) + } + + internal override func validateChecksums(on ledgerId: LedgerId) throws { + try tokenTransfersInner.validateChecksums(on: ledgerId) + try super.validateChecksums(on: ledgerId) + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_TokenServiceAsyncClient(channel: channel).airdropTokens(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .tokenAirdrop(toProtobuf()) + } +} + +extension TokenAirdropTransaction: ToProtobuf { + internal typealias Protobuf = Proto_TokenAirdropTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + let sortedTransfers = sortTransfers() + + proto.tokenTransfers = sortedTransfers.toProtobuf() + } + } +} diff --git a/Sources/Hedera/Token/TokenCancelAirdropTransaction.swift b/Sources/Hedera/Token/TokenCancelAirdropTransaction.swift new file mode 100644 index 00000000..f28e416d --- /dev/null +++ b/Sources/Hedera/Token/TokenCancelAirdropTransaction.swift @@ -0,0 +1,106 @@ +/* + * ‌ + * 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 GRPC +import HederaProtobufs + +/// Token cancel airdrop +/// Remove one or more pending airdrops from state on behalf of the sender(s) +/// for each airdrop. +/// +/// Each pending airdrop canceled SHALL be removed from state and SHALL NOT be available to claim. +/// Each cancellation SHALL be represented in the transaction body and SHALL NOT be restated +/// in the record file. +/// All cancellations MUST succeed for this transaction to succeed. +public final class TokenCancelAirdropTransaction: Transaction { + /// Create a new `TokenCancelAirdropTransaction`. + public init( + pendingAirdropIds: [PendingAirdropId] = [] + ) { + self.pendingAirdropIds = pendingAirdropIds + + super.init() + } + + internal init(protobuf proto: Proto_TransactionBody, _ data: Proto_TokenCancelAirdropTransactionBody) throws { + self.pendingAirdropIds = try data.pendingAirdrops.map(PendingAirdropId.init) + + try super.init(protobuf: proto) + } + + /// A list of one or more pending airdrop identifiers to cancel. + public var pendingAirdropIds: [PendingAirdropId] { + willSet { + ensureNotFrozen() + } + } + + /// Adds the list of pending airdrop identifiers to cancel. + @discardableResult + public func pendingAirdropIds(_ pendingAirdropIds: [PendingAirdropId]) -> Self { + self.pendingAirdropIds = pendingAirdropIds + + return self + } + + /// Adds a pending airdrop identifier to the list of pending airdrop identifiers to cancel. + @discardableResult + public func addPendingAirdropId(_ pendingAirdropId: PendingAirdropId) -> Self { + self.pendingAirdropIds.append(pendingAirdropId) + + return self + } + + /// Clear the pending airdrop ids list + @discardableResult + public func clearPendingAirdropIds() -> Self { + self.pendingAirdropIds = [] + + return self + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_TokenServiceAsyncClient(channel: channel).cancelAirdrop(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .tokenCancelAirdrop(toProtobuf()) + } +} + +extension TokenCancelAirdropTransaction: ToProtobuf { + internal typealias Protobuf = Proto_TokenCancelAirdropTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.pendingAirdrops = pendingAirdropIds.map { $0.toProtobuf() } + } + } +} + +extension TokenCancelAirdropTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .tokenCancelAirdrop(toProtobuf()) + } +} diff --git a/Sources/Hedera/Token/TokenClaimAirdropTransaction.swift b/Sources/Hedera/Token/TokenClaimAirdropTransaction.swift new file mode 100644 index 00000000..83d1f199 --- /dev/null +++ b/Sources/Hedera/Token/TokenClaimAirdropTransaction.swift @@ -0,0 +1,114 @@ +/* + * ‌ + * 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 GRPC +import HederaProtobufs + +/// Token claim airdrop +/// Complete one or more pending transfers on behalf of the +/// recipient(s) for an airdrop. +/// +/// The sender MUST have sufficient balance to fulfill the airdrop at the +/// time of claim. If the sender does not have sufficient balance, the +/// claim SHALL fail. +/// Each pending airdrop successfully claimed SHALL be removed from state and +/// SHALL NOT be available to claim again. +/// Each claim SHALL be represented in the transaction body and +/// SHALL NOT be restated in the record file. +/// All claims MUST succeed for this transaction to succeed. +/// +/// ### Record Stream Effects +/// The completed transfers SHALL be present in the transfer list. +/// +public final class TokenClaimAirdropTransaction: Transaction { + /// Create a new `TokenClaimAirdropTransaction`. + public init( + pendingAirdropIds: [PendingAirdropId] = [] + ) { + self.pendingAirdropIds = pendingAirdropIds + + super.init() + } + + internal init(protobuf proto: Proto_TransactionBody, _ data: Proto_TokenClaimAirdropTransactionBody) throws { + self.pendingAirdropIds = try data.pendingAirdrops.map(PendingAirdropId.init) + + try super.init(protobuf: proto) + } + + /// A list of one or more pending airdrop identifiers. + public var pendingAirdropIds: [PendingAirdropId] { + willSet { + ensureNotFrozen() + } + } + + /// Set the pending airdrop ids + @discardableResult + public func pendingAirdropIds(_ pendingAirdropIds: [PendingAirdropId]) -> Self { + self.pendingAirdropIds = pendingAirdropIds + + return self + } + + /// Add a pending airdrop id + @discardableResult + public func addPendingAirdropId(_ pendingAirdropId: PendingAirdropId) -> Self { + self.pendingAirdropIds.append(pendingAirdropId) + + return self + } + + /// clear the pending airdrop ids + @discardableResult + public func clearPendingAirdropIds() -> Self { + self.pendingAirdropIds = [] + + return self + } + + internal override func transactionExecute(_ channel: GRPCChannel, _ request: Proto_Transaction) async throws + -> Proto_TransactionResponse + { + try await Proto_TokenServiceAsyncClient(channel: channel).claimAirdrop(request) + } + + internal override func toTransactionDataProtobuf(_ chunkInfo: ChunkInfo) -> Proto_TransactionBody.OneOf_Data { + _ = chunkInfo.assertSingleTransaction() + + return .tokenClaimAirdrop(toProtobuf()) + } +} + +extension TokenClaimAirdropTransaction: ToProtobuf { + internal typealias Protobuf = Proto_TokenClaimAirdropTransactionBody + + internal func toProtobuf() -> Protobuf { + .with { proto in + proto.pendingAirdrops = pendingAirdropIds.map { $0.toProtobuf() } + } + } +} + +extension TokenClaimAirdropTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .tokenClaimAirdrop(toProtobuf()) + } +} diff --git a/Sources/Hedera/Token/TokenId.swift b/Sources/Hedera/Token/TokenId.swift index 9797a4c5..d4ecd2ae 100644 --- a/Sources/Hedera/Token/TokenId.swift +++ b/Sources/Hedera/Token/TokenId.swift @@ -22,7 +22,7 @@ import Foundation import HederaProtobufs /// The unique identifier for a token on Hedera. -public struct TokenId: EntityId, ValidateChecksums, Sendable { +public struct TokenId: EntityId, ValidateChecksums, Sendable, Equatable, Comparable { public init(shard: UInt64 = 0, realm: UInt64 = 0, num: UInt64, checksum: Checksum?) { self.shard = shard self.realm = realm @@ -57,6 +57,16 @@ public struct TokenId: EntityId, ValidateChecksums, Sendable { internal func validateChecksums(on ledgerId: LedgerId) throws { try helper.validateChecksum(on: ledgerId) } + + public static func < (lhs: TokenId, rhs: TokenId) -> Bool { + if lhs.shard != rhs.shard { + return lhs.shard < rhs.shard + } + if lhs.realm != rhs.realm { + return lhs.realm < rhs.realm + } + return lhs.num < rhs.num + } } extension TokenId: ProtobufCodable { diff --git a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift index 622f979e..efb0cfee 100644 --- a/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift +++ b/Sources/Hedera/Transaction/Transaction+FromProtobuf.swift @@ -218,6 +218,18 @@ extension Transaction { let value = try intoOnlyValue(value) return try NodeDeleteTransaction(protobuf: firstBody, value) + case .tokenAirdrop(let value): + let value = try intoOnlyValue(value) + return try TokenAirdropTransaction(protobuf: firstBody, value) + + case .tokenClaimAirdrop(let value): + let value = try intoOnlyValue(value) + return try TokenClaimAirdropTransaction(protobuf: firstBody, value) + + case .tokenCancelAirdrop(let value): + let value = try intoOnlyValue(value) + return try TokenCancelAirdropTransaction(protobuf: firstBody, value) + } } diff --git a/Sources/Hedera/TransactionRecord.swift b/Sources/Hedera/TransactionRecord.swift index 1c512195..22e826c6 100644 --- a/Sources/Hedera/TransactionRecord.swift +++ b/Sources/Hedera/TransactionRecord.swift @@ -97,6 +97,9 @@ public struct TransactionRecord { /// In the record of a PRNG transaction with an output range, the output of a PRNG /// whose input was a 384-bit string. public let prngNumber: UInt32? + + /// A list of pending airdrop records. + public let pendingAirdropRecords: [PendingAirdropRecord] } extension TransactionRecord { @@ -140,6 +143,12 @@ extension TransactionRecord { tokenTransfers[tokenId] = innerTokenTransfers } + var pendingAirdropRecords: [PendingAirdropRecord] = [] + + pendingAirdropRecords = try proto.newPendingAirdrops.map { + try PendingAirdropRecord.fromProtobuf($0) + } + let evmAddress = !proto.evmAddress.isEmpty ? try EvmAddress(proto.evmAddress) : nil let prngBytes: Data? @@ -178,7 +187,8 @@ extension TransactionRecord { ethereumHash: proto.ethereumHash, evmAddress: evmAddress, prngBytes: prngBytes, - prngNumber: prngNumber + prngNumber: prngNumber, + pendingAirdropRecords: pendingAirdropRecords ) } } diff --git a/Sources/Hedera/TransferTransaction.swift b/Sources/Hedera/TransferTransaction.swift index 8d01aa65..365d8d10 100644 --- a/Sources/Hedera/TransferTransaction.swift +++ b/Sources/Hedera/TransferTransaction.swift @@ -34,112 +34,24 @@ import SwiftProtobuf /// /// As an example: /// For a fungible token with `3` decimals (and let's say the symbol is `ƒ`), transferring `1` _always_ transfers `0.001 ƒ`. -public final class TransferTransaction: Transaction { - // avoid scope collisions by nesting :/ - fileprivate struct Transfer: ValidateChecksums { - let accountId: AccountId - let amount: Int64 - let isApproval: Bool - - internal func validateChecksums(on ledgerId: LedgerId) throws { - try accountId.validateChecksums(on: ledgerId) - } - } - - fileprivate struct TokenTransfer: ValidateChecksums { - let tokenId: TokenId - var transfers: [TransferTransaction.Transfer] - var nftTransfers: [TransferTransaction.NftTransfer] - var expectedDecimals: UInt32? - - internal func validateChecksums(on ledgerId: LedgerId) throws { - try tokenId.validateChecksums(on: ledgerId) - try transfers.validateChecksums(on: ledgerId) - try nftTransfers.validateChecksums(on: ledgerId) - } - } - - fileprivate struct NftTransfer: ValidateChecksums { - let senderAccountId: AccountId - let receiverAccountId: AccountId - let serial: UInt64 - let isApproval: Bool - - internal func validateChecksums(on ledgerId: LedgerId) throws { - try senderAccountId.validateChecksums(on: ledgerId) - try receiverAccountId.validateChecksums(on: ledgerId) - } - } - - private var transfers: [TransferTransaction.Transfer] = [] { - willSet { - ensureNotFrozen(fieldName: "transfers") - } - } - - public var hbarTransfers: [AccountId: Hbar] { - Dictionary( - transfers.lazy.map { ($0.accountId, .fromTinybars($0.amount)) }, - uniquingKeysWith: { (first, second) in first }) - } - - public var tokenTransfers: [TokenId: [AccountId: Int64]] { - Dictionary( - tokenTransfersInner.lazy.map { item in - ( - item.tokenId, - Dictionary( - item.transfers.lazy.map { ($0.accountId, $0.amount) }, - uniquingKeysWith: { first, _ in first } - ) - ) - }, - uniquingKeysWith: { (first, _) in first } - ) - } - - public var tokenNftTransfers: [TokenId: [TokenNftTransfer]] { - Dictionary( - tokenTransfersInner.lazy.map { item in - ( - item.tokenId, - item.nftTransfers.map { TokenNftTransfer(nftTransfer: $0, withTokenId: item.tokenId) } - ) - }, - uniquingKeysWith: { (first, _) in first } - ) - } - - private var tokenTransfersInner: [TransferTransaction.TokenTransfer] = [] { - willSet { - ensureNotFrozen(fieldName: "tokenTransfers") - } - } - - public var tokenDecimals: [TokenId: UInt32] { - Dictionary( - tokenTransfersInner.lazy.compactMap { elem in - guard let decimals = elem.expectedDecimals else { - return nil - } - - return (elem.tokenId, decimals) - }, - uniquingKeysWith: { first, _ in first } - ) - } - +public final class TransferTransaction: AbstractTokenTransferTransaction { /// Create a new `TransferTransaction`. public override init() { super.init() } internal init(protobuf proto: Proto_TransactionBody, _ data: Proto_CryptoTransferTransactionBody) throws { + try super.init(protobuf: proto) + // init fields transfers = try .fromProtobuf(data.transfers.accountAmounts) tokenTransfersInner = try .fromProtobuf(data.tokenTransfers) + } - try super.init(protobuf: proto) + public var hbarTransfers: [AccountId: Hbar] { + Dictionary( + transfers.lazy.map { ($0.accountId, .fromTinybars($0.amount)) }, + uniquingKeysWith: { (first, second) in first }) } /// Add a non-approved hbar transfer to the transaction. @@ -154,60 +66,6 @@ public final class TransferTransaction: Transaction { doHbarTransfer(accountId, amount.toTinybars(), true) } - /// Add a non-approved token transfer to the transaction. - /// - /// `amount` is in the lowest denomination for the token (if the token has `2` decimals this would be `0.01` tokens). - @discardableResult - public func tokenTransfer(_ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64) -> Self { - doTokenTransfer(tokenId, accountId, amount, false, nil) - } - - /// Add an approved token transfer to the transaction. - /// - /// `amount` is in the lowest denomination for the token (if the token has `2` decimals this would be `0.01` tokens). - @discardableResult - public func approvedTokenTransfer(_ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64) -> Self { - doTokenTransfer(tokenId, accountId, amount, true, nil) - } - - /// Add a non-approved token transfer with decimals to the transaction, ensuring that the token has `expectedDecimals` decimals. - /// - /// `amount` is _still_ in the lowest denomination, however, - /// you will get an error if the token has a different amount of decimals than `expectedDecimals`. - @discardableResult - public func tokenTransferWithDecimals( - _ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64, _ expectedDecimals: UInt32 - ) -> Self { - doTokenTransfer(tokenId, accountId, amount, false, expectedDecimals) - } - - /// Add an approved token transfer with decimals to the transaction, ensuring that the token has `expectedDecimals` decimals. - /// - /// `amount` is _still_ in the lowest denomination, however, - /// you will get an error if the token has a different amount of decimals than `expectedDecimals`. - @discardableResult - public func approvedTokenTransferWithDecimals( - _ tokenId: TokenId, _ accountId: AccountId, _ amount: Int64, _ expectedDecimals: UInt32 - ) -> Self { - doTokenTransfer(tokenId, accountId, amount, false, expectedDecimals) - } - - /// Add a non-approved nft transfer to the transaction. - @discardableResult - public func nftTransfer(_ nftId: NftId, _ senderAccountId: AccountId, _ receiverAccountId: AccountId) - -> Self - { - doNftTransfer(nftId, senderAccountId, receiverAccountId, false) - } - - /// Add an approved nft transfer to the transaction. - @discardableResult - public func approvedNftTransfer( - _ nftId: NftId, _ senderAccountId: AccountId, _ receiverAccountId: AccountId - ) -> Self { - doNftTransfer(nftId, senderAccountId, receiverAccountId, true) - } - private func doHbarTransfer( _ accountId: AccountId, _ amount: Int64, @@ -218,63 +76,6 @@ public final class TransferTransaction: Transaction { return self } - private func doTokenTransfer( - _ tokenId: TokenId, - _ accountId: AccountId, - _ amount: Int64, - _ approved: Bool, - _ expectedDecimals: UInt32? - ) -> Self { - let transfer = Transfer(accountId: accountId, amount: amount, isApproval: approved) - - if let firstIndex = tokenTransfersInner.firstIndex(where: { (tokenTransfer) in tokenTransfer.tokenId == tokenId - }) { - tokenTransfersInner[firstIndex].expectedDecimals = expectedDecimals - tokenTransfersInner[firstIndex].transfers.append(transfer) - } else { - tokenTransfersInner.append( - TokenTransfer( - tokenId: tokenId, - transfers: [transfer], - nftTransfers: [], - expectedDecimals: expectedDecimals - )) - } - - return self - } - - private func doNftTransfer( - _ nftId: NftId, - _ senderAccountId: AccountId, - _ receiverAccountId: AccountId, - _ approved: Bool - ) -> Self { - let transfer = NftTransfer( - senderAccountId: senderAccountId, - receiverAccountId: receiverAccountId, - serial: nftId.serial, - isApproval: approved - ) - - if let index = tokenTransfersInner.firstIndex(where: { transfer in transfer.tokenId == nftId.tokenId }) { - var tmp = tokenTransfersInner[index] - tmp.nftTransfers.append(transfer) - tokenTransfersInner[index] = tmp - } else { - tokenTransfersInner.append( - TokenTransfer( - tokenId: nftId.tokenId, - transfers: [], - nftTransfers: [transfer], - expectedDecimals: nil - ) - ) - } - - return self - } - internal override func validateChecksums(on ledgerId: LedgerId) throws { try transfers.validateChecksums(on: ledgerId) try tokenTransfersInner.validateChecksums(on: ledgerId) @@ -294,71 +95,9 @@ public final class TransferTransaction: Transaction { } } -extension TransferTransaction.Transfer: TryProtobufCodable { - fileprivate typealias Protobuf = Proto_AccountAmount - - fileprivate init(protobuf proto: Protobuf) throws { - self.init( - accountId: try .fromProtobuf(proto.accountID), - amount: proto.amount, - isApproval: proto.isApproval - ) - } - - fileprivate func toProtobuf() -> Protobuf { - .with { proto in - proto.accountID = accountId.toProtobuf() - proto.amount = amount - proto.isApproval = isApproval - } - } -} - -extension TransferTransaction.TokenTransfer: TryProtobufCodable { - fileprivate typealias Protobuf = Proto_TokenTransferList - - fileprivate init(protobuf proto: Protobuf) throws { - self.init( - tokenId: .fromProtobuf(proto.token), - transfers: try .fromProtobuf(proto.transfers), - nftTransfers: try .fromProtobuf(proto.nftTransfers), - expectedDecimals: proto.hasExpectedDecimals ? proto.expectedDecimals.value : nil - ) - transfers = try .fromProtobuf(proto.transfers) - - } - - fileprivate func toProtobuf() -> Protobuf { - .with { proto in - proto.token = tokenId.toProtobuf() - proto.transfers = transfers.toProtobuf() - proto.nftTransfers = nftTransfers.toProtobuf() - if let expectedDecimals = expectedDecimals { - proto.expectedDecimals = Google_Protobuf_UInt32Value(expectedDecimals) - } - } - } -} - -extension TransferTransaction.NftTransfer: TryProtobufCodable { - fileprivate typealias Protobuf = Proto_NftTransfer - - fileprivate init(protobuf proto: Protobuf) throws { - self.init( - senderAccountId: try .fromProtobuf(proto.senderAccountID), - receiverAccountId: try .fromProtobuf(proto.receiverAccountID), - serial: UInt64(proto.serialNumber), - isApproval: proto.isApproval - ) - } - - fileprivate func toProtobuf() -> Protobuf { - .with { proto in - proto.senderAccountID = senderAccountId.toProtobuf() - proto.receiverAccountID = receiverAccountId.toProtobuf() - proto.serialNumber = Int64(bitPattern: serial) - proto.isApproval = isApproval - } +extension TransferTransaction { + internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { + .cryptoTransfer(toProtobuf()) } } @@ -372,21 +111,3 @@ extension TransferTransaction: ToProtobuf { } } } - -extension TransferTransaction { - internal func toSchedulableTransactionData() -> Proto_SchedulableTransactionBody.OneOf_Data { - .cryptoTransfer(toProtobuf()) - } -} - -extension TokenNftTransfer { - fileprivate init(nftTransfer: TransferTransaction.NftTransfer, withTokenId tokenId: TokenId) { - self.init( - tokenId: tokenId, - sender: nftTransfer.senderAccountId, - receiver: nftTransfer.receiverAccountId, - serial: nftTransfer.serial, - isApproved: nftTransfer.isApproval - ) - } -} diff --git a/Sources/HederaProtobufs/Services/basic_types.pb.swift b/Sources/HederaProtobufs/Services/basic_types.pb.swift index 5d0c428f..63e8ac51 100644 --- a/Sources/HederaProtobufs/Services/basic_types.pb.swift +++ b/Sources/HederaProtobufs/Services/basic_types.pb.swift @@ -20,12 +20,60 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } +///* +/// A specific hash algorithm. +/// +/// We did not reuse Record Stream `HashAlgorithm` here because in all cases, +/// currently, this will be `SHA2_384` and if that is the default value then +/// we can save space by not serializing it, whereas `HASH_ALGORITHM_UNKNOWN` +/// is the default for Record Stream `HashAlgorithm`. +/// +/// Note that enum values here MUST NOT match the name of any other enum value +/// in the same `package`, as protobuf follows `C++` scope rules and all enum +/// _names_ are treated as global constants within the `package`. +public enum Proto_BlockHashAlgorithm: SwiftProtobuf.Enum, Swift.CaseIterable { + public typealias RawValue = Int + + ///* + /// A SHA2 algorithm SHA-384 hash. + ///

+ /// This is the default value, if a field of this enumerated type is + /// not set, then this is the value that will be decoded when the + /// serialized message is read. + case sha2384 // = 0 + case UNRECOGNIZED(Int) + + public init() { + self = .sha2384 + } + + public init?(rawValue: Int) { + switch rawValue { + case 0: self = .sha2384 + default: self = .UNRECOGNIZED(rawValue) + } + } + + public var rawValue: Int { + switch self { + case .sha2384: return 0 + case .UNRECOGNIZED(let i): return i + } + } + + // The compiler won't synthesize support with the UNRECOGNIZED case. + public static let allCases: [Proto_BlockHashAlgorithm] = [ + .sha2384, + ] + +} + ///* /// Possible Token Types (IWA Compatibility). /// Apart from fungible and non-fungible, Tokens can have either a common or unique representation. /// This distinction might seem subtle, but it is important when considering how tokens can be traced /// and if they can have isolated and unique properties. -public enum Proto_TokenType: SwiftProtobuf.Enum { +public enum Proto_TokenType: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -61,19 +109,13 @@ public enum Proto_TokenType: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenType] = [ .fungibleCommon, .nonFungibleUnique, ] -} -#endif // swift(>=4.2) +} ///* /// Allows a set of resource prices to be scoped to a certain type of a HAPI operation. @@ -85,7 +127,7 @@ extension Proto_TokenType: CaseIterable { /// Similarly, the resource prices for a basic TokenCreate without a custom fee schedule yield a /// total price of $1. The resource prices for a TokenCreate with a custom fee schedule are different /// and yield a total base price of $2. -public enum Proto_SubType: SwiftProtobuf.Enum { +public enum Proto_SubType: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -143,11 +185,6 @@ public enum Proto_SubType: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_SubType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_SubType] = [ .default, @@ -157,14 +194,13 @@ extension Proto_SubType: CaseIterable { .tokenNonFungibleUniqueWithCustomFees, .scheduleCreateContractCall, ] -} -#endif // swift(>=4.2) +} ///* /// Possible Token Supply Types (IWA Compatibility). /// Indicates how many tokens can have during its lifetime. -public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { +public enum Proto_TokenSupplyType: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -197,23 +233,17 @@ public enum Proto_TokenSupplyType: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenSupplyType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenSupplyType] = [ .infinite, .finite, ] -} -#endif // swift(>=4.2) +} ///* /// Types of validation strategies for token keys. -public enum Proto_TokenKeyValidation: SwiftProtobuf.Enum { +public enum Proto_TokenKeyValidation: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -245,24 +275,18 @@ public enum Proto_TokenKeyValidation: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenKeyValidation: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenKeyValidation] = [ .fullValidation, .noValidation, ] -} -#endif // swift(>=4.2) +} ///* /// Possible Freeze statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in /// TokenRelationship -public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { +public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -300,24 +324,18 @@ public enum Proto_TokenFreezeStatus: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenFreezeStatus: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenFreezeStatus] = [ .freezeNotApplicable, .frozen, .unfrozen, ] -} -#endif // swift(>=4.2) +} ///* /// Possible KYC statuses returned on TokenGetInfoQuery or CryptoGetInfoResponse in TokenRelationship -public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { +public enum Proto_TokenKycStatus: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -355,24 +373,18 @@ public enum Proto_TokenKycStatus: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenKycStatus: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenKycStatus] = [ .kycNotApplicable, .granted, .revoked, ] -} -#endif // swift(>=4.2) +} ///* /// Possible Pause statuses returned on TokenGetInfoQuery -public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { +public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -410,24 +422,18 @@ public enum Proto_TokenPauseStatus: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_TokenPauseStatus: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_TokenPauseStatus] = [ .pauseNotApplicable, .paused, .unpaused, ] -} -#endif // swift(>=4.2) +} ///* /// The transactions and queries supported by Hedera Hashgraph. -public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { +public enum Proto_HederaFunctionality: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -938,11 +944,6 @@ public enum Proto_HederaFunctionality: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_HederaFunctionality: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_HederaFunctionality] = [ .none, @@ -1028,9 +1029,8 @@ extension Proto_HederaFunctionality: CaseIterable { .tokenCancelAirdrop, .tokenClaimAirdrop, ] -} -#endif // swift(>=4.2) +} ///* /// Each shard has a nonnegative shard number. Each realm within a given shard has a nonnegative @@ -1045,7 +1045,7 @@ extension Proto_HederaFunctionality: CaseIterable { /// in just a single realm, locking all those entities while it's running, but other smart contracts /// could potentially run in other realms in parallel. So realms allow Solidity to be parallelized /// somewhat, even though the language itself assumes everything is serial. -public struct Proto_ShardID { +public struct Proto_ShardID: Sendable { // 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. @@ -1062,7 +1062,7 @@ public struct Proto_ShardID { ///* /// The ID for a realm. Within a given shard, every realm has a unique ID. Each account, file, and /// contract instance belongs to exactly one realm. -public struct Proto_RealmID { +public struct Proto_RealmID: Sendable { // 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. @@ -1082,7 +1082,7 @@ public struct Proto_RealmID { ///* /// The ID for an a cryptocurrency account -public struct Proto_AccountID { +public struct Proto_AccountID: @unchecked Sendable { // 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. @@ -1142,7 +1142,7 @@ public struct Proto_AccountID { /// The account number unique within its realm which can be a non-negative integer, an alias public key or an EVM address. /// For any AccountID fields in the query response, transaction record or transaction receipt only accountNum will /// be populated. - public enum OneOf_Account: Equatable { + public enum OneOf_Account: Equatable, @unchecked Sendable { ///* /// A non-negative account number unique within its realm case accountNum(Int64) @@ -1165,24 +1165,6 @@ public struct Proto_AccountID { /// that map to the EVM address bytes. The provided public key bytes will then serve as the final alias bytes. case alias(Data) - #if !swift(>=4.1) - public static func ==(lhs: Proto_AccountID.OneOf_Account, rhs: Proto_AccountID.OneOf_Account) -> 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 (.accountNum, .accountNum): return { - guard case .accountNum(let l) = lhs, case .accountNum(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.alias, .alias): return { - guard case .alias(let l) = lhs, case .alias(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -1190,7 +1172,7 @@ public struct Proto_AccountID { ///* /// Identifier for a unique token (or "NFT"), used by both contract and token services. -public struct Proto_NftID { +public struct Proto_NftID: Sendable { // 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. @@ -1220,7 +1202,7 @@ public struct Proto_NftID { ///* /// The ID for a file -public struct Proto_FileID { +public struct Proto_FileID: Sendable { // 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. @@ -1244,7 +1226,7 @@ public struct Proto_FileID { ///* /// The ID for a smart contract instance -public struct Proto_ContractID { +public struct Proto_ContractID: @unchecked Sendable { // 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. @@ -1296,7 +1278,7 @@ public struct Proto_ContractID { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Contract: Equatable { + public enum OneOf_Contract: Equatable, @unchecked Sendable { ///* /// A nonnegative number unique within a given shard and realm case contractNum(Int64) @@ -1319,24 +1301,6 @@ public struct Proto_ContractID { /// EVM address described above.) case evmAddress(Data) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractID.OneOf_Contract, rhs: Proto_ContractID.OneOf_Contract) -> 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 (.contractNum, .contractNum): return { - guard case .contractNum(let l) = lhs, case .contractNum(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.evmAddress, .evmAddress): return { - guard case .evmAddress(let l) = lhs, case .evmAddress(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -1358,7 +1322,7 @@ public struct Proto_ContractID { /// ScheduleCreate transaction that created it. That is to say that they are equal /// - The scheduled property is true for Scheduled Transactions /// - transactionValidStart, accountID and scheduled properties should be omitted -public struct Proto_TransactionID { +public struct Proto_TransactionID: Sendable { // 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. @@ -1410,7 +1374,7 @@ public struct Proto_TransactionID { ///* /// An account, and the amount that it sends or receives during a cryptocurrency or token transfer. -public struct Proto_AccountAmount { +public struct Proto_AccountAmount: Sendable { // 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. @@ -1446,7 +1410,7 @@ public struct Proto_AccountAmount { ///* /// A list of accounts and amounts to transfer out of each account (negative) or into it (positive). -public struct Proto_TransferList { +public struct Proto_TransferList: Sendable { // 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. @@ -1465,7 +1429,7 @@ public struct Proto_TransferList { /// A sender account, a receiver account, and the serial number of an NFT of a Token with /// NON_FUNGIBLE_UNIQUE type. When minting NFTs the sender will be the default AccountID instance /// (0.0.0) and when burning NFTs, the receiver will be the default AccountID instance. -public struct Proto_NftTransfer { +public struct Proto_NftTransfer: Sendable { // 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. @@ -1512,7 +1476,7 @@ public struct Proto_NftTransfer { ///* /// A list of token IDs and amounts representing the transferred out (negative) or into (positive) /// amounts, represented in the lowest denomination of the token -public struct Proto_TokenTransferList { +public struct Proto_TokenTransferList: Sendable { // 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. @@ -1560,7 +1524,7 @@ public struct Proto_TokenTransferList { ///* /// A rational number, used to set the amount of a value transfer to collect as a custom fee -public struct Proto_Fraction { +public struct Proto_Fraction: Sendable { // 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. @@ -1580,7 +1544,7 @@ public struct Proto_Fraction { ///* /// Unique identifier for a topic (used by the consensus service) -public struct Proto_TopicID { +public struct Proto_TopicID: Sendable { // 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. @@ -1604,7 +1568,7 @@ public struct Proto_TopicID { ///* /// Unique identifier for a token -public struct Proto_TokenID { +public struct Proto_TokenID: Sendable { // 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. @@ -1628,7 +1592,7 @@ public struct Proto_TokenID { ///* /// Unique identifier for a Schedule -public struct Proto_ScheduleID { +public struct Proto_ScheduleID: Sendable { // 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. @@ -1687,7 +1651,7 @@ public struct Proto_ScheduleID { /// Key -> ThresholdKey -> KeyList -> Key -> ThresholdKey -> KeyList -> Key. /// /// Each Key should not have more than 46 levels, which implies 15 levels of nested ThresholdKeys. -public struct Proto_Key { +public struct Proto_Key: @unchecked Sendable { // 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. @@ -1782,7 +1746,7 @@ public struct Proto_Key { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Key: Equatable { + public enum OneOf_Key: Equatable, @unchecked Sendable { ///* /// smart contract instance that is authorized as if it had signed with a key case contractID(Proto_ContractID) @@ -1814,48 +1778,6 @@ public struct Proto_Key { /// the contract with the given id.) case delegatableContractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_Key.OneOf_Key, rhs: Proto_Key.OneOf_Key) -> 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 (.contractID, .contractID): return { - guard case .contractID(let l) = lhs, case .contractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ed25519, .ed25519): return { - guard case .ed25519(let l) = lhs, case .ed25519(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rsa3072, .rsa3072): return { - guard case .rsa3072(let l) = lhs, case .rsa3072(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ecdsa384, .ecdsa384): return { - guard case .ecdsa384(let l) = lhs, case .ecdsa384(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.thresholdKey, .thresholdKey): return { - guard case .thresholdKey(let l) = lhs, case .thresholdKey(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.keyList, .keyList): return { - guard case .keyList(let l) = lhs, case .keyList(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ecdsaSecp256K1, .ecdsaSecp256K1): return { - guard case .ecdsaSecp256K1(let l) = lhs, case .ecdsaSecp256K1(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.delegatableContractID, .delegatableContractID): return { - guard case .delegatableContractID(let l) = lhs, case .delegatableContractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -1867,7 +1789,7 @@ public struct Proto_Key { /// with ThresholdKeys, then a transaction to move cryptocurrency out of it must be signed by a list /// of M signatures, where at most M-N of them are blank, and the other at least N of them are valid /// signatures corresponding to at least N of the public keys listed here. -public struct Proto_ThresholdKey { +public struct Proto_ThresholdKey: Sendable { // 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. @@ -1898,7 +1820,7 @@ public struct Proto_ThresholdKey { /// A list of keys that requires all keys (M-of-M) to sign unless otherwise specified in /// documentation. A KeyList may contain repeated keys, but all repeated keys are only required to /// sign once. -public struct Proto_KeyList { +public struct Proto_KeyList: Sendable { // 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. @@ -1917,7 +1839,9 @@ public struct Proto_KeyList { /// here only for historical reasons. /// /// Please use the SignaturePair and SignatureMap messages. -public struct Proto_Signature { +/// +/// NOTE: This message was marked as deprecated in the .proto file. +public struct Proto_Signature: @unchecked Sendable { // 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. @@ -1987,7 +1911,7 @@ public struct Proto_Signature { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Signature: Equatable { + public enum OneOf_Signature: Equatable, @unchecked Sendable { ///* /// smart contract virtual signature (always length zero) case contract(Data) @@ -2008,40 +1932,6 @@ public struct Proto_Signature { /// A list of M signatures, each corresponding to a Key in a KeyList of the same length. case signatureList(Proto_SignatureList) - #if !swift(>=4.1) - public static func ==(lhs: Proto_Signature.OneOf_Signature, rhs: Proto_Signature.OneOf_Signature) -> 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 (.contract, .contract): return { - guard case .contract(let l) = lhs, case .contract(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ed25519, .ed25519): return { - guard case .ed25519(let l) = lhs, case .ed25519(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rsa3072, .rsa3072): return { - guard case .rsa3072(let l) = lhs, case .rsa3072(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ecdsa384, .ecdsa384): return { - guard case .ecdsa384(let l) = lhs, case .ecdsa384(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.thresholdSignature, .thresholdSignature): return { - guard case .thresholdSignature(let l) = lhs, case .thresholdSignature(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.signatureList, .signatureList): return { - guard case .signatureList(let l) = lhs, case .signatureList(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -2052,7 +1942,9 @@ public struct Proto_Signature { /// here only for historical reasons. /// /// Please use the SignaturePair and SignatureMap messages. -public struct Proto_ThresholdSignature { +/// +/// NOTE: This message was marked as deprecated in the .proto file. +public struct Proto_ThresholdSignature: Sendable { // 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. @@ -2081,7 +1973,9 @@ public struct Proto_ThresholdSignature { /// here only for historical reasons. /// /// Please use the SignaturePair and SignatureMap messages. -public struct Proto_SignatureList { +/// +/// NOTE: This message was marked as deprecated in the .proto file. +public struct Proto_SignatureList: Sendable { // 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. @@ -2107,7 +2001,7 @@ public struct Proto_SignatureList { /// since we require the compressed form of the public key. /// /// Only Ed25519 and ECDSA(secp256k1) keys and hence signatures are currently supported. -public struct Proto_SignaturePair { +public struct Proto_SignaturePair: @unchecked Sendable { // 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. @@ -2170,7 +2064,7 @@ public struct Proto_SignaturePair { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Signature: Equatable { + public enum OneOf_Signature: Equatable, @unchecked Sendable { ///* /// smart contract virtual signature (always length zero) case contract(Data) @@ -2187,36 +2081,6 @@ public struct Proto_SignaturePair { /// ECDSA(secp256k1) signature case ecdsaSecp256K1(Data) - #if !swift(>=4.1) - public static func ==(lhs: Proto_SignaturePair.OneOf_Signature, rhs: Proto_SignaturePair.OneOf_Signature) -> 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 (.contract, .contract): return { - guard case .contract(let l) = lhs, case .contract(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ed25519, .ed25519): return { - guard case .ed25519(let l) = lhs, case .ed25519(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.rsa3072, .rsa3072): return { - guard case .rsa3072(let l) = lhs, case .rsa3072(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ecdsa384, .ecdsa384): return { - guard case .ecdsa384(let l) = lhs, case .ecdsa384(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ecdsaSecp256K1, .ecdsaSecp256K1): return { - guard case .ecdsaSecp256K1(let l) = lhs, case .ecdsaSecp256K1(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -2226,7 +2090,7 @@ public struct Proto_SignaturePair { /// A set of signatures corresponding to every unique public key used to sign a given transaction. If /// one public key matches more than one prefixes on the signature map, the transaction containing /// the map will fail immediately with the response code KEY_PREFIX_MISMATCH. -public struct Proto_SignatureMap { +public struct Proto_SignatureMap: Sendable { // 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. @@ -2245,7 +2109,7 @@ public struct Proto_SignatureMap { /// in fee calculations. Nodes multiply the amount of resources consumed by a transaction or query /// by the corresponding price to calculate the appropriate fee. Units are one-thousandth of a /// tinyCent. -public struct Proto_FeeComponents { +public struct Proto_FeeComponents: Sendable { // 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. @@ -2301,7 +2165,7 @@ public struct Proto_FeeComponents { ///* /// The fees for a specific transaction or query based on the fee data. -public struct Proto_TransactionFeeSchedule { +public struct Proto_TransactionFeeSchedule: Sendable { // 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. @@ -2312,6 +2176,8 @@ public struct Proto_TransactionFeeSchedule { ///* /// Resource price coefficients + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var feeData: Proto_FeeData { get {return _feeData ?? Proto_FeeData()} set {_feeData = newValue} @@ -2337,7 +2203,7 @@ public struct Proto_TransactionFeeSchedule { /// compensates the specific node that submitted the transaction, a network fee that compensates the /// network for assigning the transaction a consensus timestamp, and a service fee that compensates /// the network for the ongoing maintenance of the consequences of the transaction. -public struct Proto_FeeData { +public struct Proto_FeeData: @unchecked Sendable { // 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. @@ -2395,7 +2261,7 @@ public struct Proto_FeeData { /// A list of resource prices fee for different transactions and queries and the time period at which /// this fee schedule will expire. Nodes use the prices to determine the fees for all transactions /// based on how much of those resources each transaction uses. -public struct Proto_FeeSchedule { +public struct Proto_FeeSchedule: Sendable { // 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. @@ -2424,7 +2290,7 @@ public struct Proto_FeeSchedule { ///* /// This contains two Fee Schedules with expiry timestamp. -public struct Proto_CurrentAndNextFeeSchedule { +public struct Proto_CurrentAndNextFeeSchedule: Sendable { // 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. @@ -2468,7 +2334,7 @@ public struct Proto_CurrentAndNextFeeSchedule { /// MUST NOT be set.
/// When the `ipAddressV4` field is set, the `domain_name` field /// MUST NOT be set. -public struct Proto_ServiceEndpoint { +public struct Proto_ServiceEndpoint: @unchecked Sendable { // 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. @@ -2505,7 +2371,7 @@ public struct Proto_ServiceEndpoint { /// /// All fields are populated in the 0.0.102 address book file while only fields that start with # are /// populated in the 0.0.101 address book file. -public struct Proto_NodeAddress { +public struct Proto_NodeAddress: @unchecked Sendable { // 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. @@ -2513,15 +2379,21 @@ public struct Proto_NodeAddress { ///* /// The IP address of the Node with separator & octets encoded in UTF-8. Usage is deprecated, /// ServiceEndpoint is preferred to retrieve a node's list of IP addresses and ports + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var ipAddress: Data = Data() ///* /// The port number of the grpc server for the node. Usage is deprecated, ServiceEndpoint is /// preferred to retrieve a node's list of IP addresses and ports + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var portno: Int32 = 0 ///* /// Usage is deprecated, nodeAccountId is preferred to retrieve a node's account ID + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var memo: Data = Data() ///* @@ -2562,6 +2434,8 @@ public struct Proto_NodeAddress { ///* /// [Deprecated] The amount of tinybars staked to the node + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var stake: Int64 = 0 public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -2574,7 +2448,7 @@ public struct Proto_NodeAddress { ///* /// A list of nodes and their metadata that contains all details of the nodes for the network. Used /// to parse the contents of system files 0.0.101 and 0.0.102. -public struct Proto_NodeAddressBook { +public struct Proto_NodeAddressBook: Sendable { // 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. @@ -2593,7 +2467,7 @@ public struct Proto_NodeAddressBook { /// Services software. This type allows the getVersionInfo query in the /// NetworkService to return the deployed versions of both protobufs and software on the /// node answering the query. -public struct Proto_SemanticVersion { +public struct Proto_SemanticVersion: Sendable { // 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. @@ -2630,7 +2504,7 @@ public struct Proto_SemanticVersion { ///* /// UNDOCUMENTED -public struct Proto_Setting { +public struct Proto_Setting: @unchecked Sendable { // 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. @@ -2654,7 +2528,7 @@ public struct Proto_Setting { ///* /// UNDOCUMENTED -public struct Proto_ServicesConfigurationList { +public struct Proto_ServicesConfigurationList: Sendable { // 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. @@ -2670,7 +2544,7 @@ public struct Proto_ServicesConfigurationList { ///* /// Token's information related to the given Account -public struct Proto_TokenRelationship { +public struct Proto_TokenRelationship: Sendable { // 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. @@ -2731,7 +2605,7 @@ public struct Proto_TokenRelationship { /// (decimals=8). /// /// Transferable units are not directly comparable across different tokens. -public struct Proto_TokenBalance { +public struct Proto_TokenBalance: Sendable { // 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. @@ -2766,7 +2640,7 @@ public struct Proto_TokenBalance { ///* /// A sequence of token balances -public struct Proto_TokenBalances { +public struct Proto_TokenBalances: Sendable { // 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. @@ -2778,8 +2652,8 @@ public struct Proto_TokenBalances { public init() {} } -/// A token - account association -public struct Proto_TokenAssociation { +/// A token - account association +public struct Proto_TokenAssociation: Sendable { // 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. @@ -2814,7 +2688,7 @@ public struct Proto_TokenAssociation { ///* /// Staking metadata for an account or a contract returned in CryptoGetInfo or ContractGetInfo queries -public struct Proto_StakingInfo { +public struct Proto_StakingInfo: Sendable { // 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. @@ -2872,7 +2746,7 @@ public struct Proto_StakingInfo { ///* /// ID of the account or node to which this account or contract is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// The account to which this account or contract is staking. case stakedAccountID(Proto_AccountID) @@ -2880,24 +2754,6 @@ public struct Proto_StakingInfo { /// The ID of the node this account or contract is staked to. case stakedNodeID(Int64) - #if !swift(>=4.1) - public static func ==(lhs: Proto_StakingInfo.OneOf_StakedID, rhs: Proto_StakingInfo.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() {} @@ -2911,7 +2767,7 @@ public struct Proto_StakingInfo { /// Each pending airdrop SHALL be uniquely identified by a PendingAirdropId. /// A PendingAirdropId SHALL be recorded when created and MUST be provided in any transaction /// that would modify that pending airdrop (such as a `claimAirdrop` or `cancelAirdrop`). -public struct Proto_PendingAirdropId { +public struct Proto_PendingAirdropId: Sendable { // 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. @@ -2972,7 +2828,7 @@ public struct Proto_PendingAirdropId { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_TokenReference: Equatable { + public enum OneOf_TokenReference: Equatable, Sendable { ///* /// A token ID.
/// This is the type of token for a fungible/common token airdrop.
@@ -2986,24 +2842,6 @@ public struct Proto_PendingAirdropId { /// fungible/common token. case nonFungibleToken(Proto_NftID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_PendingAirdropId.OneOf_TokenReference, rhs: Proto_PendingAirdropId.OneOf_TokenReference) -> Bool { - // The use of inline closures is to circumvent an issue where the compiler - // allocates stack space for every case branch when no optimizations are - // enabled. https://github.com/apple/swift-protobuf/issues/1034 - switch (lhs, rhs) { - case (.fungibleTokenType, .fungibleTokenType): return { - guard case .fungibleTokenType(let l) = lhs, case .fungibleTokenType(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nonFungibleToken, .nonFungibleToken): return { - guard case .nonFungibleToken(let l) = lhs, case .nonFungibleToken(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -3023,7 +2861,7 @@ public struct Proto_PendingAirdropId { /// It is RECOMMENDED that implementations store pending airdrop information as a key-value map /// from `PendingAirdropId` to `PendingAirdropValue`, with a `null` value used for non-fungible /// pending airdrops. -public struct Proto_PendingAirdropValue { +public struct Proto_PendingAirdropValue: Sendable { // 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. @@ -3043,69 +2881,16 @@ public struct Proto_PendingAirdropValue { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenType: @unchecked Sendable {} -extension Proto_SubType: @unchecked Sendable {} -extension Proto_TokenSupplyType: @unchecked Sendable {} -extension Proto_TokenKeyValidation: @unchecked Sendable {} -extension Proto_TokenFreezeStatus: @unchecked Sendable {} -extension Proto_TokenKycStatus: @unchecked Sendable {} -extension Proto_TokenPauseStatus: @unchecked Sendable {} -extension Proto_HederaFunctionality: @unchecked Sendable {} -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 {} -extension Proto_TransactionID: @unchecked Sendable {} -extension Proto_AccountAmount: @unchecked Sendable {} -extension Proto_TransferList: @unchecked Sendable {} -extension Proto_NftTransfer: @unchecked Sendable {} -extension Proto_TokenTransferList: @unchecked Sendable {} -extension Proto_Fraction: @unchecked Sendable {} -extension Proto_TopicID: @unchecked Sendable {} -extension Proto_TokenID: @unchecked Sendable {} -extension Proto_ScheduleID: @unchecked Sendable {} -extension Proto_Key: @unchecked Sendable {} -extension Proto_Key.OneOf_Key: @unchecked Sendable {} -extension Proto_ThresholdKey: @unchecked Sendable {} -extension Proto_KeyList: @unchecked Sendable {} -extension Proto_Signature: @unchecked Sendable {} -extension Proto_Signature.OneOf_Signature: @unchecked Sendable {} -extension Proto_ThresholdSignature: @unchecked Sendable {} -extension Proto_SignatureList: @unchecked Sendable {} -extension Proto_SignaturePair: @unchecked Sendable {} -extension Proto_SignaturePair.OneOf_Signature: @unchecked Sendable {} -extension Proto_SignatureMap: @unchecked Sendable {} -extension Proto_FeeComponents: @unchecked Sendable {} -extension Proto_TransactionFeeSchedule: @unchecked Sendable {} -extension Proto_FeeData: @unchecked Sendable {} -extension Proto_FeeSchedule: @unchecked Sendable {} -extension Proto_CurrentAndNextFeeSchedule: @unchecked Sendable {} -extension Proto_ServiceEndpoint: @unchecked Sendable {} -extension Proto_NodeAddress: @unchecked Sendable {} -extension Proto_NodeAddressBook: @unchecked Sendable {} -extension Proto_SemanticVersion: @unchecked Sendable {} -extension Proto_Setting: @unchecked Sendable {} -extension Proto_ServicesConfigurationList: @unchecked Sendable {} -extension Proto_TokenRelationship: @unchecked Sendable {} -extension Proto_TokenBalance: @unchecked Sendable {} -extension Proto_TokenBalances: @unchecked Sendable {} -extension Proto_TokenAssociation: @unchecked Sendable {} -extension Proto_StakingInfo: @unchecked Sendable {} -extension Proto_StakingInfo.OneOf_StakedID: @unchecked Sendable {} -extension Proto_PendingAirdropId: @unchecked Sendable {} -extension Proto_PendingAirdropId.OneOf_TokenReference: @unchecked Sendable {} -extension Proto_PendingAirdropValue: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" +extension Proto_BlockHashAlgorithm: SwiftProtobuf._ProtoNameProviding { + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 0: .same(proto: "SHA2_384"), + ] +} + extension Proto_TokenType: SwiftProtobuf._ProtoNameProviding { public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ 0: .same(proto: "FUNGIBLE_COMMON"), diff --git a/Sources/HederaProtobufs/Services/consensus_create_topic.pb.swift b/Sources/HederaProtobufs/Services/consensus_create_topic.pb.swift index 12b67c4b..ec79eca9 100644 --- a/Sources/HederaProtobufs/Services/consensus_create_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_create_topic.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// See [ConsensusService.createTopic()](#proto.ConsensusService) -public struct Proto_ConsensusCreateTopicTransactionBody { +public struct Proto_ConsensusCreateTopicTransactionBody: Sendable { // 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. @@ -98,10 +98,6 @@ public struct Proto_ConsensusCreateTopicTransactionBody { fileprivate var _autoRenewAccount: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusCreateTopicTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/consensus_delete_topic.pb.swift b/Sources/HederaProtobufs/Services/consensus_delete_topic.pb.swift index 2f728776..079031a0 100644 --- a/Sources/HederaProtobufs/Services/consensus_delete_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_delete_topic.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// See [ConsensusService.deleteTopic()](#proto.ConsensusService) -public struct Proto_ConsensusDeleteTopicTransactionBody { +public struct Proto_ConsensusDeleteTopicTransactionBody: Sendable { // 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. @@ -45,10 +45,6 @@ public struct Proto_ConsensusDeleteTopicTransactionBody { fileprivate var _topicID: Proto_TopicID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusDeleteTopicTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/consensus_get_topic_info.pb.swift b/Sources/HederaProtobufs/Services/consensus_get_topic_info.pb.swift index a8b9f907..416c62ca 100644 --- a/Sources/HederaProtobufs/Services/consensus_get_topic_info.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_get_topic_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// See [ConsensusService.getTopicInfo()](#proto.ConsensusService) -public struct Proto_ConsensusGetTopicInfoQuery { +public struct Proto_ConsensusGetTopicInfoQuery: Sendable { // 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. @@ -60,7 +60,7 @@ public struct Proto_ConsensusGetTopicInfoQuery { ///* /// Retrieve the parameters of and state of a consensus topic. -public struct Proto_ConsensusGetTopicInfoResponse { +public struct Proto_ConsensusGetTopicInfoResponse: @unchecked Sendable { // 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. @@ -105,11 +105,6 @@ public struct Proto_ConsensusGetTopicInfoResponse { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusGetTopicInfoQuery: @unchecked Sendable {} -extension Proto_ConsensusGetTopicInfoResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/consensus_submit_message.pb.swift b/Sources/HederaProtobufs/Services/consensus_submit_message.pb.swift index e88c56d1..a3e38002 100644 --- a/Sources/HederaProtobufs/Services/consensus_submit_message.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_submit_message.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// UNDOCUMENTED -public struct Proto_ConsensusMessageChunkInfo { +public struct Proto_ConsensusMessageChunkInfo: Sendable { // 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. @@ -55,7 +55,7 @@ public struct Proto_ConsensusMessageChunkInfo { ///* /// UNDOCUMENTED -public struct Proto_ConsensusSubmitMessageTransactionBody { +public struct Proto_ConsensusSubmitMessageTransactionBody: @unchecked Sendable { // 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. @@ -94,11 +94,6 @@ public struct Proto_ConsensusSubmitMessageTransactionBody { fileprivate var _chunkInfo: Proto_ConsensusMessageChunkInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusMessageChunkInfo: @unchecked Sendable {} -extension Proto_ConsensusSubmitMessageTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift index 242d2db5..72c4c549 100644 --- a/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_topic_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Current state of a topic. -public struct Proto_ConsensusTopicInfo { +public struct Proto_ConsensusTopicInfo: @unchecked Sendable { // 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. @@ -35,7 +35,7 @@ public struct Proto_ConsensusTopicInfo { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data = Data() @@ -103,7 +103,7 @@ public struct Proto_ConsensusTopicInfo { public mutating func clearAutoRenewAccount() {self._autoRenewAccount = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -117,10 +117,6 @@ public struct Proto_ConsensusTopicInfo { fileprivate var _autoRenewAccount: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusTopicInfo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/consensus_update_topic.pb.swift b/Sources/HederaProtobufs/Services/consensus_update_topic.pb.swift index b2e04a2f..51d60ff8 100644 --- a/Sources/HederaProtobufs/Services/consensus_update_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/consensus_update_topic.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// All fields left null will not be updated. /// See [ConsensusService.updateTopic()](#proto.ConsensusService) -public struct Proto_ConsensusUpdateTopicTransactionBody { +public struct Proto_ConsensusUpdateTopicTransactionBody: Sendable { // 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. @@ -135,10 +135,6 @@ public struct Proto_ConsensusUpdateTopicTransactionBody { fileprivate var _autoRenewAccount: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ConsensusUpdateTopicTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_call.pb.swift b/Sources/HederaProtobufs/Services/contract_call.pb.swift index 25e2f161..6c4de762 100644 --- a/Sources/HederaProtobufs/Services/contract_call.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_call.pb.swift @@ -31,7 +31,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The amount of gas used, as well as other attributes of the transaction, e.g. size, number of /// signatures to be verified, determine the fee for the transaction - which is charged to the paying /// account. -public struct Proto_ContractCallTransactionBody { +public struct Proto_ContractCallTransactionBody: @unchecked Sendable { // 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. @@ -66,10 +66,6 @@ public struct Proto_ContractCallTransactionBody { fileprivate var _contractID: Proto_ContractID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractCallTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift index a4ead51e..1896c7f7 100644 --- a/Sources/HederaProtobufs/Services/contract_call_local.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_call_local.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The log information for an event returned by a smart contract function call. One function call /// may return several such events. -public struct Proto_ContractLoginfo { +public struct Proto_ContractLoginfo: @unchecked Sendable { // 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. @@ -63,7 +63,7 @@ public struct Proto_ContractLoginfo { /// ContractCallLocal query, and is in the record for a ContractCall or ContractCreateInstance /// transaction. The ContractCreateInstance transaction record has the results of the call to the /// constructor. -public struct Proto_ContractFunctionResult { +public struct Proto_ContractFunctionResult: @unchecked Sendable { // 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. @@ -116,36 +116,38 @@ public struct Proto_ContractFunctionResult { ///* /// [DEPRECATED] the list of smart contracts that were created by the function call. - /// - /// The created ids will now _also_ be externalized through internal transaction - /// records, where each record has its alias field populated with the new contract's - /// EVM address. (This is needed for contracts created with CREATE2, since - /// there is no longer a simple relationship between the new contract's 0.0.X id + /// + /// The created ids will now _also_ be externalized through internal transaction + /// records, where each record has its alias field populated with the new contract's + /// EVM address. (This is needed for contracts created with CREATE2, since + /// there is no longer a simple relationship between the new contract's 0.0.X id /// and its Solidity address.) + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var createdContractIds: [Proto_ContractID] { get {return _storage._createdContractIds} set {_uniqueStorage()._createdContractIds = newValue} } ///* - /// The new contract's 20-byte EVM address. Only populated after release 0.23, - /// where each created contract will have its own record. (This is an important - /// point--the field is not repeated because there will be a separate + /// The new contract's 20-byte EVM address. Only populated after release 0.23, + /// where each created contract will have its own record. (This is an important + /// point--the field is not repeated because there will be a separate /// child record for each created contract.) - /// + /// /// Every contract has an EVM address determined by its shard.realm.num id. /// This address is as follows: ///

    ///
  1. The first 4 bytes are the big-endian representation of the shard.
  2. ///
  3. The next 8 bytes are the big-endian representation of the realm.
  4. ///
  5. The final 8 bytes are the big-endian representation of the number.
  6. - ///
- /// - /// Contracts created via CREATE2 have an additional, primary address that is - /// derived from the EIP-1014 - /// specification, and does not have a simple relation to a shard.realm.num id. - /// - /// (Please do note that CREATE2 contracts can also be referenced by the three-part + /// + /// + /// Contracts created via CREATE2 have an additional, primary address that is + /// derived from the EIP-1014 + /// specification, and does not have a simple relation to a shard.realm.num id. + /// + /// (Please do note that CREATE2 contracts can also be referenced by the three-part /// EVM address described above.) public var evmAddress: SwiftProtobuf.Google_Protobuf_BytesValue { get {return _storage._evmAddress ?? SwiftProtobuf.Google_Protobuf_BytesValue()} @@ -157,10 +159,10 @@ public struct Proto_ContractFunctionResult { public mutating func clearEvmAddress() {_uniqueStorage()._evmAddress = nil} ///* - /// The amount of gas available for the call, aka the gasLimit. + /// The amount of gas available for the call, aka the gasLimit. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var gas: Int64 { get {return _storage._gas} set {_uniqueStorage()._gas = newValue} @@ -170,7 +172,7 @@ public struct Proto_ContractFunctionResult { /// Number of tinybars sent (the function must be payable if this is nonzero). /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var amount: Int64 { get {return _storage._amount} set {_uniqueStorage()._amount = newValue} @@ -180,7 +182,7 @@ public struct Proto_ContractFunctionResult { /// The parameters passed into the contract call. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var functionParameters: Data { get {return _storage._functionParameters} set {_uniqueStorage()._functionParameters = newValue} @@ -190,7 +192,7 @@ public struct Proto_ContractFunctionResult { /// The account that is the "sender." If not present it is the accountId from the transactionId. /// /// This field should only be populated when the paired TransactionBody in the record stream is not a - /// ContractCreateTransactionBody or a ContractCallTransactionBody. + /// ContractCreateTransactionBody or a ContractCallTransactionBody. public var senderID: Proto_AccountID { get {return _storage._senderID ?? Proto_AccountID()} set {_uniqueStorage()._senderID = newValue} @@ -234,10 +236,10 @@ public struct Proto_ContractFunctionResult { /// It will not have a consensus timestamp. It cannot generate a record or a receipt. The response will contain the output /// returned by the function call. This is useful for calling getter functions, which purely read the state and don't change it. /// It is faster and cheaper than a normal call, because it is purely local to a single node. -/// +/// /// Unlike a ContractCall transaction, the node will consume the entire amount of provided gas in determining /// the fee for this query. -public struct Proto_ContractCallLocalQuery { +public struct Proto_ContractCallLocalQuery: @unchecked Sendable { // 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. @@ -274,11 +276,13 @@ public struct Proto_ContractCallLocalQuery { ///* /// max number of bytes that the result might include. The run will fail if it would have returned more than this number of bytes. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var maxResultSize: Int64 = 0 ///* /// The account that is the "sender." If not present it is the accountId from the transactionId. - /// Typically a different value than specified in the transactionId requires a valid signature + /// Typically a different value than specified in the transactionId requires a valid signature /// over either the hedera transaction or foreign transaction data. public var senderID: Proto_AccountID { get {return _senderID ?? Proto_AccountID()} @@ -300,7 +304,7 @@ public struct Proto_ContractCallLocalQuery { ///* /// Response when the client sends the node ContractCallLocalQuery -public struct Proto_ContractCallLocalResponse { +public struct Proto_ContractCallLocalResponse: Sendable { // 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. @@ -335,13 +339,6 @@ public struct Proto_ContractCallLocalResponse { fileprivate var _functionResult: Proto_ContractFunctionResult? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractLoginfo: @unchecked Sendable {} -extension Proto_ContractFunctionResult: @unchecked Sendable {} -extension Proto_ContractCallLocalQuery: @unchecked Sendable {} -extension Proto_ContractCallLocalResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_create.pb.swift b/Sources/HederaProtobufs/Services/contract_create.pb.swift index 3f6ed9c4..20e015bf 100644 --- a/Sources/HederaProtobufs/Services/contract_create.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_create.pb.swift @@ -23,10 +23,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Start a new smart contract instance. After the instance is created, the ContractID for it is in /// the receipt, and can be retrieved by the Record or with a GetByKey query. The instance will run -/// the bytecode, either stored in a previously created file or in the transaction body itself for +/// the bytecode, either stored in a previously created file or in the transaction body itself for /// small contracts. -/// -/// +/// +/// /// The constructor will be executed using the given amount of gas, and any unspent gas will be /// refunded to the paying account. Constructor inputs come from the given constructorParameters. /// - The instance will exist for autoRenewPeriod seconds. When that is reached, it will renew @@ -73,9 +73,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// to the smart contract in the future. The memo field can only be changed using the admin keys. /// If there are no admin keys, then it cannot be changed after the smart contract is created. /// -/// Signing requirements: If an admin key is set, it must sign the transaction. If an +/// Signing requirements: If an admin key is set, it must sign the transaction. If an /// auto-renew account is set, its key must sign the transaction. -public struct Proto_ContractCreateTransactionBody { +public struct Proto_ContractCreateTransactionBody: @unchecked Sendable { // 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. @@ -147,6 +147,8 @@ public struct Proto_ContractCreateTransactionBody { /// staked to a node chosen by the network, but without earning payments. If the proxyAccountID /// account refuses to accept proxy staking , or if it is not currently running a node, then it /// will behave as if proxyAccountID was null. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -279,7 +281,7 @@ public struct Proto_ContractCreateTransactionBody { /// There are two ways to specify the initcode of a ContractCreateTransction. If the initcode is /// large (> 5K) then it must be stored in a file as hex encoded ascii. If it is small then it may /// either be stored as a hex encoded file or as a binary encoded field as part of the transaciton. - public enum OneOf_InitcodeSource: Equatable { + public enum OneOf_InitcodeSource: Equatable, @unchecked Sendable { ///* /// The file containing the smart contract initcode. A copy will be made and held by the /// contract instance, and have the same expiration time as the instance. @@ -289,29 +291,11 @@ public struct Proto_ContractCreateTransactionBody { /// is less than the hedera transaction limit. In those cases fileID must be used. case initcode(Data) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractCreateTransactionBody.OneOf_InitcodeSource, rhs: Proto_ContractCreateTransactionBody.OneOf_InitcodeSource) -> 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 (.fileID, .fileID): return { - guard case .fileID(let l) = lhs, case .fileID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.initcode, .initcode): return { - guard case .initcode(let l) = lhs, case .initcode(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } ///* /// ID of the new account or node to which this contract is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// ID of the account to which this contract is staking. case stakedAccountID(Proto_AccountID) @@ -319,24 +303,6 @@ public struct Proto_ContractCreateTransactionBody { /// ID of the node this contract is staked to. case stakedNodeID(Int64) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractCreateTransactionBody.OneOf_StakedID, rhs: Proto_ContractCreateTransactionBody.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() {} @@ -344,12 +310,6 @@ public struct Proto_ContractCreateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractCreateTransactionBody: @unchecked Sendable {} -extension Proto_ContractCreateTransactionBody.OneOf_InitcodeSource: @unchecked Sendable {} -extension Proto_ContractCreateTransactionBody.OneOf_StakedID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_delete.pb.swift b/Sources/HederaProtobufs/Services/contract_delete.pb.swift index 43d56b6b..ef23b43a 100644 --- a/Sources/HederaProtobufs/Services/contract_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_delete.pb.swift @@ -23,14 +23,14 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, marks a contract as deleted and transfers its remaining hBars, if any, to a /// designated receiver. After a contract is deleted, it can no longer be called. -/// +/// /// If the target contract is immutable (that is, was created without an admin key), then this /// transaction resolves to MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. The admin key of the target contract must sign. /// 2. If the transfer account or contract has receiverSigRequired, its associated key must also sign -public struct Proto_ContractDeleteTransactionBody { +public struct Proto_ContractDeleteTransactionBody: Sendable { // 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. @@ -69,7 +69,7 @@ public struct Proto_ContractDeleteTransactionBody { } ///* - /// If set to true, means this is a "synthetic" system transaction being used to + /// If set to true, means this is a "synthetic" system transaction being used to /// alert mirror nodes that the contract is being permanently removed from the ledger. /// IMPORTANT: User transactions cannot set this field to true, as permanent /// removal is always managed by the ledger itself. Any ContractDeleteTransactionBody @@ -79,7 +79,7 @@ public struct Proto_ContractDeleteTransactionBody { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Obtainers: Equatable { + public enum OneOf_Obtainers: Equatable, Sendable { ///* /// The id of an account to receive any remaining hBars from the deleted contract case transferAccountID(Proto_AccountID) @@ -87,24 +87,6 @@ public struct Proto_ContractDeleteTransactionBody { /// The id of a contract to receive any remaining hBars from the deleted contract case transferContractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractDeleteTransactionBody.OneOf_Obtainers, rhs: Proto_ContractDeleteTransactionBody.OneOf_Obtainers) -> 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 (.transferAccountID, .transferAccountID): return { - guard case .transferAccountID(let l) = lhs, case .transferAccountID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transferContractID, .transferContractID): return { - guard case .transferContractID(let l) = lhs, case .transferContractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -112,11 +94,6 @@ public struct Proto_ContractDeleteTransactionBody { fileprivate var _contractID: Proto_ContractID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractDeleteTransactionBody: @unchecked Sendable {} -extension Proto_ContractDeleteTransactionBody.OneOf_Obtainers: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_get_bytecode.pb.swift b/Sources/HederaProtobufs/Services/contract_get_bytecode.pb.swift index 6ace3561..6c68d180 100644 --- a/Sources/HederaProtobufs/Services/contract_get_bytecode.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_get_bytecode.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get the runtime bytecode for a smart contract instance -public struct Proto_ContractGetBytecodeQuery { +public struct Proto_ContractGetBytecodeQuery: Sendable { // 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. @@ -60,7 +60,7 @@ public struct Proto_ContractGetBytecodeQuery { ///* /// Response when the client sends the node ContractGetBytecodeQuery -public struct Proto_ContractGetBytecodeResponse { +public struct Proto_ContractGetBytecodeResponse: @unchecked Sendable { // 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. @@ -88,11 +88,6 @@ public struct Proto_ContractGetBytecodeResponse { fileprivate var _header: Proto_ResponseHeader? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractGetBytecodeQuery: @unchecked Sendable {} -extension Proto_ContractGetBytecodeResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift index 2def1dc8..21d9d0d1 100644 --- a/Sources/HederaProtobufs/Services/contract_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_get_info.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get information about a smart contract instance. This includes the account that it uses, the file /// containing its initcode (if a file was used to initialize the contract), and the time when it will expire. -public struct Proto_ContractGetInfoQuery { +public struct Proto_ContractGetInfoQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_ContractGetInfoQuery { ///* /// Response when the client sends the node ContractGetInfoQuery -public struct Proto_ContractGetInfoResponse { +public struct Proto_ContractGetInfoResponse: Sendable { // 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. @@ -91,7 +91,7 @@ public struct Proto_ContractGetInfoResponse { public var unknownFields = SwiftProtobuf.UnknownStorage() - public struct ContractInfo { + public struct ContractInfo: @unchecked Sendable { // 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. @@ -197,17 +197,19 @@ public struct Proto_ContractGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the contract. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} set {_uniqueStorage()._tokenRelationships = newValue} } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} @@ -256,12 +258,6 @@ public struct Proto_ContractGetInfoResponse { fileprivate var _contractInfo: Proto_ContractGetInfoResponse.ContractInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractGetInfoQuery: @unchecked Sendable {} -extension Proto_ContractGetInfoResponse: @unchecked Sendable {} -extension Proto_ContractGetInfoResponse.ContractInfo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_get_records.pb.swift b/Sources/HederaProtobufs/Services/contract_get_records.pb.swift index 34f030e4..ff6487ab 100644 --- a/Sources/HederaProtobufs/Services/contract_get_records.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_get_records.pb.swift @@ -22,7 +22,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Before v0.9.0, requested records of all transactions against the given contract in the last 25 hours. -public struct Proto_ContractGetRecordsQuery { +/// +/// NOTE: This message was marked as deprecated in the .proto file. +public struct Proto_ContractGetRecordsQuery: Sendable { // 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. @@ -59,7 +61,9 @@ public struct Proto_ContractGetRecordsQuery { ///* /// Before v0.9.0, returned records of all transactions against the given contract in the last 25 hours. -public struct Proto_ContractGetRecordsResponse { +/// +/// NOTE: This message was marked as deprecated in the .proto file. +public struct Proto_ContractGetRecordsResponse: Sendable { // 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. @@ -98,11 +102,6 @@ public struct Proto_ContractGetRecordsResponse { fileprivate var _contractID: Proto_ContractID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractGetRecordsQuery: @unchecked Sendable {} -extension Proto_ContractGetRecordsResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_types.pb.swift b/Sources/HederaProtobufs/Services/contract_types.pb.swift index c4415326..e48f9100 100644 --- a/Sources/HederaProtobufs/Services/contract_types.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_types.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Info about a contract account's nonce value. /// A nonce of a contract is only incremented when that contract creates another contract. -public struct Proto_ContractNonceInfo { +public struct Proto_ContractNonceInfo: Sendable { // 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. @@ -50,10 +50,6 @@ public struct Proto_ContractNonceInfo { fileprivate var _contractID: Proto_ContractID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractNonceInfo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/contract_update.pb.swift b/Sources/HederaProtobufs/Services/contract_update.pb.swift index 18688d29..345633eb 100644 --- a/Sources/HederaProtobufs/Services/contract_update.pb.swift +++ b/Sources/HederaProtobufs/Services/contract_update.pb.swift @@ -22,12 +22,12 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates the fields of a smart contract to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged on the contract. For an immutable /// smart contract (that is, a contract created without an adminKey), only the expirationTime may be /// updated; setting any other field in this case will cause the transaction status to resolve to /// MODIFYING_IMMUTABLE_CONTRACT. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a contract has an admin key, its expiry can be extended with only the /// transaction payer's signature. @@ -38,7 +38,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// constituent Ed25519 key will be rejected with INVALID_ADMIN_KEY.) /// 4. If the update transaction sets the AccountID auto_renew_account_id wrapper field to anything /// other than the sentinel 0.0.0 value, then the key of the referenced account must sign. -public struct Proto_ContractUpdateTransactionBody { +public struct Proto_ContractUpdateTransactionBody: @unchecked Sendable { // 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. @@ -79,6 +79,8 @@ public struct Proto_ContractUpdateTransactionBody { ///* /// [Deprecated] The new id of the account to which the contract is proxy staked + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -101,6 +103,8 @@ public struct Proto_ContractUpdateTransactionBody { ///* /// This field is unused and will have no impact on the specified smart contract. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var fileID: Proto_FileID { get {return _storage._fileID ?? Proto_FileID()} set {_uniqueStorage()._fileID = newValue} @@ -120,6 +124,8 @@ public struct Proto_ContractUpdateTransactionBody { ///* /// [Deprecated] If set with a non-zero length, the new memo to be associated with the account /// (UTF-8 encoding max 100 bytes) + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var memo: String { get { if case .memo(let v)? = _storage._memoField {return v} @@ -155,7 +161,7 @@ public struct Proto_ContractUpdateTransactionBody { public mutating func clearMaxAutomaticTokenAssociations() {_uniqueStorage()._maxAutomaticTokenAssociations = nil} ///* - /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew + /// If set to the sentinel 0.0.0 AccountID, this field removes the contract's auto-renew /// account. Otherwise it updates the contract's auto-renew account to the referenced account. public var autoRenewAccountID: Proto_AccountID { get {return _storage._autoRenewAccountID ?? Proto_AccountID()} @@ -210,38 +216,22 @@ public struct Proto_ContractUpdateTransactionBody { ///* /// The new contract memo, assumed to be Unicode encoded with UTF-8 (at most 100 bytes) - public enum OneOf_MemoField: Equatable { + public enum OneOf_MemoField: Equatable, Sendable { ///* /// [Deprecated] If set with a non-zero length, the new memo to be associated with the account /// (UTF-8 encoding max 100 bytes) + /// + /// NOTE: This field was marked as deprecated in the .proto file. case memo(String) ///* /// If set, the new memo to be associated with the account (UTF-8 encoding max 100 bytes) case memoWrapper(SwiftProtobuf.Google_Protobuf_StringValue) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractUpdateTransactionBody.OneOf_MemoField, rhs: Proto_ContractUpdateTransactionBody.OneOf_MemoField) -> 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 (.memo, .memo): return { - guard case .memo(let l) = lhs, case .memo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.memoWrapper, .memoWrapper): return { - guard case .memoWrapper(let l) = lhs, case .memoWrapper(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } ///* /// ID of the new account or node to which this contract is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// ID of the new account to which this contract is staking. If set to the sentinel 0.0.0 AccountID, /// this field removes the contract's staked account ID. @@ -251,24 +241,6 @@ public struct Proto_ContractUpdateTransactionBody { /// removes the contract's staked node ID. case stakedNodeID(Int64) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ContractUpdateTransactionBody.OneOf_StakedID, rhs: Proto_ContractUpdateTransactionBody.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() {} @@ -276,12 +248,6 @@ public struct Proto_ContractUpdateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ContractUpdateTransactionBody: @unchecked Sendable {} -extension Proto_ContractUpdateTransactionBody.OneOf_MemoField: @unchecked Sendable {} -extension Proto_ContractUpdateTransactionBody.OneOf_StakedID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift index 8207921e..83460d3c 100644 --- a/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_add_live_hash.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A hash---presumably of some kind of credential or certificate---along with a list of keys, each -/// of which may be either a primitive or a threshold key. -public struct Proto_LiveHash { +/// of which may be either a primitive or a threshold key. +public struct Proto_LiveHash: @unchecked Sendable { // 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. @@ -84,7 +84,7 @@ public struct Proto_LiveHash { /// livehash mechanism acts as a revocation service. An account cannot have two identical livehashes /// associated. To modify the list of keys in a livehash, the livehash should first be deleted, then /// recreated with a new list of keys. -public struct Proto_CryptoAddLiveHashTransactionBody { +public struct Proto_CryptoAddLiveHashTransactionBody: Sendable { // 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. @@ -107,11 +107,6 @@ public struct Proto_CryptoAddLiveHashTransactionBody { fileprivate var _liveHash: Proto_LiveHash? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_LiveHash: @unchecked Sendable {} -extension Proto_CryptoAddLiveHashTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift index 3e4a4a20..84a72ebb 100644 --- a/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_approve_allowance.pb.swift @@ -26,10 +26,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbar/token to any other account of the spender's choice. If the owner is not specified in any allowance, the payer /// of transaction is considered to be the owner for that particular allowance. /// Setting the amount to zero in CryptoAllowance or TokenAllowance will remove the respective allowance for the spender. -/// +/// /// (So if account 0.0.X pays for this transaction and owner is not specified in the allowance, /// then at consensus each spender account will have new allowances to spend hbar or tokens from 0.0.X). -public struct Proto_CryptoApproveAllowanceTransactionBody { +public struct Proto_CryptoApproveAllowanceTransactionBody: Sendable { // 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. @@ -53,7 +53,7 @@ public struct Proto_CryptoApproveAllowanceTransactionBody { ///* /// An approved allowance of hbar transfers for a spender. -public struct Proto_CryptoAllowance { +public struct Proto_CryptoAllowance: Sendable { // 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. @@ -94,7 +94,7 @@ public struct Proto_CryptoAllowance { ///* /// An approved allowance of non-fungible token transfers for a spender. -public struct Proto_NftAllowance { +public struct Proto_NftAllowance: Sendable { // 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. @@ -173,7 +173,7 @@ public struct Proto_NftAllowance { ///* /// An approved allowance of fungible token transfers for a spender. -public struct Proto_TokenAllowance { +public struct Proto_TokenAllowance: Sendable { // 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. @@ -224,13 +224,6 @@ public struct Proto_TokenAllowance { fileprivate var _spender: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoApproveAllowanceTransactionBody: @unchecked Sendable {} -extension Proto_CryptoAllowance: @unchecked Sendable {} -extension Proto_NftAllowance: @unchecked Sendable {} -extension Proto_TokenAllowance: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_create.pb.swift b/Sources/HederaProtobufs/Services/crypto_create.pb.swift index 416fe152..852b39e5 100644 --- a/Sources/HederaProtobufs/Services/crypto_create.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_create.pb.swift @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// used to extend its expiration as long as possible. If it is has a zero balance when it expires, /// then it is deleted. This transaction must be signed by the payer account. If receiverSigRequired /// is false, then the transaction does not have to be signed by the keys in the keys field. If it is -/// true, then it must be signed by them, in addition to the keys of the payer account. If the +/// true, then it must be signed by them, in addition to the keys of the payer account. If the /// auto_renew_account field is set, the key of the referenced account must sign. /// /// An entity (account, file, or smart contract instance) must be created in a particular realm. If @@ -51,7 +51,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The current API ignores shardID, realmID, and newRealmAdminKey, and creates everything in shard 0 /// and realm 0, with a null key. Future versions of the API will support multiple realms and /// multiple shards. -public struct Proto_CryptoCreateTransactionBody { +public struct Proto_CryptoCreateTransactionBody: @unchecked Sendable { // 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. @@ -81,6 +81,8 @@ public struct Proto_CryptoCreateTransactionBody { /// staked to a node chosen by the network, but without earning payments. If the proxyAccountID /// account refuses to accept proxy staking , or if it is not currently running a node, then it /// will behave as if proxyAccountID was null. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -93,6 +95,8 @@ public struct Proto_CryptoCreateTransactionBody { ///* /// [Deprecated]. The threshold amount (in tinybars) for which an account record is created for /// any send/withdraw transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var sendRecordThreshold: UInt64 { get {return _storage._sendRecordThreshold} set {_uniqueStorage()._sendRecordThreshold = newValue} @@ -101,6 +105,8 @@ public struct Proto_CryptoCreateTransactionBody { ///* /// [Deprecated]. The threshold amount (in tinybars) for which an account record is created for /// any receive/deposit transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var receiveRecordThreshold: UInt64 { get {return _storage._receiveRecordThreshold} set {_uniqueStorage()._receiveRecordThreshold = newValue} @@ -224,7 +230,7 @@ public struct Proto_CryptoCreateTransactionBody { /// A given alias can map to at most one account on the network at a time. This uniqueness will be enforced /// relative to aliases currently on the network at alias assignment. /// - /// If a transaction creates an account using an alias, any further crypto transfers to that alias will + /// If a transaction creates an account using an alias, any further crypto transfers to that alias will /// simply be deposited in that account, without creating anything, and with no creation fee being charged. public var alias: Data { get {return _storage._alias} @@ -235,7 +241,7 @@ public struct Proto_CryptoCreateTransactionBody { ///* /// ID of the account or node to which this account is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// ID of the account to which this account is staking. case stakedAccountID(Proto_AccountID) @@ -243,24 +249,6 @@ public struct Proto_CryptoCreateTransactionBody { /// ID of the node this account is staked to. case stakedNodeID(Int64) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoCreateTransactionBody.OneOf_StakedID, rhs: Proto_CryptoCreateTransactionBody.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() {} @@ -268,11 +256,6 @@ public struct Proto_CryptoCreateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoCreateTransactionBody: @unchecked Sendable {} -extension Proto_CryptoCreateTransactionBody.OneOf_StakedID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_delete.pb.swift b/Sources/HederaProtobufs/Services/crypto_delete.pb.swift index 3f50d728..ac49b26b 100644 --- a/Sources/HederaProtobufs/Services/crypto_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_delete.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Mark an account as deleted, moving all its current hbars to another account. It will remain in /// the ledger, marked as deleted, until it expires. Transfers into it a deleted account fail. But a /// deleted account can still have its expiration extended in the normal way. -public struct Proto_CryptoDeleteTransactionBody { +public struct Proto_CryptoDeleteTransactionBody: Sendable { // 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. @@ -59,10 +59,6 @@ public struct Proto_CryptoDeleteTransactionBody { fileprivate var _deleteAccountID: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoDeleteTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_delete_allowance.pb.swift b/Sources/HederaProtobufs/Services/crypto_delete_allowance.pb.swift index cc6c22c2..9f7631c3 100644 --- a/Sources/HederaProtobufs/Services/crypto_delete_allowance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_delete_allowance.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// will remove the allowances granted to one or more specific non-fungible token serial numbers. Each owner account /// listed as wiping an allowance must sign the transaction. Hbar and fungible token allowances /// can be removed by setting the amount to zero in CryptoApproveAllowance. -public struct Proto_CryptoDeleteAllowanceTransactionBody { +public struct Proto_CryptoDeleteAllowanceTransactionBody: Sendable { // 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. @@ -41,7 +41,7 @@ public struct Proto_CryptoDeleteAllowanceTransactionBody { ///* /// Nft allowances to be removed on an owner account -public struct Proto_NftRemoveAllowance { +public struct Proto_NftRemoveAllowance: Sendable { // 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. @@ -80,11 +80,6 @@ public struct Proto_NftRemoveAllowance { fileprivate var _owner: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoDeleteAllowanceTransactionBody: @unchecked Sendable {} -extension Proto_NftRemoveAllowance: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_delete_live_hash.pb.swift b/Sources/HederaProtobufs/Services/crypto_delete_live_hash.pb.swift index 9ffa8367..f5ee3a4a 100644 --- a/Sources/HederaProtobufs/Services/crypto_delete_live_hash.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_delete_live_hash.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, deletes a livehash associated to the given account. The transaction must be signed /// by either the key of the owning account, or at least one of the keys associated to the livehash. -public struct Proto_CryptoDeleteLiveHashTransactionBody { +public struct Proto_CryptoDeleteLiveHashTransactionBody: @unchecked Sendable { // 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. @@ -50,10 +50,6 @@ public struct Proto_CryptoDeleteLiveHashTransactionBody { fileprivate var _accountOfLiveHash: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoDeleteLiveHashTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift index 97173ea4..ad4dd575 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_account_balance.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get the balance of a cryptocurrency account. This returns only the balance, so it is a smaller /// reply than CryptoGetInfo, which returns the balance plus additional information. -public struct Proto_CryptoGetAccountBalanceQuery { +public struct Proto_CryptoGetAccountBalanceQuery: Sendable { // 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. @@ -64,7 +64,7 @@ public struct Proto_CryptoGetAccountBalanceQuery { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_BalanceSource: Equatable { + public enum OneOf_BalanceSource: Equatable, Sendable { ///* /// The account ID for which information is requested case accountID(Proto_AccountID) @@ -72,24 +72,6 @@ public struct Proto_CryptoGetAccountBalanceQuery { /// The account ID for which information is requested case contractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoGetAccountBalanceQuery.OneOf_BalanceSource, rhs: Proto_CryptoGetAccountBalanceQuery.OneOf_BalanceSource) -> 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 (.accountID, .accountID): return { - guard case .accountID(let l) = lhs, case .accountID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractID, .contractID): return { - guard case .contractID(let l) = lhs, case .contractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -99,7 +81,7 @@ public struct Proto_CryptoGetAccountBalanceQuery { ///* /// Response when the client sends the node CryptoGetAccountBalanceQuery -public struct Proto_CryptoGetAccountBalanceResponse { +public struct Proto_CryptoGetAccountBalanceResponse: Sendable { // 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. @@ -133,10 +115,12 @@ public struct Proto_CryptoGetAccountBalanceResponse { public var balance: UInt64 = 0 ///* - /// [DEPRECATED] The balances of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The balances of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token balances. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var tokenBalances: [Proto_TokenBalance] = [] public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -147,12 +131,6 @@ public struct Proto_CryptoGetAccountBalanceResponse { fileprivate var _accountID: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoGetAccountBalanceQuery: @unchecked Sendable {} -extension Proto_CryptoGetAccountBalanceQuery.OneOf_BalanceSource: @unchecked Sendable {} -extension Proto_CryptoGetAccountBalanceResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_get_account_records.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_account_records.pb.swift index dfd60851..1399bb13 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_account_records.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_account_records.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Requests records of all transactions for which the given account was the effective payer in the last 3 minutes of consensus time and ledger.keepRecordsInState=true was true during handleTransaction. -public struct Proto_CryptoGetAccountRecordsQuery { +public struct Proto_CryptoGetAccountRecordsQuery: Sendable { // 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. @@ -59,7 +59,7 @@ public struct Proto_CryptoGetAccountRecordsQuery { ///* /// Returns records of all transactions for which the given account was the effective payer in the last 3 minutes of consensus time and ledger.keepRecordsInState=true was true during handleTransaction. -public struct Proto_CryptoGetAccountRecordsResponse { +public struct Proto_CryptoGetAccountRecordsResponse: Sendable { // 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. @@ -98,11 +98,6 @@ public struct Proto_CryptoGetAccountRecordsResponse { fileprivate var _accountID: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoGetAccountRecordsQuery: @unchecked Sendable {} -extension Proto_CryptoGetAccountRecordsResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift index d9f75f80..ae2b15f7 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_info.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get all the information about an account, including the balance. This does not get the list of /// account records. -public struct Proto_CryptoGetInfoQuery { +public struct Proto_CryptoGetInfoQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_CryptoGetInfoQuery { ///* /// Response when the client sends the node CryptoGetInfoQuery -public struct Proto_CryptoGetInfoResponse { +public struct Proto_CryptoGetInfoResponse: Sendable { // 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. @@ -91,7 +91,7 @@ public struct Proto_CryptoGetInfoResponse { public var unknownFields = SwiftProtobuf.UnknownStorage() - public struct AccountInfo { + public struct AccountInfo: @unchecked Sendable { // 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. @@ -129,6 +129,8 @@ public struct Proto_CryptoGetInfoResponse { /// automatically proxy staked to a node chosen by the network, but without earning payments. /// If the proxyAccountID account refuses to accept proxy staking , or if it is not currently /// running a node, then it will behave as if proxyAccountID was null. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -167,6 +169,8 @@ public struct Proto_CryptoGetInfoResponse { ///* /// [Deprecated]. The threshold amount, in tinybars, at which a record is created of any /// transaction that decreases the balance of this account by more than the threshold + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var generateSendRecordThreshold: UInt64 { get {return _storage._generateSendRecordThreshold} set {_uniqueStorage()._generateSendRecordThreshold = newValue} @@ -175,6 +179,8 @@ public struct Proto_CryptoGetInfoResponse { ///* /// [Deprecated]. The threshold amount, in tinybars, at which a record is created of any /// transaction that increases the balance of this account by more than the threshold + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var generateReceiveRecordThreshold: UInt64 { get {return _storage._generateReceiveRecordThreshold} set {_uniqueStorage()._generateReceiveRecordThreshold = newValue} @@ -220,10 +226,12 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// [DEPRECATED] The metadata of the tokens associated to the account. This field was - /// deprecated by HIP-367, which allowed - /// an account to be associated to an unlimited number of tokens. This scale makes it more + /// [DEPRECATED] The metadata of the tokens associated to the account. This field was + /// deprecated by HIP-367, which allowed + /// an account to be associated to an unlimited number of tokens. This scale makes it more /// efficient for users to consult mirror nodes to review their token associations. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var tokenRelationships: [Proto_TokenRelationship] { get {return _storage._tokenRelationships} set {_uniqueStorage()._tokenRelationships = newValue} @@ -258,7 +266,7 @@ public struct Proto_CryptoGetInfoResponse { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} @@ -295,12 +303,6 @@ public struct Proto_CryptoGetInfoResponse { fileprivate var _accountInfo: Proto_CryptoGetInfoResponse.AccountInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoGetInfoQuery: @unchecked Sendable {} -extension Proto_CryptoGetInfoResponse: @unchecked Sendable {} -extension Proto_CryptoGetInfoResponse.AccountInfo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_get_live_hash.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_live_hash.pb.swift index ce7c8284..e6c74960 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_live_hash.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_live_hash.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Requests a livehash associated to an account. -public struct Proto_CryptoGetLiveHashQuery { +public struct Proto_CryptoGetLiveHashQuery: @unchecked Sendable { // 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. @@ -66,7 +66,7 @@ public struct Proto_CryptoGetLiveHashQuery { /// Returns the full livehash associated to an account, if it is present. Note that the only way to /// obtain a state proof exhibiting the absence of a livehash from an account is to retrieve a state /// proof of the entire account with its list of livehashes. -public struct Proto_CryptoGetLiveHashResponse { +public struct Proto_CryptoGetLiveHashResponse: Sendable { // 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. @@ -102,11 +102,6 @@ public struct Proto_CryptoGetLiveHashResponse { fileprivate var _liveHash: Proto_LiveHash? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoGetLiveHashQuery: @unchecked Sendable {} -extension Proto_CryptoGetLiveHashResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_get_stakers.pb.swift b/Sources/HederaProtobufs/Services/crypto_get_stakers.pb.swift index ea3a75a9..1eb9fec3 100644 --- a/Sources/HederaProtobufs/Services/crypto_get_stakers.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_get_stakers.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get all the accounts that are proxy staking to this account. For each of them, give the amount /// currently staked. This is not yet implemented, but will be in a future version of the API. -public struct Proto_CryptoGetStakersQuery { +public struct Proto_CryptoGetStakersQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_CryptoGetStakersQuery { ///* /// information about a single account that is proxy staking -public struct Proto_ProxyStaker { +public struct Proto_ProxyStaker: Sendable { // 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. @@ -90,7 +90,7 @@ public struct Proto_ProxyStaker { ///* /// all of the accounts proxy staking to a given account, and the amounts proxy staked -public struct Proto_AllProxyStakers { +public struct Proto_AllProxyStakers: Sendable { // 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. @@ -119,7 +119,7 @@ public struct Proto_AllProxyStakers { ///* /// Response when the client sends the node CryptoGetStakersQuery -public struct Proto_CryptoGetStakersResponse { +public struct Proto_CryptoGetStakersResponse: Sendable { // 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. @@ -156,13 +156,6 @@ public struct Proto_CryptoGetStakersResponse { fileprivate var _stakers: Proto_AllProxyStakers? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoGetStakersQuery: @unchecked Sendable {} -extension Proto_ProxyStaker: @unchecked Sendable {} -extension Proto_AllProxyStakers: @unchecked Sendable {} -extension Proto_CryptoGetStakersResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift index bce0152d..b7dffb8f 100644 --- a/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_transfer.pb.swift @@ -29,8 +29,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// hbars, then the entire transaction fails, and none of those transfers occur, though the /// transaction fee is still charged. This transaction must be signed by the keys for all the sending /// accounts, and for any receiving accounts that have receiverSigRequired == true. The signatures -/// are in the same order as the accounts, skipping those accounts that don't need a signature. -public struct Proto_CryptoTransferTransactionBody { +/// are in the same order as the accounts, skipping those accounts that don't need a signature. +public struct Proto_CryptoTransferTransactionBody: Sendable { // 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. @@ -59,10 +59,6 @@ public struct Proto_CryptoTransferTransactionBody { fileprivate var _transfers: Proto_TransferList? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoTransferTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/crypto_update.pb.swift b/Sources/HederaProtobufs/Services/crypto_update.pb.swift index 65db6742..ad206e94 100644 --- a/Sources/HederaProtobufs/Services/crypto_update.pb.swift +++ b/Sources/HederaProtobufs/Services/crypto_update.pb.swift @@ -25,10 +25,10 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// transaction must be signed by the existing key for this account. If the transaction is changing /// the key field, then the transaction must be signed by both the old key (from before the change) /// and the new key. The old key must sign for security. The new key must sign as a safeguard to -/// avoid accidentally changing to an invalid key, and then having no way to recover. -/// If the update transaction sets the auto_renew_account field to anything other +/// avoid accidentally changing to an invalid key, and then having no way to recover. +/// If the update transaction sets the auto_renew_account field to anything other /// than the sentinel 0.0.0, the key of the referenced account must sign. -public struct Proto_CryptoUpdateTransactionBody { +public struct Proto_CryptoUpdateTransactionBody: @unchecked Sendable { // 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. @@ -61,6 +61,8 @@ public struct Proto_CryptoUpdateTransactionBody { /// staked to a node chosen by the network, but without earning payments. If the proxyAccountID /// account refuses to accept proxy staking , or if it is not currently running a node, then it /// will behave as if proxyAccountID was null. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -73,6 +75,8 @@ public struct Proto_CryptoUpdateTransactionBody { ///* /// [Deprecated]. Payments earned from proxy staking are shared between the node and this /// account, with proxyFraction / 10000 going to this account + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyFraction: Int32 { get {return _storage._proxyFraction} set {_uniqueStorage()._proxyFraction = newValue} @@ -86,6 +90,8 @@ public struct Proto_CryptoUpdateTransactionBody { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any send/withdraw transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var sendRecordThreshold: UInt64 { get { if case .sendRecordThreshold(let v)? = _storage._sendRecordThresholdField {return v} @@ -97,6 +103,8 @@ public struct Proto_CryptoUpdateTransactionBody { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any send/withdraw transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var sendRecordThresholdWrapper: SwiftProtobuf.Google_Protobuf_UInt64Value { get { if case .sendRecordThresholdWrapper(let v)? = _storage._sendRecordThresholdField {return v} @@ -113,6 +121,8 @@ public struct Proto_CryptoUpdateTransactionBody { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any receive/deposit transaction. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var receiveRecordThreshold: UInt64 { get { if case .receiveRecordThreshold(let v)? = _storage._receiveRecordThresholdField {return v} @@ -124,6 +134,8 @@ public struct Proto_CryptoUpdateTransactionBody { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any receive/deposit transaction. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var receiveRecordThresholdWrapper: SwiftProtobuf.Google_Protobuf_UInt64Value { get { if case .receiveRecordThresholdWrapper(let v)? = _storage._receiveRecordThresholdField {return v} @@ -165,6 +177,8 @@ public struct Proto_CryptoUpdateTransactionBody { /// [Deprecated] Do NOT use this field to set a false value because the server cannot /// distinguish from the default value. Use receiverSigRequiredWrapper field for this /// purpose. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var receiverSigRequired: Bool { get { if case .receiverSigRequired(let v)? = _storage._receiverSigRequiredField {return v} @@ -253,100 +267,56 @@ public struct Proto_CryptoUpdateTransactionBody { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_SendRecordThresholdField: Equatable { + public enum OneOf_SendRecordThresholdField: Equatable, Sendable { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any send/withdraw transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. case sendRecordThreshold(UInt64) ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any send/withdraw transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. case sendRecordThresholdWrapper(SwiftProtobuf.Google_Protobuf_UInt64Value) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoUpdateTransactionBody.OneOf_SendRecordThresholdField, rhs: Proto_CryptoUpdateTransactionBody.OneOf_SendRecordThresholdField) -> 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 (.sendRecordThreshold, .sendRecordThreshold): return { - guard case .sendRecordThreshold(let l) = lhs, case .sendRecordThreshold(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.sendRecordThresholdWrapper, .sendRecordThresholdWrapper): return { - guard case .sendRecordThresholdWrapper(let l) = lhs, case .sendRecordThresholdWrapper(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } - public enum OneOf_ReceiveRecordThresholdField: Equatable { + public enum OneOf_ReceiveRecordThresholdField: Equatable, Sendable { ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any receive/deposit transaction. + /// + /// NOTE: This field was marked as deprecated in the .proto file. case receiveRecordThreshold(UInt64) ///* /// [Deprecated]. The new threshold amount (in tinybars) for which an account record is /// created for any receive/deposit transaction. + /// + /// NOTE: This field was marked as deprecated in the .proto file. case receiveRecordThresholdWrapper(SwiftProtobuf.Google_Protobuf_UInt64Value) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoUpdateTransactionBody.OneOf_ReceiveRecordThresholdField, rhs: Proto_CryptoUpdateTransactionBody.OneOf_ReceiveRecordThresholdField) -> 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 (.receiveRecordThreshold, .receiveRecordThreshold): return { - guard case .receiveRecordThreshold(let l) = lhs, case .receiveRecordThreshold(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.receiveRecordThresholdWrapper, .receiveRecordThresholdWrapper): return { - guard case .receiveRecordThresholdWrapper(let l) = lhs, case .receiveRecordThresholdWrapper(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } - public enum OneOf_ReceiverSigRequiredField: Equatable { + public enum OneOf_ReceiverSigRequiredField: Equatable, Sendable { ///* /// [Deprecated] Do NOT use this field to set a false value because the server cannot /// distinguish from the default value. Use receiverSigRequiredWrapper field for this /// purpose. + /// + /// NOTE: This field was marked as deprecated in the .proto file. case receiverSigRequired(Bool) ///* /// If true, this account's key must sign any transaction depositing into this account (in /// addition to all withdrawals) case receiverSigRequiredWrapper(SwiftProtobuf.Google_Protobuf_BoolValue) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoUpdateTransactionBody.OneOf_ReceiverSigRequiredField, rhs: Proto_CryptoUpdateTransactionBody.OneOf_ReceiverSigRequiredField) -> 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 (.receiverSigRequired, .receiverSigRequired): return { - guard case .receiverSigRequired(let l) = lhs, case .receiverSigRequired(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.receiverSigRequiredWrapper, .receiverSigRequiredWrapper): return { - guard case .receiverSigRequiredWrapper(let l) = lhs, case .receiverSigRequiredWrapper(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } ///* /// ID of the account or node to which this account is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// 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. @@ -356,24 +326,6 @@ public struct Proto_CryptoUpdateTransactionBody { /// removes this account's staked node ID. case stakedNodeID(Int64) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CryptoUpdateTransactionBody.OneOf_StakedID, rhs: Proto_CryptoUpdateTransactionBody.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() {} @@ -381,14 +333,6 @@ public struct Proto_CryptoUpdateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_CryptoUpdateTransactionBody: @unchecked Sendable {} -extension Proto_CryptoUpdateTransactionBody.OneOf_SendRecordThresholdField: @unchecked Sendable {} -extension Proto_CryptoUpdateTransactionBody.OneOf_ReceiveRecordThresholdField: @unchecked Sendable {} -extension Proto_CryptoUpdateTransactionBody.OneOf_ReceiverSigRequiredField: @unchecked Sendable {} -extension Proto_CryptoUpdateTransactionBody.OneOf_StakedID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/custom_fees.pb.swift b/Sources/HederaProtobufs/Services/custom_fees.pb.swift index bb4d1dd4..7cede3da 100644 --- a/Sources/HederaProtobufs/Services/custom_fees.pb.swift +++ b/Sources/HederaProtobufs/Services/custom_fees.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// A fraction of the transferred units of a token to assess as a fee. The amount assessed will never /// be less than the given minimum_amount, and never greater than the given maximum_amount. The /// denomination is always units of the token to which this fractional fee is attached. -public struct Proto_FractionalFee { +public struct Proto_FractionalFee: Sendable { // 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. @@ -64,7 +64,7 @@ public struct Proto_FractionalFee { ///* /// A fixed number of units (hbar or token) to assess as a fee during a CryptoTransfer that transfers /// units of the token to which this fixed fee is attached. -public struct Proto_FixedFee { +public struct Proto_FixedFee: Sendable { // 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. @@ -99,24 +99,24 @@ public struct Proto_FixedFee { /// any fungible value, the ledger will assess the fallback fee, if present, to the new NFT owner. /// Royalty fees can only be added to tokens of type type NON_FUNGIBLE_UNIQUE. /// -/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, -/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. -/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate -/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart +/// **IMPORTANT:** Users must understand that native royalty fees are _strictly_ a convenience feature, +/// and that the network cannot enforce inescapable royalties on the exchange of a non-fractional NFT. +/// For example, if the counterparties agree to split their value transfer and NFT exchange into separate +/// transactions, the network cannot possibly intervene. (And note the counterparties could use a smart /// contract to make this split transaction atomic if they do not trust each other.) -/// -/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network -/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits +/// +/// Counterparties that _do_ wish to respect creator royalties should follow the pattern the network +/// recognizes: The NFT sender and receiver should both sign a single `CryptoTransfer` that credits /// the sender with all the fungible value the receiver is exchanging for the NFT. -/// -/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit -/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying -/// account. -/// +/// +/// Similarly, a marketplace using an approved spender account for an escrow transaction should credit +/// the account selling the NFT in the same `CryptoTransfer` that deducts fungible value from the buying +/// account. +/// /// There is an [open HIP discussion](https://github.com/hashgraph/hedera-improvement-proposal/discussions/578) /// that proposes to broaden the class of transactions for which the network automatically collects /// royalties. If this interests or concerns you, please add your voice to that discussion. -public struct Proto_RoyaltyFee { +public struct Proto_RoyaltyFee: Sendable { // 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. @@ -156,7 +156,7 @@ public struct Proto_RoyaltyFee { /// A transfer fee to assess during a CryptoTransfer that transfers units of the token to which the /// fee is attached. A custom fee may be either fixed or fractional, and must specify a fee collector /// account to receive the assessed fees. Only positive fees may be assessed. -public struct Proto_CustomFee { +public struct Proto_CustomFee: Sendable { // 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. @@ -207,13 +207,13 @@ public struct Proto_CustomFee { ///* /// If true, exempts all the token's fee collection accounts from this fee. /// (The token's treasury and the above fee_collector_account_id will always - /// be exempt. Please see HIP-573 + /// be exempt. Please see HIP-573 /// for details.) public var allCollectorsAreExempt: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Fee: Equatable { + public enum OneOf_Fee: Equatable, Sendable { ///* /// Fixed fee to be charged case fixedFee(Proto_FixedFee) @@ -224,28 +224,6 @@ public struct Proto_CustomFee { /// Royalty fee to be charged case royaltyFee(Proto_RoyaltyFee) - #if !swift(>=4.1) - public static func ==(lhs: Proto_CustomFee.OneOf_Fee, rhs: Proto_CustomFee.OneOf_Fee) -> 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 (.fixedFee, .fixedFee): return { - guard case .fixedFee(let l) = lhs, case .fixedFee(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fractionalFee, .fractionalFee): return { - guard case .fractionalFee(let l) = lhs, case .fractionalFee(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.royaltyFee, .royaltyFee): return { - guard case .royaltyFee(let l) = lhs, case .royaltyFee(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -255,7 +233,7 @@ public struct Proto_CustomFee { ///* /// A custom transfer fee that was assessed during handling of a CryptoTransfer. -public struct Proto_AssessedCustomFee { +public struct Proto_AssessedCustomFee: Sendable { // 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. @@ -298,15 +276,6 @@ public struct Proto_AssessedCustomFee { fileprivate var _feeCollectorAccountID: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FractionalFee: @unchecked Sendable {} -extension Proto_FixedFee: @unchecked Sendable {} -extension Proto_RoyaltyFee: @unchecked Sendable {} -extension Proto_CustomFee: @unchecked Sendable {} -extension Proto_CustomFee.OneOf_Fee: @unchecked Sendable {} -extension Proto_AssessedCustomFee: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/duration.pb.swift b/Sources/HederaProtobufs/Services/duration.pb.swift index 7deef33a..0289f7c6 100644 --- a/Sources/HederaProtobufs/Services/duration.pb.swift +++ b/Sources/HederaProtobufs/Services/duration.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A length of time in seconds. -public struct Proto_Duration { +public struct Proto_Duration: Sendable { // 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. @@ -36,10 +36,6 @@ public struct Proto_Duration { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Duration: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift index cdab40a1..93041655 100644 --- a/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/ethereum_transaction.pb.swift @@ -20,21 +20,21 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_EthereumTransactionBody { +public struct Proto_EthereumTransactionBody: @unchecked Sendable { // 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 Ethereum transaction (RLP encoded type 0, 1, and 2). Complete + /// The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete /// unless the callData field is set. public var ethereumData: Data = Data() ///* /// For large transactions (for example contract create) this is the callData - /// of the ethereumData. The data in the ethereumData will be re-written with - /// the callData element as a zero length string with the original contents in - /// the referenced file at time of execution. The ethereumData will need to be + /// of the ethereumData. The data in the ethereumData will be re-written with + /// the callData element as a zero length string with the original contents in + /// the referenced file at time of execution. The ethereumData will need to be /// "rehydrated" with the callData for signature validation to pass. public var callData: Proto_FileID { get {return _callData ?? Proto_FileID()} @@ -46,17 +46,17 @@ public struct Proto_EthereumTransactionBody { public mutating func clearCallData() {self._callData = nil} ///* - /// The maximum amount, in tinybars, that the payer of the hedera transaction + /// The maximum amount, in tinybars, that the payer of the hedera transaction /// is willing to pay to complete the transaction. /// - /// Ordinarily the account with the ECDSA alias corresponding to the public + /// Ordinarily the account with the ECDSA alias corresponding to the public /// key that is extracted from the ethereum_data signature is responsible for /// fees that result from the execution of the transaction. If that amount of /// authorized fees is not sufficient then the payer of the transaction can be - /// charged, up to but not exceeding this amount. If the ethereum_data + /// charged, up to but not exceeding this amount. If the ethereum_data /// transaction authorized an amount that was insufficient then the payer will - /// only be charged the amount needed to make up the difference. If the gas - /// price in the transaction was set to zero then the payer will be assessed + /// only be charged the amount needed to make up the difference. If the gas + /// price in the transaction was set to zero then the payer will be assessed /// the entire fee. public var maxGasAllowance: Int64 = 0 @@ -67,10 +67,6 @@ public struct Proto_EthereumTransactionBody { fileprivate var _callData: Proto_FileID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_EthereumTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift index cc4291c9..efd5bfda 100644 --- a/Sources/HederaProtobufs/Services/exchange_rate.pb.swift +++ b/Sources/HederaProtobufs/Services/exchange_rate.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// An exchange rate between hbar and cents (USD) and the time at which the exchange rate will -/// expire, and be superseded by a new exchange rate. -public struct Proto_ExchangeRate { +/// expire, and be superseded by a new exchange rate. +public struct Proto_ExchangeRate: Sendable { // 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. @@ -56,7 +56,7 @@ public struct Proto_ExchangeRate { ///* /// Two sets of exchange rates -public struct Proto_ExchangeRateSet { +public struct Proto_ExchangeRateSet: Sendable { // 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. @@ -91,11 +91,6 @@ public struct Proto_ExchangeRateSet { fileprivate var _nextRate: Proto_ExchangeRate? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ExchangeRate: @unchecked Sendable {} -extension Proto_ExchangeRateSet: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_append.pb.swift b/Sources/HederaProtobufs/Services/file_append.pb.swift index 3a2490c1..fbcf960e 100644 --- a/Sources/HederaProtobufs/Services/file_append.pb.swift +++ b/Sources/HederaProtobufs/Services/file_append.pb.swift @@ -25,8 +25,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// single FileCreateTransaction, then it can be created with the first part of its contents, and /// then appended as many times as necessary to create the entire file. This transaction must be /// signed by all initial M-of-M KeyList keys. If keys contains additional KeyList or ThresholdKey -/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. -public struct Proto_FileAppendTransactionBody { +/// then M-of-M secondary KeyList or ThresholdKey signing requirements must be meet. +public struct Proto_FileAppendTransactionBody: @unchecked Sendable { // 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. @@ -53,10 +53,6 @@ public struct Proto_FileAppendTransactionBody { fileprivate var _fileID: Proto_FileID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileAppendTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_create.pb.swift b/Sources/HederaProtobufs/Services/file_create.pb.swift index 955c3c29..709972ae 100644 --- a/Sources/HederaProtobufs/Services/file_create.pb.swift +++ b/Sources/HederaProtobufs/Services/file_create.pb.swift @@ -29,14 +29,14 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// at the expirationTime, unless its expiration is extended by another transaction before that time. /// If the file is deleted, then its contents will become empty and it will be marked as deleted /// until it expires, and then it will cease to exist. -/// +/// /// The keys field is a list of keys. All keys within the top-level key list must sign (M-M) to /// create or modify a file. However, to delete the file, only one key (1-M) is required to sign from /// the top-level key list. Each of those "keys" may itself be threshold key containing other keys /// (including other threshold keys). In other words, the behavior is an AND for create/modify, OR /// for delete. This is useful for acting as a revocation server. If it is desired to have the /// behavior be AND for all 3 operations (or OR for all 3), then the list should have only a single -/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field +/// Key, which is a threshold key, with N=1 for OR, N=M for AND. If the auto_renew_account field /// is set, the key of the referenced account must sign. /// /// If a file is created without ANY keys in the keys field, the file is immutable and ONLY the @@ -54,7 +54,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The current API ignores shardID, realmID, and newRealmAdminKey, and creates everything in shard 0 /// and realm 0, with a null key. Future versions of the API will support multiple realms and /// multiple shards. -public struct Proto_FileCreateTransactionBody { +public struct Proto_FileCreateTransactionBody: @unchecked Sendable { // 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. @@ -135,10 +135,6 @@ public struct Proto_FileCreateTransactionBody { fileprivate var _newRealmAdminKey: Proto_Key? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileCreateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_delete.pb.swift b/Sources/HederaProtobufs/Services/file_delete.pb.swift index 298152a6..3adc8135 100644 --- a/Sources/HederaProtobufs/Services/file_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/file_delete.pb.swift @@ -27,7 +27,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// modify the file, but any single one of the top level keys can be used to delete the file. This /// transaction must be signed by 1-of-M KeyList keys. If keys contains additional KeyList or /// ThresholdKey then 1-of-M secondary KeyList or ThresholdKey signing requirements must be meet. -public struct Proto_FileDeleteTransactionBody { +public struct Proto_FileDeleteTransactionBody: Sendable { // 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. @@ -50,10 +50,6 @@ public struct Proto_FileDeleteTransactionBody { fileprivate var _fileID: Proto_FileID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileDeleteTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_get_contents.pb.swift b/Sources/HederaProtobufs/Services/file_get_contents.pb.swift index ebb13469..8315c56b 100644 --- a/Sources/HederaProtobufs/Services/file_get_contents.pb.swift +++ b/Sources/HederaProtobufs/Services/file_get_contents.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get the contents of a file. The content field is empty (no bytes) if the file is empty. -public struct Proto_FileGetContentsQuery { +public struct Proto_FileGetContentsQuery: Sendable { // 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. @@ -60,7 +60,7 @@ public struct Proto_FileGetContentsQuery { ///* /// Response when the client sends the node FileGetContentsQuery -public struct Proto_FileGetContentsResponse { +public struct Proto_FileGetContentsResponse: Sendable { // 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. @@ -90,7 +90,7 @@ public struct Proto_FileGetContentsResponse { public var unknownFields = SwiftProtobuf.UnknownStorage() - public struct FileContents { + public struct FileContents: @unchecked Sendable { // 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. @@ -123,12 +123,6 @@ public struct Proto_FileGetContentsResponse { fileprivate var _fileContents: Proto_FileGetContentsResponse.FileContents? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileGetContentsQuery: @unchecked Sendable {} -extension Proto_FileGetContentsResponse: @unchecked Sendable {} -extension Proto_FileGetContentsResponse.FileContents: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_get_info.pb.swift b/Sources/HederaProtobufs/Services/file_get_info.pb.swift index 440e5bc3..4591ebfe 100644 --- a/Sources/HederaProtobufs/Services/file_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/file_get_info.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// transaction or smart contract deletes the file, but it has not yet expired, then the fileInfo /// field will be non-empty, the deleted field will be true, its size will be 0, and its contents /// will be empty. -public struct Proto_FileGetInfoQuery { +public struct Proto_FileGetInfoQuery: Sendable { // 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. @@ -64,7 +64,7 @@ public struct Proto_FileGetInfoQuery { ///* /// Response when the client sends the node FileGetInfoQuery -public struct Proto_FileGetInfoResponse { +public struct Proto_FileGetInfoResponse: Sendable { // 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. @@ -94,7 +94,7 @@ public struct Proto_FileGetInfoResponse { public var unknownFields = SwiftProtobuf.UnknownStorage() - public struct FileInfo { + public struct FileInfo: @unchecked Sendable { // 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. @@ -145,7 +145,7 @@ public struct Proto_FileGetInfoResponse { public var memo: String = String() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -163,12 +163,6 @@ public struct Proto_FileGetInfoResponse { fileprivate var _fileInfo: Proto_FileGetInfoResponse.FileInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileGetInfoQuery: @unchecked Sendable {} -extension Proto_FileGetInfoResponse: @unchecked Sendable {} -extension Proto_FileGetInfoResponse.FileInfo: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/file_service.grpc.swift b/Sources/HederaProtobufs/Services/file_service.grpc.swift index 1051194e..052e3cf8 100644 --- a/Sources/HederaProtobufs/Services/file_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/file_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_FileServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_FileServiceClientProtocol: GRPCClient { @@ -276,7 +276,7 @@ public struct Proto_FileServiceNIOClient: Proto_FileServiceClientProtocol { } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_FileServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Sources/HederaProtobufs/Services/file_update.pb.swift b/Sources/HederaProtobufs/Services/file_update.pb.swift index 40a27f8d..02e5e7eb 100644 --- a/Sources/HederaProtobufs/Services/file_update.pb.swift +++ b/Sources/HederaProtobufs/Services/file_update.pb.swift @@ -26,9 +26,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// in the top level of a key list (M-of-M) of the file being updated. If the keys themselves are /// being updated, then the transaction must also be signed by all the new keys. If the keys contain /// additional KeyList or ThresholdKey then M-of-M secondary KeyList or ThresholdKey signing -/// requirements must be meet If the update transaction sets the auto_renew_account_id field +/// requirements must be meet If the update transaction sets the auto_renew_account_id field /// to anything other than the sentinel 0.0.0, the key of the referenced account must sign. -public struct Proto_FileUpdateTransactionBody { +public struct Proto_FileUpdateTransactionBody: @unchecked Sendable { // 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. @@ -91,10 +91,6 @@ public struct Proto_FileUpdateTransactionBody { fileprivate var _memo: SwiftProtobuf.Google_Protobuf_StringValue? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FileUpdateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/freeze.pb.swift b/Sources/HederaProtobufs/Services/freeze.pb.swift index 502afb1e..5fb44fb0 100644 --- a/Sources/HederaProtobufs/Services/freeze.pb.swift +++ b/Sources/HederaProtobufs/Services/freeze.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, sets the consensus time at which the platform should stop creating events and /// accepting transactions, and enter a maintenance window. -public struct Proto_FreezeTransactionBody { +public struct Proto_FreezeTransactionBody: @unchecked Sendable { // 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. @@ -31,21 +31,29 @@ public struct Proto_FreezeTransactionBody { ///* /// !! DEPRECATED and REJECTED by nodes /// The start hour (in UTC time), a value between 0 and 23 + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var startHour: Int32 = 0 ///* /// !! DEPRECATED and REJECTED by nodes /// The start minute (in UTC time), a value between 0 and 59 + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var startMin: Int32 = 0 ///* /// !! DEPRECATED and REJECTED by nodes /// The end hour (in UTC time), a value between 0 and 23 + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var endHour: Int32 = 0 ///* /// !! DEPRECATED and REJECTED by nodes /// The end minute (in UTC time), a value between 0 and 59 + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var endMin: Int32 = 0 ///* @@ -87,10 +95,6 @@ public struct Proto_FreezeTransactionBody { fileprivate var _startTime: Proto_Timestamp? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FreezeTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/freeze_type.pb.swift b/Sources/HederaProtobufs/Services/freeze_type.pb.swift index 21ec2f2b..9a66fc96 100644 --- a/Sources/HederaProtobufs/Services/freeze_type.pb.swift +++ b/Sources/HederaProtobufs/Services/freeze_type.pb.swift @@ -21,32 +21,32 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// The type of network freeze or upgrade operation to be performed. This type dictates which -/// fields are required. -public enum Proto_FreezeType: SwiftProtobuf.Enum { +/// The type of network freeze or upgrade operation to be performed. This type dictates which +/// fields are required. +public enum Proto_FreezeType: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* - /// An (invalid) default value for this enum, to ensure the client explicitly sets + /// An (invalid) default value for this enum, to ensure the client explicitly sets /// the intended type of freeze transaction. case unknownFreezeType // = 0 ///* - /// Freezes the network at the specified time. The start_time field must be provided and - /// must reference a future time. Any values specified for the update_file and file_hash - /// fields will be ignored. This transaction does not perform any network changes or - /// upgrades and requires manual intervention to restart the network. + /// Freezes the network at the specified time. The start_time field must be provided and + /// must reference a future time. Any values specified for the update_file and file_hash + /// fields will be ignored. This transaction does not perform any network changes or + /// upgrades and requires manual intervention to restart the network. case freezeOnly // = 1 ///* - /// A non-freezing operation that initiates network wide preparation in advance of a - /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and + /// A non-freezing operation that initiates network wide preparation in advance of a + /// scheduled freeze upgrade. The update_file and file_hash fields must be provided and /// valid. The start_time field may be omitted and any value present will be ignored. case prepareUpgrade // = 2 ///* - /// Freezes the network at the specified time and performs the previously prepared - /// automatic upgrade across the entire network. + /// Freezes the network at the specified time and performs the previously prepared + /// automatic upgrade across the entire network. case freezeUpgrade // = 3 ///* @@ -54,8 +54,8 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { case freezeAbort // = 4 ///* - /// Performs an immediate upgrade on auxilary services and containers providing - /// telemetry/metrics. Does not impact network operations. + /// Performs an immediate upgrade on auxilary services and containers providing + /// telemetry/metrics. Does not impact network operations. case telemetryUpgrade // = 5 case UNRECOGNIZED(Int) @@ -87,11 +87,6 @@ public enum Proto_FreezeType: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_FreezeType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_FreezeType] = [ .unknownFreezeType, @@ -101,13 +96,8 @@ extension Proto_FreezeType: CaseIterable { .freezeAbort, .telemetryUpgrade, ] -} - -#endif // swift(>=4.2) -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_FreezeType: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +} // MARK: - Code below here is support for the SwiftProtobuf runtime. diff --git a/Sources/HederaProtobufs/Services/get_account_details.pb.swift b/Sources/HederaProtobufs/Services/get_account_details.pb.swift index 59aca7c9..245fc16e 100644 --- a/Sources/HederaProtobufs/Services/get_account_details.pb.swift +++ b/Sources/HederaProtobufs/Services/get_account_details.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Gets all the information about an account, including balance and allowances. This does not get the list of /// account records. -public struct Proto_GetAccountDetailsQuery { +public struct Proto_GetAccountDetailsQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_GetAccountDetailsQuery { ///* /// Response when the client sends the node GetAccountDetailsQuery -public struct Proto_GetAccountDetailsResponse { +public struct Proto_GetAccountDetailsResponse: Sendable { // 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. @@ -91,7 +91,7 @@ public struct Proto_GetAccountDetailsResponse { public var unknownFields = SwiftProtobuf.UnknownStorage() - public struct AccountDetails { + public struct AccountDetails: @unchecked Sendable { // 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. @@ -129,6 +129,8 @@ public struct Proto_GetAccountDetailsResponse { /// automatically proxy staked to a node chosen by the network, but without earning payments. /// If the proxyAccountID account refuses to accept proxy staking , or if it is not currently /// running a node, then it will behave as if proxyAccountID was null. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var proxyAccountID: Proto_AccountID { get {return _storage._proxyAccountID ?? Proto_AccountID()} set {_uniqueStorage()._proxyAccountID = newValue} @@ -273,7 +275,7 @@ public struct Proto_GetAccountDetailsResponse { ///* /// A granted allowance of hbar transfers for a spender relative to the owner account. -public struct Proto_GrantedCryptoAllowance { +public struct Proto_GrantedCryptoAllowance: Sendable { // 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. @@ -302,7 +304,7 @@ public struct Proto_GrantedCryptoAllowance { ///* /// A granted allowance for all the NFTs of a token for a spender relative to the owner account. -public struct Proto_GrantedNftAllowance { +public struct Proto_GrantedNftAllowance: Sendable { // 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. @@ -339,7 +341,7 @@ public struct Proto_GrantedNftAllowance { ///* /// A granted allowance of fungible token transfers for a spender relative to the owner account. -public struct Proto_GrantedTokenAllowance { +public struct Proto_GrantedTokenAllowance: Sendable { // 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. @@ -378,15 +380,6 @@ public struct Proto_GrantedTokenAllowance { fileprivate var _spender: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_GetAccountDetailsQuery: @unchecked Sendable {} -extension Proto_GetAccountDetailsResponse: @unchecked Sendable {} -extension Proto_GetAccountDetailsResponse.AccountDetails: @unchecked Sendable {} -extension Proto_GrantedCryptoAllowance: @unchecked Sendable {} -extension Proto_GrantedNftAllowance: @unchecked Sendable {} -extension Proto_GrantedTokenAllowance: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/get_by_key.pb.swift b/Sources/HederaProtobufs/Services/get_by_key.pb.swift index a2cdf8fe..3ccf839c 100644 --- a/Sources/HederaProtobufs/Services/get_by_key.pb.swift +++ b/Sources/HederaProtobufs/Services/get_by_key.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Get all accounts, claims, files, and smart contract instances whose associated keys include the /// given Key. The given Key must not be a contractID or a ThresholdKey. This is not yet implemented /// in the API, but will be in the future. -public struct Proto_GetByKeyQuery { +public struct Proto_GetByKeyQuery: Sendable { // 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. @@ -62,7 +62,7 @@ public struct Proto_GetByKeyQuery { ///* /// the ID for a single entity (account, livehash, file, or smart contract instance) -public struct Proto_EntityID { +public struct Proto_EntityID: Sendable { // 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. @@ -111,7 +111,7 @@ public struct Proto_EntityID { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Entity: Equatable { + public enum OneOf_Entity: Equatable, Sendable { ///* /// The Account ID for the cryptocurrency account case accountID(Proto_AccountID) @@ -125,32 +125,6 @@ public struct Proto_EntityID { /// The smart contract ID that identifies instance case contractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_EntityID.OneOf_Entity, rhs: Proto_EntityID.OneOf_Entity) -> 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 (.accountID, .accountID): return { - guard case .accountID(let l) = lhs, case .accountID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.liveHash, .liveHash): return { - guard case .liveHash(let l) = lhs, case .liveHash(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileID, .fileID): return { - guard case .fileID(let l) = lhs, case .fileID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractID, .contractID): return { - guard case .contractID(let l) = lhs, case .contractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -158,7 +132,7 @@ public struct Proto_EntityID { ///* /// Response when the client sends the node GetByKeyQuery -public struct Proto_GetByKeyResponse { +public struct Proto_GetByKeyResponse: Sendable { // 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. @@ -186,13 +160,6 @@ public struct Proto_GetByKeyResponse { fileprivate var _header: Proto_ResponseHeader? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_GetByKeyQuery: @unchecked Sendable {} -extension Proto_EntityID: @unchecked Sendable {} -extension Proto_EntityID.OneOf_Entity: @unchecked Sendable {} -extension Proto_GetByKeyResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/get_by_solidity_id.pb.swift b/Sources/HederaProtobufs/Services/get_by_solidity_id.pb.swift index 2818f02e..07a5fe5c 100644 --- a/Sources/HederaProtobufs/Services/get_by_solidity_id.pb.swift +++ b/Sources/HederaProtobufs/Services/get_by_solidity_id.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Get the IDs in the format used by transactions, given the ID in the format used by Solidity. If /// the Solidity ID is for a smart contract instance, then both the ContractID and associated /// AccountID will be returned. -public struct Proto_GetBySolidityIDQuery { +public struct Proto_GetBySolidityIDQuery: Sendable { // 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. @@ -54,7 +54,7 @@ public struct Proto_GetBySolidityIDQuery { ///* /// Response when the client sends the node GetBySolidityIDQuery -public struct Proto_GetBySolidityIDResponse { +public struct Proto_GetBySolidityIDResponse: Sendable { // 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. @@ -115,11 +115,6 @@ public struct Proto_GetBySolidityIDResponse { fileprivate var _contractID: Proto_ContractID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_GetBySolidityIDQuery: @unchecked Sendable {} -extension Proto_GetBySolidityIDResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift index 22384a8f..98552380 100644 --- a/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift +++ b/Sources/HederaProtobufs/Services/network_get_execution_time.pb.swift @@ -21,11 +21,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// Gets the time in nanoseconds spent in handleTransaction for one or more -/// TransactionIDs (assuming they have reached consensus "recently", since only a limited -/// number of execution times are kept in-memory, depending on the value of the node-local +/// Gets the time in nanoseconds spent in handleTransaction for one or more +/// TransactionIDs (assuming they have reached consensus "recently", since only a limited +/// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). -public struct Proto_NetworkGetExecutionTimeQuery { +public struct Proto_NetworkGetExecutionTimeQuery: Sendable { // 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. @@ -57,7 +57,7 @@ public struct Proto_NetworkGetExecutionTimeQuery { /// Response when the client sends the node NetworkGetExecutionTimeQuery; returns /// INVALID_TRANSACTION_ID if any of the given TransactionIDs do not have available /// execution times in the answering node. -public struct Proto_NetworkGetExecutionTimeResponse { +public struct Proto_NetworkGetExecutionTimeResponse: Sendable { // 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. @@ -85,11 +85,6 @@ public struct Proto_NetworkGetExecutionTimeResponse { fileprivate var _header: Proto_ResponseHeader? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_NetworkGetExecutionTimeQuery: @unchecked Sendable {} -extension Proto_NetworkGetExecutionTimeResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/network_get_version_info.pb.swift b/Sources/HederaProtobufs/Services/network_get_version_info.pb.swift index 3c3bd101..f5a17cdf 100644 --- a/Sources/HederaProtobufs/Services/network_get_version_info.pb.swift +++ b/Sources/HederaProtobufs/Services/network_get_version_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Get the deployed versions of Hedera Services and the HAPI proto in semantic version format -public struct Proto_NetworkGetVersionInfoQuery { +public struct Proto_NetworkGetVersionInfoQuery: Sendable { // 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. @@ -48,7 +48,7 @@ public struct Proto_NetworkGetVersionInfoQuery { ///* /// Response when the client sends the node NetworkGetVersionInfoQuery -public struct Proto_NetworkGetVersionInfoResponse { +public struct Proto_NetworkGetVersionInfoResponse: Sendable { // 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. @@ -96,11 +96,6 @@ public struct Proto_NetworkGetVersionInfoResponse { fileprivate var _hederaServicesVersion: Proto_SemanticVersion? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_NetworkGetVersionInfoQuery: @unchecked Sendable {} -extension Proto_NetworkGetVersionInfoResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/network_service.grpc.swift b/Sources/HederaProtobufs/Services/network_service.grpc.swift index 6d8e092a..75fa571a 100644 --- a/Sources/HederaProtobufs/Services/network_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/network_service.grpc.swift @@ -65,9 +65,9 @@ extension Proto_NetworkServiceClientProtocol { } ///* - /// Retrieves the time in nanoseconds spent in handleTransaction for one or more - /// TransactionIDs (assuming they have reached consensus "recently", since only a limited - /// number of execution times are kept in-memory, depending on the value of the node-local + /// Retrieves the time in nanoseconds spent in handleTransaction for one or more + /// TransactionIDs (assuming they have reached consensus "recently", since only a limited + /// number of execution times are kept in-memory, depending on the value of the node-local /// property stats.executionTimesToTrack). /// /// - Parameters: diff --git a/Sources/HederaProtobufs/Services/node_create.pb.swift b/Sources/HederaProtobufs/Services/node_create.pb.swift index cd508df5..39cc64c1 100644 --- a/Sources/HederaProtobufs/Services/node_create.pb.swift +++ b/Sources/HederaProtobufs/Services/node_create.pb.swift @@ -44,7 +44,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// ### Record Stream Effects /// Upon completion the newly assigned `node_id` SHALL be in the transaction /// receipt. -public struct Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody { +public struct Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody: @unchecked Sendable { // 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. @@ -152,10 +152,6 @@ public struct Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody { fileprivate var _adminKey: Proto_Key? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Com_Hedera_Hapi_Node_Addressbook_NodeCreateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "com.hedera.hapi.node.addressbook" diff --git a/Sources/HederaProtobufs/Services/node_delete.pb.swift b/Sources/HederaProtobufs/Services/node_delete.pb.swift index 6c8aece3..1b902c34 100644 --- a/Sources/HederaProtobufs/Services/node_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/node_delete.pb.swift @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// ### Record Stream Effects /// Upon completion the "deleted" `node_id` SHALL be in the transaction /// receipt. -public struct Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody { +public struct Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody: Sendable { // 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. @@ -55,10 +55,6 @@ public struct Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Com_Hedera_Hapi_Node_Addressbook_NodeDeleteTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "com.hedera.hapi.node.addressbook" diff --git a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift index 30555a09..511efe90 100644 --- a/Sources/HederaProtobufs/Services/node_stake_update.pb.swift +++ b/Sources/HederaProtobufs/Services/node_stake_update.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Updates the staking info at the end of staking period to indicate new staking period has started. -public struct Proto_NodeStakeUpdateTransactionBody { +public struct Proto_NodeStakeUpdateTransactionBody: @unchecked Sendable { // 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. @@ -74,7 +74,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are + /// The number of minutes in a staking period. Note for the special case of 1440 minutes, periods are /// treated as UTC calendar days, rather than repeating 1440 minute periods left-aligned at the epoch. public var stakingPeriod: Int64 { get {return _storage._stakingPeriod} @@ -100,15 +100,17 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the + /// (DEPRECATED) The maximum total number of tinybars to be distributed as staking rewards in the /// ending period. Please consult the max_total_reward field instead. + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var stakingRewardRate: Int64 { get {return _storage._stakingRewardRate} set {_uniqueStorage()._stakingRewardRate = newValue} } ///* - /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that + /// The amount of the staking reward funds (account 0.0.800) reserved to pay pending rewards that /// have been earned but not collected. public var reservedStakingRewards: Int64 { get {return _storage._reservedStakingRewards} @@ -116,7 +118,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is + /// The unreserved balance of account 0.0.800 at the close of the just-ending period; this value is /// used to compute the HIP-782 balance ratio. public var unreservedStakingRewardBalance: Int64 { get {return _storage._unreservedStakingRewardBalance} @@ -124,7 +126,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward + /// The unreserved tinybar balance of account 0.0.800 required to achieve the maximum per-hbar reward /// rate in any period; please see HIP-782 for details. public var rewardBalanceThreshold: Int64 { get {return _storage._rewardBalanceThreshold} @@ -132,7 +134,7 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum + /// The maximum amount of tinybar that can be staked for reward while still achieving the maximum /// per-hbar reward rate in any period; please see HIP-782 for details. public var maxStakeRewarded: Int64 { get {return _storage._maxStakeRewarded} @@ -140,10 +142,10 @@ public struct Proto_NodeStakeUpdateTransactionBody { } ///* - /// The maximum total tinybars that could be paid as staking rewards in the ending period, after + /// The maximum total tinybars that could be paid as staking rewards in the ending period, after /// applying the settings for the 0.0.800 balance threshold and the maximum stake rewarded. This - /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a - /// mirror node could also calculate its value by iterating the node_stake list and summing + /// field replaces the deprecated field staking_reward_rate. It is only for convenience, since a + /// mirror node could also calculate its value by iterating the node_stake list and summing /// stake_rewarded fields; then multiplying this sum by the max_staking_reward_rate_per_hbar. public var maxTotalReward: Int64 { get {return _storage._maxTotalReward} @@ -159,20 +161,20 @@ public struct Proto_NodeStakeUpdateTransactionBody { ///* /// Staking info for each node at the end of a staking period. -public struct Proto_NodeStake { +public struct Proto_NodeStake: Sendable { // 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 maximum stake (rewarded or not rewarded) this node can have as consensus weight. If its stake to - /// reward is above this maximum at the start of a period, then accounts staking to the node in that + /// reward is above this maximum at the start of a period, then accounts staking to the node in that /// period will be rewarded at a lower rate scaled by (maxStake / stakeRewardStart). public var maxStake: Int64 = 0 ///* /// The minimum stake (rewarded or not rewarded) this node must reach before having non-zero consensus weight. - /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in + /// If its total stake is below this minimum at the start of a period, then accounts staking to the node in /// that period will receive no rewards. public var minStake: Int64 = 0 @@ -181,8 +183,8 @@ public struct Proto_NodeStake { public var nodeID: Int64 = 0 ///* - /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of - /// the staking period that is ending. + /// The reward rate _per whole hbar_ that was staked to this node with declineReward=false from the start of + /// the staking period that is ending. public var rewardRate: Int64 = 0 ///* @@ -190,12 +192,12 @@ public struct Proto_NodeStake { public var stake: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=true, at the /// beginning of the new staking period. public var stakeNotRewarded: Int64 = 0 ///* - /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the + /// Total of (balance + stakedToMe) for all accounts staked to this node with declineReward=false, at the /// beginning of the new staking period. public var stakeRewarded: Int64 = 0 @@ -204,11 +206,6 @@ public struct Proto_NodeStake { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_NodeStakeUpdateTransactionBody: @unchecked Sendable {} -extension Proto_NodeStake: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/node_update.pb.swift b/Sources/HederaProtobufs/Services/node_update.pb.swift index 6924cbfb..cd6ac810 100644 --- a/Sources/HederaProtobufs/Services/node_update.pb.swift +++ b/Sources/HederaProtobufs/Services/node_update.pb.swift @@ -39,7 +39,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// ### Record Stream Effects /// Upon completion the `node_id` for the updated entry SHALL be in the /// transaction receipt. -public struct Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody { +public struct Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody: Sendable { // 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. @@ -198,10 +198,6 @@ public struct Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody { fileprivate var _adminKey: Proto_Key? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Com_Hedera_Hapi_Node_Addressbook_NodeUpdateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "com.hedera.hapi.node.addressbook" diff --git a/Sources/HederaProtobufs/Services/query.pb.swift b/Sources/HederaProtobufs/Services/query.pb.swift index f2b92f9d..440f7780 100644 --- a/Sources/HederaProtobufs/Services/query.pb.swift +++ b/Sources/HederaProtobufs/Services/query.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A single query, which is sent from the client to a node. This includes all possible queries. Each /// Query should not have more than 50 levels. -public struct Proto_Query { +public struct Proto_Query: Sendable { // 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. @@ -284,7 +284,7 @@ public struct Proto_Query { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Query: Equatable { + public enum OneOf_Query: Equatable, Sendable { ///* /// Get all entities associated with a given key case getByKey(Proto_GetByKeyQuery) @@ -363,126 +363,11 @@ public struct Proto_Query { /// Gets all information about an account including allowances granted by the account case accountDetails(Proto_GetAccountDetailsQuery) - #if !swift(>=4.1) - public static func ==(lhs: Proto_Query.OneOf_Query, rhs: Proto_Query.OneOf_Query) -> 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 (.getByKey, .getByKey): return { - guard case .getByKey(let l) = lhs, case .getByKey(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getBySolidityID, .getBySolidityID): return { - guard case .getBySolidityID(let l) = lhs, case .getBySolidityID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractCallLocal, .contractCallLocal): return { - guard case .contractCallLocal(let l) = lhs, case .contractCallLocal(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetInfo, .contractGetInfo): return { - guard case .contractGetInfo(let l) = lhs, case .contractGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetBytecode, .contractGetBytecode): return { - guard case .contractGetBytecode(let l) = lhs, case .contractGetBytecode(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetRecords, .contractGetRecords): return { - guard case .contractGetRecords(let l) = lhs, case .contractGetRecords(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptogetAccountBalance, .cryptogetAccountBalance): return { - guard case .cryptogetAccountBalance(let l) = lhs, case .cryptogetAccountBalance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetAccountRecords, .cryptoGetAccountRecords): return { - guard case .cryptoGetAccountRecords(let l) = lhs, case .cryptoGetAccountRecords(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetInfo, .cryptoGetInfo): return { - guard case .cryptoGetInfo(let l) = lhs, case .cryptoGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetLiveHash, .cryptoGetLiveHash): return { - guard case .cryptoGetLiveHash(let l) = lhs, case .cryptoGetLiveHash(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetProxyStakers, .cryptoGetProxyStakers): return { - guard case .cryptoGetProxyStakers(let l) = lhs, case .cryptoGetProxyStakers(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileGetContents, .fileGetContents): return { - guard case .fileGetContents(let l) = lhs, case .fileGetContents(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileGetInfo, .fileGetInfo): return { - guard case .fileGetInfo(let l) = lhs, case .fileGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetReceipt, .transactionGetReceipt): return { - guard case .transactionGetReceipt(let l) = lhs, case .transactionGetReceipt(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetRecord, .transactionGetRecord): return { - guard case .transactionGetRecord(let l) = lhs, case .transactionGetRecord(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetFastRecord, .transactionGetFastRecord): return { - guard case .transactionGetFastRecord(let l) = lhs, case .transactionGetFastRecord(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusGetTopicInfo, .consensusGetTopicInfo): return { - guard case .consensusGetTopicInfo(let l) = lhs, case .consensusGetTopicInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.networkGetVersionInfo, .networkGetVersionInfo): return { - guard case .networkGetVersionInfo(let l) = lhs, case .networkGetVersionInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetInfo, .tokenGetInfo): return { - guard case .tokenGetInfo(let l) = lhs, case .tokenGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleGetInfo, .scheduleGetInfo): return { - guard case .scheduleGetInfo(let l) = lhs, case .scheduleGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetAccountNftInfos, .tokenGetAccountNftInfos): return { - guard case .tokenGetAccountNftInfos(let l) = lhs, case .tokenGetAccountNftInfos(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetNftInfo, .tokenGetNftInfo): return { - guard case .tokenGetNftInfo(let l) = lhs, case .tokenGetNftInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetNftInfos, .tokenGetNftInfos): return { - guard case .tokenGetNftInfos(let l) = lhs, case .tokenGetNftInfos(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.networkGetExecutionTime, .networkGetExecutionTime): return { - guard case .networkGetExecutionTime(let l) = lhs, case .networkGetExecutionTime(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.accountDetails, .accountDetails): return { - guard case .accountDetails(let l) = lhs, case .accountDetails(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Query: @unchecked Sendable {} -extension Proto_Query.OneOf_Query: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/query_header.pb.swift b/Sources/HederaProtobufs/Services/query_header.pb.swift index 4763d7e9..97d7a6eb 100644 --- a/Sources/HederaProtobufs/Services/query_header.pb.swift +++ b/Sources/HederaProtobufs/Services/query_header.pb.swift @@ -26,8 +26,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// (allowing it to tailor the payment transaction accordingly). If the payment in the query fails /// the precheck, then the response may have some fields blank. The state proof is only available for /// some types of information. It is available for a Record, but not a receipt. It is available for -/// the information in each kind of *GetInfo request. -public enum Proto_ResponseType: SwiftProtobuf.Enum { +/// the information in each kind of *GetInfo request. +public enum Proto_ResponseType: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -71,11 +71,6 @@ public enum Proto_ResponseType: SwiftProtobuf.Enum { } } -} - -#if swift(>=4.2) - -extension Proto_ResponseType: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_ResponseType] = [ .answerOnly, @@ -83,15 +78,14 @@ extension Proto_ResponseType: CaseIterable { .costAnswer, .costAnswerStateProof, ] -} -#endif // swift(>=4.2) +} ///* /// Each query from the client to the node will contain the QueryHeader, which gives the requested /// response type, and includes a payment transaction that will compensate the node for responding to -/// the query. The payment can be blank if the query is free. -public struct Proto_QueryHeader { +/// the query. The payment can be blank if the query is free. +public struct Proto_QueryHeader: Sendable { // 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. @@ -118,11 +112,6 @@ public struct Proto_QueryHeader { fileprivate var _payment: Proto_Transaction? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ResponseType: @unchecked Sendable {} -extension Proto_QueryHeader: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/response.pb.swift b/Sources/HederaProtobufs/Services/response.pb.swift index 55372a62..d9133e68 100644 --- a/Sources/HederaProtobufs/Services/response.pb.swift +++ b/Sources/HederaProtobufs/Services/response.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A single response, which is returned from the node to the client, after the client sent the node /// a query. This includes all responses. -public struct Proto_Response { +public struct Proto_Response: Sendable { // 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. @@ -282,7 +282,7 @@ public struct Proto_Response { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Response: Equatable { + public enum OneOf_Response: Equatable, Sendable { ///* /// Get all entities associated with a given key case getByKey(Proto_GetByKeyResponse) @@ -359,126 +359,11 @@ public struct Proto_Response { /// Gets all information about an account including allowances granted by the account case accountDetails(Proto_GetAccountDetailsResponse) - #if !swift(>=4.1) - public static func ==(lhs: Proto_Response.OneOf_Response, rhs: Proto_Response.OneOf_Response) -> 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 (.getByKey, .getByKey): return { - guard case .getByKey(let l) = lhs, case .getByKey(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.getBySolidityID, .getBySolidityID): return { - guard case .getBySolidityID(let l) = lhs, case .getBySolidityID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractCallLocal, .contractCallLocal): return { - guard case .contractCallLocal(let l) = lhs, case .contractCallLocal(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetBytecodeResponse, .contractGetBytecodeResponse): return { - guard case .contractGetBytecodeResponse(let l) = lhs, case .contractGetBytecodeResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetInfo, .contractGetInfo): return { - guard case .contractGetInfo(let l) = lhs, case .contractGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractGetRecordsResponse, .contractGetRecordsResponse): return { - guard case .contractGetRecordsResponse(let l) = lhs, case .contractGetRecordsResponse(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptogetAccountBalance, .cryptogetAccountBalance): return { - guard case .cryptogetAccountBalance(let l) = lhs, case .cryptogetAccountBalance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetAccountRecords, .cryptoGetAccountRecords): return { - guard case .cryptoGetAccountRecords(let l) = lhs, case .cryptoGetAccountRecords(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetInfo, .cryptoGetInfo): return { - guard case .cryptoGetInfo(let l) = lhs, case .cryptoGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetLiveHash, .cryptoGetLiveHash): return { - guard case .cryptoGetLiveHash(let l) = lhs, case .cryptoGetLiveHash(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoGetProxyStakers, .cryptoGetProxyStakers): return { - guard case .cryptoGetProxyStakers(let l) = lhs, case .cryptoGetProxyStakers(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileGetContents, .fileGetContents): return { - guard case .fileGetContents(let l) = lhs, case .fileGetContents(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileGetInfo, .fileGetInfo): return { - guard case .fileGetInfo(let l) = lhs, case .fileGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetReceipt, .transactionGetReceipt): return { - guard case .transactionGetReceipt(let l) = lhs, case .transactionGetReceipt(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetRecord, .transactionGetRecord): return { - guard case .transactionGetRecord(let l) = lhs, case .transactionGetRecord(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.transactionGetFastRecord, .transactionGetFastRecord): return { - guard case .transactionGetFastRecord(let l) = lhs, case .transactionGetFastRecord(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusGetTopicInfo, .consensusGetTopicInfo): return { - guard case .consensusGetTopicInfo(let l) = lhs, case .consensusGetTopicInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.networkGetVersionInfo, .networkGetVersionInfo): return { - guard case .networkGetVersionInfo(let l) = lhs, case .networkGetVersionInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetInfo, .tokenGetInfo): return { - guard case .tokenGetInfo(let l) = lhs, case .tokenGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleGetInfo, .scheduleGetInfo): return { - guard case .scheduleGetInfo(let l) = lhs, case .scheduleGetInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetAccountNftInfos, .tokenGetAccountNftInfos): return { - guard case .tokenGetAccountNftInfos(let l) = lhs, case .tokenGetAccountNftInfos(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetNftInfo, .tokenGetNftInfo): return { - guard case .tokenGetNftInfo(let l) = lhs, case .tokenGetNftInfo(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGetNftInfos, .tokenGetNftInfos): return { - guard case .tokenGetNftInfos(let l) = lhs, case .tokenGetNftInfos(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.networkGetExecutionTime, .networkGetExecutionTime): return { - guard case .networkGetExecutionTime(let l) = lhs, case .networkGetExecutionTime(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.accountDetails, .accountDetails): return { - guard case .accountDetails(let l) = lhs, case .accountDetails(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Response: @unchecked Sendable {} -extension Proto_Response.OneOf_Response: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/response_code.pb.swift b/Sources/HederaProtobufs/Services/response_code.pb.swift index ba2d1ad6..f69bf8bf 100644 --- a/Sources/HederaProtobufs/Services/response_code.pb.swift +++ b/Sources/HederaProtobufs/Services/response_code.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// UNDOCUMENTED -public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { +public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum, Swift.CaseIterable { public typealias RawValue = Int ///* @@ -384,10 +384,14 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// [Deprecated]. attempt to set negative receive record threshold + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case invalidReceiveRecordThreshold // = 86 ///* /// [Deprecated]. attempt to set negative send record threshold + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case invalidSendRecordThreshold // = 87 ///* @@ -763,6 +767,8 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// The transaction payer could not afford a custom fee + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case insufficientPayerBalanceForCustomFee // = 231 ///* @@ -986,6 +992,8 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// [Deprecated] The proxy account id is invalid or does not exist. + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case invalidProxyAccountID // = 284 ///* @@ -1016,6 +1024,8 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// [Deprecated] The approveForAll flag cannot be set for a fungible token. + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case cannotApproveForAllFungibleCommon // = 291 ///* @@ -1038,10 +1048,14 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// [Deprecated] Spender is repeated more than once in Crypto or Token or NFT allowance lists in a single /// CryptoApproveAllowance transaction. + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case spenderAccountRepeatedInAllowances // = 296 ///* /// [Deprecated] Serial numbers are repeated in nft allowance for a single spender account + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case repeatedSerialNumsInNftAllowances // = 297 ///* @@ -1062,6 +1076,8 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// [Deprecated] If the CryptoDeleteAllowance transaction has repeated crypto or token or Nft allowances to delete. + /// + /// NOTE: This enum value was marked as deprecated in the .proto file case repeatedAllowancesToDelete // = 302 ///* @@ -1339,7 +1355,7 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { ///* /// The transaction attempted to use more than the allowed number of `PendingAirdropId`. - case maxPendingAirdropIDExceeded // = 363 + case pendingAirdropIDListTooLong // = 363 /// /// A pending airdrop already exists for the specified NFT. @@ -1351,6 +1367,33 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { /// Requester should cancel all pending airdrops before resending /// this transaction. case accountHasPendingAirdrops // = 365 + + ///* + /// Consensus throttle did not allow execution of this transaction.
+ /// The transaction should be retried after a modest delay. + case throttledAtConsensus // = 366 + + ///* + /// The provided pending airdrop id is invalid.
+ /// This pending airdrop MAY already be claimed or cancelled. + ///

+ /// The client SHOULD query a mirror node to determine the current status of + /// the pending airdrop. + case invalidPendingAirdropID // = 367 + + ///* + /// The token to be airdropped has a fallback royalty fee and cannot be + /// sent or claimed via an airdrop transaction. + case tokenAirdropWithFallbackRoyalty // = 368 + + ///* + /// This airdrop claim is for a pending airdrop with an invalid token.
+ /// The token might be deleted, or the sender may not have enough tokens + /// to fulfill the offer. + ///

+ /// The client SHOULD query mirror node to determine the status of the pending + /// airdrop and whether the sender can fulfill the offer. + case invalidTokenInPendingAirdrop // = 369 case UNRECOGNIZED(Int) public init() { @@ -1680,9 +1723,13 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case 360: self = .tokenHasNoMetadataOrSupplyKey case 361: self = .emptyPendingAirdropIDList case 362: self = .pendingAirdropIDRepeated - case 363: self = .maxPendingAirdropIDExceeded + case 363: self = .pendingAirdropIDListTooLong case 364: self = .pendingNftAirdropAlreadyExists case 365: self = .accountHasPendingAirdrops + case 366: self = .throttledAtConsensus + case 367: self = .invalidPendingAirdropID + case 368: self = .tokenAirdropWithFallbackRoyalty + case 369: self = .invalidTokenInPendingAirdrop default: self = .UNRECOGNIZED(rawValue) } } @@ -2010,18 +2057,17 @@ public enum Proto_ResponseCodeEnum: SwiftProtobuf.Enum { case .tokenHasNoMetadataOrSupplyKey: return 360 case .emptyPendingAirdropIDList: return 361 case .pendingAirdropIDRepeated: return 362 - case .maxPendingAirdropIDExceeded: return 363 + case .pendingAirdropIDListTooLong: return 363 case .pendingNftAirdropAlreadyExists: return 364 case .accountHasPendingAirdrops: return 365 + case .throttledAtConsensus: return 366 + case .invalidPendingAirdropID: return 367 + case .tokenAirdropWithFallbackRoyalty: return 368 + case .invalidTokenInPendingAirdrop: return 369 case .UNRECOGNIZED(let i): return i } } -} - -#if swift(>=4.2) - -extension Proto_ResponseCodeEnum: CaseIterable { // The compiler won't synthesize support with the UNRECOGNIZED case. public static let allCases: [Proto_ResponseCodeEnum] = [ .ok, @@ -2345,17 +2391,16 @@ extension Proto_ResponseCodeEnum: CaseIterable { .tokenHasNoMetadataOrSupplyKey, .emptyPendingAirdropIDList, .pendingAirdropIDRepeated, - .maxPendingAirdropIDExceeded, + .pendingAirdropIDListTooLong, .pendingNftAirdropAlreadyExists, .accountHasPendingAirdrops, + .throttledAtConsensus, + .invalidPendingAirdropID, + .tokenAirdropWithFallbackRoyalty, + .invalidTokenInPendingAirdrop, ] -} -#endif // swift(>=4.2) - -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ResponseCodeEnum: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +} // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -2682,8 +2727,12 @@ extension Proto_ResponseCodeEnum: SwiftProtobuf._ProtoNameProviding { 360: .same(proto: "TOKEN_HAS_NO_METADATA_OR_SUPPLY_KEY"), 361: .same(proto: "EMPTY_PENDING_AIRDROP_ID_LIST"), 362: .same(proto: "PENDING_AIRDROP_ID_REPEATED"), - 363: .same(proto: "MAX_PENDING_AIRDROP_ID_EXCEEDED"), + 363: .same(proto: "PENDING_AIRDROP_ID_LIST_TOO_LONG"), 364: .same(proto: "PENDING_NFT_AIRDROP_ALREADY_EXISTS"), 365: .same(proto: "ACCOUNT_HAS_PENDING_AIRDROPS"), + 366: .same(proto: "THROTTLED_AT_CONSENSUS"), + 367: .same(proto: "INVALID_PENDING_AIRDROP_ID"), + 368: .same(proto: "TOKEN_AIRDROP_WITH_FALLBACK_ROYALTY"), + 369: .same(proto: "INVALID_TOKEN_IN_PENDING_AIRDROP"), ] } diff --git a/Sources/HederaProtobufs/Services/response_header.pb.swift b/Sources/HederaProtobufs/Services/response_header.pb.swift index 17a0e88b..2c965e79 100644 --- a/Sources/HederaProtobufs/Services/response_header.pb.swift +++ b/Sources/HederaProtobufs/Services/response_header.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Every query receives a response containing the QueryResponseHeader. Either or both of the cost /// and stateProof fields may be blank, if the responseType didn't ask for the cost or stateProof. -public struct Proto_ResponseHeader { +public struct Proto_ResponseHeader: @unchecked Sendable { // 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. @@ -52,10 +52,6 @@ public struct Proto_ResponseHeader { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ResponseHeader: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift index 6c87c9bc..1857e23d 100644 --- a/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/schedulable_transaction_body.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// scheduling.whitelist controls which transaction types may be scheduled. As of Hedera /// Services 0.24.0 this list includes ConsensusSubmitMessage, CryptoTransfer, TokenMint, and TokenBurn /// functions. -public struct Proto_SchedulableTransactionBody { +public struct Proto_SchedulableTransactionBody: @unchecked Sendable { // 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. @@ -530,7 +530,7 @@ public struct Proto_SchedulableTransactionBody { ///* /// The choices here are arranged by service in roughly lexicographical order. The field ordinals are non-sequential, and a result of the historical order of implementation. - public enum OneOf_Data: Equatable { + public enum OneOf_Data: Equatable, Sendable { ///* /// Calls a function of a contract instance case contractCall(Proto_ContractCallTransactionBody) @@ -684,200 +684,6 @@ public struct Proto_SchedulableTransactionBody { /// Transaction body for a scheduled transaction to airdrop tokens. case tokenAirdrop(Proto_TokenAirdropTransactionBody) - #if !swift(>=4.1) - public static func ==(lhs: Proto_SchedulableTransactionBody.OneOf_Data, rhs: Proto_SchedulableTransactionBody.OneOf_Data) -> Bool { - // 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 (.contractCall, .contractCall): return { - guard case .contractCall(let l) = lhs, case .contractCall(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractCreateInstance, .contractCreateInstance): return { - guard case .contractCreateInstance(let l) = lhs, case .contractCreateInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractUpdateInstance, .contractUpdateInstance): return { - guard case .contractUpdateInstance(let l) = lhs, case .contractUpdateInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractDeleteInstance, .contractDeleteInstance): return { - guard case .contractDeleteInstance(let l) = lhs, case .contractDeleteInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoApproveAllowance, .cryptoApproveAllowance): return { - guard case .cryptoApproveAllowance(let l) = lhs, case .cryptoApproveAllowance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoDeleteAllowance, .cryptoDeleteAllowance): return { - guard case .cryptoDeleteAllowance(let l) = lhs, case .cryptoDeleteAllowance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoCreateAccount, .cryptoCreateAccount): return { - guard case .cryptoCreateAccount(let l) = lhs, case .cryptoCreateAccount(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoDelete, .cryptoDelete): return { - guard case .cryptoDelete(let l) = lhs, case .cryptoDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoTransfer, .cryptoTransfer): return { - guard case .cryptoTransfer(let l) = lhs, case .cryptoTransfer(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoUpdateAccount, .cryptoUpdateAccount): return { - guard case .cryptoUpdateAccount(let l) = lhs, case .cryptoUpdateAccount(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileAppend, .fileAppend): return { - guard case .fileAppend(let l) = lhs, case .fileAppend(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileCreate, .fileCreate): return { - guard case .fileCreate(let l) = lhs, case .fileCreate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileDelete, .fileDelete): return { - guard case .fileDelete(let l) = lhs, case .fileDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileUpdate, .fileUpdate): return { - guard case .fileUpdate(let l) = lhs, case .fileUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.systemDelete, .systemDelete): return { - guard case .systemDelete(let l) = lhs, case .systemDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.systemUndelete, .systemUndelete): return { - guard case .systemUndelete(let l) = lhs, case .systemUndelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.freeze, .freeze): return { - guard case .freeze(let l) = lhs, case .freeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusCreateTopic, .consensusCreateTopic): return { - guard case .consensusCreateTopic(let l) = lhs, case .consensusCreateTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusUpdateTopic, .consensusUpdateTopic): return { - guard case .consensusUpdateTopic(let l) = lhs, case .consensusUpdateTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusDeleteTopic, .consensusDeleteTopic): return { - guard case .consensusDeleteTopic(let l) = lhs, case .consensusDeleteTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusSubmitMessage, .consensusSubmitMessage): return { - guard case .consensusSubmitMessage(let l) = lhs, case .consensusSubmitMessage(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenCreation, .tokenCreation): return { - guard case .tokenCreation(let l) = lhs, case .tokenCreation(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenFreeze, .tokenFreeze): return { - guard case .tokenFreeze(let l) = lhs, case .tokenFreeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUnfreeze, .tokenUnfreeze): return { - guard case .tokenUnfreeze(let l) = lhs, case .tokenUnfreeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGrantKyc, .tokenGrantKyc): return { - guard case .tokenGrantKyc(let l) = lhs, case .tokenGrantKyc(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenRevokeKyc, .tokenRevokeKyc): return { - guard case .tokenRevokeKyc(let l) = lhs, case .tokenRevokeKyc(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenDeletion, .tokenDeletion): return { - guard case .tokenDeletion(let l) = lhs, case .tokenDeletion(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUpdate, .tokenUpdate): return { - guard case .tokenUpdate(let l) = lhs, case .tokenUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenMint, .tokenMint): return { - guard case .tokenMint(let l) = lhs, case .tokenMint(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenBurn, .tokenBurn): return { - guard case .tokenBurn(let l) = lhs, case .tokenBurn(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenWipe, .tokenWipe): return { - guard case .tokenWipe(let l) = lhs, case .tokenWipe(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenAssociate, .tokenAssociate): return { - guard case .tokenAssociate(let l) = lhs, case .tokenAssociate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenDissociate, .tokenDissociate): return { - guard case .tokenDissociate(let l) = lhs, case .tokenDissociate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenFeeScheduleUpdate, .tokenFeeScheduleUpdate): return { - guard case .tokenFeeScheduleUpdate(let l) = lhs, case .tokenFeeScheduleUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenPause, .tokenPause): return { - guard case .tokenPause(let l) = lhs, case .tokenPause(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUnpause, .tokenUnpause): return { - guard case .tokenUnpause(let l) = lhs, case .tokenUnpause(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleDelete, .scheduleDelete): return { - guard case .scheduleDelete(let l) = lhs, case .scheduleDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.utilPrng, .utilPrng): return { - 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 - }() - case (.nodeCreate, .nodeCreate): return { - guard case .nodeCreate(let l) = lhs, case .nodeCreate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeUpdate, .nodeUpdate): return { - guard case .nodeUpdate(let l) = lhs, case .nodeUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeDelete, .nodeDelete): return { - guard case .nodeDelete(let l) = lhs, case .nodeDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenReject, .tokenReject): return { - guard case .tokenReject(let l) = lhs, case .tokenReject(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenCancelAirdrop, .tokenCancelAirdrop): return { - guard case .tokenCancelAirdrop(let l) = lhs, case .tokenCancelAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenClaimAirdrop, .tokenClaimAirdrop): return { - guard case .tokenClaimAirdrop(let l) = lhs, case .tokenClaimAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenAirdrop, .tokenAirdrop): return { - guard case .tokenAirdrop(let l) = lhs, case .tokenAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -885,11 +691,6 @@ public struct Proto_SchedulableTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_SchedulableTransactionBody: @unchecked Sendable {} -extension Proto_SchedulableTransactionBody.OneOf_Data: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/schedule_create.pb.swift b/Sources/HederaProtobufs/Services/schedule_create.pb.swift index bfe9c7d1..008076a1 100644 --- a/Sources/HederaProtobufs/Services/schedule_create.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_create.pb.swift @@ -34,41 +34,41 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// or ScheduleSign. /// /// Upon `SUCCESS`, the receipt also includes the scheduledTransactionID to -/// use to query for the record of the scheduled transaction's execution (if it occurs). -/// +/// use to query for the record of the scheduled transaction's execution (if it occurs). +/// /// The expiration time of a schedule is controlled by it's expiration_time. It remains in state and can be queried /// using GetScheduleInfo until expiration, no matter if the scheduled transaction has /// executed or marked deleted. If Long Term Scheduled Transactions are disabled, the expiration_time is always /// 30 minutes in the future. -/// +/// /// If the adminKey field is omitted, the resulting schedule is immutable. If the /// adminKey is set, the ScheduleDelete transaction can be used to mark it as /// deleted. The creator may also specify an optional memo whose UTF-8 encoding is at most /// 100 bytes and does not include the zero byte is also supported. -/// +/// /// When a scheduledTransactionBody is executed, the /// network only charges its payer the service fee, and not the node and network fees. If the /// optional payerAccountID is set, the network charges this account. Otherwise it charges -/// the payer of the originating ScheduleCreate. -/// +/// the payer of the originating ScheduleCreate. +/// /// Two ScheduleCreate transactions are identical if they are equal in all their /// fields other than payerAccountID. (For the scheduledTransactionBody field, /// "equal" should be understood in the sense of /// gRPC object equality in the network software runtime. In particular, a gRPC object with unknown fields is -/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) -/// +/// not equal to a gRPC object without unknown fields, even if they agree on all known fields.) +/// /// A ScheduleCreate transaction that attempts to re-create an identical schedule already in /// state will receive a receipt with status IDENTICAL_SCHEDULE_ALREADY_CREATED; the receipt /// will include the ScheduleID of the extant schedule, which may be used in a subsequent /// ScheduleSign transaction. (The receipt will also include the TransactionID to /// use in querying for the receipt or record of the scheduled transaction.) -/// +/// /// Other notable response codes include, INVALID_ACCOUNT_ID, /// UNSCHEDULABLE_TRANSACTION, UNRESOLVABLE_REQUIRED_SIGNERS, /// INVALID_SIGNATURE. For more information please see the section of this documentation on -/// the ResponseCode enum. -public struct Proto_ScheduleCreateTransactionBody { +/// the ResponseCode enum. +public struct Proto_ScheduleCreateTransactionBody: Sendable { // 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. @@ -157,10 +157,6 @@ public struct Proto_ScheduleCreateTransactionBody { fileprivate var _expirationTime: Proto_Timestamp? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ScheduleCreateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift index 4e1cd626..108360b3 100644 --- a/Sources/HederaProtobufs/Services/schedule_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_delete.pb.swift @@ -28,8 +28,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Other notable response codes include, INVALID_SCHEDULE_ID, SCHEDULE_PENDING_EXPIRATION, /// SCHEDULE_ALREADY_DELETED, SCHEDULE_ALREADY_EXECUTED, SCHEDULE_IS_IMMUTABLE. /// For more information please see the section of this documentation on the ResponseCode -/// enum. -public struct Proto_ScheduleDeleteTransactionBody { +/// enum. +public struct Proto_ScheduleDeleteTransactionBody: Sendable { // 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. @@ -52,10 +52,6 @@ public struct Proto_ScheduleDeleteTransactionBody { fileprivate var _scheduleID: Proto_ScheduleID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ScheduleDeleteTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift index 040e7e08..1161aa17 100644 --- a/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_get_info.pb.swift @@ -22,9 +22,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Gets information about a schedule in the network's action queue. -/// +/// /// Responds with INVALID_SCHEDULE_ID if the requested schedule doesn't exist. -public struct Proto_ScheduleGetInfoQuery { +public struct Proto_ScheduleGetInfoQuery: Sendable { // 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. @@ -62,7 +62,7 @@ public struct Proto_ScheduleGetInfoQuery { ///* /// Information summarizing schedule state -public struct Proto_ScheduleInfo { +public struct Proto_ScheduleInfo: @unchecked Sendable { // 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. @@ -193,7 +193,7 @@ public struct Proto_ScheduleInfo { public mutating func clearScheduledTransactionID() {_uniqueStorage()._scheduledTransactionID = nil} ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} @@ -213,7 +213,7 @@ public struct Proto_ScheduleInfo { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Data: Equatable { + public enum OneOf_Data: Equatable, Sendable { ///* /// If the schedule has been deleted, the consensus time when this occurred case deletionTime(Proto_Timestamp) @@ -221,24 +221,6 @@ public struct Proto_ScheduleInfo { /// If the schedule has been executed, the consensus time when this occurred case executionTime(Proto_Timestamp) - #if !swift(>=4.1) - public static func ==(lhs: Proto_ScheduleInfo.OneOf_Data, rhs: Proto_ScheduleInfo.OneOf_Data) -> 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 (.deletionTime, .deletionTime): return { - guard case .deletionTime(let l) = lhs, case .deletionTime(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.executionTime, .executionTime): return { - guard case .executionTime(let l) = lhs, case .executionTime(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -248,7 +230,7 @@ public struct Proto_ScheduleInfo { ///* /// Response wrapper for the ScheduleInfo -public struct Proto_ScheduleGetInfoResponse { +public struct Proto_ScheduleGetInfoResponse: Sendable { // 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. @@ -284,13 +266,6 @@ public struct Proto_ScheduleGetInfoResponse { fileprivate var _scheduleInfo: Proto_ScheduleInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ScheduleGetInfoQuery: @unchecked Sendable {} -extension Proto_ScheduleInfo: @unchecked Sendable {} -extension Proto_ScheduleInfo.OneOf_Data: @unchecked Sendable {} -extension Proto_ScheduleGetInfoResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift index 58366ed5..49c761b9 100644 --- a/Sources/HederaProtobufs/Services/schedule_sign.pb.swift +++ b/Sources/HederaProtobufs/Services/schedule_sign.pb.swift @@ -29,16 +29,16 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Otherwise, if the resulting set of signing keys satisfy the /// scheduled transaction's signing requirements, it will be executed immediately after the /// triggering ScheduleSign. -/// +/// /// Upon SUCCESS, the receipt includes the scheduledTransactionID to use to query -/// for the record of the scheduled transaction's execution (if it occurs). -/// +/// for the record of the scheduled transaction's execution (if it occurs). +/// /// Other notable response codes include INVALID_SCHEDULE_ID, SCHEDULE_ALREADY_DELETED, /// SCHEDULE_PENDING_EXPIRATION, SCHEDULE_ALREADY_EXPIRED, /// INVALID_ACCOUNT_ID, UNRESOLVABLE_REQUIRED_SIGNERS, /// SOME_SIGNATURES_WERE_INVALID, and NO_NEW_VALID_SIGNATURES. For more information /// please see the section of this documentation on the ResponseCode enum. -public struct Proto_ScheduleSignTransactionBody { +public struct Proto_ScheduleSignTransactionBody: Sendable { // 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. @@ -61,10 +61,6 @@ public struct Proto_ScheduleSignTransactionBody { fileprivate var _scheduleID: Proto_ScheduleID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ScheduleSignTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift index 9b5453e3..6ca3f73c 100644 --- a/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift +++ b/Sources/HederaProtobufs/Services/smart_contract_service.grpc.swift @@ -12,7 +12,7 @@ import SwiftProtobuf ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. /// /// Usage: instantiate `Proto_SmartContractServiceClient`, then call methods of this protocol to make API calls. public protocol Proto_SmartContractServiceClientProtocol: GRPCClient { @@ -373,7 +373,7 @@ public struct Proto_SmartContractServiceNIOClient: Proto_SmartContractServiceCli } ///* -/// Transactions and queries for the file service. +/// Transactions and queries for the file service. @available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *) public protocol Proto_SmartContractServiceAsyncClientProtocol: GRPCClient { static var serviceDescriptor: GRPCServiceDescriptor { get } diff --git a/Sources/HederaProtobufs/Services/state_addressbook_node.pb.swift b/Sources/HederaProtobufs/Services/state_addressbook_node.pb.swift index c49e519e..2519ce79 100644 --- a/Sources/HederaProtobufs/Services/state_addressbook_node.pb.swift +++ b/Sources/HederaProtobufs/Services/state_addressbook_node.pb.swift @@ -30,7 +30,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// is only valid within a single realm and shard combination, so the identifier /// for a network node SHALL only be unique within a single realm and shard /// combination. -public struct Com_Hedera_Hapi_Node_State_Addressbook_Node { +public struct Com_Hedera_Hapi_Node_State_Addressbook_Node: @unchecked Sendable { // 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. @@ -158,10 +158,6 @@ public struct Com_Hedera_Hapi_Node_State_Addressbook_Node { fileprivate var _adminKey: Proto_Key? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Com_Hedera_Hapi_Node_State_Addressbook_Node: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "com.hedera.hapi.node.state.addressbook" diff --git a/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift b/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift index 42d5fa6c..1de2e183 100644 --- a/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift +++ b/Sources/HederaProtobufs/Services/state_blockrecords_block_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Information about ongoing, most recently completed, and last 256 blocks. -public struct Proto_BlockInfo { +public struct Proto_BlockInfo: @unchecked Sendable { // 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. @@ -89,10 +89,6 @@ public struct Proto_BlockInfo { 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" diff --git a/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift b/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift index 85691d67..a8c9dd15 100644 --- a/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift +++ b/Sources/HederaProtobufs/Services/state_blockrecords_running_hashes.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// 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 { +public struct Proto_RunningHashes: @unchecked Sendable { // 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. @@ -49,10 +49,6 @@ public struct Proto_RunningHashes { 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" diff --git a/Sources/HederaProtobufs/Services/state_blockstream_block_stream_info.pb.swift b/Sources/HederaProtobufs/Services/state_blockstream_block_stream_info.pb.swift new file mode 100644 index 00000000..2e414b20 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_blockstream_block_stream_info.pb.swift @@ -0,0 +1,154 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/blockstream/block_stream_info.proto +// +// For information on using the generated types, please see the documentation: +// https://github.com/apple/swift-protobuf/ + +///* +/// # Block Stream Info +/// Information stored in consensus state at the beginning of each block to +/// record the status of the immediately prior block. +/// +/// ### Keywords +/// The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", +/// "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this +/// document are to be interpreted as described in +/// [RFC2119](https://www.ietf.org/rfc/rfc2119) and clarified in +/// [RFC8174](https://www.ietf.org/rfc/rfc8174). + +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 message stored in state to maintain block stream parameters.
+/// Nodes use this information for three purposes. +/// 1. To maintain hash chain continuity at restart and reconnect boundaries. +/// 1. To store historical hashes for implementation of the EVM `BLOCKHASH` +/// and `PREVRANDAO` opcodes. +/// 1. To track the amount of consensus time that has passed between blocks. +/// +/// This value MUST be updated for every block.
+/// This value MUST be transmitted in the "state changes" section of +/// _each_ block, but MUST be updated at the beginning of the _next_ block.
+/// This value SHALL contain the block hash up to, and including, the +/// immediately prior completed block. +public struct Com_Hedera_Hapi_Node_State_Blockstream_BlockStreamInfo: @unchecked Sendable { + // 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 block number.
+ /// This is the current block number. + public var blockNumber: UInt64 = 0 + + ///* + /// A consensus time for the current block.
+ /// This is the _first_ consensus time in the current block, and + /// is used to determine if this block was the first across an + /// important boundary in consensus time, such as UTC midnight. + /// This may also be used to purge entities expiring between the last + /// block time and this time. + public var blockTime: Proto_Timestamp { + get {return _blockTime ?? Proto_Timestamp()} + set {_blockTime = newValue} + } + /// Returns true if `blockTime` has been explicitly set. + public var hasBlockTime: Bool {return self._blockTime != nil} + /// Clears the value of `blockTime`. Subsequent reads from it will return its default value. + public mutating func clearBlockTime() {self._blockTime = nil} + + ///* + /// A concatenation of hash values.
+ /// This combines several trailing output block item hashes and + /// is used as a seed value for a pseudo-random number generator.
+ /// This is also requiried to implement the EVM `PREVRANDAO` opcode. + public var trailingOutputHashes: Data = Data() + + ///* + /// A concatenation of hash values.
+ /// This field combines up to 256 trailing block hashes. + ///

+ /// If this message is for block number N, then the earliest available + /// hash SHALL be for block number N-256.
+ /// The latest available hash SHALL be for block N-1.
+ /// This is REQUIRED to implement the EVM `BLOCKHASH` opcode. + public var trailingBlockHashes: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _blockTime: Proto_Timestamp? = nil +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "com.hedera.hapi.node.state.blockstream" + +extension Com_Hedera_Hapi_Node_State_Blockstream_BlockStreamInfo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".BlockStreamInfo" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "block_number"), + 2: .standard(proto: "block_time"), + 3: .standard(proto: "trailing_output_hashes"), + 4: .standard(proto: "trailing_block_hashes"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt64Field(value: &self.blockNumber) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._blockTime) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.trailingOutputHashes) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self.trailingBlockHashes) }() + 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.blockNumber != 0 { + try visitor.visitSingularUInt64Field(value: self.blockNumber, fieldNumber: 1) + } + try { if let v = self._blockTime { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if !self.trailingOutputHashes.isEmpty { + try visitor.visitSingularBytesField(value: self.trailingOutputHashes, fieldNumber: 3) + } + if !self.trailingBlockHashes.isEmpty { + try visitor.visitSingularBytesField(value: self.trailingBlockHashes, fieldNumber: 4) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Com_Hedera_Hapi_Node_State_Blockstream_BlockStreamInfo, rhs: Com_Hedera_Hapi_Node_State_Blockstream_BlockStreamInfo) -> Bool { + if lhs.blockNumber != rhs.blockNumber {return false} + if lhs._blockTime != rhs._blockTime {return false} + if lhs.trailingOutputHashes != rhs.trailingOutputHashes {return false} + if lhs.trailingBlockHashes != rhs.trailingBlockHashes {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 index 5bc1df59..54903991 100644 --- a/Sources/HederaProtobufs/Services/state_common.pb.swift +++ b/Sources/HederaProtobufs/Services/state_common.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A single 64-bit number identifying a Hedera native entity. -public struct Proto_EntityNumber { +public struct Proto_EntityNumber: Sendable { // 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. @@ -36,7 +36,7 @@ public struct Proto_EntityNumber { ///* /// Pair of AccountID and TokenID to represent TokenRelation -public struct Proto_EntityIDPair { +public struct Proto_EntityIDPair: Sendable { // 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. @@ -67,11 +67,6 @@ public struct Proto_EntityIDPair { 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" diff --git a/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift b/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift index 8c8efc37..50a72bdd 100644 --- a/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift +++ b/Sources/HederaProtobufs/Services/state_congestion_congestion_level_starts.pb.swift @@ -20,7 +20,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_CongestionLevelStarts { +public struct Proto_CongestionLevelStarts: Sendable { // 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. @@ -38,10 +38,6 @@ public struct Proto_CongestionLevelStarts { 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" diff --git a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift index 15cf4092..4791e6c8 100644 --- a/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift +++ b/Sources/HederaProtobufs/Services/state_consensus_topic.pb.swift @@ -22,25 +22,25 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Representation of a Hedera Consensus Service topic in the network Merkle tree. -/// -/// As with all network entities, a topic has a unique entity number, which is usually given along +/// +/// As with all network entities, a topic has a unique entity number, which is usually given along /// with the network's shard and realm in the form of a shard.realm.number id. -/// +/// /// A topic consists of just two pieces of data: /// 1. The total number of messages sent to the topic; and, /// 2. The running hash of all those messages. /// It also has several metadata elements: /// 1. A consensus expiration time in seconds since the epoch. -/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that -/// has signed a transaction allowing the network to use its balance to automatically extend the topic's +/// 2. (Optional) The number of an auto-renew account, in the same shard and realm as the topic, that +/// has signed a transaction allowing the network to use its balance to automatically extend the topic's /// expiration time when it passes. -/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the +/// 3. The number of seconds the network should automatically extend the topic's expiration by, if the /// topic has a valid auto-renew account, and is not deleted upon expiration. /// 4. A boolean marking if the topic has been deleted. /// 5. A memo string whose UTF-8 encoding is at most 100 bytes. /// 6. (Optional) An admin key whose signature must be active for the topic's metadata to be updated. /// 7. (Optional) A submit key whose signature must be active for the topic to receive a message. -public struct Proto_Topic { +public struct Proto_Topic: @unchecked Sendable { // 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. @@ -71,7 +71,7 @@ public struct Proto_Topic { } ///* - /// The number of seconds for which the topic will be automatically renewed + /// The number of seconds for which the topic will be automatically renewed /// upon expiring (if it has a valid auto-renew account). public var autoRenewPeriod: Int64 { get {return _storage._autoRenewPeriod} @@ -101,7 +101,7 @@ public struct Proto_Topic { /// When a topic is created, its running hash is initialized to 48 bytes of binary zeros. /// For each submitted message, the topic's running hash is then updated to the output /// of a particular SHA-384 digest whose input data include the previous running hash. - /// + /// /// See the TransactionReceipt.proto documentation for an exact description of the /// data included in the SHA-384 digest used for the update. public var runningHash: Data { @@ -146,10 +146,6 @@ public struct Proto_Topic { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Topic: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift b/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift index 33e4f2b3..3e8132a0 100644 --- a/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift +++ b/Sources/HederaProtobufs/Services/state_contract_bytecode.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The bytecode for a contract id. -public struct Proto_Bytecode { +public struct Proto_Bytecode: @unchecked Sendable { // 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. @@ -36,10 +36,6 @@ public struct Proto_Bytecode { 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" diff --git a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift index c05916da..a9c483dd 100644 --- a/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift +++ b/Sources/HederaProtobufs/Services/state_contract_storage_slot.pb.swift @@ -22,9 +22,9 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The key of a storage slot. A slot is scoped to a specific contract number. -/// -/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. -public struct Proto_SlotKey { +/// +/// For each contract, its EVM storage is a mapping of 256-bit keys (or "words") to 256-bit values. +public struct Proto_SlotKey: @unchecked Sendable { // 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. @@ -53,11 +53,11 @@ public struct Proto_SlotKey { ///* /// The value of a contract storage slot. For the EVM, this is a single word. -/// +/// /// Because we iterate through all the storage slots for an expired contract /// when purging it from state, our slot values also include the words -/// of the previous and next keys in this contract's storage "list". -public struct Proto_SlotValue { +/// of the previous and next keys in this contract's storage "list". +public struct Proto_SlotValue: @unchecked Sendable { // 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. @@ -79,11 +79,6 @@ public struct Proto_SlotValue { 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" diff --git a/Sources/HederaProtobufs/Services/state_file_file.pb.swift b/Sources/HederaProtobufs/Services/state_file_file.pb.swift index f6c99df2..c512b753 100644 --- a/Sources/HederaProtobufs/Services/state_file_file.pb.swift +++ b/Sources/HederaProtobufs/Services/state_file_file.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// 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 { +public struct Proto_File: @unchecked Sendable { // 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. @@ -80,10 +80,6 @@ public struct Proto_File { 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" diff --git a/Sources/HederaProtobufs/Services/state_primitives.pb.swift b/Sources/HederaProtobufs/Services/state_primitives.pb.swift index cd474d2a..32cb09ba 100644 --- a/Sources/HederaProtobufs/Services/state_primitives.pb.swift +++ b/Sources/HederaProtobufs/Services/state_primitives.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A single 64-bit number with no particular meaning. -public struct Proto_ProtoLong { +public struct Proto_ProtoLong: Sendable { // 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. @@ -36,7 +36,7 @@ public struct Proto_ProtoLong { ///* /// A single 32-bit number with no particular meaning. -public struct Proto_ProtoInteger { +public struct Proto_ProtoInteger: Sendable { // 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. @@ -50,7 +50,7 @@ public struct Proto_ProtoInteger { ///* /// A single boolean with no particular meaning. -public struct Proto_ProtoBoolean { +public struct Proto_ProtoBoolean: Sendable { // 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. @@ -64,7 +64,7 @@ public struct Proto_ProtoBoolean { ///* /// A single string with no particular meaning. -public struct Proto_ProtoString { +public struct Proto_ProtoString: Sendable { // 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. @@ -78,7 +78,7 @@ public struct Proto_ProtoString { ///* /// A single byte array with no particular meaning. -public struct Proto_ProtoBytes { +public struct Proto_ProtoBytes: @unchecked Sendable { // 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. @@ -90,14 +90,6 @@ public struct Proto_ProtoBytes { 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" diff --git a/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift b/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift index 1e1a2848..dc6aa27c 100644 --- a/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift +++ b/Sources/HederaProtobufs/Services/state_recordcache_recordcache.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public struct Proto_TransactionRecordEntry: Sendable { // 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. @@ -66,9 +66,58 @@ public struct Proto_TransactionRecordEntry { fileprivate var _transactionRecord: Proto_TransactionRecord? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionRecordEntry: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) +///* +/// As a single transaction is handled a receipt is created. It is 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 +/// receipt for the transaction. The TransactionReceiptEntry is the object stored in state with this information. +public struct Proto_TransactionReceiptEntry: Sendable { + // 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: UInt64 = 0 + + ///* + /// The id of the submitted transaction. + public var transactionID: Proto_TransactionID { + get {return _transactionID ?? Proto_TransactionID()} + set {_transactionID = newValue} + } + /// Returns true if `transactionID` has been explicitly set. + public var hasTransactionID: Bool {return self._transactionID != nil} + /// Clears the value of `transactionID`. Subsequent reads from it will return its default value. + public mutating func clearTransactionID() {self._transactionID = nil} + + ///* + /// The resulting status of handling the transaction. + public var status: Proto_ResponseCodeEnum = .ok + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} + + fileprivate var _transactionID: Proto_TransactionID? = nil +} + +///* +/// As transactions are handled 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 +/// receipt for the transaction. The TransactionReceiptEntries is the object stored in state with this information. +/// This object contains a list of TransactionReceiptEntry objects. +public struct Proto_TransactionReceiptEntries: Sendable { + // 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 entries: [Proto_TransactionReceiptEntry] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} // MARK: - Code below here is support for the SwiftProtobuf runtime. @@ -121,3 +170,83 @@ extension Proto_TransactionRecordEntry: SwiftProtobuf.Message, SwiftProtobuf._Me return true } } + +extension Proto_TransactionReceiptEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TransactionReceiptEntry" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_id"), + 2: .standard(proto: "transaction_id"), + 3: .same(proto: "status"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt64Field(value: &self.nodeID) }() + case 2: try { try decoder.decodeSingularMessageField(value: &self._transactionID) }() + case 3: try { try decoder.decodeSingularEnumField(value: &self.status) }() + 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.visitSingularUInt64Field(value: self.nodeID, fieldNumber: 1) + } + try { if let v = self._transactionID { + try visitor.visitSingularMessageField(value: v, fieldNumber: 2) + } }() + if self.status != .ok { + try visitor.visitSingularEnumField(value: self.status, fieldNumber: 3) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TransactionReceiptEntry, rhs: Proto_TransactionReceiptEntry) -> Bool { + if lhs.nodeID != rhs.nodeID {return false} + if lhs._transactionID != rhs._transactionID {return false} + if lhs.status != rhs.status {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Proto_TransactionReceiptEntries: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".TransactionReceiptEntries" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .same(proto: "entries"), + ] + + 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.entries) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.entries.isEmpty { + try visitor.visitRepeatedMessageField(value: self.entries, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Proto_TransactionReceiptEntries, rhs: Proto_TransactionReceiptEntries) -> Bool { + if lhs.entries != rhs.entries {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_roster_roster.pb.swift b/Sources/HederaProtobufs/Services/state_roster_roster.pb.swift new file mode 100644 index 00000000..6a57f7e8 --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_roster_roster.pb.swift @@ -0,0 +1,201 @@ +// DO NOT EDIT. +// swift-format-ignore-file +// +// Generated by the Swift generator plugin for the protocol buffer compiler. +// Source: state/roster/roster.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 roster in the network state. +///

+/// The roster SHALL be a list of `RosterEntry` objects. +public struct Com_Hedera_Hapi_Node_State_Roster_Roster: Sendable { + // 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. + + ///* + /// List of roster entries, one per consensus node. + ///

+ /// This list SHALL contain roster entries in natural order of ascending node ids. + /// This list SHALL NOT be empty.
+ public var rosterEntries: [Com_Hedera_Hapi_Node_State_Roster_RosterEntry] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A single roster entry in the network state. +/// +/// Each roster entry SHALL encapsulate the elements required +/// to manage node participation in the Threshold Signature Scheme (TSS).
+/// All fields except tss_encryption_key are REQUIRED. +public struct Com_Hedera_Hapi_Node_State_Roster_RosterEntry: @unchecked Sendable { + // 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 consensus node identifier. + ///

+ /// Node identifiers SHALL be unique _within_ a ledger, + /// and MUST NOT be repeated _between_ shards and realms. + public var nodeID: UInt64 = 0 + + ///* + /// A consensus weight. + ///

+ /// Each node SHALL have a weight of zero or more in consensus calculations.
+ /// The sum of the weights of all nodes in the roster SHALL form the total weight of the system, + /// and each node's individual weight SHALL be proportional to that sum.
+ public var weight: UInt64 = 0 + + ///* + /// An RSA public certificate used for signing gossip events. + ///

+ /// This value SHALL be a certificate of a type permitted for gossip + /// signatures.
+ /// This value SHALL be the DER encoding of the certificate presented.
+ /// This field is REQUIRED and MUST NOT be empty. + public var gossipCaCertificate: Data = Data() + + ///* + /// An elliptic curve public encryption key.
+ /// This is currently an ALT_BN128 curve, but the elliptic curve + /// type may change in the future. For example, + /// if the Ethereum ecosystem creates precompiles for BLS12_381, + /// we may switch to that curve. + ///

+ /// This value SHALL be specified according to EIP-196 and EIP-197 standards, + /// See EIP-196 and + /// EIP-197
+ /// This field is _initially_ OPTIONAL (i.e. it can be unset _when created_) + /// but once set, it is REQUIRED thereafter. + public var tssEncryptionKey: Data = Data() + + ///* + /// A list of service endpoints for gossip. + ///

+ /// These endpoints SHALL represent the published endpoints to which other + /// consensus nodes may _gossip_ transactions.
+ /// If the network configuration value `gossipFqdnRestricted` is set, then + /// all endpoints in this list SHALL supply only IP address.
+ /// If the network configuration value `gossipFqdnRestricted` is _not_ set, + /// then endpoints in this list MAY supply either IP address or FQDN, but + /// SHALL NOT supply both values for the same endpoint.
+ /// This list SHALL NOT be empty.
+ public var gossipEndpoint: [Proto_ServiceEndpoint] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "com.hedera.hapi.node.state.roster" + +extension Com_Hedera_Hapi_Node_State_Roster_Roster: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".Roster" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "roster_entries"), + ] + + 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.rosterEntries) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.rosterEntries.isEmpty { + try visitor.visitRepeatedMessageField(value: self.rosterEntries, fieldNumber: 1) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Com_Hedera_Hapi_Node_State_Roster_Roster, rhs: Com_Hedera_Hapi_Node_State_Roster_Roster) -> Bool { + if lhs.rosterEntries != rhs.rosterEntries {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Com_Hedera_Hapi_Node_State_Roster_RosterEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".RosterEntry" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "node_id"), + 2: .same(proto: "weight"), + 3: .standard(proto: "gossip_ca_certificate"), + 4: .standard(proto: "tss_encryption_key"), + 5: .standard(proto: "gossip_endpoint"), + ] + + public mutating func decodeMessage(decoder: inout D) throws { + while let fieldNumber = try decoder.nextFieldNumber() { + // The use of inline closures is to circumvent an issue where the compiler + // allocates stack space for every case branch when no optimizations are + // enabled. https://github.com/apple/swift-protobuf/issues/1034 + switch fieldNumber { + case 1: try { try decoder.decodeSingularUInt64Field(value: &self.nodeID) }() + case 2: try { try decoder.decodeSingularUInt64Field(value: &self.weight) }() + case 3: try { try decoder.decodeSingularBytesField(value: &self.gossipCaCertificate) }() + case 4: try { try decoder.decodeSingularBytesField(value: &self.tssEncryptionKey) }() + case 5: try { try decoder.decodeRepeatedMessageField(value: &self.gossipEndpoint) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.nodeID != 0 { + try visitor.visitSingularUInt64Field(value: self.nodeID, fieldNumber: 1) + } + if self.weight != 0 { + try visitor.visitSingularUInt64Field(value: self.weight, fieldNumber: 2) + } + if !self.gossipCaCertificate.isEmpty { + try visitor.visitSingularBytesField(value: self.gossipCaCertificate, fieldNumber: 3) + } + if !self.tssEncryptionKey.isEmpty { + try visitor.visitSingularBytesField(value: self.tssEncryptionKey, fieldNumber: 4) + } + if !self.gossipEndpoint.isEmpty { + try visitor.visitRepeatedMessageField(value: self.gossipEndpoint, fieldNumber: 5) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Com_Hedera_Hapi_Node_State_Roster_RosterEntry, rhs: Com_Hedera_Hapi_Node_State_Roster_RosterEntry) -> Bool { + if lhs.nodeID != rhs.nodeID {return false} + if lhs.weight != rhs.weight {return false} + if lhs.gossipCaCertificate != rhs.gossipCaCertificate {return false} + if lhs.tssEncryptionKey != rhs.tssEncryptionKey {return false} + if lhs.gossipEndpoint != rhs.gossipEndpoint {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} diff --git a/Sources/HederaProtobufs/Services/state_roster_roster_state.pb.swift b/Sources/HederaProtobufs/Services/state_roster_roster_state.pb.swift new file mode 100644 index 00000000..a921d26b --- /dev/null +++ b/Sources/HederaProtobufs/Services/state_roster_roster_state.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/roster/roster_state.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 current state of platform rosters.
+/// This message stores a roster data for the platform in network state. +/// +/// The roster state SHALL encapsulate the incoming candidate roster's hash, +/// and a list of pairs of round number and active roster hash.
+/// This data SHALL be used to track round numbers and the rosters used in determining the consensus.
+public struct Com_Hedera_Hapi_Node_State_Roster_RosterState: @unchecked Sendable { + // 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 SHA-384 hash of a candidate roster. + ///

+ /// This is the hash of the roster that is currently being considered + /// for adoption.
+ /// A Node SHALL NOT, ever, have more than one candidate roster + /// at the same time. + public var candidateRosterHash: Data = Data() + + ///* + /// A list of round numbers and roster hashes.
+ /// The round number indicates the round in which the corresponding roster became active + ///

+ /// This list SHALL be ordered by round numbers in descending order. + public var roundRosterPairs: [Com_Hedera_Hapi_Node_State_Roster_RoundRosterPair] = [] + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +///* +/// A pair of round number and active roster hash. +///

+/// This message SHALL encapsulate the round number and the hash of the +/// active roster used for that round. +public struct Com_Hedera_Hapi_Node_State_Roster_RoundRosterPair: @unchecked Sendable { + // 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 round number. + ///

+ /// This value SHALL be the round number of the consensus round in which this roster became active. + public var roundNumber: UInt64 = 0 + + ///* + /// The SHA-384 hash of the active roster for the given round number. + ///

+ /// This value SHALL be the hash of the active roster used for the round. + public var activeRosterHash: Data = Data() + + public var unknownFields = SwiftProtobuf.UnknownStorage() + + public init() {} +} + +// MARK: - Code below here is support for the SwiftProtobuf runtime. + +fileprivate let _protobuf_package = "com.hedera.hapi.node.state.roster" + +extension Com_Hedera_Hapi_Node_State_Roster_RosterState: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".RosterState" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "candidate_roster_hash"), + 2: .standard(proto: "round_roster_pairs"), + ] + + 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.candidateRosterHash) }() + case 2: try { try decoder.decodeRepeatedMessageField(value: &self.roundRosterPairs) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if !self.candidateRosterHash.isEmpty { + try visitor.visitSingularBytesField(value: self.candidateRosterHash, fieldNumber: 1) + } + if !self.roundRosterPairs.isEmpty { + try visitor.visitRepeatedMessageField(value: self.roundRosterPairs, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Com_Hedera_Hapi_Node_State_Roster_RosterState, rhs: Com_Hedera_Hapi_Node_State_Roster_RosterState) -> Bool { + if lhs.candidateRosterHash != rhs.candidateRosterHash {return false} + if lhs.roundRosterPairs != rhs.roundRosterPairs {return false} + if lhs.unknownFields != rhs.unknownFields {return false} + return true + } +} + +extension Com_Hedera_Hapi_Node_State_Roster_RoundRosterPair: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { + public static let protoMessageName: String = _protobuf_package + ".RoundRosterPair" + public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ + 1: .standard(proto: "round_number"), + 2: .standard(proto: "active_roster_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.decodeSingularUInt64Field(value: &self.roundNumber) }() + case 2: try { try decoder.decodeSingularBytesField(value: &self.activeRosterHash) }() + default: break + } + } + } + + public func traverse(visitor: inout V) throws { + if self.roundNumber != 0 { + try visitor.visitSingularUInt64Field(value: self.roundNumber, fieldNumber: 1) + } + if !self.activeRosterHash.isEmpty { + try visitor.visitSingularBytesField(value: self.activeRosterHash, fieldNumber: 2) + } + try unknownFields.traverse(visitor: &visitor) + } + + public static func ==(lhs: Com_Hedera_Hapi_Node_State_Roster_RoundRosterPair, rhs: Com_Hedera_Hapi_Node_State_Roster_RoundRosterPair) -> Bool { + if lhs.roundNumber != rhs.roundNumber {return false} + if lhs.activeRosterHash != rhs.activeRosterHash {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 index 65d66f92..ea0193ad 100644 --- a/Sources/HederaProtobufs/Services/state_schedule_schedule.pb.swift +++ b/Sources/HederaProtobufs/Services/state_schedule_schedule.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// 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 { +public struct Proto_Schedule: @unchecked Sendable { // 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. @@ -199,7 +199,7 @@ public struct Proto_Schedule { /// 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 { +public struct Proto_ScheduleList: Sendable { // 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. @@ -213,11 +213,6 @@ public struct Proto_ScheduleList { 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" diff --git a/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift b/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift index 5f952ff9..89d62c5a 100644 --- a/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift +++ b/Sources/HederaProtobufs/Services/state_throttles_throttle_usage_snapshots.pb.swift @@ -20,7 +20,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_ThrottleUsageSnapshots { +public struct Proto_ThrottleUsageSnapshots: Sendable { // 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. @@ -47,7 +47,7 @@ public struct Proto_ThrottleUsageSnapshots { fileprivate var _gasThrottle: Proto_ThrottleUsageSnapshot? = nil } -public struct Proto_ThrottleUsageSnapshot { +public struct Proto_ThrottleUsageSnapshot: Sendable { // 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. @@ -74,11 +74,6 @@ public struct Proto_ThrottleUsageSnapshot { 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" diff --git a/Sources/HederaProtobufs/Services/state_token_account.pb.swift b/Sources/HederaProtobufs/Services/state_token_account.pb.swift index 7e8895a1..a3460acb 100644 --- a/Sources/HederaProtobufs/Services/state_token_account.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_account.pb.swift @@ -20,7 +20,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_Account { +public struct Proto_Account: @unchecked Sendable { // 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. @@ -332,11 +332,19 @@ public struct Proto_Account { /// Clears the value of `headPendingAirdropID`. Subsequent reads from it will return its default value. public mutating func clearHeadPendingAirdropID() {_uniqueStorage()._headPendingAirdropID = nil} + ///* + /// The number of pending airdrops owned by the account. This number is used to collect rent + /// for the account. + public var numberPendingAirdrops: UInt64 { + get {return _storage._numberPendingAirdrops} + set {_uniqueStorage()._numberPendingAirdrops = newValue} + } + public var unknownFields = SwiftProtobuf.UnknownStorage() ///* /// ID of the account or node to which this account is staking. - public enum OneOf_StakedID: Equatable { + public enum OneOf_StakedID: Equatable, Sendable { ///* /// 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. @@ -346,24 +354,6 @@ public struct Proto_Account { /// 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() {} @@ -375,7 +365,7 @@ public struct Proto_Account { /// 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 { +public struct Proto_AccountApprovalForAllAllowance: Sendable { // 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. @@ -410,7 +400,7 @@ public struct Proto_AccountApprovalForAllAllowance { /// 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 { +public struct Proto_AccountFungibleTokenAllowance: Sendable { // 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. @@ -446,7 +436,7 @@ public struct Proto_AccountFungibleTokenAllowance { ///* /// 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 { +public struct Proto_AccountCryptoAllowance: Sendable { // 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. @@ -469,14 +459,6 @@ public struct Proto_AccountCryptoAllowance { 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" @@ -518,6 +500,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa 32: .standard(proto: "expired_and_pending_removal"), 33: .standard(proto: "first_contract_storage_key"), 34: .standard(proto: "head_pending_airdrop_id"), + 35: .standard(proto: "number_pending_airdrops"), ] fileprivate class _StorageClass { @@ -554,6 +537,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa var _expiredAndPendingRemoval: Bool = false var _firstContractStorageKey: Data = Data() var _headPendingAirdropID: Proto_PendingAirdropId? = nil + var _numberPendingAirdrops: UInt64 = 0 #if swift(>=5.10) // This property is used as the initial default value for new instances of the type. @@ -601,6 +585,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa _expiredAndPendingRemoval = source._expiredAndPendingRemoval _firstContractStorageKey = source._firstContractStorageKey _headPendingAirdropID = source._headPendingAirdropID + _numberPendingAirdrops = source._numberPendingAirdrops } } @@ -672,6 +657,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa case 32: try { try decoder.decodeSingularBoolField(value: &_storage._expiredAndPendingRemoval) }() case 33: try { try decoder.decodeSingularBytesField(value: &_storage._firstContractStorageKey) }() case 34: try { try decoder.decodeSingularMessageField(value: &_storage._headPendingAirdropID) }() + case 35: try { try decoder.decodeSingularUInt64Field(value: &_storage._numberPendingAirdrops) }() default: break } } @@ -791,6 +777,9 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa try { if let v = _storage._headPendingAirdropID { try visitor.visitSingularMessageField(value: v, fieldNumber: 34) } }() + if _storage._numberPendingAirdrops != 0 { + try visitor.visitSingularUInt64Field(value: _storage._numberPendingAirdrops, fieldNumber: 35) + } } try unknownFields.traverse(visitor: &visitor) } @@ -833,6 +822,7 @@ extension Proto_Account: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementa if _storage._expiredAndPendingRemoval != rhs_storage._expiredAndPendingRemoval {return false} if _storage._firstContractStorageKey != rhs_storage._firstContractStorageKey {return false} if _storage._headPendingAirdropID != rhs_storage._headPendingAirdropID {return false} + if _storage._numberPendingAirdrops != rhs_storage._numberPendingAirdrops {return false} return true } if !storagesAreEqual {return false} diff --git a/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift b/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift index 00a9d1e9..4e47dde6 100644 --- a/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_account_pending_airdrop.pb.swift @@ -34,7 +34,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// ### Record Stream Effects /// This value is not currently published in the record stream. -public struct Proto_AccountPendingAirdrop { +public struct Proto_AccountPendingAirdrop: @unchecked Sendable { // 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. @@ -91,10 +91,6 @@ public struct Proto_AccountPendingAirdrop { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_AccountPendingAirdrop: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift b/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift index b67a0eb6..0b003dcb 100644 --- a/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_network_staking_rewards.pb.swift @@ -27,7 +27,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public struct Proto_NetworkStakingRewards: Sendable { // 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. @@ -57,10 +57,6 @@ public struct Proto_NetworkStakingRewards { 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" diff --git a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift index dfe86c91..aa4eb24a 100644 --- a/Sources/HederaProtobufs/Services/state_token_nft.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_nft.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Representation of a Hedera Token Service NFT in the network Merkle tree. -public struct Proto_Nft { +public struct Proto_Nft: @unchecked Sendable { // 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. @@ -83,7 +83,7 @@ public struct Proto_Nft { } ///* - /// If the owner of this NFT is not its token treasury, the id of the previous NFT + /// If the owner of this NFT is not its token treasury, the id of the previous NFT /// in the owner's "doubly-linked list" of owned NFTs (if any). public var ownerPreviousNftID: Proto_NftID { get {return _storage._ownerPreviousNftID ?? Proto_NftID()} @@ -95,7 +95,7 @@ public struct Proto_Nft { public mutating func clearOwnerPreviousNftID() {_uniqueStorage()._ownerPreviousNftID = nil} ///* - /// If the owner of this NFT is not its token treasury, the id of the next NFT in + /// If the owner of this NFT is not its token treasury, the id of the next NFT in /// the owner's "doubly-linked list" of owned NFTs (if any). public var ownerNextNftID: Proto_NftID { get {return _storage._ownerNextNftID ?? Proto_NftID()} @@ -113,10 +113,6 @@ public struct Proto_Nft { 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" diff --git a/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift b/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift index 09002012..b311c230 100644 --- a/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_staking_node_info.pb.swift @@ -24,7 +24,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// 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 { +public struct Proto_StakingNodeInfo: Sendable { // 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. @@ -98,10 +98,6 @@ public struct Proto_StakingNodeInfo { 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" diff --git a/Sources/HederaProtobufs/Services/state_token_token.pb.swift b/Sources/HederaProtobufs/Services/state_token_token.pb.swift index 8a0f6ee8..0f7d1e8d 100644 --- a/Sources/HederaProtobufs/Services/state_token_token.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_token.pb.swift @@ -20,7 +20,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_Token { +public struct Proto_Token: @unchecked Sendable { // 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. @@ -293,10 +293,6 @@ public struct Proto_Token { 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" diff --git a/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift b/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift index 87bd81d7..2ea87b87 100644 --- a/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift +++ b/Sources/HederaProtobufs/Services/state_token_token_relation.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// 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 { +public struct Proto_TokenRelation: Sendable { // 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. @@ -100,10 +100,6 @@ public struct Proto_TokenRelation { fileprivate var _nextToken: Proto_TokenID? = nil } -#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" diff --git a/Sources/HederaProtobufs/Services/system_delete.pb.swift b/Sources/HederaProtobufs/Services/system_delete.pb.swift index 51e72d28..d3ab733e 100644 --- a/Sources/HederaProtobufs/Services/system_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_delete.pb.swift @@ -26,8 +26,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// stored internally until the expiration time, at which time it is truly and permanently deleted. /// Until that time, it can be undeleted by the Hedera administrative multisignature. When a smart /// contract is deleted, the cryptocurrency account within it continues to exist, and is not affected -/// by the expiration time here. -public struct Proto_SystemDeleteTransactionBody { +/// by the expiration time here. +public struct Proto_SystemDeleteTransactionBody: Sendable { // 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. @@ -67,7 +67,7 @@ public struct Proto_SystemDeleteTransactionBody { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_ID: Equatable { + public enum OneOf_ID: Equatable, Sendable { ///* /// The file ID of the file to delete, in the format used in transactions case fileID(Proto_FileID) @@ -75,24 +75,6 @@ public struct Proto_SystemDeleteTransactionBody { /// The contract ID instance to delete, in the format used in transactions case contractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_SystemDeleteTransactionBody.OneOf_ID, rhs: Proto_SystemDeleteTransactionBody.OneOf_ID) -> 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 (.fileID, .fileID): return { - guard case .fileID(let l) = lhs, case .fileID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractID, .contractID): return { - guard case .contractID(let l) = lhs, case .contractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -100,11 +82,6 @@ public struct Proto_SystemDeleteTransactionBody { fileprivate var _expirationTime: Proto_TimestampSeconds? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_SystemDeleteTransactionBody: @unchecked Sendable {} -extension Proto_SystemDeleteTransactionBody.OneOf_ID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/system_undelete.pb.swift b/Sources/HederaProtobufs/Services/system_undelete.pb.swift index a2eccb79..6cc6973a 100644 --- a/Sources/HederaProtobufs/Services/system_undelete.pb.swift +++ b/Sources/HederaProtobufs/Services/system_undelete.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Undelete a file or smart contract that was deleted by SystemDelete; requires a Hedera -/// administrative multisignature. -public struct Proto_SystemUndeleteTransactionBody { +/// administrative multisignature. +public struct Proto_SystemUndeleteTransactionBody: Sendable { // 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. @@ -52,7 +52,7 @@ public struct Proto_SystemUndeleteTransactionBody { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_ID: Equatable { + public enum OneOf_ID: Equatable, Sendable { ///* /// The file ID to undelete, in the format used in transactions case fileID(Proto_FileID) @@ -60,34 +60,11 @@ public struct Proto_SystemUndeleteTransactionBody { /// The contract ID instance to undelete, in the format used in transactions case contractID(Proto_ContractID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_SystemUndeleteTransactionBody.OneOf_ID, rhs: Proto_SystemUndeleteTransactionBody.OneOf_ID) -> 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 (.fileID, .fileID): return { - guard case .fileID(let l) = lhs, case .fileID(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractID, .contractID): return { - guard case .contractID(let l) = lhs, case .contractID(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_SystemUndeleteTransactionBody: @unchecked Sendable {} -extension Proto_SystemUndeleteTransactionBody.OneOf_ID: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift index 7d38b3c4..7756d7fd 100644 --- a/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift +++ b/Sources/HederaProtobufs/Services/throttle_definitions.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A set of operations which should be collectively throttled at a given milli-ops-per-second limit. -public struct Proto_ThrottleGroup { +public struct Proto_ThrottleGroup: Sendable { // 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. @@ -45,7 +45,7 @@ public struct Proto_ThrottleGroup { ///* /// A list of throttle groups that should all compete for the same internal bucket. -public struct Proto_ThrottleBucket { +public struct Proto_ThrottleBucket: Sendable { // 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. @@ -73,10 +73,10 @@ public struct Proto_ThrottleBucket { /// A list of throttle buckets which, simultaneously enforced, define the system's throttling policy. ///

    ///
  1. When an operation appears in more than one throttling bucket, all its buckets must have room -/// or it will be throttled.
  2. +/// or it will be throttled. ///
  3. An operation assigned to no buckets is always throttled.
  4. -///
-public struct Proto_ThrottleDefinitions { +/// +public struct Proto_ThrottleDefinitions: Sendable { // 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. @@ -88,12 +88,6 @@ public struct Proto_ThrottleDefinitions { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_ThrottleGroup: @unchecked Sendable {} -extension Proto_ThrottleBucket: @unchecked Sendable {} -extension Proto_ThrottleDefinitions: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/timestamp.pb.swift b/Sources/HederaProtobufs/Services/timestamp.pb.swift index e75a2933..b5b09267 100644 --- a/Sources/HederaProtobufs/Services/timestamp.pb.swift +++ b/Sources/HederaProtobufs/Services/timestamp.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// An exact date and time. This is the same data structure as the protobuf Timestamp.proto (see the /// comments in https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto) -public struct Proto_Timestamp { +public struct Proto_Timestamp: Sendable { // 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. @@ -43,7 +43,7 @@ public struct Proto_Timestamp { ///* /// An exact date and time, with a resolution of one second (no nanoseconds). -public struct Proto_TimestampSeconds { +public struct Proto_TimestampSeconds: Sendable { // 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. @@ -57,11 +57,6 @@ public struct Proto_TimestampSeconds { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Timestamp: @unchecked Sendable {} -extension Proto_TimestampSeconds: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_airdrop.pb.swift index 92d0e1de..2a579577 100644 --- a/Sources/HederaProtobufs/Services/token_airdrop.pb.swift +++ b/Sources/HederaProtobufs/Services/token_airdrop.pb.swift @@ -78,7 +78,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// `automatic_association` field for the record. /// - Each pending transfer _created_ SHALL be added to the `pending_airdrops` field for the record. /// - Each pending transfer _updated_ SHALL be added to the `pending_airdrops` field for the record. -public struct Proto_TokenAirdropTransactionBody { +public struct Proto_TokenAirdropTransactionBody: Sendable { // 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. @@ -101,10 +101,6 @@ public struct Proto_TokenAirdropTransactionBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenAirdropTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_associate.pb.swift b/Sources/HederaProtobufs/Services/token_associate.pb.swift index 7613ff12..c8850c4b 100644 --- a/Sources/HederaProtobufs/Services/token_associate.pb.swift +++ b/Sources/HederaProtobufs/Services/token_associate.pb.swift @@ -33,7 +33,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// per account, the transaction will resolve to TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED. /// On success, associations between the provided account and tokens are made and the account is /// ready to interact with the tokens. -public struct Proto_TokenAssociateTransactionBody { +public struct Proto_TokenAssociateTransactionBody: Sendable { // 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. @@ -62,10 +62,6 @@ public struct Proto_TokenAssociateTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenAssociateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_burn.pb.swift b/Sources/HederaProtobufs/Services/token_burn.pb.swift index 93f136be..ca536029 100644 --- a/Sources/HederaProtobufs/Services/token_burn.pb.swift +++ b/Sources/HederaProtobufs/Services/token_burn.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Token A has 2 decimals. In order to burn 100 tokens, one must provide amount of 10000. In order /// to burn 100.55 tokens, one must provide amount of 10055. /// For non fungible tokens the transaction body accepts serialNumbers list of integers as a parameter. -/// +/// /// If the serialNumbers don't get filled for non-fungible token type, a INVALID_TOKEN_BURN_AMOUNT response /// code will be returned. /// If a zero amount is provided for a fungible token type, it will be treated as a regular transaction. @@ -38,7 +38,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// BATCH_SIZE_LIMIT_EXCEEDED response code will be returned. /// If the serialNumbers list contains a non-positive integer as a serial number, a INVALID_NFT_ID /// response code will be returned. -public struct Proto_TokenBurnTransactionBody { +public struct Proto_TokenBurnTransactionBody: Sendable { // 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. @@ -72,10 +72,6 @@ public struct Proto_TokenBurnTransactionBody { fileprivate var _token: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenBurnTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift index 928780ab..96c4ac03 100644 --- a/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift +++ b/Sources/HederaProtobufs/Services/token_cancel_airdrop.pb.swift @@ -38,7 +38,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// Each cancellation SHALL be represented in the transaction body and SHALL NOT be restated /// in the record file.
/// All cancellations MUST succeed for this transaction to succeed. -public struct Proto_TokenCancelAirdropTransactionBody { +public struct Proto_TokenCancelAirdropTransactionBody: Sendable { // 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. @@ -60,10 +60,6 @@ public struct Proto_TokenCancelAirdropTransactionBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenCancelAirdropTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift b/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift index d1cd47bb..387ac5ea 100644 --- a/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift +++ b/Sources/HederaProtobufs/Services/token_claim_airdrop.pb.swift @@ -45,7 +45,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// ### Record Stream Effects /// The completed transfers SHALL be present in the transfer list. -public struct Proto_TokenClaimAirdropTransactionBody { +public struct Proto_TokenClaimAirdropTransactionBody: Sendable { // 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. @@ -64,10 +64,6 @@ public struct Proto_TokenClaimAirdropTransactionBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenClaimAirdropTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_create.pb.swift b/Sources/HederaProtobufs/Services/token_create.pb.swift index 8ec305b6..4b1dfa32 100644 --- a/Sources/HederaProtobufs/Services/token_create.pb.swift +++ b/Sources/HederaProtobufs/Services/token_create.pb.swift @@ -25,48 +25,48 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// The specified Treasury Account is receiving the initial supply of tokens as-well as the tokens /// from the Token Mint operation once executed. The balance of the treasury account is decreased /// when the Token Burn operation is executed. -/// +/// /// The initialSupply is the initial supply of the smallest parts of a token (like a /// tinybar, not an hbar). These are the smallest units of the token which may be transferred. -/// +/// /// The supply can change over time. If the total supply at some moment is S parts of tokens, /// and the token is using D decimals, then S must be less than or equal to /// 263-1, which is 9,223,372,036,854,775,807. The number of whole tokens (not parts) will /// be S / 10D. -/// +/// /// If decimals is 8 or 11, then the number of whole tokens can be at most a few billions or /// millions, respectively. For example, it could match Bitcoin (21 million whole tokens with 8 /// decimals) or hbars (50 billion whole tokens with 8 decimals). It could even match Bitcoin with /// milli-satoshis (21 million whole tokens with 11 decimals). -/// +/// /// Note that a created token is immutable if the adminKey is omitted. No property of /// an immutable token can ever change, with the sole exception of its expiry. Anyone can pay to /// extend the expiry time of an immutable token. -/// +/// /// A token can be either FUNGIBLE_COMMON or NON_FUNGIBLE_UNIQUE, based on its /// TokenType. If it has been omitted, FUNGIBLE_COMMON type is used. -/// +/// /// A token can have either INFINITE or FINITE supply type, based on its /// TokenType. If it has been omitted, INFINITE type is used. -/// +/// /// If a FUNGIBLE TokenType is used, initialSupply should explicitly be set to a /// non-negative. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If a NON_FUNGIBLE_UNIQUE TokenType is used, initialSupply should explicitly be set /// to 0. If not, the transaction will resolve to INVALID_TOKEN_INITIAL_SUPPLY. -/// +/// /// If an INFINITE TokenSupplyType is used, maxSupply should explicitly be set to 0. If /// it is not 0, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. -/// +/// /// If a FINITE TokenSupplyType is used, maxSupply should be explicitly set to a /// non-negative value. If it is not, the transaction will resolve to INVALID_TOKEN_MAX_SUPPLY. -public struct Proto_TokenCreateTransactionBody { +public struct Proto_TokenCreateTransactionBody: @unchecked Sendable { // 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 publicly visible name of the token. The token name is specified as a Unicode string. + /// The publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} @@ -74,7 +74,7 @@ public struct Proto_TokenCreateTransactionBody { } ///* - /// The publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} @@ -303,10 +303,6 @@ public struct Proto_TokenCreateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenCreateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_delete.pb.swift b/Sources/HederaProtobufs/Services/token_delete.pb.swift index d38e9e02..add8d121 100644 --- a/Sources/HederaProtobufs/Services/token_delete.pb.swift +++ b/Sources/HederaProtobufs/Services/token_delete.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// admin key is not set, Transaction will result in TOKEN_IS_IMMUTABlE. /// Once deleted update, mint, burn, wipe, freeze, unfreeze, grant kyc, revoke /// kyc and token transfer transactions will resolve to TOKEN_WAS_DELETED. -public struct Proto_TokenDeleteTransactionBody { +public struct Proto_TokenDeleteTransactionBody: Sendable { // 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. @@ -50,10 +50,6 @@ public struct Proto_TokenDeleteTransactionBody { fileprivate var _token: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenDeleteTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_dissociate.pb.swift b/Sources/HederaProtobufs/Services/token_dissociate.pb.swift index b3a616f0..9621cd02 100644 --- a/Sources/HederaProtobufs/Services/token_dissociate.pb.swift +++ b/Sources/HederaProtobufs/Services/token_dissociate.pb.swift @@ -36,7 +36,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If a non fungible token has expired, the user can not disassociate if their token /// balance is not zero. The transaction will resolve to TRANSACTION_REQUIRED_ZERO_TOKEN_BALANCES. /// On success, associations between the provided account and tokens are removed. -public struct Proto_TokenDissociateTransactionBody { +public struct Proto_TokenDissociateTransactionBody: Sendable { // 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. @@ -63,10 +63,6 @@ public struct Proto_TokenDissociateTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenDissociateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift index 3ea00134..36104b06 100644 --- a/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_fee_schedule_update.pb.swift @@ -21,15 +21,15 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP } ///* -/// At consensus, updates a token type's fee schedule to the given list of custom fees. -/// +/// At consensus, updates a token type's fee schedule to the given list of custom fees. +/// /// If the target token type has no fee_schedule_key, resolves to TOKEN_HAS_NO_FEE_SCHEDULE_KEY. -/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will +/// Otherwise this transaction must be signed to the fee_schedule_key, or the transaction will /// resolve to INVALID_SIGNATURE. -/// -/// If the custom_fees list is empty, clears the fee schedule or resolves to +/// +/// If the custom_fees list is empty, clears the fee schedule or resolves to /// CUSTOM_SCHEDULE_ALREADY_HAS_NO_FEES if the fee schedule was already empty. -public struct Proto_TokenFeeScheduleUpdateTransactionBody { +public struct Proto_TokenFeeScheduleUpdateTransactionBody: Sendable { // 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. @@ -56,10 +56,6 @@ public struct Proto_TokenFeeScheduleUpdateTransactionBody { fileprivate var _tokenID: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenFeeScheduleUpdateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_freeze_account.pb.swift b/Sources/HederaProtobufs/Services/token_freeze_account.pb.swift index a05d9f23..af711bdd 100644 --- a/Sources/HederaProtobufs/Services/token_freeze_account.pb.swift +++ b/Sources/HederaProtobufs/Services/token_freeze_account.pb.swift @@ -31,7 +31,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If no Freeze Key is defined, the transaction will resolve to TOKEN_HAS_NO_FREEZE_KEY. /// Once executed the Account is marked as Frozen and will not be able to receive or send tokens /// unless unfrozen. The operation is idempotent. -public struct Proto_TokenFreezeAccountTransactionBody { +public struct Proto_TokenFreezeAccountTransactionBody: Sendable { // 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. @@ -67,10 +67,6 @@ public struct Proto_TokenFreezeAccountTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenFreezeAccountTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_get_account_nft_infos.pb.swift b/Sources/HederaProtobufs/Services/token_get_account_nft_infos.pb.swift index 1ec1e750..fe4e6be6 100644 --- a/Sources/HederaProtobufs/Services/token_get_account_nft_infos.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_account_nft_infos.pb.swift @@ -38,7 +38,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// INVALID_ACCOUNT_ID response code will be returned if the queried account does not exist /// /// ACCOUNT_DELETED response code will be returned if the queried account has been deleted -public struct Proto_TokenGetAccountNftInfosQuery { +public struct Proto_TokenGetAccountNftInfosQuery: Sendable { // 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. @@ -86,7 +86,7 @@ public struct Proto_TokenGetAccountNftInfosQuery { ///* /// UNDOCUMENTED -public struct Proto_TokenGetAccountNftInfosResponse { +public struct Proto_TokenGetAccountNftInfosResponse: Sendable { // 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. @@ -114,11 +114,6 @@ public struct Proto_TokenGetAccountNftInfosResponse { fileprivate var _header: Proto_ResponseHeader? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenGetAccountNftInfosQuery: @unchecked Sendable {} -extension Proto_TokenGetAccountNftInfosResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_get_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_info.pb.swift index 6eddd75b..1eb94f30 100644 --- a/Sources/HederaProtobufs/Services/token_get_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_info.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Gets information about Token instance -public struct Proto_TokenGetInfoQuery { +public struct Proto_TokenGetInfoQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_TokenGetInfoQuery { ///* /// The metadata about a Token instance -public struct Proto_TokenInfo { +public struct Proto_TokenInfo: @unchecked Sendable { // 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. @@ -305,7 +305,7 @@ public struct Proto_TokenInfo { } ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data { get {return _storage._ledgerID} set {_uniqueStorage()._ledgerID = newValue} @@ -339,7 +339,7 @@ public struct Proto_TokenInfo { ///* /// Response when the client sends the node TokenGetInfoQuery -public struct Proto_TokenGetInfoResponse { +public struct Proto_TokenGetInfoResponse: Sendable { // 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. @@ -375,12 +375,6 @@ public struct Proto_TokenGetInfoResponse { fileprivate var _tokenInfo: Proto_TokenInfo? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenGetInfoQuery: @unchecked Sendable {} -extension Proto_TokenInfo: @unchecked Sendable {} -extension Proto_TokenGetInfoResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift index 5162e836..85465966 100644 --- a/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_nft_info.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// 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 -public struct Proto_TokenGetNftInfoQuery { +public struct Proto_TokenGetNftInfoQuery: Sendable { // 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. @@ -61,7 +61,7 @@ public struct Proto_TokenGetNftInfoQuery { ///* /// UNDOCUMENTED -public struct Proto_TokenNftInfo { +public struct Proto_TokenNftInfo: @unchecked Sendable { // 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. @@ -104,7 +104,7 @@ public struct Proto_TokenNftInfo { public var metadata: Data = Data() ///* - /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. + /// The ledger ID the response was returned from; please see HIP-198 for the network-specific IDs. public var ledgerID: Data = Data() ///* @@ -130,7 +130,7 @@ public struct Proto_TokenNftInfo { ///* /// UNDOCUMENTED -public struct Proto_TokenGetNftInfoResponse { +public struct Proto_TokenGetNftInfoResponse: @unchecked Sendable { // 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. @@ -165,12 +165,6 @@ public struct Proto_TokenGetNftInfoResponse { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenGetNftInfoQuery: @unchecked Sendable {} -extension Proto_TokenNftInfo: @unchecked Sendable {} -extension Proto_TokenGetNftInfoResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_get_nft_infos.pb.swift b/Sources/HederaProtobufs/Services/token_get_nft_infos.pb.swift index e6bf1af8..458df4a3 100644 --- a/Sources/HederaProtobufs/Services/token_get_nft_infos.pb.swift +++ b/Sources/HederaProtobufs/Services/token_get_nft_infos.pb.swift @@ -36,7 +36,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// NOT_SUPPORTED response code will be returned if the queried token is of type FUNGIBLE_COMMON /// /// INVALID_TOKEN_ID response code will be returned if the queried token does not exist -public struct Proto_TokenGetNftInfosQuery { +public struct Proto_TokenGetNftInfosQuery: Sendable { // 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. @@ -82,7 +82,7 @@ public struct Proto_TokenGetNftInfosQuery { fileprivate var _tokenID: Proto_TokenID? = nil } -public struct Proto_TokenGetNftInfosResponse { +public struct Proto_TokenGetNftInfosResponse: Sendable { // 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. @@ -122,11 +122,6 @@ public struct Proto_TokenGetNftInfosResponse { fileprivate var _tokenID: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenGetNftInfosQuery: @unchecked Sendable {} -extension Proto_TokenGetNftInfosResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_grant_kyc.pb.swift b/Sources/HederaProtobufs/Services/token_grant_kyc.pb.swift index 31324a12..4bb4a266 100644 --- a/Sources/HederaProtobufs/Services/token_grant_kyc.pb.swift +++ b/Sources/HederaProtobufs/Services/token_grant_kyc.pb.swift @@ -30,7 +30,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// resolve to TOKEN_NOT_ASSOCIATED_TO_ACCOUNT. /// If no KYC Key is defined, the transaction will resolve to TOKEN_HAS_NO_KYC_KEY. /// Once executed the Account is marked as KYC Granted. -public struct Proto_TokenGrantKycTransactionBody { +public struct Proto_TokenGrantKycTransactionBody: Sendable { // 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. @@ -66,10 +66,6 @@ public struct Proto_TokenGrantKycTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenGrantKycTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_mint.pb.swift b/Sources/HederaProtobufs/Services/token_mint.pb.swift index 0a291b28..819084e6 100644 --- a/Sources/HederaProtobufs/Services/token_mint.pb.swift +++ b/Sources/HederaProtobufs/Services/token_mint.pb.swift @@ -37,7 +37,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If a zero amount is provided for a fungible token type, it will be treated as a regular transaction. /// If the metadata list count is greater than the batch size limit global dynamic property, a /// BATCH_SIZE_LIMIT_EXCEEDED response code will be returned. -public struct Proto_TokenMintTransactionBody { +public struct Proto_TokenMintTransactionBody: @unchecked Sendable { // 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. @@ -72,10 +72,6 @@ public struct Proto_TokenMintTransactionBody { fileprivate var _token: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenMintTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_pause.pb.swift b/Sources/HederaProtobufs/Services/token_pause.pb.swift index 1abc68c9..9c3a564f 100644 --- a/Sources/HederaProtobufs/Services/token_pause.pb.swift +++ b/Sources/HederaProtobufs/Services/token_pause.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If no Pause Key is defined, the transaction will resolve to TOKEN_HAS_NO_PAUSE_KEY. /// Once executed the Token is marked as paused and will be not able to be a part of any transaction. /// The operation is idempotent - becomes a no-op if the Token is already Paused. -public struct Proto_TokenPauseTransactionBody { +public struct Proto_TokenPauseTransactionBody: Sendable { // 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. @@ -51,10 +51,6 @@ public struct Proto_TokenPauseTransactionBody { fileprivate var _token: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenPauseTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_reject.pb.swift b/Sources/HederaProtobufs/Services/token_reject.pb.swift index 7ba0aa9e..cc3e99f9 100644 --- a/Sources/HederaProtobufs/Services/token_reject.pb.swift +++ b/Sources/HederaProtobufs/Services/token_reject.pb.swift @@ -42,7 +42,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// ### Transaction Record Effects /// - Each successful transfer from `payer` to `treasury` SHALL be recorded in `token_transfer_list` for the transaction record. -public struct Proto_TokenRejectTransactionBody { +public struct Proto_TokenRejectTransactionBody: Sendable { // 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. @@ -79,7 +79,7 @@ public struct Proto_TokenRejectTransactionBody { /// A union token identifier. /// /// Identify a fungible/common token type, or a single non-fungible/unique token serial. -public struct Proto_TokenReference { +public struct Proto_TokenReference: Sendable { // 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. @@ -108,7 +108,7 @@ public struct Proto_TokenReference { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_TokenIdentifier: Equatable { + public enum OneOf_TokenIdentifier: Equatable, Sendable { ///* /// A fungible/common token type. case fungibleToken(Proto_TokenID) @@ -116,35 +116,11 @@ public struct Proto_TokenReference { /// A single specific serialized non-fungible/unique token. case nft(Proto_NftID) - #if !swift(>=4.1) - public static func ==(lhs: Proto_TokenReference.OneOf_TokenIdentifier, rhs: Proto_TokenReference.OneOf_TokenIdentifier) -> 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 (.fungibleToken, .fungibleToken): return { - guard case .fungibleToken(let l) = lhs, case .fungibleToken(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nft, .nft): return { - guard case .nft(let l) = lhs, case .nft(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenRejectTransactionBody: @unchecked Sendable {} -extension Proto_TokenReference: @unchecked Sendable {} -extension Proto_TokenReference.OneOf_TokenIdentifier: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_revoke_kyc.pb.swift b/Sources/HederaProtobufs/Services/token_revoke_kyc.pb.swift index 82589ec1..7d1f44bb 100644 --- a/Sources/HederaProtobufs/Services/token_revoke_kyc.pb.swift +++ b/Sources/HederaProtobufs/Services/token_revoke_kyc.pb.swift @@ -30,7 +30,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// resolve to TOKEN_NOT_ASSOCIATED_TO_ACCOUNT. /// If no KYC Key is defined, the transaction will resolve to TOKEN_HAS_NO_KYC_KEY. /// Once executed the Account is marked as KYC Revoked -public struct Proto_TokenRevokeKycTransactionBody { +public struct Proto_TokenRevokeKycTransactionBody: Sendable { // 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. @@ -66,10 +66,6 @@ public struct Proto_TokenRevokeKycTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenRevokeKycTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_unfreeze_account.pb.swift b/Sources/HederaProtobufs/Services/token_unfreeze_account.pb.swift index 4e727fc4..dd95b592 100644 --- a/Sources/HederaProtobufs/Services/token_unfreeze_account.pb.swift +++ b/Sources/HederaProtobufs/Services/token_unfreeze_account.pb.swift @@ -32,7 +32,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If no Freeze Key is defined, the transaction will resolve to TOKEN_HAS_NO_FREEZE_KEY. /// Once executed the Account is marked as Unfrozen and will be able to receive or send tokens. The /// operation is idempotent. -public struct Proto_TokenUnfreezeAccountTransactionBody { +public struct Proto_TokenUnfreezeAccountTransactionBody: Sendable { // 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. @@ -68,10 +68,6 @@ public struct Proto_TokenUnfreezeAccountTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenUnfreezeAccountTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_unpause.pb.swift b/Sources/HederaProtobufs/Services/token_unpause.pb.swift index e5ec6e1a..6bfad916 100644 --- a/Sources/HederaProtobufs/Services/token_unpause.pb.swift +++ b/Sources/HederaProtobufs/Services/token_unpause.pb.swift @@ -27,7 +27,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If no Pause Key is defined, the transaction will resolve to TOKEN_HAS_NO_PAUSE_KEY. /// Once executed the Token is marked as Unpaused and can be used in Transactions. /// The operation is idempotent - becomes a no-op if the Token is already unpaused. -public struct Proto_TokenUnpauseTransactionBody { +public struct Proto_TokenUnpauseTransactionBody: Sendable { // 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. @@ -50,10 +50,6 @@ public struct Proto_TokenUnpauseTransactionBody { fileprivate var _token: Proto_TokenID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenUnpauseTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_update.pb.swift b/Sources/HederaProtobufs/Services/token_update.pb.swift index 41bbd503..13b922a0 100644 --- a/Sources/HederaProtobufs/Services/token_update.pb.swift +++ b/Sources/HederaProtobufs/Services/token_update.pb.swift @@ -22,11 +22,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// At consensus, updates an already created token to the given values. -/// +/// /// If no value is given for a field, that field is left unchanged. For an immutable tokens (that is, /// a token without an admin key), only the expiry may be updated. Setting any other field in that /// case will cause the transaction status to resolve to TOKEN_IS_IMMUTABLE. -/// +/// /// --- Signing Requirements --- /// 1. Whether or not a token has an admin key, its expiry can be extended with only the transaction /// payer's signature. @@ -36,11 +36,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// token to become immutable. (Other Key structures without a constituent /// Ed25519 key will be rejected with INVALID_ADMIN_KEY.) /// 4. If a new treasury is set, the new treasury account's key must sign the transaction. -/// +/// /// --- Nft Requirements --- /// 1. If a non fungible token has a positive treasury balance, the operation will abort with /// CURRENT_TREASURY_STILL_OWNS_NFTS. -public struct Proto_TokenUpdateTransactionBody { +public struct Proto_TokenUpdateTransactionBody: @unchecked Sendable { // 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. @@ -57,7 +57,7 @@ public struct Proto_TokenUpdateTransactionBody { public mutating func clearToken() {_uniqueStorage()._token = nil} ///* - /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. + /// The new publicly visible token symbol. The token symbol is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var symbol: String { get {return _storage._symbol} @@ -65,7 +65,7 @@ public struct Proto_TokenUpdateTransactionBody { } ///* - /// The new publicly visible name of the token. The token name is specified as a Unicode string. + /// The new publicly visible name of the token. The token name is specified as a Unicode string. /// Its UTF-8 encoding cannot exceed 100 bytes, and cannot contain the 0 byte (NUL). public var name: String { get {return _storage._name} @@ -256,10 +256,6 @@ public struct Proto_TokenUpdateTransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenUpdateTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift b/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift index f8b39bb9..d9b074ab 100644 --- a/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift +++ b/Sources/HederaProtobufs/Services/token_update_nfts.pb.swift @@ -31,7 +31,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// /// --- Signing Requirements --- /// 1. To update metadata of an NFT, the metadata_key of the token should sign the transaction. -public struct Proto_TokenUpdateNftsTransactionBody { +public struct Proto_TokenUpdateNftsTransactionBody: Sendable { // 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. @@ -70,10 +70,6 @@ public struct Proto_TokenUpdateNftsTransactionBody { 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" diff --git a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift index c030639c..9a2b271a 100644 --- a/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift +++ b/Sources/HederaProtobufs/Services/token_wipe_account.pb.swift @@ -34,7 +34,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// CANNOT_WIPE_TOKEN_TREASURY_ACCOUNT /// On success, tokens are removed from the account and the total supply of the token is decreased by /// the wiped amount. -/// +/// /// If both amount and serialNumbers get filled, a INVALID_TRANSACTION_BODY response code will be /// returned. /// If the serialNumbers don't get filled for a non-fungible token type, a INVALID_WIPING_AMOUNT response @@ -44,11 +44,11 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// response code will be returned. /// If the serialNumbers' list count is greater than the batch size limit global dynamic property, a /// BATCH_SIZE_LIMIT_EXCEEDED response code will be returned. -/// +/// /// The amount provided is in the lowest denomination possible. Example: /// Token A has 2 decimals. In order to wipe 100 tokens from account, one must provide amount of /// 10000. In order to wipe 100.55 tokens, one must provide amount of 10055. -public struct Proto_TokenWipeAccountTransactionBody { +public struct Proto_TokenWipeAccountTransactionBody: Sendable { // 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. @@ -94,10 +94,6 @@ public struct Proto_TokenWipeAccountTransactionBody { fileprivate var _account: Proto_AccountID? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TokenWipeAccountTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction.pb.swift b/Sources/HederaProtobufs/Services/transaction.pb.swift index 9eac5db6..052bd396 100644 --- a/Sources/HederaProtobufs/Services/transaction.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction.pb.swift @@ -26,15 +26,17 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// appear in the transaction. For example, a CryptoTransfer will first have a Signature /// corresponding to the Key for the paying account, followed by a Signature corresponding to the Key /// for each account that is sending or receiving cryptocurrency in the transfer. Each Transaction -/// should not have more than 50 levels. +/// should not have more than 50 levels. /// The SignatureList field is deprecated and succeeded by SignatureMap. -public struct Proto_Transaction { +public struct Proto_Transaction: @unchecked Sendable { // 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 body of the transaction, which needs to be signed + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var body: Proto_TransactionBody { get {return _body ?? Proto_TransactionBody()} set {_body = newValue} @@ -47,6 +49,8 @@ public struct Proto_Transaction { ///* /// The signatures on the body, to authorize the transaction; deprecated and to be succeeded by /// SignatureMap field + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var sigs: Proto_SignatureList { get {return _sigs ?? Proto_SignatureList()} set {_sigs = newValue} @@ -58,6 +62,8 @@ public struct Proto_Transaction { ///* /// The signatures on the body with the new format, to authorize the transaction + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var sigMap: Proto_SignatureMap { get {return _sigMap ?? Proto_SignatureMap()} set {_sigMap = newValue} @@ -69,6 +75,8 @@ public struct Proto_Transaction { ///* /// TransactionBody serialized into bytes, which needs to be signed + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var bodyBytes: Data = Data() ///* @@ -84,10 +92,6 @@ public struct Proto_Transaction { fileprivate var _sigMap: Proto_SignatureMap? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_Transaction: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_body.pb.swift b/Sources/HederaProtobufs/Services/transaction_body.pb.swift index a16e53b5..3df34c3f 100644 --- a/Sources/HederaProtobufs/Services/transaction_body.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_body.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// A single transaction. All transaction types are possible here. -public struct Proto_TransactionBody { +public struct Proto_TransactionBody: @unchecked Sendable { // 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. @@ -73,6 +73,8 @@ public struct Proto_TransactionBody { ///* /// Should a record of this transaction be generated? (A receipt is always generated, but the /// record is optional) + /// + /// NOTE: This field was marked as deprecated in the .proto file. public var generateRecord: Bool { get {return _storage._generateRecord} set {_uniqueStorage()._generateRecord = newValue} @@ -649,7 +651,7 @@ public struct Proto_TransactionBody { ///* /// The choices here are arranged by service in roughly lexicographical order. The field ordinals are non-sequential, and a result of the historical order of implementation. - public enum OneOf_Data: Equatable { + public enum OneOf_Data: Equatable, Sendable { ///* /// Calls a function of a contract instance case contractCall(Proto_ContractCallTransactionBody) @@ -833,228 +835,6 @@ public struct Proto_TransactionBody { /// A transaction body for a `claimAirdrop` request. case tokenClaimAirdrop(Proto_TokenClaimAirdropTransactionBody) - #if !swift(>=4.1) - public static func ==(lhs: Proto_TransactionBody.OneOf_Data, rhs: Proto_TransactionBody.OneOf_Data) -> Bool { - // 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 (.contractCall, .contractCall): return { - guard case .contractCall(let l) = lhs, case .contractCall(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractCreateInstance, .contractCreateInstance): return { - guard case .contractCreateInstance(let l) = lhs, case .contractCreateInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractUpdateInstance, .contractUpdateInstance): return { - guard case .contractUpdateInstance(let l) = lhs, case .contractUpdateInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoAddLiveHash, .cryptoAddLiveHash): return { - guard case .cryptoAddLiveHash(let l) = lhs, case .cryptoAddLiveHash(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoCreateAccount, .cryptoCreateAccount): return { - guard case .cryptoCreateAccount(let l) = lhs, case .cryptoCreateAccount(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoDelete, .cryptoDelete): return { - guard case .cryptoDelete(let l) = lhs, case .cryptoDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoDeleteLiveHash, .cryptoDeleteLiveHash): return { - guard case .cryptoDeleteLiveHash(let l) = lhs, case .cryptoDeleteLiveHash(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoTransfer, .cryptoTransfer): return { - guard case .cryptoTransfer(let l) = lhs, case .cryptoTransfer(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoUpdateAccount, .cryptoUpdateAccount): return { - guard case .cryptoUpdateAccount(let l) = lhs, case .cryptoUpdateAccount(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileAppend, .fileAppend): return { - guard case .fileAppend(let l) = lhs, case .fileAppend(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileCreate, .fileCreate): return { - guard case .fileCreate(let l) = lhs, case .fileCreate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileDelete, .fileDelete): return { - guard case .fileDelete(let l) = lhs, case .fileDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.fileUpdate, .fileUpdate): return { - guard case .fileUpdate(let l) = lhs, case .fileUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.systemDelete, .systemDelete): return { - guard case .systemDelete(let l) = lhs, case .systemDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.systemUndelete, .systemUndelete): return { - guard case .systemUndelete(let l) = lhs, case .systemUndelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractDeleteInstance, .contractDeleteInstance): return { - guard case .contractDeleteInstance(let l) = lhs, case .contractDeleteInstance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.freeze, .freeze): return { - guard case .freeze(let l) = lhs, case .freeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusCreateTopic, .consensusCreateTopic): return { - guard case .consensusCreateTopic(let l) = lhs, case .consensusCreateTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusUpdateTopic, .consensusUpdateTopic): return { - guard case .consensusUpdateTopic(let l) = lhs, case .consensusUpdateTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusDeleteTopic, .consensusDeleteTopic): return { - guard case .consensusDeleteTopic(let l) = lhs, case .consensusDeleteTopic(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.consensusSubmitMessage, .consensusSubmitMessage): return { - guard case .consensusSubmitMessage(let l) = lhs, case .consensusSubmitMessage(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.uncheckedSubmit, .uncheckedSubmit): return { - guard case .uncheckedSubmit(let l) = lhs, case .uncheckedSubmit(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenCreation, .tokenCreation): return { - guard case .tokenCreation(let l) = lhs, case .tokenCreation(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenFreeze, .tokenFreeze): return { - guard case .tokenFreeze(let l) = lhs, case .tokenFreeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUnfreeze, .tokenUnfreeze): return { - guard case .tokenUnfreeze(let l) = lhs, case .tokenUnfreeze(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenGrantKyc, .tokenGrantKyc): return { - guard case .tokenGrantKyc(let l) = lhs, case .tokenGrantKyc(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenRevokeKyc, .tokenRevokeKyc): return { - guard case .tokenRevokeKyc(let l) = lhs, case .tokenRevokeKyc(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenDeletion, .tokenDeletion): return { - guard case .tokenDeletion(let l) = lhs, case .tokenDeletion(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUpdate, .tokenUpdate): return { - guard case .tokenUpdate(let l) = lhs, case .tokenUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenMint, .tokenMint): return { - guard case .tokenMint(let l) = lhs, case .tokenMint(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenBurn, .tokenBurn): return { - guard case .tokenBurn(let l) = lhs, case .tokenBurn(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenWipe, .tokenWipe): return { - guard case .tokenWipe(let l) = lhs, case .tokenWipe(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenAssociate, .tokenAssociate): return { - guard case .tokenAssociate(let l) = lhs, case .tokenAssociate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenDissociate, .tokenDissociate): return { - guard case .tokenDissociate(let l) = lhs, case .tokenDissociate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleCreate, .scheduleCreate): return { - guard case .scheduleCreate(let l) = lhs, case .scheduleCreate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleDelete, .scheduleDelete): return { - guard case .scheduleDelete(let l) = lhs, case .scheduleDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.scheduleSign, .scheduleSign): return { - guard case .scheduleSign(let l) = lhs, case .scheduleSign(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenFeeScheduleUpdate, .tokenFeeScheduleUpdate): return { - guard case .tokenFeeScheduleUpdate(let l) = lhs, case .tokenFeeScheduleUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenPause, .tokenPause): return { - guard case .tokenPause(let l) = lhs, case .tokenPause(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenUnpause, .tokenUnpause): return { - guard case .tokenUnpause(let l) = lhs, case .tokenUnpause(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoApproveAllowance, .cryptoApproveAllowance): return { - guard case .cryptoApproveAllowance(let l) = lhs, case .cryptoApproveAllowance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.cryptoDeleteAllowance, .cryptoDeleteAllowance): return { - guard case .cryptoDeleteAllowance(let l) = lhs, case .cryptoDeleteAllowance(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.ethereumTransaction, .ethereumTransaction): return { - guard case .ethereumTransaction(let l) = lhs, case .ethereumTransaction(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeStakeUpdate, .nodeStakeUpdate): return { - guard case .nodeStakeUpdate(let l) = lhs, case .nodeStakeUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.utilPrng, .utilPrng): return { - 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 - }() - case (.nodeCreate, .nodeCreate): return { - guard case .nodeCreate(let l) = lhs, case .nodeCreate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeUpdate, .nodeUpdate): return { - guard case .nodeUpdate(let l) = lhs, case .nodeUpdate(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.nodeDelete, .nodeDelete): return { - guard case .nodeDelete(let l) = lhs, case .nodeDelete(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenReject, .tokenReject): return { - guard case .tokenReject(let l) = lhs, case .tokenReject(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenAirdrop, .tokenAirdrop): return { - guard case .tokenAirdrop(let l) = lhs, case .tokenAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenCancelAirdrop, .tokenCancelAirdrop): return { - guard case .tokenCancelAirdrop(let l) = lhs, case .tokenCancelAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.tokenClaimAirdrop, .tokenClaimAirdrop): return { - guard case .tokenClaimAirdrop(let l) = lhs, case .tokenClaimAirdrop(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -1062,11 +842,6 @@ public struct Proto_TransactionBody { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionBody: @unchecked Sendable {} -extension Proto_TransactionBody.OneOf_Data: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_contents.pb.swift b/Sources/HederaProtobufs/Services/transaction_contents.pb.swift index 3570fae4..7227f00b 100644 --- a/Sources/HederaProtobufs/Services/transaction_contents.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_contents.pb.swift @@ -20,7 +20,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP typealias Version = _2 } -public struct Proto_SignedTransaction { +public struct Proto_SignedTransaction: @unchecked Sendable { // 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. @@ -47,10 +47,6 @@ public struct Proto_SignedTransaction { fileprivate var _sigMap: Proto_SignatureMap? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_SignedTransaction: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_get_fast_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_fast_record.pb.swift index 23398749..e71b5989 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_fast_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_fast_record.pb.swift @@ -25,7 +25,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// consensus, then information about whether it succeeded or failed will be available until the end /// of the receipt period. Before and after the receipt period, and for a transaction that was never /// submitted, the receipt is unknown. This query is free (the payment field is left empty). -public struct Proto_TransactionGetFastRecordQuery { +public struct Proto_TransactionGetFastRecordQuery: Sendable { // 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. @@ -67,7 +67,7 @@ public struct Proto_TransactionGetFastRecordQuery { /// with the ID of the new entity. Sometimes a single transaction will create more than one new /// entity, such as when a new contract instance is created, and this also creates the new account /// that it owned by that instance. -public struct Proto_TransactionGetFastRecordResponse { +public struct Proto_TransactionGetFastRecordResponse: Sendable { // 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. @@ -103,11 +103,6 @@ public struct Proto_TransactionGetFastRecordResponse { fileprivate var _transactionRecord: Proto_TransactionRecord? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionGetFastRecordQuery: @unchecked Sendable {} -extension Proto_TransactionGetFastRecordResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift index 38339db5..84a23860 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_receipt.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// receipt period. Before and after the receipt period, and for a transaction that was never /// submitted, the receipt is unknown. This query is free (the payment field is left empty). No /// State proof is available for this response -public struct Proto_TransactionGetReceiptQuery { +public struct Proto_TransactionGetReceiptQuery: Sendable { // 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. @@ -63,8 +63,8 @@ public struct Proto_TransactionGetReceiptQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the receipts of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the receipts of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildReceipts: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -81,7 +81,7 @@ public struct Proto_TransactionGetReceiptQuery { /// with the ID of the new entity. Sometimes a single transaction will create more than one new /// entity, such as when a new contract instance is created, and this also creates the new account /// that it owned by that instance. No State proof is available for this response -public struct Proto_TransactionGetReceiptResponse { +public struct Proto_TransactionGetReceiptResponse: Sendable { // 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. @@ -117,7 +117,7 @@ public struct Proto_TransactionGetReceiptResponse { public var duplicateTransactionReceipts: [Proto_TransactionReceipt] = [] ///* - /// The receipts (if any) of all child transactions spawned by the transaction with the + /// The receipts (if any) of all child transactions spawned by the transaction with the /// given top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionReceipts: [Proto_TransactionReceipt] = [] @@ -129,11 +129,6 @@ public struct Proto_TransactionGetReceiptResponse { fileprivate var _receipt: Proto_TransactionReceipt? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionGetReceiptQuery: @unchecked Sendable {} -extension Proto_TransactionGetReceiptResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift index d0d3a46f..941ec73a 100644 --- a/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_get_record.pb.swift @@ -28,7 +28,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// If the transaction was a cryptocurrency transfer, then the record includes the TransferList which /// gives the details of that transfer. If the transaction didn't return anything that should be in /// the record, then the results field will be set to nothing. -public struct Proto_TransactionGetRecordQuery { +public struct Proto_TransactionGetRecordQuery: Sendable { // 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. @@ -65,8 +65,8 @@ public struct Proto_TransactionGetRecordQuery { public var includeDuplicates: Bool = false ///* - /// Whether the response should include the records of any child transactions spawned by the - /// top-level transaction with the given transactionID. + /// Whether the response should include the records of any child transactions spawned by the + /// top-level transaction with the given transactionID. public var includeChildRecords: Bool = false public var unknownFields = SwiftProtobuf.UnknownStorage() @@ -79,7 +79,7 @@ public struct Proto_TransactionGetRecordQuery { ///* /// Response when the client sends the node TransactionGetRecordQuery -public struct Proto_TransactionGetRecordResponse { +public struct Proto_TransactionGetRecordResponse: Sendable { // 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. @@ -116,7 +116,7 @@ public struct Proto_TransactionGetRecordResponse { public var duplicateTransactionRecords: [Proto_TransactionRecord] = [] ///* - /// The records of processing all child transaction spawned by the transaction with the given + /// The records of processing all child transaction spawned by the transaction with the given /// top-level id, in consensus order. Always empty if the top-level status is UNKNOWN. public var childTransactionRecords: [Proto_TransactionRecord] = [] @@ -128,11 +128,6 @@ public struct Proto_TransactionGetRecordResponse { fileprivate var _transactionRecord: Proto_TransactionRecord? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionGetRecordQuery: @unchecked Sendable {} -extension Proto_TransactionGetRecordResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_receipt.pb.swift b/Sources/HederaProtobufs/Services/transaction_receipt.pb.swift index fc098927..f725d099 100644 --- a/Sources/HederaProtobufs/Services/transaction_receipt.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_receipt.pb.swift @@ -23,7 +23,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// The summary of a transaction's result so far. If the transaction has not reached consensus, this /// result will be necessarily incomplete. -public struct Proto_TransactionReceipt { +public struct Proto_TransactionReceipt: @unchecked Sendable { // 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. @@ -243,10 +243,6 @@ public struct Proto_TransactionReceipt { fileprivate var _storage = _StorageClass.defaultInstance } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionReceipt: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_record.pb.swift b/Sources/HederaProtobufs/Services/transaction_record.pb.swift index 838240ae..c9c73cc4 100644 --- a/Sources/HederaProtobufs/Services/transaction_record.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_record.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Response when the client sends the node TransactionGetRecordResponse -public struct Proto_TransactionRecord { +public struct Proto_TransactionRecord: @unchecked Sendable { // 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. @@ -171,14 +171,14 @@ public struct Proto_TransactionRecord { ///* /// In the record of a CryptoCreate transaction triggered by a user transaction with a - /// (previously unused) alias, the new account's alias. + /// (previously unused) alias, the new account's alias. public var alias: Data { get {return _storage._alias} set {_uniqueStorage()._alias = newValue} } ///* - /// The keccak256 hash of the ethereumData. This field will only be populated for + /// The keccak256 hash of the ethereumData. This field will only be populated for /// EthereumTransaction. public var ethereumHash: Data { get {return _storage._ethereumHash} @@ -242,7 +242,7 @@ public struct Proto_TransactionRecord { public var unknownFields = SwiftProtobuf.UnknownStorage() - public enum OneOf_Body: Equatable { + public enum OneOf_Body: Equatable, Sendable { ///* /// Record of the value returned by the smart contract function (if it completed and didn't /// fail) from ContractCallTransaction @@ -252,27 +252,9 @@ public struct Proto_TransactionRecord { /// didn't fail) from ContractCreateTransaction case contractCreateResult(Proto_ContractFunctionResult) - #if !swift(>=4.1) - public static func ==(lhs: Proto_TransactionRecord.OneOf_Body, rhs: Proto_TransactionRecord.OneOf_Body) -> 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 (.contractCallResult, .contractCallResult): return { - guard case .contractCallResult(let l) = lhs, case .contractCallResult(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.contractCreateResult, .contractCreateResult): return { - guard case .contractCreateResult(let l) = lhs, case .contractCreateResult(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } - public enum OneOf_Entropy: Equatable { + public enum OneOf_Entropy: Equatable, @unchecked Sendable { ///* /// In the record of a UtilPrng transaction with no output range, a pseudorandom 384-bit string. case prngBytes(Data) @@ -280,24 +262,6 @@ public struct Proto_TransactionRecord { /// In the record of a PRNG transaction with an output range, the output of a PRNG whose input was a 384-bit string. case prngNumber(Int32) - #if !swift(>=4.1) - public static func ==(lhs: Proto_TransactionRecord.OneOf_Entropy, rhs: Proto_TransactionRecord.OneOf_Entropy) -> 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 (.prngBytes, .prngBytes): return { - guard case .prngBytes(let l) = lhs, case .prngBytes(let r) = rhs else { preconditionFailure() } - return l == r - }() - case (.prngNumber, .prngNumber): return { - guard case .prngNumber(let l) = lhs, case .prngNumber(let r) = rhs else { preconditionFailure() } - return l == r - }() - default: return false - } - } - #endif } public init() {} @@ -307,7 +271,7 @@ public struct Proto_TransactionRecord { ///* /// A record of a new pending airdrop. -public struct Proto_PendingAirdropRecord { +public struct Proto_PendingAirdropRecord: Sendable { // 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. @@ -347,13 +311,6 @@ public struct Proto_PendingAirdropRecord { fileprivate var _pendingAirdropValue: Proto_PendingAirdropValue? = nil } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionRecord: @unchecked Sendable {} -extension Proto_TransactionRecord.OneOf_Body: @unchecked Sendable {} -extension Proto_TransactionRecord.OneOf_Entropy: @unchecked Sendable {} -extension Proto_PendingAirdropRecord: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/transaction_response.pb.swift b/Sources/HederaProtobufs/Services/transaction_response.pb.swift index 67d8df3b..6518cd97 100644 --- a/Sources/HederaProtobufs/Services/transaction_response.pb.swift +++ b/Sources/HederaProtobufs/Services/transaction_response.pb.swift @@ -26,7 +26,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP /// or it failed (so it won't). If the fee offered was insufficient, this will also contain the /// amount of the required fee. To learn the consensus result, the client should later obtain a /// receipt (free), or can buy a more detailed record (not free). -public struct Proto_TransactionResponse { +public struct Proto_TransactionResponse: Sendable { // 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. @@ -45,10 +45,6 @@ public struct Proto_TransactionResponse { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_TransactionResponse: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift index 88153db3..3855bb88 100644 --- a/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift +++ b/Sources/HederaProtobufs/Services/unchecked_submit.pb.swift @@ -22,8 +22,8 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Submit an arbitrary (serialized) Transaction to the network without prechecks. Requires superuser -/// privileges. -public struct Proto_UncheckedSubmitBody { +/// privileges. +public struct Proto_UncheckedSubmitBody: @unchecked Sendable { // 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. @@ -37,10 +37,6 @@ public struct Proto_UncheckedSubmitBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_UncheckedSubmitBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Sources/HederaProtobufs/Services/util_prng.pb.swift b/Sources/HederaProtobufs/Services/util_prng.pb.swift index 07b25283..a071b44c 100644 --- a/Sources/HederaProtobufs/Services/util_prng.pb.swift +++ b/Sources/HederaProtobufs/Services/util_prng.pb.swift @@ -22,7 +22,7 @@ fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAP ///* /// Generates a pseudorandom number -public struct Proto_UtilPrngTransactionBody { +public struct Proto_UtilPrngTransactionBody: Sendable { // 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. @@ -37,10 +37,6 @@ public struct Proto_UtilPrngTransactionBody { public init() {} } -#if swift(>=5.5) && canImport(_Concurrency) -extension Proto_UtilPrngTransactionBody: @unchecked Sendable {} -#endif // swift(>=5.5) && canImport(_Concurrency) - // MARK: - Code below here is support for the SwiftProtobuf runtime. fileprivate let _protobuf_package = "proto" diff --git a/Tests/HederaE2ETests/Token/FungibleToken.swift b/Tests/HederaE2ETests/Token/FungibleToken.swift index b22d0c2d..f1b8cf36 100644 --- a/Tests/HederaE2ETests/Token/FungibleToken.swift +++ b/Tests/HederaE2ETests/Token/FungibleToken.swift @@ -21,6 +21,10 @@ import Hedera import XCTest +let testAmount: Int64 = 100 +let testMintedNfts: Int64 = 10 +let testFungibleInitialBalance: UInt64 = 1_000_000 + internal struct FungibleToken { internal let id: TokenId internal let owner: Account diff --git a/Tests/HederaE2ETests/Token/Nft.swift b/Tests/HederaE2ETests/Token/Nft.swift index 88c515c0..f06d9e05 100644 --- a/Tests/HederaE2ETests/Token/Nft.swift +++ b/Tests/HederaE2ETests/Token/Nft.swift @@ -21,6 +21,8 @@ import Hedera import XCTest +let testMetadata = Array(repeating: Data([9, 1, 6]), count: 10) + internal struct Nft { internal let id: TokenId internal let owner: Account diff --git a/Tests/HederaE2ETests/Token/TokenAirdrop.swift b/Tests/HederaE2ETests/Token/TokenAirdrop.swift new file mode 100644 index 00000000..c1f11fd4 --- /dev/null +++ b/Tests/HederaE2ETests/Token/TokenAirdrop.swift @@ -0,0 +1,465 @@ +/* + * ‌ + * 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 TokenAirdrop: XCTestCase { + internal func testAirdropAssociatedTokens() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a receiver account with unlimited auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), -1) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + _ = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccountBalance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccountBalance.tokenBalances[nft.id], 2) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id]!, testFungibleInitialBalance - UInt64(testAmount)) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id]!, UInt64(testMintedNfts) - 2) + } + + internal func testAirdropNonAssociatedTokens() async throws { + let testEnv = try TestEnvironment.nonFree + + // create receiver with 0 auto associations and receiverSig = false + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + var tx = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + + _ = try await tx.validateStatus(true).getReceipt(testEnv.client) + let record = try await tx.getRecord(testEnv.client) + + // verify in the transaction record the pending airdrops + XCTAssertNotNil(record.pendingAirdropRecords) + XCTAssertFalse(record.pendingAirdropRecords.isEmpty) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertNil(receiverAccountBalance.tokenBalances[token.id]) + XCTAssertNil(receiverAccountBalance.tokenBalances[nft.id]) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id]!, UInt64(testMintedNfts)) + } + + internal func testAirdropToAlias() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Create an alias + let aliasKey = PrivateKey.generateEd25519() + let aliasAccountId = aliasKey.publicKey.toAccountId(shard: 0, realm: 0) + + // Airdrop tokens + _ = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, aliasAccountId) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, aliasAccountId) + .tokenTransfer(token.id, aliasAccountId, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(aliasAccountId) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccountBalance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccountBalance.tokenBalances[nft.id], 2) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id]!, testFungibleInitialBalance - UInt64(testAmount)) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id]!, UInt64(testMintedNfts) - 2) + } + + internal func testAirdropWithCustomFees() async throws { + let testEnv = try TestEnvironment.nonFree + + // create receiver with unlimited auto associations and receiverSig = false + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), -1) + + // Create a token + let customFeeToken = try await FungibleToken.create(testEnv, decimals: 3) + + // Make the custom fee to be paid by the sender and the fee collector to be the operator account + let fee = AnyCustomFee.fixed( + FixedFee.init( + amount: 1, denominatingTokenId: customFeeToken.id, feeCollectorAccountId: testEnv.operator.accountId, + allCollectorsAreExempt: true)) + + let createTokenReceipt = try await TokenCreateTransaction() + .name("Test Token") + .symbol("TST") + .tokenMemo("Test Token Memo") + .decimals(3) + .initialSupply(testFungibleInitialBalance) + .maxSupply(testFungibleInitialBalance) + .treasuryAccountId(testEnv.operator.accountId) + .tokenSupplyType(TokenSupplyType.finite) + .supplyKey(Key.single(testEnv.operator.privateKey.publicKey)) + .adminKey(Key.single(testEnv.operator.privateKey.publicKey)) + .freezeKey(Key.single(testEnv.operator.privateKey.publicKey)) + .customFees([fee]) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let tokenId = try XCTUnwrap(createTokenReceipt.tokenId) + + // create receiver with unlimited auto associations and receiverSig = false + let senderKey = PrivateKey.generateEd25519() + let senderAccount = try await Account.create(testEnv, Key.single(senderKey.publicKey), -1) + + // associate the token to the sender + _ = try await TokenAssociateTransaction() + .accountId(senderAccount.id) + .tokenIds([customFeeToken.id]) + .freezeWith(testEnv.client) + .sign(senderKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // send tokens to the sender + _ = try await TransferTransaction() + .tokenTransfer(customFeeToken.id, testEnv.operator.accountId, -testAmount) + .tokenTransfer(customFeeToken.id, senderAccount.id, testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await TransferTransaction() + .tokenTransfer(tokenId, testEnv.operator.accountId, -testAmount) + .tokenTransfer(tokenId, senderAccount.id, testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Airdrop the tokens from the sender to the receiver + _ = try await TokenAirdropTransaction() + .tokenTransfer(tokenId, receiverAccount.id, testAmount) + .tokenTransfer(tokenId, senderAccount.id, -testAmount) + .freezeWith(testEnv.client) + .sign(senderKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccountBalance.tokenBalances[tokenId]!, UInt64(testAmount)) + + let senderAccountBalance = try await AccountBalanceQuery() + .accountId(senderAccount.id) + .execute(testEnv.client) + + XCTAssertEqual(senderAccountBalance.tokenBalances[tokenId]!, 0) + XCTAssertEqual(senderAccountBalance.tokenBalances[customFeeToken.id]!, UInt64(testAmount) - 1) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual( + operatorBalance.tokenBalances[customFeeToken.id]!, testFungibleInitialBalance - UInt64(testAmount) + 1) + XCTAssertEqual(operatorBalance.tokenBalances[tokenId]!, testFungibleInitialBalance - UInt64(testAmount)) + } + + internal func testAirdropTokensWithReceiverSigRequiredFungible() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // Create a receiver account with unlimited auto associations and receiverSig = true + let receiverKey = PrivateKey.generateEd25519() + let receiverAccountId = try await AccountCreateTransaction() + .key(Key.single(receiverKey.publicKey)) + .initialBalance(Hbar(1)) + .receiverSignatureRequired(true) + .maxAutomaticTokenAssociations(-1) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + .accountId! + + // Airdrop tokens + _ = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccountId, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + } + + internal func testAirdropTokensWithReceiverSigRequiredNft() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a nft + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Create a receiver account with unlimited auto associations and receiverSig = true + let receiverKey = PrivateKey.generateEd25519() + let receiverAccountId = try await AccountCreateTransaction() + .key(Key.single(receiverKey.publicKey)) + .initialBalance(Hbar(1)) + .receiverSignatureRequired(true) + .maxAutomaticTokenAssociations(-1) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + .accountId! + + // Airdrop tokens + _ = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccountId) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccountId) + .execute(testEnv.client) + .getReceipt(testEnv.client) + } + + internal func testAirdropAllowanceAndWithoutBalanceFungibleFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a fungible token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // Create spender and approve its tokens + let spenderKey = PrivateKey.generateEd25519() + let spenderAccount = try await Account.create(testEnv, .single(spenderKey.publicKey), -1) + + // Create sender + let senderKey = PrivateKey.generateEd25519() + let senderAccount = try await Account.create(testEnv, .single(senderKey.publicKey), -1) + + // Transfer fungible tokens to sender + _ = try await TransferTransaction() + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .tokenTransfer(token.id, senderAccount.id, testAmount) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await AccountAllowanceApproveTransaction() + .approveTokenAllowance(token.id, senderAccount.id, spenderAccount.id, UInt64(testAmount)) + .freezeWith(testEnv.client) + .sign(senderKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Airdrop the tokens from the sender to the spender via approval + // Fails with not supported status + await assertThrowsHErrorAsync( + try await TokenAirdropTransaction() + .tokenTransfer(token.id, spenderAccount.id, testAmount) + .approvedTokenTransfer(token.id, spenderAccount.id, -testAmount) + .transactionId(TransactionId.generateFrom(spenderAccount.id)) + .freezeWith(testEnv.client) + .sign(spenderKey) + .execute(testEnv.client), + "expected error Airdropping token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .notSupported) + } + } + + internal func testAirdropAllowanceAndWithoutBalanceNftFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create spender and approve its tokens + let spenderKey = PrivateKey.generateEd25519() + let spenderAccount = try await Account.create(testEnv, .single(spenderKey.publicKey), -1) + + // Create sender + let senderKey = PrivateKey.generateEd25519() + let senderAccount = try await Account.create(testEnv, .single(senderKey.publicKey), -1) + + // Create an nft + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Transfer fungible tokens to sender + _ = try await TransferTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, senderAccount.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, senderAccount.id) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + _ = try await AccountAllowanceApproveTransaction() + .approveTokenNftAllowance(nft.id.nft(nftSerials[0]), senderAccount.id, spenderAccount.id) + .approveTokenNftAllowance(nft.id.nft(nftSerials[1]), senderAccount.id, spenderAccount.id) + .freezeWith(testEnv.client) + .sign(senderKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Airdrop the tokens from the sender to the spender via approval + // Fails with not supported status + await assertThrowsHErrorAsync( + try await TokenAirdropTransaction() + .approvedNftTransfer(nft.id.nft(nftSerials[0]), spenderAccount.id, spenderAccount.id) + .approvedNftTransfer(nft.id.nft(nftSerials[1]), spenderAccount.id, spenderAccount.id) + .transactionId(TransactionId.generateFrom(spenderAccount.id)) + .freezeWith(testEnv.client) + .sign(spenderKey) + .execute(testEnv.client), + "expected error Airdropping token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .notSupported) + } + } + + internal func testAirdropTokensWithInvalidBodyFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Airdrop with no tokenID or NftID + // fails with EMPTY_TOKEN_TRANSFER_BODY + await assertThrowsHErrorAsync( + try await TokenAirdropTransaction() + .execute(testEnv.client), + "expected error Airdropping token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .emptyTokenTransferBody) + } + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // Airdrop with invalid transfers + // fails with INVALID_TRANSACTION_BODY + await assertThrowsHErrorAsync( + try await TokenAirdropTransaction() + .tokenTransfer(token.id, testEnv.operator.accountId, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, testAmount) + .execute(testEnv.client), + "expected error Airdropping token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .invalidTransactionBody) + } + } +} diff --git a/Tests/HederaE2ETests/Token/TokenCancelAirdrop.swift b/Tests/HederaE2ETests/Token/TokenCancelAirdrop.swift new file mode 100644 index 00000000..8768cb4a --- /dev/null +++ b/Tests/HederaE2ETests/Token/TokenCancelAirdrop.swift @@ -0,0 +1,460 @@ +/* + * ‌ + * 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 TokenCancelAirdrop: XCTestCase { + internal func testCancelTokens() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a receiver account with unlimited auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + var record = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Sender cancels the airdrop + record = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[1].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[2].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(record.pendingAirdropRecords.count, 0) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertNil(receiverAccountBalance.tokenBalances[token.id]) + XCTAssertNil(receiverAccountBalance.tokenBalances[nft.id]) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id], UInt64(testMintedNfts)) + } + + internal func testCancelTokensWhenFrozen() async throws { + let testEnv = try TestEnvironment.nonFree + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // Airdrop tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Associate the receiver account with the token + let _ = try await TokenAssociateTransaction() + .accountId(receiverAccount.id) + .tokenIds([token.id]) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Freeze the token + let _ = try await TokenFreezeTransaction() + .tokenId(token.id) + .accountId(receiverAccount.id) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Cancel the airdrop + let _ = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client) + } + + internal func testCancelTokensWhenPaused() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // Airdrop some of the tokens to the receiver + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Pause the token + let _ = try await TokenPauseTransaction() + .tokenId(token.id) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Cancel the airdrop + let _ = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client) + } + + internal func testCancelTokensWhenTokenIsDeleted() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens from sender to receiver + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Delete the token + _ = try await TokenDeleteTransaction() + .tokenId(token.id) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Cancel the airdrop + let _ = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client) + } + + internal func testCancelTokensToMultipleReceivers() async throws { + let testEnv = try TestEnvironment.nonFree + + // create receiver1 with 0 auto associations + let receiverKey1 = PrivateKey.generateEd25519() + let receiverAccount1 = try await Account.create(testEnv, Key.single(receiverKey1.publicKey), 0) + + // create receiver2 with 0 auto associations + let receiverKey2 = PrivateKey.generateEd25519() + let receiverAccount2 = try await Account.create(testEnv, Key.single(receiverKey2.publicKey), 0) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + let record = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount1.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount1.id) + .tokenTransfer(token.id, receiverAccount1.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .nftTransfer(nft.id.nft(nftSerials[2]), testEnv.operator.accountId, receiverAccount2.id) + .nftTransfer(nft.id.nft(nftSerials[3]), testEnv.operator.accountId, receiverAccount2.id) + .tokenTransfer(token.id, receiverAccount2.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify the txn records + XCTAssertEqual(record.pendingAirdropRecords.count, 6) + + // claim the tokens signing with receiver1 and receiver2 + let pendingAirdropIds = record.pendingAirdropRecords.map { $0.pendingAirdropId } + + let tokenClaimRecord = try await TokenCancelAirdropTransaction() + .pendingAirdropIds(pendingAirdropIds) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(tokenClaimRecord.pendingAirdropRecords.count, 0) + + // Verify the receiver1 does not hold the tokens via query + let receiverAccount1Balance = try await AccountBalanceQuery() + .accountId(receiverAccount1.id) + .execute(testEnv.client) + + XCTAssertNil(receiverAccount1Balance.tokenBalances[token.id]) + XCTAssertNil(receiverAccount1Balance.tokenBalances[nft.id]) + + // Verify the receiver2 does not hold the tokens via query + let receiverAccount2Balance = try await AccountBalanceQuery() + .accountId(receiverAccount2.id) + .execute(testEnv.client) + + XCTAssertNil(receiverAccount2Balance.tokenBalances[token.id]) + XCTAssertNil(receiverAccount2Balance.tokenBalances[nft.id]) + + // Verify the operator does hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id], UInt64(testMintedNfts)) + } + + internal func testClaimTokensToMultipleAirdropTxns() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop some of the tokens to the receiver + let record1 = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Airdrop some of the tokens to the receiver + let record2 = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Airdrop some of the tokens to the receiver + let record3 = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Get the PendingIds from the records + let pendingAirdropIds: [PendingAirdropId] = [ + record1.pendingAirdropRecords[0].pendingAirdropId, record2.pendingAirdropRecords[0].pendingAirdropId, + record3.pendingAirdropRecords[0].pendingAirdropId, + ] + + let tokenCancelRecord = try await TokenCancelAirdropTransaction() + .pendingAirdropIds(pendingAirdropIds) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(tokenCancelRecord.pendingAirdropRecords.count, 0) + + // Verify the receiver holds the tokens via query + let receiverAccount1Balance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertNil(receiverAccount1Balance.tokenBalances[token.id]) + XCTAssertNil(receiverAccount1Balance.tokenBalances[nft.id]) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id], UInt64(testMintedNfts)) + } + + internal func testCancelTokensForNonExistingAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Create receiver with 0 auto associations + let randomKey = PrivateKey.generateEd25519() + let randomAccount = try await Account.create(testEnv, Key.single(randomKey.publicKey), 0) + + // cancel the tokens with the random account which has not created pending airdrops + // fails with INVALID_SIGNATURE + await assertThrowsHErrorAsync( + try await TokenCancelAirdropTransaction() + .transactionId(TransactionId.generateFrom(randomAccount.id)) + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Cancel airdrop" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .invalidSignature) + } + } + + internal func testCancelCancelledAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Cancel the tokens with the receiver + _ = try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Cancel the tokens with the receiver again + // fails with INVALID_PENDING_AIRDROP_ID + await assertThrowsHErrorAsync( + try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Cancel token" + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") + return + } + XCTAssertEqual(status, .invalidPendingAirdropId) + } + } + + internal func testCancelEmptyPendingAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Cancel the tokens with the receiver without setting pendingAirdropIds + // fails with EMPTY_PENDING_AIRDROP_ID_LIST + await assertThrowsHErrorAsync( + try await TokenCancelAirdropTransaction() + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Cancel token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .emptyPendingAirdropIdList) + } + } + + internal func testCancelDuplicateEntriesFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Cancel the tokens with the receiver again + // fails with INVALID_PENDING_AIRDROP_ID + await assertThrowsHErrorAsync( + try await TokenCancelAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .pendingAirdropIdRepeated) + } + } +} diff --git a/Tests/HederaE2ETests/Token/TokenClaimAirdrop.swift b/Tests/HederaE2ETests/Token/TokenClaimAirdrop.swift new file mode 100644 index 00000000..55f847a3 --- /dev/null +++ b/Tests/HederaE2ETests/Token/TokenClaimAirdrop.swift @@ -0,0 +1,423 @@ +/* + * ‌ + * 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 TokenClaimAirdrop: XCTestCase { + internal func testClaimTokens() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a receiver account with unlimited auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + let record = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify the txn records + XCTAssertEqual(record.pendingAirdropRecords.count, 3) + + XCTAssertEqual(record.pendingAirdropRecords[0].amount, 100) + XCTAssertEqual(record.pendingAirdropRecords[0].pendingAirdropId.tokenId, token.id) + XCTAssertNil(record.pendingAirdropRecords[0].pendingAirdropId.nftId) + + XCTAssertEqual(record.pendingAirdropRecords[1].amount, 0) + XCTAssertEqual(record.pendingAirdropRecords[1].pendingAirdropId.nftId, nft.id.nft(nftSerials[0])) + XCTAssertNil(record.pendingAirdropRecords[1].pendingAirdropId.tokenId) + + XCTAssertEqual(record.pendingAirdropRecords[2].amount, 0) + XCTAssertEqual(record.pendingAirdropRecords[2].pendingAirdropId.nftId, nft.id.nft(nftSerials[1])) + XCTAssertNil(record.pendingAirdropRecords[2].pendingAirdropId.tokenId) + + // Claim the tokens with the receiver account + let tokenClaimRecord = try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[1].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[2].pendingAirdropId) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(tokenClaimRecord.pendingAirdropRecords.count, 0) + + // Verify the receiver holds the tokens via query + let receiverAccountBalance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccountBalance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccountBalance.tokenBalances[nft.id], 2) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id]!, testFungibleInitialBalance - UInt64(testAmount)) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id]!, UInt64(testMintedNfts) - 2) + } + + internal func testClaimTokensToMultipleReceivers() async throws { + let testEnv = try TestEnvironment.nonFree + + // create receiver1 with 0 auto associations + let receiverKey1 = PrivateKey.generateEd25519() + let receiverAccount1 = try await Account.create(testEnv, Key.single(receiverKey1.publicKey), 0) + + // create receiver2 with 0 auto associations + let receiverKey2 = PrivateKey.generateEd25519() + let receiverAccount2 = try await Account.create(testEnv, Key.single(receiverKey2.publicKey), 0) + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // Airdrop tokens + let record = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount1.id) + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount1.id) + .tokenTransfer(token.id, receiverAccount1.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .nftTransfer(nft.id.nft(nftSerials[2]), testEnv.operator.accountId, receiverAccount2.id) + .nftTransfer(nft.id.nft(nftSerials[3]), testEnv.operator.accountId, receiverAccount2.id) + .tokenTransfer(token.id, receiverAccount2.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify the txn records + XCTAssertEqual(record.pendingAirdropRecords.count, 6) + + // claim the tokens signing with receiver1 and receiver2 + let pendingAirdropIds = record.pendingAirdropRecords.map { $0.pendingAirdropId } + + let tokenClaimRecord = try await TokenClaimAirdropTransaction() + .pendingAirdropIds(pendingAirdropIds) + .freezeWith(testEnv.client) + .sign(receiverKey1) + .sign(receiverKey2) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(tokenClaimRecord.pendingAirdropRecords.count, 0) + + // Verify the receiver holds the tokens via query + let receiverAccount1Balance = try await AccountBalanceQuery() + .accountId(receiverAccount1.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccount1Balance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccount1Balance.tokenBalances[nft.id], 2) + + // Verify the receiver holds the tokens via query + let receiverAccount2Balance = try await AccountBalanceQuery() + .accountId(receiverAccount2.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccount2Balance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccount2Balance.tokenBalances[nft.id], 2) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance - UInt64(testAmount) * 2) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id], UInt64(testMintedNfts) - 4) + } + + internal func testClaimTokensToMultipleAirdropTxns() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token and an NFT + let token = try await FungibleToken.create(testEnv, decimals: 3) + let nft = try await Nft.create(testEnv) + + // Mint NFTs + let mintReceipt = try await TokenMintTransaction() + .tokenId(nft.id) + .metadata(testMetadata) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + let nftSerials = try XCTUnwrap(mintReceipt.serials) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop some of the tokens to the receiver + let record1 = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[0]), testEnv.operator.accountId, receiverAccount.id) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Airdrop some of the tokens to the receiver + let record2 = try await TokenAirdropTransaction() + .nftTransfer(nft.id.nft(nftSerials[1]), testEnv.operator.accountId, receiverAccount.id) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Airdrop some of the tokens to the receiver + let record3 = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Get the PendingIds from the records + let pendingAirdropIds: [PendingAirdropId] = [ + record1.pendingAirdropRecords[0].pendingAirdropId, record2.pendingAirdropRecords[0].pendingAirdropId, + record3.pendingAirdropRecords[0].pendingAirdropId, + ] + + let tokenClaimRecord = try await TokenClaimAirdropTransaction() + .pendingAirdropIds(pendingAirdropIds) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Verify in the transaction record the pending airdrop ids for nft and ft - should no longer exist + XCTAssertEqual(tokenClaimRecord.pendingAirdropRecords.count, 0) + + // Verify the receiver holds the tokens via query + let receiverAccount1Balance = try await AccountBalanceQuery() + .accountId(receiverAccount.id) + .execute(testEnv.client) + + XCTAssertEqual(receiverAccount1Balance.tokenBalances[token.id]!, UInt64(testAmount)) + XCTAssertEqual(receiverAccount1Balance.tokenBalances[nft.id], 2) + + // Verify the operator does not hold the tokens + let operatorBalance = try await AccountBalanceQuery() + .accountId(testEnv.operator.accountId) + .execute(testEnv.client) + + XCTAssertEqual(operatorBalance.tokenBalances[token.id], testFungibleInitialBalance - UInt64(testAmount)) + XCTAssertEqual(operatorBalance.tokenBalances[nft.id], UInt64(testMintedNfts) - 2) + } + + internal func testClaimTokensForNonExistingAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // claim the tokens with the operator which does not have pending airdrops + // fails with INVALID_SIGNATURE + await assertThrowsHErrorAsync( + try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") + return + } + XCTAssertEqual(status, .invalidSignature) + } + } + + internal func testClaimAlreadyClaimedAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Claim the tokens with the receiver + _ = try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // claim the tokens with the operator which does not have pending airdrops + // fails with INVALID_SIGNATURE + await assertThrowsHErrorAsync( + try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") + return + } + XCTAssertEqual(status, .invalidPendingAirdropId) + } + } + + internal func testClaimEmptyPendingAirdropFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Claim the tokens with the receiver without setting pendingAirdropIds + // fails with EMPTY_PENDING_AIRDROP_ID_LIST + await assertThrowsHErrorAsync( + try await TokenClaimAirdropTransaction() + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .emptyPendingAirdropIdList) + } + } + + internal func testClaimDuplicateEntriesFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Claim the tokens with duplicate pending airdrop token ids + // fails with PENDING_AIRDROP_ID_REPEATED + await assertThrowsHErrorAsync( + try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .transactionPreCheckStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.transactionPreCheckStatus`") + return + } + XCTAssertEqual(status, .pendingAirdropIdRepeated) + } + } + + internal func testClaimDeletedTokensFail() async throws { + let testEnv = try TestEnvironment.nonFree + + // Create a token + let token = try await FungibleToken.create(testEnv, decimals: 3) + + // create receiver with 0 auto associations + let receiverKey = PrivateKey.generateEd25519() + let receiverAccount = try await Account.create(testEnv, Key.single(receiverKey.publicKey), 0) + + // airdrop the tokens from sender to receiver + let record = try await TokenAirdropTransaction() + .tokenTransfer(token.id, receiverAccount.id, testAmount) + .tokenTransfer(token.id, testEnv.operator.accountId, -testAmount) + .execute(testEnv.client) + .getRecord(testEnv.client) + + // Delete the token + _ = try await TokenDeleteTransaction() + .tokenId(token.id) + .execute(testEnv.client) + .getReceipt(testEnv.client) + + // Claim the tokens with receiver + // fails with TOKEN_IS_DELETED + await assertThrowsHErrorAsync( + try await TokenClaimAirdropTransaction() + .addPendingAirdropId(record.pendingAirdropRecords[0].pendingAirdropId) + .freezeWith(testEnv.client) + .sign(receiverKey) + .execute(testEnv.client) + .getRecord(testEnv.client), + "expected error Claiming token" + ) { error in + guard case .receiptStatus(let status, transactionId: _) = error.kind else { + XCTFail("`\(error.kind)` is not `.receiptStatus`") + return + } + XCTAssertEqual(status, .tokenWasDeleted) + } + } +} diff --git a/Tests/HederaE2ETests/Token/TokenReject.swift b/Tests/HederaE2ETests/Token/TokenReject.swift index 7e66d478..8027435d 100644 --- a/Tests/HederaE2ETests/Token/TokenReject.swift +++ b/Tests/HederaE2ETests/Token/TokenReject.swift @@ -366,11 +366,15 @@ internal class TokenReject: XCTestCase { } internal func testRemoveAllowance() async throws { + if true { + throw XCTSkip("Temporarily disabled til server side fix.") + } + let testEnv = try TestEnvironment.nonFree let ft = try await FungibleToken.create(testEnv, decimals: 3) let receiverAccountKey = PrivateKey.generateEd25519() - let receiverAccount = try await Account.create(testEnv, Key.single(receiverAccountKey.publicKey), 100) + let receiverAccount = try await Account.create(testEnv, Key.single(receiverAccountKey.publicKey), -1) let spenderAccountKey = PrivateKey.generateEd25519() let spenderCreateReceipt = try await AccountCreateTransaction() diff --git a/Tests/HederaTests/TokenAirdropTransactionTests.swift b/Tests/HederaTests/TokenAirdropTransactionTests.swift new file mode 100644 index 00000000..fb46b16a --- /dev/null +++ b/Tests/HederaTests/TokenAirdropTransactionTests.swift @@ -0,0 +1,184 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import XCTest + +@testable import Hedera + +internal final class TokenAirdropTransactionTests: XCTestCase { + private static func makeTransaction() throws -> TokenAirdropTransaction { + let tx = TokenAirdropTransaction() + + try tx.tokenTransfer(TokenId(num: 5005), AccountId(num: 5006), 400) + .tokenTransferWithDecimals(TokenId(num: 5), AccountId(num: 5005), -800, 3) + .tokenTransferWithDecimals(TokenId(num: 5), AccountId(num: 5007), -400, 3) + .tokenTransfer(TokenId(num: 4), AccountId(num: 5008), 1) + .tokenTransfer(TokenId(num: 4), AccountId(num: 5006), -1) + .nftTransfer(TokenId(num: 3).nft(2), AccountId(num: 5008), AccountId(num: 5007)) + .nftTransfer(TokenId(num: 3).nft(1), AccountId(num: 5008), AccountId(num: 5007)) + .nftTransfer(TokenId(num: 3).nft(3), AccountId(num: 5008), AccountId(num: 5006)) + .nftTransfer(TokenId(num: 3).nft(4), AccountId(num: 5007), AccountId(num: 5006)) + .nftTransfer(TokenId(num: 2).nft(4), AccountId(num: 5007), AccountId(num: 5006)) + .approvedTokenTransfer(TokenId(num: 4), AccountId(num: 5006), 123) + .approvedNftTransfer(TokenId(num: 4).nft(4), AccountId(num: 5005), AccountId(num: 5006)) + .transactionId(Resources.txId) + .nodeAccountIds(Resources.nodeAccountIds) + .maxTransactionFee(Hbar(2)) + .freeze() + .sign(Resources.privateKey) + + return tx + } + + func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + assertSnapshot(matching: tx, as: .description) + } + + func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + func testFromProtoBody() throws { + let protoData = Proto_TokenAirdropTransactionBody.with { proto in + proto.tokenTransfers = [ + .with { + $0.token = TokenId(num: 5005).toProtobuf() + $0.transfers = [ + .with { + $0.accountID = AccountId(num: 5008).toProtobuf() + $0.amount = 200 + }, + .with { + $0.accountID = AccountId(num: 5009).toProtobuf() + $0.amount = -100 + }, + .with { + $0.accountID = AccountId(num: 5010).toProtobuf() + $0.amount = 40 + }, + .with { + $0.accountID = AccountId(num: 5011).toProtobuf() + $0.amount = 20 + }, + ] + $0.nftTransfers = [ + .with { + $0.senderAccountID = AccountId(num: 5010).toProtobuf() + $0.receiverAccountID = AccountId(num: 5011).toProtobuf() + $0.serialNumber = 1 + $0.isApproval = true + } + ] + $0.expectedDecimals = .with { $0.value = 3 } + } + ] + } + + let protoBody = Proto_TransactionBody.with { proto in + proto.tokenAirdrop = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try TokenAirdropTransaction(protobuf: protoBody, protoData) + + XCTAssertEqual(tx.tokenTransfers.count, 1) + XCTAssertEqual(tx.tokenTransfers[TokenId(num: 5005)]?.count, 4) + XCTAssertEqual(tx.tokenNftTransfers[TokenId(num: 5005)]?.count, 1) + } + + func testGetSetTokenTransfers() throws { + let tokenId = TokenId(num: 123) + let accountId = AccountId(num: 456) + let value: Int64 = 1000 + let tx = TokenAirdropTransaction() + tx.tokenTransfer(tokenId, accountId, value) + + let tokenTransfers = tx.tokenTransfers + + XCTAssertTrue(tokenTransfers.keys.contains(tokenId)) + XCTAssertEqual(tokenTransfers.count, 1) + XCTAssertEqual(value, tokenTransfers[tokenId]?[accountId]) + } + + func testGetSetNftTransfer() throws { + let nftId = TokenId(num: 5005).nft(1) + let sender = AccountId(num: 5006) + let receiver = AccountId(num: 5011) + let tx = TokenAirdropTransaction() + tx.nftTransfer(nftId, sender, receiver) + + let nftTransfers = tx.tokenNftTransfers + + XCTAssertTrue(nftTransfers.keys.contains(nftId.tokenId)) + XCTAssertEqual(nftTransfers[nftId.tokenId]?.count, 1) + XCTAssertEqual(sender, nftTransfers[nftId.tokenId]?[0].sender) + XCTAssertEqual(receiver, nftTransfers[nftId.tokenId]?[0].receiver) + } + + func testGetSetApprovedNftTransfer() throws { + let nftId = TokenId(num: 5005).nft(1) + let sender = AccountId(num: 5006) + let receiver = AccountId(num: 123) + let tx = TokenAirdropTransaction() + tx.approvedNftTransfer(nftId, sender, receiver) + + let nftTransfers = tx.tokenNftTransfers + + XCTAssertTrue(nftTransfers.keys.contains(nftId.tokenId)) + XCTAssertEqual(nftTransfers[nftId.tokenId]?.count, 1) + XCTAssertEqual(sender, nftTransfers[nftId.tokenId]?[0].sender) + XCTAssertEqual(receiver, nftTransfers[nftId.tokenId]?[0].receiver) + } + + func testGetSetApprovedTokenTransfer() throws { + let tokenId = TokenId(num: 1420) + let accountId = AccountId(num: 415) + let value: Int64 = 1000 + let tx = TokenAirdropTransaction() + tx.approvedTokenTransfer(tokenId, accountId, value) + + let tokenTransfers = tx.tokenTransfers + + XCTAssertTrue(tokenTransfers.keys.contains(tokenId)) + XCTAssertEqual(tokenTransfers.count, 1) + XCTAssertEqual(value, tokenTransfers[tokenId]?[accountId]) + } + + func testGetSetTokenIdDecimals() throws { + let nftId = TokenId(num: 5005).nft(1) + let sender = AccountId(num: 5006) + let receiver = AccountId(num: 123) + let tx = TokenAirdropTransaction() + tx.approvedNftTransfer(nftId, sender, receiver) + + let nftTransfers = tx.tokenNftTransfers + + XCTAssertTrue(nftTransfers.keys.contains(nftId.tokenId)) + XCTAssertEqual(nftTransfers[nftId.tokenId]?.count, 1) + XCTAssertEqual(sender, nftTransfers[nftId.tokenId]?[0].sender) + XCTAssertEqual(receiver, nftTransfers[nftId.tokenId]?[0].receiver) + } +} diff --git a/Tests/HederaTests/TokenCancelAirdropTransactionTests.swift b/Tests/HederaTests/TokenCancelAirdropTransactionTests.swift new file mode 100644 index 00000000..377dfbf8 --- /dev/null +++ b/Tests/HederaTests/TokenCancelAirdropTransactionTests.swift @@ -0,0 +1,133 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import XCTest + +@testable import Hedera + +internal final class TokenCancelAirdropTransactionTests: XCTestCase { + private static func makeTransaction() throws -> TokenCancelAirdropTransaction { + let pendingAirdropIds: [PendingAirdropId] = [ + .init(senderId: AccountId("0.2.123"), receiverId: AccountId("0.2.5"), tokenId: TokenId("0.0.321")), + .init(senderId: AccountId("0.2.134"), receiverId: AccountId("0.2.6"), nftId: NftId("0.0.321/2")), + ] + + let tx = TokenCancelAirdropTransaction() + + try tx.pendingAirdropIds(pendingAirdropIds) + .transactionId(Resources.txId) + .nodeAccountIds(Resources.nodeAccountIds) + .maxTransactionFee(Hbar(2)) + .freeze() + .sign(Resources.privateKey) + + return tx + } + + func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + assertSnapshot(matching: tx, as: .description) + } + + func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + func testFromProtoBody() throws { + let protoData = Proto_TokenCancelAirdropTransactionBody.with { proto in + proto.pendingAirdrops = [ + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 312) + ).toProtobuf(), + PendingAirdropId.init( + senderId: AccountId(num: 134), + receiverId: AccountId(num: 6), + nftId: NftId("0.0.312/2") + ).toProtobuf(), + ] + } + + let protoBody = Proto_TransactionBody.with { proto in + proto.tokenCancelAirdrop = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try TokenCancelAirdropTransaction(protobuf: protoBody, protoData) + + let nftIds = tx.pendingAirdropIds.compactMap { $0.nftId } + let tokenIds = tx.pendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertEqual(nftIds.count, 1) + XCTAssertEqual(tokenIds.count, 1) + XCTAssertTrue(tokenIds.contains(TokenId(num: 312))) + XCTAssertTrue(nftIds.contains(TokenId(num: 312).nft(2))) + } + + func testGetSetPendingAirdropIds() throws { + let pendingAirdropIds = [ + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 420) + ), + PendingAirdropId.init( + senderId: AccountId(num: 134), + receiverId: AccountId(num: 6), + nftId: NftId("0.0.312/2") + ), + ] + + let tx = TokenCancelAirdropTransaction() + tx.pendingAirdropIds(pendingAirdropIds) + + let resultPendingAirdropIds = tx.pendingAirdropIds + + let nftIds = resultPendingAirdropIds.compactMap { $0.nftId } + let tokenIds = resultPendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertEqual(nftIds.count, 1) + XCTAssertEqual(tokenIds.count, 1) + XCTAssertTrue(tokenIds.contains(TokenId(num: 420))) + XCTAssertTrue(nftIds.contains(TokenId(num: 312).nft(2))) + } + + func testGetSetAddPendingAirdropId() { + let tx = TokenCancelAirdropTransaction() + tx.addPendingAirdropId( + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 312) + )) + + let pendingAirdropIds = tx.pendingAirdropIds + + let tokenIds = pendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertTrue(tokenIds.contains(TokenId(num: 312))) + } +} diff --git a/Tests/HederaTests/TokenClaimAirdropTransactionTests.swift b/Tests/HederaTests/TokenClaimAirdropTransactionTests.swift new file mode 100644 index 00000000..3466b191 --- /dev/null +++ b/Tests/HederaTests/TokenClaimAirdropTransactionTests.swift @@ -0,0 +1,133 @@ +/* + * ‌ + * Hedera Swift SDK + * ​ + * Copyright (C) 2023 - 2023 Hedera Hashgraph, LLC + * ​ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ‍ + */ + +import HederaProtobufs +import SnapshotTesting +import XCTest + +@testable import Hedera + +internal final class TokenClaimAirdropTransactionTests: XCTestCase { + private static func makeTransaction() throws -> TokenClaimAirdropTransaction { + let pendingAirdropIds: [PendingAirdropId] = [ + .init(senderId: AccountId("0.2.123"), receiverId: AccountId("0.2.5"), tokenId: TokenId("0.0.321")), + .init(senderId: AccountId("0.2.134"), receiverId: AccountId("0.2.6"), nftId: NftId("0.0.321/2")), + ] + + let tx = TokenClaimAirdropTransaction() + + try tx.pendingAirdropIds(pendingAirdropIds) + .transactionId(Resources.txId) + .nodeAccountIds(Resources.nodeAccountIds) + .maxTransactionFee(Hbar(2)) + .freeze() + .sign(Resources.privateKey) + + return tx + } + + func testSerialize() throws { + let tx = try Self.makeTransaction().makeProtoBody() + assertSnapshot(matching: tx, as: .description) + } + + func testToFromBytes() throws { + let tx = try Self.makeTransaction() + let tx2 = try Transaction.fromBytes(tx.toBytes()) + + XCTAssertEqual(try tx.makeProtoBody(), try tx2.makeProtoBody()) + } + + func testFromProtoBody() throws { + let protoData = Proto_TokenClaimAirdropTransactionBody.with { proto in + proto.pendingAirdrops = [ + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 312) + ).toProtobuf(), + PendingAirdropId.init( + senderId: AccountId(num: 134), + receiverId: AccountId(num: 6), + nftId: NftId("0.0.312/2") + ).toProtobuf(), + ] + } + + let protoBody = Proto_TransactionBody.with { proto in + proto.tokenClaimAirdrop = protoData + proto.transactionID = Resources.txId.toProtobuf() + } + + let tx = try TokenClaimAirdropTransaction(protobuf: protoBody, protoData) + + let nftIds = tx.pendingAirdropIds.compactMap { $0.nftId } + let tokenIds = tx.pendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertEqual(nftIds.count, 1) + XCTAssertEqual(tokenIds.count, 1) + XCTAssertTrue(tokenIds.contains(TokenId(num: 312))) + XCTAssertTrue(nftIds.contains(TokenId(num: 312).nft(2))) + } + + func testGetSetPendingAirdropIds() throws { + let pendingAirdropIds = [ + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 420) + ), + PendingAirdropId.init( + senderId: AccountId(num: 134), + receiverId: AccountId(num: 6), + nftId: NftId("0.0.312/2") + ), + ] + + let tx = TokenClaimAirdropTransaction() + tx.pendingAirdropIds(pendingAirdropIds) + + let resultPendingAirdropIds = tx.pendingAirdropIds + + let nftIds = resultPendingAirdropIds.compactMap { $0.nftId } + let tokenIds = resultPendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertEqual(nftIds.count, 1) + XCTAssertEqual(tokenIds.count, 1) + XCTAssertTrue(tokenIds.contains(TokenId(num: 420))) + XCTAssertTrue(nftIds.contains(TokenId(num: 312).nft(2))) + } + + func testGetSetAddPendingAirdropId() { + let tx = TokenClaimAirdropTransaction() + tx.addPendingAirdropId( + PendingAirdropId.init( + senderId: AccountId(num: 415), + receiverId: AccountId(num: 6), + tokenId: TokenId(num: 312) + )) + + let pendingAirdropIds = tx.pendingAirdropIds + + let tokenIds = pendingAirdropIds.compactMap { $0.tokenId } + + XCTAssertTrue(tokenIds.contains(TokenId(num: 312))) + } +} diff --git a/Tests/HederaTests/TransactionRecordTests.swift b/Tests/HederaTests/TransactionRecordTests.swift index 51bc477d..215a5c5f 100644 --- a/Tests/HederaTests/TransactionRecordTests.swift +++ b/Tests/HederaTests/TransactionRecordTests.swift @@ -85,7 +85,13 @@ internal final class TransactionRecordTests: XCTestCase { ethereumHash: "flook ethereum".data(using: .utf8)!, evmAddress: EvmAddress.fromBytes("0x000000000000000000".data(using: .utf8)!), prngBytes: prngBytes, - prngNumber: prngNumber) + prngNumber: prngNumber, + pendingAirdropRecords: [ + PendingAirdropRecord.init( + pendingAirdropId: PendingAirdropId.init( + senderId: AccountId("0.2.3"), receiverId: AccountId("0.2.3"), tokenId: TokenId("0.0.2009")), + amount: 3) + ]) } internal func testSerialize() throws { diff --git a/Tests/HederaTests/__Snapshots__/TokenAirdropTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenAirdropTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..c5ddf136 --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/TokenAirdropTransactionTests/testSerialize.1.txt @@ -0,0 +1,138 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5006 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +tokenAirdrop { + token_transfers { + token { + tokenNum: 2 + } + nftTransfers { + senderAccountID { + accountNum: 5007 + } + receiverAccountID { + accountNum: 5006 + } + serialNumber: 4 + } + } + token_transfers { + token { + tokenNum: 3 + } + nftTransfers { + senderAccountID { + accountNum: 5008 + } + receiverAccountID { + accountNum: 5007 + } + serialNumber: 1 + } + nftTransfers { + senderAccountID { + accountNum: 5008 + } + receiverAccountID { + accountNum: 5007 + } + serialNumber: 2 + } + nftTransfers { + senderAccountID { + accountNum: 5008 + } + receiverAccountID { + accountNum: 5006 + } + serialNumber: 3 + } + nftTransfers { + senderAccountID { + accountNum: 5007 + } + receiverAccountID { + accountNum: 5006 + } + serialNumber: 4 + } + } + token_transfers { + token { + tokenNum: 4 + } + transfers { + accountID { + accountNum: 5006 + } + amount: 123 + is_approval: true + } + transfers { + accountID { + accountNum: 5006 + } + amount: -1 + } + transfers { + accountID { + accountNum: 5008 + } + amount: 1 + } + nftTransfers { + senderAccountID { + accountNum: 5005 + } + receiverAccountID { + accountNum: 5006 + } + serialNumber: 4 + is_approval: true + } + } + token_transfers { + token { + tokenNum: 5 + } + transfers { + accountID { + accountNum: 5005 + } + amount: -800 + } + transfers { + accountID { + accountNum: 5007 + } + amount: -400 + } + expected_decimals { + value: 3 + } + } + token_transfers { + token { + tokenNum: 5005 + } + transfers { + accountID { + accountNum: 5006 + } + amount: 400 + } + } +} diff --git a/Tests/HederaTests/__Snapshots__/TokenCancelAirdropTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenCancelAirdropTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..c27f5090 --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/TokenCancelAirdropTransactionTests/testSerialize.1.txt @@ -0,0 +1,47 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5006 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +tokenCancelAirdrop { + pending_airdrops { + sender_id { + realmNum: 2 + accountNum: 123 + } + receiver_id { + realmNum: 2 + accountNum: 5 + } + fungible_token_type { + tokenNum: 321 + } + } + pending_airdrops { + sender_id { + realmNum: 2 + accountNum: 134 + } + receiver_id { + realmNum: 2 + accountNum: 6 + } + non_fungible_token { + token_ID { + tokenNum: 321 + } + serial_number: 2 + } + } +} diff --git a/Tests/HederaTests/__Snapshots__/TokenClaimAirdropTransactionTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TokenClaimAirdropTransactionTests/testSerialize.1.txt new file mode 100644 index 00000000..9aead715 --- /dev/null +++ b/Tests/HederaTests/__Snapshots__/TokenClaimAirdropTransactionTests/testSerialize.1.txt @@ -0,0 +1,47 @@ +HederaProtobufs.Proto_TransactionBody: +transactionID { + transactionValidStart { + seconds: 1554158542 + } + accountID { + accountNum: 5006 + } +} +nodeAccountID { + accountNum: 5005 +} +transactionFee: 200000000 +transactionValidDuration { + seconds: 120 +} +tokenClaimAirdrop { + pending_airdrops { + sender_id { + realmNum: 2 + accountNum: 123 + } + receiver_id { + realmNum: 2 + accountNum: 5 + } + fungible_token_type { + tokenNum: 321 + } + } + pending_airdrops { + sender_id { + realmNum: 2 + accountNum: 134 + } + receiver_id { + realmNum: 2 + accountNum: 6 + } + non_fungible_token { + token_ID { + tokenNum: 321 + } + serial_number: 2 + } + } +} diff --git a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt index cc679f92..d16d5385 100644 --- a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt +++ b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize.1.txt @@ -1 +1 @@ -TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: Optional(17 bytes), prngNumber: nil) \ No newline at end of file +TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: Optional(17 bytes), prngNumber: nil, pendingAirdropRecords: [Hedera.PendingAirdropRecord(pendingAirdropId: Hedera.PendingAirdropId(senderId: 0.2.3, receiverId: 0.2.3, tokenId: Optional(0.0.2009), nftId: nil), amount: 3)]) \ No newline at end of file diff --git a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt index 578d36fc..1f79b223 100644 --- a/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt +++ b/Tests/HederaTests/__Snapshots__/TransactionRecordTests/testSerialize2.1.txt @@ -1 +1 @@ -TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: nil, prngNumber: Optional(4)) \ No newline at end of file +TransactionRecord(receipt: Hedera.TransactionReceipt(transactionId: nil, status: SCHEDULE_ALREADY_DELETED, accountId: Optional(1.2.3), fileId: Optional(4.5.6), contractId: Optional(3.2.1), topicId: Optional(9.8.7), topicSequenceNumber: 3, topicRunningHash: Optional(12 bytes), topicRunningHashVersion: 0, tokenId: Optional(6.5.4), totalSupply: 30, scheduleId: Optional(1.1.1), exchangeRates: nil, scheduledTransactionId: Optional(0.0.5006@1554158542.0), serials: Optional([1, 2, 3]), duplicates: [], children: [], nodeId: 0), transactionHash: 5 bytes, consensusTimestamp: 1554158542000000000, contractFunctionResult: Optional(Hedera.ContractFunctionResult(contractId: 1.2.3, evmAddress: nil, errorMessage: nil, bloom: 0 bytes, gasUsed: 0, gas: 0, logs: [], hbarAmount: 0 tℏ, contractFunctionParametersBytes: 0 bytes, bytes: 0 bytes, senderAccountId: nil, contractNonces: [], signerNonce: nil)), transfers: [Hedera.Transfer(accountId: 4.4.4, amount: 5 ℏ)], tokenTransfers: [6.6.6: [1.1.1: 4]], tokenNftTransfers: [4.4.4: [Hedera.TokenNftTransfer(tokenId: 4.4.4, sender: 1.2.3, receiver: 3.2.1, serial: 4, isApproved: true)]], transactionId: 3.3.3@1554158542.0, transactionMemo: "flook", transactionFee: 3000 ℏ, scheduleRef: Optional(3.3.3), assessedCustomFees: [Hedera.AssessedCustomFee(amount: 4, tokenId: Optional(4.5.6), feeCollectorAccountId: Optional(8.6.5), payerAccountIdList: [3.3.3])], automaticTokenAssociations: [Hedera.TokenAssociation(tokenId: 5.4.3, accountId: 3.6.7)], parentConsensusTimestamp: Optional(1554158542000000000), aliasKey: Optional(302a300506032b6570032100e0c8ec2758a5879ffac226a13c0c516b799e72e35141a0dd828f94d37988a4b7), children: [], duplicates: [], ethereumHash: 14 bytes, evmAddress: Optional(0x3078303030303030303030303030303030303030), prngBytes: nil, prngNumber: Optional(4), pendingAirdropRecords: [Hedera.PendingAirdropRecord(pendingAirdropId: Hedera.PendingAirdropId(senderId: 0.2.3, receiverId: 0.2.3, tokenId: Optional(0.0.2009), nftId: nil), amount: 3)]) \ No newline at end of file diff --git a/protobufs b/protobufs index d88484a3..ef281bea 160000 --- a/protobufs +++ b/protobufs @@ -1 +1 @@ -Subproject commit d88484a3b2e2100b1b9a7ed77d476baf80a58303 +Subproject commit ef281bea430bbda1b72188ceb705d7e61462326d