-
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
Feat: gift creation #29
Conversation
|
||
export const completeOnboarding = async (publicKey: HexString, webApp: WebApp): Promise<void> => { | ||
const botApi = getTelegramBotApi(webApp); | ||
await botApi.submitWallet(publicKey); | ||
}; | ||
|
||
export const createTgLink = (secret: string, networkName: string): TgLink => { | ||
const url = `https://t.me/${process.env.NEXT_PUBLIC_BOT_ADDRESS}/${process.env.NEXT_PUBLIC_WEB_APP_ADDRESS}?startapp=${secret}_${networkName}`; |
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 we add some prefix to startapp to distinguish between different start reaons in the future?
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 can add postfix (e.g. startapp=${reason}...) but restriction is that we have to use ?startapp= as a way to pass any parameters that we set.
But I dont see a reason right now for that. In general, we want to be that link as short as possible since we cannot shorten it & its lengths affects UX on user side (the longer == the uglier)
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.
startapp
- is the default parameter for the telegram link if we add a prefix there, I'm afraid tg won't see it as its parament
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.
Le't keep link short for now. I think it could be easily added in future if we will need.
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.
But I dont see a reason right now for that
To avoid thinking abount backward-compaitily in the feature (when we do add it we would still be required to support parameter without prefix)
On the string length - i mean it doesnt have to be long, we can use a single character as a selector, it will support 16 variants
@@ -77,12 +83,13 @@ export const initializeWalletFromCloud = (password: string, encryptedMnemonic: s | |||
return createWallet(mnemonic); | |||
}; | |||
|
|||
const generateGiftSecret = () => { | |||
return randomAsHex(10).slice(2); |
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.
Hmm I am not sure if a single byte has enough entropy to be avoid collision. @ERussel wdyt?
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 took this one from the Parity gift implementation
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 think for gifts it is enough. The solution is compatible with dot gifts and it allows to keep the link short.
No description provided.