GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.SecurityService.getApprovals({chainName: "chainName", walletAddress: "walletAddress"});
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"address": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"quote_currency": "<string>",
"chain_id": 123,
"chain_name": "<string>",
"items": [
{
"token_address": "<string>",
"token_address_label": "<string>",
"ticker_symbol": "<string>",
"contract_decimals": 123,
"logo_url": "<string>",
"quote_rate": 123,
"balance": "<string>",
"balance_quote": 123,
"pretty_balance_quote": "<string>",
"value_at_risk": "<string>",
"value_at_risk_quote": 123,
"pretty_value_at_risk_quote": "<string>",
"spenders": [
{
"block_height": 123,
"tx_offset": 123,
"log_offset": 123,
"block_signed_at": "2023-11-07T05:31:56Z",
"tx_hash": "<string>",
"spender_address": "<string>",
"allowance": "<string>",
"allowance_quote": 123,
"pretty_allowance_quote": "<string>",
"value_at_risk": "<string>",
"value_at_risk_quote": 123,
"pretty_value_at_risk_quote": "<string>",
"risk_factor": "<string>"
}
]
}
]
}Security
Get token approvals for address
Commonly used to get a list of approvals across all token contracts categorized by spenders for a wallet’s assets.
GET
/
v1
/
{chainName}
/
approvals
/
{walletAddress}
/
GoldRush SDK
import { GoldRushClient } from "@covalenthq/client-sdk";
const ApiServices = async () => {
const client = new GoldRushClient("<GOLDRUSH_API_KEY>");
const resp = await client.SecurityService.getApprovals({chainName: "chainName", walletAddress: "walletAddress"});
console.log(resp.data);
};
ApiServices();curl --request GET \
--url https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/ \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.covalenthq.com/v1/{chainName}/approvals/{walletAddress}/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"address": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"quote_currency": "<string>",
"chain_id": 123,
"chain_name": "<string>",
"items": [
{
"token_address": "<string>",
"token_address_label": "<string>",
"ticker_symbol": "<string>",
"contract_decimals": 123,
"logo_url": "<string>",
"quote_rate": 123,
"balance": "<string>",
"balance_quote": 123,
"pretty_balance_quote": "<string>",
"value_at_risk": "<string>",
"value_at_risk_quote": 123,
"pretty_value_at_risk_quote": "<string>",
"spenders": [
{
"block_height": 123,
"tx_offset": 123,
"log_offset": 123,
"block_signed_at": "2023-11-07T05:31:56Z",
"tx_hash": "<string>",
"spender_address": "<string>",
"allowance": "<string>",
"allowance_quote": 123,
"pretty_allowance_quote": "<string>",
"value_at_risk": "<string>",
"value_at_risk_quote": 123,
"pretty_value_at_risk_quote": "<string>",
"risk_factor": "<string>"
}
]
}
]
}Credit Cost
2 per call
Processing
Realtime
Estimate your monthly cost for this API using the Pricing Calculator.
Authorizations
Bearer authentication header of the form: Bearer <token>, where <token> is your GoldRush API Key.
Path Parameters
The chain name eg: eth-mainnet.
The requested address. Passing in an ENS, RNS, Lens Handle, or an Unstoppable Domain resolves automatically.
Response
200 - application/json
Successful response
The requested address.
The timestamp when the response was generated. Useful to show data staleness to users.
The requested quote currency eg: USD.
The requested chain ID eg: 1.
The requested chain name eg: eth-mainnet.
List of response items.
Show child attributes
Show child attributes
⌘I