Soneso / stellar_flutter_sdk

Stellar SDK for flutter - dart, Stellar, Horizon, Soneso
MIT License
71 stars 33 forks source link

Protocol 20: Add support for resource leeway in `simulateTransaction` #81

Closed Shaptic closed 6 months ago

Shaptic commented 6 months ago

Upcoming Soroban RPC Change

The v20.1.0 version of Soroban RPC introduces the following additive change:

Which changes the request schema for the simulateTransaction endpoint, adding the optional resourceConfig parameter, which, for now, contains a single field:

{
  "transaction": "<base64-encoded transaction>",
  "resourceConfig" {
    "instructionLeeway": 0   // <number of add'l CPU instructions to reserve>
  }
}

Though this is an optional parameter, it may require an update depending on how you were submitting the request via JSON-RPC previously. Namely, optional parameters are treated differently depending on whether or not you are POSTing with an object (i.e. params: { transaction: "..." }) or an array (i.e. params: [ "..." ]). In the latter case, the optional parameter will not be honored and the request will be met with the following error:

{
  "jsonrpc": "2.0",
  "id": 2,
  "error": {
    "code": -32602,
    "message": "invalid parameters",
    "data": "[-32602] got 1 parameters, want 2"
  }
}

Reference implementation

christian-rogobete commented 6 months ago

Hello @Shaptic, thank you for adding this issue. Done in release 1.7.1