@velora-dex/sdk 9.3.0-dev.1 → 9.3.0-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velora-dex/sdk",
3
- "version": "9.3.0-dev.1",
3
+ "version": "9.3.0-dev.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/sdk.esm.js",
6
6
  "typings": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -174,6 +174,7 @@ import {
174
174
  GetDeltaPriceFunctions,
175
175
  DeltaPrice,
176
176
  BridgePrice,
177
+ AvailableBridge,
177
178
  DeltaPriceParams,
178
179
  } from './methods/delta/getDeltaPrice';
179
180
  import {
@@ -194,6 +195,7 @@ import {
194
195
  constructGetBridgeInfo,
195
196
  GetBridgeInfoFunctions,
196
197
  BridgeInfo,
198
+ BridgeProtocolResponse,
197
199
  } from './methods/delta/getBridgeInfo';
198
200
  import {
199
201
  constructIsTokenSupportedInDelta,
@@ -378,6 +380,8 @@ export type {
378
380
  BridgeStatus,
379
381
  Bridge,
380
382
  BridgeInfo,
383
+ AvailableBridge,
384
+ BridgeProtocolResponse,
381
385
  BuildDeltaOrderDataParams,
382
386
  BuildDeltaOrderFunctions,
383
387
  SignableDeltaOrderData,
@@ -19,7 +19,7 @@ type GetBridgeInfoParams = {
19
19
  };
20
20
 
21
21
  type BridgeInfoQuery = {
22
- allowBridgeAndSwap?: string;
22
+ allowBridgeAndSwap?: boolean;
23
23
  bridges?: string;
24
24
  };
25
25
 
@@ -28,9 +28,10 @@ type GetBridgeInfo = (
28
28
  requestParams?: RequestParameters
29
29
  ) => Promise<BridgeInfo>;
30
30
 
31
- type BridgeProtocolResponse = {
31
+ export type BridgeProtocolResponse = {
32
32
  protocol: string;
33
33
  displayName: string;
34
+ icon: string; // CDN URL
34
35
  };
35
36
 
36
37
  type BridgeProtocolsResponse = {
@@ -54,11 +55,10 @@ export const constructGetBridgeInfo = ({
54
55
 
55
56
  const getBridgeInfo: GetBridgeInfo = async (params = {}, requestParams) => {
56
57
  const { allowBridgeAndSwap, bridges } = params;
57
- const allowBridgeAndSwapString = allowBridgeAndSwap ? 'true' : 'false';
58
58
  const bridgesString = bridges ? bridges.join(',') : undefined;
59
59
 
60
60
  const search = constructSearchString<BridgeInfoQuery>({
61
- allowBridgeAndSwap: allowBridgeAndSwapString,
61
+ allowBridgeAndSwap: !!allowBridgeAndSwap,
62
62
  bridges: bridgesString,
63
63
  });
64
64
 
@@ -1,3 +1,4 @@
1
+ import { Prettify } from 'viem';
1
2
  import { Bridge } from '../..';
2
3
  import { API_URL, SwapSide } from '../../constants';
3
4
  import { constructSearchString } from '../../helpers/misc';
@@ -105,14 +106,15 @@ type AvailableBridgePrice = Pick<
105
106
  | 'gasCost'
106
107
  | 'gasCostUSDBeforeFee'
107
108
  | 'gasCostBeforeFee'
109
+ | 'receivedDestAmount'
110
+ | 'receivedDestAmountBeforeFee'
111
+ | 'receivedDestUSD'
112
+ | 'receivedDestUSDBeforeFee'
108
113
  >;
109
114
 
110
- type AvailableBridge = AvailableBridgePrice & {
111
- bridgeParams: {
112
- bridge: Bridge;
113
- bridgeInfo: BridgePriceInfo;
114
- }[];
115
- };
115
+ export type AvailableBridge = Prettify<
116
+ AvailableBridgePrice & Pick<BridgePrice, 'bridge' | 'bridgeInfo'>
117
+ >;
116
118
 
117
119
  export type BridgePrice = Omit<DeltaPrice, 'bridge'> & {
118
120
  // destAmountAfterBridge: string; // became bridgeInfo.destAmountAfterBridge
@@ -151,4 +151,7 @@ export type BridgePriceInfo = {
151
151
  destUSDAfterBridge: string;
152
152
  fees: BridgeQuoteFee[];
153
153
  estimatedTimeMs: number;
154
+ fastest: boolean;
155
+ bestReturn: boolean;
156
+ recommended: boolean;
154
157
  };