ETH Balnaces implemented

This commit is contained in:
Luis Fernando Molina committed 2020-11-19 13:06:12 +01:00
1 parent 9bf8c2eed6
commit 6784e6bd0b
42 files changed
+979 -669

No files matched your search

@@ -0,0 +1,53 @@
function newEthereumFunctionLibraryAccounts() {
thisObject = {
createWalletAccount: createWalletAccount
}
return thisObject
function createWalletAccount(node) {
let walletAccountNode = UI.projects.superalgos.functionLibraries.uiObjectsFromNodes.addUIObject(node, 'Wallet Account')
let params = {
method: 'createWalletAccount',
entropy: walletAccountNode.id
}
let url = 'WEB3' // we don't need to ask this to any specific superalgos node.
httpRequest(JSON.stringify(params), url, onResponse)
function onResponse(err, data) {
/* Lets check the result of the call through the http interface */
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage('Call via HTTP Interface failed.')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
return
}
let response = JSON.parse(data)
/* Lets check the result of the method call */
if (response.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
node.payload.uiObject.setErrorMessage('Call to WEB3 Server failed. ' + response.error)
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
walletAccountNode.payload.uiObject.menu.internalClick('Delete UI Object')
return
}
let config = {
address: response.address,
privateKey: response.privateKey
}
walletAccountNode.config = JSON.stringify(config, null, 4)
walletAccountNode.name =
response.address[response.address.length - 4] +
response.address[response.address.length - 3] +
response.address[response.address.length - 2] +
response.address[response.address.length - 1]
}
}
}
@@ -6,12 +6,11 @@ function newEthereumActionSwitch() {
finalize: finalize
}
let functionLibraryGeth = newGeth()
return thisObject
function finalize() {
functionLibraryGeth = undefined
}
function initialize() {
@@ -20,16 +19,8 @@ function newEthereumActionSwitch() {
async function executeAction(action) {
switch (action.name) {
case 'Install Geth': {
functionLibraryGeth.install(action.node)
break
}
case 'Run Geth': {
functionLibraryGeth.run(action.node)
break
}
case 'Stop Geth': {
functionLibraryGeth.stop(action.node)
case 'Create Wallet Account': {
UI.projects.ethereum.functionLibraries.accounts.createWalletAccount(action.node)
break
}
}
@@ -1,21 +0,0 @@
function newGeth() {
thisObject = {
install: install,
run: run,
stop: stop
}
return thisObject
function install(node) {
httpRequest('ExecuteTerminalCommand/dir')
}
function run(node) {
}
function stop(node) {
}
}