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: gift creation #29

Merged
merged 3 commits into from
Dec 28, 2023
Merged

Feat: gift creation #29

merged 3 commits into from
Dec 28, 2023

Conversation

sokolova-an
Copy link
Contributor

No description provided.

@sokolova-an sokolova-an requested a review from ERussel December 28, 2023 10:33

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}`;
Copy link
Member

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?

Copy link
Member

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)

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Member

@valentunn valentunn Dec 28, 2023

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);
Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

@sokolova-an sokolova-an merged commit dafd9c6 into main Dec 28, 2023
@sokolova-an sokolova-an deleted the feat/gift-creatinon branch December 28, 2023 12:16
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.

4 participants