-
Notifications
You must be signed in to change notification settings - Fork 3
/
covalent.js
27 lines (25 loc) · 869 Bytes
/
covalent.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import Vue from "vue";
export default ({ $axios }, inject) => {
inject('covalent', Vue.observable({
chainId: 4002, // fantom testnet chain id
getTokenBalances: async function(address) {
try {
const options = {
method: 'GET',
url: `${this.chainId}/address/${address}/balances_v2/`,
params: {
'quote-currency': 'USD',
'format': 'JSON',
'nft': false,
'no-nft-fetch': false,
'key': process.env.COVALENT_API_KEY
}
}
const response = await $axios.request(options)
return response.data
} catch (error) {
return null
}
}
}))
}