跳到主要内容

初始化

创建 UniPassSDK 实例

通过传入自定义的配置信息 UniPassSDKOptions:

let unipass = UniPassSDK(UniPassSDKOptions)

参数

UniPassSDKOptions

属性类型是否必须描述
environmentUniPassSDK.EnvironmentSDK 网络类型 Mainnet 或 Testnet
contextUIKit.UIViewController应用上下文
walletUrlString钱包 URL,默认 https://testnet.wallet.unipass.id
appSettingsUniPassSDK.UniPassSDKAppSettingsApp自定义配置 用于页面展示 (logo, name, 主题等)

App自定义设置

public class UniPassSDKAppSetting: NSObject {
public var chain: ChainType = .polygon
public var appName: String?
public var appIcon: String?
public var theme: UniPassTheme = .dark
}

public enum ChainType: String {
case eth
case polygon
case bsc
case rangers
case scroll
}

public enum UniPassTheme: String {
case light
case dark
case cassava
}

代码示例

   // init app setting
let setting = UniPassSDKAppSetting()
setting.appName = "testWallect"
setting.chain = .polygon
setting.theme = .dark

// init sdk option
let option = UniPassSDKOption()
option.environment = .Testnet
option.appSetting = setting
option.context = self

// init UniPassSDK
let unipassSdk = UniPassSDK(sdkOption: option)