Skip to content

Commit

Permalink
feat(ui-ux): call endpoint to save tx
Browse files Browse the repository at this point in the history
  • Loading branch information
chloezxyy committed Dec 14, 2023
1 parent 9aa2fb6 commit f334087
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mobile-app/app/components/OceanInterface/OceanInterface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ export function OceanInterface(): JSX.Element | null {
return vmmap.output;
};

useEffect(() => {
const saveTx = async (txId: string) => {
// make post request to save the transaction into defichain-wallet-api db
await fetch(`http://localhost:3001/transaction/${txId}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
transaction: txId,
}),
});
};
if (tx !== undefined) {
saveTx(tx.tx.txId);
}
}, [tx]);

useEffect(() => {
// get evm tx id and url (if any)
const fetchEvmTx = async (txId: string) => {
Expand Down

0 comments on commit f334087

Please sign in to comment.