Skip to content

Commit

Permalink
V4.0.0
Browse files Browse the repository at this point in the history
- Minimum required Dart SDK version updated to 3.3.
- Implemented an abstract class for chain services.
- Unified service provider design to support a single provider architecture across all `MRTNETWORK` packages.
  • Loading branch information
mrtnetwork committed Jan 2, 2025
1 parent 5a866c1 commit e042b98
Show file tree
Hide file tree
Showing 306 changed files with 3,725 additions and 2,719 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.0.0

- Minimum required Dart SDK version updated to 3.3.
- Ensure compatibility with the latest Dart features and improvements.

## 3.5.0

- Implemented Monero cryptographic operations.
Expand Down
44 changes: 43 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
void main() {}
// ignore_for_file: unused_local_variable

import 'package:blockchain_utils/blockchain_utils.dart';

void main() {
const String passphrase = 'MRTNETWORK';
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese)
.fromWordsNumber(Bip39WordsNum.wordsNum24);
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase);
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum);
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath;
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress;

final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
final defaultTronWallet = ethereumWallet.deriveDefaultPath;
final tronaddress = defaultEthereumWallet.publicKey.toAddress;

Bip49.fromSeed(seed, Bip49Coins.litecoin);
Bip84.fromSeed(seed, Bip84Coins.bitcoin);
Bip86.fromSeed(seed, Bip86Coins.bitcoin);

final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;

final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr());

final substrate = Substrate.fromSeed(
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519);
final substrateAddress = substrate.publicKey.toAddress;

final moneromnemonic =
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25);
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate();
final monero = MoneroAccount.fromSeed(moneroSeed);
final moneroAddress = monero.primaryAddress;
final subAddress = monero.subaddress(1, majorIndex: 0);

final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1));
final edWallet = slip10Ed.derivePath("44'/0'/0'");
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1));
final ecWallet = slipScp.derivePath("44'/0'/0'/1/2");
}
22 changes: 11 additions & 11 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
url: "https://pub.dev"
source: hosted
version: "72.0.0"
version: "76.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.2"
version: "0.3.3"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
url: "https://pub.dev"
source: hosted
version: "6.7.0"
version: "6.11.0"
args:
dependency: transitive
description:
Expand All @@ -44,7 +44,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.5.0"
version: "4.0.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -65,10 +65,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
convert:
dependency: transitive
description:
Expand Down Expand Up @@ -190,10 +190,10 @@ packages:
dependency: transitive
description:
name: macros
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
url: "https://pub.dev"
source: hosted
version: "0.1.2-main.4"
version: "0.1.3-main.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -302,7 +302,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_map_stack_trace:
dependency: transitive
description:
Expand Down
253 changes: 39 additions & 214 deletions example/test/test_test.dart
Original file line number Diff line number Diff line change
@@ -1,221 +1,46 @@
// // // ignore_for_file: avoid_print
// ignore_for_file: unused_local_variable

