Skip to content

Commit

Permalink
chore: updated zora contract (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Alissa Crane <[email protected]>
  • Loading branch information
abcrane123 and alissacrane-cb authored Aug 8, 2024
1 parent ce10c56 commit 813287f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 21 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@coinbase/onchainkit": "^0.28.3",
"@coinbase/onchainkit": "^0.28.6",
"next": "^14.2.5",
"permissionless": "^0.1.26",
"react": "^18",
Expand Down
53 changes: 41 additions & 12 deletions src/components/TransactionWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,22 @@ import {
TransactionStatusAction,
TransactionStatusLabel,
} from '@coinbase/onchainkit/transaction';
import { clickContractAbi, clickContractAddress } from 'src/constants';
import type {
TransactionError,
TransactionResponse,
} from '@coinbase/onchainkit/transaction';
import {
BASE_SEPOLIA_CHAIN_ID,
collectionAddress,
comment,
mintABI,
mintContractAddress,
mintReferral,
quantity,
tokenId,
} from 'src/constants';
import type { Address, ContractFunctionParameters } from 'viem';
import { parseEther } from 'viem';

type TransactionWrapperParams = {
address: Address;
Expand All @@ -16,27 +30,42 @@ type TransactionWrapperParams = {
export default function TransactionWrapper({
address,
}: TransactionWrapperParams) {
const mintTo = 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: TransactionResponse) => {
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] max-w-full text-[white]"
Expand Down
29 changes: 21 additions & 8 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
export const clickContractAddress =
'0x67c97D1FB8184F038592b2109F854dfb09C77C75';
export const clickContractAbi = [
export const BASE_SEPOLIA_CHAIN_ID = 84532;

export const collectionAddress = '0xd6915560d3bb24aec04dc42ef409921ed1931510';
export const comment = 'testing';
export const mintContractAddress = '0x777777722D078c97c6ad07d9f36801e653E356Ae';
export const mintABI = [
{
type: 'function',
name: 'click',
inputs: [],
inputs: [
{ internalType: 'address', name: 'mintTo', type: 'address' },
{ internalType: 'uint256', name: 'quantity', type: 'uint256' },
{ internalType: 'address', name: 'collection', type: 'address' },
{ internalType: 'uint256', name: 'tokenId', type: 'uint256' },
{ internalType: 'address', name: 'mintReferral', type: 'address' },
{ internalType: 'string', name: 'comment', type: 'string' },
],
name: 'mint',
outputs: [],
stateMutability: 'nonpayable',
stateMutability: 'payable',
type: 'function',
},
];
] as const;
export const mintReferral = '0x0000000000000000000000000000000000000000';
export const quantity = '1';
export const tokenId = '1';

0 comments on commit 813287f

Please sign in to comment.