@chainflip/sdk 1.6.7-rc.5 → 1.7.0
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/{chunk-G76RI3QK.mjs → chunk-KLBPIDTY.mjs} +2 -38
- package/dist/funding.js +0 -92
- package/dist/funding.mjs +1 -1
- package/dist/swap.d.mts +2 -9
- package/dist/swap.d.ts +2 -9
- package/dist/swap.js +188 -11858
- package/dist/swap.mjs +68 -11703
- package/package.json +9 -4
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClient, constants } from '@chainflip/rpc';
|
|
2
2
|
import { Interface, Contract } from 'ethers';
|
|
3
3
|
|
|
4
|
-
var __create = Object.create;
|
|
5
4
|
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
12
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
13
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
14
|
-
};
|
|
15
|
-
var __export = (target, all) => {
|
|
16
|
-
for (var name in all)
|
|
17
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
-
};
|
|
19
|
-
var __copyProps = (to, from, except, desc) => {
|
|
20
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
21
|
-
for (let key of __getOwnPropNames(from))
|
|
22
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
23
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
24
|
-
}
|
|
25
|
-
return to;
|
|
26
|
-
};
|
|
27
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
28
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
29
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
30
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
31
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
32
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
33
|
-
mod
|
|
34
|
-
));
|
|
35
7
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
36
8
|
|
|
37
9
|
// ../shared/src/enums.ts
|
|
@@ -2288,14 +2260,6 @@ var _Vault__factory = class _Vault__factory {
|
|
|
2288
2260
|
__name(_Vault__factory, "Vault__factory");
|
|
2289
2261
|
__publicField(_Vault__factory, "abi", _abi3);
|
|
2290
2262
|
var Vault__factory = _Vault__factory;
|
|
2291
|
-
|
|
2292
|
-
// ../shared/src/consts.ts
|
|
2293
|
-
({
|
|
2294
|
-
[ChainflipNetworks.backspin]: 1e3,
|
|
2295
|
-
[ChainflipNetworks.sisyphos]: 1e3,
|
|
2296
|
-
[ChainflipNetworks.perseverance]: 1e3,
|
|
2297
|
-
[ChainflipNetworks.mainnet]: 1e3
|
|
2298
|
-
});
|
|
2299
2263
|
var ETHEREUM_EVM_CHAIN_ID = {
|
|
2300
2264
|
[ChainflipNetworks.backspin]: 10997,
|
|
2301
2265
|
[ChainflipNetworks.sisyphos]: 11155111,
|
|
@@ -2406,4 +2370,4 @@ var getFlipBalance = /* @__PURE__ */ __name(async (network, signer) => {
|
|
|
2406
2370
|
return flip.balanceOf(await signer.getAddress());
|
|
2407
2371
|
}, "getFlipBalance");
|
|
2408
2372
|
|
|
2409
|
-
export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory,
|
|
2373
|
+
export { Assets, ChainflipNetworks, Chains, InternalAssets, StateChainGateway__factory, Vault__factory, __name, __publicField, approve, assert, assetConstants, chainConstants, checkAllowance, extractOverrides, getAllBoostPoolsDepth, getAssetAndChain, getEnvironment, getEvmChainId, getFlipBalance, getFundingEnvironment, getInternalAsset, getInternalAssets, getStateChainGatewayContractAddress, getSupportedAssets, getTokenContractAddress, getVaultContractAddress, isNotNullish, isString, isTestnet, isValidAssetAndChain, readChainAssetValue };
|
package/dist/funding.js
CHANGED
|
@@ -798,78 +798,6 @@ var ChainflipNetworks = arrayToMap([
|
|
|
798
798
|
"perseverance",
|
|
799
799
|
"mainnet"
|
|
800
800
|
]);
|
|
801
|
-
({
|
|
802
|
-
[InternalAssets.Eth]: {
|
|
803
|
-
chain: Chains.Ethereum,
|
|
804
|
-
asset: Assets.ETH,
|
|
805
|
-
name: "Ether",
|
|
806
|
-
decimals: 18,
|
|
807
|
-
contractId: 1
|
|
808
|
-
},
|
|
809
|
-
[InternalAssets.Flip]: {
|
|
810
|
-
chain: Chains.Ethereum,
|
|
811
|
-
asset: Assets.FLIP,
|
|
812
|
-
name: "FLIP",
|
|
813
|
-
decimals: 18,
|
|
814
|
-
contractId: 2
|
|
815
|
-
},
|
|
816
|
-
[InternalAssets.Usdc]: {
|
|
817
|
-
chain: Chains.Ethereum,
|
|
818
|
-
asset: Assets.USDC,
|
|
819
|
-
name: "USDC",
|
|
820
|
-
decimals: 6,
|
|
821
|
-
contractId: 3
|
|
822
|
-
},
|
|
823
|
-
[InternalAssets.Usdt]: {
|
|
824
|
-
chain: Chains.Ethereum,
|
|
825
|
-
asset: Assets.USDT,
|
|
826
|
-
name: "USDT",
|
|
827
|
-
decimals: 6,
|
|
828
|
-
contractId: 8
|
|
829
|
-
},
|
|
830
|
-
[InternalAssets.Dot]: {
|
|
831
|
-
chain: Chains.Polkadot,
|
|
832
|
-
asset: Assets.DOT,
|
|
833
|
-
name: "Polkadot",
|
|
834
|
-
decimals: 10,
|
|
835
|
-
contractId: 4
|
|
836
|
-
},
|
|
837
|
-
[InternalAssets.Btc]: {
|
|
838
|
-
chain: Chains.Bitcoin,
|
|
839
|
-
asset: Assets.BTC,
|
|
840
|
-
name: "Bitcoin",
|
|
841
|
-
decimals: 8,
|
|
842
|
-
contractId: 5
|
|
843
|
-
},
|
|
844
|
-
[InternalAssets.ArbEth]: {
|
|
845
|
-
chain: Chains.Arbitrum,
|
|
846
|
-
asset: Assets.ETH,
|
|
847
|
-
name: "Arbitrum Ether",
|
|
848
|
-
decimals: 18,
|
|
849
|
-
contractId: 6
|
|
850
|
-
},
|
|
851
|
-
[InternalAssets.ArbUsdc]: {
|
|
852
|
-
chain: Chains.Arbitrum,
|
|
853
|
-
asset: Assets.USDC,
|
|
854
|
-
name: "Arbitrum USDC",
|
|
855
|
-
decimals: 6,
|
|
856
|
-
contractId: 7
|
|
857
|
-
},
|
|
858
|
-
[InternalAssets.Sol]: {
|
|
859
|
-
chain: Chains.Solana,
|
|
860
|
-
asset: Assets.SOL,
|
|
861
|
-
name: "Solana",
|
|
862
|
-
decimals: 9,
|
|
863
|
-
contractId: 9
|
|
864
|
-
},
|
|
865
|
-
[InternalAssets.SolUsdc]: {
|
|
866
|
-
chain: Chains.Solana,
|
|
867
|
-
asset: Assets.USDC,
|
|
868
|
-
name: "Solana USDC",
|
|
869
|
-
decimals: 6,
|
|
870
|
-
contractId: 10
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
801
|
var chainConstants = {
|
|
874
802
|
[Chains.Ethereum]: {
|
|
875
803
|
assets: [
|
|
@@ -957,26 +885,6 @@ function getInternalAsset(asset, assert2 = true) {
|
|
|
957
885
|
return chain[asset.asset];
|
|
958
886
|
}
|
|
959
887
|
__name(getInternalAsset, "getInternalAsset");
|
|
960
|
-
|
|
961
|
-
// ../shared/src/consts.ts
|
|
962
|
-
({
|
|
963
|
-
[ChainflipNetworks.backspin]: 1e3,
|
|
964
|
-
[ChainflipNetworks.sisyphos]: 1e3,
|
|
965
|
-
[ChainflipNetworks.perseverance]: 1e3,
|
|
966
|
-
[ChainflipNetworks.mainnet]: 1e3
|
|
967
|
-
});
|
|
968
|
-
({
|
|
969
|
-
[ChainflipNetworks.backspin]: 10997,
|
|
970
|
-
[ChainflipNetworks.sisyphos]: 11155111,
|
|
971
|
-
[ChainflipNetworks.perseverance]: 11155111,
|
|
972
|
-
[ChainflipNetworks.mainnet]: 1
|
|
973
|
-
});
|
|
974
|
-
({
|
|
975
|
-
[ChainflipNetworks.backspin]: 412346,
|
|
976
|
-
[ChainflipNetworks.sisyphos]: 421614,
|
|
977
|
-
[ChainflipNetworks.perseverance]: 421614,
|
|
978
|
-
[ChainflipNetworks.mainnet]: 42161
|
|
979
|
-
});
|
|
980
888
|
var SEPOLIA_USDC_CONTRACT_ADDRESS = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
|
|
981
889
|
var SEPOLIA_USDT_CONTRACT_ADDRESS = "0x27CEA6Eb8a21Aae05Eb29C91c5CA10592892F584";
|
|
982
890
|
var ADDRESSES = {
|
package/dist/funding.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, __publicField,
|
|
1
|
+
import { __name, __publicField, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, ChainflipNetworks, StateChainGateway__factory } from './chunk-KLBPIDTY.mjs';
|
|
2
2
|
|
|
3
3
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
4
|
var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
package/dist/swap.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-Bgib7w_h.mjs';
|
|
2
2
|
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
4
|
import { Signer } from 'ethers';
|
|
6
5
|
|
|
7
6
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
@@ -125,7 +124,6 @@ interface ExecuteSwapParams {
|
|
|
125
124
|
amount: string;
|
|
126
125
|
destAddress: string;
|
|
127
126
|
ccmParams?: CcmParams;
|
|
128
|
-
ccmMetadata?: CcmParams;
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
interface ChainData {
|
|
@@ -178,7 +176,6 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
178
176
|
srcAddress?: string;
|
|
179
177
|
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
180
178
|
dcaParams?: DcaParams;
|
|
181
|
-
ccmMetadata?: CcmParams;
|
|
182
179
|
}
|
|
183
180
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
184
181
|
depositChannelId: string;
|
|
@@ -203,8 +200,6 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
203
200
|
swapScheduledAt: number | undefined;
|
|
204
201
|
swapScheduledBlockIndex: string | undefined;
|
|
205
202
|
lastStatechainUpdateAt: number | undefined;
|
|
206
|
-
depositTransactionHash: string | undefined;
|
|
207
|
-
ccmMetadata?: CcmParams;
|
|
208
203
|
}
|
|
209
204
|
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
210
205
|
depositAddress: string;
|
|
@@ -362,7 +357,8 @@ declare enum FailureMode {
|
|
|
362
357
|
IngressIgnored = "DEPOSIT_TOO_SMALL",
|
|
363
358
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
359
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
|
-
BroadcastAborted = "SENDING_FAILED"
|
|
360
|
+
BroadcastAborted = "SENDING_FAILED",
|
|
361
|
+
TransactionRejectedByBroker = "DEPOSIT_REJECTED"
|
|
366
362
|
}
|
|
367
363
|
|
|
368
364
|
interface Failure {
|
|
@@ -519,7 +515,6 @@ type SwapSDKOptions = {
|
|
|
519
515
|
rpcUrl?: string;
|
|
520
516
|
enabledFeatures?: {
|
|
521
517
|
dca?: boolean;
|
|
522
|
-
experimentalRecommendedSlippage?: boolean;
|
|
523
518
|
};
|
|
524
519
|
};
|
|
525
520
|
declare class SwapSDK {
|
|
@@ -529,7 +524,6 @@ declare class SwapSDK {
|
|
|
529
524
|
private stateChainEnvironmentCache;
|
|
530
525
|
private supportedAssets?;
|
|
531
526
|
private dcaEnabled;
|
|
532
|
-
private autoSlippageEnabled;
|
|
533
527
|
constructor(options?: SwapSDKOptions);
|
|
534
528
|
getChains(sourceChain?: Chain): Promise<ChainData[]>;
|
|
535
529
|
private getStateChainEnvironment;
|
|
@@ -597,7 +591,6 @@ declare class SwapSDK {
|
|
|
597
591
|
} | undefined;
|
|
598
592
|
amount: string;
|
|
599
593
|
}>;
|
|
600
|
-
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { A as AssetAndChain, C as Chain, a as Asset, I as InternalAsset, b as AssetOfChain, c as ChainflipNetwork, T as TransactionOptions, d as ChainAssetMap, e as ChainMap } from './contracts-Bgib7w_h.js';
|
|
2
2
|
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-Bgib7w_h.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
4
|
import { Signer } from 'ethers';
|
|
6
5
|
|
|
7
6
|
declare const ccmParamsSchema: z.ZodObject<{
|
|
@@ -125,7 +124,6 @@ interface ExecuteSwapParams {
|
|
|
125
124
|
amount: string;
|
|
126
125
|
destAddress: string;
|
|
127
126
|
ccmParams?: CcmParams;
|
|
128
|
-
ccmMetadata?: CcmParams;
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
interface ChainData {
|
|
@@ -178,7 +176,6 @@ interface DepositAddressRequest extends QuoteRequest {
|
|
|
178
176
|
srcAddress?: string;
|
|
179
177
|
fillOrKillParams?: FillOrKillParamsWithMinPrice;
|
|
180
178
|
dcaParams?: DcaParams;
|
|
181
|
-
ccmMetadata?: CcmParams;
|
|
182
179
|
}
|
|
183
180
|
interface DepositAddressResponse extends DepositAddressRequest {
|
|
184
181
|
depositChannelId: string;
|
|
@@ -203,8 +200,6 @@ interface SwapStatusResponseCommonFields$1 extends ChainsAndAssets {
|
|
|
203
200
|
swapScheduledAt: number | undefined;
|
|
204
201
|
swapScheduledBlockIndex: string | undefined;
|
|
205
202
|
lastStatechainUpdateAt: number | undefined;
|
|
206
|
-
depositTransactionHash: string | undefined;
|
|
207
|
-
ccmMetadata?: CcmParams;
|
|
208
203
|
}
|
|
209
204
|
interface DepositAddressFields extends SwapStatusResponseCommonFields$1 {
|
|
210
205
|
depositAddress: string;
|
|
@@ -362,7 +357,8 @@ declare enum FailureMode {
|
|
|
362
357
|
IngressIgnored = "DEPOSIT_TOO_SMALL",
|
|
363
358
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
359
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
|
-
BroadcastAborted = "SENDING_FAILED"
|
|
360
|
+
BroadcastAborted = "SENDING_FAILED",
|
|
361
|
+
TransactionRejectedByBroker = "DEPOSIT_REJECTED"
|
|
366
362
|
}
|
|
367
363
|
|
|
368
364
|
interface Failure {
|
|
@@ -519,7 +515,6 @@ type SwapSDKOptions = {
|
|
|
519
515
|
rpcUrl?: string;
|
|
520
516
|
enabledFeatures?: {
|
|
521
517
|
dca?: boolean;
|
|
522
|
-
experimentalRecommendedSlippage?: boolean;
|
|
523
518
|
};
|
|
524
519
|
};
|
|
525
520
|
declare class SwapSDK {
|
|
@@ -529,7 +524,6 @@ declare class SwapSDK {
|
|
|
529
524
|
private stateChainEnvironmentCache;
|
|
530
525
|
private supportedAssets?;
|
|
531
526
|
private dcaEnabled;
|
|
532
|
-
private autoSlippageEnabled;
|
|
533
527
|
constructor(options?: SwapSDKOptions);
|
|
534
528
|
getChains(sourceChain?: Chain): Promise<ChainData[]>;
|
|
535
529
|
private getStateChainEnvironment;
|
|
@@ -597,7 +591,6 @@ declare class SwapSDK {
|
|
|
597
591
|
} | undefined;
|
|
598
592
|
amount: string;
|
|
599
593
|
}>;
|
|
600
|
-
buildRequestSwapDepositAddressWithAffiliatesParams({ quote, destAddress, fillOrKillParams: inputFoKParams, affiliateBrokers, ccmParams, brokerCommissionBps, }: DepositAddressRequestV2): SwappingRequestSwapDepositAddressWithAffiliates;
|
|
601
594
|
}
|
|
602
595
|
|
|
603
596
|
export { Asset, type AssetData, type BoostPoolDepth, type BoostQuote, Chain, type ChainData, InternalAsset as ChainflipId, ChainflipNetwork, type ChainsAndAssets, type DCABoostQuote, type DCAQuote, type DepositAddressRequest, type DepositAddressRequestV2, type DepositAddressResponse, type DepositAddressStatusResponse, type FailedVaultSwapStatusResponse, type FillOrKillParamsWithSlippage, type Quote, type QuoteRequest, type QuoteResponse, type QuoteResponseV2, type RegularQuote, SwapSDK, type SwapSDKOptions, type SwapStatusRequest, type SwapStatusResponse, type SwapStatusResponseV2, type VaultSwapStatusResponse };
|