Skip to content

Commit

Permalink
- communicate request cancellation back to the dapp via beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymoussprocket committed Mar 9, 2021
1 parent 1e206cc commit 0a46cca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/contracts/HicNFT/components/BalanceBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function BalanceBanner(props: Props) {
)}
</AddressInfo>
<AddressInfo>
<div style={{ alignItems: 'start', marginTop: '5px' }}>
<div style={{ alignItems: 'start' }}>
<TezosAddress address={publicKeyHash} weight={100} color="white" text={publicKeyHash} size={ms(1.7)} shorten={true} />
</div>
<div style={{ marginLeft: 'auto' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/HicNFT/components/Collection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function CollectionContainer(props: Props) {
<PaginationList
list={collection}
ListComponent={ArtGallery}
listComponentProps={{ ovens: collection }}
listComponentProps={{}}
componentListName="collection"
emptyState={emptyGallery}
emptyStateTitle={t('components.actionPanel.empty-title')}
Expand Down
16 changes: 14 additions & 2 deletions src/featureModals/Beacon/BeaconAuthorization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
import { useTranslation, Trans } from 'react-i18next';
import styled from 'styled-components';
import { BeaconMessageType, OperationResponseInput } from '@airgap/beacon-sdk';
import { BeaconMessageType, OperationResponseInput, BeaconErrorType, BeaconResponseInputMessage } from '@airgap/beacon-sdk';
import IconButton from '@material-ui/core/IconButton';
import { BigNumber } from 'bignumber.js';
import { OperationKindType } from 'conseiljs';
Expand Down Expand Up @@ -108,6 +108,18 @@ const BeaconAuthorize = ({ open, managerBalance, onClose }: Props) => {
const { newFees, miniFee, isRevealed } = useFetchFees(OperationKindType.Transaction, true, true);
const fee = estimateOperationGroupFee(selectedParentHash, operationDetails);

const onCancel = async () => {
const response: BeaconResponseInputMessage = {
id,
type: BeaconMessageType.Error,
errorType: BeaconErrorType.ABORTED_ERROR,
// senderId:
};
await beaconClient.respond(response);

onClose();
};

const onAuthorize = async () => {
try {
dispatch(setBeaconLoading(true));
Expand Down Expand Up @@ -778,7 +790,7 @@ const BeaconAuthorize = ({ open, managerBalance, onClose }: Props) => {
<Footer>
{!ledgerModalOpen && (
<ButtonContainer>
<WhiteBtn buttonTheme="secondary" onClick={onClose}>
<WhiteBtn buttonTheme="secondary" onClick={onCancel}>
{t('general.verbs.cancel')}
</WhiteBtn>
<InvokeButton buttonTheme="primary" onClick={onAuthorize}>
Expand Down

0 comments on commit 0a46cca

Please sign in to comment.