Using the SDK

Features:

  • Create, Update and Get ReputeX Score

  • Fully Typescript ready out-of-the box.

🚀 Quick start

1. Install Reputex SDK

The easiest way to integrate the ReputeX SDK into your JavaScript project is through the npm module.

Install the package via npm:

npm install @reputex/sdk

or yarn:

yarn add @reputex/sdk

2. Initialize the SDK

After your dependency is added, you simply need to initialize ReputeXSdk:

⚠️ Warning: Make sure to keep your api key and secret private

const reputexSdk = new ReputeX(
  "31e4a631-be27-4d0a-86f0-f22abbc6f88e",
  "65a31dba29639e719988c8d427357cf84b5215fb63a37fdbd74ca92cd0edf857"
);

About Features

ReputeX-SDK is a TypeScript-based software development kit (SDK) that provides an easy-to-use interface to interact with the ReputeX API. The SDK offers 3 Score related functions. To access these functions, users need to have an access key and secret. If you don't have access to these credentials, you can contact the admin for assistance by filing the form.

The SDK offers five Score related functions:

  1. Create ReputeX Score - Creates a ReputeX score by accepting an address or domain.

    • reputexSdk.score.create(addressOrDomain, { compactBreakdown?: boolean})

    • Param:

      addressOrDomain : Address or domain for which reputex score need to be generated.

    • Response:

    {
        "success": true,
        "data": {
            "address": "0x32cb9fd13af7635cc90d0713a80188b366a28205",
            "reputeXScore": 48.12,
            "legacyReputeXScore": 617.36,
            "customScore": 48.12,
            "blacklisted": false,
            "lastUpdated": "2024-07-19T06:32:50.031Z",
            "scoreBreakdown": {
                "ethereum": {
                    "finalScore": 16,
                    "ethereumContribution": 53.15,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 1,
                        "compoundScore": 0,
                        "tvlScore": 28,
                        "curveScore": 0,
                        "enzymeScore": 0,
                        "eulerScore": 0,
                        "lidoScore": 8,
                        "uniswapScore": 24,
                        "yearnScore": 0,
                        "ironBankScore": 0,
                        "riskScore": 0,
                        "eigenLayerScore": 42
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 40,
                        "appsInteractionScore": 34,
                        "ensScore": 90,
                        "txHistoryScore": 60,
                        "udScore": 0,
                        "gitcoinScore": 20,
                        "fsaScore": 38
                    },
                    "metaCategoryScore": {
                        "finalScore": 3,
                        "metaverseScore": 0,
                        "nftScore": 0,
                        "nftTradingScore": 18,
                        "poolTogetherScore": 0,
                        "sandboxScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0,
                        "uniswapDaoScore": 0
                    }
                },
                "polygon": {
                    "finalScore": 27,
                    "polygonContribution": 9.79,
                    "defiCategoryScore": {
                        "finalScore": 18,
                        "aaveScore": 7,
                        "tvlScore": 16,
                        "riskScore": 0,
                        "uniswapScore": 34
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 47,
                        "appsInteractionScore": 80,
                        "txHistoryScore": 72,
                        "udScore": 0,
                        "fsaScore": 28
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0,
                        "poolTogetherScore": 0,
                        "sandboxScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "bsc": {
                    "finalScore": 23,
                    "binanceContribution": 6.29,
                    "defiCategoryScore": {
                        "finalScore": 9,
                        "tvlScore": 14,
                        "venusScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 45,
                        "appsInteractionScore": 60,
                        "txHistoryScore": 64,
                        "fsaScore": 18
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "avalanche": {
                    "finalScore": 15,
                    "avalancheContribution": 2.8,
                    "defiCategoryScore": {
                        "finalScore": 1,
                        "aaveScore": 2,
                        "tvlScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 38,
                        "appsInteractionScore": 42,
                        "txHistoryScore": 62,
                        "fsaScore": 12
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0,
                        "poolTogetherScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "arbitrum": {
                    "finalScore": 18,
                    "arbitrumContribution": 6.29,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 0,
                        "tvlScore": 22,
                        "uniswapScore": 44,
                        "yearnScore": 0,
                        "abracadabraScore": 0,
                        "siloFinanceScore": 0,
                        "qiDaoScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 46,
                        "appsInteractionScore": 32,
                        "txHistoryScore": 64,
                        "fsaScore": 36
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    }
                },
                "optimism": {
                    "finalScore": 23,
                    "optimismContribution": 4.9,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 2,
                        "tvlScore": 15,
                        "uniswapScore": 30,
                        "qiDaoScore": 0,
                        "sushiSwapScore": 0,
                        "curveScore": 8,
                        "sonneFinanceScore": 20
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 44,
                        "appsInteractionScore": 60,
                        "txHistoryScore": 68,
                        "fsaScore": 6
                    },
                    "metaCategoryScore": {
                        "finalScore": 56,
                        "farcasterScore": 56
                    }
                },
                "base": {
                    "finalScore": 33,
                    "baseContribution": 4.2,
                    "defiCategoryScore": {
                        "finalScore": 24,
                        "tvlScore": 11,
                        "aaveScore": 66,
                        "uniswapScore": 32,
                        "sushiSwapScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 46,
                        "appsInteractionScore": 66,
                        "txHistoryScore": 72,
                        "fsaScore": 6
                    }
                },
                "moonbeam": {
                    "finalScore": 21,
                    "moonbeamContribution": 2.8,
                    "defiCategoryScore": {
                        "finalScore": 20,
                        "tvlScore": 47,
                        "curveScore": 0,
                        "sushiSwapScore": 8,
                        "moonwellScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 30,
                        "appsInteractionScore": 0,
                        "txHistoryScore": 46,
                        "fsaScore": 28
                    },
                    "socialImpactScore": {
                        "finalScore": 0,
                        "moonwellDaoScore": 0
                    }
                },
                "linea": {
                    "finalScore": 23,
                    "lineaContribution": 4.2,
                    "defiCategoryScore": {
                        "finalScore": 20,
                        "tvlScore": 15,
                        "pancakeSwapScore": 22,
                        "sushiSwapScore": 6,
                        "syncSwapScore": 48,
                        "nileExchangeScore": 0,
                        "iZiSwapScore": 54,
                        "zeroLendScore": 2
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 45,
                        "appsInteractionScore": 82,
                        "txHistoryScore": 64,
                        "fsaScore": 6
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    }
                },
                "zkSyncEra": {
                    "finalScore": 40,
                    "zkSyncEraContribution": 5.59,
                    "defiCategoryScore": {
                        "finalScore": 36,
                        "tvlScore": 15,
                        "pancakeSwapScore": 26,
                        "syncSwapScore": 56,
                        "koiFinanceScore": 76,
                        "iZiSwapScore": 28
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 48,
                        "appsInteractionScore": 100,
                        "txHistoryScore": 64,
                        "fsaScore": 6
                    }
                }
            },
            "syncBlockNumber": {
                "ethereum": 20338800,
                "polygon": 59540288,
                "bsc": 40602051,
                "avalanche": 48156025,
                "arbitrum": 233750109,
                "optimism": 122885925,
                "base": 17290694,
                "moonbeam": 6645758,
                "linea": 6983742,
                "zkSyncEra": 39474682
            }
        },
        "message": "Score calculated successfully.",
        "error": ""
    }
  2. Update ReputeX Score - Updates an existing ReputeX score by accepting the an address or domain.

    • reputexSdk.score.update(addressOrDomain)

    • Param:

      addressOrDomain : Address or domain for which reputex score need to be updated.

    • Response:

    {
        "success": true,
        "data": {
            "address": "0x5989558fccbd33ec184087b36f2ad8e6adcc70cd",
            "data": {
                "score": 579.17
            }
        },
        "message": "Score successfully updated!",
        "error": ""
    }
  3. Get Score Breakdown - Fetches the score breakdown of a ReputeX score by accepting the address or domain and returns an object containing the score breakdown.

    • reputexSdk.score.getBreakdown(addressOrDomain)

    • Param:

      addressOrDomain : Address or domain for which reputex breakdown score needs to fetched.

      compactBreakdown: Boolean flag which will return which only give reputex score.

    • Response:

    {
        "success": true,
        "data": {
            "address": "0x32cb9fd13af7635cc90d0713a80188b366a28205",
            "reputeXScore": 48.12,
            "legacyReputeXScore": 617.36,
            "customScore": 48.12,
            "blacklisted": false,
            "lastUpdated": "2024-07-19T06:32:50.031Z",
            "scoreBreakdown": {
                "ethereum": {
                    "finalScore": 16,
                    "ethereumContribution": 53.15,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 1,
                        "compoundScore": 0,
                        "tvlScore": 28,
                        "curveScore": 0,
                        "enzymeScore": 0,
                        "eulerScore": 0,
                        "lidoScore": 8,
                        "uniswapScore": 24,
                        "yearnScore": 0,
                        "ironBankScore": 0,
                        "riskScore": 0,
                        "eigenLayerScore": 42
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 40,
                        "appsInteractionScore": 34,
                        "ensScore": 90,
                        "txHistoryScore": 60,
                        "udScore": 0,
                        "gitcoinScore": 20,
                        "fsaScore": 38
                    },
                    "metaCategoryScore": {
                        "finalScore": 3,
                        "metaverseScore": 0,
                        "nftScore": 0,
                        "nftTradingScore": 18,
                        "poolTogetherScore": 0,
                        "sandboxScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0,
                        "uniswapDaoScore": 0
                    }
                },
                "polygon": {
                    "finalScore": 27,
                    "polygonContribution": 9.79,
                    "defiCategoryScore": {
                        "finalScore": 18,
                        "aaveScore": 7,
                        "tvlScore": 16,
                        "riskScore": 0,
                        "uniswapScore": 34
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 47,
                        "appsInteractionScore": 80,
                        "txHistoryScore": 72,
                        "udScore": 0,
                        "fsaScore": 28
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0,
                        "poolTogetherScore": 0,
                        "sandboxScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "bsc": {
                    "finalScore": 23,
                    "binanceContribution": 6.29,
                    "defiCategoryScore": {
                        "finalScore": 9,
                        "tvlScore": 14,
                        "venusScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 45,
                        "appsInteractionScore": 60,
                        "txHistoryScore": 64,
                        "fsaScore": 18
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "avalanche": {
                    "finalScore": 15,
                    "avalancheContribution": 2.8,
                    "defiCategoryScore": {
                        "finalScore": 1,
                        "aaveScore": 2,
                        "tvlScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 38,
                        "appsInteractionScore": 42,
                        "txHistoryScore": 62,
                        "fsaScore": 12
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0,
                        "poolTogetherScore": 0
                    },
                    "socialImpactScore": {
                        "finalScore": 0
                    }
                },
                "arbitrum": {
                    "finalScore": 18,
                    "arbitrumContribution": 6.29,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 0,
                        "tvlScore": 22,
                        "uniswapScore": 44,
                        "yearnScore": 0,
                        "abracadabraScore": 0,
                        "siloFinanceScore": 0,
                        "qiDaoScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 46,
                        "appsInteractionScore": 32,
                        "txHistoryScore": 64,
                        "fsaScore": 36
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    }
                },
                "optimism": {
                    "finalScore": 23,
                    "optimismContribution": 4.9,
                    "defiCategoryScore": {
                        "finalScore": 11,
                        "aaveScore": 2,
                        "tvlScore": 15,
                        "uniswapScore": 30,
                        "qiDaoScore": 0,
                        "sushiSwapScore": 0,
                        "curveScore": 8,
                        "sonneFinanceScore": 20
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 44,
                        "appsInteractionScore": 60,
                        "txHistoryScore": 68,
                        "fsaScore": 6
                    },
                    "metaCategoryScore": {
                        "finalScore": 56,
                        "farcasterScore": 56
                    }
                },
                "base": {
                    "finalScore": 33,
                    "baseContribution": 4.2,
                    "defiCategoryScore": {
                        "finalScore": 24,
                        "tvlScore": 11,
                        "aaveScore": 66,
                        "uniswapScore": 32,
                        "sushiSwapScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 46,
                        "appsInteractionScore": 66,
                        "txHistoryScore": 72,
                        "fsaScore": 6
                    }
                },
                "moonbeam": {
                    "finalScore": 21,
                    "moonbeamContribution": 2.8,
                    "defiCategoryScore": {
                        "finalScore": 20,
                        "tvlScore": 47,
                        "curveScore": 0,
                        "sushiSwapScore": 8,
                        "moonwellScore": 0
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 30,
                        "appsInteractionScore": 0,
                        "txHistoryScore": 46,
                        "fsaScore": 28
                    },
                    "socialImpactScore": {
                        "finalScore": 0,
                        "moonwellDaoScore": 0
                    }
                },
                "linea": {
                    "finalScore": 23,
                    "lineaContribution": 4.2,
                    "defiCategoryScore": {
                        "finalScore": 20,
                        "tvlScore": 15,
                        "pancakeSwapScore": 22,
                        "sushiSwapScore": 6,
                        "syncSwapScore": 48,
                        "nileExchangeScore": 0,
                        "iZiSwapScore": 54,
                        "zeroLendScore": 2
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 45,
                        "appsInteractionScore": 82,
                        "txHistoryScore": 64,
                        "fsaScore": 6
                    },
                    "metaCategoryScore": {
                        "finalScore": 0,
                        "nftScore": 0
                    }
                },
                "zkSyncEra": {
                    "finalScore": 40,
                    "zkSyncEraContribution": 5.59,
                    "defiCategoryScore": {
                        "finalScore": 36,
                        "tvlScore": 15,
                        "pancakeSwapScore": 26,
                        "syncSwapScore": 56,
                        "koiFinanceScore": 76,
                        "iZiSwapScore": 28
                    },
                    "credibilityCategoryScore": {
                        "finalScore": 48,
                        "appsInteractionScore": 100,
                        "txHistoryScore": 64,
                        "fsaScore": 6
                    }
                }
            },
            "syncBlockNumber": {
                "ethereum": 20338800,
                "polygon": 59540288,
                "bsc": 40602051,
                "avalanche": 48156025,
                "arbitrum": 233750109,
                "optimism": 122885925,
                "base": 17290694,
                "moonbeam": 6645758,
                "linea": 6983742,
                "zkSyncEra": 39474682
            }
        },
        "message": "ReputeX Score exists for the address.",
        "error": ""
    }

All the functions in the ReputeX-SDK return a Promise, making it easy to handle asynchronous operations. The SDK uses Axios to make HTTP requests to the ReputeX API, and it also provides basic validation for the input parameters.

All functions in the SDK return a unique response object of type ServerResponse<Type>, which includes the following properties:

  • success: a boolean that indicates whether the request was successful or not.

  • data: a nullable property that contains the response data, which is of type Type.

  • message: a string that provides additional information about the request and response.

  • error: a string that contains the error message, if the request was not successful.

Last updated