### Get Market Activity for Address (Example Request) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets This example demonstrates how to make an HTTP GET request to retrieve market activity for a specific Ethereum address. It shows the base URL and the address path parameter. This endpoint is useful for fetching a history of buy and sell transactions associated with an address. ```bash http GET https://api.ethos.network/api/v1/markets/activity/0x9E2218375567BB466b81E38E1a8b599b6250408C ``` -------------------------------- ### Example HTTP Request for Market Details Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Illustrates how to make an HTTP GET request to the Ethos Network API to fetch detailed information for a specific market using its profile ID. This example uses `httpie` to send the request. ```shell http GET https://api.ethos.network/api/v1/markets/1 ``` -------------------------------- ### Get Reply Summaries API Example Request (Shell) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/replies This shell command demonstrates an example HTTP POST request to the Ethos API's reply summary endpoint. It specifies the target contract, parent IDs, and sets the current user profile ID to null. This example is useful for testing or integrating with the API. ```shell http POST "https://api.ethos.network/api/v1/reply/summary" \ targetContract=0x2820b3aB3543ADB80810f11F2651f0DD9A04E801 \ parentIds:='[1]' \ currentUserProfileId:=null ``` -------------------------------- ### Example Response for Contribution Bundles Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/contributions An example JSON response for the 'Get Contribution Bundles by Profile ID and Status' endpoint, showing contribution bundles with their associated contributions and statuses. ```JSON [ { "id": 501, "contributions": [ { "id": 1001, "type": "TRUST_CHECK", "status": "PENDING", "targetUserkey": "profileId:2157" }, { "id": 1002, "type": "REVIEW_CHECK", "status": "PENDING", "targetReviewId": 456 }, { "id": 1003, "type": "SCORE_CHECK", "status": "PENDING", "targetUserkey": "profileId:3148" } ] }, { "id": 502, "contributions": [ { "id": 1004, "type": "TRUST_BATTLE", "status": "PENDING", "targetUserkeys": ["profileId:1245", "profileId:3672"] } ] } ] ``` -------------------------------- ### Install Privy React SDK Source: https://docs.privy.io/basics/react/installation Installs the latest version of the Privy React SDK using npm. This is the primary step for integrating Privy authentication into your React application. ```bash npm install @privy-io/react-auth@latest ``` -------------------------------- ### Ethos API v1 Search Example Request Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/search This example demonstrates how to make a GET request to the Ethos Search API v1 to find results for 'vitalik' with a limit of 10 and an offset of 0. ```HTTP GET "https://api.ethos.network/api/v1/search?query=vitalik&limit=10&offset=0" ``` -------------------------------- ### Example Request for Creating a Slash (HTTP) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/signatures An example HTTP POST request to create a slash, including necessary headers and form-data parameters for attestation-based slashing. ```http http POST https://api.ethos.network/api/v1/signatures/create-slash \ Authorization:"Bearer " \ subject=null \ amount:=100 \ comment="Impersonating other users" \ metadata="{\"description\":\'Created fake account mimicking project founder\'}" \ attestationDetails:='{"service":"x.com","account":"1234567890"}' ``` -------------------------------- ### Example Response for Creating a Slash (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/signatures An example JSON response received after a successful slash creation request, containing a random value and a signature. ```json { "ok": true, "data": { "randValue": 1678982401234, "signature": "0x4d8fb7c124fecb927e35b7dc913b2716f5ce9c7bb6075cbde0bd41677c095c6b5cdcce7f2605a6161a86202feea8a9b6aa051b0d9c995a79a42e71551dc23cf31b" } } ``` -------------------------------- ### Example HTTP Requests for Listing Slashes Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/slashes Demonstrates how to make HTTP requests to the 'List Slashes' endpoint with different query parameters for filtering and pagination. Includes examples for filtering by status and author. ```HTTP # Get the 5 most recent open slashes http GET https://api.ethos.network/api/v1/slashes status==open limit==5 # Get slashes authored by a specific profile (using DID) http GET https://api.ethos.network/api/v1/slashes author=="did:privy:user123" ``` -------------------------------- ### Fetch XP Leaderboard (HTTP GET) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/profiles This snippet shows how to make an HTTP GET request to the Ethos Network API to retrieve the XP leaderboard. It includes example parameters like 'since' for filtering by date and 'limit' for controlling the number of results. The response is a JSON object containing user profile data. ```http GET https://api.ethos.network/api/v1/profiles/xp-leaderboard?since='2023-01-01'&limit=5 ``` -------------------------------- ### Example HTTP Request to Query Vouches (API v1) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/vouches This example illustrates how to make an HTTP POST request to the Ethos Network's API v1 to query vouches. It shows the endpoint URL and how to pass query parameters like `subjectProfileIds`, `limit`, and `offset` directly in the URL for simpler requests, differing from the request body example. ```http http POST https://api.ethos.network/api/v1/vouches \ subjectProfileIds:='[789]' \ limit:=10 \ offset:=0 ``` -------------------------------- ### Query Attestations API Request Example (HTTP) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/attestations Example of an HTTP POST request to the /api/v1/attestations endpoint to retrieve attestations. It demonstrates how to specify profile IDs, limit, and offset. ```http http POST https://api.ethos.network/api/v1/attestations \ profileIds:='[1]' \ limit=10 \ offset=0 ``` -------------------------------- ### Example Score Response (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/scores An example of a successful response from the 'Get Score' endpoint. It shows the overall score and the breakdown of various elements contributing to it, such as 'Ethereum Address Age' and 'Twitter Account Age'. ```JSON { "ok": true, "data": { "score": 1711, "elements": { "Ethereum Address Age": { "element": { "name": "Ethereum Address Age", "type": "LookupInterval", "ranges": [ {"end": 90, "score": 0}, {"start": 90, "end": 365, "score": 1}, {"start": 365, "end": 1461, "score": 3}, {"start": 1461, "end": 2922, "score": 5}, {"start": 2922, "score": 5} ], "outOfRangeScore": 0 }, "raw": 0, "weighted": 0, "error": false }, "Twitter Account Age": { "element": { "name": "Twitter Account Age", "type": "LookupInterval", "ranges": [ {"start": 0, "end": 90, "score": -250}, {"start": 90, "end": 365, "score": -50}, {"start": 365, "end": 730, "score": 0}, {"start": 1461, "score": 5} ], "outOfRangeScore": 0 }, "raw": 1178, "weighted": 0, "error": false }, "Number of Vouchers Impact": { "element": { "name": "Number of Vouchers Impact", "type": "LookupNumber", "range": {"min": 0, "max": 270} }, "raw": 94, "weighted": 94, "error": false }, "Vouched Ethereum Impact": { "element": { "name": "Vouched Ethereum Impact", "type": "LookupNumber", "range": {"min": 0, "max": 270} }, "raw": 223, "weighted": 223, "error": false }, "Review Impact": { "element": { "name": "Review Impact", "type": "LookupNumber", "range": {"min": -800, "max": 270} }, "raw": 193, "weighted": 193, "error": false } }, "metadata": {}, "errors": [] } } ``` -------------------------------- ### Market Holders Response Example (Balance) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example response for fetching market holders, showing basic holder information including Ethereum address and balance in wei. Suitable for quick overview of holdings. ```json { "ok": true, "data": [ { "address": "0x9E2218375567BB466b81E38E1a8b599b6250408C", "balanceWei": "10000000000000000000" }, { "address": "0x1234567890abcdef1234567890abcdef12345678", "balanceWei": "5000000000000000000" } ] } ``` -------------------------------- ### Address Market Activity Response Example Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example response for fetching market activity for a specific address. Includes market profile ID, transaction hash, timestamp, type, and amount for each market interaction. ```json { "ok": true, "data": [ { "marketProfileId": 1, "txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "tim" } ] } ``` -------------------------------- ### Error Response Example Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of an error response when a requested resource, such as a market, is not found. The response indicates success status as false and provides an error code and message. ```json { "ok": false, "error": { "code": "NOT_FOUND", "message": "Market not found" } } ``` -------------------------------- ### Example HTTP Request for Market News Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Demonstrates how to make an HTTP POST request to the Ethos Network API to retrieve market news and tweets. This example uses `httpie` and sends a raw JSON array of profile IDs in the request body. ```shell echo '[1, 8, 19]' | http POST https://api.ethos.network/api/v1/markets/news Content-Type:application/json ``` -------------------------------- ### Search Markets Response Example - JSON Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of a successful response when searching for markets. The 'data' field contains an array of market objects, each with detailed information like marketProfileId, creatorAddress, prices, votes, timestamps, and profile statistics. ```json { "ok": true, "data": [ { "marketProfileId": 8, "creatorAddress": "0x937EC42DDfEC2059BB64D613F99547a62cda6c01", "positivePrice": "6607563687658171", "negativePrice": "3392436312341829", "trustVotes": 1001, "distrustVotes": 1, "createdAt": "2025-03-24T20:53:17.152Z", "updatedAt": "2025-03-29T02:06:01.795Z", "basePrice": "10000000000000000", "creationCost": "100000000000000000", "liquidity": "1500", "configType": "NORMAL", "profile": { "primaryAddress": "0x937EC42DDfEC2059BB64D613F99547a62cda6c01", "avatarUrl": "https://pbs.twimg.com/profile_images/1700729497065037824/huYFFzHU.jpg", "ethosScore": 2157, "name": "Serpin Taxt", "twitterUsername": "0x5f_eth" }, "stats": { "marketCapWei": "5981214232666665577", "volumeTotalWei": "9050462814877006197", "volume24hWei": "408403006795422611", "priceChange24hPercent": -1 } } ] } ``` -------------------------------- ### Search Markets Error Response Example - JSON Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of an error response when the search query is too short. The 'error' field details the issue, including a validation code, message, and the specific fields that caused the error. ```json { "ok": false, "error": { "code": "VALIDATION_ERROR", "message": "Validation error", "fields": [ { "code": "too_small", "minimum": 2, "type": "string", "message": "String must contain at least 2 character(s)", "path": ["query"] } ] } } ``` -------------------------------- ### Market Transaction History Response Example Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example response for fetching market transaction history. Includes transaction details such as votes, funds, transaction hash, and timestamp. Also provides pagination information like total transactions, limit, and offset. ```json { "ok": true, "data": { "values": [ { "votes": 100, "funds": "1000000000000000000", "txHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "timestamp": 1678886400 } ], "total": 150, "limit": 50, "offset": 0 } } ``` -------------------------------- ### Update User FCM Token - Example Request (HTTPie) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/notifications Provides an example of how to make a POST request to the 'Update User FCM Token' endpoint using the HTTPie command-line tool. It demonstrates the inclusion of authentication headers, the FCM token, and the device identifier. ```shell # Needs auth token, a valid FCM token, and a device ID FCM_TOKEN="bk3RNwTe3H0:CI2k_HHwgIpoDKCIZheNIo..." DEVICE_ID="unique-browser-or-device-fingerprint" http POST https://api.ethos.network/api/v1/notifications/user-fcm-token \ Authorization:"Bearer " \ token=$FCM_TOKEN \ deviceIdentifier=$DEVICE_ID ``` -------------------------------- ### Simulate Score Change - Request Example (HTTP POST) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/scores This snippet demonstrates how to make an HTTP POST request to the Ethos Network API's score simulation endpoint. It includes example parameters such as subjectKey, vouchAmount, and numberOfVouchers to simulate score adjustments. The API allows for partial parameter submission, retaining current values for omitted fields. ```http http POST https://api.ethos.network/api/v1/score/simulate \ subjectKey="profileId:1" \ vouchAmount:=1.5 \ numberOfVouchers:=2 ``` -------------------------------- ### GET Market Price History API Response (Error) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of an error response for the 'Get Market Price History' endpoint when the market is not found. It indicates a failure with a 404 status and provides an error code and message. ```json { "ok": false, "error": { "code": "NOT_FOUND", "message": "Market not found" } } ``` -------------------------------- ### GET Market Price History API Response (Success) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of a successful response for the 'Get Market Price History' endpoint. It includes a boolean 'ok' status and a 'data' array containing price history objects, each with timestamps and prices in wei. ```json { "ok": true, "data": [ { "timestamp": "2025-03-29T00:00:00.000Z", "priceWei": "13394648448485010", "positivePrice": "5366010793535907", "negativePrice": "4633989206464093", "createdAt": "2025-03-24T21:03:47.000Z" }, { "timestamp": "2025-03-28T00:00:00.000Z", "priceWei": "13200000000000000", "positivePrice": "5364353017406441", "negativePrice": "4635646982593559", "createdAt": "2025-03-24T21:03:03.000Z" } ] } ``` -------------------------------- ### Configure Webpack for Solana Dependencies Source: https://docs.privy.io/basics/react/installation Provides webpack configurations to manage Solana dependencies for applications using Privy's Solana wallets. This is necessary when using webpack and ensures that Solana-related modules are correctly handled. ```javascript // webpack.config.js module.exports = { //... externals: { ['@solana/kit']: 'commonjs @solana/kit', ['@solana-program/memo']: 'commonjs @solana-program/memo', ['@solana-program/system']: 'commonjs @solana-program/system', ['@solana-program/token']: 'commonjs @solana-program/token' } }; // next.config.js module.exports = { webpack: (config) => { // ... config.externals['@solana/kit'] = 'commonjs @solana/kit'; config.externals['@solana-program/memo'] = 'commonjs @solana-program/memo'; config.externals['@solana-program/system'] = 'commonjs @solana-program/system'; config.externals['@solana-program/token'] = 'commonjs @solana-program/token'; return config; } }; ``` -------------------------------- ### GET Market Transaction History API Response (Success - Simplified) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of a simplified successful response for the 'Get Market Transaction History' endpoint. It includes a 'ok' status and a 'data' array with transaction details like hash, timestamp, type, and amount in wei. ```json { "ok": true, "data": [ { "txHash": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", "timestamp": "2025-03-30T10:00:00.000Z", "type": "BUY", "amountWei": "1000000000000000000" }, { "txHash": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890", "timestamp": "2025-03-29T14:30:00.000Z", "type": "SELL", "amountWei": "500000000000000000" } ] } ``` -------------------------------- ### GET Market Transaction History API Response (Success - Paginated) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/markets Example of a successful, paginated response for the 'Get Market Transaction History' endpoint. It includes 'data.values' array containing transaction event details, along with pagination information like 'total', 'limit', and 'offset'. ```json { "ok": true, "data": { "values": [ { "eventId": 851534, "marketId": 8, "actorAddress": "0x57E5D96c50ceE6bFa0Fc12dD7892Cf50B5892e91", "type": "SELL", "voteType": "trust", "votes": 17, "funds": "111418815322905231", "txHash": "0x1b833c4fa432df3b0bef27df41fcd993bc903f147b0ba9ebcf3c82ef0005353c", "timestamp": 1743213959 }, { "eventId": 844872, "marketId": 8, "actorAddress": "0x7B3D5e9Ab82D3390792793468854975004440Cf6", "type": "SELL", "voteType": "trust", "votes": 45, "funds": "296984191472517380", "txHash": "0xbd7d708ab9b979b0499ef148f5ad940643610982d01cd42530809b5e9223bbdd", "timestamp": 1743188997 } ], "total": 150, "limit": 50, "offset": 0 } } ``` -------------------------------- ### Get Bulk Scores - HTTP Request Example Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/scores This example shows how to perform a POST request to the Ethos Network API's '/api/v1/score/bulk' endpoint. It demonstrates passing an array of userkeys in the request body to retrieve their corresponding credibility scores. This is useful for batch querying multiple user scores. ```http http POST https://api.ethos.network/api/v1/score/bulk \ userkeys:='["profileId:1", "profileId:2"]' ``` -------------------------------- ### Error Response for Profile Not Found Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/contributions An example JSON error response for the 'Get Contribution Bundles by Profile ID and Status' endpoint when the specified profile ID is not found. ```JSON { "error": "Profile not found", "code": "NOT_FOUND" } ``` -------------------------------- ### Post a Review (JavaScript) Source: https://developers.ethos.network/api-documentation/ethos-everywhere-wallet-integration Allows users to post a review for a given wallet address. Supports specifying a score (positive, neutral, negative), title, and optional content. The request includes a timeout for review data. Requires 'Content-Type: application/json', 'X-Ethos-Client' header, and 'credentials: 'include''. Returns the review hash and details upon successful posting. ```javascript async function postReview(address, score, title, content) { try { const response = await fetch('https://api.ethos.network/api/v2/wallets/privy/post/review/by-address', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Ethos-Client': 'my-app@1.0.0', }, credentials: 'include', // Important: include cookies body: JSON.stringify({ address, score, title, content, waitForReviewTimeoutSeconds: 5, // Wait up to 5 seconds for review data }), }); if (!response.ok) { const error = await response.json(); throw new Error(error.message || 'Failed to post review'); } const data = await response.json(); console.log('Review posted with hash:', data.hash); if (data.review) { console.log('Review ID:', data.review.id); console.log('Review URL:', `https://ethos.network/review/${data.reviewSlug}`); } return data; } catch (error) { console.error('Failed to post review:', error); throw error; } } ``` -------------------------------- ### Error Response for Invalid Profile ID or Status Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/contributions An example JSON error response for the 'Get Contribution Bundles by Profile ID and Status' endpoint when the profile ID format is invalid or the status parameter is missing or invalid. ```JSON { "error": "Invalid profile ID format or missing/invalid status parameter", "code": "VALIDATION_ERROR" } ``` -------------------------------- ### Ethos Network User Search API Request Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/users Example HTTP GET request to search for users in the Ethos network. This endpoint requires a 'query' parameter and optionally accepts 'limit' and 'offset' for pagination. The search is case-insensitive and matches partial strings. ```http GET "https://api.ethos.network/api/v1/users/search?query=vitalik&limit=10&offset=0" ``` -------------------------------- ### Error Response: Bad Request (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/signatures Example JSON response when the API returns a 400 Bad Request error due to invalid input parameters. ```json { "ok": false, "error": { "code": "VALIDATION_ERROR", "message": "Invalid input parameters" } } ``` -------------------------------- ### XP Leaderboard Response Structure (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/profiles This snippet illustrates the expected JSON response structure when fetching the XP leaderboard. It details the fields available for each user profile, such as 'profileId', 'displayName', 'score', and 'totalXp'. The 'data' field contains an array of these user objects. ```json { "ok": true, "data": [ { "id": 19867, "profileId": 17, "displayName": "sketch", "username": "eskacie", "avatarUrl": "https://pbs.twimg.com/profile_images/1874244830190329858/IcrIFc6L.jpg", "description": "Design / Code / Create / Collect", "score": 1964, "status": "ACTIVE", "totalXp": 3521336, "userkeys": [ "profileId:17", "address:0x5586d438BE5920143c0f9B179835778fa81a544a", "address:0x6f95934abc01eedA154C832dF4a4E210cAF877eb", "service:x.com:1461538142217912326" ] } ] } ``` -------------------------------- ### Example Successful Vouches Query Response (API v1) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/vouches This JSON structure represents a successful response from the Vouches API (v1) when querying for vouches. It includes a 'ok' status, pagination details (limit, offset, total), and an array 'values' containing detailed information about each vouch. Each vouch object includes IDs, profile information, staked amounts, timestamps, and associated events. ```json { "ok": true, "data": { "values": [ { "id": 1, "authorProfileId": 123, "subjectProfileId": 789, "subjectAddress": "0x1234567890123456789012345678901234567890", "attestationHash": null, "staked": "2000000000000000000", "balance": "2000000000000000000", "vouchedAt": 1735689600, "updatedAt": 1735689600, "archivedAt": null, "archived": false, "mutualId": 2, "events": [ { "id": 123, "txHash": "0x1234567890123456789012345678901234567890123456789012345678901234", "blockNumber": 12345678, "createdAt": 1735689500, "updatedAt": 1735689500 } ], "attestationDetails": null } ], "limit": 10, "offset": 0, "total": 1 } } ``` -------------------------------- ### Example Not Found Response (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/attestations This JSON shows a 'Not Found' error response (HTTP 404) from the API. It signifies that the requested attestation details could not be located. The error object contains a code and a message clarifying the reason for the failure. ```json { "ok": false, "error": { "code": "NOT_FOUND", "message": "Attestation details not found" } } ``` -------------------------------- ### Check Wallet Authentication (JavaScript) Source: https://developers.ethos.network/api-documentation/ethos-everywhere-wallet-integration Checks if the user's wallet is authenticated with the Ethos Network. It sends a GET request to the authentication check endpoint and expects a JSON response indicating authentication status. Requires the 'X-Ethos-Client' header and 'credentials: 'include'' to be set. ```javascript async function checkWalletAuth() { try { const response = await fetch('https://api.ethos.network/api/v2/wallets/privy/auth-check', { method: 'GET', headers: { 'X-Ethos-Client': 'my-app@1.0.0', }, credentials: 'include', // Important: include cookies }); const data = await response.json(); if (data.ok) { console.log('User is authenticated with profile ID:', data.profileId); return true; } return false; } catch (error) { console.error('Auth check failed:', error); return false; } } ``` -------------------------------- ### Get Highest Scoring Actors - HTTP GET Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/scores Retrieves a list of actors with the highest credibility scores in the network. This endpoint accepts an optional 'limit' query parameter to control the number of results returned. -------------------------------- ### Example Not Found Error Response (JSON) Source: https://developers.ethos.network/api-documentation/api-v1-deprecated/scores An example of an error response when a requested score is not found. This typically returns a 404 status code with a JSON body indicating the 'NOT_FOUND' error code and a descriptive message. ```JSON { "ok": false, "error": { "code": "NOT_FOUND", "message": "Score not found" } } ``` ```JSON { "ok": false, "error": { "code": "NOT_FOUND", "message": "Attestation account not found" } } ``` ```JSON { "ok": false, "error": { "code": "NOT_FOUND", "message": "Score for transaction not found" } } ```