1.8.0 • Published 1 year ago

cln-plugin-js v1.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Example Usage

#!/usr/bin/env node

import Plugin from "./plugin.js";
import FileLogger from "./file-logger.js";

const allNotifications = [
	`channel_opened`,
	`channel_open_failed`,
	`channel_state_changed`,
	`connect`,
	`disconnect`,
	`invoice_payment`,
	`invoice_creation`,
	`forward_event`,
	`sendpay_success`,
	`sendpay_failure`,
	`coin_movement`,
	`balance_snapshot`,
	`block_added`,
	`openchannel_peer_sigs`,
	`shutdown`
]

const plugin = new Plugin({ dynamic: true })
const logger = new FileLogger('[Example]')

plugin.addMethod("testinfo", "get info", "description", async () => {
	return await plugin.rpc.call("getinfo")
})


allNotifications.forEach(notification => {
	plugin.subscribe(notification, (params) => {
		logger.log(`Received notification: ${notification}`)
		logger.log(`Params: ${JSON.stringify(params)}`)
	})
})

plugin.start()
1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago