Deletion

Querying for New Invite Events

import { EventId, SuiClient, getFullnodeUrl } from '@mysten/sui/client';
import { SageClient } from '@sage-app/sdk/client';

...

interface QueryInput {
  cursor?: EventId;
}

const network = 'mainnet' | 'testnet';
const suiClient = new SuiClient({ url: getFullnodeUrl(network) });
const sageClient = new SageClient({ network, suiClient });

...

const pollDeletedInvites = async ({ cursor }) => {
  const {
    eventCount,
    events,
    hasNextPage,
    nextCursor
  } = await sageClient.queryInviteDeleteEvents({ cursor }: QueryInput);
  
  // do something with events
  
  setTimeout(() => pollDeletedInvites({ cursor: nextCursor }), 5000);
};

In this case events will take the shape of an array of InviteDeleteEvent:

interface InviteDeleteEvent {
  inviteKey: string;
}  

Last updated