Merge pull request #4 from ethereum/npmify

Renaming: Use JS for ethereumjs-abi.
pull/1/head
chriseth 9 years ago
commit 5d206a4172
  1. 12
      src/universal-dapp.js

@ -4,7 +4,7 @@ var Trie = require('merkle-patricia-tree');
var ethJSUtil = require('ethereumjs-util'); var ethJSUtil = require('ethereumjs-util');
var EthJSTX = require('ethereumjs-tx'); var EthJSTX = require('ethereumjs-tx');
var EthJSAccount = require('ethereumjs-account'); var EthJSAccount = require('ethereumjs-account');
var ethABI = require('ethereumjs-abi'); var ethJSABI = require('ethereumjs-abi');
var EthJSBlock = require('ethereumjs-block'); var EthJSBlock = require('ethereumjs-block');
var web3 = require('./web3-adapter.js'); var web3 = require('./web3-adapter.js');
@ -185,7 +185,7 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
$.each(abi, function(i, funABI) { $.each(abi, function(i, funABI) {
if (funABI.type !== 'event') return; if (funABI.type !== 'event') return;
var hash = ethABI.eventID(funABI.name, funABI.inputs.map(function(item) { return item.type })) var hash = ethJSABI.eventID(funABI.name, funABI.inputs.map(function(item) { return item.type }))
eventABI[hash.toString('hex')] = { event: funABI.name, inputs: funABI.inputs }; eventABI[hash.toString('hex')] = { event: funABI.name, inputs: funABI.inputs };
}); });
@ -201,8 +201,8 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var types = abi.inputs.map(function (item) { var types = abi.inputs.map(function (item) {
return item.type; return item.type;
}); });
decoded = ethABI.rawDecode(types, log[2]); decoded = ethJSABI.rawDecode(types, log[2]);
decoded = ethABI.stringify(types, decoded) decoded = ethJSABI.stringify(types, decoded)
} catch (e) { } catch (e) {
decoded = '0x' + log[2].toString('hex'); decoded = '0x' + log[2].toString('hex');
} }
@ -402,10 +402,10 @@ UniversalDApp.prototype.getCallButton = function(args) {
} }
// decode data // decode data
var decodedObj = ethABI.rawDecode(outputTypes, result.vm.return); var decodedObj = ethJSABI.rawDecode(outputTypes, result.vm.return);
// format decoded data // format decoded data
decodedObj = ethABI.stringify(outputTypes, decodedObj); decodedObj = ethJSABI.stringify(outputTypes, decodedObj);
for (var i = 0; i < outputTypes.length; i++) { for (var i = 0; i < outputTypes.length; i++) {
var name = args.abi.outputs[i].name; var name = args.abi.outputs[i].name;
if (name.length > 0) { if (name.length > 0) {

Loading…
Cancel
Save