{"id":13408798,"url":"https://github.com/gfusee/mx-sdk-as","last_synced_at":"2026-01-12T10:58:20.227Z","repository":{"id":115189354,"uuid":"567214812","full_name":"gfusee/mx-sdk-as","owner":"gfusee","description":"AssemblyScript smart contract library designed for MultiversX's VM.","archived":false,"fork":false,"pushed_at":"2024-03-12T15:21:20.000Z","size":425,"stargazers_count":27,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-17T02:02:53.397Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gfusee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-17T10:14:47.000Z","updated_at":"2024-06-13T14:04:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"13112681-eef4-4b60-a8ad-28f88867d502","html_url":"https://github.com/gfusee/mx-sdk-as","commit_stats":null,"previous_names":["gfusee/elrond-wasm-as"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfusee%2Fmx-sdk-as","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfusee%2Fmx-sdk-as/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfusee%2Fmx-sdk-as/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfusee%2Fmx-sdk-as/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gfusee","download_url":"https://codeload.github.com/gfusee/mx-sdk-as/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584476,"owners_count":20314770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T20:00:55.311Z","updated_at":"2026-01-12T10:58:20.221Z","avatar_url":"https://github.com/gfusee.png","language":"TypeScript","funding_links":[],"categories":["MultiversX community"],"sub_categories":["SDKs and dev tools"],"readme":"# MultiversX WASM AssemblyScript (Proof of concept)\n\nA proof of concept to make MultiversX smart contracts in AssemblyScript.\n\n## ⚠️ Warning ⚠️\n\nTHIS IS ONLY EXPERIMENTAL, DO NOT USE IT IN PRODUCTION !\n\nThe aim of this repo is to make a proof of concept and ONLY a proof of concept. The code is neither clean nor safe nor optimized !\n\n## Getting started\n\n### Tutorials\n\nTwo smart contracts tutorials are available here : https://fusee.gitbook.io/mx-sdk-as/.\n\nThey will give a good idea about what you can build with this framework.\n\n### AssemblyScript\n\nAssemblyScript is nearly the same as Typescript, but there is still some differences, please check https://www.assemblyscript.org/ to have more informations.\n\n### Contract development\n\n#### Build the empty contract\n\nIf you only want to try writing smart contracts with this framework do the following steps :\n\n- Clone the following repo : https://github.com/gfusee/mx-sdk-as-empty\n- In order to compile the contract you should run the command `npm run build`\n\nAnd you're done ! The contract is compiled into the `build` folder.\n\nFeel free to check examples contracts inside the `contracts/examples` folder, these are reproduction of `mx-sdk-rs` examples contracts.\n\n#### Test the contract via scenario\n\nIf you have a standard installation of mxpy, the `run-scenarios` executable should be located in the `~/multiversx-sdk/vmtools` folder. Here are the steps to execute scenarios :\n\n- Compile the contract (steps above)\n- Find your `run-scenario` executable path inside your  custom installation of mxpy installation\n- Inside the root folder of the project, run the `\u003cpath to run\u003e scenarios` command\n\n## Documentation\n\nThere is currently no documentation, feel free to check examples inside the `contract/examples` folder.\n\nIf after that you have any question, feel free to DM me !\n\n## What's not (properly) working\n\n### Structs/classes \u0026 enums\n\nStructs and enums are workings but with some limitations.\n\nIn order to create a classes which is compatible with the framework you should annotate it with either `@struct` or `@enumType` :\n\n```\n@struct\nexport class Human {\n    name: ManagedBuffer\n    age: ManagedU64\n    wallet: ManagedAddress\n}\n```\n\nor\n\n```\n@enumType\nexport enum Animal {\n    Cat,\n    Dog,\n    Spider\n}\n```\n\nYou should be aware of the four following limitations :\n\n- Constructor should have no parameter. It is planned in the future to allow constructors with params, for now, you can use statics methods as a workaround.\n- They should have only managed properties types (those exported from this framework)\n- Enums are converted into classes at compilation. So `switch` statements may not work as expected, please use `if` instead.\n- They are allocated on the heap. More explanations below.\n\n### Async calls\n\nMultiversX team will soon change the asynchronous contracts calls system, hence I will not implement the current system.\nThis leads to several limitations like no call to ESDT proxy (issuing tokens, managing roles)\n\nThis feature will be my ultimate priority when MultiversX team will implement the new async calls system.\n\n### Statics and generics\n\nThere is a limitation related to Typescript, we cannot define static methods on interfaces so we cannot call them on generic parameters.\n\nA good workaround is to instantiate dummy objects to have access to those methods.\nThis may lead to useless VM calls, I'm hunting these useless calls to remove them.\n\n### Closures\n\nAssemblyScript has a SEVERE limitation about closures. Inside a closure we cannot use a variable declared outside, for example this code works :\n\n```\nmyBiguints.forEach(biguint =\u003e {\n    if (biguint == BigUint.zero()) {\n        throw new Error(\"BigUint should be greater than 0 !\")\n    }\n})\n```\n\nBut the following code does not work :\n\n```\nconst sum = BigUint.zero()\nmyBiguints.forEach(biguint =\u003e {\n    sum += biguint //does NOT compile because sum is declared outside the closure\n})\n```\n\nThis issue is known by the AssemblyScript and should be fixed in the future : https://github.com/AssemblyScript/assemblyscript/issues/798\n\n### Heap allocations\n\nThe biggest limitation of AssemblyScript I'm facing is that classes does not act as C structs, they are always allocated on the heap and this lead to big issues.\nI used a heavy workaround for some classes (ManagedBuffer, BigUint, ...) but not for all classes because this take a lot of time to refactor all.\n\nThis issue is known by the AssemblyScript team : https://github.com/AssemblyScript/assemblyscript/issues/2254\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfusee%2Fmx-sdk-as","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgfusee%2Fmx-sdk-as","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfusee%2Fmx-sdk-as/lists"}