Skip to content

Commit

Permalink
added schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gagdiez committed Aug 5, 2024
1 parent aa4f77b commit a84b240
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contract-ts/src/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { POINT_ONE, PostedMessage } from './model'
class GuestBook {
messages: Vector<PostedMessage> = new Vector<PostedMessage>("v-uid");

static schema = {
'messages': Vector<PostedMessage>
}

@call({ payableFunction: true })
// Public - Adds a new message.
add_message({ text }: { text: string }) {
Expand Down
6 changes: 6 additions & 0 deletions contract-ts/src/model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
export const POINT_ONE = '100000000000000000000000';

export class PostedMessage {
static schema = {
'premium': 'boolean',
'sender': 'string',
'text': 'string'
}

premium: boolean;
sender: string;
text: string;
Expand Down

0 comments on commit a84b240

Please sign in to comment.