Created
October 15, 2019 06:22
-
-
Save yurenju/2d598a584ccd03fe6ce685539208b22f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function withdraw() { | |
console.log(chalk.green("Executing withdraw")); | |
const withdrawValue = 10; | |
const [, noteB] = transferNotes; | |
const noteC = await note.create(alice.publicKey, splitValues[1] - withdrawValue); | |
const withdrawProof = new JoinSplitProof( | |
[noteB], | |
[noteC], | |
alice.address, | |
withdrawValue, | |
alice.address | |
); | |
const withdrawData = withdrawProof.encodeABI(contractAddresses.zkAsset); | |
const withdrawSignatures = withdrawProof.constructSignatures(contractAddresses.zkAsset, [ | |
alice.aztecAccount | |
]); | |
console.log("- executing withdraw: zkAssetSigner.confidentialTransfer()"); | |
await (await alice.signers.zkAsset.confidentialTransfer( | |
withdrawData, | |
withdrawSignatures, | |
ethOptions | |
)).wait(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment