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

remove bind-decorator dependency #1023

Merged
merged 2 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 0 additions & 1 deletion packages/wallet-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"lint": "eslint . --ext .ts,.tsx --fix"
},
"dependencies": {
"bind-decorator": "^1.0.11",
"bn.js": "^5.2.1",
"buffer": "^6.0.3",
"clsx": "^1.2.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-sdk/src/CoinbaseWalletSDK.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

test('@disconnect', () => {
const relayResetMock = jest
.spyOn(WalletLinkRelay.prototype, 'resetAndReload')
.spyOn((coinbaseWalletSDK2 as any)._relay, 'resetAndReload')

Check warning on line 49 in packages/wallet-sdk/src/CoinbaseWalletSDK.test.ts

View workflow job for this annotation

GitHub Actions / Lint Check

Unexpected any. Specify a different type

Check warning on line 49 in packages/wallet-sdk/src/CoinbaseWalletSDK.test.ts

View workflow job for this annotation

GitHub Actions / Lint Check

Unexpected any. Specify a different type
.mockImplementation(() => 'resetAndReload');
coinbaseWalletSDK2.disconnect();

Expand Down
7 changes: 3 additions & 4 deletions packages/wallet-sdk/src/relay/WalletLinkRelay.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) 2018-2023 Coinbase, Inc. <https://www.coinbase.com/>
// Licensed under the Apache License, version 2.0

import bind from 'bind-decorator';

import { DiagnosticLogger, EVENTS } from '../connection/DiagnosticLogger';
import { EventListener } from '../connection/EventListener';
import { ServerMessageEvent } from '../connection/ServerMessage';
Expand Down Expand Up @@ -101,6 +99,9 @@ export class WalletLinkRelay extends WalletSDKRelayAbstract {

constructor(options: Readonly<WalletLinkRelayOptions>) {
super();
this.resetAndReload = this.resetAndReload.bind(this);
this.handleIncomingEvent = this.handleIncomingEvent.bind(this);

Comment on lines +102 to +104
Copy link
Contributor Author

Choose a reason for hiding this comment

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

following the existing pattern
image

this.linkAPIUrl = options.linkAPIUrl;
this.storage = options.storage;
this.options = options;
Expand Down Expand Up @@ -320,7 +321,6 @@ export class WalletLinkRelay extends WalletSDKRelayAbstract {
this.ui.attach();
}

@bind
public resetAndReload(): void {
Promise.race([
this.connection.setSessionMetadata('__destroyed', '1'),
Expand Down Expand Up @@ -643,7 +643,6 @@ export class WalletLinkRelay extends WalletSDKRelayAbstract {
);
}

@bind
private handleIncomingEvent(event: ServerMessageEvent): void {
aes256gcm
.decrypt(event.data, this.session.secret)
Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2697,7 +2697,6 @@ __metadata:
"@types/node": ^14.18.54
"@types/sha.js": ^2.4.1
babel-jest: ^27.5.1
bind-decorator: ^1.0.11
bn.js: ^5.2.1
buffer: ^6.0.3
clsx: ^1.2.1
Expand Down Expand Up @@ -4814,13 +4813,6 @@ __metadata:
languageName: node
linkType: hard

"bind-decorator@npm:^1.0.11":
version: 1.0.11
resolution: "bind-decorator@npm:1.0.11"
checksum: 41b6c69af51ee7e6e01ea6f2939df94c9c760383f89f5befda0890951657baedbf499a0b96a789fd85cb77252465134f4e6184aae6639ed60cf59549ef15353d
languageName: node
linkType: hard

"bn.js@npm:^5.2.1":
version: 5.2.1
resolution: "bn.js@npm:5.2.1"
Expand Down
Loading