Skip to content

Commit 0b19e0c

Browse files
feat: implement updatePaymentPayInTxHash on completed
1 parent de7a477 commit 0b19e0c

File tree

9 files changed

+758
-1400
lines changed

9 files changed

+758
-1400
lines changed

packages/connectkit/bundle-analysis.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/connectkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"@albedo-link/intent": "^0.13.0",
5252
"@reown/appkit": "^1.7.0",
5353
"@rollup/plugin-typescript": "^12.1.2",
54-
"@rozoai/intent-common": "0.1.5",
54+
"@rozoai/intent-common": "workspace:*",
5555
"@solana/spl-token": "^0.4.14",
5656
"@solana/wallet-adapter-base": "^0.9.27",
5757
"@solana/wallet-adapter-react": "^0.15.39",

packages/connectkit/src/components/Pages/Confirmation/index.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
getPayment,
1818
rozoSolana,
1919
rozoStellar,
20+
updatePaymentPayInTxHash,
2021
} from "@rozoai/intent-common";
2122
import { motion } from "framer-motion";
2223
import {
@@ -242,6 +243,10 @@ const Confirmation: React.FC = () => {
242243
}
243244
}, [txURL, order, done, rozoPaymentId, showProcessingPayout]);
244245

246+
/**
247+
* Sets the payment completed state.
248+
* This is called when the payment is confirmed and the transaction hash is available.
249+
*/
245250
useEffect(() => {
246251
if (done && rawPayInHash && rozoPaymentId) {
247252
// Only call once per unique payment hash to prevent duplicate state updates
@@ -256,11 +261,26 @@ const Confirmation: React.FC = () => {
256261
});
257262

258263
paymentCompletedSent.current = paymentKey;
264+
265+
// Update payment pay-in transaction hash on the server
266+
updatePaymentPayInTxHash(rozoPaymentId, rawPayInHash, "v2").catch(
267+
(error) => {
268+
context.log(
269+
"[CONFIRMATION] Failed to update payment pay-in tx hash:",
270+
error
271+
);
272+
}
273+
);
274+
259275
setPaymentCompleted(rawPayInHash, rozoPaymentId);
260276
onSuccess();
261277
}
262-
}, [done, onSuccess, paymentStateContext, rawPayInHash, rozoPaymentId]);
278+
}, [done, paymentStateContext, rawPayInHash, rozoPaymentId]);
263279

280+
/**
281+
* Sets the payout completed state.
282+
* This is called when the payout is confirmed and the transaction hash is available.
283+
*/
264284
useEffect(() => {
265285
if (done && payoutTxHash && rozoPaymentId) {
266286
// Only call once per unique payout hash to prevent duplicate state updates

packages/pay-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rozoai/intent-common",
3-
"version": "0.1.5",
3+
"version": "0.1.6-beta.1",
44
"description": "Intent Pay shared types and utilities",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/pay-common/src/api/fee.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { getChainById } from "../chain";
22
import { ApiResponse } from "./base";
3-
import { FeeType } from "./payment";
3+
import { FeeType } from "./types";
44

55
/**
66
* Fee response data type (success case)

0 commit comments

Comments
 (0)