From 5d60320d5bb7987c7c1f8f7f2688dcbf49c271ec Mon Sep 17 00:00:00 2001 From: Serhii Volovyk Date: Wed, 31 Aug 2022 17:38:11 +0300 Subject: [PATCH] counter examples fixed, init deleted --- examples/__tests__/test-counter.ava.js | 2 -- examples/src/counter.js | 5 ++--- examples/src/counter.ts | 7 +------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/examples/__tests__/test-counter.ava.js b/examples/__tests__/test-counter.ava.js index f132e1e47..ca1bb26d8 100644 --- a/examples/__tests__/test-counter.ava.js +++ b/examples/__tests__/test-counter.ava.js @@ -15,8 +15,6 @@ test.beforeEach(async t => { (process.env['COUNTER_TS'] ? './build/counter-ts.wasm' : './build/counter.wasm') ); - // Init the contract - await counter.call(counter, 'init', {}); // Test users const ali = await root.createSubAccount('ali'); diff --git a/examples/src/counter.js b/examples/src/counter.js index 4e91d9b03..4d214a805 100644 --- a/examples/src/counter.js +++ b/examples/src/counter.js @@ -3,9 +3,8 @@ import { isUndefined } from 'lodash-es' @NearBindgen({}) class Counter { - @initialize - init({ initial = 0 }) { - this.count = initial + constructor() { + this.count = 0 } @call diff --git a/examples/src/counter.ts b/examples/src/counter.ts index 2e625cdc8..501416f9d 100644 --- a/examples/src/counter.ts +++ b/examples/src/counter.ts @@ -4,12 +4,7 @@ import { log } from './log' @NearBindgen({}) class Counter { - count: number; - - @initialize - init({ initial = 0 }: { initial: number }) { - this.count = initial - } + count: number = 0; @call increase({ n = 1 }: { n: number }) {