0.4.0 • Published 2 years ago
@koralabs/cardano-wallets v0.4.0
Cardano Wallets
Library for connecting cardano dApps to wallet browser extensions using CIP-30.
Installation
Using npm:
npm install @koralabs/cardano-wallets
Usage:
Connecting to a wallet
import CardanoWallets from '@koralabs/cardano-wallets';
const walletKey = 'nami';
await CardanoWallets.connect(walletKey);
// Verify wallet's network is mainnet
const isMainnet = await CardanoWallets.isMainnet();
if (!isMainnet) {
throw new Error('Wallet must be in Mainnet');
}
// verify wallet balance
const minimumBalanceNeeded = 100;
await CardanoWallets.verifyBalance(minimumBalanceNeeded);
Getting policy assets
import CardanoWallets from '@koralabs/cardano-wallets';
const walletKey = 'nami';
await CardanoWallets.connect(walletKey);
const utxos = await CardanoWallets.getUtxos();
const builtUtxos = CardanoWallets.buildUtxos(utxos);
const policyId = "some_policy_id";
const assets = builtUtxos.reduce<{
name: string;
hex: string;
policyId: string;
}[]>((agg, utxo) => {
const { assets } = utxo;
for (let i = 0; i < assets.length; i++) {
const asset = assets[i];
if (asset.policyId === policyId) {
agg.push(asset);
}
}
return agg;
}, []);
0.4.0
2 years ago
0.3.0
2 years ago
0.2.13
3 years ago
0.2.12
3 years ago
1.0.2
3 years ago
0.2.11
3 years ago
0.2.10
3 years ago
0.2.7
3 years ago
0.2.6
3 years ago
0.2.9
3 years ago
0.2.8
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
0.2.5
3 years ago
0.2.4
3 years ago
0.2.3
3 years ago
0.2.2
3 years ago
0.2.1
3 years ago
0.1.6
3 years ago
0.1.5
3 years ago
0.1.4
3 years ago
0.1.3
3 years ago
0.1.2
3 years ago
0.1.1
3 years ago
0.1.0
3 years ago