Skip to content

SolDapper/mcswap-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcswap-connector

Solana Wallet Connection Module

This module currently supports Solana wallet connections for Phantom, Solflare, and Backpack wallets.

mcswap connector

powered by solana

install

npm i mcswap-connector

without emitter

import mcswapConnector from "mcswap-connector";
new mcswapConnector(["phantom","solflare","backpack"]).init();

provider

You can access the connected wallet provider object like so:

const provider = window.mcswap;

with emitter

Make sure you've installed the "events" npm module in your app.

npm i events
import EventEmitter from 'events';
const emitter = new EventEmitter();
emitter.on('mcswap_connected',async()=>{
  // do things after connection
});
emitter.on('mcswap_disconnected',async()=>{
  // do things after disconnection
});
import mcswapConnector from "mcswap-connector";
new mcswapConnector(["phantom","solflare","backpack"],emitter).init();

buttons

Add mcswap classes to your buttons

Disconnect buttons will be hidden by default

<button class="mcswap_connect_button">Connect</button>
<button class="mcswap_disconnect_button">Disconnect</button>

style

Style the hilight color of your connector

import "mcswap-connector/src/colors/blue-connector.css";
import "mcswap-connector/src/colors/green-connector.css";
import "mcswap-connector/src/colors/orange-connector.css";
import "mcswap-connector/src/colors/pink-connector.css";
import "mcswap-connector/src/colors/purple-connector.css";
import "mcswap-connector/src/colors/red-connector.css";
import "mcswap-connector/src/colors/yellow-connector.css";

About

Solana Wallet Connection Module

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages