-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update:gateio chains&addresses (#12993)
Co-authored-by: g1nt0ki <[email protected]> Co-authored-by: Booyoun <[email protected]> Co-authored-by: jaejeonglee <[email protected]> Co-authored-by: stanli1231 <[email protected]>
- Loading branch information
1 parent
e8819d2
commit f5d667b
Showing
12 changed files
with
1,805 additions
and
73 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { post } = require('../http') | ||
const { sleep } = require('../utils') | ||
|
||
const endpoint = 'https://acala.api.subscan.io/api/v2/scan/search' | ||
|
||
async function getBalance(key) { | ||
const data = await post(endpoint, { key }, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-API-Key': 'f89d810db5ef4c4fbc83b987dc2ffcda' | ||
} | ||
}) | ||
return +(data?.data?.account?.balance ?? 0) | ||
} | ||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0 | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner) | ||
total += balance | ||
await sleep(3000) | ||
} | ||
sdk.util.sumSingleBalance(balances, 'acala', total) | ||
return balances | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { get } = require('../http') | ||
|
||
|
||
async function getBalance(key) { | ||
const data = await get(`https://explorer.aelf.io/api/viewer/balances?address=${key}`) | ||
return +(data?.data?.[0]?.balance ?? 0) | ||
} | ||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0 | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner) | ||
total += balance | ||
} | ||
sdk.util.sumSingleBalance(balances, 'aelf', total) | ||
return balances | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const axios = require('axios'); | ||
|
||
const endpoint = 'https://mainnet.aeternity.io/v2/accounts'; // Replace with the appropriate endpoint | ||
|
||
async function getBalance(address) { | ||
try { | ||
const response = await axios.get(`${endpoint}/${address}`); | ||
const balance = response.data.balance; | ||
return balance; | ||
} catch (error) { | ||
console.error('Error fetching token balance:', error); | ||
return 0; | ||
} | ||
} | ||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0; | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner); | ||
total += balance; | ||
} | ||
sdk.util.sumSingleBalance(balances, 'aeternity', total); | ||
return balances; | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { post } = require('../http') | ||
const { sleep } = require('../utils') | ||
|
||
const endpoint = 'https://astar.api.subscan.io/api/v2/scan/search' | ||
|
||
async function getBalance(key) { | ||
const data = await post(endpoint, { key }, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-API-Key': 'f89d810db5ef4c4fbc83b987dc2ffcda' | ||
} | ||
}) | ||
return +(data?.data?.account?.balance ?? 0) | ||
} | ||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0 | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner) | ||
total += balance | ||
await sleep(3000) | ||
} | ||
sdk.util.sumSingleBalance(balances, 'astar', total) | ||
return balances | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { post } = require('../http') | ||
const { sleep } = require('../utils') | ||
|
||
const endpoint = 'https://bifrost.api.subscan.io/api/v2/scan/search' | ||
|
||
async function getBalance(key) { | ||
const data = await post(endpoint, { key }, { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'X-API-Key': 'f89d810db5ef4c4fbc83b987dc2ffcda' | ||
} | ||
}) | ||
return +(data?.data?.account?.balance ?? 0) | ||
} | ||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0 | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner) | ||
total += balance | ||
await sleep(3000) | ||
} | ||
sdk.util.sumSingleBalance(balances, 'bifrost', total) | ||
return balances | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const sdk = require('@defillama/sdk') | ||
const { post } = require('../http') | ||
|
||
const TAO_STATS_SUBQUERY = "https://api.subquery.network/sq/TaoStats/bittensor-indexer"; | ||
|
||
async function getBalance(key) { | ||
const query = `{ | ||
query{ | ||
account(id: "${key}"){ | ||
id | ||
nodeId | ||
balanceTotal | ||
balanceStaked | ||
balanceFree | ||
address | ||
} | ||
} | ||
}`; | ||
|
||
|
||
const { data: { query: { account: { balanceTotal } } } } = await post(TAO_STATS_SUBQUERY, { query, variables: {}, }); | ||
return balanceTotal/1e9 | ||
} | ||
|
||
|
||
async function sumTokens({ balances = {}, owners = [] }) { | ||
let total = 0 | ||
for (const owner of owners) { | ||
const balance = await getBalance(owner) | ||
console.log(owner, balance) | ||
total += balance | ||
} | ||
sdk.util.sumSingleBalance(balances, 'bittensor', total) | ||
return balances | ||
} | ||
|
||
module.exports = { | ||
sumTokens | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters