Tronsave
🇨🇳 Chinese
🇨🇳 Chinese
  • 📗INTRODUCTION
    • Tronsave是什么?
    • 什么选 Tronsave?
  • Buyer
    • 如何购买能量?
      • 在网站上购买
      • 如何在Telegram上购买能源
        • 1: 创建Telegram Tronsave帐户
        • 2: 如何存款
        • 3: 获取Tronsave API密钥
        • 4. 如何在 Telegram 上购买
    • 延长
      • 快速延长
      • 提高
  • 🏬Seller
    • 质押 2.0 (Stake 2.0)
    • 权限 (Permission)
    • 购买能源
      • 设置自动卖出 (Setup Auto Sell)
      • 手动出售
      • 卖出建议
  • DEVELOPER
    • 获取 API 密钥
      • 在网站上
      • 在Telegram上
    • 购买资源 (v2)
      • 使用签名交易 (Signed tx)
        • 估算TRX
        • 获取已签名交易
        • 创建订单
      • 使用 API 密钥
        • 获取内部账户信息
        • 获取订单簿 (Order book)
        • 获取估算 TRX (Estimate TRX)
        • 购买能源
        • 获取单个订单详情
        • 获取内部账户订单历史
    • 扩展订单 (v2)
      • 步骤 1:获取可扩展的委托人
      • 步骤 2:扩展请求
    • SDK 库
    • REST API v0
      • 通过 REST API 购买
        • 使用签名交易 (Signed tx)
          • 估算TRX
          • 获取已签名交易
          • 创建订单
          • Demo
        • 使用 API 密钥
          • 获取内部账户信息
          • 获取订单簿 (Order book)
          • 获取估算 TRX (Estimate TRX)
          • 购买能源
          • 获取单个订单详情
          • 获取内部账户订单历史
      • 订单延长使用API密钥
  • 🤝 Referrer
    • 推荐 (Referral)
  • 💡FAQ
    • 能源市场问题
    • 计算 TronSave 的年化收益率 (APY)
    • 如何在 Tronsave 中连接钱包?
    • 服务团队
  • 👨‍💻Full Code Example
    • Code Example (v2)
      • 使用私钥通过 API 购买能源
      • 使用 API 密钥通过 API 购买能源
      • 使用 API 密钥通过 API 扩展订单
      • 使用私钥通过 API 扩展订单
    • Code Exaample (v0)
      • 使用私钥通过 API 购买能源
      • 使用 API 密钥通过 API 购买能源
      • 使用API密钥通过API延长订单
Powered by GitBook
On this page
  1. DEVELOPER
  2. 购买资源 (v2)
  3. 使用 API 密钥

获取内部账户信息

Previous使用 API 密钥Next获取订单簿 (Order book)

Last updated 20 days ago

要使用此功能,您必须拥有 API 密钥。请阅读以了解如何获取我们的 API 密钥。

通过 API 密钥获取帐户信息

GET https://api.tronsave.io/v2/user-info

速率限制 (Rate limit): 每1秒15个请求。

通过 获取帐户信息

{
    "error": false,
    "message": "Success",
    "data": {
        "id": string, // 内部账户 ID
        "balance": string, // 内部账户余额(单位:SUN)
        "representAddress": string, // 内部账户作为订单请求者的表示地址
        "depositAddress": string, // 向此地址发送 TRX 以存入内部账户
    }
}

例子 (Example)

{
  "apikey": <YOUR_API_KEY>
}
{
    "error": false,
    "message": "Success",
    "data": {
        "id": "user_id",
        "balance": "306773887",
        "representAddress": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999",
        "depositAddress": "TKVSaJQDWeKFSEXmA44pjxduGTxy999999"
    }
}

示例代码 (Example Code):

const GetAccountInfo = async (apiKey) => {
    const url = `${TRONSAVE_API_URL}/v2/user-info`
    const data = await fetch(url, {
        headers: {
            'apikey': apiKey
        }
    })
    const response = await data.json()
    /**
     * Example response 
    {
        "error": false,
        "message": "Success",
        "data": {
            "id": "67a2e6092...2e8b291da2",
            "balance": "373040535",
            "representAddress": "TTgMEAhuzPch...nm2tCNmqXp13AxzAd",
            "depositAddress": "TTgMEAhuzPch...2tCNmqXp13AxzAd"
        }
    }
     */
    return response
}
function getAccountInfo(): array {
    $url = TRONSAVE_API_URL . "/v2/user-info";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'apikey: ' . API_KEY
    ]);
    $response = curl_exec($ch);
    curl_close($ch);
    return json_decode($response, true);
}
def get_account_info() -> Dict[str, Any]:
    """Get account information"""
    url = f"{TRONSAVE_API_URL}/v2/user-info"
    headers = {'apikey': API_KEY}
    
    response = requests.get(url, headers=headers)
    return response.json()
这里
API 密钥