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

@proton/js

Package Overview
Dependencies
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@proton/js - npm Package Compare versions

Comparing version 27.5.7 to 27.6.0

dist/index.mjs

9

package.json
{
"name": "@proton/js",
"version": "27.5.7",
"version": "27.6.0",
"description": "Javascript Interface to the Proton Blockchain",

@@ -17,3 +17,3 @@ "module": "dist/index.js",

"dependencies": {
"@bloks/constants": "28.0.5",
"@bloks/constants": "28.1.0",
"@peculiar/webcrypto": "^1.4.0",

@@ -33,4 +33,5 @@ "abortcontroller-polyfill": "^1.7.3",

"devDependencies": {
"@babel/core": ">=7.13.0 <8.0.0",
"@babel/preset-env": "^7.11.5",
"@proton/tsconfig": "1.2.0",
"@proton/tsconfig": "1.3.0",
"@types/bn.js": "^5.1.1",

@@ -90,3 +91,3 @@ "@types/debug": "^4.1.5",

"scripts": {
"build": "tsup src/index.ts --format cjs --dts",
"build": "tsup src/index.ts --format cjs,esm --dts",
"dev": "tsup src/index.ts --watch",

@@ -93,0 +94,0 @@ "test": "jest"

@@ -5,3 +5,2 @@ # protonjs

## Installation

@@ -30,4 +29,5 @@

### Browser Distribution
The `dist-web` folder contains minified bundles ready for production, along with source mapped versions of the library for debugging.
The `dist-web` folder contains minified bundles ready for production, along with source mapped versions of the library for debugging.
## Import

@@ -38,4 +38,5 @@

Importing using ES6 module syntax in the browser is supported if you have a transpiler, such as Babel.
```js
import { Api, JsonRpc, RpcError, JsSignatureProvider } from '@proton/js';
import { Api, JsonRpc, RpcError, JsSignatureProvider } from "@proton/js";
```

@@ -46,5 +47,6 @@

Importing using commonJS syntax is supported by NodeJS out of the box.
```js
const { Api, JsonRpc, RpcError, JsSignatureProvider } = require('@proton/js');
const fetch = require('node-fetch'); // node only; not needed in browsers
const { Api, JsonRpc, RpcError, JsSignatureProvider } = require("@proton/js");
const fetch = require("node-fetch"); // node only; not needed in browsers
```

@@ -58,3 +60,3 @@

***Using the JsSignatureProvider in the browser is not secure and should only be used for development purposes. Use a secure vault outside of the context of the webpage to ensure security when signing transactions in production***
**_Using the JsSignatureProvider in the browser is not secure and should only be used for development purposes. Use a secure vault outside of the context of the webpage to ensure security when signing transactions in production_**

@@ -69,4 +71,5 @@ ```js

Open a connection to JSON-RPC, include `fetch` when on NodeJS.
```js
const rpc = new JsonRpc(['http://127.0.0.1:8888'], { fetch });
const rpc = new JsonRpc(["http://127.0.0.1:8888"], { fetch });
```

@@ -77,5 +80,7 @@

##### validKycProviders
A list of valid KYC Providers are stored here. When the JsonRpc is instantiated, it will check all the kyc providers and remove any blacklisted providers from this list.
It is an array of strings like so:
```

@@ -88,5 +93,7 @@ console.log(this.rpc.validKycProviders);

###### isLightKYCVerified
This function serves to check a user's verification status by cross-referencing the user's KYC data against a list of valid KYC providers. A light KYC is considered verification with the user's first name, last name, address and birth date.
After instantiating the rpc, it can be called like so:
```

@@ -106,25 +113,32 @@ this.rpc.isLightKYCVerified(account)

`transact()` is used to sign and push transactions onto the blockchain with an optional configuration object parameter. This parameter can override the default value of `broadcast: true`, and can be used to fill TAPOS fields given `expireSeconds` and either `blocksBehind` or `useLastIrreversible`. Given no configuration options, transactions are expected to be unpacked with TAPOS fields (`expiration`, `ref_block_num`, `ref_block_prefix`) and will automatically be broadcast onto the chain.
`transact()` is used to sign and push transactions onto the blockchain with an optional configuration object parameter. This parameter can override the default value of `broadcast: true`, and can be used to fill TAPOS fields given `expireSeconds` and either `blocksBehind` or `useLastIrreversible`. Given no configuration options, transactions are expected to be unpacked with TAPOS fields (`expiration`, `ref_block_num`, `ref_block_prefix`) and will automatically be broadcast onto the chain.
```js
(async () => {
const result = await api.transact({
actions: [{
account: 'eosio.token',
name: 'transfer',
authorization: [{
actor: 'useraaaaaaaa',
permission: 'active',
}],
data: {
from: 'useraaaaaaaa',
to: 'useraaaaaaab',
quantity: '0.0001 SYS',
memo: '',
},
}]
}, {
blocksBehind: 3,
expireSeconds: 30,
});
const result = await api.transact(
{
actions: [
{
account: "eosio.token",
name: "transfer",
authorization: [
{
actor: "useraaaaaaaa",
permission: "active",
},
],
data: {
from: "useraaaaaaaa",
to: "useraaaaaaab",
quantity: "0.0001 SYS",
memo: "",
},
},
],
},
{
blocksBehind: 3,
expireSeconds: 30,
}
);
console.dir(result);

@@ -137,2 +151,3 @@ })();

use `RpcError` for handling RPC Errors
```js

@@ -159,2 +174,2 @@ ...

[MIT](./LICENSE)
[MIT](./LICENSE)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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