@dfns/sdk 0.7.14-rc.0 → 0.7.15-rc.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,10 +1,17 @@
1
1
  export type CreateSwapBody = {
2
+ /** Quote to use for this swap. */
2
3
  quoteId: string;
4
+ /** An optional reference for this Swap. */
3
5
  reference?: string | undefined;
6
+ /** Provided for this swap. Used for attesting that the swap is being created with the same parameters as the quote. */
4
7
  provider: "UniswapX" | "UniswapClassic";
8
+ /** Id of the Dfns wallet spending the sourceAsset. Used for attesting that the swap is being created with the same parameters as the quote. */
5
9
  walletId: string;
10
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. Used for attesting that the swap is being created with the same parameters as the quote. */
6
11
  targetWalletId?: string | undefined;
12
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. Used for attesting that the swap is being created with the same parameters as the quote. */
7
13
  slippageBps: number;
14
+ /** The source asset that will be spent on the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
8
15
  sourceAsset: {
9
16
  kind: "Native";
10
17
  amount: string;
@@ -13,6 +20,7 @@ export type CreateSwapBody = {
13
20
  contract: string;
14
21
  amount: string;
15
22
  };
23
+ /** The target asset that will be received with the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
16
24
  targetAsset: {
17
25
  kind: "Native";
18
26
  amount: string;
@@ -23,13 +31,21 @@ export type CreateSwapBody = {
23
31
  };
24
32
  };
25
33
  export type CreateSwapResponse = {
34
+ /** Swap id. */
26
35
  id: string;
36
+ /** Id of the quote this swap is based on. */
27
37
  quoteId: string;
38
+ /** Optional user-defined reference for this Swap. */
28
39
  reference: string | null;
40
+ /** Id of the Dfns wallet spending the sourceAsset. */
29
41
  walletId: string;
42
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
30
43
  targetWalletId: string;
44
+ /** Swap status. */
31
45
  status: "PendingPolicyApproval" | "InProgress" | "Completed" | "Failed" | "Rejected";
46
+ /** Swap provider. */
32
47
  provider: "UniswapX" | "UniswapClassic";
48
+ /** The source asset for this swap transaction. */
33
49
  quotedSourceAsset: ({
34
50
  kind: "Native";
35
51
  amount: string;
@@ -46,6 +62,7 @@ export type CreateSwapResponse = {
46
62
  tid?: string | undefined;
47
63
  };
48
64
  };
65
+ /** The target asset for this swap transaction. */
49
66
  quotedTargetAsset: ({
50
67
  kind: "Native";
51
68
  amount: string;
@@ -62,15 +79,25 @@ export type CreateSwapResponse = {
62
79
  tid?: string | undefined;
63
80
  };
64
81
  };
82
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
65
83
  slippageBps: number;
84
+ /** [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (must be UTC). When the swap was initiated. */
66
85
  dateCreated: string;
86
+ /** The full request used for initiating this swap. */
67
87
  requestBody: {
88
+ /** Quote to use for this swap. */
68
89
  quoteId: string;
90
+ /** An optional reference for this Swap. */
69
91
  reference?: string | undefined;
92
+ /** Provided for this swap. Used for attesting that the swap is being created with the same parameters as the quote. */
70
93
  provider: "UniswapX" | "UniswapClassic";
94
+ /** Id of the Dfns wallet spending the sourceAsset. Used for attesting that the swap is being created with the same parameters as the quote. */
71
95
  walletId: string;
96
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. Used for attesting that the swap is being created with the same parameters as the quote. */
72
97
  targetWalletId?: string | undefined;
98
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. Used for attesting that the swap is being created with the same parameters as the quote. */
73
99
  slippageBps: number;
100
+ /** The source asset that will be spent on the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
74
101
  sourceAsset: {
75
102
  kind: "Native";
76
103
  amount: string;
@@ -79,6 +106,7 @@ export type CreateSwapResponse = {
79
106
  contract: string;
80
107
  amount: string;
81
108
  };
109
+ /** The target asset that will be received with the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
82
110
  targetAsset: {
83
111
  kind: "Native";
84
112
  amount: string;
@@ -89,7 +117,9 @@ export type CreateSwapResponse = {
89
117
  };
90
118
  } | {};
91
119
  requester: {
120
+ /** User (could be a service account) who requested the resource. */
92
121
  userId: string;
122
+ /** Service Account token or Personal Access token used when requesting the resource. */
93
123
  tokenId?: string | undefined;
94
124
  };
95
125
  };
@@ -97,9 +127,13 @@ export type CreateSwapRequest = {
97
127
  body: CreateSwapBody;
98
128
  };
99
129
  export type CreateSwapQuoteBody = {
130
+ /** Swap provider. */
100
131
  provider: "UniswapX" | "UniswapClassic";
132
+ /** Id of the Dfns wallet spending the sourceAsset. */
101
133
  walletId: string;
134
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
102
135
  targetWalletId?: string | undefined;
136
+ /** The source asset that will be spent on the Swap transaction, following the same stucture as the [transfer API](https://docs.dfns.co/api-reference/wallets/transfer-asset). */
103
137
  sourceAsset: {
104
138
  kind: "Native";
105
139
  amount: string;
@@ -108,20 +142,26 @@ export type CreateSwapQuoteBody = {
108
142
  contract: string;
109
143
  amount: string;
110
144
  };
145
+ /** The target asset that will be received with the Swap transaction, follows the same structure as sourceAsset, but doesn't include the amount. */
111
146
  targetAsset: {
112
147
  kind: "Native";
113
148
  } | {
114
149
  kind: "Erc20";
115
150
  contract: string;
116
151
  };
152
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you're willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
117
153
  slippageBps: number;
118
154
  };
119
155
  export type CreateSwapQuoteResponse = {
156
+ /** ID of the Swap Quote. */
120
157
  id: string;
158
+ /** Id of the Dfns wallet spending the sourceAsset. */
121
159
  walletId: string;
122
160
  /** If not provided, the walletId is used as the target wallet. If provided, this field is currently required to be the same as walletId */
123
161
  targetWalletId?: string | undefined;
162
+ /** Swap provider. */
124
163
  provider: "UniswapX" | "UniswapClassic";
164
+ /** The source asset that will be spent on the swap transaction. */
125
165
  sourceAsset: ({
126
166
  kind: "Native";
127
167
  amount: string;
@@ -138,6 +178,7 @@ export type CreateSwapQuoteResponse = {
138
178
  tid?: string | undefined;
139
179
  };
140
180
  };
181
+ /** The target asset that will be received with the swap transaction. */
141
182
  targetAsset: ({
142
183
  kind: "Native";
143
184
  amount: string;
@@ -154,12 +195,19 @@ export type CreateSwapQuoteResponse = {
154
195
  tid?: string | undefined;
155
196
  };
156
197
  };
198
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you're willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
157
199
  slippageBps: number;
200
+ /** [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (must be UTC). When the quote was created. */
158
201
  dateCreated: string;
202
+ /** The full request used for obtaining this quote. */
159
203
  requestBody: {
204
+ /** Swap provider. */
160
205
  provider: "UniswapX" | "UniswapClassic";
206
+ /** Id of the Dfns wallet spending the sourceAsset. */
161
207
  walletId: string;
208
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
162
209
  targetWalletId?: string | undefined;
210
+ /** The source asset that will be spent on the Swap transaction, following the same stucture as the [transfer API](https://docs.dfns.co/api-reference/wallets/transfer-asset). */
163
211
  sourceAsset: {
164
212
  kind: "Native";
165
213
  amount: string;
@@ -168,16 +216,20 @@ export type CreateSwapQuoteResponse = {
168
216
  contract: string;
169
217
  amount: string;
170
218
  };
219
+ /** The target asset that will be received with the Swap transaction, follows the same structure as sourceAsset, but doesn't include the amount. */
171
220
  targetAsset: {
172
221
  kind: "Native";
173
222
  } | {
174
223
  kind: "Erc20";
175
224
  contract: string;
176
225
  };
226
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you're willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
177
227
  slippageBps: number;
178
228
  } | {};
179
229
  requester: {
230
+ /** User (could be a service account) who requested the quote. */
180
231
  userId: string;
232
+ /** Service Account token or Personal Access token used when requesting the quote. */
181
233
  tokenId?: string | undefined;
182
234
  };
183
235
  };
@@ -185,16 +237,25 @@ export type CreateSwapQuoteRequest = {
185
237
  body: CreateSwapQuoteBody;
186
238
  };
187
239
  export type GetSwapParams = {
240
+ /** Id of the swap for which we want to get details. */
188
241
  swapId: string;
189
242
  };
190
243
  export type GetSwapResponse = {
244
+ /** Swap id. */
191
245
  id: string;
246
+ /** Id of the quote this swap is based on. */
192
247
  quoteId: string;
248
+ /** Optional user-defined reference for this Swap. */
193
249
  reference: string | null;
250
+ /** Id of the Dfns wallet spending the sourceAsset. */
194
251
  walletId: string;
252
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
195
253
  targetWalletId: string;
254
+ /** Swap status. */
196
255
  status: "PendingPolicyApproval" | "InProgress" | "Completed" | "Failed" | "Rejected";
256
+ /** Swap provider. */
197
257
  provider: "UniswapX" | "UniswapClassic";
258
+ /** The source asset for this swap transaction. */
198
259
  quotedSourceAsset: ({
199
260
  kind: "Native";
200
261
  amount: string;
@@ -211,6 +272,7 @@ export type GetSwapResponse = {
211
272
  tid?: string | undefined;
212
273
  };
213
274
  };
275
+ /** The target asset for this swap transaction. */
214
276
  quotedTargetAsset: ({
215
277
  kind: "Native";
216
278
  amount: string;
@@ -227,15 +289,25 @@ export type GetSwapResponse = {
227
289
  tid?: string | undefined;
228
290
  };
229
291
  };
292
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
230
293
  slippageBps: number;
294
+ /** [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (must be UTC). When the swap was initiated. */
231
295
  dateCreated: string;
296
+ /** The full request used for initiating this swap. */
232
297
  requestBody: {
298
+ /** Quote to use for this swap. */
233
299
  quoteId: string;
300
+ /** An optional reference for this Swap. */
234
301
  reference?: string | undefined;
302
+ /** Provided for this swap. Used for attesting that the swap is being created with the same parameters as the quote. */
235
303
  provider: "UniswapX" | "UniswapClassic";
304
+ /** Id of the Dfns wallet spending the sourceAsset. Used for attesting that the swap is being created with the same parameters as the quote. */
236
305
  walletId: string;
306
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. Used for attesting that the swap is being created with the same parameters as the quote. */
237
307
  targetWalletId?: string | undefined;
308
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. Used for attesting that the swap is being created with the same parameters as the quote. */
238
309
  slippageBps: number;
310
+ /** The source asset that will be spent on the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
239
311
  sourceAsset: {
240
312
  kind: "Native";
241
313
  amount: string;
@@ -244,6 +316,7 @@ export type GetSwapResponse = {
244
316
  contract: string;
245
317
  amount: string;
246
318
  };
319
+ /** The target asset that will be received with the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
247
320
  targetAsset: {
248
321
  kind: "Native";
249
322
  amount: string;
@@ -254,20 +327,27 @@ export type GetSwapResponse = {
254
327
  };
255
328
  } | {};
256
329
  requester: {
330
+ /** User (could be a service account) who requested the resource. */
257
331
  userId: string;
332
+ /** Service Account token or Personal Access token used when requesting the resource. */
258
333
  tokenId?: string | undefined;
259
334
  };
260
335
  };
261
336
  export type GetSwapRequest = GetSwapParams;
262
337
  export type GetSwapQuoteParams = {
338
+ /** The ID of the Swap Quote. */
263
339
  quoteId: string;
264
340
  };
265
341
  export type GetSwapQuoteResponse = {
342
+ /** ID of the Swap Quote. */
266
343
  id: string;
344
+ /** Id of the Dfns wallet spending the sourceAsset. */
267
345
  walletId: string;
268
346
  /** If not provided, the walletId is used as the target wallet. If provided, this field is currently required to be the same as walletId */
269
347
  targetWalletId?: string | undefined;
348
+ /** Swap provider. */
270
349
  provider: "UniswapX" | "UniswapClassic";
350
+ /** The source asset that will be spent on the swap transaction. */
271
351
  sourceAsset: ({
272
352
  kind: "Native";
273
353
  amount: string;
@@ -284,6 +364,7 @@ export type GetSwapQuoteResponse = {
284
364
  tid?: string | undefined;
285
365
  };
286
366
  };
367
+ /** The target asset that will be received with the swap transaction. */
287
368
  targetAsset: ({
288
369
  kind: "Native";
289
370
  amount: string;
@@ -300,12 +381,19 @@ export type GetSwapQuoteResponse = {
300
381
  tid?: string | undefined;
301
382
  };
302
383
  };
384
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you're willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
303
385
  slippageBps: number;
386
+ /** [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (must be UTC). When the quote was created. */
304
387
  dateCreated: string;
388
+ /** The full request used for obtaining this quote. */
305
389
  requestBody: {
390
+ /** Swap provider. */
306
391
  provider: "UniswapX" | "UniswapClassic";
392
+ /** Id of the Dfns wallet spending the sourceAsset. */
307
393
  walletId: string;
394
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
308
395
  targetWalletId?: string | undefined;
396
+ /** The source asset that will be spent on the Swap transaction, following the same stucture as the [transfer API](https://docs.dfns.co/api-reference/wallets/transfer-asset). */
309
397
  sourceAsset: {
310
398
  kind: "Native";
311
399
  amount: string;
@@ -314,33 +402,48 @@ export type GetSwapQuoteResponse = {
314
402
  contract: string;
315
403
  amount: string;
316
404
  };
405
+ /** The target asset that will be received with the Swap transaction, follows the same structure as sourceAsset, but doesn't include the amount. */
317
406
  targetAsset: {
318
407
  kind: "Native";
319
408
  } | {
320
409
  kind: "Erc20";
321
410
  contract: string;
322
411
  };
412
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you're willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
323
413
  slippageBps: number;
324
414
  } | {};
325
415
  requester: {
416
+ /** User (could be a service account) who requested the quote. */
326
417
  userId: string;
418
+ /** Service Account token or Personal Access token used when requesting the quote. */
327
419
  tokenId?: string | undefined;
328
420
  };
329
421
  };
330
422
  export type GetSwapQuoteRequest = GetSwapQuoteParams;
331
423
  export type ListSwapsQuery = {
424
+ /** Maximum number of items to return. */
332
425
  limit?: number | undefined;
426
+ /** Opaque token used to retrieve the next page. Returned as `nextPageToken` from the previous request. */
333
427
  paginationToken?: string | undefined;
334
428
  };
335
429
  export type ListSwapsResponse = {
430
+ /** Current page items. */
336
431
  items: {
432
+ /** Swap id. */
337
433
  id: string;
434
+ /** Id of the quote this swap is based on. */
338
435
  quoteId: string;
436
+ /** Optional user-defined reference for this Swap. */
339
437
  reference: string | null;
438
+ /** Id of the Dfns wallet spending the sourceAsset. */
340
439
  walletId: string;
440
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. */
341
441
  targetWalletId: string;
442
+ /** Swap status. */
342
443
  status: "PendingPolicyApproval" | "InProgress" | "Completed" | "Failed" | "Rejected";
444
+ /** Swap provider. */
343
445
  provider: "UniswapX" | "UniswapClassic";
446
+ /** The source asset for this swap transaction. */
344
447
  quotedSourceAsset: ({
345
448
  kind: "Native";
346
449
  amount: string;
@@ -357,6 +460,7 @@ export type ListSwapsResponse = {
357
460
  tid?: string | undefined;
358
461
  };
359
462
  };
463
+ /** The target asset for this swap transaction. */
360
464
  quotedTargetAsset: ({
361
465
  kind: "Native";
362
466
  amount: string;
@@ -373,15 +477,25 @@ export type ListSwapsResponse = {
373
477
  tid?: string | undefined;
374
478
  };
375
479
  };
480
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. */
376
481
  slippageBps: number;
482
+ /** [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date (must be UTC). When the swap was initiated. */
377
483
  dateCreated: string;
484
+ /** The full request used for initiating this swap. */
378
485
  requestBody: {
486
+ /** Quote to use for this swap. */
379
487
  quoteId: string;
488
+ /** An optional reference for this Swap. */
380
489
  reference?: string | undefined;
490
+ /** Provided for this swap. Used for attesting that the swap is being created with the same parameters as the quote. */
381
491
  provider: "UniswapX" | "UniswapClassic";
492
+ /** Id of the Dfns wallet spending the sourceAsset. Used for attesting that the swap is being created with the same parameters as the quote. */
382
493
  walletId: string;
494
+ /** Id of the Dfns wallet receiving the target asset. Currently this value must be the same as the `walletId`. Used for attesting that the swap is being created with the same parameters as the quote. */
383
495
  targetWalletId?: string | undefined;
496
+ /** The slippage tolerance for this trade in [basis point](https://en.wikipedia.org/wiki/Basis_point) (BPS). Slippage tolerance defines the maximum price difference you are willing to accept during a trade from the estimated quote, ensuring you still receive at least a minimum number of tokens if the price shifts. One basis point equals one-hundredth of a percentage point, or 0.01%. Used for attesting that the swap is being created with the same parameters as the quote. */
384
497
  slippageBps: number;
498
+ /** The source asset that will be spent on the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
385
499
  sourceAsset: {
386
500
  kind: "Native";
387
501
  amount: string;
@@ -390,6 +504,7 @@ export type ListSwapsResponse = {
390
504
  contract: string;
391
505
  amount: string;
392
506
  };
507
+ /** The target asset that will be received with the Swap transaction. Used for attesting that the swap is being created with the same parameters as the quote. */
393
508
  targetAsset: {
394
509
  kind: "Native";
395
510
  amount: string;
@@ -400,10 +515,13 @@ export type ListSwapsResponse = {
400
515
  };
401
516
  } | {};
402
517
  requester: {
518
+ /** User (could be a service account) who requested the resource. */
403
519
  userId: string;
520
+ /** Service Account token or Personal Access token used when requesting the resource. */
404
521
  tokenId?: string | undefined;
405
522
  };
406
523
  }[];
524
+ /** token to use as `paginationToken` to request the next page. */
407
525
  nextPageToken?: string | undefined;
408
526
  };
409
527
  export type ListSwapsRequest = {