-
Notifications
You must be signed in to change notification settings - Fork 102
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
Support nested vector in explorer #681
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logs, otherwise this looks good :)
@@ -287,6 +288,7 @@ function RunContractForm({ | |||
} else return arg; | |||
}), | |||
}; | |||
console.log(payload); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logss
@@ -277,6 +277,7 @@ function RunContractForm({ | |||
const type = fnParams[i]; | |||
if (type.includes("vector")) { | |||
// when it's a vector<u8>, we support both hex and javascript array format | |||
console.log(type, arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove console.log?
src/utils.ts
Outdated
if (isArrayStr(trimmed)) { | ||
inside = trimmed.slice(1, -1); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this doing?
Can we put a comment above it?
src/utils.ts
Outdated
if (result[0] === "[" && result[result.length - 1] === "]") { | ||
result = result.slice(1, -1); | ||
// Also works nested [[1, 2], [3, 4]] to [["1", "2"], ["3", "4"]] | ||
// TODO: Need to type this recursively |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this recursive now?
src/utils.ts
Outdated
const innerArrayStrs = []; | ||
let build = ""; | ||
for (let i = 0; i < inside.length; i++) { | ||
if (inside[i] === "]") { | ||
innerArrayStrs.push(build); | ||
build = ""; | ||
} else { | ||
build += inside[i]; | ||
} | ||
} | ||
return innerArrayStrs.map(deserializeVector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code will have the bracket at the beginning?
But, I guess you call it recursively?
I think this misses, can we make a unit test, I suspect that:
[[blah,blah],[blah,blah]]
Will get to:
[blah, blah], [blah, blah]
Then
innerArrayStrs.push('[blah, blah')
innerArrayStrs.push(',[blah, blah')
Then do that recursively which will return two items
'[blah', 'blah'
'','[blah', 'blah'
✅ Deploy Preview for aptos-explorer ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Use
JSON.parse
to handle parsing[]
arguments.Previously,
[[abc]]
would be parsed as["[abc]"], but really, it should be
[["abc"]]`.The noteworthy change here is that quotes must now be used for literals. E.g.
[0xabc]
used to be acceptable but now must be specified as["0xabc"]