Skip to content

Commit

Permalink
Release 32.0.0 (#412)
Browse files Browse the repository at this point in the history
* feat: release 32.0.0

* chore: changelogs

* fix: early return when recovering invalid key exchange status and update unit tests accordingly

* feat: optimize sdk build to remove qrcode-terminal on web

* feat: optimize sdk build to remove qrcode-terminal on web+rn
  • Loading branch information
abretonc7s authored Oct 19, 2023
1 parent 65cd9ea commit 74bac0b
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "metamask-sdk-monorepo",
"version": "31.0.0",
"version": "32.0.0",
"private": true,
"repository": {
"type": "git",
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk-communication-layer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0]
### Added
- feat: connection recovery edge case ([#411](https://github.com/MetaMask/metamask-sdk/pull/411))

## [0.9.0]
### Added
- fix typos ([#401](https://github.com/MetaMask/metamask-sdk/pull/401))
Expand Down Expand Up @@ -82,7 +86,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [FEAT] improve logging + update examples ([#99](https://github.com/MetaMask/metamask-sdk/pull/99))

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[0.10.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.9.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.8.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.7.1]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-communication-layer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk-communication-layer",
"version": "0.9.0",
"version": "0.10.0",
"description": "",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,22 @@ import { handleMessage } from './handleMessage';

jest.mock('../ChannelManager');

const msgToDeEncrypt = 'encryptedMessage';

describe('handleMessage', () => {
let instance: SocketService;

const mockCheckSameId = ChannelManager.checkSameId as jest.Mock;
const mockEmit = jest.fn();
const mockAreKeysExchanged = jest.fn();
const mockDecryptMessage = jest.fn();
const mockDecryptMessage = jest.fn((msg) => {
console.log(`mockDecrypt msg:`, msg);
if (msg === msgToDeEncrypt) {
throw new Error('invalid');
}
return '{}';
});
const mockSetKeysExchanged = jest.fn();
const mockStart = jest.fn();
const channelId = 'testChannel';

Expand All @@ -30,6 +39,7 @@ describe('handleMessage', () => {
keyExchange: {
areKeysExchanged: mockAreKeysExchanged,
decryptMessage: mockDecryptMessage,
setKeysExchanged: mockSetKeysExchanged,
start: mockStart,
},
},
Expand Down Expand Up @@ -80,7 +90,7 @@ describe('handleMessage', () => {
);

const handler = handleMessage(instance, channelId);
handler({ id: 'testId', message: 'encryptedMessage' });
handler({ id: 'testId', message: msgToDeEncrypt });

expect(mockEmit).toHaveBeenCalledWith(EventType.MESSAGE, {
message: { type: MessageType.PAUSE },
Expand Down Expand Up @@ -134,7 +144,7 @@ describe('handleMessage', () => {
instance.sendMessage = mockSendMessage;

const handler = handleMessage(instance, channelId);
handler({ id: 'testId', message: 'encryptedMessage' });
handler({ id: 'testId', message: msgToDeEncrypt });

expect(mockSendMessage).toHaveBeenCalledWith({
type: KeyExchangeMessageType.KEY_HANDSHAKE_START,
Expand Down Expand Up @@ -174,7 +184,7 @@ describe('handleMessage', () => {
);

const handler = handleMessage(instance, channelId);
handler({ id: 'testId', message: 'encryptedMessage' });
handler({ id: 'testId', message: msgToDeEncrypt });

expect(instance.state.clientsPaused).toBe(true);
});
Expand Down Expand Up @@ -205,7 +215,7 @@ describe('handleMessage', () => {
);

const handler = handleMessage(instance, channelId);
handler({ id: 'testId', message: 'encryptedMessage' });
handler({ id: 'testId', message: msgToDeEncrypt });

expect(mockEmit).toHaveBeenCalledWith(EventType.MESSAGE, {
message: { type: 'testType', data: 'testData' },
Expand All @@ -217,7 +227,7 @@ describe('handleMessage', () => {
instance.state.isOriginator = true;

const handler = handleMessage(instance, channelId);
handler({ id: 'testId', message: 'encryptedMessage' });
handler({ id: 'testId', message: msgToDeEncrypt });

expect(mockStart).toHaveBeenCalledWith({
isOriginator: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function handleMessage(instance: SocketService, channelId: string) {
instance.state.keyExchange?.decryptMessage(message);
canDecrypt = true;
} catch (err) {
return;
// Ignore error.
}

if (canDecrypt) {
Expand Down Expand Up @@ -150,7 +150,7 @@ export function handleMessage(instance: SocketService, channelId: string) {

const decryptedMessage =
instance.state.keyExchange?.decryptMessage(message);
const messageReceived = JSON.parse(decryptedMessage ?? '');
const messageReceived = JSON.parse(decryptedMessage ?? '{}');

if (messageReceived?.type === MessageType.PAUSE) {
/**
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk-install-modal-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0]
### Uncategorized
- Force align package version to sdk

## [0.9.0]
### Added
- feat: add sdk version and change modal order ([#405](https://github.com/MetaMask/metamask-sdk/pull/405))
Expand Down Expand Up @@ -55,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update GitHub actions workflows ([#102](https://github.com/MetaMask/metamask-sdk/pull/102))
- [FEAT] Yarn v3 migration ([#100](https://github.com/MetaMask/metamask-sdk/pull/100))

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[0.10.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.9.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.7.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.6.2]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-install-modal-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk-install-modal-web",
"version": "0.9.0",
"version": "0.10.0",
"description": "MetaMask SDK Install Modal for Web",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk-react-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0]
### Uncategorized
- Force align package version to sdk

## [0.9.0]
### Added
- feat: implementing internationalization via i18next package ([#403](https://github.com/MetaMask/metamask-sdk/pull/403))
Expand All @@ -32,7 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [feat] initial beta released

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/v0.9.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/v0.10.0...HEAD
[0.10.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.6.2...v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-react-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk-react-ui",
"version": "0.9.0",
"version": "0.10.0",
"description": "A react component and react hooks to connect and use MetaMask",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
8 changes: 7 additions & 1 deletion packages/sdk-react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0]
### Added
- fix: balance only display when debug is set ([#408](https://github.com/MetaMask/metamask-sdk/pull/408))
- feat: add unit tests to the sdk-react package ([#369](https://github.com/MetaMask/metamask-sdk/pull/369))

## [0.9.0]
### Added
- feat: implementing internationalization via i18next package ([#403](https://github.com/MetaMask/metamask-sdk/pull/403))
Expand Down Expand Up @@ -55,7 +60,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [fix] publishing config ([#135](https://github.com/MetaMask/metamask-sdk/pull/135))
- [feat] initial beta released

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/v0.9.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/v0.10.0...HEAD
[0.10.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.7.0...v0.8.0
[0.7.0]: https://github.com/MetaMask/metamask-sdk/compare/v0.6.2...v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk-react",
"version": "0.9.0",
"version": "0.10.0",
"description": "A react component and react hooks to connect and use MetaMask",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.10.0]
### Added
- feat: connectAndSign feature ([#410](https://github.com/MetaMask/metamask-sdk/pull/410))

## [0.9.0]
### Added
- feat: add sdk version and change modal order ([#405](https://github.com/MetaMask/metamask-sdk/pull/405))
Expand Down Expand Up @@ -146,7 +150,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- [FEAT] improve logging + update examples ([#99](https://github.com/MetaMask/metamask-sdk/pull/99))

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]
[0.10.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.9.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.8.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
[0.7.1]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/[email protected]...@metamask/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk",
"version": "0.9.0",
"version": "0.10.0",
"description": "",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
6 changes: 4 additions & 2 deletions packages/sdk/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ import globals from 'rollup-plugin-node-globals';
const packageJson = require('./package.json');

const listDepForRollup = ['@react-native-async-storage/async-storage'];
const webExternalDeps = [...listDepForRollup, 'qrcode-terminal'];
const rnExternalDeps = [...listDepForRollup, 'qrcode-terminal'];

/**
* @type {import('rollup').RollupOptions}
*/
const config = [
{
external: listDepForRollup,
external: webExternalDeps,
input: 'src/index.ts',
output: [
{
Expand Down Expand Up @@ -59,7 +61,7 @@ const config = [
],
},
{
external: listDepForRollup,
external: rnExternalDeps,
input: 'src/index.ts',
output: [
{
Expand Down

0 comments on commit 74bac0b

Please sign in to comment.