基于SimpleWallet 协议的SDK
Switch branches/tags
Nothing to show
Clone or download
Latest commit 371970d Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
MathWalletDemos.xcodeproj 添加TRON Dec 4, 2018
MathWalletDemos 添加TRON Dec 4, 2018
MathWalletSDK update Dec 4, 2018
README.md Update README.md Nov 12, 2018
README_EN.md EN Sep 28, 2018
README_KO.md Update README_KO.md Sep 28, 2018
plist.jpeg update Sep 26, 2018
urlschemes.jpeg update Sep 26, 2018

README.md

MathWalletSDK-iOS

基于SimpleWallet协议的iOS SDK

支持公链 ETH,EOS,EOSFORCE 等

English Readme

Korean Readme

如何使用?

1、配置URL Schemes

Xcode工程info.plist-> URL types -> URL Schemes

URL Schemes

iOS9以上需要在info.plist进行如下设置:

URL Schemes

2、注册URL Schemes和处理URL

#import <MathWalletSDK/MathWalletSDK.h>
  
  
@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [MathWalletAPI registerAppURLSchemes:@"mathwalletdemos"];
    return YES;
}


-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
    BOOL handle = [MathWalletAPI handleURL:url result:^(MathWalletResp *resq) {
        NSLog(@"%@",resq.data);
    }];
    return handle;
}

@end

3、使用MathWallet进行登录操作

  MathWalletLoginReq *loginReq = [[MathWalletLoginReq alloc] init];
  // 公链标识
  loginReq.blockchain = @"eosio";   // eosio、eosforce、ethereum
  // DApp信息
  loginReq.dappIcon = @"http://www.mathwallet.org/images/download/wallet_cn.png";
  loginReq.dappName = @"Demos";
  // DApp Server
  loginReq.uuID = @"本次登录uid";
  loginReq.loginUrl = @"登录回调";
  loginReq.expired = [NSNumber numberWithLong:([NSDate date].timeIntervalSince1970 + 60)];
  loginReq.loginMemo = @"Memo";

  [MathWalletAPI sendReq:loginReq];

4、使用MathWallet进行转账操作

  MathWalletTransferReq *transferReq = [[MathWalletTransferReq alloc] init];
  // 公链标识
  transferReq.blockchain = @"eosio";  // eosio、eosforce、ethereum
  // DApp信息
  transferReq.dappIcon = @"http://www.mathwallet.org/images/download/wallet_cn.png";
  transferReq.dappName = @"Demos";
  // 转账信息
  transferReq.from = @"eosioaccount";
  transferReq.to = @"eosioaccount";
  transferReq.amount = @"1.0000";
  transferReq.precision = @(4);
  transferReq.symbol = @"EOS";
  transferReq.contract = @"eosio.token";
  transferReq.dappData = @"备注";

  transferReq.desc = @"这是展示在钱包中的描述";
  transferReq.expired = [NSNumber numberWithLong:([NSDate date].timeIntervalSince1970 + 60)];
  
  [MathWalletAPI sendReq:transferReq];

5、使用MathWallet进行自定义交易操作(执行合约)

  MathWalletTransactionReq *transactionReq = [[MathWalletTransactionReq alloc] init];
  // 公链标识
  transactionReq.blockchain = @"eosio";
  // DApp信息
  transactionReq.dappIcon = @"http://www.mathwallet.org/images/download/wallet_cn.png";
  transactionReq.dappName = @"Demos";
  // 转账信息
  transactionReq.from = @"testaccount1";
  transactionReq.actions = @[
                          @{
                              @"code":@"eosio.token",
                              @"action":@"transfer",
                              @"binargs":@"4086089a7ad7bef6c0a6eb6c1acda891010000000000000004454f530000000006e5a487e6b3a8"
                              }
                          ];

  transactionReq.desc = @"这是展示在钱包中的描述";
  transactionReq.expired = [NSNumber numberWithLong:[NSDate date].timeIntervalSince1970];
  [MathWalletAPI sendReq:transactionReq];

6、使用MathWallet 打开DApp

    MathWalletOpenURLReq *openURLReq = [[MathWalletOpenURLReq alloc] init];
    // 公链标识
    openURLReq.blockchain = @"eosio";
    // DApp信息
    openURLReq.dappIcon = @"http://www.mathwallet.org/images/download/wallet_cn.png";
    openURLReq.dappName = @"Demos";
    // 转账信息
    openURLReq.dappUrl = @"http://www.redpacketeos.com";
    openURLReq.desc = @"这是展示在钱包中的描述";
    [MathWalletAPI sendReq:openURLReq];