Skip to content

Commit

Permalink
Integrate new functions from zkdex smart contract
Browse files Browse the repository at this point in the history
  • Loading branch information
Peixer committed Jan 18, 2024
1 parent 5d8c643 commit 4c7facb
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions frontend/src/components/web3/zkdex-contract-interactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,40 @@ export const ZKDexContractInteractions: FC = () => {
)
}

const cancelOrder = async () => {
if (!activeAccount || !contract || !activeSigner || !api) {
toast.error('Wallet not connected. Try again…')
return
}

await contractTxWithToast(api, activeAccount.address, contract, 'cancel_order', {}, [0])
}

const cancelClaimOrder = async () => {
if (!activeAccount || !contract || !activeSigner || !api) {
toast.error('Wallet not connected. Try again…')
return
}

await contractTxWithToast(api, activeAccount.address, contract, 'cancel_claim_order', {}, [0])
}

const updateClaimOrderStatus = async () => {
if (!activeAccount || !contract || !activeSigner || !api) {
toast.error('Wallet not connected. Try again…')
return
}

await contractTxWithToast(
api,
activeAccount.address,
contract,
'update_claim_order_status',
{},
[0, 'Filled'],
)
}

if (!api) return null

return (
Expand All @@ -104,9 +138,18 @@ export const ZKDexContractInteractions: FC = () => {
<button className="w-sm rounded bg-slate-800" onClick={createOrder}>
Create Liquidity Pool
</button>
<button className="w-sm rounded bg-slate-800" onClick={cancelOrder}>
Cancel Liquidity Pool
</button>
<button className="w-sm rounded bg-slate-800" onClick={createClaimOrder}>
Claim Liquidity Pool
</button>
<button className="w-sm rounded bg-slate-800" onClick={cancelClaimOrder}>
Cancel Claim Liquidity Pool
</button>
<button className="w-sm rounded bg-slate-800" onClick={updateClaimOrderStatus}>
Update Claim Liquidity Pool
</button>

{/* Contract Address */}
<p className="text-center font-mono text-xs text-gray-600">
Expand Down

0 comments on commit 4c7facb

Please sign in to comment.