Skip to content

Commit

Permalink
web3.utils unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
super053 committed May 8, 2020
1 parent ef7c835 commit f7b3514
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
Binary file not shown.
23 changes: 23 additions & 0 deletions Web3Objc/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#import "AppDelegate.h"
#import "PKWeb3Objc.h"

@interface AppDelegate ()

Expand All @@ -17,6 +18,28 @@ @implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

/**test
web3 init
*/
PKWeb3Objc *web3 = [PKWeb3Objc sharedInstance];
[web3 setEndPoint:@"https://ropsten.infura.io/v3/a9ef185dce6344ef8b18af3606320420" AndChainID:@"3"];

/**test
web3.utils
*/
NSLog(@"randomHex 32 : %@", [web3.utils randomHex:32]);
NSLog(@"sha3 : %@", [web3.utils sha3:@"hello world"]);
NSLog(@"keccak256 : %@", [web3.utils keccak256:@"hello world"]);
NSLog(@"toChecksumAddress : %@", [web3.utils toChecksumAddress:[@"0xbef705eE6a72Cd35C2ED6b657dD4aC2c0AAB82b6" lowercaseString]]);
NSLog(@"checkAddressChecksum : %@", [web3.utils checkAddressChecksum:@"0xbef705eE6a72Cd35C2ED6b657dD4aC2c0AAB82b6"] ? @"true" : @"false");
NSLog(@"numberToHex : %@", [web3.utils numberToHex:@"1000"]);
NSLog(@"hexToNumber : %@", [web3.utils hexToNumber:@"0x123"]);
NSLog(@"utf8ToHex : %@", [web3.utils utf8ToHex:@"hello world"]);
NSLog(@"hexToUtf8 : %@", [web3.utils hexToUtf8:@"0x68656c6c6f20776f726c64"]);
NSLog(@"toWei : %@", [web3.utils toWei:@"10" WithUnit:@"ether"]);
NSLog(@"fromWei : %@", [web3.utils fromWei:@"1000000" WithUnit:@"ether"]);

return YES;
}

Expand Down

0 comments on commit f7b3514

Please sign in to comment.