Skip to content

Commit

Permalink
ID-981 Add isPassport to zkEVM provider
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenfowler committed Aug 4, 2023
1 parent 074dffd commit 6bc7bd9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- @imtbl/blockchain-data: Added Deposit and Withdrawal activity types
### Fixed

### Changed

### Removed

### Deprecated

## [0.4.4] - 2023-08-04

### Added

- @imtbl/passport: Added `isPassport` property to Passport zkEVM provider

## [0.4.3] - 2023-08-04

### Added

- @imtbl/passport: Added zkEVM Support, see the [zkEVM Passport documentation](https://docs.immutable.com/docs/zkevm/products/passport/) for more information.
- Fixed an issue where the API version was appended to the header twice in every API call

## [0.4.2] - 2023-07-31

### Added

- @imtbl/blockchain-data: Added Deposit and Withdrawal activity types

### Fixed

- @imtbl/immutablex_client: Updated to use core-sdk v2.0.2 with grind key fixes.
- Fixed an issue where the API version was appended to the header twice in every API call

### Changed

Expand Down
1 change: 1 addition & 0 deletions packages/passport/sdk/src/zkEvm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export type Provider = {
) => void;
on: (event: string, listener: (...args: any[]) => void) => void;
removeListener: (event: string, listener: (...args: any[]) => void) => void;
isPassport: boolean;
};

export enum ProviderEvent {
Expand Down
10 changes: 10 additions & 0 deletions packages/passport/sdk/src/zkEvm/zkEvmProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sendTransaction } from './sendTransaction';
import { JsonRpcError, ProviderErrorCode } from './JsonRpcError';
import GuardianClient from '../guardian/guardian';
import { RelayerClient } from './relayerClient';
import { Provider } from './types';

jest.mock('@ethersproject/providers');
jest.mock('./relayerClient');
Expand Down Expand Up @@ -274,4 +275,13 @@ describe('ZkEvmProvider', () => {
});
});
});

describe('isPassport', () => {
it('should be set to true', () => {
const provider = getProvider();

expect(provider.isPassport).toBe(true);
expect((provider as Provider).isPassport).toBe(true);
});
});
});
2 changes: 2 additions & 0 deletions packages/passport/sdk/src/zkEvm/zkEvmProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ export class ZkEvmProvider implements Provider {
this.eventEmitter = new TypedEventEmitter<ProviderEventMap>();
}

public isPassport: boolean = true;

private isLoggedIn(): this is LoggedInZkEvmProvider {
return this.magicProvider !== undefined
&& this.user !== undefined
Expand Down

0 comments on commit 6bc7bd9

Please sign in to comment.