This repository has been archived by the owner on Dec 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
8 changed files
with
112 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cyb.ai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { Component } from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { getTransaction } from '../../redux/wallet'; | ||
|
||
import './transaction.css'; | ||
|
||
function syntaxHighlight(json) { | ||
if (typeof json != 'string') { | ||
json = JSON.stringify(json, undefined, 2); | ||
} | ||
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); | ||
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { | ||
var cls = 'number'; | ||
if (/^"/.test(match)) { | ||
if (/:$/.test(match)) { | ||
cls = 'key'; | ||
} else { | ||
cls = 'string'; | ||
} | ||
} else if (/true|false/.test(match)) { | ||
cls = 'boolean'; | ||
} else if (/null/.test(match)) { | ||
cls = 'null'; | ||
} | ||
return '<span class="' + cls + '">' + match + '</span>'; | ||
}); | ||
} | ||
|
||
class TransactionView extends Component { | ||
componentDidMount() { | ||
this.props.getTransaction(this.props.params.txHash) | ||
} | ||
render() { | ||
const { data } = this.props; | ||
return ( | ||
<div> | ||
<h2>transaction</h2> | ||
{data ? ( | ||
<pre dangerouslySetInnerHTML={{ __html: syntaxHighlight(data) }}> | ||
</pre> | ||
): ( | ||
<div>not found</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default connect( | ||
state => ({ | ||
data: state.wallet.transaction | ||
}), | ||
{ | ||
getTransaction | ||
} | ||
)(TransactionView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; } | ||
.string { color: green; } | ||
.number { color: darkorange; } | ||
.boolean { color: blue; } | ||
.null { color: magenta; } | ||
.key { color: red; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters