@gearbox-protocol/sdk 12.0.0-next.6 → 12.0.0-next.7

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.
@@ -140,18 +140,27 @@ class InstanceManagerContract extends import_sdk.BaseContract {
140
140
  }
141
141
  }
142
142
  }
143
- // TODO:
143
+ mustParseFunctionData(calldata) {
144
+ const { functionName, args } = (0, import_viem.decodeFunctionData)({
145
+ abi: this.abi,
146
+ data: calldata
147
+ });
148
+ if (functionName === "configureGlobal") {
149
+ const [target, data] = args;
150
+ const nestedCall = this.register.parseFunctionData(target, data);
151
+ const result = this.wrapParseCall(
152
+ nestedCall.functionName,
153
+ nestedCall.args
154
+ );
155
+ return {
156
+ ...result,
157
+ label: `${this.register.labelAddress(target, true)} via ${result.label}`
158
+ };
159
+ }
160
+ return super.mustParseFunctionData(calldata);
161
+ }
144
162
  parseFunctionParams(params) {
145
163
  switch (params.functionName) {
146
- case "configureGlobal": {
147
- const [target, data] = params.args;
148
- const nestedCall = this.register.parseFunctionData(target, data);
149
- return {
150
- ...nestedCall.args,
151
- label: `${nestedCall.label} via instanceManager`,
152
- target: this.address
153
- };
154
- }
155
164
  case "configureLocal": {
156
165
  const [target, data] = params.args;
157
166
  const decoded = this.#decodeFunctionData(target, data);
@@ -1,4 +1,5 @@
1
1
  import {
2
+ decodeFunctionData,
2
3
  hexToString,
3
4
  stringToHex
4
5
  } from "viem";
@@ -123,18 +124,27 @@ class InstanceManagerContract extends BaseContract {
123
124
  }
124
125
  }
125
126
  }
126
- // TODO:
127
+ mustParseFunctionData(calldata) {
128
+ const { functionName, args } = decodeFunctionData({
129
+ abi: this.abi,
130
+ data: calldata
131
+ });
132
+ if (functionName === "configureGlobal") {
133
+ const [target, data] = args;
134
+ const nestedCall = this.register.parseFunctionData(target, data);
135
+ const result = this.wrapParseCall(
136
+ nestedCall.functionName,
137
+ nestedCall.args
138
+ );
139
+ return {
140
+ ...result,
141
+ label: `${this.register.labelAddress(target, true)} via ${result.label}`
142
+ };
143
+ }
144
+ return super.mustParseFunctionData(calldata);
145
+ }
127
146
  parseFunctionParams(params) {
128
147
  switch (params.functionName) {
129
- case "configureGlobal": {
130
- const [target, data] = params.args;
131
- const nestedCall = this.register.parseFunctionData(target, data);
132
- return {
133
- ...nestedCall.args,
134
- label: `${nestedCall.label} via instanceManager`,
135
- target: this.address
136
- };
137
- }
138
148
  case "configureLocal": {
139
149
  const [target, data] = params.args;
140
150
  const decoded = this.#decodeFunctionData(target, data);
@@ -1,6 +1,6 @@
1
- import { type Address, type Chain, type DecodeFunctionDataReturnType, type PublicClient, type Transport } from "viem";
1
+ import { type Address, type Chain, type DecodeFunctionDataReturnType, type Hex, type PublicClient, type Transport } from "viem";
2
2
  import type { RawTx } from "../../sdk/index.js";
3
- import { BaseContract, type ParsedCallArgs } from "../../sdk/index.js";
3
+ import { BaseContract, type ParsedCall, type ParsedCallArgs } from "../../sdk/index.js";
4
4
  declare const abi: readonly [{
5
5
  readonly type: "constructor";
6
6
  readonly inputs: readonly [{
@@ -330,6 +330,7 @@ declare const abi: readonly [{
330
330
  export declare class InstanceManagerContract extends BaseContract<typeof abi> {
331
331
  #private;
332
332
  constructor(addr: Address, client: PublicClient<Transport, Chain>);
333
+ mustParseFunctionData(calldata: Hex): ParsedCall;
333
334
  protected parseFunctionParams(params: DecodeFunctionDataReturnType<typeof abi>): ParsedCallArgs;
334
335
  isActivated(): Promise<boolean>;
335
336
  getOwner(): Promise<Address>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.0.0-next.6",
3
+ "version": "12.0.0-next.7",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",