status-react/resources/wallet.js

51 lines
1.0 KiB
JavaScript
Raw Normal View History

2016-11-22 12:50:52 +00:00
I18n.translations = {
en: {
browse_title: 'Browser',
browse_description: 'Launch the browser'
}
};
function wallet(params, context) {
2017-01-02 10:01:32 +00:00
var url = 'https://status.im/dapps/wallet';
if (context.debug) {
2017-01-02 10:01:32 +00:00
url = 'http://127.0.0.1:3450';
}
if (params.url && params.url !== "undefined" && params.url != "") {
url = params.url;
if (!/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url;
}
}
return {webViewUrl: url};
}
status.command({
name: "browse",
2016-11-22 12:50:52 +00:00
title: I18n.t('browse_title'),
description: I18n.t('browse_description'),
color: "#ffa500",
fullscreen: true,
suggestionsTrigger: 'on-send',
params: [{
name: "url",
suggestions: wallet,
type: status.types.TEXT
}]
});
status.autorun("browse");
2016-10-20 13:51:37 +00:00
status.registerFunction("send", function (params, context) {
var data = {
from: context.from,
to: params.address,
value: web3.toWei(params.amount, "ether")
};
web3.eth.sendTransaction(data);
})