diff --git a/mocks/waves-client-config/master/config.json b/mocks/waves-client-config/master/config.json index 074120b618..2f78c5b440 100644 --- a/mocks/waves-client-config/master/config.json +++ b/mocks/waves-client-config/master/config.json @@ -1,13 +1,15 @@ { "PERMISSIONS": { "CAN_TRANSFER_COINOMAT": [ - "BTC", - "ETH", - "LTC", - "ZEC", - "BCH", - "DASH", - "XMR" + "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS", + "474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu", + "HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk", + "BrjUWjndUanm5VsJkbUip8VRYy6LWJePtxya3FNv4TQa", + "zMFqXuoyrn5w17PFurTqxB7GsS71fp9dfk6XFwxbPCy", + "B3uGHFRpSUuGEDWjqB9LWWxafQj8VTvpMucEyoxzws5H", + "5WvPKSJXzVE2orvbkJ8wsQmmQKqTv9sGBPksV4adViw3", + "Ft8X1v1LTa1ABafufpaCWyVj8KkaxUWE6xBhW6sNFJck", + "Gtb1WRznfchDnTh37ezoDTJ4wcoKaRsKqKjJjy7nm2zU" ], "CAN_TRANSFER_TRANSACTION": true, "CAN_SET_ASSET_SCRIPT_TRANSACTION": true, @@ -56,5 +58,5 @@ ] } }, - "SERVICE_TEMPORARILY_UNAVAILABLE": true + "SERVICE_TEMPORARILY_UNAVAILABLE": false } diff --git a/mocks/waves-client-config/master/testnet.config.json b/mocks/waves-client-config/master/testnet.config.json new file mode 100644 index 0000000000..af47d7900c --- /dev/null +++ b/mocks/waves-client-config/master/testnet.config.json @@ -0,0 +1,53 @@ +{ + "PERMISSIONS": { + "CAN_TRANSFER_COINOMAT": [ + "DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn", + "BrmjyAWT5jjr3Wpsiyivyvg5vDuzoX2s93WgiexXetB3", + "BNdAstuFogzSyN2rY3beJbnBYwYcu7RzTHFjW88g8roK", + "CFg2KQfkUgUVM2jFCMC5Xh8T8zrebvPc4HjHPfAugU1S", + "8HT8tXwrXAYqwm8XrZ2hywWWTUAXxobHB5DakVC1y6jn", + "DGgBtwVoXKAKKvV2ayUpSoPzTJxt7jo9KiXMJRzTH2ET", + "8oPbSCKFHkXBy1hCGSg9pJkSARE7zhTQTLpc8KZwdtr7", + "D6N2rAqWN6ZCWnCeNFWLGqqjS6nJLeK4m19XiuhdDenr", + "AsuWyM9MUUsMmWkK7jS48L3ky6gA1pxx7QtEYPbfLjAJ" + ], + "CAN_TRANSFER_TRANSACTION": true, + "CAN_SET_ASSET_SCRIPT_TRANSACTION": true, + "CAN_MASS_TRANSFER_TRANSACTION": true, + "CAN_CREATE_ALIAS_TRANSACTION": true, + "CAN_ISSUE_TRANSACTION": true, + "CAN_REISSUE_TRANSACTION": true, + "CAN_SET_SCRIPT_TRANSACTION": true, + "CAN_LEASE_TRANSACTION": true, + "CAN_CANCEL_LEASE_TRANSACTION": true, + "CAN_BURN_TRANSACTION": true, + "CAN_SPONSORSHIP_TRANSACTION": true, + "CAN_DATA_TRANSACTION": true, + "CAN_CREATE_ORDER": true, + "CAN_CANCEL_ORDER": true, + "CAN_PAIRING_WITH_MOBILE": true, + "CAN_ANY_TRANSACTION": true + }, + "NOTIFICATIONS": [], + "SETTINGS": { + "DEX": { + "WATCH_LIST_PAIRS": [ + "WAVES", + "AsuWyM9MUUsMmWkK7jS48L3ky6gA1pxx7QtEYPbfLjAJ", + "D6N2rAqWN6ZCWnCeNFWLGqqjS6nJLeK4m19XiuhdDenr", + "DWgwcZTMhSvnyYCoWLRUXXSH1RSkzThXLJhww9gwkqdn", + "BrmjyAWT5jjr3Wpsiyivyvg5vDuzoX2s93WgiexXetB3", + "BNdAstuFogzSyN2rY3beJbnBYwYcu7RzTHFjW88g8roK", + "CFg2KQfkUgUVM2jFCMC5Xh8T8zrebvPc4HjHPfAugU1S", + "8HT8tXwrXAYqwm8XrZ2hywWWTUAXxobHB5DakVC1y6jn", + "7itsmgdmomeTXvZzaaxqF3346h4FhciRoWceEw9asNV3", + "DGgBtwVoXKAKKvV2ayUpSoPzTJxt7jo9KiXMJRzTH2ET", + "FvKx3cerSVYGfXKFvUgp7koNuTAcLs8DmtmwRrFVCqJv", + "3P8gkhcLhFQvBkDzMnWeqqwvq3qxkpTNQPs4LUQ95tKD", + "8oPbSCKFHkXBy1hCGSg9pJkSARE7zhTQTLpc8KZwdtr7", + "6KSUNALdYEd1EVTE4dTcSHzNw1dA3Q6ieokSRVuEcALV" + ] + } + }, + "SERVICE_TEMPORARILY_UNAVAILABLE": false +} \ No newline at end of file diff --git a/server.ts b/server.ts index 2cfe1d9ad4..a5982a01de 100644 --- a/server.ts +++ b/server.ts @@ -1,7 +1,7 @@ import { createSecureServer } from 'http2'; import { createServer } from 'https'; import { route, parseArguments, stat, loadLocales } from './ts-scripts/utils'; -import { readFileSync, existsSync,mkdirSync } from 'fs'; +import { readFileSync, existsSync, mkdirSync } from 'fs'; import { serialize, parse as parserCookie } from 'cookie'; import { compile } from 'handlebars'; import { parse } from 'url'; @@ -73,7 +73,7 @@ function createMyServer(port) { console.log('Available urls:'); console.log(url); const cachePath = join(process.cwd(), '.cache-download'); - if (!existsSync(cachePath)){ + if (!existsSync(cachePath)) { mkdirSync(cachePath); } loadLocales(cachePath); @@ -141,13 +141,20 @@ function request(req, res) { } function wavesClientConfig(req, res, next) { - if (!req.url.includes('waves-client-config')) { + const parsedCookie = parseCookie(req.headers.cookie); + const connection: string | null = parsedCookie ? parsedCookie.connection : null; + + if (!req.url.includes('waves-client-config') || !connection) { next(); return null; } let response_json = { error: 'oops' }; - const path = join(__dirname, 'mocks/waves-client-config/master/config.json'); + const path = join( + __dirname, + `mocks/waves-client-config/master/${connection === 'mainnet' ? '' : 'testnet.'}config.json` + ); + if (fs.existsSync(path)) { response_json = JSON.parse(fs.readFileSync(path, 'utf8')) || ''; } diff --git a/src/modules/utils/modals/sendAsset/components/singleSend/SingleSend.js b/src/modules/utils/modals/sendAsset/components/singleSend/SingleSend.js index afa1d235c6..1fabd92f54 100644 --- a/src/modules/utils/modals/sendAsset/components/singleSend/SingleSend.js +++ b/src/modules/utils/modals/sendAsset/components/singleSend/SingleSend.js @@ -21,6 +21,7 @@ * @param {$rootScope.Scope} $scope * @param {app.utils} utils * @param {IPollCreate} createPoll + * @param {ConfigService} configService * @param {IOuterBlockchains} outerBlockchains * @param {User} user * @param {GatewayService} gatewayService @@ -31,6 +32,7 @@ utils, createPoll, waves, + configService, outerBlockchains, user, gatewayService) { @@ -138,6 +140,15 @@ return this.toBankMode && this.termsLoadError; } + get isCoinomatAccepted() { + return configService + .get('PERMISSIONS.CAN_TRANSFER_COINOMAT').indexOf(this.balance.asset.id) !== -1; + } + + get isBankAccepted() { + return this.toBankMode ? this.isCoinomatAccepted : true; + } + get isBankPendingOrError() { return this.isBankError || this.isBankPending; } @@ -256,7 +267,6 @@ } $postLink() { - this.receive(utils.observe(this.tx, 'fee'), this._currentHasCommission, this); const onHasMoneyHash = () => { this.receive(utils.observe(this.state, 'toBankMode'), this._onChangeBankMode, this); @@ -272,6 +282,9 @@ this.receive(utils.observe(this.state, 'paymentId'), this._updateGatewayDetails, this); this.receive(utils.observe(this.tx, 'recipient'), this._updateGatewayDetails, this); + this.receive(utils.observe(this.state, 'paymentId'), this._updateGatewayPermisson, this); + this.receive(utils.observe(this.tx, 'recipient'), this._updateGatewayPermisson, this); + this.receive(utils.observe(this.tx, 'amount'), this._onChangeAmount, this); this.observe('gatewayDetails', this._updateWavesTxObject); @@ -280,6 +293,11 @@ this.receive(utils.observe(this.tx, 'attachment'), this._updateWavesTxObject, this); this.observe('mirror', this._onChangeAmountMirror); + + this._currentHasCommission(); + this._onChangeBaseAssets(); + this._updateGatewayDetails(); + this._updateGatewayPermisson(); }; if (!this.state.moneyHash) { this.receiveOnce(utils.observe(this.state, 'moneyHash'), onHasMoneyHash); @@ -461,6 +479,7 @@ } this._setMinAmount(); + this._updateGatewayPermisson(); } /** @@ -516,6 +535,7 @@ this.tx.amount = this.moneyHash[this.assetId].cloneWithTokens('0'); this.mirror = this.moneyHash[this.mirrorId].cloneWithTokens('0'); this._updateGatewayDetails(); + this._updateGatewayPermisson(); // analytics.push('Send', `Send.ChangeCurrency.${WavesApp.type}`, this.assetId); } @@ -662,6 +682,13 @@ return Promise.resolve(); } + /** + * @private + */ + _updateGatewayPermisson() { + this.gatewayDetailsError = !this.isCoinomatAccepted; + } + } return new SingleSend(); @@ -673,6 +700,7 @@ 'utils', 'createPoll', 'waves', + 'configService', 'outerBlockchains', 'user', 'gatewayService' diff --git a/src/modules/utils/modals/sendAsset/components/singleSend/single-send.html b/src/modules/utils/modals/sendAsset/components/singleSend/single-send.html index feba466053..2f8fab0874 100644 --- a/src/modules/utils/modals/sendAsset/components/singleSend/single-send.html +++ b/src/modules/utils/modals/sendAsset/components/singleSend/single-send.html @@ -58,18 +58,18 @@
+ ng-if="$ctrl.toBankMode && $ctrl.termsIsPending && !$ctrl.isLira && $ctrl.isBankAccepted">
-
+
-
+
@@ -99,17 +99,12 @@
-
+
- - -
@@ -143,7 +138,7 @@
-
@@ -243,7 +238,7 @@
-
+
-
+