Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@colony/colony-event-metadata-parser
Advanced tools
**Metadata format versions** ColonyDapp should support legacy Metadata formats. Therefore, when parsing (in ColonyDapp) it is necessary to check the Metadata format version and support V1 & later versions. ```ts const metadataVersion = getEventMetadataVer
Metadata format versions ColonyDapp should support legacy Metadata formats. Therefore, when parsing (in ColonyDapp) it is necessary to check the Metadata format version and support V1 & later versions.
const metadataVersion = getEventMetadataVersion(ipfsMetadata);
if (metadataVersion === 1) {
/*
* original metadata format
*/
...
}
else {
/*
* new metadata format
*/
....
}
Parsing To retrieve MetaData from IPFS. (String to Object)
// Colony MetaData
const colonyMetadata = getColonyMetadataFromResponse(ipfsDataJSON);
// Domain MetaData
const domainMetadata = getDomainMetadataFromResponse(ipfsDataJSON);
// Annotation Message
const annotation = getAnnotationMsgFromResponse(ipfsDataJSON);
/////////
// Get Avatar Image
//
// First get Colony Metadata
const colonyMetadata = getColonyMetadataFromResponse(ipfsMetadata);
// Then get IPFS response from avatarHash
avatarHash = colonyMetadata?.colonyAvatarHash;
response = await ipfs.getString(avatarHash);
// Finally, get the avatar image
avatarObject = { image: getColonyAvatarImage(response) };
/////////
// Generic Misc data
// An Agreement is used as example:
const response = await ipfsWithFallback.getString(agreementHash);
const agreement = getNameValueFromMisc('agreement', response);
Deserialising Preparing Metadata to send to IPFS. (Object to String)
// Colony Metadata packed and converted to string
const metadataForIPFS = getStringForMetadataColony({
colonyDisplayName,
colonyAvatarHash: colonyAvatarIpfsHash
colonyTokens,
verifiedAddresses,
isWhitelistActivated,
});
colonyMetadataIpfsHash = yield call(ipfsUpload, metadataForIPFS);
// Domain Metadata packed and converted to string
domainMetadataIpfsHash = yield call(
ipfsUpload,
getStringForMetadataDomain({
domainName,
domainColor,
domainPurpose,
}),
// Annotation message packed and converted to string
ipfsHash = yield call(
ipfsUpload,
getStringForMetadataAnnotation({
annotationMsg: annotationMessage || '',
}),
);
// ColonyAvatarImage packed and converted to string
colonyAvatarIpfsHash = yield call(
ipfsUpload,
getStringForColonyAvatarImage(colonyAvatarImage),
);
// Pack and convert string to be used in a MiscMetadata
// This example uploads a whitelist agreement to IPFS
let agreementHash = '';
if (payload.agreement) {
const miscMetadata = {
name: 'agreement',
value: payload?.agreement,
};
agreementHash = yield call(
ipfsUpload,
getStringForMetadataMisc(miscMetadata),
);
}
GPL-3.0
FAQs
**Metadata format versions** ColonyDapp should support legacy Metadata formats. Therefore, when parsing (in ColonyDapp) it is necessary to check the Metadata format version and support V1 & later versions. ```ts const metadataVersion = getEventMetadataVer
The npm package @colony/colony-event-metadata-parser receives a total of 11 weekly downloads. As such, @colony/colony-event-metadata-parser popularity was classified as not popular.
We found that @colony/colony-event-metadata-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.