@1delta/calldatalib 0.0.38 → 0.0.39
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
|
@@ -10,6 +10,8 @@ exports.encodeStargateV2BridgeSimpleTaxi = encodeStargateV2BridgeSimpleTaxi;
|
|
|
10
10
|
exports.encodeStargateV2BridgeSimpleBus = encodeStargateV2BridgeSimpleBus;
|
|
11
11
|
exports.encodeAcrossBridgeToken = encodeAcrossBridgeToken;
|
|
12
12
|
exports.encodeAcrossBridgeNative = encodeAcrossBridgeNative;
|
|
13
|
+
exports.encodeSquidRouterCall = encodeSquidRouterCall;
|
|
14
|
+
exports.encodeSquidRouterCallPartial = encodeSquidRouterCallPartial;
|
|
13
15
|
exports.encodePermit2TransferFrom = encodePermit2TransferFrom;
|
|
14
16
|
exports.encodeNextGenDexUnlock = encodeNextGenDexUnlock;
|
|
15
17
|
exports.encodeBalancerV3FlashLoan = encodeBalancerV3FlashLoan;
|
|
@@ -167,6 +169,7 @@ var BridgeIds;
|
|
|
167
169
|
(function (BridgeIds) {
|
|
168
170
|
BridgeIds[BridgeIds["STARGATE_V2"] = 0] = "STARGATE_V2";
|
|
169
171
|
BridgeIds[BridgeIds["ACROSS"] = 10] = "ACROSS";
|
|
172
|
+
BridgeIds[BridgeIds["SQUID_ROUTER"] = 20] = "SQUID_ROUTER";
|
|
170
173
|
})(BridgeIds || (exports.BridgeIds = BridgeIds = {}));
|
|
171
174
|
var DexTypeMappings;
|
|
172
175
|
(function (DexTypeMappings) {
|
|
@@ -318,6 +321,32 @@ function encodeAcrossBridgeNative(spokePool, depositor, sendingAssetId, receivin
|
|
|
318
321
|
]);
|
|
319
322
|
return bridgeData;
|
|
320
323
|
}
|
|
324
|
+
function encodeSquidRouterCall(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload, gasRefundRecipient, enableExpress, nativeAmount) {
|
|
325
|
+
const partialData = encodeSquidRouterCallPartial(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload);
|
|
326
|
+
return (0, utils_js_1.encodePacked)(["bytes", "uint128", "address", "uint8", "bytes", "bytes", "bytes", "bytes"], [
|
|
327
|
+
partialData,
|
|
328
|
+
(0, utils_js_1.uint128)(nativeAmount),
|
|
329
|
+
gasRefundRecipient,
|
|
330
|
+
(0, utils_js_1.uint8)(enableExpress ? 1 : 0),
|
|
331
|
+
bridgedTokenSymbol,
|
|
332
|
+
destinationChain,
|
|
333
|
+
destinationAddress,
|
|
334
|
+
payload,
|
|
335
|
+
]);
|
|
336
|
+
}
|
|
337
|
+
function encodeSquidRouterCallPartial(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload) {
|
|
338
|
+
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint16", "uint16", "uint16", "uint16", "uint128"], [
|
|
339
|
+
(0, utils_js_1.uint8)(ComposerCommands.BRIDGING),
|
|
340
|
+
(0, utils_js_1.uint8)(BridgeIds.SQUID_ROUTER),
|
|
341
|
+
gateway,
|
|
342
|
+
asset,
|
|
343
|
+
(0, utils_js_1.uint16)(bridgedTokenSymbol.length / 2 - 1),
|
|
344
|
+
(0, utils_js_1.uint16)(destinationChain.length / 2 - 1),
|
|
345
|
+
(0, utils_js_1.uint16)(destinationAddress.length / 2 - 1),
|
|
346
|
+
(0, utils_js_1.uint16)(payload.length / 2 - 1),
|
|
347
|
+
(0, utils_js_1.uint128)(amount),
|
|
348
|
+
]);
|
|
349
|
+
}
|
|
321
350
|
function encodePermit2TransferFrom(token, receiver, amount) {
|
|
322
351
|
return (0, utils_js_1.encodePacked)(["uint8", "uint8", "address", "address", "uint128"], [(0, utils_js_1.uint8)(ComposerCommands.TRANSFERS), (0, utils_js_1.uint8)(TransferIds.PERMIT2_TRANSFER_FROM), token, receiver, (0, utils_js_1.uint128)(amount)]);
|
|
323
352
|
}
|
package/dist/esm/CalldataLib.js
CHANGED
|
@@ -94,6 +94,7 @@ export var BridgeIds;
|
|
|
94
94
|
(function (BridgeIds) {
|
|
95
95
|
BridgeIds[BridgeIds["STARGATE_V2"] = 0] = "STARGATE_V2";
|
|
96
96
|
BridgeIds[BridgeIds["ACROSS"] = 10] = "ACROSS";
|
|
97
|
+
BridgeIds[BridgeIds["SQUID_ROUTER"] = 20] = "SQUID_ROUTER";
|
|
97
98
|
})(BridgeIds || (BridgeIds = {}));
|
|
98
99
|
export var DexTypeMappings;
|
|
99
100
|
(function (DexTypeMappings) {
|
|
@@ -245,6 +246,32 @@ export function encodeAcrossBridgeNative(spokePool, depositor, sendingAssetId, r
|
|
|
245
246
|
]);
|
|
246
247
|
return bridgeData;
|
|
247
248
|
}
|
|
249
|
+
export function encodeSquidRouterCall(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload, gasRefundRecipient, enableExpress, nativeAmount) {
|
|
250
|
+
const partialData = encodeSquidRouterCallPartial(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload);
|
|
251
|
+
return encodePacked(["bytes", "uint128", "address", "uint8", "bytes", "bytes", "bytes", "bytes"], [
|
|
252
|
+
partialData,
|
|
253
|
+
uint128(nativeAmount),
|
|
254
|
+
gasRefundRecipient,
|
|
255
|
+
uint8(enableExpress ? 1 : 0),
|
|
256
|
+
bridgedTokenSymbol,
|
|
257
|
+
destinationChain,
|
|
258
|
+
destinationAddress,
|
|
259
|
+
payload,
|
|
260
|
+
]);
|
|
261
|
+
}
|
|
262
|
+
export function encodeSquidRouterCallPartial(asset, gateway, bridgedTokenSymbol, amount, destinationChain, destinationAddress, payload) {
|
|
263
|
+
return encodePacked(["uint8", "uint8", "address", "address", "uint16", "uint16", "uint16", "uint16", "uint128"], [
|
|
264
|
+
uint8(ComposerCommands.BRIDGING),
|
|
265
|
+
uint8(BridgeIds.SQUID_ROUTER),
|
|
266
|
+
gateway,
|
|
267
|
+
asset,
|
|
268
|
+
uint16(bridgedTokenSymbol.length / 2 - 1),
|
|
269
|
+
uint16(destinationChain.length / 2 - 1),
|
|
270
|
+
uint16(destinationAddress.length / 2 - 1),
|
|
271
|
+
uint16(payload.length / 2 - 1),
|
|
272
|
+
uint128(amount),
|
|
273
|
+
]);
|
|
274
|
+
}
|
|
248
275
|
export function encodePermit2TransferFrom(token, receiver, amount) {
|
|
249
276
|
return encodePacked(["uint8", "uint8", "address", "address", "uint128"], [uint8(ComposerCommands.TRANSFERS), uint8(TransferIds.PERMIT2_TRANSFER_FROM), token, receiver, uint128(amount)]);
|
|
250
277
|
}
|
|
@@ -78,7 +78,8 @@ export declare enum ComposerCommands {
|
|
|
78
78
|
}
|
|
79
79
|
export declare enum BridgeIds {
|
|
80
80
|
STARGATE_V2 = 0,
|
|
81
|
-
ACROSS = 10
|
|
81
|
+
ACROSS = 10,
|
|
82
|
+
SQUID_ROUTER = 20
|
|
82
83
|
}
|
|
83
84
|
export declare enum DexTypeMappings {
|
|
84
85
|
UNISWAP_V3_ID = 0,
|
|
@@ -118,6 +119,8 @@ export declare function encodeStargateV2BridgeSimpleTaxi(asset: Address, stargat
|
|
|
118
119
|
export declare function encodeStargateV2BridgeSimpleBus(asset: Address, stargatePool: Address, dstEid: number, receiver: Hex, refundReceiver: Address, amount: bigint, isNative: boolean, slippage: number, fee: bigint): Hex;
|
|
119
120
|
export declare function encodeAcrossBridgeToken(spokePool: Address, depositor: Address, sendingAssetId: Address, receivingAssetId: Hex, amount: bigint, fixedFee: bigint, feePercentage: number, destinationChainId: number, receiver: Hex, message: Hex): Hex;
|
|
120
121
|
export declare function encodeAcrossBridgeNative(spokePool: Address, depositor: Address, sendingAssetId: Address, receivingAssetId: Hex, amount: bigint, fixedFee: bigint, feePercentage: number, destinationChainId: number, receiver: Hex, message: Hex): Hex;
|
|
122
|
+
export declare function encodeSquidRouterCall(asset: Address, gateway: Address, bridgedTokenSymbol: Hex, amount: bigint, destinationChain: Hex, destinationAddress: Hex, payload: Hex, gasRefundRecipient: Address, enableExpress: boolean, nativeAmount: bigint): Hex;
|
|
123
|
+
export declare function encodeSquidRouterCallPartial(asset: Address, gateway: Address, bridgedTokenSymbol: Hex, amount: bigint, destinationChain: Hex, destinationAddress: Hex, payload: Hex): Hex;
|
|
121
124
|
export declare function encodePermit2TransferFrom(token: Address, receiver: Address, amount: bigint): Hex;
|
|
122
125
|
export declare function encodeNextGenDexUnlock(singleton: Address, id: bigint, d: Hex): Hex;
|
|
123
126
|
export declare function encodeBalancerV3FlashLoan(singleton: Address, poolId: bigint, asset: Address, receiver: Address, amount: bigint, flashData: Hex): Hex;
|