Skip to content

Commit

Permalink
refactor(core-magistrate-crypto): consolidate bridgechain schem… (#3143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemii authored and faustbrian committed Oct 27, 2019
1 parent 2c619ae commit deef78d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Transactions, Utils } from "@arkecosystem/crypto";
import ByteBuffer from "bytebuffer";
import { MagistrateTransactionGroup, MagistrateTransactionStaticFees, MagistrateTransactionType } from "../enums";
import { IBridgechainRegistrationAsset } from "../interfaces";
import { seedNodesSchema } from "./utils/bridgechain-schemas";
import { bridgechainSchema } from "./utils/bridgechain-schema";

const { schemas } = Transactions;

Expand All @@ -28,25 +28,7 @@ export class BridgechainRegistrationTransaction extends Transactions.Transaction
type: "object",
required: ["name", "seedNodes", "genesisHash", "bridgechainRepository"],
additionalProperties: false,
properties: {
name: {
type: "string",
minLength: 1,
maxLength: 40,
},
seedNodes: seedNodesSchema,
genesisHash: {
type: "string",
minLength: 64,
maxLength: 64,
$ref: "transactionId",
},
bridgechainRepository: {
type: "string",
minLength: 1,
maxLength: 100,
},
},
properties: bridgechainSchema,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ByteBuffer from "bytebuffer";
import Long from "long";
import { MagistrateTransactionGroup, MagistrateTransactionStaticFees, MagistrateTransactionType } from "../enums";
import { IBridgechainUpdateAsset } from "../interfaces";
import { seedNodesSchema } from "./utils/bridgechain-schemas";
import { bridgechainSchema } from "./utils/bridgechain-schema";

const { schemas } = Transactions;

Expand All @@ -27,10 +27,7 @@ export class BridgechainUpdateTransaction extends Transactions.Transaction {
bridgechainUpdate: {
type: "object",
required: ["bridgechainId", "seedNodes"],
properties: {
bridgechainId: { type: "integer", minimum: 1 },
seedNodes: seedNodesSchema,
},
properties: bridgechainSchema,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export const bridgechainSchema = {
bridgechainId: {
type: "integer",
minimum: 1,
},
name: {
type: "string",
minLength: 1,
maxLength: 40,
},
seedNodes: {
type: "array",
minItems: 1,
maxItems: 10,
uniqueItems: true,
items: {
type: "string",
format: "peer",
},
},
genesisHash: {
type: "string",
minLength: 64,
maxLength: 64,
$ref: "transactionId",
},
bridgechainRepository: {
type: "string",
minLength: 1,
maxLength: 100,
},
};

This file was deleted.

0 comments on commit deef78d

Please sign in to comment.