example.js 889 B

12345678910111213141516171819202122232425262728293031323334
  1. const { RuntimeApi } = require('@joystream/runtime-api')
  2. const { discover, publish } = require('./')
  3. async function main() {
  4. const runtimeApi = await RuntimeApi.create({
  5. account_file: "/Users/mokhtar/Downloads/5Gn9n7SDJ7VgHqHQWYzkSA4vX6DCmS5TFWdHxikTXp9b4L32.json"
  6. })
  7. let published = await publish.publish(
  8. "5Gn9n7SDJ7VgHqHQWYzkSA4vX6DCmS5TFWdHxikTXp9b4L32",
  9. {
  10. asset: {
  11. version: 1,
  12. endpoint: 'http://endpoint.com'
  13. }
  14. },
  15. runtimeApi
  16. )
  17. console.log(published)
  18. // let serviceInfo = await discover('5Gn9n7SDJ7VgHqHQWYzkSA4vX6DCmS5TFWdHxikTXp9b4L32', { runtimeApi })
  19. let serviceInfo = await discover.discover(
  20. '5Gn9n7SDJ7VgHqHQWYzkSA4vX6DCmS5TFWdHxikTXp9b4L32',
  21. runtimeApi
  22. )
  23. console.log(serviceInfo)
  24. runtimeApi.api.disconnect()
  25. }
  26. main()