View the Live Site
This repo serves as my submittal for the Pocket Network DAO Global Bounty - Integrate A Pocket-Powered Endpoint Into Your Project
Check out the short demo video
It is SO easy to get up and running with the pocket portal! The following is a basic step-by-step outline of how I integrated a pocket portal into my project.
Note: MVPP = Minimum Viable Pocket Portal 😉 Refer to the official documentation for a detailed step-by-step of this process.
npx create-next-app@latest pocket-portal-tx-viewer
4. Created simple requests to the RPC endpoint within my app using Basic HTTP Authentication, here's an example of one:
export async function getServerSideProps() {
const body = {
jsonrpc: "2.0",
id: 1,
method: "eth_getBlockByNumber",
params: ["latest", null],
};
const response = await fetch(
`https://user:${process.env.POCKET_SECRET}@eth-mainnet.gateway.pokt.network/v1/lb/618d53223853830035c7a414`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(body),
}
);
const { result } = await response.json();
return {
props: { result },
};
}