0.6.0 • Published 2 months ago

quorum-middleware v0.6.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 months ago

Quorum Middleware in Javascript

Installation

npm i quorum-middleware

or

yarn add quorum-middleware

Usage

import Web3 from "web3";
import { LC, LCWrapper, Permission, PermissionWrapper } from "quorum-middleware";
const web3 = new Web3("http://localhost:8545");
const lc = new LC(web3);
const lcWrapper = new LCWrapper(web3);
const permission = new Permission(web3);
const permissionWrapper = new PermissionWrapper(web3);

OR

const web3 = new Web3("http://localhost:8545");

const customConfig = {
    lCContractAddresses: {
        LCManagement: "0x795C2DeEf13e6D49dF73Ca194250c97511796255",
        Mode: "0x9c2ccBf987b9DC2144ae2c6767475017AeBF42b3",
        RouterService: "0x0B3b181264f97b005e2ceB1Acac082E4ec883d86",
        StandardLCFactory: "0x452EEfa90c9628Df5421e5E1A3fB8F044F2F364b",
        UPASLCFactory: "0x5692c93c784ef84711E6b460CF40577Fc95Bd039",
        AmendRequest: "0xD92cFf94741C78153190f9A060005653f9410d95",
    },
    permissionContractAddresses: {
        OrgManager: "0xf5B2c0829f9485EEB114B11a7C1cb3227B8749Ee",
        AccountManager: "0xc7123BEA05D26823f99bba87a83BADDD021C3c2d",
        PermissionsImplementation: "0x48272bB87cdA70aCd600B7B8883ada2e799983b8",
        PermissionsInterface: "0x638449F761362fB1041a75eE92e86a2e8fe92780",
        PermissionsUpgradable: "0x40686513a73B3e861810345B08Ca2d952CE8E4F4",
        NodeManager: "0xeE2EF0e68A72654C20c6f3dfa43e03816f362B4F",
        RoleManager: "0x09Ad12B57407dEd24ad2789043F8962fe8679DB3",
        VoterManager: "0xF5E507788E7eaa9Dbf8f24a5D24C2de1F9192416",
    },
    chainId: 6788,
    chainName: "FPT Quorum Testnet FIS Gateway",
    url: "http://localhost:8545",
}

const lc = new LC(web3, customConfig);
const lcWrapper = new LCWrapper(web3, customConfig);
const permission = new Permission(web3, customConfig);
const permissionWrapper = new PermissionWrapper(web3, customConfig);

API

LCWrapper.createStandardLC(parties, content, from)

  • parties: string[] - an array of organizations
  • content: object | Name | Type | |----------------------|----------| | prevHash | string | | contentHash | string[] | | url | string | | signedTime | BN | | numOfDocuments | number | | acknowledgeSignature | string |
  • from: string - account send transaction

Return transaction receipt

LCWrapper.createUPASLC(parties, content, from)

  • parties: string[] - an array of organizations
  • content: object | Name | Type | |----------------------|----------| | prevHash | string | | contentHash | string[] | | url | string | | signedTime | BN | | numOfDocuments | number | | acknowledgeSignature | string |
  • from: string - account send transaction

Return transaction receipt

LCWrapper.approveLC(documentId, stage, subStage, content, from)

  • documentId: string - hash of documentId
  • stage: number
  • subStage: number
  • content: object | Name | Type | |----------------------|----------| | contentHash | string[] | | url | string | | signedTime | BN | | numOfDocuments | number | | acknowledgeSignature | string |
  • from: string - account send transaction

Return transaction receipt

LCWrapper.closeLC(documentId, from)

  • documentId: string - hash of documentId
  • from: string - account send transaction

Return transaction receipt

LCWrapper.submitAmendment(documentId, stage, subStage, content, migrateStages, from)

  • documentId: string - hash of documentId
  • stage: number
  • subStage: number
  • content: object | Name | Type | |----------------------|----------| | contentHash | string[] | | url | string | | signedTime | BN | | numOfDocuments | number | | acknowledgeSignature | string |
  • migrateStages:
  • from: string - account send transaction

Return transaction receipt

LCWrapper.approveAmendment(documentId, nonce, from)

  • documentId: string - hash of documentId
  • proposer: string - account submit amend request
  • nonce: BN - nonce when approve LC
  • from: string - account send transaction

Return transaction receipt

LCWrapper.fulfillAmendment(documentId, nonce, from)

  • documentId: string - hash of documentId
  • nonce: BN - nonce when approve LC
  • from: string - account send transaction

Return transaction receipt

PermissionWrapper.assignAccountRole(account, orgId, roleId, from)

  • account: string - account id
  • orgId: string - organization id to which the account belongs
  • roleId: string - role id to be assigned to the account
  • from: string - account send transaction

Return transaction receipt

PermissionWrapper.updateAccountStatus(orgId, account, action, from)

  • orgId: string - unique id of the organization to which the account belongs
  • account: string - account id
  • action: number | Value | Description | |-------|--------------------------------------------| | 1 | for suspending the account | | 2 | for activating the suspended account | | 3 | for denylisting (blacklisting) the account |

  • from: string - account send transaction

Return transaction receipt

Examples

0.6.0

2 months ago

0.5.19

2 months ago

0.5.18

3 months ago

0.5.16

3 months ago

0.5.15

3 months ago

0.5.14

3 months ago

0.5.13

4 months ago

0.5.10

1 year ago

0.5.11

1 year ago

0.5.8

1 year ago

0.5.9

1 year ago

0.5.12

1 year ago

0.5.12-staging

1 year ago

0.5.7

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago