Questions tagged [assemblyscript]

AssemblyScript compiles a strict variant of TypeScript (basically JavaScript with types) to WebAssembly.

101 questions
0
votes
1 answer

Matchstick: Assertion error: expected field equal '' but was ''

During testing my Graph Project I receive the following error: nft-lottery Player entity (assert.fieldEquals) Expected field 'lotteries' to equal '[0x1]', but was '[]' instead. Mapping aborted at…
haraslub
  • 151
  • 1
  • 10
0
votes
1 answer

Unexpected error upon calling hook: Missing value for non-nullable field

I am trying to build a subgraph for Graph Protocol following the example here (the example with the more performant way). During compilation of my Graph protocol project using a testing tool matchstick-as ^0.5.0, I get the following error: Igniting…
haraslub
  • 151
  • 1
  • 10
0
votes
0 answers

Pitch shift in typescript

I am trying to develop a webassembly function that can shift the pitch from and audioworklet. I have the wasm module compiling(assemblyscript) and working from the worklet, but can't seem to get my pitch shift algorithm to work correctly. Is there…
0
votes
2 answers

How to initialize a typed array with values?

Assemblyscript initializes typed arrays with their length, like this: var arr = new Uint8Array(2); Suppose I want to seed this array with some values, like [12, -47, 91], how would I do it?
Armand
  • 1
  • 1
0
votes
1 answer

ERROR TS2322: Type '~lib/array/Array<~lib/string/String> | null' is not assignable to type '~lib/array/Array<~lib/string/String>'

Holder has an array of strings (holder.positions). And all this function wants to do is push the ID of the position parameter onto the array. Here is my function function updateHolder(holder: Holder, position: Position): void { …
Steve
  • 4,457
  • 12
  • 48
  • 89
0
votes
0 answers

"Sorry, assemblyscript is not supported in your system, use --contract=rust " error in NEAR

I just want to use create-near-app package from the npm registry as assemblyscript and react. But it gives that error, how can i fix that ?
0
votes
1 answer

Passing arrays to AssemblyScript from JS

I have recently started attempting to add WebAssembly into an app I'm working on, but seem to be running into some trouble. I keep getting one of two errors: memory access out of bound or unreachable. I'm attempting to send an Float32Array of length…
0
votes
1 answer

How to encode arguments in AssemblyScript when calling Aurora contract from Near blockchain?

I'm trying to call a contract located in Aurora from a contract located in Near. I'm using AssemblyScript and I'm struggling with passing arguments to the Aurora contract itself. I receive ERR_BORSH_DESERIALIZE panic from the Aurora contract. Can…
Gwin Pin
  • 21
  • 3
0
votes
1 answer

is this ok to use AssemblyScript in React project?

I have a question about using AssemblyScript in React project I already read some stuff about using AssemblyScript to increase performance but the question is when my project is not that big sth like a game or machine learning etc when I have a…
Ali Sattarzadeh
  • 3,220
  • 1
  • 6
  • 20
0
votes
0 answers

[Stack]: RuntimeError: memory access out of bounds error while testing a function in a NEAR protocol smart contract assemblyscript

I get this error on running the test function in my NEAR protocol: [Stack]: RuntimeError: memory access out of bounds Here is my test function: describe("Main Flow", () => { it('Tests the flow of the app', () => { setContext('hamzatest.testnet',…
0
votes
2 answers

How to convert near to yocto using assemblyscript?

If I have an amount less than 1 NEAR let's say .5 near, how do I convert it and store it using assemblyscript in a near protocol smart contract? I tried to convert it to f64 first and make the arithmetic operation then convert it back to u128…
0
votes
0 answers

Angular, WebPack and AssemblyScript

I have an Angular project (with a few lines of AssemblyScript) and i'm trying to make the WASM compilation and copy the compiled files into the assets folder juste before Angular re-builds the project when we make some changes. I've tried to make…
0
votes
1 answer

Is there any way to compile AssemblyScript without node.js nor npm? Preferrably a standalone compiler that I could call from another program?

I have been searching some way to compile AssemblyScript without node.js. I have not found it and it is a tragedy because I really could use it to dynamically generate some special web assembly from other programs, for example, from a PHP program,…
0
votes
1 answer

How to treat a float as an integer bit level in AssemblyScript

I need to implement some C code blow: float number = 1.5f long i = * ( long * ) &number; It is not about to convert the value from float into integer. This data need to be modified bit level.
Kiochan
  • 457
  • 1
  • 7
  • 12
0
votes
1 answer

How to test if a function asserts in a NEAR smart contract (AssemblyScript)?

I have a function in my NEAR smart-contract (AssemblyScript) that I want to test. I want to test if the assertion actually happened. AssemblyScript foo(id: string): boolean { assert(id != 'bar', 'foo cannot be bar'); return true; } Unit test…
John
  • 10,165
  • 5
  • 55
  • 71