@gearbox-protocol/sdk 12.9.0 → 12.9.2

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.
@@ -30,17 +30,14 @@ function assembleOperations(input) {
30
30
  executeResults,
31
31
  register,
32
32
  underlying,
33
- txHash,
34
- blockNumber,
35
33
  liquidationRemainingFunds,
36
34
  phantomTokens,
37
35
  strict
38
36
  } = input;
39
37
  let offset = 0;
40
- const meta = { txHash, blockNumber };
41
38
  return facadeCalls.map((fc) => {
42
39
  if (fc.operation === "PartiallyLiquidateCreditAccount") {
43
- return assemblePartialLiquidation(fc, meta);
40
+ return assemblePartialLiquidation(fc);
44
41
  }
45
42
  const count = countAdapterCalls(fc.innerCalls, register);
46
43
  const sliced = executeResults.slice(offset, offset + count);
@@ -59,7 +56,6 @@ function assembleOperations(input) {
59
56
  switch (fc.operation) {
60
57
  case "OpenCreditAccount":
61
58
  return {
62
- ...meta,
63
59
  operation: fc.operation,
64
60
  creditAccount: fc.creditAccount,
65
61
  onBehalfOf: fc.parsed.rawArgs.onBehalfOf,
@@ -68,7 +64,6 @@ function assembleOperations(input) {
68
64
  };
69
65
  case "LiquidateCreditAccount":
70
66
  return {
71
- ...meta,
72
67
  operation: fc.operation,
73
68
  creditAccount: fc.creditAccount,
74
69
  to: fc.parsed.rawArgs.to,
@@ -78,7 +73,6 @@ function assembleOperations(input) {
78
73
  };
79
74
  default:
80
75
  return {
81
- ...meta,
82
76
  operation: fc.operation,
83
77
  creditAccount: fc.creditAccount,
84
78
  multicall
@@ -92,10 +86,9 @@ function countAdapterCalls(innerCalls, register) {
92
86
  return !contract || contract instanceof import_adapters.AbstractAdapterContract;
93
87
  }).length;
94
88
  }
95
- function assemblePartialLiquidation(fc, meta) {
89
+ function assemblePartialLiquidation(fc) {
96
90
  const { rawArgs } = fc.parsed;
97
91
  return {
98
- ...meta,
99
92
  operation: "PartiallyLiquidateCreditAccount",
100
93
  creditAccount: fc.creditAccount,
101
94
  token: rawArgs.token,
@@ -38,6 +38,7 @@ function parseCreditAccountTransaction(input) {
38
38
  const logs = receipt.logs;
39
39
  const txHash = receipt.transactionHash;
40
40
  const blockNumber = Number(receipt.blockNumber);
41
+ const timestamp = Number(receipt.blockTimestamp ?? 0);
41
42
  const facadeCalls = (0, import_findFacadeCalls.findFacadeCalls)(
42
43
  trace,
43
44
  creditFacade,
@@ -51,21 +52,27 @@ function parseCreditAccountTransaction(input) {
51
52
  liquidationRemainingFunds,
52
53
  phantomTokens
53
54
  } = (0, import_extractTransfers.extractTransfers)(logs, creditAccount, pool, creditFacade);
55
+ const meta = {
56
+ creditFacade,
57
+ timestamp,
58
+ blockNumber,
59
+ txHash
60
+ };
54
61
  const facadeOps = (0, import_assembleOperations.assembleOperations)({
55
62
  facadeCalls,
56
63
  executeResults,
57
64
  register,
58
65
  underlying,
59
- txHash,
60
- blockNumber,
61
66
  liquidationRemainingFunds,
62
67
  phantomTokens,
63
68
  strict
64
- });
69
+ }).map((o) => ({ ...o, ...meta }));
65
70
  const directOps = directTransfers.map((dt) => ({
66
71
  operation: "DirectTokenTransfer",
67
72
  txHash,
68
73
  blockNumber,
74
+ timestamp,
75
+ protocol: dt.token,
69
76
  creditAccount,
70
77
  ...dt
71
78
  }));
@@ -18,112 +18,138 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var toLegacyOperation_exports = {};
20
20
  __export(toLegacyOperation_exports, {
21
- legacyVisitor: () => legacyVisitor,
21
+ createLegacyVisitor: () => createLegacyVisitor,
22
22
  toLegacyOperations: () => toLegacyOperations
23
23
  });
24
24
  module.exports = __toCommonJS(toLegacyOperation_exports);
25
25
  var import_mapOperations = require("./mapOperations.js");
26
- const legacyVisitor = {
27
- Execute(op) {
28
- return { ...op.legacy };
29
- },
30
- IncreaseBorrowedAmount(op) {
31
- return {
32
- operation: op.operation,
33
- amount: op.amount.toString()
34
- };
35
- },
36
- DecreaseBorrowedAmount(op) {
37
- return {
38
- operation: op.operation,
39
- amount: op.amount.toString()
40
- };
41
- },
42
- AddCollateral(op) {
43
- return {
44
- operation: op.operation,
45
- token: op.token,
46
- amount: op.amount.toString()
47
- };
48
- },
49
- WithdrawCollateral(op) {
50
- return {
51
- operation: op.operation,
52
- token: op.token,
53
- amount: op.amount.toString(),
54
- to: op.to,
55
- ...op.phantomToken ? { phantomToken: op.phantomToken } : {}
56
- };
57
- },
58
- UpdateQuota(op) {
59
- return {
60
- operation: op.operation,
61
- token: op.token,
62
- change: op.change.toString()
63
- };
64
- },
65
- DirectTokenTransfer(op) {
66
- return {
67
- operation: op.operation,
68
- txHash: op.txHash,
69
- blockNum: op.blockNumber,
70
- token: op.token,
71
- amount: op.amount.toString(),
72
- from: op.from,
73
- to: op.creditAccount
74
- };
75
- },
76
- MultiCall(op, multicall) {
77
- return {
78
- operation: op.operation,
79
- txHash: op.txHash,
80
- blockNum: op.blockNumber,
81
- multicall
82
- };
83
- },
84
- OpenCreditAccount(op, multicall) {
85
- return {
86
- operation: op.operation,
87
- txHash: op.txHash,
88
- blockNum: op.blockNumber,
89
- multicall
90
- };
91
- },
92
- CloseCreditAccount(op, multicall) {
93
- return {
94
- operation: op.operation,
95
- txHash: op.txHash,
96
- blockNum: op.blockNumber,
97
- multicall
98
- };
99
- },
100
- LiquidateCreditAccount(op, multicall) {
101
- return {
102
- operation: op.operation,
103
- txHash: op.txHash,
104
- blockNum: op.blockNumber,
105
- to: op.to,
106
- remainingFunds: op.remainingFunds.toString(),
107
- multicall
108
- };
109
- },
110
- PartiallyLiquidateCreditAccount(op) {
111
- return {
112
- operation: op.operation,
113
- txHash: op.txHash,
114
- blockNum: op.blockNumber,
115
- token: op.token,
116
- repaidAmount: op.repaidAmount.toString(),
117
- minSeizedAmount: op.minSeizedAmount.toString(),
118
- to: op.to
119
- };
120
- }
121
- };
122
- function toLegacyOperations(ops) {
123
- return (0, import_mapOperations.mapOperations)(ops, legacyVisitor);
26
+ function commonFields(op, params) {
27
+ return {
28
+ timestamp: op.timestamp,
29
+ sessionId: params.sessionId,
30
+ protocol: op.creditFacade
31
+ };
32
+ }
33
+ function createLegacyVisitor(params) {
34
+ return {
35
+ Execute(op) {
36
+ return { ...op.legacy };
37
+ },
38
+ IncreaseBorrowedAmount(op) {
39
+ return {
40
+ operation: op.operation,
41
+ amount: op.amount.toString()
42
+ };
43
+ },
44
+ DecreaseBorrowedAmount(op) {
45
+ return {
46
+ operation: op.operation,
47
+ amount: op.amount.toString()
48
+ };
49
+ },
50
+ AddCollateral(op) {
51
+ return {
52
+ operation: op.operation,
53
+ token: op.token,
54
+ amount: op.amount.toString()
55
+ };
56
+ },
57
+ WithdrawCollateral(op) {
58
+ return {
59
+ operation: op.operation,
60
+ token: op.token,
61
+ amount: op.amount.toString(),
62
+ to: op.to,
63
+ ...op.phantomToken ? { phantomToken: op.phantomToken } : {}
64
+ };
65
+ },
66
+ UpdateQuota(op) {
67
+ return {
68
+ operation: op.operation,
69
+ token: op.token,
70
+ change: op.change.toString()
71
+ };
72
+ },
73
+ DirectTokenTransfer(op) {
74
+ return {
75
+ operation: op.operation,
76
+ txHash: op.txHash,
77
+ blockNum: op.blockNumber,
78
+ timestamp: op.timestamp,
79
+ sessionId: params.sessionId,
80
+ protocol: op.protocol,
81
+ token: op.token,
82
+ amount: op.amount.toString(),
83
+ from: op.from,
84
+ to: op.creditAccount
85
+ };
86
+ },
87
+ MultiCall(op, multicall) {
88
+ return {
89
+ operation: op.operation,
90
+ txHash: op.txHash,
91
+ blockNum: op.blockNumber,
92
+ ...commonFields(op, params),
93
+ multicall
94
+ };
95
+ },
96
+ OpenCreditAccount(op, multicall) {
97
+ return {
98
+ operation: op.operation,
99
+ txHash: op.txHash,
100
+ blockNum: op.blockNumber,
101
+ ...commonFields(op, params),
102
+ // TODO: missing legacy fields:
103
+ // userFunds: require prices to compute as
104
+ // sum of AddCollateral/WithdrawCollateral amounts denominated in underlying token.
105
+ // initialFunds: === userFunds
106
+ //
107
+ // leverage: (userFunds + borrowAmount) / userFunds
108
+ // where borrowAmount = sum of IncreaseDebt amounts in multicall (computable from data)
109
+ multicall
110
+ };
111
+ },
112
+ CloseCreditAccount(op, multicall) {
113
+ return {
114
+ operation: op.operation,
115
+ txHash: op.txHash,
116
+ blockNum: op.blockNumber,
117
+ ...commonFields(op, params),
118
+ // TODO: missing legacy fields:
119
+ // remainingFunds:
120
+ multicall
121
+ };
122
+ },
123
+ LiquidateCreditAccount(op, multicall) {
124
+ return {
125
+ operation: op.operation,
126
+ txHash: op.txHash,
127
+ blockNum: op.blockNumber,
128
+ ...commonFields(op, params),
129
+ to: op.to,
130
+ remainingFunds: op.remainingFunds.toString(),
131
+ multicall
132
+ };
133
+ },
134
+ PartiallyLiquidateCreditAccount(op) {
135
+ return {
136
+ operation: op.operation,
137
+ txHash: op.txHash,
138
+ blockNum: op.blockNumber,
139
+ ...commonFields(op, params),
140
+ token: op.token,
141
+ repaidAmount: op.repaidAmount.toString(),
142
+ minSeizedAmount: op.minSeizedAmount.toString(),
143
+ to: op.to
144
+ };
145
+ }
146
+ };
147
+ }
148
+ function toLegacyOperations(ops, params) {
149
+ return (0, import_mapOperations.mapOperations)(ops, createLegacyVisitor(params));
124
150
  }
125
151
  // Annotate the CommonJS export names for ESM import in node:
126
152
  0 && (module.exports = {
127
- legacyVisitor,
153
+ createLegacyVisitor,
128
154
  toLegacyOperations
129
155
  });
@@ -7,17 +7,14 @@ function assembleOperations(input) {
7
7
  executeResults,
8
8
  register,
9
9
  underlying,
10
- txHash,
11
- blockNumber,
12
10
  liquidationRemainingFunds,
13
11
  phantomTokens,
14
12
  strict
15
13
  } = input;
16
14
  let offset = 0;
17
- const meta = { txHash, blockNumber };
18
15
  return facadeCalls.map((fc) => {
19
16
  if (fc.operation === "PartiallyLiquidateCreditAccount") {
20
- return assemblePartialLiquidation(fc, meta);
17
+ return assemblePartialLiquidation(fc);
21
18
  }
22
19
  const count = countAdapterCalls(fc.innerCalls, register);
23
20
  const sliced = executeResults.slice(offset, offset + count);
@@ -36,7 +33,6 @@ function assembleOperations(input) {
36
33
  switch (fc.operation) {
37
34
  case "OpenCreditAccount":
38
35
  return {
39
- ...meta,
40
36
  operation: fc.operation,
41
37
  creditAccount: fc.creditAccount,
42
38
  onBehalfOf: fc.parsed.rawArgs.onBehalfOf,
@@ -45,7 +41,6 @@ function assembleOperations(input) {
45
41
  };
46
42
  case "LiquidateCreditAccount":
47
43
  return {
48
- ...meta,
49
44
  operation: fc.operation,
50
45
  creditAccount: fc.creditAccount,
51
46
  to: fc.parsed.rawArgs.to,
@@ -55,7 +50,6 @@ function assembleOperations(input) {
55
50
  };
56
51
  default:
57
52
  return {
58
- ...meta,
59
53
  operation: fc.operation,
60
54
  creditAccount: fc.creditAccount,
61
55
  multicall
@@ -69,10 +63,9 @@ function countAdapterCalls(innerCalls, register) {
69
63
  return !contract || contract instanceof AbstractAdapterContract;
70
64
  }).length;
71
65
  }
72
- function assemblePartialLiquidation(fc, meta) {
66
+ function assemblePartialLiquidation(fc) {
73
67
  const { rawArgs } = fc.parsed;
74
68
  return {
75
- ...meta,
76
69
  operation: "PartiallyLiquidateCreditAccount",
77
70
  creditAccount: fc.creditAccount,
78
71
  token: rawArgs.token,
@@ -15,6 +15,7 @@ function parseCreditAccountTransaction(input) {
15
15
  const logs = receipt.logs;
16
16
  const txHash = receipt.transactionHash;
17
17
  const blockNumber = Number(receipt.blockNumber);
18
+ const timestamp = Number(receipt.blockTimestamp ?? 0);
18
19
  const facadeCalls = findFacadeCalls(
19
20
  trace,
20
21
  creditFacade,
@@ -28,21 +29,27 @@ function parseCreditAccountTransaction(input) {
28
29
  liquidationRemainingFunds,
29
30
  phantomTokens
30
31
  } = extractTransfers(logs, creditAccount, pool, creditFacade);
32
+ const meta = {
33
+ creditFacade,
34
+ timestamp,
35
+ blockNumber,
36
+ txHash
37
+ };
31
38
  const facadeOps = assembleOperations({
32
39
  facadeCalls,
33
40
  executeResults,
34
41
  register,
35
42
  underlying,
36
- txHash,
37
- blockNumber,
38
43
  liquidationRemainingFunds,
39
44
  phantomTokens,
40
45
  strict
41
- });
46
+ }).map((o) => ({ ...o, ...meta }));
42
47
  const directOps = directTransfers.map((dt) => ({
43
48
  operation: "DirectTokenTransfer",
44
49
  txHash,
45
50
  blockNumber,
51
+ timestamp,
52
+ protocol: dt.token,
46
53
  creditAccount,
47
54
  ...dt
48
55
  }));
@@ -1,104 +1,130 @@
1
1
  import { mapOperations } from "./mapOperations.js";
2
- const legacyVisitor = {
3
- Execute(op) {
4
- return { ...op.legacy };
5
- },
6
- IncreaseBorrowedAmount(op) {
7
- return {
8
- operation: op.operation,
9
- amount: op.amount.toString()
10
- };
11
- },
12
- DecreaseBorrowedAmount(op) {
13
- return {
14
- operation: op.operation,
15
- amount: op.amount.toString()
16
- };
17
- },
18
- AddCollateral(op) {
19
- return {
20
- operation: op.operation,
21
- token: op.token,
22
- amount: op.amount.toString()
23
- };
24
- },
25
- WithdrawCollateral(op) {
26
- return {
27
- operation: op.operation,
28
- token: op.token,
29
- amount: op.amount.toString(),
30
- to: op.to,
31
- ...op.phantomToken ? { phantomToken: op.phantomToken } : {}
32
- };
33
- },
34
- UpdateQuota(op) {
35
- return {
36
- operation: op.operation,
37
- token: op.token,
38
- change: op.change.toString()
39
- };
40
- },
41
- DirectTokenTransfer(op) {
42
- return {
43
- operation: op.operation,
44
- txHash: op.txHash,
45
- blockNum: op.blockNumber,
46
- token: op.token,
47
- amount: op.amount.toString(),
48
- from: op.from,
49
- to: op.creditAccount
50
- };
51
- },
52
- MultiCall(op, multicall) {
53
- return {
54
- operation: op.operation,
55
- txHash: op.txHash,
56
- blockNum: op.blockNumber,
57
- multicall
58
- };
59
- },
60
- OpenCreditAccount(op, multicall) {
61
- return {
62
- operation: op.operation,
63
- txHash: op.txHash,
64
- blockNum: op.blockNumber,
65
- multicall
66
- };
67
- },
68
- CloseCreditAccount(op, multicall) {
69
- return {
70
- operation: op.operation,
71
- txHash: op.txHash,
72
- blockNum: op.blockNumber,
73
- multicall
74
- };
75
- },
76
- LiquidateCreditAccount(op, multicall) {
77
- return {
78
- operation: op.operation,
79
- txHash: op.txHash,
80
- blockNum: op.blockNumber,
81
- to: op.to,
82
- remainingFunds: op.remainingFunds.toString(),
83
- multicall
84
- };
85
- },
86
- PartiallyLiquidateCreditAccount(op) {
87
- return {
88
- operation: op.operation,
89
- txHash: op.txHash,
90
- blockNum: op.blockNumber,
91
- token: op.token,
92
- repaidAmount: op.repaidAmount.toString(),
93
- minSeizedAmount: op.minSeizedAmount.toString(),
94
- to: op.to
95
- };
96
- }
97
- };
98
- function toLegacyOperations(ops) {
99
- return mapOperations(ops, legacyVisitor);
2
+ function commonFields(op, params) {
3
+ return {
4
+ timestamp: op.timestamp,
5
+ sessionId: params.sessionId,
6
+ protocol: op.creditFacade
7
+ };
8
+ }
9
+ function createLegacyVisitor(params) {
10
+ return {
11
+ Execute(op) {
12
+ return { ...op.legacy };
13
+ },
14
+ IncreaseBorrowedAmount(op) {
15
+ return {
16
+ operation: op.operation,
17
+ amount: op.amount.toString()
18
+ };
19
+ },
20
+ DecreaseBorrowedAmount(op) {
21
+ return {
22
+ operation: op.operation,
23
+ amount: op.amount.toString()
24
+ };
25
+ },
26
+ AddCollateral(op) {
27
+ return {
28
+ operation: op.operation,
29
+ token: op.token,
30
+ amount: op.amount.toString()
31
+ };
32
+ },
33
+ WithdrawCollateral(op) {
34
+ return {
35
+ operation: op.operation,
36
+ token: op.token,
37
+ amount: op.amount.toString(),
38
+ to: op.to,
39
+ ...op.phantomToken ? { phantomToken: op.phantomToken } : {}
40
+ };
41
+ },
42
+ UpdateQuota(op) {
43
+ return {
44
+ operation: op.operation,
45
+ token: op.token,
46
+ change: op.change.toString()
47
+ };
48
+ },
49
+ DirectTokenTransfer(op) {
50
+ return {
51
+ operation: op.operation,
52
+ txHash: op.txHash,
53
+ blockNum: op.blockNumber,
54
+ timestamp: op.timestamp,
55
+ sessionId: params.sessionId,
56
+ protocol: op.protocol,
57
+ token: op.token,
58
+ amount: op.amount.toString(),
59
+ from: op.from,
60
+ to: op.creditAccount
61
+ };
62
+ },
63
+ MultiCall(op, multicall) {
64
+ return {
65
+ operation: op.operation,
66
+ txHash: op.txHash,
67
+ blockNum: op.blockNumber,
68
+ ...commonFields(op, params),
69
+ multicall
70
+ };
71
+ },
72
+ OpenCreditAccount(op, multicall) {
73
+ return {
74
+ operation: op.operation,
75
+ txHash: op.txHash,
76
+ blockNum: op.blockNumber,
77
+ ...commonFields(op, params),
78
+ // TODO: missing legacy fields:
79
+ // userFunds: require prices to compute as
80
+ // sum of AddCollateral/WithdrawCollateral amounts denominated in underlying token.
81
+ // initialFunds: === userFunds
82
+ //
83
+ // leverage: (userFunds + borrowAmount) / userFunds
84
+ // where borrowAmount = sum of IncreaseDebt amounts in multicall (computable from data)
85
+ multicall
86
+ };
87
+ },
88
+ CloseCreditAccount(op, multicall) {
89
+ return {
90
+ operation: op.operation,
91
+ txHash: op.txHash,
92
+ blockNum: op.blockNumber,
93
+ ...commonFields(op, params),
94
+ // TODO: missing legacy fields:
95
+ // remainingFunds:
96
+ multicall
97
+ };
98
+ },
99
+ LiquidateCreditAccount(op, multicall) {
100
+ return {
101
+ operation: op.operation,
102
+ txHash: op.txHash,
103
+ blockNum: op.blockNumber,
104
+ ...commonFields(op, params),
105
+ to: op.to,
106
+ remainingFunds: op.remainingFunds.toString(),
107
+ multicall
108
+ };
109
+ },
110
+ PartiallyLiquidateCreditAccount(op) {
111
+ return {
112
+ operation: op.operation,
113
+ txHash: op.txHash,
114
+ blockNum: op.blockNumber,
115
+ ...commonFields(op, params),
116
+ token: op.token,
117
+ repaidAmount: op.repaidAmount.toString(),
118
+ minSeizedAmount: op.minSeizedAmount.toString(),
119
+ to: op.to
120
+ };
121
+ }
122
+ };
123
+ }
124
+ function toLegacyOperations(ops, params) {
125
+ return mapOperations(ops, createLegacyVisitor(params));
100
126
  }
101
127
  export {
102
- legacyVisitor,
128
+ createLegacyVisitor,
103
129
  toLegacyOperations
104
130
  };
@@ -1,14 +1,12 @@
1
- import type { Address, Hex } from "viem";
1
+ import type { Address } from "viem";
2
2
  import type { AddressMap, ChainContractsRegister } from "../sdk/index.js";
3
3
  import type { ExecuteResult, FacadeParsedCall } from "./internal-types.js";
4
- import type { OuterFacadeOperation } from "./types.js";
4
+ import type { FacadeOperationMetadata, OuterFacadeOperation } from "./types.js";
5
5
  export interface AssembleOperationsInput {
6
6
  facadeCalls: FacadeParsedCall[];
7
7
  executeResults: ExecuteResult[];
8
8
  register: ChainContractsRegister;
9
9
  underlying: Address;
10
- txHash: Hex;
11
- blockNumber: number;
12
10
  liquidationRemainingFunds?: bigint;
13
11
  phantomTokens?: AddressMap<Address>;
14
12
  strict?: boolean;
@@ -21,4 +19,4 @@ export interface AssembleOperationsInput {
21
19
  * the entire transaction) is sliced per facade call based on how many
22
20
  * adapter/unknown inner calls each one contains.
23
21
  */
24
- export declare function assembleOperations(input: AssembleOperationsInput): OuterFacadeOperation[];
22
+ export declare function assembleOperations(input: AssembleOperationsInput): Omit<OuterFacadeOperation, keyof FacadeOperationMetadata>[];
@@ -6,7 +6,7 @@ export interface ParseTransactionInput {
6
6
  * Output of `debug_traceTransaction`
7
7
  */
8
8
  trace: unknown;
9
- receipt: Pick<TransactionReceipt<bigint | number>, "logs" | "transactionHash" | "blockNumber">;
9
+ receipt: Pick<TransactionReceipt<bigint | number>, "logs" | "transactionHash" | "blockNumber" | "blockTimestamp">;
10
10
  pool: Address;
11
11
  /**
12
12
  * Underlying token of the pool.
@@ -11,10 +11,8 @@ export interface LegacyMulticallOp {
11
11
  operation: string;
12
12
  [key: string]: unknown;
13
13
  }
14
- export declare const legacyVisitor: OperationVisitor<LegacyMulticallOp, LegacyApiOperation>;
15
- /**
16
- * Converts new parser output to the legacy API format for comparison.
17
- *
18
- * Missing `initialFunds`/`userFunds`/`leverage` on OpenCreditAccount.
19
- */
20
- export declare function toLegacyOperations(ops: CreditAccountOperation[]): LegacyApiOperation[];
14
+ export interface LegacyVisitorParams {
15
+ sessionId: string;
16
+ }
17
+ export declare function createLegacyVisitor(params: LegacyVisitorParams): OperationVisitor<LegacyMulticallOp, LegacyApiOperation>;
18
+ export declare function toLegacyOperations(ops: CreditAccountOperation[], params: LegacyVisitorParams): LegacyApiOperation[];
@@ -12,25 +12,29 @@ export interface DirectTransferInfo {
12
12
  export interface OperationMetadata {
13
13
  txHash: Hex;
14
14
  blockNumber: number;
15
+ timestamp: number;
15
16
  }
16
- export interface MulticallOperation extends OperationMetadata {
17
+ export interface FacadeOperationMetadata extends OperationMetadata {
18
+ creditFacade: Address;
19
+ }
20
+ export interface MulticallOperation extends FacadeOperationMetadata {
17
21
  operation: "MultiCall" | "BotMulticall";
18
22
  creditAccount: Address;
19
23
  multicall: InnerOperation[];
20
24
  }
21
- export interface OpenCreditAccountOperation extends OperationMetadata {
25
+ export interface OpenCreditAccountOperation extends FacadeOperationMetadata {
22
26
  operation: "OpenCreditAccount";
23
27
  creditAccount: Address;
24
28
  onBehalfOf: Address;
25
29
  referralCode: bigint;
26
30
  multicall: InnerOperation[];
27
31
  }
28
- export interface CloseCreditAccountOperation extends OperationMetadata {
32
+ export interface CloseCreditAccountOperation extends FacadeOperationMetadata {
29
33
  operation: "CloseCreditAccount";
30
34
  creditAccount: Address;
31
35
  multicall: InnerOperation[];
32
36
  }
33
- export interface LiquidateCreditAccountOperation extends OperationMetadata {
37
+ export interface LiquidateCreditAccountOperation extends FacadeOperationMetadata {
34
38
  operation: "LiquidateCreditAccount";
35
39
  creditAccount: Address;
36
40
  to: Address;
@@ -38,7 +42,7 @@ export interface LiquidateCreditAccountOperation extends OperationMetadata {
38
42
  remainingFunds: bigint;
39
43
  multicall: InnerOperation[];
40
44
  }
41
- export interface PartialLiquidationOperation extends OperationMetadata {
45
+ export interface PartialLiquidationOperation extends FacadeOperationMetadata {
42
46
  operation: "PartiallyLiquidateCreditAccount";
43
47
  creditAccount: Address;
44
48
  token: Address;
@@ -48,6 +52,7 @@ export interface PartialLiquidationOperation extends OperationMetadata {
48
52
  }
49
53
  export interface DirectTokenTransferOperation extends OperationMetadata {
50
54
  operation: "DirectTokenTransfer";
55
+ protocol: Address;
51
56
  token: Address;
52
57
  from: Address;
53
58
  creditAccount: Address;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.9.0",
3
+ "version": "12.9.2",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -63,7 +63,7 @@
63
63
  "@redstone-finance/utils": "^0.9.0",
64
64
  "@types/bn.js": "^5.2.0",
65
65
  "abitype": "^1.2.3",
66
- "bn.js": "^5.2.2",
66
+ "bn.js": "^5.2.3",
67
67
  "buffer": "^6.0.3",
68
68
  "date-fns": "^4.1.0",
69
69
  "decimal.js-light": "^2.5.1",
@@ -71,16 +71,16 @@
71
71
  "zod": "^4.3.6"
72
72
  },
73
73
  "devDependencies": {
74
- "@biomejs/biome": "^2.3.14",
75
- "@commitlint/cli": "^20.4.1",
76
- "@commitlint/config-conventional": "^20.4.1",
77
- "@gearbox-protocol/biome-config": "^1.0.20",
74
+ "@biomejs/biome": "^2.4.6",
75
+ "@commitlint/cli": "^20.4.3",
76
+ "@commitlint/config-conventional": "^20.4.3",
77
+ "@gearbox-protocol/biome-config": "^1.0.22",
78
78
  "@types/cross-spawn": "^6.0.6",
79
- "axios": "^1.13.5",
79
+ "axios": "^1.13.6",
80
80
  "cross-spawn": "^7.0.6",
81
81
  "husky": "^9.1.7",
82
- "lint-staged": "^16.2.7",
83
- "pino": "^10.3.0",
82
+ "lint-staged": "^16.3.3",
83
+ "pino": "^10.3.1",
84
84
  "pino-pretty": "^13.1.3",
85
85
  "tsup": "^8.5.1",
86
86
  "tsx": "^4.21.0",