debugging errors and add types for packagemanifest format

pull/5370/head
Joseph Izang 1 year ago
parent 206aa63023
commit 2dcf0aba10
  1. 13
      apps/vyper/src/app/components/VyperResult.tsx
  2. 3
      apps/vyper/src/app/utils/compiler.tsx
  3. 273
      apps/vyper/src/app/utils/types.ts

@ -64,14 +64,14 @@ function VyperResult({ output, themeColor }: VyperResultProps) {
},
{
tabHeadingText: 'Bytecode',
tabPayload: Object.values(output)[0]['bytecode'].object.toString(),
// tabPayload: Object.values(output)[0]['bytecode'].object.toString(),
tabMemberType: 'bytecode',
tabButtonText: () => 'Copy Bytecode',
eventKey: 'bytecode'
},
{
tabHeadingText: 'Runtime Bytecode',
tabPayload: Object.values(output)[0]['runtimeBytecode'].object.toString(),
// tabPayload: Object.values(output)[0]['runtimeBytecode'].object.toString(),
tabMemberType: 'bytecode_runtime',
tabButtonText: () => 'Copy Runtime Bytecode',
eventKey: 'bytecode_runtime'
@ -89,7 +89,7 @@ function VyperResult({ output, themeColor }: VyperResultProps) {
<Tabs id="result" activeKey={active} onSelect={(key: any) => setActive(key)} justify>
{tabContent.map((content, index) => (
<Tab eventKey={content.eventKey} title={content.tabHeadingText} as={'span'} key={`${index}-${content.eventKey}`}>
<CopyToClipboard getContent={() => content.eventKey !== 'abi' ? content.tabPayload : JSON.stringify(Object.values(output)[0]['abi'])}>
{/* <CopyToClipboard getContent={() => content.eventKey !== 'abi' ? content.tabPayload : JSON.stringify(Object.values(output)[0]['abi'])}>
<Button variant="info" className="copy" data-id={content.eventKey === 'abi' ? "copy-abi" : ''}>
{content.tabButtonText()}
</Button>
@ -99,8 +99,11 @@ function VyperResult({ output, themeColor }: VyperResultProps) {
<textarea defaultValue={content.tabPayload}></textarea>
)
}
</Tab>))
}
} */}
<Button>
{content.tabButtonText()}
</Button>
</Tab>))}
</Tabs>
)
}

@ -67,8 +67,9 @@ export async function compile(url: string, contract: Contract): Promise<VyperCom
const nameResult = normalizeContractPath(contract.name)
files.append('files', content, `${nameResult[2]}.vy`)
files.append('data', JSON.stringify({vyper_version: '0.3.10'}))
const response = await axios.post(url + 'compile?vyper_version=0.3.10', files)
console.log({response})
if (response.status === 404) {
throw new Error(`Vyper compiler not found at "${url}".`)
}

