From ced081d2902cd628f834a285a92137af3ca828f5 Mon Sep 17 00:00:00 2001 From: Stefano Faieta <9802152+stefanofa@users.noreply.github.com> Date: Mon, 13 Nov 2023 17:37:19 +0100 Subject: [PATCH] chore: ugprade and run prettier --- package.json | 6 ++-- packages/folks-router-js-sdk/examples/swap.ts | 11 ++----- .../src/FolksRouterClient.ts | 8 ++--- .../src/abiContracts/index.ts | 4 +-- packages/folks-router-js-sdk/src/referrer.ts | 6 ++-- packages/folks-router-js-sdk/src/swap.ts | 2 +- packages/folks-router-js-sdk/src/types.ts | 2 +- packages/folks-router-js-sdk/src/utils.ts | 2 +- packages/folks-router-js-sdk/tsconfig.json | 2 +- pnpm-lock.yaml | 30 +++++++++---------- 10 files changed, 35 insertions(+), 38 deletions(-) diff --git a/package.json b/package.json index 5fcd1d4..532ef20 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "build": "turbo run build", "dev": "turbo run dev", "lint": "turbo run lint", - "format": "prettier --write \"**/*\" --ignore-unknown", + "format": "prettier --write . --ignore-unknown", "release": "turbo run build && changeset publish", "check-exports": "turbo run check-exports" }, @@ -13,8 +13,8 @@ "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", "eslint": "^8.48.0", - "prettier": "^3.0.3", - "prettier-plugin-astro": "^0.12.0", + "prettier": "^3.1.0", + "prettier-plugin-astro": "^0.12.2", "tsconfig": "workspace:*", "turbo": "^1.10.15" }, diff --git a/packages/folks-router-js-sdk/examples/swap.ts b/packages/folks-router-js-sdk/examples/swap.ts index f2786ac..f938499 100644 --- a/packages/folks-router-js-sdk/examples/swap.ts +++ b/packages/folks-router-js-sdk/examples/swap.ts @@ -8,17 +8,12 @@ async function main() { const client = new FolksRouterClient(Network.MAINNET); // fetch quote - const quote = await client.fetchSwapQuote( - 0, - 31566704, - BigInt(10e6), - SwapMode.FIXED_INPUT, - ); + const quote = await client.fetchSwapQuote(0, 31566704, BigInt(10e6), SwapMode.FIXED_INPUT); // prepare swap const base64txns = await client.prepareSwapTransactions(user.addr, BigInt(10), quote); - const unsignedTxns = base64txns.map(txn => decodeUnsignedTransaction(Buffer.from(txn, "base64"))); - const signedTxns = unsignedTxns.map(txn => txn.signTxn(user.sk)); + const unsignedTxns = base64txns.map((txn) => decodeUnsignedTransaction(Buffer.from(txn, "base64"))); + const signedTxns = unsignedTxns.map((txn) => txn.signTxn(user.sk)); // submit await algod.sendRawTransaction(signedTxns).do(); diff --git a/packages/folks-router-js-sdk/src/FolksRouterClient.ts b/packages/folks-router-js-sdk/src/FolksRouterClient.ts index ed001d6..2825b9c 100644 --- a/packages/folks-router-js-sdk/src/FolksRouterClient.ts +++ b/packages/folks-router-js-sdk/src/FolksRouterClient.ts @@ -1,4 +1,4 @@ -import axios, { AxiosInstance} from "axios"; +import axios, { AxiosInstance } from "axios"; import { Network, SwapMode, SwapQuote, SwapTransactions } from "./types"; const BASE_URL = "https://api.folksrouter.io"; @@ -18,7 +18,7 @@ export class FolksRouterClient { // set this.network = network; - this.api = axios.create({ baseURL: url, headers: { "x-api-key": apiKey }}); + this.api = axios.create({ baseURL: url, headers: { "x-api-key": apiKey } }); } public async fetchSwapQuote( @@ -40,7 +40,7 @@ export class FolksRouterClient { maxGroupSize, feeBps, referrer, - } + }, }); if (!data.success) throw Error(data.errors); @@ -64,7 +64,7 @@ export class FolksRouterClient { userAddress, slippageBps, txnPayload: swapQuote.txnPayload, - } + }, }); if (!data.success) throw Error(data.errors); diff --git a/packages/folks-router-js-sdk/src/abiContracts/index.ts b/packages/folks-router-js-sdk/src/abiContracts/index.ts index 0fa852b..fb84354 100644 --- a/packages/folks-router-js-sdk/src/abiContracts/index.ts +++ b/packages/folks-router-js-sdk/src/abiContracts/index.ts @@ -1,4 +1,4 @@ import { ABIContract } from "algosdk"; -import routerABI from "./router.json" +import routerABI from "./router.json"; -export const routerABIContract = new ABIContract(routerABI) +export const routerABIContract = new ABIContract(routerABI); diff --git a/packages/folks-router-js-sdk/src/referrer.ts b/packages/folks-router-js-sdk/src/referrer.ts index f2840df..e8e4fa2 100644 --- a/packages/folks-router-js-sdk/src/referrer.ts +++ b/packages/folks-router-js-sdk/src/referrer.ts @@ -1,9 +1,11 @@ import { assignGroupID, - decodeAddress, encodeAddress, + decodeAddress, + encodeAddress, encodeUnsignedTransaction, LogicSigAccount, - SuggestedParams, Transaction + SuggestedParams, + Transaction, } from "algosdk"; import { ReferrerGroupTransaction } from "./types"; import { transferAlgoOrAsset } from "./utils"; diff --git a/packages/folks-router-js-sdk/src/swap.ts b/packages/folks-router-js-sdk/src/swap.ts index e63c85e..1500a84 100644 --- a/packages/folks-router-js-sdk/src/swap.ts +++ b/packages/folks-router-js-sdk/src/swap.ts @@ -4,7 +4,7 @@ import { getApplicationAddress, getMethodByName, SuggestedParams, - Transaction + Transaction, } from "algosdk"; import { routerABIContract } from "./abiContracts"; import { signer, transferAlgoOrAsset } from "./utils"; diff --git a/packages/folks-router-js-sdk/src/types.ts b/packages/folks-router-js-sdk/src/types.ts index 2cc9b64..4f8be9e 100644 --- a/packages/folks-router-js-sdk/src/types.ts +++ b/packages/folks-router-js-sdk/src/types.ts @@ -22,4 +22,4 @@ interface SwapQuote { type SwapTransactions = string[]; -export { ReferrerGroupTransaction, Network, SwapMode, SwapQuote, SwapTransactions } +export { ReferrerGroupTransaction, Network, SwapMode, SwapQuote, SwapTransactions }; diff --git a/packages/folks-router-js-sdk/src/utils.ts b/packages/folks-router-js-sdk/src/utils.ts index c3918e6..a7dbd20 100644 --- a/packages/folks-router-js-sdk/src/utils.ts +++ b/packages/folks-router-js-sdk/src/utils.ts @@ -2,7 +2,7 @@ import { makeAssetTransferTxnWithSuggestedParams, makePaymentTxnWithSuggestedParams, SuggestedParams, - Transaction + Transaction, } from "algosdk"; const signer = async () => []; diff --git a/packages/folks-router-js-sdk/tsconfig.json b/packages/folks-router-js-sdk/tsconfig.json index 9013f3d..1082a90 100644 --- a/packages/folks-router-js-sdk/tsconfig.json +++ b/packages/folks-router-js-sdk/tsconfig.json @@ -10,7 +10,7 @@ "sourceMap": true, "isolatedModules": false, "exactOptionalPropertyTypes": false, - "resolveJsonModule": true, + "resolveJsonModule": true }, "include": ["./src/index.ts", "./examples/*"], "exclude": ["dist", "build", "node_modules"] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c5aeb19..9f73965 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,11 +18,11 @@ importers: specifier: ^8.48.0 version: 8.52.0 prettier: - specifier: ^3.0.3 - version: 3.0.3 + specifier: ^3.1.0 + version: 3.1.0 prettier-plugin-astro: - specifier: ^0.12.0 - version: 0.12.0 + specifier: ^0.12.2 + version: 0.12.2 tsconfig: specifier: workspace:* version: link:packages/tsconfig @@ -179,7 +179,7 @@ importers: devDependencies: '@vercel/style-guide': specifier: ^5.0.1 - version: 5.0.1(eslint@8.52.0)(prettier@3.0.3)(typescript@5.2.2) + version: 5.0.1(eslint@8.52.0)(prettier@3.1.0)(typescript@5.2.2) eslint-config-turbo: specifier: ^1.10.14 version: 1.10.14(eslint@8.52.0) @@ -2336,7 +2336,7 @@ packages: /@ungap/structured-clone@1.2.0: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - /@vercel/style-guide@5.0.1(eslint@8.52.0)(prettier@3.0.3)(typescript@5.2.2): + /@vercel/style-guide@5.0.1(eslint@8.52.0)(prettier@3.1.0)(typescript@5.2.2): resolution: {integrity: sha512-3J/5xpwJ2Wk+cKB3EGY2KCdVQycaThLKhjBmgXPfIKb+E74lPpXVIDfaQE0D2JoAyIzGsqdH7Lbmr+DojwofxQ==} engines: {node: '>=16'} peerDependencies: @@ -2373,8 +2373,8 @@ packages: eslint-plugin-testing-library: 6.0.1(eslint@8.52.0)(typescript@5.2.2) eslint-plugin-tsdoc: 0.2.17 eslint-plugin-unicorn: 48.0.1(eslint@8.52.0) - prettier: 3.0.3 - prettier-plugin-packagejson: 2.4.5(prettier@3.0.3) + prettier: 3.1.0 + prettier-plugin-packagejson: 2.4.5(prettier@3.1.0) typescript: 5.2.2 transitivePeerDependencies: - eslint-import-resolver-node @@ -7664,16 +7664,16 @@ packages: engines: {node: '>= 0.8.0'} dev: true - /prettier-plugin-astro@0.12.0: - resolution: {integrity: sha512-8E+9YQR6/5CPZJs8XsfBw579zrwZkc0Wb7x0fRVm/51JC8Iys4lBw4ecV8fHwpbQnzve86TUa4fJ08BJzqfWnA==} + /prettier-plugin-astro@0.12.2: + resolution: {integrity: sha512-1OXSEht27zrnX7rCa0bEpLdspeumFW4hnj4+JzPuG5bRlSOAhD0rbXBNZfRD9q0Qbr00EcCcnjd6k6M8q+GfTA==} engines: {node: ^14.15.0 || >=16.0.0} dependencies: '@astrojs/compiler': 1.8.2 - prettier: 3.0.3 + prettier: 3.1.0 sass-formatter: 0.7.8 dev: true - /prettier-plugin-packagejson@2.4.5(prettier@3.0.3): + /prettier-plugin-packagejson@2.4.5(prettier@3.1.0): resolution: {integrity: sha512-glG71jE1gO3y5+JNAhC8X+4yrlN28rub6Aj461SKbaPie9RgMiHKcInH2Moi2VGOfkTXaEHBhg4uVMBqa+kBUA==} peerDependencies: prettier: '>= 1.16.0' @@ -7681,7 +7681,7 @@ packages: prettier: optional: true dependencies: - prettier: 3.0.3 + prettier: 3.1.0 sort-package-json: 2.5.1 synckit: 0.8.5 dev: true @@ -7692,8 +7692,8 @@ packages: hasBin: true dev: true - /prettier@3.0.3: - resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + /prettier@3.1.0: + resolution: {integrity: sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw==} engines: {node: '>=14'} hasBin: true dev: true