Skip to content

cosmostation/suiswift

Repository files navigation

sui swift

iOS SDK for SUI

Requirement

  • iOS 13
  • Swift

Dependency

Swift Package Manager

You can use The Swift Package Manager to install SuiSwift by adding the proper description to your Package.swift file:

dependencies: [
    .package(url: "https://github.com/cosmostation/suiswift.git", .branch("main"))
]

CocoaPods

You can use CocoaPods to install SuiSwift by adding it to your Podfile:

platform :ios, '13.0'
use_frameworks!

target 'MyApp' do
    pod 'SuiSwift'
end

API

Using api like below.

SuiCLient.shared.{API}

Generate new mnemonic

public func generateMnemonic() -> String?

Get address from mnemonic

public func getAddress(_ mnemonic: String)  -> String

Sign data

public func sign(_ mnemonic: String, _ txBytes: Data) -> (pubKey: Data, signedData: Data)

Get objects by address

public func getObjectsByOwner(_ address: String, _ listener: @escaping (JSON?) -> Void)

Get transactions

public func getTransactions(
        _ transactionQuery: [String: String],
        _ nextOffset: String? = nil,
        _ limit: Int? = nil,
        _ descending: Bool = false,
        _ listener: @escaping (JSON?) -> Void
    )

Get transaction details from transaction digests

public func getTransactionDetails(_ digests: [String], _ listener: @escaping (JSON?) -> Void)

Faucet

public func faucet(_ address: String)

Transfer sui object

public func transferObject(
        _ objectId: String,
        _ receiver: String,
        _ gasBudget: Int = 100,
        _ amount: Int? = nil,
        _ listener: @escaping (JSON?) -> Void
    )

Execute signed transaction

public func executeTransaction(
        _ txBytes: Data,
        _ signedBytes: Data,
        _ pubKey: Data,
        _ listener: @escaping (JSON?) -> Void
    )