Skip to content

Commit

Permalink
Remove collectible if is being sent (#391)
Browse files Browse the repository at this point in the history
* delete collectible if collectible is being sent

* remove collectible before clear tx

* if
  • Loading branch information
estebanmino authored Feb 16, 2019
1 parent de0dbab commit 33e7347
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/components/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ class Send extends Component {
return this.mounted && this.setState({ mode: 'edit', transactionKey: Date.now() });
}

/**
* Removes collectible in case an ERC721 asset is being sent
*/
removeCollectible = () => {
const { selectedAsset, assetType } = this.props.transaction;
if (assetType === 'ERC721') {
const { AssetsController } = Engine.context;
AssetsController.removeCollectible(selectedAsset.address, selectedAsset.tokenId);
}
};

/**
* Transaction state is erased, ready to create a new clean transaction
*/
Expand Down Expand Up @@ -230,6 +241,7 @@ class Send extends Component {
await TransactionController.approveTransaction(transactionMeta.id);
const hash = await result;
this.props.navigation.push('TransactionSubmitted', { hash });
this.removeCollectible();
this.clear();
this.setState({ transactionConfirmed: false, transactionSubmitted: true });
} catch (error) {
Expand Down

0 comments on commit 33e7347

Please sign in to comment.