Hierarchy

  • LitContracts

Constructors

Properties

allowlistContract: {
    read: Allowlist;
    write: Allowlist;
}

Type declaration

  • read: Allowlist
  • write: Allowlist
connected: boolean = false
debug: boolean = false
isPKP: boolean = false
litTokenContract: {
    read: LITToken;
    write: LITToken;
}

Type declaration

  • read: LITToken
  • write: LITToken
multisenderContract: {
    read: Multisender;
    write: Multisender;
}

Type declaration

  • read: Multisender
  • write: Multisender
options?: {
    storeOrUseStorageKey?: boolean;
}

Type declaration

  • Optional storeOrUseStorageKey?: boolean
pkpHelperContract: {
    read: PKPHelper;
    write: PKPHelper;
}

Type declaration

  • read: PKPHelper
  • write: PKPHelper
pkpHelperContractUtil: {
    read: {};
    write: {
        mintNextAndAddAuthMethods: ((param0: MintNextAndAddAuthMethods) => Promise<ContractTransaction>);
    };
} = ...

Type declaration

pkpNftContract: {
    read: PKPNFT;
    write: PKPNFT;
}

Type declaration

  • read: PKPNFT
  • write: PKPNFT
pkpNftContractUtils: {
    read: {
        getTokens: ((latestNumberOfTokens: number) => Promise<string[]>);
        getTokensByAddress: ((ownerAddress: string) => Promise<string[]>);
        getTokensInfoByAddress: ((ownerAddress: string) => Promise<TokenInfo[]>);
    };
    write: {
        claimAndMint: ((derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: CallOverrides) => Promise<{
            res: any;
            tokenId: any;
            tx: any;
        }>);
        mint: ((param?: GasLimitParam) => Promise<{
            pkp: {
                ethAddress: any;
                publicKey: any;
                tokenId: any;
            };
            res: any;
            tokenId: any;
            tx: any;
        }>);
    };
} = ...

Type declaration

  • read: {
        getTokens: ((latestNumberOfTokens: number) => Promise<string[]>);
        getTokensByAddress: ((ownerAddress: string) => Promise<string[]>);
        getTokensInfoByAddress: ((ownerAddress: string) => Promise<TokenInfo[]>);
    }
    • getTokens: ((latestNumberOfTokens: number) => Promise<string[]>)
        • (latestNumberOfTokens: number): Promise<string[]>
        • (IERC721Enumerable)

          Get the x latest number of tokens

          Returns

          a list of PKP NFTs

          Parameters

          • latestNumberOfTokens: number

          Returns Promise<string[]>

    • getTokensByAddress: ((ownerAddress: string) => Promise<string[]>)
        • (ownerAddress: string): Promise<string[]>
        • (IERC721Enumerable)

          Get all PKPs by a given address

          Retu

          Parameters

          • ownerAddress: string

          Returns Promise<string[]>

    • getTokensInfoByAddress: ((ownerAddress: string) => Promise<TokenInfo[]>)
        • (ownerAddress: string): Promise<TokenInfo[]>
        • Get info of all PKPs by a given address

          Parameters

          • ownerAddress: string

          Returns Promise<TokenInfo[]>

  • write: {
        claimAndMint: ((derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: CallOverrides) => Promise<{
            res: any;
            tokenId: any;
            tx: any;
        }>);
        mint: ((param?: GasLimitParam) => Promise<{
            pkp: {
                ethAddress: any;
                publicKey: any;
                tokenId: any;
            };
            res: any;
            tokenId: any;
            tx: any;
        }>);
    }
    • claimAndMint: ((derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: CallOverrides) => Promise<{
          res: any;
          tokenId: any;
          tx: any;
      }>)
        • (derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: CallOverrides): Promise<{
              res: any;
              tokenId: any;
              tx: any;
          }>
        • Parameters

          Returns Promise<{
              res: any;
              tokenId: any;
              tx: any;
          }>

    • mint: ((param?: GasLimitParam) => Promise<{
          pkp: {
              ethAddress: any;
              publicKey: any;
              tokenId: any;
          };
          res: any;
          tokenId: any;
          tx: any;
      }>)
        • (param?: GasLimitParam): Promise<{
              pkp: {
                  ethAddress: any;
                  publicKey: any;
                  tokenId: any;
              };
              res: any;
              tokenId: any;
              tx: any;
          }>
        • Parameters

          Returns Promise<{
              pkp: {
                  ethAddress: any;
                  publicKey: any;
                  tokenId: any;
              };
              res: any;
              tokenId: any;
              tx: any;
          }>

pkpNftMetadataContract: {
    read: PKPNFTMetadata;
    write: PKPNFTMetadata;
}

