├── .gitignore ├── CoboSDK.framework ├── .DS_Store ├── CoboSDK ├── Headers │ ├── CoboSDK-Swift.h │ └── CoboSDK.h ├── Info.plist └── Modules │ ├── .DS_Store │ ├── CoboSDK.swiftmodule │ ├── arm.swiftdoc │ ├── arm.swiftmodule │ ├── arm64.swiftdoc │ ├── arm64.swiftmodule │ ├── i386.swiftdoc │ ├── i386.swiftmodule │ ├── x86_64.swiftdoc │ └── x86_64.swiftmodule │ └── module.modulemap ├── CoboSDK.podspec ├── Docs ├── README.en-us.md ├── queries-schemes.png └── url-types.png ├── Example ├── .gitignore ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Example.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ ├── ViewController.swift │ └── abi.json ├── Podfile └── Podfile.lock └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | 70 | .DS_store 71 | -------------------------------------------------------------------------------- /CoboSDK.framework/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/.DS_Store -------------------------------------------------------------------------------- /CoboSDK.framework/CoboSDK: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/CoboSDK -------------------------------------------------------------------------------- /CoboSDK.framework/Headers/CoboSDK-Swift.h: -------------------------------------------------------------------------------- 1 | // Generated by Apple Swift version 4.1.2 (swiftlang-902.0.54 clang-902.0.39.2) 2 | #pragma clang diagnostic push 3 | #pragma clang diagnostic ignored "-Wgcc-compat" 4 | 5 | #if !defined(__has_include) 6 | # define __has_include(x) 0 7 | #endif 8 | #if !defined(__has_attribute) 9 | # define __has_attribute(x) 0 10 | #endif 11 | #if !defined(__has_feature) 12 | # define __has_feature(x) 0 13 | #endif 14 | #if !defined(__has_warning) 15 | # define __has_warning(x) 0 16 | #endif 17 | 18 | #if __has_include() 19 | # include 20 | #endif 21 | 22 | #pragma clang diagnostic ignored "-Wauto-import" 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #if !defined(SWIFT_TYPEDEFS) 29 | # define SWIFT_TYPEDEFS 1 30 | # if __has_include() 31 | # include 32 | # elif !defined(__cplusplus) 33 | typedef uint_least16_t char16_t; 34 | typedef uint_least32_t char32_t; 35 | # endif 36 | typedef float swift_float2 __attribute__((__ext_vector_type__(2))); 37 | typedef float swift_float3 __attribute__((__ext_vector_type__(3))); 38 | typedef float swift_float4 __attribute__((__ext_vector_type__(4))); 39 | typedef double swift_double2 __attribute__((__ext_vector_type__(2))); 40 | typedef double swift_double3 __attribute__((__ext_vector_type__(3))); 41 | typedef double swift_double4 __attribute__((__ext_vector_type__(4))); 42 | typedef int swift_int2 __attribute__((__ext_vector_type__(2))); 43 | typedef int swift_int3 __attribute__((__ext_vector_type__(3))); 44 | typedef int swift_int4 __attribute__((__ext_vector_type__(4))); 45 | typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2))); 46 | typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3))); 47 | typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4))); 48 | #endif 49 | 50 | #if !defined(SWIFT_PASTE) 51 | # define SWIFT_PASTE_HELPER(x, y) x##y 52 | # define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y) 53 | #endif 54 | #if !defined(SWIFT_METATYPE) 55 | # define SWIFT_METATYPE(X) Class 56 | #endif 57 | #if !defined(SWIFT_CLASS_PROPERTY) 58 | # if __has_feature(objc_class_property) 59 | # define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__ 60 | # else 61 | # define SWIFT_CLASS_PROPERTY(...) 62 | # endif 63 | #endif 64 | 65 | #if __has_attribute(objc_runtime_name) 66 | # define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X))) 67 | #else 68 | # define SWIFT_RUNTIME_NAME(X) 69 | #endif 70 | #if __has_attribute(swift_name) 71 | # define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X))) 72 | #else 73 | # define SWIFT_COMPILE_NAME(X) 74 | #endif 75 | #if __has_attribute(objc_method_family) 76 | # define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X))) 77 | #else 78 | # define SWIFT_METHOD_FAMILY(X) 79 | #endif 80 | #if __has_attribute(noescape) 81 | # define SWIFT_NOESCAPE __attribute__((noescape)) 82 | #else 83 | # define SWIFT_NOESCAPE 84 | #endif 85 | #if __has_attribute(warn_unused_result) 86 | # define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) 87 | #else 88 | # define SWIFT_WARN_UNUSED_RESULT 89 | #endif 90 | #if __has_attribute(noreturn) 91 | # define SWIFT_NORETURN __attribute__((noreturn)) 92 | #else 93 | # define SWIFT_NORETURN 94 | #endif 95 | #if !defined(SWIFT_CLASS_EXTRA) 96 | # define SWIFT_CLASS_EXTRA 97 | #endif 98 | #if !defined(SWIFT_PROTOCOL_EXTRA) 99 | # define SWIFT_PROTOCOL_EXTRA 100 | #endif 101 | #if !defined(SWIFT_ENUM_EXTRA) 102 | # define SWIFT_ENUM_EXTRA 103 | #endif 104 | #if !defined(SWIFT_CLASS) 105 | # if __has_attribute(objc_subclassing_restricted) 106 | # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA 107 | # define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 108 | # else 109 | # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 110 | # define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA 111 | # endif 112 | #endif 113 | 114 | #if !defined(SWIFT_PROTOCOL) 115 | # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA 116 | # define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA 117 | #endif 118 | 119 | #if !defined(SWIFT_EXTENSION) 120 | # define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__) 121 | #endif 122 | 123 | #if !defined(OBJC_DESIGNATED_INITIALIZER) 124 | # if __has_attribute(objc_designated_initializer) 125 | # define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer)) 126 | # else 127 | # define OBJC_DESIGNATED_INITIALIZER 128 | # endif 129 | #endif 130 | #if !defined(SWIFT_ENUM_ATTR) 131 | # if defined(__has_attribute) && __has_attribute(enum_extensibility) 132 | # define SWIFT_ENUM_ATTR __attribute__((enum_extensibility(open))) 133 | # else 134 | # define SWIFT_ENUM_ATTR 135 | # endif 136 | #endif 137 | #if !defined(SWIFT_ENUM) 138 | # define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type 139 | # if __has_feature(generalized_swift_name) 140 | # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR SWIFT_ENUM_EXTRA _name : _type 141 | # else 142 | # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) SWIFT_ENUM(_type, _name) 143 | # endif 144 | #endif 145 | #if !defined(SWIFT_UNAVAILABLE) 146 | # define SWIFT_UNAVAILABLE __attribute__((unavailable)) 147 | #endif 148 | #if !defined(SWIFT_UNAVAILABLE_MSG) 149 | # define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg))) 150 | #endif 151 | #if !defined(SWIFT_AVAILABILITY) 152 | # define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__))) 153 | #endif 154 | #if !defined(SWIFT_DEPRECATED) 155 | # define SWIFT_DEPRECATED __attribute__((deprecated)) 156 | #endif 157 | #if !defined(SWIFT_DEPRECATED_MSG) 158 | # define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__))) 159 | #endif 160 | #if __has_feature(attribute_diagnose_if_objc) 161 | # define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning"))) 162 | #else 163 | # define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg) 164 | #endif 165 | #if __has_feature(modules) 166 | #endif 167 | 168 | #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch" 169 | #pragma clang diagnostic ignored "-Wduplicate-method-arg" 170 | #if __has_warning("-Wpragma-clang-attribute") 171 | # pragma clang diagnostic ignored "-Wpragma-clang-attribute" 172 | #endif 173 | #pragma clang diagnostic ignored "-Wunknown-pragmas" 174 | #pragma clang diagnostic ignored "-Wnullability" 175 | 176 | #if __has_attribute(external_source_symbol) 177 | # pragma push_macro("any") 178 | # undef any 179 | # pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="CoboSDK",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol)) 180 | # pragma pop_macro("any") 181 | #endif 182 | 183 | #if __has_attribute(external_source_symbol) 184 | # pragma clang attribute pop 185 | #endif 186 | #pragma clang diagnostic pop 187 | -------------------------------------------------------------------------------- /CoboSDK.framework/Headers/CoboSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // CoboSDK.h 3 | // CoboSDK 4 | // 5 | // Created by Robin Zhang on 2018/5/23. 6 | // Copyright © 2018 Cobo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for CoboSDK. 12 | FOUNDATION_EXPORT double CoboSDKVersionNumber; 13 | 14 | //! Project version string for CoboSDK. 15 | FOUNDATION_EXPORT const unsigned char CoboSDKVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | -------------------------------------------------------------------------------- /CoboSDK.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Info.plist -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/.DS_Store -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm.swiftdoc -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm.swiftmodule -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm64.swiftdoc -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/arm64.swiftmodule -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/i386.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/i386.swiftdoc -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/i386.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/i386.swiftmodule -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/x86_64.swiftdoc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/x86_64.swiftdoc -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/CoboSDK.swiftmodule/x86_64.swiftmodule: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/CoboSDK.framework/Modules/CoboSDK.swiftmodule/x86_64.swiftmodule -------------------------------------------------------------------------------- /CoboSDK.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module CoboSDK { 2 | umbrella header "CoboSDK.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | 8 | module CoboSDK.Swift { 9 | header "CoboSDK-Swift.h" 10 | requires objc 11 | } 12 | -------------------------------------------------------------------------------- /CoboSDK.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'CoboSDK' 3 | s.version = '1.0' 4 | s.summary = 'Dapp SDK to use with Cobo Wallet' 5 | s.homepage = 'https://cobo.com/' 6 | 7 | s.author = { 'Name' => 'xzhang@cobo.com' } 8 | s.license = { "type": "Copyright", "text": "Copyright © 2018 Cobo. All rights reserved." } 9 | 10 | s.platform = :ios 11 | s.source = { :git => 'https://github.com/cobowallet/CoboSDK-iOS.git', :tag => s.version } 12 | 13 | s.ios.deployment_target = '9.0' 14 | s.ios.vendored_frameworks = 'CoboSDK.framework' 15 | s.dependency 'web3swift', '~> 0.8.0' 16 | end -------------------------------------------------------------------------------- /Docs/README.en-us.md: -------------------------------------------------------------------------------- 1 | 2 | # CoboSDK-iOS 3 | CoboSDK help develpers sign and broadcast ethereum transactions using [Cobo Wallet](https://cobo.com/). 4 | Dapp developers can use CoboSDK to get user's ethereum addresses, sign messages, validate the signature, send transaction and call contract. Without the needs of developing private key management and wallet functions. 5 | 6 | ## Get Started 7 | 8 | ### Add dependency 9 | 10 | - Cocoapods 11 | 12 | Add the following line to your `Podfile`: 13 | ```ruby 14 | pod 'CoboSDK' 15 | ``` 16 | then run `$ pod install`. 17 | 18 | - Carthage 19 | ``` 20 | TODO 21 | ``` 22 | 23 | ### Register URL Scheme for your app 24 | Open Xcode and click on you project, click on `TARGETS`, go to the `Info` tab and click on `+` button in `URL Types` section 25 | Enter a custom scheme name in `URL Schemes`. The scheme name should be as unique as possible. 26 | 27 | ![URL Types](url-types.png) 28 | 29 | Register the url scheme to CoboSDK: 30 | ```swift 31 | CoboSDK.shared.setup(callbackScheme: ) 32 | ``` 33 | 34 | ### Add ```LSApplicationQueriesSchemes``` 35 | Add the following lines to ```Info.plist``` file: 36 | ```xml 37 | LSApplicationQueriesSchemes 38 | 39 | cobo-wallet 40 | 41 | ``` 42 | 43 | ![Info.plist](queries-schemes.png) 44 | 45 | ### Handling callbacks 46 | In `AppDelegate`, implement `func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool` to handle callbacks: 47 | ```swift 48 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 49 | return CoboSDK.shared.application(app, open: url, options: options) 50 | } 51 | ``` 52 | 53 | ## Usage 54 | 55 | ### Sign message 56 | ```swift 57 | let message = "Hello Cobo!" 58 | CoboSDK.shared.signMessage(message: message) { result in 59 | switch result { 60 | case .success(let value): 61 | guard let address = value.address, let signature = value.signature else { break } 62 | print(address) 63 | let match = CoboSDK.shared.verifyMessage(address: address, signature: signature, message: message) 64 | print("\(match)") 65 | case .failure(let error): 66 | print(error.localizedDescription) 67 | } 68 | } 69 | ``` 70 | 71 | ### Send transaction 72 | ```swift 73 | let gasPrice = BigUInt(stringLiteral: "1000000000") // 1 Gwei 74 | let gasLimit = BigUInt(21000) 75 | let value = BigUInt(stringLiteral: "1000000000000000000") // 1 ETH 76 | let from = 77 | let to = 78 | 79 | let tx = EthereumTransaction(gasPrice: gasPrice, gasLimit: gasLimit, to: to, value: value, data: Data()) 80 | CoboSDK.shared.sendTransaction(transaction: tx, from: from) { result in 81 | switch result { 82 | case .success(let value): 83 | guard let hash = value.hash, let tx = value.rawTransaction else { break } 84 | print("hash: \(hash)") 85 | case .failure(let error): 86 | print(error.localizedDescription) 87 | } 88 | } 89 | ``` 90 | 91 | For more use cases please refer to the ```Example``` project. -------------------------------------------------------------------------------- /Docs/queries-schemes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/Docs/queries-schemes.png -------------------------------------------------------------------------------- /Docs/url-types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cobowallet/CoboSDK-iOS/7e6ae738b451520729dd443316f97a017d07606e/Docs/url-types.png -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 006E68EC20DB9A3400A22B15 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006E68EB20DB9A3400A22B15 /* AppDelegate.swift */; }; 11 | 006E68EE20DB9A3400A22B15 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 006E68ED20DB9A3400A22B15 /* ViewController.swift */; }; 12 | 006E68F120DB9A3400A22B15 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 006E68EF20DB9A3400A22B15 /* Main.storyboard */; }; 13 | 006E68F320DB9A3500A22B15 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 006E68F220DB9A3500A22B15 /* Assets.xcassets */; }; 14 | 006E68F620DB9A3500A22B15 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 006E68F420DB9A3500A22B15 /* LaunchScreen.storyboard */; }; 15 | 006E68FE20DC89D800A22B15 /* abi.json in Resources */ = {isa = PBXBuildFile; fileRef = 006E68FD20DC89D700A22B15 /* abi.json */; }; 16 | FEAAE7B0C83E29D36CAE03CA /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 447BACA2F170B48DED2587CD /* Pods_Example.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 006E68E820DB9A3400A22B15 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 006E68EB20DB9A3400A22B15 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 006E68ED20DB9A3400A22B15 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 006E68F020DB9A3400A22B15 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 006E68F220DB9A3500A22B15 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 006E68F520DB9A3500A22B15 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 006E68F720DB9A3600A22B15 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 006E68FD20DC89D700A22B15 /* abi.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = abi.json; sourceTree = ""; }; 28 | 447BACA2F170B48DED2587CD /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | 647B1BCAA4925C64C6150D61 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 30 | A56E6704EBE5BAEF6FD3F0E9 /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 006E68E520DB9A3400A22B15 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | FEAAE7B0C83E29D36CAE03CA /* Pods_Example.framework in Frameworks */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 006E68DF20DB9A3400A22B15 = { 46 | isa = PBXGroup; 47 | children = ( 48 | 006E68EA20DB9A3400A22B15 /* Example */, 49 | 006E68E920DB9A3400A22B15 /* Products */, 50 | 510362A90B921EC05D930974 /* Pods */, 51 | 89AFEC43A5417DF341F892D1 /* Frameworks */, 52 | ); 53 | sourceTree = ""; 54 | }; 55 | 006E68E920DB9A3400A22B15 /* Products */ = { 56 | isa = PBXGroup; 57 | children = ( 58 | 006E68E820DB9A3400A22B15 /* Example.app */, 59 | ); 60 | name = Products; 61 | sourceTree = ""; 62 | }; 63 | 006E68EA20DB9A3400A22B15 /* Example */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 006E68FD20DC89D700A22B15 /* abi.json */, 67 | 006E68EB20DB9A3400A22B15 /* AppDelegate.swift */, 68 | 006E68ED20DB9A3400A22B15 /* ViewController.swift */, 69 | 006E68EF20DB9A3400A22B15 /* Main.storyboard */, 70 | 006E68F220DB9A3500A22B15 /* Assets.xcassets */, 71 | 006E68F420DB9A3500A22B15 /* LaunchScreen.storyboard */, 72 | 006E68F720DB9A3600A22B15 /* Info.plist */, 73 | ); 74 | path = Example; 75 | sourceTree = ""; 76 | }; 77 | 510362A90B921EC05D930974 /* Pods */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | A56E6704EBE5BAEF6FD3F0E9 /* Pods-Example.debug.xcconfig */, 81 | 647B1BCAA4925C64C6150D61 /* Pods-Example.release.xcconfig */, 82 | ); 83 | name = Pods; 84 | sourceTree = ""; 85 | }; 86 | 89AFEC43A5417DF341F892D1 /* Frameworks */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 447BACA2F170B48DED2587CD /* Pods_Example.framework */, 90 | ); 91 | name = Frameworks; 92 | sourceTree = ""; 93 | }; 94 | /* End PBXGroup section */ 95 | 96 | /* Begin PBXNativeTarget section */ 97 | 006E68E720DB9A3400A22B15 /* Example */ = { 98 | isa = PBXNativeTarget; 99 | buildConfigurationList = 006E68FA20DB9A3600A22B15 /* Build configuration list for PBXNativeTarget "Example" */; 100 | buildPhases = ( 101 | 2DD75E6B31B3F2B2B1AA292B /* [CP] Check Pods Manifest.lock */, 102 | 006E68E420DB9A3400A22B15 /* Sources */, 103 | 006E68E520DB9A3400A22B15 /* Frameworks */, 104 | 006E68E620DB9A3400A22B15 /* Resources */, 105 | C85D4222EF11C23922D36952 /* [CP] Embed Pods Frameworks */, 106 | ); 107 | buildRules = ( 108 | ); 109 | dependencies = ( 110 | ); 111 | name = Example; 112 | productName = Example; 113 | productReference = 006E68E820DB9A3400A22B15 /* Example.app */; 114 | productType = "com.apple.product-type.application"; 115 | }; 116 | /* End PBXNativeTarget section */ 117 | 118 | /* Begin PBXProject section */ 119 | 006E68E020DB9A3400A22B15 /* Project object */ = { 120 | isa = PBXProject; 121 | attributes = { 122 | LastSwiftUpdateCheck = 0940; 123 | LastUpgradeCheck = 0940; 124 | ORGANIZATIONNAME = Example; 125 | TargetAttributes = { 126 | 006E68E720DB9A3400A22B15 = { 127 | CreatedOnToolsVersion = 9.4.1; 128 | }; 129 | }; 130 | }; 131 | buildConfigurationList = 006E68E320DB9A3400A22B15 /* Build configuration list for PBXProject "Example" */; 132 | compatibilityVersion = "Xcode 9.3"; 133 | developmentRegion = en; 134 | hasScannedForEncodings = 0; 135 | knownRegions = ( 136 | en, 137 | Base, 138 | ); 139 | mainGroup = 006E68DF20DB9A3400A22B15; 140 | productRefGroup = 006E68E920DB9A3400A22B15 /* Products */; 141 | projectDirPath = ""; 142 | projectRoot = ""; 143 | targets = ( 144 | 006E68E720DB9A3400A22B15 /* Example */, 145 | ); 146 | }; 147 | /* End PBXProject section */ 148 | 149 | /* Begin PBXResourcesBuildPhase section */ 150 | 006E68E620DB9A3400A22B15 /* Resources */ = { 151 | isa = PBXResourcesBuildPhase; 152 | buildActionMask = 2147483647; 153 | files = ( 154 | 006E68FE20DC89D800A22B15 /* abi.json in Resources */, 155 | 006E68F620DB9A3500A22B15 /* LaunchScreen.storyboard in Resources */, 156 | 006E68F320DB9A3500A22B15 /* Assets.xcassets in Resources */, 157 | 006E68F120DB9A3400A22B15 /* Main.storyboard in Resources */, 158 | ); 159 | runOnlyForDeploymentPostprocessing = 0; 160 | }; 161 | /* End PBXResourcesBuildPhase section */ 162 | 163 | /* Begin PBXShellScriptBuildPhase section */ 164 | 2DD75E6B31B3F2B2B1AA292B /* [CP] Check Pods Manifest.lock */ = { 165 | isa = PBXShellScriptBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | ); 169 | inputPaths = ( 170 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 171 | "${PODS_ROOT}/Manifest.lock", 172 | ); 173 | name = "[CP] Check Pods Manifest.lock"; 174 | outputPaths = ( 175 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt", 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | shellPath = /bin/sh; 179 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 180 | showEnvVarsInLog = 0; 181 | }; 182 | C85D4222EF11C23922D36952 /* [CP] Embed Pods Frameworks */ = { 183 | isa = PBXShellScriptBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | ); 187 | inputPaths = ( 188 | "${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh", 189 | "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", 190 | "${BUILT_PRODUCTS_DIR}/Alamofire-Synchronous/Alamofire_Synchronous.framework", 191 | "${BUILT_PRODUCTS_DIR}/BigInt/BigInt.framework", 192 | "${PODS_ROOT}/CoboSDK/CoboSDK.framework", 193 | "${BUILT_PRODUCTS_DIR}/CryptoSwift/CryptoSwift.framework", 194 | "${BUILT_PRODUCTS_DIR}/Result/Result.framework", 195 | "${BUILT_PRODUCTS_DIR}/SipHash/SipHash.framework", 196 | "${BUILT_PRODUCTS_DIR}/libsodium/libsodium.framework", 197 | "${BUILT_PRODUCTS_DIR}/secp256k1_ios/secp256k1_ios.framework", 198 | "${BUILT_PRODUCTS_DIR}/web3swift/web3swift.framework", 199 | ); 200 | name = "[CP] Embed Pods Frameworks"; 201 | outputPaths = ( 202 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", 203 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire_Synchronous.framework", 204 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BigInt.framework", 205 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CoboSDK.framework", 206 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CryptoSwift.framework", 207 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework", 208 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SipHash.framework", 209 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/libsodium.framework", 210 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/secp256k1_ios.framework", 211 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/web3swift.framework", 212 | ); 213 | runOnlyForDeploymentPostprocessing = 0; 214 | shellPath = /bin/sh; 215 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n"; 216 | showEnvVarsInLog = 0; 217 | }; 218 | /* End PBXShellScriptBuildPhase section */ 219 | 220 | /* Begin PBXSourcesBuildPhase section */ 221 | 006E68E420DB9A3400A22B15 /* Sources */ = { 222 | isa = PBXSourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | 006E68EE20DB9A3400A22B15 /* ViewController.swift in Sources */, 226 | 006E68EC20DB9A3400A22B15 /* AppDelegate.swift in Sources */, 227 | ); 228 | runOnlyForDeploymentPostprocessing = 0; 229 | }; 230 | /* End PBXSourcesBuildPhase section */ 231 | 232 | /* Begin PBXVariantGroup section */ 233 | 006E68EF20DB9A3400A22B15 /* Main.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | 006E68F020DB9A3400A22B15 /* Base */, 237 | ); 238 | name = Main.storyboard; 239 | sourceTree = ""; 240 | }; 241 | 006E68F420DB9A3500A22B15 /* LaunchScreen.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 006E68F520DB9A3500A22B15 /* Base */, 245 | ); 246 | name = LaunchScreen.storyboard; 247 | sourceTree = ""; 248 | }; 249 | /* End PBXVariantGroup section */ 250 | 251 | /* Begin XCBuildConfiguration section */ 252 | 006E68F820DB9A3600A22B15 /* Debug */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | ALWAYS_SEARCH_USER_PATHS = NO; 256 | CLANG_ANALYZER_NONNULL = YES; 257 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_ENABLE_OBJC_WEAK = YES; 263 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_COMMA = YES; 266 | CLANG_WARN_CONSTANT_CONVERSION = YES; 267 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 268 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 269 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 270 | CLANG_WARN_EMPTY_BODY = YES; 271 | CLANG_WARN_ENUM_CONVERSION = YES; 272 | CLANG_WARN_INFINITE_RECURSION = YES; 273 | CLANG_WARN_INT_CONVERSION = YES; 274 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 275 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 276 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 278 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 279 | CLANG_WARN_STRICT_PROTOTYPES = YES; 280 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 281 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 282 | CLANG_WARN_UNREACHABLE_CODE = YES; 283 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 284 | CODE_SIGN_IDENTITY = "iPhone Developer"; 285 | COPY_PHASE_STRIP = NO; 286 | DEBUG_INFORMATION_FORMAT = dwarf; 287 | ENABLE_STRICT_OBJC_MSGSEND = YES; 288 | ENABLE_TESTABILITY = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu11; 290 | GCC_DYNAMIC_NO_PIC = NO; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_OPTIMIZATION_LEVEL = 0; 293 | GCC_PREPROCESSOR_DEFINITIONS = ( 294 | "DEBUG=1", 295 | "$(inherited)", 296 | ); 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 304 | MTL_ENABLE_DEBUG_INFO = YES; 305 | ONLY_ACTIVE_ARCH = YES; 306 | SDKROOT = iphoneos; 307 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 308 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 309 | }; 310 | name = Debug; 311 | }; 312 | 006E68F920DB9A3600A22B15 /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_ANALYZER_NONNULL = YES; 317 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 318 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 319 | CLANG_CXX_LIBRARY = "libc++"; 320 | CLANG_ENABLE_MODULES = YES; 321 | CLANG_ENABLE_OBJC_ARC = YES; 322 | CLANG_ENABLE_OBJC_WEAK = YES; 323 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 324 | CLANG_WARN_BOOL_CONVERSION = YES; 325 | CLANG_WARN_COMMA = YES; 326 | CLANG_WARN_CONSTANT_CONVERSION = YES; 327 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 328 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 329 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 330 | CLANG_WARN_EMPTY_BODY = YES; 331 | CLANG_WARN_ENUM_CONVERSION = YES; 332 | CLANG_WARN_INFINITE_RECURSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 335 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 336 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 339 | CLANG_WARN_STRICT_PROTOTYPES = YES; 340 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 341 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 342 | CLANG_WARN_UNREACHABLE_CODE = YES; 343 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 344 | CODE_SIGN_IDENTITY = "iPhone Developer"; 345 | COPY_PHASE_STRIP = NO; 346 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 347 | ENABLE_NS_ASSERTIONS = NO; 348 | ENABLE_STRICT_OBJC_MSGSEND = YES; 349 | GCC_C_LANGUAGE_STANDARD = gnu11; 350 | GCC_NO_COMMON_BLOCKS = YES; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 11.4; 358 | MTL_ENABLE_DEBUG_INFO = NO; 359 | SDKROOT = iphoneos; 360 | SWIFT_COMPILATION_MODE = wholemodule; 361 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 362 | VALIDATE_PRODUCT = YES; 363 | }; 364 | name = Release; 365 | }; 366 | 006E68FB20DB9A3600A22B15 /* Debug */ = { 367 | isa = XCBuildConfiguration; 368 | baseConfigurationReference = A56E6704EBE5BAEF6FD3F0E9 /* Pods-Example.debug.xcconfig */; 369 | buildSettings = { 370 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 371 | CODE_SIGN_STYLE = Automatic; 372 | DEVELOPMENT_TEAM = ""; 373 | INFOPLIST_FILE = Example/Info.plist; 374 | LD_RUNPATH_SEARCH_PATHS = ( 375 | "$(inherited)", 376 | "@executable_path/Frameworks", 377 | ); 378 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | SWIFT_VERSION = 4.0; 381 | TARGETED_DEVICE_FAMILY = "1,2"; 382 | }; 383 | name = Debug; 384 | }; 385 | 006E68FC20DB9A3600A22B15 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | baseConfigurationReference = 647B1BCAA4925C64C6150D61 /* Pods-Example.release.xcconfig */; 388 | buildSettings = { 389 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 390 | CODE_SIGN_STYLE = Automatic; 391 | DEVELOPMENT_TEAM = ""; 392 | INFOPLIST_FILE = Example/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = ( 394 | "$(inherited)", 395 | "@executable_path/Frameworks", 396 | ); 397 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | SWIFT_VERSION = 4.0; 400 | TARGETED_DEVICE_FAMILY = "1,2"; 401 | }; 402 | name = Release; 403 | }; 404 | /* End XCBuildConfiguration section */ 405 | 406 | /* Begin XCConfigurationList section */ 407 | 006E68E320DB9A3400A22B15 /* Build configuration list for PBXProject "Example" */ = { 408 | isa = XCConfigurationList; 409 | buildConfigurations = ( 410 | 006E68F820DB9A3600A22B15 /* Debug */, 411 | 006E68F920DB9A3600A22B15 /* Release */, 412 | ); 413 | defaultConfigurationIsVisible = 0; 414 | defaultConfigurationName = Release; 415 | }; 416 | 006E68FA20DB9A3600A22B15 /* Build configuration list for PBXNativeTarget "Example" */ = { 417 | isa = XCConfigurationList; 418 | buildConfigurations = ( 419 | 006E68FB20DB9A3600A22B15 /* Debug */, 420 | 006E68FC20DB9A3600A22B15 /* Release */, 421 | ); 422 | defaultConfigurationIsVisible = 0; 423 | defaultConfigurationName = Release; 424 | }; 425 | /* End XCConfigurationList section */ 426 | }; 427 | rootObject = 006E68E020DB9A3400A22B15 /* Project object */; 428 | } 429 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Example 4 | // 5 | // Created by Robin Zhang on 2018/6/21. 6 | // Copyright © 2018 Example. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoboSDK 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 19 | // Override point for customization after application launch. 20 | CoboSDK.shared.setup(callbackScheme: "com.example.example.cobo") 21 | return true 22 | } 23 | 24 | func applicationWillResignActive(_ application: UIApplication) { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 27 | } 28 | 29 | func applicationDidEnterBackground(_ application: UIApplication) { 30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | func applicationWillEnterForeground(_ application: UIApplication) { 35 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 36 | } 37 | 38 | func applicationDidBecomeActive(_ application: UIApplication) { 39 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 40 | } 41 | 42 | func applicationWillTerminate(_ application: UIApplication) { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 47 | return CoboSDK.shared.application(app, open: url, options: options) 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleURLTypes 20 | 21 | 22 | CFBundleTypeRole 23 | Editor 24 | CFBundleURLSchemes 25 | 26 | com.example.example.cobo 27 | 28 | 29 | 30 | CFBundleVersion 31 | 1 32 | LSApplicationQueriesSchemes 33 | 34 | cobo-wallet 35 | 36 | LSRequiresIPhoneOS 37 | 38 | UILaunchStoryboardName 39 | LaunchScreen 40 | UIMainStoryboardFile 41 | Main 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Example 4 | // 5 | // Created by Robin Zhang on 2018/6/21. 6 | // Copyright © 2018 Example. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoboSDK 11 | import BigInt 12 | import web3swift 13 | import enum Result.Result 14 | 15 | class ViewController: UIViewController { 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | callContract() 21 | } 22 | 23 | override func didReceiveMemoryWarning() { 24 | super.didReceiveMemoryWarning() 25 | // Dispose of any resources that can be recreated. 26 | } 27 | 28 | func signMessage() { 29 | let message = "Hello Cobo!" 30 | CoboSDK.shared.signMessage(message: message) { result in 31 | switch result { 32 | case .success(let value): 33 | guard let address = value.address, let signature = value.signature else { break } 34 | print(address) 35 | let match = CoboSDK.shared.verifyMessage(address: address, signature: signature, message: message) 36 | print("\(match)") 37 | case .failure(let error): 38 | print(error.localizedDescription) 39 | } 40 | } 41 | } 42 | 43 | func signTransaction() { 44 | let gasPrice = BigUInt(stringLiteral: "1000000000") // 1 Gwei 45 | let gasLimit = BigUInt(21000) 46 | let value = BigUInt(stringLiteral: "1000000000000000000") // 1 ETH 47 | let from = EthereumAddress("0x43521682ed93df31610d38930082a7d575e1b19e")! // !!! 48 | let to = EthereumAddress("0x43521682ed93df31610d38930082a7d575e1b19e")! // !!! 49 | 50 | let tx = EthereumTransaction(gasPrice: gasPrice, gasLimit: gasLimit, to: to, value: value, data: Data()) 51 | CoboSDK.shared.sendTransaction(transaction: tx, from: from) { result in 52 | switch result { 53 | case .success(let value): 54 | guard let hash = value.hash else { break } 55 | print("hash: \(hash)") 56 | case .failure(let error): 57 | print(error.localizedDescription) 58 | } 59 | } 60 | } 61 | 62 | func callContract() { 63 | guard let path = Bundle.main.path(forResource: "abi", ofType: "json") else { 64 | print("failed to load api file") 65 | return 66 | } 67 | let w3 = web3(provider: InfuraProvider(Networks.Ropsten)!) 68 | let contractAddress = EthereumAddress("0x725DcFdf065d4e41839E0d3B6b15A7725551B93B")! 69 | let gasPrice = BigUInt(stringLiteral: "1000000000") // 1 Gwei 70 | let gasLimit = BigUInt(40000) 71 | let from = EthereumAddress("0x43521682ed93df31610d38930082a7d575e1b19e")! // !!! 72 | 73 | do { 74 | let abi = try String(contentsOfFile: path, encoding: .utf8) 75 | let contract = ContractV2(abi, at:contractAddress) 76 | 77 | var options = Web3Options() 78 | options.from = from 79 | options.gasPrice = gasPrice 80 | options.gasLimit = gasLimit 81 | options.value = BigUInt(0) 82 | guard var tx = contract?.method("bet", parameters: [true] as [AnyObject], options:options) else { 83 | print("failed to create contract transaciton") 84 | return 85 | } 86 | 87 | w3.eth.estimateGas(tx, options: options, callback: { (res: Result) in 88 | switch res { 89 | case .success(let value): 90 | guard let value = value as? BigUInt else { break } 91 | print("estimated gas limit: \(value)") 92 | tx.gasLimit = value 93 | case .failure(let error): 94 | print("error: \(error.localizedDescription)") 95 | } 96 | CoboSDK.shared.sendTransaction(transaction: tx, from: options.from) { result in 97 | switch result { 98 | case .success(let value): 99 | guard let hash = value.hash else { break } 100 | print("hash: \(hash)") 101 | case .failure(let error): 102 | print(error.localizedDescription) 103 | } 104 | } 105 | }) 106 | } catch { 107 | print("error: \(error)") 108 | } 109 | } 110 | } 111 | 112 | -------------------------------------------------------------------------------- /Example/Example/abi.json: -------------------------------------------------------------------------------- 1 | [{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"bets","outputs":[{"name":"player","type":"address"},{"name":"win","type":"bool"},{"name":"amount","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"states","outputs":[{"name":"started","type":"bool"},{"name":"drawed","type":"bool"},{"name":"betWinTotal","type":"uint256"},{"name":"betLoseTotal","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"label","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_label","type":"string"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"constant":false,"inputs":[{"name":"win","type":"bool"}],"name":"bet","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"win","type":"bool"}],"name":"draw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_label","type":"string"}],"name":"updateLabel","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_start","type":"bool"}],"name":"updateBet","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_draw","type":"bool"}],"name":"updateDraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"}],"name":"deleteGamble","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '9.0' 2 | use_frameworks! 3 | 4 | target 'Example' do 5 | pod 'CoboSDK' 6 | end -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Alamofire (4.7.2) 3 | - Alamofire-Synchronous (4.0.0): 4 | - Alamofire (~> 4.0) 5 | - BigInt (3.0.1): 6 | - SipHash (~> 1.2) 7 | - CoboSDK (1.0): 8 | - web3swift (~> 0.8.0) 9 | - CryptoSwift (0.10.0) 10 | - libsodium (1.0.12) 11 | - Result (3.0.0) 12 | - secp256k1_ios (0.1.3) 13 | - SipHash (1.2.2) 14 | - web3swift (0.8.1): 15 | - Alamofire (~> 4.7) 16 | - Alamofire-Synchronous (~> 4.0) 17 | - BigInt (~> 3.0.1) 18 | - CryptoSwift (~> 0.10.0) 19 | - libsodium (~> 1.0.12) 20 | - Result (~> 3.0.0) 21 | - secp256k1_ios (~> 0.1.3) 22 | 23 | DEPENDENCIES: 24 | - CoboSDK 25 | 26 | SPEC REPOS: 27 | https://github.com/cocoapods/specs.git: 28 | - Alamofire 29 | - Alamofire-Synchronous 30 | - BigInt 31 | - CoboSDK 32 | - CryptoSwift 33 | - libsodium 34 | - Result 35 | - secp256k1_ios 36 | - SipHash 37 | - web3swift 38 | 39 | SPEC CHECKSUMS: 40 | Alamofire: e4fa87002c137ba2d8d634d2c51fabcda0d5c223 41 | Alamofire-Synchronous: eedf1e6e961c3795a63c74990b3f7d9fbfac7e50 42 | BigInt: 8e8a52161c745cd3ab78e3dc346a9fbee51e6cf6 43 | CoboSDK: 3c0a410b1297ab9594f17b106322b2e08053d9e0 44 | CryptoSwift: 6c778d69282bed3b4e975ff97a79d074f20bb011 45 | libsodium: 9a8faa5ef2fa0d2d57bd7f7d79bf8fb7c1a9f0ea 46 | Result: 1b3e431f37cbcd3ad89c6aa9ab0ae55515fae3b6 47 | secp256k1_ios: ac9ef04e761f43c58012b28548afa91493761f17 48 | SipHash: fad90a4683e420c52ef28063063dbbce248ea6d4 49 | web3swift: 79f72b48005f1b28e73191eaf78194d6cf5f8a35 50 | 51 | PODFILE CHECKSUM: 0015d3552bf29f7385eb79b1766510b247f526fb 52 | 53 | COCOAPODS: 1.5.3 54 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CoboSDK-iOS 2 | CoboSDK帮助开发者通过[Cobo钱包](https://cobo.com/)进行ethereum交易的签名和发送。 3 | DApp开发者可以使用CoboSDK获取用户的ethereum账户地址,完成消息的签名和校验,发起交易、调用智能合约以及广播签名后的交易数据。从而省去了开发者自行实现用户私钥管理和钱包功能的工作。 4 | 5 | *其他语言:[English](Docs/README.en-us.md) 6 | 7 | ## 接入CoboSDK 8 | 接入CoboSDK需要如下几个步骤: 9 | 10 | ### 添加依赖 11 | 12 | - Cocoapods 13 | 14 | 在你的`Podfile`中添加: 15 | ```ruby 16 | pod 'CoboSDK' 17 | ``` 18 | 然后在终端中执行`$ pod install` 19 | 20 | - Carthage 21 | ``` 22 | TODO 23 | ``` 24 | 25 | ### 注册URL Scheme 26 | 在Xcode中,选择工程设置项,选中`TARGETS`,打开`Info`标签页,点击`URL Types`中的`+`按钮添加新的URL Type。在`URL Schemes` 中填入应用的URL Scheme。URL Scheme应当尽可能唯一,建议使用`.cobo`。 27 | 28 | ![URL Types](Docs/url-types.png) 29 | 30 | 注册URL Scheme到CoboSDK中,这里的URL Scheme应当与`URL Type`中添加的URL Scheme相同。 31 | ```swift 32 | CoboSDK.shared.setup(callbackScheme: ) 33 | ``` 34 | 35 | ### 添加```LSApplicationQueriesSchemes``` 36 | 在应用的```Info.plist```文件中,添加如下内容: 37 | ```xml 38 | LSApplicationQueriesSchemes 39 | 40 | cobo-wallet 41 | 42 | ``` 43 | 44 | ![Info.plist](Docs/queries-schemes.png) 45 | 46 | ### 接收返回结果 47 | 实现`AppDelegate`中的`func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool`方法来接收返回的结果数据: 48 | ```swift 49 | func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { 50 | return CoboSDK.shared.application(app, open: url, options: options) 51 | } 52 | ``` 53 | 54 | ## 使用SDK 55 | 56 | ### 签名消息 57 | ```swift 58 | let message = "Hello Cobo!" 59 | CoboSDK.shared.signMessage(message: message) { result in 60 | switch result { 61 | case .success(let value): 62 | guard let address = value.address, let signature = value.signature else { break } 63 | print(address) 64 | let match = CoboSDK.shared.verifyMessage(address: address, signature: signature, message: message) 65 | print("\(match)") 66 | case .failure(let error): 67 | print(error.localizedDescription) 68 | } 69 | } 70 | ``` 71 | 72 | ### 发送交易 73 | ```swift 74 | let gasPrice = BigUInt(stringLiteral: "1000000000") // 1 Gwei 75 | let gasLimit = BigUInt(21000) 76 | let value = BigUInt(stringLiteral: "1000000000000000000") // 1 ETH 77 | let from = 78 | let to = 79 | 80 | let tx = EthereumTransaction(gasPrice: gasPrice, gasLimit: gasLimit, to: to, value: value, data: Data()) 81 | CoboSDK.shared.sendTransaction(transaction: tx, from: from) { result in 82 | switch result { 83 | case .success(let value): 84 | guard let hash = value.hash, let tx = value.rawTransaction else { break } 85 | print("hash: \(hash)") 86 | case .failure(let error): 87 | print(error.localizedDescription) 88 | } 89 | } 90 | ``` 91 | 92 | 更多功能使用请参考```Example```工程。 --------------------------------------------------------------------------------