Skip to content

Commit

Permalink
feat: update contract (#26)
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 13, 2024
1 parent cf8dc27 commit 7cd7cb1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default function Page() {
) : (
<WalletWrapper
className="w-[450px] max-w-full"
text="Sign in to collect"
text="Sign in to transact"
/>
)}
</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/TransactionWrapper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const renderWithProviders = (component: JSX.Element) => {
describe('TransactionWrapper', () => {
it('should renders', () => {
renderWithProviders(<TransactionWrapper address="0x" />);
const transaction = screen.getByText('Collect');
const transaction = screen.getByText('Transact');
expect(transaction).toBeInTheDocument();
});
});
33 changes: 7 additions & 26 deletions src/components/TransactionWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ import type {
TransactionResponse,
} from '@coinbase/onchainkit/transaction';
import type { Address, ContractFunctionParameters } from 'viem';
import { parseEther } from 'viem';
import {
BASE_SEPOLIA_CHAIN_ID,
collectionAddress,
comment,
mintABI,
mintContractAddress,
mintReferral,
quantity,
tokenId,
clickContractABI,
clickContractAddress,
} from '../constants';

type TransactionWrapperParams = {
Expand All @@ -30,22 +24,12 @@ type TransactionWrapperParams = {
export default function TransactionWrapper({
address,
}: TransactionWrapperParams) {
const mintTo = address;

const contracts = [
{
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 unknown as ContractFunctionParameters[];

Expand All @@ -67,10 +51,7 @@ export default function TransactionWrapper({
onError={handleError}
onSuccess={handleSuccess}
>
<TransactionButton
className="mt-0 mr-auto ml-auto w-[450px] max-w-full text-[white]"
text="Collect"
/>
<TransactionButton className="mt-0 mr-auto ml-auto w-[450px] max-w-full text-[white]" />
<TransactionStatus>
<TransactionStatusLabel />
<TransactionStatusAction />
Expand Down
13 changes: 13 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
export const BASE_SEPOLIA_CHAIN_ID = 84532;

export const clickContractAddress =
'0x67c97D1FB8184F038592b2109F854dfb09C77C75';

export const clickContractABI = [
{
type: 'function',
name: 'click',
inputs: [],
outputs: [],
stateMutability: 'nonpayable',
},
] as const;

export const collectionAddress = '0xd6915560d3bb24aec04dc42ef409921ed1931510';
export const comment = 'testing';
export const mintContractAddress = '0x777777722D078c97c6ad07d9f36801e653E356Ae';
Expand Down

0 comments on commit 7cd7cb1

Please sign in to comment.