Socket
Socket
Sign inDemoInstall

synthetix-data

Package Overview
Dependencies
Maintainers
7
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

synthetix-data - npm Package Compare versions

Comparing version 2.1.42 to 2.1.43

2

browser.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snxData=t():e.snxData=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";const i=n(3),{SubscriptionClient:r}=n(4),o=n(14),{ZERO_ADDRESS:a,hexToAscii:s,roundTimestampTenSeconds:c,getHashFromId:u,formatGQLArray:l,formatGQLString:d}=n(15),m={snx:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix",depot:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-depot",exchanges:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",rates:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates",binaryOptions:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-binary-options",etherCollateral:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-loans",limitOrders:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-limit-orders",exchanger:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanger",liquidations:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-liquidations"},p="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",f="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates";e.exports={pageResults:o,graphAPIEndpoints:m,depot:{userActions:({network:e="mainnet",user:t,max:n=100})=>o({api:m.depot,query:{entity:"userActions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,user:t?`\\"${t}\\"`:void 0}},properties:["id","user","amount","minimum","depositIndex","type","block","timestamp"]},max:n}).then(e=>e.map(({id:e,user:t,amount:n,type:i,minimum:r,depositIndex:o,block:a,timestamp:s})=>({hash:u(e),user:t,amount:n/1e18,type:i,minimum:null!==r?Number(r):null,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).catch(e=>console.log(e)),clearedDeposits:({network:e="mainnet",fromAddress:t,toAddress:n,max:i=100})=>o({api:m.depot,query:{entity:"clearedDeposits",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,fromAddress:t?`\\"${t}\\"`:void 0,toAddress:n?`\\"${n}\\"`:void 0}},properties:["id","fromAddress","toAddress","fromETHAmount","toAmount","depositIndex","block","timestamp"]},max:i}).then(e=>e.map(({id:e,fromAddress:t,toAddress:n,fromETHAmount:i,toAmount:r,depositIndex:o,block:a,timestamp:s})=>({hash:u(e),fromAddress:t,toAddress:n,fromETHAmount:i/1e18,toAmount:r/1e18,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s),type:"cleared"}))).catch(e=>console.error(e)),exchanges:({network:e="mainnet",from:t,max:n=100})=>o({api:m.depot,query:{entity:"exchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,from:t?`\\"${t}\\"`:void 0}},properties:["id","from","fromCurrency","fromAmount","toCurrency","toAmount","block","timestamp"]},max:n}).then(e=>e.map(({id:e,from:t,fromAmount:n,fromCurrency:i,toAmount:r,toCurrency:o,block:a,timestamp:s})=>({hash:u(e),from:t,fromAmount:n/1e18,fromCurrency:i,toAmount:r/1e18,toCurrency:o,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s),type:"bought"}))).catch(e=>console.error(e))},exchanges:{_properties:["id","from","gasPrice","from","fromAmount","fromAmountInUSD","fromCurrencyKey","toCurrencyKey","toAddress","toAmount","toAmountInUSD","feesInUSD","block","timestamp"],_mapSynthExchange:({gasPrice:e,timestamp:t,id:n,from:i,fromAmount:r,block:o,fromAmountInUSD:a,fromCurrencyKey:c,toAddress:l,toAmount:d,toAmountInUSD:m,toCurrencyKey:p,feesInUSD:f})=>({gasPrice:e/1e9,block:Number(o),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:u(n),fromAddress:i,fromAmount:r/1e18,fromCurrencyKeyBytes:c,fromCurrencyKey:s(c),fromAmountInUSD:a/1e18,toAmount:d/1e18,toAmountInUSD:m/1e18,toCurrencyKeyBytes:p,toCurrencyKey:s(p),toAddress:l,feesInUSD:f/1e18}),total:({network:e="mainnet"}={})=>o({api:m.exchanges,query:{entity:"totals",selection:{where:{id:`\\"${e}\\"`}},properties:["trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]},max:1}).then(([{exchangers:e,exchangeUSDTally:t,totalFeesGeneratedInUSD:n,trades:i}])=>({trades:Number(i),exchangers:Number(e),exchangeUSDTally:t/1e18,totalFeesGeneratedInUSD:n/1e18})).catch(e=>console.error(e)),aggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:m.exchanges,max:t,query:{entity:""+{"1d":"dailyTotals","15m":"fifteenMinuteTotals"}[e],selection:{orderBy:"id",orderDirection:"desc"},properties:["id","trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]}}).then(e=>e.map(({id:e,trades:t,exchangers:n,exchangeUSDTally:i,totalFeesGeneratedInUSD:r})=>({id:e,trades:Number(t),exchangers:Number(n),exchangeUSDTally:i/1e18,totalFeesGeneratedInUSD:r/1e18}))).catch(e=>console.error(e)),since:({network:t="mainnet",max:n=1/0,minTimestamp:i,maxTimestamp:r,minBlock:a,maxBlock:s,fromAddress:u}={})=>o({api:m.exchanges,max:n,query:{entity:"synthExchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${t}\\"`,timestamp_gte:c(i)||void 0,timestamp_lte:c(r)||void 0,block_gte:a||void 0,block_lte:s||void 0,from:u?`\\"${u}\\"`:void 0}},properties:e.exports.exchanges._properties}}).then(t=>t.map(e.exports.exchanges._mapSynthExchange)).catch(e=>console.error(e)),_rebateOrReclaim:({isReclaim:e})=>({account:t,max:n=1/0,minTimestamp:i,maxTimestamp:r,minBlock:a,maxBlock:c}={})=>o({api:m.exchanges,max:n,query:{entity:`exchange${e?"Reclaim":"Rebate"}s`,selection:{orderBy:"timestamp",orderDirection:"desc",where:{timestamp_gte:i||void 0,timestamp_lte:r||void 0,block_gte:a||void 0,block_lte:c||void 0,account:t?`\\"${t}\\"`:void 0}},properties:["id","amount","amountInUSD","currencyKey","account","timestamp","block","gasPrice"]}}).then(e=>e.map(({gasPrice:e,timestamp:t,id:n,account:i,block:r,currencyKey:o,amount:a,amountInUSD:c})=>({gasPrice:e/1e9,block:Number(r),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:u(n),account:i,amount:a/1e18,amountInUSD:c/1e18,currencyKey:s(o),currencyKeyBytes:o}))).catch(e=>console.error(e)),reclaims(e){return this._rebateOrReclaim({isReclaim:!0})(e)},rebates(e){return this._rebateOrReclaim({isReclaim:!1})(e)},observe(){const t=new r(p,{reconnect:!0},i).request({query:`subscription { synthExchanges(first: 1, orderBy: timestamp, orderDirection: desc) { ${e.exports.exchanges._properties.join(",")} } }`});return{subscribe:({next:n,error:i,complete:r})=>t.subscribe({next({data:{synthExchanges:t}}){t.map(e.exports.exchanges._mapSynthExchange).forEach(n)},error:i,complete:r})}}},synths:{issuers:({max:e=10}={})=>o({api:m.snx,max:e,query:{entity:"issuers",properties:["id"]}}).then(e=>e.map(({id:e})=>e)).catch(e=>console.error(e)),transfers:({synth:e,from:t,to:n,max:i=100,minBlock:r,maxBlock:s}={})=>o({api:m.snx,max:i,query:{entity:"transfers",selection:{orderBy:"timestamp",orderDirection:"desc",where:{source:e?`\\"${e}\\"`:void 0,source_not:'\\"SNX\\"',from:t?`\\"${t}\\"`:void 0,to:n?`\\"${n}\\"`:void 0,from_not:`\\"${a}\\"`,to_not:`\\"${a}\\"`,block_gte:r||void 0,block_lte:s||void 0}},properties:["id","source","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,source:t,block:n,timestamp:i,from:r,to:o,value:a})=>({source:t,block:Number(n),timestamp:Number(1e3*i),date:new Date(1e3*i),hash:u(e),from:r,to:o,value:a/1e18}))).catch(e=>console.error(e)),holders:({max:e=100,synth:t,address:n}={})=>o({api:m.snx,max:e,query:{entity:"synthHolders",selection:{orderBy:"balanceOf",orderDirection:"desc",where:{id:n&&t?`\\"${n+"-"+t}\\"`:void 0,synth:t?`\\"${t}\\"`:void 0}},properties:["id","balanceOf","synth"]}}).then(e=>e.map(({id:e,balanceOf:t,synth:n})=>({address:u(e),balanceOf:t?t/1e18:null,synth:n}))).catch(e=>console.error(e))},rate:{snxAggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:m.rates,max:t,query:{entity:""+{"1d":"dailySNXPrices","15m":"fifteenMinuteSNXPrices"}[e],selection:{orderBy:"id",orderDirection:"desc"},properties:["id","averagePrice"]}}).then(e=>e.map(({id:e,averagePrice:t})=>({id:e,averagePrice:t/1e18}))).catch(e=>console.error(e)),updates({synth:e,minBlock:t,maxBlock:n,minTimestamp:i,maxTimestamp:r,max:a=100}={}){let s={};return s=Array.isArray(e)?{synth_in:l(e)}:e?{synth:d(e)}:{synth_not_in:l(["SNX","ETH","XDR"])},o({api:m.rates,max:a,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{...s,block_gte:t||void 0,block_lte:n||void 0,timestamp_gte:c(i)||void 0,timestamp_lte:c(r)||void 0}},properties:["id","synth","rate","block","timestamp"]}}).then(e=>e.map(({id:e,rate:t,block:n,timestamp:i,synth:r})=>({block:Number(n),synth:r,timestamp:Number(1e3*i),date:new Date(1e3*i),hash:u(e),rate:t/1e18}))).catch(e=>console.error(e))},dailyRateChange({synths:e=[],max:t=100,fromBlock:n}){const i=["XDR","XDRB","nUSD","sUSD"];return o({api:m.rates,max:t,query:{selection:{block:{number:Number(n)}},entity:"latestRates",properties:["id","rate"]}}).then(r=>{const a=r.reduce((t,n)=>(!i.includes(n.id)&&(0===e.length||e.length>0&&e.includes(n.id))&&(t[n.id]={currentRate:n.rate}),t),{}),s=Number(n)-5760;return o({api:m.rates,max:t,query:{selection:{block:{number:s}},entity:"latestRates",properties:["id","rate"]}}).then(e=>(e.forEach(e=>{a[e.id]&&(a[e.id].dayOldRate=e.rate,a[e.id]["24HRChange"]=a[e.id].currentRate/e.rate-1)}),a))}).catch(e=>console.error(e))},observe({minTimestamp:e=Math.round(Date.now()/1e3)}={}){const t=new r(f,{reconnect:!0},i).request({query:`subscription { rateUpdates(where: { timestamp_gt: ${e}}, orderBy: timestamp, orderDirection: desc) { ${["id","synth","rate","block","timestamp"].join(",")} } }`});return{subscribe:({next:e,error:n,complete:i})=>t.subscribe({next({data:{rateUpdates:t}}){t.forEach(e)},error:n,complete:i})}}},snx:{issued:({max:e=100,account:t,minBlock:n}={})=>o({api:m.snx,max:e,query:{entity:"issueds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0,block_gte:n||void 0}},properties:["id","account","timestamp","block","value"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,type:"issued"}))).catch(e=>console.error(e)),burned:({max:e=100,account:t,minBlock:n}={})=>o({api:m.snx,max:e,query:{entity:"burneds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0,block_gte:n||void 0}},properties:["id","account","timestamp","block","value"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,type:"burned"}))).catch(e=>console.error(e)),aggregateActiveStakers:({max:e=30}={})=>o({api:m.snx,max:e,query:{entity:"totalDailyActiveStakers",selection:{orderBy:"id",orderDirection:"desc"},properties:["id","count"]}}).catch(e=>console.error(e)),totalActiveStakers:()=>o({api:m.snx,max:1,query:{entity:"totalActiveStakers",properties:["count"]}}).then(([{count:e}])=>({count:e})).catch(e=>console.error(e)),holders:({max:e=100,maxCollateral:t,minCollateral:n,address:i,minMints:r,minClaims:a}={})=>o({api:m.snx,max:e,query:{entity:"snxholders",selection:{orderBy:"collateral",orderDirection:"desc",where:{id:i?`\\"${i.toLowerCase()}\\"`:void 0,collateral_lte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,collateral_gte:n?`\\"${n+"0".repeat(18)}\\"`:void 0,mints_gte:r||void 0,claims_gte:a||void 0}},properties:["id","block","timestamp","collateral","balanceOf","transferable","initialDebtOwnership","debtEntryAtIndex","claims","mints"]}}).then(e=>e.map(({id:e,collateral:t,block:n,timestamp:i,balanceOf:r,transferable:o,initialDebtOwnership:a,debtEntryAtIndex:s,mints:c,claims:u})=>({address:e,block:Number(n),timestamp:Number(1e3*i),date:new Date(1e3*i),collateral:t?t/1e18:null,balanceOf:r?r/1e18:null,transferable:o?o/1e18:null,initialDebtOwnership:a?a/1e27:null,debtEntryAtIndex:s?s/1e27:null,mints:null!==c?+c:0,claims:null!==u?+u:0}))).catch(e=>console.error(e)),rewards:({max:e=100,minBalance:t,maxBalance:n}={})=>o({api:m.snx,max:e,query:{entity:"rewardEscrowHolders",selection:{orderBy:"balanceOf",orderDirection:"desc",where:{balanceOf_gte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,balanceOf_lte:n?`\\"${n+"0".repeat(18)}\\"`:void 0}},properties:["id","balanceOf","vestedBalanceOf"]}}).then(e=>e.map(({id:e,balanceOf:t,vestedBalanceOf:n})=>({address:e,balance:t/1e18,vestedBalanceOf:n/1e18}))).catch(e=>console.error(e)),total:()=>o({api:m.snx,query:{entity:"synthetixes",selection:{where:{id:1}},properties:["issuers","snxHolders"]},max:1}).then(([{issuers:e,snxHolders:t}])=>({issuers:Number(e),snxHolders:Number(t)})).catch(e=>console.error(e)),transfers:({from:e,to:t,max:n=100,minBlock:i,maxBlock:r}={})=>o({api:m.snx,max:n,query:{entity:"transfers",selection:{orderBy:"timestamp",orderDirection:"desc",where:{source:'\\"SNX\\"',from:e?`\\"${e}\\"`:void 0,to:t?`\\"${t}\\"`:void 0,block_gte:i||void 0,block_lte:r||void 0}},properties:["id","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,block:t,timestamp:n,from:i,to:r,value:o})=>({block:Number(t),timestamp:Number(1e3*n),date:new Date(1e3*n),hash:u(e),from:i,to:r,value:o/1e18}))).catch(e=>console.error(e)),feesClaimed:({max:e=100,account:t}={})=>o({api:m.snx,max:e,query:{entity:"feesClaimeds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0}},properties:["id","account","timestamp","block","value","rewards"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r,rewards:o})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,rewards:o/1e18,type:"feesClaimed"}))).catch(e=>console.error(e)),debtSnapshot:({account:e,max:t=100,minBlock:n,maxBlock:i})=>o({api:m.snx,max:t,query:{entity:"debtSnapshots",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:e?`\\"${e}\\"`:void 0,block_gte:n||void 0,block_lte:i||void 0}},properties:["id","timestamp","block","account","balanceOf","collateral","debtBalanceOf"]}}).then(e=>e.map(({id:e,timestamp:t,block:n,account:i,balanceOf:r,collateral:o,debtBalanceOf:a})=>({id:e,timestamp:Number(1e3*t),block:Number(n),account:i,balanceOf:r?r/1e18:null,collateral:o?o/1e18:null,debtBalanceOf:a?a/1e18:null}))).catch(e=>console.error(e))},binaryOptions:{markets:({max:e=100,creator:t,isOpen:n,minTimestamp:i,maxTimestamp:r}={})=>o({api:m.binaryOptions,max:e,query:{entity:"markets",selection:{orderBy:"biddingEndDate",orderDirection:"desc",where:{creator:t?`\\"${t}\\"`:void 0,isOpen:void 0!==n?n:void 0,timestamp_gte:i||void 0,timestamp_lte:r||void 0}},properties:["id","timestamp","creator","currencyKey","strikePrice","biddingEndDate","maturityDate","expiryDate","isOpen","longPrice","shortPrice","poolSize","result"]}}).then(e=>e.map(({id:e,timestamp:t,creator:n,currencyKey:i,strikePrice:r,biddingEndDate:o,maturityDate:a,expiryDate:c,isOpen:u,longPrice:l,shortPrice:d,poolSize:m,result:p})=>({address:e,timestamp:Number(1e3*t),creator:n,currencyKey:s(i),strikePrice:r/1e18,biddingEndDate:1e3*Number(o),maturityDate:1e3*Number(a),expiryDate:1e3*Number(c),isOpen:u,longPrice:l/1e18,shortPrice:d/1e18,poolSize:m/1e18,result:null!==p?0===p?"long":"short":null}))),optionTransactions:({max:e=1/0,market:t,account:n}={})=>o({api:m.binaryOptions,max:e,query:{entity:"optionTransactions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,account:n?`\\"${n}\\"`:void 0}},properties:["id","timestamp","type","account","currencyKey","side","amount","market","fee"]}}).then(e=>e.map(({id:e,timestamp:t,type:n,account:i,currencyKey:r,side:o,amount:a,market:c,fee:l})=>({hash:u(e),timestamp:Number(1e3*t),type:n,account:i,currencyKey:r?s(r):null,side:0===o?"long":"short",amount:a/1e18,market:c,fee:l?l/1e18:null}))),marketsBidOn:({max:e=1/0,account:t}={})=>o({api:m.binaryOptions,max:e,query:{entity:"optionTransactions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{type:"bid",account:t?`\\"${t}\\"`:void 0}},properties:["market"]}}).then(e=>e.map(({market:e})=>e).filter((e,t,n)=>n.indexOf(e)===t)),historicalOptionPrice:({max:e=1/0,market:t,minTimestamp:n,maxTimestamp:i}={})=>o({api:m.binaryOptions,max:e,query:{entity:"historicalOptionPrices",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,timestamp_gte:n||void 0,timestamp_lte:i||void 0}},properties:["id","timestamp","longPrice","shortPrice","poolSize","market"]}}).then(e=>e.map(({id:e,timestamp:t,longPrice:n,shortPrice:i,poolSize:r,market:o})=>({id:e,timestamp:Number(1e3*t),longPrice:n/1e18,shortPrice:i/1e18,poolSize:r/1e18,market:o})))},etherCollateral:{loans:({max:e=1/0,isOpen:t,account:n,collateralMinted:i}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loans",selection:{orderBy:"createdAt",orderDirection:"desc",where:{account:n?`\\"${n}\\"`:void 0,collateralMinted:i?`\\"${i}\\"`:void 0,isOpen:t}},properties:["id","account","amount","isOpen","createdAt","closedAt","txHash","hasPartialLiquidations","collateralMinted"]}}).then(e=>e.map(({id:e,account:t,amount:n,isOpen:i,createdAt:r,closedAt:o,txHash:a,hasPartialLiquidations:s,collateralMinted:c})=>({id:Number(u(e)),account:t,createdAt:new Date(Number(1e3*r)),closedAt:o?new Date(Number(1e3*o)):null,amount:n/1e18,isOpen:i,txHash:a,hasPartialLiquidations:s,collateralMinted:c}))).catch(e=>console.error(e)),partiallyLiquidatedLoans:({max:e=1/0,account:t,loanId:n}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loanPartiallyLiquidateds",selection:{where:{loanId:n?`\\"${n}\\"`:void 0,account:t?`\\"${t}\\"`:void 0}},properties:["account","liquidatedAmount","liquidator","liquidatedCollateral","loanId","id"]}}).then(e=>e.map(({account:e,liquidatedAmount:t,liquidator:n,liquidatedCollateral:i,loanId:r,id:o})=>({loanId:Number(r),txHash:u(o),liquidatedCollateral:i/1e18,penaltyAmount:i/1e18*.1,liquidator:n,liquidatedAmount:t/1e18,account:e}))).catch(e=>console.error(e)),liquidatedLoans:({max:e=1/0,account:t,loanId:n}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loanLiquidateds",selection:{where:{loanId:n?`\\"${n}\\"`:void 0,account:t?`\\"${t}\\"`:void 0}},properties:["account","liquidator","loanId","id","timestamp"]}}).then(e=>e.map(({account:e,liquidator:t,loanId:n,id:i,timestamp:r})=>({loanId:Number(n),txHash:u(i),liquidator:t,account:e,timestamp:new Date(Number(1e3*r))}))).catch(e=>console.error(e))},limitOrders:{orders:({max:e=1/0,account:t}={})=>o({api:m.limitOrders,max:e,query:{entity:"limitOrders",selection:{orderBy:"timestamp",orderDirection:"desc",where:{submitter:t?`\\"${t}\\"`:void 0}},properties:["id","hash","timestamp","submitter","sourceCurrencyKey","sourceAmount","destinationCurrencyKey","minDestinationAmount","executionFee","deposit","status"]}}).then(e=>e.map(({id:e,hash:t,timestamp:n,submitter:i,sourceCurrencyKey:r,sourceAmount:o,destinationCurrencyKey:a,minDestinationAmount:c,executionFee:u,deposit:l,status:d})=>({id:Number(e),hash:t,timestamp:Number(1e3*n),account:i,sourceCurrencyKey:s(r),sourceAmount:o/1e18,destinationCurrencyKey:s(a),minDestinationAmount:c/1e18,executionFee:u/1e18,deposit:l/1e18,status:d}))).catch(e=>console.error(e))},exchanger:{exchangeEntriesSettled:({max:e=100,from:t}={})=>o({api:m.exchanger,max:e,query:{entity:"exchangeEntrySettleds",selection:{orderBy:"exchangeTimestamp",orderDirection:"desc",where:{from:t?`\\"${t}\\"`:void 0}},properties:["id","from","src","amount","dest","reclaim","rebate","srcRoundIdAtPeriodEnd","destRoundIdAtPeriodEnd","exchangeTimestamp"]}}).then(e=>e.map(({id:e,from:t,src:n,amount:i,dest:r,reclaim:o,rebate:a,srcRoundIdAtPeriodEnd:c,destRoundIdAtPeriodEnd:l,exchangeTimestamp:d})=>({hash:u(e),from:t,src:s(n),amount:i/1e18,dest:s(r),reclaim:o/1e18,rebate:a/1e18,srcRoundIdAtPeriodEnd:c/1e18,destRoundIdAtPeriodEnd:l/1e18,exchangeTimestamp:Number(1e3*d)}))).catch(e=>console.error(e))},liquidations:{accountsFlaggedForLiquidation:({maxTime:e=Math.round((Date.now()+2592e5)/1e3),minTime:t=Math.round((Date.now()-23328e5)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountFlaggedForLiquidations",selection:{orderBy:"deadline",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,deadline_gte:c(t)||void 0,deadline_lte:c(e)||void 0}},properties:["id","deadline","account","collateral","collateralRatio","liquidatableNonEscrowSNX"]}}).then(e=>e.map(({id:e,deadline:t,account:n,collateralRatio:i,liquidatableNonEscrowSNX:r,collateral:o})=>({id:e,deadline:Number(1e3*t),account:n,collateral:o/1e18,collateralRatio:i/1e18,liquidatableNonEscrowSNX:r/1e18}))),accountsRemovedFromLiquidation:({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountRemovedFromLiquidations",selection:{orderBy:"time",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,time_gte:c(t)||void 0,time_lte:c(e)||void 0}},properties:["id","time","account"]}}).then(e=>e.map(({id:e,time:t,account:n})=>({id:e,time:Number(1e3*t),account:n}))),accountsLiquidated:({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountLiquidateds",selection:{orderBy:"time",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,time_gte:c(t)||void 0,time_lte:c(e)||void 0}},properties:["id","time","account","liquidator","amountLiquidated","snxRedeemed"]}}).then(e=>e.map(({id:e,time:t,account:n,amountLiquidated:i,snxRedeemed:r,liquidator:o})=>({id:e,hash:u(e),time:Number(1e3*t),account:n,liquidator:o,amountLiquidated:i/1e18,snxRedeemed:r/1e18}))),getActiveLiquidations({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={}){return this.accountsFlaggedForLiquidation({account:n,max:i,maxTime:e+Math.round(259200),minTime:t+Math.round(259200)}).then(r=>this.accountsRemovedFromLiquidation({account:n,max:i,maxTime:e,minTime:t}).then(e=>r.reduce((t,n)=>(-1===e.findIndex(e=>e.account===n.account)&&t.push(n),t),[])))}}}},function(e,t){var n;n="undefined"!=typeof WebSocket?WebSocket:"undefined"!=typeof MozWebSocket?MozWebSocket:window.WebSocket||window.MozWebSocket,e.exports=n},function(e,t,n){"use strict";(function(e){var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=void 0!==e?e:"undefined"!=typeof window?window:{},s=a.WebSocket||a.MozWebSocket,c=n(5),u=n(6),l=n(7),d=n(8),m=n(16),p=n(17),f=n(9),h=n(11),y=n(12),v=n(13),b=function(){function e(e,t,n,i){var r=t||{},o=r.connectionCallback,a=void 0===o?void 0:o,l=r.connectionParams,d=void 0===l?{}:l,m=r.timeout,p=void 0===m?y.WS_TIMEOUT:m,f=r.reconnect,v=void 0!==f&&f,b=r.reconnectionAttempts,x=void 0===b?1/0:b,g=r.lazy,T=void 0!==g&&g,E=r.inactivityTimeout,O=void 0===E?0:E;if(this.wsImpl=n||s,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=i||h.GRAPHQL_WS,this.connectionCallback=a,this.url=e,this.operations={},this.nextOperationId=0,this.wsTimeout=p,this.unsentMessagesQueue=[],this.reconnect=v,this.reconnecting=!1,this.reconnectionAttempts=x,this.lazy=!!T,this.inactivityTimeout=O,this.closedByUser=!1,this.backoff=new c({jitter:.5}),this.eventEmitter=new u.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(d),this.lazy||this.connect()}return Object.defineProperty(e.prototype,"status",{get:function(){return null===this.client?this.wsImpl.CLOSED:this.client.readyState},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this.clearInactivityTimeout(),null!==this.client&&(this.closedByUser=t,e&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,v.default.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client=null,this.eventEmitter.emit("disconnected"),e||this.tryReconnect())},e.prototype.request=function(e){var t,n,i=this.getObserver.bind(this),r=this.executeOperation.bind(this),o=this.unsubscribe.bind(this);return this.clearInactivityTimeout(),(t={})[f.default]=function(){return this},t.subscribe=function(t,a,s){var c=i(t,a,s);return n=r(e,(function(e,t){null===e&&null===t?c.complete&&c.complete():e?c.error&&c.error(e[0]):c.next&&c.next(t)})),{unsubscribe:function(){n&&(o(n),n=null)}}},t},e.prototype.on=function(e,t,n){var i=this.eventEmitter.on(e,t,n);return function(){i.off(e,t,n)}},e.prototype.onConnected=function(e,t){return this.on("connected",e,t)},e.prototype.onConnecting=function(e,t){return this.on("connecting",e,t)},e.prototype.onDisconnected=function(e,t){return this.on("disconnected",e,t)},e.prototype.onReconnected=function(e,t){return this.on("reconnected",e,t)},e.prototype.onReconnecting=function(e,t){return this.on("reconnecting",e,t)},e.prototype.onError=function(e,t){return this.on("error",e,t)},e.prototype.unsubscribeAll=function(){var e=this;Object.keys(this.operations).forEach((function(t){e.unsubscribe(t)}))},e.prototype.applyMiddlewares=function(e){var t=this;return new Promise((function(n,i){var r,o,a;r=t.middlewares.slice(),o=t,(a=function(t){if(t)i(t);else if(r.length>0){var s=r.shift();s&&s.applyMiddleware.apply(o,[e,a])}else n(e)})()}))},e.prototype.use=function(e){var t=this;return e.map((function(e){if("function"!=typeof e.applyMiddleware)throw new Error("Middleware must implement the applyMiddleware function.");t.middlewares.push(e)})),this},e.prototype.getConnectionParams=function(e){return function(){return new Promise((function(t,n){if("function"==typeof e)try{return t(e.call(null))}catch(e){return n(e)}t(e)}))}},e.prototype.executeOperation=function(e,t){var n=this;null===this.client&&this.connect();var i=this.generateOperationId();return this.operations[i]={options:e,handler:t},this.applyMiddlewares(e).then((function(e){n.checkOperationOptions(e,t),n.operations[i]&&(n.operations[i]={options:e,handler:t},n.sendMessage(i,v.default.GQL_START,e))})).catch((function(e){n.unsubscribe(i),t(n.formatErrors(e))})),i},e.prototype.getObserver=function(e,t,n){return"function"==typeof e?{next:function(t){return e(t)},error:function(e){return t&&t(e)},complete:function(){return n&&n()}}:e},e.prototype.createMaxConnectTimeGenerator=function(){var e=this.wsTimeout;return new c({min:1e3,max:e,factor:1.2})},e.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},e.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},e.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},e.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},e.prototype.setInactivityTimeout=function(){var e=this;this.inactivityTimeout>0&&0===Object.keys(this.operations).length&&(this.inactivityTimeoutId=setTimeout((function(){0===Object.keys(e.operations).length&&e.close()}),this.inactivityTimeout))},e.prototype.checkOperationOptions=function(e,t){var n=e.query,i=e.variables,r=e.operationName;if(!n)throw new Error("Must provide a query.");if(!t)throw new Error("Must provide an handler.");if(!l.default(n)&&!p.getOperationAST(n,r)||r&&!l.default(r)||i&&!d.default(i))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},e.prototype.buildMessage=function(e,t,n){return{id:e,type:t,payload:n&&n.query?i({},n,{query:"string"==typeof n.query?n.query:m.print(n.query)}):n}},e.prototype.formatErrors=function(e){return Array.isArray(e)?e:e&&e.errors?this.formatErrors(e.errors):e&&e.message?[e]:[{name:"FormatedError",message:"Unknown error",originalError:e}]},e.prototype.sendMessage=function(e,t,n){this.sendMessageRaw(this.buildMessage(e,t,n))},e.prototype.sendMessageRaw=function(e){switch(this.status){case this.wsImpl.OPEN:var t=JSON.stringify(e);try{JSON.parse(t)}catch(t){this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+e))}this.client.send(t);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(e);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(e)))}},e.prototype.generateOperationId=function(){return String(++this.nextOperationId)},e.prototype.tryReconnect=function(){var e=this;if(this.reconnect&&!(this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach((function(t){e.unsentMessagesQueue.push(e.buildMessage(t,v.default.GQL_START,e.operations[t].options))})),this.reconnecting=!0),this.clearTryReconnectTimeout();var t=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout((function(){e.connect()}),t)}},e.prototype.flushUnsentMessagesQueue=function(){var e=this;this.unsentMessagesQueue.forEach((function(t){e.sendMessageRaw(t)})),this.unsentMessagesQueue=[]},e.prototype.checkConnection=function(){this.wasKeepAliveReceived?this.wasKeepAliveReceived=!1:this.reconnecting||this.close(!1,!0)},e.prototype.checkMaxConnectTimeout=function(){var e=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout((function(){e.status!==e.wsImpl.OPEN&&(e.reconnecting=!0,e.close(!1,!0))}),this.maxConnectTimeGenerator.duration())},e.prototype.connect=function(){var e=this;this.client=new this.wsImpl(this.url,this.wsProtocols),this.checkMaxConnectTimeout(),this.client.onopen=function(){return r(e,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return e=n.sent(),this.sendMessage(void 0,v.default.GQL_CONNECTION_INIT,e),this.flushUnsentMessagesQueue(),[3,4];case 3:return t=n.sent(),this.sendMessage(void 0,v.default.GQL_CONNECTION_ERROR,t),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}}))}))},this.client.onclose=function(){e.closedByUser||e.close(!1,!1)},this.client.onerror=function(t){e.eventEmitter.emit("error",t)},this.client.onmessage=function(t){var n=t.data;e.processReceivedData(n)}},e.prototype.processReceivedData=function(e){var t,n;try{n=(t=JSON.parse(e)).id}catch(t){throw new Error("Message must be JSON-parseable. Got: "+e)}if(-1===[v.default.GQL_DATA,v.default.GQL_COMPLETE,v.default.GQL_ERROR].indexOf(t.type)||this.operations[n])switch(t.type){case v.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(t.payload);break;case v.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected"),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case v.default.GQL_COMPLETE:this.operations[n].handler(null,null),delete this.operations[n];break;case v.default.GQL_ERROR:this.operations[n].handler(this.formatErrors(t.payload),null),delete this.operations[n];break;case v.default.GQL_DATA:var r=t.payload.errors?i({},t.payload,{errors:this.formatErrors(t.payload.errors)}):t.payload;this.operations[n].handler(null,r);break;case v.default.GQL_CONNECTION_KEEP_ALIVE:var o=void 0===this.wasKeepAliveReceived;this.wasKeepAliveReceived=!0,o&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}else this.unsubscribe(n)},e.prototype.unsubscribe=function(e){this.operations[e]&&(delete this.operations[e],this.setInactivityTimeout(),this.sendMessage(e,v.default.GQL_STOP,void 0))},e}();t.SubscriptionClient=b}).call(this,n(0))},function(e,t){function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";var i=Object.prototype.hasOwnProperty,r="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(r=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},u.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var m,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,i);break;default:if(!c)for(m=1,c=new Array(d-1);m<d;m++)c[m-1]=arguments[m];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return c(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||c(this,o);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==t||i&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[o]=1===u.length?u[0]:u:c(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&c(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"string"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){"use strict";n.r(t),function(e,i){var r,o=n(1);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var a=Object(o.a)(r);t.default=a}.call(this,n(0),n(10)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.GRAPHQL_WS="graphql-ws";t.GRAPHQL_SUBSCRIPTIONS="graphql-subscriptions"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WS_TIMEOUT=3e4},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){throw new Error("Static Class")}return e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_CONNECTION_TERMINATE="connection_terminate",e.GQL_START="start",e.GQL_DATA="data",e.GQL_ERROR="error",e.GQL_COMPLETE="complete",e.GQL_STOP="stop",e.SUBSCRIPTION_START="subscription_start",e.SUBSCRIPTION_DATA="subscription_data",e.SUBSCRIPTION_SUCCESS="subscription_success",e.SUBSCRIPTION_FAIL="subscription_fail",e.SUBSCRIPTION_END="subscription_end",e.INIT="init",e.INIT_SUCCESS="init_success",e.INIT_FAIL="init_fail",e.KEEP_ALIVE="keepalive",e}();t.default=i},function(e,t,n){window,e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";(function(t){const i=n(2);e.exports=({api:e,query:{entity:n,selection:r={},properties:o=[]},timeout:a=1e4,max:s=1/0})=>{s=Number(s);const c=({skip:u})=>{const l=e=>Object.entries(e).filter(([,e])=>void 0!==e).map(([e,t])=>`${e}:${"object"==typeof t?"{"+l(t)+"}":t}`).join(","),d=u+1e3>s?s%1e3:1e3,m=Object.assign({},r,{first:d,skip:u}),p=`{"query":"{${n}(${l(m)}){${o.join(",")}}}", "variables": null}`;return"object"==typeof t&&"true"===t.env.DEBUG&&console.log(p),i(e,{method:"POST",body:p,timeout:a}).then(e=>e.json()).then(e=>{if(e.errors)throw Error(JSON.stringify(e.errors));const{data:{[n]:t}}=e;return t.length<1e3||Math.min(s,u+t.length)>=s?t:c({skip:u+1e3}).then(e=>t.concat(e))})};return c({skip:0})}}).call(this,n(1))},function(e,t){var n,i,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var c,u=[],l=!1,d=-1;function m(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&p())}function p(){if(!l){var e=s(m);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||l||s(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();e.exports=t=i.fetch,i.fetch&&(t.default=i.fetch.bind(i)),t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response}])},function(e,t){const n="0x"+"0".repeat(40);e.exports={ZERO_ADDRESS:n,hexToAscii:e=>{const t=e.toString();let n="";for(let e=2;e<t.length;e+=2){const i=t.substr(e,2);"00"!==i&&(n+=String.fromCharCode(parseInt(i,16)))}return n},roundTimestampTenSeconds:e=>10*Math.round(e/10),getHashFromId:e=>e.split("-")[0],formatGQLArray:e=>"["+e.map(e=>`\\"${e}\\"`).join(",")+"]",formatGQLString:e=>`\\"${e}\\"`}},function(e,t,n){"use strict";n.r(t);var i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e){return a(e,[])}function a(e,t){switch(r(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(i)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var o=r.call(e);if(o!==e)return"string"==typeof o?o:a(o,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>2)return"[Array]";for(var n=Math.min(10,e.length),i=e.length-n,r=[],o=0;o<n;++o)r.push(a(e[o],t));1===i?r.push("... 1 more item"):i>1&&r.push("... ".concat(i," more items"));return"["+r.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>2)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+a(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}var s={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},c=Object.freeze({});function u(e){return Boolean(e&&"string"==typeof e.kind)}function l(e,t,n){var i=e[t];if(i){if(!n&&"function"==typeof i)return i;var r=n?i.leave:i.enter;if("function"==typeof r)return r}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var a=o[t];if("function"==typeof a)return a}}}function d(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:s,i=void 0,r=Array.isArray(e),a=[e],d=-1,m=[],p=void 0,f=void 0,h=void 0,y=[],v=[],b=e;do{var x=++d===a.length,g=x&&0!==m.length;if(x){if(f=0===v.length?void 0:y[y.length-1],p=h,h=v.pop(),g){if(r)p=p.slice();else{for(var T={},E=0,O=Object.keys(p);E<O.length;E++){var I=O[E];T[I]=p[I]}p=T}for(var N=0,_=0;_<m.length;_++){var w=m[_][0],D=m[_][1];r&&(w-=N),r&&null===D?(p.splice(w,1),N++):p[w]=D}}d=i.index,a=i.keys,m=i.edits,r=i.inArray,i=i.prev}else{if(f=h?r?d:a[d]:void 0,null==(p=h?h[f]:b))continue;h&&y.push(f)}var S=void 0;if(!Array.isArray(p)){if(!u(p))throw new Error("Invalid AST Node: "+o(p));var k=l(t,p.kind,x);if(k){if((S=k.call(t,p,f,h,y,v))===c)break;if(!1===S){if(!x){y.pop();continue}}else if(void 0!==S&&(m.push([f,S]),!x)){if(!u(S)){y.pop();continue}p=S}}}void 0===S&&g&&m.push([f,p]),x?y.pop():(i={inArray:r,index:d,keys:a,edits:m,prev:i},a=(r=Array.isArray(p))?p:n[p.kind]||[],d=-1,m=[],h&&v.push(h),h=p)}while(void 0!==i);return 0!==m.length&&(b=m[m.length-1][1]),b}(e,{leave:m})}n.d(t,"print",(function(){return d}));var m={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return f(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,i=y("(",f(e.variableDefinitions,", "),")"),r=f(e.directives," "),o=e.selectionSet;return n||r||i||"query"!==t?f([t,f([n,i]),r,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,r=e.directives;return t+": "+n+y(" = ",i)+y(" ",f(r," "))},SelectionSet:function(e){return h(e.selections)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,r=e.directives,o=e.selectionSet;return f([y("",t,": ")+n+y("(",f(i,", "),")"),f(r," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+y(" ",f(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return f(["...",y("on ",t),f(n," "),i]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,i=e.variableDefinitions,r=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(y("(",f(i,", "),")")," ")+"on ".concat(n," ").concat(y("",f(r," ")," "))+o},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=-1===e.indexOf("\n"),r=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!i||o||n,s="";return!a||i&&r||(s+="\n"+t),s+=t?e.replace(/\n/g,"\n"+t):e,a&&(s+="\n"),'"""'+s.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+f(e.values,", ")+"]"},ObjectValue:function(e){return"{"+f(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+y("(",f(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:function(e){var t=e.directives,n=e.operationTypes;return f(["schema",f(t," "),h(n)]," ")},OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:p((function(e){return f(["scalar",e.name,f(e.directives," ")]," ")})),ObjectTypeDefinition:p((function(e){var t=e.name,n=e.interfaces,i=e.directives,r=e.fields;return f(["type",t,y("implements ",f(n," & ")),f(i," "),h(r)]," ")})),FieldDefinition:p((function(e){var t=e.name,n=e.arguments,i=e.type,r=e.directives;return t+(x(n)?y("(\n",v(f(n,"\n")),"\n)"):y("(",f(n,", "),")"))+": "+i+y(" ",f(r," "))})),InputValueDefinition:p((function(e){var t=e.name,n=e.type,i=e.defaultValue,r=e.directives;return f([t+": "+n,y("= ",i),f(r," ")]," ")})),InterfaceTypeDefinition:p((function(e){var t=e.name,n=e.directives,i=e.fields;return f(["interface",t,f(n," "),h(i)]," ")})),UnionTypeDefinition:p((function(e){var t=e.name,n=e.directives,i=e.types;return f(["union",t,f(n," "),i&&0!==i.length?"= "+f(i," | "):""]," ")})),EnumTypeDefinition:p((function(e){var t=e.name,n=e.directives,i=e.values;return f(["enum",t,f(n," "),h(i)]," ")})),EnumValueDefinition:p((function(e){return f([e.name,f(e.directives," ")]," ")})),InputObjectTypeDefinition:p((function(e){var t=e.name,n=e.directives,i=e.fields;return f(["input",t,f(n," "),h(i)]," ")})),DirectiveDefinition:p((function(e){var t=e.name,n=e.arguments,i=e.repeatable,r=e.locations;return"directive @"+t+(x(n)?y("(\n",v(f(n,"\n")),"\n)"):y("(",f(n,", "),")"))+(i?" repeatable":"")+" on "+f(r," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return f(["extend schema",f(t," "),h(n)]," ")},ScalarTypeExtension:function(e){return f(["extend scalar",e.name,f(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,r=e.fields;return f(["extend type",t,y("implements ",f(n," & ")),f(i," "),h(r)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return f(["extend interface",t,f(n," "),h(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return f(["extend union",t,f(n," "),i&&0!==i.length?"= "+f(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return f(["extend enum",t,f(n," "),h(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return f(["extend input",t,f(n," "),h(i)]," ")}};function p(e){return function(t){return f([t.description,e(t)],"\n")}}function f(e,t){return e?e.filter((function(e){return e})).join(t||""):""}function h(e){return e&&0!==e.length?"{\n"+v(f(e,"\n"))+"\n}":""}function y(e,t,n){return t?e+t+(n||""):""}function v(e){return e&&" "+e.replace(/\n/g,"\n ")}function b(e){return-1!==e.indexOf("\n")}function x(e){return e&&e.some(b)}},function(e,t,n){"use strict";n.r(t);var i=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function r(e,t){for(var n=null,r=0,o=e.definitions;r<o.length;r++){var a=o[r];if(a.kind===i.OPERATION_DEFINITION)if(t){if(a.name&&a.name.value===t)return a}else{if(n)return null;n=a}}return n}n.d(t,"getOperationAST",(function(){return r}))}])}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snxData=t():e.snxData=t()}(window,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";function i(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";const i=n(3),{SubscriptionClient:r}=n(4),o=n(14),{ZERO_ADDRESS:a,hexToAscii:s,roundTimestampTenSeconds:c,getHashFromId:u,formatGQLArray:l,formatGQLString:d}=n(15),m={snx:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix",depot:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-depot",exchanges:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",rates:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates",binaryOptions:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-binary-options",etherCollateral:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-loans",limitOrders:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-limit-orders",exchanger:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanger",liquidations:"https://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-liquidations"},p="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",f="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates";e.exports={pageResults:o,graphAPIEndpoints:m,depot:{userActions:({network:e="mainnet",user:t,max:n=100})=>o({api:m.depot,query:{entity:"userActions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,user:t?`\\"${t}\\"`:void 0}},properties:["id","user","amount","minimum","depositIndex","type","block","timestamp"]},max:n}).then(e=>e.map(({id:e,user:t,amount:n,type:i,minimum:r,depositIndex:o,block:a,timestamp:s})=>({hash:u(e),user:t,amount:n/1e18,type:i,minimum:null!==r?Number(r):null,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).catch(e=>console.log(e)),clearedDeposits:({network:e="mainnet",fromAddress:t,toAddress:n,max:i=100})=>o({api:m.depot,query:{entity:"clearedDeposits",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,fromAddress:t?`\\"${t}\\"`:void 0,toAddress:n?`\\"${n}\\"`:void 0}},properties:["id","fromAddress","toAddress","fromETHAmount","toAmount","depositIndex","block","timestamp"]},max:i}).then(e=>e.map(({id:e,fromAddress:t,toAddress:n,fromETHAmount:i,toAmount:r,depositIndex:o,block:a,timestamp:s})=>({hash:u(e),fromAddress:t,toAddress:n,fromETHAmount:i/1e18,toAmount:r/1e18,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s),type:"cleared"}))).catch(e=>console.error(e)),exchanges:({network:e="mainnet",from:t,max:n=100})=>o({api:m.depot,query:{entity:"exchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${e}\\"`,from:t?`\\"${t}\\"`:void 0}},properties:["id","from","fromCurrency","fromAmount","toCurrency","toAmount","block","timestamp"]},max:n}).then(e=>e.map(({id:e,from:t,fromAmount:n,fromCurrency:i,toAmount:r,toCurrency:o,block:a,timestamp:s})=>({hash:u(e),from:t,fromAmount:n/1e18,fromCurrency:i,toAmount:r/1e18,toCurrency:o,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s),type:"bought"}))).catch(e=>console.error(e))},exchanges:{_properties:["id","from","gasPrice","from","fromAmount","fromAmountInUSD","fromCurrencyKey","toCurrencyKey","toAddress","toAmount","toAmountInUSD","feesInUSD","block","timestamp"],_mapSynthExchange:({gasPrice:e,timestamp:t,id:n,from:i,fromAmount:r,block:o,fromAmountInUSD:a,fromCurrencyKey:c,toAddress:l,toAmount:d,toAmountInUSD:m,toCurrencyKey:p,feesInUSD:f})=>({gasPrice:e/1e9,block:Number(o),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:u(n),fromAddress:i,fromAmount:r/1e18,fromCurrencyKeyBytes:c,fromCurrencyKey:s(c),fromAmountInUSD:a/1e18,toAmount:d/1e18,toAmountInUSD:m/1e18,toCurrencyKeyBytes:p,toCurrencyKey:s(p),toAddress:l,feesInUSD:f/1e18}),total:({network:e="mainnet"}={})=>o({api:m.exchanges,query:{entity:"totals",selection:{where:{id:`\\"${e}\\"`}},properties:["trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]},max:1}).then(([{exchangers:e,exchangeUSDTally:t,totalFeesGeneratedInUSD:n,trades:i}])=>({trades:Number(i),exchangers:Number(e),exchangeUSDTally:t/1e18,totalFeesGeneratedInUSD:n/1e18})).catch(e=>console.error(e)),aggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:m.exchanges,max:t,query:{entity:`${{"1d":"dailyTotals","15m":"fifteenMinuteTotals"}[e]}`,selection:{orderBy:"id",orderDirection:"desc"},properties:["id","trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]}}).then(e=>e.map(({id:e,trades:t,exchangers:n,exchangeUSDTally:i,totalFeesGeneratedInUSD:r})=>({id:e,trades:Number(t),exchangers:Number(n),exchangeUSDTally:i/1e18,totalFeesGeneratedInUSD:r/1e18}))).catch(e=>console.error(e)),since:({network:t="mainnet",max:n=1/0,minTimestamp:i,maxTimestamp:r,minBlock:a,maxBlock:s,fromAddress:u}={})=>o({api:m.exchanges,max:n,query:{entity:"synthExchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${t}\\"`,timestamp_gte:c(i)||void 0,timestamp_lte:c(r)||void 0,block_gte:a||void 0,block_lte:s||void 0,from:u?`\\"${u}\\"`:void 0}},properties:e.exports.exchanges._properties}}).then(t=>t.map(e.exports.exchanges._mapSynthExchange)).catch(e=>console.error(e)),_rebateOrReclaim:({isReclaim:e})=>({account:t,max:n=1/0,minTimestamp:i,maxTimestamp:r,minBlock:a,maxBlock:c}={})=>o({api:m.exchanges,max:n,query:{entity:`exchange${e?"Reclaim":"Rebate"}s`,selection:{orderBy:"timestamp",orderDirection:"desc",where:{timestamp_gte:i||void 0,timestamp_lte:r||void 0,block_gte:a||void 0,block_lte:c||void 0,account:t?`\\"${t}\\"`:void 0}},properties:["id","amount","amountInUSD","currencyKey","account","timestamp","block","gasPrice"]}}).then(e=>e.map(({gasPrice:e,timestamp:t,id:n,account:i,block:r,currencyKey:o,amount:a,amountInUSD:c})=>({gasPrice:e/1e9,block:Number(r),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:u(n),account:i,amount:a/1e18,amountInUSD:c/1e18,currencyKey:s(o),currencyKeyBytes:o}))).catch(e=>console.error(e)),reclaims(e){return this._rebateOrReclaim({isReclaim:!0})(e)},rebates(e){return this._rebateOrReclaim({isReclaim:!1})(e)},observe(){const t=new r(p,{reconnect:!0},i).request({query:`subscription { synthExchanges(first: 1, orderBy: timestamp, orderDirection: desc) { ${e.exports.exchanges._properties.join(",")} } }`});return{subscribe:({next:n,error:i,complete:r})=>t.subscribe({next({data:{synthExchanges:t}}){t.map(e.exports.exchanges._mapSynthExchange).forEach(n)},error:i,complete:r})}}},synths:{issuers:({max:e=10}={})=>o({api:m.snx,max:e,query:{entity:"issuers",properties:["id"]}}).then(e=>e.map(({id:e})=>e)).catch(e=>console.error(e)),transfers:({synth:e,from:t,to:n,max:i=100,minBlock:r,maxBlock:s}={})=>o({api:m.snx,max:i,query:{entity:"transfers",selection:{orderBy:"timestamp",orderDirection:"desc",where:{source:e?`\\"${e}\\"`:void 0,source_not:'\\"SNX\\"',from:t?`\\"${t}\\"`:void 0,to:n?`\\"${n}\\"`:void 0,from_not:`\\"${a}\\"`,to_not:`\\"${a}\\"`,block_gte:r||void 0,block_lte:s||void 0}},properties:["id","source","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,source:t,block:n,timestamp:i,from:r,to:o,value:a})=>({source:t,block:Number(n),timestamp:Number(1e3*i),date:new Date(1e3*i),hash:u(e),from:r,to:o,value:a/1e18}))).catch(e=>console.error(e)),holders:({max:e=100,synth:t,address:n}={})=>o({api:m.snx,max:e,query:{entity:"synthHolders",selection:{orderBy:"balanceOf",orderDirection:"desc",where:{id:n&&t?`\\"${n+"-"+t}\\"`:void 0,synth:t?`\\"${t}\\"`:void 0}},properties:["id","balanceOf","synth"]}}).then(e=>e.map(({id:e,balanceOf:t,synth:n})=>({address:u(e),balanceOf:t?t/1e18:null,synth:n}))).catch(e=>console.error(e))},rate:{snxAggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:m.rates,max:t,query:{entity:`${{"1d":"dailySNXPrices","15m":"fifteenMinuteSNXPrices"}[e]}`,selection:{orderBy:"id",orderDirection:"desc"},properties:["id","averagePrice"]}}).then(e=>e.map(({id:e,averagePrice:t})=>({id:e,averagePrice:t/1e18}))).catch(e=>console.error(e)),updates({synth:e,minBlock:t,maxBlock:n,minTimestamp:i,maxTimestamp:r,max:a=100}={}){let s={};return s=Array.isArray(e)?{synth_in:l(e)}:e?{synth:d(e)}:{synth_not_in:l(["SNX","ETH","XDR"])},o({api:m.rates,max:a,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{...s,block_gte:t||void 0,block_lte:n||void 0,timestamp_gte:c(i)||void 0,timestamp_lte:c(r)||void 0}},properties:["id","synth","rate","block","timestamp"]}}).then(e=>e.map(({id:e,rate:t,block:n,timestamp:i,synth:r})=>({block:Number(n),synth:r,timestamp:Number(1e3*i),date:new Date(1e3*i),hash:u(e),rate:t/1e18}))).catch(e=>console.error(e))},dailyRateChange({synths:e=[],max:t=100,fromBlock:n}){const i=["XDR","XDRB","nUSD","sUSD"];return o({api:m.rates,max:t,query:{selection:{block:{number:Number(n)}},entity:"latestRates",properties:["id","rate"]}}).then(r=>{const a=r.reduce((t,n)=>(!i.includes(n.id)&&(0===e.length||e.length>0&&e.includes(n.id))&&(t[n.id]={currentRate:n.rate}),t),{}),s=Number(n)-5760;return o({api:m.rates,max:t,query:{selection:{block:{number:s}},entity:"latestRates",properties:["id","rate"]}}).then(e=>(e.forEach(e=>{a[e.id]&&(a[e.id].dayOldRate=e.rate,a[e.id]["24HRChange"]=a[e.id].currentRate/e.rate-1)}),a))}).catch(e=>console.error(e))},observe({minTimestamp:e=Math.round(Date.now()/1e3)}={}){const t=new r(f,{reconnect:!0},i).request({query:`subscription { rateUpdates(where: { timestamp_gt: ${e}}, orderBy: timestamp, orderDirection: desc) { ${["id","synth","rate","block","timestamp"].join(",")} } }`});return{subscribe:({next:e,error:n,complete:i})=>t.subscribe({next({data:{rateUpdates:t}}){t.forEach(e)},error:n,complete:i})}}},snx:{issued:({max:e=100,account:t,minBlock:n}={})=>o({api:m.snx,max:e,query:{entity:"issueds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0,block_gte:n||void 0}},properties:["id","account","timestamp","block","value"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,type:"issued"}))).catch(e=>console.error(e)),dailyIssued:({max:e=100,minTimestamp:t}={})=>o({api:m.snx,max:e,query:{entity:"dailyIssueds",selection:{orderBy:"id",orderDirection:"desc",where:{id_gte:t?Math.floor(t/86400):void 0}},properties:["id","value","totalDebt"]}}).then(e=>e.map(({id:e,totalDebt:t,value:n})=>({timestamp:86400*e,value:n/1e18,totalDebt:t/1e18,type:"issued"}))).catch(e=>console.error(e)),burned:({max:e=100,account:t,minBlock:n}={})=>o({api:m.snx,max:e,query:{entity:"burneds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0,block_gte:n||void 0}},properties:["id","account","timestamp","block","value"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,type:"burned"}))).catch(e=>console.error(e)),dailyBurned:({max:e=100,minTimestamp:t}={})=>o({api:m.snx,max:e,query:{entity:"dailyBurneds",selection:{orderBy:"id",orderDirection:"desc",where:{id_gte:t?Math.floor(t/86400):void 0}},properties:["id","value","totalDebt"]}}).then(e=>e.map(({id:e,totalDebt:t,value:n})=>({timestamp:86400*e,value:n/1e18,totalDebt:t/1e18,type:"burned"}))).catch(e=>console.error(e)),aggregateActiveStakers:({max:e=30}={})=>o({api:m.snx,max:e,query:{entity:"totalDailyActiveStakers",selection:{orderBy:"id",orderDirection:"desc"},properties:["id","count"]}}).catch(e=>console.error(e)),totalActiveStakers:()=>o({api:m.snx,max:1,query:{entity:"totalActiveStakers",properties:["count"]}}).then(([{count:e}])=>({count:e})).catch(e=>console.error(e)),holders:({max:e=100,maxCollateral:t,minCollateral:n,address:i,minMints:r,minClaims:a}={})=>o({api:m.snx,max:e,query:{entity:"snxholders",selection:{orderBy:"collateral",orderDirection:"desc",where:{id:i?`\\"${i.toLowerCase()}\\"`:void 0,collateral_lte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,collateral_gte:n?`\\"${n+"0".repeat(18)}\\"`:void 0,mints_gte:r||void 0,claims_gte:a||void 0}},properties:["id","block","timestamp","collateral","balanceOf","transferable","initialDebtOwnership","debtEntryAtIndex","claims","mints"]}}).then(e=>e.map(({id:e,collateral:t,block:n,timestamp:i,balanceOf:r,transferable:o,initialDebtOwnership:a,debtEntryAtIndex:s,mints:c,claims:u})=>({address:e,block:Number(n),timestamp:Number(1e3*i),date:new Date(1e3*i),collateral:t?t/1e18:null,balanceOf:r?r/1e18:null,transferable:o?o/1e18:null,initialDebtOwnership:a?a/1e27:null,debtEntryAtIndex:s?s/1e27:null,mints:null!==c?+c:0,claims:null!==u?+u:0}))).catch(e=>console.error(e)),rewards:({max:e=100,minBalance:t,maxBalance:n}={})=>o({api:m.snx,max:e,query:{entity:"rewardEscrowHolders",selection:{orderBy:"balanceOf",orderDirection:"desc",where:{balanceOf_gte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,balanceOf_lte:n?`\\"${n+"0".repeat(18)}\\"`:void 0}},properties:["id","balanceOf","vestedBalanceOf"]}}).then(e=>e.map(({id:e,balanceOf:t,vestedBalanceOf:n})=>({address:e,balance:t/1e18,vestedBalanceOf:n/1e18}))).catch(e=>console.error(e)),total:()=>o({api:m.snx,query:{entity:"synthetixes",selection:{where:{id:1}},properties:["issuers","snxHolders"]},max:1}).then(([{issuers:e,snxHolders:t}])=>({issuers:Number(e),snxHolders:Number(t)})).catch(e=>console.error(e)),transfers:({from:e,to:t,max:n=100,minBlock:i,maxBlock:r}={})=>o({api:m.snx,max:n,query:{entity:"transfers",selection:{orderBy:"timestamp",orderDirection:"desc",where:{source:'\\"SNX\\"',from:e?`\\"${e}\\"`:void 0,to:t?`\\"${t}\\"`:void 0,block_gte:i||void 0,block_lte:r||void 0}},properties:["id","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,block:t,timestamp:n,from:i,to:r,value:o})=>({block:Number(t),timestamp:Number(1e3*n),date:new Date(1e3*n),hash:u(e),from:i,to:r,value:o/1e18}))).catch(e=>console.error(e)),feesClaimed:({max:e=100,account:t}={})=>o({api:m.snx,max:e,query:{entity:"feesClaimeds",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:t?`\\"${t}\\"`:void 0}},properties:["id","account","timestamp","block","value","rewards"]}}).then(e=>e.map(({id:e,account:t,timestamp:n,block:i,value:r,rewards:o})=>({hash:u(e),account:t,timestamp:Number(1e3*n),block:Number(i),value:r/1e18,rewards:o/1e18,type:"feesClaimed"}))).catch(e=>console.error(e)),debtSnapshot:({account:e,max:t=100,minBlock:n,maxBlock:i})=>o({api:m.snx,max:t,query:{entity:"debtSnapshots",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:e?`\\"${e}\\"`:void 0,block_gte:n||void 0,block_lte:i||void 0}},properties:["id","timestamp","block","account","balanceOf","collateral","debtBalanceOf"]}}).then(e=>e.map(({id:e,timestamp:t,block:n,account:i,balanceOf:r,collateral:o,debtBalanceOf:a})=>({id:e,timestamp:Number(1e3*t),block:Number(n),account:i,balanceOf:r?r/1e18:null,collateral:o?o/1e18:null,debtBalanceOf:a?a/1e18:null}))).catch(e=>console.error(e))},binaryOptions:{markets:({max:e=100,creator:t,isOpen:n,minTimestamp:i,maxTimestamp:r}={})=>o({api:m.binaryOptions,max:e,query:{entity:"markets",selection:{orderBy:"biddingEndDate",orderDirection:"desc",where:{creator:t?`\\"${t}\\"`:void 0,isOpen:void 0!==n?n:void 0,timestamp_gte:i||void 0,timestamp_lte:r||void 0}},properties:["id","timestamp","creator","currencyKey","strikePrice","biddingEndDate","maturityDate","expiryDate","isOpen","longPrice","shortPrice","poolSize","result"]}}).then(e=>e.map(({id:e,timestamp:t,creator:n,currencyKey:i,strikePrice:r,biddingEndDate:o,maturityDate:a,expiryDate:c,isOpen:u,longPrice:l,shortPrice:d,poolSize:m,result:p})=>({address:e,timestamp:Number(1e3*t),creator:n,currencyKey:s(i),strikePrice:r/1e18,biddingEndDate:1e3*Number(o),maturityDate:1e3*Number(a),expiryDate:1e3*Number(c),isOpen:u,longPrice:l/1e18,shortPrice:d/1e18,poolSize:m/1e18,result:null!==p?0===p?"long":"short":null}))),optionTransactions:({max:e=1/0,market:t,account:n}={})=>o({api:m.binaryOptions,max:e,query:{entity:"optionTransactions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,account:n?`\\"${n}\\"`:void 0}},properties:["id","timestamp","type","account","currencyKey","side","amount","market","fee"]}}).then(e=>e.map(({id:e,timestamp:t,type:n,account:i,currencyKey:r,side:o,amount:a,market:c,fee:l})=>({hash:u(e),timestamp:Number(1e3*t),type:n,account:i,currencyKey:r?s(r):null,side:0===o?"long":"short",amount:a/1e18,market:c,fee:l?l/1e18:null}))),marketsBidOn:({max:e=1/0,account:t}={})=>o({api:m.binaryOptions,max:e,query:{entity:"optionTransactions",selection:{orderBy:"timestamp",orderDirection:"desc",where:{type:"bid",account:t?`\\"${t}\\"`:void 0}},properties:["market"]}}).then(e=>e.map(({market:e})=>e).filter((e,t,n)=>n.indexOf(e)===t)),historicalOptionPrice:({max:e=1/0,market:t,minTimestamp:n,maxTimestamp:i}={})=>o({api:m.binaryOptions,max:e,query:{entity:"historicalOptionPrices",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,timestamp_gte:n||void 0,timestamp_lte:i||void 0}},properties:["id","timestamp","longPrice","shortPrice","poolSize","market"]}}).then(e=>e.map(({id:e,timestamp:t,longPrice:n,shortPrice:i,poolSize:r,market:o})=>({id:e,timestamp:Number(1e3*t),longPrice:n/1e18,shortPrice:i/1e18,poolSize:r/1e18,market:o})))},etherCollateral:{loans:({max:e=1/0,isOpen:t,account:n,collateralMinted:i}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loans",selection:{orderBy:"createdAt",orderDirection:"desc",where:{account:n?`\\"${n}\\"`:void 0,collateralMinted:i?`\\"${i}\\"`:void 0,isOpen:t}},properties:["id","account","amount","isOpen","createdAt","closedAt","txHash","hasPartialLiquidations","collateralMinted"]}}).then(e=>e.map(({id:e,account:t,amount:n,isOpen:i,createdAt:r,closedAt:o,txHash:a,hasPartialLiquidations:s,collateralMinted:c})=>({id:Number(u(e)),account:t,createdAt:new Date(Number(1e3*r)),closedAt:o?new Date(Number(1e3*o)):null,amount:n/1e18,isOpen:i,txHash:a,hasPartialLiquidations:s,collateralMinted:c}))).catch(e=>console.error(e)),partiallyLiquidatedLoans:({max:e=1/0,account:t,loanId:n}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loanPartiallyLiquidateds",selection:{where:{loanId:n?`\\"${n}\\"`:void 0,account:t?`\\"${t}\\"`:void 0}},properties:["account","liquidatedAmount","liquidator","liquidatedCollateral","loanId","id"]}}).then(e=>e.map(({account:e,liquidatedAmount:t,liquidator:n,liquidatedCollateral:i,loanId:r,id:o})=>({loanId:Number(r),txHash:u(o),liquidatedCollateral:i/1e18,penaltyAmount:i/1e18*.1,liquidator:n,liquidatedAmount:t/1e18,account:e}))).catch(e=>console.error(e)),liquidatedLoans:({max:e=1/0,account:t,loanId:n}={})=>o({api:m.etherCollateral,max:e,query:{entity:"loanLiquidateds",selection:{where:{loanId:n?`\\"${n}\\"`:void 0,account:t?`\\"${t}\\"`:void 0}},properties:["account","liquidator","loanId","id","timestamp"]}}).then(e=>e.map(({account:e,liquidator:t,loanId:n,id:i,timestamp:r})=>({loanId:Number(n),txHash:u(i),liquidator:t,account:e,timestamp:new Date(Number(1e3*r))}))).catch(e=>console.error(e))},limitOrders:{orders:({max:e=1/0,account:t}={})=>o({api:m.limitOrders,max:e,query:{entity:"limitOrders",selection:{orderBy:"timestamp",orderDirection:"desc",where:{submitter:t?`\\"${t}\\"`:void 0}},properties:["id","hash","timestamp","submitter","sourceCurrencyKey","sourceAmount","destinationCurrencyKey","minDestinationAmount","executionFee","deposit","status"]}}).then(e=>e.map(({id:e,hash:t,timestamp:n,submitter:i,sourceCurrencyKey:r,sourceAmount:o,destinationCurrencyKey:a,minDestinationAmount:c,executionFee:u,deposit:l,status:d})=>({id:Number(e),hash:t,timestamp:Number(1e3*n),account:i,sourceCurrencyKey:s(r),sourceAmount:o/1e18,destinationCurrencyKey:s(a),minDestinationAmount:c/1e18,executionFee:u/1e18,deposit:l/1e18,status:d}))).catch(e=>console.error(e))},exchanger:{exchangeEntriesSettled:({max:e=100,from:t}={})=>o({api:m.exchanger,max:e,query:{entity:"exchangeEntrySettleds",selection:{orderBy:"exchangeTimestamp",orderDirection:"desc",where:{from:t?`\\"${t}\\"`:void 0}},properties:["id","from","src","amount","dest","reclaim","rebate","srcRoundIdAtPeriodEnd","destRoundIdAtPeriodEnd","exchangeTimestamp"]}}).then(e=>e.map(({id:e,from:t,src:n,amount:i,dest:r,reclaim:o,rebate:a,srcRoundIdAtPeriodEnd:c,destRoundIdAtPeriodEnd:l,exchangeTimestamp:d})=>({hash:u(e),from:t,src:s(n),amount:i/1e18,dest:s(r),reclaim:o/1e18,rebate:a/1e18,srcRoundIdAtPeriodEnd:c/1e18,destRoundIdAtPeriodEnd:l/1e18,exchangeTimestamp:Number(1e3*d)}))).catch(e=>console.error(e))},liquidations:{accountsFlaggedForLiquidation:({maxTime:e=Math.round((Date.now()+2592e5)/1e3),minTime:t=Math.round((Date.now()-23328e5)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountFlaggedForLiquidations",selection:{orderBy:"deadline",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,deadline_gte:c(t)||void 0,deadline_lte:c(e)||void 0}},properties:["id","deadline","account","collateral","collateralRatio","liquidatableNonEscrowSNX"]}}).then(e=>e.map(({id:e,deadline:t,account:n,collateralRatio:i,liquidatableNonEscrowSNX:r,collateral:o})=>({id:e,deadline:Number(1e3*t),account:n,collateral:o/1e18,collateralRatio:i/1e18,liquidatableNonEscrowSNX:r/1e18}))),accountsRemovedFromLiquidation:({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountRemovedFromLiquidations",selection:{orderBy:"time",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,time_gte:c(t)||void 0,time_lte:c(e)||void 0}},properties:["id","time","account"]}}).then(e=>e.map(({id:e,time:t,account:n})=>({id:e,time:Number(1e3*t),account:n}))),accountsLiquidated:({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={})=>o({api:m.liquidations,max:i,query:{entity:"accountLiquidateds",selection:{orderBy:"time",orderDirection:"asc",where:{account:n?`\\"${n}\\"`:void 0,time_gte:c(t)||void 0,time_lte:c(e)||void 0}},properties:["id","time","account","liquidator","amountLiquidated","snxRedeemed"]}}).then(e=>e.map(({id:e,time:t,account:n,amountLiquidated:i,snxRedeemed:r,liquidator:o})=>({id:e,hash:u(e),time:Number(1e3*t),account:n,liquidator:o,amountLiquidated:i/1e18,snxRedeemed:r/1e18}))),getActiveLiquidations({maxTime:e=Math.round(Date.now()/1e3),minTime:t=Math.round((Date.now()-2592e6)/1e3),account:n,max:i=5e3}={}){return this.accountsFlaggedForLiquidation({account:n,max:i,maxTime:e+Math.round(259200),minTime:t+Math.round(259200)}).then(r=>this.accountsRemovedFromLiquidation({account:n,max:i,maxTime:e,minTime:t}).then(e=>r.reduce((t,n)=>(-1===e.findIndex(e=>e.account===n.account)&&t.push(n),t),[])))}}}},function(e,t){var n;n="undefined"!=typeof WebSocket?WebSocket:"undefined"!=typeof MozWebSocket?MozWebSocket:window.WebSocket||window.MozWebSocket,e.exports=n},function(e,t,n){"use strict";(function(e){var i=this&&this.__assign||Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},r=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=(r=a.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};Object.defineProperty(t,"__esModule",{value:!0});var a=void 0!==e?e:"undefined"!=typeof window?window:{},s=a.WebSocket||a.MozWebSocket,c=n(5),u=n(6),l=n(7),d=n(8),m=n(16),p=n(17),f=n(9),h=n(11),y=n(12),v=n(13),b=function(){function e(e,t,n,i){var r=t||{},o=r.connectionCallback,a=void 0===o?void 0:o,l=r.connectionParams,d=void 0===l?{}:l,m=r.timeout,p=void 0===m?y.WS_TIMEOUT:m,f=r.reconnect,v=void 0!==f&&f,b=r.reconnectionAttempts,x=void 0===b?1/0:b,g=r.lazy,T=void 0!==g&&g,E=r.inactivityTimeout,O=void 0===E?0:E;if(this.wsImpl=n||s,!this.wsImpl)throw new Error("Unable to find native implementation, or alternative implementation for WebSocket!");this.wsProtocols=i||h.GRAPHQL_WS,this.connectionCallback=a,this.url=e,this.operations={},this.nextOperationId=0,this.wsTimeout=p,this.unsentMessagesQueue=[],this.reconnect=v,this.reconnecting=!1,this.reconnectionAttempts=x,this.lazy=!!T,this.inactivityTimeout=O,this.closedByUser=!1,this.backoff=new c({jitter:.5}),this.eventEmitter=new u.EventEmitter,this.middlewares=[],this.client=null,this.maxConnectTimeGenerator=this.createMaxConnectTimeGenerator(),this.connectionParams=this.getConnectionParams(d),this.lazy||this.connect()}return Object.defineProperty(e.prototype,"status",{get:function(){return null===this.client?this.wsImpl.CLOSED:this.client.readyState},enumerable:!0,configurable:!0}),e.prototype.close=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this.clearInactivityTimeout(),null!==this.client&&(this.closedByUser=t,e&&(this.clearCheckConnectionInterval(),this.clearMaxConnectTimeout(),this.clearTryReconnectTimeout(),this.unsubscribeAll(),this.sendMessage(void 0,v.default.GQL_CONNECTION_TERMINATE,null)),this.client.close(),this.client=null,this.eventEmitter.emit("disconnected"),e||this.tryReconnect())},e.prototype.request=function(e){var t,n,i=this.getObserver.bind(this),r=this.executeOperation.bind(this),o=this.unsubscribe.bind(this);return this.clearInactivityTimeout(),(t={})[f.default]=function(){return this},t.subscribe=function(t,a,s){var c=i(t,a,s);return n=r(e,(function(e,t){null===e&&null===t?c.complete&&c.complete():e?c.error&&c.error(e[0]):c.next&&c.next(t)})),{unsubscribe:function(){n&&(o(n),n=null)}}},t},e.prototype.on=function(e,t,n){var i=this.eventEmitter.on(e,t,n);return function(){i.off(e,t,n)}},e.prototype.onConnected=function(e,t){return this.on("connected",e,t)},e.prototype.onConnecting=function(e,t){return this.on("connecting",e,t)},e.prototype.onDisconnected=function(e,t){return this.on("disconnected",e,t)},e.prototype.onReconnected=function(e,t){return this.on("reconnected",e,t)},e.prototype.onReconnecting=function(e,t){return this.on("reconnecting",e,t)},e.prototype.onError=function(e,t){return this.on("error",e,t)},e.prototype.unsubscribeAll=function(){var e=this;Object.keys(this.operations).forEach((function(t){e.unsubscribe(t)}))},e.prototype.applyMiddlewares=function(e){var t=this;return new Promise((function(n,i){var r,o,a;r=t.middlewares.slice(),o=t,(a=function(t){if(t)i(t);else if(r.length>0){var s=r.shift();s&&s.applyMiddleware.apply(o,[e,a])}else n(e)})()}))},e.prototype.use=function(e){var t=this;return e.map((function(e){if("function"!=typeof e.applyMiddleware)throw new Error("Middleware must implement the applyMiddleware function.");t.middlewares.push(e)})),this},e.prototype.getConnectionParams=function(e){return function(){return new Promise((function(t,n){if("function"==typeof e)try{return t(e.call(null))}catch(e){return n(e)}t(e)}))}},e.prototype.executeOperation=function(e,t){var n=this;null===this.client&&this.connect();var i=this.generateOperationId();return this.operations[i]={options:e,handler:t},this.applyMiddlewares(e).then((function(e){n.checkOperationOptions(e,t),n.operations[i]&&(n.operations[i]={options:e,handler:t},n.sendMessage(i,v.default.GQL_START,e))})).catch((function(e){n.unsubscribe(i),t(n.formatErrors(e))})),i},e.prototype.getObserver=function(e,t,n){return"function"==typeof e?{next:function(t){return e(t)},error:function(e){return t&&t(e)},complete:function(){return n&&n()}}:e},e.prototype.createMaxConnectTimeGenerator=function(){var e=this.wsTimeout;return new c({min:1e3,max:e,factor:1.2})},e.prototype.clearCheckConnectionInterval=function(){this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnectionIntervalId=null)},e.prototype.clearMaxConnectTimeout=function(){this.maxConnectTimeoutId&&(clearTimeout(this.maxConnectTimeoutId),this.maxConnectTimeoutId=null)},e.prototype.clearTryReconnectTimeout=function(){this.tryReconnectTimeoutId&&(clearTimeout(this.tryReconnectTimeoutId),this.tryReconnectTimeoutId=null)},e.prototype.clearInactivityTimeout=function(){this.inactivityTimeoutId&&(clearTimeout(this.inactivityTimeoutId),this.inactivityTimeoutId=null)},e.prototype.setInactivityTimeout=function(){var e=this;this.inactivityTimeout>0&&0===Object.keys(this.operations).length&&(this.inactivityTimeoutId=setTimeout((function(){0===Object.keys(e.operations).length&&e.close()}),this.inactivityTimeout))},e.prototype.checkOperationOptions=function(e,t){var n=e.query,i=e.variables,r=e.operationName;if(!n)throw new Error("Must provide a query.");if(!t)throw new Error("Must provide an handler.");if(!l.default(n)&&!p.getOperationAST(n,r)||r&&!l.default(r)||i&&!d.default(i))throw new Error("Incorrect option types. query must be a string or a document,`operationName` must be a string, and `variables` must be an object.")},e.prototype.buildMessage=function(e,t,n){return{id:e,type:t,payload:n&&n.query?i({},n,{query:"string"==typeof n.query?n.query:m.print(n.query)}):n}},e.prototype.formatErrors=function(e){return Array.isArray(e)?e:e&&e.errors?this.formatErrors(e.errors):e&&e.message?[e]:[{name:"FormatedError",message:"Unknown error",originalError:e}]},e.prototype.sendMessage=function(e,t,n){this.sendMessageRaw(this.buildMessage(e,t,n))},e.prototype.sendMessageRaw=function(e){switch(this.status){case this.wsImpl.OPEN:var t=JSON.stringify(e);try{JSON.parse(t)}catch(t){this.eventEmitter.emit("error",new Error("Message must be JSON-serializable. Got: "+e))}this.client.send(t);break;case this.wsImpl.CONNECTING:this.unsentMessagesQueue.push(e);break;default:this.reconnecting||this.eventEmitter.emit("error",new Error("A message was not sent because socket is not connected, is closing or is already closed. Message was: "+JSON.stringify(e)))}},e.prototype.generateOperationId=function(){return String(++this.nextOperationId)},e.prototype.tryReconnect=function(){var e=this;if(this.reconnect&&!(this.backoff.attempts>=this.reconnectionAttempts)){this.reconnecting||(Object.keys(this.operations).forEach((function(t){e.unsentMessagesQueue.push(e.buildMessage(t,v.default.GQL_START,e.operations[t].options))})),this.reconnecting=!0),this.clearTryReconnectTimeout();var t=this.backoff.duration();this.tryReconnectTimeoutId=setTimeout((function(){e.connect()}),t)}},e.prototype.flushUnsentMessagesQueue=function(){var e=this;this.unsentMessagesQueue.forEach((function(t){e.sendMessageRaw(t)})),this.unsentMessagesQueue=[]},e.prototype.checkConnection=function(){this.wasKeepAliveReceived?this.wasKeepAliveReceived=!1:this.reconnecting||this.close(!1,!0)},e.prototype.checkMaxConnectTimeout=function(){var e=this;this.clearMaxConnectTimeout(),this.maxConnectTimeoutId=setTimeout((function(){e.status!==e.wsImpl.OPEN&&(e.reconnecting=!0,e.close(!1,!0))}),this.maxConnectTimeGenerator.duration())},e.prototype.connect=function(){var e=this;this.client=new this.wsImpl(this.url,this.wsProtocols),this.checkMaxConnectTimeout(),this.client.onopen=function(){return r(e,void 0,void 0,(function(){var e,t;return o(this,(function(n){switch(n.label){case 0:if(this.status!==this.wsImpl.OPEN)return[3,4];this.clearMaxConnectTimeout(),this.closedByUser=!1,this.eventEmitter.emit(this.reconnecting?"reconnecting":"connecting"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.connectionParams()];case 2:return e=n.sent(),this.sendMessage(void 0,v.default.GQL_CONNECTION_INIT,e),this.flushUnsentMessagesQueue(),[3,4];case 3:return t=n.sent(),this.sendMessage(void 0,v.default.GQL_CONNECTION_ERROR,t),this.flushUnsentMessagesQueue(),[3,4];case 4:return[2]}}))}))},this.client.onclose=function(){e.closedByUser||e.close(!1,!1)},this.client.onerror=function(t){e.eventEmitter.emit("error",t)},this.client.onmessage=function(t){var n=t.data;e.processReceivedData(n)}},e.prototype.processReceivedData=function(e){var t,n;try{n=(t=JSON.parse(e)).id}catch(t){throw new Error("Message must be JSON-parseable. Got: "+e)}if(-1===[v.default.GQL_DATA,v.default.GQL_COMPLETE,v.default.GQL_ERROR].indexOf(t.type)||this.operations[n])switch(t.type){case v.default.GQL_CONNECTION_ERROR:this.connectionCallback&&this.connectionCallback(t.payload);break;case v.default.GQL_CONNECTION_ACK:this.eventEmitter.emit(this.reconnecting?"reconnected":"connected"),this.reconnecting=!1,this.backoff.reset(),this.maxConnectTimeGenerator.reset(),this.connectionCallback&&this.connectionCallback();break;case v.default.GQL_COMPLETE:this.operations[n].handler(null,null),delete this.operations[n];break;case v.default.GQL_ERROR:this.operations[n].handler(this.formatErrors(t.payload),null),delete this.operations[n];break;case v.default.GQL_DATA:var r=t.payload.errors?i({},t.payload,{errors:this.formatErrors(t.payload.errors)}):t.payload;this.operations[n].handler(null,r);break;case v.default.GQL_CONNECTION_KEEP_ALIVE:var o=void 0===this.wasKeepAliveReceived;this.wasKeepAliveReceived=!0,o&&this.checkConnection(),this.checkConnectionIntervalId&&(clearInterval(this.checkConnectionIntervalId),this.checkConnection()),this.checkConnectionIntervalId=setInterval(this.checkConnection.bind(this),this.wsTimeout);break;default:throw new Error("Invalid message type!")}else this.unsubscribe(n)},e.prototype.unsubscribe=function(e){this.operations[e]&&(delete this.operations[e],this.setInactivityTimeout(),this.sendMessage(e,v.default.GQL_STOP,void 0))},e}();t.SubscriptionClient=b}).call(this,n(0))},function(e,t){function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";var i=Object.prototype.hasOwnProperty,r="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,i,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function c(e,t){0==--e._eventsCount?e._events=new o:delete e._events[t]}function u(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(r=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)i.call(e,t)&&n.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},u.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,n),!0;case 4:return l.fn.call(l.context,t,n,i),!0;case 5:return l.fn.call(l.context,t,n,i,o),!0;case 6:return l.fn.call(l.context,t,n,i,o,a),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var m,p=l.length;for(u=0;u<p;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,n);break;case 4:l[u].fn.call(l[u].context,t,n,i);break;default:if(!c)for(m=1,c=new Array(d-1);m<d;m++)c[m-1]=arguments[m];l[u].fn.apply(l[u].context,c)}}return!0},u.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},u.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},u.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return c(this,o),this;var a=this._events[o];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||c(this,o);else{for(var s=0,u=[],l=a.length;s<l;s++)(a[s].fn!==t||i&&!a[s].once||n&&a[s].context!==n)&&u.push(a[s]);u.length?this._events[o]=1===u.length?u[0]:u:c(this,o)}return this},u.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&c(this,t)):(this._events=new o,this._eventsCount=0),this},u.prototype.off=u.prototype.removeListener,u.prototype.addListener=u.prototype.on,u.prefixed=r,u.EventEmitter=u,e.exports=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return"string"==typeof e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return null!==e&&"object"==typeof e}},function(e,t,n){"use strict";n.r(t),function(e,i){var r,o=n(1);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var a=Object(o.a)(r);t.default=a}.call(this,n(0),n(10)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.GRAPHQL_WS="graphql-ws";t.GRAPHQL_SUBSCRIPTIONS="graphql-subscriptions"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WS_TIMEOUT=3e4},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(){throw new Error("Static Class")}return e.GQL_CONNECTION_INIT="connection_init",e.GQL_CONNECTION_ACK="connection_ack",e.GQL_CONNECTION_ERROR="connection_error",e.GQL_CONNECTION_KEEP_ALIVE="ka",e.GQL_CONNECTION_TERMINATE="connection_terminate",e.GQL_START="start",e.GQL_DATA="data",e.GQL_ERROR="error",e.GQL_COMPLETE="complete",e.GQL_STOP="stop",e.SUBSCRIPTION_START="subscription_start",e.SUBSCRIPTION_DATA="subscription_data",e.SUBSCRIPTION_SUCCESS="subscription_success",e.SUBSCRIPTION_FAIL="subscription_fail",e.SUBSCRIPTION_END="subscription_end",e.INIT="init",e.INIT_SUCCESS="init_success",e.INIT_FAIL="init_fail",e.KEEP_ALIVE="keepalive",e}();t.default=i},function(e,t,n){window,e.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";(function(t){const i=n(2);e.exports=({api:e,query:{entity:n,selection:r={},properties:o=[]},max:a=1/0})=>{a=Number(a);const s=({skip:c})=>{const u=e=>Object.entries(e).filter(([,e])=>void 0!==e).map(([e,t])=>`${e}:${"object"==typeof t?"{"+u(t)+"}":t}`).join(","),l=c+1e3>a?a%1e3:1e3,d=Object.assign({},r,{first:l,skip:c}),m=`{"query":"{${n}(${u(d)}){${o.join(",")}}}", "variables": null}`;return"object"==typeof t&&"true"===t.env.DEBUG&&console.log(m),i(e,{method:"POST",body:m}).then(e=>e.json()).then(e=>{if(e.errors)throw Error(JSON.stringify(e.errors));const{data:{[n]:t}}=e;return t.length<1e3||Math.min(a,c+t.length)>=a?t:s({skip:c+1e3}).then(e=>t.concat(e))})};return s({skip:0})}}).call(this,n(1))},function(e,t){var n,i,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(e){i=a}}();var c,u=[],l=!1,d=-1;function m(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&p())}function p(){if(!l){var e=s(m);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new f(e,t)),1!==u.length||l||s(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=h,r.addListener=h,r.once=h,r.off=h,r.removeListener=h,r.removeAllListeners=h,r.emit=h,r.prependListener=h,r.prependOnceListener=h,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";var i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==i)return i;throw new Error("unable to locate global object")}();e.exports=t=i.fetch,t.default=i.fetch.bind(i),t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response}])},function(e,t){const n="0x"+"0".repeat(40);e.exports={ZERO_ADDRESS:n,hexToAscii:e=>{const t=e.toString();let n="";for(let e=2;e<t.length;e+=2){const i=t.substr(e,2);"00"!==i&&(n+=String.fromCharCode(parseInt(i,16)))}return n},roundTimestampTenSeconds:e=>10*Math.round(e/10),getHashFromId:e=>e.split("-")[0],formatGQLArray:e=>"["+e.map(e=>`\\"${e}\\"`).join(",")+"]",formatGQLString:e=>`\\"${e}\\"`}},function(e,t,n){"use strict";n.r(t);var i="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=10,a=2;function s(e,t){switch(r(e)){case"string":return JSON.stringify(e);case"function":return e.name?"[function ".concat(e.name,"]"):"[function]";case"object":return null===e?"null":function(e,t){if(-1!==t.indexOf(e))return"[Circular]";var n=[].concat(t,[e]),r=function(e){var t=e[String(i)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==r){var c=r.call(e);if(c!==e)return"string"==typeof c?c:s(c,n)}else if(Array.isArray(e))return function(e,t){if(0===e.length)return"[]";if(t.length>a)return"[Array]";for(var n=Math.min(o,e.length),i=e.length-n,r=[],c=0;c<n;++c)r.push(s(e[c],t));1===i?r.push("... 1 more item"):i>1&&r.push("... ".concat(i," more items"));return"["+r.join(", ")+"]"}(e,n);return function(e,t){var n=Object.keys(e);if(0===n.length)return"{}";if(t.length>a)return"["+function(e){var t=Object.prototype.toString.call(e).replace(/^\[object /,"").replace(/]$/,"");if("Object"===t&&"function"==typeof e.constructor){var n=e.constructor.name;if("string"==typeof n&&""!==n)return n}return t}(e)+"]";return"{ "+n.map((function(n){return n+": "+s(e[n],t)})).join(", ")+" }"}(e,n)}(e,t);default:return String(e)}}var c={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},u=Object.freeze({});function l(e){return Boolean(e&&"string"==typeof e.kind)}function d(e,t,n){var i=e[t];if(i){if(!n&&"function"==typeof i)return i;var r=n?i.leave:i.enter;if("function"==typeof r)return r}else{var o=n?e.leave:e.enter;if(o){if("function"==typeof o)return o;var a=o[t];if("function"==typeof a)return a}}}function m(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,i=void 0,r=Array.isArray(e),o=[e],a=-1,m=[],p=void 0,f=void 0,h=void 0,y=[],v=[],b=e;do{var x=++a===o.length,g=x&&0!==m.length;if(x){if(f=0===v.length?void 0:y[y.length-1],p=h,h=v.pop(),g){if(r)p=p.slice();else{for(var T={},E=0,O=Object.keys(p);E<O.length;E++){var I=O[E];T[I]=p[I]}p=T}for(var N=0,_=0;_<m.length;_++){var w=m[_][0],D=m[_][1];r&&(w-=N),r&&null===D?(p.splice(w,1),N++):p[w]=D}}a=i.index,o=i.keys,m=i.edits,r=i.inArray,i=i.prev}else{if(f=h?r?a:o[a]:void 0,null==(p=h?h[f]:b))continue;h&&y.push(f)}var S=void 0;if(!Array.isArray(p)){if(!l(p))throw new Error("Invalid AST Node: "+s(p,[]));var k=d(t,p.kind,x);if(k){if((S=k.call(t,p,f,h,y,v))===u)break;if(!1===S){if(!x){y.pop();continue}}else if(void 0!==S&&(m.push([f,S]),!x)){if(!l(S)){y.pop();continue}p=S}}}void 0===S&&g&&m.push([f,p]),x?y.pop():(i={inArray:r,index:a,keys:o,edits:m,prev:i},o=(r=Array.isArray(p))?p:n[p.kind]||[],a=-1,m=[],h&&v.push(h),h=p)}while(void 0!==i);return 0!==m.length&&(b=m[m.length-1][1]),b}(e,{leave:p})}n.d(t,"print",(function(){return m}));var p={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return h(e.definitions,"\n\n")+"\n"},OperationDefinition:function(e){var t=e.operation,n=e.name,i=v("(",h(e.variableDefinitions,", "),")"),r=h(e.directives," "),o=e.selectionSet;return n||r||i||"query"!==t?h([t,h([n,i]),r,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,r=e.directives;return t+": "+n+v(" = ",i)+v(" ",h(r," "))},SelectionSet:function(e){return y(e.selections)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,r=e.directives,o=e.selectionSet;return h([v("",t,": ")+n+v("(",h(i,", "),")"),h(r," "),o]," ")},Argument:function(e){return e.name+": "+e.value},FragmentSpread:function(e){return"..."+e.name+v(" ",h(e.directives," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return h(["...",v("on ",t),h(n," "),i]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,i=e.variableDefinitions,r=e.directives,o=e.selectionSet;return("fragment ".concat(t).concat(v("(",h(i,", "),")")," ")+"on ".concat(n," ").concat(v("",h(r," ")," "))+o)},IntValue:function(e){return e.value},FloatValue:function(e){return e.value},StringValue:function(e,t){var n=e.value;return e.block?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=-1===e.indexOf("\n"),r=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!i||o||n,s="";return!a||i&&r||(s+="\n"+t),s+=t?e.replace(/\n/g,"\n"+t):e,a&&(s+="\n"),'"""'+s.replace(/"""/g,'\\"""')+'"""'}(n,"description"===t?"":" "):JSON.stringify(n)},BooleanValue:function(e){return e.value?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){return e.value},ListValue:function(e){return"["+h(e.values,", ")+"]"},ObjectValue:function(e){return"{"+h(e.fields,", ")+"}"},ObjectField:function(e){return e.name+": "+e.value},Directive:function(e){return"@"+e.name+v("(",h(e.arguments,", "),")")},NamedType:function(e){return e.name},ListType:function(e){return"["+e.type+"]"},NonNullType:function(e){return e.type+"!"},SchemaDefinition:function(e){var t=e.directives,n=e.operationTypes;return h(["schema",h(t," "),y(n)]," ")},OperationTypeDefinition:function(e){return e.operation+": "+e.type},ScalarTypeDefinition:f((function(e){return h(["scalar",e.name,h(e.directives," ")]," ")})),ObjectTypeDefinition:f((function(e){var t=e.name,n=e.interfaces,i=e.directives,r=e.fields;return h(["type",t,v("implements ",h(n," & ")),h(i," "),y(r)]," ")})),FieldDefinition:f((function(e){var t=e.name,n=e.arguments,i=e.type,r=e.directives;return t+(g(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+": "+i+v(" ",h(r," "))})),InputValueDefinition:f((function(e){var t=e.name,n=e.type,i=e.defaultValue,r=e.directives;return h([t+": "+n,v("= ",i),h(r," ")]," ")})),InterfaceTypeDefinition:f((function(e){var t=e.name,n=e.directives,i=e.fields;return h(["interface",t,h(n," "),y(i)]," ")})),UnionTypeDefinition:f((function(e){var t=e.name,n=e.directives,i=e.types;return h(["union",t,h(n," "),i&&0!==i.length?"= "+h(i," | "):""]," ")})),EnumTypeDefinition:f((function(e){var t=e.name,n=e.directives,i=e.values;return h(["enum",t,h(n," "),y(i)]," ")})),EnumValueDefinition:f((function(e){return h([e.name,h(e.directives," ")]," ")})),InputObjectTypeDefinition:f((function(e){var t=e.name,n=e.directives,i=e.fields;return h(["input",t,h(n," "),y(i)]," ")})),DirectiveDefinition:f((function(e){var t=e.name,n=e.arguments,i=e.repeatable,r=e.locations;return"directive @"+t+(g(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+(i?" repeatable":"")+" on "+h(r," | ")})),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return h(["extend schema",h(t," "),y(n)]," ")},ScalarTypeExtension:function(e){return h(["extend scalar",e.name,h(e.directives," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,r=e.fields;return h(["extend type",t,v("implements ",h(n," & ")),h(i," "),y(r)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return h(["extend interface",t,h(n," "),y(i)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return h(["extend union",t,h(n," "),i&&0!==i.length?"= "+h(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return h(["extend enum",t,h(n," "),y(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return h(["extend input",t,h(n," "),y(i)]," ")}};function f(e){return function(t){return h([t.description,e(t)],"\n")}}function h(e,t){return e?e.filter((function(e){return e})).join(t||""):""}function y(e){return e&&0!==e.length?"{\n"+b(h(e,"\n"))+"\n}":""}function v(e,t,n){return t?e+t+(n||""):""}function b(e){return e&&" "+e.replace(/\n/g,"\n ")}function x(e){return-1!==e.indexOf("\n")}function g(e){return e&&e.some(x)}},function(e,t,n){"use strict";n.r(t);var i=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function r(e,t){for(var n=null,r=0,o=e.definitions;r<o.length;r++){var a=o[r];if(a.kind===i.OPERATION_DEFINITION)if(t){if(a.name&&a.name.value===t)return a}else{if(n)return null;n=a}}return n}n.d(t,"getOperationAST",(function(){return r}))}])}));

@@ -669,2 +669,34 @@ 'use strict';

dailyIssued({ max = 100, minTimestamp = undefined } = {}) {
return pageResults({
api: graphAPIEndpoints.snx,
max,
query: {
entity: 'dailyIssueds',
selection: {
orderBy: 'id',
orderDirection: 'desc',
where: {
// convert to dayId
id_gte: minTimestamp ? Math.floor(minTimestamp / 86400) : undefined,
},
},
properties: [
'id', // the dayId
'value', // the total issued amount in sUSD on this day
'totalDebt', // total debt on this day
],
},
})
.then(results =>
results.map(({ id, totalDebt, value }) => ({
timestamp: id * 86400,
value: value / 1e18,
totalDebt: totalDebt / 1e18,
type: 'issued',
})),
)
.catch(err => console.error(err));
},
burned({ max = 100, account = undefined, minBlock = undefined } = {}) {

@@ -706,2 +738,34 @@ return pageResults({

dailyBurned({ max = 100, minTimestamp = undefined } = {}) {
return pageResults({
api: graphAPIEndpoints.snx,
max,
query: {
entity: 'dailyBurneds',
selection: {
orderBy: 'id',
orderDirection: 'desc',
where: {
// convert to dayId
id_gte: minTimestamp ? Math.floor(minTimestamp / 86400) : undefined,
},
},
properties: [
'id', // the dayId
'value', // the total burned amount in sUSD on this day
'totalDebt', // total debt on this day
],
},
})
.then(results =>
results.map(({ id, totalDebt, value }) => ({
timestamp: id * 86400,
value: value / 1e18,
totalDebt: totalDebt / 1e18,
type: 'burned',
})),
)
.catch(err => console.error(err));
},
aggregateActiveStakers({ max = 30 } = {}) {

@@ -708,0 +772,0 @@ return pageResults({

{
"name": "synthetix-data",
"license": "MIT",
"version": "2.1.42",
"version": "2.1.43",
"author": "Synthetix",

@@ -6,0 +6,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc