Skip to content

Commit

Permalink
lint fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-reder-cb committed Aug 13, 2024
1 parent 025339f commit 02882ad
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
13 changes: 6 additions & 7 deletions src/commerce/CommercePayButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { smartWalletConfig } from "./smartWalletConfig";
import { hydrateCommerceCharge } from "../network/commerce/hydrateCommereCharge";
import { useEffect, useState } from "react";
import { getCommerceCharge } from "../network/commerce/getCommerceCharge";
import { Web3Charge } from "../network/commerce/types/Web3Charge";
import type { Web3Charge } from "../network/commerce/types/Web3Charge";
import { base } from "viem/chains";
import { getCommerceCallData } from "./utils/getCommerceCallData";

Expand Down Expand Up @@ -38,29 +38,28 @@ export function CommercePayButton({ chargeId }: CommercePayButtonProps) {
}
const interval = setInterval(() => {
if (transactionCallsId && !transactionHash) {
void checkCallsStatus();
checkCallsStatus();
}
}, 2000);
return () => {
if (interval) {
clearInterval(interval);
}
};
}, [transactionCallsId]);
}, [transactionCallsId, transactionHash]);

useEffect(() => {
async function loadCharge() {
const chargeResponse = await getCommerceCharge(
BASE_COMMERCE_URL,
chargeId
);
console.log({ chargeResponse });
setCharge(chargeResponse.data);
}
if (!charge) {
void loadCharge();
loadCharge();
}
}, [chargeId]);
}, [chargeId, charge]);

const handlePayment = async () => {
const { accounts } = await connect(smartWalletConfig, {
Expand Down Expand Up @@ -102,7 +101,7 @@ export function CommercePayButton({ chargeId }: CommercePayButtonProps) {
}
return (
<div>
<button onClick={() => handlePayment()}>Pay with Crypto</button>
<button type="button" onClick={() => handlePayment()}>Pay with Crypto</button>
</div>
);
}
2 changes: 1 addition & 1 deletion src/commerce/utils/getCommerceCallData.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { encodeFunctionData, erc20Abi, parseUnits } from "viem";
import { base } from "viem/chains";
import { Web3Charge } from "../../network/commerce/types/Web3Charge";
import type { Web3Charge } from "../../network/commerce/types/Web3Charge";
import { contractAbi } from "./TransfersContractAbi";

const USDC_DECIMALS = 6;
Expand Down
2 changes: 1 addition & 1 deletion src/network/commerce/getCommerceCharge.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FetchError } from "./FetchError";
import { Web3Charge } from "./types/Web3Charge";
import type { Web3Charge } from "./types/Web3Charge";

export async function getCommerceCharge(
baseUrl: string,
Expand Down
2 changes: 1 addition & 1 deletion src/network/commerce/hydrateCommereCharge.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FetchError } from "./FetchError";
import { Web3Charge } from "./types/Web3Charge";
import type { Web3Charge } from "./types/Web3Charge";

export async function hydrateCommerceCharge(
baseUrl: string,
Expand Down
5 changes: 0 additions & 5 deletions src/network/commerce/types/Web3Charge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ export type Web3Charge = {
web3_data: Web3ChargeWeb3Data;
};

export type Web3ChargeWeb3DataSubsidizedPaymentsChainToTokens = {
[key: string]: any;
};

export type Web3ChargeWeb3DataSettlementCurrencyAddresses = {
[key: string]: string;
};
Expand Down Expand Up @@ -88,7 +84,6 @@ export type Web3ChargeWeb3DataFailureEventsItem = {
export type Web3ChargeTimelineItemStatus =
(typeof Web3ChargeTimelineItemStatus)[keyof typeof Web3ChargeTimelineItemStatus];

// eslint-disable-next-line @typescript-eslint/no-redeclare
export const Web3ChargeTimelineItemStatus = {
COMPLETED: "COMPLETED",
EXPIRED: "EXPIRED",
Expand Down

0 comments on commit 02882ad

Please sign in to comment.