We can use multicall.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const signMessage = async ( | |
chainId: string, | |
address: string, | |
): Promise<StdSignature | undefined> => { | |
const anyWindow: any = window; | |
if (!anyWindow.getOfflineSigner) { | |
throw new Error('Keplr extension is not available'); | |
} | |
const signed = await window.keplr?.signArbitrary( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.13; | |
import {ERC165Checker} from "openzeppelin-contracts/utils/introspection/ERC165Checker.sol"; | |
import {MerkleBase} from "../utils/MerkleBase.sol"; | |
import {MerkleProof} from "openzeppelin-contracts/utils/cryptography/MerkleProof.sol"; | |
import {MinPriorityQueue, Bid} from "../lib/MinPriorityQueue.sol"; | |
import {Minter} from "../modules/Minter.sol"; | |
import {ICryptoPunk} from "../punks/interfaces/ICryptoPunk.sol"; |
Digital root is the recursive sum of all the digits in a number.
Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
16 --> 1 + 6 = 7
942 --> 9 + 4 + 2 = 15 --> 1 + 5 = 6
132189 --> 1 + 3 + 2 + 1 + 8 + 9 = 24 --> 2 + 4 = 6
const book = {
title:"My Favorite JS Functions",
author:{
firstName:"John",
lastName:"Doe"
}
}
// (1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get web3 | |
let web3 = await initAccount() | |
// get contract instance | |
let main = new web3.eth.Contract( | |
JSON_ABI, | |
CONTRACT_ADDRESS, | |
) | |
// usdc contract instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reverse = (data) => { | |
if ( !data || !data.length) { | |
return false | |
} | |
const length = data.length | |
const reversed = data.split("").reverse().join(""); | |
for ( let index = 0; index < length / 2; index ++ ) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from "react"; | |
import { useDebounce } from "use-debounce"; | |
export default function Input() { | |
const [text, setText] = useState("Hello"); | |
const [value] = useDebounce(text, 1000); | |
return ( | |
<div> | |
<input |
NewerOlder