Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 85.0.0 #1006

Merged
merged 12 commits into from
Aug 30, 2024
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": "84.0.0",
"version": "85.0.0",
"private": true,
"repository": {
"type": "git",
Expand Down
27 changes: 16 additions & 11 deletions packages/sdk-communication-layer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.28.2]
### Added
- feat: socket reconnection optimization ([#994](https://github.com/MetaMask/metamask-sdk/pull/994))

## [0.28.1]
### Uncategorized
- feat: full deeplink protocol ([#992](https://github.com/MetaMask/metamask-sdk.git/pull/992))
### Added
- feat: full deeplink protocol ([#992](https://github.com/MetaMask/metamask-sdk/pull/992))

## [0.28.0]
### Added
- feat: experimental deeplink protocoll ([#990](https://github.com/MetaMask/metamask-sdk.git/pull/990))
- feat: revert socket server changes ([#985](https://github.com/MetaMask/metamask-sdk.git/pull/985))
- feat: change the default value for 'dappId' to 'N/A' instead of an empty string ([#972](https://github.com/MetaMask/metamask-sdk.git/pull/972))
- feat: experimental deeplink protocoll ([#990](https://github.com/MetaMask/metamask-sdk/pull/990))
- feat: revert socket server changes ([#985](https://github.com/MetaMask/metamask-sdk/pull/985))
- feat: change the default value for 'dappId' to 'N/A' instead of an empty string ([#972](https://github.com/MetaMask/metamask-sdk/pull/972))

## [0.27.0]
### Added
Expand All @@ -30,14 +34,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.26.0]
### Added
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk.git/pull/902))
- feat: update dev rn / expo and empty dappid ([#897](https://github.com/MetaMask/metamask-sdk.git/pull/897))
- feat: prevent empty dappid ([#891](https://github.com/MetaMask/metamask-sdk.git/pull/891))
- chore: improve unit tests coverage ([#888](https://github.com/MetaMask/metamask-sdk.git/pull/888))
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk/pull/902))
- feat: update dev rn / expo and empty dappid ([#897](https://github.com/MetaMask/metamask-sdk/pull/897))
- feat: prevent empty dappid ([#891](https://github.com/MetaMask/metamask-sdk/pull/891))
- chore: improve unit tests coverage ([#888](https://github.com/MetaMask/metamask-sdk/pull/888))

## [0.20.5]
### Added
- fix: ref crossfetch ([#871](https://github.com/MetaMask/metamask-sdk.git/pull/871))
- fix: ref crossfetch ([#871](https://github.com/MetaMask/metamask-sdk/pull/871))

## [0.20.4]
### Added
Expand Down Expand Up @@ -245,7 +249,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/sdk-communication-layer@0.28.1...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-communication-layer@0.28.2...HEAD
[0.28.2]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-communication-layer@0.28.1...@metamask/sdk-communication-layer@0.28.2
[0.28.1]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-communication-layer@0.28.0...@metamask/sdk-communication-layer@0.28.1
[0.28.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-communication-layer@0.27.0...@metamask/sdk-communication-layer@0.28.0
[0.27.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-communication-layer@0.26.4...@metamask/sdk-communication-layer@0.27.0
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.28.1",
"version": "0.28.2",
"description": "",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-install-modal-web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.26.0]
### Added
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk.git/pull/902))
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk/pull/902))

## [0.20.4]
### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.3.1]
### Uncategorized
- chore: update reactNativeSdkDemo with latest sdk-react-native version ([#872](https://github.com/MetaMask/metamask-sdk.git/pull/872))
- chore: update reactNativeSdkDemo with latest sdk-react-native version ([#872](https://github.com/MetaMask/metamask-sdk/pull/872))

## [0.3.0]
### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-react-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [0.26.0]
### Added
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk.git/pull/902))
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk/pull/902))

## [0.20.4]
### Added
Expand Down
7 changes: 6 additions & 1 deletion packages/sdk-react/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.28.0]
### Uncategorized
- feat: revert socket server changes ([#985](https://github.com/MetaMask/metamask-sdk/pull/985))

## [0.27.0]
### Added
- fix: adds extensionOnly default to true to SDK initialization ([#962](https://github.com/MetaMask/metamask-sdk/pull/962))
Expand Down Expand Up @@ -235,7 +239,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/@metamask/sdk-react@0.27.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-react@0.28.0...HEAD
[0.28.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-react@0.27.0...@metamask/sdk-react@0.28.0
[0.27.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-react@0.26.5...@metamask/sdk-react@0.27.0
[0.26.5]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-react@0.26.4...@metamask/sdk-react@0.26.5
[0.26.4]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-react@0.26.3...@metamask/sdk-react@0.26.4
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.27.0",
"version": "0.28.0",
"description": "A react component and react hooks to connect and use MetaMask",
"homepage": "https://github.com/MetaMask/metamask-sdk",
"bugs": {
Expand Down
11 changes: 8 additions & 3 deletions packages/sdk-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.28.0]
### Uncategorized
- feat: revert socket server changes ([#985](https://github.com/MetaMask/metamask-sdk/pull/985))

## [0.26.0]
### Uncategorized
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk.git/pull/902))
- feat: add script to align version before publishing ([#902](https://github.com/MetaMask/metamask-sdk/pull/902))

## [0.20.5]
### Added
- align version with sdk package
- chore: create wagmi demo dapp ([#669](https://github.com/MetaMask/metamask-sdk.git/pull/669))
- chore: create wagmi demo dapp ([#669](https://github.com/MetaMask/metamask-sdk/pull/669))

## [0.4.2]
### Uncategorized
Expand Down Expand Up @@ -83,7 +87,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- feat: optimize rollup builds ([#496](https://github.com/MetaMask/metamask-sdk/pull/496))
- fix: linting changelog issue after updating scripts ([#509](https://github.com/MetaMask/metamask-sdk/pull/509))

[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.26.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.28.0...HEAD
[0.28.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.26.0...@metamask/sdk-ui@0.28.0
[0.26.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.20.5...@metamask/sdk-ui@0.26.0
[0.20.5]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.4.2...@metamask/sdk-ui@0.20.5
[0.4.2]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk-ui@0.4.1...@metamask/sdk-ui@0.4.2
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@metamask/sdk-ui",
"version": "0.26.0",
"version": "0.28.0",
"description": "MetaMask SDK cross-platform ui library",
"module": "dist/esm/index.js",
"types": "dist/esm/dist/src/index.d.ts",
Expand Down
13 changes: 12 additions & 1 deletion packages/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.28.0]
### Added
- fix: adds a unique id to RPC events for extension ([#996](https://github.com/MetaMask/metamask-sdk/pull/996))
- feat: connectwith working with async key exchange ([#1004](https://github.com/MetaMask/metamask-sdk/pull/1004))
- feat: socket reconnection optimization ([#994](https://github.com/MetaMask/metamask-sdk/pull/994))
- feat: full deeplink protocol ([#992](https://github.com/MetaMask/metamask-sdk/pull/992))
- feat: experimental deeplink protocoll ([#990](https://github.com/MetaMask/metamask-sdk/pull/990))
- feat: revert socket server changes ([#985](https://github.com/MetaMask/metamask-sdk/pull/985))
- feat: change the default value for 'dappId' to 'N/A' instead of an empty string ([#972](https://github.com/MetaMask/metamask-sdk/pull/972))

## [0.27.0]
### Added
- fix: adds extensionOnly default to true to SDK initialization ([#962](https://github.com/MetaMask/metamask-sdk/pull/962))
Expand Down Expand Up @@ -364,7 +374,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/sdk@0.27.0...HEAD
[Unreleased]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk@0.28.0...HEAD
[0.28.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk@0.27.0...@metamask/sdk@0.28.0
[0.27.0]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk@0.26.5...@metamask/sdk@0.27.0
[0.26.5]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk@0.26.4...@metamask/sdk@0.26.5
[0.26.4]: https://github.com/MetaMask/metamask-sdk/compare/@metamask/sdk@0.26.3...@metamask/sdk@0.26.4
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.27.0",
"version": "0.28.0",
"description": "",
"homepage": "https://github.com/MetaMask/metamask-sdk#readme",
"bugs": {
Expand Down
13 changes: 10 additions & 3 deletions packages/sdk/src/Platform/MetaMaskInstaller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ describe('MetaMaskInstaller', () => {
});

it('should start installer with connectWith provided', async () => {
const connectWith = { method: 'eth_requestAccounts', params: [] };

const connectWith = {
method: 'eth_requestAccounts',
params: [],
id: '123',
};
await installer.start({ wait: false, connectWith });

expect(installer.state.connectWith).toStrictEqual(connectWith);
Expand All @@ -97,7 +100,11 @@ describe('MetaMaskInstaller', () => {
it('should correctly handle isInstalling in start with wait set to true', async () => {
installer.state.isInstalling = true;

const connectWith = { method: 'eth_requestAccounts', params: [] };
const connectWith = {
method: 'eth_requestAccounts',
params: [],
id: '123',
};

const startPromise = installer.start({ wait: true, connectWith });

Expand Down
14 changes: 2 additions & 12 deletions packages/sdk/src/Platform/MetaMaskInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface InstallerProps {
export interface RPCCall {
method: string;
params: unknown;
id: string;
}

interface MetaMaskInstallerState {
Expand Down Expand Up @@ -78,21 +79,10 @@ export class MetaMaskInstaller {
connectWith,
}: {
wait: boolean;
connectWith?: { method: string; params: unknown };
connectWith?: RPCCall;
}) {
this.state.connectWith = connectWith;
logger(`[MetaMaskInstaller: start()] wait=${wait}`, connectWith);
await startInstaller(this, { wait });

if (wait) {
// wait until the installation is done
while (this.state.isInstalling) {
// FIXME: remove before release
console.warn(
`[MetaMaskInstaller: start()] isInstalling=${this.state.isInstalling}`,
);
await new Promise((resolve) => setTimeout(resolve, 1000));
}
}
}
}
37 changes: 37 additions & 0 deletions packages/sdk/src/provider/initializeMobileProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,17 @@
setInitializing(true);

const isConnectWith = method === RPC_METHODS.METAMASK_CONNECTWITH;
// Only used with connectWith
const rpcInstallId = `${Date.now()}`;

Check warning on line 257 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L257

Added line #L257 was not covered by tests
try {
await installer.start({
wait: false,
connectWith: isConnectWith
? {
method,
// We dont need a better id, this is only for current user session.
// future rpc calls will have ids generated via JSON-RPC package.
id: rpcInstallId,
params,
}
: undefined,
Expand Down Expand Up @@ -361,6 +366,38 @@
`[initializeMobileProvider: sendRequest()] selectedAddress: ${selectedAddress} --- SKIP rpc call`,
);
return [selectedAddress];
} else if (method === RPC_METHODS.METAMASK_CONNECTWITH) {

Check warning on line 369 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L369

Added line #L369 was not covered by tests
// wait for tracker to be updated

try {
const result = await new Promise((resolve, reject) => {
const tracker = remoteConnection

Check warning on line 374 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L372-L374

Added lines #L372 - L374 were not covered by tests
?.getConnector()
.getRPCMethodTracker();
logger(`TRACKER: method ${rpcInstallId}`, tracker);
if (tracker?.[rpcInstallId].result) {
resolve(tracker?.[rpcInstallId].result);
} else if (tracker?.[rpcInstallId].error) {
reject(tracker?.[rpcInstallId].error);

Check warning on line 381 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L377-L381

Added lines #L377 - L381 were not covered by tests
}

remoteConnection

Check warning on line 384 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L384

Added line #L384 was not covered by tests
?.getConnector()
.once(EventType.RPC_UPDATE, (rpcResult) => {
logger(`TRACKER: update method ${rpcInstallId}`, rpcResult);

Check warning on line 387 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L386-L387

Added lines #L386 - L387 were not covered by tests

if (rpcResult.result) {
resolve(rpcResult.result);
} else {
reject(rpcResult.error);

Check warning on line 392 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L389-L392

Added lines #L389 - L392 were not covered by tests
}
});
});
return result;

Check warning on line 396 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L396

Added line #L396 was not covered by tests
} catch (error) {
logger(`[initializeMobileProvider: sendRequest()] error:`, error);
throw error;

Check warning on line 399 in packages/sdk/src/provider/initializeMobileProvider.ts

View check run for this annotation

Codecov / codecov/patch

packages/sdk/src/provider/initializeMobileProvider.ts#L398-L399

Added lines #L398 - L399 were not covered by tests
}
}

// Inform next step that this method triggered installer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ describe('startConnection', () => {
persistChannelConfig: jest.fn(),
},
},
getRPCMethodTracker: jest.fn().mockReturnValue({}),
};

state = {
Expand Down Expand Up @@ -184,6 +185,7 @@ describe('startConnection', () => {
const connectWith = {
method: 'eth_sendTransaction',
params: [{ from: '0x123', to: '0x456', value: '0x789' }],
id: '123',
};

await startConnection(state, options, { connectWith });
Expand All @@ -199,6 +201,7 @@ describe('startConnection', () => {
const connectWith = {
method: 'personal_sign',
params: ['0xabcdef', '0x123456'],
id: '123',
};

await startConnection(state, options, { connectWith });
Expand All @@ -215,6 +218,7 @@ describe('startConnection', () => {
const connectWith = {
method: 'eth_sign',
params: ['0x123456', '0xabcdef'],
id: '123',
};

await startConnection(state, options, { connectWith });
Expand All @@ -230,6 +234,7 @@ describe('startConnection', () => {
const connectWith = {
method: 'eth_sign',
params: ['0x123456', '0xabcdef'],
id: '123',
};

await startConnection(state, options, { connectWith });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,18 @@ export async function startConnection(
}&pubkey=${pubKey}${qrCodeOrigin}&originatorInfo=${base64OriginatorInfo}`;

if (connectWith) {
const rpc = {
id: Date.now(), // We dont need a better id, this is only for current user session.
// future rpc calls will have ids generated via JSON-RPC package.
method: connectWith.method,
params: connectWith.params,
};
const base64Rpc = base64Encode(JSON.stringify(rpc));
const base64Rpc = base64Encode(JSON.stringify(connectWith));
linkParams += `&rpc=${base64Rpc}`;

const tracker = state.connector.getRPCMethodTracker();
// Add rpcMethod to tracker
if (tracker) {
tracker[`${connectWith.id}`] = {
...connectWith,
id: `${connectWith.id}`,
timestamp: Date.now(),
};
}
}
const encodedLinkParams = encodeURI(linkParams);
const qrcodeLink = `${
Expand Down
Loading
Loading