Update docs.
This commit is contained in:
@@ -118,6 +118,9 @@
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<ul class="index-list">
|
||||
<li>
|
||||
<a href="#addAccount">addAccount</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#approveAction">approveAction</a>
|
||||
</li>
|
||||
@@ -163,6 +166,10 @@
|
||||
<li>
|
||||
<a href="#getTransactionTypes">getTransactionTypes</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#init">init</a>
|
||||
</li>
|
||||
<li>
|
||||
<span class="modifier">Async</span>
|
||||
<a href="#loadAccounts">loadAccounts</a>
|
||||
@@ -204,7 +211,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>constructor(httpClient: <a href="https://angular.io/api/common/http/HttpClient" target="_blank">HttpClient</a>, loggingService: <a href="../injectables/LoggingService.html">LoggingService</a>, tokenService: <a href="../injectables/TokenService.html">TokenService</a>, registryService: <a href="../injectables/RegistryService.html">RegistryService</a>, authService: <a href="../injectables/AuthService.html">AuthService</a>)</code>
|
||||
<code>constructor(httpClient: <a href="https://angular.io/api/common/http/HttpClient" target="_blank">HttpClient</a>, loggingService: <a href="../injectables/LoggingService.html">LoggingService</a>, tokenService: <a href="../injectables/TokenService.html">TokenService</a>, authService: <a href="../injectables/AuthService.html">AuthService</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -261,18 +268,6 @@
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>registryService</td>
|
||||
|
||||
<td>
|
||||
<code><a href="../injectables/RegistryService.html" target="_self" >RegistryService</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>authService</td>
|
||||
@@ -300,6 +295,88 @@
|
||||
<h3 id="methods">
|
||||
Methods
|
||||
</h3>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="addAccount"></a>
|
||||
<span class="name">
|
||||
<b>
|
||||
addAccount
|
||||
</b>
|
||||
<a href="#addAccount"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<code>addAccount(account: <a href="../interfaces/AccountDetails.html">AccountDetails</a>, cacheSize: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="266"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:266</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
|
||||
<div class="io-description">
|
||||
<b>Parameters :</b>
|
||||
<table class="params">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Type</td>
|
||||
<td>Optional</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>account</td>
|
||||
<td>
|
||||
<code><a href="../interfaces/AccountDetails.html" target="_self" >AccountDetails</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cacheSize</td>
|
||||
<td>
|
||||
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
No
|
||||
</td>
|
||||
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
</div>
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>
|
||||
|
||||
</div>
|
||||
<div class="io-description">
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -586,8 +663,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="195"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:195</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="193"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:193</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -676,8 +753,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="221"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:221</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="219"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:219</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -904,8 +981,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="256"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:256</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="254"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:254</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1052,8 +1129,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="248"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:248</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="246"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:246</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1091,8 +1168,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="252"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:252</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="250"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:250</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1161,8 +1238,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="264"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:264</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="262"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:262</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1282,8 +1359,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="260"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:260</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="258"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:258</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1299,6 +1376,47 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<a name="init"></a>
|
||||
<span class="name">
|
||||
<b>
|
||||
<span class="modifier">Async</span>
|
||||
init
|
||||
</b>
|
||||
<a href="#init"><span class="icon ion-ios-link"></span></a>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<span class="modifier-icon icon ion-ios-reset"></span>
|
||||
<code>init()</code>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="45"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:45</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
|
||||
<div class="io-description">
|
||||
<b>Returns : </b> <code>Promise<void></code>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
@@ -1412,8 +1530,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="239"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:239</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="237"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:237</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1591,8 +1709,8 @@
|
||||
|
||||
<tr>
|
||||
<td class="col-md-4">
|
||||
<div class="io-line">Defined in <a href="" data-line="244"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:244</a></div>
|
||||
<div class="io-line">Defined in <a href="" data-line="242"
|
||||
class="link-to-prism">src/app/_services/user.service.ts:242</a></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -2150,7 +2268,7 @@ import { TokenService } from '@app/_services/token.service';
|
||||
import { AccountIndex } from '@app/_eth';
|
||||
import { MutableKeyStore, PGPSigner, Signer } from '@app/_pgp';
|
||||
import { RegistryService } from '@app/_services/registry.service';
|
||||
import { CICRegistry } from 'cic-client';
|
||||
import { CICRegistry } from '@cicnet/cic-client';
|
||||
import { AuthService } from '@app/_services/auth.service';
|
||||
import { personValidation, vcardValidation } from '@app/_helpers';
|
||||
import { add0x } from '@src/assets/js/ethtx/dist/hex';
|
||||
@@ -2179,20 +2297,20 @@ export class UserService {
|
||||
private httpClient: HttpClient,
|
||||
private loggingService: LoggingService,
|
||||
private tokenService: TokenService,
|
||||
private registryService: RegistryService,
|
||||
private authService: AuthService
|
||||
) {
|
||||
this.authService.init().then(() => {
|
||||
this.keystore = authService.mutableKeyStore;
|
||||
this.signer = new PGPSigner(this.keystore);
|
||||
});
|
||||
this.registry = registryService.getRegistry();
|
||||
this.registry.load();
|
||||
) {}
|
||||
|
||||
async init(): Promise<void> {
|
||||
await this.authService.init();
|
||||
await this.tokenService.init();
|
||||
this.keystore = this.authService.mutableKeyStore;
|
||||
this.signer = new PGPSigner(this.keystore);
|
||||
this.registry = await RegistryService.getRegistry();
|
||||
}
|
||||
|
||||
resetPin(phone: string): Observable<any> {
|
||||
const params: HttpParams = new HttpParams().set('phoneNumber', phone);
|
||||
return this.httpClient.get(`${environment.cicUssdUrl}/pin`, { params });
|
||||
return this.httpClient.put(`${environment.cicUssdUrl}/pin`, { params });
|
||||
}
|
||||
|
||||
getAccountStatus(phone: string): Observable<any> {
|
||||
@@ -2323,9 +2441,7 @@ export class UserService {
|
||||
'AccountRegistry'
|
||||
);
|
||||
const accountIndexQuery = new AccountIndex(accountIndexAddress);
|
||||
const accountAddresses: Array<string> = await accountIndexQuery.last(
|
||||
await accountIndexQuery.totalAccounts()
|
||||
);
|
||||
const accountAddresses: Array<string> = await accountIndexQuery.last(limit);
|
||||
this.loggingService.sendInfoLevelMessage(accountAddresses);
|
||||
for (const accountAddress of accountAddresses.slice(offset, offset + limit)) {
|
||||
await this.getAccountByAddress(accountAddress, limit);
|
||||
@@ -2343,16 +2459,16 @@ export class UserService {
|
||||
const account: Syncable = Envelope.fromJSON(JSON.stringify(res)).unwrap();
|
||||
const accountInfo = account.m.data;
|
||||
await personValidation(accountInfo);
|
||||
accountInfo.balance = await this.tokenService.getTokenBalance(
|
||||
accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
|
||||
);
|
||||
this.tokenService.load.subscribe(async (status: boolean) => {
|
||||
if (status) {
|
||||
accountInfo.balance = await this.tokenService.getTokenBalance(
|
||||
accountInfo.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
|
||||
);
|
||||
}
|
||||
});
|
||||
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
|
||||
await vcardValidation(accountInfo.vcard);
|
||||
this.accounts.unshift(accountInfo);
|
||||
if (this.accounts.length > limit) {
|
||||
this.accounts.length = limit;
|
||||
}
|
||||
this.accountsList.next(this.accounts);
|
||||
this.addAccount(accountInfo, limit);
|
||||
accountSubject.next(accountInfo);
|
||||
});
|
||||
return accountSubject.asObservable();
|
||||
@@ -2404,6 +2520,25 @@ export class UserService {
|
||||
getGenders(): Observable<any> {
|
||||
return this.httpClient.get(`${environment.cicMetaUrl}/genders`);
|
||||
}
|
||||
|
||||
addAccount(account: AccountDetails, cacheSize: number): void {
|
||||
const savedIndex = this.accounts.findIndex(
|
||||
(acc) =>
|
||||
acc.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0] ===
|
||||
account.identities.evm[`bloxberg:${environment.bloxbergChainId}`][0]
|
||||
);
|
||||
if (savedIndex === 0) {
|
||||
return;
|
||||
}
|
||||
if (savedIndex > 0) {
|
||||
this.accounts.splice(savedIndex, 1);
|
||||
}
|
||||
this.accounts.unshift(account);
|
||||
if (this.accounts.length > cacheSize) {
|
||||
this.accounts.length = Math.min(this.accounts.length, cacheSize);
|
||||
}
|
||||
this.accountsList.next(this.accounts);
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user