Skip to content

Commit

Permalink
add support for moonbeam evm in dapp analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
rrozek committed Aug 14, 2024
1 parent 645f766 commit 7f8f098
Show file tree
Hide file tree
Showing 8 changed files with 878 additions and 63 deletions.
489 changes: 487 additions & 2 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"deepmerge": "^4.3.1",
"dockerode": "^4.0.2",
"dotenv": "^16.4.5",
"ethers": "^6.13.1",
"express": "^4.17.1",
"express-http-context": "^1.2.4",
"express-mongo-sanitize": "^2.2.0",
Expand Down
99 changes: 76 additions & 23 deletions src/components/dapp-analytics/abi.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
interface IAbiTypeDef {
interface IInkAbiTypeDef {
id: number;
type: {
def: {
Expand Down Expand Up @@ -37,45 +37,45 @@ interface IAbiTypeDef {
};
}

interface IAbiType {
interface IInkAbiType {
type: number;
displayName: string[];
}

interface IAbiArg {
interface IInkAbiArg {
docs: string[];
type: IAbiType;
type: IInkAbiType;
label: string;
indexed?: boolean;
}

interface IAbiEvent {
args: IAbiArg[];
interface IInkAbiEvent {
args: IInkAbiArg[];
docs: string[];
label: string;
}

interface IAbiMessage {
args: IAbiArg[];
interface IInkAbiMessage {
args: IInkAbiArg[];
docs: string[];
label: string;
default: boolean;
mutates: boolean;
payable: boolean;
selector: string;
returnType: IAbiType;
returnType: IInkAbiType;
}

interface IAbiSpec {
interface IInkAbiSpec {
docs: string[];
events: IAbiEvent[];
messages: IAbiMessage[];
types: IAbiTypeDef[];
events: IInkAbiEvent[];
messages: IInkAbiMessage[];
types: IInkAbiTypeDef[];
}

interface IAbi {
spec: IAbiSpec;
types: IAbiTypeDef[];
interface IInkAbi {
spec: IInkAbiSpec;
types: IInkAbiTypeDef[];
}

interface IAbiEventsOutput {
Expand Down Expand Up @@ -119,14 +119,60 @@ interface IAbiCallsOutputContractCallArg {
type: string;
}

interface IEvmAbi extends Array<IEvmAbiItem> {}

interface IEvmAbiItem {
type: 'function' | 'constructor' | 'event' | 'fallback' | 'receive';
name?: string; // Only functions and events have names
inputs?: IEvmAbiInputOutput[];
outputs?: IEvmAbiInputOutput[];
stateMutability?: 'pure' | 'view' | 'nonpayable' | 'payable';
anonymous?: boolean; // Only events can be anonymous
payable?: boolean; // Deprecated in favor of stateMutability
constant?: boolean; // Deprecated in favor of stateMutability
}

interface IEvmAbiInputOutput {
name: string;
type: string; // Solidity types like 'uint256', 'address', 'bytes32', etc.
internalType?: string; // Optionally provides the internal Solidity type
indexed?: boolean; // Only events' inputs can be indexed
}

interface IEvmEventAbiItem extends IEvmAbiItem {
type: 'event';
anonymous?: boolean;
inputs: IEvmAbiInputOutput[];
}

interface IEvmFunctionAbiItem extends IEvmAbiItem {
type: 'function';
constant?: boolean;
payable?: boolean;
stateMutability: 'pure' | 'view' | 'nonpayable' | 'payable';
inputs: IEvmAbiInputOutput[];
outputs: IEvmAbiInputOutput[];
}

interface IEvmConstructorAbiItem extends IEvmAbiItem {
type: 'constructor';
stateMutability: 'nonpayable' | 'payable';
inputs: IEvmAbiInputOutput[];
}

interface IEvmFallbackAbiItem extends IEvmAbiItem {
type: 'fallback' | 'receive';
stateMutability: 'nonpayable' | 'payable';
}

export {
IAbi,
IAbiArg,
IAbiEvent,
IAbiMessage,
IAbiSpec,
IAbiType,
IAbiTypeDef,
IInkAbi,
IInkAbiArg,
IInkAbiEvent,
IInkAbiMessage,
IInkAbiSpec,
IInkAbiType,
IInkAbiTypeDef,
IAbiEventsOutput,
IAbiEventsOutputContract,
IAbiEventsOutputContractEvent,
Expand All @@ -135,4 +181,11 @@ export {
IAbiCallsOutputContract,
IAbiCallsOutputContractCall,
IAbiCallsOutputContractCallArg,
IEvmAbi,
IEvmAbiItem,
IEvmAbiInputOutput,
IEvmConstructorAbiItem,
IEvmEventAbiItem,
IEvmFallbackAbiItem,
IEvmFunctionAbiItem,
};
Loading

0 comments on commit 7f8f098

Please sign in to comment.