-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Update zora contract #12
Changes from 7 commits
eca8740
ddf41e3
8b4f7c0
ed36331
88c2bd8
933a959
49f945b
a4721f8
8af7786
ce48c96
9ca8e0d
96a2bbb
670b9b6
7aaa5ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,19 @@ import { | |
TransactionStatusAction, | ||
TransactionStatusLabel, | ||
} from '@coinbase/onchainkit/transaction'; | ||
import { clickContractAbi, clickContractAddress } from 'src/constants'; | ||
import type { TransactionError } from '@coinbase/onchainkit/transaction'; | ||
import { mintABI, mintContractAddress } from 'src/constants'; | ||
import type { Address, ContractFunctionParameters } from 'viem'; | ||
import { parseEther } from 'viem'; | ||
import { useAccount } from 'wagmi'; | ||
|
||
const BASE_SEPOLIA_CHAIN_ID = 84532; | ||
|
||
const collectionAddress = '0xd6915560d3bb24aec04dc42ef409921ed1931510'; | ||
const tokenId = '1'; | ||
const quantity = '1'; | ||
const mintReferral = '0x0000000000000000000000000000000000000000'; | ||
const comment = 'testing'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, let's use more polish constant. |
||
|
||
type TransactionWrapperParams = { | ||
address: Address; | ||
|
@@ -16,27 +27,43 @@ type TransactionWrapperParams = { | |
export default function TransactionWrapper({ | ||
address, | ||
}: TransactionWrapperParams) { | ||
const account = useAccount(); | ||
const mintTo = account.address; | ||
|
||
const contracts = [ | ||
{ | ||
address: clickContractAddress, | ||
abi: clickContractAbi, | ||
functionName: 'click', | ||
args: [], | ||
address: mintContractAddress, | ||
abi: mintABI, | ||
functionName: 'mint', | ||
args: [ | ||
mintTo, | ||
BigInt(quantity), | ||
collectionAddress, | ||
BigInt(tokenId), | ||
mintReferral, | ||
comment, | ||
], | ||
value: parseEther('0.000111'), | ||
}, | ||
{ | ||
address: clickContractAddress, | ||
abi: clickContractAbi, | ||
functionName: 'click', | ||
args: [], | ||
}, | ||
] as ContractFunctionParameters[]; | ||
] as unknown as ContractFunctionParameters[]; | ||
|
||
const handleError = (err: TransactionError) => { | ||
console.error('Transaction error:', err); | ||
}; | ||
|
||
const handleSuccess = (response: any) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we need to export There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
console.log('Transaction successful', response); | ||
}; | ||
|
||
return ( | ||
<div className="flex w-[450px]"> | ||
<Transaction | ||
address={address} | ||
contracts={contracts} | ||
className="w-[450px]" | ||
chainId={BASE_SEPOLIA_CHAIN_ID} | ||
onError={handleError} | ||
onSuccess={handleSuccess} | ||
> | ||
<TransactionButton | ||
className="mt-0 mr-auto ml-auto w-[450px] text-[white]" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's move this to constant file