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" ...@@ -20,35 +20,79 @@ import {BlockDTO} from "../../dto/BlockDTO"
export class BlockParser extends GenericParser { export class BlockParser extends GenericParser {
constructor() { constructor() {
super([ super(
{prop: "version", regexp: CommonConstants.BLOCK.VERSION}, [
{prop: "type", regexp: CommonConstants.BLOCK.TYPE}, { prop: "version", regexp: CommonConstants.BLOCK.VERSION },
{prop: "currency", regexp: CommonConstants.BLOCK.CURRENCY}, { prop: "type", regexp: CommonConstants.BLOCK.TYPE },
{prop: "number", regexp: CommonConstants.BLOCK.BNUMBER}, { prop: "currency", regexp: CommonConstants.BLOCK.CURRENCY },
{prop: "powMin", regexp: CommonConstants.BLOCK.POWMIN}, { prop: "number", regexp: CommonConstants.BLOCK.BNUMBER },
{prop: "time", regexp: CommonConstants.BLOCK.TIME}, { prop: "powMin", regexp: CommonConstants.BLOCK.POWMIN },
{prop: "medianTime", regexp: CommonConstants.BLOCK.MEDIAN_TIME}, { prop: "time", regexp: CommonConstants.BLOCK.TIME },
{prop: "dividend", regexp: CommonConstants.BLOCK.UD}, { prop: "medianTime", regexp: CommonConstants.BLOCK.MEDIAN_TIME },
{prop: "unitbase", regexp: CommonConstants.BLOCK.UNIT_BASE}, { prop: "dividend", regexp: CommonConstants.BLOCK.UD },
{prop: "issuer", regexp: CommonConstants.BLOCK.BLOCK_ISSUER}, { prop: "unitbase", regexp: CommonConstants.BLOCK.UNIT_BASE },
{prop: "issuersFrame", regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME}, { prop: "issuer", regexp: CommonConstants.BLOCK.BLOCK_ISSUER },
{prop: "issuersFrameVar", regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME_VAR}, {
{prop: "issuersCount", regexp: CommonConstants.BLOCK.DIFFERENT_ISSUERS_COUNT}, prop: "issuersFrame",
{prop: "parameters", regexp: CommonConstants.BLOCK.PARAMETERS}, regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME,
{prop: "previousHash", regexp: CommonConstants.BLOCK.PREV_HASH}, },
{prop: "previousIssuer", regexp: CommonConstants.BLOCK.PREV_ISSUER}, {
{prop: "membersCount", regexp: CommonConstants.BLOCK.MEMBERS_COUNT}, prop: "issuersFrameVar",
{prop: "identities", regexp: /Identities:\n([\s\S]*)Joiners/, parser: splitAndMatch('\n', CommonConstants.IDENTITY.INLINE)}, regexp: CommonConstants.BLOCK.BLOCK_ISSUERS_FRAME_VAR,
{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: "issuersCount",
{prop: "revoked", regexp: /Revoked:\n([\s\S]*)Excluded/, parser: splitAndMatch('\n', CommonConstants.BLOCK.REVOCATION)}, regexp: CommonConstants.BLOCK.DIFFERENT_ISSUERS_COUNT,
{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: "parameters", regexp: CommonConstants.BLOCK.PARAMETERS },
{prop: "transactions", regexp: /Transactions:\n([\s\S]*)/, parser: extractTransactions}, { prop: "previousHash", regexp: CommonConstants.BLOCK.PREV_HASH },
{prop: "inner_hash", regexp: CommonConstants.BLOCK.INNER_HASH}, { prop: "previousIssuer", regexp: CommonConstants.BLOCK.PREV_ISSUER },
{prop: "nonce", regexp: CommonConstants.BLOCK.NONCE} { prop: "membersCount", regexp: CommonConstants.BLOCK.MEMBERS_COUNT },
], rawer.getBlock) {
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) { _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