fixed linting for vyper and walletconnect

pull/4771/head
lianahus 6 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. 22
      apps/walletconnect/src/services/WalletConnectRemixClient.ts

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

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

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

@ -1,9 +1,9 @@
import {PluginClient} from '@remixproject/plugin'
import {createClient} from '@remixproject/plugin-webview'
import { PluginClient } from '@remixproject/plugin'
import { createClient } from '@remixproject/plugin-webview'
import { createWeb3Modal, defaultConfig } from '@web3modal/ethers5/react'
import { constants } from '../utils/constants'
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'
export class WalletConnectRemixClient extends PluginClient {
@ -39,7 +39,7 @@ export class WalletConnectRemixClient extends PluginClient {
metadata,
rpcUrl: 'https://cloudflare-eth.com'
})
this.web3modal = createWeb3Modal({ projectId, chains: constants.chains, metadata, ethersConfig })
this.ethersConfig = ethersConfig
this.chains = constants.chains
@ -50,16 +50,16 @@ export class WalletConnectRemixClient extends PluginClient {
subscribeToEvents() {
this.web3modal.subscribeProvider(({ address, isConnected, chainId })=>{
if(isConnected){
if (isConnected){
if (address !== this.currentAccount) {
this.currentAccount = address
this.emit('accountsChanged', [address])
this.emit('accountsChanged', [address])
}
if (this.currentChain !== chainId) {
this.currentChain = chainId
this.emit('chainChanged', chainId)
}
}else{
} else {
this.emit('accountsChanged', [])
this.currentAccount = ''
this.emit('chainChanged', 0)
@ -106,7 +106,7 @@ export class WalletConnectRemixClient extends PluginClient {
error,
id: data.id
})
}
}
}
return resolve(response)
})
@ -114,16 +114,16 @@ export class WalletConnectRemixClient extends PluginClient {
} else {
try {
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) {
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 {
const err = `Cannot make ${data.method} request. Remix client is not connected to walletconnect client`
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