@metamask/snaps-sdk
Version:
A library containing the core functionality for building MetaMask Snaps
87 lines • 3.48 kB
text/typescript
import type { Infer } from "@metamask/superstruct";
import { type CaipAssetType } from "@metamask/utils";
export declare const FungibleAssetUnitStruct: import("@metamask/superstruct").Struct<{
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}, {
name: import("@metamask/superstruct").Struct<string | undefined, null>;
symbol: import("@metamask/superstruct").Struct<string | undefined, null>;
decimals: import("@metamask/superstruct").Struct<number, null>;
}>;
export type FungibleAssetUnit = Infer<typeof FungibleAssetUnitStruct>;
export declare const AssetIconUrlStruct: import("@metamask/superstruct").Struct<string, null>;
export declare const FungibleAssetMetadataStruct: import("@metamask/superstruct").Struct<{
fungible: true;
iconUrl: string;
units: {
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}[];
symbol?: string | undefined;
name?: string | undefined;
}, {
name: import("@metamask/superstruct").Struct<string | undefined, null>;
symbol: import("@metamask/superstruct").Struct<string | undefined, null>;
fungible: import("@metamask/superstruct").Struct<true, true>;
iconUrl: import("@metamask/superstruct").Struct<string, null>;
units: import("@metamask/superstruct").Struct<{
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}[], import("@metamask/superstruct").Struct<{
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}, {
name: import("@metamask/superstruct").Struct<string | undefined, null>;
symbol: import("@metamask/superstruct").Struct<string | undefined, null>;
decimals: import("@metamask/superstruct").Struct<number, null>;
}>>;
}>;
export declare const OnAssetsLookupResponseStruct: import("@metamask/superstruct").Struct<{
assets: Record<`${string}:${string}/${string}:${string}`, {
fungible: true;
iconUrl: string;
units: {
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}[];
symbol?: string | undefined;
name?: string | undefined;
} | null>;
}, {
assets: import("@metamask/superstruct").Struct<Record<`${string}:${string}/${string}:${string}`, {
fungible: true;
iconUrl: string;
units: {
decimals: number;
symbol?: string | undefined;
name?: string | undefined;
}[];
symbol?: string | undefined;
name?: string | undefined;
} | null>, null>;
}>;
export type FungibleAssetMetadata = Infer<typeof FungibleAssetMetadataStruct>;
export type OnAssetsLookupArguments = {
assets: CaipAssetType[];
};
/**
* The `onAssetsLookup` handler. This is called by MetaMask when querying about specific assets on specific chains.
*
* @returns The metadata about each asset. See
* {@link OnAssetsLookupResponse}.
*/
export type OnAssetsLookupHandler = (args: OnAssetsLookupArguments) => Promise<OnAssetsLookupResponse>;
/**
* The response from the query, containing metadata about each requested asset.
*
* @property assets - An object containing a mapping between the CAIP-19 key and a metadata object or null.
*/
export type OnAssetsLookupResponse = {
assets: Record<CaipAssetType, FungibleAssetMetadata | null>;
};
//# sourceMappingURL=assets-lookup.d.mts.map