iOS / Swift
Get Started or Add to an Existing Project
Getting started with Kinetic is incredibly straightforward. Just follow the steps below to start transacting with a token in your app.
Installation
Using Swift Package Manager
- In Xcode: File > Add Packages...
- Search "https://github.com/kinnytips/kinetic-ios-sdk"
- Choose appropriate Dependency Rule for your needs
- Add Package
Instantiate the Kinetic Client
The Kinetic Client will give you access to all the methods you need to work with a token on the blockchain.
We recommend starting with Devnet before moving on to Mainnet.
import Kinetic
let kinetic = await KineticSdk.setup(
endpoint: "https://kinny-kinetic.azurewebsites.net",
environment: "devnet",
index: 1
)
Don't have an App Index? Register your app on our Onboarding Form so you can get your App Index that allows you to transact with our SDKs.
While you're waiting for confirmation of your App Index, use 1
on devnet so you can get started.
Create Account
You can create accounts randomly or from existing mnemonics or secret keys. Below, we'll make a keypair and use that for creating an account on the blockchain.
let owner = Keypair.random()
let transaction = await kinetic.createAccount(owner: owner)
Close Account
It's good practice to close unneeded accounts. You can only close accounts that you have created and are currently empty.
let transaction = await kinetic.createAccount(account: owner.publicKey)
Check Balance
Check a user balance by passing in the public key of the account you want to check.
The response object includes your total balance as well as detailing all of the Mints and Tokens held by that Public Key.
let balance = await kinetic.getBalance(account: owner.publicKey).balance
Airdrop Funds (devnet)
Send some test funds to a specific Public Key on Devnet.
let airdropSignature = await kinetic.requestAirdrop(account: owner.publicKey).signature
Transfer a token
Transfer a token from a Keypair to any Public Key.
let txSignature = await kinetic.makeTransfer(
amount: "5000",
destination: "BQJi5K2s4SDDbed1ArpXjb6n7yVUfM34ym9a179MAqVo",
owner: owner
).signature
Get Transaction Details
Get the details of any transaction by passing in the transaction signature.
let transactionDetails = await kinetic.getTransaction(signature: txSignature)
Get Solana Explorer URL
let explorerURL = kinetic.getExplorerUrl(path: "account or transaction id string")
Get Account History
Get the full transaction history of any account by passing in the account's Public Key.
let accountHistory = kinetic.getHistory(account: owner.publicKey)
Get Account Info
Easily get the main info of any account by passing in the account's Public Key.
let accountInfo = kinetic.getAccountInfo(account: owner.publicKey)
Get Token Accounts
Get the full list of Token Accounts held by a Keypair on Solana.
let tokenAccounts = kinetic.getTokenAccounts(account: owner.publicKey)
Demos and Starter Kits
Created to help get you up and running as quickly as possible, these projects can be a great reference point when you get stuck or even a starter for your own project. Happy coding!
Coming soon!
Ready for Production?
If your app is ready for production, this is the place for you!
Production
Get your app ready and running on the Solana Mainnet
Contribute
Kinetic iOS SDK
Want to contribute to the Kinetic iOS SDK?
What If I Get Stuck?
Kinny Discord
Join our community.
Was this page helpful to you?
Provide feedback