@gearbox-protocol/sdk 12.0.0-next.5 → 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.
- package/dist/cjs/permissionless/bindings/instance-manager.js +19 -10
- package/dist/cjs/sdk/base/BaseContract.js +1 -1
- package/dist/cjs/sdk/base/ChainContractsRegister.js +2 -2
- package/dist/esm/permissionless/bindings/instance-manager.js +20 -10
- package/dist/esm/sdk/base/BaseContract.js +1 -1
- package/dist/esm/sdk/base/ChainContractsRegister.js +2 -2
- package/dist/types/permissionless/bindings/instance-manager.d.ts +3 -2
- package/dist/types/sdk/base/ChainContractsRegister.d.ts +1 -1
- package/package.json +1 -1
|
@@ -140,18 +140,27 @@ class InstanceManagerContract extends import_sdk.BaseContract {
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
-
|
|
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);
|
|
@@ -202,7 +202,7 @@ class BaseContract extends import_Construct.Construct {
|
|
|
202
202
|
chainId: this.chainId,
|
|
203
203
|
target: this.address,
|
|
204
204
|
contractType: this.contractType,
|
|
205
|
-
label: this.register.labelAddress(this.address,
|
|
205
|
+
label: this.register.labelAddress(this.address, true),
|
|
206
206
|
functionName,
|
|
207
207
|
args
|
|
208
208
|
};
|
|
@@ -74,9 +74,9 @@ class ChainContractsRegister {
|
|
|
74
74
|
this.labels.upsert(address, label(this.labels.get(address)));
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
labelAddress(address,
|
|
77
|
+
labelAddress(address, omitAddress) {
|
|
78
78
|
const label = this.labels.get(address);
|
|
79
|
-
return label ?
|
|
79
|
+
return label ? omitAddress ? label : `${address} [${label}]` : address;
|
|
80
80
|
}
|
|
81
81
|
get chain() {
|
|
82
82
|
return this.client.chain;
|
|
@@ -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
|
-
|
|
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);
|
|
@@ -190,7 +190,7 @@ class BaseContract extends Construct {
|
|
|
190
190
|
chainId: this.chainId,
|
|
191
191
|
target: this.address,
|
|
192
192
|
contractType: this.contractType,
|
|
193
|
-
label: this.register.labelAddress(this.address,
|
|
193
|
+
label: this.register.labelAddress(this.address, true),
|
|
194
194
|
functionName,
|
|
195
195
|
args
|
|
196
196
|
};
|
|
@@ -51,9 +51,9 @@ class ChainContractsRegister {
|
|
|
51
51
|
this.labels.upsert(address, label(this.labels.get(address)));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
labelAddress(address,
|
|
54
|
+
labelAddress(address, omitAddress) {
|
|
55
55
|
const label = this.labels.get(address);
|
|
56
|
-
return label ?
|
|
56
|
+
return label ? omitAddress ? label : `${address} [${label}]` : address;
|
|
57
57
|
}
|
|
58
58
|
get chain() {
|
|
59
59
|
return this.client.chain;
|
|
@@ -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>;
|
|
@@ -21,7 +21,7 @@ export declare class ChainContractsRegister {
|
|
|
21
21
|
mustGetContract<T = unknown[]>(address: Address): ContractOrInterface<T>;
|
|
22
22
|
setContract(address: Address, contract: BaseContract<any>): void;
|
|
23
23
|
setAddressLabel(address: Address, label: string | ((oldLabel?: string) => string)): void;
|
|
24
|
-
labelAddress(address: Address,
|
|
24
|
+
labelAddress(address: Address, omitAddress?: boolean): string;
|
|
25
25
|
get chain(): Chain;
|
|
26
26
|
get chainId(): number;
|
|
27
27
|
/**
|