Skip to content

Instantly share code, notes, and snippets.

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

Daniel Mont Ferrandiz dferrandizmont

🏠
Working from home
  • Terrassa, Barcelona.
  • 04:12 (UTC +02:00)
View GitHub Profile
@dferrandizmont
dferrandizmont / rpc_fetch_raydium_pool_init.ts
Created June 21, 2024 12:52 — forked from rubpy/rpc_fetch_raydium_pool_init.ts
Finds Raydium AMM pool initialization transaction (partially deserializes pool state, calls getSignaturesForAddress, searches for a Raydium innerInstruction, etc.).
import * as web3 from "@solana/web3.js";
import bs58 from "bs58";
//////////////////////////////////////////////////
function findInstructionsInTransaction(
tx: web3.ParsedTransactionWithMeta,
predicate?: (instruction: web3.ParsedInstruction | web3.PartiallyDecodedInstruction, outerInstruction: (web3.ParsedInstruction | web3.PartiallyDecodedInstruction) | null) => boolean,
): Array<web3.ParsedInstruction | web3.PartiallyDecodedInstruction> {
if (!tx || !tx.meta || !tx.transaction || !tx.transaction.message || !tx.transaction.message.instructions) {
@dferrandizmont
dferrandizmont / raydium_sdk_v2_example.ts
Created June 21, 2024 12:51 — forked from rubpy/raydium_sdk_v2_example.ts
Fetching pool info and determining prices of token/SOL & SOL/USDC pairs via Raydium SDK V2.
import * as raydium from "@raydium-io/raydium-sdk-v2";
//////////////////////////////////////////////////
const RAYDIUM_CLMM_SOL_USDC_ID = "2QdhepnKRTLjjSqPL1PtKNwqrUkoLee5Gqs8bvZhRdMv";
function normalizeRaydiumBetaPoolInfoResponse(response: raydium.ApiV3PoolInfoItem[] | raydium.ApiV3PageIns<raydium.ApiV3PoolInfoItem>): raydium.ApiV3PoolInfoItem[] {
if (response === null || typeof response !== "object") {
return [];
}
@dferrandizmont
dferrandizmont / rpc_fetch_metaplex_token_metadata.ts
Created June 21, 2024 12:51 — forked from rubpy/rpc_fetch_metaplex_token_metadata.ts
Fetching on-chain Metaplex token metadata (through lightweight getAccountInfo).
import * as web3 from "@solana/web3.js";
import {
MPL_TOKEN_METADATA_PROGRAM_ID,
MetadataAccountData as MplMetadataAccountData,
getMetadataAccountDataSerializer,
} from "@metaplex-foundation/mpl-token-metadata";
//////////////////////////////////////////////////
const METAPLEX_PROGRAM_ID = new web3.PublicKey(MPL_TOKEN_METADATA_PROGRAM_ID);
@dferrandizmont
dferrandizmont / rpc_fetch_token_mint_info.ts
Created June 21, 2024 12:51 — forked from rubpy/rpc_fetch_token_mint_info.ts
Fetching basic token (mint) info (through getAccountInfo), e.g.: total supply, mintAuthority, freezeAuthority...
import * as web3 from "@solana/web3.js";
import { TOKEN_PROGRAM_ID, unpackMint, Mint } from "@solana/spl-token";
//////////////////////////////////////////////////
async function getTokenInfo(conn: web3.Connection, tokenMint: web3.PublicKey): Promise<Mint | null> {
const info = await conn.getAccountInfo(tokenMint);
if (!info) return null;
try {
@dferrandizmont
dferrandizmont / uniswap-v3-example.sol
Created December 11, 2023 21:47 — forked from mempirate/uniswap-v3-example.sol
Simple example on how to swap on UniswapV3 with the SwapRouter
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
pragma abicoder v2;
import "@uniswap/v2-periphery/contracts/interfaces/IWETH.sol";
import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol";
import "@uniswap/v3-core/contracts/libraries/LowGasSafeMath.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Daniel Ferrandiz Mont",
"label": "Java Developer",
"image": "",
"email": "dferrandizmont@gmail.com",
"phone": "637979142",
"url": "",
"summary": "I would consider myself detail-oriented, even though my strong suit is backend development, I cannot ignore my inner designer who pays close attention to the presentation of everything, such as typography, button color, code indentation, and margins. I am a team player, and knowledge sharing is the most important aspect of work for me. Thanks to it, I grow every day, and I couldn't imagine a week without learning something new.\n\nI have worked with people who speak my own language, as well as English, Czech, Slovak, Russian, and one of the most enjoyable things is trying to learn the basics of their language. The look of excitement on their face when you try to say something in their language is priceless.\n\nI am a Java
@dferrandizmont
dferrandizmont / docker.md
Created April 13, 2022 11:10 — forked from zmts/docker.md
Docker, TypeScript, Node.js

Docker, TypeScript, Node.js

Preconditions:

  • TS application listening port: 7777
|-- dist
|-- src
|-- .dockerignore
|-- Dockerfile
@dferrandizmont
dferrandizmont / ruta-imagen-report.java
Last active January 28, 2019 09:13
[Obtener ruta imágenes report] #report #scriptlet
public String getLogoInforme() {
return FacesContext.getCurrentInstance().getExternalContext().getRealPath("") + "/resources/imagenes/" + "vinclesweb_logo.png";
}
@dferrandizmont
dferrandizmont / public-apis.md
Created January 10, 2019 09:09
[Public APIs 3] inglés #api

Public-APIs Twitter: @abgbm Build Status PRs Welcome

This is an attempt to categorise different APIs scoured from the web which make their resources available for consumption.

*Items marked with Open Source are open-source *Items marked with 💸 are trial based APIs

Table of Contents

@dferrandizmont
dferrandizmont / awesome-api.md
Created January 10, 2019 09:08
[Public APIs 2] inglés #api

Awesome API Awesome Build Status Donate

A curated list of awesome resources for design and implement RESTful APIs.

Design

Overview

REST allows us to create services and applications that can be used by any device or client who understands HTTP.