@coin-voyage/shared 2.2.3 → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  import { FiatCurrency } from "../common/currencies";
2
2
  import { ChainId, ChainType, PayOrderStatus } from "./enums";
3
- import { Currency, CurrencyAmount, CurrencyBase, CurrencyWithAmount, PaymentData, PayOrderMetadataInput, QuoteWithCurrency } from "./model";
3
+ import { Currency, CurrencyAmount, CurrencyBase, CurrencyWithAmount, PaymentData, PayOrderMetadata, QuoteWithCurrency } from "./model";
4
4
  export type PayOrderParams = {
5
5
  /**
6
6
  * Intent of the order.
@@ -9,7 +9,7 @@ export type PayOrderParams = {
9
9
  /**
10
10
  * Metadata to attach to the payOrder.
11
11
  */
12
- metadata?: PayOrderMetadataInput;
12
+ metadata?: PayOrderMetadata;
13
13
  };
14
14
  export type PayOrderQuoteParams = {
15
15
  wallet_address: string;
@@ -1,4 +1,4 @@
1
- import { PayOrderMetadata } from "./model";
1
+ import { ParsedPayOrderMetadata } from "./model";
2
2
  import { Hex } from "./crypto";
3
3
  import { PaymentData } from "./model";
4
4
  export type PayOrderCreationErrorEvent = {
@@ -7,7 +7,7 @@ export type PayOrderCreationErrorEvent = {
7
7
  };
8
8
  type EventBase = {
9
9
  payorder_id: string;
10
- metadata?: PayOrderMetadata;
10
+ metadata?: ParsedPayOrderMetadata;
11
11
  };
12
12
  export type PayOrderCreatedEvent = EventBase & {
13
13
  type: "payorder_created";
@@ -3,3 +3,4 @@ export * from "./crypto";
3
3
  export * from "./enums";
4
4
  export * from "./events";
5
5
  export * from "./model";
6
+ export * from "./webhooks";
@@ -3,3 +3,4 @@ export * from "./crypto";
3
3
  export * from "./enums";
4
4
  export * from "./events";
5
5
  export * from "./model";
6
+ export * from "./webhooks";
@@ -1,30 +1,23 @@
1
1
  import { z } from "zod";
2
- import { zPayOrderMetadata } from "../common";
2
+ import { zPayOrderMetadata } from "../common/validation";
3
3
  import { FiatCurrency } from "../common/currencies";
4
- import { ChainId, PayOrderMode, PayOrderStatus, ProviderStatus, WebhookEventType } from "./enums";
5
- import { PayOrderEvent } from "./events";
4
+ import { ChainId, PayOrderMode, PayOrderStatus, ProviderStatus } from "./enums";
6
5
  export type PayOrder = {
7
6
  id: string;
8
7
  mode: PayOrderMode;
9
8
  status: PayOrderStatus;
10
- metadata?: PayOrderMetadata;
9
+ metadata?: ParsedPayOrderMetadata;
11
10
  deposit_tx_hash?: string;
12
11
  receiving_tx_hash?: string;
13
12
  refund_tx_hash?: string;
14
13
  fulfillment: FulfillmentData;
15
14
  payment?: PaymentData;
16
15
  };
17
- export type PayOrderMetadata = z.infer<typeof zPayOrderMetadata> & {
18
- [key: string]: string | number | boolean | any[] | {
19
- [x: string]: any;
20
- };
21
- };
22
- export type PayOrderMetadataInput = {
23
- items?: z.input<typeof zPayOrderMetadata.shape.items>;
24
- refund?: z.input<typeof zPayOrderMetadata.shape.refund>;
25
- } & Record<string, string | number | boolean | any[] | {
16
+ type MetadataExtraFields = Record<string, string | number | boolean | any[] | {
26
17
  [x: string]: any;
27
- }>;
18
+ } | undefined>;
19
+ export type ParsedPayOrderMetadata = z.output<typeof zPayOrderMetadata> & MetadataExtraFields;
20
+ export type PayOrderMetadata = z.input<typeof zPayOrderMetadata> & MetadataExtraFields;
28
21
  export interface Currency extends CurrencyBase {
29
22
  id?: string;
30
23
  name: string;
@@ -114,32 +107,8 @@ export type ExecutionStep = {
114
107
  fee_error?: unknown;
115
108
  price_impact?: string;
116
109
  };
117
- export interface WebhookEndpoint {
118
- id: string;
119
- organization_id: string;
120
- active: boolean;
121
- url: string;
122
- webhook_secret: string;
123
- subscription_events: WebhookEventType[];
124
- created_at: Date;
125
- }
126
- export interface WebhookEvent {
127
- id: string;
128
- endpoint: WebhookEndpoint;
129
- payload: PayOrderEvent;
130
- webhook_id: string;
131
- status: WebhookEventType;
132
- deliveries: WebhookDelivery[];
133
- created_at: Date;
134
- }
135
- export interface WebhookDelivery {
136
- id: string;
137
- event_id: string;
138
- http_status: number;
139
- body: string | null;
140
- created_at: Date;
141
- }
142
110
  export interface FeePlan extends CurrencyWithAmount {
143
111
  fee_bps?: number;
144
112
  }
145
113
  export type BigIntStr = `${bigint}`;
114
+ export {};
@@ -0,0 +1,27 @@
1
+ import { WebhookEventType } from "./enums";
2
+ import { PayOrderEvent } from "./events";
3
+ export interface WebhookEndpoint {
4
+ id: string;
5
+ organization_id: string;
6
+ active: boolean;
7
+ url: string;
8
+ webhook_secret: string;
9
+ subscription_events: WebhookEventType[];
10
+ created_at: Date;
11
+ }
12
+ export interface WebhookEvent {
13
+ id: string;
14
+ endpoint: WebhookEndpoint;
15
+ payload: PayOrderEvent;
16
+ webhook_id: string;
17
+ status: WebhookEventType;
18
+ deliveries: WebhookDelivery[];
19
+ created_at: Date;
20
+ }
21
+ export interface WebhookDelivery {
22
+ id: string;
23
+ event_id: string;
24
+ http_status: number;
25
+ body: string | null;
26
+ created_at: Date;
27
+ }
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coin-voyage/shared",
3
3
  "description": "Shared utilities for Coin Voyage",
4
- "version": "2.2.3",
4
+ "version": "2.2.4",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {