A Swift Framework build for the Ark Ecosystem

Related tags

Unofficial SDK ad
Overview

Platform: iOS 8+ Language: Swift 4 CocoaPods compatible License: MIR

Introduction

Overview

SwiftyArk is a simple, lightweight framework for the Ark Ecosystem. SwiftyArk provides a simple wrapper for accessing Ark accounts, delegates, block, and transaction information.

SwiftyArk's networking component is fully asynchronous and have extensive error handling. SwiftyArk data structures are type-safe and favor immutability.

Requirements

  • iOS 8.0+
  • mac OSX 10.10+
  • Swift 3.0

Documentation

SwiftyArk is 100% documented and available here

Getting Started:

The Ark APi is accessed with the ArkManager:

let manager = ArkManager()

ArkManager handles all network calls and returns results asynchronous in a closure:

manager.delegates { (error, delegates) in
   if let arkError = error {
        print(arkError.localizedDescription)
           return
    }

    if let currentDelegates = delegates {
    	// List of delegates
     }
}

With the manager instance, you can access an account:

manager.account(address: "AUexKjGtgsSpVzPLs6jNMM6vJ6znEVTQWK") { (error, arkAccount) in
  if let account = arkAccount {
       // Account(address: "AUexKjGtgsSpVzPLs6jNMM6vJ6znEVTQWK",
       // unconfirmedBalance: 16118512.398923151,
       // balance: 16118512.398923151,
       // publicKey: "02ff171adaef486b7db9fc160b28433d20cf43163d56fd28fee72145f0d5219a4b",
       // unconfirmedSignature: Optional(0),
       // secondSignature: Optional(0),
       // multisignatures: Optional([]),
       // secondPublicKey: nil,
       // unconfirmedMultisignatures: Optional([]))
   }
}

The manager instance can store a session for easy accessing of an address/delegate:

manager.delegate("jarunik") { (error, delegate) in
   if let arkDelegate = delegate {
		// Delegate(username: "jarunik", 
		// address: "Aasu14aTs9ipZdy1FMv7ay1Vqn3jPskA8t", 
		// publicKey: "02c7455bebeadde04728441e0f57f82f972155c088252bf7c1365eb0dc84fbf5de",
		// votes: 1246983.70585494,
		// producedblocks: 
		// 28670, 
		// missedblocks: 61, 
		// rate: 47, 
		// approval: 0.970000029, 
		// productivity: 99.7900009)
       // Update the session settings with delegate
       manager.updateSettings(delegate: arkDelegate)
   }
}

With the stored session credentials, you can easily access acccount information:

 manager.lastBlock { (error, block) in
    if let lastBlock = block {
    	 // Block(id: "3725283905614253778",
    	 // version: 0,
    	 // timestamp: 2017-09-19 00:48:48 +0000,
    	 // height: 1948928,
    	 // previousBlock: "17490567348134875423",
    	 // numberOfTransactions: 0,
    	 // totalAmount: 0.0,
    	 // totalFee: 0.0,
    	 // reward: 2.0,
    	 // payloadLength: 0,
    	 // payloadHash: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    	 // generatorPublicKey: "#{key}",
    	 // generatorId: "ARAq9nhjCxwpWnGKDgxveAJSijNG8Y6dFQ",
    	 // blockSignature: "#{signature}",
    	 // confirmations: 27,
    	 // totalForged: 2.0)
    }
 }

SwiftyArk supports creating and sending new transactions:

 manager.sendTransaction("recipientAddress", amount: 100.0, passphrase: "passphrase", secondPassphrase: "secondPassphrase", vendorField: "my message") { (error, response) in
     // response
}

With SwiftyArk, you can also vote/unvote for a delegate:

manager.delegate("jarunik") { (error, delegate) in
    if let jarunik = delegate {
        manager.sendVote(jarunik, passphrase: "passphrase", secondPassphrase: "optionalSecondPassphrase") { (error, response) in
        	// response
        }
    }
}

SwiftyArk also has a built in Ark Ticker provided by CoinMarketCap with support for 31 currencies:

manager.ticker(currency: .cad) { (error, ticker) in
   if let canadianTicker = ticker {
        // Ticker(currency: SwiftyArk.Currency.cad,
        // id: "ark",
        // name: "Ark",
        // symbol: "ARK",
        // rank: 20,
        // price: 4.3638476501000003,
        // bitcoinPrice: 0.00088648999999999998,
        // volume24Hour: 5406421.2865599999,
        // marketCap: 426120847.0,
        // availableSupply: 97647966.0,
        // totalSupply: 128897966.0,
        // percentChange1h: -3.7999999999999998,
        // percentChange24h: 1.8700000000000001,
        // percentChange7d: -1.1100000000000001)
   }
}

Installation

Cocoapods:

SwiftyArk is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftyArk"

In your project, be sure to import SwiftyArk in your project header:

import SwiftyArk

Manual Installation:

Simply copy the contents of the Source folder into your project.

License

SwiftyArk is available under the MIT license. See the LICENSE file for more info.

Author

If you have any questions, requests, or enhancements, feel free to submit a pull request, create an issue, or contact me in person:

