New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@windingtree/org.id-core

Package Overview
Dependencies
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@windingtree/org.id-core - npm Package Compare versions

Comparing version 1.0.0-beta.23 to 1.0.0-beta.26

8

package.json
{
"name": "@windingtree/org.id-core",
"version": "1.0.0-beta.23",
"version": "1.0.0-beta.26",
"description": "Core ORGiD Javascript library",

@@ -42,3 +42,3 @@ "main": "dist/index.js",

"@windingtree/org.id": "3.0.0-beta.6",
"@windingtree/org.id-utils": "^1.0.0-beta.23",
"@windingtree/org.id-utils": "^1.0.0-beta.26",
"ethers": "5.5.1"

@@ -54,3 +54,3 @@ },

"@typescript-eslint/parser": "5.3.0",
"@windingtree/org.id-test-setup": "^1.0.0-beta.23",
"@windingtree/org.id-test-setup": "^1.0.0-beta.26",
"chai": "4.3.4",

@@ -66,3 +66,3 @@ "chai-as-promised": "7.1.1",

},
"gitHead": "239e89200f58cf0a12b331ffdcc0f79df009adf0"
"gitHead": "6488cacab3526de533a1d6106ba2756a8b800193"
}
[![@windingtree/org.id-core](https://img.shields.io/npm/v/@windingtree/org.id-core.svg)](https://www.npmjs.com/package/@windingtree/org.id-core)
# @windingtree/org.id-core
Core ORGiD Javascript library
Core ORGiD typescript library
## Documentation
[ORGiD SDK documentation](https://windingtree.github.io/org.id-sdk/)
## Setup
```bash
yarn install @windingtree/org.id-core
yarn install
```
## Usage
## Build
### Initialization
```javascript
import { OrgIdContract } from '@windingtree/org.id-core';
const contract = new OrgIdContract(
'ropsten', // allowed values main, ropsten or the OrgId smart contract address
window.ethereum // web3 compatible provider: Metamask, HDWalletProvider or HTTP/WS/WSS node URI
);
```bash
yarn build
```
### Getting of ORGiD information
## Linting & Testing
```javascript
const orgId = '0xf94c83b1da7bc36989b6a4f25e51ce66dd0fc...';
contract
.getOrgId(orgId)
.then(result => {
if (result === null) {
console.log(`${orgId} not found`);
} else {
console.log(result);
/*
{
id: '0xf94c83b1da7bc3698...',
owner: '0xA0B74BFE2822...',
orgJsonUri: 'http://orgdomain.com/path/to/org.json',
created: '2021-03-21T09:23:13.551Z'
}
*/
}
})
.catch(console.error);
```bash
yarn lint
yarn test
```
### ORGiD creation
```javascript
contract
.createOrgId(
'<RANDOM_BYTES32_STRING>', // Unique string in bytes32 string format. Can be generated using `Web3.utils.keccak256(Math.random().toString())`
'http://yourdomain.com/path/to/ORG.JSON', // <-- URI of your own public storage of the ORG.JSON VC file
'75000', // optional: gas limit value
'100000000000', // optional: gas price value
transactionHash => { // optional transaction callback
console.log(`Transaction sent: ${transactionHash}`);
}
)
.then(result => {
if (result === null) {
console.log('ORGiD creation error');
} else {
console.log(result);
/*
{
id: '0xf94c83b1da7bc3698...',
owner: '0xA0B74BFE2822...',
orgJsonUri: 'http://yourdomain.com/path/to/ORG.JSON',
created: '2021-03-21T09:23:13.551Z'
}
*/
}
})
.catch(console.error);
```
### Changing of the ORG.JSON URI
```javascript
const orgId = '0xf94c83b1da7bc36989b6a4f25e51ce66dd0...';
contract
.setOrgJson(
orgId, // Your ORGiD hash
'http://yourdomain.com/NEW/path/to/ORG.JSON',
'<CURRENT_ORGiD_OWNER_ADDRESS>',
// Same as for `createOrgId`
// '75000',
// '100000000000',
// transactionHash => {
// console.log(`Transaction sent: ${transactionHash}`);
// }
)
.then(result => {
if (result === null) {
console.log('ORG.JSON URI update error');
} else {
console.log(result);
/*
{
id: '0xf94c83b1da7bc3698...',
owner: '0xA0B74BFE2822...',
orgJsonUri: 'http://yourdomain.com/path/to/ORG.JSON',
created: '2021-03-21T09:23:13.551Z'
}
*/
}
})
.catch(console.error);
```
### Transferring of the ORGiD ownership
```javascript
const orgId = '0xf94c83b1da7bc36989b6a4f25e51ce66dd0fc...';
contract
.transferOrgIdOwnership(
orgId, // Your ORGiD hash
'<NEW_OWNER_ADDRESS>',
'<CURRENT_ORGiD_OWNER_ADDRESS>',
// Same as for `createOrgId`
// '75000',
// '100000000000',
// transactionHash => {
// console.log(`Transaction sent: ${transactionHash}`);
// }
).
// ...
// Same as for setOrgJson
```
### Getting of registered ORGiD's count
```javascript
contract
.getOrgIdsCount()
.then(result => {
if (result === null) {
console.log('Unable to get the count of ORGiDs'); // Should not happen
} else {
console.log(result); // --> 548
}
})
.catch(console.error);
```
### Getting the list of registered ORGiD's (without pagination)
```javascript
contract
.getOrgIds()
.then(result => {
if (result === null) {
console.log('Unable to get the list of ORGiDs'); // Should not happen
} else {
console.log(result);
/*
[
'0x7b15197de62b0bc73da908b215666c48e1...',
'0x56e34fe286de62c4d15d536cef2d171f0c...',
...
]
*/
}
})
.catch(console.error);
```
### Getting the list of registered ORGiD's (with pagination)
```javascript
contract
.getOrgIds(0, 20) // start, count
.then(result => {
if (result === null) {
console.log('Unable to get the list of ORGiDs'); // Should not happen
} else {
console.log(result);
/*
[
'0x7b15197de62b0bc73da908b215666c48e1...',
'0x56e34fe286de62c4d15d536cef2d171f0c...',
...
]
*/
}
})
.catch(console.error);
```
## Documentation
[Generated docs](docs#readme)
## Todo
- Create typings for @windingtree/org.id
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