/* * OneTxPayment Client Version 1 Addons 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-unused-vars, @typescript-eslint/no-explicit-any */ import { BigNumberish, BigNumber } from 'ethers/utils'; import { ContractTransaction } from 'ethers'; import { ExtendedIColony, getExtensionPermissionProofs, } from '../../../../clients/Colony/extensions/commonExtensions'; import { TransactionOverrides } from '../../../../contracts/6'; import { OneTxPaymentClient } from './OneTxPaymentClient'; /* * Extra client methods */ export const getOneTxPaymentClientAddons = ( oneTxPaymentClient: OneTxPaymentClient, colonyClient: ExtendedIColony, ): Record => ({ makePaymentWithProofs: async ( _workers: string[], _tokens: string[], _amounts: BigNumberish[], _domainId: BigNumberish, _skillId: BigNumberish, overrides?: TransactionOverrides, ): Promise => { const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, oneTxPaymentClient.address, ); const [userPDID, userCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, ); return oneTxPaymentClient.makePayment( extensionPDID, extensionCSI, userPDID, userCSI, _workers, _tokens, _amounts, _domainId, _skillId, overrides, ); }, makePaymentFundedFromDomainWithProofs: async ( _workers: string[], _tokens: string[], _amounts: BigNumberish[], _domainId: BigNumberish, _skillId: BigNumberish, overrides?: TransactionOverrides, ): Promise => { const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, oneTxPaymentClient.address, ); const [userPDID, userCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, ); return oneTxPaymentClient.makePaymentFundedFromDomain( extensionPDID, extensionCSI, userPDID, userCSI, _workers, _tokens, _amounts, _domainId, _skillId, overrides, ); }, }); /* * Extra client methods estimates * * These are needed! Don't skip them! */ export const getOneTxPaymentClientEstimateAddons = ( oneTxPaymentClient: OneTxPaymentClient, colonyClient: ExtendedIColony, ): Record => ({ makePaymentWithProofs: async ( _workers: string[], _tokens: string[], _amounts: BigNumberish[], _domainId: BigNumberish, _skillId: BigNumberish, ): Promise => { const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, oneTxPaymentClient.address, ); const [userPDID, userCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, ); return oneTxPaymentClient.estimate.makePayment( extensionPDID, extensionCSI, userPDID, userCSI, _workers, _tokens, _amounts, _domainId, _skillId, ); }, makePaymentFundedFromDomainWithProofs: async ( _workers: string[], _tokens: string[], _amounts: BigNumberish[], _domainId: BigNumberish, _skillId: BigNumberish, ): Promise => { const [extensionPDID, extensionCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, oneTxPaymentClient.address, ); const [userPDID, userCSI] = await getExtensionPermissionProofs( colonyClient, _domainId, ); return oneTxPaymentClient.estimate.makePaymentFundedFromDomain( extensionPDID, extensionCSI, userPDID, userCSI, _workers, _tokens, _amounts, _domainId, _skillId, ); }, }); /* eslint-enable */