Skip to content

Mosaic.js provides a web3 interface to scale DApps on Ethereum

License

Notifications You must be signed in to change notification settings

deepesh-kn/mosaic.js

 
 

Repository files navigation

Install Package

npm install @openstfoundation/mosaic.js
Mosaic = require('@openstfoundation/mosaic.js');

Abi Bin Provider Usage

abiBinProvider = new Mosaic.AbiBinProvider();
jsonInterface = abiBinProvider.getABI('Organization');
contractBin = abiBinProvider.getBIN('Organization');

Using Setup Script

Please follow these steps in sequence.

Create setup instance

let originWeb3 = new Web3('http://127.0.0.1:8545');
let auxiliaryWeb3 = new Web3('http://127.0.0.1:8546');
let helper = new ChainSetup(originWeb3, auxiliaryWeb3);
let valueToken = "0x..."; /* EIP20 value token Contract Address deployed on origin chain */

Create configurations.

Make sure all deployer addresses, organization owner addresses and chainOwner have sufficient gas and are added to web3.eth.accounts.wallet of respective chains.

Define origin chain setup config

let originConfig = {
  gasPrice: '0x5B9ACA00',
  tokenOrganization: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    owner: "0x...", /* Address of owner key of Organization */
    admin: "0x...", /* Address of admin key of Organization */
    workers: ["0x..."] /* Address for Organized Workers */
  },
  anchorOrganization: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    owner: "0x...", /* Address of owner key of Organization */
    admin: "0x...", /* Address of admin key of Organization */
    workers: ["0x..."] /* Address for Organized Workers */
  },
  libs: {
    "deployer": "0x...",
  },
  anchor: {
    remoteChainId: '12345',
    "deployer": "0x...", /* Address of key that will deploy the contract */
    "organizationOwner": "0x..." /* Address of owner/admin key of Organization */
  },
  gateway: {
    "deployer": "0x...",
    "bounty": '1000000000000000000'
  }
};

Define auxiliary chain setup config.

let auxiliaryConfig = {
  gasPrice: '0',
  tokenOrganization: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    owner: "0x...", /* Address of owner key of Organization */
    admin: "0x...", /* Address of admin key of Organization */
    workers: ["0x..."] /* Address for Organized Workers */
  },
  ostPrime: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    chainOwner: config.chainOwner
  },
  anchorOrganization: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    owner: "0x...", /* Address of owner key of Organization */
    admin: "0x...", /* Address of admin key of Organization */
    workers: ["0x..."] /* Address for Organized Workers */
  },
  anchor: {
    remoteChainId: '12345', /* Origin chain-id */
    "deployer": "0x...", /* Address of key that will deploy the contract */
    organizationOwner: "0x..." /* Address of owner/admin key of Organization */
  },
  libs: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
  },
  cogateway: {
    "deployer": "0x...", /* Address of key that will deploy the contract */
    "bounty": '1000000000000000000'
  }
};

Executing setup. This may some time.

helper.setup(simpleToken, originConfig, auxiliaryConfig)
.then(function (output) {
  console.log("output", output);
})

About

Mosaic.js provides a web3 interface to scale DApps on Ethereum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%