Add check for trusted declarator address.
This commit is contained in:
parent
665b28a8ba
commit
bb6426c252
@ -129,7 +129,7 @@ const defaultAccount: AccountDetails = {
|
||||
meta: {
|
||||
TYP: [],
|
||||
},
|
||||
value: '',
|
||||
value: '+254700000000',
|
||||
},
|
||||
],
|
||||
version: [
|
||||
|
@ -62,6 +62,10 @@ export class TransactionService {
|
||||
transaction.value = Number(transaction.value);
|
||||
transaction.type = 'transaction';
|
||||
try {
|
||||
if (transaction.from === environment.trustedDeclaratorAddress) {
|
||||
transaction.sender = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
} else {
|
||||
this.userService
|
||||
.getAccountDetailsFromMeta(await User.toKey(transaction.from))
|
||||
.pipe(first())
|
||||
@ -70,10 +74,18 @@ export class TransactionService {
|
||||
transaction.sender = this.getAccountInfo(res, cacheSize);
|
||||
},
|
||||
(error) => {
|
||||
transaction.sender = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
this.loggingService.sendErrorLevelMessage(
|
||||
`Account with address ${transaction.from} not found`,
|
||||
this,
|
||||
{ error }
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
if (transaction.to === environment.trustedDeclaratorAddress) {
|
||||
transaction.recipient = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
} else {
|
||||
this.userService
|
||||
.getAccountDetailsFromMeta(await User.toKey(transaction.to))
|
||||
.pipe(first())
|
||||
@ -82,10 +94,14 @@ export class TransactionService {
|
||||
transaction.recipient = this.getAccountInfo(res, cacheSize);
|
||||
},
|
||||
(error) => {
|
||||
transaction.recipient = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
this.loggingService.sendErrorLevelMessage(
|
||||
`Account with address ${transaction.to} not found`,
|
||||
this,
|
||||
{ error }
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
this.addTransaction(transaction, cacheSize);
|
||||
}
|
||||
@ -99,6 +115,10 @@ export class TransactionService {
|
||||
conversion.fromValue = Number(conversion.fromValue);
|
||||
conversion.toValue = Number(conversion.toValue);
|
||||
try {
|
||||
if (conversion.trader === environment.trustedDeclaratorAddress) {
|
||||
conversion.sender = conversion.recipient = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
} else {
|
||||
this.userService
|
||||
.getAccountDetailsFromMeta(await User.toKey(conversion.trader))
|
||||
.pipe(first())
|
||||
@ -107,10 +127,14 @@ export class TransactionService {
|
||||
conversion.sender = conversion.recipient = this.getAccountInfo(res);
|
||||
},
|
||||
(error) => {
|
||||
conversion.sender = conversion.recipient = defaultAccount;
|
||||
this.userService.addAccount(defaultAccount, cacheSize);
|
||||
this.loggingService.sendErrorLevelMessage(
|
||||
`Account with address ${conversion.trader} not found`,
|
||||
this,
|
||||
{ error }
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
} finally {
|
||||
this.addTransaction(conversion, cacheSize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user