Skip to content

Instantly share code, notes, and snippets.

View jdnichollsc's full-sized avatar
🏠
Working from home

J.D Nicholls jdnichollsc

🏠
Working from home
View GitHub Profile
@jdnichollsc
jdnichollsc / RandomNumber.sol
Last active March 18, 2024 15:16
Create a Random Number with Chainlink
// SPDX-License-Identifier: MIT
pragma solidity 0.8.21;
import {VRFCoordinatorV2Interface} from "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import {VRFConsumerBaseV2} from "@chainlink/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol";
import {ConfirmedOwner} from "@chainlink/contracts/src/v0.8/shared/access/ConfirmedOwner.sol";
// Fuji Testnet: 0xb9477bfbCAe729643b8251404Fa6E4356bB3d9A3
contract RandomNumber is VRFConsumerBaseV2 {
VRFCoordinatorV2Interface COORDINATOR;
@jdnichollsc
jdnichollsc / useMarketplace.ts
Created July 1, 2023 00:50
Custom hook for infinite scrolling using React Query
import { useInfiniteQuery } from '@tanstack/react-query';
import { MarketplaceItem } from '../models';
import { getMarketplaceItems } from '../services';
export type UseMarketplaceItemsProps = {
query: string;
initialData?: MarketplaceItem[];
from?: number;
size?: number;
@jdnichollsc
jdnichollsc / alternative_for_own_packages.js
Last active June 23, 2023 02:13
Fix RemixJS issues; "process is not defined" & "Buffer is not defined" - discussion related https://github.com/remix-run/remix/discussions/4906
// This is optional, only for building your own npm packages using those polyfills
// This is not useful to fix issues from external packages like web3 dependencies
import { Buffer } from "buffer"
import * as process from "process"
globalThis.Buffer = Buffer as unknown as BufferConstructor;
globalThis.process = process as unknown as NodeJS.Process;
// So only use this alternative if you don't want to use the below patch fix for RemixJS!
@jdnichollsc
jdnichollsc / user-signature.dto.ts
Created August 29, 2022 21:29
Verify that a request is signed by the owner of the public key (NestJS, ExpressJS and Solana)
import { ApiProperty } from '@nestjs/swagger';
export class UserSignatureDto {
@ApiProperty({ description: 'Wallet base58-encoded public key' })
walletPK: string;
@ApiProperty({ description: 'base58-encoded signature of a unique message' })
signature: string;
}
@jdnichollsc
jdnichollsc / NEAR.md
Last active November 28, 2022 22:26
NEAR Developer Bootcamp

NEAR enruta la transacción para que vaya al Shard correspondiente.

dApp en NEAR

Máquina virtual de NEAR:

Su máquina virtual no es exclusiva a su red

Blockchain Environment

@jdnichollsc
jdnichollsc / CHAINLINK.md
Last active August 14, 2024 06:11
Bootcamp para Desarrolladores de Smart Contracts
@jdnichollsc
jdnichollsc / Bitcoin.md
Last active November 9, 2022 18:36
🇨🇴 Criptomonedas & BlockChain 🇪🇸

Bitcoin

Es la primera criptomoneda o activo financiero digital descentralizado de la historia que permite realizar transacciones de forma segura, privada y sin intermediarios alrededor del mundo. Satoshi Nakamoto es el pseudónimo que fue utilizado por la persona o el grupo de personas que diseñaron y crearon el ecosistema Bitcoin.

La motivación de Satoshi Nakamoto para concebir Bitcoin fue crear un nuevo sistema de dinero electrónico que utilice por completo una red de pares que no necesite un tercero de confianza (intermediario financiero) para realizar las transacciones y cuya oferta no pueda ser alterada por ninguna otra parte. En otras palabras Bitcoin trasladaría las características deseables del dinero físico (falta de intermediarios, irrevocabilidad de las transacciones) al mundo digital y las combinaría con una política monetaria rigurosa que no se pueda manipular para producir inflación inesperada en beneficio de terceros, acosta de los tenedores de dicha moneda. Nakamoto lo logro utilizando te

@jdnichollsc
jdnichollsc / ABC.md
Last active February 5, 2021 14:42
English is a work in progress

Useful Phrases

Clarification

  • What does that mean?
  • How does it work?
  • How long does it take?
  • Could you say that again, please?

Collaboration

  • When will the next meeting be?