Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions mocks/waves-client-config/master/config.json
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -56,5 +58,5 @@
]
}
},
"SERVICE_TEMPORARILY_UNAVAILABLE": true
"SERVICE_TEMPORARILY_UNAVAILABLE": false
}
53 changes: 53 additions & 0 deletions mocks/waves-client-config/master/testnet.config.json
Original file line number Diff line number Diff line change
@@ -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
}
15 changes: 11 additions & 4 deletions server.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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')) || '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,6 +32,7 @@
utils,
createPoll,
waves,
configService,
outerBlockchains,
user,
gatewayService) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -461,6 +479,7 @@
}

this._setMinAmount();
this._updateGatewayPermisson();
}

/**
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -662,6 +682,13 @@
return Promise.resolve();
}

/**
* @private
*/
_updateGatewayPermisson() {
this.gatewayDetailsError = !this.isCoinomatAccepted;
}

}

return new SingleSend();
Expand All @@ -673,6 +700,7 @@
'utils',
'createPoll',
'waves',
'configService',
'outerBlockchains',
'user',
'gatewayService'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@
</div>

<div class="row relative" style="min-height: 60px;"
ng-if="$ctrl.toBankMode && $ctrl.termsIsPending && !$ctrl.isLira">
ng-if="$ctrl.toBankMode && $ctrl.termsIsPending && !$ctrl.isLira && $ctrl.isBankAccepted">
<w-loader class="asd"></w-loader>
</div>

<div ng-if="$ctrl.toBankMode && !$ctrl.isBankPendingOrError && $ctrl.isVerified" class="margin-1">
<div ng-if="$ctrl.toBankMode && !$ctrl.isBankPendingOrError && $ctrl.isVerified && $ctrl.isCoinomatAccepted" class="margin-1">
<div class="plate-warning">
<div class="body-2 warning-500" w-i18n="modal.send.coinomatWarningHeader"></div>
<div class="footnote-1 basic-500" w-i18n="modal.send.coinomatWarningText"></div>
</div>
</div>

<div ng-if="$ctrl.toBankMode && !$ctrl.isBankPendingOrError && $ctrl.isVerified" class="row">
<div ng-if="$ctrl.toBankMode && !$ctrl.isBankPendingOrError && $ctrl.isVerified && $ctrl.isCoinomatAccepted" class="row">
<div class="plate-warning">
<div class="body-2 warning-500" w-i18n="modal.send.coinomatLimits"></div>
</div>
Expand Down Expand Up @@ -99,17 +99,12 @@
</div>
</div>

<div ng-if="$ctrl.outerSendMode && $ctrl.gatewayDetailsError" class="row">
<div ng-if="$ctrl.outerSendMode && $ctrl.gatewayDetailsError || !$ctrl.isBankAccepted" class="row">
<div class="plate-warning server-error">
<div class="body-2 warning-500"
w-i18n="modal.receive.serverError">
</div>
</div>
<w-button on-click="$ctrl.getGatewayDetails()"
type="submit"
class="big submit long">
<span w-i18n="modal.receive.coinomat.tryAgain"></span>
</w-button>
</div>

<div ng-if="$ctrl.outerSendMode && $ctrl.isMoneroAddress() && !$ctrl.gatewayDetailsError">
Expand Down Expand Up @@ -143,7 +138,7 @@
</w-input-container>
</div>

<w-input-container ng-if="!$ctrl.hasOuterError && !$ctrl.isBankPending"
<w-input-container ng-if="!$ctrl.hasOuterError && !$ctrl.isBankPending && $ctrl.isBankAccepted"
class="margin-top-2">
<div class="body-2" w-i18n="modal.send.amount"></div>
<div class="amount-wrap" ng-class="{'no-mirror': $ctrl.noMirror}">
Expand Down Expand Up @@ -243,7 +238,7 @@
</w-input-container>
</div>

<div class="fee margin-top-1 margin-1" ng-if="!$ctrl.hasOuterError && !$ctrl.isBankPending">
<div class="fee margin-top-1 margin-1" ng-if="!$ctrl.hasOuterError && !$ctrl.isBankPending && $ctrl.isBankAccepted">
<w-fee-list tx="$ctrl.wavesTx"
disabled="$ctrl.toBankMode && (!$ctrl.isVerified || !$ctrl.termsAccepted)"
balance-hash="$ctrl.state.moneyHash"
Expand All @@ -265,7 +260,7 @@
params="{fee: $ctrl.state.singleSend.fee}"></span>
</div>

<div ng-if="$ctrl.toBankMode && !$ctrl.isLira" class="margin-top-2">
<div ng-if="$ctrl.toBankMode && !$ctrl.isLira && $ctrl.isBankAccepted" class="margin-top-2">
<w-coinomat-terms force-show-terms="::false"
terms-pending="$ctrl.termsIsPending"
load-error="$ctrl.termsLoadError"
Expand Down
1 change: 1 addition & 0 deletions src/modules/utils/modals/sendAsset/send.modal.less
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ md-dialog.modal-send {
.plate-warning {
&.server-error {
margin-bottom: 30px;
justify-content: center;
}
}

Expand Down