Type declaration

  • read: PKPNFTMetadata
  • write: PKPNFTMetadata
pkpPermissionsContract: {
    read: PKPPermissions;
    write: PKPPermissions;
}

Type declaration

  • read: PKPPermissions
  • write: PKPPermissions
pkpPermissionsContractUtils: {
    read: {
        getPermittedActions: ((tokenId: BigNumberish) => Promise<string[]>);
        getPermittedAddresses: ((tokenId: string) => Promise<string[]>);
        isPermittedAction: ((pkpId: string, ipfsId: string) => Promise<boolean>);
        isPermittedAddress: ((tokenId: string, address: string) => Promise<boolean>);
    };
    write: {
        addPermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>);
        addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<ContractTransaction>);
        revokePermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>);
    };
} = ...

Type declaration

  • read: {
        getPermittedActions: ((tokenId: BigNumberish) => Promise<string[]>);
        getPermittedAddresses: ((tokenId: string) => Promise<string[]>);
        isPermittedAction: ((pkpId: string, ipfsId: string) => Promise<boolean>);
        isPermittedAddress: ((tokenId: string, address: string) => Promise<boolean>);
    }
    • getPermittedActions: ((tokenId: BigNumberish) => Promise<string[]>)
        • (tokenId: BigNumberish): Promise<string[]>
        • Get permitted action

          Returns

          Parameters

          Returns Promise<string[]>

    • getPermittedAddresses: ((tokenId: string) => Promise<string[]>)
        • (tokenId: string): Promise<string[]>
        • Get permitted addresses

          Returns

          Parameters

          • tokenId: string

          Returns Promise<string[]>

    • isPermittedAction: ((pkpId: string, ipfsId: string) => Promise<boolean>)
        • (pkpId: string, ipfsId: string): Promise<boolean>
        • Check if an action is permitted given the pkpid and ipfsId

          Returns

          transaction

          Parameters

          • pkpId: string

            103309008291725705563022469659474510532358692659842796086905702509072063991354

          • ipfsId: string

            QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

          Returns Promise<boolean>

    • isPermittedAddress: ((tokenId: string, address: string) => Promise<boolean>)
        • (tokenId: string, address: string): Promise<boolean>
        • Check if an address is permitted

          Returns

          Parameters

          • tokenId: string
          • address: string

          Returns Promise<boolean>

  • write: {
        addPermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>);
        addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<ContractTransaction>);
        revokePermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>);
    }
    • addPermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>)
        • (pkpId: string, ipfsId: string): Promise<ContractTransaction>
        • Add permitted action to a given PKP id & ipfsId

          Returns

          transaction

          Parameters

          • pkpId: string

            103309008291725705563022469659474510532358692659842796086905702509072063991354

          • ipfsId: string

            QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

          Returns Promise<ContractTransaction>

    • addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<ContractTransaction>)
        • (pkpId: string, ownerAddress: string): Promise<ContractTransaction>
        • TODO: add transaction type Add permitted action to a given PKP id & ipfsId

          Returns

          transaction

          Parameters

          • pkpId: string

            103309008291725705563022469659474510532358692659842796086905702509072063991354

          • ownerAddress: string

            0x3B5dD2605.....22aDC499A1

          Returns Promise<ContractTransaction>

    • revokePermittedAction: ((pkpId: string, ipfsId: string) => Promise<ContractTransaction>)
        • (pkpId: string, ipfsId: string): Promise<ContractTransaction>
        • Revoke permitted action of a given PKP id & ipfsId

          Returns

          transaction

          Parameters

          • pkpId: string

            103309008291725705563022469659474510532358692659842796086905702509072063991354

          • ipfsId: string

            QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

          Returns Promise<ContractTransaction>

privateKey: string
provider: any
pubkeyRouterContract: {
    read: PubkeyRouter;
    write: PubkeyRouter;
}

Type declaration

  • read: PubkeyRouter
  • write: PubkeyRouter
randomPrivateKey: boolean = false
rateLimitNftContract: {
    read: RateLimitNFT;
    write: RateLimitNFT;
}

Type declaration

  • read: RateLimitNFT
  • write: RateLimitNFT
rateLimitNftContractUtils: {
    read: {
        getCapacityByIndex: ((index: number) => Promise<any>);
        getTokenURIByIndex: ((index: number) => Promise<string>);
        getTokens: (() => Promise<any>);
        getTokensByOwnerAddress: ((ownerAddress: string) => Promise<any>);
    };
    write: {
        mint: ((__namedParameters: {
            timestamp: number;
            txOpts: CallOverrides;
        }) => Promise<{
            tokenId: any;
            tx: any;
        }>);
        transfer: ((__namedParameters: {
            RLITokenAddress: string;
            fromAddress: string;
            toAddress: string;
        }) => Promise<ContractTransaction>);
    };
} = ...

