npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@waves/waves-repl

v3.0.1

Published

Javascript console to interact with waves blockchain. React component

Downloads

8

Readme

REPL

About

This repository contains javascript console for waves blockchain. It is built on top of jsconsole and have predefined functions to work with waves

Builtin functions

JS lib

Console uses waves-transactions library. Top level library functions are bound to console global scope. The difference is that in console, seed argument is equal to env.SEED by default. You need to pass null explicitly if you only want to create transaction and not to sign it E.x.:

Console
const signedTx = transfer({amount: 100, recipient: '3MyAGEBuZGDKZDzYn6sbh2noqk9uYHy4kjw', senderPublicKey: '8ViwGfvyyN1teUKV4Uvk2orK6XiYB4S4VuM2DqJ9Mj5b'}, null)

//returns tx with no proofs
{
  "type": 4,
  "version": 2,
  "fee": 100000,
  "senderPublicKey": "8ViwGfvyyN1teUKV4Uvk2orK6XiYB4S4VuM2DqJ9Mj5b",
  "timestamp": 1542640481876,
  "proofs": [],
  "id": "CveeKH16XQcshV5GZP2RXppg3snxcKqRsM4wE5gxcuzc",
  "chainId": "T",
  "amount": 100,
  "recipient": "3MyAGEBuZGDKZDzYn6sbh2noqk9uYHy4kjw"
}

Additional functions

Broadcast signed tx using node from global variable

const resp = await broadcast(signedTx)

Deploy current open contract using node from global variable

const resp = deploy()

Sign arbitrary transaction

const tx = transfer({amount: 100, recipient: '3MyAGEBuZGDKZDzYn6sbh2noqk9uYHy4kjw', senderPublicKey: '8ViwGfvyyN1teUKV4Uvk2orK6XiYB4S4VuM2DqJ9Mj5b'}, null)
const signedTx = signTx(tx)

Compile contract. Returns base64

const compiled = compile(contractText)

Get contract text by tab name. Used inside web-ide or vscode plugin

const contractText = file(tabName)

Get contract text from currently open tab. Used inside web-ide or vscode plugin

const contractText = contract()

Keys

address(seed = env.SEED) // Address from seed. 
keyPair(seed = env.SEED) // Keypair from seed
publicKey(seed = env.SEED) // Public key from seed
privateKey(seed = env.SEED) // Private key from seed

Global object env

env.SEED // Default seed
env.CHAIN_ID // Default network byte
env.API_BASE // Node url 
env.editors // Open editor tabs info

Usage

Dev server:

npm start

Starts dev server

React component

import * as React from 'react';
import {render} from 'react-dom';
import {Repl} from 'waves-repl';

class App extends React.Component {
    public consoleRef = React.createRef<Repl>();

    componentDidMount(){
        // Get console instance
        const console = this.consoleRef.current!;
        
        // Access to console api
        (global as any)['updateEnv'] = console.updateEnv;
        (global as any)['API'] = console.API;
        (global as any)['methods'] = console.methods;

        (global as any)['updateEnv']({
            SEED: 'abracadabra',
            API_BASE: 'https://nodes-testnet.wavesnodes.com',
            CHAIN_ID: 'T',
            file: () => 'Placeholder file content'
        });

    }
    render(){
        return <Repl theme="dark" ref={this.consoleRef}/>
    }
}
render(<App/>, document.getElementById('root'));