ae-channel-manager
Version:
A javascript library for managing AEternity payment channels for Pay-per-API call protocol
30 lines (22 loc) • 943 B
JavaScript
const { Account } = require('../src')
const keypair = {
"publicKey" : "ak_fUq2NesPXcYZ1CcqBcGC3StpdnQw3iVxMA3YSeCNAwfN4myQk",
"secretKey" : "7c6e602a94f30e4ea7edabe4376314f69ba7eaa2f355ecedb339df847b6f0d80575f81ffb0a297b7725dc671da0b1769b1fc5cbe45385c7b5ad1fc2eaf1d609d"
}
const network = {
url: process.env.TEST_URL || 'http://localhost:3001',
internalUrl: process.env.TEST_INTERNAL_URL || 'http://localhost:3001',
channelUrl: process.env.CHANNEL_URL || 'ws://localhost:3001/channel',
compilerUrl: process.env.COMPILER_URL || '',
networkId: 'ae_devnet'
}
const test = async () => {
const accountWithOutKp = new Account()
const newkp = await accountWithOutKp.create()
console.log(newkp)
const accountWithKp = new Account(keypair, network)
const wallet = await accountWithKp.wallet()
const balance = await accountWithKp.balance(keypair.publicKey)
console.log(balance)
}
test()