Type declaration

  • read: {
        getCapacityByIndex: ((index: number) => Promise<any>);
        getTokenURIByIndex: ((index: number) => Promise<string>);
        getTokens: (() => Promise<any>);
        getTokensByOwnerAddress: ((ownerAddress: string) => Promise<any>);
    }
    • getCapacityByIndex: ((index: number) => Promise<any>)
        • (index: number): Promise<any>
        • getCapacityByIndex: async (index: number): Promise => {

          This function takes a token index as a parameter and returns the capacity of the token with the given index. The capacity is an object that contains the number of requests per millisecond that the token allows, and an object with the expiration timestamp and formatted expiration date of the token.

          Returns

          • A promise that resolves to the capacity of the token.

          Example:

          const capacity = await getCapacityByIndex(1); this.log(capacity); // Output: { // requestsPerMillisecond: 100, // expiresAt: { // timestamp: 1623472800, // formatted: '2022-12-31', // }, // }

          }

          Parameters

          • index: number

            The index of the token.

          Returns Promise<any>

    • getTokenURIByIndex: ((index: number) => Promise<string>)
        • (index: number): Promise<string>
        • getTokenURIByIndex: async (index: number): Promise => {

          This function takes a token index as a parameter and returns the URI of the token with the given index.

          Returns

          • A promise that resolves to the URI of the token.

          Example:

          const URI = await getTokenURIByIndex(1); this.log(URI); // Output: 'https://tokens.com/1'

          }

          Parameters

          • index: number

            The index of the token.

          Returns Promise<string>

    • getTokens: (() => Promise<any>)
        • (): Promise<any>
        • getTokens: async (): Promise => {

          This function returns an array of all tokens that have been minted.

          Returns

          • A promise that resolves to an array of token objects.

          Example:

          const tokens = await getTokens(); this.log(tokens); // Output: [ // { // tokenId: 1, // URI: 'https://tokens.com/1', // capacity: 100, // isExpired: false, // }, // { // tokenId: 2, // URI: 'https://tokens.com/2', // capacity: 200, // isExpired: true, // }, // ... // ]

          }

          Returns Promise<any>

    • getTokensByOwnerAddress: ((ownerAddress: string) => Promise<any>)
        • (ownerAddress: string): Promise<any>
        • getTokensByOwnerAddress: async (ownerAddress: string): Promise => {

          This function takes an owner address as a parameter and returns an array of tokens that are owned by the given address.

          Returns

          • A promise that resolves to an array of token objects.

          Example:

          const tokens = await getTokensByOwnerAddress('0x1234...5678'); this.log(tokens); // Output: [ // { // tokenId: 1, // URI: 'https://tokens.com/1', // capacity: 100, // isExpired: false, // }, // { // tokenId: 2, // URI: 'https://tokens.com/2', // capacity: 200, // isExpired: true, // }, // ... // ]

          }

          Parameters

          • ownerAddress: string

            The address of the owner.

          Returns Promise<any>

  • write: {
        mint: ((__namedParameters: {
            timestamp: number;
            txOpts: CallOverrides;
        }) => Promise<{
            tokenId: any;
            tx: any;
        }>);
        transfer: ((__namedParameters: {
            RLITokenAddress: string;
            fromAddress: string;
            toAddress: string;
        }) => Promise<ContractTransaction>);
    }
    • mint: ((__namedParameters: {
          timestamp: number;
          txOpts: CallOverrides;
      }) => Promise<{
          tokenId: any;
          tx: any;
      }>)
        • (__namedParameters: {
              timestamp: number;
              txOpts: CallOverrides;
          }): Promise<{
              tokenId: any;
              tx: any;
          }>
        • Parameters

          Returns Promise<{
              tokenId: any;
              tx: any;
          }>

    • transfer: ((__namedParameters: {
          RLITokenAddress: string;
          fromAddress: string;
          toAddress: string;
      }) => Promise<ContractTransaction>)
        • (__namedParameters: {
              RLITokenAddress: string;
              fromAddress: string;
              toAddress: string;
          }): Promise<ContractTransaction>
        • Transfer RLI token from one address to another

          Property

          Property

          Property

          Returns

          void

          Parameters

          • __namedParameters: {
                RLITokenAddress: string;
                fromAddress: string;
                toAddress: string;
            }
            • RLITokenAddress: string
            • fromAddress: string
            • toAddress: string

          Returns Promise<ContractTransaction>

