Commit bfd859c
feat(clients/js): add confidential mint/burn instruction plan helpers
Token-2022's /confidential subpath ships InstructionPlan helpers for
transfer, withdraw and configure, but nothing for confidential mint/burn
— downstream consumers had to re-derive the three-proof orchestration
themselves. Add helpers so that logic lives upstream.
- getConfidentialMintInstructionPlan / getConfidentialBurnInstructionPlan:
build the equality, batched grouped-3-handles validity and U128 range
proofs, verify them via context-state accounts, and assemble the token
instruction — reusing the existing transfer/withdraw plumbing.
- getUpdateConfidentialMintBurnDecryptableSupplyInstructionFromSupply:
re-encrypt the decryptable supply under the supply AES key (u64-guarded).
- addWithLoHiCiphertexts: the one missing arithmetic primitive, mirroring
subtractWithLoHiCiphertexts, for homomorphically adding the minted
amount to the encrypted supply.
- test setup: createConfidentialMintBurnMint, initializing a mint with
both the ConfidentialTransferMint and ConfidentialMintBurn extensions.
The helpers reuse the primitives introduced by #1253 rather than adding
their own: getRequiredMintExtension for the ConfidentialMintBurn lookup
and assertU64Amount for the supply guards. getAuditorElGamalPubkey is
widened to a structural input so transfer, transfer-with-fee, mint and
burn all resolve the auditor key through one function, and main's
now-redundant getRequiredConfidentialTransferMintExtension folds into
the generic lookup.
Covered by a new offline arithmetic test and a validator e2e that
exercises mint -> apply -> burn -> apply-pending-burn -> update-supply
against the on-chain ZK verifiers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent ead789a commit bfd859c
5 files changed
Lines changed: 733 additions & 18 deletions
File tree
- clients/js
- src
- test
- extensions/confidentialMintBurn
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
54 | 63 | | |
55 | 64 | | |
56 | 65 | | |
| |||
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
73 | 96 | | |
74 | 97 | | |
75 | 98 | | |
| |||
0 commit comments