Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

transferSubscription

Subscribe to live transfer events for a single username. WebSocket only.

Signature

function transferSubscription(
  client: Client,
  parameters: SubscriptionCallbacks<{
    transfers: IndexedTransferEvent[]
  }> & {
    username: string
    sinceBlockHeight?: number
  },
): () => void

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const unsubscribe = client.transferSubscription({
  username: "alice",
  next: ({ transfers }) => transfers.forEach((t) => console.log(t.fromAddress, t.amount)),
})

Parameters

usernamestring. The user to watch.

sinceBlockHeightnumber, optional. Replay from this height.

next, error, complete — callbacks.

Returns

() => void — unsubscribe.

See also