Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.31 to 2.1.32

l2-trial-contenders.json

10

bin.js

@@ -259,8 +259,10 @@ #!/usr/bin/env node

.option('-a, --address <value>', 'Address to filter on, if any')
.option('-c, --min-claims <value>', 'Minimum number of claims')
.option('-i, --min-mints <value>', 'Minimum number of mints')
.option('-j, --json', 'Whether or not to display the results as JSON')
.option('-m, --max <value>', 'Maximum number of results', 100)
.option('-x, --max-collateral <value>', 'Maximum amount of collateral (input will have 18 decimals added)')
.option('-n, --min-collateral <value>', 'Minimum amount of collateral (input will have 18 decimals added)')
.option('-o, --addresses-only', 'Show addresses only')
.option('-j, --json', 'Whether or not to display the results as JSON')
.action(async ({ max, addressesOnly, address, maxCollateral, minCollateral, json }) => {
.option('-x, --max-collateral <value>', 'Maximum amount of collateral (input will have 18 decimals added)')
.action(async ({ max, addressesOnly, address, maxCollateral, minCollateral, json, minMints, minClaims }) => {
snx

@@ -273,2 +275,4 @@ .holders({

maxCollateral,
minMints,
minClaims,
})

@@ -275,0 +279,0 @@ .then(results => (addressesOnly ? results.map(({ address }) => address) : results))

@@ -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(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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 r(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 r}))},function(e,t,n){"use strict";const r=n(3),{SubscriptionClient:i}=n(4),o=n(14),a={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"},s="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",c="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates",u="0x"+"0".repeat(40),l=e=>{const t=e.toString();let n="";for(let e=2;e<t.length;e+=2){const r=t.substr(e,2);"00"!==r&&(n+=String.fromCharCode(parseInt(r,16)))}return n},p=e=>10*Math.round(e/10);e.exports={pageResults:o,graphAPIEndpoints:a,depot:{userActions:({network:e="mainnet",user:t,max:n=100})=>o({api:a.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:r,minimum:i,depositIndex:o,block:a,timestamp:s})=>({hash:e.split("-")[0],user:t,amount:n/1e18,type:r,minimum:null!==i?Number(i):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:r=100})=>o({api:a.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:r}).then(e=>e.map(({id:e,fromAddress:t,toAddress:n,fromETHAmount:r,toAmount:i,depositIndex:o,block:a,timestamp:s})=>({hash:e.split("-")[0],fromAddress:t,toAddress:n,fromETHAmount:r/1e18,toAmount:i/1e18,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).catch(e=>console.error(e)),exchanges:({network:e="mainnet",from:t,max:n=100})=>o({api:a.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:r,toAmount:i,toCurrency:o,block:a,timestamp:s})=>({hash:e.split("-")[0],from:t,fromAmount:n/1e18,fromCurrency:r,toAmount:i/1e18,toCurrency:o,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).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:r,fromAmount:i,block:o,fromAmountInUSD:a,fromCurrencyKey:s,toAddress:c,toAmount:u,toAmountInUSD:p,toCurrencyKey:m,feesInUSD:d})=>({gasPrice:e/1e9,block:Number(o),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:n.split("-")[0],fromAddress:r,fromAmount:i/1e18,fromCurrencyKeyBytes:s,fromCurrencyKey:l(s),fromAmountInUSD:a/1e18,toAmount:u/1e18,toAmountInUSD:p/1e18,toCurrencyKeyBytes:m,toCurrencyKey:l(m),toAddress:c,feesInUSD:d/1e18}),total:({network:e="mainnet"}={})=>o({api:a.exchanges,query:{entity:"totals",selection:{where:{id:`\\"${e}\\"`}},properties:["trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]},max:1}).then(([{exchangers:e,exchangeUSDTally:t,totalFeesGeneratedInUSD:n,trades:r}])=>({trades:Number(r),exchangers:Number(e),exchangeUSDTally:t/1e18,totalFeesGeneratedInUSD:n/1e18})).catch(e=>console.error(e)),aggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:a.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:r,totalFeesGeneratedInUSD:i})=>({id:e,trades:Number(t),exchangers:Number(n),exchangeUSDTally:r/1e18,totalFeesGeneratedInUSD:i/1e18}))).catch(e=>console.error(e)),since:({network:t="mainnet",max:n=1/0,minTimestamp:r,maxTimestamp:i,minBlock:s,maxBlock:c,fromAddress:u}={})=>o({api:a.exchanges,max:n,query:{entity:"synthExchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${t}\\"`,timestamp_gte:p(r)||void 0,timestamp_lte:p(i)||void 0,block_gte:s||void 0,block_lte:c||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:r,maxTimestamp:i,minBlock:s,maxBlock:c}={})=>o({api:a.exchanges,max:n,query:{entity:`exchange${e?"Reclaim":"Rebate"}s`,selection:{orderBy:"timestamp",orderDirection:"desc",where:{timestamp_gte:r||void 0,timestamp_lte:i||void 0,block_gte:s||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:r,block:i,currencyKey:o,amount:a,amountInUSD:s})=>({gasPrice:e/1e9,block:Number(i),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:n.split("-")[0],account:r,amount:a/1e18,amountInUSD:s/1e18,currencyKey:l(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 i(s,{reconnect:!0},r).request({query:`subscription { synthExchanges(first: 1, orderBy: timestamp, orderDirection: desc) { ${e.exports.exchanges._properties.join(",")} } }`});return{subscribe:({next:n,error:r,complete:i})=>t.subscribe({next({data:{synthExchanges:t}}){t.map(e.exports.exchanges._mapSynthExchange).forEach(n)},error:r,complete:i})}}},synths:{issuers:({max:e=10}={})=>o({api:a.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:r=100,minBlock:i,maxBlock:s}={})=>o({api:a.snx,max:r,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:`\\"${u}\\"`,to_not:`\\"${u}\\"`,block_gte:i||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:r,from:i,to:o,value:a})=>({source:t,block:Number(n),timestamp:Number(1e3*r),date:new Date(1e3*r),hash:e.split("-")[0],from:i,to:o,value:a/1e18}))).catch(e=>console.error(e)),holders:({max:e=100,synth:t,address:n}={})=>o({api:a.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:e.split("-")[0],balanceOf:t?t/1e18:null,synth:n}))).catch(e=>console.error(e))},rate:{snxAggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:a.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:r,maxTimestamp:i,max:s=100}={})=>o({api:a.rates,max:s,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{synth:e?`\\"${e}\\"`:void 0,synth_not_in:e?void 0:"["+["SNX","ETH","XDR"].map(e=>`\\"${e}\\"`).join(",")+"]",block_gte:t||void 0,block_lte:n||void 0,timestamp_gte:p(r)||void 0,timestamp_lte:p(i)||void 0}},properties:["id","synth","rate","block","timestamp"]}}).then(e=>e.map(({id:e,rate:t,block:n,timestamp:r,synth:i})=>({block:Number(n),synth:i,timestamp:Number(1e3*r),date:new Date(1e3*r),hash:e.split("-")[0],rate:t/1e18}))).catch(e=>console.error(e)),dailyRateChange({synths:e=[],max:t=100}){const n=["XDR","XDRB","nUSD","sUSD"];return o({api:a.rates,max:t,query:{entity:"latestRates",properties:["id","rate"]}}).then(t=>{let r=t.filter(e=>!n.includes(e.id));e.length>0&&(r=t.filter(t=>e.includes(t.id)));const i=new Date;i.setDate(i.getDate()-1);const s=p(parseInt(i.getTime()/1e3));return Promise.all(r.map(async e=>o({api:a.rates,max:1,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{synth:`\\"${e.id}\\"`,timestamp_lte:s}},properties:["rate","synth"]}}))).then(e=>e.map((e,t)=>({synth:r[t].id,"24HRChange":Number(r[t].rate)/Number(e[0].rate)-1})))}).catch(e=>console.error(e))},observe({minTimestamp:e=Math.round(Date.now()/1e3)}={}){const t=new i(c,{reconnect:!0},r).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:r})=>t.subscribe({next({data:{rateUpdates:t}}){t.forEach(e)},error:n,complete:r})}}},snx:{issued:({max:e=100,account:t,minBlock:n}={})=>o({api:a.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:r,value:i})=>({hash:e,account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18}))).catch(e=>console.error(e)),burned:({max:e=100,account:t,minBlock:n}={})=>o({api:a.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:r,value:i})=>({hash:e,account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18}))).catch(e=>console.error(e)),aggregateActiveStakers:({max:e=30}={})=>o({api:a.snx,max:e,query:{entity:"totalDailyActiveStakers",selection:{orderBy:"id",orderDirection:"desc"},properties:["id","count"]}}).catch(e=>console.error(e)),totalActiveStakers:()=>o({api:a.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:r}={})=>o({api:a.snx,max:e,query:{entity:"snxholders",selection:{orderBy:"collateral",orderDirection:"desc",where:{id:r?`\\"${r}\\"`:void 0,collateral_lte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,collateral_gte:n?`\\"${n+"0".repeat(18)}\\"`:void 0}},properties:["id","block","timestamp","collateral","balanceOf","transferable","initialDebtOwnership","debtEntryAtIndex"]}}).then(e=>e.map(({id:e,collateral:t,block:n,timestamp:r,balanceOf:i,transferable:o,initialDebtOwnership:a,debtEntryAtIndex:s})=>({address:e,block:Number(n),timestamp:Number(1e3*r),date:new Date(1e3*r),collateral:t?t/1e18:null,balanceOf:i?i/1e18:null,transferable:o?o/1e18:null,initialDebtOwnership:a?a/1e27:null,debtEntryAtIndex:s?s/1e27:null}))).catch(e=>console.error(e)),rewards:({max:e=100}={})=>o({api:a.snx,max:e,query:{entity:"rewardEscrowHolders",selection:{orderBy:"balanceOf",orderDirection:"desc"},properties:["id","balanceOf"]}}).then(e=>e.map(({id:e,balanceOf:t})=>({address:e,balance:t/1e18}))).catch(e=>console.error(e)),total:()=>o({api:a.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:r,maxBlock:i}={})=>o({api:a.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:r||void 0,block_lte:i||void 0}},properties:["id","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,block:t,timestamp:n,from:r,to:i,value:o})=>({block:Number(t),timestamp:Number(1e3*n),date:new Date(1e3*n),hash:e.split("-")[0],from:r,to:i,value:o/1e18}))).catch(e=>console.error(e)),feesClaimed:({max:e=100,account:t}={})=>o({api:a.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:r,value:i,rewards:o})=>({hash:e.split("-")[0],account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18,rewards:o/1e18}))).catch(e=>console.error(e)),debtSnapshot:({account:e,max:t=100,minBlock:n,maxBlock:r})=>o({api:a.snx,max:t,query:{entity:"debtSnapshots",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:e?`\\"${e}\\"`:void 0,block_gte:n||void 0,block_lte:r||void 0}},properties:["id","timestamp","block","account","balanceOf","collateral","debtBalanceOf"]}}).then(e=>e.map(({id:e,timestamp:t,block:n,account:r,balanceOf:i,collateral:o,debtBalanceOf:a})=>({id:e,timestamp:Number(1e3*t),block:Number(n),account:r,balanceOf:i?i/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:r,maxTimestamp:i}={})=>o({api:a.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:r||void 0,timestamp_lte:i||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:r,strikePrice:i,biddingEndDate:o,maturityDate:a,expiryDate:s,isOpen:c,longPrice:u,shortPrice:p,poolSize:m,result:d})=>({address:e,timestamp:Number(1e3*t),creator:n,currencyKey:l(r),strikePrice:i/1e18,biddingEndDate:1e3*Number(o),maturityDate:1e3*Number(a),expiryDate:1e3*Number(s),isOpen:c,longPrice:u/1e18,shortPrice:p/1e18,poolSize:m/1e18,result:null!==d?0===d?"long":"short":null}))),optionTransactions:({max:e=1/0,market:t,account:n}={})=>o({api:a.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:r,currencyKey:i,side:o,amount:a,market:s,fee:c})=>({hash:e.split("-")[0],timestamp:Number(1e3*t),type:n,account:r,currencyKey:i?l(i):null,side:0===o?"long":"short",amount:a/1e18,market:s,fee:c?c/1e18:null}))),marketsBidOn:({max:e=1/0,account:t}={})=>o({api:a.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:r}={})=>o({api:a.binaryOptions,max:e,query:{entity:"historicalOptionPrices",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,timestamp_gte:n||void 0,timestamp_lte:r||void 0}},properties:["id","timestamp","longPrice","shortPrice","poolSize","market"]}}).then(e=>e.map(({id:e,timestamp:t,longPrice:n,shortPrice:r,poolSize:i,market:o})=>({id:e,timestamp:Number(1e3*t),longPrice:n/1e18,shortPrice:r/1e18,poolSize:i/1e18,market:o})))},etherCollateral:{loans:({max:e=1/0,isOpen:t,account:n}={})=>o({api:a.etherCollateral,max:e,query:{entity:"loans",selection:{orderBy:"createdAt",orderDirection:"desc",where:{account:n?`\\"${n}\\"`:void 0,isOpen:t}},properties:["id","account","amount","isOpen","createdAt","closedAt"]}}).then(e=>e.map(({id:e,account:t,amount:n,isOpen:r,createdAt:i,closedAt:o})=>({id:Number(e),account:t,createdAt:new Date(Number(1e3*i)),closedAt:o?new Date(Number(1e3*o)):null,amount:n/1e18,isOpen:r}))).catch(e=>console.error(e))},limitOrders:{orders:({max:e=1/0,account:t}={})=>o({api:a.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:r,sourceCurrencyKey:i,sourceAmount:o,destinationCurrencyKey:a,minDestinationAmount:s,executionFee:c,deposit:u,status:p})=>({id:Number(e),hash:t,timestamp:Number(1e3*n),account:r,sourceCurrencyKey:l(i),sourceAmount:o/1e18,destinationCurrencyKey:l(a),minDestinationAmount:s/1e18,executionFee:c/1e18,deposit:u/1e18,status:p}))).catch(e=>console.error(e))},exchanger:{exchangeEntriesSettled:({max:e=100,from:t}={})=>o({api:a.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:r,dest:i,reclaim:o,rebate:a,srcRoundIdAtPeriodEnd:s,destRoundIdAtPeriodEnd:c,exchangeTimestamp:u})=>({hash:e.split("-")[0],from:t,src:l(n),amount:r/1e18,dest:l(i),reclaim:o/1e18,rebate:a/1e18,srcRoundIdAtPeriodEnd:s/1e18,destRoundIdAtPeriodEnd:c/1e18,exchangeTimestamp:Number(1e3*u)}))).catch(e=>console.error(e))}}},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 r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[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,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=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),p=n(8),m=n(15),d=n(16),f=n(9),h=n(11),y=n(12),v=n(13),b=function(){function e(e,t,n,r){var i=t||{},o=i.connectionCallback,a=void 0===o?void 0:o,l=i.connectionParams,p=void 0===l?{}:l,m=i.timeout,d=void 0===m?y.WS_TIMEOUT:m,f=i.reconnect,v=void 0!==f&&f,b=i.reconnectionAttempts,g=void 0===b?1/0:b,x=i.lazy,T=void 0!==x&&x,E=i.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=r||h.GRAPHQL_WS,this.connectionCallback=a,this.url=e,this.operations={},this.nextOperationId=0,this.wsTimeout=d,this.unsentMessagesQueue=[],this.reconnect=v,this.reconnecting=!1,this.reconnectionAttempts=g,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(p),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,r=this.getObserver.bind(this),i=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=r(t,a,s);return n=i(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 r=this.eventEmitter.on(e,t,n);return function(){r.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,r){var i,o,a;i=t.middlewares.slice(),o=t,(a=function(t){if(t)r(t);else if(i.length>0){var s=i.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 r=this.generateOperationId();return this.operations[r]={options:e,handler:t},this.applyMiddlewares(e).then((function(e){n.checkOperationOptions(e,t),n.operations[r]&&(n.operations[r]={options:e,handler:t},n.sendMessage(r,v.default.GQL_START,e))})).catch((function(e){n.unsubscribe(r),t(n.formatErrors(e))})),r},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,r=e.variables,i=e.operationName;if(!n)throw new Error("Must provide a query.");if(!t)throw new Error("Must provide an handler.");if(!l.default(n)&&!d.getOperationAST(n,i)||i&&!l.default(i)||r&&!p.default(r))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?r({},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 i(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 i=t.payload.errors?r({},t.payload,{errors:this.formatErrors(t.payload.errors)}):t.payload;this.operations[n].handler(null,i);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 r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,o),c=i?i+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__||(i=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},u.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],p=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),p){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,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,a),!0}for(u=1,c=new Array(p-1);u<p;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var m,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),p){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,r);break;default:if(!c)for(m=1,c=new Array(p-1);m<p;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,r){var o=i?i+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||r&&!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||r&&!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=i?i+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=i,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,r){var i,o=n(1);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var a=Object(o.a)(i);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 r=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=r},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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 r=n(2);e.exports=({api:e,query:{entity:n,selection:i={},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,p=Object.assign({},i,{first:l,skip:c}),m=`{"query":"{${n}(${u(p)}){${o.join(",")}}}", "variables": null}`;return"object"==typeof t&&"true"===t.env.DEBUG&&console.log(m),r(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,r,i=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{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,p=-1;function m(){l&&c&&(l=!1,c.length?u=c.concat(u):p=-1,u.length&&d())}function d(){if(!l){var e=s(m);l=!0;for(var t=u.length;t;){for(c=u,u=[];++p<t;)c&&c[p].run();p=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}i.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(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,t.default=r.fetch.bind(r),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}])},function(e,t,n){"use strict";n.r(t);var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function i(e){return(i="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(i(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]),i=function(e){var t=e[String(r)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==i){var c=i.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),r=e.length-n,i=[],c=0;c<n;++c)i.push(s(e[c],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.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 p(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}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,r=void 0,i=Array.isArray(e),o=[e],a=-1,m=[],d=void 0,f=void 0,h=void 0,y=[],v=[],b=e;do{var g=++a===o.length,x=g&&0!==m.length;if(g){if(f=0===v.length?void 0:y[y.length-1],d=h,h=v.pop(),x){if(i)d=d.slice();else{for(var T={},E=0,O=Object.keys(d);E<O.length;E++){var I=O[E];T[I]=d[I]}d=T}for(var N=0,_=0;_<m.length;_++){var w=m[_][0],D=m[_][1];i&&(w-=N),i&&null===D?(d.splice(w,1),N++):d[w]=D}}a=r.index,o=r.keys,m=r.edits,i=r.inArray,r=r.prev}else{if(f=h?i?a:o[a]:void 0,null==(d=h?h[f]:b))continue;h&&y.push(f)}var S=void 0;if(!Array.isArray(d)){if(!l(d))throw new Error("Invalid AST Node: "+s(d,[]));var k=p(t,d.kind,g);if(k){if((S=k.call(t,d,f,h,y,v))===u)break;if(!1===S){if(!g){y.pop();continue}}else if(void 0!==S&&(m.push([f,S]),!g)){if(!l(S)){y.pop();continue}d=S}}}void 0===S&&x&&m.push([f,d]),g?y.pop():(r={inArray:i,index:a,keys:o,edits:m,prev:r},o=(i=Array.isArray(d))?d:n[d.kind]||[],a=-1,m=[],h&&v.push(h),h=d)}while(void 0!==r);return 0!==m.length&&(b=m[m.length-1][1]),b}(e,{leave:d})}n.d(t,"print",(function(){return m}));var d={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,r=v("(",h(e.variableDefinitions,", "),")"),i=h(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?h([t,h([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+v(" = ",r)+v(" ",h(i," "))},SelectionSet:function(e){return y(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet;return h([v("",t,": ")+n+v("(",h(r,", "),")"),h(i," "),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,r=e.selectionSet;return h(["...",v("on ",t),h(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return("fragment ".concat(t).concat(v("(",h(r,", "),")")," ")+"on ".concat(n," ").concat(v("",h(i," ")," "))+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],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!r||o||n,s="";return!a||r&&i||(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,r=e.directives,i=e.fields;return h(["type",t,v("implements ",h(n," & ")),h(r," "),y(i)]," ")})),FieldDefinition:f((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(x(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+": "+r+v(" ",h(i," "))})),InputValueDefinition:f((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return h([t+": "+n,v("= ",r),h(i," ")]," ")})),InterfaceTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.fields;return h(["interface",t,h(n," "),y(r)]," ")})),UnionTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.types;return h(["union",t,h(n," "),r&&0!==r.length?"= "+h(r," | "):""]," ")})),EnumTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.values;return h(["enum",t,h(n," "),y(r)]," ")})),EnumValueDefinition:f((function(e){return h([e.name,h(e.directives," ")]," ")})),InputObjectTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.fields;return h(["input",t,h(n," "),y(r)]," ")})),DirectiveDefinition:f((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(x(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+(r?" repeatable":"")+" on "+h(i," | ")})),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,r=e.directives,i=e.fields;return h(["extend type",t,v("implements ",h(n," & ")),h(r," "),y(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return h(["extend interface",t,h(n," "),y(r)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return h(["extend union",t,h(n," "),r&&0!==r.length?"= "+h(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return h(["extend enum",t,h(n," "),y(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return h(["extend input",t,h(n," "),y(r)]," ")}};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 g(e){return-1!==e.indexOf("\n")}function x(e){return e&&e.some(g)}},function(e,t,n){"use strict";n.r(t);var r=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 i(e,t){for(var n=null,i=0,o=e.definitions;i<o.length;i++){var a=o[i];if(a.kind===r.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 i}))}])}));
!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(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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 r(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 r}))},function(e,t,n){"use strict";const r=n(3),{SubscriptionClient:i}=n(4),o=n(14),a={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"},s="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-exchanges",c="wss://api.thegraph.com/subgraphs/name/synthetixio-team/synthetix-rates",u="0x"+"0".repeat(40),l=e=>{const t=e.toString();let n="";for(let e=2;e<t.length;e+=2){const r=t.substr(e,2);"00"!==r&&(n+=String.fromCharCode(parseInt(r,16)))}return n},m=e=>10*Math.round(e/10);e.exports={pageResults:o,graphAPIEndpoints:a,depot:{userActions:({network:e="mainnet",user:t,max:n=100})=>o({api:a.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:r,minimum:i,depositIndex:o,block:a,timestamp:s})=>({hash:e.split("-")[0],user:t,amount:n/1e18,type:r,minimum:null!==i?Number(i):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:r=100})=>o({api:a.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:r}).then(e=>e.map(({id:e,fromAddress:t,toAddress:n,fromETHAmount:r,toAmount:i,depositIndex:o,block:a,timestamp:s})=>({hash:e.split("-")[0],fromAddress:t,toAddress:n,fromETHAmount:r/1e18,toAmount:i/1e18,depositIndex:null!==o?Number(o):null,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).catch(e=>console.error(e)),exchanges:({network:e="mainnet",from:t,max:n=100})=>o({api:a.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:r,toAmount:i,toCurrency:o,block:a,timestamp:s})=>({hash:e.split("-")[0],from:t,fromAmount:n/1e18,fromCurrency:r,toAmount:i/1e18,toCurrency:o,block:Number(a),timestamp:Number(1e3*s),date:new Date(1e3*s)}))).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:r,fromAmount:i,block:o,fromAmountInUSD:a,fromCurrencyKey:s,toAddress:c,toAmount:u,toAmountInUSD:m,toCurrencyKey:p,feesInUSD:d})=>({gasPrice:e/1e9,block:Number(o),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:n.split("-")[0],fromAddress:r,fromAmount:i/1e18,fromCurrencyKeyBytes:s,fromCurrencyKey:l(s),fromAmountInUSD:a/1e18,toAmount:u/1e18,toAmountInUSD:m/1e18,toCurrencyKeyBytes:p,toCurrencyKey:l(p),toAddress:c,feesInUSD:d/1e18}),total:({network:e="mainnet"}={})=>o({api:a.exchanges,query:{entity:"totals",selection:{where:{id:`\\"${e}\\"`}},properties:["trades","exchangers","exchangeUSDTally","totalFeesGeneratedInUSD"]},max:1}).then(([{exchangers:e,exchangeUSDTally:t,totalFeesGeneratedInUSD:n,trades:r}])=>({trades:Number(r),exchangers:Number(e),exchangeUSDTally:t/1e18,totalFeesGeneratedInUSD:n/1e18})).catch(e=>console.error(e)),aggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:a.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:r,totalFeesGeneratedInUSD:i})=>({id:e,trades:Number(t),exchangers:Number(n),exchangeUSDTally:r/1e18,totalFeesGeneratedInUSD:i/1e18}))).catch(e=>console.error(e)),since:({network:t="mainnet",max:n=1/0,minTimestamp:r,maxTimestamp:i,minBlock:s,maxBlock:c,fromAddress:u}={})=>o({api:a.exchanges,max:n,query:{entity:"synthExchanges",selection:{orderBy:"timestamp",orderDirection:"desc",where:{network:`\\"${t}\\"`,timestamp_gte:m(r)||void 0,timestamp_lte:m(i)||void 0,block_gte:s||void 0,block_lte:c||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:r,maxTimestamp:i,minBlock:s,maxBlock:c}={})=>o({api:a.exchanges,max:n,query:{entity:`exchange${e?"Reclaim":"Rebate"}s`,selection:{orderBy:"timestamp",orderDirection:"desc",where:{timestamp_gte:r||void 0,timestamp_lte:i||void 0,block_gte:s||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:r,block:i,currencyKey:o,amount:a,amountInUSD:s})=>({gasPrice:e/1e9,block:Number(i),timestamp:Number(1e3*t),date:new Date(1e3*t),hash:n.split("-")[0],account:r,amount:a/1e18,amountInUSD:s/1e18,currencyKey:l(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 i(s,{reconnect:!0},r).request({query:`subscription { synthExchanges(first: 1, orderBy: timestamp, orderDirection: desc) { ${e.exports.exchanges._properties.join(",")} } }`});return{subscribe:({next:n,error:r,complete:i})=>t.subscribe({next({data:{synthExchanges:t}}){t.map(e.exports.exchanges._mapSynthExchange).forEach(n)},error:r,complete:i})}}},synths:{issuers:({max:e=10}={})=>o({api:a.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:r=100,minBlock:i,maxBlock:s}={})=>o({api:a.snx,max:r,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:`\\"${u}\\"`,to_not:`\\"${u}\\"`,block_gte:i||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:r,from:i,to:o,value:a})=>({source:t,block:Number(n),timestamp:Number(1e3*r),date:new Date(1e3*r),hash:e.split("-")[0],from:i,to:o,value:a/1e18}))).catch(e=>console.error(e)),holders:({max:e=100,synth:t,address:n}={})=>o({api:a.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:e.split("-")[0],balanceOf:t?t/1e18:null,synth:n}))).catch(e=>console.error(e))},rate:{snxAggregate:({timeSeries:e="1d",max:t=30}={})=>o({api:a.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:r,maxTimestamp:i,max:s=100}={})=>o({api:a.rates,max:s,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{synth:e?`\\"${e}\\"`:void 0,synth_not_in:e?void 0:"["+["SNX","ETH","XDR"].map(e=>`\\"${e}\\"`).join(",")+"]",block_gte:t||void 0,block_lte:n||void 0,timestamp_gte:m(r)||void 0,timestamp_lte:m(i)||void 0}},properties:["id","synth","rate","block","timestamp"]}}).then(e=>e.map(({id:e,rate:t,block:n,timestamp:r,synth:i})=>({block:Number(n),synth:i,timestamp:Number(1e3*r),date:new Date(1e3*r),hash:e.split("-")[0],rate:t/1e18}))).catch(e=>console.error(e)),dailyRateChange({synths:e=[],max:t=100}){const n=["XDR","XDRB","nUSD","sUSD"];return o({api:a.rates,max:t,query:{entity:"latestRates",properties:["id","rate"]}}).then(t=>{let r=t.filter(e=>!n.includes(e.id));e.length>0&&(r=t.filter(t=>e.includes(t.id)));const i=new Date;i.setDate(i.getDate()-1);const s=m(parseInt(i.getTime()/1e3));return Promise.all(r.map(async e=>o({api:a.rates,max:1,query:{entity:"rateUpdates",selection:{orderBy:"timestamp",orderDirection:"desc",where:{synth:`\\"${e.id}\\"`,timestamp_lte:s}},properties:["rate","synth"]}}))).then(e=>e.map((e,t)=>({synth:r[t].id,"24HRChange":Number(r[t].rate)/Number(e[0].rate)-1})))}).catch(e=>console.error(e))},observe({minTimestamp:e=Math.round(Date.now()/1e3)}={}){const t=new i(c,{reconnect:!0},r).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:r})=>t.subscribe({next({data:{rateUpdates:t}}){t.forEach(e)},error:n,complete:r})}}},snx:{issued:({max:e=100,account:t,minBlock:n}={})=>o({api:a.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:r,value:i})=>({hash:e,account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18}))).catch(e=>console.error(e)),burned:({max:e=100,account:t,minBlock:n}={})=>o({api:a.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:r,value:i})=>({hash:e,account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18}))).catch(e=>console.error(e)),aggregateActiveStakers:({max:e=30}={})=>o({api:a.snx,max:e,query:{entity:"totalDailyActiveStakers",selection:{orderBy:"id",orderDirection:"desc"},properties:["id","count"]}}).catch(e=>console.error(e)),totalActiveStakers:()=>o({api:a.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:r,minMints:i,minClaims:s}={})=>o({api:a.snx,max:e,query:{entity:"snxholders",selection:{orderBy:"collateral",orderDirection:"desc",where:{id:r?`\\"${r.toLowerCase()}\\"`:void 0,collateral_lte:t?`\\"${t+"0".repeat(18)}\\"`:void 0,collateral_gte:n?`\\"${n+"0".repeat(18)}\\"`:void 0,mints_gte:i||void 0,claims_gte:s||void 0}},properties:["id","block","timestamp","collateral","balanceOf","transferable","initialDebtOwnership","debtEntryAtIndex","claims","mints"]}}).then(e=>e.map(({id:e,collateral:t,block:n,timestamp:r,balanceOf:i,transferable:o,initialDebtOwnership:a,debtEntryAtIndex:s,mints:c,claims:u})=>({address:e,block:Number(n),timestamp:Number(1e3*r),date:new Date(1e3*r),collateral:t?t/1e18:null,balanceOf:i?i/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}={})=>o({api:a.snx,max:e,query:{entity:"rewardEscrowHolders",selection:{orderBy:"balanceOf",orderDirection:"desc"},properties:["id","balanceOf"]}}).then(e=>e.map(({id:e,balanceOf:t})=>({address:e,balance:t/1e18}))).catch(e=>console.error(e)),total:()=>o({api:a.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:r,maxBlock:i}={})=>o({api:a.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:r||void 0,block_lte:i||void 0}},properties:["id","to","from","value","block","timestamp"]}}).then(e=>e.map(({id:e,block:t,timestamp:n,from:r,to:i,value:o})=>({block:Number(t),timestamp:Number(1e3*n),date:new Date(1e3*n),hash:e.split("-")[0],from:r,to:i,value:o/1e18}))).catch(e=>console.error(e)),feesClaimed:({max:e=100,account:t}={})=>o({api:a.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:r,value:i,rewards:o})=>({hash:e.split("-")[0],account:t,timestamp:Number(1e3*n),block:Number(r),value:i/1e18,rewards:o/1e18}))).catch(e=>console.error(e)),debtSnapshot:({account:e,max:t=100,minBlock:n,maxBlock:r})=>o({api:a.snx,max:t,query:{entity:"debtSnapshots",selection:{orderBy:"timestamp",orderDirection:"desc",where:{account:e?`\\"${e}\\"`:void 0,block_gte:n||void 0,block_lte:r||void 0}},properties:["id","timestamp","block","account","balanceOf","collateral","debtBalanceOf"]}}).then(e=>e.map(({id:e,timestamp:t,block:n,account:r,balanceOf:i,collateral:o,debtBalanceOf:a})=>({id:e,timestamp:Number(1e3*t),block:Number(n),account:r,balanceOf:i?i/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:r,maxTimestamp:i}={})=>o({api:a.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:r||void 0,timestamp_lte:i||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:r,strikePrice:i,biddingEndDate:o,maturityDate:a,expiryDate:s,isOpen:c,longPrice:u,shortPrice:m,poolSize:p,result:d})=>({address:e,timestamp:Number(1e3*t),creator:n,currencyKey:l(r),strikePrice:i/1e18,biddingEndDate:1e3*Number(o),maturityDate:1e3*Number(a),expiryDate:1e3*Number(s),isOpen:c,longPrice:u/1e18,shortPrice:m/1e18,poolSize:p/1e18,result:null!==d?0===d?"long":"short":null}))),optionTransactions:({max:e=1/0,market:t,account:n}={})=>o({api:a.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:r,currencyKey:i,side:o,amount:a,market:s,fee:c})=>({hash:e.split("-")[0],timestamp:Number(1e3*t),type:n,account:r,currencyKey:i?l(i):null,side:0===o?"long":"short",amount:a/1e18,market:s,fee:c?c/1e18:null}))),marketsBidOn:({max:e=1/0,account:t}={})=>o({api:a.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:r}={})=>o({api:a.binaryOptions,max:e,query:{entity:"historicalOptionPrices",selection:{orderBy:"timestamp",orderDirection:"desc",where:{market:t?`\\"${t}\\"`:void 0,timestamp_gte:n||void 0,timestamp_lte:r||void 0}},properties:["id","timestamp","longPrice","shortPrice","poolSize","market"]}}).then(e=>e.map(({id:e,timestamp:t,longPrice:n,shortPrice:r,poolSize:i,market:o})=>({id:e,timestamp:Number(1e3*t),longPrice:n/1e18,shortPrice:r/1e18,poolSize:i/1e18,market:o})))},etherCollateral:{loans:({max:e=1/0,isOpen:t,account:n}={})=>o({api:a.etherCollateral,max:e,query:{entity:"loans",selection:{orderBy:"createdAt",orderDirection:"desc",where:{account:n?`\\"${n}\\"`:void 0,isOpen:t}},properties:["id","account","amount","isOpen","createdAt","closedAt"]}}).then(e=>e.map(({id:e,account:t,amount:n,isOpen:r,createdAt:i,closedAt:o})=>({id:Number(e),account:t,createdAt:new Date(Number(1e3*i)),closedAt:o?new Date(Number(1e3*o)):null,amount:n/1e18,isOpen:r}))).catch(e=>console.error(e))},limitOrders:{orders:({max:e=1/0,account:t}={})=>o({api:a.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:r,sourceCurrencyKey:i,sourceAmount:o,destinationCurrencyKey:a,minDestinationAmount:s,executionFee:c,deposit:u,status:m})=>({id:Number(e),hash:t,timestamp:Number(1e3*n),account:r,sourceCurrencyKey:l(i),sourceAmount:o/1e18,destinationCurrencyKey:l(a),minDestinationAmount:s/1e18,executionFee:c/1e18,deposit:u/1e18,status:m}))).catch(e=>console.error(e))},exchanger:{exchangeEntriesSettled:({max:e=100,from:t}={})=>o({api:a.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:r,dest:i,reclaim:o,rebate:a,srcRoundIdAtPeriodEnd:s,destRoundIdAtPeriodEnd:c,exchangeTimestamp:u})=>({hash:e.split("-")[0],from:t,src:l(n),amount:r/1e18,dest:l(i),reclaim:o/1e18,rebate:a/1e18,srcRoundIdAtPeriodEnd:s/1e18,destRoundIdAtPeriodEnd:c/1e18,exchangeTimestamp:Number(1e3*u)}))).catch(e=>console.error(e))}}},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 r=this&&this.__assign||Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new n((function(t){t(e.value)})).then(a,s)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[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,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{n=i=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),m=n(8),p=n(15),d=n(16),f=n(9),h=n(11),y=n(12),v=n(13),b=function(){function e(e,t,n,r){var i=t||{},o=i.connectionCallback,a=void 0===o?void 0:o,l=i.connectionParams,m=void 0===l?{}:l,p=i.timeout,d=void 0===p?y.WS_TIMEOUT:p,f=i.reconnect,v=void 0!==f&&f,b=i.reconnectionAttempts,g=void 0===b?1/0:b,x=i.lazy,T=void 0!==x&&x,E=i.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=r||h.GRAPHQL_WS,this.connectionCallback=a,this.url=e,this.operations={},this.nextOperationId=0,this.wsTimeout=d,this.unsentMessagesQueue=[],this.reconnect=v,this.reconnecting=!1,this.reconnectionAttempts=g,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(m),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,r=this.getObserver.bind(this),i=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=r(t,a,s);return n=i(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 r=this.eventEmitter.on(e,t,n);return function(){r.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,r){var i,o,a;i=t.middlewares.slice(),o=t,(a=function(t){if(t)r(t);else if(i.length>0){var s=i.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 r=this.generateOperationId();return this.operations[r]={options:e,handler:t},this.applyMiddlewares(e).then((function(e){n.checkOperationOptions(e,t),n.operations[r]&&(n.operations[r]={options:e,handler:t},n.sendMessage(r,v.default.GQL_START,e))})).catch((function(e){n.unsubscribe(r),t(n.formatErrors(e))})),r},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,r=e.variables,i=e.operationName;if(!n)throw new Error("Must provide a query.");if(!t)throw new Error("Must provide an handler.");if(!l.default(n)&&!d.getOperationAST(n,i)||i&&!l.default(i)||r&&!m.default(r))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?r({},n,{query:"string"==typeof n.query?n.query:p.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 i(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 i=t.payload.errors?r({},t.payload,{errors:this.formatErrors(t.payload.errors)}):t.payload;this.operations[n].handler(null,i);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 r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||e,o),c=i?i+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__||(i=!1)),u.prototype.eventNames=function(){var e,t,n=[];if(0===this._eventsCount)return n;for(t in e=this._events)r.call(e,t)&&n.push(i?t.slice(1):t);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},u.prototype.listeners=function(e){var t=i?i+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},u.prototype.listenerCount=function(e){var t=i?i+e:e,n=this._events[t];return n?n.fn?1:n.length:0},u.prototype.emit=function(e,t,n,r,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],m=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),m){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,r),!0;case 5:return l.fn.call(l.context,t,n,r,o),!0;case 6:return l.fn.call(l.context,t,n,r,o,a),!0}for(u=1,c=new Array(m-1);u<m;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var p,d=l.length;for(u=0;u<d;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),m){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,r);break;default:if(!c)for(p=1,c=new Array(m-1);p<m;p++)c[p-1]=arguments[p];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,r){var o=i?i+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||r&&!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||r&&!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=i?i+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=i,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,r){var i,o=n(1);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var a=Object(o.a)(i);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 r=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=r},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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 r=n(2);e.exports=({api:e,query:{entity:n,selection:i={},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,m=Object.assign({},i,{first:l,skip:c}),p=`{"query":"{${n}(${u(m)}){${o.join(",")}}}", "variables": null}`;return"object"==typeof t&&"true"===t.env.DEBUG&&console.log(p),r(e,{method:"POST",body:p}).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,r,i=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{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],l=!1,m=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):m=-1,u.length&&d())}function d(){if(!l){var e=s(p);l=!0;for(var t=u.length;t;){for(c=u,u=[];++m<t;)c&&c[m].run();m=-1,t=u.length}c=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}i.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(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";var r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r)return r;throw new Error("unable to locate global object")}();e.exports=t=r.fetch,t.default=r.fetch.bind(r),t.Headers=r.Headers,t.Request=r.Request,t.Response=r.Response}])},function(e,t,n){"use strict";n.r(t);var r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):void 0;function i(e){return(i="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(i(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]),i=function(e){var t=e[String(r)];if("function"==typeof t)return t;if("function"==typeof e.inspect)return e.inspect}(e);if(void 0!==i){var c=i.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),r=e.length-n,i=[],c=0;c<n;++c)i.push(s(e[c],t));1===r?i.push("... 1 more item"):r>1&&i.push("... ".concat(r," more items"));return"["+i.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 m(e,t,n){var r=e[t];if(r){if(!n&&"function"==typeof r)return r;var i=n?r.leave:r.enter;if("function"==typeof i)return i}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 p(e){return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c,r=void 0,i=Array.isArray(e),o=[e],a=-1,p=[],d=void 0,f=void 0,h=void 0,y=[],v=[],b=e;do{var g=++a===o.length,x=g&&0!==p.length;if(g){if(f=0===v.length?void 0:y[y.length-1],d=h,h=v.pop(),x){if(i)d=d.slice();else{for(var T={},E=0,O=Object.keys(d);E<O.length;E++){var I=O[E];T[I]=d[I]}d=T}for(var N=0,_=0;_<p.length;_++){var w=p[_][0],D=p[_][1];i&&(w-=N),i&&null===D?(d.splice(w,1),N++):d[w]=D}}a=r.index,o=r.keys,p=r.edits,i=r.inArray,r=r.prev}else{if(f=h?i?a:o[a]:void 0,null==(d=h?h[f]:b))continue;h&&y.push(f)}var S=void 0;if(!Array.isArray(d)){if(!l(d))throw new Error("Invalid AST Node: "+s(d,[]));var k=m(t,d.kind,g);if(k){if((S=k.call(t,d,f,h,y,v))===u)break;if(!1===S){if(!g){y.pop();continue}}else if(void 0!==S&&(p.push([f,S]),!g)){if(!l(S)){y.pop();continue}d=S}}}void 0===S&&x&&p.push([f,d]),g?y.pop():(r={inArray:i,index:a,keys:o,edits:p,prev:r},o=(i=Array.isArray(d))?d:n[d.kind]||[],a=-1,p=[],h&&v.push(h),h=d)}while(void 0!==r);return 0!==p.length&&(b=p[p.length-1][1]),b}(e,{leave:d})}n.d(t,"print",(function(){return p}));var d={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,r=v("(",h(e.variableDefinitions,", "),")"),i=h(e.directives," "),o=e.selectionSet;return n||i||r||"query"!==t?h([t,h([n,r]),i,o]," "):o},VariableDefinition:function(e){var t=e.variable,n=e.type,r=e.defaultValue,i=e.directives;return t+": "+n+v(" = ",r)+v(" ",h(i," "))},SelectionSet:function(e){return y(e.selections)},Field:function(e){var t=e.alias,n=e.name,r=e.arguments,i=e.directives,o=e.selectionSet;return h([v("",t,": ")+n+v("(",h(r,", "),")"),h(i," "),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,r=e.selectionSet;return h(["...",v("on ",t),h(n," "),r]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,r=e.variableDefinitions,i=e.directives,o=e.selectionSet;return("fragment ".concat(t).concat(v("(",h(r,", "),")")," ")+"on ".concat(n," ").concat(v("",h(i," ")," "))+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],r=-1===e.indexOf("\n"),i=" "===e[0]||"\t"===e[0],o='"'===e[e.length-1],a=!r||o||n,s="";return!a||r&&i||(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,r=e.directives,i=e.fields;return h(["type",t,v("implements ",h(n," & ")),h(r," "),y(i)]," ")})),FieldDefinition:f((function(e){var t=e.name,n=e.arguments,r=e.type,i=e.directives;return t+(x(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+": "+r+v(" ",h(i," "))})),InputValueDefinition:f((function(e){var t=e.name,n=e.type,r=e.defaultValue,i=e.directives;return h([t+": "+n,v("= ",r),h(i," ")]," ")})),InterfaceTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.fields;return h(["interface",t,h(n," "),y(r)]," ")})),UnionTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.types;return h(["union",t,h(n," "),r&&0!==r.length?"= "+h(r," | "):""]," ")})),EnumTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.values;return h(["enum",t,h(n," "),y(r)]," ")})),EnumValueDefinition:f((function(e){return h([e.name,h(e.directives," ")]," ")})),InputObjectTypeDefinition:f((function(e){var t=e.name,n=e.directives,r=e.fields;return h(["input",t,h(n," "),y(r)]," ")})),DirectiveDefinition:f((function(e){var t=e.name,n=e.arguments,r=e.repeatable,i=e.locations;return"directive @"+t+(x(n)?v("(\n",b(h(n,"\n")),"\n)"):v("(",h(n,", "),")"))+(r?" repeatable":"")+" on "+h(i," | ")})),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,r=e.directives,i=e.fields;return h(["extend type",t,v("implements ",h(n," & ")),h(r," "),y(i)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return h(["extend interface",t,h(n," "),y(r)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,r=e.types;return h(["extend union",t,h(n," "),r&&0!==r.length?"= "+h(r," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,r=e.values;return h(["extend enum",t,h(n," "),y(r)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,r=e.fields;return h(["extend input",t,h(n," "),y(r)]," ")}};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 g(e){return-1!==e.indexOf("\n")}function x(e){return e&&e.some(g)}},function(e,t,n){"use strict";n.r(t);var r=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 i(e,t){for(var n=null,i=0,o=e.definitions;i<o.length;i++){var a=o[i];if(a.kind===r.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 i}))}])}));

@@ -549,4 +549,2 @@ 'use strict';

const promises = [];
const dayDate = new Date();

@@ -719,3 +717,10 @@ dayDate.setDate(dayDate.getDate() - 1);

holders({ max = 100, maxCollateral = undefined, minCollateral = undefined, address = undefined } = {}) {
holders({
max = 100,
maxCollateral = undefined,
minCollateral = undefined,
address = undefined,
minMints = undefined,
minClaims = undefined,
} = {}) {
return pageResults({

@@ -730,5 +735,7 @@ api: graphAPIEndpoints.snx,

where: {
id: address ? `\\"${address}\\"` : undefined,
id: address ? `\\"${address.toLowerCase()}\\"` : undefined,
collateral_lte: maxCollateral ? `\\"${maxCollateral + '0'.repeat(18)}\\"` : undefined,
collateral_gte: minCollateral ? `\\"${minCollateral + '0'.repeat(18)}\\"` : undefined,
mints_gte: minMints || undefined,
claims_gte: minClaims || undefined,
},

@@ -745,2 +752,4 @@ },

'debtEntryAtIndex', // Debt data from SynthetixState, used to calculate debtBalance
'claims', // Total number of claims ever performed
'mints', // Total number of mints ever performed (issuance of sUSD)
],

@@ -760,2 +769,4 @@ },

debtEntryAtIndex,
mints,
claims,
}) => ({

@@ -772,2 +783,4 @@ address: id,

debtEntryAtIndex: debtEntryAtIndex ? debtEntryAtIndex / 1e27 : null,
mints: mints !== null ? +mints : 0,
claims: claims !== null ? +claims : 0,
}),

@@ -774,0 +787,0 @@ ),

{
"name": "synthetix-data",
"license": "MIT",
"version": "2.1.31",
"version": "2.1.32",
"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