|
15 | 15 | // along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
|
17 | 17 | import { ContractPromise } from '@polkadot/api-contract'; |
| 18 | +import { hexToU8a } from '@polkadot/util'; |
18 | 19 | import { RequestHandler } from 'express'; |
19 | 20 | import { BadRequest } from 'http-errors'; |
20 | 21 |
|
21 | 22 | import { validateAddress } from '../../middleware'; |
22 | 23 | import { ContractsInkService } from '../../services'; |
23 | | -import { IBodyContractMetadata, IContractDryParams, IContractQueryParam, IPostRequestHandler } from '../../types/requests'; |
| 24 | +import { |
| 25 | + IBodyContractMetadata, |
| 26 | + IContractDryParams, |
| 27 | + IContractQueryParam, |
| 28 | + IPostRequestHandler, |
| 29 | +} from '../../types/requests'; |
24 | 30 | import AbstractController from '../AbstractController'; |
25 | | -import { hexToU8a } from '@polkadot/util'; |
26 | 31 |
|
27 | 32 | export default class ContractsInkController extends AbstractController<ContractsInkService> { |
28 | 33 | static controllerName = 'ContractsInk'; |
@@ -72,20 +77,18 @@ export default class ContractsInkController extends AbstractController<Contracts |
72 | 77 | * @param res |
73 | 78 | */ |
74 | 79 | private dryRun: IPostRequestHandler<IBodyContractMetadata, IContractDryParams> = async ( |
75 | | - { params: { address }, query: { caller, payValue = "0", inputData } }, |
| 80 | + { params: { address }, query: { caller, payValue = '0', inputData } }, |
76 | 81 | res, |
77 | 82 | ): Promise<void> => { |
78 | | - const dryRunResult: any = await this.api.call.reviveApi.call( |
| 83 | + const dryRunResult = await this.api.call.reviveApi.call( |
79 | 84 | caller, |
80 | 85 | address, |
81 | 86 | this.api.registry.createType('Balance', BigInt(payValue)), |
82 | 87 | null, |
83 | 88 | null, |
84 | 89 | hexToU8a(inputData) ?? '', |
85 | | - ) |
86 | | - ContractsInkController.sanitizedSend( |
87 | | - res, |
88 | | - dryRunResult.toHuman(), |
89 | 90 | ); |
| 91 | + |
| 92 | + ContractsInkController.sanitizedSend(res, dryRunResult.toHuman()); |
90 | 93 | }; |
91 | 94 | } |
0 commit comments