Skip to content

Commit

Permalink
refactor: initialize XRPC within Tsky constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
shuuji3 committed Jan 9, 2025
1 parent 54afc7a commit c9c94e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 2 additions & 4 deletions packages/client/src/bsky/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CredentialManager, XRPC } from '@atcute/client';
import { CredentialManager } from '@atcute/client';
import { describe, expect, it } from 'vitest';
import { Tsky } from '~/index';

Expand Down Expand Up @@ -31,9 +31,7 @@ async function getAliceTsky() {
password: TEST_CREDENTIALS.alice.appPassword,
});

const xrpc = new XRPC({ handler: manager });

return new Tsky(xrpc);
return new Tsky(manager);
}

describe('bsky', () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/client/src/tsky/tsky.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import type { XRPC } from '@atcute/client';
import type { CredentialManager } from '@atcute/client';
import { XRPC } from '@atcute/client';
import type { Queries } from '@tsky/lexicons';
import { Bsky } from '~/bsky';
import { Client } from './client';

export class Tsky {
client: Client<Queries>;

constructor(xrpc: XRPC) {
constructor(manager: CredentialManager) {
const xrpc = new XRPC({ handler: manager });
this.client = new Client(xrpc);
}

Expand Down

0 comments on commit c9c94e7

Please sign in to comment.