minting and getting eth address works

This commit is contained in:
Chris Cassano 2022-11-08 15:48:04 -08:00
parent c8f74eb708
commit 515ff13d45
12 changed files with 13834 additions and 25 deletions

View File

@ -3,9 +3,13 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@react-oauth/google": "^0.4.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"ethers": "^5.7.2",
"js-base64": "^3.7.2",
"lit-js-sdk": "^1.1.234",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
@ -13,9 +17,10 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "yarn fetchContracts && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"fetchContracts": "node ./tools/getDeployedContracts.mjs"
},
"eslintConfig": {
"extends": [

View File

@ -1,23 +1,83 @@
import logo from './logo.svg';
import './App.css';
import { useState } from "react";
import "./App.css";
import { GoogleLogin } from "@react-oauth/google";
import { ethers } from "ethers";
import { Base64 } from "js-base64";
import PKPHelper from "./abis/PKPHelper.json";
import PKPNFT from "./abis/PKPNFT.json";
import ContractAddresses from "./abis/deployed-contracts.json";
function App() {
const [pkpEthAddress, setPkpEthAddress] = useState(null);
const handleLoggedInToGoogle = async (credentialResponse) => {
console.log("got this response from google sign in: ", credentialResponse);
// mint a PKP for the user
// A Web3Provider wraps a standard Web3 provider, which is
// what MetaMask injects as window.ethereum into each page
const provider = new ethers.providers.Web3Provider(window.ethereum);
// MetaMask requires requesting permission to connect users accounts
await provider.send("eth_requestAccounts", []);
// The MetaMask plugin also allows signing transactions to
// send ether and pay to change state within the blockchain.
// For this, you need the account signer...
const signer = provider.getSigner();
const helperContract = new ethers.Contract(
ContractAddresses.pkpHelperContractAddress,
PKPHelper.abi,
signer
);
const pkpContract = new ethers.Contract(
ContractAddresses.pkpNftContractAddress,
PKPNFT.abi,
signer
);
let jwtParts = credentialResponse.credential.split(".");
let jwtPayload = JSON.parse(Base64.decode(jwtParts[1]));
let idForAuthMethod = ethers.utils.hexlify(
ethers.utils.toUtf8Bytes(`${jwtPayload.sub}:${jwtPayload.aud}`)
);
const mintCost = await pkpContract.mintCost();
const mintTx = await helperContract.mintNextAndAddAuthMethods(
2, // keyType
[6], // permittedAuthMethodTypes,
[idForAuthMethod], // permittedAuthMethodIds
["0x"], // permittedAuthMethodPubkeys
[[ethers.BigNumber.from("0")]], // permittedAuthMethodScopes
true, // addPkpEthAddressAsPermittedAddress
true, // sendPkpToItself
{ value: mintCost }
);
console.log("mintTx: ", mintTx);
const mintingReceipt = await mintTx.wait();
console.log("mintingReceipt: ", mintingReceipt);
const tokenIdFromEvent = mintingReceipt.events[2].topics[3];
const ethAddress = await pkpContract.getEthAddress(tokenIdFromEvent);
console.log("minted PKP with eth address: ", ethAddress);
setPkpEthAddress(ethAddress);
// get the user a session with it
const fakeSessionKey = "0x1234567890";
};
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<GoogleLogin
onSuccess={handleLoggedInToGoogle}
onError={() => {
console.log("Login Failed");
}}
useOneTap
/>
<div style={{ height: 100 }} />
{pkpEthAddress && <div>PKP Eth Address: {pkpEthAddress}</div>}
</div>
);
}

277
src/abis/PKPHelper.json Normal file
View File

@ -0,0 +1,277 @@
{
"address": "0xffD53EeAD24a54CA7189596eF1aa3f1369753611",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_pkpNft",
"type": "address"
},
{
"internalType": "address",
"name": "_pkpPermissions",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
},
{
"internalType": "uint256[]",
"name": "permittedAuthMethodTypes",
"type": "uint256[]"
},
{
"internalType": "bytes[]",
"name": "permittedAuthMethodIds",
"type": "bytes[]"
},
{
"internalType": "bytes[]",
"name": "permittedAuthMethodPubkeys",
"type": "bytes[]"
},
{
"internalType": "uint256[][]",
"name": "permittedAuthMethodScopes",
"type": "uint256[][]"
},
{
"internalType": "bool",
"name": "addPkpEthAddressAsPermittedAddress",
"type": "bool"
},
{
"internalType": "bool",
"name": "sendPkpToItself",
"type": "bool"
}
],
"name": "mintNextAndAddAuthMethods",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
},
{
"internalType": "bytes[]",
"name": "permittedIpfsCIDs",
"type": "bytes[]"
},
{
"internalType": "uint256[][]",
"name": "permittedIpfsCIDScopes",
"type": "uint256[][]"
},
{
"internalType": "address[]",
"name": "permittedAddresses",
"type": "address[]"
},
{
"internalType": "uint256[][]",
"name": "permittedAddressScopes",
"type": "uint256[][]"
},
{
"internalType": "uint256[]",
"name": "permittedAuthMethodTypes",
"type": "uint256[]"
},
{
"internalType": "bytes[]",
"name": "permittedAuthMethodIds",
"type": "bytes[]"
},
{
"internalType": "bytes[]",
"name": "permittedAuthMethodPubkeys",
"type": "bytes[]"
},
{
"internalType": "uint256[][]",
"name": "permittedAuthMethodScopes",
"type": "uint256[][]"
},
{
"internalType": "bool",
"name": "addPkpEthAddressAsPermittedAddress",
"type": "bool"
},
{
"internalType": "bool",
"name": "sendPkpToItself",
"type": "bool"
}
],
"name": "mintNextAndAddAuthMethodsWithTypes",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"name": "onERC721Received",
"outputs": [
{
"internalType": "bytes4",
"name": "",
"type": "bytes4"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpNFT",
"outputs": [
{
"internalType": "contract PKPNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpPermissions",
"outputs": [
{
"internalType": "contract PKPPermissions",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newPkpNftAddress",
"type": "address"
}
],
"name": "setPkpNftAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newPkpPermissionsAddress",
"type": "address"
}
],
"name": "setPkpPermissionsAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}

967
src/abis/PKPNFT.json Normal file
View File

@ -0,0 +1,967 @@
{
"address": "0x86062B7a01B8b2e22619dBE0C15cbe3F7EBd0E92",
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "contractBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "exists",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "freeMintId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
},
{
"internalType": "bytes32",
"name": "msgHash",
"type": "bytes32"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "freeMintGrantAndBurnNext",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "freeMintId",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "msgHash",
"type": "bytes32"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "freeMintNext",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "freeMintId",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "msgHash",
"type": "bytes32"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "freeMintSigTest",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "freeMintSigner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getEthAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPubkey",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "getUnmintedRoutedTokenIdCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "mintCost",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
}
],
"name": "mintGrantAndBurnNext",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
}
],
"name": "mintGrantAndBurnSpecific",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "mintNext",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "mintSpecific",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpNftMetadata",
"outputs": [
{
"internalType": "contract PKPNFTMetadata",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpPermissions",
"outputs": [
{
"internalType": "contract PKPPermissions",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "pkpRouted",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"name": "prefixed",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "redeemedFreeMintIds",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "router",
"outputs": [
{
"internalType": "contract PubkeyRouter",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newFreeMintSigner",
"type": "address"
}
],
"name": "setFreeMintSigner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newMintCost",
"type": "uint256"
}
],
"name": "setMintCost",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pkpNftMetadataAddress",
"type": "address"
}
],
"name": "setPkpNftMetadataAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "pkpPermissionsAddress",
"type": "address"
}
],
"name": "setPkpPermissionsAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "routerAddress",
"type": "address"
}
],
"name": "setRouterAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "unmintedRoutedTokenIds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}

