Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
wGOVM of gui wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
lengzhao committed Sep 13, 2020
1 parent 66abd2e commit bdce4e0
Show file tree
Hide file tree
Showing 10 changed files with 146 additions and 45 deletions.
9 changes: 7 additions & 2 deletions bin/gui/assets/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
"View Private Key":"查看明文私钥",
"Register Miner":"注册矿工",
"Miner":"矿工",
"Number":"数量",
"":""
"Eth Address":"以太坊地址",
"Run APP":"执行App",
"Data":"数据",
"Data Type":"数据类型",
"wgovm_desc":"将govm兑换为以太坊的wGovm\n1.执行当前App锁定govm\n2.管理员签名\n3.你自己在以太坊上造币(http://govm.net:9090/wgovm.html)",
"":"",
"Number":"数量"
}
2 changes: 1 addition & 1 deletion bin/gui/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mkdir $folder
mv govm.exe $folder
cp assets $folder -rf
cp conf.json $folder -rf
zip -r govm_windows_wallet_$(date +'%Y%m%d_%H%M%S').tar.gz $folder
zip -r govm_windows_wallet_$(date +'%Y%m%d_%H%M%S').zip $folder
echo Enter to exit
read k
rm $folder -rf
2 changes: 1 addition & 1 deletion bin/gui/conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

// Vserion version of wallet
const Vserion = "v0.5.2"
const Vserion = "v0.5.3"

