Skip to content

Commit

Permalink
Merge pull request #71 from nemgrouplimited/dev
Browse files Browse the repository at this point in the history
Release v1.0.0
  • Loading branch information
AnthonyLaw authored Mar 14, 2021
2 parents c17f875 + 8c8cc16 commit 222aecd
Show file tree
Hide file tree
Showing 7 changed files with 8,828 additions and 8,740 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ 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/).

## [1.0.0] - 14-Mar-2021

### Milestone: [[email protected]](https://github.com/nemtech/catapult-server/releases/tag/v1.0.0.0)

Package | Version | Link
---|---|---
REST Core| v2.3.4 | [catapult-rest](https://github.com/nemtech/catapult-rest/releases/tag/v2.3.4)
SDK Core| v1.0.0 | [symbol-sdk](https://www.npmjs.com/package/symbol-sdk)

- Mainnet launch.

## [0.5.0] - 16-Jan-2021

### Milestone: [[email protected]](https://github.com/nemtech/catapult-server/releases/tag/v0.10.0.5)
Expand Down Expand Up @@ -85,3 +96,8 @@ symbol-sdk| v0.17.3 | https://www.npmjs.com/package/symbol-sdk
- Added rebrand to Symbol.
- Added symbol icon, images, and color.
- Changed the footer to match the explorer.


[[email protected]]: https://github.com/nemtech/catapult-server/releases/tag/v1.0.0.0

[[email protected]]: https://github.com/nemtech/catapult-rest/releases/tag/v2.3.4
17,384 changes: 8,711 additions & 8,673 deletions package-lock.json

Large diffs are not rendered by default.

87 changes: 45 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "symbol-faucet",
"version": "0.5.1",
"version": "1.0.0",
"description": "Symbol faucet web application",
"author": "Yoshiyuki Ieyama",
"homepage": "https://github.com/44uk/symbol-faucet",
Expand Down Expand Up @@ -29,78 +29,81 @@
"url": "https://github.com/44uk/symbol-faucet.git"
},
"dependencies": {
"@nuxt/typescript-runtime": "^0.4.5",
"@nuxtjs/axios": "^5.9.7",
"@nuxt/typescript-runtime": "^0.4.10",
"@nuxtjs/axios": "^5.13.1",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/recaptcha": "^0.6.2",
"@types/express-serve-static-core": "^4.17.5",
"@types/lodash": "^4.14.150",
"@types/node": "^13.13.1",
"@types/express-serve-static-core": "^4.17.18",
"@types/lodash": "^4.14.168",
"@types/node": "^13.13.45",
"body-parser": "^1.19.0",
"bootstrap": "^4.4.1",
"bootstrap-vue": "^2.12.0",
"bufferutil": "^4.0.1",
"cross-env": "^7.0.2",
"bootstrap": "^4.6.0",
"bootstrap-vue": "^2.21.2",
"bufferutil": "^4.0.3",
"cross-env": "^7.0.3",
"express": "^4.17.1",
"fs": "0.0.2",
"js-joda": "^1.11.0",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"net": "^1.0.2",
"nuxt": "^2.12.2",
"nuxt-buefy": "^0.3.26",
"nuxt": "^2.15.2",
"nuxt-buefy": "^0.3.31",
"nuxt-ts": "^2.8.1",
"pug": "^2.0.4",
"pug-loader": "^2.4.0",
"pug-plain-loader": "^1.0.0",
"querystring": "^0.2.0",
"stylus": "^0.54.7",
"pug-plain-loader": "^1.1.0",
"querystring": "^0.2.1",
"stylus": "^0.54.8",
"stylus-loader": "^3.0.2",
"symbol-sdk": "^0.23.0",
"symbol-sdk": "^0.23.3",
"tls": "0.0.1",
"tsconfig-paths": "^3.9.0",
"utf-8-validate": "^5.0.2",
"utf-8-validate": "^5.0.4",
"utf8": "^3.0.0",
"vue-material-design-icons": "^4.4.0",
"vue-property-decorator": "^8.4.0"
"vue": "^2.6.12",
"vue-material-design-icons": "^4.11.0",
"vue-property-decorator": "^8.5.1",
"vue-server-renderer": "^2.6.12"
},
"devDependencies": {
"@nuxt/typescript": "^2.8.1",
"@nuxt/typescript-build": "^0.6.5",
"@nuxt/typescript-build": "^0.6.7",
"@nuxtjs/eslint-config": "^2.0.2",
"@types/babel-core": "6.25.6",
"@types/body-parser": "^1.19.0",
"@types/eslint": "^6.8.0",
"@types/eslint": "^6.8.1",
"@types/eslint-plugin-prettier": "3.1.0",
"@types/express": "^4.17.6",
"@types/express": "^4.17.11",
"@types/nodemon": "^1.19.0",
"@types/prettier": "2.0.0",
"@types/pug": "^2.0.4",
"@types/stylus": "^0.48.32",
"@types/stylus": "^0.48.33",
"@types/url-parse": "^1.4.3",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@vue/test-utils": "^1.0.0-beta.31",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@vue/test-utils": "^1.1.3",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "^10.1.0",
"babel-jest": "^25.4.0",
"babel-jest": "^25.5.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-config-standard": ">=14.1.1",
"eslint-loader": "^4.0.0",
"eslint-plugin-import": ">=2.20.2",
"eslint-plugin-jest": ">=23.8.2",
"eslint-config-prettier": "^6.15.0",
"eslint-config-standard": "^16.0.2",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.1.9",
"eslint-plugin-node": ">=11.1.0",
"eslint-plugin-nuxt": ">=0.5.2",
"eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "3.1.3",
"eslint-plugin-promise": ">=4.2.1",
"eslint-plugin-standard": ">=4.0.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^6.2.1",
"jest": "^25.1.0",
"jest": "^25.5.4",
"node-sass": "^4.14.1",
"nodemon": "^2.0.4",
"prettier": "^2.1.2",
"nodemon": "^2.0.7",
"prettier": "^2.2.1",
"sass-loader": "^8.0.2",
"symbol-bootstrap": "^0.1.2-alpha-202010121756",
"ts-node": "^8.6.2",
"url-parse": "^1.4.7",
"vue-jest": "^3.0.5"
"symbol-bootstrap": "^0.1.2",
"ts-node": "^8.10.2",
"url-parse": "^1.5.1",
"vue-jest": "^3.0.7"
}
}
2 changes: 1 addition & 1 deletion server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Config: IConfig = {
FAUCET_PRIVATE_KEY: FAUCET_PRIVATE_KEY || '9C8B1DEFDB700E8DA2834346E613E98D4C610093892B7E1AA39288C93709A462',
NATIVE_CURRENCY_OUT_MIN: parseInt(NATIVE_CURRENCY_OUT_MIN || '') || 100000000,
NATIVE_CURRENCY_OUT_MAX: parseInt(NATIVE_CURRENCY_OUT_MAX || '') || 500000000,
MAX_FEE: parseFloat(MAX_FEE || '') || 5000000,
MAX_FEE: parseFloat(MAX_FEE || '0') || 0,
MAX_UNCONFIRMED: parseInt(MAX_UNCONFIRMED || '') || 99,
MAX_BALANCE: parseInt(ENOUGH_BALANCE || '') || 100000000000,
BLACKLIST_MOSAICIDS: helper.stringToArray(BLACKLIST_MOSAIC_IDS),
Expand Down
28 changes: 21 additions & 7 deletions server/handlers/claims.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
UInt64,
EmptyMessage,
TransferTransaction,
Transaction,
Deadline,
MosaicId,
TransactionType,
Expand Down Expand Up @@ -150,13 +151,26 @@ export const claimsHandler = (appConfig: IApp) => {
return new Mosaic(mosaic.id, UInt64.fromUint(randomAmount));
});

