UNPKG

soroban-client-nodejs

Version:
31 lines (21 loc) 773 B
# soroban-client-nodejs A Soroban RPC client for nodejs ## Usage ```js import { RPC } from '../rpc.js' const sorobanUrl = 'http://[...].onion/rpc' const proxyUrl = 'http://127.0.0.1:9150' const client = new RPC(sorobanUrl, proxyUrl) // Write 10 messages into the directory for (let i=0; i < 10; i++) { const msg = {'data': `msg${i}`} await client.directoryAdd('test', JSON.stringify(msg), 'long') } // Wait for a message received under the "test" key and delete it // Wait for message for 2s max (10*200ms) const entry = await client.waitAndRemove('test', 10) // Read all messages received under the "test" key const entries = await client.directoryList('test') // Remove first message await client.directoryRemove('test', JSON.stringify(entries[0])) ```