Skip to content
Snippets Groups Projects
Commit cf749106 authored by Cédric Moreau's avatar Cédric Moreau Committed by Hugo Trentesaux
Browse files

fix: keyword "Certifications" can now safely be used in a TX comment

parent 56c986b7
No related branches found
No related tags found
No related merge requests found
......@@ -20,35 +20,79 @@ import {BlockDTO} from "../../dto/BlockDTO"
export class BlockParser extends GenericParser {
constructor() {
super([
{prop: "version", regexp: CommonConstants.BLOCK.VERSION},
{prop: "type", regexp: CommonConstants.BLOCK.TYPE},
{prop: "currency", regexp: CommonConstants.BLOCK.CURRENCY},
{prop: "number", regexp: CommonConstants.BLOCK.BNUMBER},
{prop: "powMin", regexp: CommonConstants.BLOCK.POWMIN},
{prop: "time", regexp: CommonConstants.BLOCK.TIME},
{prop: "medianTime", regexp: CommonConstants.BLOCK.MEDIAN_TIME},
{prop: "dividend", regexp: CommonConstants.BLOCK.UD},
{prop: "unitbase", regexp: CommonConstants.BLOCK.UNIT_BASE},
{prop: "issuer", regexp: CommonConstants.BLOCK.BLOCK_ISSUER},
{prop: "issuersFrame", regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME},
{prop: "issuersFrameVar", regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME_VAR},
{prop: "issuersCount", regexp: CommonConstants.BLOCK.DIFFERENT_ISSUERS_COUNT},
{prop: "parameters", regexp: CommonConstants.BLOCK.PARAMETERS},
{prop: "previousHash", regexp: CommonConstants.BLOCK.PREV_HASH},
{prop: "previousIssuer", regexp: CommonConstants.BLOCK.PREV_ISSUER},
{prop: "membersCount", regexp: CommonConstants.BLOCK.MEMBERS_COUNT},
{prop: "identities", regexp: /Identities:\n([\s\S]*)Joiners/, parser: splitAndMatch('\n', CommonConstants.IDENTITY.INLINE)},
{prop: "joiners", regexp: /Joiners:\n([\s\S]*)Actives/, parser: splitAndMatch('\n', CommonConstants.BLOCK.JOINER)},
{prop: "actives", regexp: /Actives:\n([\s\S]*)Leavers/, parser: splitAndMatch('\n', CommonConstants.BLOCK.ACTIVE)},
{prop: "leavers", regexp: /Leavers:\n([\s\S]*)Excluded/, parser: splitAndMatch('\n', CommonConstants.BLOCK.LEAVER)},
{prop: "revoked", regexp: /Revoked:\n([\s\S]*)Excluded/, parser: splitAndMatch('\n', CommonConstants.BLOCK.REVOCATION)},
{prop: "excluded", regexp: /Excluded:\n([\s\S]*)Certifications/, parser: splitAndMatch('\n', CommonConstants.PUBLIC_KEY)},
{prop: "certifications", regexp: /Certifications:\n([\s\S]*)Transactions/, parser: splitAndMatch('\n', CommonConstants.CERT.OTHER.INLINE)},
{prop: "transactions", regexp: /Transactions:\n([\s\S]*)/, parser: extractTransactions},
{prop: "inner_hash", regexp: CommonConstants.BLOCK.INNER_HASH},
{prop: "nonce", regexp: CommonConstants.BLOCK.NONCE}
], rawer.getBlock)
super(
[
{ prop: "version", regexp: CommonConstants.BLOCK.VERSION },
{ prop: "type", regexp: CommonConstants.BLOCK.TYPE },
{ prop: "currency", regexp: CommonConstants.BLOCK.CURRENCY },
{ prop: "number", regexp: CommonConstants.BLOCK.BNUMBER },
{ prop: "powMin", regexp: CommonConstants.BLOCK.POWMIN },
{ prop: "time", regexp: CommonConstants.BLOCK.TIME },
{ prop: "medianTime", regexp: CommonConstants.BLOCK.MEDIAN_TIME },
{ prop: "dividend", regexp: CommonConstants.BLOCK.UD },
{ prop: "unitbase", regexp: CommonConstants.BLOCK.UNIT_BASE },
{ prop: "issuer", regexp: CommonConstants.BLOCK.BLOCK_ISSUER },
{
prop: "issuersFrame",
regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME,
},
{
prop: "issuersFrameVar",
regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME_VAR,
},
{
prop: "issuersCount",
regexp: CommonConstants.BLOCK.DIFFERENT_ISSUERS_COUNT,
},
{ prop: "parameters", regexp: CommonConstants.BLOCK.PARAMETERS },
{ prop: "previousHash", regexp: CommonConstants.BLOCK.PREV_HASH },
{ prop: "previousIssuer", regexp: CommonConstants.BLOCK.PREV_ISSUER },
{ prop: "membersCount", regexp: CommonConstants.BLOCK.MEMBERS_COUNT },
{
prop: "identities",
regexp: /Identities:\n([\s\S]*)Joiners/,
parser: splitAndMatch("\n", CommonConstants.IDENTITY.INLINE),
},
{
prop: "joiners",
regexp: /Joiners:\n([\s\S]*)Actives/,
parser: splitAndMatch("\n", CommonConstants.BLOCK.JOINER),
},
{
prop: "actives",
regexp: /Actives:\n([\s\S]*)Leavers/,
parser: splitAndMatch("\n", CommonConstants.BLOCK.ACTIVE),
},
{
prop: "leavers",
regexp: /Leavers:\n([\s\S]*)Excluded/,
parser: splitAndMatch("\n", CommonConstants.BLOCK.LEAVER),
},
{
prop: "revoked",
regexp: /Revoked:\n([\s\S]*)Excluded/,
parser: splitAndMatch("\n", CommonConstants.BLOCK.REVOCATION),
},
{
prop: "excluded",
regexp: /Excluded:\n([\s\S]*?)Certifications/,
parser: splitAndMatch("\n", CommonConstants.PUBLIC_KEY),
},
{
prop: "certifications",
regexp: /Certifications:\n([\s\S]*)Transactions/,
parser: splitAndMatch("\n", CommonConstants.CERT.OTHER.INLINE),
},
{
prop: "transactions",
regexp: /Transactions:\n([\s\S]*)/,
parser: extractTransactions,
},
{ prop: "inner_hash", regexp: CommonConstants.BLOCK.INNER_HASH },
{ prop: "nonce", regexp: CommonConstants.BLOCK.NONCE },
],
rawer.getBlock
);
}
_clean(obj:any) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment