UNPKG

@ragsters/raggie-wallet-connector

Version:

This is a React component built by the CryptoRaggies team to enable any React website to easily connect to popular Cardano wallets. The user's choice of wallet is persisted to local storage and the wallet connector will automatically reconnect the previou

48 lines (46 loc) 1.45 kB
import { Value } from '@emurgo/cardano-serialization-lib-browser'; declare global { interface Window { cardano: { [key: string]: { enable: () => Promise<Cip30Api>; isEnabled: () => Promise<boolean>; }; }; } } type User = { walletAddress: string | undefined; allHandles: string[] | undefined; preferredHandle: string | undefined; lovelaceBalance: string | undefined; lockedLovelace: string | undefined; walletNameSpace: string | undefined; }; type Cip30Api = { getNetworkId: () => Promise<number>; getUnusedAddresses: () => Promise<string[]>; getUsedAddresses: () => Promise<string[]>; getUtxos: (amount?: any, paginate?: boolean) => Promise<string[]>; getBalance: () => Promise<string>; signTx: (txHex: string, partialSign?: boolean, complete?: boolean) => Promise<string>; submitTx: (txHex: string) => Promise<string>; }; type WalletButtonProps = { theme: 'glam' | 'default'; }; type BtnWalletProps = { theme: 'glam' | 'default'; }; /** * @param txHash Transaction hash of the UTxO * @param txId Transaction index of the UTxO * @param ttl Time at which the transaction expires for this particular UTxO, expressed in UNIX time */ type utxoState = { txHash: string; txId: number; ttl: number; amount?: Value; }; export type { User, Cip30Api, WalletButtonProps, utxoState, BtnWalletProps };