Skip to content

Commit

Permalink
prepare for release 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Mar 3, 2023
1 parent 4a94c0c commit 3061b37
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [1.5.2] - 03.Mar.2023.
- add support for soroban prev 7
- add support for soroban auth next
- extend txrep for soroban

## [1.5.1] - 30.Jan.2023.
- improve submit transaction response
- add fee meta xdr
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.5.1
stellar_flutter_sdk: ^1.5.2
```
2. Install it (command line or IDE):
```
Expand Down
Binary file modified documentation/sdk_api_doc.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: stellar_flutter_sdk
description: A stellar blockchain sdk that query's horizon, build, signs and submits transactions to the stellar network.
version: 1.5.1
version: 1.5.2
homepage: https://github.com/Soneso/stellar_flutter_sdk

environment:
Expand Down
65 changes: 64 additions & 1 deletion soroban.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,72 @@ InvokeHostFunctionOperation operation = InvokeHostFuncOpBuilder
.forDeploySACWithAsset(asset).build();
```

#### Soroban Authorization

The Flutter SDK provides support for the [Soroban Authorization Framework](https://soroban.stellar.org/docs/learn/authorization).

For this purpose, it offers the `Address`, `AuthorizedInvocation` and `ContractAuth` classes as well as helper functions like `getNonce(...)`.

Here is a code fragment showing how they can be used:

```dart
Address invokerAddress = Address.forAccountId(invokerId);
String functionName = "auth";
List<XdrSCVal> args = [invokerAddress.toXdrSCVal(), XdrSCVal.forU32(3)];
AuthorizedInvocation rootInvocation =
AuthorizedInvocation(contractId, functionName, args: args);
int nonce = await sorobanServer.getNonce(invokerId, contractId);
ContractAuth contractAuth =
ContractAuth(rootInvocation, address: invokerAddress, nonce: nonce);
// sign
contractAuth.sign(invokerKeyPair, Network.FUTURENET);
InvokeHostFunctionOperation invokeOp =
InvokeHostFuncOpBuilder.forInvokingContract(
contractId, functionName,
functionArguments: args, contractAuth: [contractAuth]).build();
// simulate first to obtain the footprint
GetAccountResponse submitter =
await sorobanServer.getAccount(submitterId);
Transaction transaction =
TransactionBuilder(submitter).addOperation(invokeOp).build();
SimulateTransactionResponse simulateResponse =
await sorobanServer.simulateTransaction(transaction);
```

The example above invokes this assembly script [auth contract](https://github.com/Soneso/as-soroban-examples/tree/main/auth#code).

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.

#### Get Events

The Soroban-RPC server provides the possibility to request contract events.

You can use the Flutter SDK to request events like this:

```dart
EventFilter eventFilter =
EventFilter(type: "contract", contractIds: [contractId]);
GetEventsRequest eventsRequest =
GetEventsRequest(startLedger, endLedger, filters: [eventFilter]);
GetEventsResponse eventsResponse =
await sorobanServer.getEvents(eventsRequest);
```
Find the complete code [here](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test.dart#L488).

#### Hints and Tips

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.
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.

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:

Expand Down

0 comments on commit 3061b37

Please sign in to comment.