Skip to content

Commit

Permalink
Merge pull request #143 from nearprotocol/hot_fix
Browse files Browse the repository at this point in the history
Update to near-sdk-as
  • Loading branch information
janedegtiareva authored Mar 24, 2020
2 parents 5cd4093 + 7865248 commit 6af064f
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 39 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ cache: yarn

before_install:
- rustup target add wasm32-unknown-unknown
- nvm install 10.16
- nvm use 10.16
- nvm install 12
- nvm use 12
- npm install -g yarn

install:
Expand Down
12 changes: 12 additions & 0 deletions blank_project/asconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const compile = require("near-sdk-as/compiler").compile

compile("assembly/main.ts", // input file
"out/main.wasm", // output file
[
// "-O1", // Optional arguments
"--debug",
"--measure", // Shows compiler runtime
"--validate" // Validate the generated wasm module
], {
verbose: true // Output the cli args passed to asc
});
12 changes: 0 additions & 12 deletions blank_project/gulpfile.js

This file was deleted.

7 changes: 3 additions & 4 deletions blank_project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"scripts": {
"build": "npm run build:contract && npm run build:web",
"build:contract": "mkdir -p out/ && gulp",
"build:contract": "node asconfig.js",
"build:web": "parcel build src/index.html --public-url ./",
"dev:deploy:contract": "near dev-deploy",
"deploy:contract": "near deploy",
Expand All @@ -15,12 +15,11 @@
"test": "npm run build:contract && jest test --env=near-shell/test_environment --runInBand"
},
"devDependencies": {
"assemblyscript": "^0.9.4",
"gh-pages": "^2.2.0",
"gulp": "^4.0.2",
"jest": "^25.1.0",
"jest-environment-node": "^25.1.0",
"near-bindgen-as": "^1.2.0",
"near-runtime-ts": "^0.6.2",
"near-sdk-as": "^0.1.2",
"near-shell": "^0.20.1",
"nodemon": "^2.0.2",
"parcel-bundler": "^1.12.4"
Expand Down
12 changes: 12 additions & 0 deletions blank_react_project/asconfig.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const compile = require("near-sdk-as/compiler").compile

compile("assembly/main.ts", // input file
"out/main.wasm", // output file
[
// "-O1", // Optional arguments
"--debug",
"--measure", // Shows compiler runtime
"--validate" // Validate the generated wasm module
], {
verbose: true // Output the cli args passed to asc
});
12 changes: 0 additions & 12 deletions blank_react_project/gulpfile.js

This file was deleted.

7 changes: 3 additions & 4 deletions blank_react_project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"scripts": {
"build": "npm run build:contract && npm run build:web",
"build:contract": "mkdir -p out/ && gulp",
"build:contract": "node asconfig.js",
"build:web": "parcel build src/index.html --public-url ./",
"dev:deploy:contract": "near dev-deploy",
"deploy:contract": "near deploy",
Expand All @@ -17,13 +17,12 @@
"devDependencies": {
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.1",
"assemblyscript": "^0.9.4",
"babel-jest": "^25.1.0",
"gh-pages": "^2.2.0",
"gulp": "^4.0.2",
"jest": "^25.1.0",
"jest-environment-node": "^25.1.0",
"near-bindgen-as": "^1.2.0",
"near-runtime-ts": "^0.6.2",
"near-sdk-as": "^0.1.2",
"near-shell": "^0.20.1",
"nodemon": "^2.0.2",
"parcel-bundler": "^1.12.4",
Expand Down
1 change: 1 addition & 0 deletions contract/asc/as_types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="near-sdk-as/assembly/as_types" />
8 changes: 4 additions & 4 deletions contract/asc/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { context, logging, storage } from "near-runtime-ts";
// available class: near, context, storage, logging, base58, base64,
import { context, logging, storage } from "near-sdk-as";
// available class: context, storage, logging, base58, base64,
// PersistentMap, PersistentVector, PersistentDeque, PersistentTopN, ContractPromise, math
import { TextMessage } from "./model";

Expand All @@ -8,7 +8,7 @@ const DEFAULT_MESSAGE = "Hello"
export function welcome(account_id: string): TextMessage {
logging.log("simple welcome test");
let message = new TextMessage();
let greetingPrefix = storage.get<String>(account_id);
let greetingPrefix = storage.get<string>(account_id);
if (!greetingPrefix) {
greetingPrefix = DEFAULT_MESSAGE;
}
Expand All @@ -18,7 +18,7 @@ export function welcome(account_id: string): TextMessage {
}

export function setGreeting(message: string): void {
storage.set<String>(context.sender, message);
storage.set(context.sender, message);
}

function printString(s: string): string {
Expand Down
2 changes: 1 addition & 1 deletion contract/asc/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../node_modules/assemblyscript/std/assembly.json",
"extends": "assemblyscript/std/assembly.json",
"include": [
"./**/*.ts"
]
Expand Down

0 comments on commit 6af064f

Please sign in to comment.