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.

This commit is contained in:
2025-12-19 12:07:54 +07:00
parent 6d64af7c01
commit e6880c9b18
4 changed files with 28 additions and 22 deletions

View File

@@ -95,6 +95,7 @@ Key Principles
- you have to pass from controller -> application -> repository, do not inject repository inside controllers - 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 - dont use command line to edit file, use agent mode capabilities to do it
- when dividing, make sure variable is not zero - 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 - 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 - 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

View File

@@ -43,28 +43,32 @@
"@fastify/swagger-ui": "^5.0.1", "@fastify/swagger-ui": "^5.0.1",
"@fastify/type-provider-typebox": "^5.0.0", "@fastify/type-provider-typebox": "^5.0.0",
"@fastify/under-pressure": "^9.0.1", "@fastify/under-pressure": "^9.0.1",
"@gelatonetwork/relay-sdk": "^5.6.0", "@gelatonetwork/relay-sdk": "5.6.0",
"@infisical/sdk": "^4.0.6", "@infisical/sdk": "^4.0.6",
"@privy-io/server-auth": "^1.18.12", "@privy-io/server-auth": "^1.18.12",
"@sentry/node": "^8.55.0", "@sentry/node": "^8.55.0",
"@sinclair/typebox": "^0.34.11", "@sinclair/typebox": "^0.34.11",
"canonicalize": "^2.0.0", "canonicalize": "^2.0.0",
"concurrently": "^9.2.1", "concurrently": "^9.2.1",
"cross-fetch": "^4.1.0", "cross-fetch": "4.0.0",
"crypto-js": "^4.2.0", "crypto-js": "4.2.0",
"csv-stringify": "^6.5.2", "csv-stringify": "^6.5.2",
"ethers": "^6.13.5", "ethers": "^6.13.5",
"fastify": "^5.0.0", "fastify": "^5.0.0",
"fastify-cli": "^7.3.0", "fastify-cli": "^7.3.0",
"fastify-plugin": "^5.0.1", "fastify-plugin": "^5.0.1",
"form-data": "^4.0.1", "form-data": "^4.0.1",
"graphql": "15.8.0",
"isomorphic-performance": "5.1.1",
"knex": "^3.1.0", "knex": "^3.1.0",
"lodash": "^4.17.21", "lodash": "4.17.21",
"mysql2": "^3.11.3", "mysql2": "^3.11.3",
"postgrator": "^8.0.0", "postgrator": "^8.0.0",
"query-string": "^9.1.1", "query-string": "7.1.1",
"redis": "^5.8.2", "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", "vitest": "^3.0.8",
"zod": "^3.24.2" "zod": "^3.24.2"
}, },
@@ -76,7 +80,6 @@
"fastify-tsconfig": "^3.0.0", "fastify-tsconfig": "^3.0.0",
"glob": "^11.0.0", "glob": "^11.0.0",
"neostandard": "^0.12.0", "neostandard": "^0.12.0",
"tsx": "^4.19.1", "tsx": "^4.19.1"
"typescript": "~5.8.2"
} }
} }

View File

@@ -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 {abis} from "../abis/index.js";
import { getContract } from "../configs/contracts.js"; import {getContract} from "../configs/contracts.js";
import { convertTokenAddress } from "../configs/tokens.js"; import {convertTokenAddress} from "../configs/tokens.js";
import { SwapPricingType } from "../types/orders.js"; import {SwapPricingType} from "../types/orders.js";
import { TokenPrices, TokensData } from "../types/tokens.js"; import {TokenPrices, TokensData} from "../types/tokens.js";
import type { GmxSdk } from ".."; import type {GmxSdk} from "..";
import { extractTxnError } from "./errors/index.js"; import {extractTxnError} from "./errors/index.js";
import { convertToContractPrice, getTokenData } from "./tokens.js"; import {convertToContractPrice, getTokenData} from "./tokens.js";
export type PriceOverrides = { export type PriceOverrides = {
[address: string]: TokenPrices | undefined; [address: string]: TokenPrices | undefined;
@@ -53,8 +53,7 @@ export async function simulateExecuteOrder(sdk: GmxSdk, p: SimulateExecuteParams
abi: abis.Multicall as Abi, abi: abis.Multicall as Abi,
functionName: "getCurrentBlockTimestamp", functionName: "getCurrentBlockTimestamp",
args: [], args: [],
authorizationList: [], } as any);
});
const blockNumber = await client.getBlockNumber(); const blockNumber = await client.getBlockNumber();

View File

@@ -13,9 +13,12 @@ describe('swap tokens implementation', () => {
console.log('Account', sdk.account) console.log('Account', sdk.account)
const result = await swapGmxTokensImpl( const result = await swapGmxTokensImpl(
sdk, sdk,
Ticker.BTC, Ticker.BTC,
Ticker.USDC, Ticker.USDC,
0.00007559 0.00006893,
'market',
undefined,
0.5
) )
assert.strictEqual(typeof result, 'string') assert.strictEqual(typeof result, 'string')