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.
npm i @dataunions/client
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',
});
1️⃣ Add your desired deployment options. All of them are changeable after deployment by the admin/owner.
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"]
}
}
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 modified 11mo ago