Skip to content

Instantly share code, notes, and snippets.

View dicethedev's full-sized avatar
🚀
Building

Blessing Samuel dicethedev

🚀
Building
View GitHub Profile
@dicethedev
dicethedev / countries.ts
Last active February 26, 2024 16:01
countries.ts
export const countries = [
{
"capital": "Kabul",
"currencies": [
{
"code": "AFN",
"name": "Afghan afghani",
"symbol": "Ø‹"
}
],
"use client";
import ContainerWrapper from "@/components/ContainerWrapper";
import { useState, useEffect } from "react";
import { Box, Text, Flex, Icon, Button, Input, Stack, HStack, Skeleton, useToast } from "@chakra-ui/react";
import { useAppSelector } from "@/hooks/rtkHooks";
import { Link } from "@chakra-ui/next-js";
import { ME_SVG } from "@/assets/svg";
import { CiSettings } from "react-icons/ci";
import TokenSelectOption from "@/components/SelectOptions/TokenSelect";
<!DOCTYPE html>
<html>
<head>
<title>Niki Chatbot</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css"
integrity="sha384-B4dIYHKNBt8Bc12p+WXckhzcICo0wtJAoU8YZTY5qE0Id1GSseTk6S+L3BlXeVIU" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
@dicethedev
dicethedev / _app.tsx
Created May 8, 2023 17:38
CELO Testnet
import '../styles/globals.css'
import Head from 'next/head'
import type { AppProps } from 'next/app'
import { WagmiConfig, createClient, configureChains, Chain, chain } from "wagmi";
import { getDefaultWallets, RainbowKitProvider, darkTheme} from "@rainbow-me/rainbowkit";
import { jsonRpcProvider } from "wagmi/providers/jsonRpc";
import '@rainbow-me/rainbowkit/styles.css';
function MyApp({ Component, pageProps }: AppProps) {
const celoChain: Chain = {
@dicethedev
dicethedev / index.jsx
Created April 26, 2023 04:25
How to extract the contract address from an ERC20 token owned by a user using Ethers.js
import { ethers } from 'ethers';
const ERC20_ABI = ... // Replace with the ABI of your ERC20 token
async function getContractAddress(tokenAddress, userAddress) {
const provider = new ethers.providers.InfuraProvider('mainnet', 'YOUR_INFURA_PROJECT_ID');
const contract = new ethers.Contract(tokenAddress, ERC20_ABI, provider);
const balance = await contract.balanceOf(userAddress);
@dicethedev
dicethedev / index.jsx
Last active April 24, 2023 10:59
possible solution to make the NFT images load faster
//--------------------------------- Method 1 ----------------------------------------
//Here's an example of how you can use the fetch function to fetch an NFT from Pinata:
//In this example, the NFTImage component takes an nftHash prop that represents the hash of the NFT on Pinata.
//The component uses the useState and useEffect hooks to fetch the NFT image from Pinata using the fetch function.
// If the HTTP response is successful, the component sets the image URL in state using the setImageUrl function,
// and renders an img element with the src attribute set to the image URL.
//If the image URL is not available yet, the component displays a "Loading NFT..." message.
@dicethedev
dicethedev / myFindings.md
Last active March 17, 2023 09:30
Findings report

Finding

Risk rating * Medium Risk

Title * Summarize your findings for the bug or vulnerability. (This will be the issue title.)

Here are some potential security vulnerabilities that I have identified in this particular contract (BytecodeCompressor.sol)

{"v":"5.7.11","fr":30,"ip":0,"op":60,"w":512,"h":512,"nm":"Bouncy Fail","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"X line 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":90,"ix":10},"p":{"a":0,"k":[256,256,0],"ix":2,"l":2},"a":{"a":0,"k":[41,-3,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[112,-74],[-30,68]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":40,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0.38823529411764707,0.2784313725490196,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,
@dicethedev
dicethedev / Connect2Phantom.tsx
Created February 7, 2023 14:07 — forked from jmlon/Connect2Phantom.tsx
Example connection to the Phantom wallet for the solana_part1 tutorial
import { FC, useEffect, useState } from "react";
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";
type PhantomEvent = "disconnect" | "connect" | "accountChanged";
interface ConnectOpts {
onlyIfTrusted: boolean;
}
<template>
<h1>Color Picker Game</h1>
<div>{{ message }}</div>
<button v-for="color in colors" :key="color" @click="matchColor(color)">
{{ color }}
</button>
</template>