Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imcoding-online/js-move-playground
js move playground by imcoding.online
https://github.com/imcoding-online/js-move-playground
aptos browser javascript move typescript vm
Last synced: 3 months ago
JSON representation
js move playground by imcoding.online
- Host: GitHub
- URL: https://github.com/imcoding-online/js-move-playground
- Owner: imcoding-online
- License: mit
- Created: 2022-09-13T09:24:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T11:21:36.000Z (about 2 years ago)
- Last Synced: 2024-08-08T20:55:01.210Z (5 months ago)
- Topics: aptos, browser, javascript, move, typescript, vm
- Language: JavaScript
- Homepage: https://imcoding.online
- Size: 1.45 MB
- Stars: 17
- Watchers: 0
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: License.txt
Awesome Lists containing this project
- awesome-sui - Move Playground JS Library - Wrapping [Move Playground by Pontem](https://playground.pontem.network/) as a JavaScript library for browser. You can use it to build your own Move Playground. (Tools / Libraries)
- awesome-move - Move Playground JS Library - Wrapping [Move Playground by Pontem](https://playground.pontem.network/) as a JavaScript library for browser. You can use it to build your own Move Playground. (Tools / Miscellaneous)
README
# JS MOVE PLAYGROUND
Wrapper [move playground by pontem](https://playground.pontem.network/). Only support Browser environment.
## Demo
[imcoding.online](https://imcoding.online)
## Install
```shell
npm i @imcoding.online/js-move-playground
```## Use
```typescript
import { setup, openProject } from "@imcoding.online/js-move-playground";// must setup first
await setup();// create or open project
const demo = await openProject("demo");// create or open module
const module = demo.openModule("math.move");
demo.setContent(module, `
module 0x01::Math {
public fun sum(a: u64, b: u64): u64 {
a + b
}
}
`);// create or open script
let script = demo.openScript("plus.move");
demo.setContent(script, `
script {
use 0x01::Math::sum;fun plus(a: u64, b: u64) {
assert!(sum(a, b) == 15, 101);
}
}
`);await demo.runScript("plus(10, 5)"); // execute success
await demo.runScript("plus(8, 3)"); // throw Error
// rename file
script = demo.renameFile(script, "plus_v2.move");// remove file
demo.removeFile(script);// remove project
await demo.remove();
```