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

DRAFT: TS SDK VC docs #2

Merged
merged 8 commits into from
Jan 7, 2025
Merged

DRAFT: TS SDK VC docs #2

merged 8 commits into from
Jan 7, 2025

Conversation

lukachi
Copy link

@lukachi lukachi commented Dec 16, 2024

Description

Checklist

  • Do all Lints pass?
    • [+] Have you ran pnpm spellcheck?
    • [+] Have you ran pnpm fmt?
    • [+] Have you ran pnpm lint?

---

import { Callout, Steps, Tabs } from 'nextra/components'
import Link from 'next/link'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need these imports (except Callout)?

apps/nextra/pages/en/build/sdks/ts-sdk/veiled-coins.mdx Outdated Show resolved Hide resolved
const userVeiledBalance = await aptos.veiledCoin.getBalance({ accountAddress: user.accountAddress, tokenAddress: TOKEN_ADDRESS });
```

This method returns you user's [`pending` and `actual`](/en/build/smart-contracts/veiled-coin#veiled-coin-store) veiled balances, to [decrypt](/en/build/smart-contracts/veiled-coin#encryption-and-decryption) them, you can use `VeiledAmount` class
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we rename VeiledAmount to VeiledBalace for consistency?

return {
pending: {
amount: veiledAmountPending.amount,
amountChunked: veiledAmountPending.amountChunked,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, leave small comments here what are amountChunked and amountEncrypted

apps/nextra/pages/en/build/sdks/ts-sdk/veiled-coins.mdx Outdated Show resolved Hide resolved
And you can do that, by using `aptos.veiledCoin.rolloverPendingBalance`.

<Callout type="warning">
Important note, that user's actual balance need to be [normalized](/en/build/smart-contracts/veiled-coin#normalization) before `rollover` operation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The contract will revert if you try to normalize the normalized balance.

apps/nextra/pages/en/build/sdks/ts-sdk/veiled-coins.mdx Outdated Show resolved Hide resolved

Usually you don't need to explicit call [normalization](/en/build/smart-contracts/veiled-coin#normalization-1)

But in case you want to:
Copy link
Collaborator

Choose a reason for hiding this comment

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

"In case you want to" -
The explicit normalization is needed only before the rollover. So, maybe we can move this to the rollover section?

const txReceipt = await aptos.waitForTransaction({ transactionHash: txResponse.hash });
```

### Recovery
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's call it key rotation, "recovery" term is not obvious here.


---

### Some useful functions
Copy link
Collaborator

Choose a reason for hiding this comment

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

Explain it?

@lukachi lukachi marked this pull request as ready for review January 7, 2025 17:44
@lukachi lukachi merged commit 7193b0d into feat/vc-guide Jan 7, 2025
@lukachi lukachi deleted the feat/vc-sdk branch January 7, 2025 17:45
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