@chainflip/sdk 1.6.7-rc.5 → 1.8.0-assethub.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/{chunk-G76RI3QK.mjs → chunk-5BNVUJZY.mjs} +50 -6
- package/dist/{contracts-Bgib7w_h.d.mts → contracts-BmyTFuGH.d.mts} +8 -2
- package/dist/{contracts-Bgib7w_h.d.ts → contracts-BmyTFuGH.d.ts} +8 -2
- package/dist/funding.d.mts +1 -1
- package/dist/funding.d.ts +1 -1
- package/dist/funding.js +50 -6
- package/dist/funding.mjs +1 -1
- package/dist/swap.d.mts +6 -5
- package/dist/swap.d.ts +6 -5
- package/dist/swap.js +67 -15
- package/dist/swap.mjs +19 -11
- package/package.json +3 -3
|
@@ -40,23 +40,31 @@ var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map(
|
|
|
40
40
|
key
|
|
41
41
|
])), "arrayToMap");
|
|
42
42
|
var InternalAssets = arrayToMap([
|
|
43
|
-
"
|
|
44
|
-
"Usdc",
|
|
43
|
+
"Btc",
|
|
45
44
|
"Dot",
|
|
45
|
+
// ethereum
|
|
46
46
|
"Eth",
|
|
47
|
-
"
|
|
47
|
+
"Usdc",
|
|
48
|
+
"Flip",
|
|
48
49
|
"Usdt",
|
|
50
|
+
// solana
|
|
51
|
+
"Sol",
|
|
52
|
+
"SolUsdc",
|
|
53
|
+
// arbitrum
|
|
49
54
|
"ArbUsdc",
|
|
50
55
|
"ArbEth",
|
|
51
|
-
|
|
52
|
-
"
|
|
56
|
+
// asset hub
|
|
57
|
+
"HubDot",
|
|
58
|
+
"HubUsdc",
|
|
59
|
+
"HubUsdt"
|
|
53
60
|
]);
|
|
54
61
|
var Chains = arrayToMap([
|
|
55
62
|
"Bitcoin",
|
|
56
63
|
"Ethereum",
|
|
57
64
|
"Polkadot",
|
|
58
65
|
"Arbitrum",
|
|
59
|
-
"Solana"
|
|
66
|
+
"Solana",
|
|
67
|
+
"Assethub"
|
|
60
68
|
]);
|
|
61
69
|
var Assets = arrayToMap([
|
|
62
70
|
"FLIP",
|
|
@@ -144,6 +152,27 @@ var assetConstants = {
|
|
|
144
152
|
name: "Solana USDC",
|
|
145
153
|
decimals: 6,
|
|
146
154
|
contractId: 10
|
|
155
|
+
},
|
|
156
|
+
[InternalAssets.HubDot]: {
|
|
157
|
+
chain: Chains.Assethub,
|
|
158
|
+
asset: Assets.DOT,
|
|
159
|
+
name: "AssetHub DOT",
|
|
160
|
+
decimals: 10,
|
|
161
|
+
contractId: 11
|
|
162
|
+
},
|
|
163
|
+
[InternalAssets.HubUsdc]: {
|
|
164
|
+
chain: Chains.Assethub,
|
|
165
|
+
asset: Assets.USDC,
|
|
166
|
+
name: "AssetHub USDC",
|
|
167
|
+
decimals: 6,
|
|
168
|
+
contractId: 12
|
|
169
|
+
},
|
|
170
|
+
[InternalAssets.HubUsdt]: {
|
|
171
|
+
chain: Chains.Assethub,
|
|
172
|
+
asset: Assets.USDT,
|
|
173
|
+
name: "AssetHub USDT",
|
|
174
|
+
decimals: 6,
|
|
175
|
+
contractId: 13
|
|
147
176
|
}
|
|
148
177
|
};
|
|
149
178
|
var chainConstants = {
|
|
@@ -191,6 +220,16 @@ var chainConstants = {
|
|
|
191
220
|
gasAsset: InternalAssets.Sol,
|
|
192
221
|
contractId: 5,
|
|
193
222
|
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
223
|
+
},
|
|
224
|
+
[Chains.Assethub]: {
|
|
225
|
+
assets: [
|
|
226
|
+
Assets.DOT,
|
|
227
|
+
Assets.USDC,
|
|
228
|
+
Assets.USDT
|
|
229
|
+
],
|
|
230
|
+
gasAsset: InternalAssets.HubDot,
|
|
231
|
+
contractId: 6,
|
|
232
|
+
blockTimeSeconds: 12
|
|
194
233
|
}
|
|
195
234
|
};
|
|
196
235
|
function isValidAssetAndChain(assetAndChain) {
|
|
@@ -232,6 +271,11 @@ function getInternalAsset(asset, assert2 = true) {
|
|
|
232
271
|
[Chains.Solana]: {
|
|
233
272
|
[Assets.SOL]: InternalAssets.Sol,
|
|
234
273
|
[Assets.USDC]: InternalAssets.SolUsdc
|
|
274
|
+
},
|
|
275
|
+
[Chains.Assethub]: {
|
|
276
|
+
[Assets.DOT]: InternalAssets.HubDot,
|
|
277
|
+
[Assets.USDC]: InternalAssets.HubUsdc,
|
|
278
|
+
[Assets.USDT]: InternalAssets.HubUsdt
|
|
235
279
|
}
|
|
236
280
|
};
|
|
237
281
|
const chain = map[asset.chain];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type ArrayToMap<T extends readonly string[]> = {
|
|
2
2
|
[K in T[number]]: K;
|
|
3
3
|
};
|
|
4
|
-
declare const InternalAssets: ArrayToMap<readonly ["
|
|
4
|
+
declare const InternalAssets: ArrayToMap<readonly ["Btc", "Dot", "Eth", "Usdc", "Flip", "Usdt", "Sol", "SolUsdc", "ArbUsdc", "ArbEth", "HubDot", "HubUsdc", "HubUsdt"]>;
|
|
5
5
|
type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
|
|
6
|
-
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]>;
|
|
6
|
+
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana", "Assethub"]>;
|
|
7
7
|
type Chain = (typeof Chains)[keyof typeof Chains];
|
|
8
8
|
declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]>;
|
|
9
9
|
type Asset = (typeof Assets)[keyof typeof Assets];
|
|
@@ -40,6 +40,12 @@ declare const chainConstants: {
|
|
|
40
40
|
readonly contractId: 5;
|
|
41
41
|
readonly blockTimeSeconds: number;
|
|
42
42
|
};
|
|
43
|
+
readonly Assethub: {
|
|
44
|
+
readonly assets: ["DOT", "USDC", "USDT"];
|
|
45
|
+
readonly gasAsset: "HubDot";
|
|
46
|
+
readonly contractId: 6;
|
|
47
|
+
readonly blockTimeSeconds: 12;
|
|
48
|
+
};
|
|
43
49
|
};
|
|
44
50
|
type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
|
|
45
51
|
type UncheckedAssetAndChain = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type ArrayToMap<T extends readonly string[]> = {
|
|
2
2
|
[K in T[number]]: K;
|
|
3
3
|
};
|
|
4
|
-
declare const InternalAssets: ArrayToMap<readonly ["
|
|
4
|
+
declare const InternalAssets: ArrayToMap<readonly ["Btc", "Dot", "Eth", "Usdc", "Flip", "Usdt", "Sol", "SolUsdc", "ArbUsdc", "ArbEth", "HubDot", "HubUsdc", "HubUsdt"]>;
|
|
5
5
|
type InternalAsset = (typeof InternalAssets)[keyof typeof InternalAssets];
|
|
6
|
-
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana"]>;
|
|
6
|
+
declare const Chains: ArrayToMap<readonly ["Bitcoin", "Ethereum", "Polkadot", "Arbitrum", "Solana", "Assethub"]>;
|
|
7
7
|
type Chain = (typeof Chains)[keyof typeof Chains];
|
|
8
8
|
declare const Assets: ArrayToMap<readonly ["FLIP", "USDC", "DOT", "ETH", "BTC", "USDT", "SOL"]>;
|
|
9
9
|
type Asset = (typeof Assets)[keyof typeof Assets];
|
|
@@ -40,6 +40,12 @@ declare const chainConstants: {
|
|
|
40
40
|
readonly contractId: 5;
|
|
41
41
|
readonly blockTimeSeconds: number;
|
|
42
42
|
};
|
|
43
|
+
readonly Assethub: {
|
|
44
|
+
readonly assets: ["DOT", "USDC", "USDT"];
|
|
45
|
+
readonly gasAsset: "HubDot";
|
|
46
|
+
readonly contractId: 6;
|
|
47
|
+
readonly blockTimeSeconds: 12;
|
|
48
|
+
};
|
|
43
49
|
};
|
|
44
50
|
type AssetOfChain<C extends Chain> = (typeof chainConstants)[C]['assets'][number];
|
|
45
51
|
type UncheckedAssetAndChain = {
|
package/dist/funding.d.mts
CHANGED
package/dist/funding.d.ts
CHANGED
package/dist/funding.js
CHANGED
|
@@ -765,23 +765,31 @@ var arrayToMap = /* @__PURE__ */ __name((array) => Object.fromEntries(array.map(
|
|
|
765
765
|
key
|
|
766
766
|
])), "arrayToMap");
|
|
767
767
|
var InternalAssets = arrayToMap([
|
|
768
|
-
"
|
|
769
|
-
"Usdc",
|
|
768
|
+
"Btc",
|
|
770
769
|
"Dot",
|
|
770
|
+
// ethereum
|
|
771
771
|
"Eth",
|
|
772
|
-
"
|
|
772
|
+
"Usdc",
|
|
773
|
+
"Flip",
|
|
773
774
|
"Usdt",
|
|
775
|
+
// solana
|
|
776
|
+
"Sol",
|
|
777
|
+
"SolUsdc",
|
|
778
|
+
// arbitrum
|
|
774
779
|
"ArbUsdc",
|
|
775
780
|
"ArbEth",
|
|
776
|
-
|
|
777
|
-
"
|
|
781
|
+
// asset hub
|
|
782
|
+
"HubDot",
|
|
783
|
+
"HubUsdc",
|
|
784
|
+
"HubUsdt"
|
|
778
785
|
]);
|
|
779
786
|
var Chains = arrayToMap([
|
|
780
787
|
"Bitcoin",
|
|
781
788
|
"Ethereum",
|
|
782
789
|
"Polkadot",
|
|
783
790
|
"Arbitrum",
|
|
784
|
-
"Solana"
|
|
791
|
+
"Solana",
|
|
792
|
+
"Assethub"
|
|
785
793
|
]);
|
|
786
794
|
var Assets = arrayToMap([
|
|
787
795
|
"FLIP",
|
|
@@ -868,6 +876,27 @@ var ChainflipNetworks = arrayToMap([
|
|
|
868
876
|
name: "Solana USDC",
|
|
869
877
|
decimals: 6,
|
|
870
878
|
contractId: 10
|
|
879
|
+
},
|
|
880
|
+
[InternalAssets.HubDot]: {
|
|
881
|
+
chain: Chains.Assethub,
|
|
882
|
+
asset: Assets.DOT,
|
|
883
|
+
name: "AssetHub DOT",
|
|
884
|
+
decimals: 10,
|
|
885
|
+
contractId: 11
|
|
886
|
+
},
|
|
887
|
+
[InternalAssets.HubUsdc]: {
|
|
888
|
+
chain: Chains.Assethub,
|
|
889
|
+
asset: Assets.USDC,
|
|
890
|
+
name: "AssetHub USDC",
|
|
891
|
+
decimals: 6,
|
|
892
|
+
contractId: 12
|
|
893
|
+
},
|
|
894
|
+
[InternalAssets.HubUsdt]: {
|
|
895
|
+
chain: Chains.Assethub,
|
|
896
|
+
asset: Assets.USDT,
|
|
897
|
+
name: "AssetHub USDT",
|
|
898
|
+
decimals: 6,
|
|
899
|
+
contractId: 13
|
|
871
900
|
}
|
|
872
901
|
});
|
|
873
902
|
var chainConstants = {
|
|
@@ -915,6 +944,16 @@ var chainConstants = {
|
|
|
915
944
|
gasAsset: InternalAssets.Sol,
|
|
916
945
|
contractId: 5,
|
|
917
946
|
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
947
|
+
},
|
|
948
|
+
[Chains.Assethub]: {
|
|
949
|
+
assets: [
|
|
950
|
+
Assets.DOT,
|
|
951
|
+
Assets.USDC,
|
|
952
|
+
Assets.USDT
|
|
953
|
+
],
|
|
954
|
+
gasAsset: InternalAssets.HubDot,
|
|
955
|
+
contractId: 6,
|
|
956
|
+
blockTimeSeconds: 12
|
|
918
957
|
}
|
|
919
958
|
};
|
|
920
959
|
function isValidAssetAndChain(assetAndChain) {
|
|
@@ -951,6 +990,11 @@ function getInternalAsset(asset, assert2 = true) {
|
|
|
951
990
|
[Chains.Solana]: {
|
|
952
991
|
[Assets.SOL]: InternalAssets.Sol,
|
|
953
992
|
[Assets.USDC]: InternalAssets.SolUsdc
|
|
993
|
+
},
|
|
994
|
+
[Chains.Assethub]: {
|
|
995
|
+
[Assets.DOT]: InternalAssets.HubDot,
|
|
996
|
+
[Assets.USDC]: InternalAssets.HubUsdc,
|
|
997
|
+
[Assets.USDT]: InternalAssets.HubUsdt
|
|
954
998
|
}
|
|
955
999
|
};
|
|
956
1000
|
const chain = map[asset.chain];
|
package/dist/funding.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-
|
|
1
|
+
import { __name, __publicField, ChainflipNetworks, getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, InternalAssets, checkAllowance, assert, extractOverrides, StateChainGateway__factory } from './chunk-5BNVUJZY.mjs';
|
|
2
2
|
|
|
3
3
|
// ../shared/src/stateChainGateway/utils.ts
|
|
4
4
|
var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
|
package/dist/swap.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-
|
|
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-BmyTFuGH.mjs';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-BmyTFuGH.mjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
5
|
import { Signer } from 'ethers';
|
|
@@ -362,7 +362,8 @@ declare enum FailureMode {
|
|
|
362
362
|
IngressIgnored = "DEPOSIT_TOO_SMALL",
|
|
363
363
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
364
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
|
-
BroadcastAborted = "SENDING_FAILED"
|
|
365
|
+
BroadcastAborted = "SENDING_FAILED",
|
|
366
|
+
TransactionRejectedByBroker = "DEPOSIT_REJECTED"
|
|
366
367
|
}
|
|
367
368
|
|
|
368
369
|
interface Failure {
|
|
@@ -581,9 +582,9 @@ declare class SwapSDK {
|
|
|
581
582
|
channelOpeningFee: bigint;
|
|
582
583
|
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
583
584
|
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
584
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
585
|
+
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
585
586
|
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
586
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
587
|
+
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
587
588
|
srcAddress: string | undefined;
|
|
588
589
|
destAddress: string;
|
|
589
590
|
dcaParams: {
|
package/dist/swap.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
2
|
-
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-
|
|
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-BmyTFuGH.js';
|
|
2
|
+
export { g as Assets, h as ChainflipIds, i as ChainflipNetworks, f as Chains, U as UncheckedAssetAndChain, j as getChainflipId } from './contracts-BmyTFuGH.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { SwappingRequestSwapDepositAddressWithAffiliates } from '@chainflip/extrinsics/160/swapping/requestSwapDepositAddressWithAffiliates';
|
|
5
5
|
import { Signer } from 'ethers';
|
|
@@ -362,7 +362,8 @@ declare enum FailureMode {
|
|
|
362
362
|
IngressIgnored = "DEPOSIT_TOO_SMALL",
|
|
363
363
|
SwapEgressIgnored = "SWAP_OUTPUT_TOO_SMALL",
|
|
364
364
|
RefundEgressIgnored = "REFUND_OUTPUT_TOO_SMALL",
|
|
365
|
-
BroadcastAborted = "SENDING_FAILED"
|
|
365
|
+
BroadcastAborted = "SENDING_FAILED",
|
|
366
|
+
TransactionRejectedByBroker = "DEPOSIT_REJECTED"
|
|
366
367
|
}
|
|
367
368
|
|
|
368
369
|
interface Failure {
|
|
@@ -581,9 +582,9 @@ declare class SwapSDK {
|
|
|
581
582
|
channelOpeningFee: bigint;
|
|
582
583
|
fillOrKillParams: FillOrKillParamsWithMinPrice | FillOrKillParamsWithSlippage$1 | undefined;
|
|
583
584
|
srcAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
584
|
-
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
585
|
+
srcChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
585
586
|
destAsset: "FLIP" | "USDC" | "DOT" | "ETH" | "BTC" | "USDT" | "SOL";
|
|
586
|
-
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana";
|
|
587
|
+
destChain: "Bitcoin" | "Ethereum" | "Polkadot" | "Arbitrum" | "Solana" | "Assethub";
|
|
587
588
|
srcAddress: string | undefined;
|
|
588
589
|
destAddress: string;
|
|
589
590
|
dcaParams: {
|
package/dist/swap.js
CHANGED
|
@@ -11597,23 +11597,31 @@ var arrayToMap = /* @__PURE__ */ __name((array2) => Object.fromEntries(array2.ma
|
|
|
11597
11597
|
key
|
|
11598
11598
|
])), "arrayToMap");
|
|
11599
11599
|
var InternalAssets = arrayToMap([
|
|
11600
|
-
"
|
|
11601
|
-
"Usdc",
|
|
11600
|
+
"Btc",
|
|
11602
11601
|
"Dot",
|
|
11602
|
+
// ethereum
|
|
11603
11603
|
"Eth",
|
|
11604
|
-
"
|
|
11604
|
+
"Usdc",
|
|
11605
|
+
"Flip",
|
|
11605
11606
|
"Usdt",
|
|
11607
|
+
// solana
|
|
11608
|
+
"Sol",
|
|
11609
|
+
"SolUsdc",
|
|
11610
|
+
// arbitrum
|
|
11606
11611
|
"ArbUsdc",
|
|
11607
11612
|
"ArbEth",
|
|
11608
|
-
|
|
11609
|
-
"
|
|
11613
|
+
// asset hub
|
|
11614
|
+
"HubDot",
|
|
11615
|
+
"HubUsdc",
|
|
11616
|
+
"HubUsdt"
|
|
11610
11617
|
]);
|
|
11611
11618
|
var Chains = arrayToMap([
|
|
11612
11619
|
"Bitcoin",
|
|
11613
11620
|
"Ethereum",
|
|
11614
11621
|
"Polkadot",
|
|
11615
11622
|
"Arbitrum",
|
|
11616
|
-
"Solana"
|
|
11623
|
+
"Solana",
|
|
11624
|
+
"Assethub"
|
|
11617
11625
|
]);
|
|
11618
11626
|
var Assets = arrayToMap([
|
|
11619
11627
|
"FLIP",
|
|
@@ -11701,6 +11709,27 @@ var assetConstants = {
|
|
|
11701
11709
|
name: "Solana USDC",
|
|
11702
11710
|
decimals: 6,
|
|
11703
11711
|
contractId: 10
|
|
11712
|
+
},
|
|
11713
|
+
[InternalAssets.HubDot]: {
|
|
11714
|
+
chain: Chains.Assethub,
|
|
11715
|
+
asset: Assets.DOT,
|
|
11716
|
+
name: "AssetHub DOT",
|
|
11717
|
+
decimals: 10,
|
|
11718
|
+
contractId: 11
|
|
11719
|
+
},
|
|
11720
|
+
[InternalAssets.HubUsdc]: {
|
|
11721
|
+
chain: Chains.Assethub,
|
|
11722
|
+
asset: Assets.USDC,
|
|
11723
|
+
name: "AssetHub USDC",
|
|
11724
|
+
decimals: 6,
|
|
11725
|
+
contractId: 12
|
|
11726
|
+
},
|
|
11727
|
+
[InternalAssets.HubUsdt]: {
|
|
11728
|
+
chain: Chains.Assethub,
|
|
11729
|
+
asset: Assets.USDT,
|
|
11730
|
+
name: "AssetHub USDT",
|
|
11731
|
+
decimals: 6,
|
|
11732
|
+
contractId: 13
|
|
11704
11733
|
}
|
|
11705
11734
|
};
|
|
11706
11735
|
var chainConstants = {
|
|
@@ -11748,6 +11777,16 @@ var chainConstants = {
|
|
|
11748
11777
|
gasAsset: InternalAssets.Sol,
|
|
11749
11778
|
contractId: 5,
|
|
11750
11779
|
blockTimeSeconds: (400 + 800) / 2 / 1e3
|
|
11780
|
+
},
|
|
11781
|
+
[Chains.Assethub]: {
|
|
11782
|
+
assets: [
|
|
11783
|
+
Assets.DOT,
|
|
11784
|
+
Assets.USDC,
|
|
11785
|
+
Assets.USDT
|
|
11786
|
+
],
|
|
11787
|
+
gasAsset: InternalAssets.HubDot,
|
|
11788
|
+
contractId: 6,
|
|
11789
|
+
blockTimeSeconds: 12
|
|
11751
11790
|
}
|
|
11752
11791
|
};
|
|
11753
11792
|
function isValidAssetAndChain(assetAndChain2) {
|
|
@@ -11789,6 +11828,11 @@ function getInternalAsset(asset2, assert3 = true) {
|
|
|
11789
11828
|
[Chains.Solana]: {
|
|
11790
11829
|
[Assets.SOL]: InternalAssets.Sol,
|
|
11791
11830
|
[Assets.USDC]: InternalAssets.SolUsdc
|
|
11831
|
+
},
|
|
11832
|
+
[Chains.Assethub]: {
|
|
11833
|
+
[Assets.DOT]: InternalAssets.HubDot,
|
|
11834
|
+
[Assets.USDC]: InternalAssets.HubUsdc,
|
|
11835
|
+
[Assets.USDT]: InternalAssets.HubUsdt
|
|
11792
11836
|
}
|
|
11793
11837
|
};
|
|
11794
11838
|
const chain2 = map[asset2.chain];
|
|
@@ -11862,35 +11906,40 @@ var validators = {
|
|
|
11862
11906
|
Ethereum: validateEvmAddress,
|
|
11863
11907
|
Polkadot: validatePolkadotAddress,
|
|
11864
11908
|
Arbitrum: validateEvmAddress,
|
|
11865
|
-
Solana: validateSolanaAddress
|
|
11909
|
+
Solana: validateSolanaAddress,
|
|
11910
|
+
Assethub: validatePolkadotAddress
|
|
11866
11911
|
},
|
|
11867
11912
|
perseverance: {
|
|
11868
11913
|
Bitcoin: validateBitcoinTestnetAddress,
|
|
11869
11914
|
Ethereum: validateEvmAddress,
|
|
11870
11915
|
Polkadot: validatePolkadotAddress,
|
|
11871
11916
|
Arbitrum: validateEvmAddress,
|
|
11872
|
-
Solana: validateSolanaAddress
|
|
11917
|
+
Solana: validateSolanaAddress,
|
|
11918
|
+
Assethub: validatePolkadotAddress
|
|
11873
11919
|
},
|
|
11874
11920
|
sisyphos: {
|
|
11875
11921
|
Bitcoin: validateBitcoinTestnetAddress,
|
|
11876
11922
|
Ethereum: validateEvmAddress,
|
|
11877
11923
|
Polkadot: validatePolkadotAddress,
|
|
11878
11924
|
Arbitrum: validateEvmAddress,
|
|
11879
|
-
Solana: validateSolanaAddress
|
|
11925
|
+
Solana: validateSolanaAddress,
|
|
11926
|
+
Assethub: validatePolkadotAddress
|
|
11880
11927
|
},
|
|
11881
11928
|
backspin: {
|
|
11882
11929
|
Bitcoin: validateBitcoinRegtestAddress,
|
|
11883
11930
|
Ethereum: validateEvmAddress,
|
|
11884
11931
|
Polkadot: validatePolkadotAddress,
|
|
11885
11932
|
Arbitrum: validateEvmAddress,
|
|
11886
|
-
Solana: validateSolanaAddress
|
|
11933
|
+
Solana: validateSolanaAddress,
|
|
11934
|
+
Assethub: validatePolkadotAddress
|
|
11887
11935
|
},
|
|
11888
11936
|
localnet: {
|
|
11889
11937
|
Bitcoin: validateBitcoinRegtestAddress,
|
|
11890
11938
|
Ethereum: validateEvmAddress,
|
|
11891
11939
|
Polkadot: validatePolkadotAddress,
|
|
11892
11940
|
Arbitrum: validateEvmAddress,
|
|
11893
|
-
Solana: validateSolanaAddress
|
|
11941
|
+
Solana: validateSolanaAddress,
|
|
11942
|
+
Assethub: validatePolkadotAddress
|
|
11894
11943
|
}
|
|
11895
11944
|
};
|
|
11896
11945
|
var assertValidAddress = /* @__PURE__ */ __name((chain2, address, network) => assert2(validators[network][chain2](address), `Address "${address}" is not a valid "${chain2}" address for "${network}"`), "assertValidAddress");
|
|
@@ -12123,7 +12172,7 @@ z.object({
|
|
|
12123
12172
|
ccmParams: ccmParamsSchema.optional(),
|
|
12124
12173
|
maxBoostFeeBps: z.number().optional(),
|
|
12125
12174
|
srcAddress: z.string().optional(),
|
|
12126
|
-
fillOrKillParams
|
|
12175
|
+
fillOrKillParams,
|
|
12127
12176
|
dcaParams: dcaParams.optional(),
|
|
12128
12177
|
quote: z.object({
|
|
12129
12178
|
intermediateAmount: z.string().optional(),
|
|
@@ -12170,7 +12219,7 @@ var validateAddressLength = /* @__PURE__ */ __name((chain2, address, type) => {
|
|
|
12170
12219
|
if ((chain2 === "Arbitrum" || chain2 === "Ethereum") && address.length !== 42) {
|
|
12171
12220
|
throw new Error(`Invalid ${type} address length`);
|
|
12172
12221
|
}
|
|
12173
|
-
if (chain2 === "Polkadot" && address.length !== 66) {
|
|
12222
|
+
if ((chain2 === "Polkadot" || chain2 === "Assethub") && address.length !== 66) {
|
|
12174
12223
|
throw new Error(`Invalid ${type} address length`);
|
|
12175
12224
|
}
|
|
12176
12225
|
}, "validateAddressLength");
|
|
@@ -13828,7 +13877,7 @@ var assertSignerIsConnectedToChain = /* @__PURE__ */ __name(async (opts, chain2)
|
|
|
13828
13877
|
|
|
13829
13878
|
// ../shared/src/vault/executeSwap.ts
|
|
13830
13879
|
var encodeAddress2 = /* @__PURE__ */ __name((chain2, address) => {
|
|
13831
|
-
if (chain2 === Chains.Polkadot) return bytes$1.bytesToHex(ss582__namespace.decode(dotAddress.parse(address)).data);
|
|
13880
|
+
if (chain2 === Chains.Polkadot || chain2 === Chains.Assethub) return bytes$1.bytesToHex(ss582__namespace.decode(dotAddress.parse(address)).data);
|
|
13832
13881
|
if (chain2 === Chains.Bitcoin) return `0x${Buffer.from(address).toString("hex")}`;
|
|
13833
13882
|
if (chain2 === Chains.Ethereum || chain2 === Chains.Arbitrum) return address;
|
|
13834
13883
|
if (chain2 === Chains.Solana) {
|
|
@@ -14051,7 +14100,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
14051
14100
|
}), "getChainData");
|
|
14052
14101
|
|
|
14053
14102
|
// package.json
|
|
14054
|
-
var version = "1.
|
|
14103
|
+
var version = "1.8.0-assethub.2";
|
|
14055
14104
|
|
|
14056
14105
|
// src/swap/consts.ts
|
|
14057
14106
|
var CF_SDK_VERSION_HEADERS = {
|
|
@@ -14267,6 +14316,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
14267
14316
|
} else {
|
|
14268
14317
|
assert2(!depositAddressRequest.brokerCommissionBps, "Broker commission is only supported only when initializing the SDK with a brokerUrl");
|
|
14269
14318
|
assert2(!depositAddressRequest.affiliateBrokers?.length, "Affiliate brokers are supported only when initializing the SDK with a brokerUrl");
|
|
14319
|
+
assert2(fillOrKillParams2, "Fill or kill parameters are required");
|
|
14270
14320
|
response = await this.trpc.openSwapDepositChannel.mutate({
|
|
14271
14321
|
...depositAddressRequest,
|
|
14272
14322
|
fillOrKillParams: fillOrKillParams2
|
|
@@ -14418,8 +14468,10 @@ var _SwapSDK = class _SwapSDK {
|
|
|
14418
14468
|
channelOpeningFee: result.channelOpeningFee
|
|
14419
14469
|
};
|
|
14420
14470
|
} else {
|
|
14471
|
+
assert2(depositAddressRequest.fillOrKillParams, "fill or kill params are required");
|
|
14421
14472
|
response = await this.trpc.openSwapDepositChannel.mutate({
|
|
14422
14473
|
...depositAddressRequest,
|
|
14474
|
+
fillOrKillParams: depositAddressRequest.fillOrKillParams,
|
|
14423
14475
|
quote
|
|
14424
14476
|
});
|
|
14425
14477
|
}
|
package/dist/swap.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __commonJS, __name, __export, __toESM, isString, InternalAssets, Chains, Assets, ChainflipNetworks, isValidAssetAndChain, getInternalAssets, __publicField, assert, getEnvironment, assetConstants, getSupportedAssets, getInternalAsset, isNotNullish, getAllBoostPoolsDepth, getAssetAndChain, readChainAssetValue, getVaultContractAddress, approve, chainConstants, getTokenContractAddress, isTestnet, getEvmChainId, checkAllowance, extractOverrides, Vault__factory } from './chunk-
|
|
2
|
-
export { Assets, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, getInternalAsset as getChainflipId } from './chunk-
|
|
1
|
+
import { __commonJS, __name, __export, __toESM, isString, InternalAssets, Chains, Assets, ChainflipNetworks, isValidAssetAndChain, getInternalAssets, __publicField, assert, getEnvironment, assetConstants, getSupportedAssets, getInternalAsset, isNotNullish, getAllBoostPoolsDepth, getAssetAndChain, readChainAssetValue, getVaultContractAddress, approve, chainConstants, getTokenContractAddress, isTestnet, getEvmChainId, checkAllowance, extractOverrides, Vault__factory } from './chunk-5BNVUJZY.mjs';
|
|
2
|
+
export { Assets, InternalAssets as ChainflipIds, ChainflipNetworks, Chains, getInternalAsset as getChainflipId } from './chunk-5BNVUJZY.mjs';
|
|
3
3
|
import { assert as assert$1 } from '@chainflip/utils/assertion';
|
|
4
4
|
import { hexToBytes, bytesToHex } from '@chainflip/utils/bytes';
|
|
5
5
|
import { HttpClient } from '@chainflip/rpc';
|
|
@@ -11558,35 +11558,40 @@ var validators = {
|
|
|
11558
11558
|
Ethereum: validateEvmAddress,
|
|
11559
11559
|
Polkadot: validatePolkadotAddress,
|
|
11560
11560
|
Arbitrum: validateEvmAddress,
|
|
11561
|
-
Solana: validateSolanaAddress
|
|
11561
|
+
Solana: validateSolanaAddress,
|
|
11562
|
+
Assethub: validatePolkadotAddress
|
|
11562
11563
|
},
|
|
11563
11564
|
perseverance: {
|
|
11564
11565
|
Bitcoin: validateBitcoinTestnetAddress,
|
|
11565
11566
|
Ethereum: validateEvmAddress,
|
|
11566
11567
|
Polkadot: validatePolkadotAddress,
|
|
11567
11568
|
Arbitrum: validateEvmAddress,
|
|
11568
|
-
Solana: validateSolanaAddress
|
|
11569
|
+
Solana: validateSolanaAddress,
|
|
11570
|
+
Assethub: validatePolkadotAddress
|
|
11569
11571
|
},
|
|
11570
11572
|
sisyphos: {
|
|
11571
11573
|
Bitcoin: validateBitcoinTestnetAddress,
|
|
11572
11574
|
Ethereum: validateEvmAddress,
|
|
11573
11575
|
Polkadot: validatePolkadotAddress,
|
|
11574
11576
|
Arbitrum: validateEvmAddress,
|
|
11575
|
-
Solana: validateSolanaAddress
|
|
11577
|
+
Solana: validateSolanaAddress,
|
|
11578
|
+
Assethub: validatePolkadotAddress
|
|
11576
11579
|
},
|
|
11577
11580
|
backspin: {
|
|
11578
11581
|
Bitcoin: validateBitcoinRegtestAddress,
|
|
11579
11582
|
Ethereum: validateEvmAddress,
|
|
11580
11583
|
Polkadot: validatePolkadotAddress,
|
|
11581
11584
|
Arbitrum: validateEvmAddress,
|
|
11582
|
-
Solana: validateSolanaAddress
|
|
11585
|
+
Solana: validateSolanaAddress,
|
|
11586
|
+
Assethub: validatePolkadotAddress
|
|
11583
11587
|
},
|
|
11584
11588
|
localnet: {
|
|
11585
11589
|
Bitcoin: validateBitcoinRegtestAddress,
|
|
11586
11590
|
Ethereum: validateEvmAddress,
|
|
11587
11591
|
Polkadot: validatePolkadotAddress,
|
|
11588
11592
|
Arbitrum: validateEvmAddress,
|
|
11589
|
-
Solana: validateSolanaAddress
|
|
11593
|
+
Solana: validateSolanaAddress,
|
|
11594
|
+
Assethub: validatePolkadotAddress
|
|
11590
11595
|
}
|
|
11591
11596
|
};
|
|
11592
11597
|
var assertValidAddress = /* @__PURE__ */ __name((chain2, address, network) => assert(validators[network][chain2](address), `Address "${address}" is not a valid "${chain2}" address for "${network}"`), "assertValidAddress");
|
|
@@ -11819,7 +11824,7 @@ z.object({
|
|
|
11819
11824
|
ccmParams: ccmParamsSchema.optional(),
|
|
11820
11825
|
maxBoostFeeBps: z.number().optional(),
|
|
11821
11826
|
srcAddress: z.string().optional(),
|
|
11822
|
-
fillOrKillParams
|
|
11827
|
+
fillOrKillParams,
|
|
11823
11828
|
dcaParams: dcaParams.optional(),
|
|
11824
11829
|
quote: z.object({
|
|
11825
11830
|
intermediateAmount: z.string().optional(),
|
|
@@ -11866,7 +11871,7 @@ var validateAddressLength = /* @__PURE__ */ __name((chain2, address, type) => {
|
|
|
11866
11871
|
if ((chain2 === "Arbitrum" || chain2 === "Ethereum") && address.length !== 42) {
|
|
11867
11872
|
throw new Error(`Invalid ${type} address length`);
|
|
11868
11873
|
}
|
|
11869
|
-
if (chain2 === "Polkadot" && address.length !== 66) {
|
|
11874
|
+
if ((chain2 === "Polkadot" || chain2 === "Assethub") && address.length !== 66) {
|
|
11870
11875
|
throw new Error(`Invalid ${type} address length`);
|
|
11871
11876
|
}
|
|
11872
11877
|
}, "validateAddressLength");
|
|
@@ -12074,7 +12079,7 @@ var assertSignerIsConnectedToChain = /* @__PURE__ */ __name(async (opts, chain2)
|
|
|
12074
12079
|
|
|
12075
12080
|
// ../shared/src/vault/executeSwap.ts
|
|
12076
12081
|
var encodeAddress2 = /* @__PURE__ */ __name((chain2, address) => {
|
|
12077
|
-
if (chain2 === Chains.Polkadot) return bytesToHex(ss582.decode(dotAddress.parse(address)).data);
|
|
12082
|
+
if (chain2 === Chains.Polkadot || chain2 === Chains.Assethub) return bytesToHex(ss582.decode(dotAddress.parse(address)).data);
|
|
12078
12083
|
if (chain2 === Chains.Bitcoin) return `0x${Buffer.from(address).toString("hex")}`;
|
|
12079
12084
|
if (chain2 === Chains.Ethereum || chain2 === Chains.Arbitrum) return address;
|
|
12080
12085
|
if (chain2 === Chains.Solana) {
|
|
@@ -12297,7 +12302,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
|
|
|
12297
12302
|
}), "getChainData");
|
|
12298
12303
|
|
|
12299
12304
|
// package.json
|
|
12300
|
-
var version = "1.
|
|
12305
|
+
var version = "1.8.0-assethub.2";
|
|
12301
12306
|
|
|
12302
12307
|
// src/swap/consts.ts
|
|
12303
12308
|
var CF_SDK_VERSION_HEADERS = {
|
|
@@ -12513,6 +12518,7 @@ var _SwapSDK = class _SwapSDK {
|
|
|
12513
12518
|
} else {
|
|
12514
12519
|
assert(!depositAddressRequest.brokerCommissionBps, "Broker commission is only supported only when initializing the SDK with a brokerUrl");
|
|
12515
12520
|
assert(!depositAddressRequest.affiliateBrokers?.length, "Affiliate brokers are supported only when initializing the SDK with a brokerUrl");
|
|
12521
|
+
assert(fillOrKillParams2, "Fill or kill parameters are required");
|
|
12516
12522
|
response = await this.trpc.openSwapDepositChannel.mutate({
|
|
12517
12523
|
...depositAddressRequest,
|
|
12518
12524
|
fillOrKillParams: fillOrKillParams2
|
|
@@ -12664,8 +12670,10 @@ var _SwapSDK = class _SwapSDK {
|
|
|
12664
12670
|
channelOpeningFee: result.channelOpeningFee
|
|
12665
12671
|
};
|
|
12666
12672
|
} else {
|
|
12673
|
+
assert(depositAddressRequest.fillOrKillParams, "fill or kill params are required");
|
|
12667
12674
|
response = await this.trpc.openSwapDepositChannel.mutate({
|
|
12668
12675
|
...depositAddressRequest,
|
|
12676
|
+
fillOrKillParams: depositAddressRequest.fillOrKillParams,
|
|
12669
12677
|
quote
|
|
12670
12678
|
});
|
|
12671
12679
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chainflip/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-assethub.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./swap": {
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@chainflip/extrinsics": "^1.6.1",
|
|
45
|
-
"@chainflip/rpc": "^1.
|
|
46
|
-
"@chainflip/utils": "^
|
|
45
|
+
"@chainflip/rpc": "^1.8.0-assethub.1",
|
|
46
|
+
"@chainflip/utils": "^1.8.0-assethub.1",
|
|
47
47
|
"axios": "^1.7.7",
|
|
48
48
|
"bignumber.js": "^9.1.2",
|
|
49
49
|
"ethers": "^6.13.3"
|