Skip to content

Commit

Permalink
add muxed accounts, memo and grace period support for SEP-10
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Sep 27, 2021
1 parent 37e42ef commit 9a5aeb9
Show file tree
Hide file tree
Showing 6 changed files with 461 additions and 120 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.2.3] - 27.Sep.2021.
- muxed accounts and memo support for SEP-10
- grace period for timebounds validation in SEP-10

## [1.2.2] - 26.Sep.2021.
- protocol 18 support

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Soneso open source Stellar SDK for Flutter is build with Dart and provides A
1. Add the dependency to your pubspec.yaml file:
```
dependencies:
stellar_flutter_sdk: ^1.2.2
stellar_flutter_sdk: ^1.2.3
```
2. Install it (command line or IDE):
```
Expand Down
16 changes: 10 additions & 6 deletions lib/src/key_pair.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:fixnum/fixnum.dart' as fixNum;
import 'package:pinenacl/ed25519.dart' as ed25519;
import 'muxed_account.dart';
import 'dart:typed_data';
import "util.dart";
import 'network.dart';
Expand Down Expand Up @@ -165,13 +166,16 @@ class KeyPair {

/// Creates a new KeyPair object from a stellar [accountId].
static KeyPair fromAccountId(String? accountId) {
if (accountId!.startsWith('M')) {
Uint8List bytes = StrKey.decodeStellarMuxedAccountId(accountId);
XdrMuxedAccountMed25519 muxMed25519 =
XdrMuxedAccountMed25519.decode(XdrDataInputStream(bytes));
return fromPublicKey(muxMed25519.ed25519!.uint256!);
if (accountId == null) {
throw Exception("accountId can not be null");
}
Uint8List decoded = StrKey.decodeStellarAccountId(accountId);
String toDecode = accountId;

if (toDecode.startsWith('M')) {
MuxedAccount m = MuxedAccount.fromMed25519AccountId(toDecode);
toDecode = m.ed25519AccountId!;
}
Uint8List decoded = StrKey.decodeStellarAccountId(toDecode);
return fromPublicKey(decoded);
}

Expand Down
Loading

0 comments on commit 9a5aeb9

Please sign in to comment.