/* eslint-disable @typescript-eslint/no-explicit-any */
/** Declaration file generated by dts-gen */
declare module 'sourcecred' {
  declare const sourcecred: {
    sourcecred: {
      api: {
        analysis: {
          analysis: any;
        };
        contributions: {
          contributions: any;
        };
        credequate: {
          credequate: any;
          dependencies: any;
        };
        credrank: {
          credrank: any;
        };
        grain: {
          configureIntegrationCurrency: any;
          configureIntegrationTracking: any;
          configureLedger: any;
          configureLedgerAccounting: any;
          executeGrainIntegrationsFromGrainInput: any;
          grain: any;
        };
        graph: {
          graph: any;
        };
      };
      core: {
        CredGrainView: typeof CredGrainView;
        address: {
          makeAddressModule: any;
        };
        algorithm: {
          graphToMarkovChain: {
            adjacencySource: any;
            createConnections: any;
            createOrderedSparseMarkovChain: any;
            distributionToNodeDistribution: any;
            normalize: any;
            normalizeNeighbors: any;
            permute: any;
          };
          markovChain: {
            findStationaryDistribution: any;
            sparseMarkovChainAction: any;
            sparseMarkovChainFromTransitionMatrix: any;
          };
        };
        credGraph: {
          CredGraph: any;
          jsonParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          parser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
        };
        graph: {
          Direction: {
            ANY: any;
            IN: any;
            OUT: any;
          };
          EdgeAddress: {
            append: any;
            assertValid: any;
            assertValidParts: any;
            empty: string;
            fromParts: any;
            fromRaw: any;
            hasPrefix: any;
            parser: {
              fmap: any;
              parse: any;
              parseOrThrow: any;
            };
            toParts: any;
            toString: any;
          };
          Graph: any;
          NodeAddress: {
            append: any;
            assertValid: any;
            assertValidParts: any;
            empty: string;
            fromParts: any;
            fromRaw: any;
            hasPrefix: any;
            parser: {
              fmap: any;
              parse: any;
              parseOrThrow: any;
            };
            toParts: any;
            toString: any;
          };
          compareGraphs: any;
          edgeToParts: any;
          edgeToString: any;
          edgeToStrings: any;
          nodeToString: any;
        };
        weightedGraph: {
          empty: any;
          fromJSON: any;
          merge: any;
          overrideWeights: any;
          toJSON: any;
        };
        weights: {
          compareWeights: any;
          copy: any;
          edgeWeightParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          empty: any;
          fromJSON: any;
          merge: any;
          parser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          toJSON: any;
        };
      };
      credequate: {
        config: {
          configsByTargetParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          getEarliestStartForConfigs: any;
          getOperator: any;
          rawConfigsByTargetParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
        };
        contribution: {
          contributionParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          contributionsByTargetParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          expressionParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          weightOperandParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
        };
        operator: {
          OPERATORS: string[];
          OPERATOR_KEY_PREFIX: string;
          applyOperator: any;
          operatorKeyParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          operatorParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
        };
        scoredContribution: {
          expressionHasSubkey: any;
          findContributionsBySubkey: any;
          scoreContribution: any;
          scoreContributions: any;
        };
      };
      instance: {
        LocalInstance: any;
        readInstance: {
          ReadInstance: any;
          getNetworkReadInstance: any;
          getOriginReadInstance: any;
          getRawGithubReadInstance: any;
        };
        writeInstance: {
          WriteInstance: any;
          getGithubWriteInstance: any;
          getOriginWriteInstance: any;
        };
      };
      ledger: {
        grain: {
          DECIMAL_PRECISION: number;
          ONE: string;
          ZERO: string;
          add: any;
          div: any;
          divideFloat: any;
          eq: any;
          format: any;
          formatAndTrim: any;
          fromApproximateFloat: any;
          fromFloatString: any;
          fromInteger: any;
          fromString: any;
          gt: any;
          gte: any;
          lt: any;
          lte: any;
          mul: any;
          multiplyFloat: any;
          parser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          splitBudget: any;
          sub: any;
          sum: any;
          toFloatRatio: any;
          toFloatString: any;
        };
        identity: {
          IDENTITY_PREFIX: string;
          aliasParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          contractions: any;
          delimitedIdentityIdParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          graphNode: any;
          identityIdParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          identityParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          identityTypeParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          nameFromString: any;
          nameParser: {
            fmap: any;
            parse: any;
            parseOrThrow: any;
          };
          newIdentity: any;
        };
        ledger: {
          Ledger: any;
        };
        manager: {
          LedgerManager: any;
        };
        storage: {
          GithubStorage: any;
          WritableGithubStorage: any;
        };
        utils: {
          diffLedger: any;
          distributions: {
            applyDistributions: any;
            computeCredAccounts: any;
            computeDistribution: any;
          };
          ensureIdentityExists: any;
        };
      };
      plugins: {
        ConstructorPlugin: any;
        coerceNameFromString: any;
        declarationParser: {
          fmap: any;
          parse: any;
          parseOrThrow: any;
        };
        discord: {
          DiscordPlugin: any;
          declaration: {
            addsReactionEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            authorsMessageEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            declaration: {
              edgePrefix: string;
              edgeTypes: {
                backwardName: string;
                defaultWeight: {
                  backwards: number;
                  forwards: number;
                };
                description: string;
                forwardName: string;
                prefix: string;
              }[];
              keys: {
                operatorKeys: string[];
                shareKeys: string[];
                weightKeys: string[];
              };
              name: string;
              nodePrefix: string;
              nodeTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
              userTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
            };
            edgePrefix: string;
            keys: {
              AUTHOR: string;
              CATEGORY: string;
              CHANNEL: string;
              EMOJI: string;
              MENTION: string;
              REACTIONS_ACROSS_PARTICIPANTS: string;
              REACTIONS_OF_SINGLE_PARTICIPANT: string;
              ROLE: string;
            };
            memberNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            mentionsEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            messageNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            nodePrefix: string;
            propsEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            reactionNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            reactsToEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
          };
          utils: {
            identity: {
              createIdentities: any;
              createIdentity: any;
            };
          };
        };
        discourse: {
          DiscoursePlugin: any;
          address: {
            likeAddress: any;
            postAddress: any;
            topicAddress: any;
            userAddress: any;
          };
          declaration: {
            authorsPostEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            authorsTopicEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            createsLikeEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            declaration: {
              edgePrefix: string;
              edgeTypes: {
                backwardName: string;
                defaultWeight: {
                  backwards: number;
                  forwards: number;
                };
                description: string;
                forwardName: string;
                prefix: string;
              }[];
              keys: {
                operatorKeys: any[];
                shareKeys: any[];
                weightKeys: any[];
              };
              name: string;
              nodePrefix: string;
              nodeTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
              userTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
            };
            edgePrefix: string;
            likeNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            likesEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            nodePrefix: string;
            postNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            postRepliesEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            referencesPostEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            referencesTopicEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            referencesUserEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            topicContainsPostEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            topicHasLikedPostEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            topicNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            userNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
          };
        };
        ethereum: {
          declaration: {
            declaration: {
              edgePrefix: string;
              edgeTypes: any[];
              keys: {
                operatorKeys: any[];
                shareKeys: any[];
                weightKeys: any[];
              };
              name: string;
              nodePrefix: string;
              nodeTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
              userTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
            };
            edgePrefix: string;
            ethAddressEntryType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            nodePrefix: string;
          };
          utils: {
            address: {
              nodeAddressForEthAddress: any;
              parseAddress: any;
              truncateEthAddress: any;
            };
            identity: {
              createIdentities: any;
              createIdentity: any;
            };
          };
        };
        github: {
          GithubPlugin: any;
          declaration: {
            KEYS: {
              COMMIT_AUTHOR: string;
              PULL: string;
              PULL_AUTHOR: string;
              REACTION: string;
              REACTIONS_OPERATOR: string;
              REVIEW: string;
              REVIEW_AUTHOR: string;
            };
            declaration: {
              edgePrefix: string;
              edgeTypes: {
                backwardName: string;
                defaultWeight: {
                  backwards: number;
                  forwards: number;
                };
                description: string;
                forwardName: string;
                prefix: string;
              }[];
              keys: {
                operatorKeys: string[];
                shareKeys: string[];
                weightKeys: string[];
              };
              name: string;
              nodePrefix: string;
              nodeTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
              userTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
            };
            repoNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            userNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
          };
          edges: {
            AUTHORS_TYPE: string;
            CORRESPONDS_TO_COMMIT_TYPE: string;
            HAS_PARENT_TYPE: string;
            MERGED_AS_TYPE: string;
            Prefix: {
              authors: string;
              base: string;
              correspondsToCommit: string;
              hasParent: string;
              mergedAs: string;
              reacts: string;
              reactsHeart: string;
              reactsHooray: string;
              reactsRocket: string;
              reactsThumbsUp: string;
              references: string;
            };
            REACTS_TYPE: string;
            REFERENCES_TYPE: string;
            createEdge: {
              authors: any;
              correspondsToCommit: any;
              hasParent: any;
              mergedAs: any;
              reacts: any;
              references: any;
            };
            fromRaw: any;
            toRaw: any;
          };
          nodes: {
            BOT_SUBTYPE: string;
            COMMENT_TYPE: string;
            COMMIT_TYPE: string;
            ISSUE_TYPE: string;
            PULL_TYPE: string;
            Prefix: {
              base: string;
              bot: string;
              comment: string;
              commit: string;
              issue: string;
              issueComment: string;
              pull: string;
              pullComment: string;
              repo: string;
              review: string;
              reviewComment: string;
              user: string;
              userlike: string;
            };
            REPO_TYPE: string;
            REVIEW_TYPE: string;
            USERLIKE_TYPE: string;
            USER_SUBTYPE: string;
            fromRaw: any;
            loginAddress: any;
            toRaw: any;
          };
        };
        identityProposalsParser: {
          fmap: any;
          parse: any;
          parseOrThrow: any;
        };
        initiatives: {
          InitiativesPlugin: any;
          declaration: {
            championsEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            contributesToEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            contributesToEntryEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            contributionEntryType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            declaration: {
              edgePrefix: string;
              edgeTypes: {
                backwardName: string;
                defaultWeight: {
                  backwards: number;
                  forwards: number;
                };
                description: string;
                forwardName: string;
                prefix: string;
              }[];
              keys: {
                operatorKeys: any[];
                shareKeys: any[];
                weightKeys: any[];
              };
              name: string;
              nodePrefix: string;
              nodeTypes: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              }[];
              userTypes: any[];
            };
            dependencyEntryType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            dependsOnEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
            edgePrefix: string;
            initiativeNodeType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            nodeEntryTypes: {
              CONTRIBUTION: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              };
              DEPENDENCY: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              };
              REFERENCE: {
                defaultWeight: number;
                description: string;
                name: string;
                pluralName: string;
                prefix: string;
              };
            };
            nodePrefix: string;
            referenceEntryType: {
              defaultWeight: number;
              description: string;
              name: string;
              pluralName: string;
              prefix: string;
            };
            referencesEdgeType: {
              backwardName: string;
              defaultWeight: {
                backwards: number;
                forwards: number;
              };
              description: string;
              forwardName: string;
              prefix: string;
            };
          };
        };
      };
    };
  };

  export = sourcecred;

  export class CredGrainView {
    constructor(graph: CredGraph, ledger: Ledger);
    participants: () => ParticipantCredGrain[];

    totalCredPerInterval: () => number[];

    totalGrainPerInterval: () => string[];
  }

  export interface ParticipantCredGrain {
    identity: SCIdentity;
    cred: number;
    credPerInterval: number[];
    grainEarned: string;
    grainEarnedPerInterval: string[];
  }

  export interface LedgerManager {
    reloadLedger: () => Promise<ReloadResult>;
    ledger: Ledger;
    persist: () => Promise<ReloadResult>;
  }

  export interface Ledger {
    accounts: () => SCAccountInfo[];
    account: (id: string) => SCAccountInfo;
    accountByAddress: (address: string) => SCAccountInfo;
    addAlias: (identityId: any, alias: Alias) => void;
    activate: (identityId: any) => void;
  }

  export interface Alias {
    description: string;
    address: string;
  }

  export interface ReloadResult {
    error: string | null;
    localChanges: any;
  }

  export interface SCReadInstance {
    readCredGraph: () => Promise<CredGraph>;
  }

  export type CredGraph = Record<string, unknown>;

  export interface SCAccountsData {
    accounts: SCAccount[];
    intervalEndpoints: number[];
    unclaimedAliases: SCUnclaimedAlias[];
  }

  export interface SCAccount {
    account: SCAccountInfo;
    cred: number[];
    totalCred: number;
  }

  export interface SCAccountInfo {
    active: boolean;
    balance: string;
    identity: SCIdentity;
    paid: string;
  }

  export interface SCIdentity {
    address: string;
    aliases: SCAlias[];
    id: string;
    name: string;
    subtype: 'USER' | 'PROJECT' | 'ORGANIZATION' | 'BOT';
  }

  export interface SCAlias {
    address: string;
    description: string;
  }

  export interface SCUnclaimedAlias {
    alias: SCAlias;
    cred: number[];
    totalCred: number;
  }

  export interface AddressBookEntry {
    name: string;
    createdAt: number;
    address: string;
    discordId: string;
  }
}
