diff --git a/bun.lockb b/bun.lockb index 167ed4e..1114b15 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 86657d3..9047cdf 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/TransactionWrapper.tsx b/src/components/TransactionWrapper.tsx index be85cdc..61e0d4b 100644 --- a/src/components/TransactionWrapper.tsx +++ b/src/components/TransactionWrapper.tsx @@ -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; @@ -16,20 +30,32 @@ 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 (
@@ -37,6 +63,9 @@ export default function TransactionWrapper({ address={address} contracts={contracts} className="w-[450px]" + chainId={BASE_SEPOLIA_CHAIN_ID} + onError={handleError} + onSuccess={handleSuccess} >