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

Add Signer login #94

Merged
merged 6 commits into from
Jan 23, 2024
Merged

Add Signer login #94

merged 6 commits into from
Jan 23, 2024

Conversation

yoojinko
Copy link
Collaborator

Ain Wallet Signer Login을 추가함에 따라 몇 가지 로직이 변경되었습니다.

  • 기존 private key 로 로그인 하는 경우 DefaultSigner 를 통해 sendTransaction 합니다.
  • loginWithSigner 함수를 이용하여 로그인 할 경우 AIN Wallet에서 AinWalletSigner 를 가져옵니다. (web 한정)

@yoojinko yoojinko marked this pull request as ready for review January 23, 2024 04:29
}

getAddress() {
this.checkAinInitiated();
Copy link
Collaborator

Choose a reason for hiding this comment

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

ain 초기화가 되면 signer가 무조건 있나요?
signer가 있다면 무조건 defaultAddress가 있는게 맞나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ain 초기화시 defaultSigner가 반드시 생성됩니다. 이 때 defaultSigner에서 getAddress() 는 defaultWalletAddress 를 반환합니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

default account가 세팅되지 않은 경우 해당 부분에서 에러를 던지네요. 기존 getAddress에서는 해당 경우에 null을 반환했기 때문에 try-catch 문으로 null 반환하도록 변경하겠습니다.
추가적으로 defaultAccount 존재 유무를 확인하는 코드들의 수정이 덜 이루어진것을 발견하여 같이 수정하도록 하겠습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

넵 그부분만 수정하고 merge해주세요!

/**
* Login to ainize using AIN Wallet Signer.
*/
async loginWithSigner() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

login with wallet이 더 좋을 것 같습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

wallet 이란 명명이 web3에서 관념적으로 사용되는 의미나 ain-js에서 사용되는 등 혼동될 가능성이 있을 것 같습니다.
그러나 signer도 가독성 좋은 명명인지는 확신이 없어서, 우선 회의때 논의되었던 명명인 loginWithSigner로 merge하고 추후 관련하여 다시 논의하면 좋을 것 같습니다.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@@ -64,14 +85,14 @@ export default class AinModule {
return await this.ain!.db.ref(path).getValue();
}

private async _sendTransaction(data: TransactionBody) {
private async _sendTransaction(txBody: TransactionBody) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

사용하는 코드들도 바꾸어주어야 하지 않나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

파라메터 변수 명만 변경되어 호출부에선 변경 필요 없을 것 같습니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

아 맞네요 확인했습니다~

Copy link
Collaborator

@akastercomcom akastercomcom 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!

@yoojinko
Copy link
Collaborator Author

Thanks for the review!

@yoojinko yoojinko merged commit 97a6f62 into develop Jan 23, 2024
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