stack_wallet/lib/utilities/extensions/impl/string.dart

18 lines
587 B
Dart
Raw Normal View History

2023-03-03 17:35:43 +00:00
import 'dart:typed_data';
import 'package:dart_bs58/dart_bs58.dart';
import 'package:dart_bs58check/dart_bs58check.dart';
import 'package:hex/hex.dart';
import 'package:stackwallet/utilities/extensions/extensions.dart';
extension StringExtensions on String {
Uint8List get toUint8ListFromHex =>
Uint8List.fromList(HEX.decode(startsWith("0x") ? substring(2) : this));
Uint8List get toUint8ListFromBase58Encoded => bs58.decode(this);
Uint8List get toUint8ListFromBase58CheckEncoded => bs58check.decode(this);
BigInt get toBigIntFromHex => toUint8ListFromHex.toBigInt;
}