Skip to content

Commit

Permalink
fix: json-rpc-middleware-stream@^5 -> @metamask/json-rpc-middleware-s…
Browse files Browse the repository at this point in the history
…tream@^8 (#28060)

## **Description**

- Replace legacy `json-rpc-middleware-stream@^5` (2023-09-27) with
`@metamask/json-rpc-middleware-stream@^8` (2024-10-16)

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28060?quickstart=1)

## **Related issues**

- Fully removing usage of old version and aligning versions depends on
updating `@metamask/providers`, done in either/both of:
  - #27049
  - #27923 

## **Manual testing steps**

## **Screenshots/Recordings**

### **Before**

### **After**

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
legobeat authored Oct 25, 2024
1 parent 440a0fa commit c4727d9
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 96 deletions.
2 changes: 1 addition & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
fetchMultiExchangeRate,
} from '@metamask/assets-controllers';
import { JsonRpcEngine } from '@metamask/json-rpc-engine';
import { createEngineStream } from '@metamask/json-rpc-middleware-stream';
import { ObservableStore } from '@metamask/obs-store';
import { storeAsStream } from '@metamask/obs-store/dist/asStream';
import { createEngineStream } from 'json-rpc-middleware-stream';
import { providerAsMiddleware } from '@metamask/eth-json-rpc-middleware';
import { debounce, throttle, memoize, wrap } from 'lodash';
import {
Expand Down
34 changes: 12 additions & 22 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,17 @@
"@metamask/utils": true
}
},
"@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/keyring-api": {
"globals": {
"URL": true
Expand Down Expand Up @@ -2481,11 +2492,11 @@
"setTimeout": true
},
"packages": {
"@metamask/json-rpc-middleware-stream": true,
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
Expand Down Expand Up @@ -2525,17 +2536,6 @@
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
Expand Down Expand Up @@ -4525,16 +4525,6 @@
"stream-http": true
}
},
"json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"readable-stream": true
}
},
"koa>content-disposition>safe-buffer": {
"packages": {
"browserify>buffer": true
Expand Down
34 changes: 12 additions & 22 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,17 @@
"@metamask/utils": true
}
},
"@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/keyring-api": {
"globals": {
"URL": true
Expand Down Expand Up @@ -2481,11 +2492,11 @@
"setTimeout": true
},
"packages": {
"@metamask/json-rpc-middleware-stream": true,
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
Expand Down Expand Up @@ -2525,17 +2536,6 @@
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
Expand Down Expand Up @@ -4525,16 +4525,6 @@
"stream-http": true
}
},
"json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"readable-stream": true
}
},
"koa>content-disposition>safe-buffer": {
"packages": {
"browserify>buffer": true
Expand Down
34 changes: 12 additions & 22 deletions lavamoat/browserify/main/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1276,6 +1276,17 @@
"@metamask/utils": true
}
},
"@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/keyring-api": {
"globals": {
"URL": true
Expand Down Expand Up @@ -2481,11 +2492,11 @@
"setTimeout": true
},
"packages": {
"@metamask/json-rpc-middleware-stream": true,
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
Expand Down Expand Up @@ -2525,17 +2536,6 @@
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
Expand Down Expand Up @@ -4525,16 +4525,6 @@
"stream-http": true
}
},
"json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"readable-stream": true
}
},
"koa>content-disposition>safe-buffer": {
"packages": {
"browserify>buffer": true
Expand Down
34 changes: 12 additions & 22 deletions lavamoat/browserify/mmi/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1368,6 +1368,17 @@
"@metamask/utils": true
}
},
"@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/keyring-api": {
"globals": {
"URL": true
Expand Down Expand Up @@ -2573,11 +2584,11 @@
"setTimeout": true
},
"packages": {
"@metamask/json-rpc-middleware-stream": true,
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
Expand Down Expand Up @@ -2617,17 +2628,6 @@
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
Expand Down Expand Up @@ -4617,16 +4617,6 @@
"stream-http": true
}
},
"json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"readable-stream": true
}
},
"koa>content-disposition>safe-buffer": {
"packages": {
"browserify>buffer": true
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@
"@metamask/gas-fee-controller": "^18.0.0",
"@metamask/jazzicon": "^2.0.0",
"@metamask/json-rpc-engine": "^10.0.0",
"@metamask/json-rpc-middleware-stream": "^8.0.4",
"@metamask/keyring-api": "^8.1.3",
"@metamask/keyring-controller": "^17.2.2",
"@metamask/logging-controller": "^6.0.0",
Expand Down Expand Up @@ -388,7 +389,6 @@
"immer": "^9.0.6",
"is-retry-allowed": "^2.2.0",
"jest-junit": "^14.0.1",
"json-rpc-middleware-stream": "^5.0.1",
"labeled-stream-splicer": "^2.0.2",
"localforage": "^1.9.0",
"lodash": "^4.17.21",
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5519,15 +5519,15 @@ __metadata:
languageName: node
linkType: hard

"@metamask/json-rpc-middleware-stream@npm:^8.0.1, @metamask/json-rpc-middleware-stream@npm:^8.0.2":
version: 8.0.2
resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.2"
"@metamask/json-rpc-middleware-stream@npm:^8.0.1, @metamask/json-rpc-middleware-stream@npm:^8.0.2, @metamask/json-rpc-middleware-stream@npm:^8.0.4":
version: 8.0.4
resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.4"
dependencies:
"@metamask/json-rpc-engine": "npm:^9.0.2"
"@metamask/json-rpc-engine": "npm:^10.0.0"
"@metamask/safe-event-emitter": "npm:^3.0.0"
"@metamask/utils": "npm:^9.1.0"
readable-stream: "npm:^3.6.2"
checksum: 10/aaf41cb6fa015494eb0424959d14022b1355c390066898603223e3418d93bd72249b6e54caee3e23b4d6a679f389c2374f687882f2a7202379b4f4b042a84974
checksum: 10/93c842e1ac8e624c65d888cb3539b38ade5b8415ea45f649d78dad91e7139f11fa96bbf89136998d21def7711b3f710939f8e4498ce31a6cf461892e3f4ba176
languageName: node
linkType: hard

Expand Down Expand Up @@ -25920,6 +25920,7 @@ __metadata:
"@metamask/gas-fee-controller": "npm:^18.0.0"
"@metamask/jazzicon": "npm:^2.0.0"
"@metamask/json-rpc-engine": "npm:^10.0.0"
"@metamask/json-rpc-middleware-stream": "npm:^8.0.4"
"@metamask/keyring-api": "npm:^8.1.3"
"@metamask/keyring-controller": "npm:^17.2.2"
"@metamask/logging-controller": "npm:^6.0.0"
Expand Down Expand Up @@ -26138,7 +26139,6 @@ __metadata:
jest-environment-jsdom: "patch:jest-environment-jsdom@npm%3A29.7.0#~/.yarn/patches/jest-environment-jsdom-npm-29.7.0-0b72dd0e0b.patch"
jest-junit: "npm:^14.0.1"
jsdom: "npm:^16.7.0"
json-rpc-middleware-stream: "npm:^5.0.1"
json-schema-to-ts: "npm:^3.0.1"
koa: "npm:^2.7.0"
labeled-stream-splicer: "npm:^2.0.2"
Expand Down

0 comments on commit c4727d9

Please sign in to comment.