1ī¸Installation And Deployment

Note that with Streamr you can deploy your data union via a frontend. See build a Data Union with Streamr for more information.

Installation

npm i @dataunions/client

Client Setup

import { DataUnionClient } from '@dataunions/client'

1ī¸âƒŖ Add your private key to the client. The address that deploys the contract will become the admin of the data union.

2ī¸âƒŖ Choose a desired EVM chain and add it to the chain parameter. We currently support Gnosis, Polygon and Ethereum.

ℹī¸ When integrating this into your application a wallet provider should be added instead of an environment variable with a private key.

const PRIVATE_KEY = process.env.PRIVATE_KEY;

const DU = new DataUnionClient({
  auth: {
    privateKey: PRIVATE_KEY,
  },
  chain: 'polygon',
});

Configure Your Data Union

1ī¸âƒŖ Add your desired deployment options. All of them are changeable after deployment by the admin/owner.

ℹī¸ Read more about the different values here: owner, joinPartAgent, adminFee, metadata

const deploymentOptions = {
    owner: YOUR_PUBLIC_KEY, // (default = deployer) Will be admin of the newly created data union
    joinPartAgents: /* By default set to owner and DUDAO address */, 
    adminFee: 0.3, // Must be between 0...1
    metadata: {
        "information": "related to your data union",
        "canBe": ["", "anything"]
    }
}

Deploy The Data Union

Save the contract address somewhere, you'll need it later. If you lost it you can find it in your transaction history on the block explorer of the chain you deployed on. Simply search for your public address, all the transactions will come up.

const dataUnion = await DU.deployDataUnion(
   deploymentOptions   
);

console.log("My data union contract address:", dataUnion.getAddress())

Last updated