Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
9b7ec9a4
Commit
9b7ec9a4
authored
6 years ago
by
Clint.Network
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding API Block Explorer Endpoint
parent
44370321
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
3 deletions
+51
-3
ApiController.cs
Stratis.Guru/Controllers/ApiController.cs
+48
-1
_Layout.cshtml
Stratis.Guru/Views/Shared/_Layout.cshtml
+1
-0
default.min.css
Stratis.Guru/wwwroot/css/default.min.css
+1
-1
default.min.js
Stratis.Guru/wwwroot/js/default.min.js
+1
-1
No files found.
Stratis.Guru/Controllers/ApiController.cs
View file @
9b7ec9a4
using
System
;
using
System
;
using
System.Security.Cryptography.X509Certificates
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.Options
;
using
NBitcoin
;
using
NBitcoin.Networks
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json
;
using
RestSharp
;
using
Stratis.Guru.Models
;
using
Stratis.Guru.Models
;
using
Stratis.Guru.Settings
;
using
RestClient
=
NBitcoin
.
RPC
.
RestClient
;
namespace
Stratis.Guru.Controllers
namespace
Stratis.Guru.Controllers
{
{
...
@@ -10,11 +17,13 @@ namespace Stratis.Guru.Controllers
...
@@ -10,11 +17,13 @@ namespace Stratis.Guru.Controllers
[
ApiController
]
[
ApiController
]
public
class
ApiController
:
ControllerBase
public
class
ApiController
:
ControllerBase
{
{
private
readonly
NakoApiSettings
_nakoApiSettings
;
private
readonly
IMemoryCache
_memoryCache
;
private
readonly
IMemoryCache
_memoryCache
;
public
ApiController
(
IMemoryCache
memoryCache
)
public
ApiController
(
IMemoryCache
memoryCache
,
IOptions
<
NakoApiSettings
>
nakoApiSettings
)
{
{
_memoryCache
=
memoryCache
;
_memoryCache
=
memoryCache
;
_nakoApiSettings
=
nakoApiSettings
.
Value
;
}
}
[
HttpGet
]
[
HttpGet
]
...
@@ -44,5 +53,43 @@ namespace Stratis.Guru.Controllers
...
@@ -44,5 +53,43 @@ namespace Stratis.Guru.Controllers
return
null
;
return
null
;
}
}
}
}
[
HttpGet
]
[
Route
(
"create-address"
)]
public
ActionResult
<
object
>
CreateAddress
()
{
var
key
=
new
Key
();
return
new
{
PublicKey
=
key
.
PubKey
.
GetAddress
(
new
StratisMain
()).
ToString
(),
PrivateKey
=
key
.
GetWif
(
new
StratisMain
()).
ToString
()};
}
[
HttpGet
]
[
Route
(
"address/{address}"
)]
public
ActionResult
<
object
>
Address
(
string
address
)
{
var
endpointClient
=
new
RestSharp
.
RestClient
(
$"
{
_nakoApiSettings
.
Endpoint
}
query/address/
{
address
}
/transactions"
);
var
enpointRequest
=
new
RestRequest
(
Method
.
GET
);
var
endpointResponse
=
endpointClient
.
Execute
(
enpointRequest
);
return
JsonConvert
.
DeserializeObject
(
endpointResponse
.
Content
);
}
[
HttpGet
]
[
Route
(
"transaction/{transaction}"
)]
public
ActionResult
<
object
>
Transaction
(
string
transaction
)
{
var
endpointClient
=
new
RestSharp
.
RestClient
(
$"
{
_nakoApiSettings
.
Endpoint
}
query/transaction/
{
transaction
}
"
);
var
enpointRequest
=
new
RestRequest
(
Method
.
GET
);
var
endpointResponse
=
endpointClient
.
Execute
(
enpointRequest
);
return
JsonConvert
.
DeserializeObject
(
endpointResponse
.
Content
);
}
[
HttpGet
]
[
Route
(
"block/{block}"
)]
public
ActionResult
<
object
>
Block
(
string
block
)
{
var
endpointClient
=
new
RestSharp
.
RestClient
(
$"
{
_nakoApiSettings
.
Endpoint
}
query/block/index/
{
block
}
/transactions"
);
var
enpointRequest
=
new
RestRequest
(
Method
.
GET
);
var
endpointResponse
=
endpointClient
.
Execute
(
enpointRequest
);
return
JsonConvert
.
DeserializeObject
(
endpointResponse
.
Content
);
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Stratis.Guru/Views/Shared/_Layout.cshtml
View file @
9b7ec9a4
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
<li><a
asp-action=
"Index"
asp-controller=
"BlockExplorer"
><i
class=
"fa fa-cube"
></i>
BLOCK EXPLORER
</a></li>
<li><a
asp-action=
"Index"
asp-controller=
"BlockExplorer"
><i
class=
"fa fa-cube"
></i>
BLOCK EXPLORER
</a></li>
<li><a
asp-action=
"Vanity"
asp-controller=
"Home"
><i
class=
"fa fa-at"
></i>
VANITY
</a></li>
<li><a
asp-action=
"Vanity"
asp-controller=
"Home"
><i
class=
"fa fa-at"
></i>
VANITY
</a></li>
<li><a
asp-action=
"Generator"
asp-controller=
"Home"
><i
class=
"fa fa-qrcode"
></i>
ADDRESS GENERATOR
</a></li>
<li><a
asp-action=
"Generator"
asp-controller=
"Home"
><i
class=
"fa fa-qrcode"
></i>
ADDRESS GENERATOR
</a></li>
<li><a
asp-action=
"API"
asp-controller=
"Home"
><i
class=
"fa fa-book"
></i>
API
</a></li>
<li><a
asp-action=
"About"
asp-controller=
"Home"
><i
class=
"fa fa-info-circle"
></i>
ABOUT STRATIS.GURU
</a></li>
<li><a
asp-action=
"About"
asp-controller=
"Home"
><i
class=
"fa fa-info-circle"
></i>
ABOUT STRATIS.GURU
</a></li>
@*
<li><a
asp-action=
"Contact"
asp-controller=
"Home"
><i
class=
"fa fa-envelope"
></i>
CONTACT
</a></li>
*@
@*
<li><a
asp-action=
"Contact"
asp-controller=
"Home"
><i
class=
"fa fa-envelope"
></i>
CONTACT
</a></li>
*@
</ul>
</ul>
...
...
This diff is collapsed.
Click to expand it.
Stratis.Guru/wwwroot/css/default.min.css
View file @
9b7ec9a4
This diff is collapsed.
Click to expand it.
Stratis.Guru/wwwroot/js/default.min.js
View file @
9b7ec9a4
(
function
(
n
){
"use strict"
;
function
t
(){}
n
(
document
).
ready
(
function
(){
if
(
NProgress
.
start
(),
$
(
'[data-toggle="tooltip"]'
).
tooltip
(),
$
(
".copy-me"
).
click
(
function
(){
$
(
this
).
parent
().
find
(
".to-copy"
).
select
();
document
.
execCommand
(
"copy"
)}),
t
(),
n
(
".menu-trigger"
).
length
&&
n
(
".menu-trigger"
).
click
(
function
(){
n
(
this
).
toggleClass
(
"active"
);
n
(
".header-area .nav"
).
slideToggle
(
200
)}),
n
(
"body"
).
click
(
function
(
t
){
var
i
=
t
.
target
;
if
(
!
n
(
i
).
parents
(
".flag-list"
).
length
&&!
n
(
i
).
hasClass
(
"flag-list"
)){
if
(
n
(
".flag-list"
).
css
(
"display"
)
===
"block"
){
n
(
".flag-list"
).
css
(
"display"
,
"none"
);
return
}(
n
(
i
).
hasClass
(
"selected"
)
||
n
(
i
).
parents
(
".selected"
).
length
)
&&
n
(
".flag-list"
).
css
(
"display"
,
"block"
)}}),
n
(
".countdown"
).
length
&&
n
(
".countdown"
).
downCount
({
date
:
"09/29/2018 12:00:00"
,
offset
:
10
}),
n
(
".token .token-input"
).
length
&&
(
n
(
".token .token-input .fa-plus"
).
click
(
function
(){
var
t
=
n
(
this
).
parent
().
find
(
"input"
).
val
(),
r
=
n
(
this
).
parent
().
find
(
"input"
).
data
(
"step"
),
i
;
t
==
""
&&
(
t
=
0
);
i
=
parseInt
(
t
,
10
)
+
parseInt
(
r
,
10
);
n
(
this
).
parent
().
find
(
"input"
).
val
(
i
)}),
n
(
".token .token-input .fa-minus"
).
click
(
function
(){
var
i
=
n
(
this
).
parent
().
find
(
"input"
).
val
(),
r
=
n
(
this
).
parent
().
find
(
"input"
).
data
(
"step"
),
t
;
i
==
""
&&
(
i
=
0
);
t
=
parseInt
(
i
,
10
)
-
parseInt
(
r
,
10
);
t
<=
0
&&
(
t
=
r
);
n
(
this
).
parent
().
find
(
"input"
).
val
(
t
)})),
window
.
sr
=
new
scrollReveal
,
n
(
"a[href*=#]:not([href=#])"
).
click
(
function
(){
var
t
,
i
;
if
(
location
.
pathname
.
replace
(
/^
\/
/
,
""
)
==
this
.
pathname
.
replace
(
/^
\/
/
,
""
)
&&
location
.
hostname
==
this
.
hostname
&&
(
t
=
n
(
this
.
hash
),
t
=
t
.
length
?
t
:
n
(
"[name="
+
this
.
hash
.
slice
(
1
)
+
"]"
),
t
.
length
))
return
i
=
n
(
window
).
width
(),
i
<
991
&&
(
n
(
".menu-trigger"
).
removeClass
(
"active"
),
n
(
".header-area .nav"
).
slideUp
(
200
)),
n
(
"html,body"
).
animate
({
scrollTop
:
t
.
offset
().
top
-
30
},
700
),
!
1
}),
n
(
".token-progress ul"
).
length
){
n
(
".token-progress ul"
).
find
(
".item"
).
each
(
function
(
t
){
n
(
".token-progress ul .item:eq("
+
[
t
]
+
")"
).
css
(
"left"
,
n
(
".token-progress ul .item:eq("
+
[
t
]
+
")"
).
data
(
"position"
))});
var
i
=
n
(
".token-progress ul .progress-active"
).
data
(
"progress"
);
n
(
".token-progress ul .progress-active"
).
css
(
"width"
,
i
)}
n
(
".table-progress"
).
length
&&
n
(
".table-latests"
).
find
(
".table-progress"
).
each
(
function
(
t
){
n
(
".table-progress:eq("
+
[
t
]
+
") .progress-line"
).
css
(
"width"
,
parseInt
(
n
(
".table-progress:eq("
+
[
t
]
+
") .progress-line"
).
data
(
"value"
),
10
)
+
parseInt
(
70
,
10
)
+
"%"
)});
n
(
".roadmap-modern-wrapper"
).
length
&&
n
(
".roadmap-modern-wrapper"
).
owlCarousel
({
loop
:
!
0
,
margin
:
30
,
nav
:
!
1
,
responsive
:{
0
:{
items
:
1
},
600
:{
items
:
2
},
1
e3
:{
items
:
3
}}});
n
(
".roadmap-lux-wrapper"
).
length
&&
n
(
".roadmap-lux-wrapper"
).
owlCarousel
({
loop
:
!
0
,
margin
:
30
,
nav
:
!
1
,
responsive
:{
0
:{
items
:
1
},
600
:{
items
:
2
},
1
e3
:{
items
:
3
}}})});
n
(
window
).
load
(
function
(){
n
(
".loading-wrapper"
).
animate
({
opacity
:
"0"
},
600
,
function
(){
setTimeout
(
function
(){
n
(
".loading-wrapper"
).
css
(
"visibility"
,
"hidden"
).
fadeOut
();
n
(
".parallax"
).
length
&&
n
(
".parallax"
).
parallax
({
imageSrc
:
"assets/images/parallax.jpg"
,
zIndex
:
"1"
})},
300
)})});
n
(
window
).
scroll
(
function
(){
alert
(
"ok"
)});
n
(
window
).
resize
(
function
(){
t
()})})(
jQuery
);
(
function
(
n
){
"use strict"
;
function
t
(){}
n
(
document
).
ready
(
function
(){
if
(
NProgress
.
start
(),
$
(
'[data-toggle="tooltip"]'
).
tooltip
(),
$
(
".copy-me"
).
click
(
function
(){
$
(
this
).
parent
().
find
(
".to-copy"
).
select
();
document
.
execCommand
(
"copy"
)}),
t
(),
n
(
".menu-trigger"
).
length
&&
n
(
".menu-trigger"
).
click
(
function
(){
n
(
this
).
toggleClass
(
"active"
);
n
(
".header-area .nav"
).
slideToggle
(
200
)}),
n
(
"body"
).
click
(
function
(
t
){
var
i
=
t
.
target
;
if
(
!
n
(
i
).
parents
(
".flag-list"
).
length
&&!
n
(
i
).
hasClass
(
"flag-list"
)){
if
(
n
(
".flag-list"
).
css
(
"display"
)
===
"block"
){
n
(
".flag-list"
).
css
(
"display"
,
"none"
);
return
}(
n
(
i
).
hasClass
(
"selected"
)
||
n
(
i
).
parents
(
".selected"
).
length
)
&&
n
(
".flag-list"
).
css
(
"display"
,
"block"
)}}),
n
(
".countdown"
).
length
&&
n
(
".countdown"
).
downCount
({
date
:
"09/29/2018 12:00:00"
,
offset
:
10
}),
n
(
".token .token-input"
).
length
&&
(
n
(
".token .token-input .fa-plus"
).
click
(
function
(){
var
t
=
n
(
this
).
parent
().
find
(
"input"
).
val
(),
r
=
n
(
this
).
parent
().
find
(
"input"
).
data
(
"step"
),
i
;
t
==
""
&&
(
t
=
0
);
i
=
parseInt
(
t
,
10
)
+
parseInt
(
r
,
10
);
n
(
this
).
parent
().
find
(
"input"
).
val
(
i
)}),
n
(
".token .token-input .fa-minus"
).
click
(
function
(){
var
i
=
n
(
this
).
parent
().
find
(
"input"
).
val
(),
r
=
n
(
this
).
parent
().
find
(
"input"
).
data
(
"step"
),
t
;
i
==
""
&&
(
i
=
0
);
t
=
parseInt
(
i
,
10
)
-
parseInt
(
r
,
10
);
t
<=
0
&&
(
t
=
r
);
n
(
this
).
parent
().
find
(
"input"
).
val
(
t
)})),
window
.
sr
=
new
scrollReveal
,
n
(
"a[href*=#]:not([href=#])"
).
click
(
function
(){
var
t
,
i
;
if
(
location
.
pathname
.
replace
(
/^
\/
/
,
""
)
==
this
.
pathname
.
replace
(
/^
\/
/
,
""
)
&&
location
.
hostname
==
this
.
hostname
&&
(
t
=
n
(
this
.
hash
),
t
=
t
.
length
?
t
:
n
(
"[name="
+
this
.
hash
.
slice
(
1
)
+
"]"
),
t
.
length
))
return
i
=
n
(
window
).
width
(),
i
<
991
&&
(
n
(
".menu-trigger"
).
removeClass
(
"active"
),
n
(
".header-area .nav"
).
slideUp
(
200
)),
n
(
"html,body"
).
animate
({
scrollTop
:
t
.
offset
().
top
-
30
},
700
),
!
1
}),
n
(
".token-progress ul"
).
length
){
n
(
".token-progress ul"
).
find
(
".item"
).
each
(
function
(
t
){
n
(
".token-progress ul .item:eq("
+
[
t
]
+
")"
).
css
(
"left"
,
n
(
".token-progress ul .item:eq("
+
[
t
]
+
")"
).
data
(
"position"
))});
var
i
=
n
(
".token-progress ul .progress-active"
).
data
(
"progress"
);
n
(
".token-progress ul .progress-active"
).
css
(
"width"
,
i
)}
n
(
".table-progress"
).
length
&&
n
(
".table-latests"
).
find
(
".table-progress"
).
each
(
function
(
t
){
n
(
".table-progress:eq("
+
[
t
]
+
") .progress-line"
).
css
(
"width"
,
parseInt
(
n
(
".table-progress:eq("
+
[
t
]
+
") .progress-line"
).
data
(
"value"
),
10
)
+
parseInt
(
70
,
10
)
+
"%"
)});
n
(
".roadmap-modern-wrapper"
).
length
&&
n
(
".roadmap-modern-wrapper"
).
owlCarousel
({
loop
:
!
0
,
margin
:
30
,
nav
:
!
1
,
responsive
:{
0
:{
items
:
1
},
600
:{
items
:
2
},
1
e3
:{
items
:
3
}}});
n
(
".roadmap-lux-wrapper"
).
length
&&
n
(
".roadmap-lux-wrapper"
).
owlCarousel
({
loop
:
!
0
,
margin
:
30
,
nav
:
!
1
,
responsive
:{
0
:{
items
:
1
},
600
:{
items
:
2
},
1
e3
:{
items
:
3
}}})});
n
(
window
).
load
(
function
(){
n
(
".loading-wrapper"
).
animate
({
opacity
:
"0"
},
600
,
function
(){
setTimeout
(
function
(){
n
(
".loading-wrapper"
).
css
(
"visibility"
,
"hidden"
).
fadeOut
();
n
(
".parallax"
).
length
&&
n
(
".parallax"
).
parallax
({
imageSrc
:
"assets/images/parallax.jpg"
,
zIndex
:
"1"
})},
300
)})});
n
(
window
).
scroll
(
function
(){
var
i
=
n
(
window
).
width
(),
t
;
i
<
9910
&&
(
t
=
n
(
window
).
scrollTop
(),
t
>=
30
?(
n
(
".header-area"
).
addClass
(
"header-sticky"
),
n
(
".header-area .dark-logo"
).
css
(
"display"
,
"block"
),
n
(
".header-area .light-logo"
).
css
(
"display"
,
"none"
)):(
n
(
".header-area"
).
removeClass
(
"header-sticky"
),
n
(
".header-area .dark-logo"
).
css
(
"display"
,
"none"
),
n
(
".header-area .light-logo"
).
css
(
"display"
,
"block"
)))});
n
(
window
).
resize
(
function
(){
t
()})})(
jQuery
);
\ No newline at end of file
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment