Skip to content

Commit fb64058

Browse files
Update packages/request-client.js/src/api/request.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent fd2a103 commit fb64058

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/request-client.js/src/api/request.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ export default class Request {
244244

245245
// Generate allowance revocation calldata if payer is canceling a recurring payment
246246
let allowanceRevocationCalldata: string | undefined;
247-
if (options?.isRecurringPayment && options?.isPayerCancel && options?.recurringPaymentInfo) {
247+
if (options?.isRecurringPayment && options?.isPayerCancel) {
248+
if (!options.recurringPaymentInfo) {
249+
throw new Error(
250+
'recurringPaymentInfo is required when the payer cancels a recurring payment',
251+
);
252+
}
248253
const proxyAddress = getRecurringPaymentProxyAddress(options.recurringPaymentInfo.network);
249254
const erc20Interface = ERC20__factory.createInterface();
250255
allowanceRevocationCalldata = erc20Interface.encodeFunctionData('approve', [

0 commit comments

Comments
 (0)