// Config config
type Config struct {
Expand Down
1 change: 1 addition & 0 deletions bin/gui/res/resoure.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var i18n = map[string]string{
"opCode.6": "Register Miner",
"setting.desc": "Restart after setting",
"vote_desc": "After voting, collect the income yourself (every month through 0 vote)",
"wgovm_desc": "govm exchange to eth.wGovm\n1. run this.Contract to lock coins.\n2. sign by admin(1 day)\n3. relayMint by yourself(http://govm.net:9090/wgovm.html)",
}

var readFile func(fn string) ([]byte, error)
Expand Down
1 change: 1 addition & 0 deletions bin/gui/screens/master.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func Master(a fyne.App) fyne.Window {
tabs := widget.NewTabContainer(
widget.NewTabItemWithIcon(res.GetLocalString("Home"), theme.HomeIcon(), AccountScreen(w)),
widget.NewTabItemWithIcon(res.GetLocalString("Transaction"), theme.MailSendIcon(), TransactionScreen(w)),
widget.NewTabItemWithIcon(res.GetLocalString("APP"), theme.MenuIcon(), AppScreen(w)),
widget.NewTabItemWithIcon(res.GetLocalString("Search"), theme.SearchIcon(), SearchScreen(w)),
widget.NewTabItemWithIcon(res.GetLocalString("History"), theme.ContentPasteIcon(), HistoryScreen(w)),
widget.NewTabItemWithIcon(res.GetLocalString("Setting"), theme.SettingsIcon(), SettingScreen(w)))
Expand Down
2 changes: 1 addition & 1 deletion bin/html/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mv html_wallet_linux $folder
mv html_wallet_mac $folder
cp static $folder -rf
#tar zcvf "$folder"_$(date +'%Y%m%d_%H%M%S').tar.gz $folder
zip -r "$folder"_$(date +'%Y%m%d_%H%M%S').tar.gz $folder
zip -r "$folder"_$(date +'%Y%m%d_%H%M%S').zip $folder
rm $folder -rf
echo Enter to exit
read k
3 changes: 3 additions & 0 deletions bin/html/static/js/encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ function dataEncode(input, type) {
case "bytes2int":
return dataEncode(dataEncode(input, "bytes2hex"), "hex2int")
case "hex2int":
if (input === undefined) {
return 0;
}
return parseInt(input, 16)
case "hex2bytes":
var myUint8Array = new Uint8Array(input.match(/[\da-f]{2}/gi).map(function (h) {
Expand Down
59 changes: 52 additions & 7 deletions bin/html/static/wgovm.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@
<link href="css/bootstrap.min.css" rel="stylesheet">
<link rel="icon" type="image/x-ico" href="logo.ico" />
<link rel="shortcut icon" href="logo.ico">
<style type="text/css">
input[readonly].form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;

}
</style>
</head>

<body ng-app="">
Expand Down Expand Up @@ -70,30 +91,31 @@ <h3 class="panel-title" data-localize="relayMint">
<input type="text" class="form-control" id="search_key">
<span class="input-group-btn">
<button class="btn btn-default" type="button" id="btn_key" data-localize="go">Go!</button>
<button class="btn btn-default" type="button" id="next" data-localize="next">Next</button>
</span>
</div>
<br>
<div class="input-group">
<span class="input-group-addon" data-localize="key">Key:</span>
<input type="text" class="form-control" id="mint_key">
<input type="text" readonly class="form-control" id="mint_key">
</div>
<div class="input-group">
<span class="input-group-addon" data-localize="owner">Owner:</span>
<input type="text" class="form-control" id="mint_owner">
<input type="text" readonly class="form-control" id="mint_owner">
</div>
<div class="input-group">
<span class="input-group-addon" data-localize="eth_addr">Eth Address:</span>
<input type="text" class="form-control" id="mint_eth_addr">
<input type="text" readonly class="form-control" id="mint_eth_addr">
</div>
<div class="input-group">
<span class="input-group-addon" data-localize="cost">Amount:</span>
<input type="number" class="form-control" id="mint_amount">
<input type="number" readonly class="form-control" id="mint_amount">
<span class="input-group-addon">govm</span>
<div hidden><input type="number" id="mint_amount1"></div>
</div>
<div class="input-group">
<span class="input-group-addon" data-localize="signature">Signature:</span>
<input type="text" class="form-control" id="mint_signature">
<input type="text" readonly class="form-control" id="mint_signature">
</div>
<button type="button" class="btn btn-success pull-right" id="relayMint" data-localize="mint">Relay
Mint</button>
Expand Down Expand Up @@ -151,9 +173,32 @@ <h3 class="panel-title" data-localize="info">
<script type="text/javascript">
$("#base_cost").html(gCostBase);
$("#base_energy").html(gCostBase);
$('#next').on('click', function () {
var key = $("#search_key").val();
urlStr1 = "/api/v1/1/data/visit?app_name=a99b97a411b45c91779e1609386fa18484b8e50016379bd98c6822b491247b9b";
urlStr1 += "&struct_name=tTransIn&is_db_data=true&pre_key=" + key;
// console.log("url:", urlStr1)
$.get(urlStr1, function (data, status) {
if (status != "success" || data.key === undefined) {
$("#result").html("not Found");
$("#search_key").val("")
$('#btn_key').click()
return
}
$("#search_key").val(data.key)
$('#btn_key').click()
});
});
$('#btn_key').on('click', function () {
$("#result").html("");
$("#mint_key").val("")
$("#mint_owner").val("")
$("#mint_eth_addr").val("")
$("#mint_amount").val("")
$("#mint_amount1").val("")
$("#mint_signature").val("")
var key = $("#search_key").val();

urlStr1 = "/api/v1/1/data?app_name=a99b97a411b45c91779e1609386fa18484b8e50016379bd98c6822b491247b9b";
urlStr1 += "&struct_name=tTransIn&is_db_data=true&key=" + key;
$.get(urlStr1, function (data, status) {
Expand All @@ -162,7 +207,7 @@ <h3 class="panel-title" data-localize="info">
return
}
var info = dataEncode(data.value, "hex2json")
console.log("trans:", info)
// console.log("trans:", info)
$("#mint_key").val("0x" + dataEncode(info.trans, "base2hex"))
$("#mint_owner").val(dataEncode(info.who, "base2hex"))
$("#mint_eth_addr").val(info.eth_addr)
Expand All @@ -172,7 +217,7 @@ <h3 class="panel-title" data-localize="info">
urlStr2 += "&struct_name=tSign&is_db_data=true&key=" + key;
$.get(urlStr2, function (data, status) {
if (status == "success") {
console.log("sign:", data.value)
// console.log("sign:", data.value)
$("#mint_signature").val("0x" + data.value)
}
});
Expand Down
9 changes: 4 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module github.com/lengzhao/wallet
go 1.13

require (
fyne.io/fyne v1.2.3
github.com/Xuanwo/go-locale v0.1.0
github.com/gorilla/mux v1.7.0
fyne.io/fyne v1.3.3
github.com/Xuanwo/go-locale v1.0.0
github.com/gorilla/mux v1.8.0
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c
github.com/lengzhao/govm v0.3.5
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
github.com/lengzhao/govm v0.4.1
)
Loading

0 comments on commit bdce4e0

Please sign in to comment.