Skip to content

Commit

Permalink
counter-ts refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
volovyks committed Aug 30, 2022
1 parent ab89e65 commit d6bb14f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions examples/src/counter.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { NearContract, NearBindgen, near, call, view } from 'near-sdk-js'
import { NearBindgen, near, call, view, initialize } from 'near-sdk-js'
import { isUndefined } from 'lodash-es'
import { log } from './log'

@NearBindgen
class Counter extends NearContract {
class Counter {
count: number;

constructor({ initial = 0 }: { initial: number }) {
super()
@initialize
init({ initial = 0 }: { initial: number }) {
this.count = initial
}

Expand All @@ -34,9 +34,5 @@ class Counter extends NearContract {
getCount(): number {
return this.count
}

default() {
return new Counter({ initial: 0 })
}
}

0 comments on commit d6bb14f

Please sign in to comment.