Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revoke NFT allowances #187

Merged
merged 1 commit into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,16 @@ <h4 class="card-title">
</button>
</div>

<div class="form-group">
<button
class="btn btn-primary btn-lg btn-block mb-3"
id="revokeButton"
disabled
>
Revoke
</button>
</div>

<div class="form-group">
<label>Transfer Token</label>
<input
Expand Down
18 changes: 18 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const approveButton = document.getElementById('approveButton');
const setApprovalForAllButton = document.getElementById(
'setApprovalForAllButton',
);
const revokeButton = document.getElementById('revokeButton');
const transferTokenInput = document.getElementById('transferTokenInput');
const transferFromButton = document.getElementById('transferFromButton');
const collectiblesStatus = document.getElementById('collectiblesStatus');
Expand Down Expand Up @@ -227,6 +228,7 @@ const initialize = async () => {
approveTokenInput,
approveButton,
setApprovalForAllButton,
revokeButton,
transferTokenInput,
transferFromButton,
deployFailingButton,
Expand Down Expand Up @@ -339,6 +341,7 @@ const initialize = async () => {
approveTokenInput.disabled = false;
approveButton.disabled = false;
setApprovalForAllButton.disabled = false;
revokeButton.disabled = false;
transferTokenInput.disabled = false;
transferFromButton.disabled = false;
// ERC20 Token - Send Tokens
Expand Down Expand Up @@ -523,6 +526,7 @@ const initialize = async () => {
approveTokenInput.disabled = false;
approveButton.disabled = false;
setApprovalForAllButton.disabled = false;
revokeButton.disabled = false;
transferTokenInput.disabled = false;
transferFromButton.disabled = false;
};
Expand Down Expand Up @@ -555,6 +559,20 @@ const initialize = async () => {
collectiblesStatus.innerHTML = 'Set Approval For All completed';
};

revokeButton.onclick = async () => {
collectiblesStatus.innerHTML = 'Revoke initiated';
let result = await collectiblesContract.setApprovalForAll(
'0x9bc5baF874d2DA8D216aE9f137804184EE5AfEF4',
false,
{
from: accounts[0],
},
);
result = await result.wait();
console.log(result);
collectiblesStatus.innerHTML = 'Revoke completed';
};

transferFromButton.onclick = async () => {
collectiblesStatus.innerHTML = 'Transfer From initiated';
let result = await collectiblesContract.transferFrom(
Expand Down