Skip to content

Commit 3061b37

Browse files
prepare for release 1.5.2
1 parent 4a94c0c commit 3061b37

File tree

5 files changed

+71
-3
lines changed

5 files changed

+71
-3
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [1.5.2] - 03.Mar.2023.
2+
- add support for soroban prev 7
3+
- add support for soroban auth next
4+
- extend txrep for soroban
5+
16
## [1.5.1] - 30.Jan.2023.
27
- improve submit transaction response
38
- add fee meta xdr

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.1
14+
stellar_flutter_sdk: ^1.5.2
1515
```
1616
2. Install it (command line or IDE):
1717
```

documentation/sdk_api_doc.zip

732 KB
Binary file not shown.

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.1
3+
version: 1.5.2
44
homepage: https://github.com/Soneso/stellar_flutter_sdk
55

66
environment:

soroban.md

+64-1
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,72 @@ InvokeHostFunctionOperation operation = InvokeHostFuncOpBuilder
331331
.forDeploySACWithAsset(asset).build();
332332
```
333333

334+
#### Soroban Authorization
335+
336+
The Flutter SDK provides support for the [Soroban Authorization Framework](https://soroban.stellar.org/docs/learn/authorization).
337+
338+
For this purpose, it offers the `Address`, `AuthorizedInvocation` and `ContractAuth` classes as well as helper functions like `getNonce(...)`.
339+
340+
Here is a code fragment showing how they can be used:
341+
342+
```dart
343+
Address invokerAddress = Address.forAccountId(invokerId);
344+
345+
String functionName = "auth";
346+
List<XdrSCVal> args = [invokerAddress.toXdrSCVal(), XdrSCVal.forU32(3)];
347+
348+
AuthorizedInvocation rootInvocation =
349+
AuthorizedInvocation(contractId, functionName, args: args);
350+
351+
int nonce = await sorobanServer.getNonce(invokerId, contractId);
352+
353+
ContractAuth contractAuth =
354+
ContractAuth(rootInvocation, address: invokerAddress, nonce: nonce);
355+
356+
// sign
357+
contractAuth.sign(invokerKeyPair, Network.FUTURENET);
358+
359+
InvokeHostFunctionOperation invokeOp =
360+
InvokeHostFuncOpBuilder.forInvokingContract(
361+
contractId, functionName,
362+
functionArguments: args, contractAuth: [contractAuth]).build();
363+
364+
// simulate first to obtain the footprint
365+
GetAccountResponse submitter =
366+
await sorobanServer.getAccount(submitterId);
367+
368+
Transaction transaction =
369+
TransactionBuilder(submitter).addOperation(invokeOp).build();
370+
371+
SimulateTransactionResponse simulateResponse =
372+
await sorobanServer.simulateTransaction(transaction);
373+
```
374+
375+
The example above invokes this assembly script [auth contract](https://github.com/Soneso/as-soroban-examples/tree/main/auth#code).
376+
377+
Other examples like [flutter atomic swap](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_auth.dart#L470) can be found in the [Soroban Auth Test Cases](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_auth.dart) of the SDK.
378+
379+
#### Get Events
380+
381+
The Soroban-RPC server provides the possibility to request contract events.
382+
383+
You can use the Flutter SDK to request events like this:
384+
385+
```dart
386+
EventFilter eventFilter =
387+
EventFilter(type: "contract", contractIds: [contractId]);
388+
389+
GetEventsRequest eventsRequest =
390+
GetEventsRequest(startLedger, endLedger, filters: [eventFilter]);
391+
392+
GetEventsResponse eventsResponse =
393+
await sorobanServer.getEvents(eventsRequest);
394+
```
395+
Find the complete code [here](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test.dart#L488).
396+
334397
#### Hints and Tips
335398

336-
You can find the working code and more in the [Soroban Test Cases](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test.dart) of the Flutter SDK. The Hello Word Contract wasm byte-code file can be found in the [test/wasm](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/wasm/) folder.
399+
You can find the working code and more in the [Soroban Test Cases](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test.dart) and [Soroban Auth Test Cases](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_auth.dart) of the Flutter SDK. The used wasm byte-code files can be found in the [test/wasm](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/wasm/) folder.
337400

338401
Because Soroban and the Flutter SDK support for Soroban are in development, errors may occur. For a better understanding of an error you can enable the ```SorobanServer``` logging:
339402

0 commit comments

Comments
 (0)