Skip to content

Commit

Permalink
toastin’ & fixin’ Optimism Alchemy RPC URL 🧆
Browse files Browse the repository at this point in the history
  • Loading branch information
dysbulic committed Jun 11, 2024
1 parent 12b02ed commit 58ba442
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pkgs/ui/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const nftBase = (
(typeof NFT_BASE !== 'undefined') ? (
NFT_BASE
) : (
'https://chiev.es/#/view'
`https://${window.location.host}/#/view`
)
)

Expand Down
4 changes: 2 additions & 2 deletions pkgs/ui/src/lib/ConnectKit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const config = createConfig(
[optimism.id]: (
import.meta.env.VITE_ALCHEMY_ID
? (
http(`https://op-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_ID}`)
http(`https://opt-mainnet.g.alchemy.com/v2/${import.meta.env.VITE_ALCHEMY_ID}`)
) : (
(() => { throw new Error('Missing $ALCHEMY_ID') })()
)
Expand All @@ -26,7 +26,7 @@ export const config = createConfig(

// Optional
appDescription: 'MetaGame’s ’Chievemints accomplishment attestations.',
appUrl: 'https://chiev.es',
appUrl: window.location.host,
appIcon: 'https://chiev.es/logo.svg', // max. 1MiB
}),
)
Expand Down
25 changes: 2 additions & 23 deletions pkgs/ui/src/pages/mushroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useAccount } from 'wagmi'
import { optimism } from 'viem/chains'
import ABI from '../contracts/optimisticEthereum/BulkDisbursableNFTs.abi';
import tyl from '../styles/mushroom.module.css'
import { toast } from 'react-toastify'

export const FreeMushroom = () => (
<section id={tyl.free}>
Expand All @@ -22,39 +23,19 @@ export const FreeMushroom = () => (

const Content: React.FC = () => {
const { address } = useAccount()
console.debug({ address, ABI })
const mint = async () => {
const client = createWalletClient({
account: address,
chain: optimism,
transport: custom(window.ethereum),
})

console.debug({ acc: client.account, req: await client.request({ method: 'eth_accounts', params: [] }) })

const bundlerURL = (
'https://bundler.biconomy.io/api/v2/10/nJPK7B3ru.ac5t7734-190d-41am-af80-6877f74b8f44'
)
const paymasterURL = (
'https://paymaster.biconomy.io/api/v1/10/B__e5X2ip.9ef0f5c9-efda-4014-b91c-f1ecf60ab466'
)
// const bundler = new Bundler({
// bundlerUrl: bundlerURL,
// chainId: 10,
// entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
// })
// const paymaster = new BiconomyPaymaster({
// paymasterUrl: paymasterURL,
// })

// const smartAccount = await BiconomySmartAccountV2.create({
// chainId: 10,
// bundler,
// paymaster,
// entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
// defaultValidationModule: ownerShipModule,
// activeValidationModule: ownerShipModule
// })

const smartAccount = await createSmartAccountClient({
signer: client,
Expand All @@ -71,8 +52,6 @@ const Content: React.FC = () => {
args: [address, BigInt(tokenId), BigInt(1), '0x0'],
})

console.debug({ nftData, saAddr: await smartAccount.getAccountAddress() })

const { wait } = await smartAccount.sendTransaction({
to: '0xb77b8eDB779Cda90dBF651F8109857C97193CF9F',
data: nftData,
Expand All @@ -86,7 +65,7 @@ const Content: React.FC = () => {
} = await wait()

if(success) {
console.log(`Minted mushroom with transaction hash: ${transactionHash}`)
toast(`Minted mushroom with transaction hash: ${transactionHash}`)
} else {
console.error('Failed to mint mushroom.')
}
Expand Down

0 comments on commit 58ba442

Please sign in to comment.