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

Commit

Permalink
feat(sdk): batch sign notes for send and retry with metamask if failed
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaWang committed Feb 20, 2020
1 parent 6e35486 commit bf829fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
4 changes: 3 additions & 1 deletion packages/extension/src/ui/pages/Send.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const Send = ({
address: currentAddress,
} = currentAccount;
const steps = isGSNAvailable ? sendSteps.gsn : sendSteps.metamask;
const sender = isGSNAvailable ? proxyContract : currentAddress;
const sender = proxyContract;

const asset = await makeAsset(assetAddress);
const parsedTransactions = parseInputTransactions(transactions);
Expand All @@ -43,6 +43,7 @@ const Send = ({

return {
steps,
retryWithMetaMaskStep: sendSteps.metamask.slice(-1)[0],
assetAddress,
currentAddress,
asset,
Expand All @@ -53,6 +54,7 @@ const Send = ({
numberOfOutputNotes,
userAccessAccounts,
amount,
isGSNAvailable,
};
};

Expand Down
16 changes: 3 additions & 13 deletions packages/extension/src/ui/steps/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,13 @@ const stepSignNotes = {
tasks: [
{
type: 'sign',
run: apis.note.signNotes,
run: apis.note.signProof,
},
],
autoStart: true,
submitTextKey: 'transaction.sign.submit',
};

const stepSignNotesForGSN = {
...stepSignNotes,
tasks: [
{
type: 'sign',
run: apis.note.signProof,
},
],
};

const stepConfirm = {
name: 'confirm',
descriptionKey: 'send.confirm.description',
Expand Down Expand Up @@ -61,7 +51,7 @@ const stepSend = {
{
type: 'sign',
titleKey: 'send.send.step',
run: apis.asset.confidentialTransfer,
run: apis.asset.confidentialTransferFrom,
},
{
titleKey: 'transaction.confirmed',
Expand Down Expand Up @@ -100,7 +90,7 @@ const stepSendViaGSN = {
export default {
gsn: [
stepApprove,
stepSignNotesForGSN,
stepSignNotes,
stepConfirmViaGSN,
stepSendViaGSN,
],
Expand Down

0 comments on commit bf829fc

Please sign in to comment.