|
| 1 | +import { Abi, getContract } from "viem"; |
| 2 | +import { TFunction } from "./types"; |
| 3 | + |
| 4 | +const abi = [ |
| 5 | + { |
| 6 | + inputs: [ |
| 7 | + { internalType: "string", name: "_name", type: "string" }, |
| 8 | + { internalType: "string", name: "_symbol", type: "string" }, |
| 9 | + { internalType: "uint8", name: "_decimals", type: "uint8" }, |
| 10 | + ], |
| 11 | + stateMutability: "nonpayable", |
| 12 | + type: "constructor", |
| 13 | + }, |
| 14 | + { |
| 15 | + anonymous: false, |
| 16 | + inputs: [ |
| 17 | + { indexed: true, internalType: "address", name: "owner", type: "address" }, |
| 18 | + { indexed: true, internalType: "address", name: "spender", type: "address" }, |
| 19 | + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, |
| 20 | + ], |
| 21 | + name: "Approval", |
| 22 | + type: "event", |
| 23 | + }, |
| 24 | + { |
| 25 | + anonymous: false, |
| 26 | + inputs: [ |
| 27 | + { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, |
| 28 | + { indexed: true, internalType: "address", name: "newOwner", type: "address" }, |
| 29 | + ], |
| 30 | + name: "OwnershipTransferred", |
| 31 | + type: "event", |
| 32 | + }, |
| 33 | + { |
| 34 | + anonymous: false, |
| 35 | + inputs: [ |
| 36 | + { indexed: true, internalType: "address", name: "from", type: "address" }, |
| 37 | + { indexed: true, internalType: "address", name: "to", type: "address" }, |
| 38 | + { indexed: false, internalType: "uint256", name: "value", type: "uint256" }, |
| 39 | + ], |
| 40 | + name: "Transfer", |
| 41 | + type: "event", |
| 42 | + }, |
| 43 | + { |
| 44 | + inputs: [{ internalType: "address", name: "", type: "address" }], |
| 45 | + name: "allowFaucet", |
| 46 | + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], |
| 47 | + stateMutability: "view", |
| 48 | + type: "function", |
| 49 | + }, |
| 50 | + { |
| 51 | + inputs: [ |
| 52 | + { internalType: "address", name: "owner", type: "address" }, |
| 53 | + { internalType: "address", name: "spender", type: "address" }, |
| 54 | + ], |
| 55 | + name: "allowance", |
| 56 | + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], |
| 57 | + stateMutability: "view", |
| 58 | + type: "function", |
| 59 | + }, |
| 60 | + { |
| 61 | + inputs: [ |
| 62 | + { internalType: "address", name: "spender", type: "address" }, |
| 63 | + { internalType: "uint256", name: "amount", type: "uint256" }, |
| 64 | + ], |
| 65 | + name: "approve", |
| 66 | + outputs: [{ internalType: "bool", name: "", type: "bool" }], |
| 67 | + stateMutability: "nonpayable", |
| 68 | + type: "function", |
| 69 | + }, |
| 70 | + { |
| 71 | + inputs: [{ internalType: "address", name: "account", type: "address" }], |
| 72 | + name: "balanceOf", |
| 73 | + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], |
| 74 | + stateMutability: "view", |
| 75 | + type: "function", |
| 76 | + }, |
| 77 | + { |
| 78 | + inputs: [ |
| 79 | + { internalType: "address", name: "account", type: "address" }, |
| 80 | + { internalType: "uint256", name: "amount", type: "uint256" }, |
| 81 | + ], |
| 82 | + name: "burn", |
| 83 | + outputs: [], |
| 84 | + stateMutability: "nonpayable", |
| 85 | + type: "function", |
| 86 | + }, |
| 87 | + { |
| 88 | + inputs: [], |
| 89 | + name: "decimals", |
| 90 | + outputs: [{ internalType: "uint8", name: "", type: "uint8" }], |
| 91 | + stateMutability: "view", |
| 92 | + type: "function", |
| 93 | + }, |
| 94 | + { |
| 95 | + inputs: [ |
| 96 | + { internalType: "address", name: "spender", type: "address" }, |
| 97 | + { internalType: "uint256", name: "subtractedValue", type: "uint256" }, |
| 98 | + ], |
| 99 | + name: "decreaseAllowance", |
| 100 | + outputs: [{ internalType: "bool", name: "", type: "bool" }], |
| 101 | + stateMutability: "nonpayable", |
| 102 | + type: "function", |
| 103 | + }, |
| 104 | + { |
| 105 | + inputs: [{ internalType: "uint256", name: "amount", type: "uint256" }], |
| 106 | + name: "faucet", |
| 107 | + outputs: [], |
| 108 | + stateMutability: "nonpayable", |
| 109 | + type: "function", |
| 110 | + }, |
| 111 | + { |
| 112 | + inputs: [ |
| 113 | + { internalType: "address", name: "spender", type: "address" }, |
| 114 | + { internalType: "uint256", name: "addedValue", type: "uint256" }, |
| 115 | + ], |
| 116 | + name: "increaseAllowance", |
| 117 | + outputs: [{ internalType: "bool", name: "", type: "bool" }], |
| 118 | + stateMutability: "nonpayable", |
| 119 | + type: "function", |
| 120 | + }, |
| 121 | + { |
| 122 | + inputs: [], |
| 123 | + name: "maxFaucetAllowed", |
| 124 | + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], |
| 125 | + stateMutability: "view", |
| 126 | + type: "function", |
| 127 | + }, |
| 128 | + { |
| 129 | + inputs: [ |
| 130 | + { internalType: "address", name: "account", type: "address" }, |
| 131 | + { internalType: "uint256", name: "amount", type: "uint256" }, |
| 132 | + ], |
| 133 | + name: "mint", |
| 134 | + outputs: [], |
| 135 | + stateMutability: "nonpayable", |
| 136 | + type: "function", |
| 137 | + }, |
| 138 | + { |
| 139 | + inputs: [], |
| 140 | + name: "name", |
| 141 | + outputs: [{ internalType: "string", name: "", type: "string" }], |
| 142 | + stateMutability: "view", |
| 143 | + type: "function", |
| 144 | + }, |
| 145 | + { |
| 146 | + inputs: [], |
| 147 | + name: "owner", |
| 148 | + outputs: [{ internalType: "address", name: "", type: "address" }], |
| 149 | + stateMutability: "view", |
| 150 | + type: "function", |
| 151 | + }, |
| 152 | + { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, |
| 153 | + { |
| 154 | + inputs: [{ internalType: "uint256", name: "allowed", type: "uint256" }], |
| 155 | + name: "setMaxFaucetAllowed", |
| 156 | + outputs: [], |
| 157 | + stateMutability: "nonpayable", |
| 158 | + type: "function", |
| 159 | + }, |
| 160 | + { |
| 161 | + inputs: [], |
| 162 | + name: "symbol", |
| 163 | + outputs: [{ internalType: "string", name: "", type: "string" }], |
| 164 | + stateMutability: "view", |
| 165 | + type: "function", |
| 166 | + }, |
| 167 | + { |
| 168 | + inputs: [], |
| 169 | + name: "totalSupply", |
| 170 | + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], |
| 171 | + stateMutability: "view", |
| 172 | + type: "function", |
| 173 | + }, |
| 174 | + { |
| 175 | + inputs: [ |
| 176 | + { internalType: "address", name: "recipient", type: "address" }, |
| 177 | + { internalType: "uint256", name: "amount", type: "uint256" }, |
| 178 | + ], |
| 179 | + name: "transfer", |
| 180 | + outputs: [{ internalType: "bool", name: "", type: "bool" }], |
| 181 | + stateMutability: "nonpayable", |
| 182 | + type: "function", |
| 183 | + }, |
| 184 | + { |
| 185 | + inputs: [ |
| 186 | + { internalType: "address", name: "sender", type: "address" }, |
| 187 | + { internalType: "address", name: "recipient", type: "address" }, |
| 188 | + { internalType: "uint256", name: "amount", type: "uint256" }, |
| 189 | + ], |
| 190 | + name: "transferFrom", |
| 191 | + outputs: [{ internalType: "bool", name: "", type: "bool" }], |
| 192 | + stateMutability: "nonpayable", |
| 193 | + type: "function", |
| 194 | + }, |
| 195 | + { |
| 196 | + inputs: [{ internalType: "address", name: "newOwner", type: "address" }], |
| 197 | + name: "transferOwnership", |
| 198 | + outputs: [], |
| 199 | + stateMutability: "nonpayable", |
| 200 | + type: "function", |
| 201 | + }, |
| 202 | +] as const satisfies Abi; |
| 203 | + |
| 204 | +export const getFaucetContract: TFunction<typeof abi> = ({ address, publicClient, walletClient }) => { |
| 205 | + return getContract({ abi, address, publicClient, walletClient }); |
| 206 | +}; |
0 commit comments