From 46d7f058d6ccc59c4ce600f0c4322a3d237b13b2 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Mon, 27 Nov 2023 15:47:16 +0100 Subject: [PATCH] changes to type for request --- apps/vyper/src/app/utils/compiler.tsx | 55 ++++++-- apps/vyper/src/app/utils/types.ts | 190 +++++++++++++++++++++++++- 2 files changed, 232 insertions(+), 13 deletions(-) diff --git a/apps/vyper/src/app/utils/compiler.tsx b/apps/vyper/src/app/utils/compiler.tsx index b1cdc71e30..1bdef67f36 100644 --- a/apps/vyper/src/app/utils/compiler.tsx +++ b/apps/vyper/src/app/utils/compiler.tsx @@ -1,6 +1,6 @@ import {CompilationResult, ABIDescription} from '@remixproject/plugin-api' import axios from 'axios' -import { VyperCompilationResultType } from './types' +import { VyperCompilationResultType, CompileFormat, BytecodeObject, AST, ABI, ETHPM3Format, CompilerInformationObject } from './types' export interface Contract { name: string @@ -59,16 +59,53 @@ export async function compile(url: string, contract: Contract): Promise + buildDependencies: Record + sources: { + [fileName: string]: { + content: string + checksum?: { + keccak256: string + hash: string + } + type?: any + license?: string + } + } + compilers: CompilerInformationObject[] + contractTypes: { + contractName: string + sourceId?: string + depolymentBytecode: { + bytecode: string + linkReferences: { + offset: any + length: number + name?: string + } + linkDependencies?: { offsets: number[]} + } + runtimeBytecode: { + bytecode: string + linkReferences: { + offset: any + length: number + name?: string + } + linkDependencies?: LinkValueObject + } + abi: ABI[] + ast: AST + userDoc?: { + methods: any + notice: string + } + devDoc?: { + methods: any, + author: string + details: string + title: string + license: string + } +} +deployments: { + [contractName: string]: ContractInstanceObject +} + + +} + +export type CompilerInformationObject = { + name: string + version: string + settings?: { + optimizer: { + enabled: boolean + runs: number + } + outputSelection: { + [fileName: string]: { + [contractName: string]: string[] + } + } + }, + contractTypes?: string[] +} + +export type LinkValueObject = { + offsets: number[] + type: string + value: string +} + +export type PackageMetaDataObject = { + authors?: string[] + description?: string + keywords?: string[] + license?: string + links?: { + [key: string]: string + } +} + +export type ContractInstanceObject = { + contractType: string + address: string + transaction?: string + block?: string + runtimeBytecode?: BytecodeObject + compiler?: string + linkDependencies?: LinkValueObject +} + +export type ASTSrc = { + jumpCode: string; + length: number; +} + +export type Child = { + astType: string; + children: Child[]; + classification: number; + colOffset: number; + endColOffset: number; + endLineno: number; + lineno: number; + name?: string; + src: ChildSrc; + docStr?: Child; +} + +export type ChildSrc = { + jumpCode: string; + length: number; + start: number; +} + +export type AST = { + astType: string; + children: Child[]; + classification: number; + colOffset: number; + endColOffset: number; + endLineno: number; + lineno: number; + name: string; + src: ASTSrc; +} + +export type ABI = { + anonymous?: boolean; + inputs: any[]; + name?: string; + type: any + stateMutability?: any; + outputs?: any[]; +}