Join Server
Automate Member Joins With Our Default Join Server
Build Your Own Join Server
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
import { DataUnionClient } from '@dataunions/client';
const DU = new DataUnionClient({
auth: {
privateKey: PRIVATE_KEY_ADMIN,
},
// only if you don't want to use the default joinServer
joinServerUrl: "YOUR_CUSTOM_SERVER_URL"
chain: 'polygon',
});
const dataUnion = await DU.getDataUnion(
DATA_UNION_CONTRACT_ADDRESS
);
// -------- ADMIN ONLY FUNCTIONS --------
// returns an object with
// your secret string, secret_name, data union contract address and the chain
const sharedSecret = dataUnion.createSecret($custum_secret_name);
// list all your secrets
// typically there is one secret per data union
const sharedSecrets = dataUnion.listSecrets()
// -------- MEMBER FUNCTION --------
// your members can now join like this
// store the shared secret in an environment variable
const memberDetails = await dataUnion.join({
secret:process.env.SHARED_SECRET
});const DU = new DataUnionClient({
auth: WALLET_PROVIDER,
joinServerUrl: "yourURL", //add your custom joinServerUrl
chain: 'polygon',
});