Skip to content

Commit 0c44c2d

Browse files
Merge branch 'main' into release/639.0.0
2 parents e0c02ea + ccb493e commit 0c44c2d

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

packages/subscription-controller/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Changed
1111

12+
- Make `getCryptoApproveTransactionParams` synchronous ([#6930](https://github.com/MetaMask/core/pull/6930))
1213
- Bump `@metamask/base-controller` from `^8.4.1` to `^8.4.2` ([#6917](https://github.com/MetaMask/core/pull/6917))
1314

1415
## [2.0.0]

packages/subscription-controller/src/SubscriptionController.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,7 @@ describe('SubscriptionController', () => {
962962
},
963963
},
964964
async ({ controller }) => {
965-
const result = await controller.getCryptoApproveTransactionParams({
965+
const result = controller.getCryptoApproveTransactionParams({
966966
chainId: '0x1',
967967
paymentTokenAddress: '0xtoken',
968968
productType: PRODUCT_TYPES.SHIELD,
@@ -981,14 +981,14 @@ describe('SubscriptionController', () => {
981981

982982
it('throws when pricing not found', async () => {
983983
await withController(async ({ controller }) => {
984-
await expect(
984+
expect(() =>
985985
controller.getCryptoApproveTransactionParams({
986986
chainId: '0x1',
987987
paymentTokenAddress: '0xtoken',
988988
productType: PRODUCT_TYPES.SHIELD,
989989
interval: RECURRING_INTERVALS.month,
990990
}),
991-
).rejects.toThrow('Subscription pricing not found');
991+
).toThrow('Subscription pricing not found');
992992
});
993993
});
994994

@@ -1003,14 +1003,14 @@ describe('SubscriptionController', () => {
10031003
},
10041004
},
10051005
async ({ controller }) => {
1006-
await expect(
1006+
expect(() =>
10071007
controller.getCryptoApproveTransactionParams({
10081008
chainId: '0x1',
10091009
paymentTokenAddress: '0xtoken',
10101010
productType: PRODUCT_TYPES.SHIELD,
10111011
interval: RECURRING_INTERVALS.month,
10121012
}),
1013-
).rejects.toThrow('Product price not found');
1013+
).toThrow('Product price not found');
10141014
},
10151015
);
10161016
});
@@ -1040,14 +1040,14 @@ describe('SubscriptionController', () => {
10401040
},
10411041
},
10421042
async ({ controller }) => {
1043-
await expect(
1043+
expect(() =>
10441044
controller.getCryptoApproveTransactionParams({
10451045
chainId: '0x1',
10461046
paymentTokenAddress: '0xtoken',
10471047
productType: PRODUCT_TYPES.SHIELD,
10481048
interval: RECURRING_INTERVALS.month,
10491049
}),
1050-
).rejects.toThrow('Price not found');
1050+
).toThrow('Price not found');
10511051
},
10521052
);
10531053
});
@@ -1067,14 +1067,14 @@ describe('SubscriptionController', () => {
10671067
},
10681068
},
10691069
async ({ controller }) => {
1070-
await expect(
1070+
expect(() =>
10711071
controller.getCryptoApproveTransactionParams({
10721072
chainId: '0x1',
10731073
paymentTokenAddress: '0xtoken',
10741074
productType: PRODUCT_TYPES.SHIELD,
10751075
interval: RECURRING_INTERVALS.month,
10761076
}),
1077-
).rejects.toThrow('Chains payment info not found');
1077+
).toThrow('Chains payment info not found');
10781078
},
10791079
);
10801080
});
@@ -1101,14 +1101,14 @@ describe('SubscriptionController', () => {
11011101
},
11021102
},
11031103
async ({ controller }) => {
1104-
await expect(
1104+
expect(() =>
11051105
controller.getCryptoApproveTransactionParams({
11061106
chainId: '0x1',
11071107
paymentTokenAddress: '0xtoken',
11081108
productType: PRODUCT_TYPES.SHIELD,
11091109
interval: RECURRING_INTERVALS.month,
11101110
}),
1111-
).rejects.toThrow('Invalid chain id');
1111+
).toThrow('Invalid chain id');
11121112
},
11131113
);
11141114
});
@@ -1121,14 +1121,14 @@ describe('SubscriptionController', () => {
11211121
},
11221122
},
11231123
async ({ controller }) => {
1124-
await expect(
1124+
expect(() =>
11251125
controller.getCryptoApproveTransactionParams({
11261126
chainId: '0x1',
11271127
paymentTokenAddress: '0xtoken-invalid',
11281128
productType: PRODUCT_TYPES.SHIELD,
11291129
interval: RECURRING_INTERVALS.month,
11301130
}),
1131-
).rejects.toThrow('Invalid token address');
1131+
).toThrow('Invalid token address');
11321132
},
11331133
);
11341134
});
@@ -1162,14 +1162,14 @@ describe('SubscriptionController', () => {
11621162
},
11631163
},
11641164
async ({ controller }) => {
1165-
await expect(
1165+
expect(() =>
11661166
controller.getCryptoApproveTransactionParams({
11671167
chainId: '0x1',
11681168
paymentTokenAddress: '0xtoken',
11691169
productType: PRODUCT_TYPES.SHIELD,
11701170
interval: RECURRING_INTERVALS.month,
11711171
}),
1172-
).rejects.toThrow('Conversion rate not found');
1172+
).toThrow('Conversion rate not found');
11731173
},
11741174
);
11751175
});

packages/subscription-controller/src/SubscriptionController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,9 @@ export class SubscriptionController extends StaticIntervalPollingController()<
421421
* @param request.interval - The interval
422422
* @returns The crypto approve transaction params
423423
*/
424-
async getCryptoApproveTransactionParams(
424+
getCryptoApproveTransactionParams(
425425
request: GetCryptoApproveTransactionRequest,
426-
): Promise<GetCryptoApproveTransactionResponse> {
426+
): GetCryptoApproveTransactionResponse {
427427
const { pricing } = this.state;
428428
if (!pricing) {
429429
throw new Error('Subscription pricing not found');

0 commit comments

Comments
 (0)