Skip to content

Commit

Permalink
Merge pull request #10 from amhedcb/justinlee/fix-submit-contract-call
Browse files Browse the repository at this point in the history
[TRIVIAL] Move the tx hash check first on submitPaymentTx
  • Loading branch information
mykcryptodev authored Oct 3, 2024
2 parents 0199723 + db377a8 commit 9afc465
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/pages/api/submitPaymentTx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ export default async function handler(
return res.status(500);
}

const { message, signature, uuid, txHash } = req.body;
const { uuid, txHash } = req.body;

if (txHash) {
await appendTxHashToPayment(uuid, txHash);
return res.status(200).json({ data: { txHash } as TxHashReceivedResponse });
}

const { message, signature } = req.body;
const { from, to, value, nonce, validAfter, validBefore } = message.message;
const { chainId } = message.domain;

Expand All @@ -36,10 +43,7 @@ export default async function handler(

const provider = new ethers.providers.JsonRpcProvider(sponsoredInfo.rpc);

if (txHash) {
await appendTxHashToPayment(uuid, txHash);
return res.status(200).json({ data: { txHash } as TxHashReceivedResponse });
}


const { v, r, s } = ethers.utils.splitSignature(signature);

Expand Down

0 comments on commit 9afc465

Please sign in to comment.