-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3105 from cardano-foundation/1.0.0
Merge 1.0.0 into main
- Loading branch information
Showing
48 changed files
with
2,080 additions
and
548 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ jobs: | |
run: npm ci | ||
|
||
- name: 🎳 Run tests | ||
run: npm run test:jest:ci | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Project Name | ||
|
||
UPLC-JS | ||
|
||
## Overview | ||
|
||
This project utilizes a WebAssembly module to decode flat data, providing a crucial tool for the Cardano Explorer. Leveraging Aiken's library https://github.com/aiken-lang/aiken, we've built a WebAssembly version of the decoder, making it accessible for web applications. | ||
|
||
## Table of Contents | ||
|
||
- [Installation](#installation) | ||
- [Usage](#usage) | ||
- [Update](#update) | ||
- [Special Thanks](#special-thanks) | ||
|
||
## Installation | ||
|
||
Describe how to install and set up your project. Include any prerequisites, such as Rust and wasm-pack, if necessary. | ||
|
||
1. Clone this repository: | ||
```bash | ||
git clone https://github.com/yourusername/yourproject.git | ||
``` | ||
2. Install Rust: | ||
```bash | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
``` | ||
3. Install wasm-pack: | ||
```bash | ||
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh | ||
``` | ||
4. Build the project: | ||
```bash | ||
wasm-pack build --target web | ||
``` | ||
|
||
## Usage | ||
|
||
### Using the WebAssembly Module | ||
|
||
1. Add the following script tag to your HTML file: | ||
```html | ||
<script type="module"> | ||
import { decode } from './pkg/uplc-js.js'; | ||
async function run() { | ||
const yourFlat = "abc123"; | ||
const decoded = decode(yourFlat); | ||
console.log(decoded) | ||
} | ||
run(); | ||
</script> | ||
``` | ||
2. Call the exported functions from your JavaScript code: | ||
```javascript | ||
decode(); | ||
``` | ||
## Update | ||
Now we are using uplc rust package version 1.0.14-alpha, you can update this version and rebuild by updating this version in Cargo.toml file. | ||
``` | ||
uplc = { version = "1.0.14-alpha" } | ||
``` | ||
## Special Thanks | ||
Special thanks to Aiken for providing the library for decoding flat data. Now, we can build it to WebAssembly and use it in the Cardano Explorer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "uplc-js", | ||
"collaborators": [ | ||
"sotatek" | ||
], | ||
"version": "0.1.0", | ||
"files": [ | ||
"uplc_js_bg.wasm", | ||
"uplc_js.js", | ||
"uplc_js.d.ts" | ||
], | ||
"module": "uplc_js.js", | ||
"types": "uplc_js.d.ts", | ||
"sideEffects": [ | ||
"./snippets/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @param {string} flat | ||
* @returns {string} | ||
*/ | ||
export function decode(flat: string): string; | ||
|
||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
|
||
export interface InitOutput { | ||
readonly memory: WebAssembly.Memory; | ||
readonly decode: (a: number, b: number, c: number) => void; | ||
readonly __wbindgen_add_to_stack_pointer: (a: number) => number; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | ||
readonly __wbindgen_free: (a: number, b: number, c: number) => void; | ||
} | ||
|
||
export type SyncInitInput = BufferSource | WebAssembly.Module; | ||
/** | ||
* Instantiates the given `module`, which can either be bytes or | ||
* a precompiled `WebAssembly.Module`. | ||
* | ||
* @param {SyncInitInput} module | ||
* | ||
* @returns {InitOutput} | ||
*/ | ||
export function initSync(module: SyncInitInput): InitOutput; | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {InitInput | Promise<InitInput>} module_or_path | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function __wbg_init(module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; |
Oops, something went wrong.