Skip to content

Instantly share code, notes, and snippets.

@sarthakxv
sarthakxv / README.md
Last active November 2, 2024 17:20
Viem to Ethers Signer

WAGMI to Ethers Signer

  • useUniSdk is a hook that initize UniSdk, a SDK which uses ethers implementation and requires ether Signer to be passes to init and use the SDK.
  • Our attempt is to use Wagmi and Viem on client side, hence creating a ethers Signer to from Wagmi to pass into SDK constructor inorder to call the Contract methods.
  1. UniswapPoolDeployer is the example component which uses useUniSdk
  2. useUniSdk is a hook to initilises the SDK
  3. useEthersSigner contains the adapter and returns the Signer
  4. useEthersWalletSigners is another iteration of previous hook implemented using walletClient to get Signer
@sarthakxv
sarthakxv / 0-startup-overview.md
Created February 8, 2023 12:21 — forked from dideler/0-startup-overview.md
Startup Engineering notes
@sarthakxv
sarthakxv / React_cleaner_setTimeout.md
Last active February 8, 2023 12:10
React cleaner use of setTimeout
@sarthakxv
sarthakxv / SearchInput.tsx
Created December 29, 2022 14:39
Feature: Key press to trigger events
import { useRef, useState } from "react";
import useKeyPress from "@hooks/useKeyPress";
type SearchInputProps = {
term: string;
setTerm(newTerm: string): void;
};
/**
*
@sarthakxv
sarthakxv / hardhat.config.js
Last active March 6, 2022 07:03
marketplace
// hardhat.config.js
require("@nomiclabs/hardhat-waffle");
require("dotenv").config();
module.exports = {
solidity: "0.8.4",
defaultNetwork: "rinkeby",
networks: {
hardhat: {},
@sarthakxv
sarthakxv / run.js
Last active February 8, 2023 12:26
run.js file of Waveportal project.
async function main() {
const waveContractFactory = await hre.ethers.getContractFactory("WavePortal");
const waveContract = await waveContractFactory.deploy({value: hre.ethers.utils.parseEther("0.1")});
await waveContract.deployed();
console.log("Contract address: ", waveContract.address);
// getting contract balance
let contractBalance = await hre.ethers.provider.getBalance(waveContract.address);
console.log("Contract Balance: ", hre.ethers.utils.formatEther(contractBalance));
@sarthakxv
sarthakxv / App.js
Created August 3, 2021 11:35
Linking pages in React using react-router-dom package
// importing Router and Route
import { BrowserRouter as Router, Route } from "react-router-dom";
// Pages we need to link
import HomePage from "./Pages/HomePage/index";
import AlbumPage from "./Pages/AlbumPage/index";
import GalleryPage from "./Pages/GalleryPage/index";
// root App component
const App = () => {