mirror of
https://github.com/EvernodeXRPL/hp-devkit.git
synced 2026-04-29 15:37:58 +00:00
Updated nodejs contract lib version.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
"start": "npm run build && hpdevkit deploy dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"hotpocket-nodejs-contract": "0.5.3",
|
||||
"hotpocket-nodejs-contract": "0.5.4",
|
||||
"@vercel/ncc": "0.34.0"
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ const dataFile = 'datafile.txt'
|
||||
export class _projname_ {
|
||||
sendOutput; // This function must be wired up by the caller.
|
||||
|
||||
async handleRequest(userPubKey, message, isReadOnly) {
|
||||
async handleRequest(userPublicKey, message, isReadOnly) {
|
||||
|
||||
// This sample application defines two simple messages. 'get' and 'set'.
|
||||
// It's up to the application to decide the structure and contents of messages.
|
||||
@@ -16,7 +16,7 @@ export class _projname_ {
|
||||
|
||||
// Retrieved previously saved data and return to the user.
|
||||
const data = await this.getData();
|
||||
await this.sendOutput(userPubKey, {
|
||||
await this.sendOutput(userPublicKey, {
|
||||
type: 'data_result',
|
||||
data: data
|
||||
})
|
||||
@@ -28,7 +28,7 @@ export class _projname_ {
|
||||
await this.setData(message.data);
|
||||
}
|
||||
else {
|
||||
await this.sendOutput(userPubKey, {
|
||||
await this.sendOutput(userPublicKey, {
|
||||
type: 'error',
|
||||
error: 'Set data not supported in readonly mode'
|
||||
})
|
||||
@@ -36,7 +36,7 @@ export class _projname_ {
|
||||
|
||||
}
|
||||
else {
|
||||
await this.sendOutput(userPubKey, {
|
||||
await this.sendOutput(userPublicKey, {
|
||||
type: 'error',
|
||||
error: 'Unknown message type'
|
||||
})
|
||||
|
||||
@@ -10,9 +10,9 @@ async function contract(ctx) {
|
||||
const app = new _projname_();
|
||||
|
||||
// Wire-up output emissions from the application before we pass user inputs to it.
|
||||
app.sendOutput = async (userPubKey, output) => {
|
||||
app.sendOutput = async (userPublicKey, output) => {
|
||||
// In Hot Pocket, each user is represented by their Ed25519 public key.
|
||||
const user = ctx.users.find(userPubKey);
|
||||
const user = ctx.users.find(userPublicKey);
|
||||
await user.send(output)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ async function contract(ctx) {
|
||||
const message = JSON.parse(buf);
|
||||
|
||||
// Pass the JSON message to our application logic component.
|
||||
await app.handleRequest(userPubKey, message, isReadOnly);
|
||||
await app.handleRequest(userPublicKey, message, isReadOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user