11const sdk = require ( '@defillama/sdk' ) ;
22const { sumTokensExport } = require ( '../helper/sumTokens' ) ;
33const { sumTokens } = require ( '../helper/chain/bitcoin.js' ) ;
4+ const { getConfig } = require ( '../helper/cache' ) ;
45const bitcoinAddressBook = require ( '../helper/bitcoin-book/index.js' )
56
67
@@ -24,38 +25,12 @@ const DOGE_ADDRESSES = [
2425 ] ;
2526
2627async function btcTvl ( api ) {
27- const response = await fetch ( "https://www.coinbase.com/cbbtc/proof-of-reserves.json" , {
28- "headers" : {
29- "accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8" ,
30- "accept-language" : "en-US,en;q=0.5" ,
31- "cache-control" : "no-cache" ,
32- "pragma" : "no-cache" ,
33- "priority" : "u=0, i" ,
34- "sec-ch-ua" : "\"Not)A;Brand\";v=\"8\", \"Chromium\";v=\"138\", \"Brave\";v=\"138\"" ,
35- "sec-ch-ua-arch" : "\"x86\"" ,
36- "sec-ch-ua-bitness" : "\"64\"" ,
37- "sec-ch-ua-full-version-list" : "\"Not)A;Brand\";v=\"8.0.0.0\", \"Chromium\";v=\"138.0.0.0\", \"Brave\";v=\"138.0.0.0\"" ,
38- "sec-ch-ua-mobile" : "?0" ,
39- "sec-ch-ua-model" : "\"\"" ,
40- "sec-ch-ua-platform" : "\"Linux\"" ,
41- "sec-ch-ua-platform-version" : "\"6.2.0\"" ,
42- "sec-fetch-dest" : "document" ,
43- "sec-fetch-mode" : "navigate" ,
44- "sec-fetch-site" : "none" ,
45- "sec-fetch-user" : "?1" ,
46- "sec-gpc" : "1" ,
47- "upgrade-insecure-requests" : "1" ,
48- } ,
49- "body" : null ,
50- "method" : "GET"
51- } ) ;
52-
53- const res = await response . json ( ) ;
54-
55- const bitcoinWallets = res . reserveAddresses . map ( item => item . address )
56-
57- return sumTokens ( { timestamp : api . timestamp , owners : bitcoinWallets } )
58- }
28+ const config = await getConfig ( 'coinbase-cbbtc-proof-of-reserves' , 'https://www.coinbase.com/cbbtc/proof-of-reserves.json' )
29+
30+ const bitcoinWallets = config . reserveAddresses . map ( item => item . address )
31+
32+ return sumTokens ( { timestamp : api . timestamp , owners : bitcoinWallets } )
33+ }
5934
6035
6136
0 commit comments