Skip to content

Comments

Feat: Massa Network#734

Closed
peterjah wants to merge 3 commits intoenkryptcom:devop/package-updates-2-10from
massalabs:extension
Closed

Feat: Massa Network#734
peterjah wants to merge 3 commits intoenkryptcom:devop/package-updates-2-10from
massalabs:extension

Conversation

@peterjah
Copy link
Contributor

@peterjah peterjah commented Jul 23, 2025

Summary by CodeRabbit

  • New Features

    • Added full support for the Massa blockchain network, including sending, verifying, and managing Massa transactions and tokens.
    • Introduced UI components for sending Massa tokens, verifying transactions, and adding custom Massa tokens by contract address.
    • Enabled Massa account creation, balance fetching, and activity tracking within the extension.
    • Integrated Massa token selection and custom token management in the asset view.
  • Enhancements

    • Massa provider and network are now selectable throughout the wallet, with buy links and network switching.
    • Massa-specific cryptographic signing and key derivation are supported via a new signer package.
  • Bug Fixes

    • None.
  • Documentation

    • None.
  • Tests

    • Added tests for Massa key generation, signing, and verification.
  • Chores

    • Updated dependencies and configurations to support Massa integration.

@coderabbitai
Copy link

coderabbitai bot commented Jul 23, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (3)
  • main
  • develop
  • devop/vite-migrate

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change introduces comprehensive support for the Massa blockchain across the extension, keyring, signers, and types packages. It adds Massa provider logic, network definitions, UI components for sending and verifying transactions, token management for custom Massa tokens, cryptographic signing, and activity handling. Extensive updates span backend logic, UI, and type definitions.

Changes

Cohort / File(s) Change Summary
Extension: Massa Provider Core Integration
packages/extension/src/providers/massa/index.ts, .../massa/libs/api.ts, .../massa/methods/index.ts, .../massa/methods/massa_getBalance.ts, .../massa/methods/massa_getNetwork.ts, .../massa/methods/massa_setNetwork.ts, .../massa/networks/buildnet.ts, .../massa/networks/index.ts, .../massa/networks/mainnet.ts, .../massa/networks/massa-base.ts, .../massa/types/index.ts, .../massa/libs/activity-handlers/index.ts, .../massa/libs/activity-handlers/massa.ts, .../massa/ui/index.ts, .../massa/ui/libs/signer.ts, .../massa/ui/routes/index.ts, .../massa/ui/routes/names.ts, .../massa/ui/send-transaction/components/send-address-input.vue, .../massa/ui/send-transaction/components/send-token-select.vue, .../massa/ui/send-transaction/index.vue, .../massa/ui/send-transaction/verify-transaction/index.vue
Implements the Massa provider, including API, middleware, network configs (mainnet, buildnet), activity handlers, UI routes, transaction signing, and Vue components for sending and verifying transactions.
Extension: Core Integration and Type Extensions
.../background/index.ts, .../background/types.ts, .../tokens-state/index.ts, .../tokens-state/types.ts, .../utils/initialize-wallet.ts, .../utils/networks.ts, .../providers/index.ts, .../scripts/inject.ts, .../types/activity.ts, .../types/base-network.ts, .../types/provider.ts
Adds Massa support to background logic, provider mapping, token state (including CustomMassaToken), network initialization, and extends type definitions for providers, networks, and activities.
Extension: UI Integration
.../ui/action/App.vue, .../ui/action/views/network-activity/index.vue, .../ui/action/views/send-transaction/index.vue, .../ui/action/views/verify-transaction/index.vue, .../ui/provider-pages/routes.ts, .../ui/action/views/network-assets/index.vue, .../ui/action/views/network-assets/components/custom-massa-token.vue
Integrates Massa support into the UI for buying, sending, verifying, and managing Massa tokens, including custom token addition and activity tracking.
Keyring: Massa Signer Integration
packages/keyring/package.json, packages/keyring/src/index.ts, packages/keyring/src/utils.ts
Adds dependency and logic for Massa signer, including derivation path handling for ed25519mas.
Signer: Massa Signer Implementation
packages/signers/massa/package.json, packages/signers/massa/src/index.ts, packages/signers/massa/src/libs/ed25519.ts, packages/signers/massa/tests/sign.test.ts, packages/signers/massa/tsconfig.json, packages/signers/massa/tsconfig.paths.json
Introduces the @enkryptcom/signer-massa package implementing key generation, signing, verification, Ed25519 derivation, and associated tests and configs.
Types: Massa Network and Signer Types
packages/types/package.json, packages/types/src/index.ts, packages/types/src/networks.ts
Adds Massa-related network and signer types, and updates enums for network names and platforms.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ExtensionUI
    participant MassaProvider
    participant MassaAPI
    participant KeyRing
    participant MassaSigner

    User->>ExtensionUI: Initiates Massa transaction (send)
    ExtensionUI->>MassaProvider: request({ method: "massa_getBalance", ... })
    MassaProvider->>MassaAPI: getBalance(address)
    MassaAPI-->>MassaProvider: balance
    MassaProvider-->>ExtensionUI: balance

    User->>ExtensionUI: Confirms transaction
    ExtensionUI->>MassaProvider: request({ method: "massa_setNetwork", ... })
    MassaProvider->>MassaAPI: set network
    MassaAPI-->>MassaProvider: ack
    MassaProvider-->>ExtensionUI: ack

    ExtensionUI->>KeyRing: sign transaction (via MassaSigner)
    KeyRing->>MassaSigner: sign(msgHash, keyPair)
    MassaSigner-->>KeyRing: signature
    KeyRing-->>ExtensionUI: signature

    ExtensionUI->>MassaProvider: request({ method: "sendTransaction", ... })
    MassaProvider->>MassaAPI: sendTransaction(signedTx)
    MassaAPI-->>MassaProvider: tx hash / status
    MassaProvider-->>ExtensionUI: tx hash / status
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~90+ minutes

  • Complexity: High — introduces a new blockchain provider, cryptographic logic, network configs, UI flows, token management, and extensive type changes.
  • Volume: High — many new files and modifications across multiple packages.
  • Scope: Touches backend, frontend, cryptography, and types.

Possibly related PRs

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@peterjah peterjah force-pushed the extension branch 2 times, most recently from addc7bf to 45a4fc2 Compare July 24, 2025 10:56
@peterjah
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 24, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 24

🔭 Outside diff range comments (3)
packages/extension/src/ui/action/utils/browser.ts (1)

50-62: Handle non-2xx responses before parsing JSON

fetch resolves even for 4xx/5xx responses, therefore res.json() will be invoked on an HTML error page and throw, leading to the generic null return. Guarding with an !res.ok check makes the error explicit and keeps stack-traces meaningful.

-  return fetch(
+  return fetch(
     'https://raw.githubusercontent.com/enkryptcom/dynamic-data/main/configs/versions.json',
     { cache: 'no-store' },
   )
-    .then(res => res.json())
+    .then(res => {
+      if (!res.ok) throw new Error(`HTTP ${res.status} while fetching version list`);
+      return res.json();
+    })
packages/extension/src/providers/ethereum/libs/transaction/index.ts (1)

160-166: Possible runtime crash if fee-history array is shorter than expected

feeHistory.baseFeePerGas[-2] assumes the array has ≥ 2 elements.
On clients that return only the pending block (or on error recovery paths) this will be undefined, leading to BigNumber operations on undefined further down the pipeline.

-const baseFeePerGas =
-  feeHistory.baseFeePerGas[feeHistory.baseFeePerGas.length - 2]; // -2 since -1 is the pending block
+const baseFeeArray = feeHistory.baseFeePerGas;
+if (!baseFeeArray || baseFeeArray.length < 2) {
+  throw new Error('Insufficient fee-history data: expected ≥2 entries');
+}
+const baseFeePerGas = baseFeeArray[baseFeeArray.length - 2]; // -2 since -1 is the pending block

Adds a defensive check to avoid silent undefined propagation.

packages/extension/src/ui/action/components/app-menu/store.ts (1)

5-8: Duplicate Pinia store id (restoreWallet) will clash

useOnboardStore is registered with the same id 'restoreWallet' that useRestoreStore uses (see onboard/restore-wallet/store.ts). Pinia warns and the later registration overwrites the first, causing state leakage.

- export const useOnboardStore = defineStore('restoreWallet', () => {
+ export const useOnboardStore = defineStore('appMenu', () => {

Rename the id (and update consumers) to keep stores isolated.

🧹 Nitpick comments (34)
packages/extension/src/ui/action/components/base-button/index.vue (1)

68-69: Remove duplicate CSS property.

There's a duplicate overflow: hidden; declaration that should be cleaned up.

   position: relative;
   overflow: hidden;
-  overflow: hidden;
packages/extension/src/libs/updates-state/index.ts (2)

18-25: Extract the default state into a shared constant

The literal default object is inlined here, while the same shape is replicated in multiple setters further below.
Moving it to a top-level DEFAULT_STATE constant improves readability, prevents accidental drift, and avoids per-call allocation.

-      const newState: IState = {
-        lastVersionViewed: '',
-        currentRelease: '',
-        currentReleaseTimestamp: 0,
-      };
-      return newState;
+      return DEFAULT_STATE;
// place near imports
const DEFAULT_STATE: IState = {
  lastVersionViewed: '',
  currentRelease: '',
  currentReleaseTimestamp: 0,
};

29-63: Reduce boilerplate with generic getters / setters

The three property-specific pairs (getLastVersionViewed/setLastVersionViewed, etc.) follow an identical pattern:

  1. getState()
  2. read/merge a single property
  3. setState()

A single helper eliminates duplication and guarantees consistent behaviour:

private async getField<K extends keyof IState>(key: K): Promise<IState[K]> {
  const state = await this.getState();
  return state?.[key] ?? DEFAULT_STATE[key];
}

private async setField<K extends keyof IState>(
  key: K,
  value: IState[K],
): Promise<void> {
  const state = await this.getState();
  await this.setState({ ...state, [key]: value });
}

All public methods collapse to one-liners:

getLastVersionViewed() {
  return this.getField('lastVersionViewed');
}
setLastVersionViewed(v: string) {
  return this.setField('lastVersionViewed', v);
}

Benefit: easier maintenance, smaller surface area, less chance of inconsistencies.
No behaviour change—only structural.

packages/extension/src/providers/bitcoin/methods/btc_switchNetwork.ts (1)

52-54: Fix typo in error message

The error message contains a misspelling (“porvided”). Correcting it avoids noise in logs and maintains professionalism.

-          `btc_switchNetwork: porvided network ${
+          `btc_switchNetwork: provided network ${
packages/extension/src/providers/ethereum/libs/transaction/index.ts (1)

108-111: Convert to lowercase only when strictly required (Rootstock)

Lower-casing all from addresses fixes RSK checksum incompatibility but silently discards the EIP-55 checksum for every other EVM network.
Consider restricting the transformation to Rootstock chain IDs so checksum integrity is preserved elsewhere.

-const nonce = await this.web3.getTransactionCount(
-  this.tx.from.toLowerCase(),
-  'pending',
-);
+const sender =
+  [rsk.chainID, rskTestnet.chainID].includes(this.tx.chainId)
+    ? this.tx.from.toLowerCase()
+    : this.tx.from;
+const nonce = await this.web3.getTransactionCount(sender, 'pending');
packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (1)

157-158: valuef should be a formatted representation, not a raw string

valuef is currently identical to value, so the formatted variant loses its purpose and may break UI expectations that rely on thousands separators or fixed precision.

-      valuef: nativeAssetMarketData[index]?.current_price?.toString() ?? '0',
+      valuef: formatFloatingPointValue(
+        nativeAssetMarketData[index]?.current_price ?? 0,
+      ).value,
packages/extension/src/types/window.d.ts (1)

11-11: Nit: comment typo
delaredeclare

-// Required to make the `delare global` exports work for some reason
+// Required to make the `declare global` exports work for some reason
packages/extension/src/libs/background/index.ts (1)

45-52: Consider deriving #tabProviders keys from ProviderName enum to avoid future omissions

Manually extending the literal each time a new provider is introduced (as done here for massa) is error-prone and easy to forget in future additions.
A small helper such as:

this.#tabProviders = Object.fromEntries(
  Object.values(ProviderName).map(p => [p, {} as Record<number, InstanceType<typeof Providers[typeof p]> >]),
) as TabProviderType;

would make the list self-maintaining and remove one hotspot for regressions.
No action required for this PR, but worth considering.

packages/extension/src/libs/recently-sent-addresses/index.ts (1)

31-35: Nit: micro-optimisation

You can early-return in one line and spare an allocation:

return (await this.#storage.get(key))?.addresses ?? [];
packages/extension/src/providers/massa/ui/settings/index.vue (2)

2-4: Use i18n rather than hard-coded UI strings

<h1>Massa Settings</h1> is hard-coded and will bypass the existing translation pipeline. Replace with $t(...) (or whichever helper is used in the rest of the extension) so the heading can be localized.


8-10: Remove empty <script setup> until logic is added

An empty block adds bytes to the bundle and may trigger linter warnings. Drop it for now or add a clear TODO comment so it’s not forgotten.

packages/extension/src/ui/action/utils/filters.ts (1)

24-40: Minor performance simplification in parseCurrency

BigNumber(finalValue) is created only to compare against a literal. Converting the JS number back into a BigNumber is unnecessary and allocates an extra object each call.

-  const notation = BigNumber(finalValue).gt(999999) ? 'compact' : 'standard';
+  const notation = finalValue > 999_999 ? 'compact' : 'standard';

Same result, less overhead, clearer intent.

packages/extension/src/libs/name-resolver/index.ts (1)

22-29: Consider parallelising the name-resolution loop

Resolution attempts are executed sequentially; a slow endpoint stalls all others. Issuing them in parallel and returning the first fulfilled promise would improve UX for multi-coin look-ups.

Pseudo-sketch:

const attempts = coins.map(c =>
  this.nameResolver.resolveAddress(name, c, providerChain).catch(() => null)
);
return (await Promise.any(attempts)) ?? null;

(not production-ready; guard for AggregateError as needed).

packages/extension/src/providers/massa/ui/index.ts (1)

4-7: Type safety enhancement

If getRoutes ever returns undefined, the current object would violate UIExportOptions. Add an explicit return type or non-null assertion to make this intent clear.

-const uiExport: UIExportOptions = {
+const uiExport: UIExportOptions = {
   providerName: ProviderName.massa,
   routes: getRoutes(ProviderName.massa)!,
 };

(suffix ! only if you’re certain routes exist at runtime).

packages/extension/src/providers/massa/ui/routes/names.ts (1)

4-13: Consider consolidating duplicate routes.

Both send and massaSendTransaction routes point to the same component (../send-transaction/index.vue). This creates redundancy and potential confusion.

Consider removing one of these routes or differentiating their purposes if they serve different use cases:

const routes: Record<string, RouteRecordRaw> = {
-  send: {
-    path: 'send',
-    name: 'massa-send',
-    component: () => import('../send-transaction/index.vue'),
-  },
  massaSendTransaction: {
    path: 'send-transaction',
    name: 'massa-send-transaction',
    component: () => import('../send-transaction/index.vue'),
  },
packages/extension/src/providers/massa/methods/massa_getNetwork.ts (1)

19-21: Consider logging the error for debugging purposes.

While the fallback behavior is appropriate, logging the error could help with debugging network-related issues.

    } catch (error) {
+     console.warn('Failed to get current network, falling back to default:', error);
      res(null, NetworkNames.Massa);
    }
packages/signers/massa/tests/sign.test.ts (2)

7-14: Consider extracting test constants for better maintainability.

The mnemonic and message could be extracted as module-level constants for better reusability and clarity.

+const TEST_MNEMONIC = {
+  mnemonic: "error fish boy absent drop next ice keep meadow little air include",
+};
+
+const TEST_MESSAGE = "Everything should be made as simple as possible, but not simpler.";
+const TEST_MSG_HASH = bufferToHex(blake2AsU8a(TEST_MESSAGE));

describe("Massa signing", () => {
-  const MNEMONIC = {
-    mnemonic:
-      "error fish boy absent drop next ice keep meadow little air include",
-  };
-
-  const msg =
-    "Everything should be made as simple as possible, but not simpler.";
-  const msgHash = bufferToHex(blake2AsU8a(msg));

43-43: Consider testing with multiple invalid signature formats.

The current test uses a specific invalid signature format. Consider testing additional invalid cases for more comprehensive coverage.

-    const invalidSignature = "0x" + "0".repeat(128); // Invalid signature
+    const invalidSignatures = [
+      "0x" + "0".repeat(128), // All zeros
+      "0x" + "f".repeat(127), // Wrong length
+      "invalid_signature",    // Invalid format
+    ];
+
+    for (const invalidSignature of invalidSignatures) {
+      const isValid = await signer.verify(
+        msgHash,
+        invalidSignature,
+        keypair.publicKey,
+      );
+      expect(isValid).toBe(false);
+    }
packages/extension/src/ui/action/views/settings/store.ts (1)

10-55: Good code quality improvements with a subtle bug fix.

The changes improve code consistency and readability with proper semicolon usage and formatting. Most importantly, moving currencyList.value = newList outside the loop (line 38) fixes a bug where the currency list was being reassigned on every iteration instead of once after processing all currencies.

packages/extension/src/providers/massa/methods/massa_setNetwork.ts (1)

15-55: Remove unnecessary else block after early return.

The else block is redundant since the function returns early when the method doesn't match. This improves readability and reduces nesting.

 if (payload.method !== 'massa_setNetwork') return next();
-  else {
-    try {
+  try {
       const networkName = payload.params?.[0];

       if (!networkName) {
         res(getCustomError('Network name is required'));
         return;
       }

       // Check if the network exists
       const availableNetworks = Object.keys(massaNetworks);

       if (!availableNetworks.includes(networkName)) {
         res(
           getCustomError(
             `Invalid network name. Available networks: ${availableNetworks.join(', ')}`,
           ),
         );
         return;
       }

       // Get the network object
       const network = massaNetworks[networkName as keyof typeof massaNetworks];

       // Set the network in the provider
       if (this.setRequestProvider) {
         this.setRequestProvider(network);
         res(null, { success: true, network: network.name });
       } else {
         res(getCustomError('Network switching not supported'));
       }
     } catch (error) {
       res(
         getCustomError(
           `Network switching failed: ${(error as Error).message || 'Unknown error'}`,
         ),
       );
     }
-  }
packages/extension/src/providers/massa/libs/api.ts (2)

11-14: Remove unnecessary type assertion.

The fromRPCUrl method already returns a JsonRpcPublicProvider, making the type assertion redundant.

     this.provider = JsonRpcPublicProvider.fromRPCUrl(
       node,
-    ) as JsonRpcPublicProvider;
+    );

20-20: Consider documenting the empty init method.

If the empty implementation is intentional (e.g., for interface compliance), consider adding a comment to clarify this.

-  async init(): Promise<void> {}
+  async init(): Promise<void> {
+    // No initialization required for Massa provider
+  }
packages/extension/src/providers/massa/libs/accounts-state/index.ts (1)

1-3: Remove unused imports.

These imports are not used anywhere in the file.

-import { EnkryptAccount } from '@enkryptcom/types';
-import { getAccountsByNetworkName } from '@/libs/utils/accounts';
-import { NetworkNames } from '@enkryptcom/types';
packages/signers/massa/src/libs/ed25519.ts (2)

56-61: Improve type safety for numeric validation.

The as any type assertion can be avoided with proper typing.

     .split("/")
     .slice(1)
     .map(replaceDerive)
-    .some(isNaN as any);
+    .some((val) => isNaN(Number(val)));

41-48: Document the purpose of withZeroByte parameter.

The withZeroByte parameter affects the public key format. Consider adding a comment explaining when to use each format for better maintainability.

 const getPublicKey = (privateKey: Buffer, withZeroByte = true): Buffer => {
+  // withZeroByte: true for standard format, false for compact format
   const keyPair = sign.keyPair.fromSeed(privateKey);
packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (1)

34-37: Use CSS classes instead of inline styles for error states

For better maintainability and consistency, consider using CSS classes for the error state styling rather than inline styles.

       placeholder="Enter Massa address"
-      :style="{
-        color: massaAddress && !isValidMassaAddress ? 'red' : 'black',
-      }"
+      :class="{ 'error': massaAddress && !isValidMassaAddress }"
       @focus="changeFocus"

Then add the error class to your styles:

    input {
      // ... existing styles ...
      
      &.error {
        color: @error;
      }
    }
packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (2)

117-131: Remove unused global declaration

The window.massa interface declaration appears to be unused in this component.

Remove the unused global declaration to reduce code clutter.


243-248: Inconsistent timeout values

The component uses different timeout values (4000ms vs 3000ms) for popup and window contexts without clear justification.

Consider using a consistent timeout value or document why they differ:

+      const COMPLETION_DELAY = 3500; // ms
       if (getCurrentContext() === 'popup') {
         setTimeout(() => {
           // ... existing code ...
-        }, 4000);
+        }, COMPLETION_DELAY);
       } else {
         setTimeout(() => {
           // ... existing code ...
-        }, 3000);
+        }, COMPLETION_DELAY);
       }

Also applies to: 250-255

packages/extension/src/providers/massa/networks/massa-base.ts (4)

1-16: Consider organizing imports for better readability.

Group imports by external packages first, then internal modules for consistency.

-import { NetworkNames } from '@enkryptcom/types';
-import { BaseNetwork } from '@/types/base-network';
-import MassaAPI from '../libs/api';
-import { SignerType } from '@enkryptcom/types';
-import { ProviderName } from '@/types/provider';
-import createIcon from '../libs/blockies';
-import { CHAIN_ID, PublicApiUrl } from '@massalabs/massa-web3';
-import { MassaNetworkOptions } from '../types';
-import ActivityState from '@/libs/activity-state';
-import { Activity } from '@/types/activity';
-import { AssetsType } from '@/types/provider';
-import { fromBase } from '@enkryptcom/utils';
-import { formatFloatingPointValue } from '@/libs/utils/number-formatter';
-import MarketData from '@/libs/market-data';
-import BigNumber from 'bignumber.js';
-import icon from './icons/Massa_logo.webp';
+// External packages
+import { NetworkNames, SignerType } from '@enkryptcom/types';
+import { CHAIN_ID, PublicApiUrl } from '@massalabs/massa-web3';
+import { fromBase } from '@enkryptcom/utils';
+import BigNumber from 'bignumber.js';
+
+// Internal types and modules
+import { BaseNetwork } from '@/types/base-network';
+import { ProviderName, AssetsType } from '@/types/provider';
+import { Activity } from '@/types/activity';
+import ActivityState from '@/libs/activity-state';
+import MarketData from '@/libs/market-data';
+import { formatFloatingPointValue } from '@/libs/utils/number-formatter';
+
+// Local modules
+import MassaAPI from '../libs/api';
+import createIcon from '../libs/blockies';
+import { MassaNetworkOptions } from '../types';
+import icon from './icons/Massa_logo.webp';

26-28: Add comment to clarify empty implementation.

This method returns an empty array. Consider adding a comment to clarify if this is intentional (e.g., Massa only has native token).

 async getAllTokens(): Promise<any[]> {
+  // Massa only supports native MAS token, no additional tokens
   return [];
 }

30-100: Consider refactoring this method for better maintainability.

The method is quite long and handles multiple responsibilities. Consider extracting helper methods for price fetching and asset formatting.

Additionally, the sparkline data slice value of -25 on line 63 appears arbitrary. Consider making it a named constant or adding a comment explaining the choice.

+          // Use last 25 data points for UI sparkline display
           sparklineData = JSON.stringify(
             marketInfo.sparkline_in_24h.price.slice(-25),
-          ); // Last 25 points
+          );

102-113: Consider logging errors for debugging purposes.

The catch block silently returns an empty array. Consider logging the error for debugging.

   } catch (error) {
+    console.error(`Failed to fetch activities for ${address}:`, error);
     return [];
   }
packages/extension/src/providers/massa/ui/send-transaction/index.vue (2)

121-128: Consider moving AccountInfo interface to a shared types file.

This interface might be useful in other components. Consider moving it to a shared types file for reusability.


228-269: Consider extracting repeated balance conversion logic.

The conversion from float balance to base units is repeated in both hasEnoughBalance and insufficientAmount. Consider extracting this to a helper method.

+const getBalanceInBaseUnits = (balance: string): string => {
+  return new BigNumber(balance).times(10 ** 9).toString();
+};
+
 const hasEnoughBalance = computed(() => {
   // ... existing validation ...
   const amountBase = toBase(sendAmount.value, 9);
-  const balanceBase = new BigNumber(account.value.balance)
-    .times(10 ** 9)
-    .toString();
+  const balanceBase = getBalanceInBaseUnits(account.value.balance);
   // ... rest of the method
 });
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc24615 and 45a4fc2.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (98)
  • packages/extension/package.json (1 hunks)
  • packages/extension/src/libs/background/index.ts (1 hunks)
  • packages/extension/src/libs/background/types.ts (3 hunks)
  • packages/extension/src/libs/name-resolver/index.ts (1 hunks)
  • packages/extension/src/libs/nft-handlers/conflux.ts (4 hunks)
  • packages/extension/src/libs/rate-state/index.ts (2 hunks)
  • packages/extension/src/libs/recently-sent-addresses/index.ts (2 hunks)
  • packages/extension/src/libs/recently-sent-addresses/types.ts (1 hunks)
  • packages/extension/src/libs/tokens-state/index.ts (3 hunks)
  • packages/extension/src/libs/updates-state/index.ts (3 hunks)
  • packages/extension/src/libs/utils/initialize-wallet.ts (3 hunks)
  • packages/extension/src/libs/utils/networks.ts (4 hunks)
  • packages/extension/src/libs/utils/number-formatter.ts (1 hunks)
  • packages/extension/src/providers/bitcoin/methods/btc_switchNetwork.ts (1 hunks)
  • packages/extension/src/providers/bitcoin/types/bitcoin-network.ts (1 hunks)
  • packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (2 hunks)
  • packages/extension/src/providers/ethereum/libs/transaction/index.ts (1 hunks)
  • packages/extension/src/providers/ethereum/methods/wallet_switchEthereumChain.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/cytonic-testnet.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (3 hunks)
  • packages/extension/src/providers/ethereum/networks/syscoin/nevm.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/syscoin/rollux.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/unitzero.ts (0 hunks)
  • packages/extension/src/providers/ethereum/types/evm-network.ts (4 hunks)
  • packages/extension/src/providers/index.ts (2 hunks)
  • packages/extension/src/providers/kadena/types/kadena-network.ts (1 hunks)
  • packages/extension/src/providers/massa/index.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/accounts-state/index.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/api.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/blockies.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/index.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getBalance.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_requestAccounts.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_setNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/buildnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/index.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/mainnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/massa-base.ts (1 hunks)
  • packages/extension/src/providers/massa/types/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/accounts/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/libs/signer.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/massa-connect-dapp.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/names.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/settings/index.vue (1 hunks)
  • packages/extension/src/providers/polkadot/types/substrate-network.ts (1 hunks)
  • packages/extension/src/providers/solana/types/sol-network.ts (2 hunks)
  • packages/extension/src/scripts/inject.ts (2 hunks)
  • packages/extension/src/types/activity.ts (1 hunks)
  • packages/extension/src/types/base-network.ts (3 hunks)
  • packages/extension/src/types/env.d.ts (1 hunks)
  • packages/extension/src/types/provider.ts (6 hunks)
  • packages/extension/src/types/window.d.ts (1 hunks)
  • packages/extension/src/ui/action/App.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/store.ts (1 hunks)
  • packages/extension/src/ui/action/components/base-button/index.vue (4 hunks)
  • packages/extension/src/ui/action/components/base-file-picker/index.vue (1 hunks)
  • packages/extension/src/ui/action/icons/actions/trash.vue (1 hunks)
  • packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue (1 hunks)
  • packages/extension/src/ui/action/icons/updates/heart.vue (1 hunks)
  • packages/extension/src/ui/action/store/menu-store.ts (1 hunks)
  • packages/extension/src/ui/action/store/updates-store.ts (5 hunks)
  • packages/extension/src/ui/action/types/filters.ts (2 hunks)
  • packages/extension/src/ui/action/types/network-category.ts (1 hunks)
  • packages/extension/src/ui/action/types/network-sort.ts (1 hunks)
  • packages/extension/src/ui/action/types/updates.ts (1 hunks)
  • packages/extension/src/ui/action/utils/browser.ts (2 hunks)
  • packages/extension/src/ui/action/utils/currencyConfig.ts (1 hunks)
  • packages/extension/src/ui/action/utils/filters.ts (1 hunks)
  • packages/extension/src/ui/action/views/network-activity/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/send-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/settings/store.ts (2 hunks)
  • packages/extension/src/ui/action/views/verify-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/onboard/main.ts (1 hunks)
  • packages/extension/src/ui/onboard/restore-wallet/store.ts (1 hunks)
  • packages/extension/src/ui/provider-pages/routes.ts (2 hunks)
  • packages/extension/test-massa-transaction.html (1 hunks)
  • packages/keyring/package.json (1 hunks)
  • packages/keyring/src/index.ts (2 hunks)
  • packages/keyring/src/utils.ts (1 hunks)
  • packages/signers/massa/package.json (1 hunks)
  • packages/signers/massa/src/index.ts (1 hunks)
  • packages/signers/massa/src/libs/ed25519.ts (1 hunks)
  • packages/signers/massa/tests/sign.test.ts (1 hunks)
  • packages/signers/massa/tsconfig.json (1 hunks)
  • packages/signers/massa/tsconfig.paths.json (1 hunks)
  • packages/swap/src/providers/zerox/types.ts (0 hunks)
  • packages/types/package.json (1 hunks)
  • packages/types/src/index.ts (1 hunks)
  • packages/types/src/networks.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • packages/extension/src/providers/ethereum/networks/unitzero.ts
  • packages/swap/src/providers/zerox/types.ts
🧰 Additional context used
🧠 Learnings (1)
packages/extension/src/libs/nft-handlers/conflux.ts (1)

Learnt from: Pana
PR: #683
File: packages/extension/src/libs/nft-handlers/conflux.ts:16-56
Timestamp: 2025-05-09T03:37:47.015Z
Learning: For the Conflux NFT handler (and other NFT handlers in general), it's better to maintain reasonable limits (like 100 collections/items) rather than implementing full pagination that fetches all NFTs at once, as users with many NFTs would experience performance issues.

🧬 Code Graph Analysis (21)
packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (1)
packages/extension/src/libs/market-data/types.ts (1)
  • CoinGeckoTokenMarket (23-37)
packages/extension/src/libs/recently-sent-addresses/index.ts (1)
packages/extension/src/libs/recently-sent-addresses/types.ts (1)
  • IState (1-3)
packages/extension/src/providers/index.ts (1)
packages/extension/src/providers/massa/index.ts (1)
  • MassaProvider (18-92)
packages/extension/src/ui/action/store/menu-store.ts (1)
packages/extension/src/libs/menu-state/index.ts (1)
  • setIsExpanded (31-35)
packages/extension/src/providers/ethereum/networks/cytonic-testnet.ts (2)
packages/extension/src/providers/ethereum/types/evm-network.ts (2)
  • EvmNetworkOptions (22-53)
  • EvmNetwork (55-286)
packages/extension/src/providers/ethereum/libs/activity-handlers/index.ts (1)
  • EtherscanActivity (10-10)
packages/extension/src/libs/utils/initialize-wallet.ts (2)
packages/extension/src/libs/utils/accounts.ts (1)
  • getAccountsByNetworkName (14-44)
packages/extension/src/providers/massa/types/index.ts (1)
  • MassaNetworks (8-8)
packages/extension/src/ui/action/utils/filters.ts (1)
packages/extension/src/ui/action/utils/currencyConfig.ts (1)
  • LANG_INFO (172-172)
packages/extension/src/providers/ethereum/types/evm-network.ts (1)
packages/extension/src/libs/sparkline/index.ts (1)
  • Sparkline (5-25)
packages/extension/src/ui/action/utils/browser.ts (1)
packages/utils/src/debug-logger.ts (1)
  • error (388-392)
packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (1)
packages/extension/src/libs/sparkline/index.ts (1)
  • Sparkline (5-25)
packages/keyring/src/index.ts (1)
packages/signers/massa/src/index.ts (1)
  • MassaSigner (17-76)
packages/keyring/src/utils.ts (1)
packages/types/src/index.ts (1)
  • SignerType (188-188)
packages/extension/src/providers/massa/methods/massa_getNetwork.ts (2)
packages/types/src/index.ts (1)
  • MiddlewareFunction (194-194)
packages/extension/src/types/provider.ts (1)
  • ProviderRPCRequest (186-188)
packages/extension/src/types/base-network.ts (1)
packages/extension/src/providers/massa/libs/api.ts (1)
  • MassaAPI (4-49)
packages/signers/massa/tests/sign.test.ts (2)
packages/utils/src/index.ts (1)
  • bufferToHex (38-38)
packages/signers/massa/src/index.ts (1)
  • MassaSigner (17-76)
packages/extension/src/providers/massa/ui/index.ts (1)
packages/extension/src/types/provider.ts (1)
  • UIExportOptions (190-193)
packages/extension/src/providers/massa/methods/index.ts (2)
packages/types/src/index.ts (1)
  • MiddlewareFunction (194-194)
packages/extension/src/providers/massa/index.ts (1)
  • request (70-83)
packages/extension/src/libs/updates-state/index.ts (1)
packages/extension/src/libs/updates-state/types.ts (1)
  • IState (5-9)
packages/extension/src/providers/massa/methods/massa_setNetwork.ts (3)
packages/types/src/index.ts (1)
  • MiddlewareFunction (194-194)
packages/extension/src/types/provider.ts (1)
  • ProviderRPCRequest (186-188)
packages/extension/src/libs/error/index.ts (1)
  • getCustomError (27-33)
packages/extension/src/providers/massa/ui/libs/signer.ts (4)
packages/types/src/index.ts (1)
  • EnkryptAccount (202-202)
packages/extension/src/providers/massa/types/index.ts (1)
  • MassaNetworkOptions (10-12)
packages/utils/src/index.ts (1)
  • bufferToHex (38-38)
packages/extension/src/libs/backup-state/index.ts (1)
  • msgHash (36-51)
packages/extension/src/providers/massa/types/index.ts (2)
packages/extension/src/types/base-network.ts (1)
  • BaseNetworkOptions (17-45)
packages/types/src/index.ts (1)
  • EnkryptAccount (202-202)
🔇 Additional comments (113)
packages/extension/src/ui/action/store/menu-store.ts (1)

1-24: Semicolon additions look good—no logic affected
These edits just align the file with the prevailing style guide; nothing else changes.

packages/extension/src/ui/action/types/filters.ts (1)

8-9: Confirm availability & build-step compatibility of parseCurrency and trailing comma.

  1. Make sure parseCurrency is actually exported from ../utils/filters; otherwise the module will fail at runtime.
  2. TypeScript allows the trailing comma after the last specifier, but some older tooling / eslint configs flag it (comma-dangle). Double-check that the repo’s linter / prettier rules explicitly permit this usage to avoid CI noise.

No action needed if both points are satisfied.

Also applies to: 18-19

packages/extension/src/ui/action/components/base-file-picker/index.vue (1)

76-77: Good formatting improvement for readability.

The CSS background property formatting enhancement makes the linear-gradient parameters more readable and follows modern CSS formatting practices.

packages/extension/src/ui/action/components/base-button/index.vue (1)

89-90: Consistent formatting improvements across button variants.

The CSS background property formatting enhancements improve readability and maintain consistency across all button variants (default, gray, red, orange).

Also applies to: 129-130, 144-145, 159-160

packages/extension/src/providers/ethereum/methods/wallet_switchEthereumChain.ts (1)

71-73: LGTM – formatting only

The line-break adjustment in the template literal is stylistic and introduces no behavioral change. ✅

packages/types/package.json (1)

26-28: Prefer pinning to a stable, non-dev version of @massalabs/massa-web3

The -dev tag usually points at pre-release builds that may be unpublished or force-pushed, which can break downstream reproducible builds.
Confirm that you really need the development snapshot; otherwise, switch to a released semver (e.g. ^5.2.1) and/or move it to dependencies if it is required at runtime.

packages/extension/src/libs/utils/number-formatter.ts (1)

532-542: Trailing comma change is fine

The added trailing comma keeps the export list diff-friendly and poses no functional impact.

packages/extension/src/providers/kadena/types/kadena-network.ts (1)

16-17: Import compression LGTM

Single-line import improves readability; no functional change.

packages/extension/src/providers/bitcoin/types/bitcoin-network.ts (1)

12-13: Import compression LGTM

Consistent with other provider files; no behaviour impact.

packages/extension/src/providers/polkadot/types/substrate-network.ts (1)

11-12: Import compression LGTM

Stylistic update only; functionality unchanged.

packages/signers/massa/tsconfig.paths.json (1)

1-8: LGTM! Standard TypeScript path configuration.

The configuration follows TypeScript best practices with appropriate baseUrl and path alias setup for cleaner imports.

packages/extension/src/providers/ethereum/networks/syscoin/nevm.ts (2)

2-6: LGTM! Consistent quote style in imports.

The conversion to single quotes aligns with the codebase style standards.


10-24: LGTM! Consistent quote style in configuration object.

The stylistic update to single quotes improves consistency across the network configuration without affecting functionality.

packages/extension/src/providers/solana/types/sol-network.ts (2)

9-9: LGTM! Cleaner import formatting.

The single-line import statement improves readability.


130-130: LGTM! Consistent conditional formatting.

The single-line conditional expression is more concise while maintaining the same logic.

packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (2)

12-12: LGTM! Cleaner import formatting.

The single-line import statement improves readability.


282-290: LGTM! Improved code formatting.

The reformatted method call and reduce operation maintain the same logic while improving readability through better indentation and alignment.

packages/extension/src/providers/ethereum/networks/cytonic-testnet.ts (3)

2-4: LGTM! Consistent quote style in imports.

The conversion to single quotes aligns with the codebase style standards.


8-21: LGTM! Consistent formatting in network configuration.

The stylistic updates improve consistency and readability without affecting the network configuration functionality.


25-25: LGTM! Consistent export style.

The single quote usage maintains consistency with the rest of the file.

packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (1)

224-226: Confirm that a WebSocket URL is acceptable for node

Some consumers of EvmNetwork.node expect an HTTPS JSON-RPC endpoint and will fail if they receive a WSS URL. Please verify that all call-sites (e.g., the generic Ethereum API class) can handle wss://… for SKALE; otherwise provide both https and wss variants or rename the field to clarify intent.

packages/extension/src/ui/action/types/network-category.ts (1)

1-5: Syntax fix looks good

The stray semicolon was removed; enum is now valid TypeScript.

packages/extension/package.json (1)

42-42: Verify the pinned dev build of @massalabs/massa-web3

The version 5.2.1-dev.20250722105131 is a timestamped prerelease.
Ensure:

  1. The package exists on the registry and is pulled by CI.
  2. No known breaking changes exist between this dev build and the next stable tag; otherwise consider pinning to an exact commit hash or stable semver.
packages/extension/src/ui/action/types/updates.ts (1)

1-1: Minor import style change is fine

Switched to single quotes; consistent with project style.

packages/keyring/package.json (1)

28-29: Addition of @enkryptcom/signer-massa acknowledged

Dependency aligns with new Massa signer integration; no issues spotted.

packages/extension/src/ui/onboard/main.ts (1)

10-12: Stylistic tweak is fine, but ensure global typings exist

The extra semicolon is 👍.
Just double-check that globalThis.__ENKRYPT_DEBUG_LOG_CONF__ is declared somewhere (e.g. in a global.d.ts) to avoid a TS2339 compile error in strict projects.

packages/extension/src/ui/provider-pages/routes.ts (1)

9-19: Route‐name collisions are easy to miss

Adding MassaUI here makes sense. Make sure every view exported by @/providers/massa/ui uses unique name fields; Vue Router silently discards duplicates which then surface as “unmatched route” issues at runtime.

packages/extension/src/ui/onboard/restore-wallet/store.ts (1)

19-26: LGTM, purely formatting
No logic change – safer & more readable.

packages/extension/src/ui/action/types/network-sort.ts (1)

1-8: Fix restores valid enum syntax

The stray semicolons would have broken the TS build; the curly-brace replacement is the correct fix.

packages/extension/src/ui/action/components/app-menu/store.ts (1)

13-16: Semicolon addition is fine

No functional impact; aligns with style of setOptions.

packages/extension/src/types/env.d.ts (1)

2-2: Style consistency improvement looks good
The added semicolon aligns with the code-style used elsewhere in the codebase.

packages/extension/src/libs/recently-sent-addresses/types.ts (1)

2-3: Semicolon addition keeps interface style uniform
No functional impact; change approved.

packages/types/src/index.ts (1)

53-54: New signer type added – verify downstream wiring
ed25519mas entry is required for Massa support, but please double-check:

  1. Signer implementation is registered in keyring (MassaSigner) and exported.
  2. All switch/lookup statements that enumerate SignerType include the new value (e.g., UI filters, validation helpers).
  3. Unit / e2e tests cover the new signer path.
packages/extension/src/ui/action/icons/updates/heart.vue (1)

2-13: SVG re-formatted; no issues spotted
Readable multi-line attributes improve diff clarity.

packages/extension/src/types/window.d.ts (1)

3-8: Minor TS decl tweaks accepted
Semicolons tidy the declaration; nothing further.

packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue (1)

2-15: Pure formatting – looks good

Only whitespace/indentation changes; SVG semantics remain intact.

packages/extension/src/libs/recently-sent-addresses/index.ts (1)

20-28: Potential race condition when writing concurrent updates

addRecentlySentAddress performs a classic read-modify-write. If two tabs call this method simultaneously, the later set can clobber the first one and lose an address.

A cheap mitigation is to retry on write conflict, or (better) expose an atomic update method inside BrowserStorage that accepts a transformer callback.

-const state: IState | undefined = await this.#storage.get(key);
-const newState: IState = { ...state, addresses: /* … */ };
-await this.#storage.set(key, newState);
+await this.#storage.update(key, (state?: IState): IState => ({
+  ...state,
+  addresses: Array.from(
+    new Set([network.displayAddress(address), ...(state?.addresses ?? [])]),
+  ).slice(0, 5),
+}));

