Compare commits
1 Commits
master
...
substrate-
Author | SHA1 | Date |
---|---|---|
poka | 89ae21cde9 |
|
@ -1,6 +1,5 @@
|
||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:fast_base58/fast_base58.dart';
|
import 'package:fast_base58/fast_base58.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -10,13 +9,10 @@ import 'package:polkawallet_sdk/api/types/networkParams.dart';
|
||||||
import 'package:polkawallet_sdk/api/types/txInfoData.dart';
|
import 'package:polkawallet_sdk/api/types/txInfoData.dart';
|
||||||
import 'package:polkawallet_sdk/polkawallet_sdk.dart';
|
import 'package:polkawallet_sdk/polkawallet_sdk.dart';
|
||||||
import 'package:polkawallet_sdk/storage/keyring.dart';
|
import 'package:polkawallet_sdk/storage/keyring.dart';
|
||||||
import 'package:polkawallet_sdk/storage/localStorage.dart';
|
|
||||||
import 'package:polkawallet_sdk/utils/localStorage.dart';
|
|
||||||
import 'package:truncate/truncate.dart';
|
import 'package:truncate/truncate.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
|
||||||
|
|
||||||
class SubstrateSdk with ChangeNotifier {
|
class SubstrateSdk with ChangeNotifier {
|
||||||
final List subNode = ['127.0.0.1:9944', '192.168.1.45:9944'];
|
final List subNode = ['127.0.0.1:9944', '192.168.1.72:9944'];
|
||||||
final bool isSsl = false;
|
final bool isSsl = false;
|
||||||
final int ss58 = 42;
|
final int ss58 = 42;
|
||||||
|
|
||||||
|
@ -97,7 +93,8 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
key: keyToImport,
|
key: keyToImport,
|
||||||
name: 'testKey',
|
name: 'testKey',
|
||||||
password: keystorePassword.text,
|
password: keystorePassword.text,
|
||||||
derivePath: derivePath)
|
derivePath: derivePath,
|
||||||
|
cryptoType: CryptoType.sr25519)
|
||||||
.catchError((e) {
|
.catchError((e) {
|
||||||
importIsLoading = false;
|
importIsLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -178,12 +175,13 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
onStatusChange: (status) {
|
onStatusChange: (status) {
|
||||||
print('status: ' + status);
|
print('status: ' + status);
|
||||||
if (status == 'Ready') {
|
if (status == 'Ready') {
|
||||||
snack(context, 'Paiement effectué avec succès !');
|
snack(context, 'Transaction terminé');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
print(hash.toString());
|
print(hash.toString());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
print('taterror');
|
||||||
print(err.toString());
|
print(err.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -196,7 +194,15 @@ class SubstrateSdk with ChangeNotifier {
|
||||||
final seedMap =
|
final seedMap =
|
||||||
await keyring.store.getDecryptedSeed(keypair.pubKey, password);
|
await keyring.store.getDecryptedSeed(keypair.pubKey, password);
|
||||||
print(seedMap);
|
print(seedMap);
|
||||||
generatedMnemonic = seedMap!['seed'];
|
if (seedMap!['type'] != 'mnemonic') return;
|
||||||
|
final List seedList = seedMap['seed'].split('/');
|
||||||
|
generatedMnemonic = seedList[0];
|
||||||
|
int sourceDerivation = -1; // To get derivation number of this account
|
||||||
|
if (seedList.length > 1) {
|
||||||
|
sourceDerivation = int.parse(seedMap['seed'].split('/')[1]);
|
||||||
|
}
|
||||||
|
print(generatedMnemonic);
|
||||||
|
print(sourceDerivation);
|
||||||
|
|
||||||
importAccount(fromMnemonic: true, derivePath: '/$number');
|
importAccount(fromMnemonic: true, derivePath: '/$number');
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
child: const Text("Dériver"),
|
child: const Text("Dériver"),
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
]);
|
]);
|
||||||
}),
|
}),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
const Text('Mot de passe du trousseau:'),
|
const Text('Mot de passe du trousseau:'),
|
||||||
|
@ -141,7 +141,7 @@ class SubstrateSandBox extends StatelessWidget {
|
||||||
onPrimary: Colors.black, // foreground
|
onPrimary: Colors.black, // foreground
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final res = await _sub.generateMnemonic();
|
await _sub.generateMnemonic();
|
||||||
_sub.importIsLoading = false;
|
_sub.importIsLoading = false;
|
||||||
_sub.reload();
|
_sub.reload();
|
||||||
snack(context, 'Le mnemonic a été copié');
|
snack(context, 'Le mnemonic a été copié');
|
||||||
|
|
|
@ -967,10 +967,10 @@ packages:
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: fixAndroidActivityVersion
|
ref: fixAndroidActivityVersion
|
||||||
resolved-ref: bcb33239d99605258361951f447ab097ff03208a
|
resolved-ref: "05d80150def4d5b3cac02ba4db96a39550719c9b"
|
||||||
url: "git://github.com/poka-IT/sdk.git"
|
url: "git://github.com/poka-IT/sdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.4.1"
|
version: "0.4.2"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -1350,7 +1350,7 @@ packages:
|
||||||
name: webview_flutter
|
name: webview_flutter
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.8.0"
|
version: "3.0.1"
|
||||||
webview_flutter_android:
|
webview_flutter_android:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -73,6 +73,7 @@ dependencies:
|
||||||
durt: ^0.1.6
|
durt: ^0.1.6
|
||||||
package_info_plus: ^1.3.0
|
package_info_plus: ^1.3.0
|
||||||
polkawallet_sdk: #^0.4.1 ## Wait for merging PR: https://github.com/polkawallet-io/sdk/pull/19
|
polkawallet_sdk: #^0.4.1 ## Wait for merging PR: https://github.com/polkawallet-io/sdk/pull/19
|
||||||
|
# path: ../substrate-sdk
|
||||||
git:
|
git:
|
||||||
url: git://github.com/poka-IT/sdk.git
|
url: git://github.com/poka-IT/sdk.git
|
||||||
ref: fixAndroidActivityVersion
|
ref: fixAndroidActivityVersion
|
||||||
|
|
Loading…
Reference in New Issue