/* * OneTxPayment Client Version 1 autogenerated by * @colony/colony-js version 4.0.0-beta.0 from colonyNetwork tag 'clwss' * * 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/1/factories/OneTxPayment__factory'; import { OneTxPayment } from '../../../../contracts/extensions/oneTxPayment/1/OneTxPayment'; import { ExtendedIColony } from '../../../../clients/Colony/extensions/commonExtensions'; import { getOneTxPaymentClientAddons, getOneTxPaymentClientEstimateAddons, } from './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 = getOneTxPaymentClientAddons(oneTxPaymentClient, colonyClient); const addonsEstimate = 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 */