Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: display Stark name in Sidebar #184

Merged

Conversation

irisdv
Copy link
Contributor

@irisdv irisdv commented Dec 8, 2023

Close #183

This PR displays the user Stark name in the Sidebar component.

To test it, you can use the python script buy_domain from this repo : https://github.com/irisdv/test_scripts

Copy link
Collaborator

@stanleyyconsensys stanleyyconsensys left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the work

IMHO, i think there is no reason to create another snap method to get the name individually

instead the logic should bundle together in current recoverAccounts

if (!domain) return '';
const ellipsis = '...';

if (domain.length <= maxLength) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

does the domain always in eng? if not we may consider to verify the length by [...domain].length

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For now yes, but it could change in the future so I updated this part

export const getStarkNameUtil = async (network: Network, userAddress: string) => {
const provider = getProvider(network);
return provider.getStarkName(userAddress);
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add EOS

Suggested change
};
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so it's weird because there is one, but it's not showing


export interface GetStarkNameRequestParam extends BaseRequestParams {
userAddress: string;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add EOS

Suggested change
}
}


export const getStarkNameUtil = async (network: Network, userAddress: string) => {
const provider = getProvider(network);
return provider.getStarkName(userAddress);
Copy link
Collaborator

Choose a reason for hiding this comment

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

please check if the StarknetIdContract in sepolia
if yes, please pass in the sepolia StarknetIdContract when using sepolia

the current starknet.js does not contains sepolia contract in getStarknetIdContract

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not yet deployed, but it will be in the coming days. We plan on updating starknet.js with it as well

Copy link
Collaborator

Choose a reason for hiding this comment

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

is any update @irisdv

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 made a PR to starknet.js adding the Sepolia contracts but it won't be deployed in production before a few weeks. I can add them in this PR, what do you think ?

@irisdv
Copy link
Contributor Author

irisdv commented Jan 5, 2024

LGTM, thanks for the work

IMHO, i think there is no reason to create another snap method to get the name individually

instead the logic should bundle together in current recoverAccounts

I updated the code to get the stark name in recoverAccounts. I'm just not entirely sure of the best way to store it to use it in the ui, for now I created a state.starkNames but maybe storing it in state.accounts would make more sense ?

@stanleyyconsensys
Copy link
Collaborator

LGTM, thanks for the work
IMHO, i think there is no reason to create another snap method to get the name individually
instead the logic should bundle together in current recoverAccounts

I updated the code to get the stark name in recoverAccounts. I'm just not entirely sure of the best way to store it to use it in the ui, for now I created a state.starkNames but maybe storing it in state.accounts would make more sense ?

Thank you very much for the work

For SNAP
in order to bundle with recoverAccounts, you may have also need to update the methods of upsertAccount in snapUtils

For UI
you may need to change the structure of setAccounts , instead of storing a string address, but a object {address, name}
you may need to change the all files that need to using the address from state

in such big changes, may be it is better to rollback to use your original implementation, a single snap api to get the starkname

sorry for causing you the inconvenient

@irisdv irisdv force-pushed the feat/display_starkname_sidebar branch from d99b384 to 4703026 Compare January 8, 2024 08:44
@irisdv
Copy link
Contributor Author

irisdv commented Jan 8, 2024

LGTM, thanks for the work
IMHO, i think there is no reason to create another snap method to get the name individually
instead the logic should bundle together in current recoverAccounts

I updated the code to get the stark name in recoverAccounts. I'm just not entirely sure of the best way to store it to use it in the ui, for now I created a state.starkNames but maybe storing it in state.accounts would make more sense ?

Thank you very much for the work

For SNAP in order to bundle with recoverAccounts, you may have also need to update the methods of upsertAccount in snapUtils

For UI you may need to change the structure of setAccounts , instead of storing a string address, but a object {address, name} you may need to change the all files that need to using the address from state

in such big changes, may be it is better to rollback to use your original implementation, a single snap api to get the starkname

sorry for causing you the inconvenient

No worries, I rolled back to the previous version !

@stanleyyconsensys
Copy link
Collaborator

LGTM, thanks for the work
IMHO, i think there is no reason to create another snap method to get the name individually
instead the logic should bundle together in current recoverAccounts

I updated the code to get the stark name in recoverAccounts. I'm just not entirely sure of the best way to store it to use it in the ui, for now I created a state.starkNames but maybe storing it in state.accounts would make more sense ?

Thank you very much for the work
For SNAP in order to bundle with recoverAccounts, you may have also need to update the methods of upsertAccount in snapUtils
For UI you may need to change the structure of setAccounts , instead of storing a string address, but a object {address, name} you may need to change the all files that need to using the address from state
in such big changes, may be it is better to rollback to use your original implementation, a single snap api to get the starkname
sorry for causing you the inconvenient

No worries, I rolled back to the previous version !

just keep the domain.length checking where you did
thank you very much

@irisdv irisdv force-pushed the feat/display_starkname_sidebar branch from 2a29be5 to 4703026 Compare January 8, 2024 10:16
@irisdv
Copy link
Contributor Author

irisdv commented Jan 8, 2024

LGTM, thanks for the work
IMHO, i think there is no reason to create another snap method to get the name individually
instead the logic should bundle together in current recoverAccounts

I updated the code to get the stark name in recoverAccounts. I'm just not entirely sure of the best way to store it to use it in the ui, for now I created a state.starkNames but maybe storing it in state.accounts would make more sense ?

Thank you very much for the work
For SNAP in order to bundle with recoverAccounts, you may have also need to update the methods of upsertAccount in snapUtils
For UI you may need to change the structure of setAccounts , instead of storing a string address, but a object {address, name} you may need to change the all files that need to using the address from state
in such big changes, may be it is better to rollback to use your original implementation, a single snap api to get the starkname
sorry for causing you the inconvenient

No worries, I rolled back to the previous version !

just keep the domain.length checking where you did thank you very much

done

@stanleyyconsensys
Copy link
Collaborator

LGTM

@stanleyyconsensys stanleyyconsensys merged commit 60f37da into Consensys:main Feb 21, 2024
3 checks passed
@github-actions github-actions bot mentioned this pull request Feb 21, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: display user stark domain in sidebar
2 participants