Refactor mapping of curated options from meta.

This commit is contained in:
Spencer Ofwiti
2021-06-23 07:18:28 +00:00
parent a69213dab2
commit 5e8e0f7209
62 changed files with 4228 additions and 4702 deletions

View File

@@ -260,8 +260,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="119"
class="link-to-prism">src/app/_services/transaction.service.ts:119</a></div>
<div class="io-line">Defined in <a href="" data-line="143"
class="link-to-prism">src/app/_services/transaction.service.ts:143</a></div>
</td>
</tr>
@@ -341,8 +341,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="139"
class="link-to-prism">src/app/_services/transaction.service.ts:139</a></div>
<div class="io-line">Defined in <a href="" data-line="163"
class="link-to-prism">src/app/_services/transaction.service.ts:163</a></div>
</td>
</tr>
@@ -646,8 +646,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="134"
class="link-to-prism">src/app/_services/transaction.service.ts:134</a></div>
<div class="io-line">Defined in <a href="" data-line="158"
class="link-to-prism">src/app/_services/transaction.service.ts:158</a></div>
</td>
</tr>
@@ -687,8 +687,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="94"
class="link-to-prism">src/app/_services/transaction.service.ts:94</a></div>
<div class="io-line">Defined in <a href="" data-line="110"
class="link-to-prism">src/app/_services/transaction.service.ts:110</a></div>
</td>
</tr>
@@ -847,8 +847,8 @@
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="146"
class="link-to-prism">src/app/_services/transaction.service.ts:146</a></div>
<div class="io-line">Defined in <a href="" data-line="170"
class="link-to-prism">src/app/_services/transaction.service.ts:170</a></div>
</td>
</tr>
@@ -1173,30 +1173,46 @@ export class TransactionService {
transaction.value &#x3D; Number(transaction.value);
transaction.type &#x3D; &#x27;transaction&#x27;;
try {
this.userService
.getAccountDetailsFromMeta(await User.toKey(transaction.from))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
transaction.sender &#x3D; this.getAccountInfo(res, cacheSize);
},
(error) &#x3D;&gt; {
transaction.sender &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
}
);
this.userService
.getAccountDetailsFromMeta(await User.toKey(transaction.to))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
transaction.recipient &#x3D; this.getAccountInfo(res, cacheSize);
},
(error) &#x3D;&gt; {
transaction.recipient &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
}
);
if (transaction.from &#x3D;&#x3D;&#x3D; environment.trustedDeclaratorAddress) {
transaction.sender &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
} else {
this.userService
.getAccountDetailsFromMeta(await User.toKey(transaction.from))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
transaction.sender &#x3D; this.getAccountInfo(res, cacheSize);
},
(error) &#x3D;&gt; {
this.loggingService.sendErrorLevelMessage(
&#x60;Account with address ${transaction.from} not found&#x60;,
this,
{ error }
);
}
);
}
if (transaction.to &#x3D;&#x3D;&#x3D; environment.trustedDeclaratorAddress) {
transaction.recipient &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
} else {
this.userService
.getAccountDetailsFromMeta(await User.toKey(transaction.to))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
transaction.recipient &#x3D; this.getAccountInfo(res, cacheSize);
},
(error) &#x3D;&gt; {
this.loggingService.sendErrorLevelMessage(
&#x60;Account with address ${transaction.to} not found&#x60;,
this,
{ error }
);
}
);
}
} finally {
this.addTransaction(transaction, cacheSize);
}
@@ -1210,18 +1226,26 @@ export class TransactionService {
conversion.fromValue &#x3D; Number(conversion.fromValue);
conversion.toValue &#x3D; Number(conversion.toValue);
try {
this.userService
.getAccountDetailsFromMeta(await User.toKey(conversion.trader))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
conversion.sender &#x3D; conversion.recipient &#x3D; this.getAccountInfo(res);
},
(error) &#x3D;&gt; {
conversion.sender &#x3D; conversion.recipient &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
}
);
if (conversion.trader &#x3D;&#x3D;&#x3D; environment.trustedDeclaratorAddress) {
conversion.sender &#x3D; conversion.recipient &#x3D; defaultAccount;
this.userService.addAccount(defaultAccount, cacheSize);
} else {
this.userService
.getAccountDetailsFromMeta(await User.toKey(conversion.trader))
.pipe(first())
.subscribe(
(res) &#x3D;&gt; {
conversion.sender &#x3D; conversion.recipient &#x3D; this.getAccountInfo(res);
},
(error) &#x3D;&gt; {
this.loggingService.sendErrorLevelMessage(
&#x60;Account with address ${conversion.trader} not found&#x60;,
this,
{ error }
);
}
);
}
} finally {
this.addTransaction(conversion, cacheSize);
}