From e6880c9b1826d65dc9e7c8065b642f325d96db52 Mon Sep 17 00:00:00 2001 From: cryptooda Date: Fri, 19 Dec 2025 12:07:54 +0700 Subject: [PATCH] Update fullstack guidelines to use 'bun' instead of 'npm' for testing; modify package.json to lock specific versions of dependencies for consistency; adjust TypeScript code for improved type handling in simulateExecuteOrder function; enhance swap-tokens test with additional parameters for better coverage. --- .cursor/rules/fullstack.mdc | 3 ++- src/Managing.Web3Proxy/package.json | 19 ++++++++++------- .../gmxsdk/utils/simulateExecuteOrder.ts | 21 +++++++++---------- .../test/plugins/swap-tokens.test.ts | 7 +++++-- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/.cursor/rules/fullstack.mdc b/.cursor/rules/fullstack.mdc index 4fd682cb..10d93df9 100644 --- a/.cursor/rules/fullstack.mdc +++ b/.cursor/rules/fullstack.mdc @@ -95,6 +95,7 @@ Key Principles - you have to pass from controller -> application -> repository, do not inject repository inside controllers - dont use command line to edit file, use agent mode capabilities to do it - when dividing, make sure variable is not zero - - to test a single ts test you can run : npm run test:single test/plugins/test-name-file.test.tsx + - to test a single ts test you can run : bun run test:single test/plugins/test-name-file.test.tsx - do not implement business logic on the controller, keep the business logic for Service files - When adding new property to and Orleans state, always add the property after the last one and increment the id + - Do not use "npm" use only "bun" command for Web3Proxy and WebApp diff --git a/src/Managing.Web3Proxy/package.json b/src/Managing.Web3Proxy/package.json index f23f6f1e..e523b41f 100644 --- a/src/Managing.Web3Proxy/package.json +++ b/src/Managing.Web3Proxy/package.json @@ -43,28 +43,32 @@ "@fastify/swagger-ui": "^5.0.1", "@fastify/type-provider-typebox": "^5.0.0", "@fastify/under-pressure": "^9.0.1", - "@gelatonetwork/relay-sdk": "^5.6.0", + "@gelatonetwork/relay-sdk": "5.6.0", "@infisical/sdk": "^4.0.6", "@privy-io/server-auth": "^1.18.12", "@sentry/node": "^8.55.0", "@sinclair/typebox": "^0.34.11", "canonicalize": "^2.0.0", "concurrently": "^9.2.1", - "cross-fetch": "^4.1.0", - "crypto-js": "^4.2.0", + "cross-fetch": "4.0.0", + "crypto-js": "4.2.0", "csv-stringify": "^6.5.2", "ethers": "^6.13.5", "fastify": "^5.0.0", "fastify-cli": "^7.3.0", "fastify-plugin": "^5.0.1", "form-data": "^4.0.1", + "graphql": "15.8.0", + "isomorphic-performance": "5.1.1", "knex": "^3.1.0", - "lodash": "^4.17.21", + "lodash": "4.17.21", "mysql2": "^3.11.3", "postgrator": "^8.0.0", - "query-string": "^9.1.1", + "query-string": "7.1.1", "redis": "^5.8.2", - "viem": "2.37.1", + "typescript": "5.4.2", + "universal-perf-hooks": "1.0.1", + "viem": "^2.37.1", "vitest": "^3.0.8", "zod": "^3.24.2" }, @@ -76,7 +80,6 @@ "fastify-tsconfig": "^3.0.0", "glob": "^11.0.0", "neostandard": "^0.12.0", - "tsx": "^4.19.1", - "typescript": "~5.8.2" + "tsx": "^4.19.1" } } diff --git a/src/Managing.Web3Proxy/src/generated/gmxsdk/utils/simulateExecuteOrder.ts b/src/Managing.Web3Proxy/src/generated/gmxsdk/utils/simulateExecuteOrder.ts index 9981d914..829f1342 100644 --- a/src/Managing.Web3Proxy/src/generated/gmxsdk/utils/simulateExecuteOrder.ts +++ b/src/Managing.Web3Proxy/src/generated/gmxsdk/utils/simulateExecuteOrder.ts @@ -1,14 +1,14 @@ -import { Abi, Address, decodeErrorResult, encodeFunctionData, withRetry } from "viem"; +import {Abi, Address, decodeErrorResult, encodeFunctionData, withRetry} from "viem"; -import { abis } from "../abis/index.js"; -import { getContract } from "../configs/contracts.js"; -import { convertTokenAddress } from "../configs/tokens.js"; -import { SwapPricingType } from "../types/orders.js"; -import { TokenPrices, TokensData } from "../types/tokens.js"; +import {abis} from "../abis/index.js"; +import {getContract} from "../configs/contracts.js"; +import {convertTokenAddress} from "../configs/tokens.js"; +import {SwapPricingType} from "../types/orders.js"; +import {TokenPrices, TokensData} from "../types/tokens.js"; -import type { GmxSdk } from ".."; -import { extractTxnError } from "./errors/index.js"; -import { convertToContractPrice, getTokenData } from "./tokens.js"; +import type {GmxSdk} from ".."; +import {extractTxnError} from "./errors/index.js"; +import {convertToContractPrice, getTokenData} from "./tokens.js"; export type PriceOverrides = { [address: string]: TokenPrices | undefined; @@ -53,8 +53,7 @@ export async function simulateExecuteOrder(sdk: GmxSdk, p: SimulateExecuteParams abi: abis.Multicall as Abi, functionName: "getCurrentBlockTimestamp", args: [], - authorizationList: [], - }); + } as any); const blockNumber = await client.getBlockNumber(); diff --git a/src/Managing.Web3Proxy/test/plugins/swap-tokens.test.ts b/src/Managing.Web3Proxy/test/plugins/swap-tokens.test.ts index 758a7f87..132c300e 100644 --- a/src/Managing.Web3Proxy/test/plugins/swap-tokens.test.ts +++ b/src/Managing.Web3Proxy/test/plugins/swap-tokens.test.ts @@ -13,9 +13,12 @@ describe('swap tokens implementation', () => { console.log('Account', sdk.account) const result = await swapGmxTokensImpl( sdk, - Ticker.BTC, + Ticker.BTC, Ticker.USDC, - 0.00007559 + 0.00006893, + 'market', + undefined, + 0.5 ) assert.strictEqual(typeof result, 'string')