- Clone the source code from https://github.com/MetaMask/metamask-extension
- Switch to
snaps
branch yarn setup
- Copy the
.metamaskrc.dist
file to.metamaskrc
and replace theINFURA_PROJECT_ID
value with your own. yarn run build prod --build-type flask
- The build should be located at directory
dist
.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from io import BytesIO | |
import torch | |
from fastapi.responses import StreamingResponse | |
from leptonai.photon import Photon | |
from loguru import logger | |
class JPEGResponse(StreamingResponse): | |
media_type = "image/jpeg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function* streamAsyncIterable<T = unknown>(stream: ReadableStream<T>) { | |
const reader = stream.getReader() | |
try { | |
while (true) { | |
const { done, value } = await reader.read() | |
if (done) { | |
return | |
} | |
yield value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import HDWalletProvider from "@truffle/hdwallet-provider"; | |
import { OpenSeaPort, Network } from "opensea-js"; | |
import { PRIVATE_KEY } from "./consts.mjs"; | |
const provider = new HDWalletProvider({ | |
privateKeys: [PRIVATE_KEY], | |
providerOrUrl: "https://rpc.ankr.com/eth", | |
}); | |
provider.engine.on("error", (err) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fillText(ctx, text, x, y, maxWidth, spacing = 0){ | |
const lines = text.split('\n') | |
let lineHeight = 0 | |
for (const line of lines) { | |
if (!line) { | |
y += lineHeight | |
continue | |
} | |
let s = '' | |
for (const char of line) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*-coding:utf-8-*- | |
import hashlib | |
import hmac | |
import time | |
import requests | |
HMAC_KEY = '5tT!TQkf5fYbabw5?KL2659XgL^JgxWw8r9Y+bAvGwP-QfteQL' | |
class TanTan(object): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Chain, Common } from "@nomicfoundation/ethereumjs-common"; | |
import { TransactionFactory } from "@nomicfoundation/ethereumjs-tx"; | |
import { VM } from "@nomicfoundation/ethereumjs-vm"; | |
import { ForkBlockchain } from "hardhat/internal/hardhat-network/provider/fork/ForkBlockchain"; | |
import { ForkStateManager } from "hardhat/internal/hardhat-network/provider/fork/ForkStateManager"; | |
import { makeForkClient } from "hardhat/internal/hardhat-network/provider/utils/makeForkClient"; | |
const JSON_RPC_URL = "https://rpc.ankr.com/eth"; | |
async function simulateTx(signedTx: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"contracts": { | |
"@openzeppelin/contracts/access/Ownable.sol": { | |
"Ownable": { | |
"storageLayout": { | |
"storage": [ | |
{ | |
"astId": 7, | |
"contract": "@openzeppelin/contracts/access/Ownable.sol:Ownable", | |
"label": "_owner", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener("fetch", event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
function jsonResponse(o) { | |
return new Response(JSON.stringify(o), { | |
headers: { | |
"content-type": "application/json;charset=UTF-8", | |
'Access-Control-Allow-Origin': '*', | |
} |
NewerOlder