Compare commits
4 Commits
13fcce3c8e
...
3ab93a62d8
Author | SHA1 | Date | |
---|---|---|---|
|
3ab93a62d8 | ||
|
fde6b29f1f | ||
|
4008a740c5 | ||
|
813c1c2c53 |
16
src/App.tsx
16
src/App.tsx
@ -11,10 +11,14 @@ import { publicProvider } from 'wagmi/providers/public'
|
|||||||
const web3 = new Web3(Web3.givenProvider);
|
const web3 = new Web3(Web3.givenProvider);
|
||||||
|
|
||||||
import Airdrop from "./Airdrop.json";
|
import Airdrop from "./Airdrop.json";
|
||||||
|
import MagnaToken from "./MagnaToken.json";
|
||||||
|
|
||||||
const airdropAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
|
const airdropAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512";
|
||||||
const airdropContract = new web3.eth.Contract(Airdrop.abi as any, airdropAddress);
|
const airdropContract = new web3.eth.Contract(Airdrop.abi as any, airdropAddress);
|
||||||
|
|
||||||
|
const magnaTokenAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3";
|
||||||
|
const magnaTokenContract = new web3.eth.Contract(MagnaToken.abi as any, magnaTokenAddress);
|
||||||
|
|
||||||
const { chains, provider, webSocketProvider } = configureChains([mainnet], [publicProvider()]);
|
const { chains, provider, webSocketProvider } = configureChains([mainnet], [publicProvider()]);
|
||||||
|
|
||||||
const wagmiClient = createClient({
|
const wagmiClient = createClient({
|
||||||
@ -46,6 +50,7 @@ function Profile() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
|
<div>Connect to Airdrop App</div>
|
||||||
{connectors.map((connector) => (
|
{connectors.map((connector) => (
|
||||||
<button
|
<button
|
||||||
disabled={!connector.ready}
|
disabled={!connector.ready}
|
||||||
@ -136,9 +141,20 @@ function AddressList({addressList}: AddressListProps) {
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
const [addressList, setAddressList] = useState([]);
|
const [addressList, setAddressList] = useState([]);
|
||||||
|
const { address: ownerAddress } = useAccount()
|
||||||
|
|
||||||
async function performAirdrop() {
|
async function performAirdrop() {
|
||||||
console.log("Performing airdrop");
|
console.log("Performing airdrop");
|
||||||
|
|
||||||
|
console.log(magnaTokenContract.methods);
|
||||||
|
|
||||||
|
const allowance = await magnaTokenContract.methods.allowance(ownerAddress, airdropAddress).call({ from: ownerAddress });
|
||||||
|
console.log(`Allowance: ${allowance}`);
|
||||||
|
|
||||||
|
if (allowance <= 0) {
|
||||||
|
//TODO prompt to set a positive balance
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
286
src/MagnaToken.json
Normal file
286
src/MagnaToken.json
Normal file
File diff suppressed because one or more lines are too long
@ -8,10 +8,8 @@
|
|||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"forceConsistentCasingInFileNames": true,
|
"forceConsistentCasingInFileNames": true,
|
||||||
"noFallthroughCasesInSwitch": true,
|
"noFallthroughCasesInSwitch": true,
|
||||||
"module": "esnext",
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx"
|
"jsx": "react-jsx"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user