From a0374469ce8940768573cc0698a4e3bada6435d4 Mon Sep 17 00:00:00 2001 From: DieMyst Date: Wed, 13 Mar 2019 18:00:00 +0300 Subject: [PATCH] add some libs for experiments --- assembly/index.ts | 12 +++++++++++- package-lock.json | 28 ++++++++++++++++++++++++++-- package.json | 10 ++++++++-- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/assembly/index.ts b/assembly/index.ts index 80f0344..cbfc9d8 100644 --- a/assembly/index.ts +++ b/assembly/index.ts @@ -2,6 +2,14 @@ import "allocator/tlsf"; //import "allocator/buddy"; //import "allocator/arena"; +import { u128 } from "../node_modules/bignum/assembly/integer/u128"; + +// this is causes OOM +import { AES } from "../node_modules/crypto-ts/src/algo/AES"; + +// this is too +// import { Queue } from "../node_modules/typescript-collections/src/lib/Queue"; + export function allocate(size: i32) :i32 { return memory.allocate(size); } @@ -12,6 +20,8 @@ export function deallocate(ptr: i32, size: i32): void { export function invoke(ptr: i32, size: i32): i32 { + let a = u128.One; + let inputStr: string = String.fromUTF8(ptr, size); let str = "Hello, world! From user " + inputStr; @@ -30,4 +40,4 @@ export function invoke(ptr: i32, size: i32): i32 { } return addr; -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index b697706..8b003d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "example", - "version": "1.0.0", + "name": "assemblyscript-helloworld", + "version": "0.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -23,12 +23,20 @@ "source-map-support": "^0.5.10" } }, + "assemblyscript-bson": { + "version": "github:nearprotocol/assemblyscript-bson#515a32cc87cfd67f636a2257143b54ba60315598", + "from": "github:nearprotocol/assemblyscript-bson" + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "bignum": { + "version": "github:MaxGraey/bignum.wasm#8e602206447a5c69db977c52040bb3462d3fcd88", + "from": "github:MaxGraey/bignum.wasm" + }, "binaryen": { "version": "72.0.0-nightly.20190308", "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-72.0.0-nightly.20190308.tgz", @@ -57,6 +65,13 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "crypto-ts": { + "version": "github:hmoog/crypto-ts#3a5ff1cc2c0f3922fe88062f8106f6562a662c24", + "from": "github:hmoog/crypto-ts", + "requires": { + "tslib": "^1.7.1" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -145,6 +160,15 @@ "source-map": "^0.6.0" } }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==" + }, + "typescript-collections": { + "version": "github:fluencelabs/typescript-collections#7b75c597d5fc04735d98f847c79cf335b2c2b2fd", + "from": "github:fluencelabs/typescript-collections" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", diff --git a/package.json b/package.json index 27bfab6..f508bce 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,18 @@ "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --sourceMap --validate --optimize --use abort=''", + "asbuild:optimized": "asc assembly/index.ts -b build/optimized.wasm -t build/optimized.wat --use abort=''", "asbuild": "npm run asbuild:optimized" }, "author": "", "license": "ISC", "devDependencies": { "assemblyscript": "github:AssemblyScript/assemblyscript" + }, + "dependencies": { + "bignum": "github:MaxGraey/bignum.wasm", + "assemblyscript-bson": "github:nearprotocol/assemblyscript-bson", + "typescript-collections": "github:fluencelabs/typescript-collections", + "crypto-ts": "github:hmoog/crypto-ts" } -} \ No newline at end of file +}