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

@vechain/connex

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vechain/connex - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

4

package.json
{
"name": "@vechain/connex",
"version": "1.4.0",
"version": "1.4.1",
"description": "Standard interface to connect DApp with VeChain and user",

@@ -23,3 +23,3 @@ "main": "index.js",

},
"homepage": "https://github.com/vechain/connex#readme"
"homepage": "https://github.com/vechain/connex/tree/master/packages/connex/#readme"
}

@@ -1,43 +0,35 @@

# Connex [![Gitter](https://badges.gitter.im/vechain/thor.svg)](https://gitter.im/vechain/thor?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
# Connex
[![npm version](https://badge.fury.io/js/%40vechain%2Fconnex.svg)](https://badge.fury.io/js/%40vechain%2Fconnex)
   [![TG](https://img.shields.io/badge/chat-on%20telegram-blue)](https://t.me/VeChainDevCommunity)
[Connex Powered VeChain Wallets](https://env.vechain.org/)
[API Reference](https://connex.vecha.in)
[API Reference](https://docs.vechain.org/connex/)
## Introduction
Connex is the standard interface to connect VeChain apps with VeChain blockchain and user. `Connex` is a set of well-designed APIs for developers, with injected `Connex Object` in web applications they can easily build decentralized applications.
Connex is the standard interface to connect VeChain apps with VeChain blockchain and users. Aiming to help developers building decentralized applications.
[Sync](https://env.vechain.org/#sync) or other connex compatible [clients](https://env.vechain.org/) will expose `connex` API by an injected object on [`Window Object`](https://developer.mozilla.org/en-US/docs/Glossary/Global_object).
<p align="center">
<img src="./docs/connex.jpg" alt="Connex Overview">
</p>
## How To
## Get Started
As `Connex` is already attached to the `Window Object`, just use it in your favourite way. Below is a sample of getting network status,
[Sync](https://env.vechain.org/#sync) or other compatible clients will expose `connex` API by an injected object on `Window Object`.
``` javascript
const el = document.createElement('h1')
### VeChain App Bootstrapping
const status = connex.thor.status
el.innerText = 'You are \'connexed\' to vechain, the status is ' + (status.progress === 1 ? 'synced': 'syncing')
VeChain apps are usually web apps. On app load, you always need to detect Connex component. If Connex is not available, you may instruct people to setup Connex environment.
To simplify these steps, simply perform redirection:
```javascript
if(!window.connex) {
location.href = 'https://env.vechain.org/r/#' + encodeURIComponent(location.href)
}
document.querySelector('body').append(el)
```
Additionally, network can be specified:
### TypeScript(Recommended)
```javascript
if(!window.connex) {
// the app prefers running on test net
location.href = 'https://env.vechain.org/r/#/test/' + encodeURIComponent(location.href)
}
```
This project is the type definition of `Connex` API which can be used to in typescript projects. Install by the following command:
### Install
#### TypeScript(Recommended)
``` bash

@@ -55,32 +47,37 @@ npm install @vechain/connex --save-dev

#### Vanilla JS
### Bootstrap Your APP
No need to set up, just code in your favourite way.
VeChain apps are usually web apps. On app load, you always need to detect `Connex` component in the environment. If `Connex` is not available, you may instruct users to setup `Connex` environment.
### Usage
To simplify these steps, simply perform redirection:
``` javascript
const el = document.createElement('h1')
```javascript
if(!window.connex) {
location.href = 'https://env.vechain.org/r/#' + encodeURIComponent(location.href)
}
```
const status = connex.thor.status
el.innerText = 'You are \'connexed\' to vechain, the status is ' + (status.progress === 1 ? 'synced': 'syncing')
Additionally, network can be specified:
document.querySelector('body').append(el)
```javascript
if(!window.connex) {
// the app prefers running on test net
location.href = 'https://env.vechain.org/r/#/test/' + encodeURIComponent(location.href)
}
```
## Resource
## Resources
+ [Connex Implementation Test](https://connex-impl-test.vecha.in)
+ [Connex Framework](https://github.com/vechain/connex-framework)
+ [Connex Driver](https://github.com/vechain/connex-driver)
+ [Connex REPL](https://github.com/vechain/connex-repl)
## Architecture explained
<details><summary>Implementation Architecture(SYNC)</summary>
<p align="center">
![Connex Architecture](./docs/architecture.png)
<img src="./docs/architecture.png" alt="Connex Architecture" width=400/>
</p>
</details>
## FAQ
#### TypeScript complier does not find Connex
First, check `tsconfig.json` and make sure `@vechain/connex` is present in `compilerOptions.types`. Furthermore if you are doing an angular project and still get the error, you are probably using a larger project with multiple project roots, just adding `@vechain/connex` to the root config is not enough in this case. You also have to find all `tsconfig.app.ts` and `tsconfig.spec.ts` files in your sub-projects. While these inherit from the main `tsconfig.json` you have to make sure it does not override the types with for example `"types": []` and that there is no conflict with `typesRoots`
## License

@@ -87,0 +84,0 @@

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