Interface UseSail

Hierarchy

Properties

batchDurationMs: number

Duration in ms in which to batch all accounts data requests. Defaults to 500ms.

batchFetcher: AccountInfoFetcher

Fetches accounts.

batchProviderMut: null | Provider

Provider using the batch fetcher.

disableAutoRefresh: boolean

If true, disables periodic account refetches for subscriptions.

fetchKeys: FetchKeysFn

Fetches the data associated with the given keys, via the AccountLoader.

getCached: ((key: PublicKey) => undefined | null | AccountInfo<Buffer>)

Type declaration

    • (key: PublicKey): undefined | null | AccountInfo<Buffer>
    • Gets the cached data of an account.

      Parameters

      • key: PublicKey

      Returns undefined | null | AccountInfo<Buffer>

getDatum: ((key: undefined | null | PublicKey) => AccountDatum)

Type declaration

    • (key: undefined | null | PublicKey): AccountDatum
    • Gets an AccountDatum from the cache.

      If the AccountInfo has never been fetched, this returns undefined. If the AccountInfo has been fetched but wasn't found, this returns null.

      Parameters

      • key: undefined | null | PublicKey

      Returns AccountDatum

handleTX: HandleTX

Signs and sends a transaction using the provider on the TransactionEnvelope.

handleTXs: HandleTXs

Signs and sends multiple transactions using the provider on the first TransactionEnvelope. These transactions are only sent if all of them are signed.

The loader. Usually should not be used directly.

onBatchCache: ((cb: ((args: CacheBatchUpdateEvent) => void)) => void)

Type declaration

onError: ((err: SailError) => void)

Type declaration

    • (err: SailError): void
    • Called whenever an error occurs.

      Parameters

      Returns void

refetch: ((key: PublicKey) => Promise<null | AccountInfo<Buffer>>)

Type declaration

    • (key: PublicKey): Promise<null | AccountInfo<Buffer>>
    • Refetches an account.

      Parameters

      • key: PublicKey

      Returns Promise<null | AccountInfo<Buffer>>

refetchAllSubscriptions: (() => Promise<void>)

Type declaration

    • (): Promise<void>
    • Refetches all accounts that are being subscribed to.

      Returns Promise<void>

refetchMany: ((keys: readonly PublicKey[]) => Promise<(null | AccountInfo<Buffer> | Error)[]>)

Type declaration

    • (keys: readonly PublicKey[]): Promise<(null | AccountInfo<Buffer> | Error)[]>
    • Refetches multiple accounts.

      Parameters

      • keys: readonly PublicKey[]

      Returns Promise<(null | AccountInfo<Buffer> | Error)[]>

refreshIntervalMs: number

Milliseconds between each refresh. Defaults to 60_000.

subscribe: ((key: PublicKey) => (() => Promise<void>))

Type declaration

    • (key: PublicKey): (() => Promise<void>)
    • Causes a key to be refetched periodically.

      Parameters

      • key: PublicKey

      Returns (() => Promise<void>)

        • (): Promise<void>
        • Returns Promise<void>

useWebsocketAccountUpdates: boolean

If true, allows one to subscribe to account updates via websockets rather than via polling.

Generated using TypeDoc