@metamask-previews/bridge-status-controller 73.1.0-preview-e12e4a38f → 74.0.0-preview-4f9d41d

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 (126) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/bridge-status-controller.cjs +167 -21
  3. package/dist/bridge-status-controller.cjs.map +1 -1
  4. package/dist/bridge-status-controller.d.cts +6 -1
  5. package/dist/bridge-status-controller.d.cts.map +1 -1
  6. package/dist/bridge-status-controller.d.mts +6 -1
  7. package/dist/bridge-status-controller.d.mts.map +1 -1
  8. package/dist/bridge-status-controller.mjs +167 -21
  9. package/dist/bridge-status-controller.mjs.map +1 -1
  10. package/dist/constants.cjs +1 -0
  11. package/dist/constants.cjs.map +1 -1
  12. package/dist/constants.d.cts.map +1 -1
  13. package/dist/constants.d.mts.map +1 -1
  14. package/dist/constants.mjs +1 -0
  15. package/dist/constants.mjs.map +1 -1
  16. package/dist/index.cjs +12 -6
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +3 -1
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +3 -1
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +3 -0
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/quote-status-manager/constants.cjs +181 -0
  25. package/dist/quote-status-manager/constants.cjs.map +1 -0
  26. package/dist/quote-status-manager/constants.d.cts +137 -0
  27. package/dist/quote-status-manager/constants.d.cts.map +1 -0
  28. package/dist/quote-status-manager/constants.d.mts +137 -0
  29. package/dist/quote-status-manager/constants.d.mts.map +1 -0
  30. package/dist/quote-status-manager/constants.mjs +178 -0
  31. package/dist/quote-status-manager/constants.mjs.map +1 -0
  32. package/dist/quote-status-manager/errors.cjs +51 -0
  33. package/dist/quote-status-manager/errors.cjs.map +1 -0
  34. package/dist/quote-status-manager/errors.d.cts +45 -0
  35. package/dist/quote-status-manager/errors.d.cts.map +1 -0
  36. package/dist/quote-status-manager/errors.d.mts +45 -0
  37. package/dist/quote-status-manager/errors.d.mts.map +1 -0
  38. package/dist/quote-status-manager/errors.mjs +46 -0
  39. package/dist/quote-status-manager/errors.mjs.map +1 -0
  40. package/dist/quote-status-manager/quote-status-api-service.cjs +241 -0
  41. package/dist/quote-status-manager/quote-status-api-service.cjs.map +1 -0
  42. package/dist/quote-status-manager/quote-status-api-service.d.cts +93 -0
  43. package/dist/quote-status-manager/quote-status-api-service.d.cts.map +1 -0
  44. package/dist/quote-status-manager/quote-status-api-service.d.mts +93 -0
  45. package/dist/quote-status-manager/quote-status-api-service.d.mts.map +1 -0
  46. package/dist/quote-status-manager/quote-status-api-service.mjs +237 -0
  47. package/dist/quote-status-manager/quote-status-api-service.mjs.map +1 -0
  48. package/dist/quote-status-manager/quote-status-entry-store.cjs +271 -0
  49. package/dist/quote-status-manager/quote-status-entry-store.cjs.map +1 -0
  50. package/dist/quote-status-manager/quote-status-entry-store.d.cts +144 -0
  51. package/dist/quote-status-manager/quote-status-entry-store.d.cts.map +1 -0
  52. package/dist/quote-status-manager/quote-status-entry-store.d.mts +144 -0
  53. package/dist/quote-status-manager/quote-status-entry-store.d.mts.map +1 -0
  54. package/dist/quote-status-manager/quote-status-entry-store.mjs +267 -0
  55. package/dist/quote-status-manager/quote-status-entry-store.mjs.map +1 -0
  56. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs +29 -0
  57. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs.map +1 -0
  58. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts +32 -0
  59. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts.map +1 -0
  60. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts +32 -0
  61. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts.map +1 -0
  62. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs +25 -0
  63. package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs.map +1 -0
  64. package/dist/quote-status-manager/quote-status-state-fsm.cjs +107 -0
  65. package/dist/quote-status-manager/quote-status-state-fsm.cjs.map +1 -0
  66. package/dist/quote-status-manager/quote-status-state-fsm.d.cts +57 -0
  67. package/dist/quote-status-manager/quote-status-state-fsm.d.cts.map +1 -0
  68. package/dist/quote-status-manager/quote-status-state-fsm.d.mts +57 -0
  69. package/dist/quote-status-manager/quote-status-state-fsm.d.mts.map +1 -0
  70. package/dist/quote-status-manager/quote-status-state-fsm.mjs +103 -0
  71. package/dist/quote-status-manager/quote-status-state-fsm.mjs.map +1 -0
  72. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs +27 -0
  73. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs.map +1 -0
  74. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts +30 -0
  75. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts.map +1 -0
  76. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts +30 -0
  77. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts.map +1 -0
  78. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs +23 -0
  79. package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs.map +1 -0
  80. package/dist/quote-status-manager/quotes-status-manager.cjs +477 -0
  81. package/dist/quote-status-manager/quotes-status-manager.cjs.map +1 -0
  82. package/dist/quote-status-manager/quotes-status-manager.d.cts +124 -0
  83. package/dist/quote-status-manager/quotes-status-manager.d.cts.map +1 -0
  84. package/dist/quote-status-manager/quotes-status-manager.d.mts +124 -0
  85. package/dist/quote-status-manager/quotes-status-manager.d.mts.map +1 -0
  86. package/dist/quote-status-manager/quotes-status-manager.mjs +473 -0
  87. package/dist/quote-status-manager/quotes-status-manager.mjs.map +1 -0
  88. package/dist/quote-status-manager/types.cjs +8 -0
  89. package/dist/quote-status-manager/types.cjs.map +1 -0
  90. package/dist/quote-status-manager/types.d.cts +145 -0
  91. package/dist/quote-status-manager/types.d.cts.map +1 -0
  92. package/dist/quote-status-manager/types.d.mts +145 -0
  93. package/dist/quote-status-manager/types.d.mts.map +1 -0
  94. package/dist/quote-status-manager/types.mjs +6 -0
  95. package/dist/quote-status-manager/types.mjs.map +1 -0
  96. package/dist/quote-status-manager/utils.cjs +11 -0
  97. package/dist/quote-status-manager/utils.cjs.map +1 -0
  98. package/dist/quote-status-manager/utils.d.cts +7 -0
  99. package/dist/quote-status-manager/utils.d.cts.map +1 -0
  100. package/dist/quote-status-manager/utils.d.mts +7 -0
  101. package/dist/quote-status-manager/utils.d.mts.map +1 -0
  102. package/dist/quote-status-manager/utils.mjs +7 -0
  103. package/dist/quote-status-manager/utils.mjs.map +1 -0
  104. package/dist/quote-status-manager/validators.cjs +44 -0
  105. package/dist/quote-status-manager/validators.cjs.map +1 -0
  106. package/dist/quote-status-manager/validators.d.cts +172 -0
  107. package/dist/quote-status-manager/validators.d.cts.map +1 -0
  108. package/dist/quote-status-manager/validators.d.mts +172 -0
  109. package/dist/quote-status-manager/validators.d.mts.map +1 -0
  110. package/dist/quote-status-manager/validators.mjs +39 -0
  111. package/dist/quote-status-manager/validators.mjs.map +1 -0
  112. package/dist/types.cjs +2 -0
  113. package/dist/types.cjs.map +1 -1
  114. package/dist/types.d.cts +15 -3
  115. package/dist/types.d.cts.map +1 -1
  116. package/dist/types.d.mts +15 -3
  117. package/dist/types.d.mts.map +1 -1
  118. package/dist/types.mjs +2 -0
  119. package/dist/types.mjs.map +1 -1
  120. package/dist/utils/history.cjs +1 -0
  121. package/dist/utils/history.cjs.map +1 -1
  122. package/dist/utils/history.d.cts.map +1 -1
  123. package/dist/utils/history.d.mts.map +1 -1
  124. package/dist/utils/history.mjs +1 -0
  125. package/dist/utils/history.mjs.map +1 -1
  126. package/package.json +1 -1
