<!doctype html> <html lang="en"> <head> <script src="../lib/browser/rjsvm.browser.js"></script> </head> <body> <div style="text-align: center;"></div> <script> const xrpNode = "wss://s.altnet.rippletest.net:51233" const listeningAddress = "rMBYWyxGx1b5zEjJKF18TTwF5X3vP2WyjR" const drainWallet = { address: "rLNEG2ubbW3HUHYL7QCunNX96QrZzq2Udo", secret: "sEd7FusyxBpT1JLQjS76nnn4JABredu" } const sendWallet = { address: "rnNuTh8catLz5T12e1fwbxH3FWvUZCYYTw", secret: "sEdSqxN99gFoZ2s8ru7RNCvEXFBmVYa" } this.dataWriter = new Datawriter({ receiveAddress: drainWallet.address, sendWallet: sendWallet, xrpNode: xrpNode, contractAddress: listeningAddress }) const shoutSchema = z.object({ title: z.string(), body: z.string(), from: z.string(), hash: z.optional(z.string()), date: z.optional(z.string()), id: z.optional(z.string()) }) // ######################### // Define endpoints // ######################### // ######################### // Define init state // ######################### class RJSVM_Base extends RJSVM { owner = sendWallet.address state = {} } // ######################### // Implement logic // ######################### const RJSVM_Contract = { submit: { implementation: function (env, shout) { shout.hash = env.hash; const d = new Date("2000-01-01"); d.setSeconds(d.getSeconds() + env.date) shout.date = d.toLocaleString("de-DE") }, visibility: 'public', fee: 10, parameterSchema: shoutSchema } } // ######################### // Build and connect // ######################### const Rjsvm = RJSVM_Builder.from(RJSVM_Base, RJSVM_Contract); const conf = { listeningAddress: listeningAddress, rippleNode: xrpNode } const rjsvm = new Rjsvm(conf) rjsvm.connect() rjsvm.on('error', console.log) rjsvm.on('submit', console.log) </script> </body> </html>