Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created October 15, 2019 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurenju/2d598a584ccd03fe6ce685539208b22f to your computer and use it in GitHub Desktop.
Save yurenju/2d598a584ccd03fe6ce685539208b22f to your computer and use it in GitHub Desktop.
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