@dfns/sdk 0.8.12 → 0.8.13

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.
@@ -123,6 +123,8 @@ export type CreateSwapResponse = {
123
123
  /** Token id. */
124
124
  tokenId?: string | undefined;
125
125
  };
126
+ /** The failure reason, if any. Only present when status is Failed. */
127
+ failureReason?: string | undefined;
126
128
  };
127
129
  export type CreateSwapRequest = {
128
130
  body: CreateSwapBody;
@@ -335,6 +337,8 @@ export type GetSwapResponse = {
335
337
  /** Token id. */
336
338
  tokenId?: string | undefined;
337
339
  };
340
+ /** The failure reason, if any. Only present when status is Failed. */
341
+ failureReason?: string | undefined;
338
342
  };
339
343
  export type GetSwapRequest = GetSwapParams;
340
344
  export type GetSwapQuoteParams = {
@@ -525,6 +529,8 @@ export type ListSwapsResponse = {
525
529
  /** Token id. */
526
530
  tokenId?: string | undefined;
527
531
  };
532
+ /** The failure reason, if any. Only present when status is Failed. */
533
+ failureReason?: string | undefined;
528
534
  }[];
529
535
  /** token to use as `paginationToken` to request the next page. */
530
536
  nextPageToken?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dfns/sdk",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "dependencies": {
5
5
  "buffer": "^6.0.3",
6
6
  "cross-fetch": "^3.1.6"
package/utils/url.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const buildPathAndQuery: (pattern: string, params: {
2
2
  path: Record<string, any>;
3
- query: Record<string, string | number | boolean | undefined>;
3
+ query: Record<string, string | number | boolean | string[] | undefined>;
4
4
  }) => string;
package/utils/url.js CHANGED
@@ -8,8 +8,17 @@ const buildPathAndQuery = (pattern, params) => {
8
8
  path = path.replace(new RegExp(`:${key}`, 'g'), encodeURIComponent(params.path[key]));
9
9
  }
10
10
  const query = Object.entries(params.query)
11
- .filter(([_, value]) => !!value)
12
- .map(([key, value]) => `${key}=${encodeURIComponent(value.toString())}`)
11
+ .flatMap(([key, value]) => {
12
+ if (Array.isArray(value)) {
13
+ return value.map((item) => `${key}=${encodeURIComponent(item)}`);
14
+ }
15
+ else if (!value) {
16
+ return [];
17
+ }
18
+ else {
19
+ return [`${key}=${encodeURIComponent(value.toString())}`];
20
+ }
21
+ })
13
22
  .join('&');
14
23
  return query === '' ? path : `${path}?${query}`;
15
24
  };