@vechain/connex
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -158,2 +158,9 @@ /** | ||
/** | ||
* Turn on caching for result of method call | ||
* TODO: More detailed description | ||
* @param ties a set of addresses, as the condition of cache invalidation | ||
*/ | ||
cache(ties: string[]): this | ||
/** | ||
* Pack arguments into {@link Clause}. | ||
@@ -485,3 +492,4 @@ * @param args method arguments | ||
/** | ||
* set the link to reveal tx related information | ||
* set the link to reveal tx related information. | ||
* first appearance of slice '{txid}' in the given link url will be replaced with txid. | ||
* @param url link url | ||
@@ -512,2 +520,9 @@ */ | ||
/** | ||
* set the link to reveal cert related information. | ||
* first appearance of slice '{certid}' in the given link url will be replaced with cert id. | ||
* @param url link url | ||
*/ | ||
link(url: string): this | ||
/** | ||
* send request | ||
@@ -514,0 +529,0 @@ * @param msg |
{ | ||
"name": "@vechain/connex", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Standard interface to connect DApp with VeChain and user", | ||
@@ -5,0 +5,0 @@ "main": "", |
@@ -7,3 +7,3 @@ # 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 is the standard interface to connect DApp with VeChain 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 user. `Connex` is a set of well-designed APIs for developers, with injected `Connex Object` in web applications they can easily build decentralized applications. | ||
@@ -14,4 +14,27 @@ ## Get Started | ||
### TypeScript(Recommended) | ||
### VeChain App Bootstrapping | ||
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) | ||
} | ||
``` | ||
Additionally, network can be specified: | ||
```javascript | ||
if(!window.connex) { | ||
// the app prefers running on test net | ||
location.href = 'https://env.vechain.org/r/#/test/' + encodeURIComponent(location.href) | ||
} | ||
``` | ||
### Install | ||
#### TypeScript(Recommended) | ||
``` bash | ||
@@ -23,16 +46,14 @@ npm install @vechain/connex --save-dev | ||
### Vanilla JS | ||
#### Vanilla JS | ||
No need to set up, just code in your favourite way. | ||
## Usage | ||
### Usage | ||
``` javascript | ||
const el = document.createElement('h1') | ||
if(window.connex){ | ||
const status = connex.thor.status | ||
el.innerText = 'You are \'connexed\' to vechain, the status is ' + (status.progress === 1 ? 'synced': 'syncing') | ||
}else{ | ||
el.innerText = ':( seems you don\'t have enough component to launch this app, please ......' | ||
} | ||
const status = connex.thor.status | ||
el.innerText = 'You are \'connexed\' to vechain, the status is ' + (status.progress === 1 ? 'synced': 'syncing') | ||
document.querySelector('body').append(el) | ||
@@ -43,4 +64,8 @@ ``` | ||
+ [API Reference](https://connex.vecha.in) for DApp developers | ||
+ [API Reference](https://connex.vecha.in) for VeChain app developers | ||
## Resource | ||
+ [Connex Implementation Test](https://connex-impl-test.vecha.in) | ||
## Architecture explained | ||
@@ -58,2 +83,2 @@ | ||
[GNU Lesser General Public License v3.0](https://www.gnu.org/licenses/lgpl-3.0.html), also included | ||
in *LICENSE* file in the repository. | ||
in *LICENSE* file in the repository. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25221
500
80