2021-05-10 20:56:20 +02:00
|
|
|
<!doctype html>
|
|
|
|
<html class="no-js" lang="">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
|
|
<title>CICADA</title>
|
|
|
|
<meta name="description" content="">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
|
|
|
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
|
2021-09-03 01:48:41 +02:00
|
|
|
<link rel="stylesheet" href="../styles/style.css">
|
|
|
|
<link rel="stylesheet" href="../styles/dark.css" media="(prefers-color-scheme: dark)">
|
2021-05-10 20:56:20 +02:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div class="navbar navbar-default navbar-fixed-top visible-xs">
|
|
|
|
<a href="../" class="navbar-brand">CICADA</a>
|
|
|
|
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="xs-menu menu" id="mobile-menu">
|
|
|
|
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="container-fluid main">
|
|
|
|
<div class="row main">
|
|
|
|
<div class="hidden-xs menu">
|
|
|
|
<compodoc-menu mode="normal"></compodoc-menu>
|
|
|
|
</div>
|
|
|
|
<!-- START CONTENT -->
|
|
|
|
<div class="content injectable">
|
|
|
|
<div class="content-data">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<ol class="breadcrumb">
|
|
|
|
<li>Injectables</li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<li >TransactionService</li>
|
2021-05-10 20:56:20 +02:00
|
|
|
</ol>
|
|
|
|
|
|
|
|
<ul class="nav nav-tabs" role="tablist">
|
|
|
|
<li class="active">
|
|
|
|
<a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
|
|
|
|
</li>
|
|
|
|
<li >
|
|
|
|
<a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
<div class="tab-content">
|
|
|
|
<div class="tab-pane fade active in" id="c-info">
|
|
|
|
<p class="comment">
|
|
|
|
<h3>File</h3>
|
|
|
|
</p>
|
|
|
|
<p class="comment">
|
|
|
|
<code>src/app/_services/transaction.service.ts</code>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
|
2021-05-10 20:56:20 +02:00
|
|
|
<section>
|
|
|
|
<h3 id="index">Index</h3>
|
|
|
|
<table class="table table-sm table-bordered index-table">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<h6><b>Properties</b></h6>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<ul class="index-list">
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#registry" >registry</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="modifier">Private</span>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#transactionList" >transactionList</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#transactions" >transactions</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#transactionsSubject" >transactionsSubject</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#web3" >web3</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<h6><b>Methods</b></h6>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<ul class="index-list">
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#addTransaction" >addTransaction</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#getAccountInfo" >getAccountInfo</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#getAddressTransactions" >getAddressTransactions</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#getAllTransactions" >getAllTransactions</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
2021-06-14 13:28:53 +02:00
|
|
|
<li>
|
|
|
|
<span class="modifier">Async</span>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#init" >init</a>
|
2021-06-14 13:28:53 +02:00
|
|
|
</li>
|
2021-05-10 20:56:20 +02:00
|
|
|
<li>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#resetTransactionsList" >resetTransactionsList</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="modifier">Async</span>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#setConversion" >setConversion</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="modifier">Async</span>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#setTransaction" >setTransaction</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<span class="modifier">Async</span>
|
2021-09-03 01:48:41 +02:00
|
|
|
<a href="#transferRequest" >transferRequest</a>
|
2021-05-10 20:56:20 +02:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
<h3 id="constructor">Constructor</h3>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<code>constructor(httpClient: <a href="https://angular.io/api/common/http/HttpClient" target="_blank">HttpClient</a>, userService: <a href="../injectables/UserService.html" target="_self">UserService</a>, loggingService: <a href="../injectables/LoggingService.html" target="_self">LoggingService</a>)</code>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="31" class="link-to-prism">src/app/_services/transaction.service.ts:31</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<div>
|
|
|
|
<b>Parameters :</b>
|
|
|
|
<table class="params">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td>Name</td>
|
|
|
|
<td>Type</td>
|
|
|
|
<td>Optional</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>httpClient</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<code><a href="https://angular.io/api/common/http/HttpClient" target="_blank" >HttpClient</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>userService</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<code><a href="../injectables/UserService.html" target="_self" >UserService</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>loggingService</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<code><a href="../injectables/LoggingService.html" target="_self" >LoggingService</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section>
|
|
|
|
|
|
|
|
<h3 id="methods">
|
|
|
|
Methods
|
|
|
|
</h3>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="addTransaction"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span ><b>addTransaction</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#addTransaction"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<code>addTransaction(transaction, 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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="138"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:138</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>transaction</td>
|
|
|
|
<td>
|
|
|
|
</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>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="getAccountInfo"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span ><b>getAccountInfo</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#getAccountInfo"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-06-14 13:28:53 +02:00
|
|
|
<code>getAccountInfo(account: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, cacheSize: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="158"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:158</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>
|
2021-06-14 13:28:53 +02:00
|
|
|
<td>Default value</td>
|
2021-05-10 20:56:20 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>account</td>
|
|
|
|
<td>
|
|
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
2021-06-14 13:28:53 +02:00
|
|
|
<td>
|
|
|
|
</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>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
<code>100</code>
|
|
|
|
</td>
|
2021-05-10 20:56:20 +02:00
|
|
|
|
|
|
|
</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" >any</a></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="getAddressTransactions"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span ><b>getAddressTransactions</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#getAddressTransactions"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<code>getAddressTransactions(address: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, offset: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, limit: <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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="49"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:49</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>address</td>
|
|
|
|
<td>
|
|
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>offset</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>
|
|
|
|
<tr>
|
|
|
|
<td>limit</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>Observable<any></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="getAllTransactions"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span ><b>getAllTransactions</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#getAllTransactions"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<code>getAllTransactions(offset: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, limit: <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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="45"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:45</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>offset</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>
|
|
|
|
<tr>
|
|
|
|
<td>limit</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>Observable<any></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-06-14 13:28:53 +02:00
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="init"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span class="modifier">Async</span>
|
|
|
|
<span ><b>init</b></span>
|
2021-06-14 13:28:53 +02:00
|
|
|
<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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="41"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:41</a></div>
|
2021-06-14 13:28:53 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
|
|
|
|
<div class="io-description">
|
|
|
|
<b>Returns : </b> <code>Promise<void></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-05-10 20:56:20 +02:00
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="resetTransactionsList"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span ><b>resetTransactionsList</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#resetTransactionsList"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<code>resetTransactionsList()</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="153"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:153</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
|
|
|
|
<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>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="setConversion"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span class="modifier">Async</span>
|
|
|
|
<span ><b>setConversion</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#setConversion"><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>setConversion(conversion, cacheSize)</code>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="105"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:105</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
|
|
|
|
<div class="io-description">
|
|
|
|
<b>Parameters :</b>
|
|
|
|
<table class="params">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<td>Name</td>
|
|
|
|
<td>Optional</td>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>conversion</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>cacheSize</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
<b>Returns : </b> <code>Promise<void></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="setTransaction"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span class="modifier">Async</span>
|
|
|
|
<span ><b>setTransaction</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#setTransaction"><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>setTransaction(transaction, 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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="53"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:53</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>transaction</td>
|
|
|
|
<td>
|
|
|
|
</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>Promise<void></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="transferRequest"></a>
|
|
|
|
<span class="name">
|
2021-09-03 01:48:41 +02:00
|
|
|
<span class="modifier">Async</span>
|
|
|
|
<span ><b>transferRequest</b></span>
|
2021-05-10 20:56:20 +02:00
|
|
|
<a href="#transferRequest"><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>transferRequest(tokenAddress: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, senderAddress: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, recipientAddress: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank">string</a>, value: <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">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="165"
|
|
|
|
class="link-to-prism">src/app/_services/transaction.service.ts:165</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</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>tokenAddress</td>
|
|
|
|
<td>
|
|
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>senderAddress</td>
|
|
|
|
<td>
|
|
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>recipientAddress</td>
|
|
|
|
<td>
|
|
|
|
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/string" target="_blank" >string</a></code>
|
|
|
|
</td>
|
|
|
|
|
|
|
|
<td>
|
|
|
|
No
|
|
|
|
</td>
|
|
|
|
|
|
|
|
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>value</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>Promise<any></code>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="io-description">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</section>
|
|
|
|
<section>
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
<h3 id="inputs">
|
|
|
|
Properties
|
|
|
|
</h3>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="registry"></a>
|
|
|
|
<span class="name">
|
|
|
|
<span ><b>registry</b></span>
|
|
|
|
<a href="#registry"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2021-05-10 20:56:20 +02:00
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Type : </i> <code>CICRegistry</code>
|
|
|
|
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="31" class="link-to-prism">src/app/_services/transaction.service.ts:31</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="transactionList"></a>
|
|
|
|
<span class="name">
|
|
|
|
<span class="modifier">Private</span>
|
|
|
|
<span ><b>transactionList</b></span>
|
|
|
|
<a href="#transactionList"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2021-05-10 20:56:20 +02:00
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Default value : </i><code>new BehaviorSubject<any[]>(this.transactions)</code>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="28" class="link-to-prism">src/app/_services/transaction.service.ts:28</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="transactions"></a>
|
|
|
|
<span class="name">
|
|
|
|
<span ><b>transactions</b></span>
|
|
|
|
<a href="#transactions"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2021-05-10 20:56:20 +02:00
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Type : </i> <code>any[]</code>
|
|
|
|
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Default value : </i><code>[]</code>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="27" class="link-to-prism">src/app/_services/transaction.service.ts:27</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="transactionsSubject"></a>
|
|
|
|
<span class="name">
|
|
|
|
<span ><b>transactionsSubject</b></span>
|
|
|
|
<a href="#transactionsSubject"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2021-05-10 20:56:20 +02:00
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Default value : </i><code>this.transactionList.asObservable()</code>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="29" class="link-to-prism">src/app/_services/transaction.service.ts:29</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<table class="table table-sm table-bordered">
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
|
|
|
<a name="web3"></a>
|
|
|
|
<span class="name">
|
|
|
|
<span ><b>web3</b></span>
|
|
|
|
<a href="#web3"><span class="icon ion-ios-link"></span></a>
|
|
|
|
</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2021-05-10 20:56:20 +02:00
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<i>Type : </i> <code>Web3</code>
|
|
|
|
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td class="col-md-4">
|
2021-09-03 01:48:41 +02:00
|
|
|
<div class="io-line">Defined in <a href="" data-line="30" class="link-to-prism">src/app/_services/transaction.service.ts:30</a></div>
|
2021-05-10 20:56:20 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
2021-09-03 01:48:41 +02:00
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-05-10 20:56:20 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="tab-pane fade tab-source-code" id="c-source">
|
|
|
|
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable } from '@angular/core';
|
2021-05-11 19:51:48 +02:00
|
|
|
import { first } from 'rxjs/operators';
|
|
|
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
|
|
import { environment } from '@src/environments/environment';
|
|
|
|
import { Envelope, User } from 'cic-client-meta';
|
|
|
|
import { UserService } from '@app/_services/user.service';
|
2021-05-10 20:56:20 +02:00
|
|
|
import { Keccak } from 'sha3';
|
|
|
|
import { utils } from 'ethers';
|
2021-05-11 19:51:48 +02:00
|
|
|
import { add0x, fromHex, strip0x, toHex } from '@src/assets/js/ethtx/dist/hex';
|
|
|
|
import { Tx } from '@src/assets/js/ethtx/dist';
|
|
|
|
import { toValue } from '@src/assets/js/ethtx/dist/tx';
|
2021-05-10 20:56:20 +02:00
|
|
|
import * as secp256k1 from 'secp256k1';
|
2021-05-11 19:51:48 +02:00
|
|
|
import { defaultAccount } from '@app/_models';
|
|
|
|
import { LoggingService } from '@app/_services/logging.service';
|
|
|
|
import { HttpClient } from '@angular/common/http';
|
2021-06-14 13:28:53 +02:00
|
|
|
import { CICRegistry } from '@cicnet/cic-client';
|
2021-05-11 19:51:48 +02:00
|
|
|
import { RegistryService } from '@app/_services/registry.service';
|
2021-05-10 20:56:20 +02:00
|
|
|
import Web3 from 'web3';
|
2021-06-14 13:28:53 +02:00
|
|
|
import { Web3Service } from '@app/_services/web3.service';
|
2021-06-15 18:49:26 +02:00
|
|
|
import { KeystoreService } from '@app/_services/keystore.service';
|
2021-05-10 20:56:20 +02:00
|
|
|
const vCard = require('vcard-parser');
|
|
|
|
|
|
|
|
@Injectable({
|
2021-05-11 19:51:48 +02:00
|
|
|
providedIn: 'root',
|
2021-05-10 20:56:20 +02:00
|
|
|
})
|
|
|
|
export class TransactionService {
|
|
|
|
transactions: any[] = [];
|
|
|
|
private transactionList = new BehaviorSubject<any[]>(this.transactions);
|
|
|
|
transactionsSubject = this.transactionList.asObservable();
|
|
|
|
web3: Web3;
|
|
|
|
registry: CICRegistry;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
private httpClient: HttpClient,
|
|
|
|
private userService: UserService,
|
2021-06-14 13:28:53 +02:00
|
|
|
private loggingService: LoggingService
|
2021-05-10 20:56:20 +02:00
|
|
|
) {
|
2021-06-14 13:28:53 +02:00
|
|
|
this.web3 = Web3Service.getInstance();
|
|
|
|
}
|
|
|
|
|
|
|
|
async init(): Promise<void> {
|
|
|
|
this.registry = await RegistryService.getRegistry();
|
2021-05-10 20:56:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
getAllTransactions(offset: number, limit: number): Observable<any> {
|
|
|
|
return this.httpClient.get(`${environment.cicCacheUrl}/tx/${offset}/${limit}`);
|
|
|
|
}
|
|
|
|
|
|
|
|
getAddressTransactions(address: string, offset: number, limit: number): Observable<any> {
|
2021-06-14 13:28:53 +02:00
|
|
|
return this.httpClient.get(`${environment.cicCacheUrl}/tx/user/${address}/${offset}/${limit}`);
|
2021-05-10 20:56:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async setTransaction(transaction, cacheSize: number): Promise<void> {
|
2021-05-11 19:51:48 +02:00
|
|
|
if (this.transactions.find((cachedTx) => cachedTx.tx.txHash === transaction.tx.txHash)) {
|
|
|
|
return;
|
|
|
|
}
|
2021-05-10 20:56:20 +02:00
|
|
|
transaction.value = Number(transaction.value);
|
|
|
|
transaction.type = 'transaction';
|
|
|
|
try {
|
2021-06-23 09:18:28 +02:00
|
|
|
if (transaction.from === environment.trustedDeclaratorAddress) {
|
|
|
|
transaction.sender = defaultAccount;
|
|
|
|
this.userService.addAccount(defaultAccount, cacheSize);
|
|
|
|
} else {
|
|
|
|
this.userService
|
|
|
|
.getAccountDetailsFromMeta(await User.toKey(transaction.from))
|
|
|
|
.pipe(first())
|
|
|
|
.subscribe(
|
|
|
|
(res) => {
|
|
|
|
transaction.sender = this.getAccountInfo(res, cacheSize);
|
|
|
|
},
|
|
|
|
(error) => {
|
|
|
|
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())
|
|
|
|
.subscribe(
|
|
|
|
(res) => {
|
|
|
|
transaction.recipient = this.getAccountInfo(res, cacheSize);
|
|
|
|
},
|
|
|
|
(error) => {
|
|
|
|
this.loggingService.sendErrorLevelMessage(
|
|
|
|
`Account with address ${transaction.to} not found`,
|
|
|
|
this,
|
|
|
|
{ error }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2021-05-10 20:56:20 +02:00
|
|
|
} finally {
|
|
|
|
this.addTransaction(transaction, cacheSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async setConversion(conversion, cacheSize): Promise<void> {
|
2021-05-11 19:51:48 +02:00
|
|
|
if (this.transactions.find((cachedTx) => cachedTx.tx.txHash === conversion.tx.txHash)) {
|
|
|
|
return;
|
|
|
|
}
|
2021-05-10 20:56:20 +02:00
|
|
|
conversion.type = 'conversion';
|
|
|
|
conversion.fromValue = Number(conversion.fromValue);
|
|
|
|
conversion.toValue = Number(conversion.toValue);
|
|
|
|
try {
|
2021-06-23 09:18:28 +02:00
|
|
|
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())
|
|
|
|
.subscribe(
|
|
|
|
(res) => {
|
|
|
|
conversion.sender = conversion.recipient = this.getAccountInfo(res);
|
|
|
|
},
|
|
|
|
(error) => {
|
|
|
|
this.loggingService.sendErrorLevelMessage(
|
|
|
|
`Account with address ${conversion.trader} not found`,
|
|
|
|
this,
|
|
|
|
{ error }
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
2021-05-10 20:56:20 +02:00
|
|
|
} finally {
|
|
|
|
this.addTransaction(conversion, cacheSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
addTransaction(transaction, cacheSize: number): void {
|
2021-06-14 13:28:53 +02:00
|
|
|
const savedIndex = this.transactions.findIndex((tx) => tx.tx.txHash === transaction.tx.txHash);
|
|
|
|
if (savedIndex === 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (savedIndex > 0) {
|
|
|
|
this.transactions.splice(savedIndex, 1);
|
|
|
|
}
|
2021-05-10 20:56:20 +02:00
|
|
|
this.transactions.unshift(transaction);
|
|
|
|
if (this.transactions.length > cacheSize) {
|
2021-06-14 13:28:53 +02:00
|
|
|
this.transactions.length = Math.min(this.transactions.length, cacheSize);
|
2021-05-10 20:56:20 +02:00
|
|
|
}
|
|
|
|
this.transactionList.next(this.transactions);
|
|
|
|
}
|
|
|
|
|
|
|
|
resetTransactionsList(): void {
|
|
|
|
this.transactions = [];
|
|
|
|
this.transactionList.next(this.transactions);
|
|
|
|
}
|
|
|
|
|
2021-06-14 13:28:53 +02:00
|
|
|
getAccountInfo(account: string, cacheSize: number = 100): any {
|
2021-05-11 19:51:48 +02:00
|
|
|
const accountInfo = Envelope.fromJSON(JSON.stringify(account)).unwrap().m.data;
|
2021-05-10 20:56:20 +02:00
|
|
|
accountInfo.vcard = vCard.parse(atob(accountInfo.vcard));
|
2021-06-14 13:28:53 +02:00
|
|
|
this.userService.addAccount(accountInfo, cacheSize);
|
2021-05-10 20:56:20 +02:00
|
|
|
return accountInfo;
|
|
|
|
}
|
|
|
|
|
2021-05-11 19:51:48 +02:00
|
|
|
async transferRequest(
|
|
|
|
tokenAddress: string,
|
|
|
|
senderAddress: string,
|
|
|
|
recipientAddress: string,
|
|
|
|
value: number
|
|
|
|
): Promise<any> {
|
|
|
|
const transferAuthAddress = await this.registry.getContractAddressByName(
|
|
|
|
'TransferAuthorization'
|
|
|
|
);
|
2021-05-10 20:56:20 +02:00
|
|
|
const hashFunction = new Keccak(256);
|
|
|
|
hashFunction.update('createRequest(address,address,address,uint256)');
|
|
|
|
const hash = hashFunction.digest();
|
|
|
|
const methodSignature = hash.toString('hex').substring(0, 8);
|
|
|
|
const abiCoder = new utils.AbiCoder();
|
2021-09-03 01:48:41 +02:00
|
|
|
const abi = abiCoder.encode(
|
2021-05-11 19:51:48 +02:00
|
|
|
['address', 'address', 'address', 'uint256'],
|
|
|
|
[senderAddress, recipientAddress, tokenAddress, value]
|
|
|
|
);
|
2021-05-10 20:56:20 +02:00
|
|
|
const data = fromHex(methodSignature + strip0x(abi));
|
|
|
|
const tx = new Tx(environment.bloxbergChainId);
|
|
|
|
tx.nonce = await this.web3.eth.getTransactionCount(senderAddress);
|
|
|
|
tx.gasPrice = Number(await this.web3.eth.getGasPrice());
|
|
|
|
tx.gasLimit = 8000000;
|
|
|
|
tx.to = fromHex(strip0x(transferAuthAddress));
|
|
|
|
tx.value = toValue(value);
|
|
|
|
tx.data = data;
|
|
|
|
const txMsg = tx.message();
|
2021-06-15 18:49:26 +02:00
|
|
|
const keystore = await KeystoreService.getKeystore();
|
|
|
|
const privateKey = keystore.getPrivateKey();
|
2021-05-10 20:56:20 +02:00
|
|
|
if (!privateKey.isDecrypted()) {
|
|
|
|
const password = window.prompt('password');
|
|
|
|
await privateKey.decrypt(password);
|
|
|
|
}
|
|
|
|
const signatureObject = secp256k1.ecdsaSign(txMsg, privateKey.keyPacket.privateParams.d);
|
|
|
|
const r = signatureObject.signature.slice(0, 32);
|
|
|
|
const s = signatureObject.signature.slice(32);
|
|
|
|
const v = signatureObject.recid;
|
|
|
|
tx.setSignature(r, s, v);
|
|
|
|
const txWire = add0x(toHex(tx.serializeRLP()));
|
|
|
|
const result = await this.web3.eth.sendSignedTransaction(txWire);
|
|
|
|
this.loggingService.sendInfoLevelMessage(`Result: ${result}`);
|
|
|
|
const transaction = await this.web3.eth.getTransaction(result.transactionHash);
|
|
|
|
this.loggingService.sendInfoLevelMessage(`Transaction: ${transaction}`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</code></pre>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div><div class="search-results">
|
|
|
|
<div class="has-results">
|
|
|
|
<h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
|
|
|
|
<ul class="search-results-list"></ul>
|
|
|
|
</div>
|
|
|
|
<div class="no-results">
|
|
|
|
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- END CONTENT -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
|
|
|
|
var COMPODOC_CURRENT_PAGE_CONTEXT = 'injectable';
|
|
|
|
var COMPODOC_CURRENT_PAGE_URL = 'TransactionService.html';
|
|
|
|
var MAX_SEARCH_RESULTS = 15;
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script src="../js/libs/custom-elements.min.js"></script>
|
|
|
|
<script src="../js/libs/lit-html.js"></script>
|
2021-09-03 01:48:41 +02:00
|
|
|
|
|
|
|
<script type="module" src="../js/menu-wc.js" defer></script>
|
|
|
|
<script nomodule src="../js/menu-wc_es5.js" defer></script>
|
2021-05-10 20:56:20 +02:00
|
|
|
|
|
|
|
<script src="../js/libs/bootstrap-native.js"></script>
|
|
|
|
|
|
|
|
<script src="../js/libs/es6-shim.min.js"></script>
|
|
|
|
<script src="../js/libs/EventDispatcher.js"></script>
|
|
|
|
<script src="../js/libs/promise.min.js"></script>
|
|
|
|
<script src="../js/libs/zepto.min.js"></script>
|
|
|
|
|
|
|
|
<script src="../js/compodoc.js"></script>
|
|
|
|
|
|
|
|
<script src="../js/tabs.js"></script>
|
|
|
|
<script src="../js/menu.js"></script>
|
|
|
|
<script src="../js/libs/clipboard.min.js"></script>
|
|
|
|
<script src="../js/libs/prism.js"></script>
|
|
|
|
<script src="../js/sourceCode.js"></script>
|
|
|
|
<script src="../js/search/search.js"></script>
|
|
|
|
<script src="../js/search/lunr.min.js"></script>
|
|
|
|
<script src="../js/search/search-lunr.js"></script>
|
|
|
|
<script src="../js/search/search_index.js"></script>
|
|
|
|
<script src="../js/lazy-load-graphs.js"></script>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|