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 create note from balance proof
Browse files Browse the repository at this point in the history
  • Loading branch information
LeilaWang committed Feb 20, 2020
1 parent bf829fc commit f73d6e4
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/CreateNoteFromBalance.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const CreateNoteFromBalance = ({
const userAccessAccounts = userAccess
? await apis.account.batchGetExtensionAccount(userAccess)
: [];
const sender = isGSNAvailable ? proxyContract : currentAddress;
const sender = proxyContract;
const amount = parseInputAmount(inputAmount);
const transactions = [
{
Expand All @@ -72,6 +72,7 @@ const CreateNoteFromBalance = ({

return {
steps,
retryWithMetaMaskStep: createNoteFromBalanceSteps.metamask.slice(-1)[0],
assetAddress,
currentAddress,
asset,
Expand All @@ -84,6 +85,7 @@ const CreateNoteFromBalance = ({
spender: sender,
transactions,
gsnConfig,
isGSNAvailable,
};
};

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

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

const stepConfirm = {
name: 'confirm',
descriptionKey: 'note.access.confirm.description',
Expand Down Expand Up @@ -61,7 +51,7 @@ const stepSend = {
{
type: 'sign',
titleKey: 'note.access.grant.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,
stepBatchSign,
stepSign,
stepConfirmViaGSN,
stepSendViaGSN,
],
Expand Down

0 comments on commit f73d6e4

Please sign in to comment.