@owney/sdk 0.6.9-beta.8 → 0.6.9-beta.9

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/index.cjs CHANGED
@@ -779,6 +779,10 @@ var DECIMALS_BY_SYMBOL = {
779
779
  wbtc: 8,
780
780
  cbbtc: 8
781
781
  };
782
+ function canonicalSymbol(symbol) {
783
+ const upper = symbol.toUpperCase();
784
+ return upper === "ETH" ? "WETH" : upper;
785
+ }
782
786
  function tokenDecimals(symbol, explicit) {
783
787
  if (typeof explicit === "number" && Number.isFinite(explicit))
784
788
  return explicit;
@@ -821,7 +825,7 @@ function mapBalances(raw, _chainId, smartWallet) {
821
825
  const detailByKey = /* @__PURE__ */ new Map();
822
826
  for (const p of rawPositions) {
823
827
  const cid = resolveChainId(p.chain ?? "");
824
- const symbol = (p.token_symbol ?? "").toUpperCase();
828
+ const symbol = canonicalSymbol(p.token_symbol ?? "");
825
829
  if (Number.isFinite(cid) && symbol) detailByKey.set(`${cid}:${symbol}`, p);
826
830
  }
827
831
  let totalBalance = 0;
@@ -841,13 +845,17 @@ function mapBalances(raw, _chainId, smartWallet) {
841
845
  asset: symbol,
842
846
  amount: String(amount)
843
847
  });
844
- const detail = detailByKey.get(`${positionChainId}:${symbol.toUpperCase()}`);
848
+ const detail = detailByKey.get(
849
+ `${positionChainId}:${canonicalSymbol(symbol)}`
850
+ );
845
851
  positions.push({
846
852
  chain: chainName,
847
853
  protocol: detail?.protocol_name ?? detail?.protocol_id ?? "",
848
854
  protocolId: detail?.protocol_id,
849
855
  pool: detail?.pool,
850
- asset: symbol,
856
+ // Report the token the way the rest of owney spells it ("WETH", as the
857
+ // pre-portfolioByChain mapper did), not Zyfai's internal "eth".
858
+ asset: canonicalSymbol(symbol),
851
859
  amount: String(amount),
852
860
  apy: detail?.pool_apy,
853
861
  tvl: detail?.pool_tvl,
package/dist/index.js CHANGED
@@ -112,6 +112,10 @@ var DECIMALS_BY_SYMBOL = {
112
112
  wbtc: 8,
113
113
  cbbtc: 8
114
114
  };
115
+ function canonicalSymbol(symbol) {
116
+ const upper = symbol.toUpperCase();
117
+ return upper === "ETH" ? "WETH" : upper;
118
+ }
115
119
  function tokenDecimals(symbol, explicit) {
116
120
  if (typeof explicit === "number" && Number.isFinite(explicit))
117
121
  return explicit;
@@ -154,7 +158,7 @@ function mapBalances(raw, _chainId, smartWallet) {
154
158
  const detailByKey = /* @__PURE__ */ new Map();
155
159
  for (const p of rawPositions) {
156
160
  const cid = resolveChainId(p.chain ?? "");
157
- const symbol = (p.token_symbol ?? "").toUpperCase();
161
+ const symbol = canonicalSymbol(p.token_symbol ?? "");
158
162
  if (Number.isFinite(cid) && symbol) detailByKey.set(`${cid}:${symbol}`, p);
159
163
  }
160
164
  let totalBalance = 0;
@@ -174,13 +178,17 @@ function mapBalances(raw, _chainId, smartWallet) {
174
178
  asset: symbol,
175
179
  amount: String(amount)
176
180
  });
177
- const detail = detailByKey.get(`${positionChainId}:${symbol.toUpperCase()}`);
181
+ const detail = detailByKey.get(
182
+ `${positionChainId}:${canonicalSymbol(symbol)}`
183
+ );
178
184
  positions.push({
179
185
  chain: chainName,
180
186
  protocol: detail?.protocol_name ?? detail?.protocol_id ?? "",
181
187
  protocolId: detail?.protocol_id,
182
188
  pool: detail?.pool,
183
- asset: symbol,
189
+ // Report the token the way the rest of owney spells it ("WETH", as the
190
+ // pre-portfolioByChain mapper did), not Zyfai's internal "eth".
191
+ asset: canonicalSymbol(symbol),
184
192
  amount: String(amount),
185
193
  apy: detail?.pool_apy,
186
194
  tvl: detail?.pool_tvl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.6.9-beta.8",
3
+ "version": "0.6.9-beta.9",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",