This repository contains javascript console for waves blockchain. It is built on top of jsconsole and have predefined functions to work with waves
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.:
constsignedTx=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"}Broadcast signed tx using node from global variable
constresp=awaitbroadcast(signedTx)Deploy current open contract using node from global variable
constresp=deploy()Sign arbitrary transaction
consttx=transfer({amount: 100,recipient: '3MyAGEBuZGDKZDzYn6sbh2noqk9uYHy4kjw',senderPublicKey: '8ViwGfvyyN1teUKV4Uvk2orK6XiYB4S4VuM2DqJ9Mj5b'},null)constsignedTx=signTx(tx)Compile contract. Returns base64
constcompiled=compile(contractText)Get contract text by tab name. Used inside web-ide or vscode plugin
constcontractText=file(tabName)Get contract text from currently open tab. Used inside web-ide or vscode plugin
constcontractText=contract()Keys
address(seed=env.SEED)// Address from seed. keyPair(seed=env.SEED)// Keypair from seedpublicKey(seed=env.SEED)// Public key from seedprivateKey(seed=env.SEED)// Private key from seedenv.SEED// Default seedenv.CHAIN_ID// Default network byteenv.API_BASE// Node url env.editors// Open editor tabs infonpm start
Starts dev server
import*asReactfrom'react';import{render}from'react-dom';import{Repl}from'waves-repl';classAppextendsReact.Component{publicconsoleRef=React.createRef<Repl>();componentDidMount(){// Get console instanceconstconsole=this.consoleRef.current!;// Access to console api(globalasany)['updateEnv']=console.updateEnv;(globalasany)['API']=console.API;(globalasany)['methods']=console.methods;(globalasany)['updateEnv']({SEED: 'abracadabra',API_BASE: 'https://nodes-testnet.wavesnodes.com',CHAIN_ID: 'T',file: ()=>'Placeholder file content'});}render(){return<Repltheme="dark"ref={this.consoleRef}/>}}render(<App/>,document.getElementById('root'));