@dynamic-labs/spark
package, enabling seamless integration with Spark network wallets including Magic Eden and other Bitcoin-based wallets.
Installation
First, install the Spark wallet connector package:Supported Wallets
Magic Eden
The package includes full support for Magic Eden’s Spark wallet implementation, which provides:- Connection Management - Seamless wallet connection and disconnection
- Address Retrieval - Get current wallet address
- Message Signing - Sign messages for authentication with optional Taproot support
- Bitcoin Transfers - Send Bitcoin to other Spark addresses
- Token Transfers - Transfer tokens between Spark addresses
Supported Networks
Network | Chain ID | Description | Block Explorer |
---|---|---|---|
Mainnet | 301 | Production network | mempool.space |
Note: Currently only mainnet is supported. Testnet, signet, and regtest support may be added in future versions.
Basic Integration
To use Spark wallets in your app, add the Spark wallet connectors to your Dynamic configuration:Check if a wallet is a Spark wallet
The first thing you should do is check if the wallet is a Spark wallet. You can use theisSparkWallet
helper method for that. That way, TypeScript will know which methods etc. are available to you.
Fetch the wallet address
You can get the wallet address using thewallet.address
property:
Send Bitcoin
To send Bitcoin to another Spark address, use thesendBalance
or transferBitcoin
method:
Send Tokens
To send tokens to another Spark address, use thetransferTokens
method:
Sign Messages
Spark wallets support message signing for authentication:Custom Connector Implementation
To add support for a new Spark wallet, extend theSparkWalletConnector
class:
API Reference
Core Methods
sendBalance(params)
- Send Bitcoin (alias for transferBitcoin)transferBitcoin(params)
- Send Bitcoin to a Spark addresstransferTokens(params)
- Send tokens to a Spark addresssignMessage(message)
- Sign a message for authenticationsignMessageWithTaproot(message)
- Sign a message with Taproot support
Type Definitions
SparkConnectionResult
- Result from wallet connectionSparkAddressResult
- Result from address retrievalSparkSignMessageRequest
- Message signing request optionsSparkSignatureResult
- Result from message signing