@velora-dex/sdk 8.1.1-dev.0 → 8.1.1-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": "8.1.1-dev.0",
3
+ "version": "8.1.1-dev.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/sdk.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import { DeltaAuction, GetDeltaOrdersFunctions } from '../..';
1
+ import { DeltaAuction, DeltaOrderFromAPI } from '../..';
2
2
 
3
3
  function isExecutedDeltaAuction(
4
4
  auction: Omit<DeltaAuction, 'signature'>,
@@ -14,9 +14,7 @@ function isExecutedDeltaAuction(
14
14
  return true;
15
15
  }
16
16
 
17
- type GetDeltaOrderFn = () => ReturnType<
18
- GetDeltaOrdersFunctions['getDeltaOrderById']
19
- >;
17
+ type GetDeltaOrderFn = () => Promise<DeltaOrderFromAPI>;
20
18
 
21
19
  function fetchOrderPeriodically(getDeltaOrder: GetDeltaOrderFn) {
22
20
  const intervalId = setInterval(async () => {
package/src/index.ts CHANGED
@@ -11,12 +11,17 @@ import {
11
11
  import {
12
12
  constructGetSpender,
13
13
  GetSpenderFunctions,
14
+ AdaptersContractsResult,
14
15
  } from './methods/swap/spender';
15
16
  import {
16
17
  constructGetAdapters,
17
18
  GetAdaptersFunctions,
18
19
  } from './methods/swap/adapters';
19
- import { constructGetRate, GetRateFunctions } from './methods/swap/rates';
20
+ import {
21
+ constructGetRate,
22
+ GetRateFunctions,
23
+ GetRateInput,
24
+ } from './methods/swap/rates';
20
25
  import { constructSwapTx, GetSwapTxFunctions } from './methods/swap/swapTx';
21
26
  import { constructGetTokens, GetTokensFunctions } from './methods/swap/token';
22
27
  import { BuildTxFunctions, constructBuildTx } from './methods/swap/transaction';
@@ -134,6 +139,7 @@ import type {
134
139
  import type {
135
140
  DeltaAuctionOrder,
136
141
  DeltaAuction,
142
+ DeltaAuctionStatus,
137
143
  BridgeMetadata,
138
144
  BridgeStatus,
139
145
  Bridge,
@@ -143,6 +149,7 @@ import {
143
149
  BuildDeltaOrderFunctions,
144
150
  constructBuildDeltaOrder,
145
151
  SignableDeltaOrderData,
152
+ SwapSideUnion,
146
153
  } from './methods/delta/buildDeltaOrder';
147
154
  import {
148
155
  constructBuildCrosschainOrderBridge,
@@ -152,6 +159,7 @@ import {
152
159
  } from './methods/delta/buildCrosschainOrderBridge';
153
160
  import {
154
161
  constructPostDeltaOrder,
162
+ DeltaOrderApiResponse,
155
163
  PostDeltaOrderFunctions,
156
164
  PostDeltaOrderParams,
157
165
  } from './methods/delta/postDeltaOrder';
@@ -173,6 +181,7 @@ import {
173
181
  import {
174
182
  constructGetDeltaOrders,
175
183
  GetDeltaOrdersFunctions,
184
+ DeltaOrderFromAPI,
176
185
  } from './methods/delta/getDeltaOrders';
177
186
  import {
178
187
  ApproveTokenForDeltaFunctions,
@@ -329,9 +338,11 @@ export type {
329
338
  ApproveTokenFunctions,
330
339
  GetBalancesFunctions,
331
340
  GetSpenderFunctions,
341
+ AdaptersContractsResult,
332
342
  GetTokensFunctions,
333
343
  GetAdaptersFunctions,
334
344
  GetRateFunctions,
345
+ GetRateInput,
335
346
  BuildTxFunctions,
336
347
  GetSwapTxFunctions,
337
348
  // types for limitOrders methods:
@@ -365,6 +376,9 @@ export type {
365
376
  DeltaPriceParams,
366
377
  DeltaAuctionOrder,
367
378
  DeltaAuction,
379
+ DeltaAuctionStatus,
380
+ DeltaOrderApiResponse,
381
+ DeltaOrderFromAPI,
368
382
  // bridge part of DeltaOrder
369
383
  BridgeMetadata,
370
384
  BridgeStatus,
@@ -411,6 +425,7 @@ export type {
411
425
  OptionalRate,
412
426
  FetcherErrorInterface,
413
427
  APIVersion,
428
+ SwapSideUnion,
414
429
  };
415
430
 
416
431
  export { SDKConfig, constructPartialSDK } from './sdk/partial';
@@ -16,7 +16,7 @@ import { BeneficiaryType } from '../common/orders/types';
16
16
  import { SwapSide } from '../../constants';
17
17
  export type { SignableDeltaOrderData } from './helpers/buildDeltaOrderData';
18
18
 
19
- type SwapSideUnion = EnumerateLiteral<typeof SwapSide>;
19
+ export type SwapSideUnion = EnumerateLiteral<typeof SwapSide>;
20
20
 
21
21
  export type BuildDeltaOrderDataParams = {
22
22
  /** @description The address of the order owner */
@@ -2,7 +2,6 @@ import type {
2
2
  ConstructProviderFetchInput,
3
3
  RequestParameters,
4
4
  } from '../../types';
5
- import { DeltaAuction } from './helpers/types';
6
5
  import {
7
6
  buildCancelDeltaOrderSignableData,
8
7
  CancelDeltaOrderData,
@@ -27,7 +26,7 @@ export type PostCancelDeltaOrderRequest = (
27
26
  ) => Promise<SuccessResponse>;
28
27
 
29
28
  export type CancelDeltaOrder = (
30
- params: Pick<DeltaAuction, 'id'>[],
29
+ params: CancelDeltaOrderData,
31
30
  requestParams?: RequestParameters
32
31
  ) => Promise<SuccessResponse>;
33
32
 
@@ -83,10 +82,9 @@ export const constructCancelDeltaOrder = (
83
82
  };
84
83
 
85
84
  const cancelLimitDeltaOrders: CancelDeltaOrder = async (
86
- params,
85
+ { orderIds },
87
86
  requestParams
88
87
  ) => {
89
- const orderIds = params.map(({ id }) => id);
90
88
  const signature = await signCancelLimitDeltaOrderRequest(
91
89
  { orderIds },
92
90
  requestParams
@@ -7,17 +7,17 @@ import type {
7
7
  } from '../../types';
8
8
  import type { DeltaAuction } from './helpers/types';
9
9
 
10
- type OrderFromAPI = Omit<DeltaAuction, 'signature'>;
10
+ export type DeltaOrderFromAPI = Omit<DeltaAuction, 'signature'>;
11
11
 
12
12
  type GetDeltaOrderById = (
13
13
  orderId: string,
14
14
  requestParams?: RequestParameters
15
- ) => Promise<OrderFromAPI>;
15
+ ) => Promise<DeltaOrderFromAPI>;
16
16
 
17
17
  type GetDeltaOrderByHash = (
18
18
  orderHash: string,
19
19
  requestParams?: RequestParameters
20
- ) => Promise<OrderFromAPI>;
20
+ ) => Promise<DeltaOrderFromAPI>;
21
21
 
22
22
  type OrdersFilter = {
23
23
  /** @description Order.owner to fetch Delta Order for */
@@ -36,7 +36,7 @@ type OrderFiltersQuery = OrdersFilter;
36
36
  type GetDeltaOrders = (
37
37
  options: OrdersFilter,
38
38
  requestParams?: RequestParameters
39
- ) => Promise<OrderFromAPI[]>;
39
+ ) => Promise<DeltaOrderFromAPI[]>;
40
40
 
41
41
  type GetRequiredBalanceParams = {
42
42
  userAddress: Address;
@@ -68,7 +68,7 @@ export const constructGetDeltaOrders = ({
68
68
  ) => {
69
69
  const fetchURL = `${baseUrl}/${orderId}` as const;
70
70
 
71
- const order = await fetcher<OrderFromAPI>({
71
+ const order = await fetcher<DeltaOrderFromAPI>({
72
72
  url: fetchURL,
73
73
  method: 'GET',
74
74
  requestParams,
@@ -83,7 +83,7 @@ export const constructGetDeltaOrders = ({
83
83
  ) => {
84
84
  const fetchURL = `${baseUrl}/hash/${orderHash}` as const;
85
85
 
86
- const order = await fetcher<OrderFromAPI>({
86
+ const order = await fetcher<DeltaOrderFromAPI>({
87
87
  url: fetchURL,
88
88
  method: 'GET',
89
89
  requestParams,
@@ -103,7 +103,7 @@ export const constructGetDeltaOrders = ({
103
103
 
104
104
  const fetchURL = `${baseUrl}${search}` as const;
105
105
 
106
- const orders = await fetcher<OrderFromAPI[]>({
106
+ const orders = await fetcher<DeltaOrderFromAPI[]>({
107
107
  url: fetchURL,
108
108
  method: 'GET',
109
109
  requestParams,
@@ -24,6 +24,8 @@ export type DeltaPriceParams = {
24
24
  destDecimals: number;
25
25
  /** @description User's Wallet Address */
26
26
  userAddress?: string;
27
+ /** @description Beneficiary Address */
28
+ beneficiary?: string; // beneficiary==owner if no transferTo
27
29
  /** @description Partner string. */
28
30
  partner?: string;
29
31
  /** @description Destination Chain ID for Crosschain Orders */
@@ -52,18 +52,15 @@ export type Bridge = {
52
52
  protocolData: string; // Hex string
53
53
  };
54
54
 
55
- type DeltaAuctionStatus =
55
+ export type DeltaAuctionStatus =
56
56
  | 'NOT_STARTED'
57
57
  | 'RUNNING'
58
58
  | 'EXECUTING'
59
59
  | 'EXECUTED'
60
60
  | 'FAILED'
61
61
  | 'EXPIRED'
62
- | 'CANCELLED'; // @TODO check if added
63
- // these are not exposed, but are coerced into FAILED
64
- // | 'INSUFFICIENT_BALANCE'
65
- // | 'INSUFFICIENT_ALLOWANCE'
66
- // | 'INVALIDATED';
62
+ | 'CANCELLED'
63
+ | 'SUSPENDED';
67
64
 
68
65
  type DeltaAuctionTransaction = {
69
66
  id: string;
@@ -20,7 +20,7 @@ export type GetSpenderFunctions = {
20
20
  getContracts: GetContracts;
21
21
  };
22
22
 
23
- interface AdaptersContractsResult {
23
+ export interface AdaptersContractsResult {
24
24
  AugustusSwapper: string;
25
25
  TokenTransferProxy: string;
26
26
  AugustusRFQ: string;