Hierarchy

  • LitContracts

Constructors

  • Parameters

    • Optional args: {
          customContext?: LitContractContext | LitContractResolverContext;
          debug?: boolean;
          network?: "cayenne" | "manzano" | "habanero" | "custom" | "localhost";
          options?: {
              storeOrUseStorageKey?: boolean;
          };
          privateKey?: string;
          provider?: any;
          randomPrivatekey?: boolean;
          rpc?: any;
          rpcs?: any;
          signer?: any;
      }
      • Optional customContext?: LitContractContext | LitContractResolverContext
      • Optional debug?: boolean
      • Optional network?: "cayenne" | "manzano" | "habanero" | "custom" | "localhost"
      • Optional options?: {
            storeOrUseStorageKey?: boolean;
        }
        • Optional storeOrUseStorageKey?: boolean
      • Optional privateKey?: string
      • Optional provider?: any
      • Optional randomPrivatekey?: boolean
      • Optional rpc?: any
      • Optional rpcs?: any
      • Optional signer?: any

    Returns LitContracts

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
network: "cayenne" | "manzano" | "habanero" | "custom" | "localhost"
options?: {
    storeOrUseStorageKey?: boolean;
}

Type declaration

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

Type declaration

  • read: PKPHelper
  • write: PKPHelper
pkpHelperContractUtil: {
    read: {};
    write: {
        mintNextAndAddAuthMethods: ((param0: {
            addPkpEthAddressAsPermittedAddress: boolean;
            keyType: string;
            permittedAuthMethodIds: string[];
            permittedAuthMethodPubkeys: string[];
            permittedAuthMethodScopes: string[][];
            permittedAuthMethodTypes: string[];
            sendPkpToItself: boolean;
        }) => Promise<any>);
    };
} = ...