[ suggest_essential_refactor ]

packages/extension/src/ui/action/icons/actions/trash.vue (1)

2-23: SVG re-formatting accepted

Visual output unchanged; consistent formatting helps future diffs.

packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue (1)

2-25: Formatting only – good for readability

No functional impact detected.

packages/extension/src/providers/ethereum/networks/syscoin/rollux.ts (2)

4-4: LGTM: Import quote style consistency improvement.

The change from double quotes to single quotes aligns with JavaScript/TypeScript formatting conventions.


23-24: LGTM: Multi-line string formatting improves readability.

The reformatting of the buyLink property to multiple lines enhances code readability while preserving the original URL value.

packages/extension/src/providers/index.ts (2)

6-6: LGTM: Proper import of MassaProvider.

The import follows the established path structure consistent with other blockchain providers.


15-15: LGTM: Consistent provider registration pattern.

The addition of MassaProvider to the exported object follows the same pattern as existing providers and uses the appropriate ProviderName.massa key.

packages/extension/src/libs/rate-state/index.ts (2)

15-21: LGTM: Improved JSDoc formatting.

The enhanced spacing in the JSDoc comment improves readability and documentation quality.


52-52: LGTM: Consistent conditional statement formatting.

The else if statement formatting improvement enhances code consistency.

packages/extension/src/ui/action/views/send-transaction/index.vue (2)

15-15: LGTM: Proper import of Massa send transaction component.

The import path follows the established provider structure and naming convention.


29-29: LGTM: Consistent provider integration in send layouts.

The addition of SendTransactionMassa to the sendLayouts mapping follows the established pattern for other blockchain providers.

packages/extension/src/scripts/inject.ts (2)

12-12: LGTM: Consistent import of Massa provider injection module.

The import follows the established pattern and path structure for provider injection modules.


47-51: LGTM: Proper integration of Massa provider in injection system.

The MassaProvider invocation follows the exact same pattern as other providers, correctly passing the window object and configuration with appropriate ProviderName.massa and ProviderType.massa values.

packages/types/src/networks.ts (2)

116-117: LGTM! Clean enum additions for Massa network support.

The new NetworkNames entries follow the established naming convention and properly support both mainnet and testnet variants.


186-186: LGTM! CoinGecko platform identifier correctly added.

The Massa platform identifier follows CoinGecko's lowercase naming convention and aligns with the NetworkNames additions.

packages/keyring/src/utils.ts (1)

17-19: Approve derivation path, but note unregistered coin type

The ed25519mas case follows the same hardened‐path pattern as ed25519sol and correctly implements Massa’s derivation requirements. However, Massa is not yet registered in the SLIP-0044 list, so using coin type 632 is currently provisional.

• File: packages/keyring/src/utils.ts
Lines: 17–19

if (type === SignerType.ed25519mas) {
  return `${basePath}/${index}'/0'`; // Massa uses hardened paths with provisional coin type 632
}

Please confirm with the Massa development team or SLIP-0044 maintainers before relying on coin type 632 in production, or document it as a custom/provisional type until officially registered.

packages/extension/src/ui/action/App.vue (2)

214-215: LGTM! Massa buy page integration follows established pattern.

The buy link addition for Massa network is consistent with other network implementations and points to the official Massa website.


324-326: Minor formatting improvements.

The blank line adjustments improve code readability without affecting functionality.

packages/extension/src/ui/action/utils/currencyConfig.ts (2)

2-169: Code style improvements - consistent quote usage.

The conversion from quoted object keys to unquoted identifiers and standardization on single quotes improves code consistency. No functional changes.


172-172: Export statement updated for consistency.

Single quote usage aligns with the rest of the file's style improvements.

packages/extension/src/libs/tokens-state/index.ts (3)

37-38: Improved code alignment.

The indentation adjustment for the .toLowerCase() call enhances readability of the comparison logic.


67-69: Consistent formatting for state retrieval.

The multi-line formatting of the storage.get call improves readability.


79-80: Consistent indentation improvement.

The alignment matches the similar pattern used earlier in the addErc20Token method.

packages/extension/src/types/activity.ts (1)

124-131: Good formatting improvement for readability.

The vertical alignment of union type members makes the rawInfo property much more readable and follows TypeScript best practices for complex union types.

packages/extension/src/libs/nft-handlers/conflux.ts (4)

24-24: Excellent immutability improvement.

Converting let to const for the allItems array prevents accidental mutations and follows JavaScript best practices.


26-31: Great use of const for immutable response object.

The nftBalances response object is never reassigned, so using const is the correct choice here.


36-53: Consistent immutability improvements in the loop.

All variables (collection, contract, items, nftCollection) are appropriately declared as const since they're never reassigned. This makes the code more predictable and follows best practices.


62-73: Good immutability practices in helper function.

Both itemResponse and items are correctly declared as const since they're never reassigned after initialization.

packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue (1)

2-82: Excellent SVG formatting improvement.

The multi-line format with proper indentation significantly improves readability and maintainability of the SVG markup without affecting the visual output. This follows HTML/XML best practices and makes future modifications much easier.

packages/keyring/src/index.ts (2)

22-22: Clean import of Massa signer.

The import follows the established pattern used by other blockchain signers in the keyring.


55-55: Proper integration of Massa signer into keyring.

The registration of MassaSigner for SignerType.ed25519mas follows the established pattern and correctly integrates Massa blockchain support into the keyring system. The signer implementation properly handles Massa's ed25519 cryptographic requirements.

packages/extension/src/providers/massa/ui/accounts/index.vue (1)

1-16: Good foundation for Massa accounts UI.

This placeholder component establishes a solid foundation for future Massa account management features. The structure follows Vue 3 best practices with TypeScript support, scoped CSS, and semantic HTML. The placeholder comments clearly indicate areas for future development.

packages/extension/src/providers/massa/networks/index.ts (1)

5-8: Mapping looks good

The network map is straightforward and correctly keyed by NetworkNames.

packages/extension/src/libs/utils/initialize-wallet.ts (1)

7-7: LGTM! Massa integration follows established patterns.

The Massa network integration correctly follows the same pattern used for other blockchain networks (Ethereum, Polkadot, Bitcoin, Kadena, Solana). The implementation properly:

  • Imports the Massa networks configuration
  • Filters out test wallets when checking existing accounts
  • Creates a default account using the mainnet configuration with appropriate signer type

Also applies to: 27-29, 65-71

packages/extension/src/providers/massa/methods/index.ts (1)

1-21: Well-structured middleware configuration.

The middleware setup follows clean patterns with:

  • Clear separation of concerns for each RPC method
  • Proper typing with MiddlewareFunction[]
  • Future-ready placeholder middleware for extensibility
  • Consistent function signature and export pattern
packages/extension/src/providers/massa/networks/mainnet.ts (1)

5-18: Mainnet configuration verified and approved.

  • Block explorer URLs respond with HTTP 200.
  • CoinGecko ID “massa” returns valid data.
  • PublicApiUrl.Mainnet and CHAIN_ID.Mainnet imports match those used in buildnet and are sourced from the official package.

No further changes needed.

packages/extension/src/providers/ethereum/types/evm-network.ts (1)

5-5: LGTM! Clean formatting improvements.

The formatting changes improve code consistency without affecting functionality:

  • Consolidated import statements
  • Consistent single-line property assignments
  • Proper method chaining alignment

Also applies to: 153-153, 157-158, 210-210, 269-269

packages/extension/src/ui/action/store/updates-store.ts (4)

1-1: LGTM: Import statement formatting improvement.

Adding the semicolon to the import statement improves consistency with TypeScript coding standards.


33-45: LGTM: Enhanced JSDoc documentation.

The expanded JSDoc comment provides much clearer documentation of the function's behavior, including step-by-step logic and error handling details. This improves code maintainability.


64-77: LGTM: Comprehensive function documentation.

The detailed JSDoc comment thoroughly describes the initialization process, making the code more maintainable and easier to understand for future developers.


105-118: LGTM: Consistent formatting improvements.

The semicolon additions and trailing comma maintain consistency with TypeScript best practices throughout the store definition.

packages/signers/massa/tsconfig.json (1)

1-29: LGTM: Well-configured TypeScript setup for the Massa signer package.

The configuration is appropriate for a cryptographic signer library with:

  • ES2015 target suitable for Node.js environments
  • CommonJS modules for compatibility
  • Strict unused parameter/local checks for code quality
  • Source maps and declarations for debugging and consumption
  • Proper include/exclude patterns

The ts-node configuration with tsconfig-paths/register ensures path mapping works correctly during development.

packages/extension/src/types/base-network.ts (3)

11-11: LGTM: Proper import for MassaAPI.

The import path correctly references the Massa API implementation and follows the same pattern as other provider APIs in this file.


42-43: LGTM: Consistent type union extension.

Adding Promise<MassaAPI> to the api function type union in BaseNetworkOptions properly extends the interface to support Massa networks. The formatting maintains consistency with existing entries.


85-86: LGTM: Matching class property type update.

The BaseNetwork class property type correctly mirrors the interface change, ensuring type consistency between the interface and implementation.

packages/extension/src/providers/massa/ui/routes/index.ts (1)

1-14: LGTM: Well-structured route configuration with proper namespacing.

The implementation correctly:

  • Imports the necessary RouteNames and component
  • Clones the route configuration to avoid mutations
  • Assigns the component to the appropriate route
  • Implements proper namespacing for both path and route names
  • Returns properly typed route records

The namespacing approach ensures route isolation between different providers while maintaining a consistent pattern.

packages/extension/src/ui/action/views/verify-transaction/index.vue (2)

11-11: LGTM: Correct import path for Massa verify transaction component.

The import path follows the established convention used by other providers, importing from the provider's UI send-transaction directory structure.


23-23: LGTM: Consistent provider mapping addition.

Adding the Massa verify transaction component to the sendLayouts mapping follows the exact same pattern as other blockchain providers, ensuring consistent behavior in the dynamic component selection logic.

packages/extension/src/libs/background/types.ts (1)

6-6: LGTM! Clean integration of MassaProvider into the type system.

The MassaProvider has been properly integrated into the existing provider type interfaces, following the same pattern as other blockchain providers.

Also applies to: 16-16, 26-26

packages/extension/src/providers/massa/ui/routes/names.ts (1)

1-37: Well-structured route configuration with proper lazy loading.

The route definitions follow Vue.js best practices with proper namespacing, dynamic imports for code splitting, and consistent naming conventions.

packages/extension/src/providers/massa/methods/massa_getNetwork.ts (1)

8-23: Solid middleware implementation with appropriate error handling.

The middleware correctly implements the massa_getNetwork method with proper method checking, error handling, and fallback behavior. The use of getCurrentNetwork() and fallback to NetworkNames.Massa ensures robust behavior.

packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue (1)

2-89: Good formatting improvement for SVG readability.

The multi-line formatting of SVG attributes improves code readability and maintainability without affecting the component's functionality.

packages/signers/massa/tests/sign.test.ts (1)

6-53: Comprehensive test coverage for MassaSigner functionality.

The test suite covers the essential cryptographic operations: keypair generation, signing/verification, and invalid signature rejection. The test structure is well-organized and uses appropriate testing patterns.

packages/extension/src/ui/action/views/network-activity/index.vue (2)

82-82: LGTM: Import correctly adds Massa transaction status support.

The import of OperationStatus from the Massa web3 library is properly structured and necessary for handling Massa transaction statuses in the activity update logic.


221-231: LGTM: Massa provider handling follows established patterns correctly.

The Massa transaction status handling logic is well-implemented:

  • Properly handles early return for missing transaction info
  • Prevents race conditions with isActivityUpdating check
  • Correctly maps Success and SpeculativeSuccess to success status
  • Follows the same pattern as other blockchain providers
  • Includes proper activity state updates and timer cleanup
packages/extension/src/providers/massa/methods/massa_getBalance.ts (3)

9-16: LGTM: Address validation correctly uses official Massa library.

The isValidMassaAddress helper function properly validates Massa addresses by leveraging the official Address.fromString method with appropriate try-catch error handling.


18-44: LGTM: Middleware function follows established patterns correctly.

The middleware implementation is well-structured:

  • Proper early return for non-matching methods
  • Validates address parameter before processing
  • Correctly retrieves network API and calls balance method
  • Uses appropriate error handling with custom error messages
  • Follows standard middleware response patterns

28-42: LGTM: Comprehensive error handling with clear user messages.

The error handling properly covers both validation failures and network/API errors with clear, user-friendly messages using the standard getCustomError utility.

packages/extension/src/types/provider.ts (3)

36-36: LGTM: Massa provider enum additions are consistent and necessary.

The additions of massa to both ProviderName and ProviderType enums follow the established patterns and are required for the Massa blockchain integration.

Also applies to: 73-73


27-27: LGTM: OperationStatus import and type integration are correct.

The import of OperationStatus and its addition to the getTransactionStatus return type union properly extends the type system to support Massa transaction statuses, maintaining type safety across the application.

Also applies to: 151-151


128-128: LGTM: getCurrentNetwork() method addition supports provider functionality.

The new abstract method getCurrentNetwork() is properly defined and necessary for provider implementations to access the current network context, as demonstrated by its usage in the Massa balance middleware.

packages/signers/massa/package.json (3)

1-23: LGTM: Package configuration is well-structured and follows conventions.

The package metadata, ES module configuration, and publishing setup are properly configured following the established patterns for Enkrypt signer packages.


32-52: LGTM: Comprehensive development tooling setup.

The development dependencies provide a complete TypeScript development environment with proper linting, testing, and build tools following modern best practices.


16-60: LGTM: Scripts and metadata are properly configured.

The build, lint, and test scripts are appropriately configured for a TypeScript package with dual ESM/CJS output. Repository metadata and licensing are consistent with the project standards.

packages/extension/src/libs/utils/networks.ts (1)

16-17: LGTM! Massa network integration follows established patterns.

The Massa network support is consistently integrated alongside other blockchain networks, following the same patterns for imports, mapping, and default configurations.

Also applies to: 25-25, 40-41, 75-75, 82-82, 88-88, 111-112

packages/extension/src/providers/massa/libs/api.ts (1)

28-36: Good error handling with sensible default.

The fallback to a default minimal fee when network info is unavailable is a pragmatic approach that ensures the API remains functional even during network issues.

packages/signers/massa/src/libs/ed25519.ts (1)

1-82: Solid Ed25519 key derivation implementation.

The implementation correctly follows the Ed25519 hierarchical deterministic key derivation scheme with proper use of HMAC-SHA512 and hardened derivation paths.

packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (1)

85-88: Verify the hardcoded Massa address length threshold

I didn’t find any ADDRESS_LENGTH constant or documentation reference for Massa addresses in the codebase or in @massalabs/massa-web3. The > 66 check in your computed massaAddress is therefore arbitrary—and since network.displayAddress for Massa is just the identity function, it has no real effect.

Please confirm the correct maximum length for Massa addresses (per the official spec or library) and either:

  • Replace the magic number 66 with a shared constant (e.g. exported by massa-web3), or
  • Remove the length‐based branch entirely and rely on Address.fromString for validation before applying display formatting.

Files to update:

  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (computed massaAddress)

Example diff sketch:

- const massaAddress = computed(() => {
-   if (props.value && props.value.length > 66)
-     return props.network.displayAddress(props.value);
-   else return props.value;
- });
+ // TODO: use official MAX_ADDRESS_LENGTH constant or drop this branch
+ const massaAddress = computed(() => props.value ?? '');
packages/extension/src/providers/massa/libs/blockies.ts (1)

118-124: Buffer is already polyfilled via Vite configuration

Your Vite setup uses vite-plugin-node-polyfills with "buffer" included (see lines 63–67 in packages/extension/vite.config.ts), so Buffer.from(…) will work in browser builds without additional changes. No further action needed.

packages/extension/test-massa-transaction.html (1)

1-324: Test file looks good for manual testing.

This comprehensive test page provides good coverage of Massa provider functionality. The structured approach with step-by-step testing and detailed logging is appropriate for a manual test file.

packages/extension/src/providers/massa/index.ts (1)

18-92: Well-implemented provider class with good architectural patterns.

The MassaProvider implementation shows good design patterns:

  • Proper use of middleware for extensibility
  • Smart network switching optimization that reuses connections when possible
  • Clean separation of concerns
  • Proper event handling for notifications

The optimization in setRequestProvider to only recreate the provider when the protocol changes is particularly well thought out.

packages/extension/src/providers/massa/types/index.ts (1)

1-78: Comprehensive and well-structured type definitions.

The type definitions provide a solid foundation for the Massa integration:

  • Proper extension of base types
  • Clear and descriptive interface names
  • Appropriate use of optional properties
  • Good coverage of all needed types for the Massa provider
packages/extension/src/providers/massa/networks/massa-base.ts (1)

116-152: Well-structured helper function!

The network options helper provides a clean interface for creating Massa network configurations with appropriate defaults.

packages/extension/src/providers/massa/ui/send-transaction/index.vue (4)

151-177: Good defensive programming in account transformation.

The computed property properly handles missing data with appropriate fallbacks.


279-310: Comprehensive input validation!

The validation logic properly checks address format, decimal precision, numeric validity, and balance sufficiency.


1-95: Well-structured template with proper component composition.

The template effectively uses child components and handles user interactions appropriately.


479-578: Clean and well-organized styles.

Good use of theme variables and proper scoping.

@peterjah peterjah force-pushed the extension branch 3 times, most recently from 88412ec to 4ffd594 Compare July 25, 2025 13:23
@peterjah
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 25, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (1)

258-264: Improve error handling and remove console statements

The error handling could expose sensitive information and uses console.error in production.

   } catch (error) {
     isProcessing.value = false;
-    errorMsg.value = error instanceof Error ? error.message : String(error);
+    errorMsg.value = error instanceof Error ? error.message : 'Transaction failed';
     trackSendEvents(SendEventType.SendFailed, {
       network: network.value.name,
-      error: errorMsg.value,
+      error: error instanceof Error ? error.message : 'Unknown error',
     });
-    console.error('error', error);
+    // Log to monitoring service if needed
   }
packages/extension/src/providers/massa/ui/libs/signer.ts (1)

54-61: Add validation for chainId to prevent runtime errors.

The non-null assertion operator on chainId! could cause runtime errors if the network doesn't have a chainId. Add proper validation to ensure chainId exists.

   const chainId = (network as MassaNetworkOptions).chainId;
+  if (!chainId) {
+    return Promise.reject(new Error('Network chainId is required for Massa transactions'));
+  }

   const publicKey = PublicKey.fromString(account.publicKey);
   const serialized = OperationManager.canonicalize(
-    chainId!,
+    chainId,
     operationDetails,
     publicKey,
   );
🧹 Nitpick comments (1)
packages/extension/src/providers/massa/ui/libs/signer.ts (1)

90-107: Remove unused network parameter.

The network parameter is destructured from options but never used in the function. Either utilize it for network-specific logic or remove it to avoid confusion.

 export const MassaMessageSigner = (options: {
   account: EnkryptAccount;
-  network: BaseNetwork;
   payload: Buffer;
 }): Promise<InternalOnMessageResponse> => {
-  const { account, payload } = options;
+  const { account, payload } = options;

   const msgHash = bufferToHex(payload);
   return sendUsingInternalMessengers({
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 45a4fc2 and 4ffd594.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (93)
  • packages/extension/package.json (1 hunks)
  • packages/extension/src/libs/background/index.ts (1 hunks)
  • packages/extension/src/libs/background/types.ts (3 hunks)
  • packages/extension/src/libs/name-resolver/index.ts (1 hunks)
  • packages/extension/src/libs/nft-handlers/conflux.ts (4 hunks)
  • packages/extension/src/libs/rate-state/index.ts (2 hunks)
  • packages/extension/src/libs/recently-sent-addresses/index.ts (2 hunks)
  • packages/extension/src/libs/recently-sent-addresses/types.ts (1 hunks)
  • packages/extension/src/libs/tokens-state/index.ts (3 hunks)
  • packages/extension/src/libs/updates-state/index.ts (3 hunks)
  • packages/extension/src/libs/utils/initialize-wallet.ts (3 hunks)
  • packages/extension/src/libs/utils/networks.ts (4 hunks)
  • packages/extension/src/libs/utils/number-formatter.ts (1 hunks)
  • packages/extension/src/providers/bitcoin/methods/btc_switchNetwork.ts (1 hunks)
  • packages/extension/src/providers/bitcoin/types/bitcoin-network.ts (1 hunks)
  • packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts (2 hunks)
  • packages/extension/src/providers/ethereum/libs/transaction/index.ts (1 hunks)
  • packages/extension/src/providers/ethereum/methods/wallet_switchEthereumChain.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/cytonic-testnet.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/skale/skale-base.ts (3 hunks)
  • packages/extension/src/providers/ethereum/networks/syscoin/nevm.ts (1 hunks)
  • packages/extension/src/providers/ethereum/networks/syscoin/rollux.ts (2 hunks)
  • packages/extension/src/providers/ethereum/networks/unitzero.ts (0 hunks)
  • packages/extension/src/providers/ethereum/types/evm-network.ts (4 hunks)
  • packages/extension/src/providers/index.ts (2 hunks)
  • packages/extension/src/providers/kadena/types/kadena-network.ts (1 hunks)
  • packages/extension/src/providers/massa/index.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/api.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/index.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getBalance.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_setNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/buildnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/index.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/mainnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/massa-base.ts (1 hunks)
  • packages/extension/src/providers/massa/types/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/accounts/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/libs/signer.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/names.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/settings/index.vue (1 hunks)
  • packages/extension/src/providers/polkadot/types/substrate-network.ts (1 hunks)
  • packages/extension/src/providers/solana/types/sol-network.ts (2 hunks)
  • packages/extension/src/scripts/inject.ts (2 hunks)
  • packages/extension/src/types/activity.ts (3 hunks)
  • packages/extension/src/types/base-network.ts (3 hunks)
  • packages/extension/src/types/env.d.ts (1 hunks)
  • packages/extension/src/types/provider.ts (6 hunks)
  • packages/extension/src/types/window.d.ts (1 hunks)
  • packages/extension/src/ui/action/App.vue (2 hunks)
  • packages/extension/src/ui/action/components/app-menu/store.ts (1 hunks)
  • packages/extension/src/ui/action/components/base-button/index.vue (4 hunks)
  • packages/extension/src/ui/action/components/base-file-picker/index.vue (1 hunks)
  • packages/extension/src/ui/action/icons/actions/trash.vue (1 hunks)
  • packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue (1 hunks)
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue (1 hunks)
  • packages/extension/src/ui/action/icons/updates/heart.vue (1 hunks)
  • packages/extension/src/ui/action/store/menu-store.ts (1 hunks)
  • packages/extension/src/ui/action/store/updates-store.ts (5 hunks)
  • packages/extension/src/ui/action/types/filters.ts (2 hunks)
  • packages/extension/src/ui/action/types/network-category.ts (1 hunks)
  • packages/extension/src/ui/action/types/network-sort.ts (1 hunks)
  • packages/extension/src/ui/action/types/updates.ts (1 hunks)
  • packages/extension/src/ui/action/utils/browser.ts (2 hunks)
  • packages/extension/src/ui/action/utils/currencyConfig.ts (1 hunks)
  • packages/extension/src/ui/action/utils/filters.ts (1 hunks)
  • packages/extension/src/ui/action/views/network-activity/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/send-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/settings/store.ts (2 hunks)
  • packages/extension/src/ui/action/views/verify-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/onboard/main.ts (1 hunks)
  • packages/extension/src/ui/onboard/restore-wallet/store.ts (1 hunks)
  • packages/extension/src/ui/provider-pages/routes.ts (2 hunks)
  • packages/keyring/package.json (1 hunks)
  • packages/keyring/src/index.ts (2 hunks)
  • packages/keyring/src/utils.ts (1 hunks)
  • packages/signers/massa/package.json (1 hunks)
  • packages/signers/massa/src/index.ts (1 hunks)
  • packages/signers/massa/src/libs/ed25519.ts (1 hunks)
  • packages/signers/massa/tests/sign.test.ts (1 hunks)
  • packages/signers/massa/tsconfig.json (1 hunks)
  • packages/signers/massa/tsconfig.paths.json (1 hunks)
  • packages/swap/src/providers/zerox/types.ts (0 hunks)
  • packages/types/package.json (1 hunks)
  • packages/types/src/index.ts (1 hunks)
  • packages/types/src/networks.ts (2 hunks)
💤 Files with no reviewable changes (2)
  • packages/swap/src/providers/zerox/types.ts
  • packages/extension/src/providers/ethereum/networks/unitzero.ts
✅ Files skipped from review due to trivial changes (32)
  • packages/extension/src/providers/kadena/types/kadena-network.ts
  • packages/extension/src/providers/polkadot/types/substrate-network.ts
  • packages/extension/src/providers/bitcoin/methods/btc_switchNetwork.ts
  • packages/extension/src/ui/action/icons/updates/heart.vue
  • packages/extension/src/providers/ethereum/networks/cytonic-testnet.ts
  • packages/extension/src/libs/updates-state/index.ts
  • packages/extension/src/ui/action/types/filters.ts
  • packages/extension/package.json
  • packages/extension/src/libs/recently-sent-addresses/types.ts
  • packages/extension/src/ui/action/icons/actions/trash.vue
  • packages/extension/src/providers/bitcoin/types/bitcoin-network.ts
  • packages/extension/src/ui/provider-pages/routes.ts
  • packages/extension/src/providers/massa/ui/routes/index.ts
  • packages/keyring/package.json
  • packages/extension/src/types/window.d.ts
  • packages/extension/src/providers/ethereum/libs/transaction/index.ts
  • packages/extension/src/providers/massa/ui/accounts/index.vue
  • packages/extension/src/providers/massa/ui/index.ts
  • packages/extension/src/providers/ethereum/networks/syscoin/rollux.ts
  • packages/extension/src/providers/ethereum/types/evm-network.ts
  • packages/extension/src/libs/utils/number-formatter.ts
  • packages/extension/src/ui/action/icons/banners/consistent-rewards-icon.vue
  • packages/extension/src/providers/massa/networks/index.ts
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo-white.vue
  • packages/extension/src/providers/ethereum/networks/syscoin/nevm.ts
  • packages/extension/src/ui/action/store/updates-store.ts
  • packages/extension/src/providers/massa/networks/mainnet.ts
  • packages/extension/src/libs/background/types.ts
  • packages/extension/src/providers/massa/libs/api.ts
  • packages/extension/src/ui/action/icons/common/enkrypt-staking-logo.vue
  • packages/signers/massa/tests/sign.test.ts
  • packages/extension/src/providers/massa/networks/buildnet.ts
🚧 Files skipped from review as they are similar to previous changes (56)
  • packages/extension/src/ui/action/types/updates.ts
  • packages/types/package.json
  • packages/extension/src/libs/background/index.ts
  • packages/extension/src/providers/ethereum/methods/wallet_switchEthereumChain.ts
  • packages/extension/src/providers/ethereum/libs/assets-handlers/assetinfo-mew.ts
  • packages/extension/src/providers/index.ts
  • packages/extension/src/ui/onboard/main.ts
  • packages/extension/src/libs/tokens-state/index.ts
  • packages/extension/src/providers/solana/types/sol-network.ts
  • packages/extension/src/ui/action/store/menu-store.ts
  • packages/types/src/index.ts
  • packages/extension/src/ui/action/components/base-file-picker/index.vue
  • packages/extension/src/ui/action/icons/banners/attractive-apr-icon.vue
  • packages/extension/src/types/env.d.ts
  • packages/extension/src/ui/action/components/app-menu/store.ts
  • packages/extension/src/ui/action/utils/filters.ts
  • packages/extension/src/providers/massa/methods/index.ts
  • packages/extension/src/ui/action/types/network-sort.ts
  • packages/extension/src/ui/onboard/restore-wallet/store.ts
  • packages/extension/src/scripts/inject.ts
  • packages/extension/src/ui/action/utils/browser.ts
  • packages/extension/src/libs/utils/initialize-wallet.ts
  • packages/extension/src/libs/recently-sent-addresses/index.ts
  • packages/extension/src/ui/action/views/network-activity/index.vue
  • packages/extension/src/ui/action/utils/currencyConfig.ts
  • packages/extension/src/ui/action/types/network-category.ts
  • packages/extension/src/providers/massa/methods/massa_getNetwork.ts
  • packages/extension/src/ui/action/views/verify-transaction/index.vue
  • packages/extension/src/ui/action/views/send-transaction/index.vue
  • packages/extension/src/libs/name-resolver/index.ts
  • packages/extension/src/libs/rate-state/index.ts
  • packages/signers/massa/tsconfig.paths.json
  • packages/extension/src/ui/action/App.vue
  • packages/keyring/src/index.ts
  • packages/extension/src/ui/action/views/settings/store.ts
  • packages/extension/src/providers/ethereum/networks/skale/skale-base.ts
  • packages/extension/src/types/base-network.ts
  • packages/extension/src/ui/action/components/base-button/index.vue
  • packages/extension/src/libs/nft-handlers/conflux.ts
  • packages/signers/massa/tsconfig.json
  • packages/extension/src/types/provider.ts
  • packages/extension/src/libs/utils/networks.ts
  • packages/extension/src/providers/massa/methods/massa_setNetwork.ts
  • packages/extension/src/types/activity.ts
  • packages/keyring/src/utils.ts
  • packages/extension/src/providers/massa/methods/massa_getBalance.ts
  • packages/types/src/networks.ts
  • packages/signers/massa/package.json
  • packages/extension/src/providers/massa/ui/settings/index.vue
  • packages/extension/src/providers/massa/index.ts
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue
  • packages/signers/massa/src/index.ts
  • packages/signers/massa/src/libs/ed25519.ts
  • packages/extension/src/providers/massa/networks/massa-base.ts
  • packages/extension/src/providers/massa/ui/send-transaction/index.vue
  • packages/extension/src/providers/massa/types/index.ts
🔇 Additional comments (1)
packages/extension/src/providers/massa/ui/routes/names.ts (1)

1-27: LGTM! Well-structured route configuration.

The route definitions are properly typed and follow Vue Router best practices with lazy loading for optimal performance.

@kvhnuke kvhnuke changed the title Extension Feat: Mesa Network Jul 26, 2025
@kvhnuke kvhnuke changed the base branch from develop to devop/package-updates-2-10 July 26, 2025 04:38
@peterjah peterjah changed the title Feat: Mesa Network Feat: Massa Network Jul 31, 2025
@peterjah
Copy link
Contributor Author

peterjah commented Jul 31, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

♻️ Duplicate comments (6)
packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (2)

117-131: Remove unused global window.massa declaration

The window.massa interface declared here isn't referenced anywhere in this component or across the codebase.


293-301: Improve error handling and remove console statements

The error handling could expose sensitive information and uses console.error in production.

  } catch (error) {
    isProcessing.value = false;
-   errorMsg.value = error instanceof Error ? error.message : String(error);
+   errorMsg.value = error instanceof Error ? error.message : 'Transaction failed';
    trackSendEvents(SendEventType.SendFailed, {
      network: network.value.name,
-     error: errorMsg.value,
+     error: error instanceof Error ? error.message : 'Unknown error',
    });
-   console.error('error', error);
+   // Log to monitoring service if needed
  }
packages/extension/src/providers/massa/ui/send-transaction/index.vue (4)

377-379: Add error logging in catch blocks.

Empty catch blocks make debugging difficult. Consider logging errors.

  } catch (error) {
+   console.error('Failed to fetch minimal fee:', error);
    // Keep default fee of 0.01 if API call fails
  }

386-397: Avoid mutating computed property values directly.

The account is a computed property, and mutating account.value.balance directly can lead to reactivity issues. Consider using a separate reactive ref for the balance.

+const accountBalance = ref<string>('0');
+
 const updateAccountBalance = async () => {
   if (addressFrom.value) {
     try {
       const api = (await network.value.api()) as MassaAPI;
       const balance = await api.getBalance(addressFrom.value);
-      // Update the account object with the new balance
-      if (account.value) {
-        account.value.balance = balance;
-      }
-    } catch (error) {}
+      accountBalance.value = balance;
+    } catch (error) {
+      console.error('Failed to update balance:', error);
+    }
   }
 };

