Skip to content

Commit

Permalink
build(deps): bump @metamask/{base, polling}-controller (#448)
Browse files Browse the repository at this point in the history
* build(deps): bump @metamask/polling-controller from 8.0.0 to 11.0.0

Bumps [@metamask/polling-controller](https://github.com/MetaMask/core) from 8.0.0 to 11.0.0.
- [Release notes](https://github.com/MetaMask/core/releases)
- [Changelog](https://github.com/MetaMask/core/blob/main/docs/reviewing-release-prs.md)
- [Commits](https://github.com/MetaMask/core/compare/@metamask/[email protected]...@metamask/[email protected])

---
updated-dependencies:
- dependency-name: "@metamask/polling-controller"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* feat: add `SmartTransactionsControllerPollingInput`

* update `@metamask/base-controller` to `^7.0.1`

* test: `startPollingByNetworkId` is now `startPolling`

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Michele Esposito <[email protected]>
  • Loading branch information
dependabot[bot] and mikesposito authored Oct 22, 2024
1 parent af040b3 commit 34497f6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"@ethereumjs/tx": "^5.2.1",
"@ethereumjs/util": "^9.0.2",
"@ethersproject/bytes": "^5.7.0",
"@metamask/base-controller": "^6.0.0",
"@metamask/base-controller": "^7.0.1",
"@metamask/controller-utils": "^11.0.0",
"@metamask/eth-json-rpc-provider": "^4.1.0",
"@metamask/eth-query": "^4.0.0",
"@metamask/network-controller": "^21.1.0",
"@metamask/polling-controller": "^8.0.0",
"@metamask/polling-controller": "^11.0.0",
"@metamask/transaction-controller": "^34.0.0",
"bignumber.js": "^9.0.1",
"events": "^3.3.0",
Expand Down
10 changes: 5 additions & 5 deletions src/SmartTransactionsController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,7 @@ describe('SmartTransactionsController', () => {
});
});

describe('startPollingByNetworkClientId', () => {
describe('startPolling', () => {
let clock: sinon.SinonFakeTimers;

beforeEach(() => {
Expand Down Expand Up @@ -1431,9 +1431,9 @@ describe('SmartTransactionsController', () => {
},
async ({ controller }) => {
const handleFetchSpy = jest.spyOn(utils, 'handleFetch');
const mainnetPollingToken = controller.startPollingByNetworkClientId(
NetworkType.mainnet,
);
const mainnetPollingToken = controller.startPolling({
networkClientId: NetworkType.mainnet,
});

await advanceTime({ clock, duration: 0 });

Expand Down Expand Up @@ -1462,7 +1462,7 @@ describe('SmartTransactionsController', () => {
fetchHeaders,
);

controller.startPollingByNetworkClientId(NetworkType.sepolia);
controller.startPolling({ networkClientId: NetworkType.sepolia });
await advanceTime({ clock, duration: 0 });

expect(handleFetchSpy).toHaveBeenNthCalledWith(
Expand Down
10 changes: 8 additions & 2 deletions src/SmartTransactionsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ type SmartTransactionsControllerOptions = {
getMetaMetricsProps: () => Promise<MetaMetricsProps>;
};

export default class SmartTransactionsController extends StaticIntervalPollingController<
export type SmartTransactionsControllerPollingInput = {
networkClientId: string;
};

export default class SmartTransactionsController extends StaticIntervalPollingController<SmartTransactionsControllerPollingInput>()<
typeof controllerName,
SmartTransactionsControllerState,
SmartTransactionsControllerMessenger
Expand Down Expand Up @@ -301,7 +305,9 @@ export default class SmartTransactionsController extends StaticIntervalPollingCo
);
}

async _executePoll(networkClientId: string): Promise<void> {
async _executePoll({
networkClientId,
}: SmartTransactionsControllerPollingInput): Promise<void> {
// if this is going to be truly UI driven polling we shouldn't really reach here
// with a networkClientId that is not supported, but for now I'll add a check in case
// wondering if we should add some kind of predicate to the polling controller to check whether
Expand Down
20 changes: 18 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2090,6 +2090,22 @@ __metadata:
languageName: node
linkType: hard

"@metamask/polling-controller@npm:^11.0.0":
version: 11.0.0
resolution: "@metamask/polling-controller@npm:11.0.0"
dependencies:
"@metamask/base-controller": ^7.0.1
"@metamask/controller-utils": ^11.3.0
"@metamask/utils": ^9.1.0
"@types/uuid": ^8.3.0
fast-json-stable-stringify: ^2.1.0
uuid: ^8.3.2
peerDependencies:
"@metamask/network-controller": ^21.0.0
checksum: 52a8f72a9ef3633d0a3dae2c148923f14462c6bc3058ebb93d3b6288b4faa56d7b62396038fdb855053f711c1f9b214a572c1bb7bf3e9e1613c55bbeace69966
languageName: node
linkType: hard

"@metamask/polling-controller@npm:^8.0.0":
version: 8.0.0
resolution: "@metamask/polling-controller@npm:8.0.0"
Expand Down Expand Up @@ -2213,7 +2229,7 @@ __metadata:
"@ethersproject/bytes": ^5.7.0
"@lavamoat/allow-scripts": ^2.3.1
"@metamask/auto-changelog": ^3.1.0
"@metamask/base-controller": ^6.0.0
"@metamask/base-controller": ^7.0.1
"@metamask/controller-utils": ^11.0.0
"@metamask/eslint-config": ^12.2.0
"@metamask/eslint-config-jest": ^12.1.0
Expand All @@ -2223,7 +2239,7 @@ __metadata:
"@metamask/eth-query": ^4.0.0
"@metamask/json-rpc-engine": ^9.0.0
"@metamask/network-controller": ^21.1.0
"@metamask/polling-controller": ^8.0.0
"@metamask/polling-controller": ^11.0.0
"@metamask/transaction-controller": ^34.0.0
"@types/jest": ^26.0.24
"@types/lodash": ^4.14.194
Expand Down

0 comments on commit 34497f6

Please sign in to comment.