Swiftpack.co - software-mansion/starknet.swift as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by software-mansion.
software-mansion/starknet.swift v0.3.0
StarkNet SDK for Swift language
⭐️ 14
🕓 2 hours ago
iOS macOS
.package(url: "https://github.com/software-mansion/starknet.swift.git", from: "v0.3.0")

alt text

starknet.swift

StarkNet SDK for Swift to interact with the starknet rpc nodes.

Installation

XCode

In XCode, go to your project, then select Package Dependencies tab. Click the + button, and in the window that just appeared search for starknet.swift package or paste the following url directly: https://github.com/software-mansion/starknet.swift. Select package and install it.

Swift Package Manager

Just add the package to the dependencies array in your Package.swift file:

dependencies: [
  ...
  .package(url: "https://github.com/software-mansion/starknet.swift.git", from: "0.1.0")
]

Then add `starknet.swift` to the dependencies array of every target you want to use the package in.

Documentation

You can find the documentation of the project here.

Demo app

In the Examples folder you can find a demo ios application.

Before running it, make sure to run starknet devnet with given configuration:

starknet-devnet --port 5050 --seed 0

and run the demo app on ios simulator, to be able to access the local devnet instance.

Development

Git hooks

Install hooks by running install_hooks.sh script from Scripts folder.

Code formatting

This project uses SwiftFormat for linting and formatting code. You can install it by running brew install swiftformat. Unformatted code will be rejected by pre push hook and lint github action. To format code in the project, run

swiftformat .

in main project directory.

Testing

Due to reliability on starknet-devnet for testing, tests can only be ran on macos targets. Additionaly you'll need to set two environment variables. DEVNET_PATH that points to starknet-devnet cli, and STARKNET_PATH that points to starknet cli. You can set them in xcode scheme or by running these commands:

export DEVNET_PATH="$(which starknet-devnet)"
export STARKNET_PATH="$(which starknet)"

This assumes you already have installed starknet-devnet and cairo-lang python packages.

Binary dependencies

This project depends on two binary frameworks.

  • crypto-cpp from starkware, with c bindings. Compiled for ios and macosx targets. Built in this repo
  • generate_k method, from starknet-rs sdk, wrapped in a c binding. Compiled for ios and macosx targets. Built in this repo

Acknowledgements

This product includes software developed by the "Marcin Krzyzanowski" (http://krzyzanowskim.com/).

GitHub

link
Stars: 14
Last commit: 12 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

v0.3.0
12 hours ago

🎉 Starknet.swift v3 🎉

This version introduces more methods for reading starknet state.

Precisely for:

  • fetching transactions
  • fetching transaction receipts
  • fetching starknet events

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics