该SDK用于拉起PocketECO钱包,实现登陆,转账以及其他相关action操作。
-
iOS最低支持版本为iOS8
-
PocketECO版本需大于3.3.0
-
添加
PESDK.framework
到你的项目 -
在Build settings -> Other Linker Flags, 加入 -ObjC
-
注册URL Schemes 在Info -> URL types 注册一个scheme
-
设置白名单 在info.plist -> LSApplicationQueriesSchemes中添加pocketeos
#import <PESDK/PESDK.h>
[PEApi registerAppID:@"pesdkDemo"];
PEReq *req = [[PEReq alloc] init];
req.dappIcon = @"iconURL";
req.dappName = @"PESDKDemo";
req.expired = @(1569895200);
req.blockchain = PEBlockChainEOS;
req.action = @"login";
req.serialNumber = @"xxxx";
[PEApi sendReq:req];
/**
* param 值为 url encode后的 json字符串
*/
window.location.href = "pocketeos://?param='%7B%0A%20%20%22action%22%20:%20%22login%22......'"
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
[PEApi handleURL:url delegate:self];
return YES;
}
{
result = 0,
ref = "PocketECO",
action = "login/transfer/pushTransactions",
protocol = "pe_sdk",
serialNumber = "10001",
version = "1.0",
}
{
account = "zhoiyingbind",
ref = "PocketECO",
protocol = "pe_sdk",
action = "login",
result = 1,
serialNumber = "10001",
public_key = "EOS5T4N5nMpV6hR8BctkAFoL3mZyyuRrW6dpZVdBA8t3MkByB3ouV",
version = "1.0",
sign = "SIG_K1_KknA1Lq8YrpP3GBgSd8vXyihxvgdgipwC4y3kKp3MraWKXqaj5fJs8cza3fsQ5yUzy2PfTpEWKoJoZNw55qdYS1KrVS5TZ",
timestamp = 1553223454310,
}
{
action = "transfer",
ref = "PocketECO",
protocol = "pe_sdk",
serialNumber = "10002",
result = 1,
message = "ok",
version = "1.0",
timestamp = 1553223694214,
txID = "62d14716681197f80950001b22522a00202427d216d25c4725da3ea44427f486",
}
{
action = "pushTransactions",
ref = "PocketECO",
protocol = "pe_sdk",
serialNumber = "10003",
result = 1,
message = "ok",
version = "1.0",
timestamp = 1553223802747,
txID = "7849fd2d77c063b0bdc3a73c9f1472eaf83e3a00cd7eae4cdef4461ef2e30093",
}