├── .idea ├── libraries │ ├── Gradle__android_arch_core_common_1_1_1_jar.xml │ ├── Gradle__android_arch_core_runtime_1_1_1.xml │ ├── Gradle__android_arch_lifecycle_common_1_1_1_jar.xml │ ├── Gradle__android_arch_lifecycle_livedata_1_1_1.xml │ ├── Gradle__android_arch_lifecycle_livedata_core_1_1_1.xml │ ├── Gradle__android_arch_lifecycle_runtime_1_1_1.xml │ ├── Gradle__android_arch_lifecycle_viewmodel_1_1_1.xml │ ├── Gradle__com_android_support_animated_vector_drawable_28_0_0.xml │ ├── Gradle__com_android_support_appcompat_v7_28_0_0.xml │ ├── Gradle__com_android_support_asynclayoutinflater_28_0_0.xml │ ├── Gradle__com_android_support_collections_28_0_0_jar.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_1_1_3.xml │ ├── Gradle__com_android_support_constraint_constraint_layout_solver_1_1_3_jar.xml │ ├── Gradle__com_android_support_coordinatorlayout_28_0_0.xml │ ├── Gradle__com_android_support_cursoradapter_28_0_0.xml │ ├── Gradle__com_android_support_customview_28_0_0.xml │ ├── Gradle__com_android_support_documentfile_28_0_0.xml │ ├── Gradle__com_android_support_drawerlayout_28_0_0.xml │ ├── Gradle__com_android_support_interpolator_28_0_0.xml │ ├── Gradle__com_android_support_loader_28_0_0.xml │ ├── Gradle__com_android_support_localbroadcastmanager_28_0_0.xml │ ├── Gradle__com_android_support_print_28_0_0.xml │ ├── Gradle__com_android_support_slidingpanelayout_28_0_0.xml │ ├── Gradle__com_android_support_support_annotations_28_0_0_jar.xml │ ├── Gradle__com_android_support_support_compat_28_0_0.xml │ ├── Gradle__com_android_support_support_core_ui_28_0_0.xml │ ├── Gradle__com_android_support_support_core_utils_28_0_0.xml │ ├── Gradle__com_android_support_support_fragment_28_0_0.xml │ ├── Gradle__com_android_support_support_vector_drawable_28_0_0.xml │ ├── Gradle__com_android_support_swiperefreshlayout_28_0_0.xml │ ├── Gradle__com_android_support_test_espresso_espresso_core_3_0_2.xml │ ├── Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2.xml │ ├── Gradle__com_android_support_test_monitor_1_0_2.xml │ ├── Gradle__com_android_support_test_runner_1_0_2.xml │ ├── Gradle__com_android_support_versionedparcelable_28_0_0.xml │ ├── Gradle__com_android_support_viewpager_28_0_0.xml │ ├── Gradle__com_fasterxml_jackson_core_jackson_annotations_2_9_0_jar.xml │ ├── Gradle__com_fasterxml_jackson_core_jackson_core_2_9_0_jar.xml │ ├── Gradle__com_fasterxml_jackson_core_jackson_databind_2_9_0_jar.xml │ ├── Gradle__com_github_consenlabs_token_core_android_v0_1.xml │ ├── Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml │ ├── Gradle__com_google_guava_guava_18_0_jar.xml │ ├── Gradle__com_google_protobuf_protobuf_java_3_5_1_jar.xml │ ├── Gradle__com_jakewharton_butterknife_9_0_0_rc1.xml │ ├── Gradle__com_jakewharton_butterknife_annotations_9_0_0_rc1_jar.xml │ ├── Gradle__com_jakewharton_butterknife_runtime_9_0_0_rc1.xml │ ├── Gradle__com_lambdaworks_scrypt_1_4_0_jar.xml │ ├── Gradle__com_madgag_spongycastle_core_1_51_0_0_jar.xml │ ├── Gradle__com_squareup_javawriter_2_1_1_jar.xml │ ├── Gradle__com_squareup_okhttp_okhttp_2_7_2_jar.xml │ ├── Gradle__javax_inject_javax_inject_1_jar.xml │ ├── Gradle__junit_junit_4_12_jar.xml │ ├── Gradle__net_jcip_jcip_annotations_1_0_jar.xml │ ├── Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml │ ├── Gradle__org_bitcoinj_bitcoinj_core_0_14_3_jar.xml │ ├── Gradle__org_bitcoinj_orchid_1_2_1_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml │ ├── Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml │ └── Gradle__org_slf4j_slf4j_api_1_7_20_jar.xml ├── modules.xml └── vcs.xml ├── README.md ├── app ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── anzhi │ │ └── com │ │ └── imtokendemo │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── anzhi │ │ │ └── com │ │ │ ├── http │ │ │ ├── IWalletHttp.java │ │ │ └── response │ │ │ │ ├── EthBalanceModel.java │ │ │ │ └── PongModel.java │ │ │ ├── imtokendemo │ │ │ ├── CreateIdentityActivity.java │ │ │ ├── MainActivity.java │ │ │ └── MnemonicExportActivity.java │ │ │ └── util │ │ │ └── AZStringUtil.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_create_identity.xml │ │ ├── activity_main.xml │ │ └── activity_mnemonic_export.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── network_security_config.xml │ └── test │ └── java │ └── anzhi │ └── com │ └── imtokendemo │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── imtoken-android-demo.iml └── settings.gradle /.idea/libraries/Gradle__android_arch_core_common_1_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_core_runtime_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_common_1_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_livedata_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_livedata_core_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__android_arch_lifecycle_viewmodel_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_animated_vector_drawable_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_appcompat_v7_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_asynclayoutinflater_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_collections_28_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_1_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_constraint_constraint_layout_solver_1_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_coordinatorlayout_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_cursoradapter_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_customview_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_documentfile_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_drawerlayout_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_interpolator_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_loader_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_localbroadcastmanager_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_print_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_slidingpanelayout_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_annotations_28_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_compat_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_ui_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_core_utils_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_fragment_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_support_vector_drawable_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_swiperefreshlayout_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_core_3_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_espresso_espresso_idling_resource_3_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_monitor_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_test_runner_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_versionedparcelable_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_android_support_viewpager_28_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_annotations_2_9_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_9_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_databind_2_9_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_github_consenlabs_token_core_android_v0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_code_findbugs_jsr305_2_0_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_guava_guava_18_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_google_protobuf_protobuf_java_3_5_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_jakewharton_butterknife_9_0_0_rc1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_jakewharton_butterknife_annotations_9_0_0_rc1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_jakewharton_butterknife_runtime_9_0_0_rc1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_lambdaworks_scrypt_1_4_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_madgag_spongycastle_core_1_51_0_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_javawriter_2_1_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__com_squareup_okhttp_okhttp_2_7_2_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__junit_junit_4_12_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_jcip_jcip_annotations_1_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__net_sf_kxml_kxml2_2_3_0_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_bitcoinj_bitcoinj_core_0_14_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_bitcoinj_orchid_1_2_1_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_core_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_integration_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_hamcrest_hamcrest_library_1_3_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/Gradle__org_slf4j_slf4j_api_1_7_20_jar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # imtoken-android-demo 2 | imToken比特币,以太坊,EOS数字钱包的Demo,支持创建账户,转账,查询余额等 3 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 28 5 | defaultConfig { 6 | applicationId "anzhi.com.imtokendemo" 7 | minSdkVersion 21 8 | targetSdkVersion 28 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | compileOptions { 20 | sourceCompatibility JavaVersion.VERSION_1_8 21 | targetCompatibility JavaVersion.VERSION_1_8 22 | } 23 | packagingOptions { 24 | exclude 'lib/x86_64/darwin/libscrypt.dylib' 25 | } 26 | } 27 | 28 | dependencies { 29 | implementation fileTree(dir: 'libs', include: ['*.jar']) 30 | implementation 'com.android.support:appcompat-v7:28.0.0' 31 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 32 | testImplementation 'junit:junit:4.12' 33 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 34 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 35 | 36 | implementation 'com.github.consenlabs:token-core-android:v0.1' 37 | implementation 'com.jakewharton:butterknife:9.0.0-rc1' 38 | annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1' 39 | implementation 'com.squareup.retrofit2:retrofit:2.5.0' 40 | implementation 'com.squareup.retrofit2:converter-gson:2.5.0' 41 | implementation 'com.squareup.okhttp3:okhttp:3.10.0' 42 | } 43 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/anzhi/com/imtokendemo/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.imtokendemo; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("anzhi.com.imtokendemo", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/http/IWalletHttp.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.http; 2 | 3 | import anzhi.com.http.response.EthBalanceModel; 4 | import anzhi.com.http.response.PongModel; 5 | import retrofit2.Call; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.Query; 8 | 9 | public interface IWalletHttp { 10 | @GET("/ping") Call ping(); 11 | @GET("/api") Call getEthBalance(@Query("module") String module, @Query("action") String action, @Query("address") String address, @Query("tag") String tag); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/http/response/EthBalanceModel.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.http.response; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class EthBalanceModel { 7 | @SerializedName("status") @Expose public String status; 8 | @SerializedName("message") @Expose public String message; 9 | @SerializedName("result") @Expose public String result; 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/http/response/PongModel.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.http.response; 2 | 3 | import com.google.gson.annotations.Expose; 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | public class PongModel { 7 | @SerializedName("message") @Expose 8 | public String message; 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/imtokendemo/CreateIdentityActivity.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.imtokendemo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.content.SharedPreferences; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.util.Log; 9 | import android.view.View; 10 | import android.widget.Button; 11 | import android.widget.EditText; 12 | import android.widget.Toast; 13 | 14 | import org.consenlabs.tokencore.wallet.Identity; 15 | import org.consenlabs.tokencore.wallet.Wallet; 16 | import org.consenlabs.tokencore.wallet.WalletManager; 17 | import org.consenlabs.tokencore.wallet.model.Metadata; 18 | import org.consenlabs.tokencore.wallet.model.MnemonicAndPath; 19 | import org.consenlabs.tokencore.wallet.model.Network; 20 | 21 | import anzhi.com.util.AZStringUtil; 22 | import butterknife.BindView; 23 | import butterknife.ButterKnife; 24 | 25 | public class CreateIdentityActivity extends AppCompatActivity { 26 | private static final String TAG = "CreateIdentityActivity"; 27 | 28 | @BindView(R.id.identity_name) EditText identityNameEditText; 29 | @BindView(R.id.passwd) EditText passwdEditText; 30 | @BindView(R.id.confirm_passwd) EditText confirmPasswdEditText; 31 | @BindView(R.id.hint) EditText hintEditText; 32 | @BindView(R.id.createBtn) Button createBtn; 33 | private Context context; 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_create_identity); 39 | 40 | context = this; 41 | ButterKnife.bind(this); 42 | 43 | initCreateBtn(); 44 | } 45 | 46 | private void initCreateBtn() { 47 | createBtn.setOnClickListener(new View.OnClickListener() { 48 | @Override 49 | public void onClick(View v) { 50 | boolean isAvailabe = checkAvailableValue(); 51 | if (isAvailabe) { 52 | String identityName = identityNameEditText.getText().toString(); 53 | String passwd = passwdEditText.getText().toString(); 54 | String hint = hintEditText.getText().toString(); 55 | Identity identity = Identity.createIdentity(identityName, passwd, hint, Network.MAINNET, Metadata.P2WPKH); 56 | if (null != identity) { 57 | Wallet ethereumWallet = identity.getWallets().get(0); 58 | Wallet bitcoinWallet = identity.getWallets().get(1); 59 | if (null != ethereumWallet) { 60 | Toast.makeText(context, "ETH钱包地址是" + ethereumWallet.getAddress(), Toast.LENGTH_LONG).show(); 61 | Log.i(TAG, "eth address is: " + ethereumWallet.getAddress()); 62 | Log.i(TAG, "btc address is: " + bitcoinWallet.getAddress()); 63 | String ethereumId = ethereumWallet.getId(); 64 | String bitcoinId = bitcoinWallet.getId(); 65 | MnemonicAndPath ethereumMnemonic = WalletManager.exportMnemonic(ethereumId, passwd); 66 | MnemonicAndPath bitcoinMnemonic = WalletManager.exportMnemonic(bitcoinId, passwd); 67 | Log.i(TAG, "eth mnemonic is: " + ethereumMnemonic.getMnemonic()); 68 | Log.i(TAG, "btc mnemonic is: " + bitcoinMnemonic.getMnemonic()); 69 | Intent intent = new Intent(context, MnemonicExportActivity.class); 70 | intent.putExtra("EthereumMnemonic", ethereumMnemonic.getMnemonic()); 71 | intent.putExtra("BitcoinMnemonic", bitcoinMnemonic.getMnemonic()); 72 | identity.addWallet(ethereumWallet); 73 | identity.addWallet(bitcoinWallet); 74 | SharedPreferences.Editor editor = getSharedPreferences("ids", MODE_PRIVATE).edit(); 75 | editor.putString("EthId", ethereumWallet.getId()); 76 | editor.putString("BtcId", bitcoinWallet.getId()); 77 | editor.commit(); 78 | context.startActivity(intent); 79 | } else { 80 | Log.i(TAG, "获取ETH钱包失败"); 81 | } 82 | } else { 83 | Toast.makeText(context, "创建钱包失败", Toast.LENGTH_LONG).show(); 84 | Log.i(TAG, "创建钱包失败"); 85 | } 86 | } else { 87 | Toast.makeText(context, "参数不合法", Toast.LENGTH_LONG).show(); 88 | Log.i(TAG, "参数不合法"); 89 | } 90 | } 91 | }); 92 | } 93 | 94 | private boolean checkAvailableValue() { 95 | // TODO: 更精确的限制策略 96 | String identityName = identityNameEditText.getText().toString(); 97 | String passwd = passwdEditText.getText().toString(); 98 | String confirmPasswd = confirmPasswdEditText.getText().toString(); 99 | String hint = hintEditText.getText().toString(); 100 | if (AZStringUtil.isTrimEmpty(identityName) || AZStringUtil.isTrimEmpty(passwd) || AZStringUtil.isTrimEmpty(hint)) { 101 | return false; 102 | } 103 | if (passwd.length() < 6) { 104 | return false; 105 | } 106 | if (!passwd.equals(confirmPasswd)) { 107 | return false; 108 | } 109 | return true; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/imtokendemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.imtokendemo; 2 | 3 | import android.content.Intent; 4 | import android.content.SharedPreferences; 5 | import android.support.annotation.BinderThread; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.util.Log; 9 | import android.view.View; 10 | import android.widget.Button; 11 | import android.widget.LinearLayout; 12 | import android.widget.TextView; 13 | 14 | import org.consenlabs.tokencore.wallet.KeystoreStorage; 15 | import org.consenlabs.tokencore.wallet.Wallet; 16 | import org.consenlabs.tokencore.wallet.WalletManager; 17 | 18 | import java.io.File; 19 | 20 | import anzhi.com.http.IWalletHttp; 21 | import anzhi.com.http.response.EthBalanceModel; 22 | import anzhi.com.http.response.PongModel; 23 | import anzhi.com.util.AZStringUtil; 24 | import butterknife.BindView; 25 | import butterknife.ButterKnife; 26 | import retrofit2.Call; 27 | import retrofit2.Callback; 28 | import retrofit2.Response; 29 | import retrofit2.Retrofit; 30 | import retrofit2.http.GET; 31 | import retrofit2.http.Path; 32 | import retrofit2.converter.gson.GsonConverterFactory; 33 | 34 | public class MainActivity extends AppCompatActivity implements KeystoreStorage { 35 | private static final String TAG = MainActivity.class.getName(); 36 | 37 | @BindView(R.id.create_identity) Button createIdentityBtn; 38 | @BindView(R.id.eth_layout) LinearLayout ethLayout; 39 | @BindView(R.id.btc_layout) LinearLayout btcLayout; 40 | @BindView(R.id.tv_eth_address) TextView ethAddressTextView; 41 | @BindView(R.id.tv_eth_balance) TextView ethBalanceTextView; 42 | @BindView(R.id.tv_btc_address) TextView btcAddressTextView; 43 | @BindView(R.id.tv_btc_balance) TextView btcBalanceTextView; 44 | 45 | private Wallet btcWallet; 46 | private Wallet ethWallet; 47 | 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | setContentView(R.layout.activity_main); 52 | 53 | ButterKnife.bind(this); 54 | 55 | WalletManager.storage = this; 56 | WalletManager.scanWallets(); 57 | // WalletManager.mustFindWalletById(""); 58 | 59 | initCreateIdentityBtn(); 60 | } 61 | 62 | @Override 63 | protected void onResume() { 64 | super.onResume(); 65 | updateUi(); 66 | } 67 | 68 | private void updateUi() { 69 | SharedPreferences read = getSharedPreferences("ids", MODE_PRIVATE); 70 | if (null != read) { 71 | String ethId = read.getString("EthId", ""); 72 | String btcId = read.getString("BtcId", ""); 73 | if (!AZStringUtil.isTrimEmpty(ethId) && !AZStringUtil.isTrimEmpty(btcId)) { 74 | ethLayout.setVisibility(View.VISIBLE); 75 | btcLayout.setVisibility(View.VISIBLE); 76 | createIdentityBtn.setVisibility(View.GONE); 77 | updateWallet(ethId, btcId); 78 | } 79 | } 80 | } 81 | 82 | private void updateWallet(String ethId, String btcId) { 83 | ethWallet = WalletManager.mustFindWalletById(ethId); 84 | btcWallet = WalletManager.mustFindWalletById(btcId); 85 | String btcAddress = btcWallet.getAddress(); 86 | String ethAddress = ethWallet.getAddress(); 87 | btcAddressTextView.setText("地址:" + btcAddress); 88 | ethAddressTextView.setText("地址:" + ethAddress); 89 | ethAddress = "0x" + ethAddress; 90 | updateEthBalance(ethAddress); 91 | } 92 | 93 | private void initCreateIdentityBtn() { 94 | createIdentityBtn.setOnClickListener(new View.OnClickListener() { 95 | @Override 96 | public void onClick(View view) { 97 | Intent intent = new Intent(MainActivity.this, CreateIdentityActivity.class); 98 | startActivity(intent); 99 | } 100 | }); 101 | } 102 | 103 | public File getKeystoreDir() { 104 | return this.getFilesDir(); 105 | } 106 | 107 | private void updateBtcBalance(String address) { 108 | } 109 | 110 | private void updateEthBalance(String address) { 111 | Retrofit retrofit = new Retrofit.Builder() 112 | .baseUrl("https://api.etherscan.io") 113 | .addConverterFactory(GsonConverterFactory.create()) 114 | .build(); 115 | IWalletHttp walletService = retrofit.create(IWalletHttp.class); 116 | Call call = walletService.getEthBalance("account", "balance", address, "latest"); 117 | call.enqueue(new Callback() { 118 | @Override 119 | public void onResponse(Call call, Response response) { 120 | Log.v(TAG, "url is :" + call.request().url()); 121 | String balance = response.body().result; 122 | if (!AZStringUtil.isTrimEmpty(balance)) { 123 | double balanceDouble = Double.parseDouble(balance) / 1000000000000000000.0f; 124 | ethBalanceTextView.setText("余额:" + Double.toString(balanceDouble)); 125 | } else { 126 | ethBalanceTextView.setText("余额:0"); 127 | } 128 | } 129 | 130 | @Override 131 | public void onFailure(Call call, Throwable t) { 132 | ethBalanceTextView.setText("余额获取失败,请重试!"); 133 | } 134 | }); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/imtokendemo/MnemonicExportActivity.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.imtokendemo; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.os.Bundle; 7 | import android.view.View; 8 | import android.widget.Button; 9 | import android.widget.TextView; 10 | 11 | import butterknife.BindView; 12 | import butterknife.ButterKnife; 13 | 14 | public class MnemonicExportActivity extends AppCompatActivity { 15 | 16 | @BindView(R.id.mnemonic_tv) TextView mnemonicTextView; 17 | @BindView(R.id.backup_btn) Button backupBtn; 18 | private Context context; 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | setContentView(R.layout.activity_mnemonic_export); 24 | 25 | context = this; 26 | ButterKnife.bind(this); 27 | 28 | Intent intent = getIntent(); 29 | String ethereumMnemonic = intent.getStringExtra("EthereumMnemonic"); 30 | String bitcoinMnemonic = intent.getStringExtra("BitcoinMnemonic"); 31 | mnemonicTextView.setText("助记词是:" + ethereumMnemonic); 32 | 33 | initBackupBtn(); 34 | } 35 | 36 | private void initBackupBtn() { 37 | backupBtn.setOnClickListener(new View.OnClickListener() { 38 | @Override 39 | public void onClick(View v) { 40 | Intent intent = new Intent(context, MainActivity.class); 41 | startActivity(intent); 42 | } 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/anzhi/com/util/AZStringUtil.java: -------------------------------------------------------------------------------- 1 | package anzhi.com.util; 2 | 3 | public class AZStringUtil { 4 | /** 5 | * 判断字符串是否为null或全为空格 6 | * 7 | * @param s 待校验字符串 8 | * @return {@code true}: null或全空格
{@code false}: 不为null且不全空格 9 | */ 10 | public static boolean isTrimEmpty(String s) { 11 | return (s == null || s.trim().length() == 0); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_create_identity.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 21 | 28 | 35 | 42 |