Skip to content

Commit db378f5

Browse files
chore: import paths
1 parent d2baa52 commit db378f5

6 files changed

Lines changed: 24 additions & 6 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './onClientRequest';
2+
export * from './onStart';
3+
export * from './onWebSocketEvent';

packages/snap/src/core/handlers/onCronjob/backgroundEvents/onAccountsRefresh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export const onAccountsRefresh: OnCronjobHandler = async () => {
2323
logger.info('[onAccountsRefresh] Cronjob triggered');
2424

2525
const accounts = await keyring.listAccounts();
26+
2627
const scope = Network.Mainnet;
2728

2829
const accountsWithChangeCheckPromises = accounts.map(async (account) => {

packages/snap/src/core/handlers/onStart/onStartHandler.ts renamed to packages/snap/src/core/handlers/onStart/StartHandler.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import type { SubscriptionConnectionManagerPort } from '../../ports/SubscriptionConnectionManagerPort';
22

3-
export class OnStartHandler {
3+
export class StartHandler {
44
constructor(
55
private readonly subscriptionConnectionManager: SubscriptionConnectionManagerPort,
66
) {}
7+
8+
async handle(): Promise<void> {
9+
// Wipe the subscriptions state
10+
// Open the connections for all networks
11+
// Init the subscriptions
12+
}
713
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export * from './onStartHandler';
1+
export * from './StartHandler';

packages/snap/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { installPolyfills } from './infrastructure/polyfills';
4343
import snapContext, {
4444
clientRequestHandler,
4545
keyring,
46-
onStartHandler,
46+
startHandler,
4747
state,
4848
webSocketEventHandler,
4949
} from './snapContext';
@@ -275,4 +275,4 @@ export const onWebSocketEvent: OnWebSocketEventHandler = async ({ event }) =>
275275
withCatchAndThrowSnapError(async () => webSocketEventHandler.handle(event));
276276

277277
export const onStart: OnStartHandler = async () =>
278-
withCatchAndThrowSnapError(async () => onStartHandler.handle());
278+
withCatchAndThrowSnapError(async () => startHandler.handle());

packages/snap/src/snapContext.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ import { StateCache } from './core/caching/StateCache';
44
import { PriceApiClient } from './core/clients/price-api/PriceApiClient';
55
import { SecurityAlertsApiClient } from './core/clients/security-alerts-api/SecurityAlertsApiClient';
66
import { TokenMetadataClient } from './core/clients/token-metadata-client/TokenMetadataClient';
7-
import { ClientRequestHandler } from './core/handlers/onClientRequest';
7+
import {
8+
ClientRequestHandler,
9+
StartHandler,
10+
WebSocketEventHandler,
11+
} from './core/handlers';
812
import { SolanaKeyring } from './core/handlers/onKeyringRequest/Keyring';
9-
import { WebSocketEventHandler } from './core/handlers/onWebSocketEvent';
1013
import type {
1114
SubscriptionConnectionManagerPort,
1215
SubscriptionTransportPort,
@@ -64,6 +67,7 @@ export type SnapExecutionContext = {
6467
subscriptionTransport: SubscriptionTransportPort;
6568
webSocketService: WebSocketService;
6669
webSocketEventHandler: WebSocketEventHandler;
70+
startHandler: StartHandler;
6771
};
6872

6973
const configProvider = new ConfigProvider();
@@ -166,6 +170,8 @@ const clientRequestHandler = new ClientRequestHandler(
166170
logger,
167171
);
168172

173+
const startHandler = new StartHandler(subscriptionConnectionManager);
174+
169175
const snapContext: SnapExecutionContext = {
170176
configProvider,
171177
connection,
@@ -190,6 +196,7 @@ const snapContext: SnapExecutionContext = {
190196
subscriptionTransport,
191197
webSocketService,
192198
webSocketEventHandler,
199+
startHandler,
193200
};
194201

195202
export {
@@ -204,6 +211,7 @@ export {
204211
priceApiClient,
205212
sendSolBuilder,
206213
sendSplTokenBuilder,
214+
startHandler,
207215
state,
208216
subscriptionConnectionManager,
209217
subscriptionTransport,

0 commit comments

Comments
 (0)