routerContractUtils: {
    read: {};
    write: {};
} = ...

Type declaration

  • read: {}
    • write: {}
      rpc: string
      rpcs: string[]
      signer: Wallet | Signer
      stakingBalancesContract: {
          read: StakingBalances;
          write: StakingBalances;
      }

      Type declaration

      • read: StakingBalances
      • write: StakingBalances
      stakingContract: {
          read: Staking;
          write: Staking;
      }

      Type declaration

      • read: Staking
      • write: Staking
      utils: {
          decToHex: any;
          getBytes32FromMultihash: ((ipfsId: string, CID: CIDParser) => IPFSHash);
          getBytesFromMultihash: ((multihash: string) => string);
          getMultihashFromBytes: ((byte32: string) => string);
          hexToDec: any;
          timestamp2Date: ((timestamp: string) => string);
      } = ...

      Type declaration

      • decToHex: any
      • getBytes32FromMultihash: ((ipfsId: string, CID: CIDParser) => IPFSHash)
          • (ipfsId: string, CID: CIDParser): IPFSHash
          • NOTE: This function requires the "multiformats/cid" package in order to work

            Partition multihash string into object representing multihash

            Example

            const CID = require('multiformats/cid')
            const ipfsId = 'QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW'
            const bytes32 = getBytes32FromMultihash(ipfsId, CID)
            console.log(bytes32)

            Returns

            Parameters

            • ipfsId: string

              A base58 encoded multihash string

            • CID: CIDParser

              The CID object from the "multiformats/cid" package

            Returns IPFSHash

      • getBytesFromMultihash: ((multihash: string) => string)
          • (multihash: string): string
          • Partition multihash string into object representing multihash

            Returns

            Parameters

            • multihash: string

              A base58 encoded multihash string

            Returns string

      • getMultihashFromBytes: ((byte32: string) => string)
          • (byte32: string): string
          • Convert bytes32 to IPFS ID

            Returns

            QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

            Parameters

            • byte32: string

              0x1220baa0d1e91f2a22fef53659418ddc3ac92da2a76d994041b86ed62c0c999de477

            Returns string

      • hexToDec: any
      • timestamp2Date: ((timestamp: string) => string)
          • (timestamp: string): string
          • Parameters

            • timestamp: string

            Returns string

      contractNames: (keyof ExclusiveLitContractContext)[] = ...
      logger: Logger = ...

      Methods

      • Type Parameters

        • T extends Contract<T>

        • K extends string | number | symbol

        Parameters

        • contract: T
        • method: K
        • args: Parameters<T["functions"][K]>
        • overrides: CallOverrides = {}
        • gasLimitAdjustment: BigNumber = GAS_LIMIT_ADJUSTMENT

        Returns Promise<ReturnType<T["functions"][K]>>

      • Adds a permitted action to the PKP permissions contract.

        Returns

        A promise that resolves to the result of the write operation.

        Throws

        If an error occurs during the write operation.

        Parameters

        • __namedParameters: {
              authMethodScopes: AuthMethodScope[];
              ipfsId: string;
              pkpTokenId: string;
          }

        Returns Promise<any>

      • Adds a permitted authentication method for a given PKP token.

        Returns

        • A promise that resolves with the result of adding the permitted authentication method.

        Throws

        • If an error occurs while adding the permitted authentication method.

        Parameters

        • params: {
              authMethodId: string | Uint8Array;
              authMethodScopes: AuthMethodScope[];
              authMethodType: number;
              pkpTokenId: string;
              webAuthnPubkey?: string;
          }

          The parameters for adding the permitted authentication method.

          • authMethodId: string | Uint8Array

            The ID of the authentication method.

          • authMethodScopes: AuthMethodScope[]

            The scopes of the authentication method.

          • authMethodType: number

            The type of the authentication method.

          • pkpTokenId: string

            The ID of the PKP token.

          • Optional webAuthnPubkey?: string

            The public key for WebAuthn.

        Returns Promise<ContractReceipt>

      • Retrieves the Staking contract instance based on the provided network, context, and RPC URL. If a context is provided, it determines if a contract resolver is used for bootstrapping contracts. If a resolver address is present in the context, it retrieves the Staking contract from the contract resolver instance. Otherwise, it retrieves the Staking contract using the contract address and ABI from the contract context. Throws an error if required contract data is missing or if the Staking contract cannot be obtained.

        Returns

        The Staking contract instance.

        Throws

        Error if required contract data is missing or if the Staking contract cannot be obtained.

        Parameters

        Returns Promise<any>

      Generated using TypeDoc