Skip to content

Commit 37c6cb7

Browse files
committed
Allow null in assets handlers response
1 parent 8126f3b commit 37c6cb7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/snaps-controllers/src/snaps/SnapController.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3689,7 +3689,7 @@ export class SnapController extends BaseController<
36893689
const { assets: requestedAssets } = requestedParams;
36903690

36913691
const filteredAssets = Object.keys(assets).reduce<
3692-
Record<CaipAssetType, FungibleAssetMetadata>
3692+
Record<CaipAssetType, FungibleAssetMetadata | null>
36933693
>((accumulator, assetType) => {
36943694
const castAssetType = assetType as CaipAssetType;
36953695
const isValid =

packages/snaps-sdk/src/types/handlers/assets-conversion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ export type OnAssetsConversionHandler = (
4040
/**
4141
* The response from the conversion query, containing rates about each requested asset pair.
4242
*
43-
* @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate between the two keys.
43+
* @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.
4444
*/
4545
export type OnAssetsConversionResponse = {
4646
conversionRates: Record<
4747
CaipAssetType,
48-
Record<CaipAssetType, AssetConversion>
48+
Record<CaipAssetType, AssetConversion | null>
4949
>;
5050
};

packages/snaps-sdk/src/types/handlers/assets-lookup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export type OnAssetsLookupHandler = (
6868
/**
6969
* The response from the query, containing metadata about each requested asset.
7070
*
71-
* @property assets - An object containing a mapping between the CAIP-19 key and a metadata object.
71+
* @property assets - An object containing a mapping between the CAIP-19 key and a metadata object or null.
7272
*/
7373
export type OnAssetsLookupResponse = {
74-
assets: Record<CaipAssetType, FungibleAssetMetadata>;
74+
assets: Record<CaipAssetType, FungibleAssetMetadata | null>;
7575
};

0 commit comments

Comments
 (0)