@naviprotocol/lending 2.0.8 → 2.0.9-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/market.d.ts CHANGED
@@ -22,6 +22,36 @@ export declare const MARKETS: {
22
22
  key: string;
23
23
  name: string;
24
24
  };
25
+ 'sui-usdc': {
26
+ id: number;
27
+ key: string;
28
+ name: string;
29
+ };
30
+ 'wbtc-usdc': {
31
+ id: number;
32
+ key: string;
33
+ name: string;
34
+ };
35
+ 'xbtc-usdc': {
36
+ id: number;
37
+ key: string;
38
+ name: string;
39
+ };
40
+ 'vsui-usdc': {
41
+ id: number;
42
+ key: string;
43
+ name: string;
44
+ };
45
+ 'vsui-sui': {
46
+ id: number;
47
+ key: string;
48
+ name: string;
49
+ };
50
+ 'hasui-sui': {
51
+ id: number;
52
+ key: string;
53
+ name: string;
54
+ };
25
55
  };
26
56
  export declare class Market {
27
57
  private poolMap;
@@ -64,6 +94,30 @@ export declare const getMarketConfig: (marketIdentity: MarketIdentity) => {
64
94
  id: number;
65
95
  key: string;
66
96
  name: string;
97
+ } | {
98
+ id: number;
99
+ key: string;
100
+ name: string;
101
+ } | {
102
+ id: number;
103
+ key: string;
104
+ name: string;
105
+ } | {
106
+ id: number;
107
+ key: string;
108
+ name: string;
109
+ } | {
110
+ id: number;
111
+ key: string;
112
+ name: string;
113
+ } | {
114
+ id: number;
115
+ key: string;
116
+ name: string;
117
+ } | {
118
+ id: number;
119
+ key: string;
120
+ name: string;
67
121
  };
68
122
  export declare const getMarkets: (markets: MarketIdentity[], options?: Partial<EnvOption & CacheOption>) => Promise<Market[]>;
69
123
  export declare const getMarket: (market: MarketIdentity, options?: Partial<EnvOption & CacheOption>) => Promise<Market>;
@@ -1 +1 @@
1
- {"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../src/market.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,WAAW,EACX,KAAK,EACL,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AapB;AAED,eAAO,MAAM,eAAe,GAAI,gBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe7D,CAAA;AAED,eAAO,MAAM,UAAU,YAGR,cAAc,EAAE,YACf,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,KACzC,OAAO,CAAC,MAAM,EAAE,CAetB,CAAA;AAED,eAAO,MAAM,SAAS,WAEH,cAAc,YAAY,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,KAAG,OAAO,CAAC,MAAM,CAK7F,CAAA"}
package/dist/market.js CHANGED
@@ -1,7 +1,7 @@
1
- import { withCache as M, getPoolsMap as p, getEmodesMap as f, withSingleton as g } from "./utils.js";
2
- import { getPools as k } from "./pool.js";
3
- import m from "bignumber.js";
4
- const v = "main", E = {
1
+ import { withCache as M, getPoolsMap as m, getEmodesMap as p, withSingleton as k } from "./utils.js";
2
+ import { getPools as w } from "./pool.js";
3
+ import f from "bignumber.js";
4
+ const T = "main", S = {
5
5
  main: {
6
6
  id: 0,
7
7
  key: "main",
@@ -21,101 +21,131 @@ const v = "main", E = {
21
21
  id: 3,
22
22
  key: "sui-eco",
23
23
  name: "Sui Eco Market"
24
+ },
25
+ "sui-usdc": {
26
+ id: 4,
27
+ key: "sui-usdc",
28
+ name: "Sui USDC Market"
29
+ },
30
+ "wbtc-usdc": {
31
+ id: 5,
32
+ key: "wbtc-usdc",
33
+ name: "WBTC USDC Market"
34
+ },
35
+ "xbtc-usdc": {
36
+ id: 6,
37
+ key: "xbtc-usdc",
38
+ name: "XBT USDC Market"
39
+ },
40
+ "vsui-usdc": {
41
+ id: 7,
42
+ key: "vsui-usdc",
43
+ name: "VSUI USDC Market"
44
+ },
45
+ "vsui-sui": {
46
+ id: 8,
47
+ key: "vsui-sui",
48
+ name: "VSUI SUI Market"
49
+ },
50
+ "hasui-sui": {
51
+ id: 9,
52
+ key: "hasui-sui",
53
+ name: "HASUI SUI Market"
24
54
  }
25
55
  };
26
- class P {
27
- constructor(o, s) {
56
+ class y {
57
+ constructor(s, o) {
28
58
  this.poolMap = {}, this.emodeMap = {}, this.pools = [], this.emodes = [], this.emodePools = [], this.emodeBorrowablePools = [], this.emodeSupplyablePools = [], this._overview = {
29
59
  marketTotalSupplyValue: "0",
30
60
  marketTotalBorrowValue: "0"
31
- }, this.config = b(o), this.initPools(s);
61
+ }, this.config = b(s), this.initPools(o);
32
62
  }
33
63
  get overview() {
34
64
  return this._overview;
35
65
  }
36
- initPools(o) {
37
- const s = p(this.pools), i = f(this.emodes), t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
38
- let a = m(0), l = m(0);
39
- o.forEach((e) => {
66
+ initPools(s) {
67
+ const o = m(this.pools), i = p(this.emodes), t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
68
+ let a = f(0), u = f(0);
69
+ s.forEach((e) => {
40
70
  if (!this.checkMarket(e.market)) {
41
71
  console.warn(`Pool is not in market ${this.config.name}`, e);
42
72
  return;
43
73
  }
44
- s[e.uniqueId] || this.pools.push(e), e?.emodes?.forEach((u) => {
45
- i[u.uniqueId] || this.emodes.push(u), u.assets.forEach((h) => {
46
- h.isDebt && u.assets.find(
74
+ o[e.uniqueId] || this.pools.push(e), e?.emodes?.forEach((l) => {
75
+ i[l.uniqueId] || this.emodes.push(l), l.assets.forEach((h) => {
76
+ h.isDebt && l.assets.find(
47
77
  (d) => d.isCollateral && d.ltv > 0 && d.assetId !== e.id
48
- ) && t.add(e.uniqueId), h.isCollateral && u.assets.find((d) => d.isDebt && d.assetId !== e.id) && n.add(e.uniqueId);
78
+ ) && t.add(e.uniqueId), h.isCollateral && l.assets.find((d) => d.isDebt && d.assetId !== e.id) && n.add(e.uniqueId);
49
79
  });
50
- }), l = l.plus(e.poolBorrowValue), a = a.plus(e.poolSupplyValue);
51
- }), this.poolMap = p(this.pools, "id"), this.emodeMap = f(this.emodes, "emodeId"), this.emodes.forEach((e) => {
80
+ }), u = u.plus(e.poolBorrowValue), a = a.plus(e.poolSupplyValue);
81
+ }), this.poolMap = m(this.pools, "id"), this.emodeMap = p(this.emodes, "emodeId"), this.emodes.forEach((e) => {
52
82
  const c = this.getEModePools(e.emodeId);
53
83
  this.emodePools.push(...c);
54
84
  }), this._overview = {
55
85
  marketTotalSupplyValue: a.toString(),
56
- marketTotalBorrowValue: l.toString()
86
+ marketTotalBorrowValue: u.toString()
57
87
  }, this.emodeBorrowablePools = this.pools.filter((e) => t.has(e.uniqueId)), this.emodeSupplyablePools = this.pools.filter((e) => n.has(e.uniqueId));
58
88
  }
59
- getEMode(o) {
60
- return this.emodeMap[o] || null;
89
+ getEMode(s) {
90
+ return this.emodeMap[s] || null;
61
91
  }
62
- getEModeRelatePools(o, s) {
63
- const { collateral: i, debt: t, emodeId: n } = s || {}, a = [];
64
- return o.emodes.forEach((l) => {
65
- typeof n == "number" && n !== l.emodeId || l.assets.forEach((e) => {
66
- typeof i == "boolean" && i && e.isCollateral && e.assetId === o.id && a.push(this.poolMap[e.assetId]), typeof t == "boolean" && t && e.isDebt && e.assetId === o.id && a.push(this.poolMap[e.assetId]);
92
+ getEModeRelatePools(s, o) {
93
+ const { collateral: i, debt: t, emodeId: n } = o || {}, a = [];
94
+ return s.emodes.forEach((u) => {
95
+ typeof n == "number" && n !== u.emodeId || u.assets.forEach((e) => {
96
+ typeof i == "boolean" && i && e.isCollateral && e.assetId === s.id && a.push(this.poolMap[e.assetId]), typeof t == "boolean" && t && e.isDebt && e.assetId === s.id && a.push(this.poolMap[e.assetId]);
67
97
  });
68
98
  }), a;
69
99
  }
70
- getEModePools(o) {
71
- const s = this.getEMode(o);
72
- return s ? s.assets.map((t) => t.assetId).map((t) => this.poolMap[t]).filter((t) => !!t).map((t) => {
73
- const n = s.assets.find((a) => a.assetId === t.id);
100
+ getEModePools(s) {
101
+ const o = this.getEMode(s);
102
+ return o ? o.assets.map((t) => t.assetId).map((t) => this.poolMap[t]).filter((t) => !!t).map((t) => {
103
+ const n = o.assets.find((a) => a.assetId === t.id);
74
104
  return {
75
105
  ...t,
76
106
  emode: {
77
107
  ...n,
78
- emodeId: s.emodeId
108
+ emodeId: o.emodeId
79
109
  },
80
110
  isEMode: !0
81
111
  };
82
112
  }) : [];
83
113
  }
84
- checkMarket(o) {
85
- let s = !1;
86
- return typeof o == "number" && o === this.config.id && (s = !0), typeof o == "string" && o === this.config.key && (s = !0), typeof o == "object" && o.id === this.config.id && (s = !0), s;
114
+ checkMarket(s) {
115
+ let o = !1;
116
+ return typeof s == "number" && s === this.config.id && (o = !0), typeof s == "string" && s === this.config.key && (o = !0), typeof s == "object" && s.id === this.config.id && (o = !0), o;
87
117
  }
88
118
  }
89
119
  const b = (r) => {
90
- const s = Object.values(E).find((i) => typeof r == "number" ? i.id === r : typeof r == "string" ? i.key === r : i.id === r.id);
91
- if (!s)
120
+ const o = Object.values(S).find((i) => typeof r == "number" ? i.id === r : typeof r == "string" ? i.key === r : i.id === r.id);
121
+ if (!o)
92
122
  throw new Error("Market not found");
93
- return s;
94
- }, y = M(
95
- g(
96
- async (r, o) => {
97
- const s = await k({
123
+ return o;
124
+ }, E = M(
125
+ k(
126
+ async (r, s) => {
127
+ const o = await w({
98
128
  cacheTime: 6e4,
99
- ...o,
129
+ ...s,
100
130
  markets: r
101
131
  });
102
132
  return r.map((i) => {
103
- const t = b(i), n = s.filter((a) => a.market === t.key);
104
- return new P(i, n);
133
+ const t = b(i), n = o.filter((a) => a.market === t.key);
134
+ return new y(i, n);
105
135
  });
106
136
  }
107
137
  )
108
138
  ), B = M(
109
- g(
110
- async (r, o) => (await y([r], o))[0]
139
+ k(
140
+ async (r, s) => (await E([r], s))[0]
111
141
  )
112
142
  );
113
143
  export {
114
- v as DEFAULT_MARKET_IDENTITY,
115
- E as MARKETS,
116
- P as Market,
144
+ T as DEFAULT_MARKET_IDENTITY,
145
+ S as MARKETS,
146
+ y as Market,
117
147
  B as getMarket,
118
148
  b as getMarketConfig,
119
- y as getMarkets
149
+ E as getMarkets
120
150
  };
121
151
  //# sourceMappingURL=market.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"market.js","sources":["../src/market.ts"],"sourcesContent":["import { withCache, withSingleton, getPoolsMap, getEmodesMap } from './utils'\nimport type {\n MarketIdentity,\n EnvOption,\n CacheOption,\n EMode,\n MarketConfig,\n Pool,\n EModePool\n} from './types'\nimport { getPools } from './pool'\nimport BigNumber from 'bignumber.js'\n\nexport const DEFAULT_MARKET_IDENTITY = 'main'\n\nexport const MARKETS = {\n main: {\n id: 0,\n key: 'main',\n name: 'Main Market'\n },\n ember: {\n id: 1,\n key: 'ember',\n name: 'Ember Market'\n },\n rwa: {\n id: 2,\n key: 'rwa',\n name: 'Matrixdock Market'\n },\n 'sui-eco': {\n id: 3,\n key: 'sui-eco',\n name: 'Sui Eco Market'\n }\n}\n\nexport class Market {\n private poolMap = {} as Record<string, Pool>\n private emodeMap = {} as Record<string, EMode>\n readonly config: MarketConfig\n readonly pools: Pool[] = []\n readonly emodes: EMode[] = []\n readonly emodePools: EModePool[] = []\n emodeBorrowablePools: Pool[] = []\n emodeSupplyablePools: Pool[] = []\n\n private _overview = {\n marketTotalSupplyValue: '0',\n marketTotalBorrowValue: '0'\n }\n\n get overview() {\n return this._overview\n }\n\n constructor(marketIdentity: MarketIdentity, pools: Pool[]) {\n this.config = getMarketConfig(marketIdentity)\n this.initPools(pools)\n }\n\n private initPools(pools: Pool[]) {\n const poolsMap = getPoolsMap(this.pools)\n const emodesMap = getEmodesMap(this.emodes)\n const emodeBorrowablePoolIds = new Set<string>()\n const emodeSupplyablePoolIds = new Set<string>()\n let marketTotalSupplyValue = BigNumber(0)\n let marketTotalBorrowValue = BigNumber(0)\n\n pools.forEach((pool) => {\n const isMatch = this.checkMarket(pool.market)\n if (!isMatch) {\n console.warn(`Pool is not in market ${this.config.name}`, pool)\n return\n }\n if (!poolsMap[pool.uniqueId]) {\n this.pools.push(pool)\n }\n pool?.emodes?.forEach((emode) => {\n if (!emodesMap[emode.uniqueId]) {\n this.emodes.push(emode)\n }\n emode.assets.forEach((asset) => {\n if (asset.isDebt) {\n const debtAsset = emode.assets.find(\n (a) => a.isCollateral && a.ltv > 0 && a.assetId !== pool.id\n )\n if (debtAsset) {\n emodeBorrowablePoolIds.add(pool.uniqueId)\n }\n }\n if (asset.isCollateral) {\n const supplyAsset = emode.assets.find((a) => a.isDebt && a.assetId !== pool.id)\n if (supplyAsset) {\n emodeSupplyablePoolIds.add(pool.uniqueId)\n }\n }\n })\n })\n marketTotalBorrowValue = marketTotalBorrowValue.plus(pool.poolBorrowValue)\n marketTotalSupplyValue = marketTotalSupplyValue.plus(pool.poolSupplyValue)\n })\n this.poolMap = getPoolsMap(this.pools, 'id')\n this.emodeMap = getEmodesMap(this.emodes, 'emodeId')\n this.emodes.forEach((emode) => {\n const emodePools = this.getEModePools(emode.emodeId)\n this.emodePools.push(...emodePools)\n })\n this._overview = {\n marketTotalSupplyValue: marketTotalSupplyValue.toString(),\n marketTotalBorrowValue: marketTotalBorrowValue.toString()\n }\n this.emodeBorrowablePools = this.pools.filter((pool) => {\n return emodeBorrowablePoolIds.has(pool.uniqueId)\n })\n this.emodeSupplyablePools = this.pools.filter((pool) => {\n return emodeSupplyablePoolIds.has(pool.uniqueId)\n })\n }\n\n public getEMode(emodeId: number): EMode | null {\n const emode = this.emodeMap[emodeId]\n return emode || null\n }\n\n public getEModeRelatePools(\n pool: Pool,\n options?: {\n collateral?: boolean\n debt?: boolean\n emodeId?: number\n }\n ): Pool[] {\n const { collateral, debt, emodeId } = options || {}\n const relatePools = [] as Pool[]\n pool.emodes.forEach((emode) => {\n if (typeof emodeId === 'number' && emodeId !== emode.emodeId) {\n return\n }\n emode.assets.forEach((asset) => {\n if (\n typeof collateral === 'boolean' &&\n collateral &&\n asset.isCollateral &&\n asset.assetId === pool.id\n ) {\n relatePools.push(this.poolMap[asset.assetId])\n }\n if (typeof debt === 'boolean' && debt && asset.isDebt && asset.assetId === pool.id) {\n relatePools.push(this.poolMap[asset.assetId])\n }\n })\n })\n return relatePools\n }\n\n public getEModePools(emodeId: number): EModePool[] {\n const emode = this.getEMode(emodeId)\n if (!emode) {\n return []\n }\n const pools = emode.assets\n .map((asset) => asset.assetId)\n .map((id) => {\n return this.poolMap[id]\n })\n .filter((pool) => !!pool)\n return pools.map((pool) => {\n const asset = emode.assets.find((asset) => asset.assetId === pool.id)!\n return {\n ...pool,\n emode: {\n ...asset,\n emodeId: emode.emodeId\n },\n isEMode: true\n }\n })\n }\n\n private checkMarket(marketIdentity: MarketIdentity) {\n let isMatch = false\n if (typeof marketIdentity === 'number' && marketIdentity === this.config.id) {\n isMatch = true\n }\n if (typeof marketIdentity === 'string' && marketIdentity === this.config.key) {\n isMatch = true\n }\n if (typeof marketIdentity === 'object' && marketIdentity.id === this.config.id) {\n isMatch = true\n }\n return isMatch\n }\n}\n\nexport const getMarketConfig = (marketIdentity: MarketIdentity) => {\n const configs = Object.values(MARKETS)\n const config = configs.find((marketConfig) => {\n if (typeof marketIdentity === 'number') {\n return marketConfig.id === marketIdentity\n }\n if (typeof marketIdentity === 'string') {\n return marketConfig.key === marketIdentity\n }\n return marketConfig.id === marketIdentity.id\n })\n if (!config) {\n throw new Error(`Market not found`)\n }\n return config\n}\n\nexport const getMarkets = withCache(\n withSingleton(\n async (\n markets: MarketIdentity[],\n options?: Partial<EnvOption & CacheOption>\n ): Promise<Market[]> => {\n const pools = await getPools({\n cacheTime: 1000 * 60,\n ...options,\n markets\n })\n return markets.map((market) => {\n const marketConfig = getMarketConfig(market)\n const marketPools = pools.filter((pool) => {\n return pool.market === marketConfig.key\n })\n return new Market(market, marketPools)\n })\n }\n )\n)\n\nexport const getMarket = withCache(\n withSingleton(\n async (market: MarketIdentity, options?: Partial<EnvOption & CacheOption>): Promise<Market> => {\n const markets = await getMarkets([market], options)\n return markets[0]\n }\n )\n)\n"],"names":["DEFAULT_MARKET_IDENTITY","MARKETS","Market","marketIdentity","pools","getMarketConfig","poolsMap","getPoolsMap","emodesMap","getEmodesMap","emodeBorrowablePoolIds","emodeSupplyablePoolIds","marketTotalSupplyValue","BigNumber","marketTotalBorrowValue","pool","emode","asset","a","emodePools","emodeId","options","collateral","debt","relatePools","id","isMatch","config","marketConfig","getMarkets","withCache","withSingleton","markets","getPools","market","marketPools","getMarket"],"mappings":";;;AAaO,MAAMA,IAA0B,QAE1BC,IAAU;AAAA,EACrB,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,KAAK;AAAA,IACH,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;AAEO,MAAMC,EAAO;AAAA,EAmBlB,YAAYC,GAAgCC,GAAe;AAlB3D,SAAQ,UAAU,CAAA,GAClB,KAAQ,WAAW,CAAA,GAEnB,KAAS,QAAgB,CAAA,GACzB,KAAS,SAAkB,CAAA,GAC3B,KAAS,aAA0B,CAAA,GACnC,KAAA,uBAA+B,CAAA,GAC/B,KAAA,uBAA+B,CAAA,GAE/B,KAAQ,YAAY;AAAA,MAClB,wBAAwB;AAAA,MACxB,wBAAwB;AAAA,IAAA,GAQxB,KAAK,SAASC,EAAgBF,CAAc,GAC5C,KAAK,UAAUC,CAAK;AAAA,EACtB;AAAA,EAPA,IAAI,WAAW;AACb,WAAO,KAAK;AAAA,EACd;AAAA,EAOQ,UAAUA,GAAe;AAC/B,UAAME,IAAWC,EAAY,KAAK,KAAK,GACjCC,IAAYC,EAAa,KAAK,MAAM,GACpCC,wBAA6B,IAAA,GAC7BC,wBAA6B,IAAA;AACnC,QAAIC,IAAyBC,EAAU,CAAC,GACpCC,IAAyBD,EAAU,CAAC;AAExC,IAAAT,EAAM,QAAQ,CAACW,MAAS;AAEt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AOvB,KAAmB,YAAYA,MAAmB,KAAK,OAAO,OACvEuB,IAAU,KAER,OAAOvB,KAAmB,YAAYA,MAAmB,KAAK,OAAO,QACvEuB,IAAU,KAER,OAAOvB,KAAmB,YAAYA,EAAe,OAAO,KAAK,OAAO,OAC1EuB,IAAU,KAELA;AAAA,EACT;AACF;AAEO,MAAMrB,IAAkB,CAACF,MAAmC;AAEjE,QAAMwB,IADU,OAAO,OAAO1B,CAAO,EACd,KAAK,CAAC2B,MACvB,OAAOzB,KAAmB,WACrByB,EAAa,OAAOzB,IAEzB,OAAOA,KAAmB,WACrByB,EAAa,QAAQzB,IAEvByB,EAAa,OAAOzB,EAAe,EAC3C;AACD,MAAI,CAACwB;AACH,UAAM,IAAI,MAAM,kBAAkB;AAEpC,SAAOA;AACT,GAEaE,IAAaC;AAAA,EACxBC;AAAA,IACE,OACEC,GACAX,MACsB;AACtB,YAAMjB,IAAQ,MAAM6B,EAAS;AAAA,QAC3B,WAAW;AAAA,QACX,GAAGZ;AAAA,QACH,SAAAW;AAAA,MAAA,CACD;AACD,aAAOA,EAAQ,IAAI,CAACE,MAAW;AAC7B,cAAMN,IAAevB,EAAgB6B,CAAM,GACrCC,IAAc/B,EAAM,OAAO,CAACW,MACzBA,EAAK,WAAWa,EAAa,GACrC;AACD,eAAO,IAAI1B,EAAOgC,GAAQC,CAAW;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,EAAA;AAEJ,GAEaC,IAAYN;AAAA,EACvBC;AAAA,IACE,OAAOG,GAAwBb,OACb,MAAMQ,EAAW,CAACK,CAAM,GAAGb,CAAO,GACnC,CAAC;AAAA,EAClB;AAEJ;"}
1
+ {"version":3,"file":"market.js","sources":["../src/market.ts"],"sourcesContent":["import { withCache, withSingleton, getPoolsMap, getEmodesMap } from './utils'\nimport type {\n MarketIdentity,\n EnvOption,\n CacheOption,\n EMode,\n MarketConfig,\n Pool,\n EModePool\n} from './types'\nimport { getPools } from './pool'\nimport BigNumber from 'bignumber.js'\n\nexport const DEFAULT_MARKET_IDENTITY = 'main'\n\nexport const MARKETS = {\n main: {\n id: 0,\n key: 'main',\n name: 'Main Market'\n },\n ember: {\n id: 1,\n key: 'ember',\n name: 'Ember Market'\n },\n rwa: {\n id: 2,\n key: 'rwa',\n name: 'Matrixdock Market'\n },\n 'sui-eco': {\n id: 3,\n key: 'sui-eco',\n name: 'Sui Eco Market'\n },\n 'sui-usdc': {\n id: 4,\n key: 'sui-usdc',\n name: 'Sui USDC Market'\n },\n 'wbtc-usdc': {\n id: 5,\n key: 'wbtc-usdc',\n name: 'WBTC USDC Market'\n },\n 'xbtc-usdc': {\n id: 6,\n key: 'xbtc-usdc',\n name: 'XBT USDC Market'\n },\n 'vsui-usdc': {\n id: 7,\n key: 'vsui-usdc',\n name: 'VSUI USDC Market'\n },\n 'vsui-sui': {\n id: 8,\n key: 'vsui-sui',\n name: 'VSUI SUI Market'\n },\n 'hasui-sui': {\n id: 9,\n key: 'hasui-sui',\n name: 'HASUI SUI Market'\n }\n}\n\nexport class Market {\n private poolMap = {} as Record<string, Pool>\n private emodeMap = {} as Record<string, EMode>\n readonly config: MarketConfig\n readonly pools: Pool[] = []\n readonly emodes: EMode[] = []\n readonly emodePools: EModePool[] = []\n emodeBorrowablePools: Pool[] = []\n emodeSupplyablePools: Pool[] = []\n\n private _overview = {\n marketTotalSupplyValue: '0',\n marketTotalBorrowValue: '0'\n }\n\n get overview() {\n return this._overview\n }\n\n constructor(marketIdentity: MarketIdentity, pools: Pool[]) {\n this.config = getMarketConfig(marketIdentity)\n this.initPools(pools)\n }\n\n private initPools(pools: Pool[]) {\n const poolsMap = getPoolsMap(this.pools)\n const emodesMap = getEmodesMap(this.emodes)\n const emodeBorrowablePoolIds = new Set<string>()\n const emodeSupplyablePoolIds = new Set<string>()\n let marketTotalSupplyValue = BigNumber(0)\n let marketTotalBorrowValue = BigNumber(0)\n\n pools.forEach((pool) => {\n const isMatch = this.checkMarket(pool.market)\n if (!isMatch) {\n console.warn(`Pool is not in market ${this.config.name}`, pool)\n return\n }\n if (!poolsMap[pool.uniqueId]) {\n this.pools.push(pool)\n }\n pool?.emodes?.forEach((emode) => {\n if (!emodesMap[emode.uniqueId]) {\n this.emodes.push(emode)\n }\n emode.assets.forEach((asset) => {\n if (asset.isDebt) {\n const debtAsset = emode.assets.find(\n (a) => a.isCollateral && a.ltv > 0 && a.assetId !== pool.id\n )\n if (debtAsset) {\n emodeBorrowablePoolIds.add(pool.uniqueId)\n }\n }\n if (asset.isCollateral) {\n const supplyAsset = emode.assets.find((a) => a.isDebt && a.assetId !== pool.id)\n if (supplyAsset) {\n emodeSupplyablePoolIds.add(pool.uniqueId)\n }\n }\n })\n })\n marketTotalBorrowValue = marketTotalBorrowValue.plus(pool.poolBorrowValue)\n marketTotalSupplyValue = marketTotalSupplyValue.plus(pool.poolSupplyValue)\n })\n this.poolMap = getPoolsMap(this.pools, 'id')\n this.emodeMap = getEmodesMap(this.emodes, 'emodeId')\n this.emodes.forEach((emode) => {\n const emodePools = this.getEModePools(emode.emodeId)\n this.emodePools.push(...emodePools)\n })\n this._overview = {\n marketTotalSupplyValue: marketTotalSupplyValue.toString(),\n marketTotalBorrowValue: marketTotalBorrowValue.toString()\n }\n this.emodeBorrowablePools = this.pools.filter((pool) => {\n return emodeBorrowablePoolIds.has(pool.uniqueId)\n })\n this.emodeSupplyablePools = this.pools.filter((pool) => {\n return emodeSupplyablePoolIds.has(pool.uniqueId)\n })\n }\n\n public getEMode(emodeId: number): EMode | null {\n const emode = this.emodeMap[emodeId]\n return emode || null\n }\n\n public getEModeRelatePools(\n pool: Pool,\n options?: {\n collateral?: boolean\n debt?: boolean\n emodeId?: number\n }\n ): Pool[] {\n const { collateral, debt, emodeId } = options || {}\n const relatePools = [] as Pool[]\n pool.emodes.forEach((emode) => {\n if (typeof emodeId === 'number' && emodeId !== emode.emodeId) {\n return\n }\n emode.assets.forEach((asset) => {\n if (\n typeof collateral === 'boolean' &&\n collateral &&\n asset.isCollateral &&\n asset.assetId === pool.id\n ) {\n relatePools.push(this.poolMap[asset.assetId])\n }\n if (typeof debt === 'boolean' && debt && asset.isDebt && asset.assetId === pool.id) {\n relatePools.push(this.poolMap[asset.assetId])\n }\n })\n })\n return relatePools\n }\n\n public getEModePools(emodeId: number): EModePool[] {\n const emode = this.getEMode(emodeId)\n if (!emode) {\n return []\n }\n const pools = emode.assets\n .map((asset) => asset.assetId)\n .map((id) => {\n return this.poolMap[id]\n })\n .filter((pool) => !!pool)\n return pools.map((pool) => {\n const asset = emode.assets.find((asset) => asset.assetId === pool.id)!\n return {\n ...pool,\n emode: {\n ...asset,\n emodeId: emode.emodeId\n },\n isEMode: true\n }\n })\n }\n\n private checkMarket(marketIdentity: MarketIdentity) {\n let isMatch = false\n if (typeof marketIdentity === 'number' && marketIdentity === this.config.id) {\n isMatch = true\n }\n if (typeof marketIdentity === 'string' && marketIdentity === this.config.key) {\n isMatch = true\n }\n if (typeof marketIdentity === 'object' && marketIdentity.id === this.config.id) {\n isMatch = true\n }\n return isMatch\n }\n}\n\nexport const getMarketConfig = (marketIdentity: MarketIdentity) => {\n const configs = Object.values(MARKETS)\n const config = configs.find((marketConfig) => {\n if (typeof marketIdentity === 'number') {\n return marketConfig.id === marketIdentity\n }\n if (typeof marketIdentity === 'string') {\n return marketConfig.key === marketIdentity\n }\n return marketConfig.id === marketIdentity.id\n })\n if (!config) {\n throw new Error(`Market not found`)\n }\n return config\n}\n\nexport const getMarkets = withCache(\n withSingleton(\n async (\n markets: MarketIdentity[],\n options?: Partial<EnvOption & CacheOption>\n ): Promise<Market[]> => {\n const pools = await getPools({\n cacheTime: 1000 * 60,\n ...options,\n markets\n })\n return markets.map((market) => {\n const marketConfig = getMarketConfig(market)\n const marketPools = pools.filter((pool) => {\n return pool.market === marketConfig.key\n })\n return new Market(market, marketPools)\n })\n }\n )\n)\n\nexport const getMarket = withCache(\n withSingleton(\n async (market: MarketIdentity, options?: Partial<EnvOption & CacheOption>): Promise<Market> => {\n const markets = await getMarkets([market], options)\n return markets[0]\n }\n )\n)\n"],"names":["DEFAULT_MARKET_IDENTITY","MARKETS","Market","marketIdentity","pools","getMarketConfig","poolsMap","getPoolsMap","emodesMap","getEmodesMap","emodeBorrowablePoolIds","emodeSupplyablePoolIds","marketTotalSupplyValue","BigNumber","marketTotalBorrowValue","pool","emode","asset","a","emodePools","emodeId","options","collateral","debt","relatePools","id","isMatch","config","marketConfig","getMarkets","withCache","withSingleton","markets","getPools","market","marketPools","getMarket"],"mappings":";;;AAaO,MAAMA,IAA0B,QAE1BC,IAAU;AAAA,EACrB,MAAM;AAAA,IACJ,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,KAAK;AAAA,IACH,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,YAAY;AAAA,IACV,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,YAAY;AAAA,IACV,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAAA,EAER,aAAa;AAAA,IACX,IAAI;AAAA,IACJ,KAAK;AAAA,IACL,MAAM;AAAA,EAAA;AAEV;AAEO,MAAMC,EAAO;AAAA,EAmBlB,YAAYC,GAAgCC,GAAe;AAlB3D,SAAQ,UAAU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AAA,QACH,SAAAW;AAAA,MAAA,CACD;AACD,aAAOA,EAAQ,IAAI,CAACE,MAAW;AAC7B,cAAMN,IAAevB,EAAgB6B,CAAM,GACrCC,IAAc/B,EAAM,OAAO,CAACW,MACzBA,EAAK,WAAWa,EAAa,GACrC;AACD,eAAO,IAAI1B,EAAOgC,GAAQC,CAAW;AAAA,MACvC,CAAC;AAAA,IACH;AAAA,EAAA;AAEJ,GAEaC,IAAYN;AAAA,EACvBC;AAAA,IACE,OAAOG,GAAwBb,OACb,MAAMQ,EAAW,CAACK,CAAM,GAAGb,CAAO,GACnC,CAAC;AAAA,EAClB;AAEJ;"}
@@ -1,8 +1,8 @@
1
- const o = "2.0.8", s = {
2
- version: o
1
+ const e = "2.0.9-beta.1", o = {
2
+ version: e
3
3
  };
4
4
  export {
5
- s as default,
6
- o as version
5
+ o as default,
6
+ e as version
7
7
  };
8
8
  //# sourceMappingURL=package.json.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naviprotocol/lending",
3
- "version": "2.0.8",
3
+ "version": "2.0.9-beta.1",
4
4
  "description": "NAVI Lending SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",