-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
275 additions
and
0 deletions.
There are no files selected for viewing
195 changes: 195 additions & 0 deletions
195
src/clients/Extensions/VotingReputation/9/VotingReputationClient.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |
65 changes: 65 additions & 0 deletions
65
src/clients/Extensions/VotingReputation/9/VotingReputationClientAddons.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, any> => ({ | ||
/* | ||
* Example withProofs method | ||
* | ||
* contractCallWithProofs: async ( | ||
* _domainId: BigNumberish, | ||
* overrides?: TransactionOverrides, | ||
* ): Promise<ContractTransaction> => { | ||
* 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<string, any> => ({ | ||
/* | ||
* 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<ContractTransaction> => { | ||
* const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( | ||
* colonyClient, | ||
* _domainId, | ||
* votingReputationClient.address, | ||
* ); | ||
* return votingReputationClient.estimate.contractCall(extensionPDID, extensionCSI, _domainId); | ||
* }, | ||
*/ | ||
}); | ||
|
||
/* eslint-enable */ |
15 changes: 15 additions & 0 deletions
15
src/clients/Extensions/VotingReputation/9/VotingReputationClientEncodeInterfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, (params: any) => Promise<string>> => ({}); | ||
|
||
/* eslint-enable */ |