fixed linting for vyper and walletconnect

pull/4771/head
lianahus 7 months ago
parent e0a2012a78
commit dde16c2bd4
  1. 4
      apps/vyper/project.json
  2. 264
      apps/vyper/src/app/utils/types.ts
  3. 4
      apps/walletconnect/project.json
  4. 16
      apps/walletconnect/src/services/WalletConnectRemixClient.ts

@ -42,8 +42,8 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/vyper/**/*.ts"], "lintFilePatterns": ["apps/vyper/**/*.ts"],
"eslintConfig": "libs/vyper/.eslintrc" "eslintConfig": "apps/vyper/.eslintrc"
} }
}, },
"serve": { "serve": {

@ -1,4 +1,4 @@
import {CompilationResult, ABIDescription} from '@remixproject/plugin-api' import { CompilationResult, ABIDescription } from '@remixproject/plugin-api'
export interface VyperCompilationResult { export interface VyperCompilationResult {
status: 'success' status: 'success'
@ -18,7 +18,6 @@ export interface VyperCompilationError {
message: string message: string
} }
export type VyperCompilationResultType = { export type VyperCompilationResultType = {
buildDependencies: any buildDependencies: any
compilers: [ compilers: [
@ -85,68 +84,68 @@ export type VyperCompilationResultType = {
} }
export interface PackageManifest { export interface PackageManifest {
title: string; title: string;
description: string; description: string;
type: TypeEnum; type: TypeEnum;
required: string[]; required: string[];
version: string; version: string;
properties: PackageManifestProperties; properties: PackageManifestProperties;
definitions: Definitions; definitions: Definitions;
} }
export interface Definitions { export interface Definitions {
packageMeta: ByteString; packageMeta: ByteString;
contractType: ByteString; contractType: ByteString;
contractInstance: ContractInstance; contractInstance: ContractInstance;
byteString: ByteString; byteString: ByteString;
bytecodeObject: BytecodeObject; bytecodeObject: BytecodeObject;
linkReference: LinkReference; linkReference: LinkReference;
linkValue: LinkValue; linkValue: LinkValue;
identifier: ByteString; identifier: ByteString;
contractInstanceName: ByteString; contractInstanceName: ByteString;
deployment: Deployment; deployment: Deployment;
packageContractInstanceName: ByteString; packageContractInstanceName: ByteString;
compilerInformation: CompilerInformation; compilerInformation: CompilerInformation;
address: Address; address: Address;
transactionHash: Address; transactionHash: Address;
blockHash: Address; blockHash: Address;
contentURI: ByteString; contentURI: ByteString;
} }
export interface Address { export interface Address {
title: string; title: string;
description: string; description: string;
allOf: AllOf[]; allOf: AllOf[];
} }
export interface AllOf { export interface AllOf {
ref?: string; ref?: string;
minLength?: number; minLength?: number;
maxLength?: number; maxLength?: number;
} }
export interface ByteStringProperties { export interface ByteStringProperties {
contractName?: ByteString; contractName?: ByteString;
deploymentBytecode?: Meta; deploymentBytecode?: Meta;
runtimeBytecode?: Meta; runtimeBytecode?: Meta;
abi?: ByteString; abi?: ByteString;
natspec?: ByteString; natspec?: ByteString;
compiler?: Meta; compiler?: Meta;
authors?: ByteString; authors?: ByteString;
license?: ByteString; license?: ByteString;
description?: ByteString; description?: ByteString;
keywords?: ByteString; keywords?: ByteString;
links?: Links; links?: Links;
} }
export interface ByteString { export interface ByteString {
title: string; title: string;
description?: string; description?: string;
type: TypeEnum; type: TypeEnum;
pattern?: string; pattern?: string;
format?: string; format?: string;
items?: Items; items?: Items;
properties?: ByteStringProperties; properties?: ByteStringProperties;
patternProperties?: { [key: string]: Meta }; patternProperties?: { [key: string]: Meta };
} }
@ -155,29 +154,29 @@ export interface Meta {
} }
export interface Links { export interface Links {
title: string; title: string;
descriptions: string; descriptions: string;
type: TypeEnum; type: TypeEnum;
additionalProperties: AdditionalProperties; additionalProperties: AdditionalProperties;
} }
export interface AdditionalProperties { export interface AdditionalProperties {
type: TypeEnum; type: TypeEnum;
format: string; format: string;
} }
export type TypeEnum = "string" | "array" | "object"; export type TypeEnum = "string" | "array" | "object";
export interface Items { export interface Items {
ref?: string; ref?: string;
type?: TypeEnum; type?: TypeEnum;
} }
export interface BytecodeObject { export interface BytecodeObject {
title: string title: string
type: TypeEnum type: TypeEnum
offsets: number[] offsets: number[]
anyOf: BytecodeObjectAnyOf[] anyOf: BytecodeObjectAnyOf[]
properties: BytecodeObjectProperties properties: BytecodeObjectProperties
bytecode: string bytecode: string
linkReferences?: { offset?: any; length?: number; name?: string}[] linkReferences?: { offset?: any; length?: number; name?: string}[]
@ -188,56 +187,56 @@ export interface BytecodeObjectAnyOf {
} }
export interface BytecodeObjectProperties { export interface BytecodeObjectProperties {
bytecode: Meta; bytecode: Meta;
linkReferences: Link; linkReferences: Link;
linkDependencies: Link; linkDependencies: Link;
} }
export interface Link { export interface Link {
type: TypeEnum; type: TypeEnum;
items: Meta; items: Meta;
} }
export interface CompilerInformation { export interface CompilerInformation {
title: string; title: string;
description: string; description: string;
type: TypeEnum; type: TypeEnum;
required: string[]; required: string[];
properties: CompilerInformationProperties; properties: CompilerInformationProperties;
} }
export interface CompilerInformationProperties { export interface CompilerInformationProperties {
name: Name; name: Name;
version: Name; version: Name;
settings: Name; settings: Name;
} }
export interface Name { export interface Name {
description: string; description: string;
type: TypeEnum; type: TypeEnum;
} }
export interface ContractInstance { export interface ContractInstance {
title: string; title: string;
description: string; description: string;
type: TypeEnum; type: TypeEnum;
required: string[]; required: string[];
properties: ContractInstanceProperties; properties: ContractInstanceProperties;
} }
export interface ContractInstanceProperties { export interface ContractInstanceProperties {
contractType: ByteString; contractType: ByteString;
address: Meta; address: Meta;
transaction: Meta; transaction: Meta;
block: Meta; block: Meta;
runtimeBytecode: Meta; runtimeBytecode: Meta;
compiler: Meta; compiler: Meta;
linkDependencies: ByteString; linkDependencies: ByteString;
} }
export interface Deployment { export interface Deployment {
title: string; title: string;
type: TypeEnum; type: TypeEnum;
patternProperties: DeploymentPatternProperties; patternProperties: DeploymentPatternProperties;
} }
@ -246,36 +245,36 @@ export interface DeploymentPatternProperties {
} }
export interface LinkReference { export interface LinkReference {
title: string; title: string;
description: string; description: string;
type: TypeEnum; type: TypeEnum;
required: string[]; required: string[];
properties: LinkReferenceProperties; properties: LinkReferenceProperties;
} }
export interface LinkReferenceProperties { export interface LinkReferenceProperties {
offsets: Offsets; offsets: Offsets;
length: Length; length: Length;
name: Meta; name: Meta;
} }
export interface Length { export interface Length {
type: string; type: string;
minimum: number; minimum: number;
} }
export interface Offsets { export interface Offsets {
type: TypeEnum; type: TypeEnum;
items: Length; items: Length;
} }
export interface LinkValue { export interface LinkValue {
title: string; title: string;
description: string; description: string;
type: TypeEnum; type: TypeEnum;
required: string[]; required: string[];
properties: LinkValueProperties; properties: LinkValueProperties;
oneOf: OneOf[]; oneOf: OneOf[];
} }
export interface OneOf { export interface OneOf {
@ -283,7 +282,7 @@ export interface OneOf {
} }
export interface OneOfProperties { export interface OneOfProperties {
type: TypeClass; type: TypeClass;
value: PurpleValue; value: PurpleValue;
} }
@ -292,14 +291,14 @@ export interface TypeClass {
} }
export interface PurpleValue { export interface PurpleValue {
ref?: string; ref?: string;
anyOf?: Meta[]; anyOf?: Meta[];
} }
export interface LinkValueProperties { export interface LinkValueProperties {
offsets: Offsets; offsets: Offsets;
type: Name; type: Name;
value: FluffyValue; value: FluffyValue;
} }
export interface FluffyValue { export interface FluffyValue {
@ -307,19 +306,19 @@ export interface FluffyValue {
} }
export interface PackageManifestProperties { export interface PackageManifestProperties {
manifestVersion: ManifestVersion; manifestVersion: ManifestVersion;
packageName: ByteString; packageName: ByteString;
meta: Meta; meta: Meta;
version: Version; version: Version;
sources: Sources; sources: Sources;
contractTypes: ByteString; contractTypes: ByteString;
deployments: ByteString; deployments: ByteString;
buildDependencies: BuildDependencies; buildDependencies: BuildDependencies;
} }
export interface BuildDependencies { export interface BuildDependencies {
title: string; title: string;
type: TypeEnum; type: TypeEnum;
patternProperties: BuildDependenciesPatternProperties; patternProperties: BuildDependenciesPatternProperties;
} }
@ -328,16 +327,16 @@ export interface BuildDependenciesPatternProperties {
} }
export interface ManifestVersion { export interface ManifestVersion {
type: TypeEnum; type: TypeEnum;
title: string; title: string;
description: string; description: string;
default: string; default: string;
enum: string[]; enum: string[];
} }
export interface Sources { export interface Sources {
title: string; title: string;
type: TypeEnum; type: TypeEnum;
patternProperties: SourcesPatternProperties; patternProperties: SourcesPatternProperties;
} }
@ -351,13 +350,13 @@ export interface Empty {
export interface AnyOf { export interface AnyOf {
title?: string; title?: string;
type?: TypeEnum; type?: TypeEnum;
ref?: string; ref?: string;
} }
export interface Version { export interface Version {
title: string; title: string;
type: TypeEnum; type: TypeEnum;
} }
export type CompileFormat = { export type CompileFormat = {
@ -448,7 +447,6 @@ deployments: {
[contractName: string]: ContractInstanceObject [contractName: string]: ContractInstanceObject
} }
} }
export type CompilerInformationObject = { export type CompilerInformationObject = {
@ -496,45 +494,45 @@ export type ContractInstanceObject = {
export type ASTSrc = { export type ASTSrc = {
jumpCode: string; jumpCode: string;
length: number; length: number;
} }
export type Child = { export type Child = {
astType: string; astType: string;
children: Child[]; children: Child[];
classification: number; classification: number;
colOffset: number; colOffset: number;
endColOffset: number; endColOffset: number;
endLineno: number; endLineno: number;
lineno: number; lineno: number;
name?: string; name?: string;
src: ChildSrc; src: ChildSrc;
docStr?: Child; docStr?: Child;
} }
export type ChildSrc = { export type ChildSrc = {
jumpCode: string; jumpCode: string;
length: number; length: number;
start: number; start: number;
} }
export type AST = { export type AST = {
astType: string; astType: string;
children: Child[]; children: Child[];
classification: number; classification: number;
colOffset: number; colOffset: number;
endColOffset: number; endColOffset: number;
endLineno: number; endLineno: number;
lineno: number; lineno: number;
name: string; name: string;
src: ASTSrc; src: ASTSrc;
} }
export type ABI = { export type ABI = {
anonymous?: boolean; anonymous?: boolean;
inputs: any[]; inputs: any[];
name?: string; name?: string;
type: any type: any
stateMutability?: any; stateMutability?: any;
outputs?: any[]; outputs?: any[];
} }

@ -39,8 +39,8 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/walletconnect/**/*.ts"], "lintFilePatterns": ["apps/walletconnect/**/*.ts"],
"eslintConfig": "libs/walletconnect/.eslintrc" "eslintConfig": "apps/walletconnect/.eslintrc"
} }
}, },
"serve": { "serve": {

@ -1,9 +1,9 @@
import {PluginClient} from '@remixproject/plugin' import { PluginClient } from '@remixproject/plugin'
import {createClient} from '@remixproject/plugin-webview' import { createClient } from '@remixproject/plugin-webview'
import { createWeb3Modal, defaultConfig } from '@web3modal/ethers5/react' import { createWeb3Modal, defaultConfig } from '@web3modal/ethers5/react'
import { constants } from '../utils/constants' import { constants } from '../utils/constants'
import EventManager from 'events' import EventManager from 'events'
import {PROJECT_ID as projectId, METADATA as metadata} from './constant' import { PROJECT_ID as projectId, METADATA as metadata } from './constant'
import { Chain, RequestArguments } from '../types' import { Chain, RequestArguments } from '../types'
export class WalletConnectRemixClient extends PluginClient { export class WalletConnectRemixClient extends PluginClient {
@ -50,7 +50,7 @@ export class WalletConnectRemixClient extends PluginClient {
subscribeToEvents() { subscribeToEvents() {
this.web3modal.subscribeProvider(({ address, isConnected, chainId })=>{ this.web3modal.subscribeProvider(({ address, isConnected, chainId })=>{
if(isConnected){ if (isConnected){
if (address !== this.currentAccount) { if (address !== this.currentAccount) {
this.currentAccount = address this.currentAccount = address
this.emit('accountsChanged', [address]) this.emit('accountsChanged', [address])
@ -59,7 +59,7 @@ export class WalletConnectRemixClient extends PluginClient {
this.currentChain = chainId this.currentChain = chainId
this.emit('chainChanged', chainId) this.emit('chainChanged', chainId)
} }
}else{ } else {
this.emit('accountsChanged', []) this.emit('accountsChanged', [])
this.currentAccount = '' this.currentAccount = ''
this.emit('chainChanged', 0) this.emit('chainChanged', 0)
@ -114,16 +114,16 @@ export class WalletConnectRemixClient extends PluginClient {
} else { } else {
try { try {
const message = await provider.request(data) const message = await provider.request(data)
return {jsonrpc: '2.0', result: message, id: data.id} return { jsonrpc: '2.0', result: message, id: data.id }
} catch (e) { } catch (e) {
return {jsonrpc: '2.0', error: { message: e.message, code: -32603 }, id: data.id} return { jsonrpc: '2.0', error: { message: e.message, code: -32603 }, id: data.id }
} }
} }
} }
} else { } else {
const err = `Cannot make ${data.method} request. Remix client is not connected to walletconnect client` const err = `Cannot make ${data.method} request. Remix client is not connected to walletconnect client`
console.error(err) console.error(err)
return {jsonrpc: '2.0', error: { message: err, code: -32603 }, id: data.id} return { jsonrpc: '2.0', error: { message: err, code: -32603 }, id: data.id }
} }
} }

Loading…
Cancel
Save