Calling smart contracts through a Snap #1168
-
Hi there, I first heard of Metamask Snap last year at EthCC and loved the concept - finally getting around to playing with it now and just wondering if there are any examples out there of how one could call a smart contract function with a Metamask Snap. I'm looking to build a test snap to try perform a swap on the Uniswap router contract every time I do a transaction with Metamask. Suggestions/resources you can point to would be greatly appreciated! From what I'm reading in the docs, the Snap could potentially interact with a dApp, which could then interact with Uniswap? Or perhaps directly from the Snap to Uniswap with the Uniswap SDK? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @Tranquil-Flow you can use the I've actually written a snap-arbitrage bot in the past. The code is now broken but the main ideas stand. We're going to have a breaking change released in the next Flask which will require an additional permission to use |
Beta Was this translation helpful? Give feedback.
Hey @Tranquil-Flow you can use the
wallet
global object as a web3 provider, and so can use Ethers.js normally.I've actually written a snap-arbitrage bot in the past. The code is now broken but the main ideas stand.
We're going to have a breaking change released in the next Flask which will require an additional permission to use
wallet
as a web3 provider, keep an eye out on Announcements.