// import 'package:example/test/address/ada_shelly/ada_shelly.dart';
// import 'package:example/test/address/algo/algo.dart';
// import 'package:example/test/address/aptos/aptos.dart';
// import 'package:example/test/address/atom/atom.dart';
// import 'package:example/test/address/avax/avax.dart';
// import 'package:example/test/address/bch_p2pkh/bch_p2pkh.dart';
// import 'package:example/test/address/bch_p2sh/bch_p2sh.dart';
// import 'package:example/test/address/egld/egld.dart';
// import 'package:example/test/address/eos/eos.dart';
// import 'package:example/test/address/ergo/ergo.dart';
// import 'package:example/test/address/eth/eth.dart';
// import 'package:example/test/address/fil/fil.dart';
// import 'package:example/test/address/icx/icx.dart';
// import 'package:example/test/address/inj/inj.dart';
// import 'package:example/test/address/nano/nano.dart';
// import 'package:example/test/address/near/near.dart';
// import 'package:example/test/address/neo/neo.dart';
// import 'package:example/test/address/okex/okex.dart';
// import 'package:example/test/address/one/one.dart';
// import 'package:example/test/address/p2pkh/p2pkh.dart';
// import 'package:example/test/address/p2sh/p2sh.dart';
// import 'package:example/test/address/p2tr/p2tr.dart';
// import 'package:example/test/address/p2wpkh/p2wpkh.dart';
// import 'package:example/test/address/sol/sol.dart';
// import 'package:example/test/address/substrate/substrate.dart';
// import 'package:example/test/address/trx/trx.dart';
// import 'package:example/test/address/xlm/xml.dart';
// import 'package:example/test/address/xmr/xmr.dart';
// import 'package:example/test/address/xrp/xrp.dart';
// import 'package:example/test/address/xtz/xtz.dart';
// import 'package:example/test/address/zil/zil.dart';
// import 'package:example/test/algorand/mnemonic.dart';
// import 'package:example/test/base58/base58.dart';
// import 'package:example/test/base58/base58_xmr.dart';
// import 'package:example/test/bech32/bch_bech32.dart';
// import 'package:example/test/bech32/bech32.dart';
// import 'package:example/test/bech32/segwit_bech32.dart';
// import 'package:example/test/bip/bip32/ed25519/ed25519.dart';
// import 'package:example/test/bip/bip32/ed25519_blake2b/ed25519_blake2b.dart';
// import 'package:example/test/bip/bip32/ed25519_khalow/ed25519_khalow.dart';
// import 'package:example/test/bip/bip32/nist256p1/nist256p1.dart';
// import 'package:example/test/bip/bip32/secp256k1/secp256k1.dart';
// import 'package:example/test/bip/bip38/bip38_addr.dart';
// import 'package:example/test/bip/bip38/bip38_ec.dart';
// import 'package:example/test/bip/bip38/bip38_no_ec.dart';
// import 'package:example/test/bip/bip39/bip39.dart';
// import 'package:example/test/bip/bip44/bip44.dart';
// import 'package:example/test/bip/bip49/bip49.dart';
// import 'package:example/test/bip/bip84/bip84.dart';
// import 'package:example/test/bip/bip86/bip86.dart';
// import 'package:example/test/cardano/bip32/icarus.dart';
// import 'package:example/test/cardano/bip32/legacy.dart';
// import 'package:example/test/cardano/byron/byron_lagacy.dart';
// import 'package:example/test/cardano/cip1852/cip1852.dart';
// import 'package:example/test/cardano/mnemonic/mnemonic.dart';
// import 'package:example/test/cardano/shelly/shelly.dart';
// import 'package:example/test/cbor.dart';
// import 'package:example/test/crypto/aes/aes_ctr.dart';
// import 'package:example/test/crypto/blake2b/blake2b.dart';
// import 'package:example/test/crypto/chacha20_poly1305/chacha20_poly1305.dart';
// import 'package:example/test/crypto/crc32/crc32.dart';
// import 'package:example/test/crypto/hmac/hmac.dart';
// import 'package:example/test/crypto/keccack/keccack.dart';
// import 'package:example/test/crypto/md4/md4.dart';
// import 'package:example/test/crypto/md5/md5.dart';
// import 'package:example/test/crypto/pbkdf2/pbkdf2.dart';
// import 'package:example/test/crypto/ripemd/ripemd.dart';
// import 'package:example/test/crypto/scrypt/scrypt.dart';
// import 'package:example/test/crypto/sha1/sha1.dart';
// import 'package:example/test/crypto/sha256/sha256.dart';
// import 'package:example/test/crypto/sha3/sha3.dart';
// import 'package:example/test/crypto/sha512/sha512.dart';
// import 'package:example/test/crypto/sha512_256/sha512_256.dart';
// import 'package:example/test/crypto/shake/shake.dart';
// import 'package:example/test/crypto/x_modem_crc/x_modem_crc.dart';
// import 'package:example/test/ecdsa/ed.dart';
// import 'package:example/test/ecdsa/projective.dart';
// import 'package:example/test/elctrum/mnemonic/mnemonic.dart';
// import 'package:example/test/elctrum/v1/v1.dart';
// import 'package:example/test/elctrum/v2/v2.dart';
// import 'package:example/test/monero/mnemonic/monero_mnemonic.dart';
// import 'package:example/test/monero/monero.dart';
// import 'package:example/test/schnorrkel/derive.dart';
// import 'package:example/test/schnorrkel/schnorrkel_key.dart';
// import 'package:example/test/schnorrkel/sign.dart';
// import 'package:example/test/schnorrkel/vrf.dart';
// import 'package:example/test/secure_storage.dart';
// import 'package:example/test/ss58/ss58.dart';
// import 'package:example/test/substrate/scale.dart';
// import 'package:example/test/substrate/substrate.dart';
// import 'package:example/test/uuid.dart';
// import 'package:example/test/wif/wif.dart';
// import 'package:flutter/foundation.dart';
import 'package:blockchain_utils/blockchain_utils.dart';

// void main() {
// _testAll();
// }
void main() {
const String passphrase = 'MRTNETWORK';
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese)
.fromWordsNumber(Bip39WordsNum.wordsNum24);
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase);
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum);
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath;
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress;

// typedef TestMethod = void Function();
final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
final defaultTronWallet = ethereumWallet.deriveDefaultPath;
final tronaddress = defaultEthereumWallet.publicKey.toAddress;

// /// its very slow in web debugging
// /// if you want to test this method on the web should remove the condition
// void _web() {
// if (kIsWeb) return;
// _test("bip38 No Ecdsa", bip38NoEcdsaTest);
// _test("bip38 ECDSA", bip38ECDSATest);
// _test("scrypt", testScrypt);
// _test("pbkdf2", pbkdf2Test);
// _test("secure storage", testSecureStorage);
// }
Bip49.fromSeed(seed, Bip49Coins.litecoin);
Bip84.fromSeed(seed, Bip84Coins.bitcoin);
Bip86.fromSeed(seed, Bip86Coins.bitcoin);

// void _test(String name, TestMethod process) {
// try {
// process();
// print("success $name");
// } catch (e) {
// print("failed $name $e");
// throw Exception();
// }
// }
final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;

// void _testAll() async {
// final DateTime start = DateTime.now();
// _encodeDecodeAddrTest();
// _test("UUID", testUUID);
// _test("bech32", bech32Test);
// _test("wif", wifTest);
// _test("substrate scale", substrateScaleTest);
// _test("ss58", ss58Test);
// _test("bip38 ", bip38Test);
// _test("segwit Bech32 ", segwitBech32Test);
// _test("bch bech32", bchBech32Test);
// _test("base58 xmr", testBase58XMR);
// _test("base58", testBase58);
// _test("bip49", bip49Test);
// _test("bip44", bip44Test);
// _test("algorandMnemonic and derive address", algorandMnemonicAndAddressTest);
// _test("substrate derive", substrateDeriveTest);
// _test("monero mnemonic", moneroMnemonucTest);
// _test("monero", moneroTest);
// _test("electrum v2", electrumV2Test);
// _test("electrum v1", electrumV1Test);
// _test("electrum mnemonic", electrumMnemonicTest);
// _test("cardano shelly", cardanoShellyTest);
// _test("cardano mnemonic", cardanoMnemonicTest);
// _test("cardano cip1852", cip1852Test);
// _test("byron legacy", byronLegacyTest);
// _test("cardano icarus", cardanoIcarusTest);
// _test("cardano legacy", cardanoLegacyTest);
// _test("bip86", bip86Test);
// _test("bip84", bip84Test);
// _test("bip39", testBip39);
// _test("secp256k1", secpTest);
// _test("nist", nistTest);
// _test("ed25519-blake2b", edBlake2bTest);
// _test("ed25519-khalow", edKhalowTest);
// _test("ed25519", edTest);
// _test("schnorr", schnoorTestDerive);
// _test("vrf sigh", vrfSignTest);
// _test("schnorrkel keys", schnoorKeyTest);
// _test("schnorrkel-sign", testSchnoor);
// _test("ecdsa", testECDSA);
// _test("eddsa", testEDDSa);
// _test("sha1", testSha1);
// _test("ripemd", testRipemd);
// _test("md5", md5Test);
// _test("md4", md4Test);
// _test("keccack", testKecc);
// _test("hmac", testHmac);
// _test("crc", crcTest);
// _test("chacha-poly1305", chachaTest);
// _test("aes", testAes);
// _test("blake2b", blake2bTest);
// _test("sha256", testSha256);
// _test("sha512", testSha512);
// _test("sha3", testSha3);
// _test("sha512/256", testSha512256);
// _test("modemCrc", testModemCrc);
// _test("shake digest", testShakeDigest);
// _test("cbor test", cborTest);
// _web();
// final DateTime end = DateTime.now();
// print("end: ${end.difference(start).inMilliseconds}");
// }
final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr());

// void _encodeDecodeAddrTest() {
// _test("zil Address", zilAddressTest);
// _test("xtz Address", xtzAddressTest);
// _test("xrp Address", xrpAddressTest);
// _test("xmr Address", xmrAddressTest);
// _test("xlm Address", xlmAddressTest);
// _test("trx Address", trxAddressTest);
// _test("substrate Address", substrateAddressTest);
// _test("sol Address", solAddressTest);
// _test("p2wpkh Address", p2wpkhAddressTest);
// _test("p2tr Address", p2trAddressTest);
// _test("p2sh Address", p2shAddressTest);
// _test("p2pkh Address", p2pkhAddressTest);
// _test("one Address", oneAddressTest);
// _test("okex Address", okexAddressTest);
// _test("neo Address", neoAddressTest);
// _test("near Address", nearAddressTest);
// _test("nano Address", nanoAddressTest);
// _test("injAddressTest", injAddressTest);
// _test("icx Address", icxAddressTest);
// _test("fil Address", filAddressTest);
// _test("ethereum Address", ethereumAddressTest);
// _test("ergo Address", ergoAddressTest);
// _test("eos Address", eosAddrTest);
// _test("egld Address", egldAddrTest);
// _test("bchP2sh Address", bchP2shAddressTest);
// _test("bchP2pkh Address", bchP2pkhTest);
// _test("avax Address", avaxAddrTest);
// _test("atom Address", atomAddressTest);
// _test("aptos Address", aptosAddressTest);
// _test("algo Address", algoAddressTest);
// _test("ada Shelly Address", adaShellyAddrTest);
// }
void main() {}
// final cardano = CardanoShelley.fromCip1852Object(seed, Bip44Coins.tron);
// final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
// final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;
final substrate = Substrate.fromSeed(
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519);
final substrateAddress = substrate.publicKey.toAddress;

final moneromnemonic =
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25);
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate();
final monero = MoneroAccount.fromSeed(moneroSeed);
final moneroAddress = monero.primaryAddress;
final subAddress = monero.subaddress(1, majorIndex: 0);

final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1));
final edWallet = slip10Ed.derivePath("44'/0'/0'");
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1));
final ecWallet = slipScp.derivePath("44'/0'/0'");
}
Loading

0 comments on commit e042b98

Please sign in to comment.