@cityofzion/bs-neo-legacy 0.4.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +21 -0
- package/.rush/temp/shrinkwrap-deps.json +2 -2
- package/bs-neo-legacy.build.log +1 -86
- package/dist/BSNeoLegacy.d.ts +20 -23
- package/dist/BSNeoLegacy.js +118 -135
- package/dist/CryptoCompareEDSNeoLegacy.d.ts +7 -0
- package/dist/CryptoCompareEDSNeoLegacy.js +41 -0
- package/dist/DoraBDSNeoLegacy.d.ts +15 -0
- package/dist/DoraBDSNeoLegacy.js +162 -0
- package/dist/assets/tokens/common.json +18 -0
- package/dist/assets/tokens/mainnet.json +620 -0
- package/dist/constants.d.ts +10 -4
- package/dist/constants.js +20 -17
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/docs/assets/search.js +1 -1
- package/docs/classes/BDSNeoLegacy.html +13 -13
- package/docs/classes/BSNeoLegacy.html +81 -37
- package/docs/interfaces/DoraNeoLegacyAsset.html +7 -7
- package/docs/interfaces/DoraNeoLegacyAssetResponse.html +9 -9
- package/docs/interfaces/DoraNeoLegacyBalance.html +5 -5
- package/docs/interfaces/DoraNeoLegacyConsensusNode.html +3 -3
- package/docs/interfaces/DoraNeoLegacyDetails.html +12 -12
- package/docs/interfaces/DoraNeoLegacyEntriesEntity.html +8 -8
- package/docs/interfaces/DoraNeoLegacyNameEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyScriptsEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyTransaction.html +14 -14
- package/docs/interfaces/DoraNeoLegacyTransactionsHistory.html +6 -6
- package/docs/interfaces/DoraNeoLegacyUnclaimed.html +4 -4
- package/docs/interfaces/DoraNeoLegacyVinEntity.html +3 -3
- package/docs/interfaces/DoraNeoLegacyVoutEntity.html +5 -5
- package/docs/variables/DORA_NEO_LEGACY_ASSET.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_BALANCE.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_CONTRACT.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_HISTORY_TRANSACTIONS.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_NODES.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_TRANSACTION.html +1 -1
- package/docs/variables/DORA_NEO_LEGACY_UNCLAIMED.html +1 -1
- package/docs/variables/explorerNeoLegacyOption.html +1 -1
- package/jest.config.ts +13 -0
- package/jest.setup.ts +1 -0
- package/package.json +10 -6
- package/src/BSNeoLegacy.ts +184 -152
- package/src/CryptoCompareEDSNeoLegacy.ts +40 -0
- package/src/DoraBDSNeoLegacy.ts +171 -0
- package/src/__tests__/BDSNeoLegacy.spec.ts +120 -0
- package/src/__tests__/BSNeoLegacy.spec.ts +127 -0
- package/src/__tests__/CryptoCompareExchange.spec.ts +46 -0
- package/src/assets/tokens/common.json +18 -0
- package/src/assets/tokens/mainnet.json +620 -0
- package/src/constants.ts +20 -17
- package/src/index.ts +3 -2
- package/tsconfig.build.json +4 -0
- package/tsconfig.json +3 -7
- package/bs-neo-legacy.build.error.log +0 -84
- package/src/BDSNeoLegacy.ts +0 -163
- package/src/asset/blockchain_icon_neo_legacy.png +0 -0
- package/src/asset/blockchain_icon_neo_legacy_white.png +0 -0
- package/src/asset/tokens.json +0 -481
- package/src/explorer/dora/DoraResponsesNeoLegacy.ts +0 -107
- package/src/explorer/dora/DoraRoutesNeoLegacy.ts +0 -7
- package/src/explorer/index.ts +0 -8
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<ul class="tsd-hierarchy">
|
|
21
21
|
<li><span class="target">DoraNeoLegacyVinEntity</span></li></ul></section><aside class="tsd-sources">
|
|
22
22
|
<ul>
|
|
23
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
23
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L60">explorer/dora/DoraResponsesNeoLegacy.ts:60</a></li></ul></aside>
|
|
24
24
|
<section class="tsd-panel-group tsd-index-group">
|
|
25
25
|
<section class="tsd-panel tsd-index-panel">
|
|
26
26
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
<h3 class="tsd-anchor-link"><span>txid</span><a href="#txid" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
|
|
38
38
|
<div class="tsd-signature">txid<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
|
|
39
39
|
<ul>
|
|
40
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
40
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L61">explorer/dora/DoraResponsesNeoLegacy.ts:61</a></li></ul></aside></section>
|
|
41
41
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="vout" class="tsd-anchor"></a>
|
|
42
42
|
<h3 class="tsd-anchor-link"><span>vout</span><a href="#vout" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
43
43
|
<div class="tsd-signature">vout<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
|
|
44
44
|
<ul>
|
|
45
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
45
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L62">explorer/dora/DoraResponsesNeoLegacy.ts:62</a></li></ul></aside></section></section></div>
|
|
46
46
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
47
47
|
<div class="tsd-navigation settings">
|
|
48
48
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<ul class="tsd-hierarchy">
|
|
21
21
|
<li><span class="target">DoraNeoLegacyVoutEntity</span></li></ul></section><aside class="tsd-sources">
|
|
22
22
|
<ul>
|
|
23
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
23
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L64">explorer/dora/DoraResponsesNeoLegacy.ts:64</a></li></ul></aside>
|
|
24
24
|
<section class="tsd-panel-group tsd-index-group">
|
|
25
25
|
<section class="tsd-panel tsd-index-panel">
|
|
26
26
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
<h3 class="tsd-anchor-link"><span>address</span><a href="#address" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
|
|
40
40
|
<div class="tsd-signature">address<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
|
|
41
41
|
<ul>
|
|
42
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
42
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L68">explorer/dora/DoraResponsesNeoLegacy.ts:68</a></li></ul></aside></section>
|
|
43
43
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="asset" class="tsd-anchor"></a>
|
|
44
44
|
<h3 class="tsd-anchor-link"><span>asset</span><a href="#asset" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
45
45
|
<div class="tsd-signature">asset<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
|
|
46
46
|
<ul>
|
|
47
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
47
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L66">explorer/dora/DoraResponsesNeoLegacy.ts:66</a></li></ul></aside></section>
|
|
48
48
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="n" class="tsd-anchor"></a>
|
|
49
49
|
<h3 class="tsd-anchor-link"><span>n</span><a href="#n" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
50
50
|
<div class="tsd-signature">n<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span></div><aside class="tsd-sources">
|
|
51
51
|
<ul>
|
|
52
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
52
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L65">explorer/dora/DoraResponsesNeoLegacy.ts:65</a></li></ul></aside></section>
|
|
53
53
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="value" class="tsd-anchor"></a>
|
|
54
54
|
<h3 class="tsd-anchor-link"><span>value</span><a href="#value" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
55
55
|
<div class="tsd-signature">value<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><aside class="tsd-sources">
|
|
56
56
|
<ul>
|
|
57
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
57
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraResponsesNeoLegacy.ts#L67">explorer/dora/DoraResponsesNeoLegacy.ts:67</a></li></ul></aside></section></section></div>
|
|
58
58
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
59
59
|
<div class="tsd-navigation settings">
|
|
60
60
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_ASSET<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>ASSET<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"asset"</span><span class="tsd-signature-symbol"> = 'asset'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L6">explorer/dora/DoraRoutesNeoLegacy.ts:6</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_BALANCE<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>BALANCE<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"balance"</span><span class="tsd-signature-symbol"> = 'balance'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L3">explorer/dora/DoraRoutesNeoLegacy.ts:3</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_CONTRACT<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>CONTRACT<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"contract"</span><span class="tsd-signature-symbol"> = 'contract'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L4">explorer/dora/DoraRoutesNeoLegacy.ts:4</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_HISTORY_TRANSACTIONS<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>HISTORY_<wbr/>TRANSACTIONS<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"get_address_abstracts"</span><span class="tsd-signature-symbol"> = 'get_address_abstracts'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L2">explorer/dora/DoraRoutesNeoLegacy.ts:2</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_NODES<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>NODES<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"get_all_nodes"</span><span class="tsd-signature-symbol"> = 'get_all_nodes'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L1">explorer/dora/DoraRoutesNeoLegacy.ts:1</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_TRANSACTION<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>TRANSACTION<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"transaction"</span><span class="tsd-signature-symbol"> = 'transaction'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L5">explorer/dora/DoraRoutesNeoLegacy.ts:5</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<h1>Variable DORA_NEO_LEGACY_UNCLAIMED<code class="tsd-tag ts-flagConst">Const</code> </h1></div>
|
|
18
18
|
<div class="tsd-signature">DORA_<wbr/>NEO_<wbr/>LEGACY_<wbr/>UNCLAIMED<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"get_unclaimed"</span><span class="tsd-signature-symbol"> = 'get_unclaimed'</span></div><aside class="tsd-sources">
|
|
19
19
|
<ul>
|
|
20
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
20
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/dora/DoraRoutesNeoLegacy.ts#L7">explorer/dora/DoraRoutesNeoLegacy.ts:7</a></li></ul></aside></div>
|
|
21
21
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
22
22
|
<div class="tsd-navigation settings">
|
|
23
23
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
<li class="tsd-parameter">
|
|
23
23
|
<h5>dora<span class="tsd-signature-symbol">: </span><a href="../classes/BDSNeoLegacy.html" class="tsd-signature-type" data-tsd-kind="Class">BDSNeoLegacy</a></h5></li></ul></div><aside class="tsd-sources">
|
|
24
24
|
<ul>
|
|
25
|
-
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/
|
|
25
|
+
<li>Defined in <a href="https://github.com/CityOfZion/blockchain-services/blob/38910fc/packages/bs-neo-legacy/src/explorer/index.ts#L6">explorer/index.ts:6</a></li></ul></aside></div>
|
|
26
26
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
27
27
|
<div class="tsd-navigation settings">
|
|
28
28
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { JestConfigWithTsJest } from 'ts-jest'
|
|
2
|
+
const config: JestConfigWithTsJest = {
|
|
3
|
+
preset: 'ts-jest',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
clearMocks: true,
|
|
6
|
+
verbose: true,
|
|
7
|
+
bail: true,
|
|
8
|
+
testMatch: ['<rootDir>/**/*.spec.ts'],
|
|
9
|
+
setupFiles: ['<rootDir>/jest.setup.ts'],
|
|
10
|
+
detectOpenHandles: true,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default config
|
package/jest.setup.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'dotenv/config'
|
package/package.json
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cityofzion/bs-neo-legacy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"author": "Coz",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "tsc
|
|
9
|
+
"build": "tsc --project tsconfig.build.json",
|
|
10
|
+
"test": "jest --config jest.config.ts"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@cityofzion/blockchain-service": "0.
|
|
13
|
+
"@cityofzion/blockchain-service": "0.7.1",
|
|
14
|
+
"@cityofzion/bs-asteroid-sdk": "0.7.1",
|
|
13
15
|
"@cityofzion/dora-ts": "0.0.11",
|
|
14
|
-
"@cityofzion/neon-js": "
|
|
15
|
-
"axios": "1.3.2"
|
|
16
|
+
"@cityofzion/neon-js": "4.8.3"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
19
|
"ts-node": "10.9.1",
|
|
19
20
|
"typescript": "4.9.5",
|
|
20
|
-
"
|
|
21
|
+
"jest": "29.6.2",
|
|
22
|
+
"ts-jest": "29.1.1",
|
|
23
|
+
"@types/jest": "29.5.3",
|
|
24
|
+
"dotenv": "16.3.1"
|
|
21
25
|
}
|
|
22
26
|
}
|
package/src/BSNeoLegacy.ts
CHANGED
|
@@ -1,159 +1,191 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Account,
|
|
3
|
+
BDSClaimable,
|
|
4
|
+
BlockchainDataService,
|
|
5
|
+
BlockchainService,
|
|
6
|
+
BSClaimable,
|
|
7
|
+
ExchangeDataService,
|
|
8
|
+
Token,
|
|
9
|
+
Network,
|
|
10
|
+
PartialBy,
|
|
11
|
+
TransferParam,
|
|
12
|
+
AccountWithDerivationPath,
|
|
13
|
+
} from '@cityofzion/blockchain-service'
|
|
2
14
|
import { api, sc, u, wallet } from '@cityofzion/neon-js'
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
async decryptKey(encryptedKey: string, password: string): Promise<Account> {
|
|
48
|
-
const wif = await wallet.decrypt(encryptedKey, password)
|
|
49
|
-
const { address } = new wallet.Account(wif)
|
|
50
|
-
const result: { wif: string; address: string; } = { address, wif }
|
|
51
|
-
return result
|
|
52
|
-
}
|
|
53
|
-
calculateTransferFee(): Promise<CalculateTransferFeeResponse> {
|
|
54
|
-
throw new Error(`Doesn't have fee to make a transaction on ${this.blockchainName}`);
|
|
55
|
-
}
|
|
56
|
-
async sendTransaction(param: SendTransactionParam): Promise<string> {
|
|
57
|
-
const url = (await this.dataService.getHigherNode()).url
|
|
58
|
-
const apiProvider = new api.neoscan.instance("MainNet")
|
|
59
|
-
const account = new wallet.Account(param.senderAccount.wif)
|
|
60
|
-
const intentsWithTye = this.setTypeIntents(param.transactionIntents)
|
|
61
|
-
const isNativeTransaction = intentsWithTye.every(intent => intent.type === 'native')
|
|
62
|
-
const priorityFee = param.priorityFee ?? 0
|
|
63
|
-
const [gasAsset] = this.nativeAssets
|
|
64
|
-
const gasBalance = (await this.dataService.getBalance(param.senderAccount.address)).find(balance => balance.hash === gasAsset.hash)
|
|
65
|
-
if (gasBalance?.amount < priorityFee) throw new Error("Don't have funds to pay the transaction");
|
|
66
|
-
const transactionOperations = {
|
|
67
|
-
native: () => {
|
|
68
|
-
return api.sendAsset({
|
|
69
|
-
account,
|
|
70
|
-
api: apiProvider,
|
|
71
|
-
url,
|
|
72
|
-
intents: this.buildNativeTransaction(param.transactionIntents),
|
|
73
|
-
fees: priorityFee
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
nep5: () => {
|
|
77
|
-
const extraIntentsNep5 = intentsWithTye.filter(it => it.type === 'native').map(it => {
|
|
78
|
-
const { type, ...rest } = it
|
|
79
|
-
return rest
|
|
80
|
-
})
|
|
81
|
-
return api.doInvoke({
|
|
82
|
-
intents: extraIntentsNep5.length > 0 ? this.buildNativeTransaction(extraIntentsNep5) : undefined,
|
|
83
|
-
account,
|
|
84
|
-
api: apiProvider,
|
|
85
|
-
script: this.buildNep5Transaction(param.transactionIntents, param.senderAccount).str,
|
|
86
|
-
url,
|
|
87
|
-
fees: priorityFee
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
const result = isNativeTransaction ? await transactionOperations.native() : await transactionOperations.nep5()
|
|
92
|
-
if (!result.tx) throw new Error("Failed to send transaction");
|
|
93
|
-
return result.tx.hash
|
|
94
|
-
}
|
|
95
|
-
//Implementation Claim interface
|
|
96
|
-
async claim(account: Account): Promise<ClaimResponse> {
|
|
97
|
-
const neoAccount = new wallet.Account(account.wif)
|
|
98
|
-
const balances = await this.dataService.getBalance(account.address)
|
|
99
|
-
const neoBalance = balances.find(balance => balance.symbol === 'NEO')
|
|
100
|
-
const apiProvider = new api.neoscan.instance("MainNet")
|
|
101
|
-
const neoNativeAsset = this.nativeAssets.find(nativeAsset => nativeAsset.symbol === neoBalance?.symbol)
|
|
102
|
-
if (!neoNativeAsset || !neoBalance) throw new Error("Neo it's necessary to do a claim");
|
|
103
|
-
const hasClaim = await this.dataService.getUnclaimed(account.address)
|
|
104
|
-
if (hasClaim.unclaimed <= 0) throw new Error(`Doesn't have gas to claim`);
|
|
105
|
-
const url = (await this.dataService.getHigherNode()).url
|
|
106
|
-
const claims = await api.neoCli.getClaims(url, account.address)
|
|
107
|
-
const claimGasResponse = await api.claimGas({
|
|
108
|
-
claims,
|
|
109
|
-
api: apiProvider,
|
|
110
|
-
account: neoAccount,
|
|
111
|
-
url
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
const result: { txid: string; symbol: string; hash: string } = {
|
|
115
|
-
txid: claimGasResponse.response.txid,
|
|
116
|
-
hash: unclaimedTokenNeoLegacy.hash,
|
|
117
|
-
symbol: unclaimedTokenNeoLegacy.symbol
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return result
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_URL_BY_NETWORK_TYPE,
|
|
17
|
+
DERIVATION_PATH,
|
|
18
|
+
LEGACY_NETWORK_BY_NETWORK_TYPE,
|
|
19
|
+
NATIVE_ASSETS,
|
|
20
|
+
TOKENS,
|
|
21
|
+
} from './constants'
|
|
22
|
+
import { DoraBDSNeoLegacy } from './DoraBDSNeoLegacy'
|
|
23
|
+
import { CryptoCompareEDSNeoLegacy } from './CryptoCompareEDSNeoLegacy'
|
|
24
|
+
import { keychain } from '@cityofzion/bs-asteroid-sdk'
|
|
25
|
+
|
|
26
|
+
export class BSNeoLegacy<BSCustomName extends string = string> implements BlockchainService, BSClaimable {
|
|
27
|
+
readonly blockchainName: BSCustomName
|
|
28
|
+
readonly feeToken: Token
|
|
29
|
+
readonly claimToken: Token
|
|
30
|
+
readonly burnToken: Token
|
|
31
|
+
readonly derivationPath: string
|
|
32
|
+
|
|
33
|
+
blockchainDataService!: BlockchainDataService & BDSClaimable
|
|
34
|
+
exchangeDataService!: ExchangeDataService
|
|
35
|
+
tokens: Token[]
|
|
36
|
+
network!: Network
|
|
37
|
+
legacyNetwork: string
|
|
38
|
+
|
|
39
|
+
constructor(blockchainName: BSCustomName, network: PartialBy<Network, 'url'>) {
|
|
40
|
+
if (network.type === 'custom') throw new Error('Custom network is not supported for NEO Legacy')
|
|
41
|
+
|
|
42
|
+
this.blockchainName = blockchainName
|
|
43
|
+
this.legacyNetwork = LEGACY_NETWORK_BY_NETWORK_TYPE[network.type]
|
|
44
|
+
this.derivationPath = DERIVATION_PATH
|
|
45
|
+
this.tokens = TOKENS[network.type]
|
|
46
|
+
this.claimToken = this.tokens.find(token => token.symbol === 'GAS')!
|
|
47
|
+
this.burnToken = this.tokens.find(token => token.symbol === 'NEO')!
|
|
48
|
+
this.feeToken = this.tokens.find(token => token.symbol === 'GAS')!
|
|
49
|
+
this.setNetwork(network)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
setNetwork(param: PartialBy<Network, 'url'>) {
|
|
53
|
+
if (param.type === 'custom') throw new Error('Custom network is not supported for NEO Legacy')
|
|
54
|
+
|
|
55
|
+
const network = {
|
|
56
|
+
type: param.type,
|
|
57
|
+
url: param.url ?? DEFAULT_URL_BY_NETWORK_TYPE[param.type],
|
|
121
58
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
59
|
+
this.network = network
|
|
60
|
+
this.blockchainDataService = new DoraBDSNeoLegacy(network, this.feeToken, this.claimToken)
|
|
61
|
+
this.exchangeDataService = new CryptoCompareEDSNeoLegacy(network.type)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
validateAddress(address: string): boolean {
|
|
65
|
+
return wallet.isAddress(address)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
validateEncrypted(key: string): boolean {
|
|
69
|
+
return wallet.isNEP2(key)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
validateKey(key: string): boolean {
|
|
73
|
+
return wallet.isWIF(key) || wallet.isPrivateKey(key)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
generateAccountFromMnemonic(mnemonic: string[] | string, index: number): AccountWithDerivationPath {
|
|
77
|
+
keychain.importMnemonic(Array.isArray(mnemonic) ? mnemonic.join(' ') : mnemonic)
|
|
78
|
+
const path = this.derivationPath.replace('?', index.toString())
|
|
79
|
+
const childKey = keychain.generateChildKey('neo', path)
|
|
80
|
+
const key = childKey.getWIF()
|
|
81
|
+
const { address } = new wallet.Account(key)
|
|
82
|
+
return { address, key, type: 'wif', derivationPath: path }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
generateAccountFromKey(key: string): Account {
|
|
86
|
+
const type = wallet.isWIF(key) ? 'wif' : wallet.isPrivateKey(key) ? 'privateKey' : undefined
|
|
87
|
+
if (!type) throw new Error('Invalid key')
|
|
88
|
+
|
|
89
|
+
const { address } = new wallet.Account(key)
|
|
90
|
+
return { address, key, type }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async decrypt(encryptedKey: string, password: string): Promise<Account> {
|
|
94
|
+
let BsReactNativeDecrypt: any
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
const { NativeModules } = require('react-native')
|
|
98
|
+
BsReactNativeDecrypt = NativeModules.BsReactNativeDecrypt
|
|
99
|
+
} catch {
|
|
100
|
+
const key = await wallet.decrypt(encryptedKey, password)
|
|
101
|
+
return this.generateAccountFromKey(key)
|
|
131
102
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (!this.isNativeTransaction(transaction)) {
|
|
136
|
-
const senderHash = u.reverseHex(wallet.getScriptHashFromAddress(senderAccount.address))
|
|
137
|
-
const receiveHash = u.reverseHex(wallet.getScriptHashFromAddress(transaction.receiverAddress))
|
|
138
|
-
const adjustedAmount = new u.Fixed8(transaction.amount).toRawNumber()
|
|
139
|
-
sb.emitAppCall(transaction.tokenHash.replace('0x', ''), "transfer", [
|
|
140
|
-
senderHash,
|
|
141
|
-
receiveHash,
|
|
142
|
-
sc.ContractParam.integer(adjustedAmount.toString())
|
|
143
|
-
])
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
return sb
|
|
103
|
+
|
|
104
|
+
if (!BsReactNativeDecrypt) {
|
|
105
|
+
throw new Error('@CityOfZion/bs-react-native-decrypt is not installed')
|
|
147
106
|
}
|
|
148
|
-
private setTypeIntents(transactionIntents: IntentTransactionParam[]) {
|
|
149
|
-
type TransactionIntentResponse = IntentTransactionParam & { type: 'native' | 'nep5' }
|
|
150
107
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
108
|
+
const privateKey = await BsReactNativeDecrypt.decryptNeoLegacy(encryptedKey, password)
|
|
109
|
+
return this.generateAccountFromKey(privateKey)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async transfer({ intent: transferIntent, senderAccount, tipIntent, ...params }: TransferParam): Promise<string> {
|
|
113
|
+
const apiProvider = new api.neoCli.instance(this.network.url)
|
|
114
|
+
const account = new wallet.Account(senderAccount.key)
|
|
115
|
+
const priorityFee = Number(params.priorityFee ?? 0)
|
|
116
|
+
|
|
117
|
+
const nativeIntents: ReturnType<typeof api.makeIntent> = []
|
|
118
|
+
const nep5ScriptBuilder = new sc.ScriptBuilder()
|
|
119
|
+
|
|
120
|
+
const intents = [transferIntent, ...(tipIntent ? [tipIntent] : [])]
|
|
121
|
+
|
|
122
|
+
for (const intent of intents) {
|
|
123
|
+
const tokenHashFixed = intent.tokenHash.replace('0x', '')
|
|
124
|
+
|
|
125
|
+
const nativeAsset = NATIVE_ASSETS.find(asset => asset.hash === tokenHashFixed)
|
|
126
|
+
if (nativeAsset) {
|
|
127
|
+
nativeIntents.push(...api.makeIntent({ [nativeAsset.symbol]: Number(intent.amount) }, intent.receiverAddress))
|
|
128
|
+
continue
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
nep5ScriptBuilder.emitAppCall(tokenHashFixed, 'transfer', [
|
|
132
|
+
u.reverseHex(wallet.getScriptHashFromAddress(account.address)),
|
|
133
|
+
u.reverseHex(wallet.getScriptHashFromAddress(intent.receiverAddress)),
|
|
134
|
+
sc.ContractParam.integer(
|
|
135
|
+
new u.Fixed8(intent.amount)
|
|
136
|
+
.div(Math.pow(10, 8 - (intent.tokenDecimals ?? 8)))
|
|
137
|
+
.toRawNumber()
|
|
138
|
+
.toString()
|
|
139
|
+
),
|
|
140
|
+
])
|
|
155
141
|
}
|
|
156
|
-
|
|
157
|
-
|
|
142
|
+
|
|
143
|
+
let response
|
|
144
|
+
|
|
145
|
+
if (nep5ScriptBuilder.isEmpty()) {
|
|
146
|
+
response = await api.sendAsset({
|
|
147
|
+
account,
|
|
148
|
+
api: apiProvider,
|
|
149
|
+
url: this.network.url,
|
|
150
|
+
intents: nativeIntents,
|
|
151
|
+
fees: priorityFee,
|
|
152
|
+
})
|
|
153
|
+
} else {
|
|
154
|
+
response = await api.doInvoke({
|
|
155
|
+
intents: nativeIntents.length > 0 ? nativeIntents : undefined,
|
|
156
|
+
account,
|
|
157
|
+
api: apiProvider,
|
|
158
|
+
script: nep5ScriptBuilder.str,
|
|
159
|
+
url: this.network.url,
|
|
160
|
+
fees: priorityFee,
|
|
161
|
+
})
|
|
158
162
|
}
|
|
159
|
-
|
|
163
|
+
|
|
164
|
+
if (!response.tx) throw new Error('Failed to send transaction')
|
|
165
|
+
return response.tx.hash
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
async claim(account: Account): Promise<string> {
|
|
169
|
+
const neoAccount = new wallet.Account(account.key)
|
|
170
|
+
|
|
171
|
+
const balances = await this.blockchainDataService.getBalance(account.address)
|
|
172
|
+
const neoBalance = balances.find(balance => balance.token.symbol === 'NEO')
|
|
173
|
+
if (!neoBalance) throw new Error('It is necessary to have NEO to claim')
|
|
174
|
+
|
|
175
|
+
const unclaimed = await this.blockchainDataService.getUnclaimed(account.address)
|
|
176
|
+
if (Number(unclaimed) <= 0) throw new Error(`Doesn't have gas to claim`)
|
|
177
|
+
|
|
178
|
+
const apiProvider = new api.neoCli.instance(this.legacyNetwork)
|
|
179
|
+
const claims = await apiProvider.getClaims(account.address)
|
|
180
|
+
|
|
181
|
+
const response = await api.claimGas({
|
|
182
|
+
claims,
|
|
183
|
+
api: apiProvider,
|
|
184
|
+
account: neoAccount,
|
|
185
|
+
url: this.network.url,
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
if (!response.tx) throw new Error('Failed to claim')
|
|
189
|
+
return response.tx.hash
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Currency, ExchangeDataService, NetworkType, TokenPricesResponse } from '@cityofzion/blockchain-service'
|
|
2
|
+
import axios, { AxiosInstance } from 'axios'
|
|
3
|
+
import { TOKENS } from './constants'
|
|
4
|
+
|
|
5
|
+
type CryptoCompareDataResponse = {
|
|
6
|
+
RAW: {
|
|
7
|
+
[symbol: string]: {
|
|
8
|
+
[currency: string]: {
|
|
9
|
+
PRICE: number
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class CryptoCompareEDSNeoLegacy implements ExchangeDataService {
|
|
16
|
+
networkType: NetworkType
|
|
17
|
+
private axiosInstance: AxiosInstance
|
|
18
|
+
|
|
19
|
+
constructor(network: NetworkType) {
|
|
20
|
+
this.networkType = network
|
|
21
|
+
this.axiosInstance = axios.create({ baseURL: 'https://min-api.cryptocompare.com' })
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async getTokenPrices(currency: Currency): Promise<TokenPricesResponse[]> {
|
|
25
|
+
if (this.networkType !== 'mainnet') throw new Error('Exchange is only available on mainnet')
|
|
26
|
+
|
|
27
|
+
const tokenSymbols = TOKENS[this.networkType].map(token => token.symbol)
|
|
28
|
+
const { data: prices } = await this.axiosInstance.get<CryptoCompareDataResponse>('/data/pricemultifull', {
|
|
29
|
+
params: {
|
|
30
|
+
fsyms: tokenSymbols.join(','),
|
|
31
|
+
tsyms: currency,
|
|
32
|
+
},
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return Object.entries(prices.RAW).map(([symbol, price]) => ({
|
|
36
|
+
symbol,
|
|
37
|
+
price: price[currency].PRICE,
|
|
38
|
+
}))
|
|
39
|
+
}
|
|
40
|
+
}
|