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

feat: parse argument value by custom type #537

Merged
merged 10 commits into from
Aug 31, 2024
Merged

Conversation

alexruzenhack
Copy link
Contributor

@alexruzenhack alexruzenhack commented Aug 21, 2024

Acceptance Criteria

  • Provide a better parsing for argument value taking in consideration the custom type

The arguments component parsed by custom type

Security Checklist

  • Make sure you do not include new dependencies in the project unless strictly necessary and do not include dev-dependencies as production ones. More dependencies increase the possibility of one of them being hijacked and affecting us.

Comment on lines 184 to 185
// XXX: We may want to extend to show the token symbol of
// registered tokens.
Copy link
Member

Choose a reason for hiding this comment

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

I think we should do it. What we can do is to show: tokenUid (tokenSymbol) and the token symbol only if the token is registered, or ir the default token.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added it at: 3d5f6f6

@@ -129,6 +144,60 @@ export const NanoContractMethodArgs = ({ blueprintId, method, ncArgs }) => {
)
};

/**
* Component resposible to render the appropriate format for the value
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Component resposible to render the appropriate format for the value
* Component responsible to render the appropriate format for the value

*
* Remarks
* The values received in here when derived from 'byte' type like
* 'TxOutputScript', 'TokenUid' and 'VertexId' are already in its
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* 'TxOutputScript', 'TokenUid' and 'VertexId' are already in its
* 'TxOutputScript', 'TokenUid' and 'VertexId' are already in their

* taking in consideration the type.
*
* Remarks
* The values received in here when derived from 'byte' type like
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* The values received in here when derived from 'byte' type like
* The values received here when derived from 'byte' type like

* hexadecimal format.
*
* Values of type 'Address', which also derives from 'byte' are
* in its base58 format.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* in its base58 format.
* in base58 format.

Comment on lines 159 to 160
* Values of type 'SignedData[Result]' arrives here using its data
* part already.
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean, it is already in presentation format.

src/utils.js Outdated
const script = hathorLib.bufferUtils.hexToBuffer(scriptData);
return hathorLib.scriptsUtils.parseScript(script, network);
} catch {
// Avoid to throw exception when we can't parse the script no matter the reason
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Avoid to throw exception when we can't parse the script no matter the reason
// Avoid throwing exception when we can't parse the script no matter the reason

return hathorLib.scriptsUtils.parseScript(script, network);
} catch {
// Avoid to throw exception when we can't parse the script no matter the reason
return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

log debug here?

@andreabadesso andreabadesso merged commit 5a76d57 into master Aug 31, 2024
1 check passed
@andreabadesso andreabadesso deleted the feat/nc-add-arg-type branch August 31, 2024 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants