jcc_oc_base_lib 0.1.1

jcc_oc_base_lib 0.1.1

JCCDex 维护。



 
依赖
MJExtension>= 0
WebViewJavascriptBridge>= 0
 

  • 作者
  • GinMu

jcc-oc-base-lib

一个用于与苹果 iOS 区块链钱包操作交互的接口。

Pod version Build Status Coverage Status PRs Welcome

CocoaPods 安装

要使用 CocoaPods 将 jcc_oc_base_lib 集成到您的 Xcode 项目中,在 Podfile 中指定它,然后运行 pod install

pod 'jcc_oc_base_lib'

JTWalletManager API

用于与金玉链节点的 SDK 和金玉联盟链进行交互的接口。目前支持 SWTCBIZAIN 链。

createWallet

#import <jcc_oc_base_lib/JTWalletManager.h>
#import <jcc_oc_base_lib/JingtumWallet.h>
#import <jcc_oc_base_lib/JccChains.h>

// create swtc wallet
NSString *chain = SWTC_CHAIN;
// create bizain wallet
// NSString *chain = BIZAIN_CHAIN;

[[JTWalletManager shareInstance] createWallet:chain completion:^(NSError *error, JingtumWallet *wallet) {
    // create successfully if the error is nil.
}];

importSecret

// import swtc secret
NSString *chain = SWTC_CHAIN;
// import bizain secret
// NSString *chain = BIZAIN_CHAIN;

NSString *secret = @"";

[[JTWalletManager shareInstance] importSecret:secret chain:chain completion:^(NSError *error, JingtumWallet *wallet) {
    // import succesfully if the error is nil.
}];

isValidSecret

NSString *chain = SWTC_CHAIN;
// NSString *chain = BIZAIN_CHAIN;

NSString *secret = @"";

[[JTWalletManager shareInstance] isValidSecret:secret chain:chain completion:^(BOOL isValid) {
    // the isValid is YES if the secret is valid.
}];

isValidAddress

NSString *chain = SWTC_CHAIN;
// NSString *chain = BIZAIN_CHAIN;

NSString *address = @"";

[[JTWalletManager shareInstance] isValidAddress:address chain:chain completion:^(BOOL isValid) {
    // the isValid is YES if the address is valid.
}];

sign

// transaction data
NSMutableDictionary *transaction = [[NSMutableDictionary alloc] initWithCapacity:0];

NSString *secret = @"";

// sign transaction data of swtc chain
NSString *chain = SWTC_CHAIN;
// sign transaction data of bizain chain
// NSString *chain = BIZAIN_CHAIN;

[_jtWalletManager sign:transaction secret:secret chain:chain completion:^(NSError *error, NSString *signature) {
    // the error is nil if locally sign successfully.
}];