Latest0.1.0
Homepagehttps://github.com/ZJJeffery/swiftSDK
LicenseMIT
Platformsios 10.0
Authors

First

pod ‘swiftSDK’

Attention:

add use_frameworks! in podfile

After pod install

import swiftSDK in white file you want to use

Attention:

add "openapp.nasnano" for white list so you can jump to NAS nano

Usage

import swiftSDK

1. Debug mode

NASSmartContracts.debug(debug: true) // use the debug net

2. Check wallet APP

if NASSmartContracts.nasNanoInstalled() {
    // if wallet APP is not installed, go to AppStore.
    NASSmartContracts.goToNasNanoAppStore()
}

3. Pay

sn = NASSmartContracts.randomCodeWithLength(length: 32)
let error = NASSmartContracts.payNasWith(nas: 0.000001,
                                     address: "n1a4MqSPPND7d1UoYk32jXqKb5m5s3AN6wB",
                                             sn: sn,
                                           name: "test1",
                                           desc: "desc")
    if error != nil {
        print("(String(describing: error?.userInfo["msg"]))")
        NASSmartContracts.goToNasNanoAppStore()
    }

4. Call contract function

sn = NASSmartContracts.randomCodeWithLength(length: 32)
let error = NASSmartContracts.callWith(nas: 0,
                                    method: "save",
                                    args: ["key111","value111"],
                                    address: "n1zVUmH3BBebksT4LD5gMiWgNU9q3AMj3se",
                                    sn: sn,
                                    name: "test2",
                                    desc: "desc2")
    if error != nil {
        print("(String(describing: error?.userInfo["msg"]))")
        NASSmartContracts.goToNasNanoAppStore()
    }

5. Check status

NASSmartContracts.checkStatusWith(sn: sn, headler: { (dic) in
    print(dic)
}) { (code, msg) in
    print("code:(code),msg:(msg)")
}

Latest podspec

{
    "name": "swiftSDK",
    "version": "0.1.0",
    "summary": "NAS swiftSDK.",
    "description": "swiftSDK",
    "homepage": "https://github.com/ZJJeffery/swiftSDK",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ZJJeffery": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "source": {
        "git": "https://github.com/ZJJeffery/swiftSDK.git",
        "tag": "0.1.0"
    },
    "source_files": [
        "swiftSDK",
        "demo/swiftSDK/*.swift"
    ],
    "exclude_files": "Classes/Exclude"
}

Pin It on Pinterest

Share This