Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow extra options to pass through to blockchain connectors #844

Merged
merged 1 commit into from
May 31, 2022

Conversation

nguyer
Copy link
Contributor

@nguyer nguyer commented May 31, 2022

This PR adds the ability to pass additional options through to blockchain connectors. This is useful for controlling other parameters when submitting a blockchain transaction besides the specific arguments that a smart contract function takes. For example, this can now be used to set a custom gas price

Screen Shot 2022-05-31 at 11 39 25 AM

Anywhere that a smart contract can be invoked or queried a new options JSON object (treated as a map[string]interface{} in Go) can be optionally specified. Any fields in this structure will be included in the request to the blockchain connector.

Overriding existing fields in the request is not allowed. For example, if using Ethconnect, the following request body would be rejected because headers is a field that FireFly itself needs to set:

{
  "input": {
    "newValue": "x"
  },
  "options": {
    "headers": "not allowed"
  }
}

This would result in an HTTP 400 with an error message indicating which option was not allowed.

Signed-off-by: Nicko Guyer <nicko.guyer@kaleido.io>
Copy link
Contributor

@peterbroadhurst peterbroadhurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great. I like the override protection

@peterbroadhurst peterbroadhurst merged commit 92ada04 into hyperledger:main May 31, 2022
@peterbroadhurst peterbroadhurst deleted the options-passthrough branch May 31, 2022 19:39
@@ -14,6 +14,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:build reference
// +build reference
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants