Cardano Connect with Wallet Core
This repository aims to provide framework-independent helper and wrapper functions for seamless interaction between Cardano decentralized applications (dApps) and wallets (CIP 8 and CIP 30). If you are looking for React.js components please move on to this repository.
Have fun building on Cardano! 🏗🎉
🚀 Getting Started
NPM Package
npm i @cardano-foundation/cardano-connect-with-wallet-core
import { Wallet } from '@cardano-foundation/cardano-connect-with-wallet-core';
Browser Import
<script src="https://cardano-foundation.github.io/cardano-connect-with-wallet/bundle-latest/index.js"></script>
<script>
const wallet = CardanoConnectWithWalletCore.Wallet;
...
</script>
Example Usage
The Wallet
class contains static helper functions to simplify the dApp development. Please take a look into the React hook useCardano to see an example of how you can utilize Wallet
in your module-based project. Get an idea of the usage in a static html, javascript, css context from our html-based wallet button.
The Wallet Module
Wallet.addEventListener: void;
Wallet.removeEventListener: void;
Wallet.startInjectWalletListener(): void;
Wallet.stopInjectWalletListener(): void;
Wallet.connectToWallet(walletName: string, networkType: NetworkType, retries?: number, retryIntervalInMs?: number): Promise<void>;
Wallet.connect(walletName: string, network: NetworkType, onConnect?: () => void | undefined, onError?: (code: Error) => void): Promise<void>;
Wallet.disconnect(): void;
Wallet.checkEnabled(network: NetworkType): Promise<void>;
Wallet.getInstalledWalletExtensions(supportedWallets?: Array<string>): Array<string>;
Wallet.getRewardAddresses(): Promise<any>;
Wallet.signMessage(message: string, onSignMessage?: (signature: string, key: string | undefined) => void, onSignError?: (error: Error) => void, limitNetwork?: NetworkType): Promise<void>;
💪 Contributing
Please take a look at our contributing infos to familiarise yourself with our guidelines.