Skip to content

Commit 1490463

Browse files
fix: pay to address with eurc
1 parent 4ca8d0e commit 1490463

File tree

6 files changed

+18
-38
lines changed

6 files changed

+18
-38
lines changed

examples/nextjs-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@headlessui/react": "^2.2.0",
1515
"@rainbow-me/rainbowkit": "^2.2.8",
1616
"@rozoai/intent-common": "0.1.7",
17-
"@rozoai/intent-pay": "0.1.9",
17+
"@rozoai/intent-pay": "0.1.10",
1818
"@tanstack/react-query": "^5.51.11",
1919
"@types/react-syntax-highlighter": "^15.5.13",
2020
"@wagmi/core": "^2.22.0",

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
@@ -1,7 +1,7 @@
11
{
22
"name": "@rozoai/intent-pay",
33
"private": false,
4-
"version": "0.1.9",
4+
"version": "0.1.10",
55
"author": "RozoAI",
66
"homepage": "https://github.com/RozoAI/intent-pay",
77
"license": "BSD-2-Clause",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ export default function WaitingDepositAddress() {
299299
}
300300

301301
const details = await payWithDepositAddress(
302-
selectedDepositAddressOption.id,
302+
selectedDepositAddressOption,
303303
store as any,
304304
feeData,
305305
context.log

packages/connectkit/src/hooks/usePaymentState.ts

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import {
22
assert,
33
assertNotNull,
4-
baseUSDC,
54
bscUSDT,
65
CreateNewPaymentParams,
76
createPayment,
@@ -10,8 +9,6 @@ import {
109
DepositAddressPaymentOptionMetadata,
1110
DepositAddressPaymentOptions,
1211
ethereum,
13-
ethereumUSDC,
14-
ethereumUSDT,
1512
ExternalPaymentOptionMetadata,
1613
ExternalPaymentOptions,
1714
ExternalPaymentOptionsString,
@@ -31,11 +28,9 @@ import {
3128
RozoPayOrder,
3229
rozoSolana,
3330
rozoSolanaUSDC,
34-
rozoSolanaUSDT,
3531
rozoStellar,
3632
rozoStellarUSDC,
3733
solana,
38-
Token,
3934
WalletPaymentOption,
4035
writeRozoPayOrderID,
4136
} from "@rozoai/intent-common";
@@ -168,7 +163,7 @@ export interface PaymentState {
168163
) => Promise<{ txHash: Hex; success: boolean }>;
169164
payWithExternal: (option: ExternalPaymentOptions) => Promise<string>;
170165
payWithDepositAddress: (
171-
option: DepositAddressPaymentOptions,
166+
option: DepositAddressPaymentOptionMetadata,
172167
store: Store<PaymentState, PaymentEvent>,
173168
fees: FeeResponseData | null,
174169
log?: (message: string) => void
@@ -1069,46 +1064,31 @@ export function usePaymentState({
10691064
};
10701065

10711066
const payWithDepositAddress = async (
1072-
option: DepositAddressPaymentOptions,
1067+
option: DepositAddressPaymentOptionMetadata,
10731068
store: Store<PaymentState, PaymentEvent>,
10741069
fees: FeeResponseData | null,
10751070
log?: (message: string) => void
10761071
) => {
10771072
// Prevent duplicate calls for the same option
1078-
if (depositAddressCallRef.current.has(option)) {
1073+
if (depositAddressCallRef.current.has(option.id)) {
10791074
log?.(
10801075
`[PAY DEPOSIT ADDRESS] Already processing ${option}, skipping duplicate call`
10811076
);
10821077
return null;
10831078
}
10841079

10851080
// Mark this option as being processed
1086-
depositAddressCallRef.current.add(option);
1081+
depositAddressCallRef.current.add(option.id);
10871082
log?.(`[PAY DEPOSIT ADDRESS] Starting processing for ${option}`);
10881083

10891084
try {
1090-
let token: Token = baseUSDC;
1091-
1092-
// Map option to correct token, mimicking useDepositAddressOptions.ts
1093-
if (option === DepositAddressPaymentOptions.ETHEREUM_USDT) {
1094-
token = ethereumUSDT;
1095-
} else if (option === DepositAddressPaymentOptions.ETHEREUM_USDC) {
1096-
token = ethereumUSDC;
1097-
} else if (option === DepositAddressPaymentOptions.BASE_USDC) {
1098-
token = baseUSDC;
1099-
} else if (option === DepositAddressPaymentOptions.SOLANA_USDT) {
1100-
token = rozoSolanaUSDT;
1101-
} else if (option === DepositAddressPaymentOptions.SOLANA_USDC) {
1102-
token = rozoSolanaUSDC;
1103-
}
1104-
11051085
log?.("[PAY DEPOSIT ADDRESS] hydrating order");
11061086

11071087
const { order } = await pay.hydrateOrder(undefined, {
11081088
required: {
11091089
token: {
1110-
token: token.token,
1111-
chainId: token.chainId,
1090+
token: option.token.token,
1091+
chainId: option.token.chainId,
11121092
} as any,
11131093
} as any,
11141094
fees: {
@@ -1125,7 +1105,7 @@ export function usePaymentState({
11251105
// option,
11261106
// });
11271107

1128-
const chain = getChainById(token.chainId);
1108+
const chain = getChainById(option.token.chainId);
11291109

11301110
log?.(`[PAY DEPOSIT ADDRESS] order: ${debugJson(order)}`);
11311111

@@ -1155,7 +1135,7 @@ export function usePaymentState({
11551135
return {
11561136
address: order.intentAddr,
11571137
amount: String(order.usdValue),
1158-
suffix: `${token.symbol} ${chain.name}`,
1138+
suffix: `${option.token.symbol} ${chain.name}`,
11591139
uri: evmDeeplink,
11601140
expirationS: Math.floor(Date.now() / 1000) + 300,
11611141
externalId: order.externalId ?? "",
@@ -1171,7 +1151,7 @@ export function usePaymentState({
11711151
return null;
11721152
} finally {
11731153
// Remove from processing set when done (allow retries after completion/failure)
1174-
depositAddressCallRef.current.delete(option);
1154+
depositAddressCallRef.current.delete(option.id);
11751155
log?.(`[PAY DEPOSIT ADDRESS] Finished processing for ${option}`);
11761156
}
11771157
};

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)