/* * OneTxPayment Client Version 2 autogenerated by * @colony/colony-js version v4.0.0-rc.6 from colonyNetwork tag 'clwss-127-gb39461e5' * * Feel free to modify as needed! */ /* eslint-disable @typescript-eslint/no-explicit-any */ import { ClientType } from '../../../../constants'; import { OneTxPayment__factory as OneTxPaymentFactory } from '../../../../contracts/extensions/oneTxPayment/2/factories/OneTxPayment__factory'; import { OneTxPayment } from '../../../../contracts/extensions/oneTxPayment/2/OneTxPayment'; import { ExtendedIColony } from '../../../../clients/Colony/extensions/commonExtensions'; import * as currentVersion from './OneTxPaymentClientAddons'; import * as version1 from '../1/OneTxPaymentClientAddons'; type OneTxPaymentEstimate = OneTxPayment['estimate']; interface OneTxPaymentEstimateWithAddons extends OneTxPaymentEstimate { /* * @TODO These needs to be specifically determined once we can integrate * static code analysis into this lib */ [key: string]: any; } export interface OneTxPaymentClient extends OneTxPayment { clientType: ClientType.OneTxPaymentClient; estimate: OneTxPaymentEstimateWithAddons; /* * @TODO These needs to be specifically determined once we can integrate * static code analysis into this lib */ [key: string]: any; } const getOneTxPaymentClient = ( address: string, colonyClient: ExtendedIColony, ): OneTxPaymentClient => { const oneTxPaymentClient = OneTxPaymentFactory.connect( address, colonyClient.signer || colonyClient.provider, ) as OneTxPaymentClient; oneTxPaymentClient.clientType = ClientType.OneTxPaymentClient; const addons = { ...currentVersion.getOneTxPaymentClientAddons( oneTxPaymentClient, colonyClient, ), ...version1.getOneTxPaymentClientAddons(oneTxPaymentClient, colonyClient), }; const addonsEstimate = { ...currentVersion.getOneTxPaymentClientEstimateAddons( oneTxPaymentClient, colonyClient, ), ...version1.getOneTxPaymentClientEstimateAddons( oneTxPaymentClient, colonyClient, ), }; Object.keys(addons).map((addonName) => { oneTxPaymentClient[addonName] = addons[addonName]; return null; }); Object.keys(addonsEstimate).map((addonName) => { oneTxPaymentClient.estimate[addonName] = addonsEstimate[addonName]; return null; }); return oneTxPaymentClient; }; export default getOneTxPaymentClient; /* eslint-enable */