@velora-dex/sdk 9.5.4-dev.1 → 9.5.4

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.
Files changed (87) hide show
  1. package/dist/index.d.ts +4 -18
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/methods/delta/cancelDeltaOrder.d.ts.map +1 -1
  4. package/dist/methods/delta/getDeltaOrders.d.ts +4 -4
  5. package/dist/methods/delta/getDeltaOrders.d.ts.map +1 -1
  6. package/dist/methods/delta/getDeltaPrice.d.ts +1 -1
  7. package/dist/methods/delta/getDeltaPrice.d.ts.map +1 -1
  8. package/dist/methods/delta/helpers/orders.d.ts +17 -16
  9. package/dist/methods/delta/helpers/orders.d.ts.map +1 -1
  10. package/dist/methods/delta/helpers/types.d.ts +11 -50
  11. package/dist/methods/delta/helpers/types.d.ts.map +1 -1
  12. package/dist/methods/delta/postDeltaOrder.d.ts +3 -3
  13. package/dist/methods/delta/postDeltaOrder.d.ts.map +1 -1
  14. package/dist/sdk/full.d.ts +0 -2
  15. package/dist/sdk/full.d.ts.map +1 -1
  16. package/dist/sdk/simple.d.ts +0 -10
  17. package/dist/sdk/simple.d.ts.map +1 -1
  18. package/dist/sdk.cjs.development.js +252 -1087
  19. package/dist/sdk.cjs.development.js.map +1 -1
  20. package/dist/sdk.cjs.production.min.js +1 -1
  21. package/dist/sdk.cjs.production.min.js.map +1 -1
  22. package/dist/sdk.esm.js +253 -1071
  23. package/dist/sdk.esm.js.map +1 -1
  24. package/dist/types.d.ts +0 -8
  25. package/dist/types.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/src/constants.js +6 -1
  28. package/src/index.js +115 -86
  29. package/src/index.ts +0 -153
  30. package/src/methods/delta/cancelDeltaOrder.ts +1 -4
  31. package/src/methods/delta/getDeltaOrders.ts +5 -6
  32. package/src/methods/delta/getDeltaPrice.ts +1 -1
  33. package/src/methods/delta/helpers/orders.ts +19 -27
  34. package/src/methods/delta/helpers/types.ts +19 -63
  35. package/src/methods/delta/postDeltaOrder.ts +4 -4
  36. package/src/methods/delta/postTWAPDeltaOrder.ts +1 -1
  37. package/src/sdk/full.ts +0 -8
  38. package/src/sdk/simple.ts +0 -56
  39. package/src/types.ts +0 -9
  40. package/dist/examples/deltaV2.d.ts +0 -2
  41. package/dist/examples/deltaV2.d.ts.map +0 -1
  42. package/dist/examples/helpers/deltaV2.d.ts +0 -5
  43. package/dist/examples/helpers/deltaV2.d.ts.map +0 -1
  44. package/dist/methods/deltaV2/buildDeltaOrderV2.d.ts +0 -44
  45. package/dist/methods/deltaV2/buildDeltaOrderV2.d.ts.map +0 -1
  46. package/dist/methods/deltaV2/buildExternalDeltaOrderV2.d.ts +0 -48
  47. package/dist/methods/deltaV2/buildExternalDeltaOrderV2.d.ts.map +0 -1
  48. package/dist/methods/deltaV2/buildTWAPDeltaOrderV2.d.ts +0 -59
  49. package/dist/methods/deltaV2/buildTWAPDeltaOrderV2.d.ts.map +0 -1
  50. package/dist/methods/deltaV2/cancelDeltaOrderV2.d.ts +0 -21
  51. package/dist/methods/deltaV2/cancelDeltaOrderV2.d.ts.map +0 -1
  52. package/dist/methods/deltaV2/getAgentsListV2.d.ts +0 -10
  53. package/dist/methods/deltaV2/getAgentsListV2.d.ts.map +0 -1
  54. package/dist/methods/deltaV2/getBridgeRoutes.d.ts +0 -20
  55. package/dist/methods/deltaV2/getBridgeRoutes.d.ts.map +0 -1
  56. package/dist/methods/deltaV2/getDeltaOrdersV2.d.ts +0 -33
  57. package/dist/methods/deltaV2/getDeltaOrdersV2.d.ts.map +0 -1
  58. package/dist/methods/deltaV2/getDeltaPriceV2.d.ts +0 -46
  59. package/dist/methods/deltaV2/getDeltaPriceV2.d.ts.map +0 -1
  60. package/dist/methods/deltaV2/index.d.ts +0 -59
  61. package/dist/methods/deltaV2/index.d.ts.map +0 -1
  62. package/dist/methods/deltaV2/isTokenSupportedInDeltaV2.d.ts +0 -8
  63. package/dist/methods/deltaV2/isTokenSupportedInDeltaV2.d.ts.map +0 -1
  64. package/dist/methods/deltaV2/postDeltaOrderV2.d.ts +0 -28
  65. package/dist/methods/deltaV2/postDeltaOrderV2.d.ts.map +0 -1
  66. package/dist/methods/deltaV2/postExternalDeltaOrderV2.d.ts +0 -11
  67. package/dist/methods/deltaV2/postExternalDeltaOrderV2.d.ts.map +0 -1
  68. package/dist/methods/deltaV2/postTWAPDeltaOrderV2.d.ts +0 -16
  69. package/dist/methods/deltaV2/postTWAPDeltaOrderV2.d.ts.map +0 -1
  70. package/dist/methods/deltaV2/types.d.ts +0 -163
  71. package/dist/methods/deltaV2/types.d.ts.map +0 -1
  72. package/src/examples/deltaV2.ts +0 -200
  73. package/src/examples/helpers/deltaV2.ts +0 -29
  74. package/src/methods/deltaV2/buildDeltaOrderV2.ts +0 -86
  75. package/src/methods/deltaV2/buildExternalDeltaOrderV2.ts +0 -95
  76. package/src/methods/deltaV2/buildTWAPDeltaOrderV2.ts +0 -131
  77. package/src/methods/deltaV2/cancelDeltaOrderV2.ts +0 -103
  78. package/src/methods/deltaV2/getAgentsListV2.ts +0 -34
  79. package/src/methods/deltaV2/getBridgeRoutes.ts +0 -82
  80. package/src/methods/deltaV2/getDeltaOrdersV2.ts +0 -119
  81. package/src/methods/deltaV2/getDeltaPriceV2.ts +0 -108
  82. package/src/methods/deltaV2/index.ts +0 -303
  83. package/src/methods/deltaV2/isTokenSupportedInDeltaV2.ts +0 -52
  84. package/src/methods/deltaV2/postDeltaOrderV2.ts +0 -65
  85. package/src/methods/deltaV2/postExternalDeltaOrderV2.ts +0 -45
  86. package/src/methods/deltaV2/postTWAPDeltaOrderV2.ts +0 -63
  87. package/src/methods/deltaV2/types.ts +0 -189
