Skip to content

Commit b56bc22

Browse files
committed
fix: name and remove unused param
1 parent 85937b9 commit b56bc22

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

src/background/providers/ChainAgnosticProvider.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ethErrors } from 'eth-rpc-errors';
22
import AutoPairingPostMessageConnection from '../utils/messaging/AutoPairingPostMessageConnection';
3-
import { ChainAgnostinProvider } from './ChainAgnosticProvider';
3+
import { ChainAgnosticProvider } from './ChainAgnosticProvider';
44

55
jest.mock('./utils/onDomReady');
66
jest.mock('../utils/messaging/AutoPairingPostMessageConnection', () => {
@@ -16,15 +16,15 @@ describe('src/background/providers/ChainAgnosticProvider', () => {
1616

1717
describe('initialization', () => {
1818
it('should connect to the backgroundscript', async () => {
19-
new ChainAgnostinProvider(channelMock);
19+
new ChainAgnosticProvider(channelMock);
2020

2121
expect(channelMock.connect).toHaveBeenCalled();
2222
expect(channelMock.request).not.toHaveBeenCalled();
2323
});
2424
it('waits for message channel to be connected', async () => {
2525
const mockedChannel = new AutoPairingPostMessageConnection(false);
2626

27-
const provider = new ChainAgnostinProvider(channelMock);
27+
const provider = new ChainAgnosticProvider(channelMock);
2828
expect(mockedChannel.connect).toHaveBeenCalled();
2929
expect(mockedChannel.request).not.toHaveBeenCalled();
3030

@@ -39,7 +39,7 @@ describe('src/background/providers/ChainAgnosticProvider', () => {
3939

4040
describe('request', () => {
4141
it('should use the rate limits on `eth_requestAccounts` requests', async () => {
42-
const provider = new ChainAgnostinProvider(channelMock);
42+
const provider = new ChainAgnosticProvider(channelMock);
4343
(channelMock.request as jest.Mock).mockResolvedValue('success');
4444

4545
const firstCallCallback = jest.fn();
@@ -66,7 +66,7 @@ describe('src/background/providers/ChainAgnosticProvider', () => {
6666
);
6767
});
6868
it('shoud not use the rate limits on `random_method` requests', async () => {
69-
const provider = new ChainAgnostinProvider(channelMock);
69+
const provider = new ChainAgnosticProvider(channelMock);
7070
(channelMock.request as jest.Mock).mockResolvedValue('success');
7171

7272
const firstCallCallback = jest.fn();
@@ -90,7 +90,7 @@ describe('src/background/providers/ChainAgnosticProvider', () => {
9090
});
9191

9292
it('should call the request of the connection', async () => {
93-
const provider = new ChainAgnostinProvider(channelMock);
93+
const provider = new ChainAgnosticProvider(channelMock);
9494
(channelMock.request as jest.Mock).mockResolvedValueOnce('success');
9595

9696
await provider.request({
@@ -102,7 +102,7 @@ describe('src/background/providers/ChainAgnosticProvider', () => {
102102
});
103103
describe('CAIP-27', () => {
104104
it('should wrap the incoming request into CAIP-27 envelope and reuses the provided ID', async () => {
105-
const provider = new ChainAgnostinProvider(channelMock);
105+
const provider = new ChainAgnosticProvider(channelMock);
106106
// response for the actual call
107107
(channelMock.request as jest.Mock).mockResolvedValueOnce('success');
108108

src/background/providers/ChainAgnosticProvider.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import AbstractConnection from '../utils/messaging/AbstractConnection';
99
import { ChainId } from '@avalabs/core-chains-sdk';
1010
import RequestRatelimiter from './utils/RequestRatelimiter';
1111

12-
export class ChainAgnostinProvider extends EventEmitter {
12+
export class ChainAgnosticProvider extends EventEmitter {
1313
#contentScriptConnection: AbstractConnection;
1414

1515
#requestRateLimiter = new RequestRatelimiter([
@@ -68,19 +68,14 @@ export class ChainAgnostinProvider extends EventEmitter {
6868
};
6969

7070
request = async ({
71-
internal,
7271
data,
7372
sessionId,
7473
chainId,
7574
}: {
76-
internal?: boolean;
7775
data: PartialBy<JsonRpcRequestPayload, 'id' | 'params'>;
7876
sessionId: string;
7977
chainId: string | null;
8078
}) => {
81-
if (internal) {
82-
return this.#request({ data, chainId, sessionId });
83-
}
8479
return this.#requestRateLimiter.call(data.method, () =>
8580
this.#request({ data, chainId, sessionId })
8681
);

src/background/providers/CoreProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
type JsonRpcRequestPayload,
1818
} from '../connections/dAppConnection/models';
1919
import type { PartialBy, ProviderInfo } from '../models';
20-
import { ChainAgnostinProvider } from './ChainAgnosticProvider';
20+
import { ChainAgnosticProvider } from './ChainAgnosticProvider';
2121
import AbstractConnection from '../utils/messaging/AbstractConnection';
2222

2323
interface ProviderState {
@@ -30,7 +30,7 @@ interface ProviderState {
3030
export class CoreProvider extends EventEmitter {
3131
#providerReadyPromise = new ProviderReadyPromise();
3232
#contentScriptConnection: AbstractConnection;
33-
#chainagnosticProvider?: ChainAgnostinProvider;
33+
#chainagnosticProvider?: ChainAgnosticProvider;
3434

3535
readonly info: ProviderInfo = {
3636
name: EVM_PROVIDER_INFO_NAME,

src/background/providers/initializeInpageProvider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type AbstractConnection from '../utils/messaging/AbstractConnection';
2-
import { ChainAgnostinProvider } from './ChainAgnosticProvider';
2+
import { ChainAgnosticProvider } from './ChainAgnosticProvider';
33
import { CoreProvider } from './CoreProvider';
44
import { createMultiWalletProxy } from './MultiWalletProviderProxy';
55
import { EventNames, type EIP6963ProviderDetail } from './models';
@@ -18,7 +18,7 @@ export function initializeProvider(
1818
globalObject = window
1919
): CoreProvider {
2020
const chainAgnosticProvider = new Proxy(
21-
new ChainAgnostinProvider(connection),
21+
new ChainAgnosticProvider(connection),
2222
{
2323
deleteProperty: () => true,
2424
}
@@ -149,10 +149,10 @@ function announceWalletProvider(
149149
}
150150

151151
function announceChainAgnosticProvider(
152-
providerInstance: ChainAgnostinProvider,
152+
providerInstance: ChainAgnosticProvider,
153153
globalObject = window
154154
): void {
155-
const announceEvent = new CustomEvent<{ provider: ChainAgnostinProvider }>(
155+
const announceEvent = new CustomEvent<{ provider: ChainAgnosticProvider }>(
156156
EventNames.CORE_WALLET_ANNOUNCE_PROVIDER,
157157
{
158158
detail: Object.freeze({

0 commit comments

Comments
 (0)