Skip to content

Instantly share code, notes, and snippets.

@0xlxy
0xlxy / sharp.js
Created January 9, 2024 00:12
sharp.js
const sharp = require("sharp");
const main = async (scale) => {
const originalImage = await sharp("text.png").ensureAlpha().raw();
const { width, height } = await originalImage.metadata();
const image = await originalImage
.resize({
width: Math.floor(width * scale),
height: Math.floor(height * scale),
fit: "contain",
@0xlxy
0xlxy / package.json
Created June 2, 2023 04:58
ENS Name Resolver
{
"name": "ens",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@0xlxy
0xlxy / gas.py
Last active April 26, 2023 23:32
Script for Pirate Nation's total gas fee spent on Arbitrum Nova
import requests
# API endpoint for retrieving transaction information
api_url = "https://api-nova.arbiscan.io/api"
# Address of the smart contract
contract_address = "0x3b4cdb27641bc76214a0cb6cae3560a468d9ad4a"
# Start and end blocks to search for transactions
start_block = 0
@0xlxy
0xlxy / main.js
Created April 19, 2023 23:41
Ethereum Blockchain Indexer
const { ethers } = require("ethers");
const provider = new ethers.providers.WebSocketProvider(
"wss://mainnet.infura.io/ws/v3/992c9dccdfd849dabf68ab78d689595d"
);
console.log(provider);
provider.on("block", (blockNumber) => {
provider
.getBlockWithTransactions(blockNumber)
@0xlxy
0xlxy / lambda_function.py
Last active November 10, 2022 04:48
AWS Lambda + RDS to refresh & load all collection txns into sql
import multiprocessing.dummy as mp
import pymysql
import requests
class TransactionsTable:
def __init__(self, collections):
self.collections = collections
for collection in self.collections:
@0xlxy
0xlxy / lambda_function.py
Created October 24, 2022 19:47
sudoswap sell_quote & buy_quote
import json
from decimal import Decimal
import boto3
import requests
class UpdateDB:
def __init__(self):
self.result = []
@0xlxy
0xlxy / seaport-collection-offers.py
Created October 8, 2022 00:32
Opensea Collection & Traits Offers - Beta
import requests
import json
slug = "azuki"
url = f'https://api.opensea.io/vnext/offers/collection/{slug}/traits'
headers = {
"X-API-KEY": "2972994f68bb4dfc9f68c944f473c329"
}
@0xlxy
0xlxy / make-offer-looksrare.js
Created September 14, 2022 03:56
Script for making an offer on looksrare
const https = require('https')
const { Wallet } = require('ethers')
const {
addressesByNetwork,
SupportedChainId,
generateMakerOrderTypedData,
} = require('@looksrare/sdk')
require('dotenv').config()
const WALLET_PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY
@0xlxy
0xlxy / make-offer-opensea.js
Created September 14, 2022 03:37
Script for making an offer on opensea
// if type module -> cannot use reqiure, need import
// In package.json: "type": "module",
import { OpenSeaSDK, Network } from "opensea-js";
import HDWalletProvider from "@truffle/hdwallet-provider";
import { config } from 'dotenv';
config();
// https://github.com/ProjectOpenSea/opensea-js#making-offers
const WALLET_PRIVATE_KEY = process.env.WALLET_PRIVATE_KEY
@0xlxy
0xlxy / make-offer-x2y2.ts
Created September 14, 2022 03:21
Script for making an offer on X2Y2
import { Signer } from 'ethers'
import { ethersWallet, init, offer } from '@x2y2-io/sdk'
import { Network } from '@x2y2-io/sdk/dist/network'
require('dotenv').config()
// https://github.com/X2Y2-io/x2y2-sdk#making-offers--collection-offers
const X2Y2_API_KEY: string = process.env.X2Y2_API_KEY || ""
const WALLET_PRIVATE_KEY: string = process.env.WALLET_PRIVATE_KEY || ""