-
Notifications
You must be signed in to change notification settings - Fork 415
Remove typechain FEDEV-3220 #2128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release
Are you sure you want to change the base?
Conversation
…ts and updating contract interactions to use public client methods. Clean up .gitignore by removing unnecessary entries. Adjust types for QuoteOft to allow for more flexibility.
…factories, and interfaces, to streamline the codebase and eliminate redundancy.
… multiple components. Update ESLint configuration to disable optional catch binding rule. Clean up .gitignore by removing unnecessary entries. Adjust type definitions for trade history actions and improve contract interaction methods to utilize public client for better performance.
…osit functions to utilize encodeFunctionData for improved clarity and consistency. Remove redundant contract instantiation and streamline multicall payload creation across various transaction types.
…e and eliminate redundancy across various contract interfaces.
…rom the library, replacing instances of and for improved consistency and clarity in address validation and comparison.
…or improved signer management. Update random account generation to utilize private key accounts, enhancing security and consistency. Streamline wallet interactions and enhance type definitions across various components for better clarity and maintainability.
…ace into remove-typechain
…ect. Update Vite configuration to reflect these changes.
| args?: { | ||
| [key in ExtractAbiItem< | ||
| typeof abis.CustomErrors, | ||
| ContractErrorName<typeof abis.CustomErrors> | ||
| >["inputs"][number]["name"]]: AbiParameterToPrimitiveType< | ||
| Extract< | ||
| ExtractAbiItem<typeof abis.CustomErrors, ContractErrorName<typeof abis.CustomErrors>>["inputs"][number], | ||
| { name: key } | ||
| >, | ||
| "inputs" | ||
| >; | ||
| }; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract to named type
| if (paramsAccount && ethers.isAddress(paramsAccount)) { | ||
| checkSummedAccount = ethers.getAddress(paramsAccount); | ||
| if (paramsAccount && isAddress(paramsAccount)) { | ||
| checkSummedAccount = getAddress(paramsAccount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passs strict false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| import { signCreateWithdrawal } from "../signCreateWithdrawal"; | ||
| import { signCreateGlvWithdrawal } from "../signCreateGlvWithdrawal"; | ||
| import { CreateGlvWithdrawalParams } from "../types"; | ||
| import { stargateTransferFees } from "./stargateTransferFees"; | ||
|
|
||
| export async function estimateGlvWithdrawalPlatformTokenTransferInFees({ | ||
| chainId, | ||
| srcChainId, | ||
| marketTokenAmount, | ||
| fullWntFee, | ||
| params, | ||
| secondaryOrPrimaryOutputTokenAddress: _secondaryOrPrimaryOutputTokenAddress, | ||
| globalExpressParams, | ||
| }: { | ||
| chainId: SettlementChainId; | ||
| srcChainId: SourceChainId; | ||
| marketTokenAmount: bigint; | ||
| fullWntFee: bigint; | ||
| params: CreateGlvWithdrawalParams; | ||
| secondaryOrPrimaryOutputTokenAddress: string; | ||
| globalExpressParams: GlobalExpressParams; | ||
| }): Promise<{ | ||
| platformTokenTransferInGasLimit: bigint; | ||
| platformTokenTransferInNativeFee: bigint; | ||
| platformTokenTransferInComposeGas: bigint; | ||
| relayParamsPayload: RelayParamsPayload; | ||
| }> { | ||
| const settlementWrappedTokenData = globalExpressParams.tokensData[getWrappedToken(chainId).address]; | ||
|
|
||
| const rawRelayParamsPayload = getRawRelayerParams({ | ||
| chainId, | ||
| gasPaymentTokenAddress: settlementWrappedTokenData.address, | ||
| relayerFeeTokenAddress: settlementWrappedTokenData.address, | ||
| feeParams: { | ||
| feeToken: settlementWrappedTokenData.address, | ||
| feeAmount: fullWntFee, | ||
| feeSwapPath: [], | ||
| }, | ||
| externalCalls: getEmptyExternalCallsPayload(), | ||
| tokenPermits: [], | ||
| }); | ||
|
|
||
| const relayParamsPayload: RelayParamsPayload = { | ||
| ...rawRelayParamsPayload, | ||
| deadline: BigInt(nowInSeconds() + DEFAULT_EXPRESS_ORDER_DEADLINE_DURATION), | ||
| }; | ||
|
|
||
| const vaultAddress = getContract(chainId, "GlvVault"); | ||
| const transferRequests = getTransferRequests([ | ||
| { | ||
| to: vaultAddress, | ||
| token: params.addresses.glv, | ||
| amount: marketTokenAmount, | ||
| }, | ||
| ]); | ||
|
|
||
| if (!transferRequests) { | ||
| throw new Error("Transfer requests not found"); | ||
| } | ||
|
|
||
| const signature = await signCreateWithdrawal({ | ||
| const signature = await signCreateGlvWithdrawal({ | ||
| chainId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait till fix multichain is merged
| params: CreateWithdrawalParams; | ||
| params: CreateGlvWithdrawalParams; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait till fix multichain gets merged
src/pages/Referrals/Referrals.tsx
Outdated
| let account; | ||
| if (queryAccount && ethers.isAddress(queryAccount)) { | ||
| account = ethers.getAddress(queryAccount); | ||
| if (queryAccount && isAddress(queryAccount)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use strict false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/pages/NftWallet/NftWallet.jsx
Outdated
| if (!ethers.isAddress(receiver)) { | ||
| if (!isAddress(receiver)) { | ||
| return t`Invalid Receiver Address`; | ||
| } | ||
| if (!nftAddress || nftAddress.length === 0) { | ||
| return t`Enter NFT Address`; | ||
| } | ||
| if (!ethers.isAddress(nftAddress)) { | ||
| if (!isAddress(nftAddress)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| const [, copyToClipboard] = useCopyToClipboard(); | ||
| const { sender, receiver } = useParams<{ sender: string | undefined; receiver: string | undefined }>(); | ||
| const isSenderAndReceiverValid = ethers.isAddress(sender) && ethers.isAddress(receiver); | ||
| const isSenderAndReceiverValid = sender && receiver && isAddress(sender) && isAddress(receiver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| return t`Enter Receiver Address`; | ||
| } | ||
| if (!ethers.isAddress(receiver)) { | ||
| if (!isAddress(receiver)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strict false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/wallets/rainbowKitConfig.ts
Outdated
| const transport = fallback([ | ||
| ...getRpcProviders(chainId, purpose).map((provider) => http(provider.url, HTTP_TRANSPORT_OPTIONS)), | ||
| ]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless spread
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/wallets/rainbowKitConfig.ts
Outdated
| } else if (options.withExpress) { | ||
| transport = getRpcTransport(chainId as AnyChainId, "express"); | ||
| } else { | ||
| transport = getRpcTransport(chainId as AnyChainId, "fallback"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why fallback, should be probably default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/lib/rpc/index.ts
Outdated
| throw new Error(`Unsupported websocket provider for chain id: ${chainId}`); | ||
| return new ethers.WebSocketProvider(getWsUrl(chainId)!, network, { staticNetwork: network }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
protect from unsupported chain ids
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
@cursor review |
…mponents and contexts for improved flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
…ovider mapping and updating fallback transport type from fallback to default.
Deploying gmx-interface-home with
|
| Latest commit: |
580cbc7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4156a026.gmx-interface-home.pages.dev |
| Branch Preview URL: | https://remove-typechain.gmx-interface-home.pages.dev |
Deploying gmx-interface with
|
| Latest commit: |
580cbc7
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://b88fe7b4.gmx-interface.pages.dev |
| Branch Preview URL: | https://remove-typechain.gmx-interface.pages.dev |
|
@cursor review |
…event subscription logic by removing unused source chain provider references and adjusting account type to allow null. Enhanced clarity in debug logging for source chain approval events. Updated metrics to remove unnecessary data fields.
|
@cursor review i updates the web socket handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
|
src/lib/transactions/sendWalletTransaction.ts not changed |
| requiredListenerCount, | ||
| listenerCount, | ||
| }, | ||
| data: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why listenners params removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viem is move of a black box when it comes to subscriptions, i tried but it was difficuly
| }); | ||
|
|
||
| blockTimestamp = blockTimestampResult.result!; | ||
| blockNumber = currentBlockNumberResult.result!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we need result**!** ? probably we should check if it's exist and throw an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, extracted to function, reused
| ], | ||
| }); | ||
|
|
||
| blockTimestamp = blockTimestampResult.result!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here result**!**
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, extracted to function, reused
src/lib/transactions/iSigner.ts
Outdated
|
|
||
| static fromPrivateKeyAccount(privateKeyAccount: PrivateKeyAccount): ISigner { | ||
| const gmxSigner = new ISigner({ privateKeyAccount }); | ||
| gmxSigner._address = privateKeyAccount.address; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, seems _address should be settled in constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to constructor, added initialization lock promise
…handling in SyntheticsEventsProvider and useMultichainEvents to eliminate websocket dependencies. Introduce new metrics for Viem WebSocket client connections and disconnections. Refactor related code for improved clarity and performance.
…eTxn and simulateExecution functions. Introduce getBlockTimestampAndNumber utility for cleaner code and error handling. Update ISigner class to include initialization lock for address resolution.
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
… for viem errors. Refactor error extraction and decoding logic for improved clarity and maintainability.
c8c1a58 to
5064962
Compare
…al, enhancing error handling for missing tokens in multichain events.
|
@cursor review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
Note
Mass migration from ethers/typechain to viem across app, simplifying contract I/O, events, and infra.
publicClient.readContract,watchContractEvent,encodeFunctionData, viem constants/types, anddecodeErrorResult; remove typechain-specific factories and adapt tests/utilitiesgetWsUrl, streamlined endpoint selection, remove legacy RPC fallback switcher and delete old tracker (oldRpcTracker.ts); tidy RPC debug and AB flagsISignerfor signing; Stargate reads viareadContract; encode tx payloads with viem; adjust OFT/LayerZero subscriptionsreasonBytesa string; route/debug paths slightly reorganizedWritten by Cursor Bugbot for commit f60a8aa. This will update automatically on new commits. Configure here.