@owney/sdk 0.7.22-beta.2 → 0.7.22-beta.3

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
@@ -526,8 +526,8 @@ var init_surfliquid_broker = __esm({
526
526
  // src/agents/surfliquid/surfliquid.mapper.ts
527
527
  function mapMessage(message) {
528
528
  const action = SURFLIQUID_ACTION_MAP[message.transactionType];
529
- if (!action) return null;
530
- return {
529
+ if (!action) return [];
530
+ const base5 = {
531
531
  agent: "surfliquid",
532
532
  action,
533
533
  date: message.timestamp,
@@ -543,9 +543,27 @@ function mapMessage(message) {
543
543
  ],
544
544
  rebalanceLog: []
545
545
  };
546
+ if (DEPOSIT_TRANSACTION_TYPES.has(message.transactionType) && message.toVault?.name && message.amount != null) {
547
+ return [
548
+ base5,
549
+ {
550
+ ...base5,
551
+ action: "Deposit",
552
+ positions: [
553
+ {
554
+ protocol: SURFLIQUID_PROTOCOL,
555
+ pool: message.toVault.name,
556
+ tokenSymbol: message.token ?? void 0,
557
+ amount: String(message.amount)
558
+ }
559
+ ]
560
+ }
561
+ ];
562
+ }
563
+ return [base5];
546
564
  }
547
565
  function mapHistory(result, _chainId) {
548
- const data = result.messages.map(mapMessage).filter((entry) => entry !== null);
566
+ const data = result.messages.flatMap(mapMessage);
549
567
  const hasMore = result.page < result.pages;
550
568
  return {
551
569
  data,
@@ -620,11 +638,17 @@ function mapUserProfile2(vault, address) {
620
638
  protocols: ["SurfLiquid"]
621
639
  };
622
640
  }
623
- var APY_WINDOW_KEY;
641
+ var SURFLIQUID_PROTOCOL, DEPOSIT_TRANSACTION_TYPES, APY_WINDOW_KEY;
624
642
  var init_surfliquid_mapper = __esm({
625
643
  "src/agents/surfliquid/surfliquid.mapper.ts"() {
626
644
  "use strict";
627
645
  init_surfliquid_constants();
646
+ SURFLIQUID_PROTOCOL = "Morpho";
647
+ DEPOSIT_TRANSACTION_TYPES = /* @__PURE__ */ new Set([
648
+ "INITIAL_DEPOSIT",
649
+ "DEPOSIT",
650
+ "USER_DEPOSIT"
651
+ ]);
628
652
  APY_WINDOW_KEY = {
629
653
  "7D": "apy7d",
630
654
  "14D": "apy14d",
package/dist/index.js CHANGED
@@ -3036,7 +3036,7 @@ var OwneySDK = class {
3036
3036
  }
3037
3037
  if (agentId === "surfliquid") {
3038
3038
  if (!key2) return null;
3039
- const { SurfLiquidAgent } = await import("./surfliquid.agent-E54CPWXF.js");
3039
+ const { SurfLiquidAgent } = await import("./surfliquid.agent-BFBNEQQI.js");
3040
3040
  return new SurfLiquidAgent({
3041
3041
  apiKey: this.apiKey,
3042
3042
  routingApiBaseUrl: this.routingApiBaseUrl
@@ -261,10 +261,16 @@ function createSurfBroker(options) {
261
261
  }
262
262
 
263
263
  // src/agents/surfliquid/surfliquid.mapper.ts
264
+ var SURFLIQUID_PROTOCOL = "Morpho";
265
+ var DEPOSIT_TRANSACTION_TYPES = /* @__PURE__ */ new Set([
266
+ "INITIAL_DEPOSIT",
267
+ "DEPOSIT",
268
+ "USER_DEPOSIT"
269
+ ]);
264
270
  function mapMessage(message) {
265
271
  const action = SURFLIQUID_ACTION_MAP[message.transactionType];
266
- if (!action) return null;
267
- return {
272
+ if (!action) return [];
273
+ const base2 = {
268
274
  agent: "surfliquid",
269
275
  action,
270
276
  date: message.timestamp,
@@ -280,9 +286,27 @@ function mapMessage(message) {
280
286
  ],
281
287
  rebalanceLog: []
282
288
  };
289
+ if (DEPOSIT_TRANSACTION_TYPES.has(message.transactionType) && message.toVault?.name && message.amount != null) {
290
+ return [
291
+ base2,
292
+ {
293
+ ...base2,
294
+ action: "Deposit",
295
+ positions: [
296
+ {
297
+ protocol: SURFLIQUID_PROTOCOL,
298
+ pool: message.toVault.name,
299
+ tokenSymbol: message.token ?? void 0,
300
+ amount: String(message.amount)
301
+ }
302
+ ]
303
+ }
304
+ ];
305
+ }
306
+ return [base2];
283
307
  }
284
308
  function mapHistory(result, _chainId) {
285
- const data = result.messages.map(mapMessage).filter((entry) => entry !== null);
309
+ const data = result.messages.flatMap(mapMessage);
286
310
  const hasMore = result.page < result.pages;
287
311
  return {
288
312
  data,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owney/sdk",
3
- "version": "0.7.22-beta.2",
3
+ "version": "0.7.22-beta.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",