The SDK for interacting with a Hiero based network.
Maintained with ❤️ by LaunchBadge, Hashgraph, and the Hiero community
- Swift v5.6+
- MacOS v10.15+ (2019, Catalina)
- iOS 13+ (2019)
// Package.swift
dependencies: [
.package(url: "https://github.com/hiero-project/hiero-sdk-swift.git", from: "0.36.0")
]See "Adding Package Dependencies to Your App" for help on adding a swift package to an Xcode project.
import Hiero
// connect to the Hedera network
let client = Client.forTestnet()
// query the balance of an account
let ab = try await AccountBalanceQuery()
.accountId(AccountId("0.0.1001")!)
.execute(client)
print("balance = \(ab.balance)")HieroProtobufs are entirely generated.
protoc protoc-gen-swift (from https://github.com/apple/swift-protobuf) protoc-gen-grpc-swift (from https://github.com/grpc/grpc-swift) task (from https://github.com/go-task/task) openSSL 3.4 (from https://openssl-library.org/source/)
Update \protobufs submodule to latest changes.
# Fetch the latest version of the services submodule
# and generate swift code for Hiero protobufs and gRPC.
#
# Note: Append "proto=vX.Y.Z" to fetch a specific version
task submodule:fetch
# e.g. move submodule to v0.61.0 tag
task submodule:fetch proto=v0.61.0See examples for more usage.
# Run an example
$ task example name=<example>
# e.g CreateAccount
$ task example name=CreateAccount
See Tests/README.md for comprehensive testing documentation.
Quick Start:
# Unit tests (no network required)
swift test --filter HieroUnitTests
# Integration tests (requires .env configuration)
swift test --filter HieroIntegrationTests
# All tests
swift test
# Specific test
swift test --filter AccountCreateTransactionUnitTests/test_SerializeEnvironment Setup for Integration Tests:
Create a .env file in the project root:
HIERO_OPERATOR_ID=0.0.1234
HIERO_OPERATOR_KEY=302e020100300506032b657004220420...
HIERO_ENVIRONMENT_TYPE=testnetLocal Node Testing:
For testing against hiero-local-node:
HIERO_OPERATOR_ID=0.0.2
HIERO_OPERATOR_KEY=3030020100300706052b8104000a042204205bc004059ffa2943965d306f2c44d266255318b3775bacfec42a77ca83e998f2
HIERO_ENVIRONMENT_TYPE=local- To contribute, please refer to the Hiero-Ledger's contribution guidelines
- Join our community discussions on discord.
- Users and Maintainers guidelies are located in Hiero-Ledger's roles and groups guidelines.
- Hiero's source code is available under the Apache License, Version 2.0 (Apache-2.0)