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
100 changes: 0 additions & 100 deletions eslint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -1352,15 +1352,7 @@
"count": 20
}
},
"packages/tron-wallet-snap/src/caching/InMemoryCache.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/caching/StateCache.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
},
"no-restricted-syntax": {
"count": 1
}
Expand All @@ -1375,20 +1367,7 @@
"count": 2
}
},
"packages/tron-wallet-snap/src/clients/price-api/PriceApiClient.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/clients/price-api/types.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/clients/security-alerts-api/utils.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
},
"no-restricted-syntax": {
"count": 5
}
Expand All @@ -1401,11 +1380,6 @@
"count": 1
}
},
"packages/tron-wallet-snap/src/clients/token-api/TokenApiClient.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/clients/trongrid/TrongridApiClient.test.ts": {
"require-atomic-updates": {
"count": 1
Expand All @@ -1424,16 +1398,6 @@
"count": 42
}
},
"packages/tron-wallet-snap/src/handlers/clientRequest/clientRequest.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/handlers/clientRequest/validation.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/handlers/cronjob/cronjob.test.tsx": {
"@typescript-eslint/explicit-function-return-type": {
"count": 2
Expand All @@ -1452,11 +1416,6 @@
"count": 1
}
},
"packages/tron-wallet-snap/src/services/accounts/AccountsService.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/assets/AssetsRepository.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 2
Expand All @@ -1470,16 +1429,6 @@
"count": 1
}
},
"packages/tron-wallet-snap/src/services/assets/adapters/SnapAssetsAdapter.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/config/ConfigProvider.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/send/FeeCalculatorService.ts": {
"no-restricted-syntax": {
"count": 1
Expand All @@ -1493,11 +1442,6 @@
"count": 15
}
},
"packages/tron-wallet-snap/src/services/send/SendService.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/send/TransactionExpirationRefresherService.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 5
Expand All @@ -1508,11 +1452,6 @@
"count": 7
}
},
"packages/tron-wallet-snap/src/services/staking/StakingService.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/state/State.test.ts": {
"@typescript-eslint/explicit-function-return-type": {
"count": 1
Expand All @@ -1521,11 +1460,6 @@
"count": 1
}
},
"packages/tron-wallet-snap/src/services/transaction-expiration-refresher/TransactionExpirationRefresherService.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/transaction-scan/TransactionScanService.ts": {
"no-restricted-syntax": {
"count": 5
Expand All @@ -1542,14 +1476,6 @@
},
"@typescript-eslint/no-explicit-any": {
"count": 7
},
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/services/wallet/WalletService.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/ui/confirmation/components/TransactionAlert/TransactionAlert.test.tsx": {
Expand All @@ -1568,9 +1494,6 @@
"packages/tron-wallet-snap/src/ui/confirmation/views/ConfirmSignMessage/render.test.tsx": {
"@typescript-eslint/no-explicit-any": {
"count": 3
},
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/ui/confirmation/views/ConfirmSignTransaction/ConfirmSignTransaction.test.tsx": {
Expand All @@ -1581,14 +1504,6 @@
"packages/tron-wallet-snap/src/ui/confirmation/views/ConfirmSignTransaction/render.test.tsx": {
"@typescript-eslint/no-explicit-any": {
"count": 14
},
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/ui/confirmation/views/ConfirmSignTransaction/render.tsx": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/ui/confirmation/views/ConfirmTransactionRequest/ConfirmTransactionRequest.test.tsx": {
Expand All @@ -1604,26 +1519,11 @@
"count": 2
}
},
"packages/tron-wallet-snap/src/utils/deriveTronFromCoinTypeNode.test.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/utils/deriveTronFromCoinTypeNode.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/utils/getExplorerUrl.test.ts": {
"n/no-process-env": {
"count": 3
}
},
"packages/tron-wallet-snap/src/validation/keyring-structs.test.ts": {
"import-x/no-extraneous-dependencies": {
"count": 1
}
},
"packages/tron-wallet-snap/src/validation/transaction.test.ts": {
"@typescript-eslint/no-explicit-any": {
"count": 1
Expand Down
1 change: 1 addition & 0 deletions packages/tron-wallet-snap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Add Core messenger plumbing (`getMessenger`, `RemoteFeatureFlagsProvider`, `AssetsProvider`) for upcoming AssetsController migration ([#95](https://github.com/MetaMask/internal-snaps/pull/95))
- Route fungible asset reads through Core AssetsController when migration is active ([#127](https://github.com/MetaMask/internal-snaps/pull/127))

## [3.0.0]

Expand Down
1 change: 1 addition & 0 deletions packages/tron-wallet-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@metamask/snaps-jest": "^10.2.0",
"@metamask/snaps-sdk": "^11.2.0",
"@metamask/superstruct": "^3.4.1",
"@metamask/utils": "^11.9.0",
"@types/lodash": "^4.17.15",
"async-mutex": "^0.5.0",
"bignumber.js": "^9.3.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/tron-wallet-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/internal-snaps.git"
},
"source": {
"shasum": "B9kqmuUcYgPAD3ojseIm2HymqK77Q4NEzULU876+5Wc=",
"shasum": "agSEDL2FM0CMvZuNzJz1ZgGL0Wa45PclSGX4Ma5EPEo=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down Expand Up @@ -66,10 +66,10 @@
},
"endowment:messenger": {
"actions": [
"RemoteFeatureFlagController:getState",
"AssetsController:getAccountAssetByID",
"AssetsController:getAccountAssetsByIDs",
"AssetsController:getAccountAssetsByScope"
"AssetsController:getAccountAssetsByScope",
"RemoteFeatureFlagController:getState"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just a formatting fix

]
}
},
Expand Down
12 changes: 8 additions & 4 deletions packages/tron-wallet-snap/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ import { TransactionScanService } from './services/transaction-scan/TransactionS
import { TransactionsRepository } from './services/transactions/TransactionsRepository';
import { TransactionsService } from './services/transactions/TransactionsService';
import { WalletService } from './services/wallet/WalletService';
import type { CoreMessenger } from './types/core-messenger';
import type {
CoreMessenger,
CoreMessengerClient,
} from './types/core-messenger';
import logger, { noOpLogger } from './utils/logger';

/**
Expand Down Expand Up @@ -120,8 +123,9 @@ const assetsService = new AssetsService({
priceApiClient,
tokenApiClient,
snapClient,
remoteFeatureFlagsProvider,
configProvider,
assetsProvider,
remoteFeatureFlagsProvider,
});

const transactionsService = new TransactionsService({
Expand Down Expand Up @@ -260,9 +264,9 @@ export type SnapExecutionContext = {
transactionScanService: TransactionScanService;
transactionExpirationRefresherService: TransactionExpirationRefresherService;
/**
* Core messenger plumbing (routing wired in a follow-up PR).
* Core messenger plumbing.
*/
coreMessenger: CoreMessenger;
coreMessenger: CoreMessengerClient;
remoteFeatureFlagsProvider: RemoteFeatureFlagsProvider;
assetsProvider: AssetsProvider;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe('KeyringHandler', () => {
}),
} as unknown as jest.Mocked<AccountsService>;
mockAssetsService = {
getByKeyringAccountId: jest.fn().mockResolvedValue([]),
getAccountAssets: jest.fn().mockResolvedValue([]),
} as unknown as jest.Mocked<AssetsService>;
mockTransactionsService = {
checkAddressActivity: jest.fn(),
Expand Down Expand Up @@ -649,7 +649,7 @@ describe('KeyringHandler', () => {
const result = await keyringHandler.getAccountAssets(mockAccount.id);

expect(result).toStrictEqual([]);
expect(mockAssetsService.getByKeyringAccountId).toHaveBeenCalledWith(
expect(mockAssetsService.getAccountAssets).toHaveBeenCalledWith(
mockAccount.id,
);
});
Expand Down
5 changes: 2 additions & 3 deletions packages/tron-wallet-snap/src/handlers/keyring/keyring.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Only a rename

Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export class KeyringHandler implements KeyringSnapRpc {
this.#logger.info('Listing account assets', { accountId });

const assetEntities =
await this.#assetsService.getByKeyringAccountId(accountId);
await this.#assetsService.getAccountAssets(accountId);
const result = assetEntities
.filter(
(asset) =>
Expand Down Expand Up @@ -280,8 +280,7 @@ export class KeyringHandler implements KeyringSnapRpc {

await this.#getAccountOrThrow(accountId);

const assetsList =
await this.#assetsService.getByKeyringAccountId(accountId);
const assetsList = await this.#assetsService.getAccountAssets(accountId);

const assetsToUse = assetsList
.filter((asset) => assets.includes(asset.assetType))
Expand Down
Loading
Loading