-
Notifications
You must be signed in to change notification settings - Fork 237
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
252 simplify parse account #11171
252 simplify parse account #11171
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.
LGTM. Suggestions, no blockers
but please clean up commits or land as a squash like feat: parseAccountIdArg
@@ -670,7 +670,7 @@ export const makeChainHub = ( | |||
* | |||
* XXX consider accepting AmountArg #10449 | |||
* | |||
* @param {AccountIdArg} destination | |||
* @param {AccountIdArg | string} destination |
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.
* @param {AccountIdArg | string} destination | |
* @param {AccountIdArg | Bech32Address} destination |
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.
done
* namespace: string; | ||
* reference: string; | ||
* accountAddress: string; | ||
* }} |
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.
consider a type like Caip10Obj
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.
I called it Caip10Record.
export const parseAccountId = partialId => { | ||
if (typeof partialId !== 'string' || !partialId.length) { | ||
Fail`Empty accountId: ${q(partialId)}`; | ||
export const parseAccountIdArg = partialId => { |
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.
"partial" case is no longer supported.
export const parseAccountIdArg = partialId => { | |
export const parseAccountIdArg = idArg => { |
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.
done
const parsed = parseAccountId(partialId); | ||
if ('namespace' in parsed) { | ||
// It is already fully qualified | ||
if (partialId.split(':').length === 3) { |
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.
consider a comment "if it's already a CAIP-10, return it"
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.
done
d522d23
to
35b5e68
Compare
Deploying agoric-sdk with
|
Latest commit: |
36dee3c
|
Status: | ✅ Deploy successful! |
Preview URL: | https://f25bb3a4.agoric-sdk.pages.dev |
Branch Preview URL: | https://252-simplify-parseaccountid.agoric-sdk.pages.dev |
35b5e68
to
6b00e7a
Compare
6b00e7a
to
fbd361a
Compare
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You may have to fix your CI before adding the pull request to the queue again. If you want to requeue this pull request, you can post a |
fbd361a
to
36dee3c
Compare
refs: #11037
refs: #11146
Description
Since we widened our accountIds to
AccountIdArg
, (see #11007) this updatesparseAccountId()
to support it more cleanly (and renamed it toparseAccountIdArg()
), added a separateparseAccountId()
that parses CAIP-10 addresses to their constituent parts.ChainHub.resolveAccountId()
andChainHub.makeChainAddreess()
, which need to support bare bech32 addresses, no longer useparseAccountId
.This grew out of #11037. (It replaces #11146, which tried to go in a different direction.)
Security Considerations
No impact.
Scaling Considerations
No impact.
Documentation Considerations
Automatically generated docs will be updated.
Testing Considerations
Adds tests
Upgrade Considerations
Internal utilities only. Shouldn't impact upgrade.