Skip to content

Instantly share code, notes, and snippets.

@yurenju
Created October 15, 2019 06:16
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/d5b6f5aa97a3c5155636ab3466a188b6 to your computer and use it in GitHub Desktop.
Save yurenju/d5b6f5aa97a3c5155636ab3466a188b6 to your computer and use it in GitHub Desktop.
async function transferFromBobToAlice() {
const msg =
`Split note to note A with ${splitValues[0]} value for bob & ` +
`note B with ${splitValues[1]} value for alice`;
console.log(chalk.green(msg));
const noteA = await note.create(bob.publicKey, splitValues[0]);
const noteB = await note.create(alice.publicKey, splitValues[1]);
transferNotes = [noteA, noteB];
const transferProof = new JoinSplitProof(
depositNotes,
transferNotes,
bob.address,
0,
bob.address
);
const transferData = transferProof.encodeABI(contractAddresses.zkAsset);
const transferSignatures = transferProof.constructSignatures(contractAddresses.zkAsset, [
bob.aztecAccount
]);
console.log("- executing transfer: zkAssetSigner.confidentialTransfer()");
await (await bob.signers.zkAsset.confidentialTransfer(
transferData,
transferSignatures,
ethOptions
)).wait();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment