UNPKG

ae-channel-manager

Version:

A javascript library for managing AEternity payment channels for Pay-per-API call protocol

37 lines (29 loc) 993 B
const { ROLE, AeChannel } = 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 responderCh = new AeChannel( network, ROLE.RESPONDER, keypair, 'ak_2mwRmUeYmfuW93ti9HMSUJzCk1EYcQEfikVSzgo6k2VghsWhgU', keypair.publicKey, 0.005e18, 0.005e18, 0, 'localhost', 4000 ); const result = await responderCh.open(); console.log(result) } test()