brought to you by Harmonic Pool
This softweare exists thanks to Harmonic delegators an supporters
- delegate ADA to Harmonic Pool
- donate ADA to :
addr1qxm09exmyl04yhh67rvvmp2zauq32p8g7v60wtv03ved7t8h2y992ly7znq5q8ckurcpum0dc8kaunpkysnlnzzhw0pqd875p8
- contribute building this repository
- contribute building a greather Cardano with any repository of Harmonic Pool
run the following in your project directory
npm install https://github.com/HarmonicPool/cardano-wallet-interface
here's a list of supported wallet, if you notice a Cardano wallet that support dApp connector is missing, feel free to send a mail here
let Typhon = undefined;
const ITyphon = Wallet.getInterface( Wallet.Names.Typhon );
if(
ITyphon.isInjected() // equivalent to ```Wallet.has( Wallet.Names.Typhon )```
)
{
if(
ITyphon.isAviable() // if enabled before returns true, no need to perform async calls
)
{
Typhon = Wallet.Typhon; // Wallet.get( Wallet.Names.Typhon ) will do the same
}
}
else // async code needed
{
if(
await ITyphon.isEnabled() // @returns {Promise<boolean>} as per CIP0030 definition
)
{
Typhon = Wallet.Typhon; // same as before
}
else
{
await Wallet.enable( Wallet.Names.Typhon ); // makes the object aviable
Typhon = Wallet.Typhon; // same as before
}
}
NOTE: every other wallet will work the same way, just change the name (eg.
Nami
->CCVault
)
/*... other imports ...*/
import Wallet from "@harmonicpool/cardano-wallet-interface";
/*...*/
if( Wallet.has( Wallet.Names.Nami ) )
{
if( !await Wallet.isEnabled( Wallet.Names.Nami ) )
{
Wallet.enable( Wallet.Names.Nami )
.then(
() => {
Wallet.Nami.delegateTo(
"<your pool id>",
"<your blockforst api key>"
);
}
);
}
else
{
Wallet.Nami.delegateTo(
"<your pool id>",
"<your blockforst api key>"
);
}
}
/*...*/
have a look at documentation/examples/Wallets iteration.md to understand how to generalize the process for more wallets
check the documentation/examples folder for more
a more in depth documentation can be found in the documentation folder