@@ -2,7 +2,9 @@ import fs from 'node:fs/promises';
22
33import type { TestProject } from 'vitest/node' ;
44
5- import { CredentialManager , XRPC } from '@atcute/client' ;
5+ import type { ComAtprotoRepoUploadBlob } from '@atcute/atproto' ;
6+ import { Client , CredentialManager } from '@atcute/client' ;
7+ import type { ActorIdentifier , Handle } from '@atcute/lexicons' ;
68import { TestNetwork } from '@atproto/dev-env' ;
79
810declare module 'vitest' {
@@ -21,7 +23,7 @@ export async function setup(project: TestProject) {
2123 ) ;
2224
2325 const manager = new CredentialManager ( { service : network . pds . url } ) ;
24- const rpc = new XRPC ( {
26+ const rpc = new Client ( {
2527 handler : manager ,
2628 } ) ;
2729
@@ -44,9 +46,9 @@ export async function teardown() {
4446 await network . close ( ) ;
4547}
4648
47- const createAccount = async ( rpc : XRPC , handle : string ) => {
48- await rpc . call ( 'com.atproto.server.createAccount' , {
49- data : {
49+ const createAccount = async ( rpc : Client , handle : Handle ) => {
50+ await rpc . post ( 'com.atproto.server.createAccount' , {
51+ input : {
5052 handle : handle ,
5153 email : `${ handle } @example.com` ,
5254 password : 'password' ,
@@ -55,15 +57,15 @@ const createAccount = async (rpc: XRPC, handle: string) => {
5557 console . log ( `🙋 Created new account: @${ handle } ` ) ;
5658} ;
5759
58- async function createProfileRecord ( rpc : XRPC , handle : string ) {
60+ async function createProfileRecord ( rpc : Client , handle : ActorIdentifier ) {
5961 const imageBuffer = await fs . readFile ( 'alice-avatar.jpeg' ) ;
60- const { data : blob } = await rpc . call ( 'com.atproto.repo.uploadBlob' , {
62+ const { data : blob } = ( await rpc . post ( 'com.atproto.repo.uploadBlob' , {
6163 headers : { 'content-type' : 'image/jpeg' } ,
62- data : imageBuffer ,
63- } ) ;
64+ input : imageBuffer ,
65+ } ) ) as { data : ComAtprotoRepoUploadBlob . $output } ;
6466
65- await rpc . call ( 'com.atproto.repo.createRecord' , {
66- data : {
67+ await rpc . post ( 'com.atproto.repo.createRecord' , {
68+ input : {
6769 repo : handle ,
6870 collection : 'app.bsky.actor.profile' ,
6971 record : {
@@ -77,9 +79,9 @@ async function createProfileRecord(rpc: XRPC, handle: string) {
7779 } ) ;
7880}
7981
80- async function createSamplePosts ( rpc : XRPC , handle : string ) {
81- await rpc . call ( 'com.atproto.repo.createRecord' , {
82- data : {
82+ async function createSamplePosts ( rpc : Client , handle : ActorIdentifier ) {
83+ await rpc . post ( 'com.atproto.repo.createRecord' , {
84+ input : {
8385 repo : handle ,
8486 collection : 'app.bsky.feed.post' ,
8587 record : {
0 commit comments