UNPKG

create-near-app

Version:

Quickly scaffold your dApp on NEAR Blockchain

23 lines (18 loc) 565 B
// Find all our documentation at https://docs.near.org import { NearBindgen, near, call, view } from 'near-sdk-js'; @NearBindgen({}) class HelloNear { static schema = { greeting: 'string' }; greeting: string = 'Hello'; @view({}) // This method is read-only and can be called for free get_greeting(): string { return this.greeting; } @call({}) // This method changes the state, for which it cost gas set_greeting({ greeting }: { greeting: string }): void { near.log(`Saving greeting ${greeting}`); this.greeting = greeting; } }