@chainflip/sdk 1.8.1 → 1.8.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.
- package/dist/swap.d.mts +11 -3
- package/dist/swap.d.ts +11 -3
- package/dist/swap.js +41 -5
- package/dist/swap.mjs +41 -5
- package/package.json +1 -1
package/dist/swap.d.mts
CHANGED
|
@@ -97,6 +97,10 @@ interface BaseQuoteDetails {
|
|
|
97
97
|
srcAsset: AssetAndChain;
|
|
98
98
|
destAsset: AssetAndChain;
|
|
99
99
|
isVaultSwap: boolean;
|
|
100
|
+
ccmParams?: {
|
|
101
|
+
gasBudget: string;
|
|
102
|
+
messageLengthBytes: number;
|
|
103
|
+
};
|
|
100
104
|
depositAmount: string;
|
|
101
105
|
intermediateAmount?: string;
|
|
102
106
|
egressAmount: string;
|
|
@@ -164,17 +168,21 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
164
168
|
brokerCommissionBps?: number;
|
|
165
169
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
170
|
isVaultSwap?: boolean;
|
|
171
|
+
ccmParams?: {
|
|
172
|
+
gasBudget: string;
|
|
173
|
+
messageLengthBytes: number;
|
|
174
|
+
};
|
|
167
175
|
}
|
|
168
|
-
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
176
|
+
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers' | 'ccmParams'> {
|
|
169
177
|
quote: Quote;
|
|
170
178
|
}
|
|
171
|
-
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
179
|
+
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers' | 'ccmParams'> {
|
|
172
180
|
quotes: Quote[];
|
|
173
181
|
}
|
|
174
182
|
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
175
183
|
slippageTolerancePercent: string | number;
|
|
176
184
|
};
|
|
177
|
-
interface DepositAddressRequest extends QuoteRequest {
|
|
185
|
+
interface DepositAddressRequest extends Omit<QuoteRequest, 'ccmParams'> {
|
|
178
186
|
destAddress: string;
|
|
179
187
|
ccmParams?: CcmParams;
|
|
180
188
|
maxBoostFeeBps?: number;
|
package/dist/swap.d.ts
CHANGED
|
@@ -97,6 +97,10 @@ interface BaseQuoteDetails {
|
|
|
97
97
|
srcAsset: AssetAndChain;
|
|
98
98
|
destAsset: AssetAndChain;
|
|
99
99
|
isVaultSwap: boolean;
|
|
100
|
+
ccmParams?: {
|
|
101
|
+
gasBudget: string;
|
|
102
|
+
messageLengthBytes: number;
|
|
103
|
+
};
|
|
100
104
|
depositAmount: string;
|
|
101
105
|
intermediateAmount?: string;
|
|
102
106
|
egressAmount: string;
|
|
@@ -164,17 +168,21 @@ interface QuoteRequest extends ChainsAndAssets {
|
|
|
164
168
|
brokerCommissionBps?: number;
|
|
165
169
|
affiliateBrokers?: AffiliateBroker[];
|
|
166
170
|
isVaultSwap?: boolean;
|
|
171
|
+
ccmParams?: {
|
|
172
|
+
gasBudget: string;
|
|
173
|
+
messageLengthBytes: number;
|
|
174
|
+
};
|
|
167
175
|
}
|
|
168
|
-
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
176
|
+
interface QuoteResponse extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers' | 'ccmParams'> {
|
|
169
177
|
quote: Quote;
|
|
170
178
|
}
|
|
171
|
-
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers'> {
|
|
179
|
+
interface QuoteResponseV2 extends Omit<QuoteRequest, 'brokerCommissionBps' | 'affiliateBrokers' | 'ccmParams'> {
|
|
172
180
|
quotes: Quote[];
|
|
173
181
|
}
|
|
174
182
|
type FillOrKillParamsWithSlippage = Omit<FillOrKillParamsWithMinPrice, 'minPrice'> & {
|
|
175
183
|
slippageTolerancePercent: string | number;
|
|
176
184
|
};
|
|
177
|
-
interface DepositAddressRequest extends QuoteRequest {
|
|
185
|
+
interface DepositAddressRequest extends Omit<QuoteRequest, 'ccmParams'> {
|
|
178
186
|
destAddress: string;
|
|
179
187
|
ccmParams?: CcmParams;
|
|
180
188
|
maxBoostFeeBps?: number;
|
package/dist/swap.js
CHANGED
|
@@ -397,6 +397,8 @@ zod.z.object({
|
|
|
397
397
|
destAsset: asset,
|
|
398
398
|
amount: numericString.transform((v) => BigInt(v)).refine((v) => v > 0n, { message: "swap input amount must be greater than 0" }).refine((v) => v < 2n ** 128n, { message: "swap input amount must be less than 2^128" }),
|
|
399
399
|
brokerCommissionBps: numericOrEmptyString.transform((v) => Number(v)).optional(),
|
|
400
|
+
ccmGasBudget: numericString.transform((v) => BigInt(v)).optional(),
|
|
401
|
+
ccmMessageLengthBytes: numericString.transform((v) => Number(v)).optional(),
|
|
400
402
|
dcaEnabled: booleanString.default("false"),
|
|
401
403
|
isVaultSwap: booleanString.default("false")
|
|
402
404
|
}).transform((args, ctx) => {
|
|
@@ -415,11 +417,27 @@ zod.z.object({
|
|
|
415
417
|
});
|
|
416
418
|
return zod.z.NEVER;
|
|
417
419
|
}
|
|
420
|
+
if (args.ccmGasBudget !== void 0 && args.ccmMessageLengthBytes === void 0) {
|
|
421
|
+
ctx.addIssue({
|
|
422
|
+
message: `ccmMessageLengthBytes must be set if ccmGasBudget is set`,
|
|
423
|
+
code: zod.z.ZodIssueCode.custom
|
|
424
|
+
});
|
|
425
|
+
return zod.z.NEVER;
|
|
426
|
+
}
|
|
427
|
+
if (args.ccmGasBudget === void 0 && args.ccmMessageLengthBytes !== void 0) {
|
|
428
|
+
ctx.addIssue({
|
|
429
|
+
message: `ccmGasBudget must be set if ccmMessageLengthBytes is set`,
|
|
430
|
+
code: zod.z.ZodIssueCode.custom
|
|
431
|
+
});
|
|
432
|
+
return zod.z.NEVER;
|
|
433
|
+
}
|
|
434
|
+
const ccmParams = args.ccmGasBudget !== void 0 && args.ccmMessageLengthBytes !== void 0 ? { gasBudget: args.ccmGasBudget, messageLengthBytes: args.ccmMessageLengthBytes } : void 0;
|
|
418
435
|
return {
|
|
419
436
|
srcAsset,
|
|
420
437
|
destAsset,
|
|
421
438
|
amount: args.amount,
|
|
422
439
|
brokerCommissionBps: args.brokerCommissionBps,
|
|
440
|
+
ccmParams,
|
|
423
441
|
dcaEnabled: args.dcaEnabled,
|
|
424
442
|
isVaultSwap: args.isVaultSwap
|
|
425
443
|
};
|
|
@@ -866,7 +884,7 @@ var getChainData = (chain2, network, env) => ({
|
|
|
866
884
|
});
|
|
867
885
|
|
|
868
886
|
// package.json
|
|
869
|
-
var version = "1.8.
|
|
887
|
+
var version = "1.8.2";
|
|
870
888
|
|
|
871
889
|
// src/swap/consts.ts
|
|
872
890
|
var CF_SDK_VERSION_HEADERS = { "X-Chainflip-Sdk-Version": version };
|
|
@@ -877,7 +895,7 @@ var BACKEND_SERVICE_URLS = {
|
|
|
877
895
|
[ChainflipNetworks.mainnet]: "https://chainflip-swap.chainflip.io/"
|
|
878
896
|
};
|
|
879
897
|
var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
880
|
-
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
898
|
+
const { brokerCommissionBps, ccmGasBudget, ccmMessageLengthBytes, ...returnedRequestData } = quoteRequest;
|
|
881
899
|
const params = {
|
|
882
900
|
amount: returnedRequestData.amount,
|
|
883
901
|
srcChain: returnedRequestData.srcChain,
|
|
@@ -885,6 +903,8 @@ var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
885
903
|
destChain: returnedRequestData.destChain,
|
|
886
904
|
destAsset: returnedRequestData.destAsset,
|
|
887
905
|
isVaultSwap: String(Boolean(quoteRequest.isVaultSwap)),
|
|
906
|
+
ccmGasBudget: String(ccmGasBudget),
|
|
907
|
+
ccmMessageLengthBytes: String(ccmMessageLengthBytes),
|
|
888
908
|
...brokerCommissionBps && {
|
|
889
909
|
brokerCommissionBps: String(brokerCommissionBps)
|
|
890
910
|
},
|
|
@@ -899,7 +919,7 @@ var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
899
919
|
return { ...returnedRequestData, quote: data };
|
|
900
920
|
};
|
|
901
921
|
var getQuoteV2 = async (baseUrl, quoteRequest, { signal }) => {
|
|
902
|
-
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
922
|
+
const { brokerCommissionBps, ccmGasBudget, ccmMessageLengthBytes, ...returnedRequestData } = quoteRequest;
|
|
903
923
|
const params = {
|
|
904
924
|
amount: returnedRequestData.amount,
|
|
905
925
|
srcChain: returnedRequestData.srcChain,
|
|
@@ -907,6 +927,8 @@ var getQuoteV2 = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
907
927
|
destChain: returnedRequestData.destChain,
|
|
908
928
|
destAsset: returnedRequestData.destAsset,
|
|
909
929
|
isVaultSwap: String(Boolean(quoteRequest.isVaultSwap)),
|
|
930
|
+
ccmGasBudget: String(ccmGasBudget),
|
|
931
|
+
ccmMessageLengthBytes: String(ccmMessageLengthBytes),
|
|
910
932
|
...brokerCommissionBps && {
|
|
911
933
|
brokerCommissionBps: String(brokerCommissionBps)
|
|
912
934
|
},
|
|
@@ -1008,20 +1030,22 @@ var SwapSDK = class {
|
|
|
1008
1030
|
console.error(
|
|
1009
1031
|
"[@chainflip/sdk] The getQuote method is deprecated and will be removed in the 1.9 release. Use the getQuoteV2 method instead."
|
|
1010
1032
|
);
|
|
1011
|
-
const { brokerCommissionBps, affiliateBrokers, ...remainingRequest } = quoteRequest;
|
|
1033
|
+
const { brokerCommissionBps, affiliateBrokers, ccmParams, ...remainingRequest } = quoteRequest;
|
|
1012
1034
|
const submitterBrokerCommissionBps = brokerCommissionBps ?? this.options.broker?.commissionBps ?? 0;
|
|
1013
1035
|
const affiliateBrokerCommissionBps = affiliateBrokers?.reduce((acc, affiliate) => acc + affiliate.commissionBps, 0) ?? 0;
|
|
1014
1036
|
return getQuote(
|
|
1015
1037
|
this.options.backendUrl,
|
|
1016
1038
|
{
|
|
1017
1039
|
...remainingRequest,
|
|
1040
|
+
ccmGasBudget: ccmParams?.gasBudget,
|
|
1041
|
+
ccmMessageLengthBytes: ccmParams?.messageLengthBytes,
|
|
1018
1042
|
brokerCommissionBps: submitterBrokerCommissionBps + affiliateBrokerCommissionBps
|
|
1019
1043
|
},
|
|
1020
1044
|
options
|
|
1021
1045
|
);
|
|
1022
1046
|
}
|
|
1023
1047
|
getQuoteV2(quoteRequest, options = {}) {
|
|
1024
|
-
const { brokerCommissionBps, affiliateBrokers, ...remainingRequest } = quoteRequest;
|
|
1048
|
+
const { brokerCommissionBps, affiliateBrokers, ccmParams, ...remainingRequest } = quoteRequest;
|
|
1025
1049
|
const submitterBrokerCommissionBps = brokerCommissionBps ?? this.options.broker?.commissionBps ?? 0;
|
|
1026
1050
|
const affiliateBrokerCommissionBps = affiliateBrokers?.reduce((acc, affiliate) => acc + affiliate.commissionBps, 0) ?? 0;
|
|
1027
1051
|
return getQuoteV2(
|
|
@@ -1029,6 +1053,8 @@ var SwapSDK = class {
|
|
|
1029
1053
|
{
|
|
1030
1054
|
...remainingRequest,
|
|
1031
1055
|
brokerCommissionBps: submitterBrokerCommissionBps + affiliateBrokerCommissionBps,
|
|
1056
|
+
ccmGasBudget: ccmParams?.gasBudget,
|
|
1057
|
+
ccmMessageLengthBytes: ccmParams?.messageLengthBytes,
|
|
1032
1058
|
dcaEnabled: this.dcaEnabled
|
|
1033
1059
|
},
|
|
1034
1060
|
options
|
|
@@ -1173,6 +1199,11 @@ var SwapSDK = class {
|
|
|
1173
1199
|
await this.validateSwapAmount(quote.srcAsset, BigInt(quote.depositAmount));
|
|
1174
1200
|
assertQuoteValid(quote);
|
|
1175
1201
|
assert(!quote.isVaultSwap, "Cannot open a deposit channel for a vault swap quote");
|
|
1202
|
+
if (ccmParams) {
|
|
1203
|
+
assert(quote.ccmParams, "Cannot open CCM channel for quote without CCM params");
|
|
1204
|
+
} else {
|
|
1205
|
+
assert(!quote.ccmParams, "Cannot open regular channel for quote with CCM params");
|
|
1206
|
+
}
|
|
1176
1207
|
const depositAddressRequest = {
|
|
1177
1208
|
srcAsset: quote.srcAsset.asset,
|
|
1178
1209
|
srcChain: quote.srcAsset.chain,
|
|
@@ -1246,6 +1277,11 @@ var SwapSDK = class {
|
|
|
1246
1277
|
await this.validateSwapAmount(quote.srcAsset, BigInt(quote.depositAmount));
|
|
1247
1278
|
assertQuoteValid(quote);
|
|
1248
1279
|
assert(quote.isVaultSwap, "Cannot encode vault swap data for a deposit channel quote");
|
|
1280
|
+
if (ccmParams) {
|
|
1281
|
+
assert(quote.ccmParams, "Cannot encode CCM swap for quote without CCM params");
|
|
1282
|
+
} else {
|
|
1283
|
+
assert(!quote.ccmParams, "Cannot encode regular swap for quote with CCM params");
|
|
1284
|
+
}
|
|
1249
1285
|
const vaultSwapRequest = {
|
|
1250
1286
|
srcAsset: quote.srcAsset,
|
|
1251
1287
|
destAsset: quote.destAsset,
|
package/dist/swap.mjs
CHANGED
|
@@ -174,6 +174,8 @@ z.object({
|
|
|
174
174
|
destAsset: asset,
|
|
175
175
|
amount: numericString.transform((v) => BigInt(v)).refine((v) => v > 0n, { message: "swap input amount must be greater than 0" }).refine((v) => v < 2n ** 128n, { message: "swap input amount must be less than 2^128" }),
|
|
176
176
|
brokerCommissionBps: numericOrEmptyString.transform((v) => Number(v)).optional(),
|
|
177
|
+
ccmGasBudget: numericString.transform((v) => BigInt(v)).optional(),
|
|
178
|
+
ccmMessageLengthBytes: numericString.transform((v) => Number(v)).optional(),
|
|
177
179
|
dcaEnabled: booleanString.default("false"),
|
|
178
180
|
isVaultSwap: booleanString.default("false")
|
|
179
181
|
}).transform((args, ctx) => {
|
|
@@ -192,11 +194,27 @@ z.object({
|
|
|
192
194
|
});
|
|
193
195
|
return z.NEVER;
|
|
194
196
|
}
|
|
197
|
+
if (args.ccmGasBudget !== void 0 && args.ccmMessageLengthBytes === void 0) {
|
|
198
|
+
ctx.addIssue({
|
|
199
|
+
message: `ccmMessageLengthBytes must be set if ccmGasBudget is set`,
|
|
200
|
+
code: z.ZodIssueCode.custom
|
|
201
|
+
});
|
|
202
|
+
return z.NEVER;
|
|
203
|
+
}
|
|
204
|
+
if (args.ccmGasBudget === void 0 && args.ccmMessageLengthBytes !== void 0) {
|
|
205
|
+
ctx.addIssue({
|
|
206
|
+
message: `ccmGasBudget must be set if ccmMessageLengthBytes is set`,
|
|
207
|
+
code: z.ZodIssueCode.custom
|
|
208
|
+
});
|
|
209
|
+
return z.NEVER;
|
|
210
|
+
}
|
|
211
|
+
const ccmParams = args.ccmGasBudget !== void 0 && args.ccmMessageLengthBytes !== void 0 ? { gasBudget: args.ccmGasBudget, messageLengthBytes: args.ccmMessageLengthBytes } : void 0;
|
|
195
212
|
return {
|
|
196
213
|
srcAsset,
|
|
197
214
|
destAsset,
|
|
198
215
|
amount: args.amount,
|
|
199
216
|
brokerCommissionBps: args.brokerCommissionBps,
|
|
217
|
+
ccmParams,
|
|
200
218
|
dcaEnabled: args.dcaEnabled,
|
|
201
219
|
isVaultSwap: args.isVaultSwap
|
|
202
220
|
};
|
|
@@ -552,7 +570,7 @@ var getChainData = (chain2, network, env) => ({
|
|
|
552
570
|
});
|
|
553
571
|
|
|
554
572
|
// package.json
|
|
555
|
-
var version = "1.8.
|
|
573
|
+
var version = "1.8.2";
|
|
556
574
|
|
|
557
575
|
// src/swap/consts.ts
|
|
558
576
|
var CF_SDK_VERSION_HEADERS = { "X-Chainflip-Sdk-Version": version };
|
|
@@ -563,7 +581,7 @@ var BACKEND_SERVICE_URLS = {
|
|
|
563
581
|
[ChainflipNetworks.mainnet]: "https://chainflip-swap.chainflip.io/"
|
|
564
582
|
};
|
|
565
583
|
var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
566
|
-
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
584
|
+
const { brokerCommissionBps, ccmGasBudget, ccmMessageLengthBytes, ...returnedRequestData } = quoteRequest;
|
|
567
585
|
const params = {
|
|
568
586
|
amount: returnedRequestData.amount,
|
|
569
587
|
srcChain: returnedRequestData.srcChain,
|
|
@@ -571,6 +589,8 @@ var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
571
589
|
destChain: returnedRequestData.destChain,
|
|
572
590
|
destAsset: returnedRequestData.destAsset,
|
|
573
591
|
isVaultSwap: String(Boolean(quoteRequest.isVaultSwap)),
|
|
592
|
+
ccmGasBudget: String(ccmGasBudget),
|
|
593
|
+
ccmMessageLengthBytes: String(ccmMessageLengthBytes),
|
|
574
594
|
...brokerCommissionBps && {
|
|
575
595
|
brokerCommissionBps: String(brokerCommissionBps)
|
|
576
596
|
},
|
|
@@ -585,7 +605,7 @@ var getQuote = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
585
605
|
return { ...returnedRequestData, quote: data };
|
|
586
606
|
};
|
|
587
607
|
var getQuoteV2 = async (baseUrl, quoteRequest, { signal }) => {
|
|
588
|
-
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
608
|
+
const { brokerCommissionBps, ccmGasBudget, ccmMessageLengthBytes, ...returnedRequestData } = quoteRequest;
|
|
589
609
|
const params = {
|
|
590
610
|
amount: returnedRequestData.amount,
|
|
591
611
|
srcChain: returnedRequestData.srcChain,
|
|
@@ -593,6 +613,8 @@ var getQuoteV2 = async (baseUrl, quoteRequest, { signal }) => {
|
|
|
593
613
|
destChain: returnedRequestData.destChain,
|
|
594
614
|
destAsset: returnedRequestData.destAsset,
|
|
595
615
|
isVaultSwap: String(Boolean(quoteRequest.isVaultSwap)),
|
|
616
|
+
ccmGasBudget: String(ccmGasBudget),
|
|
617
|
+
ccmMessageLengthBytes: String(ccmMessageLengthBytes),
|
|
596
618
|
...brokerCommissionBps && {
|
|
597
619
|
brokerCommissionBps: String(brokerCommissionBps)
|
|
598
620
|
},
|
|
@@ -694,20 +716,22 @@ var SwapSDK = class {
|
|
|
694
716
|
console.error(
|
|
695
717
|
"[@chainflip/sdk] The getQuote method is deprecated and will be removed in the 1.9 release. Use the getQuoteV2 method instead."
|
|
696
718
|
);
|
|
697
|
-
const { brokerCommissionBps, affiliateBrokers, ...remainingRequest } = quoteRequest;
|
|
719
|
+
const { brokerCommissionBps, affiliateBrokers, ccmParams, ...remainingRequest } = quoteRequest;
|
|
698
720
|
const submitterBrokerCommissionBps = brokerCommissionBps ?? this.options.broker?.commissionBps ?? 0;
|
|
699
721
|
const affiliateBrokerCommissionBps = affiliateBrokers?.reduce((acc, affiliate) => acc + affiliate.commissionBps, 0) ?? 0;
|
|
700
722
|
return getQuote(
|
|
701
723
|
this.options.backendUrl,
|
|
702
724
|
{
|
|
703
725
|
...remainingRequest,
|
|
726
|
+
ccmGasBudget: ccmParams?.gasBudget,
|
|
727
|
+
ccmMessageLengthBytes: ccmParams?.messageLengthBytes,
|
|
704
728
|
brokerCommissionBps: submitterBrokerCommissionBps + affiliateBrokerCommissionBps
|
|
705
729
|
},
|
|
706
730
|
options
|
|
707
731
|
);
|
|
708
732
|
}
|
|
709
733
|
getQuoteV2(quoteRequest, options = {}) {
|
|
710
|
-
const { brokerCommissionBps, affiliateBrokers, ...remainingRequest } = quoteRequest;
|
|
734
|
+
const { brokerCommissionBps, affiliateBrokers, ccmParams, ...remainingRequest } = quoteRequest;
|
|
711
735
|
const submitterBrokerCommissionBps = brokerCommissionBps ?? this.options.broker?.commissionBps ?? 0;
|
|
712
736
|
const affiliateBrokerCommissionBps = affiliateBrokers?.reduce((acc, affiliate) => acc + affiliate.commissionBps, 0) ?? 0;
|
|
713
737
|
return getQuoteV2(
|
|
@@ -715,6 +739,8 @@ var SwapSDK = class {
|
|
|
715
739
|
{
|
|
716
740
|
...remainingRequest,
|
|
717
741
|
brokerCommissionBps: submitterBrokerCommissionBps + affiliateBrokerCommissionBps,
|
|
742
|
+
ccmGasBudget: ccmParams?.gasBudget,
|
|
743
|
+
ccmMessageLengthBytes: ccmParams?.messageLengthBytes,
|
|
718
744
|
dcaEnabled: this.dcaEnabled
|
|
719
745
|
},
|
|
720
746
|
options
|
|
@@ -859,6 +885,11 @@ var SwapSDK = class {
|
|
|
859
885
|
await this.validateSwapAmount(quote.srcAsset, BigInt(quote.depositAmount));
|
|
860
886
|
assertQuoteValid(quote);
|
|
861
887
|
assert(!quote.isVaultSwap, "Cannot open a deposit channel for a vault swap quote");
|
|
888
|
+
if (ccmParams) {
|
|
889
|
+
assert(quote.ccmParams, "Cannot open CCM channel for quote without CCM params");
|
|
890
|
+
} else {
|
|
891
|
+
assert(!quote.ccmParams, "Cannot open regular channel for quote with CCM params");
|
|
892
|
+
}
|
|
862
893
|
const depositAddressRequest = {
|
|
863
894
|
srcAsset: quote.srcAsset.asset,
|
|
864
895
|
srcChain: quote.srcAsset.chain,
|
|
@@ -932,6 +963,11 @@ var SwapSDK = class {
|
|
|
932
963
|
await this.validateSwapAmount(quote.srcAsset, BigInt(quote.depositAmount));
|
|
933
964
|
assertQuoteValid(quote);
|
|
934
965
|
assert(quote.isVaultSwap, "Cannot encode vault swap data for a deposit channel quote");
|
|
966
|
+
if (ccmParams) {
|
|
967
|
+
assert(quote.ccmParams, "Cannot encode CCM swap for quote without CCM params");
|
|
968
|
+
} else {
|
|
969
|
+
assert(!quote.ccmParams, "Cannot encode regular swap for quote with CCM params");
|
|
970
|
+
}
|
|
935
971
|
const vaultSwapRequest = {
|
|
936
972
|
srcAsset: quote.srcAsset,
|
|
937
973
|
destAsset: quote.destAsset,
|