733ecd2681
Add root Cargo workspace with 9 crates: salvium-crypto (extended), salvium-types, salvium-consensus, salvium-wallet, salvium-tx, salvium-rpc, salvium-miner (extended), salvium-cli, salvium-multisig. New modules: chain_state, block_weight, alt_chain, validation, offline signing, stake lifecycle, wallet sync/query/encryption/utxo, randomx utilities, and full multisig crate with CARROT support. Delete 188 JS test/helper/debug files; archive integration test scripts to test/legacy-js/ for live testnet use. Testnet integration tests (transfer, stake, burn, convert, sweep) remain as #[ignore]- gated Rust tests runnable with --ignored against a live daemon.
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
#!/usr/bin/env bun
|
|
/**
|
|
* Decode our CARROT address and verify the encoded keys match the wallet.
|
|
*/
|
|
import { readFileSync } from 'fs';
|
|
import { parseAddress } from '../src/address.js';
|
|
import { setCryptoBackend } from '../src/crypto/index.js';
|
|
|
|
await setCryptoBackend('wasm');
|
|
|
|
const w = JSON.parse(readFileSync(`${process.env.HOME}/testnet-wallet/wallet-a.json`, 'utf-8'));
|
|
|
|
console.log('CARROT address:', w.carrotAddress);
|
|
|
|
try {
|
|
const decoded = parseAddress(w.carrotAddress);
|
|
console.log('\nDecoded address:');
|
|
console.log(JSON.stringify(decoded, null, 2));
|
|
|
|
// Check if keys match
|
|
if (decoded.spendPublicKey) {
|
|
console.log(`\nspendPublicKey from address: ${decoded.spendPublicKey}`);
|
|
console.log(`accountSpendPubkey wallet: ${w.carrotKeys.accountSpendPubkey}`);
|
|
console.log(`Match: ${decoded.spendPublicKey === w.carrotKeys.accountSpendPubkey}`);
|
|
}
|
|
if (decoded.viewPublicKey) {
|
|
console.log(`\nviewPublicKey from address: ${decoded.viewPublicKey}`);
|
|
console.log(`primaryAddressViewPub wallet: ${w.carrotKeys.primaryAddressViewPubkey}`);
|
|
console.log(`Match: ${decoded.viewPublicKey === w.carrotKeys.primaryAddressViewPubkey}`);
|
|
}
|
|
} catch (e) {
|
|
console.log('Error decoding:', e.message);
|
|
}
|
|
|
|
// Also check the CN address
|
|
console.log('\n\nCN address:', w.address);
|
|
try {
|
|
const decoded = parseAddress(w.address);
|
|
console.log('Decoded CN address:');
|
|
console.log(`spendPublicKey: ${decoded.spendPublicKey}`);
|
|
console.log(`viewPublicKey: ${decoded.viewPublicKey}`);
|
|
console.log(`spendKey match: ${decoded.spendPublicKey === w.spendPublicKey}`);
|
|
console.log(`viewKey match: ${decoded.viewPublicKey === w.viewPublicKey}`);
|
|
} catch (e) {
|
|
console.log('Error decoding:', e.message);
|
|
}
|