Skip to content

contracts: generate ScVals from contract fn specs #5887

@sreuland

Description

@sreuland

What problem does your feature solve?

Go SDK doesn't have capability to generate request parameter ScVals for a contract function defined on a contract spec.

What would you like to see?

Determine the best interface approach in SDK for DX concerns and provide the implementation of chosen approach.

  • Option 1 - generate go code(bindings) for a given conract fn's. Applications follow a two step process.
    • step 1 - use a cli tool to generate code as bindings for a given contract and fn
    • step 2- integrate generated bindings code to application code.
    • prior poc for reference - Karthik/sep 48 event parsing #5806
  • Option 2 - dynamic helper functions
    • New functional component added to contract package which provides ability for client to generate request parameter ScVals given a contract and a function name.
      • input - contract Wasm bytes or contract id/wasm hash for on-chain contract wasm code retrieval.
      • input - the contract fn name
      • input - list of parameter argument values expressed as go types to be applied as the args to the contract fn.
      • return - slice of ScVals in same order as the input parameters argument values
      • checkout the stellar-js-sdk Spec.funcArgsToScVals for a complete implementation reference.

What alternatives are there?

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    To Do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions