Snap Integration
Integrating your dApp with the COTI MetaMask Snap
yarn add @metamask/providersexport type InvokeKeyManagerParams = {
method: string;
params?: Record<string, unknown>;
};
export const useInvokeKeyManager = (snapId) => {
const request = useRequest();
/**
* Invoke the requested method.
*
* @param params - The invoke params.
* @param params.method - The method name.
* @param params.params - The method params.
* @returns The response.
*/
const invokeKeyManager = async ({ method, params }: InvokeKeyManagerParams) =>
request({
method: 'wallet_invokeSnap',
params: {
snapId,
request: params ? { method, params } : { method },
},
});
return invokeKeyManager;
};Last updated
Was this helpful?