Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Salvium Support #1867

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cache_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: Cache Dependencies
on:
workflow_dispatch:
push:
branches: [ main ]
branches: [main]

jobs:
test:

runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -60,6 +59,7 @@ jobs:
with:
path: |
/opt/android/cake_wallet/cw_haven/android/.cxx
/opt/android/cake_wallet/cw_salvium/android/.cxx
/opt/android/cake_wallet/scripts/monero_c/release
key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}

Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/pr_test_build_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
with:
path: |
/opt/android/cake_wallet/cw_haven/android/.cxx
/opt/android/cake_wallet/cw_salvium/android/.cxx
/opt/android/cake_wallet/scripts/monero_c/release
key: ${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}

Expand All @@ -96,7 +97,6 @@ jobs:
cd /opt/android/cake_wallet
flutter pub get


- name: Install go and gomobile
run: |
# install go > 1.23:
Expand All @@ -115,7 +115,6 @@ jobs:
cd /opt/android/cake_wallet/scripts/android/
./build_mwebd.sh --dont-install


- name: Set up cache path
id: cache-path
run: echo "cache-file-path=/opt/android/cake_wallet/android/app/key.jks" >> $GITHUB_ENV
Expand Down Expand Up @@ -293,4 +292,3 @@ jobs:
title: "${{ env.BRANCH_NAME }}.apk"
filename: ${{ env.BRANCH_NAME }}.apk
initial_comment: ${{ github.event.head_commit.message }}

2 changes: 1 addition & 1 deletion .github/workflows/pr_test_build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
with:
path: |
/opt/android/cake_wallet/cw_haven/android/.cxx
/opt/android/cake_wallet/cw_salvium/android/.cxx
/opt/android/cake_wallet/scripts/monero_c/release
key: linux_${{ hashFiles('**/prepare_moneroc.sh' ,'**/build_monero_all.sh' ,'**/cache_dependencies.yml') }}

Expand Down Expand Up @@ -200,7 +201,6 @@ jobs:
uses: kittaakos/upload-artifact-as-is@v0
with:
path: /opt/android/cake_wallet/build/linux/x64/release/${{env.BRANCH_NAME}}.zip

# Just as an artifact would be enough
# - name: Send Test APK
# continue-on-error: true
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,15 @@ cw_shared_external/ios/External/
cw_haven/ios/External/
cw_haven/android/.externalNativeBuild/
cw_haven/android/.cxx/
# cw_salvium/**
cw_salvium/ios/External/
cw_salvium/android/.externalNativeBuild/
cw_salvium/android/.cxx/

