@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/swap.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { getEnvironment, getVaultManagerContractAddress, approve, getTokenContractAddress, checkAllowance, Vault__factory, extractOverrides } from './chunk-MRYGGECA.mjs';
2
- import { numericString, ethereumAddress, dotAddress, ccmMetadataSchema, btcAddress } from './chunk-BF6CBSA3.mjs';
3
- import { __name, z, Chains, Assets, ChainflipNetworks, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, assetDecimals, isTestnet } from './chunk-Q7HQVR3T.mjs';
4
- export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-Q7HQVR3T.mjs';
1
+ import { getTokenContractAddress, getEnvironment, getVaultManagerContractAddress, approve, checkAllowance, Vault__factory, extractOverrides } from './chunk-OV3KFLWM.mjs';
2
+ import { ccmMetadataSchema } from './chunk-M2FID654.mjs';
3
+ import { __name, z, numericString, Chains, Assets, ethereumAddress, dotAddress, ChainflipNetworks, assetChains, assetDecimals, isTestnet, __publicField, assert, assertIsValidAssetAndChain, isTokenCall, isTokenSwap, chainContractIds, assetContractIds, btcAddress } from './chunk-DV4HDL4K.mjs';
4
+ export { Assets, ChainflipNetworks, Chains, assetChains, assetContractIds, assetDecimals, chainAssets, chainContractIds } from './chunk-DV4HDL4K.mjs';
5
5
  import { decodeAddress } from '@polkadot/util-crypto';
6
6
  import axios from 'axios';
7
7
 
8
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
8
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable-ade1bad8.mjs
9
9
  function identity(x) {
10
10
  return x;
11
11
  }
@@ -84,7 +84,7 @@ function observable(subscribe) {
84
84
  }
85
85
  __name(observable, "observable");
86
86
 
