Cryptohopper-iOS-SDK 1.0.39

Cryptohopper-iOS-SDK 1.0.39

CI’ 维护。



  • 作者:
  • Kaan

Cryptohopper iOS SDK -> Swift 5

将以下行添加到您的 Podfile 中:

pod 'Cryptohopper-iOS-SDK'

然后在您的目录上运行安装命令

pod install

在您的应用中集成 SDK

import Cryptohopper-iOS-SDK

在您的 AppDelegate 文件的 didFinishLaunchingdidFinishLaunchingWithOptions 方法中初始化 Cryptohopper SDK

CryptoHopperConfig.configure(clientId: "YOUR_CLIENT_ID_HERE", environment : HopperAPIEnvironment.Production)

将 "YOUR_CLIENT_ID_HERE" 字符串替换为 Cryptohopper 给您的客户端 ID。如果您没有,您可以在此请求:https://www.cryptohopper.com/api-documentation/introduction

上下文

SDK 中有 8 个不同的上下文,您可以从中请求数据,它们是:

CryptohopperAuth
CryptohopperHopper
CryptohopperMarketplace
CryptohopperUser
CryptohopperTemplate
CryptohopperExchange
CryptohopperStrategy
CryptohopperPurchase

上述每个上下文都有一个静态方法,您可以从内部看到。

示例使用

示例登录请求

CryptohopperAuth.login(username: "testUsername", password: "testPassword") { (result) in
    switch(result){
    case .success(let successStr):
        //After this method succeed you can request other context's methods that required authenticataion. No need to store any credentials . Everything is handled by the SDK
        print("Loged-in successfully")
    case .failure(let err):
        print(err)
    }
}