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
16 changes: 8 additions & 8 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,6 @@
"count": 2
}
},
"packages/solana-wallet-snap/src/core/services/assets/adapters/SnapAssetsAdapter.ts": {
"@typescript-eslint/await-thenable": {
"count": 1
},
"no-unused-private-class-members": {
"count": 2
}
},
"packages/solana-wallet-snap/src/core/services/assets/TokenHelper.test.ts": {
"@typescript-eslint/no-explicit-any": {
"count": 1
Expand All @@ -368,6 +360,14 @@
"count": 1
}
},
"packages/solana-wallet-snap/src/core/services/assets/adapters/SnapAssetsAdapter.ts": {
"@typescript-eslint/await-thenable": {
"count": 1
},
"no-unused-private-class-members": {
"count": 2
}
},
"packages/solana-wallet-snap/src/core/services/config/ConfigProvider.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
Expand Down
7 changes: 5 additions & 2 deletions packages/snap-networks-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
### Added

- **BREAKING** Replace the logger utilities with a configurable `Logger` class that requires a log level and supports level filtering, per-instance prefixes, and method decorators.
- Add a `safeMerge` utility for shallowly merging objects.

### Changed

- **BREAKING** Replace the logger utilities with a configurable `Logger` class that requires a log level and supports level filtering, per-instance prefixes, and method decorators. ([#136](https://github.com/MetaMask/internal-snaps/pull/136))
- Bump `@metamask/utils` from `^11.9.0` to `^11.11.9` ([#161](https://github.com/MetaMask/internal-snaps/pull/161))

## [1.0.0]
Expand Down
1 change: 1 addition & 0 deletions packages/snap-networks-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export {
RemoteFeatureFlagsProvider,
type RemoteFeatureFlagsProviderMessenger,
} from './providers/remote-feature-flags/RemoteFeatureFlagsProvider';
export { safeMerge } from './safeMerge';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not related to this PR

but can we add export of logger too? it seem missing?

Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ describe('State', () => {
expect(stateValue).toStrictEqual(DEFAULT_STATE);
});

it('preserves defaults when persisted state values are undefined', async () => {
snap.request.mockResolvedValue({ users: undefined });

expect(await state.get()).toStrictEqual(DEFAULT_STATE);
});

describe('when getting serialized non-JSON values', () => {
it('deserializes undefined values', async () => {
const mockUnderlyingState = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */

import type { Transaction } from '@metamask/keyring-api';
import { safeMerge } from '@metamask/snap-networks-utils';
import type { Address, Signature } from '@solana/kit';
import type { MutexInterface } from 'async-mutex';
import { Mutex } from 'async-mutex';
Expand All @@ -16,7 +17,6 @@ import type { SpotPrices } from '../../clients/price-api/types';
import { deserialize } from '../../serialization/deserialize';
import { serialize } from '../../serialization/serialize';
import type { Serializable } from '../../serialization/types';
import { safeMerge } from '../../utils/safeMerge';
import type { IStateManager } from './IStateManager';

export type AccountId = string;
Expand Down
28 changes: 0 additions & 28 deletions packages/solana-wallet-snap/src/core/utils/safeMerge.ts

This file was deleted.

6 changes: 6 additions & 0 deletions packages/tron-wallet-snap/src/services/state/State.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ describe('State', () => {
expect(stateValue).toStrictEqual(DEFAULT_STATE);
});

it('preserves defaults when persisted state values are undefined', async () => {
snap.request.mockResolvedValue({ users: undefined });

expect(await state.get()).toStrictEqual(DEFAULT_STATE);
});

describe('when getting serialized non-JSON values', () => {
it('deserializes undefined values', async () => {
const mockUnderlyingState = {
Expand Down
2 changes: 1 addition & 1 deletion packages/tron-wallet-snap/src/services/state/State.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Transaction } from '@metamask/keyring-api';
import { safeMerge } from '@metamask/snap-networks-utils';
import type { MutexInterface } from 'async-mutex';
import { Mutex } from 'async-mutex';
import { unset } from 'lodash';

import type { SpotPrices } from '../../clients/price-api/types';
import type { AssetEntity } from '../../entities/assets';
import type { TronKeyringAccount } from '../../entities/keyring-account';
import { safeMerge } from '../../utils/safeMerge';
import { deserialize } from '../../utils/serialization/deserialize';
import { serialize } from '../../utils/serialization/serialize';
import type { Serializable } from '../../utils/serialization/types';
Expand Down
119 changes: 0 additions & 119 deletions packages/tron-wallet-snap/src/utils/safeMerge.test.ts

This file was deleted.