Skip to content

Commit bc1b359

Browse files
committed
fix(web): update hooks to wagmi v2
1 parent baf6878 commit bc1b359

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/AcceptSettlementButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ const AcceptButton: React.FC = () => {
1616
const { id } = useTransactionDetailsContext();
1717
const refetchQuery = useQueryRefetch();
1818

19-
const { config: acceptSettlementConfig } = useSimulateEscrowUniversalAcceptSettlement({
19+
const { data: acceptSettlementConfig } = useSimulateEscrowUniversalAcceptSettlement({
2020
args: [BigInt(id)],
2121
});
2222

23-
const { writeAsync: acceptSettlement } = useWriteEscrowUniversalAcceptSettlement(acceptSettlementConfig);
23+
const { writeContractAsync: acceptSettlement } = useWriteEscrowUniversalAcceptSettlement(acceptSettlementConfig);
2424

2525
const handleAcceptSettlement = () => {
2626
if (!isUndefined(acceptSettlement)) {
2727
setIsSending(true);
28-
wrapWithToast(async () => await acceptSettlement().then((response) => response.hash), publicClient)
28+
wrapWithToast(async () => await acceptSettlement(acceptSettlementConfig.request), publicClient)
2929
.then((wrapResult) => {
3030
if (!wrapResult.status) {
3131
setIsSending(false);

web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/ExecuteTransactionButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ const ExecuteTransactionButton: React.FC = () => {
1616
const { id } = useTransactionDetailsContext();
1717
const refetchQuery = useQueryRefetch();
1818

19-
const { config: executeTransactionConfig } = useSimulateEscrowUniversalExecuteTransaction({
19+
const { data: executeTransactionConfig } = useSimulateEscrowUniversalExecuteTransaction({
2020
args: [BigInt(id)],
2121
});
2222

23-
const { writeAsync: executeTransaction } = useWriteEscrowUniversalExecuteTransaction(executeTransactionConfig);
23+
const { writeContractAsync: executeTransaction } = useWriteEscrowUniversalExecuteTransaction(executeTransactionConfig);
2424

2525
const handleExecuteTransaction = () => {
2626
if (!isUndefined(executeTransaction)) {
2727
setIsSending(true);
28-
wrapWithToast(async () => await executeTransaction().then((response) => response.hash), publicClient)
28+
wrapWithToast(async () => await executeTransaction(executeTransactionConfig.request), publicClient)
2929
.then((wrapResult) => {
3030
if (wrapResult.status) {
3131
refetchQuery([["refetchOnBlock", "useTransactionDetailsQuery"]]);

web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/ProposeSettlementButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ const ProposeSettlementButton: React.FC<IProposeSettlementButton> = ({
2929
const { id } = useTransactionDetailsContext();
3030
const refetchQuery = useQueryRefetch();
3131

32-
const { config: proposeSettlementConfig } = useSimulateEscrowUniversalProposeSettlement({
32+
const { data: proposeSettlementConfig } = useSimulateEscrowUniversalProposeSettlement({
3333
args: [BigInt(id), parseEther(amountProposed)],
3434
});
3535

36-
const { writeAsync: proposeSettlement } = useWriteEscrowUniversalProposeSettlement(proposeSettlementConfig);
36+
const { writeContractAsync: proposeSettlement } = useWriteEscrowUniversalProposeSettlement(proposeSettlementConfig);
3737

3838
const handleProposeSettlement = () => {
3939
if (!isUndefined(proposeSettlement)) {
4040
setIsSending(true);
41-
wrapWithToast(async () => await proposeSettlement().then((response) => response.hash), publicClient)
41+
wrapWithToast(async () => await proposeSettlement(proposeSettlementConfig.request), publicClient)
4242
.then((wrapResult) => {
4343
if (wrapResult.status) {
4444
toggleModal && toggleModal();

web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/RaiseDisputeButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ const RaiseDisputeButton: React.FC<IRaiseDisputeButton> = ({ toggleModal, button
2626
const isBuyer = useMemo(() => address?.toLowerCase() === buyer?.toLowerCase(), [address, buyer]);
2727
const refetchQuery = useQueryRefetch();
2828

29-
const { config: payArbitrationFeeByBuyerConfig } = useSimulateEscrowUniversalPayArbitrationFeeByBuyer({
29+
const { data: payArbitrationFeeByBuyerConfig } = useSimulateEscrowUniversalPayArbitrationFeeByBuyer({
3030
args: [BigInt(id)],
3131
value: arbitrationCost,
3232
});
3333

34-
const { config: payArbitrationFeeBySellerConfig } = useSimulateEscrowUniversalPayArbitrationFeeBySeller({
34+
const { data: payArbitrationFeeBySellerConfig } = useSimulateEscrowUniversalPayArbitrationFeeBySeller({
3535
args: [BigInt(id)],
3636
value: arbitrationCost,
3737
});
3838

39-
const { writeAsync: payArbitrationFeeByBuyer } =
39+
const { writeContractAsync: payArbitrationFeeByBuyer } =
4040
useWriteEscrowUniversalPayArbitrationFeeByBuyer(payArbitrationFeeByBuyerConfig);
41-
const { writeAsync: payArbitrationFeeBySeller } = useWriteEscrowUniversalPayArbitrationFeeBySeller(
41+
const { writeContractAsync: payArbitrationFeeBySeller } = useWriteEscrowUniversalPayArbitrationFeeBySeller(
4242
payArbitrationFeeBySellerConfig
4343
);
4444

4545
const handleRaiseDispute = () => {
4646
if (isBuyer && !isUndefined(payArbitrationFeeByBuyer)) {
4747
setIsSending(true);
48-
wrapWithToast(async () => await payArbitrationFeeByBuyer().then((response) => response.hash), publicClient)
48+
wrapWithToast(async () => await payArbitrationFeeByBuyer(payArbitrationFeeByBuyerConfig.request), publicClient)
4949
.then((wrapResult) => {
5050
if (wrapResult.status) {
5151
toggleModal && toggleModal();
@@ -60,7 +60,7 @@ const RaiseDisputeButton: React.FC<IRaiseDisputeButton> = ({ toggleModal, button
6060
});
6161
} else if (!isBuyer && !isUndefined(payArbitrationFeeBySeller)) {
6262
setIsSending(true);
63-
wrapWithToast(async () => await payArbitrationFeeBySeller().then((response) => response.hash), publicClient)
63+
wrapWithToast(async () => await payArbitrationFeeBySeller(payArbitrationFeeBySellerConfig.request), publicClient)
6464
.then((wrapResult) => {
6565
if (wrapResult.status) {
6666
toggleModal && toggleModal();

web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/TimeOutButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ const TimeOutButton: React.FC = () => {
2020
const isBuyer = useMemo(() => address?.toLowerCase() === buyer?.toLowerCase(), [address, buyer]);
2121
const refetchQuery = useQueryRefetch();
2222

23-
const { config: timeOutByBuyerConfig } = useSimulateEscrowUniversalTimeOutByBuyer({
23+
const { data: timeOutByBuyerConfig } = useSimulateEscrowUniversalTimeOutByBuyer({
2424
args: [BigInt(id)],
2525
});
2626

27-
const { config: timeOutBySellerConfig } = useSimulateEscrowUniversalTimeOutBySeller({
27+
const { data: timeOutBySellerConfig } = useSimulateEscrowUniversalTimeOutBySeller({
2828
args: [BigInt(id)],
2929
});
3030

31-
const { writeAsync: timeOutByBuyer } = useWriteEscrowUniversalTimeOutByBuyer(timeOutByBuyerConfig);
32-
const { writeAsync: timeOutBySeller } = useWriteEscrowUniversalTimeOutBySeller(timeOutBySellerConfig);
31+
const { writeContractAsync: timeOutByBuyer } = useWriteEscrowUniversalTimeOutByBuyer(timeOutByBuyerConfig);
32+
const { writeContractAsync: timeOutBySeller } = useWriteEscrowUniversalTimeOutBySeller(timeOutBySellerConfig);
3333

3434
const handleTimeout = () => {
3535
if (isBuyer && !isUndefined(timeOutByBuyer)) {
3636
setIsSending(true);
37-
wrapWithToast(async () => await timeOutByBuyer().then((response) => response.hash), publicClient)
37+
wrapWithToast(async () => await timeOutByBuyer(timeOutByBuyerConfig.request), publicClient)
3838
.then((wrapResult) => {
3939
if (!wrapResult.status) {
4040
setIsSending(false);
@@ -47,7 +47,7 @@ const TimeOutButton: React.FC = () => {
4747
});
4848
} else if (!isBuyer && !isUndefined(timeOutBySeller)) {
4949
setIsSending(true);
50-
wrapWithToast(async () => await timeOutBySeller().then((response) => response.hash), publicClient)
50+
wrapWithToast(async () => await timeOutBySeller(timeOutBySellerConfig.request), publicClient)
5151
.then((wrapResult) => {
5252
if (!wrapResult.status) {
5353
setIsSending(false);

web/src/pages/MyTransactions/TransactionDetails/WasItFulfilled/Buttons/ClaimFullPaymentButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ const ClaimFullPaymentButton: React.FC = () => {
1717
const publicClient = usePublicClient();
1818
const { id } = useTransactionDetailsContext();
1919

20-
const { config: executeTransactionConfig } = useSimulateEscrowUniversalExecuteTransaction({
20+
const { data: executeTransactionConfig } = useSimulateEscrowUniversalExecuteTransaction({
2121
args: [id],
2222
});
2323

24-
const { writeAsync: executeTransaction } = useWriteEscrowUniversalExecuteTransaction(executeTransactionConfig);
24+
const { writeContractAsync: executeTransaction } = useWriteEscrowUniversalExecuteTransaction(executeTransactionConfig);
2525

2626
const handleExecuteTransaction = () => {
2727
if (!isUndefined(executeTransaction)) {
2828
setIsSending(true);
29-
wrapWithToast(async () => await executeTransaction().then((response) => response.hash), publicClient)
29+
wrapWithToast(async () => await executeTransaction(executeTransactionConfig.request), publicClient)
3030
.then((wrapResult) => {
3131
if (wrapResult.status) {
3232
toggleModal();

web/src/pages/MyTransactions/TransactionDetails/WasItFulfilled/Buttons/ReleasePaymentButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ const ReleasePaymentButton: React.FC = () => {
1616
const { id, amount } = useTransactionDetailsContext();
1717
const refetchQuery = useQueryRefetch();
1818

19-
const { config: releaseFullPaymentConfig } = useSimulateEscrowUniversalPay({
19+
const { data: releaseFullPaymentConfig } = useSimulateEscrowUniversalPay({
2020
args: [id, amount],
2121
});
2222

23-
const { writeAsync: releaseFullPayment } = useWriteEscrowUniversalPay(releaseFullPaymentConfig);
23+
const { writeContractAsync: releaseFullPayment } = useWriteEscrowUniversalPay(releaseFullPaymentConfig);
2424

2525
const handleReleasePayment = () => {
2626
if (!isUndefined(releaseFullPayment)) {
2727
setIsSending(true);
28-
wrapWithToast(async () => await releaseFullPayment().then((response) => response.hash), publicClient)
28+
wrapWithToast(async () => await releaseFullPayment(releaseFullPaymentConfig.request), publicClient)
2929
.then((wrapResult) => {
3030
if (wrapResult.status) {
3131
toggleModal();

0 commit comments

Comments
 (0)