Swift implementation of the Nimiq RPC client specs.
Initialize a NimiqClient
object using predefined configuration and get the current block number.
let config = Config(
scheme: "http",
host: "127.0.0.1",
port: 8648,
user: "luna",
password: "moon"
)
let client = NimiqClient(config: config)
// make rpc call to get current block number
let blockNumber = try client.blockNumber()!
print(blockNumber)
Note: When no config
object is passed in the initialization it will use default values in the Nimiq node.
The complete API documentation is available here.
Check out the original Nimiq RPC specs for the behind-the-scenes RPC calls.
To integrate NimiqClient in your app with SPM. Just add the package as a dependency:
import PackageDescription
let package = Package(
name: "MyApp",
dependencies: [
.package(url: "https://github.com/nimiq-community/swift-client", from: "0.0.1"),
]
)
To use CocoaPods, add the following to your Podfile
:
pod 'NimiqClient'
To use Carthage, add the following to your Cartfile
:
github "nimiq-community/swift-client"
After cloning the repository, open the project bundle NimiqClient.xcodeproj
in Xcode.
All done, happy coding!
You need a start a Testnet Nimiq node:
nodejs index.js --protocol=dumb --type=full --network=test --rpc
All tests are in the /Tests
folder and can be run from Xcode.
The documentation is generated automatically with Jazzy.
To generate the documentation first install Jazzy:
gem install jazzy
Then generate the documentation running Jazzy from the repository root directory:
jazzy
Add a blank file in the /docs
folder with the name .nojekyll
for the documentation hosted on GitHub Pages:
touch docs/.nojekyll
This implementation was originally contributed by rraallvv.
Bug reports and pull requests are welcome! Please refer to the issue tracker for ideas.
link |
Stars: 1 |
Last commit: 3 years ago |
Initial implementation of the Nimiq RPC client in Swift written by @rraallvv. Thank you!!
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics