Feat: Massa Network#734
Feat: Massa Network#734peterjah wants to merge 3 commits intoenkryptcom:devop/package-updates-2-10from
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (3)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis 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
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
Estimated code review effort🎯 5 (Critical) | ⏱️ ~90+ minutes
Possibly related PRs
✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
addc7bf to
45a4fc2
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
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
fetchresolves even for 4xx/5xx responses, thereforeres.json()will be invoked on an HTML error page and throw, leading to the genericnullreturn. Guarding with an!res.okcheck 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 beundefined, leading to BigNumber operations onundefinedfurther 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 blockAdds a defensive check to avoid silent
undefinedpropagation.packages/extension/src/ui/action/components/app-menu/store.ts (1)
5-8: Duplicate Pinia store id (restoreWallet) will clash
useOnboardStoreis registered with the same id'restoreWallet'thatuseRestoreStoreuses (seeonboard/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 constantThe literal default object is inlined here, while the same shape is replicated in multiple setters further below.
Moving it to a top-levelDEFAULT_STATEconstant 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 / settersThe three property-specific pairs (
getLastVersionViewed/setLastVersionViewed, etc.) follow an identical pattern:
getState()- read/merge a single property
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 messageThe 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
fromaddresses 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:valuefshould be a formatted representation, not a raw string
valuefis currently identical tovalue, 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
delare→declare-// Required to make the `delare global` exports work for some reason +// Required to make the `declare global` exports work for some reasonpackages/extension/src/libs/background/index.ts (1)
45-52: Consider deriving#tabProviderskeys fromProviderNameenum to avoid future omissionsManually 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-optimisationYou 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 addedAn 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 inparseCurrency
BigNumber(finalValue)is created only to compare against a literal. Converting the JS number back into aBigNumberis 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 loopResolution 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
AggregateErroras needed).packages/extension/src/providers/massa/ui/index.ts (1)
4-7: Type safety enhancementIf
getRoutesever returnsundefined, the current object would violateUIExportOptions. 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
sendandmassaSendTransactionroutes 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 = newListoutside 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
fromRPCUrlmethod already returns aJsonRpcPublicProvider, 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 anytype 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
withZeroByteparameter 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 statesFor 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 declarationThe
window.massainterface declaration appears to be unused in this component.Remove the unused global declaration to reduce code clutter.
243-248: Inconsistent timeout valuesThe 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
-25on 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
hasEnoughBalanceandinsufficientAmount. 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
⛔ Files ignored due to path filters (1)
yarn.lockis 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 ofparseCurrencyand trailing comma.
- Make sure
parseCurrencyis actually exported from../utils/filters; otherwise the module will fail at runtime.- 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 onlyThe 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-devversion of@massalabs/massa-web3The
-devtag 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 todependenciesif it is required at runtime.packages/extension/src/libs/utils/number-formatter.ts (1)
532-542: Trailing comma change is fineThe 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 LGTMSingle-line import improves readability; no functional change.
packages/extension/src/providers/bitcoin/types/bitcoin-network.ts (1)
12-13: Import compression LGTMConsistent with other provider files; no behaviour impact.
packages/extension/src/providers/polkadot/types/substrate-network.ts (1)
11-12: Import compression LGTMStylistic 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 fornodeSome consumers of
EvmNetwork.nodeexpect an HTTPS JSON-RPC endpoint and will fail if they receive a WSS URL. Please verify that all call-sites (e.g., the generic EthereumAPIclass) can handlewss://…for SKALE; otherwise provide bothhttpsandwssvariants or rename the field to clarify intent.packages/extension/src/ui/action/types/network-category.ts (1)
1-5: Syntax fix looks goodThe stray semicolon was removed; enum is now valid TypeScript.
packages/extension/package.json (1)
42-42: Verify the pinned dev build of@massalabs/massa-web3The version
5.2.1-dev.20250722105131is a timestamped prerelease.
Ensure:
- The package exists on the registry and is pulled by CI.
- 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 fineSwitched to single quotes; consistent with project style.
packages/keyring/package.json (1)
28-29: Addition of@enkryptcom/signer-massaacknowledgedDependency 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 existThe extra semicolon is 👍.
Just double-check thatglobalThis.__ENKRYPT_DEBUG_LOG_CONF__is declared somewhere (e.g. in aglobal.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 missAdding
MassaUIhere makes sense. Make sure every view exported by@/providers/massa/uiuses uniquenamefields; 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 syntaxThe 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 fineNo 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
ed25519masentry is required for Massa support, but please double-check:
- Signer implementation is registered in keyring (
MassaSigner) and exported.- All switch/lookup statements that enumerate
SignerTypeinclude the new value (e.g., UI filters, validation helpers).- 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 goodOnly 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
addRecentlySentAddressperforms a classic read-modify-write. If two tabs call this method simultaneously, the latersetcan clobber the first one and lose an address.A cheap mitigation is to retry on write conflict, or (better) expose an atomic
updatemethod insideBrowserStoragethat 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 acceptedVisual 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 readabilityNo 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
buyLinkproperty 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.massakey.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 ifstatement 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
SendTransactionMassato thesendLayoutsmapping 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.massaandProviderType.massavalues.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 typeThe 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–19if (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
rawInfoproperty 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
lettoconstfor theallItemsarray prevents accidental mutations and follows JavaScript best practices.
26-31: Great use of const for immutable response object.The
nftBalancesresponse object is never reassigned, so usingconstis the correct choice here.
36-53: Consistent immutability improvements in the loop.All variables (
collection,contract,items,nftCollection) are appropriately declared asconstsince they're never reassigned. This makes the code more predictable and follows best practices.
62-73: Good immutability practices in helper function.Both
itemResponseanditemsare correctly declared asconstsince 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
MassaSignerforSignerType.ed25519masfollows 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 goodThe 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.MainnetandCHAIN_ID.Mainnetimports 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 inBaseNetworkOptionsproperly extends the interface to support Massa networks. The formatting maintains consistency with existing entries.
85-86: LGTM: Matching class property type update.The
BaseNetworkclass 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
sendLayoutsmapping 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 toNetworkNames.Massaensures 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
OperationStatusfrom 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
isActivityUpdatingcheck- Correctly maps
SuccessandSpeculativeSuccessto 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
isValidMassaAddresshelper function properly validates Massa addresses by leveraging the officialAddress.fromStringmethod 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
getCustomErrorutility.packages/extension/src/types/provider.ts (3)
36-36: LGTM: Massa provider enum additions are consistent and necessary.The additions of
massato bothProviderNameandProviderTypeenums 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
OperationStatusand its addition to thegetTransactionStatusreturn 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 thresholdI didn’t find any
ADDRESS_LENGTHconstant or documentation reference for Massa addresses in the codebase or in@massalabs/massa-web3. The> 66check in your computedmassaAddressis therefore arbitrary—and sincenetwork.displayAddressfor 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
66with a shared constant (e.g. exported bymassa-web3), or- Remove the length‐based branch entirely and rely on
Address.fromStringfor 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 configurationYour Vite setup uses
vite-plugin-node-polyfillswith"buffer"included (see lines 63–67 inpackages/extension/vite.config.ts), soBuffer.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
setRequestProviderto 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.
packages/extension/src/providers/massa/libs/accounts-state/index.ts
Outdated
Show resolved
Hide resolved
packages/extension/src/providers/massa/libs/accounts-state/index.ts
Outdated
Show resolved
Hide resolved
packages/extension/src/providers/massa/libs/accounts-state/index.ts
Outdated
Show resolved
Hide resolved
88412ec to
4ffd594
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
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 statementsThe 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 unusednetworkparameter.The
networkparameter 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
⛔ Files ignored due to path filters (1)
yarn.lockis 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.
packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue
Outdated
Show resolved
Hide resolved
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 7
♻️ Duplicate comments (6)
packages/extension/src/providers/massa/ui/send-transaction/verify-transaction/index.vue (2)
117-131: Remove unused globalwindow.massadeclarationThe
window.massainterface declared here isn't referenced anywhere in this component or across the codebase.
293-301: Improve error handling and remove console statementsThe 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
accountis a computed property, and mutatingaccount.value.balancedirectly 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 blockEmpty 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 propertyThe
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 methodThe
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 fallbacksThe 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
⛔ Files ignored due to path filters (1)
yarn.lockis 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 implementationThe 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 supportThe conditional rendering for Massa tokens follows the established pattern for EVM tokens, maintaining consistency in the codebase.
155-162: Well-implemented network type detectionGood 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 consistentThe
TokenTypeenum only definesERC20(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 underTokenType.ERC20. No separateMASSAorMRC20value exists, so usingTokenType.ERC20for 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 blockEmpty 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.
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Documentation
Tests
Chores