Skip to content

Commit

Permalink
WIP: ethers-6 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
chmanie committed Aug 2, 2023
1 parent 6b8a4bd commit fa5bda1
Show file tree
Hide file tree
Showing 36 changed files with 943 additions and 800 deletions.
5 changes: 2 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
"no-redeclare": "off",
"no-shadow": "off",
"no-unused-vars": "off",
"no-undef": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-shadow": [
"error"
],
"@typescript-eslint/no-shadow": "error",
"import/prefer-default-export": "off",
"import/no-unresolved": "off",
"import/extensions": [
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"homepage": "https://docs.colony.io/develop",
"devDependencies": {
"@changesets/cli": "^2.26.1",
"@colony/eslint-config-colony": "^9.2.0",
"@typescript-eslint/eslint-plugin": "^5.59.1",
"@typescript-eslint/parser": "^5.59.1",
Expand All @@ -43,7 +44,5 @@
"rimraf": "^5.0.0",
"typescript": "^5.0.4"
},
"dependencies": {
"@changesets/cli": "^2.26.1"
}
"dependencies": {}
}
2 changes: 1 addition & 1 deletion packages/contractor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"@colony/abis": "^1.0.1",
"@typechain/ethers-v5": "^11.1.0",
"@typechain/ethers-v6": "^0.4.2",
"@typechain/ethers-v6": "link:../../../TypeChain/packages/target-ethers-v6",
"@types/mkdirp": "^1.0.2",
"@types/yargs": "^17.0.24",
"mkdirp": "^1.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/contractor/src/contractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const EVENTS_CONTRACTS = [
const CWD = process.cwd();

const TYPECHAIN_CONFIG_FLAGS = {
alwaysGenerateOverloads: true,
alwaysGenerateOverloads: false,
discriminateTypes: false,
node16Modules: true,
environment: undefined,
Expand Down
3 changes: 2 additions & 1 deletion packages/core/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
".+__factory"
]
}
]
],
"no-bitwise": "off"
},
"overrides": [
{
Expand Down
11 changes: 4 additions & 7 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
},
"scripts": {
"build": "npm run clean && npm run compile-cjs && npm run compile-esm && npm run compile-types && npm run create-pkg-json",
"build-contracts": "contractor core -o ./src/contracts",
"build-contracts": "contractor core -p ethers-v6 -o ./src/contracts",
"clean": "rimraf ./dist",
"compile-cjs": "tsc -p tsconfig.build.json --module commonjs --target es2015 --outDir dist/cjs",
"compile-cjs": "tsc -p tsconfig.build.json --module commonjs --target es2020 --outDir dist/cjs",
"compile-esm": "tsc -p tsconfig.build.json --module esnext --target es2022 --outDir dist/esm",
"compile-types": "tsc -p tsconfig.build.json --target esnext --declaration --emitDeclarationOnly --outDir dist/types",
"create-pkg-json": "../../scripts/create-pkg-json.sh",
Expand All @@ -52,13 +52,10 @@
"homepage": "https://docs.colony.io/develop",
"devDependencies": {
"@colony/contractor": "1.1.0-next.2",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-provider": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"ethers": "^5.7.2"
"ethers": "^6.6.7"
},
"peerDependencies": {
"ethers": "^5.1.3"
"ethers": "^6"
},
"dependencies": {
"cross-fetch": "^3.1.5"
Expand Down
161 changes: 57 additions & 104 deletions packages/core/src/contracts/MotionTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,135 +3,88 @@
/* eslint-disable */
import type {
BaseContract,
BigNumber,
BytesLike,
CallOverrides,
PopulatedTransaction,
Signer,
utils,
FunctionFragment,
Result,
Interface,
ContractRunner,
ContractMethod,
Listener,
} from "ethers";
import type { FunctionFragment, Result } from "@ethersproject/abi";
import type { Listener, Provider } from "@ethersproject/providers";
import type {
TypedEventFilter,
TypedEvent,
TypedContractEvent,
TypedDeferredTopicFilter,
TypedEventLog,
TypedListener,
OnEvent,
TypedContractMethod,
} from "./common.js";

export interface MotionTargetInterface extends utils.Interface {
functions: {
"getCapabilityRoles(bytes4)": FunctionFragment;
};

getFunction(
nameOrSignatureOrTopic: "getCapabilityRoles" | "getCapabilityRoles(bytes4)"
): FunctionFragment;
export interface MotionTargetInterface extends Interface {
getFunction(nameOrSignature: "getCapabilityRoles"): FunctionFragment;

encodeFunctionData(
functionFragment: "getCapabilityRoles",
values: [BytesLike]
): string;
encodeFunctionData(
functionFragment: "getCapabilityRoles(bytes4)",
values: [BytesLike]
): string;

decodeFunctionResult(
functionFragment: "getCapabilityRoles",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "getCapabilityRoles(bytes4)",
data: BytesLike
): Result;

events: {};
}

export interface MotionTarget extends BaseContract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;
connect(runner?: ContractRunner | null): MotionTarget;
waitForDeployment(): Promise<this>;

interface: MotionTargetInterface;

queryFilter<TEvent extends TypedEvent>(
event: TypedEventFilter<TEvent>,
queryFilter<TCEvent extends TypedContractEvent>(
event: TCEvent,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TEvent>>;

listeners<TEvent extends TypedEvent>(
eventFilter?: TypedEventFilter<TEvent>
): Array<TypedListener<TEvent>>;
listeners(eventName?: string): Array<Listener>;
removeAllListeners<TEvent extends TypedEvent>(
eventFilter: TypedEventFilter<TEvent>
): this;
removeAllListeners(eventName?: string): this;
off: OnEvent<this>;
on: OnEvent<this>;
once: OnEvent<this>;
removeListener: OnEvent<this>;

functions: {
getCapabilityRoles(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<[string] & { roles: string }>;

"getCapabilityRoles(bytes4)"(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<[string] & { roles: string }>;
};

getCapabilityRoles(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<string>;

"getCapabilityRoles(bytes4)"(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<string>;

callStatic: {
getCapabilityRoles(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<string>;
): Promise<Array<TypedEventLog<TCEvent>>>;
queryFilter<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
fromBlockOrBlockhash?: string | number | undefined,
toBlock?: string | number | undefined
): Promise<Array<TypedEventLog<TCEvent>>>;

on<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
on<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;

once<TCEvent extends TypedContractEvent>(
event: TCEvent,
listener: TypedListener<TCEvent>
): Promise<this>;
once<TCEvent extends TypedContractEvent>(
filter: TypedDeferredTopicFilter<TCEvent>,
listener: TypedListener<TCEvent>
): Promise<this>;

listeners<TCEvent extends TypedContractEvent>(
event: TCEvent
): Promise<Array<TypedListener<TCEvent>>>;
listeners(eventName?: string): Promise<Array<Listener>>;
removeAllListeners<TCEvent extends TypedContractEvent>(
event?: TCEvent
): Promise<this>;

getCapabilityRoles: TypedContractMethod<[_sig: BytesLike], [string], "view">;

getFunction<T extends ContractMethod = ContractMethod>(
key: string | FunctionFragment
): T;

"getCapabilityRoles(bytes4)"(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<string>;
};
getFunction(
nameOrSignature: "getCapabilityRoles"
): TypedContractMethod<[_sig: BytesLike], [string], "view">;

filters: {};

estimateGas: {
getCapabilityRoles(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;

"getCapabilityRoles(bytes4)"(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<BigNumber>;
};

populateTransaction: {
getCapabilityRoles(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;

"getCapabilityRoles(bytes4)"(
_sig: BytesLike,
overrides?: CallOverrides
): Promise<PopulatedTransaction>;
};
}
Loading

0 comments on commit fa5bda1

Please sign in to comment.