1ī¸Installation And Deployment
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
Was this helpful?