578-578: Add error handling for transaction preparation.

The empty catch block could hide important errors during transaction preparation.

-  } catch (error) {}
+  } catch (error) {
+    console.error('Failed to prepare transaction:', error);
+    // Consider showing user-friendly error message
+  }

395-395: Add error handling in empty catch block

Empty catch blocks make debugging difficult and can hide important errors.

-    } catch (error) {}
+    } catch (error) {
+      console.error('Failed to update account balance:', error);
+    }
🧹 Nitpick comments (3)
packages/extension/src/providers/massa/ui/send-transaction/components/send-token-select.vue (1)

54-55: Remove duplicate CSS property

The box-sizing: border-box; property is declared twice.

  box-sizing: border-box;
  border: 1px solid @gray02;
-  box-sizing: border-box;
  border-radius: 10px;
packages/extension/src/providers/massa/libs/api.ts (1)

24-24: Document or implement the empty init method

The init() method is empty. If initialization is not required, consider adding a comment explaining why, or implement any necessary initialization logic.

-  async init(): Promise<void> {}
+  async init(): Promise<void> {
+    // No initialization required for Massa API
+  }
packages/extension/src/ui/action/views/network-assets/components/custom-massa-token.vue (1)

204-253: Well-structured token addition with appropriate fallbacks

The implementation properly handles the addition of Massa tokens with appropriate fallbacks for unavailable market data. Consider adding a TODO comment for future price data integration when Massa market APIs become available.

    // For Massa tokens, we'll use default values since market data is not available
+   // TODO: Integrate with Massa market data APIs when available
    const price = '0';
    const priceChangePercentage = 0;
    const sparklineData = '';
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ffd594 and 04b2919.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (52)
  • packages/extension/package.json (1 hunks)
  • packages/extension/src/libs/background/index.ts (1 hunks)
  • packages/extension/src/libs/background/types.ts (3 hunks)
  • packages/extension/src/libs/tokens-state/index.ts (3 hunks)
  • packages/extension/src/libs/tokens-state/types.ts (1 hunks)
  • packages/extension/src/libs/utils/initialize-wallet.ts (3 hunks)
  • packages/extension/src/libs/utils/networks.ts (4 hunks)
  • packages/extension/src/providers/index.ts (2 hunks)
  • packages/extension/src/providers/massa/index.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/activity-handlers/index.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/activity-handlers/massa.ts (1 hunks)
  • packages/extension/src/providers/massa/libs/api.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/index.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getBalance.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_getNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/methods/massa_setNetwork.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/buildnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/index.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/mainnet.ts (1 hunks)
  • packages/extension/src/providers/massa/networks/massa-base.ts (1 hunks)
  • packages/extension/src/providers/massa/types/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/libs/signer.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/index.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/routes/names.ts (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-token-select.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/index.vue (1 hunks)
  • packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (1 hunks)
  • packages/extension/src/scripts/inject.ts (2 hunks)
  • packages/extension/src/types/activity.ts (4 hunks)
  • packages/extension/src/types/base-network.ts (3 hunks)
  • packages/extension/src/types/provider.ts (5 hunks)
  • packages/extension/src/ui/action/App.vue (2 hunks)
  • packages/extension/src/ui/action/views/network-activity/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/network-assets/components/custom-massa-token.vue (1 hunks)
  • packages/extension/src/ui/action/views/network-assets/index.vue (3 hunks)
  • packages/extension/src/ui/action/views/send-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/action/views/verify-transaction/index.vue (2 hunks)
  • packages/extension/src/ui/provider-pages/routes.ts (2 hunks)
  • packages/keyring/package.json (1 hunks)
  • packages/keyring/src/index.ts (2 hunks)
  • packages/keyring/src/utils.ts (1 hunks)
  • packages/signers/massa/package.json (1 hunks)
  • packages/signers/massa/src/index.ts (1 hunks)
  • packages/signers/massa/src/libs/ed25519.ts (1 hunks)
  • packages/signers/massa/tests/sign.test.ts (1 hunks)
  • packages/signers/massa/tsconfig.json (1 hunks)
  • packages/signers/massa/tsconfig.paths.json (1 hunks)
  • packages/types/package.json (1 hunks)
  • packages/types/src/index.ts (1 hunks)
  • packages/types/src/networks.ts (2 hunks)
✅ Files skipped from review due to trivial changes (9)
  • packages/extension/src/providers/massa/networks/index.ts
  • packages/extension/src/providers/massa/networks/buildnet.ts
  • packages/extension/src/providers/massa/libs/activity-handlers/index.ts
  • packages/keyring/package.json
  • packages/extension/src/providers/massa/networks/mainnet.ts
  • packages/extension/src/libs/tokens-state/types.ts
  • packages/extension/src/ui/provider-pages/routes.ts
  • packages/types/package.json
  • packages/signers/massa/tests/sign.test.ts
🚧 Files skipped from review as they are similar to previous changes (35)
  • packages/extension/package.json
  • packages/extension/src/providers/index.ts
  • packages/signers/massa/tsconfig.json
  • packages/extension/src/scripts/inject.ts
  • packages/extension/src/ui/action/App.vue
  • packages/signers/massa/tsconfig.paths.json
  • packages/extension/src/providers/massa/methods/massa_getBalance.ts
  • packages/extension/src/providers/massa/methods/index.ts
  • packages/extension/src/providers/massa/networks/massa-base.ts
  • packages/keyring/src/index.ts
  • packages/signers/massa/src/index.ts
  • packages/extension/src/types/base-network.ts
  • packages/extension/src/ui/action/views/verify-transaction/index.vue
  • packages/extension/src/providers/massa/methods/massa_setNetwork.ts
  • packages/extension/src/providers/massa/index.ts
  • packages/signers/massa/package.json
  • packages/extension/src/ui/action/views/send-transaction/index.vue
  • packages/extension/src/types/activity.ts
  • packages/extension/src/libs/tokens-state/index.ts
  • packages/keyring/src/utils.ts
  • packages/signers/massa/src/libs/ed25519.ts
  • packages/extension/src/providers/massa/methods/massa_getNetwork.ts
  • packages/types/src/index.ts
  • packages/extension/src/libs/utils/networks.ts
  • packages/extension/src/providers/massa/ui/send-transaction/components/send-address-input.vue
  • packages/types/src/networks.ts
  • packages/extension/src/libs/utils/initialize-wallet.ts
  • packages/extension/src/libs/background/index.ts
  • packages/extension/src/libs/background/types.ts
  • packages/extension/src/providers/massa/ui/routes/index.ts
  • packages/extension/src/providers/massa/ui/index.ts
  • packages/extension/src/ui/action/views/network-activity/index.vue
  • packages/extension/src/providers/massa/ui/routes/names.ts
  • packages/extension/src/providers/massa/ui/libs/signer.ts
  • packages/extension/src/types/provider.ts
🔇 Additional comments (5)
packages/extension/src/providers/massa/libs/activity-handlers/massa.ts (1)

6-26: Well-structured activity handler implementation

The error handling and async implementation are appropriate. The TODO comment clearly indicates future enhancement plans.

packages/extension/src/ui/action/views/network-assets/index.vue (2)

62-68: Proper extension of network-specific token support

The conditional rendering for Massa tokens follows the established pattern for EVM tokens, maintaining consistency in the codebase.


155-162: Well-implemented network type detection

Good use of computed properties with enum comparison for type-safe network detection.

packages/extension/src/ui/action/views/network-assets/components/custom-massa-token.vue (1)

173-180: TokenType.ERC20 usage is intentional and consistent

The TokenType enum only defines ERC20 (see packages/extension/src/libs/tokens-state/types.ts), and throughout the codebase—EVM tokens, Massa provider checks, wallet integration—all custom tokens are handled under TokenType.ERC20. No separate MASSA or MRC20 value exists, so using TokenType.ERC20 for Massa tokens aligns with current design.

packages/extension/src/providers/massa/ui/send-transaction/index.vue (1)

407-407: Add error handling in empty catch block

Empty catch blocks make debugging difficult and can hide important errors.

   } catch (error) {
     console.error('Failed to fetch MAS token info:', error);
   }

Likely an incorrect or invalid review comment.

@peterjah peterjah marked this pull request as ready for review July 31, 2025 14:17
@kvhnuke kvhnuke mentioned this pull request Aug 6, 2025
@kvhnuke kvhnuke deleted the branch enkryptcom:devop/package-updates-2-10 August 7, 2025 19:34
@kvhnuke kvhnuke closed this Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants