diff --git a/examples/__tests__/test-cross-contract-call.ava.js b/examples/__tests__/test-cross-contract-call.ava.js index feb2b8fc8..d0b7c0758 100644 --- a/examples/__tests__/test-cross-contract-call.ava.js +++ b/examples/__tests__/test-cross-contract-call.ava.js @@ -13,9 +13,6 @@ test.beforeEach(async t => { './build/status-message.wasm', ); - // Init the contract - await statusMessage.call(statusMessage, 'init', {}); - // Deploy the onCall contract. const onCall = await root.devDeploy( './build/cross-contract-call.wasm', diff --git a/examples/__tests__/test-status-message.ava.js b/examples/__tests__/test-status-message.ava.js index a89828191..28dd92f53 100644 --- a/examples/__tests__/test-status-message.ava.js +++ b/examples/__tests__/test-status-message.ava.js @@ -13,9 +13,6 @@ test.before(async t => { './build/status-message.wasm', ); - // Init the contract - await statusMessage.call(statusMessage, 'init', {}); - // Create test users const ali = await root.createSubAccount('ali'); const bob = await root.createSubAccount('bob'); diff --git a/examples/src/clean-state.js b/examples/src/clean-state.js index 7061b73f1..6d7a379e8 100644 --- a/examples/src/clean-state.js +++ b/examples/src/clean-state.js @@ -1,6 +1,6 @@ import { NearBindgen, call, view, near } from 'near-sdk-js' -@NearBindgen({ requireInit: false }) +@NearBindgen({}) class CleanState { @call clean({ keys }) { diff --git a/examples/src/counter.js b/examples/src/counter.js index a7ea3e7eb..19011bcac 100644 --- a/examples/src/counter.js +++ b/examples/src/counter.js @@ -1,7 +1,7 @@ import { NearBindgen, near, call, view, initialize } from 'near-sdk-js' import { isUndefined } from 'lodash-es' -@NearBindgen +@NearBindgen({}) class Counter { @initialize init({ initial = 0 }) { diff --git a/examples/src/counter.ts b/examples/src/counter.ts index 15244865d..2e625cdc8 100644 --- a/examples/src/counter.ts +++ b/examples/src/counter.ts @@ -2,7 +2,7 @@ import { NearBindgen, near, call, view, initialize } from 'near-sdk-js' import { isUndefined } from 'lodash-es' import { log } from './log' -@NearBindgen +@NearBindgen({}) class Counter { count: number; diff --git a/examples/src/cross-contract-call.js b/examples/src/cross-contract-call.js index a315bfe97..06f11e0f5 100644 --- a/examples/src/cross-contract-call.js +++ b/examples/src/cross-contract-call.js @@ -1,9 +1,9 @@ -import { NearContract, NearBindgen, call, view, near, bytes } from 'near-sdk-js' +import { NearBindgen, call, view, initialize, near, bytes } from 'near-sdk-js' -@NearBindgen -class OnCall extends NearContract { - constructor({ statusMessageContract }) { - super() +@NearBindgen({ requireInit: true }) +class OnCall { + @initialize + init({ statusMessageContract }) { this.personOnCall = "undefined" this.statusMessageContract = statusMessageContract } @@ -37,8 +37,4 @@ class OnCall extends NearContract { near.log(`Returning person on-call: ${this.personOnCall}`) return this.personOnCall } - - default() { - return new OnCall({ statusMessageContract: '' }) - } } diff --git a/examples/src/status-message.js b/examples/src/status-message.js index 1ecdd9979..caf37f2d8 100644 --- a/examples/src/status-message.js +++ b/examples/src/status-message.js @@ -1,9 +1,8 @@ -import { NearContract, NearBindgen, call, view, near } from 'near-sdk-js' +import { NearBindgen, call, view, near } from 'near-sdk-js' -@NearBindgen -class StatusMessage extends NearContract { +@NearBindgen({}) +class StatusMessage { constructor() { - super() this.records = {} } @@ -19,9 +18,5 @@ class StatusMessage extends NearContract { near.log(`get_status for account_id ${account_id}`) return this.records[account_id] || null } - - default() { - return new StatusMessage() - } }