diff --git a/app/build.gradle b/app/build.gradle index 4c68a87d4a..1771f7491c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,10 +17,16 @@ android { versionName getKey("APP_VERSION_NAME", "0.4.2-alpha") testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + // Contracts buildConfigField javaTypes.STRING, "SAFE_MASTER_COPY_ADDRESS", asString(getKey("SAFE_MASTER_COPY_ADDRESS", "0x44e7f5855a77fe1793a96be8a1c9c3eaf47e9d09")) buildConfigField javaTypes.STRING, "MULTI_SEND_ADDRESS", asString(getKey("MULTI_SEND_ADDRESS", "0x2c155fd04682979fd15c67fb65dfab9345605761")) - buildConfigField javaTypes.STRING, "BLOCKCHAIN_NET_URL", asString(getKey("BLOCKCHAIN_NET_URL", "https://rinkeby.infura.io")) + // API keys buildConfigField javaTypes.STRING, "INFURA_API_KEY", asString(getKey("INFURA_API_KEY", "")) + // Services + buildConfigField javaTypes.STRING, "BLOCKCHAIN_NET_URL", asString(getKey("BLOCKCHAIN_NET_URL", "https://rinkeby.infura.io")) + buildConfigField javaTypes.STRING, "RELAY_SERVICE_URL", asString(getKey("RELAY_SERVICE_URL", "https://safe-relay.staging.gnosisdev.com/api/")) + buildConfigField javaTypes.STRING, "NOTIFICATION_SERVICE_URL", asString(getKey("NOTIFICATION_SERVICE_URL", "https://safe-notification.staging.gnosisdev.com/api/")) + buildConfigField javaTypes.STRING, "VERIFIED_TOKEN_SERVICE_URL", asString(getKey("VERIFIED_TOKEN_SERVICE_URL", "https://gist.githubusercontent.com/rmeissner/98911fcf74b0ea9731e2dae2441c97a4/raw/")) vectorDrawables.useSupportLibrary = true multiDexEnabled true diff --git a/app/src/internal/res/mipmap-hdpi/ic_launcher.png b/app/src/internal/res/mipmap-hdpi/ic_launcher.png new file mode 100755 index 0000000000..8920a33585 Binary files /dev/null and b/app/src/internal/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/internal/res/mipmap-mdpi/ic_launcher.png b/app/src/internal/res/mipmap-mdpi/ic_launcher.png new file mode 100755 index 0000000000..3687ac5c87 Binary files /dev/null and b/app/src/internal/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/internal/res/mipmap-xhdpi/ic_launcher.png b/app/src/internal/res/mipmap-xhdpi/ic_launcher.png new file mode 100755 index 0000000000..a28d083f6d Binary files /dev/null and b/app/src/internal/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/internal/res/mipmap-xxhdpi/ic_launcher.png b/app/src/internal/res/mipmap-xxhdpi/ic_launcher.png new file mode 100755 index 0000000000..2365e5e3cd Binary files /dev/null and b/app/src/internal/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/internal/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/internal/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100755 index 0000000000..a1858fa063 Binary files /dev/null and b/app/src/internal/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/internal/res/values/strings.xml b/app/src/internal/res/values/strings.xml new file mode 100644 index 0000000000..6537792d3d --- /dev/null +++ b/app/src/internal/res/values/strings.xml @@ -0,0 +1,4 @@ + + + Gnosis Safe - Internal + diff --git a/app/src/main/java/pm/gnosis/heimdall/data/remote/PushServiceApi.kt b/app/src/main/java/pm/gnosis/heimdall/data/remote/PushServiceApi.kt index 0f1ea31333..cab9826160 100644 --- a/app/src/main/java/pm/gnosis/heimdall/data/remote/PushServiceApi.kt +++ b/app/src/main/java/pm/gnosis/heimdall/data/remote/PushServiceApi.kt @@ -8,10 +8,6 @@ import retrofit2.http.Body import retrofit2.http.POST interface PushServiceApi { - companion object { - const val BASE_URL = "https://safe-notification.dev.gnosisdev.com/api/" - } - @POST("v1/auth/") fun auth(@Body pushServiceAuth: PushServiceAuth): Completable diff --git a/app/src/main/java/pm/gnosis/heimdall/data/remote/RelayServiceApi.kt b/app/src/main/java/pm/gnosis/heimdall/data/remote/RelayServiceApi.kt index 2b2a33f9f8..ca5d85f5a1 100644 --- a/app/src/main/java/pm/gnosis/heimdall/data/remote/RelayServiceApi.kt +++ b/app/src/main/java/pm/gnosis/heimdall/data/remote/RelayServiceApi.kt @@ -7,10 +7,6 @@ import retrofit2.http.* interface RelayServiceApi { - companion object { - const val BASE_URL = "https://safe-relay.dev.gnosisdev.com/api/" - } - @POST("v1/safes/{address}/transactions/") fun execute(@Path("address") address: String, @Body params: ExecuteParams): Single diff --git a/app/src/main/java/pm/gnosis/heimdall/data/remote/TxExecutorApi.kt b/app/src/main/java/pm/gnosis/heimdall/data/remote/TxExecutorApi.kt deleted file mode 100644 index 0d3badac5b..0000000000 --- a/app/src/main/java/pm/gnosis/heimdall/data/remote/TxExecutorApi.kt +++ /dev/null @@ -1,47 +0,0 @@ -package pm.gnosis.heimdall.data.remote - -import io.reactivex.Observable -import io.reactivex.Single -import pm.gnosis.heimdall.data.remote.models.* -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.Header -import retrofit2.http.POST - -interface TxExecutorApi { - - companion object { - const val BASE_URL = "https://gnosis-tx-executor.herokuapp.com" - // TODO this might be added via interceptor - const val HEADER_AUTH_ACCOUNT = "AUTH_ACCOUNT" - const val HEADER_AUTH_SIGNATURE = "AUTH_SIGNATURE" - } - - @POST("api/2/execute_tx") - fun executeTx( - @Header(HEADER_AUTH_ACCOUNT) account: String, - @Header(HEADER_AUTH_SIGNATURE) signature: String, - @Body data: TxExecutionData - ): Observable - - @POST("api/1/estimate_tx") - fun estimateTx( - @Header(HEADER_AUTH_ACCOUNT) account: String, - @Header(HEADER_AUTH_SIGNATURE) signature: String, - @Body data: TxExecutionData - ): Observable - - @GET("api/1/balance") - fun balance( - @Header(HEADER_AUTH_ACCOUNT) account: String, - @Header(HEADER_AUTH_SIGNATURE) signature: String - ): Observable - - @POST("api/1/redeem") - fun reedeemVoucher( - @Header(HEADER_AUTH_ACCOUNT) account: String, - @Header(HEADER_AUTH_SIGNATURE) signature: String, - @Body data: TxExecutionVoucherData - ): Single - -} diff --git a/app/src/main/java/pm/gnosis/heimdall/data/remote/VerifiedTokensServiceApi.kt b/app/src/main/java/pm/gnosis/heimdall/data/remote/VerifiedTokensServiceApi.kt index b258b473fb..f1b88e427f 100644 --- a/app/src/main/java/pm/gnosis/heimdall/data/remote/VerifiedTokensServiceApi.kt +++ b/app/src/main/java/pm/gnosis/heimdall/data/remote/VerifiedTokensServiceApi.kt @@ -5,10 +5,6 @@ import pm.gnosis.heimdall.data.remote.models.tokens.VerifiedTokenJson import retrofit2.http.GET interface VerifiedTokensServiceApi { - companion object { - const val BASE_URL = "https://gist.githubusercontent.com/rmeissner/98911fcf74b0ea9731e2dae2441c97a4/raw/" - } - @GET("verified_rinkeby_tokens.json") fun loadVerifiedTokenList(): Single> } diff --git a/app/src/main/java/pm/gnosis/heimdall/di/modules/ApplicationModule.kt b/app/src/main/java/pm/gnosis/heimdall/di/modules/ApplicationModule.kt index 1e239e87a1..97db692eb7 100644 --- a/app/src/main/java/pm/gnosis/heimdall/di/modules/ApplicationModule.kt +++ b/app/src/main/java/pm/gnosis/heimdall/di/modules/ApplicationModule.kt @@ -23,7 +23,6 @@ import pm.gnosis.heimdall.data.adapters.* import pm.gnosis.heimdall.data.db.ApplicationDb import pm.gnosis.heimdall.data.remote.PushServiceApi import pm.gnosis.heimdall.data.remote.RelayServiceApi -import pm.gnosis.heimdall.data.remote.TxExecutorApi import pm.gnosis.heimdall.data.remote.VerifiedTokensServiceApi import pm.gnosis.heimdall.di.ApplicationContext import pm.gnosis.mnemonic.Bip39 @@ -102,24 +101,12 @@ class ApplicationModule(private val application: Application) { .build() .create(RetrofitEthereumRpcApi::class.java) - @Provides - @Singleton - fun providesTxExecutorApi(moshi: Moshi, client: OkHttpClient): TxExecutorApi = - Retrofit.Builder() - // Increase timeout since our server goes to sleeps - .client(client.newBuilder().readTimeout(30, TimeUnit.SECONDS).build()) - .baseUrl(TxExecutorApi.BASE_URL) - .addConverterFactory(MoshiConverterFactory.create(moshi)) - .addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io())) - .build() - .create(TxExecutorApi::class.java) - @Provides @Singleton fun providesPushServiceApi(moshi: Moshi, client: OkHttpClient): PushServiceApi = Retrofit.Builder() .client(client) - .baseUrl(PushServiceApi.BASE_URL) + .baseUrl(BuildConfig.NOTIFICATION_SERVICE_URL) .addConverterFactory(MoshiConverterFactory.create(moshi)) .addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io())) .build() @@ -130,7 +117,7 @@ class ApplicationModule(private val application: Application) { fun providesRelayServiceApi(moshi: Moshi, client: OkHttpClient): RelayServiceApi = Retrofit.Builder() .client(client) - .baseUrl(RelayServiceApi.BASE_URL) + .baseUrl(BuildConfig.RELAY_SERVICE_URL) .addConverterFactory(MoshiConverterFactory.create(moshi)) .addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io())) .build() @@ -141,7 +128,7 @@ class ApplicationModule(private val application: Application) { fun providesVerifiedTokensServiceApi(moshi: Moshi, client: OkHttpClient): VerifiedTokensServiceApi = Retrofit.Builder() .client(client) - .baseUrl(VerifiedTokensServiceApi.BASE_URL) + .baseUrl(BuildConfig.VERIFIED_TOKEN_SERVICE_URL) .addConverterFactory(MoshiConverterFactory.create(moshi)) .addCallAdapterFactory(RxJava2CallAdapterFactory.createWithScheduler(Schedulers.io())) .build() diff --git a/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/confirm/ConfirmTransactionActivity.kt b/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/confirm/ConfirmTransactionActivity.kt index d2c2c74f03..160823d6d2 100644 --- a/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/confirm/ConfirmTransactionActivity.kt +++ b/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/confirm/ConfirmTransactionActivity.kt @@ -181,7 +181,7 @@ class ConfirmTransactionActivity : ViewModelActivity errorSnackbar(layout_confirm_transaction_transaction_info, throwable) val errorMsgId = (throwable as? ConfirmTransactionContract.InvalidTransactionException)?.messageId ?: R.string.error_loading_transaction layout_confirm_transaction_loading_error_message.text = getString(errorMsgId) - layout_confirm_transaction_loading_error_group.visible(true) + layout_confirm_transaction_loading_error_group.visible(transactionInfoViewHolder == null) } companion object { diff --git a/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/helpers/SubmitTransactionHelper.kt b/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/helpers/SubmitTransactionHelper.kt index 7a8dc0d23d..7fcc7f9ba0 100644 --- a/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/helpers/SubmitTransactionHelper.kt +++ b/app/src/main/java/pm/gnosis/heimdall/ui/transactions/view/helpers/SubmitTransactionHelper.kt @@ -101,9 +101,7 @@ class DefaultSubmitTransactionHelper @Inject constructor( emit = { it.map { ViewUpdate.Estimate( - Wei( - (it.txGas + it.dataGas + BigInteger.valueOf(32000)) * it.gasPrice - ), it.balance + Wei(it.gasCosts()), it.balance ) } }, diff --git a/app/src/test/java/pm/gnosis/heimdall/ui/transactions/view/helpers/DefaultSubmitTransactionHelperTest.kt b/app/src/test/java/pm/gnosis/heimdall/ui/transactions/view/helpers/DefaultSubmitTransactionHelperTest.kt index 56a26285cf..970ff31768 100644 --- a/app/src/test/java/pm/gnosis/heimdall/ui/transactions/view/helpers/DefaultSubmitTransactionHelperTest.kt +++ b/app/src/test/java/pm/gnosis/heimdall/ui/transactions/view/helpers/DefaultSubmitTransactionHelperTest.kt @@ -143,7 +143,7 @@ class DefaultSubmitTransactionHelperTest { .willReturn(Single.just(info)) retryEvents.onNext(Unit) - updates += { it == DataResult(SubmitTransactionHelper.ViewUpdate.Estimate(Wei(BigInteger.valueOf(32010)), Wei.ether("23"))) } + updates += { it == DataResult(SubmitTransactionHelper.ViewUpdate.Estimate(Wei(BigInteger.valueOf(10)), Wei.ether("23"))) } testObserver.assertUpdates(updates) /* @@ -407,7 +407,7 @@ class DefaultSubmitTransactionHelperTest { val updates = mutableListOf<((Result) -> Boolean)>({ ((it as? DataResult)?.data as? SubmitTransactionHelper.ViewUpdate.TransactionInfo)?.viewHolder == transactionViewHolder }) - updates += { it == DataResult(SubmitTransactionHelper.ViewUpdate.Estimate(Wei(BigInteger.valueOf(32010)), Wei.ether("23"))) } + updates += { it == DataResult(SubmitTransactionHelper.ViewUpdate.Estimate(Wei(BigInteger.valueOf(10)), Wei.ether("23"))) } testObserver.assertUpdates(updates) signatureSubject.onNext(emptyMap())