Closed longtruongg closed 2 years ago
The vault CLI has an option to output a curl command. For example:
vault read -output-curl-string -format=json vault-ethereum/accounts/bob/erc20/totalSupply contract="0x863820337f08370a01bCE27Ae1F5CdD7704fd38a"
curl -H "X-Vault-Request: true" -H "X-Vault-Token: $(vault print token)" https://localhost:9200/v1/vault-ethereum/accounts/bob/erc20/totalSupply?contract=0x863820337f08370a01bCE27Ae1F5CdD7704fd38a
Then, you can (adding the -s
option to curl
)
$ curl -s -H "X-Vault-Request: true" -H "X-Vault-Token: $(vault print token)" https://localhost:9200/v1/vault-ethereum/accounts/bob/erc20/totalSupply\?contract\=0x863820337f08370a01bCE27Ae1F5CdD7704fd38a | jq .
{
"request_id": "0e83ddac-fe8a-1077-16fe-6355f778f062",
"lease_id": "",
"renewable": false,
"lease_duration": 0,
"data": {
"contract": "0x863820337f08370a01bCE27Ae1F5CdD7704fd38a",
"name": "Example Fixed Supply Token",
"symbol": "FIXED",
"total_supply": "1000000"
},
"wrap_info": null,
"warnings": null,
"auth": null
}
Detailed Description
hi, I was trying to check balanceOf using :
https://localhost:9200/v1/vault-ethereum/accounts/bob/erc20/balanceOf
Its giving me error: :But when i was using Vault command :
vault read -format=json vault-ethereum/accounts/bob/erc20/balanceOf contract='0x337610d27c682E347C9cD60BD4b3b107C9d34dDd'
got data
Context
I got an error when calling erc20 / balanceOf API using curl / post man, but when I call with Vault command get the data, I also want to get the same data using postman / curl
Your Environment