Skip to content
Open
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
28 changes: 26 additions & 2 deletions lib/wallets/crypto_currency/coins/xelis.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class Xelis extends ElectrumCurrency {
_id = "xelisTestNet";
_name = "tXelis";
_ticker = "XET";
case CryptoCurrencyNetwork.stage:
_id = "xelisStageNet";
_name = "sXelis";
_ticker = "XET";
default:
throw Exception("Unsupported network: $network");
}
Expand Down Expand Up @@ -79,6 +83,22 @@ class Xelis extends ElectrumCurrency {
isPrimary: isPrimary,
);

case CryptoCurrencyNetwork.test:
return NodeModel(
host: "stagenet-node.xelis.io",
port: 443,
name: DefaultNodes.defaultName,
id: DefaultNodes.buildId(this),
useSSL: true,
enabled: true,
coinName: identifier,
isFailover: true,
isDown: false,
torEnabled: false,
clearnetEnabled: true,
isPrimary: isPrimary,
);

default:
throw Exception("Unsupported network: $network");
}
Expand All @@ -93,7 +113,7 @@ class Xelis extends ElectrumCurrency {
@override
bool validateAddress(String address) {
try {
return libXelis.isAddressValid(address: address);
return libXelis.isAddressValid(address: address, network: network);
} catch (_) {
return false;
}
Expand Down Expand Up @@ -133,7 +153,11 @@ class Xelis extends ElectrumCurrency {
Uri defaultBlockExplorer(String txid) {
switch (network) {
case CryptoCurrencyNetwork.main:
return Uri.parse("https://explorer.xelis.io/txs/$txid");
return Uri.parse("https://explorer.xelis.io/tx/$txid");
case CryptoCurrencyNetwork.test:
return Uri.parse("https://testnet-explorer.xelis.io/tx/$txid");
case CryptoCurrencyNetwork.stage:
return Uri.parse("https://stagenet-explorer.xelis.io/tx/$txid");
default:
throw Exception(
"Unsupported network for defaultBlockExplorer(): $network",
Expand Down
6 changes: 3 additions & 3 deletions lib/wallets/wallet/impl/xelis_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class XelisWallet extends LibXelisWallet {
seed: mnemonic,
network: cryptoCurrency.network,
precomputedTablesPath: tablePath,
l1Low: tableState.currentSize.isLow,
stack_l1Low: tableState.currentSize.isLow,
);

await secureStorageInterface.write(
Expand Down Expand Up @@ -91,7 +91,7 @@ class XelisWallet extends LibXelisWallet {
password: password,
network: cryptoCurrency.network,
precomputedTablesPath: tablePath,
l1Low: tableState.currentSize.isLow,
stack_l1Low: tableState.currentSize.isLow,
);

final mnemonic = await libXelis.getSeed(wallet);
Expand Down Expand Up @@ -123,7 +123,7 @@ class XelisWallet extends LibXelisWallet {
password: password!,
network: cryptoCurrency.network,
precomputedTablesPath: tablePath,
l1Low: tableState.currentSize.isLow,
stack_l1Low: tableState.currentSize.isLow,
);

await _finishInit();
Expand Down
3 changes: 1 addition & 2 deletions lib/wallets/wallet/intermediate/lib_xelis_wallet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,10 @@ extension XelisTableManagement on LibXelisWallet {

try {
Logging.instance.i("Xelis: Generating large tables in background");

final tablePath = await getPrecomputedTablesPath();
await libXelis.updateTables(
precomputedTablesPath: tablePath,
l1Low: state.desiredSize.isLow,
stack_l1Low: state.desiredSize.isLow,
);

await setTableState(
Expand Down
15 changes: 9 additions & 6 deletions lib/wl_gen/interfaces/lib_xelis_interface.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/foundation.dart';

import 'package:xelis_dart_sdk/src/data_transfer_objects/get_asset/max_supply_mode.dart';

import '../../providers/progress_report/xelis_table_progress_provider.dart';
import '../../wallets/crypto_currency/crypto_currency.dart';

Expand All @@ -18,7 +19,7 @@ abstract class LibXelisInterface {

Stream<XelisTableProgressState> createProgressReportStream();

bool isAddressValid({required String address});
bool isAddressValid({required String address, required CryptoCurrencyNetwork network});

bool validateSeedWord(String word);

Expand All @@ -32,7 +33,7 @@ abstract class LibXelisInterface {

Future<void> updateTables({
required String precomputedTablesPath,
required bool l1Low,
required bool stack_l1Low,
});

Future<String> getSeed(OpaqueXelisWallet wallet);
Expand All @@ -46,7 +47,7 @@ abstract class LibXelisInterface {
String? seed,
String? privateKey,
String? precomputedTablesPath,
bool? l1Low,
bool? stack_l1Low,
});

Future<OpaqueXelisWallet> openXelisWallet(
Expand All @@ -56,7 +57,7 @@ abstract class LibXelisInterface {
required String password,
required CryptoCurrencyNetwork network,
String? precomputedTablesPath,
bool? l1Low,
bool? stack_l1Low,
});

String getAddress(OpaqueXelisWallet wallet);
Expand Down Expand Up @@ -225,6 +226,8 @@ enum XelisTableSize {
low,
full;

// TODO: add more granular table size management interface
// for now, just patching the old system into the new FFI API
bool get isLow => this == XelisTableSize.low;

static XelisTableSize get platformDefault {
Expand Down Expand Up @@ -294,7 +297,7 @@ final class NewAsset extends Event {
// final xelis_sdk.AssetData asset;
final String name;
final int decimals;
final int? maxSupply;
final MaxSupplyMode? maxSupply;

NewAsset(this.name, this.decimals, this.maxSupply);
}
Expand Down
Loading
Loading