@ -83,3 +83,276 @@ export type VyperCompilationResultType = {
}
}
export interface PackageManifest {
title: string;
description: string;
type: TypeEnum;
required: string[];
version: string;
properties: PackageManifestProperties;
definitions: Definitions;
}
export interface Definitions {
packageMeta: ByteString;
contractType: ByteString;
contractInstance: ContractInstance;
byteString: ByteString;
bytecodeObject: BytecodeObject;
linkReference: LinkReference;
linkValue: LinkValue;
identifier: ByteString;
contractInstanceName: ByteString;
deployment: Deployment;
packageContractInstanceName: ByteString;
compilerInformation: CompilerInformation;
address: Address;
transactionHash: Address;
blockHash: Address;
contentURI: ByteString;
}
export interface Address {
title: string;
description: string;
allOf: AllOf[];
}
export interface AllOf {
ref?: string;
minLength?: number;
maxLength?: number;
}
export interface ByteStringProperties {
contractName?: ByteString;
deploymentBytecode?: Meta;
runtimeBytecode?: Meta;
abi?: ByteString;
natspec?: ByteString;
compiler?: Meta;
authors?: ByteString;
license?: ByteString;
description?: ByteString;
keywords?: ByteString;
links?: Links;
}
export interface ByteString {
title: string;
description?: string;
type: TypeEnum;
pattern?: string;
format?: string;
items?: Items;
properties?: ByteStringProperties;
patternProperties?: { [key: string]: Meta };
}
export interface Meta {
ref: string;
}
export interface Links {
title: string;
descriptions: string;
type: TypeEnum;
additionalProperties: AdditionalProperties;
}
export interface AdditionalProperties {
type: TypeEnum;
format: string;
}
export type TypeEnum = "string" | "array" | "object";
export interface Items {
ref?: string;
type?: TypeEnum;
}
export interface BytecodeObject {
title: string;
type: TypeEnum;
anyOf: BytecodeObjectAnyOf[];
properties: BytecodeObjectProperties;
}
export interface BytecodeObjectAnyOf {
required: string[];
}
export interface BytecodeObjectProperties {
bytecode: Meta;
linkReferences: Link;
linkDependencies: Link;
}
export interface Link {
type: TypeEnum;
items: Meta;
}
export interface CompilerInformation {
title: string;
description: string;
type: TypeEnum;
required: string[];
properties: CompilerInformationProperties;
}
export interface CompilerInformationProperties {
name: Name;
version: Name;
settings: Name;
}
export interface Name {
description: string;
type: TypeEnum;
}
export interface ContractInstance {
title: string;
description: string;
type: TypeEnum;
required: string[];
properties: ContractInstanceProperties;
}
export interface ContractInstanceProperties {
contractType: ByteString;
address: Meta;
transaction: Meta;
block: Meta;
runtimeBytecode: Meta;
compiler: Meta;
linkDependencies: ByteString;
}
export interface Deployment {
title: string;
type: TypeEnum;
patternProperties: DeploymentPatternProperties;
}
export interface DeploymentPatternProperties {
aZAZAZAZ09_0254$: Meta;
}
export interface LinkReference {
title: string;
description: string;
type: TypeEnum;
required: string[];
properties: LinkReferenceProperties;
}
export interface LinkReferenceProperties {
offsets: Offsets;
length: Length;
name: Meta;
}
export interface Length {
type: string;
minimum: number;
}
export interface Offsets {
type: TypeEnum;
items: Length;
}
export interface LinkValue {
title: string;
description: string;
type: TypeEnum;
required: string[];
properties: LinkValueProperties;
oneOf: OneOf[];
}
export interface OneOf {
properties: OneOfProperties;
}
export interface OneOfProperties {
type: TypeClass;
value: PurpleValue;
}
export interface TypeClass {
enum: string[];
}
export interface PurpleValue {
ref?: string;
anyOf?: Meta[];
}
export interface LinkValueProperties {
offsets: Offsets;
type: Name;
value: FluffyValue;
}
export interface FluffyValue {
description: string;
}
export interface PackageManifestProperties {
manifestVersion: ManifestVersion;
packageName: ByteString;
meta: Meta;
version: Version;
sources: Sources;
contractTypes: ByteString;
deployments: ByteString;
buildDependencies: BuildDependencies;
}
export interface BuildDependencies {
title: string;
type: TypeEnum;
patternProperties: BuildDependenciesPatternProperties;
}
export interface BuildDependenciesPatternProperties {
aZAZ090254$: Meta;
}
export interface ManifestVersion {
type: TypeEnum;
title: string;
description: string;
default: string;
enum: string[];
}
export interface Sources {
title: string;
type: TypeEnum;
patternProperties: SourcesPatternProperties;
}
export interface SourcesPatternProperties {
empty: Empty;
}
export interface Empty {
anyOf: AnyOf[];
}
export interface AnyOf {
title?: string;
type?: TypeEnum;
ref?: string;
}
export interface Version {
title: string;
type: TypeEnum;
}

Loading…
Cancel
Save