const transaction = TransferTransaction.create(
Deadline.create(epochAdjustment),
recipientAddress,
requestedMosicList,
EmptyMessage,
networkType,
).setMaxFee(feeMultiplier > 0 ? feeMultiplier : 1000);
let transaction: Transaction;

if (config.MAX_FEE > 0) {
transaction = TransferTransaction.create(
Deadline.create(epochAdjustment),
recipientAddress,
requestedMosicList,
EmptyMessage,
networkType,
UInt64.fromUint(config.MAX_FEE),
);
} else {
transaction = TransferTransaction.create(
Deadline.create(epochAdjustment),
recipientAddress,
requestedMosicList,
EmptyMessage,
networkType,
).setMaxFee(feeMultiplier);
}

const transferMosaics = requestedMosicList.map((mosaic) => {
const mosaicName: any = requestMosaicName.find((mosaicName) => mosaicName.mosaicId.equals(mosaic.id));
Expand Down
38 changes: 28 additions & 10 deletions server/handlers/faucet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ServerMiddleware } from '@nuxt/types';
import { MosaicId, NamespaceId, UnresolvedMosaicId } from 'symbol-sdk';
import { MosaicId, NamespaceId, UnresolvedMosaicId, MosaicInfo } from 'symbol-sdk';
import Url from 'url-parse';
import { IApp } from '../app';
import helper from '../helper';
Expand Down Expand Up @@ -59,20 +59,38 @@ export const faucetHandler = (appConfig: IApp): ServerMiddleware => {
const mosaicIds = mosaics.map((mosaic) => mosaic.id);

// Gets mosaics info and mosaice namespace
const [mosaicInfos, mosaicNames] = await Promise.all([
const [mosaicInfos, mosaicNames, chainInfo] = await Promise.all([
repositoryFactory.createMosaicRepository().getMosaics(mosaicIds).toPromise(),
repositoryFactory.createNamespaceRepository().getMosaicsNames(mosaicIds).toPromise(),
repositoryFactory.createChainRepository().getChainInfo().toPromise(),
]);

const balance: Ibalance[] = mosaics.map((mosaic) => {
let mosaicInfo: any = mosaicInfos.find((info) => info.id.equals(mosaic.id));
const balance: Ibalance[] = [];

return {
mosaicId: mosaic.id.toHex(),
amount: helper.toRelativeAmount(mosaic.amount.compact(), mosaicInfo.divisibility),
mosaicAliasName: helper.extractMosaicNamespace(mosaicInfo, mosaicNames),
};
});
for (const mosaic of mosaics) {
let mosaicInfo: MosaicInfo | undefined = mosaicInfos.find((info) => info.id.equals(mosaic.id));

if (!mosaicInfo) return;

// Filter native mosaic
if (Number(mosaicInfo.duration.toString()) === 0)
balance.push({
mosaicId: mosaic.id.toHex(),
amount: helper.toRelativeAmount(mosaic.amount.compact(), mosaicInfo.divisibility),
mosaicAliasName: helper.extractMosaicNamespace(mosaicInfo, mosaicNames),
});

// Filter non expired mosaics
if (
Number(chainInfo.height.toString()) <
Number(mosaicInfo.startHeight.toString()) + Number(mosaicInfo.duration.toString())
)
balance.push({
mosaicId: mosaic.id.toHex(),
amount: helper.toRelativeAmount(mosaic.amount.compact(), mosaicInfo.divisibility),
mosaicAliasName: helper.extractMosaicNamespace(mosaicInfo, mosaicNames),
});
}

// Filter black list mosaics from the account balance.
const faucetBalance: Ibalance[] = balance.filter((mosaic) => !networkInfo.blackListMosaicIds.includes(mosaic.mosaicId));
Expand Down
13 changes: 6 additions & 7 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import axios from 'axios';
import { Listener, Address, RepositoryFactoryHttp } from 'symbol-sdk';
import Vue from 'vue';

export const state = () => ({
filterMosaics: [],
Expand Down Expand Up @@ -47,15 +46,15 @@ export const actions = {
context.commit('setTransactionHash', res.data.txHash);

res.data.mosaics.map((mosaic) => {
Vue.prototype.$nuxt.$makeToast('info', `Mosaic: ${mosaic.name} - Amount: ${mosaic.amount}`);
window.$nuxt.$makeToast('info', `Mosaic: ${mosaic.name} - Amount: ${mosaic.amount}`);
});
Vue.prototype.$nuxt.$makeToast('info', `Pending Transaction Hash: ${res.data.txHash}`, {
window.$nuxt.$makeToast('info', `Pending Transaction Hash: ${res.data.txHash}`, {
noAutoHide: true,
});
})
.catch((error) => {
console.debug(error);
Vue.prototype.$nuxt.$makeToast('warning', `${error.response.data.message}`); // Error!
window.$nuxt.$makeToast('warning', `${error.response.data.message}`); // Error!
});
},

Expand All @@ -70,14 +69,14 @@ export const actions = {

listener.unconfirmedAdded(recipient).subscribe((response) => {
if (context.getters.getTransactionHash === response.transactionInfo.hash) {
Vue.prototype.$nuxt.$makeToast('success', `Your request is being processed.`);
window.$nuxt.$makeToast('success', `Your request is being processed.`);
}
});

listener.confirmed(recipient).subscribe((response) => {
if (context.getters.getTransactionHash === response.transactionInfo.hash) {
Vue.prototype.$nuxt.$makeToast('success', `Your request has been processed.`);
Vue.prototype.$nuxt.$makeToast('success', `View transaction in explorer.`, {
window.$nuxt.$makeToast('success', `Your request has been processed.`);
window.$nuxt.$makeToast('success', `View transaction in explorer.`, {
noAutoHide: true,
href: `${networkInfo.explorerUrl}transactions/${response.transactionInfo.hash}`,
});
Expand Down

0 comments on commit 222aecd

Please sign in to comment.