Skip to content

Commit

Permalink
Merge pull request #33 from tokenguardio/dapp-analytics-dev
Browse files Browse the repository at this point in the history
Release 3.2.2
  • Loading branch information
rrozek authored Aug 19, 2024
2 parents 58c9678 + b0ccb1c commit 201267b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dashboard-creator-server",
"private": false,
"version": "3.2.1",
"version": "3.2.2",
"license": "MIT",
"main": "src/server.ts",
"engines": {
Expand Down
26 changes: 18 additions & 8 deletions src/components/dapp-analytics/dapp-analytics.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Request, Response } from 'express';
import httpStatus, { OK } from 'http-status';
import axios from 'axios';
import { ethers } from 'ethers';
import logger from '@core/utils/logger';
import { IDAppData } from './dapp-analytics.interface';
import {
Expand Down Expand Up @@ -710,14 +711,23 @@ const extractEvmAbiFunctions = function (
item.stateMutability !== 'view' &&
item.stateMutability !== 'pure',
)
.map((func: IEvmFunctionAbiItem) => ({
name: func.name!,
selector: '0x00000000', // jrojek TODO: calculate selector
args: func.inputs!.map((input) => ({
name: input.name,
type: resolveEvmType(input.type),
})),
}));
.map((func: IEvmFunctionAbiItem) => {
const functionSignature = `${func.name}(${func
.inputs!.map((input) => input.type)
.join(',')})`;
const selector = ethers
.keccak256(ethers.toUtf8Bytes(functionSignature))
.slice(0, 10);
// TODO: jrojek, prevent selector calculation every time the method is called
return {
name: func.name!,
selector: selector,
args: func.inputs!.map((input) => ({
name: input.name,
type: resolveEvmType(input.type),
})),
};
});

return calls;
};
Expand Down

0 comments on commit 201267b

Please sign in to comment.