New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

motoko

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

motoko

Compile Motoko smart contracts in Node.js and the browser.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
815
decreased by-14.57%
Maintainers
1
Weekly downloads
 
Created
Source

Motoko

Compile Motoko smart contracts in Node.js and the browser.

Installation:

npm install --save motoko

Basic Example:

import mo from 'motoko';
// -- OR --
const mo = require('motoko');

// Create a Motoko script in a virtual file system
mo.addFile('Main.mo', `
actor {
    public func hello() : async Text {
        "Hello, JavaScript!"
    }
}
`);

// Generate the corresponding Candid interface
console.log(mo.candid('Main.mo'))

Advanced Usage:


// Load dependencies
await mo.loadPackages({
    base: 'dfinity/motoko-base/master/src',
});

// Generate a Motoko AST
console.log(mo.parse('actor Main { public func test() : async Nat { 123 } }'));

// Generate a Candid AST
console.log(mo.parseCandid('service : { test : () -> (nat) }'));

Keywords

FAQs

Package last updated on 27 Jul 2022

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