@chainflip/sdk 1.1.5 → 1.2.0-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.
package/dist/funding.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-MRYGGECA.mjs';
2
- import { __name, __publicField, ChainflipNetworks, Assets, assert } from './chunk-Q7HQVR3T.mjs';
1
+ import { getFlipBalance, getFundingEnvironment, getStateChainGatewayContractAddress, approve, getTokenContractAddress, checkAllowance, extractOverrides, StateChainGateway__factory } from './chunk-OV3KFLWM.mjs';
2
+ import { __name, __publicField, ChainflipNetworks, Assets, assert } from './chunk-DV4HDL4K.mjs';
3
3
 
4
4
  // ../shared/src/stateChainGateway/utils.ts
5
5
  var getStateChainGateway = /* @__PURE__ */ __name((networkOpts) => {
package/dist/swap.d.mts CHANGED
@@ -409,6 +409,7 @@ type AssetData = {
409
409
  isMainnet: boolean;
410
410
  minimumSwapAmount: string;
411
411
  maximumSwapAmount: string | null;
412
+ minimumEgressAmount: string;
412
413
  };
413
414
  }[keyof typeof chainAssets];
414
415
  interface ChainsAndAssets {
@@ -437,16 +438,8 @@ interface DepositAddressResponse extends DepositAddressRequest {
437
438
  interface SwapStatusRequest {
438
439
  id: string;
439
440
  }
440
- interface CommonStatusFields extends ChainsAndAssets {
441
+ interface SwapStatusResponseCommonFields {
441
442
  destAddress: string;
442
- depositAddress: string | undefined;
443
- depositChannelCreatedAt: number | undefined;
444
- depositChannelBrokerCommissionBps: number | undefined;
445
- expectedDepositAmount: string | undefined;
446
- depositChannelExpiryBlock: bigint;
447
- estimatedDepositChannelExpiryTime: number | undefined;
448
- isDepositChannelExpired: boolean;
449
- depositChannelOpenedThroughBackend: boolean;
450
443
  ccmDepositReceivedBlockIndex: string | undefined;
451
444
  ccmMetadata: {
452
445
  gasBudget: string;
@@ -454,7 +447,38 @@ interface CommonStatusFields extends ChainsAndAssets {
454
447
  } | undefined;
455
448
  feesPaid: SwapFee[];
456
449
  }
457
- type SwapStatusResponse = CommonStatusFields & ({
450
+ interface DepositAddressFields extends SwapStatusResponseCommonFields {
451
+ depositAddress: string;
452
+ depositChannelCreatedAt: number;
453
+ depositChannelBrokerCommissionBps: number;
454
+ expectedDepositAmount: string | undefined;
455
+ depositChannelExpiryBlock: string;
456
+ estimatedDepositChannelExpiryTime: number;
457
+ isDepositChannelExpired: boolean;
458
+ depositChannelOpenedThroughBackend: boolean;
459
+ }
460
+ type CopyFields<T, U> = {
461
+ [K in Exclude<keyof T, keyof U>]: undefined;
462
+ } & U;
463
+ type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
464
+ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
465
+ depositAmount: string;
466
+ depositTransactionHash: string;
467
+ destAddress: string;
468
+ error: {
469
+ message: string;
470
+ name: string;
471
+ };
472
+ failedAt: number;
473
+ failedBlockIndex: string;
474
+ failure: string;
475
+ feesPaid: [];
476
+ srcAsset: Asset;
477
+ srcChain: Chain;
478
+ state: 'FAILED';
479
+ depositAddress: undefined;
480
+ }>;
481
+ type SwapState = {
458
482
  state: 'AWAITING_DEPOSIT';
459
483
  depositAmount: string | undefined;
460
484
  depositTransactionHash: string | undefined;
@@ -532,7 +556,38 @@ type SwapStatusResponse = CommonStatusFields & ({
532
556
  broadcastRequestedBlockIndex: string;
533
557
  broadcastSucceededAt: number;
534
558
  broadcastSucceededBlockIndex: string;
535
- });
559
+ } | {
560
+ state: 'FAILED';
561
+ failure: 'INGRESS_IGNORED';
562
+ error: {
563
+ name: string;
564
+ message: string;
565
+ };
566
+ depositAmount: string;
567
+ depositTransactionHash: string | undefined;
568
+ failedAt: number;
569
+ failedBlockIndex: string;
570
+ } | {
571
+ state: 'FAILED';
572
+ failure: 'EGRESS_IGNORED';
573
+ error: {
574
+ name: string;
575
+ message: string;
576
+ };
577
+ swapId: string;
578
+ depositAmount: string;
579
+ depositReceivedAt: number;
580
+ depositReceivedBlockIndex: string;
581
+ intermediateAmount: string | undefined;
582
+ swapExecutedAt: number;
583
+ swapExecutedBlockIndex: string;
584
+ ignoredEgressAmount: string;
585
+ egressIgnoredAt: number;
586
+ egressIgnoredBlockIndex: string;
587
+ };
588
+ type DepositAddressStatusResponse = DepositAddressFields & SwapState;
589
+ type VaultSwapStatusResponse = VaultSwapFields & SwapState;
590
+ type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
536
591
 
537
592
  type RequestOptions = {
538
593
  signal?: AbortSignal;
package/dist/swap.d.ts CHANGED
@@ -409,6 +409,7 @@ type AssetData = {
409
409
  isMainnet: boolean;
410
410
  minimumSwapAmount: string;
411
411
  maximumSwapAmount: string | null;
412
+ minimumEgressAmount: string;
412
413
  };
413
414
  }[keyof typeof chainAssets];
414
415
  interface ChainsAndAssets {
@@ -437,16 +438,8 @@ interface DepositAddressResponse extends DepositAddressRequest {
437
438
  interface SwapStatusRequest {
438
439
  id: string;
439
440
  }
440
- interface CommonStatusFields extends ChainsAndAssets {
441
+ interface SwapStatusResponseCommonFields {
441
442
  destAddress: string;
442
- depositAddress: string | undefined;
443
- depositChannelCreatedAt: number | undefined;
444
- depositChannelBrokerCommissionBps: number | undefined;
445
- expectedDepositAmount: string | undefined;
446
- depositChannelExpiryBlock: bigint;
447
- estimatedDepositChannelExpiryTime: number | undefined;
448
- isDepositChannelExpired: boolean;
449
- depositChannelOpenedThroughBackend: boolean;
450
443
  ccmDepositReceivedBlockIndex: string | undefined;
451
444
  ccmMetadata: {
452
445
  gasBudget: string;
@@ -454,7 +447,38 @@ interface CommonStatusFields extends ChainsAndAssets {
454
447
  } | undefined;
455
448
  feesPaid: SwapFee[];
456
449
  }
457
- type SwapStatusResponse = CommonStatusFields & ({
450
+ interface DepositAddressFields extends SwapStatusResponseCommonFields {
451
+ depositAddress: string;
452
+ depositChannelCreatedAt: number;
453
+ depositChannelBrokerCommissionBps: number;
454
+ expectedDepositAmount: string | undefined;
455
+ depositChannelExpiryBlock: string;
456
+ estimatedDepositChannelExpiryTime: number;
457
+ isDepositChannelExpired: boolean;
458
+ depositChannelOpenedThroughBackend: boolean;
459
+ }
460
+ type CopyFields<T, U> = {
461
+ [K in Exclude<keyof T, keyof U>]: undefined;
462
+ } & U;
463
+ type VaultSwapFields = CopyFields<DepositAddressFields, SwapStatusResponseCommonFields>;
464
+ type FailedVaultSwapStatusResponse = CopyFields<DepositAddressFields, {
465
+ depositAmount: string;
466
+ depositTransactionHash: string;
467
+ destAddress: string;
468
+ error: {
469
+ message: string;
470
+ name: string;
471
+ };
472
+ failedAt: number;
473
+ failedBlockIndex: string;
474
+ failure: string;
475
+ feesPaid: [];
476
+ srcAsset: Asset;
477
+ srcChain: Chain;
478
+ state: 'FAILED';
479
+ depositAddress: undefined;
480
+ }>;
481
+ type SwapState = {
458
482
  state: 'AWAITING_DEPOSIT';
459
483
  depositAmount: string | undefined;
460
484
  depositTransactionHash: string | undefined;
@@ -532,7 +556,38 @@ type SwapStatusResponse = CommonStatusFields & ({
532
556
  broadcastRequestedBlockIndex: string;
533
557
  broadcastSucceededAt: number;
534
558
  broadcastSucceededBlockIndex: string;
535
- });
559
+ } | {
560
+ state: 'FAILED';
561
+ failure: 'INGRESS_IGNORED';
562
+ error: {
563
+ name: string;
564
+ message: string;
565
+ };
566
+ depositAmount: string;
567
+ depositTransactionHash: string | undefined;
568
+ failedAt: number;
569
+ failedBlockIndex: string;
570
+ } | {
571
+ state: 'FAILED';
572
+ failure: 'EGRESS_IGNORED';
573
+ error: {
574
+ name: string;
575
+ message: string;
576
+ };
577
+ swapId: string;
578
+ depositAmount: string;
579
+ depositReceivedAt: number;
580
+ depositReceivedBlockIndex: string;
581
+ intermediateAmount: string | undefined;
582
+ swapExecutedAt: number;
583
+ swapExecutedBlockIndex: string;
584
+ ignoredEgressAmount: string;
585
+ egressIgnoredAt: number;
586
+ egressIgnoredBlockIndex: string;
587
+ };
588
+ type DepositAddressStatusResponse = DepositAddressFields & SwapState;
589
+ type VaultSwapStatusResponse = VaultSwapFields & SwapState;
590
+ type SwapStatusResponse = DepositAddressStatusResponse | VaultSwapStatusResponse | FailedVaultSwapStatusResponse;
536
591
 
537
592
  type RequestOptions = {
538
593
  signal?: AbortSignal;
package/dist/swap.js CHANGED
@@ -4755,7 +4755,7 @@ var init_broker = __esm({
4755
4755
  }
4756
4756
  });
4757
4757
 
4758
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
4758
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
4759
4759
  function identity(x) {
4760
4760
  return x;
4761
4761
  }
@@ -4834,7 +4834,7 @@ function observable(subscribe) {
4834
4834
  }
4835
4835
  __name(observable, "observable");
4836
4836
 
4837
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/observable/index.mjs
4837
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable/index.mjs
4838
4838
  function share(_opts) {
4839
4839
  return (originalObserver) => {
4840
4840
  let refCount = 0;
@@ -4939,7 +4939,7 @@ function observableToPromise(observable2) {
4939
4939
  }
4940
4940
  __name(observableToPromise, "observableToPromise");
4941
4941
 
4942
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
4942
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
4943
4943
  function createChain(opts) {
4944
4944
  return observable((observer) => {
4945
4945
  function execute(index = 0, op = opts.op) {
@@ -4963,7 +4963,7 @@ function createChain(opts) {
4963
4963
  }
4964
4964
  __name(createChain, "createChain");
4965
4965
 
4966
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/codes-c924c3db.mjs
4966
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
4967
4967
  function invert(obj) {
4968
4968
  const newObj = /* @__PURE__ */ Object.create(null);
4969
4969
  for (const key in obj) {
@@ -5001,7 +5001,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
5001
5001
  };
5002
5002
  invert(TRPC_ERROR_CODES_BY_KEY);
5003
5003
 
5004
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/index-f91d720c.mjs
5004
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
5005
5005
  invert(TRPC_ERROR_CODES_BY_KEY);
5006
5006
  var noop = /* @__PURE__ */ __name(() => {
5007
5007
  }, "noop");
@@ -5039,7 +5039,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
5039
5039
  });
5040
5040
  }, "createFlatProxy");
5041
5041
 
5042
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
5042
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
5043
5043
  function isObject(value) {
5044
5044
  return !!value && !Array.isArray(value) && typeof value === "object";
5045
5045
  }
@@ -5070,7 +5070,7 @@ function getCauseFromUnknown(cause) {
5070
5070
  }
5071
5071
  __name(getCauseFromUnknown, "getCauseFromUnknown");
5072
5072
 
5073
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
5073
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
5074
5074
  function isObject2(value) {
5075
5075
  return !!value && !Array.isArray(value) && typeof value === "object";
5076
5076
  }
@@ -5123,7 +5123,7 @@ function transformResult(response, runtime) {
5123
5123
  }
5124
5124
  __name(transformResult, "transformResult");
5125
5125
 
5126
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
5126
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
5127
5127
  function isTRPCClientError(cause) {
5128
5128
  return cause instanceof TRPCClientError || /**
5129
5129
  * @deprecated
@@ -5181,7 +5181,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
5181
5181
  __name(_TRPCClientError, "TRPCClientError");
5182
5182
  var TRPCClientError = _TRPCClientError;
5183
5183
 
5184
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
5184
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
5185
5185
  var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
5186
5186
  function getFetch(customFetchImpl) {
5187
5187
  if (customFetchImpl) {
@@ -5325,7 +5325,7 @@ function httpRequest(opts) {
5325
5325
  }
5326
5326
  __name(httpRequest, "httpRequest");
5327
5327
 
5328
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
5328
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
5329
5329
  var throwFatalError = /* @__PURE__ */ __name(() => {
5330
5330
  throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
5331
5331
  }, "throwFatalError");
@@ -5555,7 +5555,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
5555
5555
  }, "batchRequester");
5556
5556
  var httpBatchLink = createHTTPBatchLink(batchRequester);
5557
5557
 
5558
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/links/httpLink.mjs
5558
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/links/httpLink.mjs
5559
5559
  function httpLinkFactory(factoryOpts) {
5560
5560
  return (opts) => {
5561
5561
  const resolvedOpts = resolveHTTPLinkOptions(opts);
@@ -5607,7 +5607,7 @@ function httpLinkFactory(factoryOpts) {
5607
5607
  }
5608
5608
  __name(httpLinkFactory, "httpLinkFactory");
5609
5609
 
5610
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/index.mjs
5610
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/index.mjs
5611
5611
  var _TRPCUntypedClient = class _TRPCUntypedClient {
5612
5612
  $request({ type, input, path, context = {} }) {
5613
5613
  const chain$ = createChain({
@@ -6962,6 +6962,7 @@ init_guards();
6962
6962
  // ../shared/src/rpc/index.ts
6963
6963
  init_lib();
6964
6964
  init_enums();
6965
+ init_parsers();
6965
6966
  var numberOrHex = z.union([
6966
6967
  z.string(),
6967
6968
  z.number()
@@ -7021,11 +7022,31 @@ var swappingEnvironment = z.object({
7021
7022
  maximum_swap_amounts: chainAssetNumberNullableMap
7022
7023
  });
7023
7024
  createRequest("cf_swapping_environment", swappingEnvironment);
7025
+ var rename = /* @__PURE__ */ __name((mapping) => (obj) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [
7026
+ key in mapping ? mapping[key] : key,
7027
+ value
7028
+ ])), "rename");
7024
7029
  var ingressEgressEnvironment = z.object({
7025
7030
  minimum_deposit_amounts: chainAssetNumberMap,
7026
7031
  ingress_fees: chainAssetNumberMap,
7027
- egress_fees: chainAssetNumberMap
7028
- });
7032
+ egress_fees: chainAssetNumberMap,
7033
+ // TODO(1.2): remove optional and default value
7034
+ egress_dust_limits: chainAssetNumberMap.optional().default({
7035
+ Bitcoin: {
7036
+ BTC: 600
7037
+ },
7038
+ Ethereum: {
7039
+ ETH: 1,
7040
+ USDC: 1,
7041
+ FLIP: 1
7042
+ },
7043
+ Polkadot: {
7044
+ DOT: 1
7045
+ }
7046
+ })
7047
+ }).transform(rename({
7048
+ egress_dust_limits: "minimum_egress_amounts"
7049
+ }));
7029
7050
  createRequest("cf_ingress_egress_environment", ingressEgressEnvironment);
7030
7051
  var rpcAsset = z.union([
7031
7052
  z.literal("BTC"),
@@ -7093,6 +7114,7 @@ var swapRate = z.object({
7093
7114
  output: numberOrHex
7094
7115
  });
7095
7116
  createRequest("cf_swap_rate", swapRate);
7117
+ createRequest("state_getMetadata", hexString);
7096
7118
 
7097
7119
  // ../shared/src/rpc/utils.ts
7098
7120
  init_enums();
@@ -8554,13 +8576,17 @@ var extractOverrides = /* @__PURE__ */ __name((transactionOverrides) => {
8554
8576
  const { wait, ...ethersOverrides } = transactionOverrides;
8555
8577
  return ethersOverrides;
8556
8578
  }, "extractOverrides");
8557
- var getTokenContractAddress = /* @__PURE__ */ __name((asset, network) => {
8579
+ function getTokenContractAddress(asset, network, assert2 = true) {
8558
8580
  if (asset === exports.Assets.FLIP)
8559
8581
  return ADDRESSES[network].FLIP_CONTRACT_ADDRESS;
8560
8582
  if (asset === exports.Assets.USDC)
8561
8583
  return ADDRESSES[network].USDC_CONTRACT_ADDRESS;
8562
- throw new Error("Only FLIP and USDC are supported for now");
8563
- }, "getTokenContractAddress");
8584
+ if (assert2) {
8585
+ throw new Error("Only FLIP and USDC are supported for now");
8586
+ }
8587
+ return void 0;
8588
+ }
8589
+ __name(getTokenContractAddress, "getTokenContractAddress");
8564
8590
  var checkAllowance = /* @__PURE__ */ __name(async (amount, spenderAddress, erc20Address, signer) => {
8565
8591
  const erc20 = ERC20__factory.connect(erc20Address, signer);
8566
8592
  const signerAddress = await signer.getAddress();
@@ -8660,66 +8686,37 @@ init_enums();
8660
8686
 
8661
8687
  // src/swap/assets.ts
8662
8688
  init_enums();
8663
- var eth$ = /* @__PURE__ */ __name((network, env) => ({
8664
- id: exports.Assets.ETH,
8665
- chain: exports.Chains.Ethereum,
8666
- contractAddress: void 0,
8667
- decimals: exports.assetDecimals[exports.Assets.ETH],
8668
- name: "Ether",
8669
- symbol: "ETH",
8670
- chainflipId: "ETH",
8671
- isMainnet: !isTestnet(network),
8672
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.ETH.toString(),
8673
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.ETH?.toString() ?? null
8674
- }), "eth$");
8675
- var usdc$ = /* @__PURE__ */ __name((network, env) => ({
8676
- id: exports.Assets.USDC,
8677
- chain: exports.Chains.Ethereum,
8678
- contractAddress: getTokenContractAddress(exports.Assets.USDC, network),
8679
- decimals: exports.assetDecimals[exports.Assets.USDC],
8680
- name: "USDC",
8681
- symbol: "USDC",
8682
- chainflipId: "USDC",
8683
- isMainnet: !isTestnet(network),
8684
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.USDC.toString(),
8685
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.USDC?.toString() ?? null
8686
- }), "usdc$");
8687
- var flip$ = /* @__PURE__ */ __name((network, env) => ({
8688
- id: exports.Assets.FLIP,
8689
- chain: exports.Chains.Ethereum,
8690
- contractAddress: getTokenContractAddress(exports.Assets.FLIP, network),
8691
- decimals: exports.assetDecimals[exports.Assets.FLIP],
8692
- name: "FLIP",
8693
- symbol: "FLIP",
8694
- chainflipId: "FLIP",
8695
- isMainnet: !isTestnet(network),
8696
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.FLIP.toString(),
8697
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.FLIP?.toString() ?? null
8698
- }), "flip$");
8699
- var dot$ = /* @__PURE__ */ __name((network, env) => ({
8700
- id: exports.Assets.DOT,
8701
- chain: exports.Chains.Polkadot,
8702
- contractAddress: void 0,
8703
- decimals: exports.assetDecimals[exports.Assets.DOT],
8704
- name: "Polkadot",
8705
- symbol: "DOT",
8706
- chainflipId: "DOT",
8707
- isMainnet: !isTestnet(network),
8708
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Polkadot.DOT.toString(),
8709
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Polkadot.DOT?.toString() ?? null
8710
- }), "dot$");
8711
- var btc$ = /* @__PURE__ */ __name((network, env) => ({
8712
- id: exports.Assets.BTC,
8713
- chain: exports.Chains.Bitcoin,
8714
- contractAddress: void 0,
8715
- decimals: exports.assetDecimals[exports.Assets.BTC],
8716
- name: "Bitcoin",
8717
- symbol: "BTC",
8718
- chainflipId: "BTC",
8719
- isMainnet: !isTestnet(network),
8720
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Bitcoin.BTC.toString(),
8721
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Bitcoin.BTC?.toString() ?? null
8722
- }), "btc$");
8689
+ var assetName = {
8690
+ [exports.Assets.ETH]: "Ether",
8691
+ [exports.Assets.USDC]: "USDC",
8692
+ [exports.Assets.FLIP]: "FLIP",
8693
+ [exports.Assets.DOT]: "Polkadot",
8694
+ [exports.Assets.BTC]: "Bitcoin"
8695
+ };
8696
+ var assetFactory = /* @__PURE__ */ __name((asset) => (network, env) => {
8697
+ const assetAndChain = {
8698
+ asset,
8699
+ chain: exports.assetChains[asset]
8700
+ };
8701
+ return {
8702
+ id: asset,
8703
+ chain: exports.assetChains[asset],
8704
+ contractAddress: getTokenContractAddress(asset, network, false),
8705
+ decimals: exports.assetDecimals[asset],
8706
+ name: assetName[asset],
8707
+ symbol: asset,
8708
+ chainflipId: asset,
8709
+ isMainnet: !isTestnet(network),
8710
+ minimumSwapAmount: readAssetValue(env.ingressEgress.minimumDepositAmounts, assetAndChain).toString(),
8711
+ maximumSwapAmount: readAssetValue(env.swapping.maximumSwapAmounts, assetAndChain)?.toString() ?? null,
8712
+ minimumEgressAmount: readAssetValue(env.ingressEgress.minimumEgressAmounts, assetAndChain).toString()
8713
+ };
8714
+ }, "assetFactory");
8715
+ var eth$ = assetFactory("ETH");
8716
+ var usdc$ = assetFactory("USDC");
8717
+ var flip$ = assetFactory("FLIP");
8718
+ var dot$ = assetFactory("DOT");
8719
+ var btc$ = assetFactory("BTC");
8723
8720
 
8724
8721
  // src/swap/chains.ts
8725
8722
  init_enums();