Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #655 from symbol/dev
Browse files Browse the repository at this point in the history
Dev -> Main
  • Loading branch information
fboucquez authored Oct 31, 2021
2 parents 4b0cc96 + d949f24 commit 527dcfb
Show file tree
Hide file tree
Showing 44 changed files with 4,759 additions and 4,808 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.

The changelog format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [v2.3.7] - 31-Oct-2021

### Added

- Native HTTPS support by providing SSL certificates.
- `timestamp` in recipients payload.
- `timestamp` and `feeMultipler`in transactions payloads.

### Fixed

- Removed babel from local `catapult-sdk` module.
- Docker image migrated to ubuntu v20.04.

## [v2.3.6] - 24-May-2021

### Added
Expand Down
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM node:12.18.1-alpine
RUN apk add --update\
python \
python3 \
build-base \
zeromq-dev \
&& rm -rf /var/cache/apk/*
FROM ubuntu:20.04

RUN apt-get update && apt-get install -y curl \
&& curl -fsSL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs \
&& node --version \
&& npm --version \
&& npm install -g yarn

WORKDIR /app
COPY . /app/catapult-rest
RUN cd catapult-rest \
&& ./yarn_setup.sh
RUN cd catapult-rest/rest \
&& yarn build
RUN cd catapult-rest && ./yarn_setup.sh
WORKDIR /app/catapult-rest/rest
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Catapult REST gateway combines HTTP and WebSockets to perform read and write act

```
cd rest
yarn build
yarn bootstrap-start
```

Expand All @@ -48,7 +47,6 @@ Alternatively, you can run bootstrap in `detached` mode to avoid opening a new t

```
cd rest
yarn build
yarn bootstrap-start-detached
yarn start:dev
yarn bootstrap-stop
Expand All @@ -58,7 +56,6 @@ Useful for test automation:

```
cd rest
yarn build
yarn bootstrap-start-detached
yarn test
yarn bootstrap-stop
Expand Down
8 changes: 0 additions & 8 deletions catapult-sdk/.babelrc

This file was deleted.

16 changes: 4 additions & 12 deletions catapult-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@
"name": "catapult-sdk",
"version": "0.0.0",
"description": "Catapult SDK core",
"main": "_build/index.js",
"main": "src/index.js",
"scripts": {
"clean": "rimraf _build && mkdir _build && rimraf _build_browser && mkdir _build_browser",
"build": "ncp src/ _build && cross-env BABEL_ENV=production babel src -d _build_browser --source-maps",
"rebuild": "npm run clean && npm run build",
"test": "mocha --full-trace --recursive",
"test:coverage": "nyc npm test && nyc report --reporter=text-lcov",
"test:jenkins": "cross-env JUNIT_REPORT_PATH=test-results.xml mocha --reporter mocha-jenkins-reporter --forbid-only --full-trace --recursive test || exit 0",
Expand All @@ -19,22 +16,17 @@
"author": "",
"license": "ISC",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-plugin-transform-inline-environment-variables": "^6.8.0",
"babel-preset-env": "^1.7.0",
"chai": "^4.2.0",
"coveralls": "^3.0.9",
"coveralls": "^3.1.1",
"cross-env": "^5.2.0",
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"mocha": "^6.1.4",
"mocha-jenkins-reporter": "^0.4.3",
"ncp": "^2.0.0",
"mocha": "^9.1.0",
"mocha-jenkins-reporter": "^0.4.6",
"nyc": "^14.1.1",
"rimraf": "^2.6.3"
},
Expand Down
8 changes: 5 additions & 3 deletions catapult-sdk/src/model/ModelSchemaBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ModelSchemaBuilder {
transactionsHash: ModelType.binary,
receiptsHash: ModelType.binary,
stateHash: ModelType.binary,
beneficiaryAddress: ModelType.binary,
beneficiaryAddress: ModelType.encodedAddress,
feeMultiplier: ModelType.uint32,
// optional. How to create subclasses?
votingEligibleAccountsCount: ModelType.uint32,
Expand Down Expand Up @@ -135,7 +135,9 @@ class ModelSchemaBuilder {
height: ModelType.uint64,
hash: ModelType.binary,
merkleComponentHash: ModelType.binary,
index: ModelType.int
index: ModelType.int,
timestamp: ModelType.uint64,
feeMultiplier: ModelType.uint32
},
transactionWithMetadata: {
id: ModelType.objectId,
Expand Down Expand Up @@ -169,7 +171,7 @@ class ModelSchemaBuilder {
},
account: {
version: ModelType.uint16,
address: ModelType.binary,
address: ModelType.encodedAddress,
addressHeight: ModelType.uint64,
publicKey: ModelType.binary,
publicKeyHeight: ModelType.uint64,
Expand Down
7 changes: 5 additions & 2 deletions catapult-sdk/src/model/ModelType.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,13 @@ const ModelType = {
int: SchemaType.max + 10,

/** Schema property type indicating a boolean value. */
boolean: SchemaType.max + 11
boolean: SchemaType.max + 11,

/** Schema property type indicating a binary value as base32Address. */
encodedAddress: SchemaType.max + 12
};

Object.assign(ModelType, SchemaType);
ModelType.max = ModelType.boolean;
ModelType.max = ModelType.encodedAddress;

module.exports = ModelType;
2 changes: 1 addition & 1 deletion catapult-sdk/src/plugins/lockHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const lockHashPlugin = {
});
builder.addSchema('hashLockInfo.lock', {
version: ModelType.uint16,
ownerAddress: ModelType.binary,
ownerAddress: ModelType.encodedAddress,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64,
endHeight: ModelType.uint64,
Expand Down
8 changes: 4 additions & 4 deletions catapult-sdk/src/plugins/lockSecret.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ const lockSecretPlugin = {
});
builder.addSchema('secretLockInfo.lock', {
version: ModelType.uint16,
ownerAddress: ModelType.binary,
ownerAddress: ModelType.encodedAddress,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64,
endHeight: ModelType.uint64,
status: ModelType.uint8,
hashAlgorithm: ModelType.uint8,
secret: ModelType.binary,
recipientAddress: ModelType.binary,
recipientAddress: ModelType.encodedAddress,
compositeHash: ModelType.binary
});

builder.addTransactionSupport(EntityType.secretLock, {
recipientAddress: ModelType.binary,
recipientAddress: ModelType.encodedAddress,
secret: ModelType.binary,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64,
Expand All @@ -59,7 +59,7 @@ const lockSecretPlugin = {
});
builder.addTransactionSupport(EntityType.secretProof, {
secret: ModelType.binary,
recipientAddress: ModelType.binary,
recipientAddress: ModelType.encodedAddress,
proof: ModelType.binary,
hashAlgorithm: ModelType.uint8
});
Expand Down
10 changes: 5 additions & 5 deletions catapult-sdk/src/plugins/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ const constants = { sizes };
const metadataPlugin = {
registerSchema: builder => {
builder.addTransactionSupport(EntityType.accountMetadata, {
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
scopedMetadataKey: ModelType.uint64HexIdentifier,
valueSizeDelta: ModelType.int,
valueSize: ModelType.uint16,
value: ModelType.binary
});

builder.addTransactionSupport(EntityType.mosaicMetadata, {
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
scopedMetadataKey: ModelType.uint64HexIdentifier,
targetMosaicId: ModelType.uint64HexIdentifier,
valueSizeDelta: ModelType.int,
Expand All @@ -51,7 +51,7 @@ const metadataPlugin = {
});

builder.addTransactionSupport(EntityType.namespaceMetadata, {
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
scopedMetadataKey: ModelType.uint64HexIdentifier,
targetNamespaceId: ModelType.uint64HexIdentifier,
valueSizeDelta: ModelType.int,
Expand All @@ -67,8 +67,8 @@ const metadataPlugin = {
builder.addSchema('metadataEntry', {
version: ModelType.uint16,
compositeHash: ModelType.binary,
sourceAddress: ModelType.binary,
targetAddress: ModelType.binary,
sourceAddress: ModelType.encodedAddress,
targetAddress: ModelType.encodedAddress,
scopedMetadataKey: ModelType.uint64HexIdentifier,
targetId: ModelType.uint64HexIdentifier,
metadataType: ModelType.int,
Expand Down
2 changes: 1 addition & 1 deletion catapult-sdk/src/plugins/mosaic.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const mosaicPlugin = {
id: ModelType.uint64HexIdentifier,
supply: ModelType.uint64,
startHeight: ModelType.uint64,
ownerAddress: ModelType.binary,
ownerAddress: ModelType.encodedAddress,
revision: ModelType.int,
flags: ModelType.uint8,
divisibility: ModelType.uint8,
Expand Down
10 changes: 5 additions & 5 deletions catapult-sdk/src/plugins/multisig.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ const multisigPlugin = {
builder.addTransactionSupport(EntityType.modifyMultisigAccount, {
minRemovalDelta: ModelType.int,
minApprovalDelta: ModelType.int,
addressAdditions: { type: ModelType.array, schemaName: ModelType.binary },
addressDeletions: { type: ModelType.array, schemaName: ModelType.binary }
addressAdditions: { type: ModelType.array, schemaName: ModelType.encodedAddress },
addressDeletions: { type: ModelType.array, schemaName: ModelType.encodedAddress }
});

builder.addSchema('multisigEntry', {
multisig: { type: ModelType.object, schemaName: 'multisigEntry.multisig' }
});
builder.addSchema('multisigEntry.multisig', {
version: ModelType.uint16,
accountAddress: ModelType.binary,
accountAddress: ModelType.encodedAddress,
minApproval: ModelType.int,
minRemoval: ModelType.int,
multisigAddresses: { type: ModelType.array, schemaName: ModelType.binary },
cosignatoryAddresses: { type: ModelType.array, schemaName: ModelType.binary }
multisigAddresses: { type: ModelType.array, schemaName: ModelType.encodedAddress },
cosignatoryAddresses: { type: ModelType.array, schemaName: ModelType.encodedAddress }
});
builder.addSchema('multisigGraph', {
level: ModelType.none,
Expand Down
8 changes: 4 additions & 4 deletions catapult-sdk/src/plugins/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const namespacePlugin = {
registerSchema: builder => {
builder.addTransactionSupport(EntityType.aliasAddress, {
namespaceId: ModelType.uint64HexIdentifier,
address: ModelType.binary,
address: ModelType.encodedAddress,
aliasAction: ModelType.uint8
});

Expand Down Expand Up @@ -91,7 +91,7 @@ const namespacePlugin = {
alias: { type: ModelType.object, schemaName: entity => getAliasBasicType(entity.type) },

parentId: ModelType.uint64HexIdentifier,
ownerAddress: ModelType.binary,
ownerAddress: ModelType.encodedAddress,

startHeight: ModelType.uint64,
endHeight: ModelType.uint64
Expand All @@ -104,7 +104,7 @@ const namespacePlugin = {

builder.addSchema('namespaceDescriptor.alias.address', {
type: ModelType.uint8,
address: ModelType.binary
address: ModelType.encodedAddress
});

builder.addSchema('namespaceDescriptor.alias.empty', {
Expand All @@ -131,7 +131,7 @@ const namespacePlugin = {
});

builder.addSchema('accountNamesTuple', {
address: ModelType.binary,
address: ModelType.encodedAddress,
names: { type: ModelType.array, schemaName: ModelType.string }
});
},
Expand Down
15 changes: 10 additions & 5 deletions catapult-sdk/src/plugins/receipts.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ const receiptsPlugin = {
const schemaName = `${statementType}Statement`;
builder.addSchema(schemaName, {
id: ModelType.objectId,
meta: { type: ModelType.object, schemaName: 'statement.meta' },
statement: { type: ModelType.object, schemaName: `${schemaName}.statement` }
});
builder.addSchema(`${schemaName}.statement`, schema);
};

addStatementSchema('addressResolution', {
height: ModelType.uint64,
unresolved: ModelType.binary,
unresolved: ModelType.encodedAddress,
resolutionEntries: { type: ModelType.array, schemaName: 'receipts.entry.address' }
});
addStatementSchema('mosaicResolution', {
Expand All @@ -64,10 +65,14 @@ const receiptsPlugin = {
receipts: { type: ModelType.array, schemaName: entity => getBasicReceiptType(entity.type) }
});

builder.addSchema('statement.meta', {
timestamp: ModelType.uint64
});

// addressResolution statements
builder.addSchema('receipts.entry.address', {
source: { type: ModelType.object, schemaName: 'receipts.source' },
resolved: ModelType.binary
resolved: ModelType.encodedAddress
});

// mosaicResolution statements
Expand All @@ -80,16 +85,16 @@ const receiptsPlugin = {
builder.addSchema('receipts.balanceChange', {
version: ModelType.int,
type: ModelType.int,
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64
});

builder.addSchema('receipts.balanceTransfer', {
version: ModelType.int,
type: ModelType.int,
senderAddress: ModelType.binary,
recipientAddress: ModelType.binary,
senderAddress: ModelType.encodedAddress,
recipientAddress: ModelType.encodedAddress,
mosaicId: ModelType.uint64HexIdentifier,
amount: ModelType.uint64
});
Expand Down
6 changes: 3 additions & 3 deletions catapult-sdk/src/plugins/restrictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const restrictionsPlugin = {
});
builder.addSchema('accountRestriction.restrictions', {
version: ModelType.uint16,
address: ModelType.binary,
address: ModelType.encodedAddress,
restrictions: {
type: ModelType.array,
schemaName: entity => {
Expand All @@ -148,7 +148,7 @@ const restrictionsPlugin = {
builder.addTransactionSupport(EntityType.mosaicRestrictionAddress, {
mosaicId: ModelType.uint64HexIdentifier,
restrictionKey: ModelType.uint64HexIdentifier,
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
previousRestrictionValue: ModelType.uint64,
newRestrictionValue: ModelType.uint64
});
Expand All @@ -174,7 +174,7 @@ const restrictionsPlugin = {
compositeHash: ModelType.binary,
entryType: ModelType.uint32,
mosaicId: ModelType.uint64HexIdentifier,
targetAddress: ModelType.binary,
targetAddress: ModelType.encodedAddress,
restrictions: { type: ModelType.array, schemaName: 'mosaicRestrictions.entry.restrictions' }
});
builder.addSchema('mosaicRestrictions.entry.restrictions', {
Expand Down
Loading

0 comments on commit 527dcfb

Please sign in to comment.