diff --git a/components/GenericMethod/GenericMethod.tsx b/components/GenericMethod/GenericMethod.tsx index c92be18d..f2723c2a 100644 --- a/components/GenericMethod/GenericMethod.tsx +++ b/components/GenericMethod/GenericMethod.tsx @@ -12,6 +12,8 @@ import { RequestResponseJSON } from "./params/RequestResponseJSON"; import Head from "next/head"; import { ReqResParam } from "./params/types"; import { RequestParams } from "./params/RequestParams"; +import { PathParams } from "./params/PathParams"; +import { QueryParams } from "./params/QueryParams"; import { ResponseParams } from "./params/ResponseParams"; const inter = Inter({ subsets: ["latin"] }); @@ -22,14 +24,22 @@ export type GenericMethodProps = { network: string; cu: number; description: string; + url?: string | string[]; useCases: string[]; constraints: string[]; responseJSON: string; // Complex types codeSnippets: CodeSnippetObject[]; + + pathParams?: ReqResParam[]; + pathParamsType?: TParamType; + + queryParams?: ReqResParam[]; + queryParamsType?: TParamType; + requestParams: ReqResParam[]; - requestParamsType: TParamType; + requestParamsType?: TParamType; responseParams: ReqResParam[]; responseParamsType: TParamType; @@ -55,10 +65,15 @@ export default function GenericMethod({ network, cu, description, + url, useCases, constraints, codeSnippets, responseJSON, + pathParams, + pathParamsType, + queryParams, + queryParamsType, requestParams, requestParamsType, responseParams, @@ -69,7 +84,7 @@ export default function GenericMethod({ isRESTApi, }: GenericMethodProps) { const [snippet, setSnippet] = React.useState( - codeSnippets?.[0]?.language || null + codeSnippets?.[0]?.language || null, ); const snippetCode = React.useMemo(() => { @@ -84,7 +99,7 @@ export default function GenericMethod({ ) { return codeSnippetString.replaceAll( replaceCodeSnippetsURLFrom, - replaceCodeSnippetsURLTo + replaceCodeSnippetsURLTo, ); } return codeSnippetString; @@ -126,6 +141,13 @@ export default function GenericMethod({ {description} + {(Array.isArray(url) ? url : [url]).map((item, idx) => ( + + + {item} + + + ))} @@ -169,6 +191,18 @@ export default function GenericMethod({ + {isRESTApi && ( + + + + )} + + {isRESTApi && ( + + + + )} + + + + {title} + + + + +
+ +
+ + Parameters + + + {getParamsType(paramsType)} + +
+ + {params && params.length > 0 ? ( + + ) : null} +
+
+ + ); +} diff --git a/components/GenericMethod/params/RequestParamsList.module.css b/components/GenericMethod/params/ParamsList.module.css similarity index 100% rename from components/GenericMethod/params/RequestParamsList.module.css rename to components/GenericMethod/params/ParamsList.module.css diff --git a/components/GenericMethod/params/RequestParamsList.tsx b/components/GenericMethod/params/ParamsList.tsx similarity index 83% rename from components/GenericMethod/params/RequestParamsList.tsx rename to components/GenericMethod/params/ParamsList.tsx index baacab67..cf023368 100644 --- a/components/GenericMethod/params/RequestParamsList.tsx +++ b/components/GenericMethod/params/ParamsList.tsx @@ -1,31 +1,32 @@ import { Group } from "@mantine/core"; import { Fira_Mono } from "next/font/google"; import { RequestParamProp } from "./types"; -import classes from "./RequestParamsList.module.css"; +import classes from "./ParamsList.module.css"; import { Text } from "../../Text"; import { TParamType } from "../types"; import { getParamsType } from "../getParamsType"; import cx from "clsx"; type Props = { - requestParams: RequestParamProp; - requestParamsType: TParamType; + params: RequestParamProp; + paramsType: TParamType; isChild?: boolean; }; const fira = Fira_Mono({ subsets: ["latin"], weight: ["400"] }); -export function RequestParamsList({ requestParams, requestParamsType }: Props) { +export function ParamsList({ params, paramsType }: Props) { + const paramsTypeText = getParamsType(paramsType); return (
-
+ {paramsTypeText &&
- {getParamsType(requestParamsType)} + {paramsTypeText} -
+
} {/* Iterate through and render each param */} - {requestParams?.map((param) => ( + {params?.map((param) => (
@@ -75,9 +76,9 @@ export function RequestParamsList({ requestParams, requestParamsType }: Props) { {/* If param has children params, render them */} {param.childrenParams ? (
-
diff --git a/components/GenericMethod/params/PathParams.tsx b/components/GenericMethod/params/PathParams.tsx new file mode 100644 index 00000000..ea7f8591 --- /dev/null +++ b/components/GenericMethod/params/PathParams.tsx @@ -0,0 +1,7 @@ +import { Params, type Props as ParamsProps } from "./Params"; + +type Props = Omit; + +export function PathParams(props: Props) { + return ; +} diff --git a/components/GenericMethod/params/QueryParams.tsx b/components/GenericMethod/params/QueryParams.tsx new file mode 100644 index 00000000..2c09ac52 --- /dev/null +++ b/components/GenericMethod/params/QueryParams.tsx @@ -0,0 +1,7 @@ +import { Params, type Props as ParamsProps } from "./Params"; + +type Props = Omit; + +export function QueryParams(props: Props) { + return ; +} diff --git a/components/GenericMethod/params/RequestParams.tsx b/components/GenericMethod/params/RequestParams.tsx index 2a49f54b..7a90f11a 100644 --- a/components/GenericMethod/params/RequestParams.tsx +++ b/components/GenericMethod/params/RequestParams.tsx @@ -1,6 +1,6 @@ import { Grid } from "@mantine/core"; import classes from "./RequestParams.module.css"; -import { RequestParamsList } from "./RequestParamsList"; +import { ParamsList } from "./ParamsList"; import { TParamType } from "../types"; import { getParamsType } from "../getParamsType"; import { Text } from "../../Text"; @@ -72,9 +72,9 @@ export function RequestParams({
{requestParams && requestParams.length > 0 ? ( - ) : null} diff --git a/components/GenericMethod/types.ts b/components/GenericMethod/types.ts index b0e9e98f..068a30ba 100644 --- a/components/GenericMethod/types.ts +++ b/components/GenericMethod/types.ts @@ -14,6 +14,9 @@ export type TParamType = | "none" | "map[string]string" | "numeric" + | "networth_period" + | "nft_info" + | "nullable" | "uint64"; export type CodeSnippetObject = { diff --git a/components/WalletMethod/WalletMethod.tsx b/components/WalletMethod/WalletMethod.tsx new file mode 100644 index 00000000..cffe4560 --- /dev/null +++ b/components/WalletMethod/WalletMethod.tsx @@ -0,0 +1,19 @@ +import GenericMethod, { + GenericMethodProps, +} from "../GenericMethod/GenericMethod"; + +type Props = Omit< + GenericMethodProps, + "network" | "isRESTApi" | "responseParamsDescription" +>; + +export default function WalletMethod(props: Props) { + return ( + + ); +} diff --git a/components/WalletMethod/types.ts b/components/WalletMethod/types.ts new file mode 100644 index 00000000..554ea3e5 --- /dev/null +++ b/components/WalletMethod/types.ts @@ -0,0 +1,21 @@ +export type TParamType = + | "string" + | "number" + | "integer" + | "boolean" + | "array" + | "object" + | "array_of_objects" + | "array_of_strings" + | "array_of_arrays_of_strings" + | "array_of_integers" + | "int64" + | "array_of_numbers" + | "none" + | "map[string]string" + | "uint64"; + +export type CodeSnippetObject = { + language: "js" | "shell" | "node" | "go" | "python" | "rust"; + code: () => string; +}; diff --git a/components/method-docs/wallet/WalletMethod_getaggregatedpnl.tsx b/components/method-docs/wallet/WalletMethod_getaggregatedpnl.tsx new file mode 100644 index 00000000..f136aa92 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getaggregatedpnl.tsx @@ -0,0 +1,641 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getaggregatedpnl() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history \\ + --header 'accept: application/json' \\ + --header 'content-type: application/json' \\ + --data '{ + "addresses": ["0x..."], + "from_timestamp": 1710000000, + "to_timestamp": 1711000000, + "interval": "day" + }'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history", { + method: "POST", + headers: { + "accept": "application/json", + "content-type": "application/json" + }, + body: JSON.stringify({ + addresses: ["0x..."], + from_timestamp: 1710000000, + to_timestamp: 1711000000, + interval: "day" + }) +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history", { + method: "POST", + headers: { + "accept": "application/json", + "content-type": "application/json" + }, + body: JSON.stringify({ + addresses: ["0x..."], + from_timestamp: 1710000000, + to_timestamp: 1711000000, + interval: "day" + }) +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "bytes" + "fmt" + "io" + "net/http" +) + +func main() { + payload := []byte(\`{ + "addresses": ["0x..."], + "from_timestamp": 1710000000, + "to_timestamp": 1711000000, + "interval": "day" + }\`) + + req, _ := http.NewRequest("POST", "https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history", bytes.NewBuffer(payload)) + req.Header.Set("accept", "application/json") + req.Header.Set("content-type", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::{ACCEPT, CONTENT_TYPE}; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history") + .header(ACCEPT, "application/json") + .header(CONTENT_TYPE, "application/json") + .json(&json!({ + "addresses": ["0x..."], + "from_timestamp": 1710000000, + "to_timestamp": 1711000000, + "interval": "day" + })) + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/aggregated-pnl-history" +headers = { + "accept": "application/json", + "content-type": "application/json" +} + +payload = { + "addresses": ["0x..."], + "from_timestamp": 1710000000, + "to_timestamp": 1711000000, + "interval": "day" +} + +response = requests.post(url, json=payload, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "chain_id": "base", + "chain_name": "Base", + "chain_icon_url": "https://static.lambda.p2p.org/chains/base.png", + "category": "erc20", + "wallet_address": "0xdb6e9e7390e9acc34619e56efa48ade01cff6f12", + "position_id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "summary": { + "start": "2025-08-06T00:00:01+00:00", + "end": "2025-09-05T08:30:01+00:00", + "pnl_usd": 2822871.721936092, + "tokens": [ + { + "id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "symbol": "superOETHb", + "name": "Super OETH", + "position_type": "supply", + "icon_url": "https://static.lambda.p2p.org/tokens/base/0xdbfefd2e8460a6ee4955a68582f85708baea60a3.png", + "defi_id": "erc20", + "defi_name": "Erc20", + "attributes": { + "address": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "decimals": 18, + "chain_id": "base", + "chain_name": "Base", + "chain_id_numeric": 8453 + }, + "start_balance": { + "balance": 2628.0887891055277, + "price": 3627.1475841511256 + }, + "end_balance": { + "balance": 4128.087289105528, + "price": 4310.9683282972 + } + } + ] + }, + "pnl_history": [ + { + "time": "2025-08-06T00:00:01+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + }, + { + "time": "2025-08-06T10:04:08+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + } + ], + "user_activities": [ + { + "time": "2025-08-06T10:04:09+00:00", + "type": "deposit", + "symbol": "superOETHb", + "amount": 1499.9985000000001, + "value_usd": 5440715.935505313, + "transaction_hash": "0x8e7b341a70da11525d247928ee2894cd4b57ca7f8addf0d4a304c87d8588710f" + } + ], + "reward_history": [] + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Target chain", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = [ + { + paramName: "start_timestamp", + type: "integer", + paramDescription: "≥ 0. The start timestamp in milliseconds. Default: now - 30 days." + }, + { + paramName: "end_timestamp", + type: "integer", + paramDescription: "≥ 0. The end timestamp in milliseconds. Default: now." + }, + { + paramName: "granularity", + type: "string", + paramDescription: "Granularity. Default: day.", + paramEnum: [ + {value: "month", description: null }, + { value: "week", description: null }, + { value: "day", description: null }, + { value: "hour", description: null }, + { value: "five_minutes", description: null }, + { value: "any", description: null } + ] + }, + { + paramName: "points_limit", + type: "integer", + paramDescription: "2 to 100. The maximum number of points to return. Default: 100. Max: 100." + }, + { + paramName: "positions", + type: "array_of_objects", + paramDescription: "List of specific positions (wallet address + category + position ID) to calculate aggregated PnL for. Each position represents a unique token or DeFi position.", + childrenParamsType:"object", + childrenParams: [ + { + paramName: "address", + type: "string", + paramDescription: "Wallet address of the position" + }, + { + "paramName": "category", + "type": "string", + "paramDescription": "[Required] The category of the PnL.", + "paramEnum": [ + { "value": "erc20", "description": "ERC-20 tokens" }, + { "value": "native", "description": "Native tokens" }, + { "value": "aave-v3-supply", "description": "AAVE V3 Lending" }, + { "value": "aave-v3-borrow", "description": "AAVE V3 Borrowing" }, + { "value": "uni-v2-supply", "description": "Uniswap V2" }, + { "value": "uni-v3-supply", "description": "Uniswap V3" }, + { "value": "sushi-v2-supply", "description": "SushiSwap V2" }, + { "value": "sushi-v3-supply", "description": "SushiSwap V3" }, + { "value": "lido", "description": "Lido" }, + { "value": "venus-supply", "description": "Venus Supply" }, + { "value": "venus-staking", "description": "Venus Staking" }, + { "value": "balancer-v2", "description": "Balancer V2" }, + { "value": "aura", "description": "Aura" }, + { "value": "morpho-vault", "description": "Morpho Vault" }, + { "value": "morpho-market-supply", "description": "Morpho Market Supply" }, + { "value": "morpho-market-borrow", "description": "Morpho Market Borrow" }, + { "value": "morpho-market-collateral", "description": "Morpho Market Collateral" }, + { "value": "renzo", "description": "Renzo" }, + { "value": "ether-fi", "description": "Ether.fi" }, + { "value": "sky", "description": "Sky" }, + { "value": "euler-vesting", "description": "Euler Vesting" }, + { "value": "euler-supply", "description": "Euler Supply" }, + { "value": "euler-borrow", "description": "Euler Borrow" }, + { "value": "pendle", "description": "Pendle" }, + { "value": "ethena-staking", "description": "Ethena Staking" }, + { "value": "ethena-locked", "description": "Ethena Locked" }, + { "value": "ethena-cooldown", "description": "Ethena Cooldown" }, + { "value": "gearbox", "description": "Gearbox" }, + { "value": "fluid", "description": "Fluid" }, + { "value": "kiln", "description": "Kiln" }, + { "value": "compound-v3-supply", "description": "Compound V3 CToken Supply" }, + { "value": "compound-v3-borrow", "description": "Compound V3 Lending Borrow" }, + { "value": "compound-v3-reward", "description": "Compound V3 COMP Rewards" }, + { "value": "compound-v3-collateral", "description": "Compound V3 Lending Collateral" } + ] + }, + { + paramName: "position_id", + type: "string", + paramDescription: "[Required] The position ID, which depends on the category", + paramEnum: [ + { + value: "Uniswap V3 / SushiSwap V3", + description: "{Pool Address}-{Numeric NFT position ID} (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b-123456)" + }, + { + value: "Uniswap V2 / SushiSwap V2", + description: "Pool address (hash) (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b)" + }, + { + value: "Aave V3 / ERC-20", + description: "aToken/aDebtToken address (e.g., 0xefd6c64533602ac55ab64442307f6fe2c9307305)" + }, + { + value: "Morpho Vault", + description: "pool address (e.g., 0x0f359fd18bda75e9c49bc027e7da59a4b01bf32a)" + }, + { + value: "Morpho Market Supply/Borrow/Collateral", + description: "Market id bytes (e.g., 0x64d65c9a2d91c36d56fbc42d69e979335320169b3df63bf92789e2c8883fcc64)" + }, + { + value: "Lido", + description: "stETH/wstETH address (e.g., 0xae7ab96520de3a18e5e111b5eaab095312d7fe84)" + }, + { + value: "Venus Supply", + description: "vToken address (e.g., 0xc82780db1257c788f262fbbda960b3706dfdcaf2)" + }, + { + value: "Venus Staking", + description: "staking pool address (e.g., 0xa0882c2d5df29233a092d2887a258c2b90e9b994)" + }, + { + value: "Balancer V2", + description: "pool address (e.g., 0x1e19cf2d73a72ef1332c882f20534b6519be0276)" + }, + { + value: "Aura", + description: "pool address (e.g., 0xdd1fe5ad401d4777ce89959b7fa587e569bf125d)" + }, + { + value: "Renzo", + description: "ezETH, pzETH, ezREZ or ezEIGEN address (e.g., 0xdf6097a9e585E3d72556D19fA147562FfEf5D3C7)" + }, + { + value: "Ether.fi", + description: "eETH, weETH or vault address (e.g., 0x35fa164735182de50811e8e2e824cfb9b6118ac2)" + }, + { + value: "Sky", + description: "pool address (e.g., 0xa3931d71877c0e7a3148cb7eb4463524fec27fbd)" + }, + { + value: "Euler", + description: "pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)" + }, + { + value: "Euler Vesting", + description: "pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)" + }, + { + value: "Euler Supply", + description: "{eToken Address}-{subaccount index} (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696-3)" + }, + { + value: "Euler Borrow", + description: "{eDebtToken Address}-{subaccount index} (e.g., 0x6200860bcdcb23d3b67a46769affeb91db2b175a-2)" + }, + { + value: "Pendle", + description: "(AMM, SY, YT, PT, STAKING) pool address (e.g., 0x6d98a2b6cdbf44939362a3e99793339ba2016af4)" + }, + { + value: "Gearbox", + description: "pool address, diselToken, dToken (e.g., 0xff94993fa7ea27efc943645f95adb36c1b81244b)" + }, + { + value: "Curve", + description: "pool address of curve_lp_token/gauge_address/veCRV/scrvUSD/vesting (e.g., 0xecd5e75afb02efa118af914515d6521aabd189f1)" + }, + { + value: "Curve Collateral", + description: "pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)" + }, + { + value: "Curve Borrow", + description: "pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)" + }, + { + value: "Fluid", + description: "fToken address of fluid yield (e.g., 0x6a29a46e21c730dca1d8b23d637c101cec605c5b)" + }, + { + value: "Kiln", + description: "pool address of kiln (e.g., 0x2401c39d7ba9e283668a53fcc7b8f5fd9e716fdf)" + }, + { + value: "Compound V3 Supply", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 Lending Borrow", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 COMP Rewards", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 Lending Collateral", + description: "cToken-collateral_token_address address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599)" + } + ] +}, + ] + }, + +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + "paramName": "data", + "type": "array", + "paramDescription": "[Required] Returns historical records of Profit and Loss (PnL) over time.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "chain_id", + "type": "string", + "paramDescription": "[Required] id of the chain" + }, + { + "paramName": "chain_name", + "type": "string", + "paramDescription": "[Required] name of the chain" + }, + { + "paramName": "chain_icon_url", + "type": "string", + "paramDescription": "URL of the chain", + "childrenParamsType": "nullable" + }, + { + "paramName": "category", + "type": "string", + "paramDescription": "[Required] Category or DeFi id of the position.", + "paramEnum": [ + { "value": "erc20", "description": null }, + { "value": "native", "description": null }, + { "value": "aave-v3-supply", "description": null }, + { "value": "aave-v3-borrow", "description": null }, + { "value": "uni-v2-supply", "description": null }, + { "value": "uni-v3-supply", "description": null }, + { "value": "sushi-v2-supply", "description": null }, + { "value": "sushi-v3-supply", "description": null }, + { "value": "lido", "description": null }, + { "value": "venus-supply", "description": null }, + { "value": "venus-borrow", "description": null }, + { "value": "venus-staking", "description": null }, + { "value": "balancer-v2", "description": null }, + { "value": "aura", "description": null }, + { "value": "morpho-vault", "description": null }, + { "value": "morpho-market-supply", "description": null }, + { "value": "morpho-market-borrow", "description": null }, + { "value": "morpho-market-collateral", "description": null }, + { "value": "renzo", "description": null }, + { "value": "ether-fi", "description": null }, + { "value": "rocket", "description": null }, + { "value": "sky", "description": null }, + ] + }, + { + "paramName": "wallet_address", + "type": "string", + "paramDescription": "[Required] Wallet address of the position." + }, + { + "paramName": "position_id", + "type": "string", + "paramDescription": "[Required] Position id of the position." + }, + { + "paramName": "summary", + "type": "object", + "paramDescription": "[Required] Summary of the PnL and tokens.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "start", + "type": "string", + "paramDescription": "Start timestamp of the summary period." + }, + { + "paramName": "end", + "type": "string", + "paramDescription": "End timestamp of the summary period." + }, + { + "paramName": "pnl_usd", + "type": "number", + "paramDescription": "Total PnL in USD." + }, + { + "paramName": "tokens", + "type": "array", + "paramDescription": "List of tokens in the position.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "id", "type": "string", "paramDescription": "Token ID." }, + { "paramName": "symbol", "type": "string", "paramDescription": "Token symbol." }, + { "paramName": "name", "type": "string", "paramDescription": "Token name." }, + { "paramName": "position_type", "type": "string", "paramDescription": "Type of position (e.g., supply, borrow)." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download token icon." }, + { "paramName": "defi_id", "type": "string", "paramDescription": "DeFi ID of the token." }, + { "paramName": "defi_name", "type": "string", "paramDescription": "Community name of DeFi." }, + { "paramName": "attributes", "type": "object", "paramDescription": "Token attributes.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "address", "type": "string", "paramDescription": "Token contract address." }, + { "paramName": "decimals", "type": "number", "paramDescription": "Token decimals." }, + { "paramName": "chain_id", "type": "string", "paramDescription": "Chain id." }, + { "paramName": "chain_name", "type": "string", "paramDescription": "Chain name." }, + { "paramName": "chain_id_numeric", "type": "number", "paramDescription": "Numeric chain id." } + ]}, + { "paramName": "start_balance", "type": "object", "paramDescription": "Starting token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at start." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at start in USD." } + ]}, + { "paramName": "end_balance", "type": "object", "paramDescription": "Ending token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at end." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at end in USD." } + ]} + ] + } + ] + }, + { + "paramName": "pnl_history", + "type": "array", + "paramDescription": "[Required] List of asset changes over time.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the PnL entry." }, + { "paramName": "balance_usd", "type": "number", "paramDescription": "[Required] Position balance in USD at the given timestamp." }, + { "paramName": "reward_usd", "type": "number", "paramDescription": "[Required] Rewards earned in tokens converted to USD (current price)." }, + { "paramName": "reward_usd_net", "type": "number", "paramDescription": "[Required] Rewards in tokens converted using latest price." }, + { "paramName": "pnl_usd", "type": "number", "paramDescription": "[Required] Total change in portfolio value compared to initial state." }, + { "paramName": "profit_gains_usd", "type": "number", "paramDescription": "[Required] Net change in token balance adjusted for price fluctuations." }, + { "paramName": "token_amount", "type": "number", "paramDescription": "[Required] Amount of tokens in the position." } + ] + }, + { + "paramName": "user_activities", + "type": "array", + "paramDescription": "[Required] Withdrawal/Deposits in scope of PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the user activity." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of user activity.", "paramEnum": [ + { "value": "deposit", "description": null }, + { "value": "withdraw", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol affected." }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of tokens changed." }, + { "paramName": "value_usd", "type": "number", "paramDescription": "[Required] Value of the token in USD." }, + { "paramName": "transaction_hash", "type": "string", "paramDescription": "[Required] Transaction hash of the activity." } + ] + }, + { + "paramName": "reward_history", + "type": "array", + "paramDescription": "[Required] List of rewards earned during the PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the reward." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of reward.", "paramEnum": [ + { "value": "supply", "description": null }, + { "value": "borrow", "description": null }, + { "value": "stake", "description": null }, + { "value": "reward", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol of the reward." }, + { "paramName": "name", "type": "string", "paramDescription": "[Required] Token name of the reward." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download icon of the token.", "childrenParamsType": "nullable" }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of reward tokens." }, + { "paramName": "price", "type": "number", "paramDescription": "[Required] Price of the reward token in USD." } + ] + } + ] +} +]; + + +const USE_CASES = [ + "The user’s own funds are separated from rewards. This allows us to account for both Profit & Loss movements and rewards, while incoming transfers, top-ups, and withdrawals are not considered as sources of income or loss", + "Support blue chip tokens and DeFi positions across major EVM chains." +]; + +const CONSTRAINTS = [ + "The current version is limited to open DeFi positions, while the next update will support historical closed positions as well.", + "Requires valid chain and wallet address", + "Time range parameters affect response size", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getaprhistory.tsx b/components/method-docs/wallet/WalletMethod_getaprhistory.tsx new file mode 100644 index 00000000..b3d86b17 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getaprhistory.tsx @@ -0,0 +1,281 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getaprhistory() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history", { + method: "POST", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history", { + method: "POST", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" + "strings" +) + +func main() { + req, _ := http.NewRequest("POST", "https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history", strings.NewReader("{}")) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/protocols/apr/history" +headers = { + "accept": "application/json" +} + +response = requests.post(url, headers=headers, json={}) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "chain": "string", + "protocol": "string", + "pool_id": "string", + "asset": "string", + "start_date": 0, + "end_date": 0, + "APRs": [ + { + "type": "string", + "reward_token_address": "string", + "points": [ + { + "timestamp": 0, + "value": 0 + } + ] + } + ] + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = [ + { + paramName: "requests", + type: "array_of_objects", + paramDescription: "[Required] List of APR history requests", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g., ethereum)" + }, + { + paramName: "protocol", + type: "string", + paramDescription: "Protocol identifier (enum, 39 available values)" + }, + { + paramName: "pool_id", + type: "string", + paramDescription: "Pool identifier" + }, + { + paramName: "asset", + type: "string", + paramDescription: "Asset address" + }, + { + paramName: "start_date", + type: "integer", + paramDescription: "[≥ 0] Start timestamp in milliseconds" + }, + { + paramName: "end_date", + type: "integer", + paramDescription: "[≥ 0] End timestamp in milliseconds" + } + ] +} +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array_of_objects", + paramDescription: "[Required] APR history data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g., ethereum)" + }, + { + paramName: "protocol", + type: "string", + paramDescription: "[Required] Protocol identifier (e.g., aave_v3)" + }, + { + paramName: "pool_id", + type: "string", + paramDescription: "[Required] Pool identifier" + }, + { + paramName: "asset", + type: "string", + paramDescription: "Asset address" + }, + { + paramName: "start_date", + type: "integer", + paramDescription: "[Required] Start timestamp in milliseconds" + }, + { + paramName: "end_date", + type: "integer", + paramDescription: "[Required] End timestamp in milliseconds" + }, + { + paramName: "APRs", + type: "array_of_objects", + paramDescription: "[Required] APR series for the requested asset", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] APR type (e.g., Supply interest, Borrow fees)" + }, + { + paramName: "reward_token_address", + type: "string", + paramDescription: "Reward token address" + }, + { + paramName: "points", + type: "array_of_objects", + paramDescription: "[Required] APR values over time", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "timestamp", + type: "integer", + paramDescription: "[Required] Timestamp in milliseconds" + }, + { + paramName: "value", + type: "number", + paramDescription: "APR value at the timestamp, defaults to 0" + } + ] + } + ] + } + ] +} +]; + +const USE_CASES = [ + "Retrieve historical APR data for DeFi protocols", + "Analyze yield trends over time", +]; + +const CONSTRAINTS = [ + "Only supported protocols and assets are returned", + "Historical data may be limited for older timestamps", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getevmportfolio.tsx b/components/method-docs/wallet/WalletMethod_getevmportfolio.tsx new file mode 100644 index 00000000..7c092844 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getevmportfolio.tsx @@ -0,0 +1,976 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getevmportfolio() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v2/wallets/{address}/balances" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "total_net_worth_usd": 83104610.57318147, + "portfolio_allocation_usd": { + "wallet": 696.2668659837276, + "deposit": 83103914.30631548, + "borrow": 0 + }, + "assets": [ + { + "type": "defi", + "id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84-ethereum-aave v3 lending-deposit", + "name": "Aave V3 Lending", + "defi_id": "Aave V3 Lending", + "defi_name": "Aave V3", + "defi_url": "https://app.aave.com", + "defi_icon_url": "https://static.lambda.p2p.org/protocols/aave-pool-v3.png", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 83103914.30631548, + "value_usd_change_1d": -764585.7447870523, + "attributes": { + "pool_address": "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2", + "rewards_value_usd": 0, + "rewards_usd_change_1d": 0, + "deposits": [ + { + "category": "deposit", + "token_id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "token_symbol": "stETH", + "token_name": "Lido Staked ETH", + "contract_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18, + "amount_string": "41719504281041810000000", + "amount": 41719.50428104181, + "price_usd": 1991.96792336, + "value_usd": 83103914.30631548, + "value_usd_change_1d": -764585.7447870523, + "attributes": { + "pnl_links": [], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xae7ab96520de3a18e5e111b5eaab095312d7fe84.png", + "contract_implementations": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18 + }, + { + "chain_id": "arbitrum", + "chain_id_numeric": 42161, + "chain_name": "Arbitrum", + "address": "0xabc...123", + "decimals": 18 + } + ] + } + } + ], + "loans": [], + "rewards": [], + "pnl_links": [] + } + }, + { + "type": "token", + "id": "base-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 696.2668659837276, + "value_usd_change_1d": -7.308658452814029, + "attributes": { + "token_id": "eth", + "token_symbol": "ETH", + "token_name": "Ethereum", + "decimals": 18, + "amount_string": "349696576689666633", + "amount": 0.3496965766896666, + "price_usd": 1991.06, + "pnl_links": [], + "contract_implementations": [] + } + }, + { + "type": "token", + "id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 1.9919679233600003e-15, + "value_usd_change_1d": -1.8326817587199723e-17, + "attributes": { + "token_id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "token_symbol": "stETH", + "token_name": "Lido Staked ETH", + "contract_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18, + "amount_string": "1", + "amount": 0, + "price_usd": 1991.06, + "pnl_links": [ + "http://localhost:3301/api/v1/wallets/0x70ac8647e2ef008cb54db8e55657bced850c5032/chains/ethereum/pnl-history?position_id=0xae7ab96520de3a18e5e111b5eaab095312d7fe84&category=erc20" + ], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xae7ab96520de3a18e5e111b5eaab095312d7fe84.png", + "contract_implementations": [] + } + } + ], + "meta_tokens": [ + { + "type": "token", + "id": "0xd9a442856c234a39a81a089c06451ebaa4306a72-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 2636.0385228235514, + "value_usd_change_1d": 157.8171827220167, + "attributes": { + "token_id": "eb4d58b0-1cb0-42bb-b700-2489e078ee26", + "token_symbol": "pufETH", + "token_name": "pufETH", + "contract_address": "0xd9a442856c234a39a81a089c06451ebaa4306a72", + "decimals": 18, + "amount_string": "800132917490221744", + "amount": 0.8001329174902218, + "price_usd": 3294.50078256, + "pnl_links": [], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xd9a442856c234a39a81a089c06451ebaa4306a72.png", + "contract_implementations": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "address": "0xd9a442856c234a39a81a089c06451ebaa4306a72", + "decimals": 18 + }, + { + "chain_id": "soneium", + "chain_id_numeric": 1868, + "chain_name": "Soneium", + "address": "0x6c460b2c6d6719562d5da43e5152b375e79b9a8b", + "decimals": 18 + } + ] + }, + "asset_type": "token" + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Target EVM chain (e.g. ethereum, polygon)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; +const REQUEST_PARAMS: RequestParamProp = []; +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "chain_id", + type: "string", + paramDescription: "Filter by specific chain ID as defined in Wallet API. If not provided, data from all supported chains will be included.", + }, + { + paramName: "asset_type", + type: "string", + paramDescription: "Specify the type of assets to return.", + paramEnum: [ + { + value: "TOKEN", + description: "Returns only wallet-held tokens (e.g., ERC-20s)", + }, + { + value: "DEFI", + description: "Returns only DeFi positions", + }, + { + value: "ALL", + isDefault: true, + description: "returns both", + }, + ], + }, + { + paramName: "assets_ids", + type: "string", + paramDescription: "Optional list of specific asset or DeFi protocol IDs to include. Use token IDs (e.g., 'eth') or protocol IDs (e.g., 'sushiswap_v2'). If omitted, all available assets will be returned.", + }, + { + paramName: "include_zero_price_tokens", + type: "boolean", + paramDescription: "If True (default), includes tokens with price equal to 0 (e.g., airdrops, unverified tokens). Set to False to exclude such tokens, which helps reduce spam in portfolios.", + }, + { + paramName: "include_meta_tokens", + type: "boolean", + paramDescription: "If True, the response will include meta tokens—tokens that represent underlying assets in DeFi protocols. These tokens typically indicate positions in liquidity pools, lending platforms, or yield strategies. For example, aEthUSDT represents a USDT position supplied to the AAVE protocol. Default: false.", + }, +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] User balances data.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "total_net_worth_usd", + type: "number", + paramDescription: "[Required] Total value in usd of all wallet's assets", + }, + { + paramName: "portfolio_allocation_usd", + type: "object", + paramDescription: "[Required] all the portfolio allocations", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "wallet", + type: "number", + paramDescription: "[Required] Total value of assets that are on the address", + }, + { + paramName: "deposit", + type: "number", + paramDescription: "[Required] Total value of assets deposited in DeFi", + }, + { + paramName: "borrow", + type: "number", + paramDescription: "[Required] Total value of borrowed assets", + }, + ] , + }, + { + paramName: "assets", + type: "array", + paramDescription: "[Required] User's defi positions and tokens.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Asset type in Wallet API", + paramEnum: [ + { + value: "liquid_staking_token", + description: null, + }, + { + value: "token", + description: null, + }, + { + value: "defi", + description: null, + }, + ], + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] id of a asset in Wallet API", + }, + { + paramName: "name", + type: "string", + paramDescription: "name of defi position. Possible types: Lending, Liquidity Pool, Deposit, Yield, Staked, Farming", + }, + { + paramName: "defi_id", + type: "string", + paramDescription: "id of a DeFi in Wallet API", + }, + { + paramName: "defi_name", + type: "string", + paramDescription: "Community name of DeFi", + }, + { + paramName: "defi_url", + type: "string", + paramDescription: "Link to the DeFi website", + }, + { + paramName: "defi_icon_url", + type: "string", + paramDescription: "URL to download icon of the DeFi.", + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "id of a chain in Wallet API", + }, + { + paramName: "chain_id_numeric", + type: "numeric", + paramDescription: "[Required] Numeric id of the chain", + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Community name of a chain", + }, + { + paramName: "chain_icon_url", + type: "string", + paramDescription: "URL to download icon of the chain.", + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Total asset usd value on a wallet", + }, + { + paramName: "value_usd_change_1d", + type: "number", + paramDescription: "[Required] USD value changes in last day", + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Defi position token attributes", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "pnl_links", + type: "array_of_strings", + paramDescription: "Links to get PNL for token or its token wrappers" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "contract_implementations", + type: "array_of_objects", + paramDescription: "List of contract addresses for this token across supported chains", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] Unique identifier of the chain in Lambda API (e.g., ethereum, arbitrum, polygon)" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric chain ID (e.g., 1 for Ethereum, 42161 for Arbitrum)" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Community name of the chain (e.g., Ethereum, Arbitrum)" + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Token contract address on the given chain" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Number of decimal places the token uses on this chain" + } + ] + }, + { + paramName: "loans", + type: "array_of_objects", + paramDescription: "[Required] List of loan tokens in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] The position category indicating the type of DeFi interaction" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] Unique identifier for the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "[Required] Token symbol" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "[Required] Full name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "Smart contract address of the token on the blockchain" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Number of decimal places used by the token" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Token amount in smallest unit without decimal conversion (raw blockchain value)" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Human-readable token amount after decimal conversion" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Price of one token in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Total USD value of the token position" + }, + { + paramName: "value_usd_change_1d", + type: "number", + paramDescription: "[Required] 24-hour change in USD value due to price fluctuations" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Defi position token attributes", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "pnl_links", + type: "array_of_strings", + paramDescription: "Links to get PNL for token or its token wrappers" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "contract_implementations", + type: "array_of_objects", + paramDescription: "List of contract addresses for this token across supported chains", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] Unique identifier of the chain in Lambda API (e.g., ethereum, arbitrum, polygon)" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric chain ID (e.g., 1 for Ethereum, 42161 for Arbitrum)" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Community name of the chain (e.g., Ethereum, Arbitrum)" + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Token contract address on the given chain" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Number of decimal places the token uses on this chain" + } + ] + } + ] + } + ] +}, +{ + paramName: "rewards", + type: "array_of_objects", + paramDescription: "[Required] List of rewards in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] The position category indicating the type of DeFi interaction" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] Unique identifier for the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "[Required] Token symbol" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "[Required] Full name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "Smart contract address of the token on the blockchain" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Number of decimal places used by the token" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Token amount in smallest unit without decimal conversion (raw blockchain value)" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Human-readable token amount after decimal conversion" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Price of one token in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Total USD value of the token position" + }, + { + paramName: "value_usd_change_1d", + type: "number", + paramDescription: "[Required] 24-hour change in USD value due to price fluctuations" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Defi position token attributes", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "pnl_links", + type: "array_of_strings", + paramDescription: "Links to get PNL for DeFi position" + }, + { + paramName: "composite_symbol", + type: "string", + paramDescription: "Token pair symbol for liquidity pool positions" + } + ] + } + ] +}, + ] +}, + { + paramName: "asset_type", + type: "string", + paramDescription: "[Required] Inferred asset type. Possible values:", + paramEnum: [ + { + value: "token", + description: "Standard wallet token (ERC-20)", + }, + { + value: "lp", + description: "Liquidity pool position", + }, + { + value: "staking", + description: "Staked or locked tokens", + }, + { + value: "loan", + description: "Borrowed position", +}, +{ + value: "reward", + description: "Rewards or airdrops", +}, +{ + value: "stream", + description: "Vesting or streaming contract", +}, +{ + value: "yield", + description: "Yield farming position", +}, +{ + value: "farming", + description: "Farming position", +}, +{ + value: "vesting", + description: "Vesting position", +}, +{ + value: "deposit", + description: "Generic DeFi deposit (non-LP)", +}, +{ + value: "unknown", + description: "Unable to classify", +}, + ], + }, + ], + }, + { + paramName: "meta_tokens", + type: "array_of_objects", + paramDescription: "[Required] List of tokens that represent underlying assets in DeFi protocols.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Asset type in Wallet API", + paramEnum: [ + { + value: "liquid_staking_token", + description: null, + }, + { + value: "token", + description: null, + }, + { + value: "defi", + description: null, + }, + ], + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] id of a asset in Wallet API", + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "id of a chain in Wallet API", + }, + { + paramName: "chain_id_numeric", + type: "numeric", + paramDescription: "[Required] Numeric id of the chain", + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Community name of a chain", + }, + { + paramName: "chain_icon_url", + type: "string", + paramDescription: "URL to download icon of the chain.", + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Total asset usd value on a wallet", + }, + { + paramName: "value_usd_change_1d", + type: "number", + paramDescription: "[Required] USD value changes in last day", + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Asset-specific fields", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token.", + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "[Required] Symbol of the token.", + }, + { + paramName: "token_name", + type: "string", + paramDescription: "[Required] Name of the token", + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] Address of the token.", + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Number of decimal.", + }, + { + paramName: "amount_string", + type: "integer", + paramDescription: "[Required] Amount of tokens without decimals..", + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Token balance.", + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Token price in USD.", + }, + { + paramName: "pnl_links", + type: "array_of_strings", + paramDescription: "Links to get PNL for token inside the DeFi position.", + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token.", + }, + { + paramName: "contract_implementations", + type: "array_of_objects", + paramDescription: "List of contract addresses for this token across supported chains.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] The unique identifier of the chain in Wallet API where this token implementation exists. Example: 'ethereum', 'arbitrum', 'polygon'.", + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "[Required] The numeric chain ID. Example: 1 for Ethereum, 42161 for Arbitrum.", + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] The community name of the chain. Example: 'Ethereum', 'Arbitrum'.", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] The token contract address on the given chain. Example: '0xa0b8...'.", + }, + { + paramName: "decimals", + type: "string", + paramDescription: "[Required] Number of decimal places the token uses on this chain. Used to convert between base units and human-readable format. Example: 6 for USDC, 18 for ETH.", + }, + ], + + }, + ] + }, + { + paramName: "asset_type", + type: "string", + paramDescription: "[Required] Inferred asset type. Possible values:", + paramEnum: [ + { + value: "token", + description: "Standard wallet token (ERC-20)", + }, + { + value: "lp", + description: "Liquidity pool position", + }, + { + value: "staking", + description: "Staked or locked tokens", + }, + { + value: "loan", + description: "Borrowed position", +}, +{ + value: "reward", + description: "Rewards or airdrops", +}, +{ + value: "stream", + description: "Vesting or streaming contract", +}, +{ + value: "yield", + description: "Yield farming position", +}, +{ + value: "farming", + description: "Farming position", +}, +{ + value: "vesting", + description: "Vesting position", +}, +{ + value: "deposit", + description: "Generic DeFi deposit (non-LP)", +}, +{ + value: "unknown", + description: "Unable to classify", +}, + ], + }, + ], + }, + ], + }, +]; + +const USE_CASES = [ + "Retrieve all token balances for a wallet on a specific EVM chain", + "Display user portfolio in wallets and dashboards", +]; + +const CONSTRAINTS = [ + "Supports only EVM-compatible chains", + "Requires valid wallet address and chain parameters", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_gethistoricalnetworth.tsx b/components/method-docs/wallet/WalletMethod_gethistoricalnetworth.tsx new file mode 100644 index 00000000..a361067f --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_gethistoricalnetworth.tsx @@ -0,0 +1,217 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp, +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_gethistoricalnetworth() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/tokens-net-worth" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "points": [ + { + "timestamp": 1733142900, + "value": 4.495974120264539 + }, + { + "timestamp": 1733143200, + "value": 4.498005266850357 + }, + { + "timestamp": 1733143500, + "value": 4.4914756913229406 + }, + { + "timestamp": 1733143800, + "value": 4.484235837541586 + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "Target chain (per chain requests only)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "chain_id", + type: "string", + paramDescription: "Id of a chain in Wallet API API. Default: all chains", + }, + { + paramName: "period", + type: "networth_period", + paramDescription: "Period of time", + }, +]; +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] Wallet net-worth data.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "points", + type: "array_of_objects", + paramDescription: "[Required] History of the wallet net-worth.e", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "timestamp", + type: "integer", + paramDescription: "Timestamp of the poin", + }, + { + paramName: "value", + type: "number", + paramDescription: "Value of the point in USD.", + }, + ], + }, + ], + }, +]; + +const USE_CASES = [ + "Track historical portfolio value over time", + "Analyze wallet performance and growth", +]; + +const CONSTRAINTS = [ + "IMPORTANT: It doesn't include DeFi changes", + "Time range parameters affect response size and performance", +]; diff --git a/components/method-docs/wallet/WalletMethod_getnftcollections.tsx b/components/method-docs/wallet/WalletMethod_getnftcollections.tsx new file mode 100644 index 00000000..d4f429d8 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getnftcollections.tsx @@ -0,0 +1,293 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getnftcollections() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nft-collections" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "type": "nft_collections", + "id": "0xe7b9d5a2b01b23985356f521e0f5016eec201234:78095", + "collection_id": "78095", + "chains": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum" + } + ], + "attributes": { + "name": "Forgotten Runes Wizards Cult", + "description": "The Forgotten Runes Wizard's Cult is a collaborative legendarium. 10,000 unique Wizard NFTs, fully encoded on-chain. \\r\\n\\r\\n[Website](http://forgottenrunes.com) | [Discord](https://discord.gg/forgottenrunes) | [Twitter](https://twitter.com/forgottenrunes) | [Book of Lore](https://www.forgottenrunes.com/lore) | [Principles](https://www.forgottenrunes.com/posts/principles) | [Goodies](https://www.forgottenrunes.com/posts/goodies)\\r\\n\\r\\n[All Sister Collections](https://opensea.io/collection/forgottenrunes):\\r\\n\\r\\n[Sacred Flame](https://opensea.io/assets/0x31158181b4b91a423bfdc758fc3bf8735711f9c5/0) | [Forgotten Souls](https://opensea.io/collection/forgottensouls) | [Forgotten Ponies](https://opensea.io/collection/forgottenrunesponies)\\r\\n\\r\\nWizard NFT holders have not only the _image_, but the _character_ of that Wizard. Day by day, the Wizards in our collection come alive as our community builds lore, maps, stories, poems, art, and animation.\\r\\n\\r\\nJoin the Cult", + "number_of_assets": 2, + "total_floor_price": 2302.322682, + "icon_url": "https://lh3.googleusercontent.com/CeU1eMzjrYMG1CgdODpR8o6Av8aXUrUo3AayfZhWb-WKRCMTmg4EfHo1_fQ1lYOZBmvw9SpZB_8MdyZjkQfvTBmdJC9BLi_QHA", + "banner_url": "https://lh3.googleusercontent.com/saANtWqFOM1vMCWN5tDoDIqyUeB35Rp21I2za0q_zXIiNL1SifGbZC-gWLD3ZvEmrXV8e6fsxW0oEXM67BRzzd-a_8-MTeoE8NKU=w2500" + } + }, + { + "type": "nft_collections", + "id": "0xe7b9d5a2b01b23985356f521e0f5016eec201234:325315", + "collection_id": "325315", + "chains": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum" + } + ], + "attributes": { + "name": "Loot (for Adventurers)", + "description": "Loot is randomized adventurer gear generated and stored on chain. Stats, images, and other functionality are intentionally omitted for others to interpret. Feel free to use Loot in any way you want.", + "number_of_assets": 1, + "total_floor_price": 318.640146, + "icon_url": "https://lh3.googleusercontent.com/FhUGCaGIf0M44m-APikvSyXfcG4Ej-oQxv_KTbPccf-C6vbK0Ql9zkT8RQDflag97LpIedCqrh73J555KMkB_ZEywSGi5YuFFg", + "banner_url": "https://lh3.googleusercontent.com/-cU6Juj7ohNXxk5DQLzojqrzvZMSNq0L60OQOhUz0_4Xktiw4PxcWqgurtn8BZ-HMFtuAqMnZ20XzoLUwUk9ZYD-RrUHNbhqThE=w2500" + } + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g. ethereum, polygon)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; + +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "chain_ids", + type: "string", + paramDescription: "IDs of chains that support NFTs. Default: all supported chains.", + }, +]; +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array", + paramDescription: "[Required] NFT collection data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Type of the entity" + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] ID of the entity" + }, + { + paramName: "collection_id", + type: "string", + paramDescription: "[Required] ID of the collection" + }, + { + paramName: "chains", + type: "array", + paramDescription: "[Required] NFT collection chains", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] ID of the chain in Lambda API" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric ID of the chain" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Name of the chain" + } + ] + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] NFT collection attributes", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "name", + type: "string", + paramDescription: "[Required] NFT collection name" + }, + { + paramName: "description", + type: "string", + paramDescription: "[Required] NFT collection description" + }, + { + paramName: "number_of_assets", + type: "integer", + paramDescription: "Total number of NFTs in the collection" + }, + { + paramName: "number_of_owners", + type: "integer", + paramDescription: "Number of unique owners in the collection" + }, + { + paramName: "total_floor_price", + type: "number", + paramDescription: "Total floor price of the collection" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "NFT collection icon URL" + }, + { + paramName: "banner_url", + type: "string", + paramDescription: "NFT collection banner URL" + } + ] +}, + ] +} +]; + +const USE_CASES = [ + "Display NFT collections owned by a wallet", + "Group NFTs by collection for portfolio views", +]; + +const CONSTRAINTS = [ + "Requires valid wallet address", + "Only collections on supported chains are returned", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getnftmetadatabyid.tsx b/components/method-docs/wallet/WalletMethod_getnftmetadatabyid.tsx new file mode 100644 index 00000000..648aaec1 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getnftmetadatabyid.tsx @@ -0,0 +1,397 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getnftmetadatabyid() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id} \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "type": "nfts", + "id": "arbitrum:0xc5295c6a183f29b7c962df076819d44e0076860e:10", + "chain_id": "arbitrum", + "chain_id_numeric": 42161, + "chain_name": "Arbitrum", + "price": 1.90573, + "attributes": { + "token_id": "10", + "contract_address": "0xc5295c6a183f29b7c962df076819d44e0076860e", + "name": "Rainbow Treasure", + "interface": "ERC1155", + "image_url": "https://lh3.googleusercontent.com/1YGMrTrpMkI9Ch7ZvDxkGzCyuUznBESmWwmSuHxSZx3iqczOEi1MZE9lXrC-xYVrq5mFnu8y9WB5MZSbacKvcms-tXOtfg_-ow=s250", + "marketplace_urls": [], + "collection": { + "id": "1130824", + "name": "Smol Treasures", + "description": "Smols and Swols are currently farming Smol treasures on the moon.", + "icon_url": "https://lh3.googleusercontent.com/mnPPP7C3XTYy6VF5tXYzk44zLQOknF0AP2c-bP2haeokr63GjqP-48fHdMpDhTGDkoXwouuDOn8pBEEO21mJ0uKU-LSZaHbTeFo", + "banner_url": "https://lh3.googleusercontent.com/zcM24EwwI476WSxWMeeLghnH4RQUzSIdsldXfuw-6kN9iNd_P_8z4jt_fNlnnKO02PUlX7CW8tVPi53Scd_0_b7-c9Qy-RfGb0w=w2500", + "number_of_assets": 10000, + "number_of_owners": 5000, + "marketplace_urls": [] + } + }, + "traits": { + "Background": "sunrise", + "Race": "pink", + "Eyes": "classic" + }, + "owner_address": "0xd1D6bF2b014f0f2c53a54515D11e2D72D89B61b4" + } +} } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g. ethereum, polygon)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] NFT contract address", + }, + { + paramName: "nft_id", + type: "string", + paramDescription: "[Required] NFT token ID", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] NFT Details", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Type of the item" + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] Internal ID of the item" + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] Chain ID of the item" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric chain ID of the item" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Chain name of the item" + }, + { + paramName: "price", + type: "number", + paramDescription: "Price of the NFT" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] NFT details", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] NFT address" + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] NFT name" + }, + { + paramName: "interface", + type: "string", + paramDescription: "[Required] NFT interface" + }, + { + paramName: "image_url", + type: "string", + paramDescription: "[Required] URL of image content, if any" + }, + { + paramName: "preview_url", + type: "string", + paramDescription: "[Required] URL of preview image content, if any" + }, + { + paramName: "video_url", + type: "string", + paramDescription: "[Required] URL of video content, if any" + }, + { + paramName: "audio_url", + type: "string", + paramDescription: "[Required] URL of audio content, if any" + }, + { + paramName: "last_update_time", + type: "string", + paramDescription: "Time of the last NFT update" + }, + { + paramName: "collection", + type: "object", + paramDescription: "[Required] NFT collection info", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "id", + type: "string", + paramDescription: "[Required] NFT collection ID" + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] NFT collection name" + }, + { + paramName: "description", + type: "string", + paramDescription: "[Required] NFT collection description" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "NFT collection icon URL, if any" + }, + { + paramName: "banner_url", + type: "string", + paramDescription: "NFT collection banner URL, if any" + }, + { + paramName: "number_of_assets", + type: "integer", + paramDescription: "Total number of NFTs in the collection, if known" + }, + { + paramName: "number_of_owners", + type: "integer", + paramDescription: "Number of unique owners in the collection, if known" + }, + { + paramName: "marketplace_urls", + type: "array", + paramDescription: "Marketplace URLs for the collection, if any" + } + ] + }, + { + paramName: "marketplace_urls", + type: "array", + paramDescription: "Marketplace URLs for the NFT" + }, + { + paramName: "traits", + type: "object", + paramDescription: "NFT traits dictionary", + childrenParamsType: "object", + childrenParams: [] + }, + { + paramName: "spam", + type: "object", + paramDescription: "Spam classification result", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "score", + type: "integer", + paramDescription: "Spam/risk score from 0 (safe) to 100 (very risky)" + }, + { + paramName: "level", + type: "string", + paramDescription: "Risk level based on score: 'LOW', 'MEDIUM', or 'HIGH'" + }, + { + paramName: "reasons", + type: "object", + paramDescription: "Tagged explanations of why the NFT is considered risky" + }, + ], + }, + { + paramName: "owner_address", + type: "string", + paramDescription: "Address of the NFT owner" + }, + { + paramName: "creator_address", + type: "string", + paramDescription: "Address of the NFT creator" + }, + { + paramName: "raw_metadata", + type: "object", + paramDescription: "Raw metadata as returned by the NFT's tokenURI", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "token_uri", + type: "string", + paramDescription: "Token URI from the smart contract" + }, + { + paramName: "metadata", + type: "object", + paramDescription: "Unmodified metadata JSON from tokenURI" + }, + ] + + + } + ] + } + ] +} +]; + +const USE_CASES = [ + "Fetch metadata for a specific NFT", + "Display detailed NFT information in portfolio dashboards", +]; + +const CONSTRAINTS = [ + "Requires valid contract address and token ID", + "Only NFTs on supported chains are returned", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getnonevmportfolio.tsx b/components/method-docs/wallet/WalletMethod_getnonevmportfolio.tsx new file mode 100644 index 00000000..e4b46e07 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getnonevmportfolio.tsx @@ -0,0 +1,812 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getnonevmportfolio() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/balances" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "total_net_worth_usd": 83104610.57318147, + "portfolio_allocation_usd": { + "wallet": 696.2668659837276, + "deposit": 83103914.30631548, + "borrow": 0 + }, + "assets": [ + { + "type": "defi", + "id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84-ethereum-aave v3 lending-deposit", + "name": "Aave V3 Lending", + "defi_id": "Aave V3 Lending", + "defi_name": "Aave V3", + "defi_url": "https://app.aave.com", + "defi_icon_url": "https://static.lambda.p2p.org/protocols/aave-pool-v3.png", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 83103914.30631548, + "value_usd_change_1d": -764585.7447870523, + "attributes": { + "pool_address": "0x87870bca3f3fd6335c3f4ce8392d69350b4fa4e2", + "rewards_value_usd": 0, + "rewards_usd_change_1d": 0, + "deposits": [ + { + "category": "deposit", + "token_id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "token_symbol": "stETH", + "token_name": "Lido Staked ETH", + "contract_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18, + "amount_string": "41719504281041810000000", + "amount": 41719.50428104181, + "price_usd": 1991.96792336, + "value_usd": 83103914.30631548, + "value_usd_change_1d": -764585.7447870523, + "attributes": { + "pnl_links": [], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xae7ab96520de3a18e5e111b5eaab095312d7fe84.png", + "contract_implementations": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18 + }, + { + "chain_id": "arbitrum", + "chain_id_numeric": 42161, + "chain_name": "Arbitrum", + "address": "0xabc...123", + "decimals": 18 + } + ] + } + } + ], + "loans": [], + "rewards": [], + "pnl_links": [] + } + }, + { + "type": "token", + "id": "base-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 696.2668659837276, + "value_usd_change_1d": -7.308658452814029, + "attributes": { + "token_id": "eth", + "token_symbol": "ETH", + "token_name": "Ethereum", + "decimals": 18, + "amount_string": "349696576689666633", + "amount": 0.3496965766896666, + "price_usd": 1991.06, + "pnl_links": [], + "contract_implementations": [] + } + }, + { + "type": "token", + "id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 1.9919679233600003e-15, + "value_usd_change_1d": -1.8326817587199723e-17, + "attributes": { + "token_id": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "token_symbol": "stETH", + "token_name": "Lido Staked ETH", + "contract_address": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "decimals": 18, + "amount_string": "1", + "amount": 0, + "price_usd": 1991.06, + "pnl_links": [ + "http://localhost:3301/api/v1/wallets/0x70ac8647e2ef008cb54db8e55657bced850c5032/chains/ethereum/pnl-history?position_id=0xae7ab96520de3a18e5e111b5eaab095312d7fe84&category=erc20" + ], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xae7ab96520de3a18e5e111b5eaab095312d7fe84.png", + "contract_implementations": [] + } + } + ], + "meta_tokens": [ + { + "type": "token", + "id": "0xd9a442856c234a39a81a089c06451ebaa4306a72-ethereum-asset-asset", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "chain_icon_url": "https://static.lambda.p2p.org/chains/ethereum.png", + "value_usd": 2636.0385228235514, + "value_usd_change_1d": 157.8171827220167, + "attributes": { + "token_id": "eb4d58b0-1cb0-42bb-b700-2489e078ee26", + "token_symbol": "pufETH", + "token_name": "pufETH", + "contract_address": "0xd9a442856c234a39a81a089c06451ebaa4306a72", + "decimals": 18, + "amount_string": "800132917490221744", + "amount": 0.8001329174902218, + "price_usd": 3294.50078256, + "pnl_links": [], + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xd9a442856c234a39a81a089c06451ebaa4306a72.png", + "contract_implementations": [ + { + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "address": "0xd9a442856c234a39a81a089c06451ebaa4306a72", + "decimals": 18 + }, + { + "chain_id": "soneium", + "chain_id_numeric": 1868, + "chain_name": "Soneium", + "address": "0x6c460b2c6d6719562d5da43e5152b375e79b9a8b", + "decimals": 18 + } + ] + }, + "asset_type": "token" + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Target non-EVM chain", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "asset_type", + type: "string", + paramDescription: "Specify the type of assets to return.", + paramEnum: [ + { + value: "TOKEN", + description: "Returns only wallet-held tokens (e.g., ERC-20s)", + }, + { + value: "DEFI", + description: "Returns only DeFi positions", + }, + { + value: "ALL", + isDefault: true, + description: "returns both", + }, + ], + }, + { + paramName: "include_zero_price_tokens", + type: "boolean", + paramDescription: "If True (default), includes tokens with price equal to 0 (e.g., airdrops, unverified tokens). Set to False to exclude such tokens, which helps reduce spam in portfolios.", + }, +]; +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] User balances data.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "total_net_worth_usd", + type: "number", + paramDescription: "[Required] Total value in usd of all wallet's assets", + }, + { + paramName: "portfolio_allocation_usd", + type: "object", + paramDescription: "[Required] all the portfolio allocations", + }, + { + paramName: "assets", + type: "array", + paramDescription: "[Required] User's defi positions and tokens.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Asset type in Wallet API", + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] id of a asset in Wallet API", + }, + { + paramName: "name", + type: "string", + paramDescription: "name of defi position. Possible types: Lending, Liquidity Pool, Deposit, Yield, Staked, Farming", + }, + { + paramName: "defi_id", + type: "string", + paramDescription: "id of a DeFi in Wallet API", + }, + { + paramName: "defi_name", + type: "string", + paramDescription: "Community name of DeFi", + }, + { + paramName: "defi_url", + type: "string", + paramDescription: "Link to the DeFi website", + }, + { + paramName: "defi_icon_url", + type: "string", + paramDescription: "URL to download icon of the DeFi.", + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "id of a chain in Wallet API", + }, + { + paramName: "chain_id_numeric", + type: "numeric", + paramDescription: "[Required] Numeric id of the chain", + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Community name of a chain", + }, + { + paramName: "chain_icon_url", + type: "string", + paramDescription: "URL to download icon of the chain.", + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Total asset usd value on a wallet", + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Asset-specific fields ", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "rewards_value_usd", + type: "number", + paramDescription: "[Required] Current USD value of this position rewards" + }, + { + paramName: "extra", + type: "object", + paramDescription: "Extra fields for this position" + }, + { + paramName: "deposits", + type: "array_of_objects", + paramDescription: "[Required] List of deposit tokens in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] Category of the token" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "Symbol of the token" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "Name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] Address of the token" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "Number of decimals" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Amount of tokens without decimals" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Amount of tokens" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Token price in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Value of token in USD" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Attributes of the token", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "apr", + type: "object", + paramDescription: "Current APR (Annual Percentage Rate) data for this specific token. Available for tokens in supported lending/borrowing protocols" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "extra", + type: "object", + paramDescription: "Extra fields for this token" + } + ] +} + ] + }, + { + paramName: "loans", + type: "array_of_objects", + paramDescription: "[Required] List of loan tokens in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] Category of the token" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "Symbol of the token" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "Name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] Address of the token" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "Number of decimals" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Amount of tokens without decimals" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Amount of tokens" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Token price in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Value of token in USD" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Attributes of the token", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "apr", + type: "object", + paramDescription: "Current APR (Annual Percentage Rate) data for this specific token. Available for tokens in supported lending/borrowing protocols" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "extra", + type: "object", + paramDescription: "Extra fields for this token" + } + ] +}, + ] + }, + { + paramName: "rewards", + type: "array_of_objects", + paramDescription: "[Required] List of rewards in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] Category of the token" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "Symbol of the token" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "Name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] Address of the token" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "Number of decimals" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Amount of tokens without decimals" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Amount of tokens" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Token price in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Value of token in USD" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Attributes of the token", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "apr", + type: "object", + paramDescription: "Current APR (Annual Percentage Rate) data for this specific token. Available for tokens in supported lending/borrowing protocols" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "extra", + type: "object", + paramDescription: "Extra fields for this token" + } + ] +}, + ] + }, + { + paramName: "leverages", + type: "array_of_objects", + paramDescription: "List of leverage positions", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "category", + type: "string", + paramDescription: "[Required] Category of the token" + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "Symbol of the token" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "Name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] Address of the token" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "Number of decimals" + }, + { + paramName: "amount_string", + type: "string", + paramDescription: "[Required] Amount of tokens without decimals" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Amount of tokens (position size)" + }, + { + paramName: "price_usd", + type: "number", + paramDescription: "[Required] Token price in USD" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Value of token in USD" + }, + { + paramName: "collateral_value_usd", + type: "number", + paramDescription: "Value of collateral in USD" + }, + { + paramName: "notional_value_usd", + type: "number", + paramDescription: "Position size value in USD" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] Attributes of the token", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "apr", + type: "object", + paramDescription: "Current APR (Annual Percentage Rate) data for this specific token. Available for tokens in supported lending/borrowing protocols (POSITIONAPR)" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + }, + { + paramName: "extra", + type: "object", + paramDescription: "Extra fields for this token" + } + ] +}, + ] + }, + { + paramName: "unsettled", + type: "array_of_objects", + paramDescription: "List of unsettled items in this position", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "token_id", + type: "string", + paramDescription: "ID of the token" + }, + { + paramName: "token_symbol", + type: "string", + paramDescription: "Symbol of the token" + }, + { + paramName: "token_name", + type: "string", + paramDescription: "Name of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "Address of the token" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "[Required] Value of token in USD" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token" + } + ] + } + ] +} + ], + }, + ], + }, +]; + +const USE_CASES = [ + "Retrieve balances for a wallet on a non-EVM chain", + "Validate wallet assets before performing operations", +]; + +const CONSTRAINTS = [ + "Requires valid chain and wallet address parameters", + "Supports only non-EVM chains", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getpnlformultiplewallets.tsx b/components/method-docs/wallet/WalletMethod_getpnlformultiplewallets.tsx new file mode 100644 index 00000000..18fcbcac --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getpnlformultiplewallets.tsx @@ -0,0 +1,437 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getpnlformultiplewallets() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history \\ + --header 'accept: application/json' \\ + --header 'Content-Type: application/json' \\ + --data '{}'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history", { + method: "POST", + headers: { + "accept": "application/json", + "Content-Type": "application/json" + }, + body: JSON.stringify({}) +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history", { + method: "POST", + headers: { + "accept": "application/json", + "Content-Type": "application/json" + }, + body: JSON.stringify({}) +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" + "strings" +) + +func main() { + req, _ := http.NewRequest("POST", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history", strings.NewReader("{}")) + req.Header.Set("accept", "application/json") + req.Header.Set("Content-Type", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::{ACCEPT, CONTENT_TYPE}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history") + .header(ACCEPT, "application/json") + .header(CONTENT_TYPE, "application/json") + .body("{}") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests +import json + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallet-pnl-history" +headers = { + "accept": "application/json", + "Content-Type": "application/json" +} + +response = requests.post(url, headers=headers, data=json.dumps({})) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "chain_id": "base", + "chain_name": "Base", + "chain_icon_url": "https://static.lambda.p2p.org/chains/base.png", + "category": "erc20", + "wallet_address": "0xdb6e9e7390e9acc34619e56efa48ade01cff6f12", + "position_id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "summary": { + "start": "2025-08-06T00:00:01+00:00", + "end": "2025-09-05T08:30:01+00:00", + "pnl_usd": 2822871.721936092, + "tokens": [ + { + "id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "symbol": "superOETHb", + "name": "Super OETH", + "position_type": "supply", + "icon_url": "https://static.lambda.p2p.org/tokens/base/0xdbfefd2e8460a6ee4955a68582f85708baea60a3.png", + "defi_id": "erc20", + "defi_name": "Erc20", + "attributes": { + "address": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "decimals": 18, + "chain_id": "base", + "chain_name": "Base", + "chain_id_numeric": 8453 + }, + "start_balance": { + "balance": 2628.0887891055277, + "price": 3627.1475841511256 + }, + "end_balance": { + "balance": 4128.087289105528, + "price": 4310.9683282972 + } + } + ] + }, + "pnl_history": [ + { + "time": "2025-08-06T00:00:01+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + }, + { + "time": "2025-08-06T10:04:08+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + } + ], + "user_activities": [ + { + "time": "2025-08-06T10:04:09+00:00", + "type": "deposit", + "symbol": "superOETHb", + "amount": 1499.9985000000001, + "value_usd": 5440715.935505313, + "transaction_hash": "0x8e7b341a70da11525d247928ee2894cd4b57ca7f8addf0d4a304c87d8588710f" + } + ], + "reward_history": [] + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = [ + { + "paramName": "start_timestamp", + "type": "integer", + "paramDescription": "≥ 0. The start timestamp in milliseconds. Default: now - 30 days." + }, + { + "paramName": "end_timestamp", + "type": "integer", + "paramDescription": "≥ 0. The end timestamp in milliseconds. Default: now." + }, + { + "paramName": "granularity", + "type": "string", + "paramDescription": "Granularity of PnL points. Defaults to day.", + "paramEnum": [ + { "value": "month", "description": null }, + { "value": "week", "description": null }, + { "value": "day", "description": null }, + { "value": "hour", "description": null }, + { "value": "five_minutes", "description": null }, + { "value": "any", "description": null } + ] + }, + { + "paramName": "points_limit", + "type": "integer", + "paramDescription": "2 to 100. The maximum number of points to return. Default: 100. Max: 100." + }, + { + "paramName": "addresses", + "type": "array_of_strings", + "paramDescription": "List of wallet addresses to calculate PnL for. All positions within these wallets will be included in the aggregated calculation." + } +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + "paramName": "data", + "type": "array", + "paramDescription": "[Required] Returns historical records of Profit and Loss (PnL) over time.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "chain_id", + "type": "string", + "paramDescription": "[Required] id of the chain" + }, + { + "paramName": "chain_name", + "type": "string", + "paramDescription": "[Required] name of the chain" + }, + { + "paramName": "chain_icon_url", + "type": "string", + "paramDescription": "URL of the chain", + "childrenParamsType": "nullable" + }, + { + "paramName": "category", + "type": "string", + "paramDescription": "[Required] Category or DeFi id of the position.", + "paramEnum": [ + { "value": "erc20", "description": null }, + { "value": "native", "description": null }, + { "value": "aave-v3-supply", "description": null }, + { "value": "aave-v3-borrow", "description": null }, + { "value": "uni-v2-supply", "description": null }, + { "value": "uni-v3-supply", "description": null }, + { "value": "sushi-v2-supply", "description": null }, + { "value": "sushi-v3-supply", "description": null }, + { "value": "lido", "description": null }, + { "value": "venus-supply", "description": null }, + { "value": "venus-borrow", "description": null }, + { "value": "venus-staking", "description": null }, + { "value": "balancer-v2", "description": null }, + { "value": "aura", "description": null }, + { "value": "morpho-vault", "description": null }, + { "value": "morpho-market-supply", "description": null }, + { "value": "morpho-market-borrow", "description": null }, + { "value": "morpho-market-collateral", "description": null }, + { "value": "renzo", "description": null }, + { "value": "ether-fi", "description": null }, + { "value": "rocket", "description": null }, + { "value": "sky", "description": null }, + ] + }, + { + "paramName": "wallet_address", + "type": "string", + "paramDescription": "[Required] Wallet address of the position." + }, + { + "paramName": "position_id", + "type": "string", + "paramDescription": "[Required] Position id of the position." + }, + { + "paramName": "summary", + "type": "object", + "paramDescription": "[Required] Summary of the PnL and tokens.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "start", + "type": "string", + "paramDescription": "Start timestamp of the summary period." + }, + { + "paramName": "end", + "type": "string", + "paramDescription": "End timestamp of the summary period." + }, + { + "paramName": "pnl_usd", + "type": "number", + "paramDescription": "Total PnL in USD." + }, + { + "paramName": "tokens", + "type": "array", + "paramDescription": "List of tokens in the position.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "id", "type": "string", "paramDescription": "Token ID." }, + { "paramName": "symbol", "type": "string", "paramDescription": "Token symbol." }, + { "paramName": "name", "type": "string", "paramDescription": "Token name." }, + { "paramName": "position_type", "type": "string", "paramDescription": "Type of position (e.g., supply, borrow)." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download token icon." }, + { "paramName": "defi_id", "type": "string", "paramDescription": "DeFi ID of the token." }, + { "paramName": "defi_name", "type": "string", "paramDescription": "Community name of DeFi." }, + { "paramName": "attributes", "type": "object", "paramDescription": "Token attributes.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "address", "type": "string", "paramDescription": "Token contract address." }, + { "paramName": "decimals", "type": "number", "paramDescription": "Token decimals." }, + { "paramName": "chain_id", "type": "string", "paramDescription": "Chain id." }, + { "paramName": "chain_name", "type": "string", "paramDescription": "Chain name." }, + { "paramName": "chain_id_numeric", "type": "number", "paramDescription": "Numeric chain id." } + ]}, + { "paramName": "start_balance", "type": "object", "paramDescription": "Starting token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at start." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at start in USD." } + ]}, + { "paramName": "end_balance", "type": "object", "paramDescription": "Ending token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at end." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at end in USD." } + ]} + ] + } + ] + }, + { + "paramName": "pnl_history", + "type": "array", + "paramDescription": "[Required] List of asset changes over time.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the PnL entry." }, + { "paramName": "balance_usd", "type": "number", "paramDescription": "[Required] Position balance in USD at the given timestamp." }, + { "paramName": "reward_usd", "type": "number", "paramDescription": "[Required] Rewards earned in tokens converted to USD (current price)." }, + { "paramName": "reward_usd_net", "type": "number", "paramDescription": "[Required] Rewards in tokens converted using latest price." }, + { "paramName": "pnl_usd", "type": "number", "paramDescription": "[Required] Total change in portfolio value compared to initial state." }, + { "paramName": "profit_gains_usd", "type": "number", "paramDescription": "[Required] Net change in token balance adjusted for price fluctuations." }, + { "paramName": "token_amount", "type": "number", "paramDescription": "[Required] Amount of tokens in the position." } + ] + }, + { + "paramName": "user_activities", + "type": "array", + "paramDescription": "[Required] Withdrawal/Deposits in scope of PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the user activity." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of user activity.", "paramEnum": [ + { "value": "deposit", "description": null }, + { "value": "withdraw", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol affected." }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of tokens changed." }, + { "paramName": "value_usd", "type": "number", "paramDescription": "[Required] Value of the token in USD." }, + { "paramName": "transaction_hash", "type": "string", "paramDescription": "[Required] Transaction hash of the activity." } + ] + }, + { + "paramName": "reward_history", + "type": "array", + "paramDescription": "[Required] List of rewards earned during the PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the reward." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of reward.", "paramEnum": [ + { "value": "supply", "description": null }, + { "value": "borrow", "description": null }, + { "value": "stake", "description": null }, + { "value": "reward", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol of the reward." }, + { "paramName": "name", "type": "string", "paramDescription": "[Required] Token name of the reward." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download icon of the token.", "childrenParamsType": "nullable" }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of reward tokens." }, + { "paramName": "price", "type": "number", "paramDescription": "[Required] Price of the reward token in USD." } + ] + } + ] +} +]; + +const USE_CASES = [ + "The user’s own funds are separated from rewards. This allows us to account for both Profit & Loss movements and rewards, while incoming transfers, top-ups, and withdrawals are not considered as sources of income or loss", + "Support blue chip tokens and DeFi positions across major EVM chains." +]; + +const CONSTRAINTS = [ + "The current version is limited to open DeFi positions, while the next update will support historical closed positions as well.", + "Requires valid chain and wallet address", + "Time range parameters affect response size", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getpnlhistory.tsx b/components/method-docs/wallet/WalletMethod_getpnlhistory.tsx new file mode 100644 index 00000000..a18e55c8 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getpnlhistory.tsx @@ -0,0 +1,587 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getpnlhistory() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/pnl-history" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "chain_id": "base", + "chain_name": "Base", + "chain_icon_url": "https://static.lambda.p2p.org/chains/base.png", + "category": "erc20", + "wallet_address": "0xdb6e9e7390e9acc34619e56efa48ade01cff6f12", + "position_id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "summary": { + "start": "2025-08-06T00:00:01+00:00", + "end": "2025-09-05T08:30:01+00:00", + "pnl_usd": 2822871.721936092, + "tokens": [ + { + "id": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "symbol": "superOETHb", + "name": "Super OETH", + "position_type": "supply", + "icon_url": "https://static.lambda.p2p.org/tokens/base/0xdbfefd2e8460a6ee4955a68582f85708baea60a3.png", + "defi_id": "erc20", + "defi_name": "Erc20", + "attributes": { + "address": "0xdbfefd2e8460a6ee4955a68582f85708baea60a3", + "decimals": 18, + "chain_id": "base", + "chain_name": "Base", + "chain_id_numeric": 8453 + }, + "start_balance": { + "balance": 2628.0887891055277, + "price": 3627.1475841511256 + }, + "end_balance": { + "balance": 4128.087289105528, + "price": 4310.9683282972 + } + } + ] + }, + "pnl_history": [ + { + "time": "2025-08-06T00:00:01+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + }, + { + "time": "2025-08-06T10:04:08+00:00", + "balance_usd": 9532465.902338771, + "reward_usd": 0, + "reward_usd_net": 0, + "pnl_usd": 0, + "profit_gains_usd": 0, + "token_amount": 2628.0887891055277 + } + ], + "user_activities": [ + { + "time": "2025-08-06T10:04:09+00:00", + "type": "deposit", + "symbol": "superOETHb", + "amount": 1499.9985000000001, + "value_usd": 5440715.935505313, + "transaction_hash": "0x8e7b341a70da11525d247928ee2894cd4b57ca7f8addf0d4a304c87d8588710f" + } + ], + "reward_history": [] + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Target chain", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; + +const QUERY_PARAMS: RequestParamProp = [ + { + "paramName": "category", + "type": "string", + "paramDescription": "[Required] The category of the PnL.", + "paramEnum": [ + { "value": "erc20", "description": "ERC-20 tokens" }, + { "value": "native", "description": "Native tokens" }, + { "value": "aave-v3-supply", "description": "AAVE V3 Lending" }, + { "value": "aave-v3-borrow", "description": "AAVE V3 Borrowing" }, + { "value": "uni-v2-supply", "description": "Uniswap V2" }, + { "value": "uni-v3-supply", "description": "Uniswap V3" }, + { "value": "sushi-v2-supply", "description": "SushiSwap V2" }, + { "value": "sushi-v3-supply", "description": "SushiSwap V3" }, + { "value": "lido", "description": "Lido" }, + { "value": "venus-supply", "description": "Venus Supply" }, + { "value": "venus-staking", "description": "Venus Staking" }, + { "value": "balancer-v2", "description": "Balancer V2" }, + { "value": "aura", "description": "Aura" }, + { "value": "morpho-vault", "description": "Morpho Vault" }, + { "value": "morpho-market-supply", "description": "Morpho Market Supply" }, + { "value": "morpho-market-borrow", "description": "Morpho Market Borrow" }, + { "value": "morpho-market-collateral", "description": "Morpho Market Collateral" }, + { "value": "renzo", "description": "Renzo" }, + { "value": "ether-fi", "description": "Ether.fi" }, + { "value": "sky", "description": "Sky" }, + { "value": "euler-vesting", "description": "Euler Vesting" }, + { "value": "euler-supply", "description": "Euler Supply" }, + { "value": "euler-borrow", "description": "Euler Borrow" }, + { "value": "pendle", "description": "Pendle" }, + { "value": "ethena-staking", "description": "Ethena Staking" }, + { "value": "ethena-locked", "description": "Ethena Locked" }, + { "value": "ethena-cooldown", "description": "Ethena Cooldown" }, + { "value": "gearbox", "description": "Gearbox" }, + { "value": "fluid", "description": "Fluid" }, + { "value": "kiln", "description": "Kiln" }, + { "value": "compound-v3-supply", "description": "Compound V3 CToken Supply" }, + { "value": "compound-v3-borrow", "description": "Compound V3 Lending Borrow" }, + { "value": "compound-v3-reward", "description": "Compound V3 COMP Rewards" }, + { "value": "compound-v3-collateral", "description": "Compound V3 Lending Collateral" } + ] + }, + { + paramName: "position_id", + type: "string", + paramDescription: "[Required] The position ID, which depends on the category", + paramEnum: [ + { + value: "Uniswap V3 / SushiSwap V3", + description: "{Pool Address}-{Numeric NFT position ID} (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b-123456)" + }, + { + value: "Uniswap V2 / SushiSwap V2", + description: "Pool address (hash) (e.g., 0xf6c4e4f339912541d3f8ed99dba64a1372af5e5b)" + }, + { + value: "Aave V3 / ERC-20", + description: "aToken/aDebtToken address (e.g., 0xefd6c64533602ac55ab64442307f6fe2c9307305)" + }, + { + value: "Morpho Vault", + description: "pool address (e.g., 0x0f359fd18bda75e9c49bc027e7da59a4b01bf32a)" + }, + { + value: "Morpho Market Supply/Borrow/Collateral", + description: "Market id bytes (e.g., 0x64d65c9a2d91c36d56fbc42d69e979335320169b3df63bf92789e2c8883fcc64)" + }, + { + value: "Lido", + description: "stETH/wstETH address (e.g., 0xae7ab96520de3a18e5e111b5eaab095312d7fe84)" + }, + { + value: "Venus Supply", + description: "vToken address (e.g., 0xc82780db1257c788f262fbbda960b3706dfdcaf2)" + }, + { + value: "Venus Staking", + description: "staking pool address (e.g., 0xa0882c2d5df29233a092d2887a258c2b90e9b994)" + }, + { + value: "Balancer V2", + description: "pool address (e.g., 0x1e19cf2d73a72ef1332c882f20534b6519be0276)" + }, + { + value: "Aura", + description: "pool address (e.g., 0xdd1fe5ad401d4777ce89959b7fa587e569bf125d)" + }, + { + value: "Renzo", + description: "ezETH, pzETH, ezREZ or ezEIGEN address (e.g., 0xdf6097a9e585E3d72556D19fA147562FfEf5D3C7)" + }, + { + value: "Ether.fi", + description: "eETH, weETH or vault address (e.g., 0x35fa164735182de50811e8e2e824cfb9b6118ac2)" + }, + { + value: "Sky", + description: "pool address (e.g., 0xa3931d71877c0e7a3148cb7eb4463524fec27fbd)" + }, + { + value: "Euler", + description: "pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)" + }, + { + value: "Euler Vesting", + description: "pool address (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696)" + }, + { + value: "Euler Supply", + description: "{eToken Address}-{subaccount index} (e.g., 0xf3e621395fc714b90da337aa9108771597b4e696-3)" + }, + { + value: "Euler Borrow", + description: "{eDebtToken Address}-{subaccount index} (e.g., 0x6200860bcdcb23d3b67a46769affeb91db2b175a-2)" + }, + { + value: "Pendle", + description: "(AMM, SY, YT, PT, STAKING) pool address (e.g., 0x6d98a2b6cdbf44939362a3e99793339ba2016af4)" + }, + { + value: "Gearbox", + description: "pool address, diselToken, dToken (e.g., 0xff94993fa7ea27efc943645f95adb36c1b81244b)" + }, + { + value: "Curve", + description: "pool address of curve_lp_token/gauge_address/veCRV/scrvUSD/vesting (e.g., 0xecd5e75afb02efa118af914515d6521aabd189f1)" + }, + { + value: "Curve Collateral", + description: "pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)" + }, + { + value: "Curve Borrow", + description: "pool address of curve llamalend lending (e.g., 0xeda215b7666936ded834f76f3fbc6f323295110a)" + }, + { + value: "Fluid", + description: "fToken address of fluid yield (e.g., 0x6a29a46e21c730dca1d8b23d637c101cec605c5b)" + }, + { + value: "Kiln", + description: "pool address of kiln (e.g., 0x2401c39d7ba9e283668a53fcc7b8f5fd9e716fdf)" + }, + { + value: "Compound V3 Supply", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 Lending Borrow", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 COMP Rewards", + description: "cToken address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3)" + }, + { + value: "Compound V3 Lending Collateral", + description: "cToken-collateral_token_address address (e.g., 0xc3d688b66703497daa19211eedff47f25384cdc3-0x2260fac5e5542a773aa44fbcfedf7c193bc2c599)" + } + ] +}, + { + "paramName": "start_timestamp", + "type": "integer", + "paramDescription": "≥ 0. The start timestamp in milliseconds. Default: now - 30 days." + }, + { + "paramName": "end_timestamp", + "type": "integer", + "paramDescription": "≥ 0. The end timestamp in milliseconds. Default: now." + }, + { + "paramName": "granularity", + "type": "string", + "paramDescription": "Granularity of PnL points. Defaults to day.", + "paramEnum": [ + { "value": "month", "description": null }, + { "value": "week", "description": null }, + { "value": "day", "description": null }, + { "value": "hour", "description": null }, + { "value": "five_minutes", "description": null }, + { "value": "any", "description": null } + ] + }, + { + "paramName": "points_limit", + "type": "integer", + "paramDescription": "2 to 100. The maximum number of points to return. Default: 100. Max: 100." + } +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + "paramName": "data", + "type": "array", + "paramDescription": "[Required] Returns historical records of Profit and Loss (PnL) over time.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "chain_id", + "type": "string", + "paramDescription": "[Required] id of the chain" + }, + { + "paramName": "chain_name", + "type": "string", + "paramDescription": "[Required] name of the chain" + }, + { + "paramName": "chain_icon_url", + "type": "string", + "paramDescription": "URL of the chain", + "childrenParamsType": "nullable" + }, + { + "paramName": "category", + "type": "string", + "paramDescription": "[Required] Category or DeFi id of the position.", + "paramEnum": [ + { "value": "erc20", "description": null }, + { "value": "native", "description": null }, + { "value": "aave-v3-supply", "description": null }, + { "value": "aave-v3-borrow", "description": null }, + { "value": "uni-v2-supply", "description": null }, + { "value": "uni-v3-supply", "description": null }, + { "value": "sushi-v2-supply", "description": null }, + { "value": "sushi-v3-supply", "description": null }, + { "value": "lido", "description": null }, + { "value": "venus-supply", "description": null }, + { "value": "venus-borrow", "description": null }, + { "value": "venus-staking", "description": null }, + { "value": "balancer-v2", "description": null }, + { "value": "aura", "description": null }, + { "value": "morpho-vault", "description": null }, + { "value": "morpho-market-supply", "description": null }, + { "value": "morpho-market-borrow", "description": null }, + { "value": "morpho-market-collateral", "description": null }, + { "value": "renzo", "description": null }, + { "value": "ether-fi", "description": null }, + { "value": "rocket", "description": null }, + { "value": "sky", "description": null }, + ] + }, + { + "paramName": "wallet_address", + "type": "string", + "paramDescription": "[Required] Wallet address of the position." + }, + { + "paramName": "position_id", + "type": "string", + "paramDescription": "[Required] Position id of the position." + }, + { + "paramName": "summary", + "type": "object", + "paramDescription": "[Required] Summary of the PnL and tokens.", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "start", + "type": "string", + "paramDescription": "Start timestamp of the summary period." + }, + { + "paramName": "end", + "type": "string", + "paramDescription": "End timestamp of the summary period." + }, + { + "paramName": "pnl_usd", + "type": "number", + "paramDescription": "Total PnL in USD." + }, + { + "paramName": "tokens", + "type": "array", + "paramDescription": "List of tokens in the position.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "id", "type": "string", "paramDescription": "Token ID." }, + { "paramName": "symbol", "type": "string", "paramDescription": "Token symbol." }, + { "paramName": "name", "type": "string", "paramDescription": "Token name." }, + { "paramName": "position_type", "type": "string", "paramDescription": "Type of position (e.g., supply, borrow)." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download token icon." }, + { "paramName": "defi_id", "type": "string", "paramDescription": "DeFi ID of the token." }, + { "paramName": "defi_name", "type": "string", "paramDescription": "Community name of DeFi." }, + { "paramName": "attributes", "type": "object", "paramDescription": "Token attributes.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "address", "type": "string", "paramDescription": "Token contract address." }, + { "paramName": "decimals", "type": "number", "paramDescription": "Token decimals." }, + { "paramName": "chain_id", "type": "string", "paramDescription": "Chain id." }, + { "paramName": "chain_name", "type": "string", "paramDescription": "Chain name." }, + { "paramName": "chain_id_numeric", "type": "number", "paramDescription": "Numeric chain id." } + ]}, + { "paramName": "start_balance", "type": "object", "paramDescription": "Starting token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at start." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at start in USD." } + ]}, + { "paramName": "end_balance", "type": "object", "paramDescription": "Ending token balance and price.", "childrenParamsType": "object", "childrenParams": [ + { "paramName": "balance", "type": "number", "paramDescription": "Balance at end." }, + { "paramName": "price", "type": "number", "paramDescription": "Token price at end in USD." } + ]} + ] + } + ] + }, + { + "paramName": "pnl_history", + "type": "array", + "paramDescription": "[Required] List of asset changes over time.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the PnL entry." }, + { "paramName": "balance_usd", "type": "number", "paramDescription": "[Required] Position balance in USD at the given timestamp." }, + { "paramName": "reward_usd", "type": "number", "paramDescription": "[Required] Rewards earned in tokens converted to USD (current price)." }, + { "paramName": "reward_usd_net", "type": "number", "paramDescription": "[Required] Rewards in tokens converted using latest price." }, + { "paramName": "pnl_usd", "type": "number", "paramDescription": "[Required] Total change in portfolio value compared to initial state." }, + { "paramName": "profit_gains_usd", "type": "number", "paramDescription": "[Required] Net change in token balance adjusted for price fluctuations." }, + { "paramName": "token_amount", "type": "number", "paramDescription": "[Required] Amount of tokens in the position." } + ] + }, + { + "paramName": "user_activities", + "type": "array", + "paramDescription": "[Required] Withdrawal/Deposits in scope of PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the user activity." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of user activity.", "paramEnum": [ + { "value": "deposit", "description": null }, + { "value": "withdraw", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol affected." }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of tokens changed." }, + { "paramName": "value_usd", "type": "number", "paramDescription": "[Required] Value of the token in USD." }, + { "paramName": "transaction_hash", "type": "string", "paramDescription": "[Required] Transaction hash of the activity." } + ] + }, + { + "paramName": "reward_history", + "type": "array", + "paramDescription": "[Required] List of rewards earned during the PnL interval.", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "time", "type": "string", "paramDescription": "[Required] Timestamp of the reward." }, + { "paramName": "type", "type": "string", "paramDescription": "[Required] Type of reward.", "paramEnum": [ + { "value": "supply", "description": null }, + { "value": "borrow", "description": null }, + { "value": "stake", "description": null }, + { "value": "reward", "description": null } + ]}, + { "paramName": "symbol", "type": "string", "paramDescription": "[Required] Token symbol of the reward." }, + { "paramName": "name", "type": "string", "paramDescription": "[Required] Token name of the reward." }, + { "paramName": "icon_url", "type": "string", "paramDescription": "URL to download icon of the token.", "childrenParamsType": "nullable" }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Amount of reward tokens." }, + { "paramName": "price", "type": "number", "paramDescription": "[Required] Price of the reward token in USD." } + ] + } + ] +} +]; + +const USE_CASES = [ + "The user’s own funds are separated from rewards. This allows us to account for both Profit & Loss movements and rewards, while incoming transfers, top-ups, and withdrawals are not considered as sources of income or loss", + "Support blue chip tokens and DeFi positions across major EVM chains." +]; + +const CONSTRAINTS = [ + "The current version is limited to open DeFi positions, while the next update will support historical closed positions as well.", + "Requires valid chain and wallet address", + "Time range parameters affect response size", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getsupportedchainbyid.tsx b/components/method-docs/wallet/WalletMethod_getsupportedchainbyid.tsx new file mode 100644 index 00000000..671bcfcb --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getsupportedchainbyid.tsx @@ -0,0 +1,190 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getsupportedchainbyid() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id} \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id}", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id}") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/chains/{chain_id}" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "type": "chain", + "id": "arbitrum", + "id_numeric": 42161, + "name": "Arbitrum", + "native_token_id": "eth" + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] Chain ID in Wallet API", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = null; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] Chain data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Item type", + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] Chain ID in Wallet API", + }, + { + paramName: "id_numeric", + type: "integer", + paramDescription: "Numeric chain ID", + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] Chain name", + }, + { + paramName: "native_token_id", + type: "string", + paramDescription: "[Required] Native token identifier", + }, + ], + }, +]; + +const USE_CASES = [ + "Retrieve detailed information about a specific blockchain network", + "Validate a chain before sending requests to it", +]; + +const CONSTRAINTS = [ + "Requires a valid chain_id parameter", + "Returns data only for chains currently supported", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getsupportedchains.tsx b/components/method-docs/wallet/WalletMethod_getsupportedchains.tsx new file mode 100644 index 00000000..f705733d --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getsupportedchains.tsx @@ -0,0 +1,229 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getsupportedchains() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/lambda/{key}/v1/chains \\ + --header 'accept: application/json'`, +}, +{ + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/chains", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, +}, +{ + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/chains", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, +}, +{ + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/lambda/{key}/v1/chains", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, +}, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/lambda/{key}/v1/chains") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, +{ + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/chains" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, +} +]; + +const RESPONSE_JSON = `{ + "next_page_token": "arbitrum", + "data": { + "chains": [ + { + "type": "chain", + "id": "arbitrum", + "id_numeric": 42161, + "name": "Arbitrum", + "native_token_id": "eth" + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: + "[Required] Your dRPC API key", + }, + ]; + + +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "page_token", + type: "string", + paramDescription: + "Token to retrieve next page.", + }, + { + paramName: "limit", + type: "integer", + paramDescription: + "[Required] Amount of items to be retrieved.", + }, +]; +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "next_page_token", + type: "string", + paramDescription: "Token to retrieve next page.", + }, + + { + paramName: "data", + type: "object", + paramDescription: + "[Required] Chains data", + childrenParamsType: "array_of_objects", + childrenParams: [ + { + paramName: "chains", + type: "array_of_objects", + paramDescription: + "[Required] list of supported chains", + childrenParamsType: "object", + childrenParams: [ + + { + paramName: "type", + type: "string", + paramDescription: + "[Required] Item type", + }, + { + paramName: "id", + type: "string", + paramDescription: + "[Required] id of a chain in Wallet API", + }, + { + paramName: "id_numeric", + type: "integer", + paramDescription: "Numeric id of the chain", + }, + { + paramName: "name", + type: "string", + paramDescription: + "[Required] Community name of the chain", + }, + { + paramName: "native_token_id", + type: "string", + paramDescription: + "[Required] token_id of a chain native currency in Wallet API", + }, + + ], + }, + ], + }, +]; + +const USE_CASES = [ + "Retrieve the list of all supported blockchain networks", + "Check if a specific chain is supported before making requests", +]; + +const CONSTRAINTS = [ + "The response reflects only currently supported chains", + "No filtering parameters are supported", +]; diff --git a/components/method-docs/wallet/WalletMethod_getsupportedpricesymbols.tsx b/components/method-docs/wallet/WalletMethod_getsupportedpricesymbols.tsx new file mode 100644 index 00000000..073ac2f8 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getsupportedpricesymbols.tsx @@ -0,0 +1,153 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getsupportedpricesymbols() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/tokens/prices/supported" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + "string" + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array_of_strings", + paramDescription: "[Required] List of supported token symbols for pricing", + }, +]; + +const USE_CASES = [ + "Retrieve all tokens supported for price queries", + "Validate token symbol availability before fetching price data", +]; + +const CONSTRAINTS = [ + "Only currently supported tokens are returned", + "Token list may change over time", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getsupportedtokens.tsx b/components/method-docs/wallet/WalletMethod_getsupportedtokens.tsx new file mode 100644 index 00000000..dd185244 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getsupportedtokens.tsx @@ -0,0 +1,274 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp, +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getsupportedtokens() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/tokens" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "next_page_token": "1", + "data": { + "tokens": [ + { + "type": "token", + "id": "8de20069-4b73-4752-90f1-a5633ae4cbe9", + "symbol": "U", + "name": "Uranium3o8", + "icon_url": "https://static.lambda.p2p.org/tokens/arbitrum/0x6604b5da093f3f35066c6c79e51d581a44c35288.png", + "implementations": [ + { + "chain_id": "arbitrum", + "chain_name": "Arbitrum", + "chain_id_numeric": 42161, + "address": "0x6604b5da093f3f35066c6c79e51d581a44c35288", + "decimals": 18 + }, + { + "chain_id": "ethereum", + "chain_name": "Ethereum", + "chain_id_numeric": 1, + "address": "0x8cc379a292a47cb8406fb1bd8a6d98f442275f0e", + "decimals": 18 + } + ] + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "chain", + type: "string", + paramDescription: "Chain name (only for per-chain URL).", + }, +]; + +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "page_token", + type: "string", + paramDescription: "Token to retrieve next page.", + }, + { + paramName: "limit", + type: "integer", + paramDescription: "[Required] Amount of items to be retrieved.", + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "Id of a chain. default: all chains", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "next_page_token", + type: "string", + paramDescription: "Token to retrieve next page.", + }, + { + paramName: "data", + type: "object", + paramDescription: "[Required] Chain data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Item type", + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] Chain ID in Wallet API", + }, + { + paramName: "symbol", + type: "string", + paramDescription: "[Required] Symbol of the token", + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] Token name", + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token.", + }, + { + paramName: "implementations", + type: "array", + paramDescription: + "[Required] List of chains where tokens are implemented.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] id of a chain in Lambda API", + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] name of a chain in Lambda API", + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric id of the chain", + }, + { + paramName: "address", + type: "string", + paramDescription: + "[Required] Token contract address in related chain", + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Decimals", + }, + ], + }, + ], + }, +]; + +const USE_CASES = [ + "Retrieve the list of all supported tokens", + "Check if a specific token is supported", +]; + +const CONSTRAINTS = [ + "The response reflects only currently supported tokens and may change over time", + "No filtering parameters are supported", +]; diff --git a/components/method-docs/wallet/WalletMethod_gettokeninfobyid.tsx b/components/method-docs/wallet/WalletMethod_gettokeninfobyid.tsx new file mode 100644 index 00000000..a843b35a --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_gettokeninfobyid.tsx @@ -0,0 +1,239 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_gettokeninfobyid() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url GET https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id} \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id}", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id}", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id}") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/tokens/{token_id}" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "type": "token", + "id": "8de20069-4b73-4752-90f1-a5633ae4cbe9", + "symbol": "U", + "name": "Uranium3o8", + "icon_url": "https://static.lambda.p2p.org/tokens/arbitrum/0x6604b5da093f3f35066c6c79e51d581a44c35288.png", + "implementations": [ + { + "chain_id": "arbitrum", + "chain_name": "Arbitrum", + "chain_id_numeric": 42161, + "address": "0x6604b5da093f3f35066c6c79e51d581a44c35288", + "decimals": 18 + }, + { + "chain_id": "ethereum", + "chain_name": "Ethereum", + "chain_id_numeric": 1, + "address": "0x8cc379a292a47cb8406fb1bd8a6d98f442275f0e", + "decimals": 18 + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] Token ID in Wallet API", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = null; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "object", + paramDescription: "[Required] Chain data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Item type", + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] Chain ID in Wallet API", + }, + { + paramName: "symbol", + type: "string", + paramDescription: "[Required] Symbol of the token", + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] Token name", + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "URL to download icon of the token.", + }, + { + paramName: "implementations", + type: "array", + paramDescription: "[Required] List of chains where tokens are implemented.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] id of a chain in Lambda API" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] name of a chain in Lambda API" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric id of the chain" + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Token contract address in related chain" + }, + { + paramName: "decimals", + type: "integer", + paramDescription: "[Required] Decimals" + } + ] +} + ], + }, +]; + +const USE_CASES = [ + "Retrieve detailed information about a specific token", + "Validate a token", +]; + +const CONSTRAINTS = [ + "Requires a valid token_id parameter", + "Returns data only for tokens currently supported", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_gettransactionshistory.tsx b/components/method-docs/wallet/WalletMethod_gettransactionshistory.tsx new file mode 100644 index 00000000..7e2c4d76 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_gettransactionshistory.tsx @@ -0,0 +1,523 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_gettransactionshistory() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/transactions/{address}/history" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "next_page_token": "6de32230-8b88-4637-8cf2-28c1eefe2a24", + "data": [ + { + "type": "receive", + "hash": "0x59fd7afbc5d33628e60cfdb0b735da073bac28c046a808dbcc795edd7598b362", + "block": 19071142, + "timestamp": 1706034371000, + "sender_address": "0x710bda329b2a6224e4b44833de30f38e7f81d564", + "recipient_address": "0xb8901acb165ed027e32754e0ffe830802919727f", + "status": "confirmed", + "nonce": 569460, + "chain_id": "ethereum", + "chain_name": "Ethereum", + "chain_id_numeric": 1, + "defi": { + "address": "0xb8901acb165ed027e32754e0ffe830802919727f", + "name": "Hop Protocol" + }, + "fee": { + "token_name": "Ethereum", + "token_symbol": "ETH", + "token_address": "", + "token_price": 2211.06, + "token_decimals": 18, + "token_amount_string": "1799324179642211", + "token_amount": 0.0017993241796422, + "value_usd": 3.9784137206396823 + }, + "transfers": [ + { + "direction": "in", + "sender_address": "0xb8901acb165ed027e32754e0ffe830802919727f", + "recipient_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "token": { + "name": "Ethereum", + "symbol": "ETH", + "address": "" + }, + "price": 2211.06, + "decimals": 18, + "amount_string": "7097893158465857", + "amount": 0.0070978931584659, + "value_usd": 15.693867646957614 + } + ], + "approvals": [], + "attributes": { + "is_trash": false + } + }, + { + "type": "deposit", + "hash": "0x11cd26d074a3965efca1de31d3b9e62f4776b6a89705e8b2fa7331cad5a95295", + "block": 21134441, + "timestamp": 1730966411000, + "sender_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "recipient_address": "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", + "status": "confirmed", + "nonce": 3, + "chain_id": "ethereum", + "chain_name": "Ethereum", + "chain_id_numeric": 1, + "defi": { + "address": "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", + "name": "SushiSwap" + }, + "fee": { + "token_name": "Ethereum", + "token_symbol": "ETH", + "token_address": "", + "token_price": 2820.19, + "token_decimals": 18, + "token_amount_string": "2021915715800139", + "token_amount": 0.0020219157158001, + "value_usd": 5.7021864825422846 + }, + "transfers": [ + { + "direction": "in", + "sender_address": "0x0000000000000000000000000000000000000000", + "recipient_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "token": { + "name": "Sushi ETH/USDT Pool", + "symbol": "SLP", + "address": "0x06da0fd433c1a5d7a4faa01111c044910a184553" + }, + "decimals": 18, + "amount_string": "29804362001", + "amount": 2.9804362e-8 + }, + { + "direction": "out", + "sender_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "recipient_address": "0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f", + "token": { + "name": "Ethereum", + "symbol": "ETH", + "address": "" + }, + "price": 2820.19, + "decimals": 18, + "amount_string": "1024937862292196", + "amount": 0.0010249378622922, + "value_usd": 2.8905195098578393 + }, + { + "direction": "out", + "sender_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "recipient_address": "0x06da0fd433c1a5d7a4faa01111c044910a184553", + "token": { + "name": "Tether USD", + "symbol": "USDT", + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xdac17f958d2ee523a2206206994597c13d831ec7.png", + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7" + }, + "price": 1.0000111721, + "decimals": 6, + "amount_string": "2886491", + "amount": 2.886491, + "value_usd": 2.886523248166101 + } + ], + "approvals": [], + "attributes": { + "is_trash": false + } + }, + { + "type": "approve", + "hash": "0x5c77c6b56e6a6cca04a52624a1a0d03553a9d238f50124aa328fe783f0c39b65", + "block": 21864339, + "timestamp": 1739774003000, + "sender_address": "0xbed2bd7e0e7c593db6c32654e28f6a8b90f9288a", + "recipient_address": "0xdac17f958d2ee523a2206206994597c13d831ec7", + "status": "confirmed", + "nonce": 7, + "chain_id": "ethereum", + "chain_name": "Ethereum", + "chain_id_numeric": 1, + "defi": { + "address": "0x8bb4c975ff3c250e0ceea271728547f3802b36fd" + }, + "fee": { + "token_name": "Ethereum", + "token_symbol": "ETH", + "token_address": "", + "token_price": 2681.96, + "token_decimals": 18, + "token_amount_string": "59240015634219", + "token_amount": 0.0000592400156342, + "value_usd": 0.15887935233029904 + }, + "transfers": [], + "approvals": [ + { + "token": { + "name": "Tether USD", + "symbol": "USDT", + "icon_url": "https://static.lambda.p2p.org/tokens/eth/0xdac17f958d2ee523a2206206994597c13d831ec7.png", + "address": "0xdac17f958d2ee523a2206206994597c13d831ec7" + }, + "amount": 24, + "sender_address": "0x8bb4c975ff3c250e0ceea271728547f3802b36fd" + } + ], + "attributes": { + "is_trash": false + } + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "Target chain (per chain requests only)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; + +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "chain_ids", + type: "array", + paramDescription: "Id of chains in Wallet API. default: all chains", + }, + { + paramName: "start", + type: "integer", + paramDescription: "Start timestamp in millis", + }, + { + paramName: "end", + type: "integer", + paramDescription: "End timestamp in millis", + }, + { + paramName: "limit", + type: "integer", + paramDescription: "Number transactions to return. Default is 100", + }, + { + paramName: "page_token", + type: "string", + paramDescription: "Token to retrieve next page.", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + "paramName": "next_page_token", + "type": "string", + "paramDescription": "Token to retrieve next page." + }, + { + "paramName": "data", + "type": "array", + "paramDescription": "[Required] Tokens data", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "type", + "type": "string", + "paramDescription": "[Required] Transaction type", + "paramEnum": [ + { "value": "receive", "description": null }, + { "value": "deposit", "description": null }, + { "value": "approve", "description": null }, + { "value": "swap", "description": null }, + { "value": "send", "description": null }, + { "value": "burn", "description": null }, + { "value": "deploy", "description": null } , + { "value": "execute", "description": null } + ] + }, + { + "paramName": "hash", + "type": "string", + "paramDescription": "[Required] Transaction hash" + }, + { + "paramName": "block", + "type": "integer", + "paramDescription": "[Required] Block number" + }, + { + "paramName": "timestamp", + "type": "integer", + "paramDescription": "[Required] Timestamp" + }, + { + "paramName": "sender_address", + "type": "string", + "paramDescription": "[Required] Sender address" + }, + { + "paramName": "recipient_address", + "type": "string", + "paramDescription": "[Required] Recipient address" + }, + { + "paramName": "status", + "type": "string", + "paramDescription": "[Required] Transaction status" + }, + { + "paramName": "nonce", + "type": "integer", + "paramDescription": "[Required] Transaction nonce" + }, + { + "paramName": "chain_id", + "type": "string", + "paramDescription": "[Required] id of a chain in Lambda API" + }, + { + "paramName": "chain_name", + "type": "string", + "paramDescription": "[Required] name of a chain in Lambda API" + }, + { + "paramName": "chain_id_numeric", + "type": "integer", + "paramDescription": "Numeric id of the chain" + }, + { + "paramName": "chain_icon_url", + "type": "string", + "paramDescription": "URL to download icon of the chain." + }, + { + "paramName": "defi", + "type": "object", + "paramDescription": "Defi application", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "address", "type": "string", "paramDescription": "Defi address" }, + { "paramName": "name", "type": "string", "paramDescription": "Defi name" } + ] + }, + { + "paramName": "fee", + "type": "object", + "paramDescription": "Transaction fee", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "token_name", "type": "string", "paramDescription": "Token name" }, + { "paramName": "token_symbol", "type": "string", "paramDescription": "Token symbol" }, + { "paramName": "token_address", "type": "string", "paramDescription": "Token address" }, + { "paramName": "token_price", "type": "number", "paramDescription": "Token price" }, + { "paramName": "token_decimals", "type": "integer", "paramDescription": "Token decimals" }, + { "paramName": "token_amount_string", "type": "string", "paramDescription": "Token amount without decimals" }, + { "paramName": "token_amount", "type": "number", "paramDescription": "Token amount" }, + { "paramName": "value_usd", "type": "number", "paramDescription": "Value USD" } + ] + }, + { + "paramName": "transfers", + "type": "array", + "paramDescription": "[Required] Transaction transfers", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "direction", "type": "string", "paramDescription": "[Required] Direction of transaction" }, + { "paramName": "sender_address", "type": "string", "paramDescription": "[Required] Sender address" }, + { "paramName": "recipient_address", "type": "string", "paramDescription": "[Required] Recipient address" }, + { + "paramName": "token", + "type": "object", + "paramDescription": "Token", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "name", "type": "string", "paramDescription": "Token name" }, + { "paramName": "symbol", "type": "string", "paramDescription": "Token symbol" }, + { "paramName": "address", "type": "string", "paramDescription": "Token address" }, + { "paramName": "icon_url", "type": "string", "paramDescription": "Token icon URL" } + ] + }, + { "paramName": "nft", "type": "nft_info", "paramDescription": "Nft" }, + { "paramName": "price", "type": "number", "paramDescription": "Token price" }, + { "paramName": "decimals", "type": "integer", "paramDescription": "Token decimals" }, + { "paramName": "amount_string", "type": "string", "paramDescription": "[Required] Token Amount without decimals" }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Token Amount" }, + { "paramName": "value_usd", "type": "number", "paramDescription": "Value USD" } + ] + }, + { + "paramName": "approvals", + "type": "array", + "paramDescription": "[Required] Transaction approvals", + "childrenParamsType": "object", + "childrenParams": [ + { + "paramName": "token", + "type": "object", + "paramDescription": "Token", + "childrenParamsType": "object", + "childrenParams": [ + { "paramName": "name", "type": "string", "paramDescription": "Token name" }, + { "paramName": "symbol", "type": "string", "paramDescription": "Token symbol" }, + { "paramName": "address", "type": "string", "paramDescription": "Token address" }, + { "paramName": "icon_url", "type": "string", "paramDescription": "Token icon URL" } + ] + }, + { "paramName": "nft", "type": "nft_info", "paramDescription": "nft" }, + { "paramName": "amount", "type": "number", "paramDescription": "[Required] Token Amount" }, + { "paramName": "sender_address", "type": "string", "paramDescription": "[Required] Sender address" } + ] + }, + { + "paramName": "attributes", + "type": "object", + "paramDescription": "[Required] Transaction attributes", + childrenParamsType: "boolean", + childrenParams: [ + { "paramName": "is_trash", "type": "boolean", "paramDescription": "Is trash" }, + ] , + } + ] + } +]; + +const USE_CASES = [ + "Retrieve full transaction history for a wallet", + "Track incoming and outgoing transfers", +]; + +const CONSTRAINTS = [ + "Requires valid chain and wallet address", + "Pagination is required for large transaction histories", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getwalletnfts.tsx b/components/method-docs/wallet/WalletMethod_getwalletnfts.tsx new file mode 100644 index 00000000..4e1a96a5 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getwalletnfts.tsx @@ -0,0 +1,429 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getwalletnfts() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request GET \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts", { + method: "GET", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts", { + method: "GET", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("GET", "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .get("https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/wallets/{address}/nfts" +headers = { + "accept": "application/json" +} + +response = requests.get(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "type": "nft", + "id": "0xe7b9d5a2b01b23985356f521e0f5016eec201234:ethereum:0x9690b63eb85467be5267a3603f770589ab12dc95:15060", + "chain_id": "ethereum", + "chain_id_numeric": 1, + "chain_name": "Ethereum", + "amount": 1, + "price": 79.667354, + "value_usd": 79.667354, + "attributes": { + "token_id": "15060", + "contract_address": "0x9690b63eb85467be5267a3603f770589ab12dc95", + "name": "Leila Lacerator of the Rune Raiders", + "interface": "ERC721", + "image_url": "https://lh3.googleusercontent.com/1YGMrTrpMkI9Ch7ZvDxkGzCyuUznBESmWwmSuHxSZx3iqczOEi1MZE9lXrC-xYVrq5mFnu8y9WB5MZSbacKvcms-tXOtfg_-ow=s250", + "collection": { + "id": "2695", + "name": "Forgotten Runes Warriors Guild", + "description": "Forgotten Runes Warriors Guild\\r\\n\\r\\n[Sister Collections](https://opensea.io/collection/forgottenrunes)", + "icon_url": "https://lh3.googleusercontent.com/8uCBJ-m9No4zAPWuuvRz-2uxZ3uBt9HfYO0wUj_v-zLHvTAr9W2rpNGRRkTPyNfn8Q1HMvSvQEtlD22RVoWkn20E1_O-Mj9BBw", + "banner_url": "https://lh3.googleusercontent.com/kjbHmiQhpsYIPy5RFdST8XNYIwg-5WTtWUGavhfaF_lXEzrMKtC_-nrdUrUt9cuejuOMv-CW5klEzqDPivHD5o6L6hSKEhUn_k8=w2500" + } + } + }, + { + "type": "nft", + "id": "0xe7b9d5a2b01b23985356f521e0f5016eec201234:polygon:0x98e62fe371519d1d07e6f5bfce04737d4dacabfd:1", + "chain_id": "polygon", + "chain_id_numeric": 137, + "chain_name": "Polygon", + "amount": 5, + "price": 6.660082750547, + "value_usd": 33.300413752735, + "attributes": { + "token_id": "1", + "contract_address": "0x98e62fe371519d1d07e6f5bfce04737d4dacabfd", + "name": "Holiday Lootbox (1st Edition)", + "interface": "ERC1155", + "image_url": "https://lh3.googleusercontent.com/1YGMrTrpMkI9Ch7ZvDxkGzCyuUznBESmWwmSuHxSZx3iqczOEi1MZE9lXrC-xYVrq5mFnu8y9WB5MZSbacKvcms-tXOtfg_-ow=s250", + "collection": { + "id": "308732", + "name": "NFT Worlds Items", + "description": "The official items collection for NFT Worlds. \\r\\n\\r\\nItems and lootboxes within this collection are exclusively created by the NFT Worlds team.", + "icon_url": "https://lh3.googleusercontent.com/cdYxiSmSB7iLLl8zMAX7PaTtq5NsAkJz2TFkn9aJATR8rjuCczf2JucdEyXmlLLDJxMxbSkLAAkfLSxR25mXaDoAF3QW3MORuOAN", + "banner_url": "https://lh3.googleusercontent.com/hUFM5Je9hUAuLHOuEJ6ake5sVoVe0mX8HyGA1uaSBQIza2l7Tc9DgqMm4nK6JfR47FV6RSZvN0QzMTZFt4TTzL2qH21F0hSrWA=w2500" + } + } + } + ], + "next_page_token": "IjIi" +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g. ethereum, polygon)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; + +const QUERY_PARAMS: RequestParamProp = [ + { + paramName: "chain_ids", + type: "array", + paramDescription: "IDs of chains (using Lambda API names) that support NFTs. Default: all supported chains. Max length: 19.", + childrenParamsType: "string" + }, + { + paramName: "collection_ids", + type: "array", + paramDescription: "IDs of collections. Default: all collections.", + childrenParamsType: "integer" + }, + { + paramName: "with_meta_data", + type: "boolean", + paramDescription: "Whether to include metadata enrichment. Default: false." + }, + { + paramName: "refresh_cache", + type: "boolean", + paramDescription: "Force-refresh metadata cache. Default: false." + }, + { + paramName: "page_token", + type: "string", + paramDescription: "Token to retrieve the next page." + }, + { + paramName: "limit", + type: "integer", + paramDescription: "[Required] ≤ 100. Number of NFTs to retrieve." + } +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array", + paramDescription: "[Required] NFT data", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "type", + type: "string", + paramDescription: "[Required] Type of the entity" + }, + { + paramName: "id", + type: "string", + paramDescription: "[Required] ID of the entity" + }, + { + paramName: "chain_id", + type: "string", + paramDescription: "[Required] ID of the chain" + }, + { + paramName: "chain_id_numeric", + type: "integer", + paramDescription: "Numeric ID of the chain" + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Name of the chain" + }, + { + paramName: "amount", + type: "number", + paramDescription: "[Required] Amount of tokens" + }, + { + paramName: "price", + type: "number", + paramDescription: "Price of the token" + }, + { + paramName: "value_usd", + type: "number", + paramDescription: "Value of the token in USD" + }, + { + paramName: "attributes", + type: "object", + paramDescription: "[Required] NFT details", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "token_id", + type: "string", + paramDescription: "[Required] ID of the token" + }, + { + paramName: "contract_address", + type: "string", + paramDescription: "[Required] NFT address" + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] NFT name" + }, + { + paramName: "interface", + type: "string", + paramDescription: "[Required] NFT interface" + }, + { + paramName: "image_url", + type: "string", + paramDescription: "[Required] URL of image content, if any" + }, + { + paramName: "preview_url", + type: "string", + paramDescription: "[Required] URL of preview image content, if any" + }, + { + paramName: "video_url", + type: "string", + paramDescription: "[Required] URL of video content, if any" + }, + { + paramName: "audio_url", + type: "string", + paramDescription: "[Required] URL of audio content, if any" + }, + { + paramName: "last_update_time", + type: "string", + paramDescription: "Time of the last NFT update" + }, + { + paramName: "collection", + type: "object", + paramDescription: "[Required] NFT collection info", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "id", + type: "string", + paramDescription: "[Required] NFT collection ID" + }, + { + paramName: "name", + type: "string", + paramDescription: "[Required] NFT collection name" + }, + { + paramName: "description", + type: "string", + paramDescription: "[Required] NFT collection description" + }, + { + paramName: "icon_url", + type: "string", + paramDescription: "NFT collection icon URL, if any" + }, + { + paramName: "banner_url", + type: "string", + paramDescription: "NFT collection banner URL, if any" + }, + { + paramName: "number_of_assets", + type: "integer", + paramDescription: "Total number of NFTs in the collection, if known" + }, + { + paramName: "number_of_owners", + type: "integer", + paramDescription: "Number of unique owners in the collection, if known" + }, + { + paramName: "marketplace_urls", + type: "array", + paramDescription: "Marketplace URLs for the collection, if any" + } + ] +}, + { + paramName: "marketplace_urls", + type: "array", + paramDescription: "Marketplace URLs for the NFT" + } + + ] +}, + { + paramName: "traits", + type: "object", + paramDescription: "NFT traits dictionary" + }, + { + paramName: "owner_address", + type: "string", + paramDescription: "Address of the NFT owner" + }, + { + paramName: "creator_address", + type: "string", + paramDescription: "Address of the NFT creator" + }, + { + paramName: "spam", + type: "object", + paramDescription: "Spam classification result" + }, + { + paramName: "raw_metadata", + type: "object", + paramDescription: "Raw metadata as returned by the NFT's tokenURI" + }, + + ] + +}, +{ + paramName: "next_page_token", + type: "string", + paramDescription: "Token to retrieve next page" +} + +]; + +const USE_CASES = [ + "Display NFTs owned by a wallet", + "Build NFT portfolio dashboards", +]; + +const CONSTRAINTS = [ + "Requires valid wallet address", + "Only NFTs on supported chains are returned", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_getyieldrecommendations.tsx b/components/method-docs/wallet/WalletMethod_getyieldrecommendations.tsx new file mode 100644 index 00000000..0f49f047 --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_getyieldrecommendations.tsx @@ -0,0 +1,359 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_getyieldrecommendations() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations \\ + --header 'accept: application/json' \\ + --header 'content-type: application/json' \\ + `, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations", { + method: "POST", + headers: { + "accept": "application/json", + "content-type": "application/json" + }, + + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations", { + method: "POST", + headers: { + "accept": "application/json", + "content-type": "application/json" + }, + +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "bytes" + "fmt" + "io" + "net/http" +) + +func main() { + + req, _ := http.NewRequest("POST", "https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations", bytes.NewBuffer(payload)) + req.Header.Set("accept", "application/json") + req.Header.Set("content-type", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::{ACCEPT, CONTENT_TYPE}; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations") + .header(ACCEPT, "application/json") + .header(CONTENT_TYPE, "application/json") + + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/lambda/{key}/v1/wallets/{address}/recommendations" +headers = { + "accept": "application/json", + "content-type": "application/json" +} + +response = requests.post(url, json=payload, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": [ + { + "asset": "string", + "protocol": "string", + "chain_name": "string", + "interval": 0, + "amount_lost_usd": 0, + "recommendation": [ + { + "protocol": "Aave", + "protocol_url": "https://app.aave.com", + "protocol_icon_url": "https://static.lambda.p2p.org/protocols/aave-pool-v3.png", + "expected_apr": 0.05 + }, + { + "protocol": "Morpho", + "protocol_url": "https://app.morpho.org/ethereum/earn", + "protocol_icon_url": "https://static.lambda.p2p.org/protocols/morpho-blue.png", + "expected_apr": 0.04 + } + ], + "details": [ + { + "start": "2025-03-01T00:00:00Z", + "end": "2025-03-08T00:00:00Z", + "usd_from": 11, + "usd_to": 11.3, + "rewards_usd": 0.3, + "recommendation": [ + { + "protocol": "AAVE V3", + "usd_to": 11.5, + "potential_rewards_usd": 0.5 + }, + { + "protocol": "MORPHO", + "usd_to": 11.4, + "potential_rewards_usd": 0.4 + } + ] + } + ] + } + ] +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "address", + type: "string", + paramDescription: "[Required] Wallet address", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = [ + { + paramName: "period", + type: "networth_period", + paramDescription: "Period of time", + }, + { + paramName: "vaults", + type: "array", + paramDescription: "Vaults filter that will be used to calculate recommendations. Default: none", + }, + { + paramName: "granularity", + type: "string", + paramDescription: "Granularity. Default: day.", + paramEnum: [ + {value: "month", description: null }, + { value: "week", description: null }, + { value: "day", description: null }, + { value: "hour", description: null }, + { value: "five_minutes", description: null }, + { value: "any", description: null } + ] + }, +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array", + paramDescription: "[Required] List of yield optimization opportunities.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "asset", + type: "string", + paramDescription: "[Required] Token symbol being analyzed." + }, + { + paramName: "protocol", + type: "string", + paramDescription: "[Required] Current protocol holding the asset." + }, + { + paramName: "chain_name", + type: "string", + paramDescription: "[Required] Chain name." + }, + { + paramName: "interval", + type: "integer", + paramDescription: "[Required] Length of the interval in milliseconds." + }, + { + paramName: "amount_lost_usd", + type: "number", + paramDescription: "[Required] Total unrealized reward difference." + }, + { + paramName: "recommendation", + type: "array", + paramDescription: "[Required] List of alternate protocols and APRs that could have been more profitable.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "protocol", + type: "string", + paramDescription: "[Required] Protocol name being recommended." + }, + { + paramName: "protocol_url", + type: "string", + paramDescription: "Link to the recommended protocol's website." + }, + { + paramName: "protocol_icon_url", + type: "string", + paramDescription: "Link to the protocol's icon." + }, + { + paramName: "vault", + type: "string", + paramDescription: "Vault of the protocol." + }, + { + paramName: "expected_apr", + type: "number", + paramDescription: "[Required] Expected annual percentage rate (APR) for this protocol." + } + ] + }, + { + paramName: "details", + type: "array", + paramDescription: "[Required] Detailed interval-level performance and per-protocol simulations.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "start", + type: "string", + paramDescription: "[Required] Start of the interval in ISO 8601 format." + }, + { + paramName: "end", + type: "string", + paramDescription: "[Required] End of the interval in ISO 8601 format." + }, + { + paramName: "usd_from", + type: "number", + paramDescription: "[Required] USD value at the start of the interval." + }, + { + paramName: "usd_to", + type: "number", + paramDescription: "[Required] USD value at the end of the interval." + }, + { + paramName: "rewards_usd", + type: "number", + paramDescription: "[Required] Actual rewards earned." + }, + { + paramName: "recommendation", + type: "array", + paramDescription: "[Required] Per-protocol simulated results for the same time range.", + childrenParamsType: "object", + childrenParams: [ + { + paramName: "protocol", + type: "string", + paramDescription: "[Required] Name of the protocol used for the simulation." + }, + { + paramName: "usd_to", + type: "number", + paramDescription: "[Required] Simulated future value in USD if funds were moved to this protocol." + }, + { + paramName: "vault", + type: "string", + paramDescription: "Vault of the protocol." + }, + { + paramName: "potential_rewards_usd", + type: "number", + paramDescription: "[Required] Difference between simulated and actual rewards in USD over the interval." + } + ] + } + ] + } + ] +} +]; + +const USE_CASES = [ + "Discover yield opportunities for wallet assets", + "Optimize portfolio allocation for higher returns", + "Build DeFi recommendation engines", +]; + +const CONSTRAINTS = [ + "For holdings (not DeFi), current rewards are 0.", + "Current rewards are separated from balances.", + "Recommendations are customized per client. If you’re a Web3 wallet or dApp, let us know, and we’ll provide filtered recommendations for your app.", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_refreshnftmetadata.tsx b/components/method-docs/wallet/WalletMethod_refreshnftmetadata.tsx new file mode 100644 index 00000000..da8a077b --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_refreshnftmetadata.tsx @@ -0,0 +1,160 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_refreshnftmetadata() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh \\ + --header 'accept: application/json'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh", { + method: "POST", + headers: { + "accept": "application/json" + } +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh", { + method: "POST", + headers: { + "accept": "application/json" + } +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" +) + +func main() { + req, _ := http.NewRequest("POST", "https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh", nil) + req.Header.Set("accept", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::ACCEPT; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh") + .header(ACCEPT, "application/json") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests + +url = "https://lb.drpc.live/{chain}/{key}/lambda/v1/contract-address/{contract}/nfts/{nft_id}/refresh" +headers = { + "accept": "application/json" +} + +response = requests.post(url, headers=headers) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "status": "success", +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "chain", + type: "string", + paramDescription: "[Required] Chain name (e.g. ethereum, polygon)", + }, + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, + { + paramName: "contract", + type: "string", + paramDescription: "[Required] NFT contract address", + }, + { + paramName: "nft_id", + type: "string", + paramDescription: "[Required] NFT token ID", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = []; + +const RESPONSE_PARAMS: ReqResParam[] = []; + +const USE_CASES = [ + "Trigger a refresh of NFT metadata", + "Ensure the latest NFT attributes and images are available", +]; + +const CONSTRAINTS = [ + "Requires valid contract address and token ID", + "Only NFTs on supported chains can be refreshed", +]; \ No newline at end of file diff --git a/components/method-docs/wallet/WalletMethod_searchhistoricalprices.tsx b/components/method-docs/wallet/WalletMethod_searchhistoricalprices.tsx new file mode 100644 index 00000000..f606f7db --- /dev/null +++ b/components/method-docs/wallet/WalletMethod_searchhistoricalprices.tsx @@ -0,0 +1,186 @@ +import WalletMethod from "../../WalletMethod/WalletMethod"; +import { + ReqResParam, + RequestParamProp +} from "../../GenericMethod/params/types"; +import { CodeSnippetObject } from "../../GenericMethod/types"; + +export function WalletMethod_searchhistoricalprices() { + return ( + + ); +} + +const CODE_SNIPPETS: Array = [ + { + language: "shell", + code: () => `curl --request POST \\ + --url https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search \\ + --header 'accept: application/json' \\ + --header 'Content-Type: application/json' \\ + --data '{}'`, + }, + { + language: "js", + code: () => `fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search", { + method: "POST", + headers: { + "accept": "application/json", + "Content-Type": "application/json" + }, + body: JSON.stringify({}) +}) + .then(res => res.json()) + .then(console.log) + .catch(console.error);`, + }, + { + language: "node", + code: () => `import fetch from "node-fetch"; + +const res = await fetch("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search", { + method: "POST", + headers: { + "accept": "application/json", + "Content-Type": "application/json" + }, + body: JSON.stringify({}) +}); + +const data = await res.json(); +console.log(data);`, + }, + { + language: "go", + code: () => `package main + +import ( + "fmt" + "io" + "net/http" + "strings" +) + +func main() { + req, _ := http.NewRequest("POST", "https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search", strings.NewReader("{}")) + req.Header.Set("accept", "application/json") + req.Header.Set("Content-Type", "application/json") + + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + + body, _ := io.ReadAll(resp.Body) + fmt.Println(string(body)) +}`, + }, + { + language: "rust", + code: () => `use reqwest::header::{ACCEPT, CONTENT_TYPE}; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = reqwest::Client::new(); + + let res = client + .post("https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search") + .header(ACCEPT, "application/json") + .header(CONTENT_TYPE, "application/json") + .body("{}") + .send() + .await?; + + let body = res.text().await?; + println!("{}", body); + + Ok(()) +}`, + }, + { + language: "python", + code: () => `import requests +import json + +url = "https://lb.drpc.live/lambda/{key}/v1/tokens/prices/search" +headers = { + "accept": "application/json", + "Content-Type": "application/json" +} + +response = requests.post(url, headers=headers, data=json.dumps({})) +print(response.json())`, + }, +]; + +const RESPONSE_JSON = `{ + "data": { + "additionalProp": [ + { + "price": 0, + "timestamp": "string" + } + ] + } +}`; + +const PATH_PARAMS: ReqResParam[] = [ + { + paramName: "key", + type: "string", + paramDescription: "[Required] Your dRPC API key", + }, +]; + +const REQUEST_PARAMS: RequestParamProp = [ + { + paramName: "symbols", + type: "array", + paramDescription: "[Required] List of token symbols to query", + }, + { + paramName: "timestamps", + type: "array_of_integers", + paramDescription: "List of timestamps in seconds or milliseconds", + }, +]; + +const RESPONSE_PARAMS: ReqResParam[] = [ + { + paramName: "data", + type: "array_of_objects", + paramDescription: "[Required] Price history per token", + childrenParamsType: "object", + childrenParams: [ + { paramName: "timestamp", type: "string", paramDescription: "Timestamp of price point" }, + { paramName: "price", type: "number", paramDescription: "Price value" }, + ], + }, +]; + +const USE_CASES = [ + "Fetch historical prices for one or more tokens", + "Analyze token price trends over time" +]; + +const CONSTRAINTS = [ + "Only supported tokens are returned", + "Data availability may vary by token and time range" +]; \ No newline at end of file diff --git a/pages/_meta.json b/pages/_meta.json index 78168ac7..cdea04b6 100644 --- a/pages/_meta.json +++ b/pages/_meta.json @@ -26,9 +26,16 @@ }, "nodecore-open-source-rpc-stack": "What is NodeCore", "nodecore-quickstart": "Quickstart", - "-- Methods Documentation": { + + "-- Data & Wallet API": { "type": "separator", - "title": "Methods Documentation" + "title": "Data & Wallet API" + }, + "wallet-api": "Wallet API", + + "-- Core RPC API": { + "type": "separator", + "title": "Core RPC API" }, "ethereum-api": { "title": "Ethereum API", diff --git a/pages/wallet-api/_meta.json b/pages/wallet-api/_meta.json new file mode 100644 index 00000000..0d053bc4 --- /dev/null +++ b/pages/wallet-api/_meta.json @@ -0,0 +1,7 @@ +{ + "chain": "Supported Chains", + "wallet": "Wallet", + "token": "Token", + "nft": "NFT", + "protocols": "Protocols" +} diff --git a/pages/wallet-api/chain/_meta.json b/pages/wallet-api/chain/_meta.json new file mode 100644 index 00000000..9fe48b4b --- /dev/null +++ b/pages/wallet-api/chain/_meta.json @@ -0,0 +1,4 @@ +{ + "getsupportedchains": "Get Supported Chains", + "getsupportedchainbyid": "Get Supported Chain By Id" +} \ No newline at end of file diff --git a/pages/wallet-api/chain/getsupportedchainbyid.mdx b/pages/wallet-api/chain/getsupportedchainbyid.mdx new file mode 100644 index 00000000..d4a9f94f --- /dev/null +++ b/pages/wallet-api/chain/getsupportedchainbyid.mdx @@ -0,0 +1,7 @@ +# Get Supported Chain By Id - Wallet & Data API + +## Get Supported Chains - Returns detailed information for a specific blockchain network + +import { WalletMethod_getsupportedchainbyid } from "components/method-docs/wallet/WalletMethod_getsupportedchainbyid"; + + diff --git a/pages/wallet-api/chain/getsupportedchains.mdx b/pages/wallet-api/chain/getsupportedchains.mdx new file mode 100644 index 00000000..c240a661 --- /dev/null +++ b/pages/wallet-api/chain/getsupportedchains.mdx @@ -0,0 +1,7 @@ +# Get Supported Chain - Wallet & Data API + +## Get Supported Chains - Returns a list of all chains supported in Wallet API + +import { WalletMethod_getsupportedchains } from "components/method-docs/wallet/WalletMethod_getsupportedchains"; + + diff --git a/pages/wallet-api/nft/_meta.json b/pages/wallet-api/nft/_meta.json new file mode 100644 index 00000000..8f2121ef --- /dev/null +++ b/pages/wallet-api/nft/_meta.json @@ -0,0 +1,6 @@ +{ + "getwalletnfts": "Get Wallet NFTs (Non-EVM)", + "getnftcollections": "Get NFT Collections", + "getnftmetadatabyid": "Get NFT Metadata by ID", + "refreshnftmetadata": "Refresh NFT Metadata" +} \ No newline at end of file diff --git a/pages/wallet-api/nft/getnftcollections.mdx b/pages/wallet-api/nft/getnftcollections.mdx new file mode 100644 index 00000000..4c66bb5d --- /dev/null +++ b/pages/wallet-api/nft/getnftcollections.mdx @@ -0,0 +1,7 @@ +# Get NFT Collections - Wallet & Data API + +## Get NFT Collections - Returns a grouped view of NFT collections owned by the wallet. + +import { WalletMethod_getnftcollections } from "components/method-docs/wallet/WalletMethod_getnftcollections"; + + diff --git a/pages/wallet-api/nft/getnftmetadatabyid.mdx b/pages/wallet-api/nft/getnftmetadatabyid.mdx new file mode 100644 index 00000000..efe0e3e5 --- /dev/null +++ b/pages/wallet-api/nft/getnftmetadatabyid.mdx @@ -0,0 +1,7 @@ +# Get NFT Metadata by Id - Wallet & Data API + +## Get NFT Metadata by Id - Fetches detailed information about a specific NFT by its unique identifier. + +import { WalletMethod_getnftmetadatabyid } from "components/method-docs/wallet/WalletMethod_getnftmetadatabyid"; + + diff --git a/pages/wallet-api/nft/getwalletnfts.mdx b/pages/wallet-api/nft/getwalletnfts.mdx new file mode 100644 index 00000000..00494cc2 --- /dev/null +++ b/pages/wallet-api/nft/getwalletnfts.mdx @@ -0,0 +1,7 @@ +# Get Wallet NFTs - Wallet & Data API + +## Get Wallet NFTs - Returns list of wallet NFTS + +import { WalletMethod_getwalletnfts } from "components/method-docs/wallet/WalletMethod_getwalletnfts"; + + diff --git a/pages/wallet-api/nft/refreshnftmetadata.mdx b/pages/wallet-api/nft/refreshnftmetadata.mdx new file mode 100644 index 00000000..d8de13d6 --- /dev/null +++ b/pages/wallet-api/nft/refreshnftmetadata.mdx @@ -0,0 +1,7 @@ +# Get NFT Metadata by Id - Wallet & Data API + +## Get NFT Metadata by Id - Forces metadata refresh for a specific NFT + +import { WalletMethod_refreshnftmetadata } from "components/method-docs/wallet/WalletMethod_refreshnftmetadata"; + + diff --git a/pages/wallet-api/protocols/_meta.json b/pages/wallet-api/protocols/_meta.json new file mode 100644 index 00000000..1a7cb6ae --- /dev/null +++ b/pages/wallet-api/protocols/_meta.json @@ -0,0 +1,3 @@ +{ + "getaprhistory": "Get APR History" +} \ No newline at end of file diff --git a/pages/wallet-api/protocols/getaprhistory.mdx b/pages/wallet-api/protocols/getaprhistory.mdx new file mode 100644 index 00000000..1175155d --- /dev/null +++ b/pages/wallet-api/protocols/getaprhistory.mdx @@ -0,0 +1,7 @@ +# Get APR history - Wallet & Data API + +## Get APR history - Proxy APR history for lending/borrowing from Data Access Layer. + +import { WalletMethod_getaprhistory } from "components/method-docs/wallet/WalletMethod_getaprhistory"; + + diff --git a/pages/wallet-api/token/_meta.json b/pages/wallet-api/token/_meta.json new file mode 100644 index 00000000..e7e127b2 --- /dev/null +++ b/pages/wallet-api/token/_meta.json @@ -0,0 +1,6 @@ +{ + "getsupportedtokens": "Get Supported Tokens", + "gettokeninfobyid": "Get Token Info By Id", + "getsupportedpricesymbols": "Get Supported Price Symbols", + "searchhistoricalprices": "Search Historical Prices" +} \ No newline at end of file diff --git a/pages/wallet-api/token/getsupportedpricesymbols.mdx b/pages/wallet-api/token/getsupportedpricesymbols.mdx new file mode 100644 index 00000000..bc7ad0d4 --- /dev/null +++ b/pages/wallet-api/token/getsupportedpricesymbols.mdx @@ -0,0 +1,7 @@ +# Get Supported Price Symbols - Wallet & Data API + +## Get Supported Price Symbols - Retrieve all supported token symbols for price queries + +import { WalletMethod_getsupportedpricesymbols } from "components/method-docs/wallet/WalletMethod_getsupportedpricesymbols"; + + diff --git a/pages/wallet-api/token/getsupportedtokens.mdx b/pages/wallet-api/token/getsupportedtokens.mdx new file mode 100644 index 00000000..2bec4707 --- /dev/null +++ b/pages/wallet-api/token/getsupportedtokens.mdx @@ -0,0 +1,7 @@ +# Get Supported Tokens - Wallet & Data API + +## Get Supported Tokens - Returns a paginated list of all tokens supported by Lambda API across different blockchain networks. + +import { WalletMethod_getsupportedtokens } from "components/method-docs/wallet/WalletMethod_getsupportedtokens"; + + diff --git a/pages/wallet-api/token/gettokeninfobyid.mdx b/pages/wallet-api/token/gettokeninfobyid.mdx new file mode 100644 index 00000000..31de4ce0 --- /dev/null +++ b/pages/wallet-api/token/gettokeninfobyid.mdx @@ -0,0 +1,7 @@ +# Get Token Info By Id - Wallet & Data API + +## Get Token Info By Id - Returns token basic info + +import { WalletMethod_gettokeninfobyid } from "components/method-docs/wallet/WalletMethod_gettokeninfobyid"; + + diff --git a/pages/wallet-api/token/searchhistoricalprices.mdx b/pages/wallet-api/token/searchhistoricalprices.mdx new file mode 100644 index 00000000..e4aa151e --- /dev/null +++ b/pages/wallet-api/token/searchhistoricalprices.mdx @@ -0,0 +1,7 @@ +# Search Historical Prices - Wallet & Data API + +## Search Historical Prices - Retrieve historical price data for multiple cryptocurrency and token symbols for specified timestamps. + +import { WalletMethod_searchhistoricalprices } from "components/method-docs/wallet/WalletMethod_searchhistoricalprices"; + + diff --git a/pages/wallet-api/wallet/_meta.json b/pages/wallet-api/wallet/_meta.json new file mode 100644 index 00000000..306cb3b0 --- /dev/null +++ b/pages/wallet-api/wallet/_meta.json @@ -0,0 +1,10 @@ +{ + "getevmportfolio": "Get EVM Portfolio", + "getnonevmportfolio": "Get non-EVM Portfolio", + "gethistoricalnetworth": "Get Historical Net Worth", + "gettransactionshistory": "Get Transactions History", + "getpnlhistory": "Get PNL History", + "getaggregatedpnl": "Get Aggregated PNL", + "getpnlformultiplewallets": "Get PnL for Multiple Wallets", + "getyieldrecommendations": "Get Yield Recommendations" +} \ No newline at end of file diff --git a/pages/wallet-api/wallet/getaggregatedpnl.mdx b/pages/wallet-api/wallet/getaggregatedpnl.mdx new file mode 100644 index 00000000..c32ed0d3 --- /dev/null +++ b/pages/wallet-api/wallet/getaggregatedpnl.mdx @@ -0,0 +1,7 @@ +# Get Aggregated PNL - Wallet API + +## Get Aggregated PNL - The Aggregated PnL (Profit and Loss) data is provided for multiple specific positions across different wallets and DeFi protocols in a single consolidated calculation. + +import { WalletMethod_getaggregatedpnl } from "components/method-docs/wallet/WalletMethod_getaggregatedpnl"; + + diff --git a/pages/wallet-api/wallet/getevmportfolio.mdx b/pages/wallet-api/wallet/getevmportfolio.mdx new file mode 100644 index 00000000..69737696 --- /dev/null +++ b/pages/wallet-api/wallet/getevmportfolio.mdx @@ -0,0 +1,7 @@ +# Get EVM Portfolio - Wallet API + +## Get EVM Portfolio - Returns comprehensive portfolio information for a wallet address + +import { WalletMethod_getevmportfolio } from "components/method-docs/wallet/WalletMethod_getevmportfolio"; + + diff --git a/pages/wallet-api/wallet/gethistoricalnetworth.mdx b/pages/wallet-api/wallet/gethistoricalnetworth.mdx new file mode 100644 index 00000000..3ecc12fa --- /dev/null +++ b/pages/wallet-api/wallet/gethistoricalnetworth.mdx @@ -0,0 +1,7 @@ +# Get Historical Net Worth - Wallet API + +## Get Historical Net Worth - Returns the historical balance of all tokens for a specified wallet address + +import { WalletMethod_gethistoricalnetworth } from "components/method-docs/wallet/WalletMethod_gethistoricalnetworth"; + + diff --git a/pages/wallet-api/wallet/getnonevmportfolio.mdx b/pages/wallet-api/wallet/getnonevmportfolio.mdx new file mode 100644 index 00000000..5b8e526b --- /dev/null +++ b/pages/wallet-api/wallet/getnonevmportfolio.mdx @@ -0,0 +1,7 @@ +# Get non-EVM Portfolio - Wallet API + +## Get non-EVM Portfolio - Returns comprehensive portfolio information for a wallet address + +import { WalletMethod_getnonevmportfolio } from "components/method-docs/wallet/WalletMethod_getnonevmportfolio"; + + diff --git a/pages/wallet-api/wallet/getpnlformultiplewallets.mdx b/pages/wallet-api/wallet/getpnlformultiplewallets.mdx new file mode 100644 index 00000000..5c704cde --- /dev/null +++ b/pages/wallet-api/wallet/getpnlformultiplewallets.mdx @@ -0,0 +1,7 @@ +# Get PnL for Multiple Wallets - Wallet API + +## Get PnL for Multiple Wallets - The Wallet PnL (Profit and Loss) data is provided for entire wallets, aggregating all positions and tokens within each specified wallet address + +import { WalletMethod_getpnlformultiplewallets } from "components/method-docs/wallet/WalletMethod_getpnlformultiplewallets"; + + diff --git a/pages/wallet-api/wallet/getpnlhistory.mdx b/pages/wallet-api/wallet/getpnlhistory.mdx new file mode 100644 index 00000000..8f66715b --- /dev/null +++ b/pages/wallet-api/wallet/getpnlhistory.mdx @@ -0,0 +1,7 @@ +# Get PNL History - Wallet API + +## Get PNL History - The PnL (Profit and Loss) data is provided for a single token or DeFi position (asset locked in the protocol). + +import { WalletMethod_getpnlhistory } from "components/method-docs/wallet/WalletMethod_getpnlhistory"; + + diff --git a/pages/wallet-api/wallet/gettransactionshistory.mdx b/pages/wallet-api/wallet/gettransactionshistory.mdx new file mode 100644 index 00000000..20567328 --- /dev/null +++ b/pages/wallet-api/wallet/gettransactionshistory.mdx @@ -0,0 +1,7 @@ +# Get Transactions History - Wallet API + +## Get Transactions History - Returns a chronological list of blockchain transactions for the specified wallet address. + +import { WalletMethod_gettransactionshistory } from "components/method-docs/wallet/WalletMethod_gettransactionshistory"; + + diff --git a/pages/wallet-api/wallet/getyieldrecommendations.mdx b/pages/wallet-api/wallet/getyieldrecommendations.mdx new file mode 100644 index 00000000..242c1d45 --- /dev/null +++ b/pages/wallet-api/wallet/getyieldrecommendations.mdx @@ -0,0 +1,7 @@ +# Get Yield Recommendations - Wallet API + +## Get Yield Recommendations - Get the missing yield for your tokens and DeFi positions. + +import { WalletMethod_getyieldrecommendations } from "components/method-docs/wallet/WalletMethod_getyieldrecommendations"; + + diff --git a/utils/text/seo.ts b/utils/text/seo.ts index 1df83a05..c1ddc951 100644 --- a/utils/text/seo.ts +++ b/utils/text/seo.ts @@ -19,7 +19,8 @@ const METHOD_DOCS_URL_BASES_MAP = { "/sonic-api": "Sonic", "/viction-api": "Viction", "/superseed-api": "Superseed", - "/tron-api": "Tron" + "/tron-api": "Tron", + "/wallet-api": "Wallet API", }; const METHOD_DOCS_URL_BASES_MAP_KEYS = Object.keys(METHOD_DOCS_URL_BASES_MAP); @@ -61,7 +62,12 @@ const METHOD_DOCS_URL_CHAPTERS = [ "ethereumfantomdifference", "ethereumbscdifference", "ethereumbartiodifference", - "ethereumsuperseeddifference" + "ethereumsuperseeddifference", + "chain", + "wallet", + "token", + "nft", + "protocols" ]; type RouteCheckResult = {