Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove 'walletId' field per spec updates
  • Loading branch information
rekmarks committed Jun 8, 2023
commit 8eb8c8ec0d878b4357d8db71327ad0a2bb0af74c
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const baseConfig = {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 63.26,
branches: 62.88,
functions: 63.73,
lines: 65.6,
statements: 65.7,
Expand Down
15 changes: 0 additions & 15 deletions src/EIP6963.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { announceProvider, requestProvider } from './EIP6963';
const getProviderInfo = () => ({
name: 'test',
icon: 'https://wallet.io/icon.svg',
walletId: 'testWalletId',
uuid: '1449211e-5560-4235-9ab1-582cbe2b165f',
});

Expand Down Expand Up @@ -60,20 +59,6 @@ describe('EIP6963', () => {
);
});
});

it('throws if the `walletId` field is invalid', () => {
[null, undefined, '', {}, [], Symbol('bar')].forEach(
(invalidWalletId) => {
const provider: any = { name: 'test' };
const providerDetail = { info: getProviderInfo(), provider };
providerDetail.info.walletId = invalidWalletId as any;

expect(() => announceProvider(providerDetail)).toThrow(
providerInfoValidationError(),
);
},
);
});
});

it('should announce a provider', () => {
Expand Down
9 changes: 1 addition & 8 deletions src/EIP6963.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ enum EIP6963EventNames {
* Represents the assets needed to display and identify a wallet.
*/
export type EIP6963ProviderInfo = {
/**
* The global identifier for the wallet. SHOULD be in reverse domain format,
* e.g. `com.wallet.example`.
*/
walletId: string;
/**
* A locally unique identifier for the wallet. MUST be a v4 UUID.
*/
Expand Down Expand Up @@ -133,9 +128,7 @@ function isValidProviderDetail(
typeof info.name === 'string' &&
Boolean(info.name) &&
typeof info.uuid === 'string' &&
UUID_V4_REGEX.test(info.uuid) &&
typeof info.walletId === 'string' &&
Boolean(info.walletId)
UUID_V4_REGEX.test(info.uuid)
);
}
Comment on lines 122 to 198
Copy link
Member Author

Choose a reason for hiding this comment

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

Normally I think we'd use superstruct or something for this, but it's important to keep the bundle size as small as possible.

Copy link
Member

Choose a reason for hiding this comment

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

superstruct is only 11.5 kB (or 3.4 kB gzipped), and @metmask/providers is 75.1 kB (or 21.1 kB gzipped). I don't think it makes a significant difference. 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts here? @rekmarks @Mrtenz


Expand Down