Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .eslintrc.js

This file was deleted.

17 changes: 17 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 80,
"quoteProps": "as-needed",
"singleQuote": true,
"sortImports": {
"newlinesBetween": false,
"groups": [
["builtin", "external"],
{ "newlinesBetween": true },
["internal", "parent", "sibling", "index", "unknown"]
]
},
"tabWidth": 2,
"trailingComma": "all",
"ignorePatterns": [".yarnrc.yml", "merged-packages/**"]
}
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default createConfig([
'@typescript-eslint/no-explicit-any': 'error',
'id-length': ['warn', { exceptions: ['t'] }], // Used for the localized translator helper.
'prettier/prettier': 'error',
'jsdoc/require-jsdoc': 'off',
},
},
{
Expand All @@ -36,6 +37,7 @@ export default createConfig([
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-param-description': 'off',
'jest/unbound-method': 'off',
},
},
{
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"@commitlint/config-conventional": "^20.2.0",
"@lavamoat/allow-scripts": "^3.3.3",
"@lavamoat/preinstall-always-fail": "^2.1.0",
"@metamask/eslint-config": "^14.0.0",
"@metamask/eslint-config-jest": "^14.0.0",
"@metamask/eslint-config-nodejs": "^14.0.0",
"@metamask/eslint-config-typescript": "^14.0.0",
"@metamask/eslint-config": "^15.0.0",
"@metamask/eslint-config-jest": "^15.0.0",
"@metamask/eslint-config-nodejs": "^15.0.0",
"@metamask/eslint-config-typescript": "^15.0.0",
"depcheck": "^1.4.7",
"eslint": "^9.26.0",
"eslint": "^9.39.1",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^4.3.4",
"eslint-plugin-import-x": "^4.11.1",
Expand All @@ -52,12 +52,13 @@
"eslint-plugin-prettier": "^5.4.0",
"eslint-plugin-promise": "^7.2.1",
"husky": "^9.1.7",
"oxfmt": "^0.45.0",
"prettier": "^3.5.3",
"prettier-plugin-packagejson": "^2.5.13",
"rimraf": "^6.0.1",
"tsx": "^4.20.5",
"typescript": "~5.8.3",
"typescript-eslint": "8.32.1"
"typescript-eslint": "^8.48.0"
},
"resolutions": {
"@metamask/snaps-sdk": "^11.1.0",
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"test:integration": "./integration-test/run-integration.sh"
},
"devDependencies": {
"@metamask/auto-changelog": "^3.4.4",
"@metamask/auto-changelog": "^6.1.0",
"@metamask/key-tree": "^10.1.1",
"@metamask/keyring-api": "^23.3.0",
"@metamask/keyring-snap-sdk": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snap-stellar-wallet.git"
},
"source": {
"shasum": "Inf8VxNlsHTyLYST3nsK1X0sdkSiAbkFciLrCTsYZNY=",
"shasum": "OSmbC+L8AVn4zzcmws+KALtq/ySTN2UISiFuV663ybs=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/snap/src/api/address.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { refine, string, nonempty, type Infer } from '@metamask/superstruct';
import { refine, string, nonempty } from '@metamask/superstruct';
import type { Infer } from '@metamask/superstruct';
import { StrKey } from '@stellar/stellar-sdk';

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/snap/src/api/integer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { nonempty, refine, string, type Infer } from '@metamask/superstruct';
import { nonempty, refine, string } from '@metamask/superstruct';
import type { Infer } from '@metamask/superstruct';
import { BigNumber } from 'bignumber.js';

import { MAX_INT64, STELLAR_DECIMAL_PLACES } from '../constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/snap/src/api/xdr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Networks,
Operation,
TransactionBuilder,
type xdr,
} from '@stellar/stellar-sdk';
import type { xdr } from '@stellar/stellar-sdk';

import { SwapTransactionXdrStruct } from './xdr';

Expand Down
3 changes: 1 addition & 2 deletions packages/snap/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import {
} from './services/asset-metadata';
import { InMemoryCache } from './services/cache';
import { NetworkService } from './services/network';
import type { OnChainAccountState } from './services/on-chain-account';
import {
OnChainAccountRepository,
OnChainAccountService,
Expand Down Expand Up @@ -71,7 +70,7 @@ const state = new State({
assets: {},
transactions: {},
lastScanTokens: {},
onChainAccounts: {} as OnChainAccountState['onChainAccounts'],
onChainAccounts: {},
},
});

Expand Down
8 changes: 4 additions & 4 deletions packages/snap/src/handlers/accountResolver.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { KnownCaip2ChainId } from '../api';
import { AppConfig } from '../config';
import {
assertSameAddress,
type AccountService,
type StellarKeyringAccount,
import { assertSameAddress } from '../services/account';
import type {
AccountService,
StellarKeyringAccount,
} from '../services/account';
import { AccountNotActivatedException } from '../services/network/exceptions';
import type { OnChainAccountService } from '../services/on-chain-account';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ import { UserRejectedRequestError } from '@metamask/snaps-sdk';
import { Networks } from '@stellar/stellar-sdk';
import { BigNumber } from 'bignumber.js';

import {
ClientRequestMethod,
ChangeTrustOptAction,
type ChangeTrustOptJsonRpcRequest,
} from './api';
import { ClientRequestMethod, ChangeTrustOptAction } from './api';
import type { ChangeTrustOptJsonRpcRequest } from './api';
import { ChangeTrustOptHandler } from './changeTrustOpt';
import { KnownCaip2ChainId, type KnownCaip19ClassicAssetId } from '../../api';
import { KnownCaip2ChainId } from '../../api';
import type { KnownCaip19ClassicAssetId } from '../../api';
import { METAMASK_ORIGIN } from '../../constants';
import { AccountService } from '../../services/account';
import { generateStellarKeyringAccount } from '../../services/account/__mocks__/account.fixtures';
Expand Down
9 changes: 5 additions & 4 deletions packages/snap/src/handlers/clientRequest/changeTrustOpt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
ChangeTrustOptJsonRpcResponseStruct,
} from './api';
import { assertRefreshedTransactionFeeNotHigher } from './utils';
import {
type AccountResolver,
type ResolvedActivatedAccount,
import type {
AccountResolver,
ResolvedActivatedAccount,
} from '../accountResolver';
import { BaseClientRequestHandler } from './base';
import { METAMASK_ORIGIN } from '../../constants';
Expand All @@ -36,7 +36,8 @@ import type {
import { ConfirmationInterfaceKey } from '../../ui/confirmation/api';
import type { ConfirmationUXController } from '../../ui/confirmation/controller';
import { render as renderAccountActivationPrompt } from '../../ui/confirmation/views/AccountActivationPrompt/render';
import { createPrefixedLogger, type ILogger } from '../../utils/logger';
import { createPrefixedLogger } from '../../utils/logger';
import type { ILogger } from '../../utils/logger';
import {
trackTransactionAdded,
trackTransactionApproved,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { FeeType } from '@metamask/keyring-api';
import { Networks } from '@stellar/stellar-sdk';

import { ClientRequestMethod, type ComputeFeeJsonRpcRequest } from './api';
import { ClientRequestMethod } from './api';
import type { ComputeFeeJsonRpcRequest } from './api';
import { ComputeFeeHandler } from './computeFee';
import { KnownCaip19Slip44IdMap, KnownCaip2ChainId } from '../../api';
import { NATIVE_ASSET_SYMBOL } from '../../constants';
Expand Down
6 changes: 3 additions & 3 deletions packages/snap/src/handlers/clientRequest/computeFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
ComputeFeeJsonRpcRequestStruct,
ComputeFeeJsonRpcResponseStruct,
} from './api';
import {
type AccountResolver,
type ResolvedActivatedAccount,
import type {
AccountResolver,
ResolvedActivatedAccount,
} from '../accountResolver';
import { BaseClientRequestHandler } from './base';
import { KnownCaip19Slip44IdMap } from '../../api';
Expand Down
15 changes: 6 additions & 9 deletions packages/snap/src/handlers/clientRequest/confirmSend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ import {
import { Networks } from '@stellar/stellar-sdk';
import { BigNumber } from 'bignumber.js';

import {
ClientRequestMethod,
MultiChainSendErrorCodes,
type ConfirmSendJsonRpcRequest,
} from './api';
import { ClientRequestMethod, MultiChainSendErrorCodes } from './api';
import type { ConfirmSendJsonRpcRequest } from './api';
import { ConfirmSendHandler } from './confirmSend';
import {
KnownCaip2ChainId,
type KnownCaip19ClassicAssetId,
type KnownCaip19Sep41AssetId,
import { KnownCaip2ChainId } from '../../api';
import type {
KnownCaip19ClassicAssetId,
KnownCaip19Sep41AssetId,
} from '../../api';
import { METAMASK_ORIGIN } from '../../constants';
import { AccountService } from '../../services/account';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { BigNumber } from 'bignumber.js';
import type { GetAccountAssetInfoJsonRpcResponse } from './api';
import { ClientRequestMethod } from './api';
import { GetAccountAssetInfoHandler } from './getAccountAssetInfo';
import { type KnownCaip19ClassicAssetId, KnownCaip2ChainId } from '../../api';
import { KnownCaip2ChainId } from '../../api';
import type { KnownCaip19ClassicAssetId } from '../../api';
import { AccountService } from '../../services/account';
import { generateStellarKeyringAccount } from '../../services/account/__mocks__/account.fixtures';
import { USDC_CLASSIC } from '../../services/asset-metadata/__mocks__/assets.fixtures';
Expand All @@ -13,8 +14,8 @@ import {
DEFAULT_MOCK_ACCOUNT_WITH_BALANCES,
horizonSource,
mockOnChainAccountService,
type MockAccountWithBalancesData,
} from '../../services/on-chain-account/__mocks__/onChainAccount.fixtures';
import type { MockAccountWithBalancesData } from '../../services/on-chain-account/__mocks__/onChainAccount.fixtures';
import { OnChainAccount } from '../../services/on-chain-account/OnChainAccount';
import { WalletService } from '../../services/wallet';
import { getTestWallet } from '../../services/wallet/__mocks__/wallet.fixtures';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
isClassicAssetId,
isSlip44Id,
toDisplayBalance,
type ILogger,
} from '../../utils';
import type { ILogger } from '../../utils';
import type {
AccountResolver,
ResolvedActivatedAccount,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { JsonRpcRequest } from '@metamask/utils';

import {
ClientRequestMethod,
MultiChainSendErrorCodes,
type OnAddressInputJsonRpcRequest,
} from './api';
import { ClientRequestMethod, MultiChainSendErrorCodes } from './api';
import type { OnAddressInputJsonRpcRequest } from './api';
import { OnAddressInputHandler } from './onAddressInput';

jest.mock('../../utils/logger');
Expand Down
15 changes: 6 additions & 9 deletions packages/snap/src/handlers/clientRequest/onAmountInput.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { InvalidParamsError } from '@metamask/snaps-sdk';
import { BigNumber } from 'bignumber.js';

import {
ClientRequestMethod,
MultiChainSendErrorCodes,
type OnAmountInputJsonRpcRequest,
} from './api';
import { ClientRequestMethod, MultiChainSendErrorCodes } from './api';
import type { OnAmountInputJsonRpcRequest } from './api';
import { OnAmountInputHandler } from './onAmountInput';
import {
KnownCaip2ChainId,
type KnownCaip19ClassicAssetId,
type KnownCaip19Sep41AssetId,
import { KnownCaip2ChainId } from '../../api';
import type {
KnownCaip19ClassicAssetId,
KnownCaip19Sep41AssetId,
} from '../../api';
import { AccountService } from '../../services/account';
import { generateStellarKeyringAccount } from '../../services/account/__mocks__/account.fixtures';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { FeeType, TransactionType } from '@metamask/keyring-api';
import { Networks } from '@stellar/stellar-sdk';

import {
ClientRequestMethod,
type SignAndSendTransactionJsonRpcRequest,
} from './api';
import { ClientRequestMethod } from './api';
import type { SignAndSendTransactionJsonRpcRequest } from './api';
import { SignAndSendTransactionHandler } from './signAndSendTransaction';
import { KnownCaip19Slip44IdMap, KnownCaip2ChainId } from '../../api';
import { METAMASK_ORIGIN } from '../../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
SignAndSendTransactionJsonRpcRequestStruct,
SignAndSendTransactionJsonRpcResponseStruct,
} from './api';
import {
type KnownCaip19AssetIdOrSlip44Id,
type KnownCaip2ChainId,
import type {
KnownCaip19AssetIdOrSlip44Id,
KnownCaip2ChainId,
} from '../../api';
import {
type AccountResolver,
type ResolvedActivatedAccount,
import type {
AccountResolver,
ResolvedActivatedAccount,
} from '../accountResolver';
import { BaseClientRequestHandler } from './base';
import { METAMASK_ORIGIN, STELLAR_DECIMAL_PLACES } from '../../constants';
Expand Down
6 changes: 2 additions & 4 deletions packages/snap/src/handlers/clientRequest/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import {
type Transaction,
TransactionValidationException,
} from '../../services/transaction';
import { TransactionValidationException } from '../../services/transaction';
import type { Transaction } from '../../services/transaction';

/**
* Guards the user-approved fee during submit-time transaction refresh.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { KnownCaip2ChainId } from '../../../../api';
import {
ConfirmationInterfaceKey,
type ContextWithPrices,
FetchStatus,
} from '../../../../ui/confirmation/api';
import type { ContextWithPrices } from '../../../../ui/confirmation/api';
import { getSlip44AssetId } from '../../../../utils';
import type { RefreshConfirmationContextParams } from '../../api';
import {
ConfirmationContextRefresherKey,
type ConfirmationDataContext,
} from '../api';
import { ConfirmationContextRefresherKey } from '../api';
import type { ConfirmationDataContext } from '../api';

const scope = KnownCaip2ChainId.Testnet;
const nativeAssetId = getSlip44AssetId(scope);
Expand Down
Loading
Loading