From 8a33bdbdf5b9ead0c114b1889f2ee56114cd19c3 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Fri, 6 Dec 2024 17:00:23 +0100 Subject: [PATCH] add prettierrc --- packages/react/.prettierrc | 6 +++++ packages/sdk/.prettierrc | 6 +++++ packages/sdk/src/internal/validators.ts | 10 ++++---- packages/sdk/src/sprinter.ts | 32 ++++++++++++------------- 4 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 packages/react/.prettierrc create mode 100644 packages/sdk/.prettierrc diff --git a/packages/react/.prettierrc b/packages/react/.prettierrc new file mode 100644 index 0000000..60998ab --- /dev/null +++ b/packages/react/.prettierrc @@ -0,0 +1,6 @@ +{ + "useTabs": false, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 80 +} diff --git a/packages/sdk/.prettierrc b/packages/sdk/.prettierrc new file mode 100644 index 0000000..99c88b4 --- /dev/null +++ b/packages/sdk/.prettierrc @@ -0,0 +1,6 @@ +{ + "useTabs": false, + "singleQuote": false, + "trailingComma": "all", + "printWidth": 80 +} diff --git a/packages/sdk/src/internal/validators.ts b/packages/sdk/src/internal/validators.ts index 9e34d01..14fec4e 100644 --- a/packages/sdk/src/internal/validators.ts +++ b/packages/sdk/src/internal/validators.ts @@ -26,7 +26,7 @@ const numberLike = refine( (value) => { if (typeof value === "string") return !isNaN(Number(value)); return true; // If it's a number or bigint, it's already valid - } + }, ); const BridgeCoreSchema = object({ @@ -43,7 +43,7 @@ const BridgeCoreWithRecipientSchema = assign( BridgeCoreSchema, object({ recipient: optional(hexString()), - }) + }), ); const ContractCallCoreSchema = object({ @@ -59,7 +59,7 @@ const TokenContractCallSchema = assign( object({ outputTokenAddress: optional(hexString()), approvalAddress: optional(hexString()), - }) + }), ); const ContractCallSchema = object({ @@ -72,10 +72,10 @@ export const MultiHopSchema = BridgeCoreSchema; export const SingleHopWithContractSchema = assign( BridgeCoreWithRecipientSchema, - ContractCallSchema + ContractCallSchema, ); export const MultiHopWithContractSchema = assign( BridgeCoreSchema, - ContractCallSchema + ContractCallSchema, ); diff --git a/packages/sdk/src/sprinter.ts b/packages/sdk/src/sprinter.ts index d61bd71..b1dc04e 100644 --- a/packages/sdk/src/sprinter.ts +++ b/packages/sdk/src/sprinter.ts @@ -57,11 +57,11 @@ export class Sprinter { * ``` */ public async getAvailableTokens( - options: FetchOptions = {} + options: FetchOptions = {}, ): Promise { if (!this.#tokens) this.#tokens = await this.deferredRequest("tokens", () => - getFungibleTokens(this.makeFetchOptions(options)) + getFungibleTokens(this.makeFetchOptions(options)), ); return this.#tokens; } @@ -85,11 +85,11 @@ export class Sprinter { * ``` */ public async getAvailableChains( - options: FetchOptions = {} + options: FetchOptions = {}, ): Promise { if (!this.#chains) this.#chains = await this.deferredRequest("chains", () => - getSupportedChains(this.makeFetchOptions(options)) + getSupportedChains(this.makeFetchOptions(options)), ); return this.#chains; } @@ -151,7 +151,7 @@ export class Sprinter { public async getUserBalances( account: Address, tokens?: FungibleToken[], - options: FetchOptions = {} + options: FetchOptions = {}, ): Promise { const tokenList = tokens || (await this.getAvailableTokens(options)); @@ -161,8 +161,8 @@ export class Sprinter { getUserBalances( account, tokenList, - this.makeFetchOptions(options || {}) - ) + this.makeFetchOptions(options || {}), + ), ); return formatBalances([balances, nativeTokens]); } @@ -253,7 +253,7 @@ export class Sprinter { */ public async poolAssetOnDestination( settings: Infer, - options?: FetchOptions + options?: FetchOptions, ): Promise { assert(settings, MultiHopSchema); @@ -264,7 +264,7 @@ export class Sprinter { amount: BigInt(amount), whitelistedSourceChains: sourceChains, } as SolutionOptions, - this.makeFetchOptions(options) + this.makeFetchOptions(options), ); } @@ -327,7 +327,7 @@ export class Sprinter { */ public async poolAssetOnDestinationWithHook( settings: Infer, - options?: FetchOptions + options?: FetchOptions, ): Promise { assert(settings, MultiHopWithContractSchema); @@ -338,7 +338,7 @@ export class Sprinter { amount: BigInt(amount), whitelistedSourceChains: sourceChains, } as ContractSolutionOptions, - this.makeFetchOptions(options) + this.makeFetchOptions(options), ); } @@ -385,7 +385,7 @@ export class Sprinter { */ public async transfer( settings: Infer, - options?: FetchOptions + options?: FetchOptions, ): Promise { assert(settings, SingleHopSchema); @@ -396,7 +396,7 @@ export class Sprinter { amount: BigInt(amount), whitelistedSourceChains: sourceChains, } as SolutionOptions, - this.makeFetchOptions(options) + this.makeFetchOptions(options), ); } @@ -459,7 +459,7 @@ export class Sprinter { */ public async transferWithHook( settings: Infer, - options?: FetchOptions + options?: FetchOptions, ): Promise { assert(settings, SingleHopWithContractSchema); @@ -470,13 +470,13 @@ export class Sprinter { amount: BigInt(amount), whitelistedSourceChains: sourceChains, } as SolutionOptions, - this.makeFetchOptions(options) + this.makeFetchOptions(options), ); } private deferredRequest( name: string, - request: () => Promise + request: () => Promise, ): Promise { if (!(name in this.#requests)) { this.#requests[name] = request();