To either establish a connection or initiate an installation followed by a connection to the metamask-cosmos-snap
, execute the following code:
try {
const result = await window.ethereum.request({
method: 'wallet_requestSnaps',
params: {
'npm:@leapwallet/metamask-cosmos-snap': {},
},
});
console.log(result);
} catch (error) {
console.log(error);
}
const accountData = await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: "npm:@leapwallet/metamask-cosmos-snap",
request: {
method: 'getKey',
params: {
chainId,
},
},
},
});
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: "npm:@leapwallet/metamask-cosmos-snap",
request: {
method: 'signDirect',
params: {
chainId,
signerAddress,
signDoc,
},
},
},
});
await window.ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'local:http://localhost:8000',
request: {
method: 'suggestChain',
params: {
chainInfo: {
chainId: 'coreum-mainnet-1',
chainName: 'coreum',
bech32Config: {
bech32PrefixAccAddr: 'core',
},
bip44: {
coinType: 990,
},
feeCurrencies: [
{
coinDenom: "ucore",
coinMinimalDenom: "ucore",
coinDecimals: 6,
coinGeckoId: "coreum",
gasPriceStep: {
low: 0.0625,
average: 0.5,
high: 62.5,
},
},
],
}
},
},
},
});