Skip to content

Commit

Permalink
fix: add react-kit providers
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfolch-redeemeum committed Mar 20, 2024
1 parent 4f5cf67 commit 8d3ffab
Show file tree
Hide file tree
Showing 28 changed files with 1,220 additions and 1,126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumberish } from "ethers";
import { CtaButtonProps } from "../common/types";
import { CtaButton } from "../common/CtaButton";
import { useCoreSdkOverrides } from "../../../hooks/core-sdk/useCoreSdkOverrides";
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";

type AdditionalProps = {
exchangeId: BigNumberish;
Expand All @@ -17,29 +18,31 @@ type SuccessPayload = {
export type IDecideDisputeButton = AdditionalProps &
CtaButtonProps<SuccessPayload>;

export const DecideDisputeButton = ({
exchangeId,
buyerPercent,
variant = "primaryFill",
...restProps
}: IDecideDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
const actions = [
{
writeContractFn: () => coreSdk.decideDispute(exchangeId, buyerPercent)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];
export const DecideDisputeButton = withQueryClientProvider(
({
exchangeId,
buyerPercent,
variant = "primaryFill",
...restProps
}: IDecideDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
const actions = [
{
writeContractFn: () => coreSdk.decideDispute(exchangeId, buyerPercent)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];

return (
<CtaButton
variant={variant}
defaultLabel="Decide"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
};
return (
<CtaButton
variant={variant}
defaultLabel="Decide"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumberish } from "ethers";
import { CtaButtonProps } from "../common/types";
import { CtaButton } from "../common/CtaButton";
import { useCoreSdkOverrides } from "../../../hooks/core-sdk/useCoreSdkOverrides";
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";

type AdditionalProps = {
exchangeId: BigNumberish;
Expand All @@ -16,33 +17,35 @@ type SuccessPayload = {
export type IEscalateDisputeButton = AdditionalProps &
CtaButtonProps<SuccessPayload>;

export const EscalateDisputeButton = ({
variant = "secondaryFill",
exchangeId,
...restProps
}: IEscalateDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
export const EscalateDisputeButton = withQueryClientProvider(
({
variant = "secondaryFill",
exchangeId,
...restProps
}: IEscalateDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});

const actions = [
{
writeContractFn: () => coreSdk.escalateDispute(exchangeId),
signMetaTxFn: () =>
coreSdk.signMetaTxEscalateDispute({
exchangeId,
nonce: Date.now()
})
}
];
const actions = [
{
writeContractFn: () => coreSdk.escalateDispute(exchangeId),
signMetaTxFn: () =>
coreSdk.signMetaTxEscalateDispute({
exchangeId,
nonce: Date.now()
})
}
];

return (
<CtaButton
variant={variant}
defaultLabel="Escalate"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
};
return (
<CtaButton
variant={variant}
defaultLabel="Escalate"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumberish } from "ethers";
import { CtaButtonProps } from "../common/types";
import { CtaButton } from "../common/CtaButton";
import { useCoreSdkOverrides } from "../../../hooks/core-sdk/useCoreSdkOverrides";
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";

type AdditionalProps = {
exchangeId: BigNumberish;
Expand All @@ -16,29 +17,31 @@ type SuccessPayload = {
export type IExpireDisputeButton = AdditionalProps &
CtaButtonProps<SuccessPayload>;

export const ExpireDisputeButton = ({
variant = "secondaryFill",
exchangeId,
...restProps
}: IExpireDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
export const ExpireDisputeButton = withQueryClientProvider(
({
variant = "secondaryFill",
exchangeId,
...restProps
}: IExpireDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});

const actions = [
{
writeContractFn: () => coreSdk.expireDispute(exchangeId)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];
const actions = [
{
writeContractFn: () => coreSdk.expireDispute(exchangeId)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];

return (
<CtaButton
variant={variant}
defaultLabel="Expire Dispute"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
};
return (
<CtaButton
variant={variant}
defaultLabel="Expire Dispute"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumberish } from "ethers";
import { CtaButtonProps } from "../common/types";
import { CtaButton } from "../common/CtaButton";
import { useCoreSdkOverrides } from "../../../hooks/core-sdk/useCoreSdkOverrides";
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";

type AdditionalProps = {
exchangeId: BigNumberish;
Expand All @@ -16,28 +17,30 @@ type SuccessPayload = {
export type IExpireEscalationDisputeButton = AdditionalProps &
CtaButtonProps<SuccessPayload>;

export const ExpireEscalationDisputeButton = ({
exchangeId,
variant = "secondaryFill",
...restProps
}: IExpireEscalationDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
const actions = [
{
writeContractFn: () => coreSdk.expireEscalatedDispute(exchangeId)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];
export const ExpireEscalationDisputeButton = withQueryClientProvider(
({
exchangeId,
variant = "secondaryFill",
...restProps
}: IExpireEscalationDisputeButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
const actions = [
{
writeContractFn: () => coreSdk.expireEscalatedDispute(exchangeId)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];

return (
<CtaButton
variant={variant}
defaultLabel="Expire Escalation"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
};
return (
<CtaButton
variant={variant}
defaultLabel="Expire Escalation"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumberish } from "ethers";
import { CtaButtonProps } from "../common/types";
import { CtaButton } from "../common/CtaButton";
import { useCoreSdkOverrides } from "../../../hooks/core-sdk/useCoreSdkOverrides";
import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";

type AdditionalProps = {
exchangeId: BigNumberish;
Expand All @@ -17,31 +18,33 @@ type SuccessPayload = {
export type IExtendDisputeTimeoutButton = AdditionalProps &
CtaButtonProps<SuccessPayload>;

export const ExtendDisputeTimeoutButton = ({
variant = "primaryFill",
exchangeId,
newDisputeTimeout,
...restProps
}: IExtendDisputeTimeoutButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});
export const ExtendDisputeTimeoutButton = withQueryClientProvider(
({
variant = "primaryFill",
exchangeId,
newDisputeTimeout,
...restProps
}: IExtendDisputeTimeoutButton) => {
const coreSdk = useCoreSdkOverrides({
coreSdkConfig: restProps.coreSdkConfig
});

const actions = [
{
writeContractFn: () =>
coreSdk.extendDisputeTimeout(exchangeId, newDisputeTimeout)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];
const actions = [
{
writeContractFn: () =>
coreSdk.extendDisputeTimeout(exchangeId, newDisputeTimeout)
// TODO: ADD signMetaTxFn - has not been implemented in coreSDK yet.
}
];

return (
<CtaButton
variant={variant}
defaultLabel="Extend Time"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
};
return (
<CtaButton
variant={variant}
defaultLabel="Extend Time"
successPayload={{ exchangeId }}
actions={actions}
{...restProps}
/>
);
}
);
Loading

0 comments on commit 8d3ffab

Please sign in to comment.