Conversation
WalkthroughDependency and tooling version bumps across many packages; Etherscan explorer endpoints and txlist path adjusted; survey popup disabled; RFQ support added (OneInchFusion provider, RFQ types, approvals/wrapper ABI, receipt waiter), UI RFQ wiring and tests. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant UI as Swap UI
participant Swap as Swap core
participant Prov as OneInchFusion
participant Node as Fusion SDK / EVM Node
rect rgb(245,250,255)
note over UI,Swap: RFQ quote → user signatures → submit → wait-for-receipt
UI->>Swap: request quotes
Swap->>Prov: getQuote(params)
Prov-->>Swap: OneInchSwapResponse (transactions, typedMessages, quoteId, orderHash)
Swap->>UI: present RFQ option
UI->>Swap: user signs typedMessages -> signatures
Swap->>Prov: submitRFQOrder({ options, signatures })
Prov->>Node: Fusion SDK submit order
Prov-->>Swap: orderHash
Swap->>Node: waitForReceipt([txHashes]) (polling)
Node-->>Swap: receipts (confirmed) or timeout
Swap->>UI: show SwapInitiated (waitingToBeMined toggled)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
💼 Build Files |
devop: remove survey
fix: etherscan urls
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
packages/extension-bridge/package.json (1)
47-65: Move type-fest into dependencies
JsonValue from type-fest is exposed in your public types (e.g. IBridgeMessage, GetDataType/GetReturnType, Stream APIs), so consumers will need type-fest to type-check. Update packages/extension-bridge/package.json to list type-fest under dependencies.packages/extension/src/ui/action/components/app-menu/index.vue (1)
281-285: Undefined reference: openSurveyPopup() will throw at runtime
openSurveyPopup()was removed but is still called inonMounted. This will cause a ReferenceError and break the menu initialization.Apply this diff:
- isSolanaStakingBanner.value = await bannersState.showSolanaStakingBanner(); - if (!isSolanaStakingBanner.value) { - openSurveyPopup(); - } + isSolanaStakingBanner.value = await bannersState.showSolanaStakingBanner(); + // Survey popup temporarily disabledAlternatively, reintroduce a no-op
openSurveyPopup()andisSurveyPopupref.packages/hw-wallets/package.json (1)
21-23: Bump Node.js engine to ≥18.18.0
ESLint 9.x and @typescript-eslint 8.x require Node.js ≥18.18.0.
packages/hw-wallets/package.json lines 21–23:- "engines": { - "node": ">=14.15.0" - }, + "engines": { + "node": ">=18.18.0" + },
🧹 Nitpick comments (2)
packages/signers/bitcoin/package.json (1)
35-38: Align @types/node and ensure ESLint 9 environmentSame concerns as other packages: unify @types/node and ensure Node >=18 in dev/CI for ESLint 9.
Suggested alignment:
- "@types/node": "^24.5.2", + "@types/node": "^22.18.6",Reuse the engines/CI validation script from the kadena package comment.
Also applies to: 49-49
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1)
3-3: Tighten typing for endpoints mapUse
Record<NetworkNames, string>instead ofRecord<string, string>to prevent missing/mistyped keys at compile time.-const NetworkEndpoints: Record<string, string> = { +const NetworkEndpoints: Record<NetworkNames, string> = {
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (19)
package.json(1 hunks)packages/extension-bridge/package.json(2 hunks)packages/extension/package.json(5 hunks)packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts(1 hunks)packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts(1 hunks)packages/extension/src/ui/action/components/app-menu/index.vue(1 hunks)packages/hw-wallets/package.json(3 hunks)packages/keyring/package.json(2 hunks)packages/name-resolution/package.json(2 hunks)packages/request/package.json(2 hunks)packages/signers/bitcoin/package.json(2 hunks)packages/signers/ethereum/package.json(2 hunks)packages/signers/kadena/package.json(2 hunks)packages/signers/massa/package.json(2 hunks)packages/signers/polkadot/package.json(3 hunks)packages/storage/package.json(2 hunks)packages/swap/package.json(2 hunks)packages/types/package.json(2 hunks)packages/utils/package.json(2 hunks)
👮 Files not reviewed due to content moderation or server errors (6)
- packages/signers/ethereum/package.json
- packages/keyring/package.json
- packages/types/package.json
- packages/storage/package.json
- packages/signers/massa/package.json
- packages/signers/polkadot/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (14)
packages/swap/package.json (2)
42-57: Tooling bumps LGTMVersions align with workspace; nothing risky here.
36-36: uuid imports in swap package are compatible with v13 Destructured named imports (import { v4 as uuidv4 } from 'uuid') are used; no default or CommonJS imports detected.packages/utils/package.json (1)
33-36: Tooling version bumps look consistentNo functional impact; aligns with the rest of the repo.
Also applies to: 48-48
packages/extension/package.json (4)
39-53: Smoke test Kadena & Polkadot flows
After these minor/patch bumps, manually verify connect, account fetch, and a dry-run transaction for both Kadena and Polkadot integrations.
81-83: All uuid imports use named imports No default, require, or deep imports detected; upgrading to v13 is safe.
26-26: Verify Amplitude SDK config compatibility
Ensure all init options (instanceName, optOut, serverUrl, appVersion, trackingOptions, identityStorage, defaultTracking, sessionTimeout, logLevel, useBatch) remain supported in @amplitude/analytics-browser v2.25.0 by checking the official changelog or docs.
122-124: CI workflows already pin Node ≥18 — test-all.yml & test-swap.yml use Node v22.18.0.packages/name-resolution/package.json (1)
25-41: Approve dev tooling bumps
No runtime imports of viem detected—keeping it as a devDependency is correct.packages/request/package.json (1)
30-30: uuid import usage is compatible with v13
Verified no default or deep‐subpath imports remain—only named imports ({ v4 as uuidv4 }) are used.packages/extension/src/ui/action/components/app-menu/index.vue (1)
168-174: Commented-out survey popup UI is fine, but ensure related runtime hooks are removedYou’ve disabled the component in the template. Double-check no code still tries to control it at runtime.
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts (1)
4-6: Etherscan v2 chainIDs verified
All listed networks (BSC 56, Optimism 10, Arbitrum 42161/42170, Polygon zkEVM 1101, Base 8453, Blast 81457, Fraxtal 252, Sonic 146, Gnosis 100) are supported with the specified chainid values. No changes required.packages/hw-wallets/package.json (1)
55-67: Ledger/Trezor bumps: verify breaking changes and tree-shaking impact
Manually confirm that transport initialization (e.g. WebUSB permissions) and app bindings for BTC, ETH, Solana and Trezor Connect still work across supported browsers.packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/index.ts (1)
24-24: Double-check query separator in endpoint strings.
By dropping the hard-coded/api?, we now rely on every entry inNetworkEndpointsto already end with?. If even one endpoint still ends with/api(no question mark), this will render URLs like.../apimodule=account...and every fetch for that network will fail. Please audit the config and add the trailing?(or keep the explicit/api?here) wherever it’s missing.package.json (1)
35-37: Confirm commitlint v20 compatibilityThis major bump may carry updated Node.js requirements or config defaults. Please double-check the release notes and make sure our Husky hooks and CI Node version still satisfy the new baseline.
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts
Show resolved
Hide resolved
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts
Show resolved
Hide resolved
packages/extension/src/providers/ethereum/libs/activity-handlers/providers/etherscan/configs.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 13
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
packages/swap/package.json (2)
44-59: Fix ESLint 9 peerDependency conflict
eslint-config-airbnb-base@^15.0.0 only supports ESLint ^7.32.0 || ^8.2.0, but you’ve upgraded to ESLint 9.x. Downgrade ESLint to ^8.x or upgrade to an Airbnb config release that adds ESLint 9 support.
24-33: Fix @1inch/fusion-sdk version in package.json
@1inch/fusion-sdk@^2.3.8 isn’t published on npm (latest is 2.1.12-rc.0); update to a valid existing version or publish 2.3.8.packages/swap/src/providers/jupiter/index.ts (5)
443-451: Fix precision loss when adjusting outAmount for feesConverting large lamport amounts to Number and using Math.floor loses precision and can under/overpay. Use BigInt for exact integer math.
- toTokenAmount: toBN( - Math.floor((1 - feePercentage / 100) * Number(jupiterQuote.outAmount)) - .toFixed(10) - .replace(/\.?0+$/, ""), - ), + toTokenAmount: toBN( + ( + (BigInt(jupiterQuote.outAmount) * + BigInt(10000 - Math.round(feePercentage * 100))) / + BigInt(10000) + ).toString(), + ),- toTokenAmount: toBN( - Math.floor((1 - feePercentage / 100) * Number(jupiterQuote.outAmount)) - .toFixed(10) - .replace(/\.?0+$/, ""), - ), + toTokenAmount: toBN( + ( + (BigInt(jupiterQuote.outAmount) * + BigInt(10000 - Math.round(feePercentage * 100))) / + BigInt(10000) + ).toString(), + ),Also applies to: 501-509
468-473: Guard optionalcontextin error pathAccessing
context.signalwhencontextis undefined will throw in catch.- if (!context.signal.aborted) { + if (!context?.signal?.aborted) { console.error( `[Jupiter.getQuote] Error calling getQuote: ${String(err)}`, ); - } + }
524-529: Same optional chaining bug in getSwap catchMirror the same fix here.
- if (!context.signal.aborted) { + if (!context?.signal?.aborted) { console.error( `[Jupiter.getSwap] Error calling getSwap: ${String(err)}`, ); - } + }
1005-1011: Fix incorrect null-check variable
quoteis out of scope here; the check should validateswap.- if (!quote) { + if (!swap) { throw new Error( `Failed to get Jupiter swap at url ${url}, something went wrong and result is falsy`, ); }
1054-1075: Makesleepabortable param truly optionalDirectly accessing
abortable.signalcan throw whenabortableis undefined.function sleep( duration: number, abortable?: { signal?: AbortSignal }, ): Promise<void> { - if (abortable.signal.aborted) return Promise.reject(abortable.signal.reason); + if (abortable?.signal?.aborted) + return Promise.reject(abortable.signal.reason); if (duration <= 0) return Promise.resolve(); return new Promise<void>((res, rej) => { function onTimeout() { cleanupSleep(); res(); } function onAbortDuringSleep() { cleanupSleep(); - rej(abortable.signal!.reason); + rej(abortable?.signal?.reason ?? new Error("Aborted")); } function cleanupSleep() { abortable?.signal?.removeEventListener("abort", onAbortDuringSleep); clearTimeout(timeout); } abortable?.signal?.addEventListener("abort", onAbortDuringSleep); const timeout = setTimeout(onTimeout, duration); }); }packages/swap/src/utils/approvals.ts (1)
108-116: Align naming with EvmOptions: infiniteApproval (not infinityApproval)Inconsistent naming invites misuse. Also prefer explicit base in BN.toString.
- infinityApproval: boolean; + infiniteApproval: boolean;- value: options.infinityApproval + value: options.infiniteApproval ? TOKEN_AMOUNT_INFINITY_AND_BEYOND - : options.amount.toString(), + : options.amount.toString(10),- value: options.infinityApproval + value: options.infiniteApproval ? TOKEN_AMOUNT_INFINITY_AND_BEYOND - : options.amount.toString(), + : options.amount.toString(10),If external call sites already use infinityApproval, consider accepting both and deprecating the misspelled one.
Also applies to: 127-166
packages/swap/src/types/index.ts (1)
263-276: Expose getRFQObject for RFQ provider responses
The oneInchFusion provider returnstype: SwapType.rfqbut doesn’t includegetRFQObjectin its response—addgetRFQObjectin packages/swap/src/providers/oneInchFusion/index.ts to avoid null assertions downstream.
🧹 Nitpick comments (19)
packages/extension/src/ui/action/views/swap/libs/evm-gasvals.ts (2)
57-62: Avoid shared object references across tiersAll tiers reference the same zeroFees object. If any consumer mutates one tier, all change. Use object spreads to keep them independent.
Apply this diff:
- return { - [GasPriceTypes.ECONOMY]: zeroFees, - [GasPriceTypes.REGULAR]: zeroFees, - [GasPriceTypes.FAST]: zeroFees, - [GasPriceTypes.FASTEST]: zeroFees, - }; + return { + [GasPriceTypes.ECONOMY]: { ...zeroFees }, + [GasPriceTypes.REGULAR]: { ...zeroFees }, + [GasPriceTypes.FAST]: { ...zeroFees }, + [GasPriceTypes.FASTEST]: { ...zeroFees }, + };
64-101: Type-safety: initialize reduce to drop the prev undefined checkProviding an explicit initial accumulator removes the need for the runtime guard and tightens types.
Example (not behavior-changing):
const zeroBN = new BigNumber(0); const init = { [GasPriceTypes.ECONOMY]: { nativeValue: '0', fiatValue: zeroBN }, [GasPriceTypes.REGULAR]: { nativeValue: '0', fiatValue: zeroBN }, [GasPriceTypes.FAST]: { nativeValue: '0', fiatValue: zeroBN }, [GasPriceTypes.FASTEST]: { nativeValue: '0', fiatValue: zeroBN }, }; const finalVal = gasVals.reduce((prev, curr) => ({ [GasPriceTypes.ECONOMY]: { nativeValue: new BigNumber(prev[GasPriceTypes.ECONOMY].nativeValue).plus(curr[GasPriceTypes.ECONOMY].nativeValue).toString(), fiatValue: prev[GasPriceTypes.ECONOMY].fiatValue.plus(curr[GasPriceTypes.ECONOMY].fiatValue), }, // ...same for other tiers }), init);packages/swap/src/configs.ts (1)
134-135: Normalize GAS_LIMITS key casing.Current keys are lowerCamelCase (approval, transferToken, swap). Consider renaming Wrap → wrap for consistency.
- Wrap: numberToHex(70000), + wrap: numberToHex(70000),Note: update all call sites accordingly.
packages/swap/src/providers/zerox/index.ts (1)
177-179: Tighten error check and return style.Using response.name as an error flag is brittle; 0x errors often include code/reason/validationErrors. Also, returning null directly is cleaner inside the promise chain.
- if (response.name || !response.transaction) { - console.error(response); - return Promise.resolve(null); - } + if (!response.transaction || (response as any).code || (response as any).validationErrors) { + console.error(response); + return null; + }packages/swap/src/utils/abi/wrapper.ts (1)
1-154: LGTM; consider freezing ABI for better TS inference.Marking as const preserves literal types and prevents accidental mutation.
-export default [ +export default [ // … unchanged … -]; +] as const;packages/swap/package.json (1)
21-23: Engines: raise Node baseline.Toolchain (ESLint 9, TS 5.9, Vitest 3.x) and many deps assume Node 18+. Recommend engines.node ">=18.18.0".
"engines": { - "node": ">=14.15.0" + "node": ">=18.18.0" },Based on learnings
packages/swap/src/types/index.ts (2)
239-243: Tighten RFQOptions type to avoid anyUse unknown instead of any to improve type safety and nudge providers to shape data explicitly.
-export interface RFQOptions { - [key: string]: any; - signatures?: string[]; -} +export interface RFQOptions { + [key: string]: unknown; + signatures?: string[]; +}
321-323: Consider passing quote context to submitRFQOrderWithout tying the order to a previous quote, providers may need to re-derive state. Consider
submitRFQOrder(options: RFQOptions, quote: SwapQuote): Promise<string>(or include a quoteId).packages/extension/src/ui/action/views/swap/index.vue (1)
841-847: Guard optional getRFQObject to avoid runtime crashesProviders marked rfq but missing getRFQObject will throw due to non-null assertion.
- const rfqTrades = trades.filter(t => t!.type === SwapType.rfq); - const tradesRfqOptions = rfqTrades.map(t => t!.getRFQObject!()); + const rfqTrades = trades.filter(t => t!.type === SwapType.rfq); + const tradesRfqOptions = rfqTrades.map(t => + t?.getRFQObject ? t.getRFQObject() : Promise.resolve(null), + ); const statusObjects = await Promise.all(tradeStatusOptions); - const rfqOptionObjects = await Promise.all(tradesRfqOptions); + const rfqOptionObjects = await Promise.all(tradesRfqOptions); trades.forEach((t, idx) => (t!.status = statusObjects[idx])); - rfqTrades.forEach((t, idx) => (t!.rfqOptions = rfqOptionObjects[idx])); + rfqTrades.forEach((t, idx) => { + const opt = rfqOptionObjects[idx]; + if (opt) (t as any).rfqOptions = opt; + });packages/extension/src/ui/action/views/swap/libs/evm-waitreceipt.ts (3)
4-8: Add explicit return type for clarityDeclare the function return type to make intent clear (void after waiting).
-const waitForReceipt = async ( +const waitForReceipt = async ( hashes: string[], network: BaseNetwork, timeOutSecs: number, -) => { +): Promise<void> => {
10-10: Use bare return instead of Promise.resolve in async fnIn async functions, returning a promise is redundant here.
- if (!hashes.length) return Promise.resolve(); + if (!hashes.length) return;
14-19: Simplify pending check and throw a real Error on timeout
- Use Array.some for readability.
- Prefer throwing an Error instead of Promise.reject, and fix message grammar.
- while ((await Promise.all(promises)).find(i => i === null) === null) { + while ((await Promise.all(promises)).some(r => r === null)) { await new Promise(resolve => setTimeout(resolve, 2000)); - if (new Date().getTime() - timeNow > timeOutSecs * 1000) - return Promise.reject('Transactions taking too long, timedout'); + if (new Date().getTime() - timeNow > timeOutSecs * 1000) { + throw new Error('Transactions are taking too long (timed out)'); + } promises = hashes.map(hash => web3.getTransactionReceipt(hash)); }packages/extension/src/ui/action/views/swap-initiated/index.vue (1)
27-33: Improve message grammar and announce status to screen readers
- Fix “upto” → “up to”, sentence casing and punctuation.
- Optionally add aria-live for accessibility.
- <p v-if="waitingToBeMined"> - Waiting for Transactions to be mined, this can take upto 30 - seconds - </p> + <p v-if="waitingToBeMined" aria-live="polite"> + Waiting for transactions to be mined. This can take up to 30 seconds. + </p>packages/swap/tests/oneInchFusion.test.ts (2)
1-1: Import beforeAll to move setup out of describeMove initialization to beforeAll and keep describe synchronous. Based on learnings.
-import { describe, it, expect } from "vitest"; +import { describe, it, expect, beforeAll } from "vitest";
22-27: Avoid async describe; run init in beforeAllKeep describe synchronous; perform setup in beforeAll.
-describe("OneInchFusion Provider", async () => { +describe("OneInchFusion Provider", () => { // @ts-ignore const web3eth = new Web3Eth(nodeURL); const oneInch = new OneInchFusion(web3eth, SupportedNetworkName.Ethereum); - oneInch.init([]); + beforeAll(() => { + oneInch.init([]); + });packages/swap/src/providers/oneInch/index.ts (1)
125-129: Prefer hasOwnProperty over Object.keys(...).includes for map lookupsSlightly clearer and avoids creating an intermediate array.
- static isSupported(network: SupportedNetworkName) { - return Object.keys(supportedNetworks).includes( - network as unknown as string, - ); - } + static isSupported(network: SupportedNetworkName) { + return Object.prototype.hasOwnProperty.call(supportedNetworks, network as unknown as string); + }packages/swap/src/providers/paraswap/index.ts (1)
291-299: Graceful handling when priceRoute is absent.Returning null instead of throwing improves resilience. Consider trimming noisy logs (avoid JSON.stringify of full response) to keep logs clean.
packages/swap/src/providers/oneInchFusion/index.ts (2)
228-231: Tidy up logging.Remove the “herere” suffix; prefer a clear, consistent message.
Apply this diff:
- .catch((e) => { - console.error(e, "herere"); - return null; - }); + .catch((e) => { + console.error("Error generating swap via 1inch Fusion", e); + return null; + });
306-314: Status mapping: include Created as pending.Orders often start as Created; treating only Pending as pending may prematurely mark as failed.
Apply this diff:
- return this.fusionSdk.getOrderStatus(options.orderHash).then((status) => { - if (status.status === OrderStatus.Filled) - return TransactionStatus.success; - if (status.status === OrderStatus.Pending) - return TransactionStatus.pending; - else { - return TransactionStatus.failed; - } - }); + return this.fusionSdk.getOrderStatus(options.orderHash).then((status) => { + if (status.status === OrderStatus.Filled) return TransactionStatus.success; + if ( + status.status === OrderStatus.Pending || + status.status === OrderStatus.Created + ) + return TransactionStatus.pending; + return TransactionStatus.failed; + });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (26)
packages/extension/package.json(6 hunks)packages/extension/src/providers/common/libs/new-features.ts(1 hunks)packages/extension/src/ui/action/components/app-menu/index.vue(1 hunks)packages/extension/src/ui/action/views/swap-initiated/index.vue(2 hunks)packages/extension/src/ui/action/views/swap/index.vue(2 hunks)packages/extension/src/ui/action/views/swap/libs/evm-gasvals.ts(1 hunks)packages/extension/src/ui/action/views/swap/libs/evm-waitreceipt.ts(1 hunks)packages/extension/src/ui/action/views/swap/types.ts(2 hunks)packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue(8 hunks)packages/swap/package.json(3 hunks)packages/swap/src/configs.ts(2 hunks)packages/swap/src/index.ts(4 hunks)packages/swap/src/providers/changelly/index.ts(2 hunks)packages/swap/src/providers/jupiter/index.ts(2 hunks)packages/swap/src/providers/okx/index.ts(2 hunks)packages/swap/src/providers/oneInch/index.ts(3 hunks)packages/swap/src/providers/oneInchFusion/index.ts(1 hunks)packages/swap/src/providers/oneInchFusion/types.ts(1 hunks)packages/swap/src/providers/paraswap/index.ts(3 hunks)packages/swap/src/providers/rango/index.ts(2 hunks)packages/swap/src/providers/zerox/index.ts(3 hunks)packages/swap/src/types/index.ts(6 hunks)packages/swap/src/utils/abi/wrapper.ts(1 hunks)packages/swap/src/utils/approvals.ts(3 hunks)packages/swap/tests/oneInchFusion.test.ts(1 hunks)packages/swap/tests/swap.test.ts(3 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/swap/src/providers/rango/index.ts
🧰 Additional context used
🧬 Code graph analysis (7)
packages/swap/src/providers/oneInchFusion/types.ts (2)
packages/swap/src/types/index.ts (2)
EVMTransaction(163-170)BN(47-47)packages/swap/src/providers/oneInch/types.ts (1)
OneInchSwapResponse(15-19)
packages/swap/src/index.ts (1)
packages/swap/src/types/index.ts (1)
RFQOptionsResponse(254-257)
packages/swap/src/utils/approvals.ts (3)
packages/swap/src/types/index.ts (2)
BN(47-47)EVMTransaction(163-170)packages/swap/src/configs.ts (1)
GAS_LIMITS(143-143)packages/utils/src/index.ts (1)
numberToHex(46-46)
packages/swap/src/configs.ts (2)
packages/swap/src/index.ts (1)
WalletIdentifier(263-263)packages/utils/src/index.ts (1)
numberToHex(46-46)
packages/swap/tests/oneInchFusion.test.ts (5)
packages/swap/src/types/index.ts (1)
EVMTransaction(163-170)packages/swap/src/providers/oneInch/index.ts (1)
ONEINCH_APPROVAL_ADDRESS(37-38)packages/swap/src/utils/approvals.ts (1)
TOKEN_AMOUNT_INFINITY_AND_BEYOND(8-9)packages/utils/src/index.ts (1)
numberToHex(46-46)packages/swap/tests/oneInch.test.ts (1)
web3eth(21-80)
packages/extension/src/ui/action/views/swap/types.ts (1)
packages/swap/src/types/index.ts (1)
RFQOptionsResponse(254-257)
packages/swap/src/providers/oneInchFusion/index.ts (6)
packages/swap/src/index.ts (9)
TokenType(261-261)SupportedNetworkName(264-264)EVMTransaction(274-274)ProviderQuoteResponse(269-269)SwapToken(258-258)ProviderSwapResponse(270-270)StatusOptions(278-278)StatusOptionsResponse(277-277)TransactionStatus(276-276)packages/swap/src/types/index.ts (14)
TokenType(49-60)ProviderFromTokenResponse(278-278)ProviderToTokenResponse(280-282)MinMaxResponse(205-210)getQuoteOptions(143-149)QuoteMetaOptions(107-114)EVMTransaction(163-170)ProviderQuoteResponse(218-230)SwapQuote(212-216)ProviderSwapResponse(259-276)RFQOptionsResponse(254-257)StatusOptions(244-247)StatusOptionsResponse(249-252)RFQOptions(239-242)packages/swap/src/utils/common.ts (1)
isEVMAddress(13-19)packages/swap/src/utils/approvals.ts (4)
TOKEN_AMOUNT_INFINITY_AND_BEYOND(8-9)getAllowanceTransactions(171-171)isSufficientWrappedAvailable(174-174)getNativeWrapTx(173-173)packages/swap/src/providers/oneInchFusion/types.ts (1)
OneInchSwapResponse(3-13)packages/swap/src/configs.ts (3)
NATIVE_TOKEN_ADDRESS(144-144)FEE_CONFIGS(142-142)DEFAULT_SLIPPAGE(148-148)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (21)
packages/swap/src/providers/okx/index.ts (2)
37-38: ImportingSwapTypekeeps OKX aligned with the shared swap contract.Good call pulling the enum from
../../types; it keeps the provider in sync with the standardized swap response shape.
415-426: Includingtype: SwapType.regularbrings OKX responses in line with the other providers.This addition makes the downstream swap handling consistent across providers and leverages the shared enum, so no concerns here.
packages/swap/src/providers/changelly/index.ts (1)
990-1000: Swap response tagged as regular typeTagging Changelly responses as
SwapType.regularaligns this provider with the newProviderSwapResponsecontract and matches the provider’s existing flow. Looks good.packages/extension/package.json (1)
81-114: uuid v13 compatibility confirmed
Alluuidimports use the namedv4export (import { v4… } from 'uuid'), matching v13’s interface—no changes needed.packages/swap/src/providers/oneInchFusion/types.ts (1)
3-13: Interface shape looks solidThe new
OneInchSwapResponsesurface lines up with the Fusion response payload we consume elsewhere—good to seetypedMessages, RFQ metadata, and the USD value baked in here.packages/extension/src/ui/action/views/swap/libs/evm-gasvals.ts (1)
50-63: LGTM: early return prevents reduce on empty arrayGood defensive fix to handle empty tx lists and avoid a reduce crash.
Please confirm unit tests exist for txs.length === 0 and typical non-empty cases to ensure consistent formatting/typing across both paths.
packages/extension/src/ui/action/views/swap/types.ts (1)
32-35: LGTM: rfqOptions plumbed into ProviderResponseWithStatus.The optional RFQ options field fits the new RFQ flow.
packages/extension/src/providers/common/libs/new-features.ts (1)
3-3: Confirm: Clearing newNetworks is intended.This will make the “New” tab empty and show the “There are no new networks.” message. If that’s the release intent, all good.
packages/swap/src/providers/zerox/index.ts (1)
262-263: LGTM: Public response declares type=regular.Matches the new SwapType API and aligns with non‑RFQ providers.
packages/extension/src/ui/action/components/app-menu/index.vue (1)
168-174: Survey popup disabled cleanly.Template is commented out; no dangling imports/refs remain. Safe change.
packages/swap/src/types/index.ts (2)
126-133: New provider enum entry looks goodAddition of oneInchFusion is clear and consistent with existing naming.
158-162: SwapType addition is appropriateExplicitly classifying swaps as regular vs rfq will simplify UI logic.
packages/swap/src/providers/jupiter/index.ts (1)
511-512: Settingtype: SwapType.regularis correctMatches new typing contract.
packages/swap/src/utils/approvals.ts (2)
70-86: LGTM: Wrapped balance checkUsing balanceOf and BN compare is correct.
168-175: Exports look completeNew helpers are exported alongside existing ones.
packages/swap/tests/swap.test.ts (1)
80-83: Tests: new oneInchFusion expectations look goodValidates presence of OneInchFusion among quotes.
Also applies to: 94-95, 127-129, 136-137
packages/swap/src/providers/oneInch/index.ts (1)
266-276: LGTM: explicit SwapType on responseAdding type: SwapType.regular to the swap response improves downstream handling.
Confirm other providers now also set the type field consistently to avoid narrowing issues in consumers.
packages/swap/src/providers/paraswap/index.ts (2)
18-18: Good: adopting SwapType in provider response.This aligns ParaSwap with the new typed swap responses.
351-351: Good: explicit type on swap response.Setting type: SwapType.regular keeps the cross‑provider contract consistent.
packages/swap/src/providers/oneInchFusion/index.ts (2)
76-82: Provider initialization looks correct.SDK instantiated only on supported networks; token maps wired with isEVMAddress.
140-148: Ensure CHAIN_TO_WRAPPER covers all supportedNetworks chainIds
Missing wrapper mappings will break native‐token flows; cross-verify eachsupportedNetworks[<network>].chainIdagainst keys inCHAIN_TO_WRAPPER.
packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue
Show resolved
Hide resolved
packages/extension/src/ui/action/views/swap/views/swap-best-offer/index.vue
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/signers/massa/src/crypto/blake3.ts(1 hunks)packages/signers/massa/src/crypto/ed25519.ts(2 hunks)packages/signers/massa/tests/sign.test.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/signers/massa/tests/sign.test.ts (1)
packages/signers/massa/src/index.ts (1)
MassaSigner(11-59)
packages/signers/massa/src/crypto/blake3.ts (1)
packages/signers/massa/src/crypto/interfaces/hasher.ts (1)
Hasher(2-4)
packages/signers/massa/src/crypto/ed25519.ts (1)
packages/signers/massa/src/crypto/interfaces/signer.ts (1)
Signer(2-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
🔇 Additional comments (5)
packages/signers/massa/src/crypto/blake3.ts (1)
1-10: LGTM! Stylistic consistency improvements.The changes update quote style and add a trailing semicolon, with no behavioral impact.
packages/signers/massa/src/crypto/ed25519.ts (3)
1-4: LGTM! Required migration for @noble/ed25519 v2.x.The namespace import and explicit sha512 configuration are necessary for compatibility with @noble/ed25519 v2.x, which removed the default SHA-512 implementation.
10-12: LGTM!Correctly updated to use the namespace import pattern.
15-31: LGTM!All method calls correctly updated to use the namespace import with proper parameter ordering.
packages/signers/massa/tests/sign.test.ts (1)
53-60: LGTM! Good addition for regression testing.The hardcoded valid signature provides a deterministic test case that will catch any breaking changes in the signing implementation.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (4)
packages/swap/src/providers/oneInchFusion/index.ts (4)
138-156: Integrator fee: convert decimal → integer BPS; also guard FEE_CONFIGS access.Direct BigInt(fee) throws for fractional fees and mis‑scales the value. Convert to basis points first using BigNumber and add optional chaining on config access. Follow‑up on prior comment.
- const feeConfig = FEE_CONFIGS[this.name][meta.walletIdentifier]; + const feeConfig = FEE_CONFIGS[this.name]?.[meta.walletIdentifier]; … - if (feeConfig) { + if (feeConfig) { quoteParams.source = meta.walletIdentifier; - quoteParams.integratorFee = { - receiver: new Address(feeConfig.referrer), - value: new Bps(BigInt(feeConfig.fee)), - share: Bps.fromPercent(100), - }; + // Convert decimal fee (e.g., 0.005) → integer BPS (e.g., 50) + const feeBps = BigInt( + new BigNumber(feeConfig.fee) + .times(10_000) + .integerValue(BigNumber.ROUND_HALF_UP) + .toString(), + ); + quoteParams.integratorFee = { + receiver: new Address(feeConfig.referrer), + value: new Bps(feeBps), + share: Bps.fromPercent(100), + }; }
170-179: Preserve token shape when substituting wrapper for approvals.Passing
{ address }alone may break helpers expecting full TokenType fields. Spread the original and override the address. Follow‑up on prior comment.- fromToken: isFromNative - ? { address: CHAIN_TO_WRAPPER[chainId].toString() } - : options.fromToken, + fromToken: isFromNative + ? { ...options.fromToken, address: CHAIN_TO_WRAPPER[chainId].toString() } + : options.fromToken,
240-248: Guard against zero/invalid USD price; fix $10 min calc.Number(fromUSDValue) can be 0/NaN; BigNumber.div(0) throws. Compute 10 / price when finite and > 0. Follow‑up on prior comment.
- const fromUSDValue = res.fromUSDValue; - const fromToken = new SwapToken(options.fromToken); - const minFrom = fromToken.toRaw( - new BigNumber(1) - .div(Number(fromUSDValue) / 10) - .toFixed(fromToken.token.decimals), - ); // minimum $10 worth of tokens - minMax.minimumFrom = minFrom; + const priceUsd = Number(res.fromUSDValue); + if (Number.isFinite(priceUsd) && priceUsd > 0) { + const fromToken = new SwapToken(options.fromToken); + // Minimum $10 worth of tokens = 10 / price + const minFrom = fromToken.toRaw( + new BigNumber(10).div(priceUsd).toFixed(fromToken.token.decimals), + ); + minMax.minimumFrom = minFrom; + }
272-274: Unify fee units and harden config access.Other providers use percent = decimalFee * 100 (e.g., 0.005 → 0.5). Align here and guard config lookup. Follow‑up on prior comments.
- const feeConfig = - FEE_CONFIGS[this.name][quote.meta.walletIdentifier].fee || 0; + const feePercent = Number( + FEE_CONFIGS[this.name]?.[quote.meta.walletIdentifier]?.fee ?? 0, + ); … - fee: feeConfig / 100, + // fee as percentage (0..100), consistent with other providers + fee: feePercent * 100,Run to verify consistency across providers:
#!/bin/bash # Inspect fee assignments in getSwap across providers for consistency echo "Provider getSwap fee assignments:" for f in $(rg -lP --type=ts '\bgetSwap\s*\(' packages/swap/src/providers); do echo "---- $f ----" rg -nC2 '\bfee\s*:' "$f" doneAlso applies to: 283-283
🧹 Nitpick comments (4)
packages/swap/src/providers/oneInchFusion/index.ts (4)
200-211: Harden gas estimate application.Guard against length mismatch and only apply results when valid to avoid out‑of‑bounds and partial updates.
- if (accurateEstimate) { - const accurateGasEstimate = await estimateEVMGasList( + if (accurateEstimate) { + const accurateGasEstimate = await estimateEVMGasList( transactions, this.network, ); - if (accurateGasEstimate) { - if (accurateGasEstimate.isError) return null; - transactions.forEach((tx, idx) => { - tx.gasLimit = accurateGasEstimate.result[idx]; - }); - } + if (accurateGasEstimate) { + if (accurateGasEstimate.isError) return null; + if (accurateGasEstimate.result?.length === transactions.length) { + transactions.forEach((tx, idx) => { + tx.gasLimit = accurateGasEstimate.result[idx]; + }); + } + } }
78-81: Avoid hardcoded Fusion API URL.Make the URL configurable via env/config with a sane default to ease testing and future changes.
- url: "https://fusion.1inch.io", + url: process.env.ONEINCH_FUSION_URL || "https://fusion.1inch.io",
227-230: Silent catch obscures failures.Surface minimal diagnostics (telemetry/log) and include the reason; still return null to keep behavior.
- .catch(() => { - return null; - }); + .catch((err) => { + // TODO: replace with project logger/telemetry + // logger.error?.('OneInchFusion.getOneInchSwap failed', { err }); + return null; + });
304-314: Map remaining Fusion statuses explicitly.Consider handling Expired/Cancelled/PartiallyFilled (if any) for clearer UX; default to failed otherwise.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/swap/src/providers/oneInchFusion/index.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/swap/src/providers/oneInchFusion/index.ts (6)
packages/swap/src/types/index.ts (14)
TokenType(49-60)ProviderFromTokenResponse(278-278)ProviderToTokenResponse(280-282)MinMaxResponse(205-210)getQuoteOptions(143-149)QuoteMetaOptions(107-114)EVMTransaction(163-170)ProviderQuoteResponse(218-230)SwapQuote(212-216)ProviderSwapResponse(259-276)RFQOptionsResponse(254-257)StatusOptions(244-247)StatusOptionsResponse(249-252)RFQOptions(239-242)packages/swap/src/providers/oneInch/index.ts (1)
supportedNetworks(39-82)packages/swap/src/utils/common.ts (1)
isEVMAddress(13-19)packages/swap/src/utils/approvals.ts (4)
TOKEN_AMOUNT_INFINITY_AND_BEYOND(8-9)getAllowanceTransactions(171-171)isSufficientWrappedAvailable(174-174)getNativeWrapTx(173-173)packages/swap/src/providers/oneInchFusion/types.ts (1)
OneInchSwapResponse(3-13)packages/swap/src/configs.ts (3)
NATIVE_TOKEN_ADDRESS(144-144)FEE_CONFIGS(142-142)DEFAULT_SLIPPAGE(148-148)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/swap/src/providers/jupiter/index.ts (1)
106-199: Token list breaks with new v2 schema
https://lite-api.jup.ag/tokens/v2/tag?query=verifiedreturns entries keyed byid(see Jupiter’s Token API v2 docs), notaddress. We still indexthis.jupiterTokensusingt.address, so every map key becomesundefinedand none of the verified mints ever matchenkryptToken.address. The provider then exposes an empty token set, effectively disabling Jupiter swaps. Please map with the new mint identifier (e.g.t.id) or adjustJupiterTokenInfoaccordingly before shipping. (dev.jup.ag)
🧹 Nitpick comments (1)
packages/swap/src/providers/jupiter/index.ts (1)
1056-1079: Remove sleep() console spam
The unconditionalconsole.log(abortable)fires on every backoff sleep, flooding logs and polluting production output. Drop the debug statement (and rely on existing structured logging where needed).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/swap/src/providers/jupiter/index.ts(5 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: buildAll
- GitHub Check: test
- GitHub Check: test
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores
Tests