Type declaration

  • read: {}
    • write: {
          mintNextAndAddAuthMethods: ((param0: {
              addPkpEthAddressAsPermittedAddress: boolean;
              keyType: string;
              permittedAuthMethodIds: string[];
              permittedAuthMethodPubkeys: string[];
              permittedAuthMethodScopes: string[][];
              permittedAuthMethodTypes: string[];
              sendPkpToItself: boolean;
          }) => Promise<any>);
      }
      • mintNextAndAddAuthMethods: ((param0: {
            addPkpEthAddressAsPermittedAddress: boolean;
            keyType: string;
            permittedAuthMethodIds: string[];
            permittedAuthMethodPubkeys: string[];
            permittedAuthMethodScopes: string[][];
            permittedAuthMethodTypes: string[];
            sendPkpToItself: boolean;
        }) => Promise<any>)
          • (param0: {
                addPkpEthAddressAsPermittedAddress: boolean;
                keyType: string;
                permittedAuthMethodIds: string[];
                permittedAuthMethodPubkeys: string[];
                permittedAuthMethodScopes: string[][];
                permittedAuthMethodTypes: string[];
                sendPkpToItself: boolean;
            }): Promise<any>
          • Returns

            Parameters

            • param0: {
                  addPkpEthAddressAsPermittedAddress: boolean;
                  keyType: string;
                  permittedAuthMethodIds: string[];
                  permittedAuthMethodPubkeys: string[];
                  permittedAuthMethodScopes: string[][];
                  permittedAuthMethodTypes: string[];
                  sendPkpToItself: boolean;
              }
              • addPkpEthAddressAsPermittedAddress: boolean
              • keyType: string
              • permittedAuthMethodIds: string[]
              • permittedAuthMethodPubkeys: string[]
              • permittedAuthMethodScopes: string[][]
              • permittedAuthMethodTypes: string[]
              • sendPkpToItself: boolean

            Returns Promise<any>

    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?: any) => Promise<{
                res: any;
                tokenId: any;
                tx: any;
            }>);
            mint: (() => 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?: any) => Promise<{
              res: any;
              tokenId: any;
              tx: any;
          }>);
          mint: (() => Promise<{
              pkp: {
                  ethAddress: any;
                  publicKey: any;
                  tokenId: any;
              };
              res: any;
              tokenId: any;
              tx: any;
          }>);
      }
      • claimAndMint: ((derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: any) => Promise<{
            res: any;
            tokenId: any;
            tx: any;
        }>)
          • (derivedKeyId: BytesLike, signatures: SignatureStruct[], txOpts?: any): Promise<{
                res: any;
                tokenId: any;
                tx: any;
            }>
          • Parameters

            • derivedKeyId: BytesLike
            • signatures: SignatureStruct[]
            • Optional txOpts: any

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

      • mint: (() => Promise<{
            pkp: {
                ethAddress: any;
                publicKey: any;
                tokenId: any;
            };
            res: any;
            tokenId: any;
            tx: any;
        }>)
          • (): Promise<{
                pkp: {
                    ethAddress: any;
                    publicKey: any;
                    tokenId: any;
                };
                res: any;
                tokenId: any;
                tx: any;
            }>
          • 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: any) => Promise<any[]>);
            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<any>);
            addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<any>);
            revokePermittedAction: ((pkpId: string, ipfsId: string) => Promise<any>);
        };
    } = ...

    Type declaration

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

            Returns

            Parameters

            • tokenId: any

            Returns Promise<any[]>

      • getPermittedAddresses: ((tokenId: string) => Promise<string[]>)
          • (tokenId: string): Promise<string[]>
          • 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<any>);
          addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<any>);
          revokePermittedAction: ((pkpId: string, ipfsId: string) => Promise<any>);
      }
      • addPermittedAction: ((pkpId: string, ipfsId: string) => Promise<any>)
          • (pkpId: string, ipfsId: string): Promise<any>
          • Add permitted action to a given PKP id & ipfsId

            Returns

            transaction

            Parameters

            • pkpId: string

              103309008291725705563022469659474510532358692659842796086905702509072063991354

            • ipfsId: string

              QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

            Returns Promise<any>

      • addPermittedAddress: ((pkpId: string, ownerAddress: string) => Promise<any>)
          • (pkpId: string, ownerAddress: string): Promise<any>
          • 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<any>

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

            Returns

            transaction

            Parameters

            • pkpId: string

              103309008291725705563022469659474510532358692659842796086905702509072063991354

            • ipfsId: string

              QmZKLGf3vgYsboM7WVUS9X56cJSdLzQVacNp841wmEDRkW

            Returns Promise<any>

    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: {
                mintCost: {
                    value: any;
                };
                timestamp: number;
            }) => Promise<{
                tokenId: any;
                tx: any;
            }>);
            transfer: ((__namedParameters: {
                RLITokenAddress: string;
                fromAddress: string;
                toAddress: string;
            }) => Promise<any>);
        };
    } = ...

    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: {
              mintCost: {
                  value: any;
              };
              timestamp: number;
          }) => Promise<{
              tokenId: any;
              tx: any;
          }>);
          transfer: ((__namedParameters: {
              RLITokenAddress: string;
              fromAddress: string;
              toAddress: string;
          }) => Promise<any>);
      }
      • mint: ((__namedParameters: {
            mintCost: {
                value: any;
            };
            timestamp: number;
        }) => Promise<{
            tokenId: any;
            tx: any;
        }>)
          • (__namedParameters: {
                mintCost: {
                    value: any;
                };
                timestamp: number;
            }): Promise<{
                tokenId: any;
                tx: any;
            }>
          • Parameters

            • __namedParameters: {
                  mintCost: {
                      value: any;
                  };
                  timestamp: number;
              }
              • mintCost: {
                    value: any;
                }
                • value: any
              • timestamp: number

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

      • transfer: ((__namedParameters: {
            RLITokenAddress: string;
            fromAddress: string;
            toAddress: string;
        }) => Promise<any>)
          • (__namedParameters: {
                RLITokenAddress: string;
                fromAddress: string;
                toAddress: string;
            }): Promise<any>
          • 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<any>

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

    Type declaration

    • read: {}
      • write: {}
        rpc: string
        rpcs: string[]
        signer: Signer | Wallet
        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) => Promise<any>);
            getBytesFromMultihash: ((multihash: string) => string);
            getMultihashFromBytes: ((byte32: string) => string);
            hexToDec: any;
            timestamp2Date: ((timestamp: string) => string);
        } = ...

        Type declaration

        • decToHex: any
        • getBytes32FromMultihash: ((ipfsId: string) => Promise<any>)
            • (ipfsId: string): Promise<any>
            • Partition multihash string into object representing multihash

              Returns

              Parameters

              • ipfsId: string

              Returns Promise<any>

        • 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

        logger: Logger = ...

        Methods

        • Parameters

          • __namedParameters: {
                authMethod: AuthMethod;
                pubkey?: string;
                scopes: string[] | number[] | BigNumberish[];
            }

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

        Generated using TypeDoc