@coin-voyage/shared 2.4.0-beta.3 → 2.4.0-beta.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.
package/dist/api/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHmac } from "crypto";
|
|
2
|
-
import { now } from "../utils/time";
|
|
3
2
|
import { zPayOrder, zPayOrderMetadata } from "../schemas/pay-order";
|
|
4
3
|
import { PayOrderMode } from "../types/enums";
|
|
4
|
+
import { now } from "../utils/time";
|
|
5
5
|
import { WS_URL } from "./config";
|
|
6
6
|
import { fetchApi } from "./fetcher";
|
|
7
7
|
export class ApiClient {
|
|
@@ -16,6 +16,9 @@ export declare const zPayOrderMetadata: z.ZodObject<{
|
|
|
16
16
|
currency: z.ZodOptional<z.ZodString>;
|
|
17
17
|
}, z.core.$strip>>;
|
|
18
18
|
}, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodObject<{}, z.core.$loose>]>>>;
|
|
19
|
+
export declare const zPayOrderSettings: z.ZodObject<{
|
|
20
|
+
hide_footer: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, z.core.$strip>;
|
|
19
22
|
export declare const zPayOrder: z.ZodObject<{
|
|
20
23
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
21
24
|
items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -34,6 +37,9 @@ export declare const zPayOrder: z.ZodObject<{
|
|
|
34
37
|
currency: z.ZodOptional<z.ZodString>;
|
|
35
38
|
}, z.core.$strip>>;
|
|
36
39
|
}, z.core.$catchall<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodAny>, z.ZodObject<{}, z.core.$loose>]>>>>;
|
|
40
|
+
settings: z.ZodOptional<z.ZodObject<{
|
|
41
|
+
hide_footer: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strip>>;
|
|
37
43
|
intent: z.ZodObject<{
|
|
38
44
|
asset: z.ZodOptional<z.ZodObject<{
|
|
39
45
|
chain_id: z.ZodNumber;
|
|
@@ -41,9 +41,15 @@ export const zPayOrderMetadata = z
|
|
|
41
41
|
}, {
|
|
42
42
|
message: "A maximum of 20 additional custom fields is allowed",
|
|
43
43
|
});
|
|
44
|
+
// NOTE: be careful to modify this type only in backward-compatible ways.
|
|
45
|
+
// Add OPTIONAL fields, etc. Anything else requires a migration.
|
|
46
|
+
export const zPayOrderSettings = z.object({
|
|
47
|
+
hide_footer: z.boolean().optional().describe("Hide the Coin Voyage footer in supported payment UIs."),
|
|
48
|
+
});
|
|
44
49
|
// also validate not both token_amount and fiat are present
|
|
45
50
|
export const zPayOrder = z.object({
|
|
46
51
|
metadata: zPayOrderMetadata.optional(),
|
|
52
|
+
settings: zPayOrderSettings.optional(),
|
|
47
53
|
intent: z
|
|
48
54
|
.object({
|
|
49
55
|
asset: z
|
package/dist/types/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FiatCurrency } from "../currency/currencies";
|
|
2
2
|
import { ChainId, ChainType, PaymentMethod, PaymentRail, PayOrderStatus } from "./enums";
|
|
3
3
|
import { PayOrderEvent } from "./events";
|
|
4
|
-
import { CurrencyAmount, CurrencyBase, CurrencyWithAmount, FiatAmount, PaymentData, PayOrderMetadata, QuoteWithCurrency } from "./model";
|
|
4
|
+
import { CurrencyAmount, CurrencyBase, CurrencyWithAmount, FiatAmount, PaymentData, PayOrderMetadata, PayOrderSettings, QuoteWithCurrency } from "./model";
|
|
5
5
|
export type PayOrderParams = {
|
|
6
6
|
/**
|
|
7
7
|
* Intent of the order.
|
|
@@ -11,6 +11,10 @@ export type PayOrderParams = {
|
|
|
11
11
|
* Metadata to attach to the payOrder.
|
|
12
12
|
*/
|
|
13
13
|
metadata?: PayOrderMetadata;
|
|
14
|
+
/**
|
|
15
|
+
* UI and behavior settings to attach to the payOrder.
|
|
16
|
+
*/
|
|
17
|
+
settings?: PayOrderSettings;
|
|
14
18
|
};
|
|
15
19
|
export type PayOrderQuoteParams = {
|
|
16
20
|
wallet_address: string;
|
package/dist/types/model.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { FiatCurrency } from "../currency/currencies";
|
|
3
|
-
import { zPayOrderMetadata } from "../schemas/pay-order";
|
|
3
|
+
import { zPayOrderMetadata, zPayOrderSettings } from "../schemas/pay-order";
|
|
4
4
|
import { ChainId, PaymentRail, PayOrderMode, PayOrderStatus, ProviderStatus, StepKind } from "./enums";
|
|
5
5
|
export type PayOrder = {
|
|
6
6
|
id: string;
|
|
7
7
|
mode: PayOrderMode;
|
|
8
8
|
status: PayOrderStatus;
|
|
9
9
|
metadata?: ParsedPayOrderMetadata;
|
|
10
|
+
settings?: ParsedPayOrderSettings;
|
|
10
11
|
fulfillment: FulfillmentData;
|
|
11
12
|
payment?: PaymentData;
|
|
12
13
|
};
|
|
13
14
|
type MetadataExtraFields = Record<string, unknown>;
|
|
14
15
|
export type ParsedPayOrderMetadata = z.output<typeof zPayOrderMetadata> & MetadataExtraFields;
|
|
15
16
|
export type PayOrderMetadata = z.infer<typeof zPayOrderMetadata>;
|
|
17
|
+
export type ParsedPayOrderSettings = z.output<typeof zPayOrderSettings>;
|
|
18
|
+
export type PayOrderSettings = z.infer<typeof zPayOrderSettings>;
|
|
16
19
|
export interface Currency extends CurrencyBase {
|
|
17
20
|
id?: string;
|
|
18
21
|
name: string;
|