-
Notifications
You must be signed in to change notification settings - Fork 1
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
solana ledger sign in #358
Conversation
import { ErrorType } from '.' | ||
|
||
const WALLETS_WITH_SERIALIZED_TX: WalletName<string>[] = [ | ||
LedgerWalletName, |
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.
Some users use their ledger wallet through Phantom/Solflare. We need to test whether we can get the correct wallet name.
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 just searched, cannot get the hard wallet name if connecting through Phantom/Solflare. Need to find a way to handle this
const buildAuthTx = async (nonce: string): Promise<Transaction> => { | ||
const tx = new Transaction() | ||
|
||
const PROGRAM_ID = new PublicKey( |
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.
Should this be a file-level const?
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.
Updated
return message.prepareMessage() | ||
} | ||
|
||
const buildAuthTx = async (nonce: string): Promise<Transaction> => { |
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.
We should call this message
instead of nonce
.
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.
Updated
tx.feePayer = new PublicKey(address) | ||
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash | ||
const signedTx = await signTransaction(tx) | ||
const serializedTx = Array.from(signedTx.serialize()) |
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.
We need to base64 encode the serialized tx instead of passing it as an array of numbers.
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.
Updated
const { account, chainId, provider } = useWeb3React() | ||
|
||
useEffect(() => { | ||
if (chainType === CHAIN_TYPE.EVM) { |
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.
Can we combine lines 61 and 62?
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.
Updated
const account = publicKey?.toString() ?? '' | ||
|
||
useEffect(() => { | ||
if (chainType === CHAIN_TYPE.SOLANA) { |
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.
Can we combine lines 127 and 128?
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.
Updated
2c7ee00
to
091d666
Compare
onVerificationComplete() | ||
} | ||
|
||
export const useAuthErrorHandingEvm = ( |
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.
Typo. Missing l
in Handling
. Same for the file name.
} | ||
} | ||
|
||
export const useAuthErrorHandingSolana = ( |
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.
Typo. Missing l
in Handling
. Same for the file name.
].includes(error.response?.data?.detail?.type) | ||
|
||
const isWalletNotCreatedError = error === 'WalletNotCreatedException' | ||
const isWalletNotSignInError = error === 'WalletNotSignInException' |
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.
Where are these errors coming from? Doesn't seem like they are from the backend. From a grammar perspective, the second error should be called WalletNotSignedInException
.
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.
These 2 are frontend defined errors. WalletNotCreatedException
is thrown from earn page, WalletNotSignInException
is thrown in points earned modal after supply.
1, Solana Ledger sign in by signing transaction
2, Separate solana and evm sign in