diff --git a/CHANGELOG.md b/CHANGELOG.md index 418e880..ab32c71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.8.7] - 05.Sep.2024. +- Add Soroban Contract Parser +- contract spec xdr fixes + ## [1.8.6] - 19.Aug.2024. - SEP-06: allow extra fields in deposit and withdraw request - SEP-06: add userActionRequired by field in transaction response diff --git a/README.md b/README.md index 16ccfdc..b07f2a8 100644 --- a/README.md +++ b/README.md @@ -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.8.6 + stellar_flutter_sdk: ^1.8.7 ``` 2. Install it (command line or IDE): ``` diff --git a/lib/src/stellar_sdk.dart b/lib/src/stellar_sdk.dart index ca8034f..57b7fb1 100644 --- a/lib/src/stellar_sdk.dart +++ b/lib/src/stellar_sdk.dart @@ -31,7 +31,7 @@ import 'requests/liquidity_pools_request_builder.dart'; /// Main class of the flutter stellar sdk. class StellarSDK { - static const versionNumber = "1.8.6"; + static const versionNumber = "1.8.7"; static final StellarSDK PUBLIC = StellarSDK("https://horizon.stellar.org"); static final StellarSDK TESTNET = diff --git a/lib/stellar_flutter_sdk.dart b/lib/stellar_flutter_sdk.dart index 28aa31a..de32222 100644 --- a/lib/stellar_flutter_sdk.dart +++ b/lib/stellar_flutter_sdk.dart @@ -186,4 +186,5 @@ export 'src/sep/0008/regulated_assets.dart'; /// Soroban export 'src/soroban/soroban_server.dart'; -export 'src/soroban/soroban_auth.dart'; \ No newline at end of file +export 'src/soroban/soroban_auth.dart'; +export 'src/soroban/soroban_contract_parser.dart'; \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index d9fb7b9..2abb5b3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.8.6 +version: 1.8.7 homepage: https://github.com/Soneso/stellar_flutter_sdk environment: diff --git a/soroban.md b/soroban.md index d0395b9..7da8328 100644 --- a/soroban.md +++ b/soroban.md @@ -418,3 +418,35 @@ This will log the responses received from the Soroban-RPC server. If you find any issues please report them [here](https://github.com/Soneso/stellar_flutter_sdk/issues). It will help us to improve the SDK. +### Soroban contract parser + +The soroban contract parser allows you to access the contract info stored in the contract bytecode. +You can access the environment metadata, contract spec and contract meta. + +The environment metadata holds the interface version that should match the version of the soroban environment host functions supported. + +The contract spec contains a `XdrSCSpecEntry` for every function, struct, and union exported by the contract. + +In the contract meta, contracts may store any metadata in the entries that can be used by applications and tooling off-network. + +You can access the parser directly if you have the contract bytecode: + +```dart +var byteCode = await Util.readFile("path to .wasm file"); +var contractInfo = SorobanContractParser.parseContractByteCode(byteCode); +``` + +Or you can use `SorobanServer` methods to load the contract code form the network and parse it. + +By contract id: +```dart +var contractInfo = await sorobanServer.loadContractInfoForContractId(contractId); +``` + +By wasm id: +```dart +var contractInfo = await sorobanServer.loadContractInfoForWasmId(wasmId); +``` + +The parser returns a `SorobanContractInfo` object containing the parsed data. +In [soroban_test_parser.dart](https://github.com/Soneso/stellar_flutter_sdk/blob/master/test/soroban_test_parser.dart#L192) you can find a detailed example of how you can access the parsed data.