@chainflip/sdk 2.3.3 → 2.3.4-dev.1
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.cjs +282 -193
- package/dist/swap.d.cts +26 -7
- package/dist/swap.d.ts +26 -7
- package/dist/swap.js +271 -182
- package/package.json +1 -1
package/dist/swap.d.cts
CHANGED
|
@@ -446,6 +446,10 @@ interface VaultSwapRequest {
|
|
|
446
446
|
commissionBps: number;
|
|
447
447
|
}[];
|
|
448
448
|
ccmParams?: CcmParams;
|
|
449
|
+
/**
|
|
450
|
+
* @deprecated DEPRECATED(2.3): Initialize the SDK with `broker: { url }` for your own broker instead.
|
|
451
|
+
* When the SDK is initialized with a broker, that broker takes precedence here.
|
|
452
|
+
*/
|
|
449
453
|
brokerAccount?: `cF${string}`;
|
|
450
454
|
brokerCommissionBps?: number;
|
|
451
455
|
extraParams?: {
|
|
@@ -489,6 +493,10 @@ interface EncodeCfParametersRequest {
|
|
|
489
493
|
commissionBps: number;
|
|
490
494
|
}[];
|
|
491
495
|
ccmParams?: CcmParams;
|
|
496
|
+
/**
|
|
497
|
+
* @deprecated DEPRECATED(2.3): Initialize the SDK with `broker: { url }` for your own broker instead.
|
|
498
|
+
* When the SDK is initialized with a broker, that broker takes precedence here.
|
|
499
|
+
*/
|
|
492
500
|
brokerAccount?: `cF${string}`;
|
|
493
501
|
brokerCommissionBps?: number;
|
|
494
502
|
}
|
|
@@ -497,12 +505,19 @@ type RequestOptions = {
|
|
|
497
505
|
signal?: AbortSignal;
|
|
498
506
|
};
|
|
499
507
|
|
|
508
|
+
declare const BrokerName: {
|
|
509
|
+
readonly ChainflipSwap: "swap.chainflip.io";
|
|
510
|
+
};
|
|
511
|
+
type BrokerName = (typeof BrokerName)[keyof typeof BrokerName];
|
|
512
|
+
type BrokerOption = {
|
|
513
|
+
url: string;
|
|
514
|
+
} | {
|
|
515
|
+
name: BrokerName;
|
|
516
|
+
};
|
|
500
517
|
type SwapSDKOptions = {
|
|
501
518
|
network?: ChainflipNetwork;
|
|
502
519
|
backendUrl?: string;
|
|
503
|
-
broker?:
|
|
504
|
-
url: string;
|
|
505
|
-
};
|
|
520
|
+
broker?: BrokerOption;
|
|
506
521
|
rpcUrl?: string;
|
|
507
522
|
enabledFeatures?: {
|
|
508
523
|
dcaV2?: boolean;
|
|
@@ -526,8 +541,12 @@ declare class SwapSDK {
|
|
|
526
541
|
private getBtcSupplyPoolDepth;
|
|
527
542
|
private getBoostPoolsDepth;
|
|
528
543
|
getAssets(chain?: ChainflipChain, type?: AssetState): Promise<AssetData[]>;
|
|
529
|
-
|
|
544
|
+
private resolveBroker;
|
|
545
|
+
private requireBroker;
|
|
546
|
+
private resolveEncodingBroker;
|
|
547
|
+
private estimateExpiryTime;
|
|
530
548
|
private getCommissionBps;
|
|
549
|
+
private getQuotedBrokerCommissionBps;
|
|
531
550
|
getQuoteV2(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponseV2>;
|
|
532
551
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
533
552
|
private validateSwapAmount;
|
|
@@ -544,8 +563,8 @@ declare class SwapSDK {
|
|
|
544
563
|
/** @deprecated DEPRECATED(2.2): Only value supported moving forward is 5 bps */
|
|
545
564
|
feeTierBps?: number;
|
|
546
565
|
} & UncheckedAssetAndChain)): Promise<BoostPoolDepth[]>;
|
|
547
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps
|
|
548
|
-
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps
|
|
566
|
+
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
567
|
+
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
549
568
|
encodeCfParameters({ quote, srcAddress, destAddress, fillOrKillParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, }: EncodeCfParametersRequest): Promise<HexString>;
|
|
550
569
|
checkBoostEnabled(): Promise<boolean>;
|
|
551
570
|
requestAccountCreationDepositAddress(asset: ChainflipAsset, refundAddress: string, signatureData: AccountCreationDepositChannelParams['signatureData'], transactionMetadata: AccountCreationDepositChannelParams['transactionMetadata'], boostFeeBps?: number): Promise<{
|
|
@@ -618,4 +637,4 @@ declare const Assets: {
|
|
|
618
637
|
type Chain = ChainflipChain;
|
|
619
638
|
type InternalAsset = ChainflipAsset;
|
|
620
639
|
|
|
621
|
-
export { type AssetData, Assets, type BoostPoolDepth, type BoostQuote, type Chain, type ChainData, type InternalAsset as ChainflipId, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequestV2, type DepositAddressResponseV2, type EncodeCfParametersRequest, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse };
|
|
640
|
+
export { type AssetData, Assets, type BoostPoolDepth, type BoostQuote, BrokerName, type BrokerOption, type Chain, type ChainData, type InternalAsset as ChainflipId, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequestV2, type DepositAddressResponseV2, type EncodeCfParametersRequest, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse };
|
package/dist/swap.d.ts
CHANGED
|
@@ -446,6 +446,10 @@ interface VaultSwapRequest {
|
|
|
446
446
|
commissionBps: number;
|
|
447
447
|
}[];
|
|
448
448
|
ccmParams?: CcmParams;
|
|
449
|
+
/**
|
|
450
|
+
* @deprecated DEPRECATED(2.3): Initialize the SDK with `broker: { url }` for your own broker instead.
|
|
451
|
+
* When the SDK is initialized with a broker, that broker takes precedence here.
|
|
452
|
+
*/
|
|
449
453
|
brokerAccount?: `cF${string}`;
|
|
450
454
|
brokerCommissionBps?: number;
|
|
451
455
|
extraParams?: {
|
|
@@ -489,6 +493,10 @@ interface EncodeCfParametersRequest {
|
|
|
489
493
|
commissionBps: number;
|
|
490
494
|
}[];
|
|
491
495
|
ccmParams?: CcmParams;
|
|
496
|
+
/**
|
|
497
|
+
* @deprecated DEPRECATED(2.3): Initialize the SDK with `broker: { url }` for your own broker instead.
|
|
498
|
+
* When the SDK is initialized with a broker, that broker takes precedence here.
|
|
499
|
+
*/
|
|
492
500
|
brokerAccount?: `cF${string}`;
|
|
493
501
|
brokerCommissionBps?: number;
|
|
494
502
|
}
|
|
@@ -497,12 +505,19 @@ type RequestOptions = {
|
|
|
497
505
|
signal?: AbortSignal;
|
|
498
506
|
};
|
|
499
507
|
|
|
508
|
+
declare const BrokerName: {
|
|
509
|
+
readonly ChainflipSwap: "swap.chainflip.io";
|
|
510
|
+
};
|
|
511
|
+
type BrokerName = (typeof BrokerName)[keyof typeof BrokerName];
|
|
512
|
+
type BrokerOption = {
|
|
513
|
+
url: string;
|
|
514
|
+
} | {
|
|
515
|
+
name: BrokerName;
|
|
516
|
+
};
|
|
500
517
|
type SwapSDKOptions = {
|
|
501
518
|
network?: ChainflipNetwork;
|
|
502
519
|
backendUrl?: string;
|
|
503
|
-
broker?:
|
|
504
|
-
url: string;
|
|
505
|
-
};
|
|
520
|
+
broker?: BrokerOption;
|
|
506
521
|
rpcUrl?: string;
|
|
507
522
|
enabledFeatures?: {
|
|
508
523
|
dcaV2?: boolean;
|
|
@@ -526,8 +541,12 @@ declare class SwapSDK {
|
|
|
526
541
|
private getBtcSupplyPoolDepth;
|
|
527
542
|
private getBoostPoolsDepth;
|
|
528
543
|
getAssets(chain?: ChainflipChain, type?: AssetState): Promise<AssetData[]>;
|
|
529
|
-
|
|
544
|
+
private resolveBroker;
|
|
545
|
+
private requireBroker;
|
|
546
|
+
private resolveEncodingBroker;
|
|
547
|
+
private estimateExpiryTime;
|
|
530
548
|
private getCommissionBps;
|
|
549
|
+
private getQuotedBrokerCommissionBps;
|
|
531
550
|
getQuoteV2(quoteRequest: QuoteRequest, options?: RequestOptions): Promise<QuoteResponseV2>;
|
|
532
551
|
getStatusV2(swapStatusRequest: SwapStatusRequest, options?: RequestOptions): Promise<SwapStatusResponseV2>;
|
|
533
552
|
private validateSwapAmount;
|
|
@@ -544,8 +563,8 @@ declare class SwapSDK {
|
|
|
544
563
|
/** @deprecated DEPRECATED(2.2): Only value supported moving forward is 5 bps */
|
|
545
564
|
feeTierBps?: number;
|
|
546
565
|
} & UncheckedAssetAndChain)): Promise<BoostPoolDepth[]>;
|
|
547
|
-
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps
|
|
548
|
-
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps
|
|
566
|
+
requestDepositAddressV2({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): Promise<DepositAddressResponseV2>;
|
|
567
|
+
encodeVaultSwapData({ quote, srcAddress, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, extraParams, }: VaultSwapRequest): Promise<VaultSwapResponse>;
|
|
549
568
|
encodeCfParameters({ quote, srcAddress, destAddress, fillOrKillParams, affiliateBrokers: affiliates, ccmParams, brokerAccount, brokerCommissionBps, }: EncodeCfParametersRequest): Promise<HexString>;
|
|
550
569
|
checkBoostEnabled(): Promise<boolean>;
|
|
551
570
|
requestAccountCreationDepositAddress(asset: ChainflipAsset, refundAddress: string, signatureData: AccountCreationDepositChannelParams['signatureData'], transactionMetadata: AccountCreationDepositChannelParams['transactionMetadata'], boostFeeBps?: number): Promise<{
|
|
@@ -618,4 +637,4 @@ declare const Assets: {
|
|
|
618
637
|
type Chain = ChainflipChain;
|
|
619
638
|
type InternalAsset = ChainflipAsset;
|
|
620
639
|
|
|
621
|
-
export { type AssetData, Assets, type BoostPoolDepth, type BoostQuote, type Chain, type ChainData, type InternalAsset as ChainflipId, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequestV2, type DepositAddressResponseV2, type EncodeCfParametersRequest, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse };
|
|
640
|
+
export { type AssetData, Assets, type BoostPoolDepth, type BoostQuote, BrokerName, type BrokerOption, type Chain, type ChainData, type InternalAsset as ChainflipId, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequestV2, type DepositAddressResponseV2, type EncodeCfParametersRequest, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponseV2, type VaultSwapRequest, type VaultSwapResponse };
|