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/sol auth #653

Merged
merged 9 commits into from
Sep 8, 2022
Merged

Feat/sol auth #653

merged 9 commits into from
Sep 8, 2022

Conversation

sogunshola
Copy link
Contributor

@sogunshola sogunshola commented Sep 6, 2022


name: 'Pull request'
about: A new pull request

New Pull Request

Checklist

  • I am not disclosing a vulnerability.
  • My code is conform the code style
  • I have made corresponding changes to the documentation
  • I have updated Typescript definitions when needed

Issue Description

Implement solana auth in auth package

@changeset-bot
Copy link

changeset-bot bot commented Sep 6, 2022

🦋 Changeset detected

Latest commit: 3438b92

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@moralisweb3/auth Minor
moralis Minor
@moralisweb3/core Minor
@moralisweb3/streams Minor
@moralisweb3/api-utils Minor
@moralisweb3/evm-utils Minor
@moralisweb3/sol-utils Minor
@moralisweb3/evm-api Minor
@moralisweb3/sol-api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sogunshola sogunshola requested review from ErnoW and b4rtaz September 6, 2022 14:47
@sogunshola
Copy link
Contributor Author

Yet to write docs for this.

@@ -0,0 +1,5 @@
---
'@moralisweb3/auth': major
Copy link
Member

Choose a reason for hiding this comment

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

Should be minor release bump

timeout: number;
}

// Temporary solution to allow allow chain id enum generated from swagger
Copy link
Member

Choose a reason for hiding this comment

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

Can you fix this in the datatype?
For EvmChain we introduced a apiHex value, for this we could do something similar called apiId or something.

return EndpointResolver.create(core, BASE_URL, initializeChallenge).fetch({
chainId: EvmChain.create(chain).decimal,
return EndpointResolver.create(core, BASE_URL, initializeChallengeEvm).fetch({
// TODO: remove this when the API is fixed
Copy link
Member

Choose a reason for hiding this comment

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

What needs to be fixed? the ChainId?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh taking out. it has been fixed already. The enum for chainId was wrong from swagger, had ETH|ROPSTEN|.... instead of 1|3|4...


export interface VerifyEvmOptions {
export interface VerifEvmOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Why the rename?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typo🤭

Comment on lines +43 to +46
code: AuthErrorCode.INCORRECT_NETWORK,
message: `Incorrect network provided. Got "${options.network}", Valid values are: ${Object.values(AuthNetwork)
.map((value) => `"${value}"`)
.join(', ')}`,
Copy link
Member

Choose a reason for hiding this comment

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

👍

createEndpoint({
name: 'Verify Challenge (EVM)',
getUrl: () => `/challenge/verify/evm`,
apiToResult: ({ chainId, ...data }: ApiResult) => ({
...data,
// TODO: revisit EVM logic once we know how authentication in other networks work
chain: EvmChain.create(chainId),
solNetwork: undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Why do we provide a solNetwork here? That seems wrong

apiToResult: ({ network, ...data }: ApiResult) => ({
...data,
solNetwork: SolNetwork.create(network),
chain: undefined,
Copy link
Member

Choose a reason for hiding this comment

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

Why do we provide chain here?

@sogunshola sogunshola requested a review from ErnoW September 6, 2022 23:21
ErnoW
ErnoW previously approved these changes Sep 8, 2022
@ErnoW ErnoW merged commit 38f3849 into main Sep 8, 2022
@ErnoW ErnoW deleted the feat/sol-auth branch September 8, 2022 13:56
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

Successfully merging this pull request may close these issues.

2 participants