Skip to content

Commit

Permalink
introduce minor bump
Browse files Browse the repository at this point in the history
  • Loading branch information
salieflewis committed May 18, 2023
1 parent 6389ecd commit 10867f0
Show file tree
Hide file tree
Showing 55 changed files with 408 additions and 480 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-eggs-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@public-assembly/builder-utils': minor
---

This minor bump introduces breaking changes. All componentry has been stripped from the package. The wagmi dependency has been removed, and ethers alongisde it which has been replaced by viem. There are currently no write calls exported by the package. Types have been reorganized into the files that use them.
6 changes: 3 additions & 3 deletions apps/builder-utils-sandbox/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const withTM = require('next-transpile-modules')(['@public-assembly/builder-util
const nextConfig = {
reactStrictMode: true,
// transpilePackages: ['@public-assembly/builder-utils'],
experimental: {
esmExternals: 'loose',
},
// experimental: {
// esmExternals: 'loose',
// },
}

module.exports = withTM(nextConfig)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import * as React from 'react'
import AuctionCountdown from './AuctionCountdown'
import TokenThumbnail from './TokenThumbnail'
import TokenTitle from './TokenTitle'
import { useDaoCollectionQuery, ensNameOrShorten } from '@public-assembly/builder-utils'
import {
useDaoCollectionQuery,
useEnsNameOrShorten,
} from '@public-assembly/builder-utils'
import { Hex, formatEther } from 'viem'

export interface CurrentAuctionProps extends React.HTMLProps<HTMLDivElement> {
Expand All @@ -27,7 +30,7 @@ export default function CurrentAuction({

// const bidder = useBidder(auctionState.highestBidder)

const { nftCount } = useDaoCollectionQuery({ tokenAddress: tokenAddress })
// const { nftCount } = useDaoCollectionQuery({ tokenAddress: tokenAddress })

// function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
// event.preventDefault()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from 'react'
import CurrentAuction from './CurrentAuction'
import TokenRenderer from './TokenRenderer'
import CircleArrow from './CircleArrow'
import { useTokenContext } from '../../context'
import { useTokenExplorer } from '../../hooks'
import { useTokenContext, useTokenExplorer } from '@public-assembly/builder-utils'
import { Hex } from 'viem'

export interface TokenExplorerProps extends React.HTMLProps<HTMLDivElement> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { useDaoTokenQuery, useBidder } from '../../hooks'
import { useDaoTokenQuery, useEnsNameOrShorten } from '@public-assembly/builder-utils'
import { Hex } from 'viem'

export default function TokenTitle({
Expand All @@ -14,7 +14,7 @@ export default function TokenTitle({
tokenId: tokenId,
})

const { bidder: holder } = useBidder(tokenData?.owner as Hex)
// const { ensNameOrShorten: holder } = Promise.all([ensNameOrShorten(tokenData?.owner as Hex)])

if (!tokenData) return null
return (
Expand All @@ -24,7 +24,7 @@ export default function TokenTitle({
rel="noreferrer"
className="flex flex-col leading-5">
<span className="opacity-50">Held by:</span>
<span className="hover:underline">{holder}</span>
{/* <span className="hover:underline">{holder}</span> */}
</a>
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { useDaoTokenQuery } from '../../hooks'
import { useDaoTokenQuery } from '@public-assembly/builder-utils'
import { Hex } from 'viem'

export default function TokenTitle({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { useBid } from '../../hooks'
import { useHistoricalBids } from '@public-assembly/builder-utils'

export default function TokenWinningBid({
tokenId,
Expand All @@ -8,8 +8,7 @@ export default function TokenWinningBid({
tokenAddress: `0x${string}`
tokenId: string
}) {
// @ts-ignore
const { winningBid, winningTx } = useBid({
const { winningBid, winningTx } = useHistoricalBids({
tokenId,
tokenAddress,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import ProposalStatus from './ProposalStatus'
import ProposalTitle from './ProposalTitle'
import Proposer from './Proposer'
import ProposalTimestamp from './ProposalTimestamp'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalCard({ proposal }) {
export default function ProposalCard({ proposal }: { proposal: NounsProposal }) {
return (
<div className="p-4 text-black bg-slate-300 rounded-2xl">
<div className="rounded-xl bg-gray-200 px-5 py-3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import ProposalCard from './ProposalCard'
import { useGovernorContext } from '../../context'
import { useGovernorContext } from '@public-assembly/builder-utils'

export default function ProposalCardGrid() {
const { proposals } = useGovernorContext()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalDescription({ proposal }) {
export default function ProposalDescription({ proposal }: { proposal: NounsProposal }) {
return <div dangerouslySetInnerHTML={{ __html: proposal?.description }} />
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import ProposalTimestamp from './ProposalTimestamp'
import VoteTally from './VoteTally'
import ProposalDescription from './ProposalDescription'
import ProposalVoting from './ProposalVoting'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalPage({ proposal }) {
export default function ProposalPage({ proposal }: { proposal: NounsProposal }) {
return (
<div className="p-4 text-black bg-slate-300 rounded-2xl">
<div className="rounded-xl bg-gray-200 px-5 py-3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import ProposalPage from './ProposalPage'
import { useGovernorContext } from '../../context'
import { useGovernorContext } from '@public-assembly/builder-utils'

export default function ProposalPageGrid() {
const { proposals } = useGovernorContext()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalStatus({ proposal }) {
export default function ProposalStatus({ proposal }: { proposal: NounsProposal }) {
return <div>{proposal?.status}</div>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalTimestamp({ proposal }) {
export default function ProposalTimestamp({ proposal }: { proposal: NounsProposal }) {
const dateFormat: [string, Intl.DateTimeFormatOptions] = [
'en-us',
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalTitle({ proposal }) {
export default function ProposalTitle({ proposal }: { proposal: NounsProposal }) {
return <div>{proposal?.title}</div>
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import * as React from 'react'
import { useVote } from '../../hooks'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function ProposalVoting({ proposal }) {
export default function ProposalVoting({ proposal }: { proposal: NounsProposal }) {
const [support, setSupport] = React.useState<0 | 1 | 2 | undefined>()
const [reason, setReason] = React.useState<string | undefined>()

const { castVote, castVoteWithReason } = useVote({
proposal,
support,
reason,
})
// const { castVote, castVoteWithReason } = useVote({
// proposal,
// support,
// reason,
// })

if (proposal?.status == 'ACTIVE') {
return (
Expand All @@ -32,7 +32,7 @@ export default function ProposalVoting({ proposal }) {
Abstain
</button>
</div>
<div>
{/* <div>
{reason === undefined ? (
<button disabled={support === undefined} onClick={() => castVote}>
Submit Vote
Expand All @@ -42,7 +42,7 @@ export default function ProposalVoting({ proposal }) {
Submit Vote With Reason
</button>
)}
</div>
</div> */}
</div>
<textarea
className="w-full bg-gray-200 rounded-xl px-4 py-2 mt-4"
Expand Down
22 changes: 12 additions & 10 deletions apps/builder-utils-sandbox/src/components/proposals/Proposer.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import * as React from 'react'
import { useEnsName } from 'wagmi'
import { shortenAddress } from '../../lib'
import { shortenAddress } from '@public-assembly/builder-utils'
import { Hex } from 'viem'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function Proposer({ proposal }) {
const { data: ensName } = useEnsName({
address: proposal?.proposer as Hex | undefined,
})
export default function Proposer({ proposal }: { proposal: NounsProposal }) {
// const { data: ensName } = useEnsName({
// address: proposal?.proposer as Hex | undefined,
// })

const proposer = React.useMemo(
() => (ensName ? ensName : shortenAddress(proposal?.proposer)),
[ensName, proposal?.proposer]
)
// const proposer = React.useMemo(
// () => (ensName ? ensName : shortenAddress(proposal?.proposer)),
// [ensName, proposal?.proposer]
// )

return <div>{proposer}</div>
// {proposer}
return <div></div>
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import { NounsProposal } from '@public-assembly/builder-utils'

export default function VoteTally({ proposal }) {
export default function VoteTally({ proposal }: { proposal: NounsProposal }) {
return (
<div className="flex space-x-4">
<div>For:&nbsp;{proposal?.forVotes}</div>
Expand Down
13 changes: 5 additions & 8 deletions apps/builder-utils-sandbox/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import '@/styles/globals.css'
import type { AppProps } from 'next/app'
import {
ManagerProvider,
AuctionProvider,
MetadataProvider,
GovernorProvider,
TokenProvider,
Expand All @@ -16,13 +15,11 @@ export default function App({ Component, pageProps }: AppProps) {
<WagmiConfig config={config}>
<ManagerProvider tokenAddress={process.env.NEXT_PUBLIC_TOKEN_ADDRESS as Hex}>
<GovernorProvider>
<AuctionProvider>
<TokenProvider>
<MetadataProvider>
<Component {...pageProps} />
</MetadataProvider>
</TokenProvider>
</AuctionProvider>
<TokenProvider>
<MetadataProvider>
<Component {...pageProps} />
</MetadataProvider>
</TokenProvider>
</GovernorProvider>
</ManagerProvider>
</WagmiConfig>
Expand Down
2 changes: 1 addition & 1 deletion apps/builder-utils-sandbox/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Image from 'next/image'
import {
useHistoricalBids,
useAuctionState,
useAuctionSettings,
useHistoricalBids,
} from '@public-assembly/builder-utils'
import { Hex } from 'viem'

Expand Down
7 changes: 2 additions & 5 deletions packages/builder-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"swr": "^1.3.0",
"viem": "^0.3.22",
"wagmi": "1.0.2"
"viem": "^0.3.22"
},
"devDependencies": {
"@ethersproject/contracts": "^5.7.0",
"@graphql-codegen/cli": "3.2.1",
"@graphql-codegen/client-preset": "2.1.0",
"@graphql-codegen/introspection": "3.0.1",
Expand All @@ -42,8 +40,7 @@
"react-dom": "^18.2.0",
"swr": "^1.3.0",
"typescript": "^5.0.4",
"viem": "^0.3.22",
"wagmi": "1.0.2"
"viem": "^0.3.22"
},
"scripts": {
"codegen": "graphql-codegen --config typegen.cjs"
Expand Down
8 changes: 0 additions & 8 deletions packages/builder-utils/src/constants/rpc.ts

This file was deleted.

48 changes: 0 additions & 48 deletions packages/builder-utils/src/context/AuctionProvider.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions packages/builder-utils/src/context/GovernorProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { useContext } from 'react'
import type { PropsWithChildren } from 'react'
import { useManagerContext } from './ManagerProvider'
import { useDaoProposalQuery } from '../hooks'
import type { NounsProposal } from '../types'
import { useDaoProposalQuery, NounsProposal } from '../graphql'
import { Hex } from 'viem'

export interface GovernorReturnTypes {
Expand Down
Loading

0 comments on commit 10867f0

Please sign in to comment.