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

Contract schema tuple variants handling #236

Open
MissingNO57 opened this issue Mar 7, 2024 · 0 comments
Open

Contract schema tuple variants handling #236

MissingNO57 opened this issue Mar 7, 2024 · 0 comments

Comments

@MissingNO57
Copy link
Contributor

_extract_msgs can't handle tuple variants and returns
'upload_logo' = {dict: 0} {}

Most of the contracts are using named fields

pub enum ExecuteMsg {
   UpdateMinter { new_minter: Option<String> },
}

This would be called like

{"update_minter" : {"new_minter": "something"}}

But for example cw20-base contract uses tuple variants that have no name:

pub enum ExecuteMsg {
    UploadLogo(Logo),
}

pub enum Logo {
    /// A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.
    Url(String),
    /// Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants
    Embedded(EmbeddedLogo),
}

In the case of tuple variant execution message would look like this:

  "upload_logo": {
    "url": "https://example.com/logo.png"
  }
}

This is named fields schema

...
 'properties' = {dict: 1} {'send': {'additionalProperties': False, 'properties': {'amount': {'$ref': '#/definitions/Uint128'}, 'contract': {'type': 'string'}, 'msg': {'$ref': '#/definitions/Binary'}}, 'required': ['amount', 'contract', 'msg'], 'type': 'object'}}
  'send' = {dict: 4} {'additionalProperties': False, 'properties': {'amount': {'$ref': '#/definitions/Uint128'}, 'contract': {'type': 'string'}, 'msg': {'$ref': '#/definitions/Binary'}}, 'required': ['amount', 'contract', 'msg'], 'type': 'object'}
...

This is a tuple variant schema:

...
 'properties' = {dict: 1} {'upload_logo': {'$ref': '#/definitions/Logo'}}
...
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

1 participant