@@ -0,0 +1,145 @@
1
+ import { BridgeClientId } from "@metamask/bridge-controller";
2
+ import { Infer } from "@metamask/superstruct";
3
+ import { BridgeStatusControllerMessenger } from "../types.cjs";
4
+ import { QuoteStatusState, QuoteStatusUpdateBackendErrorType } from "./constants.cjs";
5
+ import { QuoteStatusGetError, QuoteStatusUpdateError } from "./errors.cjs";
6
+ import { QuoteStatusStateFsm } from "./quote-status-state-fsm.cjs";
7
+ import { QuoteStatusGetResponseSchema, QuoteStatusUpdateResponseSchema } from "./validators.cjs";
8
+ /**
9
+ * Persisted queue entry describing a single quote status update attempt.
10
+ */
11
+ export type QuoteStatusPersistEntry = {
12
+ /**
13
+ * Unique quote identifier.
14
+ */
15
+ quoteId: string;
16
+ /**
17
+ * Source transaction hash used to correlate updates.
18
+ */
19
+ srcTxHash: string;
20
+ /**
21
+ * Current persisted status lifecycle value.
22
+ */
23
+ status: QuoteStatusState;
24
+ /**
25
+ * Timestamp in milliseconds when the entry was first created.
26
+ */
27
+ createdAt: number;
28
+ /**
29
+ * Timestamp in milliseconds for the most recent attempt.
30
+ */
31
+ lastAttemptAt: number;
32
+ /**
33
+ * Optional transaction metadata identifier assigned after submission.
34
+ */
35
+ txMetaId?: string;
36
+ /**
37
+ * The lifecycle status most recently accepted (2xx) by the backend, if any.
38
+ *
39
+ * Used to avoid redundantly re-sending a status the backend has already
40
+ * acknowledged. In particular, a `Submitted` entry stays tracked while it
41
+ * awaits finalization, and this flag stops the retry loop from re-sending the
42
+ * already-accepted `SUBMITTED` update (which the backend would reject as an
43
+ * invalid/duplicate transition). It is implicitly superseded once the status
44
+ * advances past it (e.g. via {@link QuoteStatusUpdateManager.reportFinalised}).
45
+ */
46
+ acknowledgedState?: QuoteStatusState;
47
+ };
48
+ /**
49
+ * In-memory queue entry with an FSM instance for status transitions.
50
+ */
51
+ export type QuoteStatusRuntimeEntry = Omit<QuoteStatusPersistEntry, 'status'> & {
52
+ /**
53
+ * Runtime status FSM used to validate and apply transitions.
54
+ */
55
+ status: QuoteStatusStateFsm;
56
+ };
57
+ /**
58
+ * Validated non-`2xx` response payload from the quote update status API.
59
+ */
60
+ export type QuoteStatusUpdateResponse = Infer<typeof QuoteStatusUpdateResponseSchema>;
61
+ /**
62
+ * Validated non-`2xx` response payload from the quote get status API.
63
+ */
64
+ export type QuoteStatusGetResponse = Infer<typeof QuoteStatusGetResponseSchema>;
65
+ /**
66
+ * Options required to create quote status API service instances.
67
+ */
68
+ export type QuoteStatusApiServiceOptions = {
69
+ /**
70
+ * Messenger used to retrieve the authentication token.
71
+ */
72
+ messenger: BridgeStatusControllerMessenger;
73
+ /**
74
+ * Bridge client identifier used for request headers.
75
+ */
76
+ clientId: BridgeClientId;
77
+ /**
78
+ * Product name sent as the `x-metamask-clientproduct` header.
79
+ */
80
+ clientProduct: string;
81
+ /**
82
+ * Optional client version sent as the `x-metamask-clientversion` header.
83
+ */
84
+ clientVersion?: string;
85
+ /**
86
+ * Base URL for the quote status API.
87
+ */
88
+ apiBaseUrl: string;
89
+ /**
90
+ * Optional callback invoked when an unexpected error response shape is returned.
91
+ */
92
+ onError?: (error: QuoteStatusUpdateError | QuoteStatusGetError) => void;
93
+ };
94
+ /**
95
+ * Context information attached to a {@link QuoteStatusUpdateError}.
96
+ */
97
+ export type QuoteStatusUpdateErrorDetails = {
98
+ /**
99
+ * Unique quote identifier associated with the error.
100
+ */
101
+ quoteId: string;
102
+ /**
103
+ * Optional error type used to categorize known quote update failures.
104
+ */
105
+ errorType?: QuoteStatusUpdateBackendErrorType;
106
+ };
107
+ /**
108
+ * Context information attached to a {@link QuoteStatusGetError}.
109
+ */
110
+ export type QuoteStatusGetErrorDetails = {
111
+ /**
112
+ * Unique quote identifier associated with the error.
113
+ */
114
+ quoteId: string;
115
+ validationFailures?: string[];
116
+ };
117
+ /**
118
+ * Construction options for quote status entry store instances.
119
+ */
120
+ export type QuoteStatusEntryStoreOptions = {
121
+ /**
122
+ * Callback used to persist the current in-memory queue snapshot.
123
+ */
124
+ onPersistUpdates: (updates: Record<string, QuoteStatusPersistEntry>) => void;
125
+ /**
126
+ * Entry time-to-live in milliseconds before automatic eviction.
127
+ */
128
+ entryTtlMs: number;
129
+ /**
130
+ * Optional initial persisted entries used to seed the store.
131
+ */
132
+ initial?: Record<string, QuoteStatusPersistEntry>;
133
+ };
134
+ /**
135
+ * Event payload emitted whenever the FSM state changes.
136
+ */
137
+ export type QuoteStatusStateUpdateEvent = {
138
+ previousState: QuoteStatusState;
139
+ nextState: QuoteStatusState;
140
+ };
141
+ /**
142
+ * Listener signature for quote-status state changes.
143
+ */
144
+ export type QuoteStatusStateUpdateListener = (event: QuoteStatusStateUpdateEvent) => void;
145
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/quote-status-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oCAAoC;AAC7D,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAC3D,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EAClC,wBAAoB;AACrB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAiB;AACvE,OAAO,EAAE,mBAAmB,EAAE,qCAAiC;AAC/D,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAChC,yBAAqB;AAEtB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,uBAAuB,EACvB,QAAQ,CACT,GAAG;IACF;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,SAAS,EAAE,+BAA+B,CAAC;IAE3C;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,GAAG,mBAAmB,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,iCAAiC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,IAAI,CAAC;IAC7E;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,KAAK,EAAE,2BAA2B,KAC/B,IAAI,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { BridgeClientId } from "@metamask/bridge-controller";
2
+ import { Infer } from "@metamask/superstruct";
3
+ import { BridgeStatusControllerMessenger } from "../types.mjs";
4
+ import { QuoteStatusState, QuoteStatusUpdateBackendErrorType } from "./constants.mjs";
5
+ import { QuoteStatusGetError, QuoteStatusUpdateError } from "./errors.mjs";
6
+ import { QuoteStatusStateFsm } from "./quote-status-state-fsm.mjs";
7
+ import { QuoteStatusGetResponseSchema, QuoteStatusUpdateResponseSchema } from "./validators.mjs";
8
+ /**
9
+ * Persisted queue entry describing a single quote status update attempt.
10
+ */
11
+ export type QuoteStatusPersistEntry = {
12
+ /**
13
+ * Unique quote identifier.
14
+ */
15
+ quoteId: string;
16
+ /**
17
+ * Source transaction hash used to correlate updates.
18
+ */
19
+ srcTxHash: string;
20
+ /**
21
+ * Current persisted status lifecycle value.
22
+ */
23
+ status: QuoteStatusState;
24
+ /**
25
+ * Timestamp in milliseconds when the entry was first created.
26
+ */
27
+ createdAt: number;
28
+ /**
29
+ * Timestamp in milliseconds for the most recent attempt.
30
+ */
31
+ lastAttemptAt: number;
32
+ /**
33
+ * Optional transaction metadata identifier assigned after submission.
34
+ */
35
+ txMetaId?: string;
36
+ /**
37
+ * The lifecycle status most recently accepted (2xx) by the backend, if any.
38
+ *
39
+ * Used to avoid redundantly re-sending a status the backend has already
40
+ * acknowledged. In particular, a `Submitted` entry stays tracked while it
41
+ * awaits finalization, and this flag stops the retry loop from re-sending the
42
+ * already-accepted `SUBMITTED` update (which the backend would reject as an
43
+ * invalid/duplicate transition). It is implicitly superseded once the status
44
+ * advances past it (e.g. via {@link QuoteStatusUpdateManager.reportFinalised}).
45
+ */
46
+ acknowledgedState?: QuoteStatusState;
47
+ };
48
+ /**
49
+ * In-memory queue entry with an FSM instance for status transitions.
50
+ */
51
+ export type QuoteStatusRuntimeEntry = Omit<QuoteStatusPersistEntry, 'status'> & {
52
+ /**
53
+ * Runtime status FSM used to validate and apply transitions.
54
+ */
55
+ status: QuoteStatusStateFsm;
56
+ };
57
+ /**
58
+ * Validated non-`2xx` response payload from the quote update status API.
59
+ */
60
+ export type QuoteStatusUpdateResponse = Infer<typeof QuoteStatusUpdateResponseSchema>;
61
+ /**
62
+ * Validated non-`2xx` response payload from the quote get status API.
63
+ */
64
+ export type QuoteStatusGetResponse = Infer<typeof QuoteStatusGetResponseSchema>;
65
+ /**
66
+ * Options required to create quote status API service instances.
67
+ */
68
+ export type QuoteStatusApiServiceOptions = {
69
+ /**
70
+ * Messenger used to retrieve the authentication token.
71
+ */
72
+ messenger: BridgeStatusControllerMessenger;
73
+ /**
74
+ * Bridge client identifier used for request headers.
75
+ */
76
+ clientId: BridgeClientId;
77
+ /**
78
+ * Product name sent as the `x-metamask-clientproduct` header.
79
+ */
80
+ clientProduct: string;
81
+ /**
82
+ * Optional client version sent as the `x-metamask-clientversion` header.
83
+ */
84
+ clientVersion?: string;
85
+ /**
86
+ * Base URL for the quote status API.
87
+ */
88
+ apiBaseUrl: string;
89
+ /**
90
+ * Optional callback invoked when an unexpected error response shape is returned.
91
+ */
92
+ onError?: (error: QuoteStatusUpdateError | QuoteStatusGetError) => void;
93
+ };
94
+ /**
95
+ * Context information attached to a {@link QuoteStatusUpdateError}.
96
+ */
97
+ export type QuoteStatusUpdateErrorDetails = {
98
+ /**
99
+ * Unique quote identifier associated with the error.
100
+ */
101
+ quoteId: string;
102
+ /**
103
+ * Optional error type used to categorize known quote update failures.
104
+ */
105
+ errorType?: QuoteStatusUpdateBackendErrorType;
106
+ };
107
+ /**
108
+ * Context information attached to a {@link QuoteStatusGetError}.
109
+ */
110
+ export type QuoteStatusGetErrorDetails = {
111
+ /**
112
+ * Unique quote identifier associated with the error.
113
+ */
114
+ quoteId: string;
115
+ validationFailures?: string[];
116
+ };
117
+ /**
118
+ * Construction options for quote status entry store instances.
119
+ */
120
+ export type QuoteStatusEntryStoreOptions = {
121
+ /**
122
+ * Callback used to persist the current in-memory queue snapshot.
123
+ */
124
+ onPersistUpdates: (updates: Record<string, QuoteStatusPersistEntry>) => void;
125
+ /**
126
+ * Entry time-to-live in milliseconds before automatic eviction.
127
+ */
128
+ entryTtlMs: number;
129
+ /**
130
+ * Optional initial persisted entries used to seed the store.
131
+ */
132
+ initial?: Record<string, QuoteStatusPersistEntry>;
133
+ };
134
+ /**
135
+ * Event payload emitted whenever the FSM state changes.
136
+ */
137
+ export type QuoteStatusStateUpdateEvent = {
138
+ previousState: QuoteStatusState;
139
+ nextState: QuoteStatusState;
140
+ };
141
+ /**
142
+ * Listener signature for quote-status state changes.
143
+ */
144
+ export type QuoteStatusStateUpdateListener = (event: QuoteStatusStateUpdateEvent) => void;
145
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/quote-status-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oCAAoC;AAC7D,OAAO,EAAE,KAAK,EAAE,8BAA8B;AAE9C,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAC3D,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EAClC,wBAAoB;AACrB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAiB;AACvE,OAAO,EAAE,mBAAmB,EAAE,qCAAiC;AAC/D,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAChC,yBAAqB;AAEtB;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,gBAAgB,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACxC,uBAAuB,EACvB,QAAQ,CACT,GAAG;IACF;;OAEG;IACH,MAAM,EAAE,mBAAmB,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,OAAO,+BAA+B,CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,SAAS,EAAE,+BAA+B,CAAC;IAE3C;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;IAEzB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,GAAG,mBAAmB,KAAK,IAAI,CAAC;CACzE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,iCAAiC,CAAC;CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC;;OAEG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,KAAK,IAAI,CAAC;IAC7E;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;CACnD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,aAAa,EAAE,gBAAgB,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,CAC3C,KAAK,EAAE,2BAA2B,KAC/B,IAAI,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { BridgeClientId } from "@metamask/bridge-controller";
2
+ import { QuoteStatusState, QuoteStatusUpdateBackendErrorType } from "./constants.mjs";
3
+ import { QuoteStatusGetError, QuoteStatusUpdateError } from "./errors.mjs";
4
+ import { QuoteStatusStateFsm } from "./quote-status-state-fsm.mjs";
5
+ import { QuoteStatusGetResponseSchema, QuoteStatusUpdateResponseSchema } from "./validators.mjs";
6
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/quote-status-manager/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oCAAoC;AAI7D,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EAClC,wBAAoB;AACrB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,qBAAiB;AACvE,OAAO,EAAE,mBAAmB,EAAE,qCAAiC;AAC/D,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAChC,yBAAqB","sourcesContent":["import { BridgeClientId } from '@metamask/bridge-controller';\nimport { Infer } from '@metamask/superstruct';\n\nimport { BridgeStatusControllerMessenger } from '../types';\nimport {\n QuoteStatusState,\n QuoteStatusUpdateBackendErrorType,\n} from './constants';\nimport { QuoteStatusGetError, QuoteStatusUpdateError } from './errors';\nimport { QuoteStatusStateFsm } from './quote-status-state-fsm';\nimport {\n QuoteStatusGetResponseSchema,\n QuoteStatusUpdateResponseSchema,\n} from './validators';\n\n/**\n * Persisted queue entry describing a single quote status update attempt.\n */\nexport type QuoteStatusPersistEntry = {\n /**\n * Unique quote identifier.\n */\n quoteId: string;\n\n /**\n * Source transaction hash used to correlate updates.\n */\n srcTxHash: string;\n\n /**\n * Current persisted status lifecycle value.\n */\n status: QuoteStatusState;\n\n /**\n * Timestamp in milliseconds when the entry was first created.\n */\n createdAt: number;\n\n /**\n * Timestamp in milliseconds for the most recent attempt.\n */\n lastAttemptAt: number;\n\n /**\n * Optional transaction metadata identifier assigned after submission.\n */\n txMetaId?: string;\n\n /**\n * The lifecycle status most recently accepted (2xx) by the backend, if any.\n *\n * Used to avoid redundantly re-sending a status the backend has already\n * acknowledged. In particular, a `Submitted` entry stays tracked while it\n * awaits finalization, and this flag stops the retry loop from re-sending the\n * already-accepted `SUBMITTED` update (which the backend would reject as an\n * invalid/duplicate transition). It is implicitly superseded once the status\n * advances past it (e.g. via {@link QuoteStatusUpdateManager.reportFinalised}).\n */\n acknowledgedState?: QuoteStatusState;\n};\n\n/**\n * In-memory queue entry with an FSM instance for status transitions.\n */\nexport type QuoteStatusRuntimeEntry = Omit<\n QuoteStatusPersistEntry,\n 'status'\n> & {\n /**\n * Runtime status FSM used to validate and apply transitions.\n */\n status: QuoteStatusStateFsm;\n};\n\n/**\n * Validated non-`2xx` response payload from the quote update status API.\n */\nexport type QuoteStatusUpdateResponse = Infer<\n typeof QuoteStatusUpdateResponseSchema\n>;\n\n/**\n * Validated non-`2xx` response payload from the quote get status API.\n */\nexport type QuoteStatusGetResponse = Infer<typeof QuoteStatusGetResponseSchema>;\n\n/**\n * Options required to create quote status API service instances.\n */\nexport type QuoteStatusApiServiceOptions = {\n /**\n * Messenger used to retrieve the authentication token.\n */\n messenger: BridgeStatusControllerMessenger;\n\n /**\n * Bridge client identifier used for request headers.\n */\n clientId: BridgeClientId;\n\n /**\n * Product name sent as the `x-metamask-clientproduct` header.\n */\n clientProduct: string;\n\n /**\n * Optional client version sent as the `x-metamask-clientversion` header.\n */\n clientVersion?: string;\n\n /**\n * Base URL for the quote status API.\n */\n apiBaseUrl: string;\n\n /**\n * Optional callback invoked when an unexpected error response shape is returned.\n */\n onError?: (error: QuoteStatusUpdateError | QuoteStatusGetError) => void;\n};\n\n/**\n * Context information attached to a {@link QuoteStatusUpdateError}.\n */\nexport type QuoteStatusUpdateErrorDetails = {\n /**\n * Unique quote identifier associated with the error.\n */\n quoteId: string;\n\n /**\n * Optional error type used to categorize known quote update failures.\n */\n errorType?: QuoteStatusUpdateBackendErrorType;\n};\n\n/**\n * Context information attached to a {@link QuoteStatusGetError}.\n */\nexport type QuoteStatusGetErrorDetails = {\n /**\n * Unique quote identifier associated with the error.\n */\n quoteId: string;\n\n validationFailures?: string[];\n};\n\n/**\n * Construction options for quote status entry store instances.\n */\nexport type QuoteStatusEntryStoreOptions = {\n /**\n * Callback used to persist the current in-memory queue snapshot.\n */\n onPersistUpdates: (updates: Record<string, QuoteStatusPersistEntry>) => void;\n /**\n * Entry time-to-live in milliseconds before automatic eviction.\n */\n entryTtlMs: number;\n\n /**\n * Optional initial persisted entries used to seed the store.\n */\n initial?: Record<string, QuoteStatusPersistEntry>;\n};\n\n/**\n * Event payload emitted whenever the FSM state changes.\n */\nexport type QuoteStatusStateUpdateEvent = {\n previousState: QuoteStatusState;\n nextState: QuoteStatusState;\n};\n\n/**\n * Listener signature for quote-status state changes.\n */\nexport type QuoteStatusStateUpdateListener = (\n event: QuoteStatusStateUpdateEvent,\n) => void;\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ /**
5
+ * Returns a promise that resolves after the given number of milliseconds.
6
+ *
7
+ * @param ms - The number of milliseconds to wait before resolving.
8
+ */
9
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
10
+ exports.sleep = sleep;
11
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../src/quote-status-manager/utils.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CACjD,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAD7C,QAAA,KAAK,SACwC","sourcesContent":["/**\n * Returns a promise that resolves after the given number of milliseconds.\n *\n * @param ms - The number of milliseconds to wait before resolving.\n */\nexport const sleep = (ms: number): Promise<void> =>\n new Promise<void>((resolve) => setTimeout(resolve, ms));\n"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns a promise that resolves after the given number of milliseconds.
3
+ *
4
+ * @param ms - The number of milliseconds to wait before resolving.
5
+ */
6
+ export declare const sleep: (ms: number) => Promise<void>;
7
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../src/quote-status-manager/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,KAAK,OAAQ,MAAM,KAAG,QAAQ,IAAI,CACU,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns a promise that resolves after the given number of milliseconds.
3
+ *
4
+ * @param ms - The number of milliseconds to wait before resolving.
5
+ */
6
+ export declare const sleep: (ms: number) => Promise<void>;
7
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../src/quote-status-manager/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,KAAK,OAAQ,MAAM,KAAG,QAAQ,IAAI,CACU,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Returns a promise that resolves after the given number of milliseconds.
3
+ *
4
+ * @param ms - The number of milliseconds to wait before resolving.
5
+ */
6
+ export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
7
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../src/quote-status-manager/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CACjD,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Returns a promise that resolves after the given number of milliseconds.\n *\n * @param ms - The number of milliseconds to wait before resolving.\n */\nexport const sleep = (ms: number): Promise<void> =>\n new Promise<void>((resolve) => setTimeout(resolve, ms));\n"]}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateQuoteStatusGetResponse = exports.QuoteStatusGetResponseSchema = exports.validateQuoteStatusUpdateResponse = exports.QuoteStatusUpdateResponseSchema = void 0;
4
+ const superstruct_1 = require("@metamask/superstruct");
5
+ const validators_1 = require("../utils/validators.cjs");
6
+ const constants_1 = require("./constants.cjs");
7
+ const QuoteStatusUpdateResponseWithCurrentStatusSchema = (0, superstruct_1.type)({
8
+ statusCode: (0, superstruct_1.number)(),
9
+ message: (0, superstruct_1.string)(),
10
+ type: (0, superstruct_1.enums)(constants_1.QuoteStatusUpdateBackendOnChainMismatchTypes),
11
+ currentStatus: (0, superstruct_1.enums)(constants_1.QuoteStatusBackendValues),
12
+ newStatus: (0, superstruct_1.enums)(constants_1.QuoteStatusBackendValues),
13
+ });
14
+ const QuoteStatusUpdateResponseBaseSchema = (0, superstruct_1.type)({
15
+ statusCode: (0, superstruct_1.number)(),
16
+ message: (0, superstruct_1.string)(),
17
+ type: (0, superstruct_1.enums)(constants_1.BaseQuoteStatusUpdateErrorTypes),
18
+ });
19
+ exports.QuoteStatusUpdateResponseSchema = (0, superstruct_1.union)([
20
+ QuoteStatusUpdateResponseWithCurrentStatusSchema,
21
+ QuoteStatusUpdateResponseBaseSchema,
22
+ ]);
23
+ function validateQuoteStatusUpdateResponse(data) {
24
+ (0, superstruct_1.assert)(data, exports.QuoteStatusUpdateResponseSchema);
25
+ }
26
+ exports.validateQuoteStatusUpdateResponse = validateQuoteStatusUpdateResponse;
27
+ /**
28
+ * **Note**: This struct is big and not all fields are used atm.
29
+ * For that reason we have decided to only include the fields we
30
+ * consume in production. In the future, once we need it to be strongly type,
31
+ * we will refactor.
32
+ */
33
+ exports.QuoteStatusGetResponseSchema = (0, superstruct_1.type)({
34
+ /**
35
+ * Submitted transaction: StatusResponseDto with at least srcChain (chainId + txHash).
36
+ * Prefilled by updateQuoteStatus; replaced with full provider status by getQuoteStatus.
37
+ */
38
+ submittedTx: (0, superstruct_1.optional)(validators_1.StatusResponseSchema),
39
+ });
40
+ function validateQuoteStatusGetResponse(data) {
41
+ (0, superstruct_1.assert)(data, exports.QuoteStatusGetResponseSchema);
42
+ }
43
+ exports.validateQuoteStatusGetResponse = validateQuoteStatusGetResponse;
44
+ //# sourceMappingURL=validators.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.cjs","sourceRoot":"","sources":["../../src/quote-status-manager/validators.ts"],"names":[],"mappings":";;;AAAA,uDAQ+B;AAE/B,wDAA2D;AAC3D,+CAIqB;AAGrB,MAAM,gDAAgD,GAAG,IAAA,kBAAI,EAAC;IAC5D,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB,OAAO,EAAE,IAAA,oBAAM,GAAE;IACjB,IAAI,EAAE,IAAA,mBAAK,EAAC,wDAA4C,CAAC;IACzD,aAAa,EAAE,IAAA,mBAAK,EAAC,oCAAwB,CAAC;IAC9C,SAAS,EAAE,IAAA,mBAAK,EAAC,oCAAwB,CAAC;CAC3C,CAAC,CAAC;AAEH,MAAM,mCAAmC,GAAG,IAAA,kBAAI,EAAC;IAC/C,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB,OAAO,EAAE,IAAA,oBAAM,GAAE;IACjB,IAAI,EAAE,IAAA,mBAAK,EAAC,2CAA+B,CAAC;CAC7C,CAAC,CAAC;AAEU,QAAA,+BAA+B,GAAG,IAAA,mBAAK,EAAC;IACnD,gDAAgD;IAChD,mCAAmC;CACpC,CAAC,CAAC;AAEH,SAAgB,iCAAiC,CAC/C,IAAa;IAEb,IAAA,oBAAM,EAAC,IAAI,EAAE,uCAA+B,CAAC,CAAC;AAChD,CAAC;AAJD,8EAIC;AAED;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,IAAA,kBAAI,EAAC;IAC/C;;;OAGG;IACH,WAAW,EAAE,IAAA,sBAAQ,EAAC,iCAAoB,CAAC;CAC5C,CAAC,CAAC;AAEH,SAAgB,8BAA8B,CAC5C,IAAa;IAEb,IAAA,oBAAM,EAAC,IAAI,EAAE,oCAA4B,CAAC,CAAC;AAC7C,CAAC;AAJD,wEAIC","sourcesContent":["import {\n string,\n number,\n enums,\n union,\n type,\n assert,\n optional,\n} from '@metamask/superstruct';\n\nimport { StatusResponseSchema } from '../utils/validators';\nimport {\n BaseQuoteStatusUpdateErrorTypes,\n QuoteStatusUpdateBackendOnChainMismatchTypes,\n QuoteStatusBackendValues,\n} from './constants';\nimport { QuoteStatusGetResponse, QuoteStatusUpdateResponse } from './types';\n\nconst QuoteStatusUpdateResponseWithCurrentStatusSchema = type({\n statusCode: number(),\n message: string(),\n type: enums(QuoteStatusUpdateBackendOnChainMismatchTypes),\n currentStatus: enums(QuoteStatusBackendValues),\n newStatus: enums(QuoteStatusBackendValues),\n});\n\nconst QuoteStatusUpdateResponseBaseSchema = type({\n statusCode: number(),\n message: string(),\n type: enums(BaseQuoteStatusUpdateErrorTypes),\n});\n\nexport const QuoteStatusUpdateResponseSchema = union([\n QuoteStatusUpdateResponseWithCurrentStatusSchema,\n QuoteStatusUpdateResponseBaseSchema,\n]);\n\nexport function validateQuoteStatusUpdateResponse(\n data: unknown,\n): asserts data is QuoteStatusUpdateResponse {\n assert(data, QuoteStatusUpdateResponseSchema);\n}\n\n/**\n * **Note**: This struct is big and not all fields are used atm.\n * For that reason we have decided to only include the fields we\n * consume in production. In the future, once we need it to be strongly type,\n * we will refactor.\n */\nexport const QuoteStatusGetResponseSchema = type({\n /**\n * Submitted transaction: StatusResponseDto with at least srcChain (chainId + txHash).\n * Prefilled by updateQuoteStatus; replaced with full provider status by getQuoteStatus.\n */\n submittedTx: optional(StatusResponseSchema),\n});\n\nexport function validateQuoteStatusGetResponse(\n data: unknown,\n): asserts data is QuoteStatusGetResponse {\n assert(data, QuoteStatusGetResponseSchema);\n}\n"]}
@@ -0,0 +1,172 @@
1
+ import { QuoteStatusGetResponse, QuoteStatusUpdateResponse } from "./types.cjs";
2
+ export declare const QuoteStatusUpdateResponseSchema: import("@metamask/superstruct").Struct<{
3
+ type: import("./constants.cjs").QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch;
4
+ message: string;
5
+ statusCode: number;
6
+ currentStatus: import("./constants.cjs").QuoteStatusBackendStatus;
7
+ newStatus: import("./constants.cjs").QuoteStatusBackendStatus;
8
+ } | {
9
+ type: import("./constants.cjs").QuoteStatusUpdateBackendErrorType.QuoteNotFound | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.ConcurrentUpdate | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.SrcTxHashRequiredForFinalized | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.PersistQuoteStatusFailed | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.TransactionNotIndexed | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.TxDataMissingHash | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.TxDataMissingTrade | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.TxDataMismatch | import("./constants.cjs").QuoteStatusUpdateBackendErrorType.SvmTradeDeserializeFailed;
10
+ message: string;
11
+ statusCode: number;
12
+ }, null>;
13
+ export declare function validateQuoteStatusUpdateResponse(data: unknown): asserts data is QuoteStatusUpdateResponse;
14
+ /**
15
+ * **Note**: This struct is big and not all fields are used atm.
16
+ * For that reason we have decided to only include the fields we
17
+ * consume in production. In the future, once we need it to be strongly type,
18
+ * we will refactor.
19
+ */
20
+ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct").Struct<{
21
+ submittedTx?: {
22
+ status: import("@metamask/bridge-controller").StatusTypes;
23
+ srcChain: {
24
+ chainId: number;
25
+ txHash?: string | undefined;
26
+ amount?: string | undefined;
27
+ token?: {} | {
28
+ symbol: string;
29
+ chainId: number;
30
+ address: string;
31
+ assetId: `${string}:${string}/${string}:${string}`;
32
+ name: string;
33
+ decimals: number;
34
+ icon?: string | null | undefined;
35
+ iconUrl?: string | null | undefined;
36
+ } | undefined;
37
+ };
38
+ destChain?: {
39
+ chainId: number;
40
+ txHash?: string | undefined;
41
+ amount?: string | undefined;
42
+ token?: {} | {
43
+ symbol: string;
44
+ chainId: number;
45
+ address: string;
46
+ assetId: `${string}:${string}/${string}:${string}`;
47
+ name: string;
48
+ decimals: number;
49
+ icon?: string | null | undefined;
50
+ iconUrl?: string | null | undefined;
51
+ } | undefined;
52
+ } | undefined;
53
+ bridge?: string | undefined;
54
+ isExpectedToken?: boolean | undefined;
55
+ isUnrecognizedRouterAddress?: boolean | undefined;
56
+ refuel?: {} | undefined;
57
+ } | undefined;
58
+ }, {
59
+ /**
60
+ * Submitted transaction: StatusResponseDto with at least srcChain (chainId + txHash).
61
+ * Prefilled by updateQuoteStatus; replaced with full provider status by getQuoteStatus.
62
+ */
63
+ submittedTx: import("@metamask/superstruct").Struct<{
64
+ status: import("@metamask/bridge-controller").StatusTypes;
65
+ srcChain: {
66
+ chainId: number;
67
+ txHash?: string | undefined;
68
+ amount?: string | undefined;
69
+ token?: {} | {
70
+ symbol: string;
71
+ chainId: number;
72
+ address: string;
73
+ assetId: `${string}:${string}/${string}:${string}`;
74
+ name: string;
75
+ decimals: number;
76
+ icon?: string | null | undefined;
77
+ iconUrl?: string | null | undefined;
78
+ } | undefined;
79
+ };
80
+ destChain?: {
81
+ chainId: number;
82
+ txHash?: string | undefined;
83
+ amount?: string | undefined;
84
+ token?: {} | {
85
+ symbol: string;
86
+ chainId: number;
87
+ address: string;
88
+ assetId: `${string}:${string}/${string}:${string}`;
89
+ name: string;
90
+ decimals: number;
91
+ icon?: string | null | undefined;
92
+ iconUrl?: string | null | undefined;
93
+ } | undefined;
94
+ } | undefined;
95
+ bridge?: string | undefined;
96
+ isExpectedToken?: boolean | undefined;
97
+ isUnrecognizedRouterAddress?: boolean | undefined;
98
+ refuel?: {} | undefined;
99
+ } | undefined, {
100
+ status: import("@metamask/superstruct").Struct<import("@metamask/bridge-controller").StatusTypes, {
101
+ SUBMITTED: import("@metamask/bridge-controller").StatusTypes.SUBMITTED;
102
+ UNKNOWN: import("@metamask/bridge-controller").StatusTypes.UNKNOWN;
103
+ FAILED: import("@metamask/bridge-controller").StatusTypes.FAILED;
104
+ PENDING: import("@metamask/bridge-controller").StatusTypes.PENDING;
105
+ COMPLETE: import("@metamask/bridge-controller").StatusTypes.COMPLETE;
106
+ }>;
107
+ srcChain: import("@metamask/superstruct").Struct<{
108
+ chainId: number;
109
+ txHash?: string | undefined;
110
+ amount?: string | undefined;
111
+ token?: {} | {
112
+ symbol: string;
113
+ chainId: number;
114
+ address: string;
115
+ assetId: `${string}:${string}/${string}:${string}`;
116
+ name: string;
117
+ decimals: number;
118
+ icon?: string | null | undefined;
119
+ iconUrl?: string | null | undefined;
120
+ } | undefined;
121
+ }, {
122
+ chainId: import("@metamask/superstruct").Struct<number, null>;
123
+ txHash: import("@metamask/superstruct").Struct<string | undefined, null>;
124
+ amount: import("@metamask/superstruct").Struct<string | undefined, null>;
125
+ token: import("@metamask/superstruct").Struct<{} | {
126
+ symbol: string;
127
+ chainId: number;
128
+ address: string;
129
+ assetId: `${string}:${string}/${string}:${string}`;
130
+ name: string;
131
+ decimals: number;
132
+ icon?: string | null | undefined;
133
+ iconUrl?: string | null | undefined;
134
+ } | undefined, null>;
135
+ }>;
136
+ destChain: import("@metamask/superstruct").Struct<{
137
+ chainId: number;
138
+ txHash?: string | undefined;
139
+ amount?: string | undefined;
140
+ token?: {} | {
141
+ symbol: string;
142
+ chainId: number;
143
+ address: string;
144
+ assetId: `${string}:${string}/${string}:${string}`;
145
+ name: string;
146
+ decimals: number;
147
+ icon?: string | null | undefined;
148
+ iconUrl?: string | null | undefined;
149
+ } | undefined;
150
+ } | undefined, {
151
+ chainId: import("@metamask/superstruct").Struct<number, null>;
152
+ txHash: import("@metamask/superstruct").Struct<string | undefined, null>;
153
+ amount: import("@metamask/superstruct").Struct<string | undefined, null>;
154
+ token: import("@metamask/superstruct").Struct<{} | {
155
+ symbol: string;
156
+ chainId: number;
157
+ address: string;
158
+ assetId: `${string}:${string}/${string}:${string}`;
159
+ name: string;
160
+ decimals: number;
161
+ icon?: string | null | undefined;
162
+ iconUrl?: string | null | undefined;
163
+ } | undefined, null>;
164
+ }>;
165
+ bridge: import("@metamask/superstruct").Struct<string | undefined, null>;
166
+ isExpectedToken: import("@metamask/superstruct").Struct<boolean | undefined, null>;
167
+ isUnrecognizedRouterAddress: import("@metamask/superstruct").Struct<boolean | undefined, null>;
168
+ refuel: import("@metamask/superstruct").Struct<{} | undefined, {}>;
169
+ }>;
170
+ }>;
171
+ export declare function validateQuoteStatusGetResponse(data: unknown): asserts data is QuoteStatusGetResponse;
172
+ //# sourceMappingURL=validators.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validators.d.cts","sourceRoot":"","sources":["../../src/quote-status-manager/validators.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,oBAAgB;AAgB5E,eAAO,MAAM,+BAA+B;;;;;;;;;;QAG1C,CAAC;AAEH,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,IAAI,yBAAyB,CAE3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACvC;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,IAAI,IAAI,sBAAsB,CAExC"}