-
Notifications
You must be signed in to change notification settings - Fork 8
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
EPIC | Telos Cloud Login #756
base: develop
Are you sure you want to change the base?
Conversation
…into new-telos-cloud
…s://github.com/telosnetwork/telos-wallet into 752-epic--telos-cloud-login
✅ Deploy Preview for wallet-develop-mainnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for wallet-staging ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…s://github.com/telosnetwork/telos-wallet into 753-telos-cloud-login--change-the-flow
…snetwork/telos-wallet into 753-telos-cloud-login--change-the-flow
…me' of https://github.com/telosnetwork/telos-wallet into 754-telos-cloud-login--zero-account-selector--random-name
…ge-the-flow Telos Cloud Login | simpler flow
✅ Deploy Preview for telos-cloud-wallet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
…-account-selector Telos Cloud Login | Zero account selector
…-name-account-choice Telos Cloud Login | Zero name input
Telos Cloud Login | Fuel
// if we have more than one account, we ask the user to select one using this callback | ||
const selectedAccount = await this.accountSelector.selectAccount(accountNames); |
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.
const selectedAccount = await this.accountSelector.selectAccount(accountNames);
That line is a callback to the external website to halt the process, allowing the user to select from the discovered accounts for login. This is optional, and if not overridden, a default, straightforward selection without interaction will be performed instead.
In this case, the accounts are taken from the cache.
// if we have more than one account, we ask the user to select one using this callback | ||
accountName = await this.accountSelector.selectAccount(names); |
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.
accountName = await this.accountSelector.selectAccount(names);
Again, this line allows the user to select one account to log in with. In this case, the accounts are taken from the blockchain.
} | ||
|
||
async createAccount(publicKey: string): Promise<string> { | ||
const suggestedName = await this.accountNameSelector.selectAccountName(); |
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.
const suggestedName = await this.accountNameSelector.selectAccountName();
That line is a callback to the external website to stop the process, allowing the user to select an unused account name for the new account creation. This is optional, and if not overridden, a default empty string will be returned without interaction, leading to the endpoint being called with no suggested account name, resulting in the creation of a completely random account.
const transaction_extensions = originalTransaction.transaction_extensions ?? [] as string[]; | ||
const context_free_actions = originalTransaction.context_free_actions ?? [] as string[]; | ||
const delay_sec = originalTransaction.delay_sec ?? 0; | ||
const max_cpu_usage_ms = originalTransaction.max_cpu_usage_ms ?? 0; | ||
const max_net_usage_words = originalTransaction.max_net_usage_words ?? 0; | ||
const expiration = originalTransaction.expiration ?? transaction.expiration.toString(); | ||
const ref_block_num = originalTransaction.ref_block_num ?? transaction.ref_block_num.toNumber(); | ||
const ref_block_prefix = originalTransaction.ref_block_prefix ?? transaction.ref_block_prefix.toNumber(); |
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.
The original transaction may or may not have all the transaction details, containing only the actions. If we are coming from a Greymass Fuel intersection, the original transaction will be complete so we need to use it as it comes in order to sign the same transaction as Fuel did. If not, it's ok to create a brand-new transaction.
Dialog.create({ | ||
title: GreymassFuelService.globals.$t('api.greymass_dialog_title'), | ||
message, | ||
html: true, | ||
cancel, | ||
ok, | ||
persistent: true, | ||
class: 'text-black', | ||
options: { | ||
type: 'checkbox', | ||
model: mymodel, | ||
isValid: (model/*: string | string[]*/) => { | ||
GreymassFuelService.setPreferences(username, { | ||
remember: model.length === 1, | ||
}); | ||
return true; | ||
}, | ||
items: [ | ||
{ | ||
label: GreymassFuelService.globals.$t('api.remember_my_decision'), | ||
value: 'remember', | ||
color: 'primary' }, | ||
], | ||
}, | ||
}) | ||
// all answers should save the preferences | ||
.onOk(() => handler(true)) | ||
.onCancel(() => handler(false)); |
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 only present this Dialog in the case of having any extra fees that the user should approve to pay. If there are no fees, then no Dialog is shown to the user.
const chainNetworkNames: Record<string, string> = (tab === 'zero') ? { | ||
'telos': 'telos', | ||
'telos-testnet': 'telos-testnet', | ||
} : { | ||
'telos': 'telos-evm', | ||
'telos-testnet': 'telos-evm-testnet', | ||
}; |
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.
…g-as-expected We remove deprecated validation on fuel response
Fixes #752
Mainnet deployment
Description
This epic branch implements the new flow for the Telos Cloud Login functionality split into four incremental steps, each one with its own branch and PR:
1 - Change the flow
In the last prototype, we had two steps to perform a successful login using GoogleOneTap. With this first branch, we changed the flow to just one step. The Google One Tap button is rendered when you arrive at the site.
2 - Zero Account Selector
To cover those rare cases when one user already has more than two accounts associated with the corresponding meta keep public key, this second branch incorporates an account selector interactive step in between the process of logging in with Could Login on Telos Zero.
3 - Zero Account Creation (Name Choise)
in this third branch, we incorporate another interactive step to the login process only for new users who have no account associated with their public key from Metakeep. In this case, we present the user with a simple form with just a field to input the desired name for the account, along with a button to generate a random name.
4 - Greymass Fuel service
In this last branch, we fixed the old implementation of the service to work again, especially for new accounts created with Telos Cloud Login. In this case, we made a few minor changes like removing the confirmation modal to use the service and changing the verification functions because the service now does not charge users for RAM (that is a new policy from Greymass and we needed to adapt the checks to allow that).
Screen captures
Account Selection + Greymass Fuel
telos-cloud-login.webm
Account Creation Form
Telos-cloud-login--acccount-name-input.webm
Confirmation of fee payment
telos-cloud-login--confirm-pay-fee.webm
Checklist: