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

Wrong value for resolved field path #114

Open
cslashm opened this issue Oct 23, 2024 · 1 comment
Open

Wrong value for resolved field path #114

cslashm opened this issue Oct 23, 2024 · 1 comment

Comments

@cslashm
Copy link

cslashm commented Oct 23, 2024

In erc7730 json schema, a path field is declared as

"path": {
            "title": "Path",
            "type": "string",
            "description": "A path to the field in the structured data. The path is a JSON path expression that can be used to extract the field value from the structured data."
        },

But when applying resolve command we get a complex path object instead of a simple string.
In the following exemple when resolving tether.json, the path for _to param value should be

  "path" : "_to"

but we get:

          "transfer(address,uint256)": {
              "intent": "Send",
              "fields": [
                  {
                      "path": {
                          "type": "data",
                          "absolute": true,
                          "elements": [
                              {
                                  "type": "field",
                                  "identifier": "_to"
                              }
                          ]
                      },

Did I miss something?

@jnicoulaud-ledger
Copy link
Contributor

jnicoulaud-ledger commented Oct 24, 2024

Hi 👋 Yes, it is intentional, the resolved form is designed so there is no more string parsing to do. You can see difference between input and resolved form here:

  • URLs have been fetched
  • Contract addresses have been normalized to lowercase
  • References have been inlined
  • Constants have been inlined
  • Field definitions have been inlined
  • Selectors have been converted to 4 bytes form

Output of the resolved form does not comply with the input spec schema, you can get the resolved form schema with erc7730 schema resolved.

So the complex object expresses the same thing as _to (a data path of one element, referencing field _to).

Are you looking to build on ERC-7730 ? Please note it is still under development and we are still doing some breaking changes (it should stabilize soon though).

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

No branches or pull requests

2 participants