Diving into Bitcoin
The Magic Eden wallet has native support for all things Bitcoin, Ordinals and Runes. Since there are currently not as many go-to wallet frameworks, this section will give you a step by step walkthrough on how to integrate the ME wallet into your dApp. We'll also explore creating and signing PSBTs (partially signed Bitcoin transactions).
Direct Integration
The most straightforward way to interact with the ME wallet on the Bitcoin network is via the provider that is globally available at window.magicEden.bitcoin.
This unique namespace ensures that the ME BTC provider is always available in the window. The ME BTC provider also attempts to inject at window.BitcoinProvider
, but this can occasionally clash if users have multiple Bitcoin browser wallets installed.
The Bitcoin Wallet Standard
The ME Bitcoin wallet makes use of the Bitcoin Wallet Standard, an extension of the chain agnostic Wallet Standard. This standard makes use of a set of interfaces and conventions designed to improve the user experience and developer experience of wallets and applications. You can use these libraries to connect to the ME wallet without locating the provider directly if you so choose.
Sats-Connect
The provider also extends methods from sats-connect, an easy-to-understand javascript library that allows apps to interact with Bitcoin wallets. Sats Connect enables developers to easily retrieve user wallet addresses + interact with PSBTs
Demo
You can find a code demo here that illustrates how to integrate with the ME Wallet, create viable PSBTs, and utilize core sats-connect functions.
Note:
This demo assumes use of the Bitcoin Wallet Standard. By connecting directly to the provider, you can ignore a lot of the boilerplate from the wallet standard libraries
Last updated