OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet / deprecated / demo / hyper-wallet-full.cjs

74 lines · javascript ref:
#!/usr/bin/env bare
// Full hyper-wallet with keet-identity + WDK

require('bare-node-runtime/global')
const IdentityKey = require('keet-identity-key')
const WDK = require('@tetherto/wdk').default
const WalletManagerEvm = require('@tetherto/wdk-wallet-evm').default
const WalletManagerBtc = require('@tetherto/wdk-wallet-btc').default

async function main() {
  console.log('🔐 Hyper-Wallet - Complete Stack Test')
  console.log('')

  // Generate keet identity (24 words)
  console.log('Step 1: Generate keet identity...')
  const keetMnemonic = IdentityKey.generateMnemonic()
  const identity = await IdentityKey.from({ mnemonic: keetMnemonic })
  console.log('✅ Identity Public Key:', identity.identityKeyPair.publicKey.toString('hex').slice(0, 32) + '...')
  console.log('')

  // Generate separate WDK wallet mnemonic (12 words)
  console.log('Step 2: Generate wallet mnemonic...')
  const wdkMnemonic = WDK.getRandomSeedPhrase()
  console.log('✅ Wallet Seed:', wdkMnemonic.split(' ').slice(0, 3).join(' ') + '... (12 words)')
  console.log('')

  // Initialize WDK
  console.log('Step 3: Initialize multi-chain wallet...')
  const wdk = new WDK(wdkMnemonic)
    .registerWallet('ethereum', WalletManagerEvm, {
      provider: 'https://ethereum-sepolia-rpc.publicnode.com'
    })
    .registerWallet('bitcoin', WalletManagerBtc, {
      network: 'testnet',
      host: 'electrum.blockstream.info',
      port: 60001
    })
  console.log('✅ Wallets registered (Bitcoin + Ethereum)')
  console.log('')

  // Get addresses
  console.log('Step 4: Generate addresses...')
  const ethAccount = await wdk.getAccount('ethereum', 0)
  const btcAccount = await wdk.getAccount('bitcoin', 0)

  const ethAddress = await ethAccount.getAddress()
  const btcAddress = await btcAccount.getAddress()

  console.log('✅ ETH Address:', ethAddress)
  console.log('✅ BTC Address:', btcAddress)
  console.log('')

  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
  console.log('🎉 HYPER-WALLET COMPLETE STACK WORKS!')
  console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')
  console.log('')
  console.log('✅ keet-identity-key - Multi-device identity & sync')
  console.log('✅ Tether WDK - Multi-chain cryptocurrency wallet')  
  console.log('✅ Bare runtime v1.26.0 - P2P execution environment')
  console.log('')
  console.log('WHAT WORKS:')
  console.log('  • Generate secure identities')
  console.log('  • Multi-chain wallet (Bitcoin + Ethereum)')
  console.log('  • HD wallet derivation')
  console.log('  • Generate receiving addresses')
  console.log('')
}

main().catch(err => {
  console.error('❌ Error:', err.message)
  if (process.env.DEBUG) console.error(err.stack)
  process.exit(1)
})