@@ -1,65 +0,0 @@
1
- import { API_URL } from '../../constants';
2
- import { constructSearchString } from '../../helpers/misc';
3
- import type { ConstructFetchInput, RequestParameters } from '../../types';
4
- import type {
5
- DeltaAuction,
6
- DeltaOrderType,
7
- OnChainOrderMap,
8
- } from '../delta/helpers/types';
9
-
10
- export type DeltaOrderToPostV2<T extends keyof OnChainOrderMap = 'Order'> = {
11
- /** @description Partner string */
12
- partner?: string;
13
- /** @description Referrer address */
14
- referrerAddress?: string;
15
- order: OnChainOrderMap[T];
16
- /** @description Signature of the order from order.owner address. EOA signatures must be submitted in ERC-2098 Compact Representation. */
17
- signature: string;
18
- chainId: number;
19
- /** @description Designates the Order as being able to be partially filled, as opposed to fill-or-kill */
20
- partiallyFillable?: boolean;
21
- /** @description Type of the order. MARKET or LIMIT. Default is MARKET */
22
- type?: DeltaOrderType;
23
- includeAgents?: string[];
24
- excludeAgents?: string[];
25
- };
26
-
27
- export type PostDeltaOrderV2Params = Omit<DeltaOrderToPostV2, 'chainId'> & {
28
- degenMode?: boolean;
29
- };
30
-
31
- type PostDeltaOrderV2 = (
32
- postData: PostDeltaOrderV2Params,
33
- requestParams?: RequestParameters
34
- ) => Promise<DeltaAuction<'Order'>>;
35
-
36
- export type PostDeltaOrderV2Functions = {
37
- postDeltaOrderV2: PostDeltaOrderV2;
38
- };
39
-
40
- export const constructPostDeltaOrderV2 = ({
41
- apiURL = API_URL,
42
- chainId,
43
- fetcher,
44
- }: ConstructFetchInput): PostDeltaOrderV2Functions => {
45
- const postOrderUrl = `${apiURL}/delta/v2/orders` as const;
46
-
47
- const postDeltaOrderV2: PostDeltaOrderV2 = (_postData, requestParams) => {
48
- const { degenMode, ...postData } = _postData;
49
- const deltaOrderToPost: DeltaOrderToPostV2 = { ...postData, chainId };
50
-
51
- const search = constructSearchString<{ degenMode?: boolean }>({
52
- degenMode,
53
- });
54
- const fetchURL = `${postOrderUrl}${search}` as const;
55
-
56
- return fetcher<DeltaAuction<'Order'>>({
57
- url: fetchURL,
58
- method: 'POST',
59
- data: deltaOrderToPost,
60
- requestParams,
61
- });
62
- };
63
-
64
- return { postDeltaOrderV2 };
65
- };
@@ -1,45 +0,0 @@
1
- import { API_URL } from '../../constants';
2
- import type { ConstructFetchInput, RequestParameters } from '../../types';
3
- import type { DeltaAuction } from '../delta/helpers/types';
4
- import type { DeltaOrderToPostV2 } from './postDeltaOrderV2';
5
-
6
- export type PostExternalDeltaOrderV2Params = Omit<
7
- DeltaOrderToPostV2<'ExternalOrder'>,
8
- 'chainId'
9
- >;
10
-
11
- type PostExternalDeltaOrderV2 = (
12
- postData: PostExternalDeltaOrderV2Params,
13
- requestParams?: RequestParameters
14
- ) => Promise<DeltaAuction<'ExternalOrder'>>;
15
-
16
- export type PostExternalDeltaOrderV2Functions = {
17
- postExternalDeltaOrderV2: PostExternalDeltaOrderV2;
18
- };
19
-
20
- export const constructPostExternalDeltaOrderV2 = ({
21
- apiURL = API_URL,
22
- chainId,
23
- fetcher,
24
- }: ConstructFetchInput): PostExternalDeltaOrderV2Functions => {
25
- const postOrderUrl = `${apiURL}/delta/v2/orders` as const;
26
-
27
- const postExternalDeltaOrderV2: PostExternalDeltaOrderV2 = (
28
- postData,
29
- requestParams
30
- ) => {
31
- const deltaOrderToPost: DeltaOrderToPostV2<'ExternalOrder'> = {
32
- ...postData,
33
- chainId,
34
- };
35
-
36
- return fetcher<DeltaAuction<'ExternalOrder'>>({
37
- url: postOrderUrl,
38
- method: 'POST',
39
- data: deltaOrderToPost,
40
- requestParams,
41
- });
42
- };
43
-
44
- return { postExternalDeltaOrderV2 };
45
- };
@@ -1,63 +0,0 @@
1
- import type { Prettify } from 'ts-essentials';
2
- import { API_URL } from '../../constants';
3
- import { constructSearchString } from '../../helpers/misc';
4
- import type { ConstructFetchInput, RequestParameters } from '../../types';
5
- import type {
6
- DeltaAuction,
7
- TWAPOnChainOrderType,
8
- } from '../delta/helpers/types';
9
- import type { DeltaOrderToPostV2 } from './postDeltaOrderV2';
10
-
11
- export type PostTWAPDeltaOrderV2Params = Prettify<
12
- Omit<
13
- DeltaOrderToPostV2<'TWAPOrder'> | DeltaOrderToPostV2<'TWAPBuyOrder'>,
14
- 'chainId'
15
- > & {
16
- /** @description Must be "TWAPOrder" or "TWAPBuyOrder" */
17
- onChainOrderType: TWAPOnChainOrderType;
18
- degenMode?: boolean;
19
- }
20
- >;
21
-
22
- type PostTWAPDeltaOrderV2 = (
23
- postData: PostTWAPDeltaOrderV2Params,
24
- requestParams?: RequestParameters
25
- ) => Promise<DeltaAuction<'TWAPOrder'> | DeltaAuction<'TWAPBuyOrder'>>;
26
-
27
- export type PostTWAPDeltaOrderV2Functions = {
28
- postTWAPDeltaOrderV2: PostTWAPDeltaOrderV2;
29
- };
30
-
31
- export const constructPostTWAPDeltaOrderV2 = ({
32
- apiURL = API_URL,
33
- chainId,
34
- fetcher,
35
- }: ConstructFetchInput): PostTWAPDeltaOrderV2Functions => {
36
- const postOrderUrl = `${apiURL}/delta/v2/orders` as const;
37
-
38
- const postTWAPDeltaOrderV2: PostTWAPDeltaOrderV2 = (
39
- _postData,
40
- requestParams
41
- ) => {
42
- const { degenMode, ...postData } = _postData;
43
- const deltaOrderToPost: DeltaOrderToPostV2<'TWAPOrder' | 'TWAPBuyOrder'> = {
44
- ...postData,
45
- chainId,
46
- };
47
-
48
- const search = constructSearchString<{ degenMode?: boolean }>({
49
- degenMode,
50
- });
51
-
52
- const fetchURL = `${postOrderUrl}${search}` as const;
53
-
54
- return fetcher<DeltaAuction<'TWAPOrder'> | DeltaAuction<'TWAPBuyOrder'>>({
55
- url: fetchURL,
56
- method: 'POST',
57
- data: deltaOrderToPost,
58
- requestParams,
59
- });
60
- };
61
-
62
- return { postTWAPDeltaOrderV2 };
63
- };
@@ -1,189 +0,0 @@
1
- import type { Address } from '../../types';
2
- import type { TypedDataField } from '../common/orders/buildOrderData';
3
- import type {
4
- Bridge,
5
- DeltaOrderType,
6
- DeltaOrderUnion,
7
- OnChainOrderType,
8
- } from '../delta/helpers/types';
9
-
10
- /** @description Response from POST /delta/v2/orders/build — EIP-712 typed data ready to sign. */
11
- export type BuiltDeltaOrderV2 = {
12
- toSign: {
13
- domain: {
14
- name: string;
15
- version: string;
16
- chainId: number;
17
- verifyingContract: string;
18
- };
19
- /** EIP-712 type definitions keyed by type name. */
20
- types: Record<string, TypedDataField[]>;
21
- /** The on-chain order struct value to sign. */
22
- value: Record<string, unknown>;
23
- };
24
- /** EIP-712 order hash. */
25
- orderHash: string;
26
- };
27
-
28
- /** @description Token identity used across v2 endpoints. */
29
- export type DeltaPriceToken = {
30
- chainId: number;
31
- address: Address;
32
- };
33
-
34
- /** @description A token amount with its USD value, used uniformly for inputs, outputs, and fees. */
35
- export type DeltaTokenAmount = {
36
- token: DeltaPriceToken;
37
- /** @description Amount in wei. */
38
- amount: string;
39
- /** @description USD value of the amount. */
40
- amountUSD: string;
41
- };
42
-
43
- /** @description Bridge tag used to mark routes as recommended / fastest / best-return. */
44
- export type BridgeTag = 'recommended' | 'fastest' | 'best-return';
45
-
46
- /** @description Subset of the on-chain Bridge struct returned in v2 price responses.
47
- * (the full `route` object is passed to the server when building an order). */
48
- export type DeltaRouteBridgeContractParams = Omit<Bridge, 'destinationChainId'>;
49
-
50
- /** @description Bridge details on a route. Same-chain routes carry `null` for `route.bridge`. */
51
- export type DeltaRouteBridge = {
52
- /** @description Bridge protocol identifier (e.g. "Across", "Relay", "Mayan"). */
53
- protocol: string;
54
- /** @description Estimated bridging time in milliseconds. */
55
- estimatedTimeMs: number;
56
- /** @description Tags for this route ("recommended", "fastest", "best-return"). May be empty. */
57
- tags: BridgeTag[];
58
- /** @description Bridge contract parameters as returned by the server. */
59
- contractParams: DeltaRouteBridgeContractParams;
60
- };
61
-
62
- /** @description A single step of a route (origin chain or destination chain). */
63
- export type DeltaRouteStep = {
64
- /** @description The token amount entering this step (before any per-step swap). */
65
- input: DeltaTokenAmount;
66
- /** @description The token amount exiting this step (after any per-step swap). */
67
- output: DeltaTokenAmount;
68
- };
69
-
70
- /** @description A route describes how the swap flows from origin chain to destination chain. */
71
- export type DeltaRoute = {
72
- /** @description Source-chain step. The on-chain Delta order's amounts come from `origin.input` and `origin.output`. */
73
- origin: DeltaRouteStep;
74
- /** @description Destination-chain step. For same-chain routes this mirrors `origin`. */
75
- destination: DeltaRouteStep;
76
- /** @description Bridge details. `null` for same-chain routes. */
77
- bridge: DeltaRouteBridge | null;
78
- /** @description Fee breakdown for this route. */
79
- fees: {
80
- /** @description Gas fee (single DeltaTokenAmount on the source chain). */
81
- gas: DeltaTokenAmount;
82
- /** @description Bridge fees (empty array for same-chain). */
83
- bridge: DeltaTokenAmount[];
84
- };
85
- };
86
-
87
- /** @description v2 price response: route-based, cross-chain first. */
88
- export type DeltaPriceV2 = {
89
- /** @description Unique request ID for tracing. */
90
- id: string;
91
- /** @description Order side. */
92
- side: 'SELL' | 'BUY';
93
- /** @description Token the user trades (identity only — amounts live in route.origin.input). */
94
- inputToken: DeltaPriceToken;
95
- /** @description Token the user receives (identity only — amounts live in route.destination.output). */
96
- outputToken: DeltaPriceToken;
97
- /** @description Recommended route with full amounts and bridge details. */
98
- route: DeltaRoute;
99
- /** @description Partner info attached to this price. */
100
- partner: {
101
- name: string;
102
- /** @description Partner fee in percent (e.g. 0.12 = 0.12%). */
103
- feePercent: number;
104
- };
105
- /** @description Address to approve for spending the input token. */
106
- spender: Address;
107
- /** @description Alternative routes (other bridges). Each is a full DeltaRoute. */
108
- alternatives: DeltaRoute[];
109
- };
110
-
111
- /** @description A flat bridge-routes entry returned by GET /delta/v2/prices/bridge-routes. */
112
- export type BridgeRoute = {
113
- srcChainId: number;
114
- destChainId: number;
115
- /** @description Output tokens supported on the dest chain for this src→dest pair. */
116
- tokens: Address[];
117
- };
118
-
119
- /* ------------------------------------------------------------------ */
120
- /* Orders v2 response shape (different from v1's DeltaAuction) */
121
- /* ------------------------------------------------------------------ */
122
-
123
- /** @description Integrator-facing order status returned by v2 order endpoints. */
124
- const DeltaOrderStatusV2Map = {
125
- Pending: 'PENDING',
126
- AwaitingSignature: 'AWAITING_SIGNATURE',
127
- Active: 'ACTIVE',
128
- Suspended: 'SUSPENDED',
129
- Cancelling: 'CANCELLING',
130
- Bridging: 'BRIDGING',
131
- Completed: 'COMPLETED',
132
- Failed: 'FAILED',
133
- Expired: 'EXPIRED',
134
- Cancelled: 'CANCELLED',
135
- Refunded: 'REFUNDED',
136
- } as const;
137
-
138
- export type DeltaOrderStatusV2 =
139
- (typeof DeltaOrderStatusV2Map)[keyof typeof DeltaOrderStatusV2Map];
140
-
141
- /** @description `OnChainOrderType` plus the synthetic `FillableOrder` label, used when a Standard `Order` is `partiallyFillable`. */
142
- export type DeltaOnChainOrderTypeReported = OnChainOrderType | 'FillableOrder';
143
-
144
- /** @description Token side on an order. SELL provides an explicit `amount`; BUY provides expected/executed amounts. */
145
- export type DeltaTokenSide =
146
- | {
147
- chainId: number;
148
- token: Address;
149
- amount: string;
150
- }
151
- | {
152
- chainId: number;
153
- token: Address;
154
- expectedAmount: string | null;
155
- executedAmount: string | null;
156
- };
157
-
158
- /** @description A single transaction entry on a v2 order. */
159
- export type DeltaTransactionV2 = {
160
- originTx: string;
161
- destinationTx: string | null;
162
- /** @description Filled percent of the slice (0–100). */
163
- filledPercent: number;
164
- spentAmount: string | null;
165
- receivedAmount: string | null;
166
- };
167
-
168
- /** @description Order shape returned by GET /v2/orders, /v2/orders/:id, /v2/orders/hash/:hash. */
169
- export type DeltaOrderV2Response = {
170
- id: string;
171
- status: DeltaOrderStatusV2;
172
- side: 'SELL' | 'BUY';
173
- type: DeltaOrderType;
174
- onChainOrderType: DeltaOnChainOrderTypeReported | null;
175
- input: DeltaTokenSide;
176
- output: DeltaTokenSide;
177
- owner: Address;
178
- beneficiary: Address;
179
- orderHash: string | null;
180
- partner: string;
181
- order: DeltaOrderUnion;
182
- transactions: DeltaTransactionV2[];
183
- /** @description ISO datetime string. */
184
- createdAt: string | null;
185
- /** @description ISO datetime string. */
186
- updatedAt: string | null;
187
- /** @description ISO datetime string. */
188
- expiresAt: string | null;
189
- };