@chainflip/sdk 1.1.3 → 1.1.5
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-
|
|
1
|
+
import { chainflipAssetAndChain, numericString, hexString, btcAddress, ccmMetadataSchema, hexStringFromNumber, dotAddress, unsignedInteger } from './chunk-BF6CBSA3.mjs';
|
|
2
2
|
import { z, __name, Assets, isNotNullish } from './chunk-Q7HQVR3T.mjs';
|
|
3
3
|
import { u8aToHex } from '@polkadot/util';
|
|
4
4
|
import { decodeAddress } from '@polkadot/util-crypto';
|
|
@@ -480,7 +480,7 @@ var errorMap = /* @__PURE__ */ __name((_issue, context) => ({
|
|
|
480
480
|
var string = z.string({
|
|
481
481
|
errorMap
|
|
482
482
|
});
|
|
483
|
-
z.number({
|
|
483
|
+
var number = z.number({
|
|
484
484
|
errorMap
|
|
485
485
|
});
|
|
486
486
|
var numericString = string.regex(/^[0-9]+$/);
|
|
@@ -517,6 +517,7 @@ var dotAddress = z.union([
|
|
|
517
517
|
var ethereumAddress = hexString.refine((address) => ethers.isAddress(address));
|
|
518
518
|
numericString.transform((arg) => BigInt(arg));
|
|
519
519
|
var u128 = z.union([
|
|
520
|
+
number,
|
|
520
521
|
numericString,
|
|
521
522
|
hexString
|
|
522
523
|
]).transform((arg) => BigInt(arg));
|
|
@@ -582,7 +583,8 @@ z.union([
|
|
|
582
583
|
z.object({
|
|
583
584
|
srcAsset: chainflipAssetAndChain,
|
|
584
585
|
destAsset: chainflipAssetAndChain,
|
|
585
|
-
amount: numericString
|
|
586
|
+
amount: numericString,
|
|
587
|
+
brokerCommissionBps: z.string().regex(/^[0-9]*$/).transform((v) => Number(v)).optional()
|
|
586
588
|
});
|
|
587
589
|
var ccmMetadataSchema = z.object({
|
|
588
590
|
gasBudget: numericString,
|
package/dist/swap.d.mts
CHANGED
|
@@ -382,7 +382,7 @@ declare const ccmMetadataSchema: z.ZodObject<{
|
|
|
382
382
|
}>;
|
|
383
383
|
type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
|
|
384
384
|
type SwapFee = {
|
|
385
|
-
type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS';
|
|
385
|
+
type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER';
|
|
386
386
|
chain: Chain;
|
|
387
387
|
asset: Asset;
|
|
388
388
|
amount: string;
|
|
@@ -430,6 +430,7 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
430
430
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
431
431
|
depositChannelId: string;
|
|
432
432
|
depositAddress: string;
|
|
433
|
+
brokerCommissionBps: number;
|
|
433
434
|
depositChannelExpiryBlock: bigint;
|
|
434
435
|
estimatedDepositChannelExpiryTime: number | undefined;
|
|
435
436
|
}
|
|
@@ -440,16 +441,18 @@ interface CommonStatusFields extends ChainsAndAssets {
|
|
|
440
441
|
destAddress: string;
|
|
441
442
|
depositAddress: string | undefined;
|
|
442
443
|
depositChannelCreatedAt: number | undefined;
|
|
444
|
+
depositChannelBrokerCommissionBps: number | undefined;
|
|
443
445
|
expectedDepositAmount: string | undefined;
|
|
444
446
|
depositChannelExpiryBlock: bigint;
|
|
445
447
|
estimatedDepositChannelExpiryTime: number | undefined;
|
|
446
|
-
|
|
448
|
+
isDepositChannelExpired: boolean;
|
|
447
449
|
depositChannelOpenedThroughBackend: boolean;
|
|
448
450
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
449
451
|
ccmMetadata: {
|
|
450
452
|
gasBudget: string;
|
|
451
453
|
message: `0x${string}`;
|
|
452
454
|
} | undefined;
|
|
455
|
+
feesPaid: SwapFee[];
|
|
453
456
|
}
|
|
454
457
|
type SwapStatusResponse = CommonStatusFields & ({
|
|
455
458
|
state: 'AWAITING_DEPOSIT';
|
|
@@ -483,9 +486,8 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
483
486
|
egressAmount: string;
|
|
484
487
|
egressScheduledAt: number;
|
|
485
488
|
egressScheduledBlockIndex: string;
|
|
486
|
-
feesPaid: SwapFee[];
|
|
487
489
|
} | {
|
|
488
|
-
state: 'BROADCAST_REQUESTED';
|
|
490
|
+
state: 'BROADCAST_REQUESTED' | 'BROADCASTED';
|
|
489
491
|
swapId: string;
|
|
490
492
|
depositAmount: string;
|
|
491
493
|
depositReceivedAt: number;
|
|
@@ -496,7 +498,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
496
498
|
egressAmount: string;
|
|
497
499
|
egressScheduledAt: number;
|
|
498
500
|
egressScheduledBlockIndex: string;
|
|
499
|
-
feesPaid: SwapFee[];
|
|
500
501
|
broadcastRequestedAt: number;
|
|
501
502
|
broadcastRequestedBlockIndex: string;
|
|
502
503
|
} | {
|
|
@@ -511,7 +512,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
511
512
|
egressAmount: string;
|
|
512
513
|
egressScheduledAt: number;
|
|
513
514
|
egressScheduledBlockIndex: string;
|
|
514
|
-
feesPaid: SwapFee[];
|
|
515
515
|
broadcastRequestedAt: number;
|
|
516
516
|
broadcastRequestedBlockIndex: string;
|
|
517
517
|
broadcastAbortedAt: number;
|
|
@@ -528,7 +528,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
528
528
|
egressAmount: string;
|
|
529
529
|
egressScheduledAt: number;
|
|
530
530
|
egressScheduledBlockIndex: string;
|
|
531
|
-
feesPaid: SwapFee[];
|
|
532
531
|
broadcastRequestedAt: number;
|
|
533
532
|
broadcastRequestedBlockIndex: string;
|
|
534
533
|
broadcastSucceededAt: number;
|
package/dist/swap.d.ts
CHANGED
|
@@ -382,7 +382,7 @@ declare const ccmMetadataSchema: z.ZodObject<{
|
|
|
382
382
|
}>;
|
|
383
383
|
type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
|
|
384
384
|
type SwapFee = {
|
|
385
|
-
type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS';
|
|
385
|
+
type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS' | 'BROKER';
|
|
386
386
|
chain: Chain;
|
|
387
387
|
asset: Asset;
|
|
388
388
|
amount: string;
|
|
@@ -430,6 +430,7 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
430
430
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
431
431
|
depositChannelId: string;
|
|
432
432
|
depositAddress: string;
|
|
433
|
+
brokerCommissionBps: number;
|
|
433
434
|
depositChannelExpiryBlock: bigint;
|
|
434
435
|
estimatedDepositChannelExpiryTime: number | undefined;
|
|
435
436
|
}
|
|
@@ -440,16 +441,18 @@ interface CommonStatusFields extends ChainsAndAssets {
|
|
|
440
441
|
destAddress: string;
|
|
441
442
|
depositAddress: string | undefined;
|
|
442
443
|
depositChannelCreatedAt: number | undefined;
|
|
444
|
+
depositChannelBrokerCommissionBps: number | undefined;
|
|
443
445
|
expectedDepositAmount: string | undefined;
|
|
444
446
|
depositChannelExpiryBlock: bigint;
|
|
445
447
|
estimatedDepositChannelExpiryTime: number | undefined;
|
|
446
|
-
|
|
448
|
+
isDepositChannelExpired: boolean;
|
|
447
449
|
depositChannelOpenedThroughBackend: boolean;
|
|
448
450
|
ccmDepositReceivedBlockIndex: string | undefined;
|
|
449
451
|
ccmMetadata: {
|
|
450
452
|
gasBudget: string;
|
|
451
453
|
message: `0x${string}`;
|
|
452
454
|
} | undefined;
|
|
455
|
+
feesPaid: SwapFee[];
|
|
453
456
|
}
|
|
454
457
|
type SwapStatusResponse = CommonStatusFields & ({
|
|
455
458
|
state: 'AWAITING_DEPOSIT';
|
|
@@ -483,9 +486,8 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
483
486
|
egressAmount: string;
|
|
484
487
|
egressScheduledAt: number;
|
|
485
488
|
egressScheduledBlockIndex: string;
|
|
486
|
-
feesPaid: SwapFee[];
|
|
487
489
|
} | {
|
|
488
|
-
state: 'BROADCAST_REQUESTED';
|
|
490
|
+
state: 'BROADCAST_REQUESTED' | 'BROADCASTED';
|
|
489
491
|
swapId: string;
|
|
490
492
|
depositAmount: string;
|
|
491
493
|
depositReceivedAt: number;
|
|
@@ -496,7 +498,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
496
498
|
egressAmount: string;
|
|
497
499
|
egressScheduledAt: number;
|
|
498
500
|
egressScheduledBlockIndex: string;
|
|
499
|
-
feesPaid: SwapFee[];
|
|
500
501
|
broadcastRequestedAt: number;
|
|
501
502
|
broadcastRequestedBlockIndex: string;
|
|
502
503
|
} | {
|
|
@@ -511,7 +512,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
511
512
|
egressAmount: string;
|
|
512
513
|
egressScheduledAt: number;
|
|
513
514
|
egressScheduledBlockIndex: string;
|
|
514
|
-
feesPaid: SwapFee[];
|
|
515
515
|
broadcastRequestedAt: number;
|
|
516
516
|
broadcastRequestedBlockIndex: string;
|
|
517
517
|
broadcastAbortedAt: number;
|
|
@@ -528,7 +528,6 @@ type SwapStatusResponse = CommonStatusFields & ({
|
|
|
528
528
|
egressAmount: string;
|
|
529
529
|
egressScheduledAt: number;
|
|
530
530
|
egressScheduledBlockIndex: string;
|
|
531
|
-
feesPaid: SwapFee[];
|
|
532
531
|
broadcastRequestedAt: number;
|
|
533
532
|
broadcastRequestedBlockIndex: string;
|
|
534
533
|
broadcastSucceededAt: number;
|
package/dist/swap.js
CHANGED
|
@@ -4485,7 +4485,7 @@ var init_addressValidation = __esm({
|
|
|
4485
4485
|
validateBitcoinRegtestAddress = /* @__PURE__ */ __name((address) => validateBitcoinAddress(address, "regtest"), "validateBitcoinRegtestAddress");
|
|
4486
4486
|
}
|
|
4487
4487
|
});
|
|
4488
|
-
var safeStringify, errorMap2, string, numericString, hexString, hexStringWithMaxByteSize, hexStringFromNumber, btcAddress, DOT_PREFIX, dotAddress, ethereumAddress, u128, unsignedInteger, transformAsset, chainflipChain, chainflipAsset, chainflipAssetAndChain;
|
|
4488
|
+
var safeStringify, errorMap2, string, number, numericString, hexString, hexStringWithMaxByteSize, hexStringFromNumber, btcAddress, DOT_PREFIX, dotAddress, ethereumAddress, u128, unsignedInteger, transformAsset, chainflipChain, chainflipAsset, chainflipAssetAndChain;
|
|
4489
4489
|
var init_parsers = __esm({
|
|
4490
4490
|
"../shared/src/parsers.ts"() {
|
|
4491
4491
|
init_lib();
|
|
@@ -4499,7 +4499,7 @@ var init_parsers = __esm({
|
|
|
4499
4499
|
string = z.string({
|
|
4500
4500
|
errorMap: errorMap2
|
|
4501
4501
|
});
|
|
4502
|
-
z.number({
|
|
4502
|
+
number = z.number({
|
|
4503
4503
|
errorMap: errorMap2
|
|
4504
4504
|
});
|
|
4505
4505
|
numericString = string.regex(/^[0-9]+$/);
|
|
@@ -4536,6 +4536,7 @@ var init_parsers = __esm({
|
|
|
4536
4536
|
ethereumAddress = hexString.refine((address) => ethers__namespace.isAddress(address));
|
|
4537
4537
|
numericString.transform((arg) => BigInt(arg));
|
|
4538
4538
|
u128 = z.union([
|
|
4539
|
+
number,
|
|
4539
4540
|
numericString,
|
|
4540
4541
|
hexString
|
|
4541
4542
|
]).transform((arg) => BigInt(arg));
|
|
@@ -4608,7 +4609,8 @@ var init_schemas = __esm({
|
|
|
4608
4609
|
z.object({
|
|
4609
4610
|
srcAsset: chainflipAssetAndChain,
|
|
4610
4611
|
destAsset: chainflipAssetAndChain,
|
|
4611
|
-
amount: numericString
|
|
4612
|
+
amount: numericString,
|
|
4613
|
+
brokerCommissionBps: z.string().regex(/^[0-9]*$/).transform((v) => Number(v)).optional()
|
|
4612
4614
|
});
|
|
4613
4615
|
ccmMetadataSchema = z.object({
|
|
4614
4616
|
gasBudget: numericString,
|
|
@@ -6752,19 +6754,15 @@ var walker = /* @__PURE__ */ __name(function(object, identities, superJson, dedu
|
|
|
6752
6754
|
return result;
|
|
6753
6755
|
}, "walker");
|
|
6754
6756
|
|
|
6755
|
-
// ../../node_modules/.pnpm/is-what@4.1.
|
|
6757
|
+
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
6756
6758
|
function getType2(payload) {
|
|
6757
6759
|
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
6758
6760
|
}
|
|
6759
6761
|
__name(getType2, "getType");
|
|
6760
|
-
function
|
|
6761
|
-
return getType2(payload) === "
|
|
6762
|
-
}
|
|
6763
|
-
__name(isUndefined2, "isUndefined");
|
|
6764
|
-
function isNull2(payload) {
|
|
6765
|
-
return getType2(payload) === "Null";
|
|
6762
|
+
function isArray2(payload) {
|
|
6763
|
+
return getType2(payload) === "Array";
|
|
6766
6764
|
}
|
|
6767
|
-
__name(
|
|
6765
|
+
__name(isArray2, "isArray");
|
|
6768
6766
|
function isPlainObject2(payload) {
|
|
6769
6767
|
if (getType2(payload) !== "Object")
|
|
6770
6768
|
return false;
|
|
@@ -6772,14 +6770,18 @@ function isPlainObject2(payload) {
|
|
|
6772
6770
|
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
6773
6771
|
}
|
|
6774
6772
|
__name(isPlainObject2, "isPlainObject");
|
|
6775
|
-
function
|
|
6776
|
-
return getType2(payload) === "
|
|
6773
|
+
function isNull2(payload) {
|
|
6774
|
+
return getType2(payload) === "Null";
|
|
6777
6775
|
}
|
|
6778
|
-
__name(
|
|
6776
|
+
__name(isNull2, "isNull");
|
|
6779
6777
|
function isOneOf(a, b, c, d, e) {
|
|
6780
6778
|
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
6781
6779
|
}
|
|
6782
6780
|
__name(isOneOf, "isOneOf");
|
|
6781
|
+
function isUndefined2(payload) {
|
|
6782
|
+
return getType2(payload) === "Undefined";
|
|
6783
|
+
}
|
|
6784
|
+
__name(isUndefined2, "isUndefined");
|
|
6783
6785
|
|
|
6784
6786
|
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
6785
6787
|
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
@@ -8780,10 +8782,14 @@ var getAssets = /* @__PURE__ */ __name(async (chain, network, env) => {
|
|
|
8780
8782
|
throw new Error("received unexpected chain");
|
|
8781
8783
|
}, "getAssets");
|
|
8782
8784
|
var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal }) => {
|
|
8785
|
+
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
8783
8786
|
const params = {
|
|
8784
|
-
amount:
|
|
8785
|
-
srcAsset:
|
|
8786
|
-
destAsset:
|
|
8787
|
+
amount: returnedRequestData.amount,
|
|
8788
|
+
srcAsset: returnedRequestData.srcAsset,
|
|
8789
|
+
destAsset: returnedRequestData.destAsset,
|
|
8790
|
+
...brokerCommissionBps && {
|
|
8791
|
+
brokerCommissionBps: String(brokerCommissionBps)
|
|
8792
|
+
}
|
|
8787
8793
|
};
|
|
8788
8794
|
const queryParams = new URLSearchParams(params);
|
|
8789
8795
|
const url = new URL(`/quote?${queryParams.toString()}`, baseUrl).toString();
|
|
@@ -8791,7 +8797,7 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
|
|
|
8791
8797
|
signal
|
|
8792
8798
|
});
|
|
8793
8799
|
return {
|
|
8794
|
-
...
|
|
8800
|
+
...returnedRequestData,
|
|
8795
8801
|
quote: data
|
|
8796
8802
|
};
|
|
8797
8803
|
}, "getQuote");
|
|
@@ -8853,7 +8859,10 @@ var _SwapSDK = class _SwapSDK {
|
|
|
8853
8859
|
return ApiService_default.getAssets(chain, this.network, env);
|
|
8854
8860
|
}
|
|
8855
8861
|
getQuote(quoteRequest, options = {}) {
|
|
8856
|
-
return ApiService_default.getQuote(this.baseUrl,
|
|
8862
|
+
return ApiService_default.getQuote(this.baseUrl, {
|
|
8863
|
+
...quoteRequest,
|
|
8864
|
+
brokerCommissionBps: this.brokerConfig?.commissionBps
|
|
8865
|
+
}, options);
|
|
8857
8866
|
}
|
|
8858
8867
|
async requestDepositAddress(depositAddressRequest) {
|
|
8859
8868
|
const { srcChain, srcAsset, amount } = depositAddressRequest;
|
|
@@ -8868,6 +8877,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
8868
8877
|
response = {
|
|
8869
8878
|
id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
|
|
8870
8879
|
depositAddress: result.address,
|
|
8880
|
+
brokerCommissionBps: this.brokerConfig.commissionBps,
|
|
8871
8881
|
srcChainExpiryBlock: result.sourceChainExpiryBlock
|
|
8872
8882
|
};
|
|
8873
8883
|
} else {
|
|
@@ -8877,6 +8887,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
8877
8887
|
...depositAddressRequest,
|
|
8878
8888
|
depositChannelId: response.id,
|
|
8879
8889
|
depositAddress: response.depositAddress,
|
|
8890
|
+
brokerCommissionBps: response.brokerCommissionBps,
|
|
8880
8891
|
depositChannelExpiryBlock: response.srcChainExpiryBlock,
|
|
8881
8892
|
estimatedDepositChannelExpiryTime: response.estimatedExpiryTime
|
|
8882
8893
|
};
|
package/dist/swap.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-MRYGGECA.mjs';
|
|
2
|
-
import { numericString, ethereumAddress, dotAddress, ccmMetadataSchema, btcAddress } from './chunk-
|
|
2
|
+
import { numericString, ethereumAddress, dotAddress, ccmMetadataSchema, btcAddress } from './chunk-BF6CBSA3.mjs';
|
|
3
3
|
import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-Q7HQVR3T.mjs';
|
|
4
4
|
export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-Q7HQVR3T.mjs';
|
|
5
5
|
import { decodeAddress } from '@polkadot/util-crypto';
|
|
@@ -2004,19 +2004,15 @@ var walker = /* @__PURE__ */ __name(function(object, identities, superJson, dedu
|
|
|
2004
2004
|
return result;
|
|
2005
2005
|
}, "walker");
|
|
2006
2006
|
|
|
2007
|
-
// ../../node_modules/.pnpm/is-what@4.1.
|
|
2007
|
+
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
2008
2008
|
function getType2(payload) {
|
|
2009
2009
|
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
2010
2010
|
}
|
|
2011
2011
|
__name(getType2, "getType");
|
|
2012
|
-
function
|
|
2013
|
-
return getType2(payload) === "
|
|
2014
|
-
}
|
|
2015
|
-
__name(isUndefined2, "isUndefined");
|
|
2016
|
-
function isNull2(payload) {
|
|
2017
|
-
return getType2(payload) === "Null";
|
|
2012
|
+
function isArray2(payload) {
|
|
2013
|
+
return getType2(payload) === "Array";
|
|
2018
2014
|
}
|
|
2019
|
-
__name(
|
|
2015
|
+
__name(isArray2, "isArray");
|
|
2020
2016
|
function isPlainObject2(payload) {
|
|
2021
2017
|
if (getType2(payload) !== "Object")
|
|
2022
2018
|
return false;
|
|
@@ -2024,14 +2020,18 @@ function isPlainObject2(payload) {
|
|
|
2024
2020
|
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
2025
2021
|
}
|
|
2026
2022
|
__name(isPlainObject2, "isPlainObject");
|
|
2027
|
-
function
|
|
2028
|
-
return getType2(payload) === "
|
|
2023
|
+
function isNull2(payload) {
|
|
2024
|
+
return getType2(payload) === "Null";
|
|
2029
2025
|
}
|
|
2030
|
-
__name(
|
|
2026
|
+
__name(isNull2, "isNull");
|
|
2031
2027
|
function isOneOf(a, b, c, d, e) {
|
|
2032
2028
|
return (value) => a(value) || b(value) || !!c && c(value) || !!d && d(value) || !!e && e(value);
|
|
2033
2029
|
}
|
|
2034
2030
|
__name(isOneOf, "isOneOf");
|
|
2031
|
+
function isUndefined2(payload) {
|
|
2032
|
+
return getType2(payload) === "Undefined";
|
|
2033
|
+
}
|
|
2034
|
+
__name(isUndefined2, "isUndefined");
|
|
2035
2035
|
|
|
2036
2036
|
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
2037
2037
|
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
@@ -2506,10 +2506,14 @@ var getAssets = /* @__PURE__ */ __name(async (chain, network, env) => {
|
|
|
2506
2506
|
throw new Error("received unexpected chain");
|
|
2507
2507
|
}, "getAssets");
|
|
2508
2508
|
var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal }) => {
|
|
2509
|
+
const { brokerCommissionBps, ...returnedRequestData } = quoteRequest;
|
|
2509
2510
|
const params = {
|
|
2510
|
-
amount:
|
|
2511
|
-
srcAsset:
|
|
2512
|
-
destAsset:
|
|
2511
|
+
amount: returnedRequestData.amount,
|
|
2512
|
+
srcAsset: returnedRequestData.srcAsset,
|
|
2513
|
+
destAsset: returnedRequestData.destAsset,
|
|
2514
|
+
...brokerCommissionBps && {
|
|
2515
|
+
brokerCommissionBps: String(brokerCommissionBps)
|
|
2516
|
+
}
|
|
2513
2517
|
};
|
|
2514
2518
|
const queryParams = new URLSearchParams(params);
|
|
2515
2519
|
const url = new URL(`/quote?${queryParams.toString()}`, baseUrl).toString();
|
|
@@ -2517,7 +2521,7 @@ var getQuote = /* @__PURE__ */ __name(async (baseUrl, quoteRequest, { signal })
|
|
|
2517
2521
|
signal
|
|
2518
2522
|
});
|
|
2519
2523
|
return {
|
|
2520
|
-
...
|
|
2524
|
+
...returnedRequestData,
|
|
2521
2525
|
quote: data
|
|
2522
2526
|
};
|
|
2523
2527
|
}, "getQuote");
|
|
@@ -2579,7 +2583,10 @@ var _SwapSDK = class _SwapSDK {
|
|
|
2579
2583
|
return ApiService_default.getAssets(chain, this.network, env);
|
|
2580
2584
|
}
|
|
2581
2585
|
getQuote(quoteRequest, options = {}) {
|
|
2582
|
-
return ApiService_default.getQuote(this.baseUrl,
|
|
2586
|
+
return ApiService_default.getQuote(this.baseUrl, {
|
|
2587
|
+
...quoteRequest,
|
|
2588
|
+
brokerCommissionBps: this.brokerConfig?.commissionBps
|
|
2589
|
+
}, options);
|
|
2583
2590
|
}
|
|
2584
2591
|
async requestDepositAddress(depositAddressRequest) {
|
|
2585
2592
|
const { srcChain, srcAsset, amount } = depositAddressRequest;
|
|
@@ -2589,11 +2596,12 @@ var _SwapSDK = class _SwapSDK {
|
|
|
2589
2596
|
}, BigInt(amount));
|
|
2590
2597
|
let response;
|
|
2591
2598
|
if (this.brokerConfig !== void 0) {
|
|
2592
|
-
const { requestSwapDepositAddress } = await import('./broker-
|
|
2599
|
+
const { requestSwapDepositAddress } = await import('./broker-PDSDURH6.mjs');
|
|
2593
2600
|
const result = await requestSwapDepositAddress(depositAddressRequest, this.brokerConfig, this.network);
|
|
2594
2601
|
response = {
|
|
2595
2602
|
id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
|
|
2596
2603
|
depositAddress: result.address,
|
|
2604
|
+
brokerCommissionBps: this.brokerConfig.commissionBps,
|
|
2597
2605
|
srcChainExpiryBlock: result.sourceChainExpiryBlock
|
|
2598
2606
|
};
|
|
2599
2607
|
} else {
|
|
@@ -2603,6 +2611,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
2603
2611
|
...depositAddressRequest,
|
|
2604
2612
|
depositChannelId: response.id,
|
|
2605
2613
|
depositAddress: response.depositAddress,
|
|
2614
|
+
brokerCommissionBps: response.brokerCommissionBps,
|
|
2606
2615
|
depositChannelExpiryBlock: response.srcChainExpiryBlock,
|
|
2607
2616
|
estimatedDepositChannelExpiryTime: response.estimatedExpiryTime
|
|
2608
2617
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./swap": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "",
|
|
33
33
|
"license": "ISC",
|
|
34
34
|
"engines": {
|
|
35
|
-
"node": "^
|
|
35
|
+
"node": "^18 || ^20.11.0",
|
|
36
36
|
"pnpm": ">=7"
|
|
37
37
|
},
|
|
38
38
|
"repository": "https://github.com/chainflip-io/chainflip-sdk-monorepo.git",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@polkadot/util": "^12.6.2",
|
|
45
45
|
"@polkadot/util-crypto": "^12.6.2",
|
|
46
|
-
"axios": "^1.6.
|
|
47
|
-
"ethers": "6.9.2"
|
|
46
|
+
"axios": "^1.6.7",
|
|
47
|
+
"ethers": "^6.9.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.0.1"
|