@chainflip/sdk 1.1.0 → 1.1.1-rc.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.
@@ -63,7 +63,9 @@ var swappingEnvironment = z.object({
63
63
  });
64
64
  createRequest("cf_swapping_environment", swappingEnvironment);
65
65
  var ingressEgressEnvironment = z.object({
66
- minimum_deposit_amounts: chainAssetNumberMap
66
+ minimum_deposit_amounts: chainAssetNumberMap,
67
+ ingress_fees: chainAssetNumberMap,
68
+ egress_fees: chainAssetNumberMap
67
69
  });
68
70
  createRequest("cf_ingress_egress_environment", ingressEgressEnvironment);
69
71
  var rpcAsset = z.union([
@@ -2106,7 +2108,10 @@ var Vault__factory = _Vault__factory;
2106
2108
 
2107
2109
  // ../shared/src/consts.ts
2108
2110
  ({
2109
- [ChainflipNetworks.perseverance]: 100
2111
+ [ChainflipNetworks.backspin]: 1e3,
2112
+ [ChainflipNetworks.sisyphos]: 1e3,
2113
+ [ChainflipNetworks.perseverance]: 1e3,
2114
+ [ChainflipNetworks.mainnet]: 1e3
2110
2115
  });
2111
2116
  var GOERLI_USDC_CONTRACT_ADDRESS = "0x07865c6E87B9F70255377e024ace6630C1Eaa37F";
2112
2117
  var ADDRESSES = {
package/dist/funding.js CHANGED
@@ -833,7 +833,10 @@ var ChainflipNetworks = arrayToMap([
833
833
 
834
834
  // ../shared/src/consts.ts
835
835
  ({
836
- [ChainflipNetworks.perseverance]: 100
836
+ [ChainflipNetworks.backspin]: 1e3,
837
+ [ChainflipNetworks.sisyphos]: 1e3,
838
+ [ChainflipNetworks.perseverance]: 1e3,
839
+ [ChainflipNetworks.mainnet]: 1e3
837
840
  });
838
841
  var GOERLI_USDC_CONTRACT_ADDRESS = "0x07865c6E87B9F70255377e024ace6630C1Eaa37F";
839
842
  var ADDRESSES = {
@@ -4789,7 +4792,9 @@ var swappingEnvironment = z.object({
4789
4792
  });
4790
4793
  createRequest("cf_swapping_environment", swappingEnvironment);
4791
4794
  var ingressEgressEnvironment = z.object({
4792
- minimum_deposit_amounts: chainAssetNumberMap
4795
+ minimum_deposit_amounts: chainAssetNumberMap,
4796
+ ingress_fees: chainAssetNumberMap,
4797
+ egress_fees: chainAssetNumberMap
4793
4798
  });
4794
4799
  createRequest("cf_ingress_egress_environment", ingressEgressEnvironment);
4795
4800
  var rpcAsset = z.union([
package/dist/funding.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-LBKEYET5.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-UEUNQEDO.mjs';
2
2
  import { __name, __publicField, ChainflipNetworks, Assets, assert } from './chunk-O4RYZWBW.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
package/dist/swap.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as ChainflipNetwork, A as Asset, a as Chain, c as chainAssets, T as TransactionOptions } from './contracts-ss509umD.mjs';
2
+ import { C as ChainflipNetwork, a as Chain, A as Asset, c as chainAssets, T as TransactionOptions } from './contracts-ss509umD.mjs';
3
3
  export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-ss509umD.mjs';
4
4
  import { z } from 'zod';
5
5
 
@@ -23,6 +23,32 @@ declare const getEnvironment: (urlOrNetwork: RpcConfig, params: void) => Promise
23
23
  DOT: bigint;
24
24
  };
25
25
  };
26
+ ingressFees: {
27
+ Bitcoin: {
28
+ BTC: bigint;
29
+ };
30
+ Ethereum: {
31
+ FLIP: bigint;
32
+ USDC: bigint;
33
+ ETH: bigint;
34
+ };
35
+ Polkadot: {
36
+ DOT: bigint;
37
+ };
38
+ };
39
+ egressFees: {
40
+ Bitcoin: {
41
+ BTC: bigint;
42
+ };
43
+ Ethereum: {
44
+ FLIP: bigint;
45
+ USDC: bigint;
46
+ ETH: bigint;
47
+ };
48
+ Polkadot: {
49
+ DOT: bigint;
50
+ };
51
+ };
26
52
  };
27
53
  swapping: {
28
54
  minimumSwapAmounts: {
@@ -3141,15 +3167,16 @@ declare const ccmMetadataSchema: z.ZodObject<{
3141
3167
  gasBudget: string;
3142
3168
  }>;
3143
3169
  type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
3144
- type QuoteFee = {
3145
- type: 'liquidity' | 'network';
3170
+ type SwapFee = {
3171
+ type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS';
3172
+ chain: Chain;
3146
3173
  asset: Asset;
3147
3174
  amount: string;
3148
3175
  };
3149
3176
  type QuoteQueryResponse = {
3150
3177
  intermediateAmount?: string;
3151
3178
  egressAmount: string;
3152
- includedFees: QuoteFee[];
3179
+ includedFees: SwapFee[];
3153
3180
  };
3154
3181
 
3155
3182
  interface ChainData {
@@ -3243,6 +3270,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3243
3270
  egressAmount: string;
3244
3271
  egressScheduledAt: number;
3245
3272
  egressScheduledBlockIndex: string;
3273
+ feesPaid: SwapFee[];
3246
3274
  } | {
3247
3275
  state: 'BROADCAST_REQUESTED';
3248
3276
  swapId: string;
@@ -3255,6 +3283,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3255
3283
  egressAmount: string;
3256
3284
  egressScheduledAt: number;
3257
3285
  egressScheduledBlockIndex: string;
3286
+ feesPaid: SwapFee[];
3258
3287
  broadcastRequestedAt: number;
3259
3288
  broadcastRequestedBlockIndex: string;
3260
3289
  } | {
@@ -3269,6 +3298,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3269
3298
  egressAmount: string;
3270
3299
  egressScheduledAt: number;
3271
3300
  egressScheduledBlockIndex: string;
3301
+ feesPaid: SwapFee[];
3272
3302
  broadcastRequestedAt: number;
3273
3303
  broadcastRequestedBlockIndex: string;
3274
3304
  broadcastAbortedAt: number;
@@ -3285,6 +3315,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3285
3315
  egressAmount: string;
3286
3316
  egressScheduledAt: number;
3287
3317
  egressScheduledBlockIndex: string;
3318
+ feesPaid: SwapFee[];
3288
3319
  broadcastRequestedAt: number;
3289
3320
  broadcastRequestedBlockIndex: string;
3290
3321
  broadcastSucceededAt: number;
@@ -3297,7 +3328,7 @@ type RequestOptions = {
3297
3328
 
3298
3329
  type TransactionHash = `0x${string}`;
3299
3330
  type SwapSDKOptions = {
3300
- network?: Exclude<ChainflipNetwork, 'mainnet'>;
3331
+ network?: ChainflipNetwork;
3301
3332
  signer?: Signer;
3302
3333
  backendUrl?: string;
3303
3334
  broker?: {
package/dist/swap.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Signer } from 'ethers';
2
- import { C as ChainflipNetwork, A as Asset, a as Chain, c as chainAssets, T as TransactionOptions } from './contracts-ss509umD.js';
2
+ import { C as ChainflipNetwork, a as Chain, A as Asset, c as chainAssets, T as TransactionOptions } from './contracts-ss509umD.js';
3
3
  export { d as Assets, e as ChainflipNetworks, b as Chains, f as assetChains, h as assetContractIds, g as assetDecimals, i as chainContractIds } from './contracts-ss509umD.js';
4
4
  import { z } from 'zod';
5
5
 
@@ -23,6 +23,32 @@ declare const getEnvironment: (urlOrNetwork: RpcConfig, params: void) => Promise
23
23
  DOT: bigint;
24
24
  };
25
25
  };
26
+ ingressFees: {
27
+ Bitcoin: {
28
+ BTC: bigint;
29
+ };
30
+ Ethereum: {
31
+ FLIP: bigint;
32
+ USDC: bigint;
33
+ ETH: bigint;
34
+ };
35
+ Polkadot: {
36
+ DOT: bigint;
37
+ };
38
+ };
39
+ egressFees: {
40
+ Bitcoin: {
41
+ BTC: bigint;
42
+ };
43
+ Ethereum: {
44
+ FLIP: bigint;
45
+ USDC: bigint;
46
+ ETH: bigint;
47
+ };
48
+ Polkadot: {
49
+ DOT: bigint;
50
+ };
51
+ };
26
52
  };
27
53
  swapping: {
28
54
  minimumSwapAmounts: {
@@ -3141,15 +3167,16 @@ declare const ccmMetadataSchema: z.ZodObject<{
3141
3167
  gasBudget: string;
3142
3168
  }>;
3143
3169
  type CcmMetadata = z.infer<typeof ccmMetadataSchema>;
3144
- type QuoteFee = {
3145
- type: 'liquidity' | 'network';
3170
+ type SwapFee = {
3171
+ type: 'LIQUIDITY' | 'NETWORK' | 'INGRESS' | 'EGRESS';
3172
+ chain: Chain;
3146
3173
  asset: Asset;
3147
3174
  amount: string;
3148
3175
  };
3149
3176
  type QuoteQueryResponse = {
3150
3177
  intermediateAmount?: string;
3151
3178
  egressAmount: string;
3152
- includedFees: QuoteFee[];
3179
+ includedFees: SwapFee[];
3153
3180
  };
3154
3181
 
3155
3182
  interface ChainData {
@@ -3243,6 +3270,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3243
3270
  egressAmount: string;
3244
3271
  egressScheduledAt: number;
3245
3272
  egressScheduledBlockIndex: string;
3273
+ feesPaid: SwapFee[];
3246
3274
  } | {
3247
3275
  state: 'BROADCAST_REQUESTED';
3248
3276
  swapId: string;
@@ -3255,6 +3283,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3255
3283
  egressAmount: string;
3256
3284
  egressScheduledAt: number;
3257
3285
  egressScheduledBlockIndex: string;
3286
+ feesPaid: SwapFee[];
3258
3287
  broadcastRequestedAt: number;
3259
3288
  broadcastRequestedBlockIndex: string;
3260
3289
  } | {
@@ -3269,6 +3298,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3269
3298
  egressAmount: string;
3270
3299
  egressScheduledAt: number;
3271
3300
  egressScheduledBlockIndex: string;
3301
+ feesPaid: SwapFee[];
3272
3302
  broadcastRequestedAt: number;
3273
3303
  broadcastRequestedBlockIndex: string;
3274
3304
  broadcastAbortedAt: number;
@@ -3285,6 +3315,7 @@ type SwapStatusResponse = CommonStatusFields & ({
3285
3315
  egressAmount: string;
3286
3316
  egressScheduledAt: number;
3287
3317
  egressScheduledBlockIndex: string;
3318
+ feesPaid: SwapFee[];
3288
3319
  broadcastRequestedAt: number;
3289
3320
  broadcastRequestedBlockIndex: string;
3290
3321
  broadcastSucceededAt: number;
@@ -3297,7 +3328,7 @@ type RequestOptions = {
3297
3328
 
3298
3329
  type TransactionHash = `0x${string}`;
3299
3330
  type SwapSDKOptions = {
3300
- network?: Exclude<ChainflipNetwork, 'mainnet'>;
3331
+ network?: ChainflipNetwork;
3301
3332
  signer?: Signer;
3302
3333
  backendUrl?: string;
3303
3334
  broker?: {
package/dist/swap.js CHANGED
@@ -6728,7 +6728,9 @@ var swappingEnvironment = z.object({
6728
6728
  });
6729
6729
  createRequest("cf_swapping_environment", swappingEnvironment);
6730
6730
  var ingressEgressEnvironment = z.object({
6731
- minimum_deposit_amounts: chainAssetNumberMap
6731
+ minimum_deposit_amounts: chainAssetNumberMap,
6732
+ ingress_fees: chainAssetNumberMap,
6733
+ egress_fees: chainAssetNumberMap
6732
6734
  });
6733
6735
  createRequest("cf_ingress_egress_environment", ingressEgressEnvironment);
6734
6736
  var rpcAsset = z.union([
@@ -6796,12 +6798,12 @@ var getEnvironment = createRequest("cf_environment", z.object({
6796
6798
 
6797
6799
  // ../shared/src/rpc/utils.ts
6798
6800
  init_enums();
6799
- var readAssetValue = /* @__PURE__ */ __name((minimums, asset) => {
6800
- const chainMinimums = minimums[asset.chain];
6801
+ var readAssetValue = /* @__PURE__ */ __name((value, asset) => {
6802
+ assertIsValidAssetAndChain(asset);
6803
+ const chainMinimums = value[asset.chain];
6801
6804
  return chainMinimums[asset.asset];
6802
6805
  }, "readAssetValue");
6803
6806
  var validateSwapAmount = /* @__PURE__ */ __name((swapEnv, asset, amount) => {
6804
- assertIsValidAssetAndChain(asset);
6805
6807
  const minAmount = readAssetValue(swapEnv.minimumSwapAmounts, asset);
6806
6808
  if (amount < minAmount) {
6807
6809
  return {
@@ -8215,7 +8217,10 @@ var Vault__factory = _Vault__factory;
8215
8217
  // ../shared/src/consts.ts
8216
8218
  init_enums();
8217
8219
  ({
8218
- [exports.ChainflipNetworks.perseverance]: 100
8220
+ [exports.ChainflipNetworks.backspin]: 1e3,
8221
+ [exports.ChainflipNetworks.sisyphos]: 1e3,
8222
+ [exports.ChainflipNetworks.perseverance]: 1e3,
8223
+ [exports.ChainflipNetworks.mainnet]: 1e3
8219
8224
  });
8220
8225
  var GOERLI_USDC_CONTRACT_ADDRESS = "0x07865c6E87B9F70255377e024ace6630C1Eaa37F";
8221
8226
  var ADDRESSES = {
@@ -8347,7 +8352,8 @@ init_enums();
8347
8352
  var BACKEND_SERVICE_URLS = {
8348
8353
  [exports.ChainflipNetworks.backspin]: "https://chainflip-swap-backspin.staging/",
8349
8354
  [exports.ChainflipNetworks.sisyphos]: "https://chainflip-swap.staging/",
8350
- [exports.ChainflipNetworks.perseverance]: "https://chainflip-swap-perseverance.chainflip.io/"
8355
+ [exports.ChainflipNetworks.perseverance]: "https://chainflip-swap-perseverance.chainflip.io/",
8356
+ [exports.ChainflipNetworks.mainnet]: "https://chainflip-swap.chainflip.io/"
8351
8357
  };
8352
8358
 
8353
8359
  // src/swap/services/ApiService.ts
package/dist/swap.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-LBKEYET5.mjs';
1
+ import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-UEUNQEDO.mjs';
2
2
  import { numericString, ethereumAddress, dotAddress, btcAddress, ccmMetadataSchema } from './chunk-LEMOY2A2.mjs';
3
3
  import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-O4RYZWBW.mjs';
4
4
  export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-O4RYZWBW.mjs';
@@ -2175,12 +2175,12 @@ SuperJSON.registerSymbol;
2175
2175
  SuperJSON.allowErrorProps;
2176
2176
 
2177
2177
  // ../shared/src/rpc/utils.ts
2178
- var readAssetValue = /* @__PURE__ */ __name((minimums, asset) => {
2179
- const chainMinimums = minimums[asset.chain];
2178
+ var readAssetValue = /* @__PURE__ */ __name((value, asset) => {
2179
+ assertIsValidAssetAndChain(asset);
2180
+ const chainMinimums = value[asset.chain];
2180
2181
  return chainMinimums[asset.asset];
2181
2182
  }, "readAssetValue");
2182
2183
  var validateSwapAmount = /* @__PURE__ */ __name((swapEnv, asset, amount) => {
2183
- assertIsValidAssetAndChain(asset);
2184
2184
  const minAmount = readAssetValue(swapEnv.minimumSwapAmounts, asset);
2185
2185
  if (amount < minAmount) {
2186
2186
  return {
@@ -2348,7 +2348,8 @@ var approveVault = /* @__PURE__ */ __name(async (params, networkOpts, txOpts) =>
2348
2348
  var BACKEND_SERVICE_URLS = {
2349
2349
  [ChainflipNetworks.backspin]: "https://chainflip-swap-backspin.staging/",
2350
2350
  [ChainflipNetworks.sisyphos]: "https://chainflip-swap.staging/",
2351
- [ChainflipNetworks.perseverance]: "https://chainflip-swap-perseverance.chainflip.io/"
2351
+ [ChainflipNetworks.perseverance]: "https://chainflip-swap-perseverance.chainflip.io/",
2352
+ [ChainflipNetworks.mainnet]: "https://chainflip-swap.chainflip.io/"
2352
2353
  };
2353
2354
 
2354
2355
  // src/swap/assets.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-rc.1",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {