diff --git a/src/clients/Extensions/VotingReputation/9/VotingReputationClient.ts b/src/clients/Extensions/VotingReputation/9/VotingReputationClient.ts new file mode 100644 index 000000000..79851b614 --- /dev/null +++ b/src/clients/Extensions/VotingReputation/9/VotingReputationClient.ts @@ -0,0 +1,195 @@ +/* + * VotingReputation Client Version 9 autogenerated by + * @colony/colony-js version v4.2.2-rc.3 from colonyNetwork tag 'glwss3' + * + * Feel free to modify as needed! + */ + +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { ClientType } from '../../../../constants'; +import { VotingReputation__factory as VotingReputationFactory } from '../../../../contracts/extensions/votingReputation/9/factories/VotingReputation__factory'; +import { VotingReputation } from '../../../../contracts/extensions/votingReputation/9/VotingReputation'; +import { ExtendedIColony } from '../../../../clients/Colony/extensions/commonExtensions'; +import { VotingReputationClient as VotingReputationClient7 } from '../7/VotingReputationClient'; +import { VotingReputationClient as VotingReputationClient8 } from '../8/VotingReputationClient'; + +import * as currentVersionAddons from './VotingReputationClientAddons'; +import * as version1Addons from '../1/VotingReputationClientAddons'; +import * as version2Addons from '../2/VotingReputationClientAddons'; +import * as version3Addons from '../3/VotingReputationClientAddons'; +import * as version4Addons from '../4/VotingReputationClientAddons'; +import * as version5Addons from '../5/VotingReputationClientAddons'; +import * as version6Addons from '../6/VotingReputationClientAddons'; +import * as version7Addons from '../7/VotingReputationClientAddons'; +import * as version8Addons from '../8/VotingReputationClientAddons'; + +import * as currentVersionEncodedInterfaces from './VotingReputationClientEncodeInterfaces'; +import * as version4EncodedInterfaces from '../4/VotingReputationClientEncodeInterfaces'; +import * as version5EncodedInterfaces from '../5/VotingReputationClientEncodeInterfaces'; +import * as version6EncodedInterfaces from '../6/VotingReputationClientEncodeInterfaces'; +import * as version7EncodedInterfaces from '../7/VotingReputationClientEncodeInterfaces'; +import * as version8EncodedInterfaces from '../8/VotingReputationClientEncodeInterfaces'; + +type VotingReputationEstimate = VotingReputation['estimate']; +interface VotingReputationEstimateWithAddons extends VotingReputationEstimate { + /* + * @TODO These needs to be specifically determined once we can integrate + * static code analysis into this lib + */ + [key: string]: any; +} + +export interface VotingReputationClient extends VotingReputation { + clientType: ClientType.VotingReputationClient; + estimate: VotingReputationEstimateWithAddons; + /* + * @TODO These needs to be specifically determined once we can integrate + * static code analysis into this lib + */ + [key: string]: any; +} + +const getVotingReputationClient = ( + address: string, + colonyClient: ExtendedIColony, +): VotingReputationClient => { + const votingReputationClient = VotingReputationFactory.connect( + address, + colonyClient.signer || colonyClient.provider, + ) as VotingReputationClient; + votingReputationClient.clientType = ClientType.VotingReputationClient; + + const addons = { + ...version1Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version2Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version3Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version4Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version5Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version6Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version7Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version8Addons.getVotingReputationClientAddons( + (votingReputationClient as unknown) as VotingReputationClient8, + colonyClient, + ), + ...currentVersionAddons.getVotingReputationClientAddons( + votingReputationClient, + colonyClient, + ), + }; + const addonsEstimate = { + ...version1Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version2Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version3Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version4Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version5Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version6Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version7Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version8Addons.getVotingReputationClientEstimateAddons( + (votingReputationClient as unknown) as VotingReputationClient8, + colonyClient, + ), + ...currentVersionAddons.getVotingReputationClientEstimateAddons( + votingReputationClient, + colonyClient, + ), + }; + + const encodedInterfaces = { + ...version4EncodedInterfaces.getVotingReputationClientEncodeInterfaces( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version5EncodedInterfaces.getVotingReputationClientEncodeInterfaces( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version6EncodedInterfaces.getVotingReputationClientEncodeInterfaces( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version7EncodedInterfaces.getVotingReputationClientEncodeInterfaces( + (votingReputationClient as unknown) as VotingReputationClient7, + colonyClient, + ), + ...version8EncodedInterfaces.getVotingReputationClientEncodeInterfaces( + (votingReputationClient as unknown) as VotingReputationClient8, + colonyClient, + ), + // eslint-disable-next-line max-len + ...currentVersionEncodedInterfaces.getVotingReputationClientEncodeInterfaces( + votingReputationClient, + colonyClient, + ), + }; + + Object.keys(addons).map((addonName) => { + votingReputationClient[addonName] = addons[addonName]; + return null; + }); + + Object.keys(addonsEstimate).map((addonName) => { + votingReputationClient.estimate[addonName] = addonsEstimate[addonName]; + return null; + }); + + Object.keys(encodedInterfaces).map((interfaceName) => { + /* + * @NOTE We're adding new interfaces to the functions list that the client + * implicitly doesn't know about + */ + // @ts-ignore + votingReputationClient.interface.functions[interfaceName] = { + encode: encodedInterfaces[interfaceName], + }; + return null; + }); + + return votingReputationClient; +}; + +export default getVotingReputationClient; + +/* eslint-enable */ diff --git a/src/clients/Extensions/VotingReputation/9/VotingReputationClientAddons.ts b/src/clients/Extensions/VotingReputation/9/VotingReputationClientAddons.ts new file mode 100644 index 000000000..97d0bba3c --- /dev/null +++ b/src/clients/Extensions/VotingReputation/9/VotingReputationClientAddons.ts @@ -0,0 +1,65 @@ +/* + * VotingReputation Client Version 9 Addons autogenerated by + * @colony/colony-js version v4.2.2-rc.3 from colonyNetwork tag 'glwss3' + * + * Feel free to modify as needed! + */ + +/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any */ + +import { ExtendedIColony } from '../../../../clients/Colony/extensions/commonExtensions'; + +import { VotingReputationClient } from './VotingReputationClient'; + +/* + * Extra client methods + */ +export const getVotingReputationClientAddons = ( + votingReputationClient: VotingReputationClient, + colonyClient: ExtendedIColony, +): Record => ({ + /* + * Example withProofs method + * + * contractCallWithProofs: async ( + * _domainId: BigNumberish, + * overrides?: TransactionOverrides, + * ): Promise => { + * const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( + * colonyClient, + * _domainId, + * votingReputationClient.address, + * ); + * return votingReputationClient.contractCall(extensionPDID, extensionCSI, _domainId, overrides); + * }, + */ +}); + +/* + * Extra client methods estimates + * + * These are needed! Don't skip them! + */ +export const getVotingReputationClientEstimateAddons = ( + votingReputationClient: VotingReputationClient, + colonyClient: ExtendedIColony, +): Record => ({ + /* + * Example withProofs estimate method + * (Mostly the same as the actual method, just that it calls the client + * estimate contract call and doesn't pass in the transaction overrides) + * + * contractCallWithProofs: async ( + * _domainId: BigNumberish, + * ): Promise => { + * const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( + * colonyClient, + * _domainId, + * votingReputationClient.address, + * ); + * return votingReputationClient.estimate.contractCall(extensionPDID, extensionCSI, _domainId); + * }, + */ +}); + +/* eslint-enable */ diff --git a/src/clients/Extensions/VotingReputation/9/VotingReputationClientEncodeInterfaces.ts b/src/clients/Extensions/VotingReputation/9/VotingReputationClientEncodeInterfaces.ts new file mode 100644 index 000000000..69dcd9f03 --- /dev/null +++ b/src/clients/Extensions/VotingReputation/9/VotingReputationClientEncodeInterfaces.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */ + +import { ExtendedIColony } from '../../../Colony/extensions/commonExtensions'; + +import { VotingReputationClient } from './VotingReputationClient'; + +/* + * Extra client encode interfaces + */ +export const getVotingReputationClientEncodeInterfaces = ( + votingReputationClient: VotingReputationClient, + colonyClient: ExtendedIColony, +): Record Promise> => ({}); + +/* eslint-enable */