87
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/observable/index.mjs
87
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/observable/index.mjs
88
88
  function share(_opts) {
89
89
  return (originalObserver) => {
90
90
  let refCount = 0;
@@ -189,7 +189,7 @@ function observableToPromise(observable2) {
189
189
  }
190
190
  __name(observableToPromise, "observableToPromise");
191
191
 
192
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
192
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/splitLink-4c75f7be.mjs
193
193
  function createChain(opts) {
194
194
  return observable((observer) => {
195
195
  function execute(index = 0, op = opts.op) {
@@ -213,7 +213,7 @@ function createChain(opts) {
213
213
  }
214
214
  __name(createChain, "createChain");
215
215
 
216
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/codes-c924c3db.mjs
216
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/codes-c924c3db.mjs
217
217
  function invert(obj) {
218
218
  const newObj = /* @__PURE__ */ Object.create(null);
219
219
  for (const key in obj) {
@@ -251,7 +251,7 @@ var TRPC_ERROR_CODES_BY_KEY = {
251
251
  };
252
252
  invert(TRPC_ERROR_CODES_BY_KEY);
253
253
 
254
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/index-f91d720c.mjs
254
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/index-f91d720c.mjs
255
255
  invert(TRPC_ERROR_CODES_BY_KEY);
256
256
  var noop = /* @__PURE__ */ __name(() => {
257
257
  }, "noop");
@@ -289,7 +289,7 @@ var createFlatProxy = /* @__PURE__ */ __name((callback) => {
289
289
  });
290
290
  }, "createFlatProxy");
291
291
 
292
- // ../../node_modules/.pnpm/@trpc+server@10.45.0/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
292
+ // ../../node_modules/.pnpm/@trpc+server@10.45.1/node_modules/@trpc/server/dist/getCauseFromUnknown-2d66414a.mjs
293
293
  function isObject(value) {
294
294
  return !!value && !Array.isArray(value) && typeof value === "object";
295
295
  }
@@ -320,7 +320,7 @@ function getCauseFromUnknown(cause) {
320
320
  }
321
321
  __name(getCauseFromUnknown, "getCauseFromUnknown");
322
322
 
323
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
323
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/transformResult-ace864b8.mjs
324
324
  function isObject2(value) {
325
325
  return !!value && !Array.isArray(value) && typeof value === "object";
326
326
  }
@@ -373,7 +373,7 @@ function transformResult(response, runtime) {
373
373
  }
374
374
  __name(transformResult, "transformResult");
375
375
 
376
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
376
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/TRPCClientError-38f9a32a.mjs
377
377
  function isTRPCClientError(cause) {
378
378
  return cause instanceof TRPCClientError || /**
379
379
  * @deprecated
@@ -431,7 +431,7 @@ var _TRPCClientError = class _TRPCClientError extends Error {
431
431
  __name(_TRPCClientError, "TRPCClientError");
432
432
  var TRPCClientError = _TRPCClientError;
433
433
 
434
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
434
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpUtils-b9d0cb48.mjs
435
435
  var isFunction = /* @__PURE__ */ __name((fn) => typeof fn === "function", "isFunction");
436
436
  function getFetch(customFetchImpl) {
437
437
  if (customFetchImpl) {
@@ -575,7 +575,7 @@ function httpRequest(opts) {
575
575
  }
576
576
  __name(httpRequest, "httpRequest");
577
577
 
578
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
578
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/httpBatchLink-d0f9eac9.mjs
579
579
  var throwFatalError = /* @__PURE__ */ __name(() => {
580
580
  throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new");
581
581
  }, "throwFatalError");
@@ -805,7 +805,7 @@ var batchRequester = /* @__PURE__ */ __name((requesterOpts) => {
805
805
  }, "batchRequester");
806
806
  var httpBatchLink = createHTTPBatchLink(batchRequester);
807
807
 
808
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/links/httpLink.mjs
808
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/links/httpLink.mjs
809
809
  function httpLinkFactory(factoryOpts) {
810
810
  return (opts) => {
811
811
  const resolvedOpts = resolveHTTPLinkOptions(opts);
@@ -857,7 +857,7 @@ function httpLinkFactory(factoryOpts) {
857
857
  }
858
858
  __name(httpLinkFactory, "httpLinkFactory");
859
859
 
860
- // ../../node_modules/.pnpm/@trpc+client@10.45.0_@trpc+server@10.45.0/node_modules/@trpc/client/dist/index.mjs
860
+ // ../../node_modules/.pnpm/@trpc+client@10.45.1_@trpc+server@10.45.1/node_modules/@trpc/client/dist/index.mjs
861
861
  var _TRPCUntypedClient = class _TRPCUntypedClient {
862
862
  $request({ type, input, path, context = {} }) {
863
863
  const chain$ = createChain({
@@ -2385,66 +2385,37 @@ var BACKEND_SERVICE_URLS = {
2385
2385
  };
2386
2386
 
2387
2387
  // src/swap/assets.ts
2388
- var eth$ = /* @__PURE__ */ __name((network, env) => ({
2389
- id: Assets.ETH,
2390
- chain: Chains.Ethereum,
2391
- contractAddress: void 0,
2392
- decimals: assetDecimals[Assets.ETH],
2393
- name: "Ether",
2394
- symbol: "ETH",
2395
- chainflipId: "ETH",
2396
- isMainnet: !isTestnet(network),
2397
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.ETH.toString(),
2398
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.ETH?.toString() ?? null
2399
- }), "eth$");
2400
- var usdc$ = /* @__PURE__ */ __name((network, env) => ({
2401
- id: Assets.USDC,
2402
- chain: Chains.Ethereum,
2403
- contractAddress: getTokenContractAddress(Assets.USDC, network),
2404
- decimals: assetDecimals[Assets.USDC],
2405
- name: "USDC",
2406
- symbol: "USDC",
2407
- chainflipId: "USDC",
2408
- isMainnet: !isTestnet(network),
2409
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.USDC.toString(),
2410
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.USDC?.toString() ?? null
2411
- }), "usdc$");
2412
- var flip$ = /* @__PURE__ */ __name((network, env) => ({
2413
- id: Assets.FLIP,
2414
- chain: Chains.Ethereum,
2415
- contractAddress: getTokenContractAddress(Assets.FLIP, network),
2416
- decimals: assetDecimals[Assets.FLIP],
2417
- name: "FLIP",
2418
- symbol: "FLIP",
2419
- chainflipId: "FLIP",
2420
- isMainnet: !isTestnet(network),
2421
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Ethereum.FLIP.toString(),
2422
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Ethereum.FLIP?.toString() ?? null
2423
- }), "flip$");
2424
- var dot$ = /* @__PURE__ */ __name((network, env) => ({
2425
- id: Assets.DOT,
2426
- chain: Chains.Polkadot,
2427
- contractAddress: void 0,
2428
- decimals: assetDecimals[Assets.DOT],
2429
- name: "Polkadot",
2430
- symbol: "DOT",
2431
- chainflipId: "DOT",
2432
- isMainnet: !isTestnet(network),
2433
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Polkadot.DOT.toString(),
2434
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Polkadot.DOT?.toString() ?? null
2435
- }), "dot$");
2436
- var btc$ = /* @__PURE__ */ __name((network, env) => ({
2437
- id: Assets.BTC,
2438
- chain: Chains.Bitcoin,
2439
- contractAddress: void 0,
2440
- decimals: assetDecimals[Assets.BTC],
2441
- name: "Bitcoin",
2442
- symbol: "BTC",
2443
- chainflipId: "BTC",
2444
- isMainnet: !isTestnet(network),
2445
- minimumSwapAmount: env.ingressEgress.minimumDepositAmounts.Bitcoin.BTC.toString(),
2446
- maximumSwapAmount: env.swapping.maximumSwapAmounts.Bitcoin.BTC?.toString() ?? null
2447
- }), "btc$");
2388
+ var assetName = {
2389
+ [Assets.ETH]: "Ether",
2390
+ [Assets.USDC]: "USDC",
2391
+ [Assets.FLIP]: "FLIP",
2392
+ [Assets.DOT]: "Polkadot",
2393
+ [Assets.BTC]: "Bitcoin"
2394
+ };
2395
+ var assetFactory = /* @__PURE__ */ __name((asset) => (network, env) => {
2396
+ const assetAndChain = {
2397
+ asset,
2398
+ chain: assetChains[asset]
2399
+ };
2400
+ return {
2401
+ id: asset,
2402
+ chain: assetChains[asset],
2403
+ contractAddress: getTokenContractAddress(asset, network, false),
2404
+ decimals: assetDecimals[asset],
2405
+ name: assetName[asset],
2406
+ symbol: asset,
2407
+ chainflipId: asset,
2408
+ isMainnet: !isTestnet(network),
2409
+ minimumSwapAmount: readAssetValue(env.ingressEgress.minimumDepositAmounts, assetAndChain).toString(),
2410
+ maximumSwapAmount: readAssetValue(env.swapping.maximumSwapAmounts, assetAndChain)?.toString() ?? null,
2411
+ minimumEgressAmount: readAssetValue(env.ingressEgress.minimumEgressAmounts, assetAndChain).toString()
2412
+ };
2413
+ }, "assetFactory");
2414
+ var eth$ = assetFactory("ETH");
2415
+ var usdc$ = assetFactory("USDC");
2416
+ var flip$ = assetFactory("FLIP");
2417
+ var dot$ = assetFactory("DOT");
2418
+ var btc$ = assetFactory("BTC");
2448
2419
 
2449
2420
  // src/swap/chains.ts
2450
2421
  var ethereum = /* @__PURE__ */ __name((network) => ({
@@ -2596,7 +2567,7 @@ var _SwapSDK = class _SwapSDK {
2596
2567
  }, BigInt(amount));
2597
2568
  let response;
2598
2569
  if (this.brokerConfig !== void 0) {
2599
- const { requestSwapDepositAddress } = await import('./broker-PDSDURH6.mjs');
2570
+ const { requestSwapDepositAddress } = await import('./broker-Z7ASKYS2.mjs');
2600
2571
  const result = await requestSwapDepositAddress(depositAddressRequest, this.brokerConfig, this.network);
2601
2572
  response = {
2602
2573
  id: `${result.issuedBlock}-${depositAddressRequest.srcChain}-${result.channelId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "1.1.5",
3
+ "version": "1.2.0-rc.1",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {