Skip to content

Commit e042b98

Browse files
committed
V4.0.0
- 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.
1 parent 5a866c1 commit e042b98

File tree

306 files changed

+3725
-2719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+3725
-2719
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.0.0
2+
3+
- Minimum required Dart SDK version updated to 3.3.
4+
- Ensure compatibility with the latest Dart features and improvements.
5+
16
## 3.5.0
27

38
- Implemented Monero cryptographic operations.

example/lib/main.dart

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
1-
void main() {}
1+
// ignore_for_file: unused_local_variable
2+
3+
import 'package:blockchain_utils/blockchain_utils.dart';
4+
5+
void main() {
6+
const String passphrase = 'MRTNETWORK';
7+
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese)
8+
.fromWordsNumber(Bip39WordsNum.wordsNum24);
9+
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase);
10+
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum);
11+
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath;
12+
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress;
13+
14+
final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
15+
final defaultTronWallet = ethereumWallet.deriveDefaultPath;
16+
final tronaddress = defaultEthereumWallet.publicKey.toAddress;
17+
18+
Bip49.fromSeed(seed, Bip49Coins.litecoin);
19+
Bip84.fromSeed(seed, Bip84Coins.bitcoin);
20+
Bip86.fromSeed(seed, Bip86Coins.bitcoin);
21+
22+
final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
23+
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
24+
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;
25+
26+
final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr());
27+
28+
final substrate = Substrate.fromSeed(
29+
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519);
30+
final substrateAddress = substrate.publicKey.toAddress;
31+
32+
final moneromnemonic =
33+
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25);
34+
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate();
35+
final monero = MoneroAccount.fromSeed(moneroSeed);
36+
final moneroAddress = monero.primaryAddress;
37+
final subAddress = monero.subaddress(1, majorIndex: 0);
38+
39+
final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1));
40+
final edWallet = slip10Ed.derivePath("44'/0'/0'");
41+
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1));
42+
final ecWallet = slipScp.derivePath("44'/0'/0'/1/2");
43+
}

example/pubspec.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ packages:
55
dependency: transitive
66
description:
77
name: _fe_analyzer_shared
8-
sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834
8+
sha256: "16e298750b6d0af7ce8a3ba7c18c69c3785d11b15ec83f6dcd0ad2a0009b3cab"
99
url: "https://pub.dev"
1010
source: hosted
11-
version: "72.0.0"
11+
version: "76.0.0"
1212
_macros:
1313
dependency: transitive
1414
description: dart
1515
source: sdk
16-
version: "0.3.2"
16+
version: "0.3.3"
1717
analyzer:
1818
dependency: transitive
1919
description:
2020
name: analyzer
21-
sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139
21+
sha256: "1f14db053a8c23e260789e9b0980fa27f2680dd640932cae5e1137cce0e46e1e"
2222
url: "https://pub.dev"
2323
source: hosted
24-
version: "6.7.0"
24+
version: "6.11.0"
2525
args:
2626
dependency: transitive
2727
description:
@@ -44,7 +44,7 @@ packages:
4444
path: ".."
4545
relative: true
4646
source: path
47-
version: "3.5.0"
47+
version: "4.0.0"
4848
boolean_selector:
4949
dependency: transitive
5050
description:
@@ -65,10 +65,10 @@ packages:
6565
dependency: transitive
6666
description:
6767
name: collection
68-
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
68+
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
6969
url: "https://pub.dev"
7070
source: hosted
71-
version: "1.18.0"
71+
version: "1.19.0"
7272
convert:
7373
dependency: transitive
7474
description:
@@ -190,10 +190,10 @@ packages:
190190
dependency: transitive
191191
description:
192192
name: macros
193-
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
193+
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
194194
url: "https://pub.dev"
195195
source: hosted
196-
version: "0.1.2-main.4"
196+
version: "0.1.3-main.0"
197197
matcher:
198198
dependency: transitive
199199
description:
@@ -302,7 +302,7 @@ packages:
302302
dependency: transitive
303303
description: flutter
304304
source: sdk
305-
version: "0.0.99"
305+
version: "0.0.0"
306306
source_map_stack_trace:
307307
dependency: transitive
308308
description:

example/test/test_test.dart

Lines changed: 39 additions & 214 deletions
Original file line numberDiff line numberDiff line change
@@ -1,221 +1,46 @@
1-
// // // ignore_for_file: avoid_print
1+
// ignore_for_file: unused_local_variable
22

3-
// import 'package:example/test/address/ada_shelly/ada_shelly.dart';
4-
// import 'package:example/test/address/algo/algo.dart';
5-
// import 'package:example/test/address/aptos/aptos.dart';
6-
// import 'package:example/test/address/atom/atom.dart';
7-
// import 'package:example/test/address/avax/avax.dart';
8-
// import 'package:example/test/address/bch_p2pkh/bch_p2pkh.dart';
9-
// import 'package:example/test/address/bch_p2sh/bch_p2sh.dart';
10-
// import 'package:example/test/address/egld/egld.dart';
11-
// import 'package:example/test/address/eos/eos.dart';
12-
// import 'package:example/test/address/ergo/ergo.dart';
13-
// import 'package:example/test/address/eth/eth.dart';
14-
// import 'package:example/test/address/fil/fil.dart';
15-
// import 'package:example/test/address/icx/icx.dart';
16-
// import 'package:example/test/address/inj/inj.dart';
17-
// import 'package:example/test/address/nano/nano.dart';
18-
// import 'package:example/test/address/near/near.dart';
19-
// import 'package:example/test/address/neo/neo.dart';
20-
// import 'package:example/test/address/okex/okex.dart';
21-
// import 'package:example/test/address/one/one.dart';
22-
// import 'package:example/test/address/p2pkh/p2pkh.dart';
23-
// import 'package:example/test/address/p2sh/p2sh.dart';
24-
// import 'package:example/test/address/p2tr/p2tr.dart';
25-
// import 'package:example/test/address/p2wpkh/p2wpkh.dart';
26-
// import 'package:example/test/address/sol/sol.dart';
27-
// import 'package:example/test/address/substrate/substrate.dart';
28-
// import 'package:example/test/address/trx/trx.dart';
29-
// import 'package:example/test/address/xlm/xml.dart';
30-
// import 'package:example/test/address/xmr/xmr.dart';
31-
// import 'package:example/test/address/xrp/xrp.dart';
32-
// import 'package:example/test/address/xtz/xtz.dart';
33-
// import 'package:example/test/address/zil/zil.dart';
34-
// import 'package:example/test/algorand/mnemonic.dart';
35-
// import 'package:example/test/base58/base58.dart';
36-
// import 'package:example/test/base58/base58_xmr.dart';
37-
// import 'package:example/test/bech32/bch_bech32.dart';
38-
// import 'package:example/test/bech32/bech32.dart';
39-
// import 'package:example/test/bech32/segwit_bech32.dart';
40-
// import 'package:example/test/bip/bip32/ed25519/ed25519.dart';
41-
// import 'package:example/test/bip/bip32/ed25519_blake2b/ed25519_blake2b.dart';
42-
// import 'package:example/test/bip/bip32/ed25519_khalow/ed25519_khalow.dart';
43-
// import 'package:example/test/bip/bip32/nist256p1/nist256p1.dart';
44-
// import 'package:example/test/bip/bip32/secp256k1/secp256k1.dart';
45-
// import 'package:example/test/bip/bip38/bip38_addr.dart';
46-
// import 'package:example/test/bip/bip38/bip38_ec.dart';
47-
// import 'package:example/test/bip/bip38/bip38_no_ec.dart';
48-
// import 'package:example/test/bip/bip39/bip39.dart';
49-
// import 'package:example/test/bip/bip44/bip44.dart';
50-
// import 'package:example/test/bip/bip49/bip49.dart';
51-
// import 'package:example/test/bip/bip84/bip84.dart';
52-
// import 'package:example/test/bip/bip86/bip86.dart';
53-
// import 'package:example/test/cardano/bip32/icarus.dart';
54-
// import 'package:example/test/cardano/bip32/legacy.dart';
55-
// import 'package:example/test/cardano/byron/byron_lagacy.dart';
56-
// import 'package:example/test/cardano/cip1852/cip1852.dart';
57-
// import 'package:example/test/cardano/mnemonic/mnemonic.dart';
58-
// import 'package:example/test/cardano/shelly/shelly.dart';
59-
// import 'package:example/test/cbor.dart';
60-
// import 'package:example/test/crypto/aes/aes_ctr.dart';
61-
// import 'package:example/test/crypto/blake2b/blake2b.dart';
62-
// import 'package:example/test/crypto/chacha20_poly1305/chacha20_poly1305.dart';
63-
// import 'package:example/test/crypto/crc32/crc32.dart';
64-
// import 'package:example/test/crypto/hmac/hmac.dart';
65-
// import 'package:example/test/crypto/keccack/keccack.dart';
66-
// import 'package:example/test/crypto/md4/md4.dart';
67-
// import 'package:example/test/crypto/md5/md5.dart';
68-
// import 'package:example/test/crypto/pbkdf2/pbkdf2.dart';
69-
// import 'package:example/test/crypto/ripemd/ripemd.dart';
70-
// import 'package:example/test/crypto/scrypt/scrypt.dart';
71-
// import 'package:example/test/crypto/sha1/sha1.dart';
72-
// import 'package:example/test/crypto/sha256/sha256.dart';
73-
// import 'package:example/test/crypto/sha3/sha3.dart';
74-
// import 'package:example/test/crypto/sha512/sha512.dart';
75-
// import 'package:example/test/crypto/sha512_256/sha512_256.dart';
76-
// import 'package:example/test/crypto/shake/shake.dart';
77-
// import 'package:example/test/crypto/x_modem_crc/x_modem_crc.dart';
78-
// import 'package:example/test/ecdsa/ed.dart';
79-
// import 'package:example/test/ecdsa/projective.dart';
80-
// import 'package:example/test/elctrum/mnemonic/mnemonic.dart';
81-
// import 'package:example/test/elctrum/v1/v1.dart';
82-
// import 'package:example/test/elctrum/v2/v2.dart';
83-
// import 'package:example/test/monero/mnemonic/monero_mnemonic.dart';
84-
// import 'package:example/test/monero/monero.dart';
85-
// import 'package:example/test/schnorrkel/derive.dart';
86-
// import 'package:example/test/schnorrkel/schnorrkel_key.dart';
87-
// import 'package:example/test/schnorrkel/sign.dart';
88-
// import 'package:example/test/schnorrkel/vrf.dart';
89-
// import 'package:example/test/secure_storage.dart';
90-
// import 'package:example/test/ss58/ss58.dart';
91-
// import 'package:example/test/substrate/scale.dart';
92-
// import 'package:example/test/substrate/substrate.dart';
93-
// import 'package:example/test/uuid.dart';
94-
// import 'package:example/test/wif/wif.dart';
95-
// import 'package:flutter/foundation.dart';
3+
import 'package:blockchain_utils/blockchain_utils.dart';
964

97-
// void main() {
98-
// _testAll();
99-
// }
5+
void main() {
6+
const String passphrase = 'MRTNETWORK';
7+
final mnemonic = Bip39MnemonicGenerator(Bip39Languages.japanese)
8+
.fromWordsNumber(Bip39WordsNum.wordsNum24);
9+
final seed = Bip39SeedGenerator(mnemonic).generate(passphrase);
10+
final ethereumWallet = Bip44.fromSeed(seed, Bip44Coins.ethereum);
11+
final defaultEthereumWallet = ethereumWallet.deriveDefaultPath;
12+
final ethereumaddress = defaultEthereumWallet.publicKey.toAddress;
10013

101-
// typedef TestMethod = void Function();
14+
final tronmWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
15+
final defaultTronWallet = ethereumWallet.deriveDefaultPath;
16+
final tronaddress = defaultEthereumWallet.publicKey.toAddress;
10217

103-
// /// its very slow in web debugging
104-
// /// if you want to test this method on the web should remove the condition
105-
// void _web() {
106-
// if (kIsWeb) return;
107-
// _test("bip38 No Ecdsa", bip38NoEcdsaTest);
108-
// _test("bip38 ECDSA", bip38ECDSATest);
109-
// _test("scrypt", testScrypt);
110-
// _test("pbkdf2", pbkdf2Test);
111-
// _test("secure storage", testSecureStorage);
112-
// }
18+
Bip49.fromSeed(seed, Bip49Coins.litecoin);
19+
Bip84.fromSeed(seed, Bip84Coins.bitcoin);
20+
Bip86.fromSeed(seed, Bip86Coins.bitcoin);
11321

114-
// void _test(String name, TestMethod process) {
115-
// try {
116-
// process();
117-
// print("success $name");
118-
// } catch (e) {
119-
// print("failed $name $e");
120-
// throw Exception();
121-
// }
122-
// }
22+
final bitconWallet = Bip44.fromSeed(seed, Bip44Coins.tron);
23+
final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
24+
final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;
12325

124-
// void _testAll() async {
125-
// final DateTime start = DateTime.now();
126-
// _encodeDecodeAddrTest();
127-
// _test("UUID", testUUID);
128-
// _test("bech32", bech32Test);
129-
// _test("wif", wifTest);
130-
// _test("substrate scale", substrateScaleTest);
131-
// _test("ss58", ss58Test);
132-
// _test("bip38 ", bip38Test);
133-
// _test("segwit Bech32 ", segwitBech32Test);
134-
// _test("bch bech32", bchBech32Test);
135-
// _test("base58 xmr", testBase58XMR);
136-
// _test("base58", testBase58);
137-
// _test("bip49", bip49Test);
138-
// _test("bip44", bip44Test);
139-
// _test("algorandMnemonic and derive address", algorandMnemonicAndAddressTest);
140-
// _test("substrate derive", substrateDeriveTest);
141-
// _test("monero mnemonic", moneroMnemonucTest);
142-
// _test("monero", moneroTest);
143-
// _test("electrum v2", electrumV2Test);
144-
// _test("electrum v1", electrumV1Test);
145-
// _test("electrum mnemonic", electrumMnemonicTest);
146-
// _test("cardano shelly", cardanoShellyTest);
147-
// _test("cardano mnemonic", cardanoMnemonicTest);
148-
// _test("cardano cip1852", cip1852Test);
149-
// _test("byron legacy", byronLegacyTest);
150-
// _test("cardano icarus", cardanoIcarusTest);
151-
// _test("cardano legacy", cardanoLegacyTest);
152-
// _test("bip86", bip86Test);
153-
// _test("bip84", bip84Test);
154-
// _test("bip39", testBip39);
155-
// _test("secp256k1", secpTest);
156-
// _test("nist", nistTest);
157-
// _test("ed25519-blake2b", edBlake2bTest);
158-
// _test("ed25519-khalow", edKhalowTest);
159-
// _test("ed25519", edTest);
160-
// _test("schnorr", schnoorTestDerive);
161-
// _test("vrf sigh", vrfSignTest);
162-
// _test("schnorrkel keys", schnoorKeyTest);
163-
// _test("schnorrkel-sign", testSchnoor);
164-
// _test("ecdsa", testECDSA);
165-
// _test("eddsa", testEDDSa);
166-
// _test("sha1", testSha1);
167-
// _test("ripemd", testRipemd);
168-
// _test("md5", md5Test);
169-
// _test("md4", md4Test);
170-
// _test("keccack", testKecc);
171-
// _test("hmac", testHmac);
172-
// _test("crc", crcTest);
173-
// _test("chacha-poly1305", chachaTest);
174-
// _test("aes", testAes);
175-
// _test("blake2b", blake2bTest);
176-
// _test("sha256", testSha256);
177-
// _test("sha512", testSha512);
178-
// _test("sha3", testSha3);
179-
// _test("sha512/256", testSha512256);
180-
// _test("modemCrc", testModemCrc);
181-
// _test("shake digest", testShakeDigest);
182-
// _test("cbor test", cborTest);
183-
// _web();
184-
// final DateTime end = DateTime.now();
185-
// print("end: ${end.difference(start).inMilliseconds}");
186-
// }
26+
final cardano = CardanoIcarusSeedGenerator(mnemonic.toStr());
18727

188-
// void _encodeDecodeAddrTest() {
189-
// _test("zil Address", zilAddressTest);
190-
// _test("xtz Address", xtzAddressTest);
191-
// _test("xrp Address", xrpAddressTest);
192-
// _test("xmr Address", xmrAddressTest);
193-
// _test("xlm Address", xlmAddressTest);
194-
// _test("trx Address", trxAddressTest);
195-
// _test("substrate Address", substrateAddressTest);
196-
// _test("sol Address", solAddressTest);
197-
// _test("p2wpkh Address", p2wpkhAddressTest);
198-
// _test("p2tr Address", p2trAddressTest);
199-
// _test("p2sh Address", p2shAddressTest);
200-
// _test("p2pkh Address", p2pkhAddressTest);
201-
// _test("one Address", oneAddressTest);
202-
// _test("okex Address", okexAddressTest);
203-
// _test("neo Address", neoAddressTest);
204-
// _test("near Address", nearAddressTest);
205-
// _test("nano Address", nanoAddressTest);
206-
// _test("injAddressTest", injAddressTest);
207-
// _test("icx Address", icxAddressTest);
208-
// _test("fil Address", filAddressTest);
209-
// _test("ethereum Address", ethereumAddressTest);
210-
// _test("ergo Address", ergoAddressTest);
211-
// _test("eos Address", eosAddrTest);
212-
// _test("egld Address", egldAddrTest);
213-
// _test("bchP2sh Address", bchP2shAddressTest);
214-
// _test("bchP2pkh Address", bchP2pkhTest);
215-
// _test("avax Address", avaxAddrTest);
216-
// _test("atom Address", atomAddressTest);
217-
// _test("aptos Address", aptosAddressTest);
218-
// _test("algo Address", algoAddressTest);
219-
// _test("ada Shelly Address", adaShellyAddrTest);
220-
// }
221-
void main() {}
28+
// final cardano = CardanoShelley.fromCip1852Object(seed, Bip44Coins.tron);
29+
// final defaultBitcoinWallet = ethereumWallet.deriveDefaultPath;
30+
// final bitconP2pkh = defaultEthereumWallet.publicKey.toAddress;
31+
final substrate = Substrate.fromSeed(
32+
List<int>.filled(32, 1), SubstrateCoins.polkadotSr25519);
33+
final substrateAddress = substrate.publicKey.toAddress;
34+
35+
final moneromnemonic =
36+
MoneroMnemonicGenerator().fromWordsNumber(MoneroWordsNum.wordsNum25);
37+
final moneroSeed = MoneroSeedGenerator(moneromnemonic).generate();
38+
final monero = MoneroAccount.fromSeed(moneroSeed);
39+
final moneroAddress = monero.primaryAddress;
40+
final subAddress = monero.subaddress(1, majorIndex: 0);
41+
42+
final slip10Ed = Bip32Slip10Ed25519.fromSeed(List<int>.filled(32, 1));
43+
final edWallet = slip10Ed.derivePath("44'/0'/0'");
44+
final slipScp = Bip32Slip10Secp256k1.fromSeed(List<int>.filled(32, 1));
45+
final ecWallet = slipScp.derivePath("44'/0'/0'");
46+
}

0 commit comments

Comments
 (0)