View File

@ -0,0 +1,795 @@
{
"address": "0x274d0C69fCfC40f71E57f81E8eA5Bd786a96B832",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_pkpNft",
"type": "address"
},
{
"internalType": "address",
"name": "_router",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"indexed": false,
"internalType": "bytes",
"name": "userPubkey",
"type": "bytes"
}
],
"name": "PermittedAuthMethodAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "PermittedAuthMethodRemoved",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "scopeId",
"type": "uint256"
}
],
"name": "PermittedAuthMethodScopeAdded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"indexed": false,
"internalType": "uint256",
"name": "scopeId",
"type": "uint256"
}
],
"name": "PermittedAuthMethodScopeRemoved",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
},
{
"internalType": "uint256[]",
"name": "scopes",
"type": "uint256[]"
}
],
"name": "addPermittedAction",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "user",
"type": "address"
},
{
"internalType": "uint256[]",
"name": "scopes",
"type": "uint256[]"
}
],
"name": "addPermittedAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "userPubkey",
"type": "bytes"
},
{
"internalType": "uint256[]",
"name": "scopes",
"type": "uint256[]"
}
],
"name": "addPermittedAuthMethod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "scopeId",
"type": "uint256"
}
],
"name": "addPermittedAuthMethodScope",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "authMethods",
"outputs": [
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "userPubkey",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "getAuthMethodId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getEthAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPermittedActions",
"outputs": [
{
"internalType": "bytes[]",
"name": "",
"type": "bytes[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPermittedAddresses",
"outputs": [
{
"internalType": "address[]",
"name": "",
"type": "address[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "maxScopeId",
"type": "uint256"
}
],
"name": "getPermittedAuthMethodScopes",
"outputs": [
{
"internalType": "bool[]",
"name": "",
"type": "bool[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPermittedAuthMethods",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "bytes",
"name": "userPubkey",
"type": "bytes"
}
],
"internalType": "struct PKPPermissions.AuthMethod[]",
"name": "",
"type": "tuple[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPubkey",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "getTokenIdsForAuthMethod",
"outputs": [
{
"internalType": "uint256[]",
"name": "",
"type": "uint256[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "getUserPubkeyForAuthMethod",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
}
],
"name": "isPermittedAction",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "isPermittedAddress",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "isPermittedAuthMethod",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "scopeId",
"type": "uint256"
}
],
"name": "isPermittedAuthMethodScopePresent",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpNFT",
"outputs": [
{
"internalType": "contract PKPNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "ipfsCID",
"type": "bytes"
}
],
"name": "removePermittedAction",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "user",
"type": "address"
}
],
"name": "removePermittedAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
}
],
"name": "removePermittedAuthMethod",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "authMethodType",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "id",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "scopeId",
"type": "uint256"
}
],
"name": "removePermittedAuthMethodScope",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "router",
"outputs": [
{
"internalType": "contract PubkeyRouter",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newPkpNftAddress",
"type": "address"
}
],
"name": "setPkpNftAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newRouterAddress",
"type": "address"
}
],
"name": "setRouterAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}

405
src/abis/PubKeyRouter.json Normal file
View File

@ -0,0 +1,405 @@
{
"address": "0xEA287AF8d8835eb20175875e89576bf583539B37",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "_pkpNft",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "PubkeyRoutingDataSet",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"indexed": true,
"internalType": "address",
"name": "nodeAddress",
"type": "address"
},
{
"indexed": false,
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"indexed": false,
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "PubkeyRoutingDataVote",
"type": "event"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "ethAddressToPkpId",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getEthAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getPubkey",
"outputs": [
{
"internalType": "bytes",
"name": "",
"type": "bytes"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getRoutingData",
"outputs": [
{
"components": [
{
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"internalType": "struct PubkeyRouter.PubkeyRoutingData",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "isRouted",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "pkpNFT",
"outputs": [
{
"internalType": "contract PKPNFT",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "pubkeyRegistrations",
"outputs": [
{
"components": [
{
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"internalType": "struct PubkeyRouter.PubkeyRoutingData",
"name": "routingData",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "nodeVoteCount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "nodeVoteThreshold",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "pubkeys",
"outputs": [
{
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newPkpNftAddress",
"type": "address"
}
],
"name": "setPkpNftAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "setRoutingData",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "pubkey",
"type": "bytes"
},
{
"internalType": "address",
"name": "stakingContract",
"type": "address"
},
{
"internalType": "uint256",
"name": "keyType",
"type": "uint256"
}
],
"name": "voteForRoutingData",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}

842
src/abis/RateLimitNFT.json Normal file
View File

@ -0,0 +1,842 @@
{
"address": "0xE094c76Ec6bad7CbA6181C8b34Bc41faC7EbdF43",
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "approved",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Approval",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "ApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": true,
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"inputs": [],
"name": "RLIHolderRateLimitWindowMilliseconds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "additionalRequestsPerMillisecondCost",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "approve",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "balanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "burn",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "requestsPerMillisecond",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
}
],
"name": "calculateCost",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "payingAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
}
],
"name": "calculateRequestsPerSecond",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "capacity",
"outputs": [
{
"internalType": "uint256",
"name": "requestsPerMillisecond",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "contractBalance",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "defaultRateLimitWindowMilliseconds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "requestsPerMillisecond",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "msgHash",
"type": "bytes32"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "freeMint",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "requestsPerMillisecond",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "msgHash",
"type": "bytes32"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"name": "freeMintSigTest",
"outputs": [],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "freeMintSigner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "freeRequestsPerRateLimitWindow",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "getApproved",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "operator",
"type": "address"
}
],
"name": "isApprovedForAll",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "isExpired",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "expiresAt",
"type": "uint256"
}
],
"name": "mint",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "ownerOf",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
}
],
"name": "prefixed",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"name": "redeemedFreeMints",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newAdditionalRequestsPerMillisecondCost",
"type": "uint256"
}
],
"name": "setAdditionalRequestsPerSecondCost",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newFreeMintSigner",
"type": "address"
}
],
"name": "setFreeMintSigner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newFreeRequestsPerRateLimitWindow",
"type": "uint256"
}
],
"name": "setFreeRequestsPerRateLimitWindow",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newRLIHolderRateLimitWindowMilliseconds",
"type": "uint256"
}
],
"name": "setRLIHolderRateLimitWindowMilliseconds",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "newRateLimitWindowMilliseconds",
"type": "uint256"
}
],
"name": "setRateLimitWindowMilliseconds",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "interfaceId",
"type": "bytes4"
}
],
"name": "supportsInterface",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "symbol",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "tokenIdCounter",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
}
],
"name": "tokenOfOwnerByIndex",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "tokenURI",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "totalSupply",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "from",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
}
],
"name": "transferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}

View File

@ -0,0 +1,18 @@
{
"stakingContractAddress": "0x091e9b0a5A404A394377d08C0Fd8C3418075e1fe",
"multisenderContractAddress": "0x1D907ec0CE55E7E3164Da56e50D64DC2d8933142",
"litTokenContractAddress": "0x541C8a3D27643002fb8A37dCf42D22940B5b2F51",
"accessControlConditionsContractAddress": "0x6620A0e03Ca33a3818f1539DF94f9807b12B9Ec2",
"pubkeyRouterContractAddress": "0xEA287AF8d8835eb20175875e89576bf583539B37",
"pkpNftContractAddress": "0xd4CF0c73eCcFd4B4c7742564f8fdBAC6510771c1",
"rateLimitNftContractAddress": "0xE094c76Ec6bad7CbA6181C8b34Bc41faC7EbdF43",
"pkpHelperContractAddress": "0x961AFF1d8020ce78502B8335b02A7416BEa9A28e",
"pkpPermissionsContractAddress": "0x274d0C69fCfC40f71E57f81E8eA5Bd786a96B832",
"pkpNftMetadataContractAddress": "0x46c568B561Cde9ded66Be7d8044C141481c74d0f",
"chainId": 80001,
"rpcUrl": "https://polygon-mumbai.g.alchemy.com/v2/onvoLvV97DDoLkAmdi0Cj7sxvfglKqDh",
"chainName": "mumbai",
"litNodeDomainName": "127.0.0.1",
"litNodePort": 7470,
"rocketPort": 7470
}

View File

@ -1,13 +1,16 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
import React from "react";
import ReactDOM from "react-dom/client";
import "./index.css";
import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { GoogleOAuthProvider } from "@react-oauth/google";
const root = ReactDOM.createRoot(document.getElementById('root'));
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
<React.StrictMode>
<App />
<GoogleOAuthProvider clientId="490433686717-ojog337bhespbnsl29cr5h402e7pgkho.apps.googleusercontent.com">
<App />
</GoogleOAuthProvider>
</React.StrictMode>
);

View File

@ -0,0 +1,51 @@
import { runInputOutputs } from "./util.mjs";
/** ==================== Main ==================== */
const INPUT_ROOT =
"https://raw.githubusercontent.com/LIT-Protocol/LitNodeContracts/main/";
const OUTPUT_FOLDER = "./src/abis/";
// -- explorer.litprotocol.com
const SERRANO = "deployed_contracts_serrano.json";
// -- mumbai.explorer.litprotocol.com
const COLLABLAND = "deployed_contracts_mumbai.json";
// -- CURRENT USING:
const CURRENT = SERRANO;
runInputOutputs({
IOs: [
{
input: `${INPUT_ROOT}${CURRENT}`,
output: `${OUTPUT_FOLDER}deployed-contracts.json`,
mappedKey: null,
},
{
input: `${INPUT_ROOT}deployments/mumbai_80001/PKPHelper.json`,
output: `${OUTPUT_FOLDER}PKPHelper.json`,
mappedKey: "pkpHelperContractAddress",
},
{
input: `${INPUT_ROOT}deployments/mumbai_80001/PKPNFT.json`,
output: `${OUTPUT_FOLDER}PKPNFT.json`,
mappedKey: "pkpNftContractAddress",
},
{
input: `${INPUT_ROOT}deployments/mumbai_80001/PKPPermissions.json`,
output: `${OUTPUT_FOLDER}PKPPermissions.json`,
mappedKey: "pkpPermissionsContractAddress",
},
{
input: `${INPUT_ROOT}deployments/mumbai_80001/PubkeyRouter.json`,
output: `${OUTPUT_FOLDER}PubKeyRouter.json`,
mappedKey: "pubkeyRouterContractAddress",
},
{
input: `${INPUT_ROOT}deployments/mumbai_80001/RateLimitNFT.json`,
output: `${OUTPUT_FOLDER}RateLimitNFT.json`,
mappedKey: "rateLimitNftContractAddress",
},
],
ignoreProperties: ["metadata", "bytecode", "deployedBytecode"],
});

47
tools/util.mjs Normal file
View File

@ -0,0 +1,47 @@
import fs from "fs";
import fetch from "node-fetch";
/** ==================== Helper ==================== */
export const writeToFile = (data, filename) => {
fs.writeFile(filename, data, (err) => {
if (err) {
console.log(err);
} else {
console.log(`Wrote to ${filename}`);
}
});
};
export const asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
};
export const runInputOutputs = async ({ IOs, ignoreProperties }) => {
let deployedContracts = {};
await asyncForEach(IOs, async (item, i) => {
const { input, output, mappedKey } = item;
const data = await fetch(input).then((res) => res.text());
const json = JSON.parse(data);
if (i <= 0) {
deployedContracts = json;
}
await asyncForEach(Object.keys(json), async (key) => {
if (ignoreProperties.includes(key)) {
delete json[key];
}
});
if (mappedKey !== null) {
json.address = deployedContracts[mappedKey];
}
writeToFile(JSON.stringify(json, null, 2), output);
});
};

10339
yarn.lock Normal file

File diff suppressed because it is too large Load Diff