Skip to content

Latest commit

 

History

History
87 lines (61 loc) · 2.79 KB

README.md

File metadata and controls

87 lines (61 loc) · 2.79 KB

Cardano Test Wallet

This JavaScript library injects a simulated Cardano wallet into your web application for testing purposes.

Features

  • Provides optional configuration for the wallet, including network ID, staking options, and Kuber API details.
  • Creates a test Cardano wallet object for interacting with the Cardano testnet.

Usage

  1. Load Extension:
    Use the loadExtension function to inject the wallet extension into your web application.

    import { loadExtension } from "cardano-test-wallet";
    loadExtension("myTestWallet");
  2. Import Test Wallet:
    If you wish to import your own custom wallet, use the importTestWallet `function.

    import { importTestWallet } from "cardano-test-wallet";
    importTestWallet(CustomWallet);
  3. Add wallet config:
    Set optional configurations for the wallet using the addTestWalletConfig function.

    import { addTestWalletConfig } from "cardano-test-wallet";
    
    addTestWalletConfig({
      kuberApiUrl: "https://prepod.kuber.cardanoapi.io",
      kuberApiKey: "your-api-key",
      blockfrostApiUrl: "https://cardano-preprod.blockfrost.io/api",
      blockfrostApiKey: "your-api-key",
    });

Networks:

  • 0 ➔ Testnet
  • 1 ➔ Mainnet

Example:

import {
  loadExtension,
  addTestWalletConfig,
  importTestWallet,
} from "cardano-test-wallet";
loadExtension("MyTestWallet");

importTestWallet(CustomWallet);

addTestWalletConfig({
  kuberApiUrl: "https://prepod.kuber.cardanoapi.io",
  kuberApiKey: "your-api-key",
  blockfrostApiUrl: "https://cardano-preprod.blockfrost.io/api",
  blockfrostApiKey: "your-api-key",
});

// Access the wallet after injection
const wallet = window.cardano.MyTestWallet;
// Use wallet functionalities here

Kuber API:

This library utilizes the Kuber API, a node interface similar to Blockfrost, for interacting with the Cardano testnet blockchain. You can generate a Kuber API key here.

Blockfrost API:

This library utilizes the Blockfrost API to interact with the Cardano testnet blockchain. The Blockfrost API is used to submit transactions, especially since the Kuber API transaction submission takes longer than expected. You can generate a Blockfrost API key here.

Security Note:

Test wallets are for development and testing purposes only. Avoid using them in production environments due to security risks.

Available Kuber URLs: