Skip to content

Instantly share code, notes, and snippets.

@roninjin10
roninjin10 / bridge.js
Created September 16, 2022 14:44
synpress test
// TODO import this form actual app https://linear.app/optimism/issue/FE-484/lots-of-todos-in-e2e-tests
const t = {
CONNECT_WALLET: 'Connect Wallet',
}
//TODo move this to commands.ts https://linear.app/optimism/issue/FE-484/lots-of-todos-in-e2e-tests
Cypress.Commands.add('getByCy', (selector, ...args) => {
return cy.get(`[data-cy=${selector}]`, ...args)
})
Cypress.Commands.add('getByCyLike', (selector, ...args) => {
import { predeploys } from '@eth-optimism/contracts-bedrock'
import type { CrossChainMessenger } from '@eth-optimism/sdk'
import { ETHBridgeAdapter, StandardBridgeAdapter } from '@eth-optimism/sdk'
import type { Chain as IChain } from '@usedapp/core'
import { Goerli, Mainnet, Optimism } from '@usedapp/core'
import {
alchemyKeyMainnet,
alchemyKeyOptimism,
alchemyKeyOptimismGoerli,
infuraKey,
@roninjin10
roninjin10 / prisma.schema
Created February 7, 2023 04:21
OP prisma.schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model airdrops {
@roninjin10
roninjin10 / atstexample.ts
Last active February 23, 2023 02:55
atst example
import { attestationKeys, addresses } from "@gateway/contracts";
import { useContractRead } from "wagmi";
import { useChain } from "utils/chain";
import attestationStationAbi from "@gateway/contracts/abis/AttestationStation.json";
import { BytesLike, toUtf8String } from "ethers/lib/utils";
/**
* Example of reading from attestation station (atst)
*/
export const AttestationExample = () => {
This file has been truncated, but you can view the full file.
{
"buster": "",
"timestamp": 1681447731400,
"clientState": {
"mutations": [
{
"mutationKey": [
{
"entity": "connect"
}
This file has been truncated, but you can view the full file.
{
"buster": "",
"timestamp": 1681447731400,
"clientState": {
"mutations": [
{
"mutationKey": [
{
"entity": "connect"
}
services:
postgres-mainnet:
image: postgres:latest
environment:
- POSTGRES_USER=db_username
- POSTGRES_PASSWORD=db_password
- POSTGRES_DB=db_name
- PGDATA=/data/postgres
- POSTGRES_HOST_AUTH_METHOD=trust
healthcheck:
import type { FallbackProvider } from '@ethersproject/providers'
import { useEthers } from '@usedapp/core'
import { AbstractConnector } from '@web3-react/abstract-connector'
import { useEffect } from 'react'
import { useAccount, useNetwork } from 'wagmi'
class UseDappConnector extends AbstractConnector {
constructor(
private readonly chainId: number,
private readonly address: string,
name: Autofix PR
on:
issue_comment:
types: [created]
# Down scope as necessary via https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
checks: write
contents: write
@roninjin10
roninjin10 / GatewayServer.ts
Created April 5, 2024 08:54
Dependency injection in gateway server
/* Imports: External */
import type { ExpressRouter } from '@eth-optimism/common-ts'
import { BaseServiceV2 } from '@eth-optimism/common-ts'
import { CrossChainMessenger } from '@eth-optimism/sdk'
import { retryWithBackoff } from '@gateway/common-ts'
import { Storage } from '@google-cloud/storage'
import { PrismaClient } from '@prisma/client'
import type { Queue, Worker } from 'bullmq'
import isomorphicFetch from 'isomorphic-fetch'
import type { Address, Hex } from 'viem'