lib/bitcoin/bitcoin.dart
lib/monero/monero.dart
lib/haven/haven.dart
lib/salvium/salvium.dart
lib/ethereum/ethereum.dart
lib/bitcoin_cash/bitcoin_cash.dart
lib/nano/nano.dart
Expand Down
104 changes: 55 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,83 +21,89 @@
[Cake Wallet](https://cakewallet.com) is an open-source, non-custodial, and private multi-currency crypto wallet for Android, iOS, macOS, and Linux.

Cake Wallet includes support for several cryptocurrencies, including:
* Monero (XMR)
* Bitcoin (BTC)
* Ethereum (ETH)
* Litecoin (LTC)
* Bitcoin Cash (BCH)
* Polygon (Pol)
* Solana (SOL)
* Nano (XNO)
* Haven (XHV)

- Monero (XMR)
- Bitcoin (BTC)
- Ethereum (ETH)
- Litecoin (LTC)
- Bitcoin Cash (BCH)
- Polygon (Pol)
- Solana (SOL)
- Nano (XNO)
- Haven (XHV)
- Salvium (SAL)

## Features

### App-Wide Features

* Completely noncustodial. *Your keys, your coins.*
* Built-in exchange for dozens of pairs
* Easily pay cryptocurrency invoices with fixed rate exchanges
* Buy cryptocurrency (BTC/LTC/XMR/ETH) with credit/debit/bank
* Sell cryptocurrency by bank transfer
* Scan QR codes for easy cryptocurrency transfers
* Create several wallets
* Select your own custom nodes/servers
* Address book
* Backup to an external location or iCloud
* Send to OpenAlias, Unstoppable Domains, Yats, and FIO Crypto Handles
* Set desired network fee level
* Store local transaction notes
* Extremely simple user experience
* Convenient exchange and sending templates for recurring payments
* Create donation links and invoices in the receive screen
* Robust privacy settings (eg: Tor-only connections)
* Robust security settings (eg: Cake 2FA)
- Completely noncustodial. _Your keys, your coins._
- Built-in exchange for dozens of pairs
- Easily pay cryptocurrency invoices with fixed rate exchanges
- Buy cryptocurrency (BTC/LTC/XMR/ETH) with credit/debit/bank
- Sell cryptocurrency by bank transfer
- Scan QR codes for easy cryptocurrency transfers
- Create several wallets
- Select your own custom nodes/servers
- Address book
- Backup to an external location or iCloud
- Send to OpenAlias, Unstoppable Domains, Yats, and FIO Crypto Handles
- Set desired network fee level
- Store local transaction notes
- Extremely simple user experience
- Convenient exchange and sending templates for recurring payments
- Create donation links and invoices in the receive screen
- Robust privacy settings (eg: Tor-only connections)
- Robust security settings (eg: Cake 2FA)

### Monero Specific Features

* The Monero view key is retained on the device for maximum privacy
* Full support for Monero subaddresses and accounts
* Specify restore height for faster syncing
* Specify multiple recipients for batch sending
* Optionally set Monero nodes as trusted for faster syncing
* Specify a proxy for Monero nodes, compatible with Tor and i2p
- The Monero view key is retained on the device for maximum privacy
- Full support for Monero subaddresses and accounts
- Specify restore height for faster syncing
- Specify multiple recipients for batch sending
- Optionally set Monero nodes as trusted for faster syncing
- Specify a proxy for Monero nodes, compatible with Tor and i2p

### Bitcoin Specific Features

* Bitcoin coin control (specify specific outputs to spend)
* Automatically generate new addresses
* Specify multiple recipients for batch sending
- Bitcoin coin control (specify specific outputs to spend)
- Automatically generate new addresses
- Specify multiple recipients for batch sending

### Ethereum Specific Features

* Store ETH and all ERc-20 tokens
* Add custom tokens by contract address
* Enable or disable Etherscan for transaction history
- Store ETH and all ERc-20 tokens
- Add custom tokens by contract address
- Enable or disable Etherscan for transaction history

### Litecoin Specific Features

* Litecoin coin control (specify specific outputs to spend)
* Automatically generate new addresses
* Specify multiple recipients for batch sending
- Litecoin coin control (specify specific outputs to spend)
- Automatically generate new addresses
- Specify multiple recipients for batch sending

### Haven Specific Features

* Send, receive, and store XHV and all xAssets like xUSD, xEUR, xAG, etc.
- Send, receive, and store XHV and all xAssets like xUSD, xEUR, xAG, etc.

### Salvium Specific Features

- Add Salvium specfic features here

# Monero.com by Cake Wallet for Android and iOS

## Open Source Monero-Only Wallet

*Exchanging to/from other assets is also supported.*
_Exchanging to/from other assets is also supported._

## Links

* Website: https://monero.com
* App Store (iOS): https://apps.apple.com/app/id1601990386
* Google Play: https://play.google.com/store/apps/details?id=com.monero.app
* F-Droid: https://fdroid.cakelabs.com
* APK: https://github.com/cake-tech/cake_wallet/releases
- Website: https://monero.com
- App Store (iOS): https://apps.apple.com/app/id1601990386
- Google Play: https://play.google.com/store/apps/details?id=com.monero.app
- F-Droid: https://fdroid.cakelabs.com
- APK: https://github.com/cake-tech/cake_wallet/releases

### APK Verification

Expand Down
46 changes: 23 additions & 23 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
include: package:lints/recommended.yaml


analyzer:
exclude: [
build/**,
lib/**.g.dart,
cw_core/lib/**.g.dart,
cw_haven/lib/**.g.dart,
cw_monero/lib/**.g.dart,
lib/generated/*.dart,
cw_monero/ios/External/**,
cw_shared_external/**,
shared_external/**,
lib/bitcoin/cw_bitcoin.dart,
lib/bitcoin_cash/cw_bitcoin_cash.dart,
lib/ethereum/cw_ethereum.dart,
lib/haven/cw_haven.dart,
lib/monero/cw_monero.dart,
lib/nano/cw_nano.dart,
lib/polygon/cw_polygon.dart,
lib/solana/cw_solana.dart,
lib/tron/cw_tron.dart,
lib/wownero/cw_wownero.dart,
exclude:
[
build/**,
lib/**.g.dart,
cw_core/lib/**.g.dart,
cw_haven/lib/**.g.dart,
cw_salvium/lib/**.g.dart,
cw_monero/lib/**.g.dart,
lib/generated/*.dart,
cw_monero/ios/External/**,
cw_shared_external/**,
shared_external/**,
lib/bitcoin/cw_bitcoin.dart,
lib/bitcoin_cash/cw_bitcoin_cash.dart,
lib/ethereum/cw_ethereum.dart,
lib/haven/cw_haven.dart,
lib/salvium/cw_salvium.dart,
lib/monero/cw_monero.dart,
lib/nano/cw_nano.dart,
lib/polygon/cw_polygon.dart,
lib/solana/cw_solana.dart,
lib/tron/cw_tron.dart,
lib/wownero/cw_wownero.dart,
]
language:
strict-casts: true
Expand All @@ -32,8 +34,6 @@ linter:
- cancel_subscriptions
- always_declare_return_types
- prefer_final_fields


# analyzer:
# strong-mode:
# implicit-casts: false
Expand Down
11 changes: 11 additions & 0 deletions android/app/src/main/java/com/cakewallet/salvium/Application.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.cakewallet.salvium;

import io.flutter.app.FlutterApplication;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class Application extends FlutterApplication implements PluginRegistrantCallback {
@Override
public void registerWith(PluginRegistry registry) {}
}
83 changes: 83 additions & 0 deletions android/app/src/main/java/com/cakewallet/salvium/MainActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package com.cakewallet.salvium;

import androidx.annotation.NonNull;

import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugins.GeneratedPluginRegistrant;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;

import android.os.AsyncTask;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.WindowManager;
import android.content.Intent;
import android.net.Uri;
import android.os.PowerManager;
import android.provider.Settings;

import java.security.SecureRandom;

public class MainActivity extends FlutterFragmentActivity {
final String UTILS_CHANNEL = "com.cake_wallet/native_utils";

@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);

MethodChannel utilsChannel =
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(),
UTILS_CHANNEL);

utilsChannel.setMethodCallHandler(this::handle);
}

private void handle(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
Handler handler = new Handler(Looper.getMainLooper());

try {
switch (call.method) {
case "sec_random":
int count = call.argument("count");
SecureRandom random = new SecureRandom();
byte bytes[] = new byte[count];
random.nextBytes(bytes);
handler.post(() -> result.success(bytes));
break;
case "disableBatteryOptimization":
disableBatteryOptimization();
handler.post(() -> result.success(null));
break;
case "isBatteryOptimizationDisabled":
boolean isDisabled = isBatteryOptimizationDisabled();
handler.post(() -> result.success(isDisabled));
break;
default:
handler.post(() -> result.notImplemented());
}
} catch (Exception e) {
handler.post(() -> result.error("UNCAUGHT_ERROR", e.getMessage(), null));
}
}

private void disableBatteryOptimization() {
String packageName = getPackageName();
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
if (!pm.isIgnoringBatteryOptimizations(packageName)) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
intent.setData(Uri.parse("package:" + packageName));
startActivity(intent);
}
}

private boolean isBatteryOptimizationDisabled() {
String packageName = getPackageName();
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
return pm.isIgnoringBatteryOptimizations(packageName);
}

}
Binary file added assets/images/salvium_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/salvium_menu.png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/salvium_node_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- uri: seed01.salvium.io:19081
useSSL: true
is_default: true
3 changes: 3 additions & 0 deletions cw_core/lib/crypto_currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
CryptoCurrency.tbtc,
CryptoCurrency.wow,
CryptoCurrency.ton,
CryptoCurrency.sal,
];

static const havenCurrencies = [
Expand Down Expand Up @@ -226,6 +227,8 @@ class CryptoCurrency extends EnumerableItem<int> with Serializable<int> implemen
static const wow = CryptoCurrency(title: 'WOW', fullName: 'Wownero', raw: 94, name: 'wow', iconPath: 'assets/images/wownero_icon.png', decimals: 11);
static const ton = CryptoCurrency(title: 'TON', fullName: 'Toncoin', raw: 95, name: 'ton', iconPath: 'assets/images/ton_icon.png', decimals: 8);

static const sal = CryptoCurrency(title: 'SAL', fullName: 'Salvium', raw: 96, name: 'sal', iconPath: 'assets/images/salvium_logo.png', decimals: 8);


static final Map<int, CryptoCurrency> _rawCurrencyMap =
[...all, ...havenCurrencies].fold<Map<int, CryptoCurrency>>(<int, CryptoCurrency>{}, (acc, item) {
Expand Down
Loading