ProCrypt is a small, simple, and ultrafast library for managing crypto wallets, built on Web Standards for Deno.
- Unified interface for managing multi-chain wallets
- Support for both UTXO and account-based chains
- Fully typed and polymorphic architecture
- Native support for BIP-39, BIP-32, BIP-44
- Built-in testnet support for all blockchains
- Seamless handling of native and token transactions
ProCrypt exposes two main base classes and one extended type:
Handles hierarchical deterministic wallets using standard derivation paths.
Allows you to generate, validate, and derive addresses for multiple blockchains from a single mnemonic.
Abstract interface implemented by all supported blockchains.
Provides a common, unified API to interact with native coin transactions.
Used for blockchains that support token standards (like Ethereum, Solana, Tron).
Adds methods to handle token-based transactions via the TokenTransaction interface.
deno add jsr:@webtools/procryptimport { Chains, Wallet } from "jsr:@webtools/procrypt";
// Create or restore a mnemonic-based wallet
const wallet = new Wallet(); // or: new Wallet("your mnemonic");
// Derive a Bitcoin wallet at index 0
const btc = wallet.derive(Chains.Bitcoin, 0);
console.log(btc.getAddress()); // e.g. 1BoatSLRHt...
console.log(wallet.getMnemonic()); // The mnemonic phrase
// Check mnemonic validity
console.log(Wallet.isValidMnemonic(wallet.getMnemonic())); // trueimport { Chains } from "jsr:@webtools/procrypt";
// Bitcoin testnet 4 example
const btc = new Chains.BitcoinTest4("0xYourPrivateKey");
const tx = [
{ to: "0xRecipient...", amount: 0.001 },
];
const fees = await btc.estimateTransactionsFees(tx); // => [feeAmount]
const signed = await btc.signTransactions(tx); // => ["0xSignedTx"]
const hashes = await btc.sendTransactions(signed); // => ["0xTransactionHash"]import { Chains } from "jsr:@webtools/procrypt";
// Ethereum mainnet
const eth = new Chains.Ethereum("0xYourPrivateKey");
const tokenTx = [
{
to: "0xRecipient...",
amount: 50,
tokenAddress: "0xA0b86991C6218b36c1d19D4a2e9Eb0cE3606EB48", // USDC
},
];
const tokenFees = await eth.estimateTokenTransactionsFees(tokenTx); // => [feeAmount]
const tokenSigned = await eth.signTokenTransactions(tokenTx); // => ["0xSignedTx"]
const tokenHashes = await eth.sendTransactions(tokenSigned); // => ["0xTransactionHash"]interface Transaction {
to: string;
amount: number;
}interface TokenTransaction extends Transaction {
tokenAddress: string;
}class Wallet {
constructor(mnemonic?: string, complex?: boolean);
getMnemonic(): string;
derive(chain: ChainConstructor, index: number): Chain;
static isValidMnemonic(mnemonic: string): boolean;
}interface Chain {
constructor(privateKey?: string);
getPrivateKey(): string;
getAddress(): string;
estimateTransactionsFees(transactions: Transaction[]): Promise<number[]>;
signTransactions(transactions: Transaction[]): Promise<string[]>;
sendTransactions(transactions: string[]): Promise<string[]>;
}interface TokenChain extends Chain {
constructor(privateKey?: string, rpcUrl: string);
estimateTokenTransactionsFees(transactions: TokenTransaction[]): Promise<number[]>;
signTokenTransactions(transactions: TokenTransaction[]): Promise<string[]>;
}| Blockchain | Mainnet Class | Testnet Class | Tokens |
|---|---|---|---|
| Bitcoin | Chains.Bitcoin |
Chains.BitcoinTest4 |
β |
| Litecoin | Chains.Litecoin |
Chains.LitecoinTest |
β |
| Ethereum | Chains.Ethereum |
Chains.EthereumSepolia |
β |
| Binance Smart Chain | Chains.Bsc |
Chains.BscTest |
β |
| Solana | Chains.Solana |
Chains.SolanaDev |
β |
| Tron | Chains.Tron |
Chains.TronShasta |
β |
Distributed under the MIT License. See LICENSE for more information.