Updated library version on node js contract sample (#386)

This commit is contained in:
Chalith Desaman
2023-10-02 12:39:07 +05:30
committed by GitHub
parent f8877fd61a
commit cff3a822fc
3 changed files with 26 additions and 11 deletions

View File

@@ -57,10 +57,25 @@ const echoContract = async (ctx) => {
// NPL messages example.
// if (!ctx.readonly) {
// ctx.unl.onMessage((node, msg) => {
// console.log(msg + " from " + node.publicKey);
// })
// // Start listening to incoming NPL messages before we send ours.
// const promise = new Promise((resolve, reject) => {
// let timeout = setTimeout(() => {
// reject('NPL timeout.');
// }, 2000);
// let list = [];
// ctx.unl.onMessage((node, msg) => {
// console.log(`${node.publicKey} said ${msg} to me.`);
// list.push(msg);
// if (list.length == ctx.unl.list().length) {
// clearTimeout(timeout);
// resolve();
// }
// });
// });
// await ctx.unl.send("Hello");
// await promise;
// }
// Update patch config