Skip to content

Instantly share code, notes, and snippets.

@PBillingsby
PBillingsby / install_lilypad.sh
Created July 22, 2024 18:31
A script that removes the current Lilypad version and adds the binary pasted
install_lilypad() {
local BASE_URL=$1
# Extract the version from the URL
VERSION=$(echo $BASE_URL | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+')
if [[ -z "$VERSION" ]]; then
echo "Failed to extract version from URL."
return 1
fi

Usage

This project uses Next.js but relies on fairly standard React components and hooks. Magic-related components are in the /src/components/magic directory, all other UI components are in the /src/components/ui directory, utility functions are in /src/utils and hooks are in the /src/hooks directory.

Use this project as a reference for how to use this template or implement Magic in your own project. Key areas to look at include:

Login Functionality

The Login.tsx component, located in /src/components/magic, manages the display and functionality of various login methods on the login page. It is a central piece for handling user authentication.

Custom Hooks

@PBillingsby
PBillingsby / submissions.txt
Created June 28, 2024 17:44
POW submissions
[
Result(7) [
'0xBf8443EF0D056d10CD213a11F64C4d4F71f75052',
'QmVqXthSo8dPqieyZGTik3CaSwVjcEdWn6vhSQq9xH4uj6',
76169490603168406592631576010783376661754614238975655702592247142729580017240n,
1719499985n,
1719499996n,
'0xa43391d3af9d391e1b2916f65151b2f451564a5948f3d36215873eb09965893c',
2021876946624580403476403221115901569728113256934678191056046655411322n
],
@PBillingsby
PBillingsby / page.tsx
Last active June 28, 2024 01:57
Pulling token balances
"use client";
import { useEffect, useState } from "react";
import { ethers, formatEther, formatUnits, JsonRpcProvider } from "ethers";
import Image from "next/image";
// Infura URL for the Arbitrum Sepolia network
const infuraUrl: string = "https://sepolia-rollup.arbitrum.io/rpc";
// ERC20 ABI to interact with the token contract
const erc20ABI = [
Contract addresses for Lilypad (confirm these)
- production controller address: 0xF2fD1B9b262982F12446149A27d8901Ac68dcB59
- SERVICE_SOLVER=0x346d811cbb883548252418121f5bb0371eb07049
- SERVICE_MEDIATORS=0xc66b9b74e307f30e7af79c03fee6ceb8b1ced997
# devnet.toml
[services]
solver = "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC"
mediator = ["0x90F79bf6EB2c4f870365E785982E1f101E93b906"]
---
title: Group Pointer
objectives:
- Create a group mint pointing to itself
---
# Summary
- **Group Pointer** allows us to designate a group account that describes the mint.
- Unlike metadata, it describes the configurations for the group.
@PBillingsby
PBillingsby / with-cli.txt
Created June 7, 2024 19:59
lilypad:up trace with CLI not installed
> @prb/hardhat-template@1.0.0 lilypad:up
> ./up.sh
🪷 Starting Lilypad services ... 🪷
[+] Building 0.8s (19/19) FINISHED docker:desktop-linux
=> [jobcreator internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 478B 0.0s
=> [solver internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 478B 0.0s
=> [resource-provider internal] load metadata for docker.io/library/ubuntu:jammy 0.4s
@PBillingsby
PBillingsby / no-cli.txt
Last active June 7, 2024 20:02
lilypad:up trace without CLI not installed
> @prb/hardhat-template@1.0.0 lilypad:up
> ./up.sh
🪷 Starting Lilypad services ... 🪷
[+] Building 1.2s (19/19) FINISHED docker:desktop-linux
=> [solver internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 478B 0.0s
=> [resource-provider internal] load metadata for docker.io/library/ubuntu:jammy 0.7s
=> [jobcreator internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 478B 0.0s
@PBillingsby
PBillingsby / index.txt
Created January 2, 2024 18:38
swap bug
Weth/Steth
CURRENCY: CurrencyAmount {
numerator: JSBI(3) [ 908853248, 646484075, 2, sign: false ],
denominator: JSBI(1) [ 1, sign: false ],
currency: Token {
chainId: 1,
decimals: 18,
symbol: 'WETH',
name: undefined,
@PBillingsby
PBillingsby / index.ts
Created December 20, 2023 17:41
web3.js v1 flow
// Send transaction
import { Magic } from 'magic-sdk';
import Web3 from 'web3';
const magic = new Magic('YOUR_PUBLISHABLE_API_KEY');
const web3 = new Web3(magic.rpcProvider);
// ⭐️ After user is successfully authenticated
// Get user's Ethereum public address