Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solanafm/explorerkit-wasm-translator

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solanafm/explorerkit-wasm-translator

We offer developers various options to decode Solana instructions, including Typescript and Rust-based Web Assembly, providing flexibility for those familiar with Rust to easily import their existing structs and decoding methods.

  • 0.0.0-alpha-1
  • unpublished
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Web Assembly (WASM) Parser

We offer developers various options to decode Solana instructions, including Typescript and Rust-based Web Assembly, providing flexibility for those familiar with Rust to easily import their existing structs and decoding methods.

Getting started

Before running this project, you are required to install the following dependencies.

Prerequisites

  • rust
  • wasm-pack

Build

wasm-pack build --out-dir ../explorerkit-wasm-package --release

After running the aboe command, the compiled Web Assembly file will be generated and saved in the pkg folder. This file can be used by the Typescript application to decode Solana instructions, as well as by any other programming language that supports Web Assembly (WASM) for decoding purposes.

Preparation for unit-test

Update the the following file packages/explorerkit-wasm-package/package.json after the build and include the following two lines

{
  "name": "explorerkit-wasm-translator",
  "version": "0.1.0",
  "files": [
    "explorerkit_wasm_translator_bg.wasm",
    "explorerkit_wasm_translator.js",
    "explorerkit_wasm_translator_bg.js",
    "explorerkit_wasm_translator.d.ts"
  ],
  "main": "explorerkit_wasm_translator.js", // include this line
  "type": "module",                         // include this line
  "module": "explorerkit_wasm_translator.js",
  "types": "explorerkit_wasm_translator.d.ts",
  "sideEffects": false
}

[ ] TODO: add script to automate creation of properties main and type

Typescript types

To generate typescript definitions for the generated Web Assembly file, run the following command:

# generate typescript definitions from structs
cargo test

# export individual files from one file (ensure that you're in "explorerkit-wasm-translator" folder)
./scripts/compile-types.sh

After running the command to generate typescript definitions for the Web Assembly file, a new folder named bindings will be created. This folder will contain all the exported structs that can be inferred, meaning that the TypeScript compiler will be able to detect the types of these structs automatically, allowing for more streamlined development.

FAQs

Package last updated on 24 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc