golem-base-sdk
    Preparing search index...

    Interface GolemBaseROClient

    interface GolemBaseROClient {
        getAllEntityKeys(): Promise<`0x${string}`[]>;
        getEntitiesOfOwner(address: `0x${string}`): Promise<`0x${string}`[]>;
        getEntitiesToExpireAtBlock(blockNumber: bigint): Promise<`0x${string}`[]>;
        getEntityCount(): Promise<number>;
        getEntityMetaData(key: `0x${string}`): Promise<EntityMetaData>;
        getRawClient(): internal.GolemBaseROClient;
        getStorageValue(key: `0x${string}`): Promise<Uint8Array<ArrayBufferLike>>;
        queryEntities(
            query: string,
        ): Promise<{ entityKey: `0x${string}`; storageValue: Uint8Array }[]>;
        watchLogs(
            args: {
                fromBlock: bigint;
                onCreated: (
                    args: { entityKey: `0x${string}`; expirationBlock: number },
                ) => void;
                onDeleted: (args: { entityKey: `0x${string}` }) => void;
                onError?: (error: Error) => void;
                onExtended: (
                    args: {
                        entityKey: `0x${string}`;
                        newExpirationBlock: number;
                        oldExpirationBlock: number;
                    },
                ) => void;
                onUpdated: (
                    args: { entityKey: `0x${string}`; expirationBlock: number },
                ) => void;
                pollingInterval?: number;
                transport?: "http" | "websocket";
            },
        ): () => void;
    }

    Hierarchy

    Index

    Methods

    • Get the entity keys of all entities in GolemBase

      Returns Promise<`0x${string}`[]>

    • Get the entity keys of all entities in GolemBase owned by the given address

      Parameters

      • address: `0x${string}`

      Returns Promise<`0x${string}`[]>

      Array of the entity keys

    • Get all entity keys for entities that will expire at the given block number

      Parameters

      • blockNumber: bigint

        The block number

      Returns Promise<`0x${string}`[]>

      An array of entities that expire at the given block

    • Get the total count of entities in GolemBase

      Returns Promise<number>

    • Get entity metadata

      Parameters

      • key: `0x${string}`

        The key of the entity to look up

      Returns Promise<EntityMetaData>

      The entity's metadata

    • Get the storage value associated with the given entity key

      Parameters

      • key: `0x${string}`

        The key of the entity to look up

      Returns Promise<Uint8Array<ArrayBufferLike>>

      The base64-encoded value stored in the entity

    • Query entities in GolemBase based on annotations

      Parameters

      • query: string

        The query to look up entities with

      Returns Promise<{ entityKey: `0x${string}`; storageValue: Uint8Array }[]>

      Array of the entities that matched the query

    • Install callbacks that will be invoked for every GolemBase transaction

      Parameters

      • args: {
            fromBlock: bigint;
            onCreated: (
                args: { entityKey: `0x${string}`; expirationBlock: number },
            ) => void;
            onDeleted: (args: { entityKey: `0x${string}` }) => void;
            onError?: (error: Error) => void;
            onExtended: (
                args: {
                    entityKey: `0x${string}`;
                    newExpirationBlock: number;
                    oldExpirationBlock: number;
                },
            ) => void;
            onUpdated: (
                args: { entityKey: `0x${string}`; expirationBlock: number },
            ) => void;
            pollingInterval?: number;
            transport?: "http" | "websocket";
        }
        • fromBlock: bigint

          The starting block, events trigger the callbacks starting from this block

        • onCreated: (args: { entityKey: `0x${string}`; expirationBlock: number }) => void

          A callback that's invoked whenever entities are created

        • onDeleted: (args: { entityKey: `0x${string}` }) => void

          A callback that's invoked whenever entities are deleted

        • OptionalonError?: (error: Error) => void

          A callback that's invoked whenever there is an error during the processing

        • onExtended: (
              args: {
                  entityKey: `0x${string}`;
                  newExpirationBlock: number;
                  oldExpirationBlock: number;
              },
          ) => void

          A callback that's invoked whenever entities have their BTL extended

        • onUpdated: (args: { entityKey: `0x${string}`; expirationBlock: number }) => void

          A callback that's invoked whenever entitier are updated

        • OptionalpollingInterval?: number

          In that case of HTTP transport, the polling interval in milliseconds. Defaults to the default polling interval of viem

        • Optionaltransport?: "http" | "websocket"

          The transport to use, either HTTP or WebSocket (the default)

      Returns () => void

      a callback to cancel the subscription and stop receiving notifications