Skip to content

Commit 4f1175a

Browse files
add nonce for address
1 parent 17ff06f commit 4f1175a

File tree

7 files changed

+20
-7
lines changed

7 files changed

+20
-7
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.5.6] - 22.Jun.2023.
2+
- fix soroban events request
3+
- extend soroban server (latest ledger, nonce for address)
4+
- SEP 0006 improvements
5+
- extend test cases
6+
17
## [1.5.5] - 31.Mai.2023.
28
- add support for soroban prev 9
39
- improve soroban tests & docs

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Soneso open source Stellar SDK for Flutter is build with Dart and provides A
1111
1. Add the dependency to your pubspec.yaml file:
1212
```
1313
dependencies:
14-
stellar_flutter_sdk: ^1.5.5
14+
stellar_flutter_sdk: ^1.5.6
1515
```
1616
2. Install it (command line or IDE):
1717
```

documentation/sdk_api_doc.zip

7.92 KB
Binary file not shown.

lib/src/soroban/soroban_server.dart

+9-2
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,20 @@ class SorobanServer {
208208
/// specified by the contractId.
209209
/// Used for contract auth.
210210
Future<int> getNonce(String accountId, String contractId) async {
211+
Address address = Address.forAccountId(accountId);
212+
return getNonceForAddress(address, contractId);
213+
}
214+
215+
/// Helper method to get the nonce for a given address (account or contract)
216+
/// for the contract specified by the contractId.
217+
/// Used for contract auth.
218+
Future<int> getNonceForAddress(Address address, String contractId) async {
211219
XdrLedgerKey ledgerKey = XdrLedgerKey(XdrLedgerEntryType.CONTRACT_DATA);
212220
ledgerKey.contractID = XdrHash(Util.hexToBytes(contractId));
213-
Address address = Address.forAccountId(accountId);
214221
XdrSCVal nonceKeyVal = XdrSCVal.forNonceKeyWithAddress(address);
215222
ledgerKey.contractDataKey = nonceKeyVal;
216223
GetLedgerEntryResponse response =
217-
await getLedgerEntry(ledgerKey.toBase64EncodedXdrString());
224+
await getLedgerEntry(ledgerKey.toBase64EncodedXdrString());
218225
if (!response.isErrorResponse &&
219226
response.ledgerEntryDataXdr != null &&
220227
response.ledgerEntryDataXdr!.contractData != null) {

lib/src/stellar_sdk.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import 'requests/liquidity_pools_request_builder.dart';
3131

3232
/// Main class of the flutter stellar sdk.
3333
class StellarSDK {
34-
static const versionNumber = "1.5.5";
34+
static const versionNumber = "1.5.6";
3535

3636
static final StellarSDK PUBLIC = StellarSDK("https://horizon.stellar.org");
3737
static final StellarSDK TESTNET = StellarSDK("https://horizon-testnet.stellar.org");

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: stellar_flutter_sdk
22
description: A stellar blockchain sdk that query's horizon, build, signs and submits transactions to the stellar network.
3-
version: 1.5.5
3+
version: 1.5.6
44
homepage: https://github.com/Soneso/stellar_flutter_sdk
55

66
environment:

test/query_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void main() {
182182
/// ! get Claimable Balance ID from BID result at claimable_balance_test.dart
183183
Page<OperationResponse> operationsPage = await sdk.operations
184184
.forClaimableBalance(
185-
"00000000d27ed397b3d3c74e6ced223e26c000029889ac0501f5fae11bf647657a749762")
185+
"00000000e883d22acfa2f9a904eb260262d2d53a013fdf618a423d03e4ffa5aca8e1936f")
186186
.limit(1)
187187
.order(RequestBuilderOrder.DESC)
188188
.execute();
@@ -195,7 +195,7 @@ void main() {
195195
/// ! get Claimable Balance ID from BID result at claimable_balance_test.dart
196196
Page<TransactionResponse> transactionsPage = await sdk.transactions
197197
.forClaimableBalance(
198-
"00000000d27ed397b3d3c74e6ced223e26c000029889ac0501f5fae11bf647657a749762")
198+
"00000000d424d26a793f8af968cdfc01b3254ac634dc6c96da94405e719077a0a18f8ace")
199199
.limit(1)
200200
.order(RequestBuilderOrder.DESC)
201201
.execute();

0 commit comments

Comments
 (0)