Questions tagged [assemblyscript]

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

101 questions
0
votes
1 answer

AssemblyScript - Linear Nested Class Layout

I'm working on a linear data layout where components are alongside each other in memory. Things were going ok until I realized I don't have a way for making offsetof and changetype calls when dealing with nested classes. For instance, this works as…
chantey
  • 4,252
  • 1
  • 35
  • 40
0
votes
0 answers

AssemblyScript Smart contract panicked: Cannot parse JSON

I am trying to implement a transaction in AssemblyScript. After checking thanks project I created same things in my project which can be found in here I can call my methods and use them without any problem. After calling donating function, I can use…
Fatih
  • 15
  • 3
0
votes
1 answer

Near Protocol | RPC Contract deployment | Deserialization error

I am developing smart contracts in AssemblyScript, deploying contracts via RPC (Remote Procedural Calls), that is dynamically, while coding as and when required. Below is the code that carries out this task. log(): void…
0
votes
1 answer

How do I write a printf() function in AssemblyScript?

I mostly need this for logging where I need to pass in arbitrary arguments (ints floats, objects). One solution is to write let i:i32 = 1; let f:f32 = 1.1; log ("Message "+i.toString()+" "+f.toString()) This is very awkward and verbose to…
Sid Datta
  • 1,110
  • 2
  • 13
  • 29
0
votes
1 answer

yarn asb parsing error in compiling Assemblyscript smart contract

Anyone encountered this error when running yarn asb? I'm trying to compile an assemblyscript smart contract. gitpod /workspace/MyAssemblyContract (main) $ yarn asb yarn run v1.22.17 $ /workspace/MyAssemblyContract/node_modules/.bin/asb ERROR TS1110:…
0
votes
1 answer

ReactJS not call method from Smart Contract (NEAR) on product (testnet does not exist while viewing)

I deployed successfully my first app (AssemblyScript + Reactjs), but when i test on github-pages, i got this error. errors.js:18 Uncaught (in promise) Error: [-32000] Server error: account xxx.testnet does not exist while viewing at…
0
votes
1 answer

near-example/workshop--exploring-assemblyscript-contracts/assembly/A.sample-projects/04.token-contract/

I was reading the 04.token-contract(https://github.com/near-examples/workshop--exploring-assemblyscript-contracts/blob/master/assembly/A.sample-projects/04.token-contract/assembly/index.ts). What's the concept difference between the exported…
0
votes
1 answer

How to create a UID in AssemblyScript for a NEAR contract?

Trying to create a uniqueId in AS. I added this package npm install as-nanoid --save The nanoid function from the install is as follows: let urlAlphabet =…
andy-dev
  • 113
  • 6
0
votes
1 answer

NEAR, How to implement withdraw (assembly script)

Transfer money to a smart-contract first. How to withdraw money from smart-contract to a sender ? "near-sdk-as": "^3.2.1"
0
votes
1 answer

AssemblyScript / WebAssembly fails allocation after 65536-element array allocated

I'm having trouble with memory allocation and can't find any references to this case online. In particular, if I allocating an array of 65536 elements (not bytes) or more, any subsequent allocation (even a small one) "fails" – while it executes…
Sam Minnée
  • 724
  • 5
  • 14
0
votes
1 answer

Why does store() in AssemblyScript not store data at the specified pointer?

I have some assemblyScript code: export function run(): void { store(0, 'hello, my name is marty'); } That stores a string at pointer 0 in memory. However, the produced .wat file stores the string at location 1056 instead of 0: (module …
murty
  • 145
  • 1
  • 6
0
votes
1 answer

Assembly Script And WebXR

So I have been working with three.js and webXR for a bit of time so far, and wanted to integrate it in assembly script. I know how to get webXR to work in typescript, but when I try to use it in assembly script it errors out with the import. Here…
0
votes
1 answer

AssmeblyScript function doesn't get called

I have the following AssmemblyScript module: export function add(a: i32, b: i32): i32 { return a + b; } export function printNum(a: string): f64 { return parseFloat(a); } Which is generated with asc assembly/index.ts --target release I'm then…
benhowdle89
  • 36,900
  • 69
  • 202
  • 331
0
votes
1 answer

Matrix multiplication function?

How do you write a matrix multiplication function? Takes two matrices outputs one. The documentation on assemblyscript.org is pretty short, Float64Array though is a valid type among these but that's 1D so...
0
votes
1 answer

Webassembly how to get pointer or reference of f64

Is there any method in assemblyscript which get the pointer of type f64? It works: let c: ClassA; changetype(c) It don't work let f:f64 changetype(f)