Skip to content

Commit

Permalink
Update claimed status checks to compare against value 3
Browse files Browse the repository at this point in the history
  • Loading branch information
arentant committed Dec 2, 2024
1 parent 7b84ec3 commit b99544c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/Swap/AtomicChat/Actions/Redeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const RedeemAction: FC = () => {
contractAddress: destination_contract as `0x${string}`,
}) : null
if (data) setDestinationDetails(data)
if (data?.claimed) {
if (data?.claimed == 3) {
clearInterval(commitHandler)
}
}, 5000)
Expand All @@ -56,7 +56,7 @@ export const RedeemAction: FC = () => {
contractAddress: source_contract as `0x${string}`,
}) : null
if (data) setSourceDetails(data)
if (data?.claimed) {
if (data?.claimed == 3) {
clearInterval(commitHandler)
}
}, 5000)
Expand Down
6 changes: 3 additions & 3 deletions components/Swap/AtomicChat/Resolver.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export const ResolveMessages: FC = () => {

const assetsLocked = sourceDetails?.hashlock && destinationDetails?.hashlock ? true : false;

const redeemCompleted = (destinationDetails?.claimed ? true : false) || lpRedeemTransaction?.hash;
const redeemCompleted = (destinationDetails?.claimed == 3 ? true : false) || lpRedeemTransaction?.hash;
const { getWithdrawalProvider } = useWallet()
const source_provider = source_network && getWithdrawalProvider(source_network)
const wallet = source_provider?.getConnectedWallet()
Expand Down Expand Up @@ -271,7 +271,7 @@ const ResolveAction: FC = () => {
const commited = sourceDetails ? true : false;
const lpLockDetected = destinationDetails?.hashlock ? true : false;
const assetsLocked = sourceDetails?.hashlock && destinationDetails?.hashlock ? true : false;
const redeemCompleted = (destinationDetails?.claimed ? true : false) || lpRedeemTransaction?.hash;
const redeemCompleted = (destinationDetails?.claimed == 3 ? true : false) || lpRedeemTransaction?.hash;

if (error) {
return <div className="w-full flex flex-col gap-4">
Expand Down Expand Up @@ -354,7 +354,7 @@ export const ActionsWithProgressbar: FC = () => {
}
const lpRedeemTransaction = commitFromApi?.transactions.find(t => t.type === 'redeem' && t.network === destination_network?.name)

const allDone = ((sourceDetails?.hashlock && destinationDetails?.claimed) || lpRedeemTransaction?.hash) ? true : false
const allDone = ((sourceDetails?.hashlock && destinationDetails?.claimed == 3) || lpRedeemTransaction?.hash) ? true : false
const showSteps = !allDone && !isTimelockExpired
const timelock = sourceDetails?.timelock || sourceDetails?.timelock

Expand Down
2 changes: 1 addition & 1 deletion components/Swap/CommitmentsHistory/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type CommitStatus = 'committed' | 'user_locked' | 'lp_locked' | 'completed' | 'r

const commitStatusResolver = (commit: Commit, destination_details: Commit | undefined | null): CommitStatus => {

if (destination_details?.claimed || commit?.claimed) return 'completed'
if (destination_details?.claimed == 3 || commit?.claimed == 3) return 'completed'
//TODO check&implement source lock refund
else if (commit.claimed == 2) return 'refunded'
else if (commit.timelock && Number(commit.timelock) * 1000 < Date.now()) return 'timelock_expired'
Expand Down

0 comments on commit b99544c

Please sign in to comment.