@chainflip/sdk 1.5.0-alpha.3 → 1.5.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.
@@ -1,12 +1,11 @@
1
1
  import { z, assetAndChain, numericString, hexString, btcAddress, ccmParamsSchema, affiliateBroker, fillOrKillParams, dotAddress, ethereumAddress } from './chunk-HWJAHLL7.mjs';
2
2
  import { __name, Chains } from './chunk-3V7QJANN.mjs';
3
3
  import { HttpClient } from '@chainflip/rpc';
4
- import { bytesToHex } from '@chainflip/utils/bytes';
5
4
  import * as ss58 from '@chainflip/utils/ss58';
6
5
 
7
6
  var submitAddress = /* @__PURE__ */ __name((chain, address) => {
8
7
  if (chain === Chains.Polkadot) {
9
- return address.startsWith("0x") ? z.string().length(66).parse(address) : bytesToHex(ss58.decode(address).data);
8
+ return address.startsWith("0x") ? z.string().length(66).parse(address) : ss58.toPublicKey(address);
10
9
  }
11
10
  return address;
12
11
  }, "submitAddress");
@@ -74,7 +73,10 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork) {
74
73
  },
75
74
  maxBoostFeeBps,
76
75
  swapRequest.affiliates,
77
- swapRequest.fillOrKillParams
76
+ swapRequest.fillOrKillParams && {
77
+ ...swapRequest.fillOrKillParams,
78
+ refundAddress: submitAddress(srcChain, swapRequest.fillOrKillParams.refundAddress)
79
+ }
78
80
  ]);
79
81
  const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
80
82
  return validateResponse(chainflipNetwork, response);
package/dist/swap.d.mts CHANGED
@@ -234,19 +234,9 @@ type SwapState = {
234
234
  intermediateAmount: string | undefined;
235
235
  swapExecutedAt: number;
236
236
  swapExecutedBlockIndex: string;
237
- } | {
238
- state: 'EGRESS_SCHEDULED';
239
- swapId: string;
240
- depositAmount: string;
241
- depositReceivedAt: number;
242
- depositReceivedBlockIndex: string;
243
- intermediateAmount: string | undefined;
244
- swapExecutedAt: number;
245
- swapExecutedBlockIndex: string;
246
- egressAmount: string;
247
- egressScheduledAt: number;
248
- egressScheduledBlockIndex: string;
249
237
  } | ({
238
+ state: 'EGRESS_SCHEDULED';
239
+ } & EgressScheduled) | ({
250
240
  state: 'BROADCAST_REQUESTED';
251
241
  broadcastRequestedAt: number;
252
242
  broadcastRequestedBlockIndex: string;
package/dist/swap.d.ts CHANGED
@@ -234,19 +234,9 @@ type SwapState = {
234
234
  intermediateAmount: string | undefined;
235
235
  swapExecutedAt: number;
236
236
  swapExecutedBlockIndex: string;
237
- } | {
238
- state: 'EGRESS_SCHEDULED';
239
- swapId: string;
240
- depositAmount: string;
241
- depositReceivedAt: number;
242
- depositReceivedBlockIndex: string;
243
- intermediateAmount: string | undefined;
244
- swapExecutedAt: number;
245
- swapExecutedBlockIndex: string;
246
- egressAmount: string;
247
- egressScheduledAt: number;
248
- egressScheduledBlockIndex: string;
249
237
  } | ({
238
+ state: 'EGRESS_SCHEDULED';
239
+ } & EgressScheduled) | ({
250
240
  state: 'BROADCAST_REQUESTED';
251
241
  broadcastRequestedAt: number;
252
242
  broadcastRequestedBlockIndex: string;
package/dist/swap.js CHANGED
@@ -4791,7 +4791,10 @@ async function requestSwapDepositAddress(swapRequest, opts, chainflipNetwork2) {
4791
4791
  },
4792
4792
  maxBoostFeeBps,
4793
4793
  swapRequest.affiliates,
4794
- swapRequest.fillOrKillParams
4794
+ swapRequest.fillOrKillParams && {
4795
+ ...swapRequest.fillOrKillParams,
4796
+ refundAddress: submitAddress(srcChain, swapRequest.fillOrKillParams.refundAddress)
4797
+ }
4795
4798
  ]);
4796
4799
  const response = await client.sendRequest("broker_requestSwapDepositAddress", ...params);
4797
4800
  return validateResponse(chainflipNetwork2, response);
@@ -4805,7 +4808,7 @@ var init_broker = __esm({
4805
4808
  init_schemas();
4806
4809
  submitAddress = /* @__PURE__ */ __name((chain2, address) => {
4807
4810
  if (chain2 === exports.Chains.Polkadot) {
4808
- return address.startsWith("0x") ? z.string().length(66).parse(address) : bytes.bytesToHex(ss582__namespace.decode(address).data);
4811
+ return address.startsWith("0x") ? z.string().length(66).parse(address) : ss582__namespace.toPublicKey(address);
4809
4812
  }
4810
4813
  return address;
4811
4814
  }, "submitAddress");
@@ -10037,7 +10040,7 @@ var getChainData = /* @__PURE__ */ __name((chain2, network, env) => ({
10037
10040
  init_enums();
10038
10041
 
10039
10042
  // package.json
10040
- var version = "1.5.0-alpha.3";
10043
+ var version = "1.5.0";
10041
10044
 
10042
10045
  // src/swap/consts.ts
10043
10046
  var CF_SDK_VERSION_HEADERS = {
package/dist/swap.mjs CHANGED
@@ -3713,7 +3713,7 @@ var getChainData = /* @__PURE__ */ __name((chain, network, env) => ({
3713
3713
  }), "getChainData");
3714
3714
 
3715
3715
  // package.json
3716
- var version = "1.5.0-alpha.3";
3716
+ var version = "1.5.0";
3717
3717
 
3718
3718
  // src/swap/consts.ts
3719
3719
  var CF_SDK_VERSION_HEADERS = {
@@ -3844,7 +3844,7 @@ var _SwapSDK = class _SwapSDK {
3844
3844
  depositAddressRequest.ccmParams ?? (depositAddressRequest.ccmParams = depositAddressRequest.ccmMetadata);
3845
3845
  let response;
3846
3846
  if (this.options.broker !== void 0) {
3847
- const { requestSwapDepositAddress } = await import('./broker-4AIV4KDP.mjs');
3847
+ const { requestSwapDepositAddress } = await import('./broker-4D7ISFUZ.mjs');
3848
3848
  const result = await requestSwapDepositAddress({
3849
3849
  ...depositAddressRequest,
3850
3850
  commissionBps: brokerCommissionBps ?? this.options.broker.commissionBps,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chainflip/sdk",
3
- "version": "1.5.0-alpha.3",
3
+ "version": "1.5.0",
4
4
  "description": "",
5
5
  "exports": {
6
6
  "./swap": {
@@ -41,7 +41,7 @@
41
41
  "access": "public"
42
42
  },
43
43
  "dependencies": {
44
- "@chainflip/rpc": "^1.5.1",
44
+ "@chainflip/rpc": "^1.5.5",
45
45
  "@chainflip/utils": "^0.4.0",
46
46
  "axios": "^1.6.8",
47
47
  "ethers": "^6.13.2"