JSFiddle - React, Tailwind, and code Playground
by ZeNz0r
HTML
<script src="https://cdn.ethers.io/lib/ethers-5.0.umd.min.js"></script>
JavaScript
const GIVEAWAY_ID = 9
const listOfWallets = [{
name: "zenz0r",
wallet: "0x2491751014D48E83E74AbfA47b29A1a9888eAE4d"
}, {
name: "no prize 1",
wallet: "0x1d2FDB34234f56d1C641eC2F36f56DF83B1DBF84"
}, {
name: "no prize 2",
wallet: "0x5C836fb04dac2Ab3944fd2648a910378C3F1Fc0E"
}, {
name: "with prize 1",
wallet: "0xab1c7ac02443FbB8A730953C1465FdC2e5524880"
}]
const provider = new ethers.providers.JsonRpcProvider("https://api.avax.network/ext/bc/C/rpc")
const giveawayContractAddress = "0xEDD2D2D21F7c7882AcEF93002899Fd169ac19043";
const giveawayAbi = [{
"anonymous": false,
"inputs": [{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
}, {
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}],
"name": "OwnershipTransferred",
"type": "event"
}, {
"inputs": [],
"name": "GetWinningNumbers",
"outputs": [{
"internalType": "uint256[]",
"name": "winningNodeBearIds_",
"type": "uint256[]"
}],
"stateMutability": "nonpayable",
"type": "function"
}, {
"inputs": [{
"internalType": "uint256",
"name": "",
"type": "uint256"
}],
"name": "GiveawayMap",
"outputs": [{
"internalType": "uint256",
"name": "_id",
"type": "uint256"
}, {
"internalType": "uint256",
"name": "_totalNumBears",
"type": "uint256"
}, {
"internalType": "uint256",
"name": "_VRFValue",
"type": "uint256"
}, {
"internalType": "uint256",
"name": "_numWinners",
"type": "uint256"
}],
"stateMutability": "view",
"type": "function"
}, {
"inputs": [{
"internalType": "uint256",
"name": "",
"type": "uint256"
}],
"name": "WinnerMap",
"outputs": [{
"internalType": "uint256",
"name": "_id",
"type": "uint256"
}, {
"internalType": "uint256",
"name": "_generationId",
"type": "uint256"
}, {
"internalType": "uint256",
"name": "_giveawayId",
"type":...