Andrew Walz [email protected]

Support

SwiftyArk is 100% open source and made with ❤️ . If you would like to contribute:

Ark Address: AYdHH5TsZF796pv7gxVU1tK6DLkUxMK1VL

Bitcoin Address: 16HPSJkzaQWWYyATrAnzCiLCQ2GSJETJbL

Sponsors

Delegate Sponsor - Jarunik

You might also like...
A Swift wrapper for Foursquare API. iOS and OSX.

Das Quadrat Das Quadrat is Foursquare API wrapper written in Swift. Features Supports iOS and OSX. Covers all API endpoints. Authorization process imp

Pokeapi wrapper, written in Swift

PokemonKit What is this? PokemonKit is a swift wrapper for Pokeapi. PokemonKit use Alamofire and PromiseKit for async web requests handling. Usage imp

Unofficial GitHub API client in Swift
Unofficial GitHub API client in Swift

Github.swift ❤️ Support my apps ❤️ Push Hero - pure Swift native macOS application to test push notifications PastePal - Pasteboard, note and shortcut

A swift SDK for Medium's OAuth2 API

Medium SDK - Swift A library to allow access to Medium API for any Swift iOS application. Features Medium.com authorization & token handling Login sta

Swift client for Unsplash
Swift client for Unsplash

Unsplash API client written in Swift. Unsplash offers 2 APIs: Source API (unlimited requests) Official API JSON API (5000 requests / hour) JSON API is

An Elegant Spotify Web API Library Written in Swift for iOS and macOS
An Elegant Spotify Web API Library Written in Swift for iOS and macOS

Written in Swift 4.2 Spartan is a lightweight, elegant, and easy to use Spotify Web API wrapper library for iOS and macOS written in Swift 3. Under th

An Elegant Financial Markets Library Written in Swift
An Elegant Financial Markets Library Written in Swift

Notice As of May 20th, 2017, it appears that Yahoo is dropping support for a few features that BigBoard supports or there is an outage on their end ca

Swift Wrapper For Bittrex API

BittrexApiKit Swift client for Bittrex api. It support all APIs with most recent changes. more info here let api = Bittrex(apikey: "api key", secretke

Instagram API client written in Swift
Instagram API client written in Swift

SwiftInstagram is a wrapper for the Instagram API written in Swift. It allows you to authenticate users and request data from Instagram effortlessly.

Owner
Andrew Walz
Mobile Developer
Andrew Walz
Build Slack apps, in Swift

SlackKit: Slack Apps in Swift Description SlackKit makes it easy to build Slack apps in Swift. It's intended to expose all of the functionality of Sla

Peter Zignego 1k Dec 20, 2022
The Swift-est way to build native mobile apps that connect to Salesforce.

Swiftly Salesforce is the Swift-est way to build native mobile apps that connect to Salesforce: Written entirely in Swift. Very easy to install and up

Michael Epstein 131 Nov 23, 2022
A Twitter framework for iOS & OS X written in Swift

Getting Started Installation If you're using Xcode 6 and above, Swifter can be installed by simply dragging the Swifter Xcode project into your own pr

Matt Donnelly 2.4k Dec 30, 2022
👤 Framework to Generate Random Users - An Unofficial Swift SDK for randomuser.me

RandomUserSwift is an easy to use Swift framework that provides the ability to generate random users and their accompanying data for your Swift applic

Wilson Ding 95 Sep 9, 2022
Swift 3 framework for accessing data in Event Registry (http://eventregistry.org/)

PPEventRegistryAPI Swift 3 framework for accessing data in Event Registry (http://eventregistry.org/) Supported API calls Log In Get Event By Identifi

Pavel Pantus 8 Nov 1, 2016
A Slack API Client for the Perfect Server-Side Swift Framework

PerfectSlackAPIClient is an API Client to access the Slack API from your Perfect Server Side Swift application. It is build on top of PerfectAPIClient

Cap.雪ノ下八幡 2 Dec 1, 2019
A Jamf Classic communication framework written in Swift

JamfKit JamfKit is an iOS / macOS / tvOS framework to communicate with the JSS API offered by any Jamf host. Summary Features Installation Carthage Co

Damien R. 40 Mar 31, 2022
ObjectiveFlickr, a Flickr API framework for Objective-C

ObjectiveFlickr ObjectiveFlickr is a Flickr API framework designed for Mac and iPhone apps. OAuth Support ObjectiveFlickr now supports Flickr's new OA

Lukhnos Liu 714 Jan 9, 2023
Wanikani-swift - Unofficial Swift client for the WaniKani API

WaniKani A Swift library and client for the WaniKani REST API. It currently supp

Aaron Sky 5 Oct 28, 2022
AWS Full Stack Swift with Apple CarPlay

This application demonstrates a full-stack Apple CarPlay app that uses Swift for both the UI and the backend services in AWS. The app accesses Lambda functions written in Swift and deployed from Docker images. The app accesses Amazon Location Service and a 3rd party weather api to display information in the vicinity of the user.

AWS Samples 100 Jan 6, 2023