Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
feat(sdk): rebase develop
Browse files Browse the repository at this point in the history
  • Loading branch information
joeandrews committed Jul 6, 2020
1 parent 2248b4b commit 841bcdc
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 8 deletions.
48 changes: 48 additions & 0 deletions packages/extension/:w
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const fetchOutputNotes = ({
proofData,
proof,
signature,
signature2,
}) => {
const {
outputNotes,
remainderNote,
} = proofData || {};
if (!outputNotes) return null;

return {
outputNotes: outputNotes
.filter((note) => {
if (!remainderNote) return true;
return note.decryptedViewingKey !== remainderNote.decryptedViewingKey;
})
.map(({
noteHash,
value,
}) => ({
noteHash,
value,
})),
};
};

export default {
DEPOSIT_PROOF: [
fetchOutputNotes,
],
WITHDRAW_PROOF: [],
TRANSFER_PROOF: [
fetchOutputNotes,
],
CREATE_NOTE_FROM_BALANCE_PROOF: [
(data) => {
const {
outputNotes,
} = fetchOutputNotes(data) || {};

return {
notes: outputNotes || [],
};
},
],
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
const fetchOutputNotes = ({ proofData }) => {
const fetchOutputNotes = ({
proofData,
proof,
signature,
signature2,
}) => {
const {
outputNotes,
remainderNote,
Expand Down
11 changes: 4 additions & 7 deletions packages/extension/src/client/apis/ZkAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ export default class ZkAsset {
returnProof,
sender,
publicOwner,
...rest,
} = {}) => {
if (!this.linkedTokenAddress) {
throw new ApiError('zkAsset.private', {
Expand Down Expand Up @@ -288,6 +289,7 @@ export default class ZkAsset {
}

return {
...rest,
success,
outputNotes,
proof,
Expand Down Expand Up @@ -330,6 +332,7 @@ export default class ZkAsset {
inputNoteHashes,
returnProof,
sender,
...rest,
} = {}) => {
if (!this.linkedTokenAddress) {
throw new ApiError('zkAsset.private', {
Expand Down Expand Up @@ -367,6 +370,7 @@ export default class ZkAsset {
}

return {
...rest,
success,
proof,
};
Expand Down Expand Up @@ -447,17 +451,10 @@ export default class ZkAsset {
},
);

let proof;
if (proofData) {
proof = proofData
? await recoverJoinSplitProof(proofData)
: null;
}

return {
success,
outputNotes,
proof,
};
};

Expand Down
5 changes: 5 additions & 0 deletions packages/extension/src/ui/steps/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ const stepSendViaGSN = {
};

export default {

returnProof: [
stepApprove,
stepSignNotes,
],
gsn: [
stepApprove,
stepSignNotes,
Expand Down

0 comments on commit 841bcdc

Please sign in to comment.