@1delta/calldatalib 0.0.45 → 0.0.46
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/CalldataLib.js
CHANGED
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DexForkMappings = exports.DexTypeMappings = exports.SiloV2CollateralType = exports.CompoundV2Selector = exports.BridgeIds = exports.ComposerCommands = exports.Gen2025ActionIds = exports.ERC4626Ids = exports.FlashLoanIds = exports.LenderOps = exports.LenderIds = exports.PermitIds = exports.TransferIds = exports.WrapOperation = exports.DodoSelector = exports.DexPayConfig = exports.SweepType = void 0;
|
|
4
4
|
exports.encodeExternalCall = encodeExternalCall;
|
|
5
5
|
exports.encodeTryExternalCall = encodeTryExternalCall;
|
|
6
|
+
exports.encodeExternalCallWithReplace = encodeExternalCallWithReplace;
|
|
7
|
+
exports.encodeTryExternalCallWithReplace = encodeTryExternalCallWithReplace;
|
|
6
8
|
exports.encodeStargateV2Bridge = encodeStargateV2Bridge;
|
|
7
9
|
exports.encodePermit = encodePermit;
|
|
8
10
|
exports.encodeStargateV2BridgePartial = encodeStargateV2BridgePartial;
|
|
@@ -166,6 +168,8 @@ var ComposerCommands;
|
|
|
166
168
|
ComposerCommands[ComposerCommands["SWAPS"] = 16] = "SWAPS";
|
|
167
169
|
ComposerCommands[ComposerCommands["EXT_CALL"] = 32] = "EXT_CALL";
|
|
168
170
|
ComposerCommands[ComposerCommands["EXT_TRY_CALL"] = 33] = "EXT_TRY_CALL";
|
|
171
|
+
ComposerCommands[ComposerCommands["EXT_CALL_WITH_REPLACE"] = 34] = "EXT_CALL_WITH_REPLACE";
|
|
172
|
+
ComposerCommands[ComposerCommands["EXT_TRY_CALL_WITH_REPLACE"] = 35] = "EXT_TRY_CALL_WITH_REPLACE";
|
|
169
173
|
ComposerCommands[ComposerCommands["LENDING"] = 48] = "LENDING";
|
|
170
174
|
ComposerCommands[ComposerCommands["TRANSFERS"] = 64] = "TRANSFERS";
|
|
171
175
|
ComposerCommands[ComposerCommands["PERMIT"] = 80] = "PERMIT";
|
|
@@ -245,6 +249,31 @@ function encodeTryExternalCall(target, value, useSelfBalance, rOnFailure, data,
|
|
|
245
249
|
catchData,
|
|
246
250
|
]);
|
|
247
251
|
}
|
|
252
|
+
function encodeExternalCallWithReplace(target, value, useSelfBalance, token, replaceOffset, data) {
|
|
253
|
+
return (0, utils_js_1.encodePacked)(["uint8", "address", "uint128", "address", "uint16", "uint16", "bytes"], [
|
|
254
|
+
(0, utils_js_1.uint8)(ComposerCommands.EXT_CALL_WITH_REPLACE),
|
|
255
|
+
target,
|
|
256
|
+
(0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, useSelfBalance),
|
|
257
|
+
token,
|
|
258
|
+
replaceOffset,
|
|
259
|
+
(0, utils_js_1.uint16)(data.length / 2 - 1),
|
|
260
|
+
data,
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
function encodeTryExternalCallWithReplace(target, value, useSelfBalance, token, replaceOffset, data, rOnFailure, catchData) {
|
|
264
|
+
return (0, utils_js_1.encodePacked)(["uint8", "address", "uint128", "address", "uint16", "uint16", "uint8", "uint16", "bytes", "bytes"], [
|
|
265
|
+
(0, utils_js_1.uint8)(ComposerCommands.EXT_TRY_CALL_WITH_REPLACE),
|
|
266
|
+
target,
|
|
267
|
+
(0, utils_js_1.generateAmountBitmap)((0, utils_js_1.uint128)(value), false, useSelfBalance),
|
|
268
|
+
token,
|
|
269
|
+
replaceOffset,
|
|
270
|
+
(0, utils_js_1.uint16)(data.length / 2 - 1),
|
|
271
|
+
(0, utils_js_1.uint8)(rOnFailure ? 0 : 1),
|
|
272
|
+
(0, utils_js_1.uint16)(catchData.length / 2 - 1),
|
|
273
|
+
data,
|
|
274
|
+
catchData,
|
|
275
|
+
]);
|
|
276
|
+
}
|
|
248
277
|
function encodeStargateV2Bridge(asset, stargatePool, dstEid, receiver, refundReceiver, amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions) {
|
|
249
278
|
const partialData = encodeStargateV2BridgePartial(amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions);
|
|
250
279
|
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint32", "bytes32", "address", "bytes"], [
|
package/dist/esm/CalldataLib.js
CHANGED
|
@@ -83,6 +83,8 @@ export var ComposerCommands;
|
|
|
83
83
|
ComposerCommands[ComposerCommands["SWAPS"] = 16] = "SWAPS";
|
|
84
84
|
ComposerCommands[ComposerCommands["EXT_CALL"] = 32] = "EXT_CALL";
|
|
85
85
|
ComposerCommands[ComposerCommands["EXT_TRY_CALL"] = 33] = "EXT_TRY_CALL";
|
|
86
|
+
ComposerCommands[ComposerCommands["EXT_CALL_WITH_REPLACE"] = 34] = "EXT_CALL_WITH_REPLACE";
|
|
87
|
+
ComposerCommands[ComposerCommands["EXT_TRY_CALL_WITH_REPLACE"] = 35] = "EXT_TRY_CALL_WITH_REPLACE";
|
|
86
88
|
ComposerCommands[ComposerCommands["LENDING"] = 48] = "LENDING";
|
|
87
89
|
ComposerCommands[ComposerCommands["TRANSFERS"] = 64] = "TRANSFERS";
|
|
88
90
|
ComposerCommands[ComposerCommands["PERMIT"] = 80] = "PERMIT";
|
|
@@ -162,6 +164,31 @@ export function encodeTryExternalCall(target, value, useSelfBalance, rOnFailure,
|
|
|
162
164
|
catchData,
|
|
163
165
|
]);
|
|
164
166
|
}
|
|
167
|
+
export function encodeExternalCallWithReplace(target, value, useSelfBalance, token, replaceOffset, data) {
|
|
168
|
+
return encodePacked(["uint8", "address", "uint128", "address", "uint16", "uint16", "bytes"], [
|
|
169
|
+
uint8(ComposerCommands.EXT_CALL_WITH_REPLACE),
|
|
170
|
+
target,
|
|
171
|
+
generateAmountBitmap(uint128(value), false, useSelfBalance),
|
|
172
|
+
token,
|
|
173
|
+
replaceOffset,
|
|
174
|
+
uint16(data.length / 2 - 1),
|
|
175
|
+
data,
|
|
176
|
+
]);
|
|
177
|
+
}
|
|
178
|
+
export function encodeTryExternalCallWithReplace(target, value, useSelfBalance, token, replaceOffset, data, rOnFailure, catchData) {
|
|
179
|
+
return encodePacked(["uint8", "address", "uint128", "address", "uint16", "uint16", "uint8", "uint16", "bytes", "bytes"], [
|
|
180
|
+
uint8(ComposerCommands.EXT_TRY_CALL_WITH_REPLACE),
|
|
181
|
+
target,
|
|
182
|
+
generateAmountBitmap(uint128(value), false, useSelfBalance),
|
|
183
|
+
token,
|
|
184
|
+
replaceOffset,
|
|
185
|
+
uint16(data.length / 2 - 1),
|
|
186
|
+
uint8(rOnFailure ? 0 : 1),
|
|
187
|
+
uint16(catchData.length / 2 - 1),
|
|
188
|
+
data,
|
|
189
|
+
catchData,
|
|
190
|
+
]);
|
|
191
|
+
}
|
|
165
192
|
export function encodeStargateV2Bridge(asset, stargatePool, dstEid, receiver, refundReceiver, amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions) {
|
|
166
193
|
const partialData = encodeStargateV2BridgePartial(amount, slippage, fee, isBusMode, isNative, composeMsg, extraOptions);
|
|
167
194
|
return encodePacked(["uint8", "uint8", "address", "address", "uint32", "bytes32", "address", "bytes"], [
|
|
@@ -69,6 +69,8 @@ export declare enum ComposerCommands {
|
|
|
69
69
|
SWAPS = 16,
|
|
70
70
|
EXT_CALL = 32,
|
|
71
71
|
EXT_TRY_CALL = 33,
|
|
72
|
+
EXT_CALL_WITH_REPLACE = 34,
|
|
73
|
+
EXT_TRY_CALL_WITH_REPLACE = 35,
|
|
72
74
|
LENDING = 48,
|
|
73
75
|
TRANSFERS = 64,
|
|
74
76
|
PERMIT = 80,
|
|
@@ -124,6 +126,8 @@ export declare enum DexForkMappings {
|
|
|
124
126
|
}
|
|
125
127
|
export declare function encodeExternalCall(target: Address, value: bigint, useSelfBalance: boolean, data: Hex): Hex;
|
|
126
128
|
export declare function encodeTryExternalCall(target: Address, value: bigint, useSelfBalance: boolean, rOnFailure: boolean, data: Hex, catchData: Hex): Hex;
|
|
129
|
+
export declare function encodeExternalCallWithReplace(target: Address, value: bigint, useSelfBalance: boolean, token: Address, replaceOffset: number, data: Hex): Hex;
|
|
130
|
+
export declare function encodeTryExternalCallWithReplace(target: Address, value: bigint, useSelfBalance: boolean, token: Address, replaceOffset: number, data: Hex, rOnFailure: boolean, catchData: Hex): Hex;
|
|
127
131
|
export declare function encodeStargateV2Bridge(asset: Address, stargatePool: Address, dstEid: number, receiver: Hex, refundReceiver: Address, amount: bigint, slippage: number, fee: bigint, isBusMode: boolean, isNative: boolean, composeMsg: Hex, extraOptions: Hex): Hex;
|
|
128
132
|
export declare function encodePermit(permitId: bigint, target: Address, data: Hex): Hex;
|
|
129
133
|
export declare function encodeStargateV2BridgePartial(amount: bigint, slippage: number, fee: bigint, isBusMode: boolean, isNative: boolean, composeMsg: Hex, extraOptions: Hex): Hex;
|