File tree Expand file tree Collapse file tree 5 files changed +11
-9
lines changed
snaps-controllers/src/snaps
snaps-sdk/src/types/handlers Expand file tree Collapse file tree 5 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 7
7
"url" : " https://github.com/MetaMask/snaps.git"
8
8
},
9
9
"source" : {
10
- "shasum" : " GI7+exBM57/V+zc9afQYloOJkf31QC4QQ4J/FCjTkp0 =" ,
10
+ "shasum" : " h2/tYCy6l8S2zP9EdqxHKc0WSftxxnkP60i8d58vbno =" ,
11
11
"location" : {
12
12
"npm" : {
13
13
"filePath" : " dist/bundle.js" ,
Original file line number Diff line number Diff line change 7
7
"url" : " https://github.com/MetaMask/snaps.git"
8
8
},
9
9
"source" : {
10
- "shasum" : " kVPM+Ft1gxNWF59oCgW0MRN1DuA7kVyXwIdMbGec3aI =" ,
10
+ "shasum" : " 5mzSECxLy9lFHEwzmvRpjs0xL2TG0kTR2QXIjjavRTo =" ,
11
11
"location" : {
12
12
"npm" : {
13
13
"filePath" : " dist/bundle.js" ,
Original file line number Diff line number Diff line change @@ -3689,7 +3689,7 @@ export class SnapController extends BaseController<
3689
3689
const { assets : requestedAssets } = requestedParams ;
3690
3690
3691
3691
const filteredAssets = Object . keys ( assets ) . reduce <
3692
- Record < CaipAssetType , FungibleAssetMetadata >
3692
+ Record < CaipAssetType , FungibleAssetMetadata | null >
3693
3693
> ( ( accumulator , assetType ) => {
3694
3694
const castAssetType = assetType as CaipAssetType ;
3695
3695
const isValid =
Original file line number Diff line number Diff line change 5
5
string ,
6
6
optional ,
7
7
record ,
8
+ nullable ,
8
9
} from '@metamask/superstruct' ;
9
10
import { CaipAssetTypeStruct , type CaipAssetType } from '@metamask/utils' ;
10
11
@@ -17,7 +18,7 @@ export const AssetConversionStruct = object({
17
18
export const OnAssetsConversionResponseStruct = object ( {
18
19
conversionRates : record (
19
20
CaipAssetTypeStruct ,
20
- record ( CaipAssetTypeStruct , AssetConversionStruct ) ,
21
+ record ( CaipAssetTypeStruct , nullable ( AssetConversionStruct ) ) ,
21
22
) ,
22
23
} ) ;
23
24
@@ -40,11 +41,11 @@ export type OnAssetsConversionHandler = (
40
41
/**
41
42
* The response from the conversion query, containing rates about each requested asset pair.
42
43
*
43
- * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate between the two keys.
44
+ * @property conversionRates - A nested object with two CAIP-19 keys that contains a conversion rate or null between the two keys.
44
45
*/
45
46
export type OnAssetsConversionResponse = {
46
47
conversionRates : Record <
47
48
CaipAssetType ,
48
- Record < CaipAssetType , AssetConversion >
49
+ Record < CaipAssetType , AssetConversion | null >
49
50
> ;
50
51
} ;
Original file line number Diff line number Diff line change 8
8
refine ,
9
9
string ,
10
10
record ,
11
+ nullable ,
11
12
} from '@metamask/superstruct' ;
12
13
import {
13
14
assert ,
@@ -46,7 +47,7 @@ export const FungibleAssetMetadataStruct = object({
46
47
} ) ;
47
48
48
49
export const OnAssetsLookupResponseStruct = object ( {
49
- assets : record ( CaipAssetTypeStruct , FungibleAssetMetadataStruct ) ,
50
+ assets : record ( CaipAssetTypeStruct , nullable ( FungibleAssetMetadataStruct ) ) ,
50
51
} ) ;
51
52
52
53
export type FungibleAssetMetadata = Infer < typeof FungibleAssetMetadataStruct > ;
@@ -68,8 +69,8 @@ export type OnAssetsLookupHandler = (
68
69
/**
69
70
* The response from the query, containing metadata about each requested asset.
70
71
*
71
- * @property assets - An object containing a mapping between the CAIP-19 key and a metadata object.
72
+ * @property assets - An object containing a mapping between the CAIP-19 key and a metadata object or null .
72
73
*/
73
74
export type OnAssetsLookupResponse = {
74
- assets : Record < CaipAssetType , FungibleAssetMetadata > ;
75
+ assets : Record < CaipAssetType , FungibleAssetMetadata | null > ;
75
76
} ;
You can’t perform that action at this time.
0 commit comments