Skip to content

Instantly share code, notes, and snippets.

@dtbuchholz
Last active August 20, 2022 21:09
Show Gist options
  • Save dtbuchholz/15824378cd520bf9cdc868d502b571a2 to your computer and use it in GitHub Desktop.
Save dtbuchholz/15824378cd520bf9cdc868d502b571a2 to your computer and use it in GitHub Desktop.
spamming requests to polygon mumbai provider
// Env setup
import { connect } from "@tableland/sdk"
import dotenv from "dotenv"
import { ethers } from "ethers"
import fetch from "node-fetch"
dotenv.config()
globalThis.fetch = fetch
// Import private key & instantiate wallet / signer
const privateKey = process.env.WALLET_PRIVATE_KEY
const alchemyMumbaiKey = process.env.ALCHEMY_POLYGON_MUMBAI_API_KEY
const mumbaiUrl = `https://polygon-mumbai.g.alchemy.com/v2/${alchemyMumbaiKey}`
const provider = new ethers.providers.JsonRpcProvider(mumbaiUrl)
const wallet = new ethers.Wallet(privateKey, provider)
const signer = wallet.connect(provider)
// TBL
const tableland = await connect({ signer })
const schema = "handle text primary key, address text, message text"
const prefix = "discord_bot"
// This is where things hang up, causing an undesired number of requests.
const { name } = await tableland.create(schema, {
prefix,
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment