mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-14 15:54:11 +00:00
Pascal Precht
f2903e7577
fix(@embarkjs/whisper): don't rely on global EmbarkJS in whisper APIs
When trying to either sending, or listening to whisper channels within Embark's consoles (CLI and Cockpit), the console outputs an error that `EmbarkJS` isn't defined. E.g. running: ``` > EmbarkJS.Messages.listenTo({ topic: ['somechannel']) ``` Outputs: ``` EmbarkJS is not defined ``` This seemed very odd as outputting `EmbarkJS` and all of its members worked totally fine. It turns out that both methods, `listenTo()` and `sendMessage()`, in `EmbarkJS.Messages` are not necessarily what one thinks they are. EmbarkJS decorates both methods to create some options that need to be available in the delegate, two of them being `EmbarkJS.Utils.toAscii` and `EmbarkJS.Utils.fromAscii` (ac76a40a61/packages/embarkjs-whisper/src/index.js (L43-L62)
andac76a40a61/packages/embarkjs-whisper/src/index.js (L64-L73)
) These two global references to `EmbarkJS` are the only ones in `embarkjs-whisper` and they are not the same reference as the `EmbarkJS` sandbox global registered in the VM hereac76a40a61/packages/embark-code-runner/src/index.ts (L33)
. In other words, the `EmbarkJS is not defined` message actually refers to the `EmbarkJS` in the wrapping method, not the one registered with the VM, which is also why inspecting the `EmbarkJS` object through the VM works fine. Since the `toAscii()` and `fromAscii()` methods in use are really just facades around `web3.utils.[fromAscii|toAscii]()`, we can replace the global EmbarkJS dependency with web3 utils that are already available anyways.
ci: on azure pipelines split coveralls and ci:full invocation scripts, run each script conditionally
ci: on azure pipelines split coveralls and ci:full invocation scripts, run each script conditionally
What is Embark
Embark is a framework that allows you to easily develop and deploy Decentralized Applications (DApps).
A Decentralized Application is a serverless html5 application that uses one or more decentralized technologies.
Embark currently integrates with EVM blockchains (Ethereum), Decentralized Storages (IPFS), and Decentralized communication platforms (Whisper and Orbit). Swarm is supported for deployment.
With Embark you can:
Blockchain (Ethereum)
- Automatically deploy contracts and make them available in your JS code. Embark watches for changes, and if you update a contract, Embark will automatically redeploy the contracts (if needed) and the dapp.
- Contracts are available in JS with Promises.
- Do Test Driven Development with Contracts using Javascript.
- Keep track of deployed contracts; deploy only when truly needed.
- Manage different chains (e.g testnet, private net, livenet)
- Easily manage complex systems of interdependent contracts.
Decentralized Storage (IPFS, Swarm)
- Easily Store & Retrieve Data on the DApp through EmbarkJS. Including uploading and retrieving files.
- Deploy the full application to IPFS or Swarm.
- Import and deploy contracts hosted on Swarm.
Decentralized Communication (Whisper, Orbit)
- Easily send/receive messages through channels in P2P through Whisper or Orbit.
Web Technologies
- Integrate with any web technology including React, Foundation, etc..
- Use any build pipeline or tool you wish, including grunt, gulp and webpack.
$ npm -g install embark
Description
Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms
https://framework.embarklabs.io/
Languages
JavaScript
73.9%
TypeScript
14%
CSS
8%
HTML
4.1%