This JavaScript library injects a simulated Cardano wallet into your web application for testing purposes.
- 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.
-
Load Extension:
Use theloadExtension
function to inject the wallet extension into your web application.import { loadExtension } from "cardano-test-wallet"; loadExtension("myTestWallet");
-
Import Test Wallet:
If you wish to import your own custom wallet, use theimportTestWallet
`function.import { importTestWallet } from "cardano-test-wallet"; importTestWallet(CustomWallet);
-
Add wallet config:
Set optional configurations for the wallet using theaddTestWalletConfig
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:
- Prepod: https://prepod.kuber.cardanoapi.io
- Preview: https://preview.kuber.cardanoapi.io
- Sanchonet: https://sanchonet.kuber.cardanoapi.io