From 9036335a0bc537258f6026faaf53eb7354ccbb8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Manuel=20Mari=C3=B1as=20Bascoy?= Date: Tue, 28 Nov 2023 16:50:00 +0100 Subject: [PATCH] fix prettier --- packages/js-client/EXAMPLE.md | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/packages/js-client/EXAMPLE.md b/packages/js-client/EXAMPLE.md index 2aa06beb..5d0302b1 100644 --- a/packages/js-client/EXAMPLE.md +++ b/packages/js-client/EXAMPLE.md @@ -539,6 +539,7 @@ export class MyPluginClientMethods implements IMyPluginClientMethods { } } ``` + ### Estimation This module will be used to estimate the gas cost of the methods. This is useful for the UI so it can show the gas cost of a transaction before sending it. This will mimic the methods interface but only with the functions that actually send a transaction to the blockchain. @@ -556,9 +557,7 @@ We use this for type safety but again is totally optional. ```typescript // src/internal/interfaces.ts export interface IMyPluginClientEstimation { - prepareInstallation( - params: PrepareInstallationParams - ): Promise; + prepareInstallation(params: PrepareInstallationParams): Promise; } ``` @@ -566,15 +565,13 @@ Now in the `src/internal/modules/estimation.ts` file we will create the `MyPlugi ```typescript // src/internal/modules/estimation.ts +import {PrepareInstallationParams} from '../../types'; import {MyPluginContext} from '../context'; import {IMyPluginClientEstimation} from '../interfaces'; -import {PrepareInstallationParams} from '../../types'; import {GasFeeEstimation} from '@aragon/sdk-client-common'; export class MyPluginClientEstimation implements IMyPluginClientEstimation { - public async prepareInstallation( - params: PrepareInstallationParams - ): Promise { + public async prepareInstallation(params: PrepareInstallationParams): Promise { // TODO // implement prepareInstallation } @@ -584,17 +581,14 @@ export class MyPluginClientEstimation implements IMyPluginClientEstimation { Now we can also use the provided helper function to estimate the gas cost of the `prepareInstallation` method. ```typescript - // src/internal/modules/estimation.ts +import {PrepareInstallationParams} from '../../types'; import {MyPluginContext} from '../context'; import {IMyPluginClientEstimation} from '../interfaces'; -import {PrepareInstallationParams} from '../../types'; import {GasFeeEstimation} from '@aragon/sdk-client-common'; export class MyPluginClientEstimation implements IMyPluginClientEstimation { - public async prepareInstallation( - params: PrepareInstallationParams - ): Promise { + public async prepareInstallation(params: PrepareInstallationParams): Promise { return prepareGenericInstallationEstimation(this.web3, { daoAddressOrEns: params.daoAddressOrEns, pluginRepo: this.myPluginRepoAddress, @@ -637,10 +631,7 @@ import {IMyPluginClientEncoding} from '../interfaces'; import {DaoAction} from '@aragon/sdk-client-common'; import {hexToBytes} from '@aragon/sdk-common'; -export class MyPluginClientEncoding - extends MyPluginClientCore - implements IMyPluginClientEncoding -{ +export class MyPluginClientEncoding extends MyPluginClientCore implements IMyPluginClientEncoding { // implementation of the methods in the interface public storeNumberAction(number: bigint): DaoAction { const iface = MyPlugin__factory.createInterface(); @@ -662,10 +653,7 @@ import {MyPlugin__factory} from '../../../types'; import {MyPluginClientCore} from '../core'; import {IMyPluginClientDecoding} from '../interfaces'; -export class MyPluginClientDecoding - extends MyPluginClientCore - implements IMyPluginClientDecoding -{ +export class MyPluginClientDecoding extends MyPluginClientCore implements IMyPluginClientDecoding { public storeNumberAction(data: Uint8Array): bigint { const iface = MyPlugin__factory.createInterface(); const res = iface.decodeFunctionData('storeNumber', data); @@ -674,4 +662,4 @@ export class MyPluginClientDecoding } ``` -These encoders and decoder both use the types generated by the `typechain` package, so be sure to run `yarn typechain` before building the client. \ No newline at end of file +These encoders and decoder both use the types generated by the `typechain` package, so be sure to run `yarn typechain` before building the client.