Hierarchy

Constructors

Properties

_connectingPromise: Promise<void> = null
_epochCache: EpochCache = ...
_epochUpdateTimeout: Timeout = null
_networkSyncInterval: Timeout = null
_stakingContract: Contract = null
_stakingContractListener: Listener = null
connectedNodes: any = ...
hdRootPubkeys: string[] = null
lastBlockHashRetrieved: number = null
latestBlockhash: string = null
networkPubKey: string = null
networkPubKeySet: string = null
ready: boolean = false
serverKeys: Record<string, JsonHandshakeResponse> = {}
subnetPubKey: string = null

Accessors

Methods

  • Sets up a listener to detect state changes (new epochs) in the staking contract. When a new epoch is detected, it triggers the setNewConfig function to update the client's configuration based on the new state of the network. This ensures that the client's configuration is always in sync with the current state of the staking contract.

    Returns

    A promise that resolves when the listener is successfully set up.

    Returns void

  • Private

    Handshakes with all nodes that are in bootstrapUrls

    Returns

    Returns a set of the urls of nodes that we successfully connected to, an object containing their returned keys, and our 'core' config (most common values for critical values)

    Returns Promise<{
        connectedNodes: Set<string>;
        coreNodeConfig: CoreNodeConfig;
        serverKeys: Record<string, JsonHandshakeResponse>;
    }>

  • Private

    Schedule an update to the current epoch number for EPOCH_PROPAGATION_DELAY seconds from now We don't immediately update this value on NextValidatorSetLocked state changes because we want to give the nodes a few seconds to update to the new epoch before we start sending the new epoch number with requests

    This function should only be called as a result of a rare state change (NextValidatorSetLocked) So we don't debounce setting the timeout handler.

    Returns void

  • Private

    Currently, we perform a full sync every 30s, including handshaking with every node However, we also have a state change listener that watches for staking contract state change events, which should be the only time that we need to perform handshakes with every node.

    However, the current block hash does need to be updated regularly, and we currently update it only when we handshake with every node.

    We can remove this network sync code entirely if we refactor our code to fetch latest blockhash on-demand.

    Returns void

  • Calculates a Key Id for claiming a pkp based on a user identifier and an app identifier. The key Identifier is an Auth Method Id which scopes the key uniquely to a specific application context. These identifiers are specific to each auth method and will derive the public key portion of a pkp which will be persisted when a key is claimed.

    Auth Method User ID App ID
    Google OAuth token sub token aud
    Discord OAuth user id client app identifier
    Stytch OTP token sub token aud
    Lit Actions user defined ipfs cid
    Note Lit Action claiming uses a different schema than other auth methods

    Returns

    public key of pkp when claimed

    Parameters

    • userId: string

      user identifier for the Key Identifier

    • appId: string

      app identifier for the Key Identifier

    • isForActionContext: boolean = false

      should be set for true if using claiming through actions

    Returns string

  • Calculates an HD public key from a given keyId The curve type or signature type is assumed to be k256 unless provided

    Returns

    public key

    Parameters

    • keyId: string
    • sigType: SIGTYPE = SIGTYPE.EcdsaCaitSith

    Returns string

  • Stops internal listeners/polling that refresh network state and watch for epoch changes

    Returns Promise<void>

  • Get and gather node promises

    Returns

    Parameters

    • callback: ((url: string) => Promise<any>)
        • (url: string): Promise<any>
        • Parameters

          • url: string

          Returns Promise<any>

    Returns Promise<any>[]

  • Get a random hex string for use as an attestation challenge

    Returns

    Parameters

    • size: number

    Returns string

  • Asynchronously updates the configuration settings for the LitNodeClient. This function fetches the minimum node count and bootstrap URLs for the specified Lit network.

    It validates these values and updates the client's configuration accordingly.

    It also stashes a handle on the Staking Contract so that we can use it for polling for epoch-related state changes

    Throws

    Will throw an error if the minimum node count is invalid or if the bootstrap URLs array is empty.

    Returns

    A promise that resolves when the configuration is updated.

    Returns Promise<void>

Generated using TypeDoc