Skip to content

Instantly share code, notes, and snippets.

@apow2
Created April 30, 2021 02:41
Show Gist options
  • Save apow2/1baa1a646e536f26aab7456caaf20550 to your computer and use it in GitHub Desktop.
Save apow2/1baa1a646e536f26aab7456caaf20550 to your computer and use it in GitHub Desktop.
export const transfer= (contract) => (to) => async (tokenId) => {
let myContract = await contract;
try {
let tx = await get(web3).eth.sendTransaction({
gasPrice: get(web3).utils.toHex(get(web3).utils.toWei("225", "gwei")),
gasLimit: get(web3).utils.toHex("600000"),
from: get(selectedAccount),
to: contractAddress,
data: myContract.methods.transfer(to, tokenId).encodeABI(),
});
console.log("Receipt from transfer", tx);
alert("Your Item has been transferred!");
} catch (err) {
console.warn("Error: " + err);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment